This is the default implementation of a sharing provider. In most cases there
is no need to customize this, but to just use the defaultSharingProvider.
To handle sharing links correctly, the application should call the SharingProvider.getShareState of
the defaultSharingProvider and if an IShareState object is provided,
the host application should call the IVirtualStylingApi.show method providing
the share state.
Example
constvsc = ...; /// Get an IVirtualStylingBuilder instance constinformationProvider = ...; /// Get an IGarmentInformationProvider instance constorganizationId = "...."; constsharedState = awaitdefaultSharingProvider.getShareState(window.location.href); if (sharedState) { if (sharedState.type === "pictofit::virtualstyling::outfit" || sharedState.type === "pictofit::virtualstyling::style") { constreferenceId = typeofsharedState.collection === "string" ? sharedState.collection : sharedState.collection.reference; constorganizationId = typeofsharedState.collection === "string" ? undefined : (sharedState.collection.organizationId ?? organizationId); try { constresult = awaitvsc.getCollection(referenceId, organizationId); if (result === null) { thrownewError(`Failed to open shared link, collection not found!`); } (awaitvsc.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); } } }
This is the default implementation of a sharing provider. In most cases there is no need to customize this, but to just use the defaultSharingProvider.
To handle sharing links correctly, the application should call the SharingProvider.getShareState of the defaultSharingProvider and if an IShareState object is provided, the host application should call the IVirtualStylingApi.show method providing the share state.
Example