import { IShareState, ISharingProvider, ShareMechanism } from "../sharing"; /** * This is the default implementation of a sharing provider. In most cases there * is no need to customize this, but to just use the {@link defaultSharingProvider}. * * To handle sharing links correctly, the application should call the {@link SharingProvider.getShareState} of * the {@link defaultSharingProvider} and if an {@link IShareState} object is provided, * the host application should call the {@link IVirtualStylingApi.show} method providing * the share state. * * @group VSC * @group MDRC * * @example * * ```ts * const vsc = ...; /// Get an IVirtualStylingBuilder instance * const informationProvider = ...; /// Get an IGarmentInformationProvider instance * const organizationId = "...."; * const sharedState = await defaultSharingProvider.getShareState(window.location.href); * if (sharedState) { * if (sharedState.type === "pictofit::virtualstyling::outfit" || sharedState.type === "pictofit::virtualstyling::style") { * const referenceId = typeof sharedState.collection === "string" ? sharedState.collection : sharedState.collection.reference; * const organizationId = typeof sharedState.collection === "string" ? undefined : (sharedState.collection.organizationId ?? organizationId); * try { * const result = await vsc.getCollection(referenceId, organizationId); * if (result === null) { * throw new Error(`Failed to open shared link, collection not found!`); * } * (await vsc.build()).api.show(Promise.resolve(result), sharedState.collection, { * commerceProvider, * informationProvider: Promise.resolve(informationProvider), * sharedState * }); * } catch (e) { * console.error(`Failed to open shared link, collection not found!`, e); * } * } * } * ``` */ export declare class SharingProvider implements ISharingProvider { constructor(); getSharingLink(cfg: IShareState): Promise; shareLink(link: string): Promise; getShareState(url?: string): Promise; } /** * The unique instance of the default sharing provider. See {@link SharingProvider} */ export declare const defaultSharingProvider: SharingProvider;