@blotoutio/providers-blotout-wallet-sdk 1.20.1 → 1.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core.cjs.js +23 -19
- package/core.js +23 -19
- package/core.mjs +23 -19
- package/index.cjs.js +23 -19
- package/index.js +23 -19
- package/index.mjs +23 -19
- package/package.json +1 -1
package/core.cjs.js
CHANGED
@@ -715,35 +715,46 @@ const walletLogger = {
|
|
715
715
|
};
|
716
716
|
|
717
717
|
const init = (params) => {
|
718
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
718
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
719
|
+
var _j, _k;
|
719
720
|
if (typeof window == 'undefined' || typeof document == 'undefined') {
|
720
721
|
// if loaded in non-browser SDKs, return early
|
721
722
|
return;
|
722
723
|
}
|
723
|
-
|
724
|
-
|
725
|
-
storeAPI = window[registryKey].storeAPI =
|
726
|
-
(_b = (_a = window[registryKey]).storeAPIFactory) === null || _b === void 0 ? void 0 : _b.call(_a);
|
727
|
-
}
|
724
|
+
(_a = window[registryKey]) !== null && _a !== void 0 ? _a : (window[registryKey] = {});
|
725
|
+
const storeAPI = ((_b = (_j = window[registryKey]).storeAPI) !== null && _b !== void 0 ? _b : (_j.storeAPI = (_d = (_c = window[registryKey]).storeAPIFactory) === null || _d === void 0 ? void 0 : _d.call(_c)));
|
728
726
|
if (!storeAPI) {
|
729
727
|
walletLogger.error('Implementation for store API missing!');
|
730
728
|
return;
|
731
729
|
}
|
730
|
+
const walletAPI = ((_e = (_k = window[registryKey]).walletAPI) !== null && _e !== void 0 ? _e : (_k.walletAPI = createWalletAPI({
|
731
|
+
baseURL: params.baseUrl,
|
732
|
+
storeAPI,
|
733
|
+
userId: params.userId,
|
734
|
+
})));
|
732
735
|
if (window.top !== window) {
|
733
736
|
// exit if not in top window
|
734
737
|
return;
|
735
738
|
}
|
736
|
-
if (!isOnAllowedSubdomain(window.location.href, params.manifest.variables.siteDomain, (
|
739
|
+
if (!isOnAllowedSubdomain(window.location.href, params.manifest.variables.siteDomain, (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.disallowedSubdomains) !== null && _g !== void 0 ? _g : [])) {
|
737
740
|
walletLogger.error('Disabling cart recovery when not running on root domain');
|
738
741
|
return;
|
739
742
|
}
|
740
|
-
const { enabled, previewKey, mode = 'disabled', } = (
|
743
|
+
const { enabled, previewKey, mode = 'disabled', afterRestore, silentRestore, theme, } = (_h = params.manifest.variables) !== null && _h !== void 0 ? _h : {};
|
741
744
|
const experiment = createExperiment({
|
742
745
|
name: mode,
|
743
746
|
userId: params.userId,
|
744
747
|
previewKey,
|
745
748
|
userPreviewKey: getPreviewKey(),
|
746
749
|
});
|
750
|
+
window[registryKey].variables = {
|
751
|
+
experiment,
|
752
|
+
afterRestore: afterRestore !== null && afterRestore !== void 0 ? afterRestore : {
|
753
|
+
action: 'none',
|
754
|
+
},
|
755
|
+
enabled: enabled || experiment.isEnabled,
|
756
|
+
silentRestore: !!silentRestore,
|
757
|
+
};
|
747
758
|
if (experiment.name == 'preview') {
|
748
759
|
if (experiment.isEnabled) {
|
749
760
|
walletLogger.log('Previewing functionality using preview key');
|
@@ -758,17 +769,10 @@ const init = (params) => {
|
|
758
769
|
walletLogger.error('UI implementation is missing');
|
759
770
|
return;
|
760
771
|
}
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
});
|
766
|
-
uiImplementation.init({
|
767
|
-
theme: (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.theme) !== null && _g !== void 0 ? _g : {},
|
768
|
-
afterRestore: (_j = (_h = params.manifest.variables) === null || _h === void 0 ? void 0 : _h.afterRestore) !== null && _j !== void 0 ? _j : {
|
769
|
-
action: 'none',
|
770
|
-
},
|
771
|
-
silentRestore: !!((_k = params.manifest.variables) === null || _k === void 0 ? void 0 : _k.silentRestore),
|
772
|
+
uiImplementation === null || uiImplementation === void 0 ? void 0 : uiImplementation.init({
|
773
|
+
afterRestore: window[registryKey].variables.afterRestore,
|
774
|
+
silentRestore: window[registryKey].variables.silentRestore,
|
775
|
+
theme: theme !== null && theme !== void 0 ? theme : {},
|
772
776
|
walletAPI,
|
773
777
|
storeAPI,
|
774
778
|
});
|
package/core.js
CHANGED
@@ -716,35 +716,46 @@ var ProvidersBlotoutWalletSdk = (function () {
|
|
716
716
|
};
|
717
717
|
|
718
718
|
const init = (params) => {
|
719
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
719
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
720
|
+
var _j, _k;
|
720
721
|
if (typeof window == 'undefined' || typeof document == 'undefined') {
|
721
722
|
// if loaded in non-browser SDKs, return early
|
722
723
|
return;
|
723
724
|
}
|
724
|
-
|
725
|
-
|
726
|
-
storeAPI = window[registryKey].storeAPI =
|
727
|
-
(_b = (_a = window[registryKey]).storeAPIFactory) === null || _b === void 0 ? void 0 : _b.call(_a);
|
728
|
-
}
|
725
|
+
(_a = window[registryKey]) !== null && _a !== void 0 ? _a : (window[registryKey] = {});
|
726
|
+
const storeAPI = ((_b = (_j = window[registryKey]).storeAPI) !== null && _b !== void 0 ? _b : (_j.storeAPI = (_d = (_c = window[registryKey]).storeAPIFactory) === null || _d === void 0 ? void 0 : _d.call(_c)));
|
729
727
|
if (!storeAPI) {
|
730
728
|
walletLogger.error('Implementation for store API missing!');
|
731
729
|
return;
|
732
730
|
}
|
731
|
+
const walletAPI = ((_e = (_k = window[registryKey]).walletAPI) !== null && _e !== void 0 ? _e : (_k.walletAPI = createWalletAPI({
|
732
|
+
baseURL: params.baseUrl,
|
733
|
+
storeAPI,
|
734
|
+
userId: params.userId,
|
735
|
+
})));
|
733
736
|
if (window.top !== window) {
|
734
737
|
// exit if not in top window
|
735
738
|
return;
|
736
739
|
}
|
737
|
-
if (!isOnAllowedSubdomain(window.location.href, params.manifest.variables.siteDomain, (
|
740
|
+
if (!isOnAllowedSubdomain(window.location.href, params.manifest.variables.siteDomain, (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.disallowedSubdomains) !== null && _g !== void 0 ? _g : [])) {
|
738
741
|
walletLogger.error('Disabling cart recovery when not running on root domain');
|
739
742
|
return;
|
740
743
|
}
|
741
|
-
const { enabled, previewKey, mode = 'disabled', } = (
|
744
|
+
const { enabled, previewKey, mode = 'disabled', afterRestore, silentRestore, theme, } = (_h = params.manifest.variables) !== null && _h !== void 0 ? _h : {};
|
742
745
|
const experiment = createExperiment({
|
743
746
|
name: mode,
|
744
747
|
userId: params.userId,
|
745
748
|
previewKey,
|
746
749
|
userPreviewKey: getPreviewKey(),
|
747
750
|
});
|
751
|
+
window[registryKey].variables = {
|
752
|
+
experiment,
|
753
|
+
afterRestore: afterRestore !== null && afterRestore !== void 0 ? afterRestore : {
|
754
|
+
action: 'none',
|
755
|
+
},
|
756
|
+
enabled: enabled || experiment.isEnabled,
|
757
|
+
silentRestore: !!silentRestore,
|
758
|
+
};
|
748
759
|
if (experiment.name == 'preview') {
|
749
760
|
if (experiment.isEnabled) {
|
750
761
|
walletLogger.log('Previewing functionality using preview key');
|
@@ -759,17 +770,10 @@ var ProvidersBlotoutWalletSdk = (function () {
|
|
759
770
|
walletLogger.error('UI implementation is missing');
|
760
771
|
return;
|
761
772
|
}
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
});
|
767
|
-
uiImplementation.init({
|
768
|
-
theme: (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.theme) !== null && _g !== void 0 ? _g : {},
|
769
|
-
afterRestore: (_j = (_h = params.manifest.variables) === null || _h === void 0 ? void 0 : _h.afterRestore) !== null && _j !== void 0 ? _j : {
|
770
|
-
action: 'none',
|
771
|
-
},
|
772
|
-
silentRestore: !!((_k = params.manifest.variables) === null || _k === void 0 ? void 0 : _k.silentRestore),
|
773
|
+
uiImplementation === null || uiImplementation === void 0 ? void 0 : uiImplementation.init({
|
774
|
+
afterRestore: window[registryKey].variables.afterRestore,
|
775
|
+
silentRestore: window[registryKey].variables.silentRestore,
|
776
|
+
theme: theme !== null && theme !== void 0 ? theme : {},
|
773
777
|
walletAPI,
|
774
778
|
storeAPI,
|
775
779
|
});
|
package/core.mjs
CHANGED
@@ -713,35 +713,46 @@ const walletLogger = {
|
|
713
713
|
};
|
714
714
|
|
715
715
|
const init = (params) => {
|
716
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
716
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
717
|
+
var _j, _k;
|
717
718
|
if (typeof window == 'undefined' || typeof document == 'undefined') {
|
718
719
|
// if loaded in non-browser SDKs, return early
|
719
720
|
return;
|
720
721
|
}
|
721
|
-
|
722
|
-
|
723
|
-
storeAPI = window[registryKey].storeAPI =
|
724
|
-
(_b = (_a = window[registryKey]).storeAPIFactory) === null || _b === void 0 ? void 0 : _b.call(_a);
|
725
|
-
}
|
722
|
+
(_a = window[registryKey]) !== null && _a !== void 0 ? _a : (window[registryKey] = {});
|
723
|
+
const storeAPI = ((_b = (_j = window[registryKey]).storeAPI) !== null && _b !== void 0 ? _b : (_j.storeAPI = (_d = (_c = window[registryKey]).storeAPIFactory) === null || _d === void 0 ? void 0 : _d.call(_c)));
|
726
724
|
if (!storeAPI) {
|
727
725
|
walletLogger.error('Implementation for store API missing!');
|
728
726
|
return;
|
729
727
|
}
|
728
|
+
const walletAPI = ((_e = (_k = window[registryKey]).walletAPI) !== null && _e !== void 0 ? _e : (_k.walletAPI = createWalletAPI({
|
729
|
+
baseURL: params.baseUrl,
|
730
|
+
storeAPI,
|
731
|
+
userId: params.userId,
|
732
|
+
})));
|
730
733
|
if (window.top !== window) {
|
731
734
|
// exit if not in top window
|
732
735
|
return;
|
733
736
|
}
|
734
|
-
if (!isOnAllowedSubdomain(window.location.href, params.manifest.variables.siteDomain, (
|
737
|
+
if (!isOnAllowedSubdomain(window.location.href, params.manifest.variables.siteDomain, (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.disallowedSubdomains) !== null && _g !== void 0 ? _g : [])) {
|
735
738
|
walletLogger.error('Disabling cart recovery when not running on root domain');
|
736
739
|
return;
|
737
740
|
}
|
738
|
-
const { enabled, previewKey, mode = 'disabled', } = (
|
741
|
+
const { enabled, previewKey, mode = 'disabled', afterRestore, silentRestore, theme, } = (_h = params.manifest.variables) !== null && _h !== void 0 ? _h : {};
|
739
742
|
const experiment = createExperiment({
|
740
743
|
name: mode,
|
741
744
|
userId: params.userId,
|
742
745
|
previewKey,
|
743
746
|
userPreviewKey: getPreviewKey(),
|
744
747
|
});
|
748
|
+
window[registryKey].variables = {
|
749
|
+
experiment,
|
750
|
+
afterRestore: afterRestore !== null && afterRestore !== void 0 ? afterRestore : {
|
751
|
+
action: 'none',
|
752
|
+
},
|
753
|
+
enabled: enabled || experiment.isEnabled,
|
754
|
+
silentRestore: !!silentRestore,
|
755
|
+
};
|
745
756
|
if (experiment.name == 'preview') {
|
746
757
|
if (experiment.isEnabled) {
|
747
758
|
walletLogger.log('Previewing functionality using preview key');
|
@@ -756,17 +767,10 @@ const init = (params) => {
|
|
756
767
|
walletLogger.error('UI implementation is missing');
|
757
768
|
return;
|
758
769
|
}
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
});
|
764
|
-
uiImplementation.init({
|
765
|
-
theme: (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.theme) !== null && _g !== void 0 ? _g : {},
|
766
|
-
afterRestore: (_j = (_h = params.manifest.variables) === null || _h === void 0 ? void 0 : _h.afterRestore) !== null && _j !== void 0 ? _j : {
|
767
|
-
action: 'none',
|
768
|
-
},
|
769
|
-
silentRestore: !!((_k = params.manifest.variables) === null || _k === void 0 ? void 0 : _k.silentRestore),
|
770
|
+
uiImplementation === null || uiImplementation === void 0 ? void 0 : uiImplementation.init({
|
771
|
+
afterRestore: window[registryKey].variables.afterRestore,
|
772
|
+
silentRestore: window[registryKey].variables.silentRestore,
|
773
|
+
theme: theme !== null && theme !== void 0 ? theme : {},
|
770
774
|
walletAPI,
|
771
775
|
storeAPI,
|
772
776
|
});
|
package/index.cjs.js
CHANGED
@@ -840,35 +840,46 @@ const walletLogger = {
|
|
840
840
|
};
|
841
841
|
|
842
842
|
const init = (params) => {
|
843
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
843
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
844
|
+
var _j, _k;
|
844
845
|
if (typeof window == 'undefined' || typeof document == 'undefined') {
|
845
846
|
// if loaded in non-browser SDKs, return early
|
846
847
|
return;
|
847
848
|
}
|
848
|
-
|
849
|
-
|
850
|
-
storeAPI = window[registryKey].storeAPI =
|
851
|
-
(_b = (_a = window[registryKey]).storeAPIFactory) === null || _b === void 0 ? void 0 : _b.call(_a);
|
852
|
-
}
|
849
|
+
(_a = window[registryKey]) !== null && _a !== void 0 ? _a : (window[registryKey] = {});
|
850
|
+
const storeAPI = ((_b = (_j = window[registryKey]).storeAPI) !== null && _b !== void 0 ? _b : (_j.storeAPI = (_d = (_c = window[registryKey]).storeAPIFactory) === null || _d === void 0 ? void 0 : _d.call(_c)));
|
853
851
|
if (!storeAPI) {
|
854
852
|
walletLogger.error('Implementation for store API missing!');
|
855
853
|
return;
|
856
854
|
}
|
855
|
+
const walletAPI = ((_e = (_k = window[registryKey]).walletAPI) !== null && _e !== void 0 ? _e : (_k.walletAPI = createWalletAPI({
|
856
|
+
baseURL: params.baseUrl,
|
857
|
+
storeAPI,
|
858
|
+
userId: params.userId,
|
859
|
+
})));
|
857
860
|
if (window.top !== window) {
|
858
861
|
// exit if not in top window
|
859
862
|
return;
|
860
863
|
}
|
861
|
-
if (!isOnAllowedSubdomain(window.location.href, params.manifest.variables.siteDomain, (
|
864
|
+
if (!isOnAllowedSubdomain(window.location.href, params.manifest.variables.siteDomain, (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.disallowedSubdomains) !== null && _g !== void 0 ? _g : [])) {
|
862
865
|
walletLogger.error('Disabling cart recovery when not running on root domain');
|
863
866
|
return;
|
864
867
|
}
|
865
|
-
const { enabled, previewKey, mode = 'disabled', } = (
|
868
|
+
const { enabled, previewKey, mode = 'disabled', afterRestore, silentRestore, theme, } = (_h = params.manifest.variables) !== null && _h !== void 0 ? _h : {};
|
866
869
|
const experiment = createExperiment({
|
867
870
|
name: mode,
|
868
871
|
userId: params.userId,
|
869
872
|
previewKey,
|
870
873
|
userPreviewKey: getPreviewKey(),
|
871
874
|
});
|
875
|
+
window[registryKey].variables = {
|
876
|
+
experiment,
|
877
|
+
afterRestore: afterRestore !== null && afterRestore !== void 0 ? afterRestore : {
|
878
|
+
action: 'none',
|
879
|
+
},
|
880
|
+
enabled: enabled || experiment.isEnabled,
|
881
|
+
silentRestore: !!silentRestore,
|
882
|
+
};
|
872
883
|
if (experiment.name == 'preview') {
|
873
884
|
if (experiment.isEnabled) {
|
874
885
|
walletLogger.log('Previewing functionality using preview key');
|
@@ -883,17 +894,10 @@ const init = (params) => {
|
|
883
894
|
walletLogger.error('UI implementation is missing');
|
884
895
|
return;
|
885
896
|
}
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
});
|
891
|
-
uiImplementation.init({
|
892
|
-
theme: (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.theme) !== null && _g !== void 0 ? _g : {},
|
893
|
-
afterRestore: (_j = (_h = params.manifest.variables) === null || _h === void 0 ? void 0 : _h.afterRestore) !== null && _j !== void 0 ? _j : {
|
894
|
-
action: 'none',
|
895
|
-
},
|
896
|
-
silentRestore: !!((_k = params.manifest.variables) === null || _k === void 0 ? void 0 : _k.silentRestore),
|
897
|
+
uiImplementation === null || uiImplementation === void 0 ? void 0 : uiImplementation.init({
|
898
|
+
afterRestore: window[registryKey].variables.afterRestore,
|
899
|
+
silentRestore: window[registryKey].variables.silentRestore,
|
900
|
+
theme: theme !== null && theme !== void 0 ? theme : {},
|
897
901
|
walletAPI,
|
898
902
|
storeAPI,
|
899
903
|
});
|
package/index.js
CHANGED
@@ -841,35 +841,46 @@ var ProvidersBlotoutWalletSdk = (function () {
|
|
841
841
|
};
|
842
842
|
|
843
843
|
const init = (params) => {
|
844
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
844
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
845
|
+
var _j, _k;
|
845
846
|
if (typeof window == 'undefined' || typeof document == 'undefined') {
|
846
847
|
// if loaded in non-browser SDKs, return early
|
847
848
|
return;
|
848
849
|
}
|
849
|
-
|
850
|
-
|
851
|
-
storeAPI = window[registryKey].storeAPI =
|
852
|
-
(_b = (_a = window[registryKey]).storeAPIFactory) === null || _b === void 0 ? void 0 : _b.call(_a);
|
853
|
-
}
|
850
|
+
(_a = window[registryKey]) !== null && _a !== void 0 ? _a : (window[registryKey] = {});
|
851
|
+
const storeAPI = ((_b = (_j = window[registryKey]).storeAPI) !== null && _b !== void 0 ? _b : (_j.storeAPI = (_d = (_c = window[registryKey]).storeAPIFactory) === null || _d === void 0 ? void 0 : _d.call(_c)));
|
854
852
|
if (!storeAPI) {
|
855
853
|
walletLogger.error('Implementation for store API missing!');
|
856
854
|
return;
|
857
855
|
}
|
856
|
+
const walletAPI = ((_e = (_k = window[registryKey]).walletAPI) !== null && _e !== void 0 ? _e : (_k.walletAPI = createWalletAPI({
|
857
|
+
baseURL: params.baseUrl,
|
858
|
+
storeAPI,
|
859
|
+
userId: params.userId,
|
860
|
+
})));
|
858
861
|
if (window.top !== window) {
|
859
862
|
// exit if not in top window
|
860
863
|
return;
|
861
864
|
}
|
862
|
-
if (!isOnAllowedSubdomain(window.location.href, params.manifest.variables.siteDomain, (
|
865
|
+
if (!isOnAllowedSubdomain(window.location.href, params.manifest.variables.siteDomain, (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.disallowedSubdomains) !== null && _g !== void 0 ? _g : [])) {
|
863
866
|
walletLogger.error('Disabling cart recovery when not running on root domain');
|
864
867
|
return;
|
865
868
|
}
|
866
|
-
const { enabled, previewKey, mode = 'disabled', } = (
|
869
|
+
const { enabled, previewKey, mode = 'disabled', afterRestore, silentRestore, theme, } = (_h = params.manifest.variables) !== null && _h !== void 0 ? _h : {};
|
867
870
|
const experiment = createExperiment({
|
868
871
|
name: mode,
|
869
872
|
userId: params.userId,
|
870
873
|
previewKey,
|
871
874
|
userPreviewKey: getPreviewKey(),
|
872
875
|
});
|
876
|
+
window[registryKey].variables = {
|
877
|
+
experiment,
|
878
|
+
afterRestore: afterRestore !== null && afterRestore !== void 0 ? afterRestore : {
|
879
|
+
action: 'none',
|
880
|
+
},
|
881
|
+
enabled: enabled || experiment.isEnabled,
|
882
|
+
silentRestore: !!silentRestore,
|
883
|
+
};
|
873
884
|
if (experiment.name == 'preview') {
|
874
885
|
if (experiment.isEnabled) {
|
875
886
|
walletLogger.log('Previewing functionality using preview key');
|
@@ -884,17 +895,10 @@ var ProvidersBlotoutWalletSdk = (function () {
|
|
884
895
|
walletLogger.error('UI implementation is missing');
|
885
896
|
return;
|
886
897
|
}
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
});
|
892
|
-
uiImplementation.init({
|
893
|
-
theme: (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.theme) !== null && _g !== void 0 ? _g : {},
|
894
|
-
afterRestore: (_j = (_h = params.manifest.variables) === null || _h === void 0 ? void 0 : _h.afterRestore) !== null && _j !== void 0 ? _j : {
|
895
|
-
action: 'none',
|
896
|
-
},
|
897
|
-
silentRestore: !!((_k = params.manifest.variables) === null || _k === void 0 ? void 0 : _k.silentRestore),
|
898
|
+
uiImplementation === null || uiImplementation === void 0 ? void 0 : uiImplementation.init({
|
899
|
+
afterRestore: window[registryKey].variables.afterRestore,
|
900
|
+
silentRestore: window[registryKey].variables.silentRestore,
|
901
|
+
theme: theme !== null && theme !== void 0 ? theme : {},
|
898
902
|
walletAPI,
|
899
903
|
storeAPI,
|
900
904
|
});
|
package/index.mjs
CHANGED
@@ -838,35 +838,46 @@ const walletLogger = {
|
|
838
838
|
};
|
839
839
|
|
840
840
|
const init = (params) => {
|
841
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
841
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
842
|
+
var _j, _k;
|
842
843
|
if (typeof window == 'undefined' || typeof document == 'undefined') {
|
843
844
|
// if loaded in non-browser SDKs, return early
|
844
845
|
return;
|
845
846
|
}
|
846
|
-
|
847
|
-
|
848
|
-
storeAPI = window[registryKey].storeAPI =
|
849
|
-
(_b = (_a = window[registryKey]).storeAPIFactory) === null || _b === void 0 ? void 0 : _b.call(_a);
|
850
|
-
}
|
847
|
+
(_a = window[registryKey]) !== null && _a !== void 0 ? _a : (window[registryKey] = {});
|
848
|
+
const storeAPI = ((_b = (_j = window[registryKey]).storeAPI) !== null && _b !== void 0 ? _b : (_j.storeAPI = (_d = (_c = window[registryKey]).storeAPIFactory) === null || _d === void 0 ? void 0 : _d.call(_c)));
|
851
849
|
if (!storeAPI) {
|
852
850
|
walletLogger.error('Implementation for store API missing!');
|
853
851
|
return;
|
854
852
|
}
|
853
|
+
const walletAPI = ((_e = (_k = window[registryKey]).walletAPI) !== null && _e !== void 0 ? _e : (_k.walletAPI = createWalletAPI({
|
854
|
+
baseURL: params.baseUrl,
|
855
|
+
storeAPI,
|
856
|
+
userId: params.userId,
|
857
|
+
})));
|
855
858
|
if (window.top !== window) {
|
856
859
|
// exit if not in top window
|
857
860
|
return;
|
858
861
|
}
|
859
|
-
if (!isOnAllowedSubdomain(window.location.href, params.manifest.variables.siteDomain, (
|
862
|
+
if (!isOnAllowedSubdomain(window.location.href, params.manifest.variables.siteDomain, (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.disallowedSubdomains) !== null && _g !== void 0 ? _g : [])) {
|
860
863
|
walletLogger.error('Disabling cart recovery when not running on root domain');
|
861
864
|
return;
|
862
865
|
}
|
863
|
-
const { enabled, previewKey, mode = 'disabled', } = (
|
866
|
+
const { enabled, previewKey, mode = 'disabled', afterRestore, silentRestore, theme, } = (_h = params.manifest.variables) !== null && _h !== void 0 ? _h : {};
|
864
867
|
const experiment = createExperiment({
|
865
868
|
name: mode,
|
866
869
|
userId: params.userId,
|
867
870
|
previewKey,
|
868
871
|
userPreviewKey: getPreviewKey(),
|
869
872
|
});
|
873
|
+
window[registryKey].variables = {
|
874
|
+
experiment,
|
875
|
+
afterRestore: afterRestore !== null && afterRestore !== void 0 ? afterRestore : {
|
876
|
+
action: 'none',
|
877
|
+
},
|
878
|
+
enabled: enabled || experiment.isEnabled,
|
879
|
+
silentRestore: !!silentRestore,
|
880
|
+
};
|
870
881
|
if (experiment.name == 'preview') {
|
871
882
|
if (experiment.isEnabled) {
|
872
883
|
walletLogger.log('Previewing functionality using preview key');
|
@@ -881,17 +892,10 @@ const init = (params) => {
|
|
881
892
|
walletLogger.error('UI implementation is missing');
|
882
893
|
return;
|
883
894
|
}
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
});
|
889
|
-
uiImplementation.init({
|
890
|
-
theme: (_g = (_f = params.manifest.variables) === null || _f === void 0 ? void 0 : _f.theme) !== null && _g !== void 0 ? _g : {},
|
891
|
-
afterRestore: (_j = (_h = params.manifest.variables) === null || _h === void 0 ? void 0 : _h.afterRestore) !== null && _j !== void 0 ? _j : {
|
892
|
-
action: 'none',
|
893
|
-
},
|
894
|
-
silentRestore: !!((_k = params.manifest.variables) === null || _k === void 0 ? void 0 : _k.silentRestore),
|
895
|
+
uiImplementation === null || uiImplementation === void 0 ? void 0 : uiImplementation.init({
|
896
|
+
afterRestore: window[registryKey].variables.afterRestore,
|
897
|
+
silentRestore: window[registryKey].variables.silentRestore,
|
898
|
+
theme: theme !== null && theme !== void 0 ? theme : {},
|
895
899
|
walletAPI,
|
896
900
|
storeAPI,
|
897
901
|
});
|