@blotoutio/providers-blotout-wallet-sdk 1.12.1 → 1.13.0
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 +5 -0
- package/core.js +5 -0
- package/core.mjs +5 -0
- package/index.cjs.js +31 -24
- package/index.js +31 -24
- package/index.mjs +31 -24
- package/package.json +1 -1
- package/ui.cjs.js +26 -24
- package/ui.js +26 -24
- package/ui.mjs +26 -24
package/core.cjs.js
CHANGED
@@ -593,6 +593,7 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
593
593
|
const response = await fetchImpl(getURL('/cart/expired'), {
|
594
594
|
method: 'GET',
|
595
595
|
headers: getHeaders(),
|
596
|
+
credentials: 'include',
|
596
597
|
});
|
597
598
|
if (!response.ok) {
|
598
599
|
throw new Error(`Unable to get expired cart - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
|
@@ -613,6 +614,7 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
613
614
|
method: 'POST',
|
614
615
|
headers: getHeaders(true),
|
615
616
|
body: JSON.stringify({ action }),
|
617
|
+
credentials: 'include',
|
616
618
|
});
|
617
619
|
if (!response.ok) {
|
618
620
|
throw new Error(`Error while recording user event - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
|
@@ -628,6 +630,7 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
628
630
|
method: 'POST',
|
629
631
|
headers: getHeaders(true),
|
630
632
|
body: JSON.stringify({ email: normalized }),
|
633
|
+
credentials: 'include',
|
631
634
|
});
|
632
635
|
if (!response.ok) {
|
633
636
|
throw new Error(`Could not save email - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
|
@@ -638,6 +641,7 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
638
641
|
const response = await fetchImpl(getURL(`/cart/restore/${encodeURIComponent(cartId)}`), {
|
639
642
|
method: 'POST',
|
640
643
|
headers: getHeaders(),
|
644
|
+
credentials: 'include',
|
641
645
|
});
|
642
646
|
if (!response.ok) {
|
643
647
|
throw new Error(`Could not update status in DB - ${response.status}: ${response.text}\n\n${await response.text()}`);
|
@@ -650,6 +654,7 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
650
654
|
const response = await fetchImpl(getURL('/cart/skip'), {
|
651
655
|
method: 'POST',
|
652
656
|
headers: getHeaders(),
|
657
|
+
credentials: 'include',
|
653
658
|
});
|
654
659
|
if (!response.ok) {
|
655
660
|
throw new Error(`Could not mark cart as skipped - ${response.status}: ${await response.text()}`);
|
package/core.js
CHANGED
@@ -594,6 +594,7 @@ var ProvidersBlotoutWalletSdk = (function () {
|
|
594
594
|
const response = await fetchImpl(getURL('/cart/expired'), {
|
595
595
|
method: 'GET',
|
596
596
|
headers: getHeaders(),
|
597
|
+
credentials: 'include',
|
597
598
|
});
|
598
599
|
if (!response.ok) {
|
599
600
|
throw new Error(`Unable to get expired cart - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
|
@@ -614,6 +615,7 @@ var ProvidersBlotoutWalletSdk = (function () {
|
|
614
615
|
method: 'POST',
|
615
616
|
headers: getHeaders(true),
|
616
617
|
body: JSON.stringify({ action }),
|
618
|
+
credentials: 'include',
|
617
619
|
});
|
618
620
|
if (!response.ok) {
|
619
621
|
throw new Error(`Error while recording user event - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
|
@@ -629,6 +631,7 @@ var ProvidersBlotoutWalletSdk = (function () {
|
|
629
631
|
method: 'POST',
|
630
632
|
headers: getHeaders(true),
|
631
633
|
body: JSON.stringify({ email: normalized }),
|
634
|
+
credentials: 'include',
|
632
635
|
});
|
633
636
|
if (!response.ok) {
|
634
637
|
throw new Error(`Could not save email - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
|
@@ -639,6 +642,7 @@ var ProvidersBlotoutWalletSdk = (function () {
|
|
639
642
|
const response = await fetchImpl(getURL(`/cart/restore/${encodeURIComponent(cartId)}`), {
|
640
643
|
method: 'POST',
|
641
644
|
headers: getHeaders(),
|
645
|
+
credentials: 'include',
|
642
646
|
});
|
643
647
|
if (!response.ok) {
|
644
648
|
throw new Error(`Could not update status in DB - ${response.status}: ${response.text}\n\n${await response.text()}`);
|
@@ -651,6 +655,7 @@ var ProvidersBlotoutWalletSdk = (function () {
|
|
651
655
|
const response = await fetchImpl(getURL('/cart/skip'), {
|
652
656
|
method: 'POST',
|
653
657
|
headers: getHeaders(),
|
658
|
+
credentials: 'include',
|
654
659
|
});
|
655
660
|
if (!response.ok) {
|
656
661
|
throw new Error(`Could not mark cart as skipped - ${response.status}: ${await response.text()}`);
|
package/core.mjs
CHANGED
@@ -591,6 +591,7 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
591
591
|
const response = await fetchImpl(getURL('/cart/expired'), {
|
592
592
|
method: 'GET',
|
593
593
|
headers: getHeaders(),
|
594
|
+
credentials: 'include',
|
594
595
|
});
|
595
596
|
if (!response.ok) {
|
596
597
|
throw new Error(`Unable to get expired cart - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
|
@@ -611,6 +612,7 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
611
612
|
method: 'POST',
|
612
613
|
headers: getHeaders(true),
|
613
614
|
body: JSON.stringify({ action }),
|
615
|
+
credentials: 'include',
|
614
616
|
});
|
615
617
|
if (!response.ok) {
|
616
618
|
throw new Error(`Error while recording user event - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
|
@@ -626,6 +628,7 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
626
628
|
method: 'POST',
|
627
629
|
headers: getHeaders(true),
|
628
630
|
body: JSON.stringify({ email: normalized }),
|
631
|
+
credentials: 'include',
|
629
632
|
});
|
630
633
|
if (!response.ok) {
|
631
634
|
throw new Error(`Could not save email - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
|
@@ -636,6 +639,7 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
636
639
|
const response = await fetchImpl(getURL(`/cart/restore/${encodeURIComponent(cartId)}`), {
|
637
640
|
method: 'POST',
|
638
641
|
headers: getHeaders(),
|
642
|
+
credentials: 'include',
|
639
643
|
});
|
640
644
|
if (!response.ok) {
|
641
645
|
throw new Error(`Could not update status in DB - ${response.status}: ${response.text}\n\n${await response.text()}`);
|
@@ -648,6 +652,7 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
648
652
|
const response = await fetchImpl(getURL('/cart/skip'), {
|
649
653
|
method: 'POST',
|
650
654
|
headers: getHeaders(),
|
655
|
+
credentials: 'include',
|
651
656
|
});
|
652
657
|
if (!response.ok) {
|
653
658
|
throw new Error(`Could not mark cart as skipped - ${response.status}: ${await response.text()}`);
|
package/index.cjs.js
CHANGED
@@ -686,6 +686,7 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
686
686
|
const response = await fetchImpl(getURL('/cart/expired'), {
|
687
687
|
method: 'GET',
|
688
688
|
headers: getHeaders(),
|
689
|
+
credentials: 'include',
|
689
690
|
});
|
690
691
|
if (!response.ok) {
|
691
692
|
throw new Error(`Unable to get expired cart - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
|
@@ -706,6 +707,7 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
706
707
|
method: 'POST',
|
707
708
|
headers: getHeaders(true),
|
708
709
|
body: JSON.stringify({ action }),
|
710
|
+
credentials: 'include',
|
709
711
|
});
|
710
712
|
if (!response.ok) {
|
711
713
|
throw new Error(`Error while recording user event - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
|
@@ -721,6 +723,7 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
721
723
|
method: 'POST',
|
722
724
|
headers: getHeaders(true),
|
723
725
|
body: JSON.stringify({ email: normalized }),
|
726
|
+
credentials: 'include',
|
724
727
|
});
|
725
728
|
if (!response.ok) {
|
726
729
|
throw new Error(`Could not save email - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
|
@@ -731,6 +734,7 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
731
734
|
const response = await fetchImpl(getURL(`/cart/restore/${encodeURIComponent(cartId)}`), {
|
732
735
|
method: 'POST',
|
733
736
|
headers: getHeaders(),
|
737
|
+
credentials: 'include',
|
734
738
|
});
|
735
739
|
if (!response.ok) {
|
736
740
|
throw new Error(`Could not update status in DB - ${response.status}: ${response.text}\n\n${await response.text()}`);
|
@@ -743,6 +747,7 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
743
747
|
const response = await fetchImpl(getURL('/cart/skip'), {
|
744
748
|
method: 'POST',
|
745
749
|
headers: getHeaders(),
|
750
|
+
credentials: 'include',
|
746
751
|
});
|
747
752
|
if (!response.ok) {
|
748
753
|
throw new Error(`Could not mark cart as skipped - ${response.status}: ${await response.text()}`);
|
@@ -1165,35 +1170,37 @@ let BlotoutWallet = class BlotoutWallet extends i$2 {
|
|
1165
1170
|
if (this.state == 'restored') {
|
1166
1171
|
this.hideModal('restore');
|
1167
1172
|
}
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1173
|
+
this.afterHandleRestore();
|
1174
|
+
}
|
1175
|
+
catch (e) {
|
1176
|
+
logger.error(e);
|
1177
|
+
await this.transitionTo('failed');
|
1178
|
+
}
|
1179
|
+
};
|
1180
|
+
this.afterHandleRestore = () => {
|
1181
|
+
if (this.afterRestore) {
|
1182
|
+
switch (this.afterRestore.action) {
|
1183
|
+
case 'refresh': {
|
1184
|
+
window.location.reload();
|
1185
|
+
break;
|
1186
|
+
}
|
1187
|
+
case 'redirect': {
|
1188
|
+
try {
|
1189
|
+
window.location.href = new URL(this.afterRestore.url, window.location.href).toString();
|
1174
1190
|
}
|
1175
|
-
|
1176
|
-
|
1177
|
-
window.location.href = new URL(this.afterRestore.url, window.location.href).toString();
|
1178
|
-
}
|
1179
|
-
catch (e) {
|
1180
|
-
console.error('Invalid redirect URL', e);
|
1181
|
-
}
|
1182
|
-
break;
|
1191
|
+
catch (e) {
|
1192
|
+
console.error('Invalid redirect URL', e);
|
1183
1193
|
}
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1194
|
+
break;
|
1195
|
+
}
|
1196
|
+
case 'checkout': {
|
1197
|
+
const url = this.storeAPI.getCheckoutURL();
|
1198
|
+
if (url) {
|
1199
|
+
window.location.href = url.toString();
|
1189
1200
|
}
|
1190
1201
|
}
|
1191
1202
|
}
|
1192
1203
|
}
|
1193
|
-
catch (e) {
|
1194
|
-
logger.error(e);
|
1195
|
-
await this.transitionTo('failed');
|
1196
|
-
}
|
1197
1204
|
};
|
1198
1205
|
this.onDialogClick = () => {
|
1199
1206
|
if (this.state == 'loading') {
|
@@ -1306,7 +1313,7 @@ let BlotoutWallet = class BlotoutWallet extends i$2 {
|
|
1306
1313
|
this.lastExpiredCart = carts[0];
|
1307
1314
|
if (carts === null || carts === void 0 ? void 0 : carts.length) {
|
1308
1315
|
if (this.silentRestore) {
|
1309
|
-
this.restoreCart().catch(logger.error);
|
1316
|
+
this.restoreCart().then(this.afterHandleRestore).catch(logger.error);
|
1310
1317
|
}
|
1311
1318
|
else if (!this.isPopUpDismissed) {
|
1312
1319
|
this.showModal();
|
package/index.js
CHANGED
@@ -687,6 +687,7 @@ var ProvidersBlotoutWalletSdk = (function () {
|
|
687
687
|
const response = await fetchImpl(getURL('/cart/expired'), {
|
688
688
|
method: 'GET',
|
689
689
|
headers: getHeaders(),
|
690
|
+
credentials: 'include',
|
690
691
|
});
|
691
692
|
if (!response.ok) {
|
692
693
|
throw new Error(`Unable to get expired cart - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
|
@@ -707,6 +708,7 @@ var ProvidersBlotoutWalletSdk = (function () {
|
|
707
708
|
method: 'POST',
|
708
709
|
headers: getHeaders(true),
|
709
710
|
body: JSON.stringify({ action }),
|
711
|
+
credentials: 'include',
|
710
712
|
});
|
711
713
|
if (!response.ok) {
|
712
714
|
throw new Error(`Error while recording user event - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
|
@@ -722,6 +724,7 @@ var ProvidersBlotoutWalletSdk = (function () {
|
|
722
724
|
method: 'POST',
|
723
725
|
headers: getHeaders(true),
|
724
726
|
body: JSON.stringify({ email: normalized }),
|
727
|
+
credentials: 'include',
|
725
728
|
});
|
726
729
|
if (!response.ok) {
|
727
730
|
throw new Error(`Could not save email - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
|
@@ -732,6 +735,7 @@ var ProvidersBlotoutWalletSdk = (function () {
|
|
732
735
|
const response = await fetchImpl(getURL(`/cart/restore/${encodeURIComponent(cartId)}`), {
|
733
736
|
method: 'POST',
|
734
737
|
headers: getHeaders(),
|
738
|
+
credentials: 'include',
|
735
739
|
});
|
736
740
|
if (!response.ok) {
|
737
741
|
throw new Error(`Could not update status in DB - ${response.status}: ${response.text}\n\n${await response.text()}`);
|
@@ -744,6 +748,7 @@ var ProvidersBlotoutWalletSdk = (function () {
|
|
744
748
|
const response = await fetchImpl(getURL('/cart/skip'), {
|
745
749
|
method: 'POST',
|
746
750
|
headers: getHeaders(),
|
751
|
+
credentials: 'include',
|
747
752
|
});
|
748
753
|
if (!response.ok) {
|
749
754
|
throw new Error(`Could not mark cart as skipped - ${response.status}: ${await response.text()}`);
|
@@ -1166,35 +1171,37 @@ var ProvidersBlotoutWalletSdk = (function () {
|
|
1166
1171
|
if (this.state == 'restored') {
|
1167
1172
|
this.hideModal('restore');
|
1168
1173
|
}
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1174
|
+
this.afterHandleRestore();
|
1175
|
+
}
|
1176
|
+
catch (e) {
|
1177
|
+
logger.error(e);
|
1178
|
+
await this.transitionTo('failed');
|
1179
|
+
}
|
1180
|
+
};
|
1181
|
+
this.afterHandleRestore = () => {
|
1182
|
+
if (this.afterRestore) {
|
1183
|
+
switch (this.afterRestore.action) {
|
1184
|
+
case 'refresh': {
|
1185
|
+
window.location.reload();
|
1186
|
+
break;
|
1187
|
+
}
|
1188
|
+
case 'redirect': {
|
1189
|
+
try {
|
1190
|
+
window.location.href = new URL(this.afterRestore.url, window.location.href).toString();
|
1175
1191
|
}
|
1176
|
-
|
1177
|
-
|
1178
|
-
window.location.href = new URL(this.afterRestore.url, window.location.href).toString();
|
1179
|
-
}
|
1180
|
-
catch (e) {
|
1181
|
-
console.error('Invalid redirect URL', e);
|
1182
|
-
}
|
1183
|
-
break;
|
1192
|
+
catch (e) {
|
1193
|
+
console.error('Invalid redirect URL', e);
|
1184
1194
|
}
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1195
|
+
break;
|
1196
|
+
}
|
1197
|
+
case 'checkout': {
|
1198
|
+
const url = this.storeAPI.getCheckoutURL();
|
1199
|
+
if (url) {
|
1200
|
+
window.location.href = url.toString();
|
1190
1201
|
}
|
1191
1202
|
}
|
1192
1203
|
}
|
1193
1204
|
}
|
1194
|
-
catch (e) {
|
1195
|
-
logger.error(e);
|
1196
|
-
await this.transitionTo('failed');
|
1197
|
-
}
|
1198
1205
|
};
|
1199
1206
|
this.onDialogClick = () => {
|
1200
1207
|
if (this.state == 'loading') {
|
@@ -1307,7 +1314,7 @@ var ProvidersBlotoutWalletSdk = (function () {
|
|
1307
1314
|
this.lastExpiredCart = carts[0];
|
1308
1315
|
if (carts === null || carts === void 0 ? void 0 : carts.length) {
|
1309
1316
|
if (this.silentRestore) {
|
1310
|
-
this.restoreCart().catch(logger.error);
|
1317
|
+
this.restoreCart().then(this.afterHandleRestore).catch(logger.error);
|
1311
1318
|
}
|
1312
1319
|
else if (!this.isPopUpDismissed) {
|
1313
1320
|
this.showModal();
|
package/index.mjs
CHANGED
@@ -684,6 +684,7 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
684
684
|
const response = await fetchImpl(getURL('/cart/expired'), {
|
685
685
|
method: 'GET',
|
686
686
|
headers: getHeaders(),
|
687
|
+
credentials: 'include',
|
687
688
|
});
|
688
689
|
if (!response.ok) {
|
689
690
|
throw new Error(`Unable to get expired cart - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
|
@@ -704,6 +705,7 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
704
705
|
method: 'POST',
|
705
706
|
headers: getHeaders(true),
|
706
707
|
body: JSON.stringify({ action }),
|
708
|
+
credentials: 'include',
|
707
709
|
});
|
708
710
|
if (!response.ok) {
|
709
711
|
throw new Error(`Error while recording user event - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
|
@@ -719,6 +721,7 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
719
721
|
method: 'POST',
|
720
722
|
headers: getHeaders(true),
|
721
723
|
body: JSON.stringify({ email: normalized }),
|
724
|
+
credentials: 'include',
|
722
725
|
});
|
723
726
|
if (!response.ok) {
|
724
727
|
throw new Error(`Could not save email - ${response.status}: ${response.statusText}\n\n${await response.text()}`);
|
@@ -729,6 +732,7 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
729
732
|
const response = await fetchImpl(getURL(`/cart/restore/${encodeURIComponent(cartId)}`), {
|
730
733
|
method: 'POST',
|
731
734
|
headers: getHeaders(),
|
735
|
+
credentials: 'include',
|
732
736
|
});
|
733
737
|
if (!response.ok) {
|
734
738
|
throw new Error(`Could not update status in DB - ${response.status}: ${response.text}\n\n${await response.text()}`);
|
@@ -741,6 +745,7 @@ const createWalletAPI = ({ fetch: fetchImpl = window.fetch, baseURL, userId, sto
|
|
741
745
|
const response = await fetchImpl(getURL('/cart/skip'), {
|
742
746
|
method: 'POST',
|
743
747
|
headers: getHeaders(),
|
748
|
+
credentials: 'include',
|
744
749
|
});
|
745
750
|
if (!response.ok) {
|
746
751
|
throw new Error(`Could not mark cart as skipped - ${response.status}: ${await response.text()}`);
|
@@ -1163,35 +1168,37 @@ let BlotoutWallet = class BlotoutWallet extends i$2 {
|
|
1163
1168
|
if (this.state == 'restored') {
|
1164
1169
|
this.hideModal('restore');
|
1165
1170
|
}
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1171
|
+
this.afterHandleRestore();
|
1172
|
+
}
|
1173
|
+
catch (e) {
|
1174
|
+
logger.error(e);
|
1175
|
+
await this.transitionTo('failed');
|
1176
|
+
}
|
1177
|
+
};
|
1178
|
+
this.afterHandleRestore = () => {
|
1179
|
+
if (this.afterRestore) {
|
1180
|
+
switch (this.afterRestore.action) {
|
1181
|
+
case 'refresh': {
|
1182
|
+
window.location.reload();
|
1183
|
+
break;
|
1184
|
+
}
|
1185
|
+
case 'redirect': {
|
1186
|
+
try {
|
1187
|
+
window.location.href = new URL(this.afterRestore.url, window.location.href).toString();
|
1172
1188
|
}
|
1173
|
-
|
1174
|
-
|
1175
|
-
window.location.href = new URL(this.afterRestore.url, window.location.href).toString();
|
1176
|
-
}
|
1177
|
-
catch (e) {
|
1178
|
-
console.error('Invalid redirect URL', e);
|
1179
|
-
}
|
1180
|
-
break;
|
1189
|
+
catch (e) {
|
1190
|
+
console.error('Invalid redirect URL', e);
|
1181
1191
|
}
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1192
|
+
break;
|
1193
|
+
}
|
1194
|
+
case 'checkout': {
|
1195
|
+
const url = this.storeAPI.getCheckoutURL();
|
1196
|
+
if (url) {
|
1197
|
+
window.location.href = url.toString();
|
1187
1198
|
}
|
1188
1199
|
}
|
1189
1200
|
}
|
1190
1201
|
}
|
1191
|
-
catch (e) {
|
1192
|
-
logger.error(e);
|
1193
|
-
await this.transitionTo('failed');
|
1194
|
-
}
|
1195
1202
|
};
|
1196
1203
|
this.onDialogClick = () => {
|
1197
1204
|
if (this.state == 'loading') {
|
@@ -1304,7 +1311,7 @@ let BlotoutWallet = class BlotoutWallet extends i$2 {
|
|
1304
1311
|
this.lastExpiredCart = carts[0];
|
1305
1312
|
if (carts === null || carts === void 0 ? void 0 : carts.length) {
|
1306
1313
|
if (this.silentRestore) {
|
1307
|
-
this.restoreCart().catch(logger.error);
|
1314
|
+
this.restoreCart().then(this.afterHandleRestore).catch(logger.error);
|
1308
1315
|
}
|
1309
1316
|
else if (!this.isPopUpDismissed) {
|
1310
1317
|
this.showModal();
|
package/package.json
CHANGED
package/ui.cjs.js
CHANGED
@@ -797,35 +797,37 @@ let BlotoutWallet = class BlotoutWallet extends i$2 {
|
|
797
797
|
if (this.state == 'restored') {
|
798
798
|
this.hideModal('restore');
|
799
799
|
}
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
800
|
+
this.afterHandleRestore();
|
801
|
+
}
|
802
|
+
catch (e) {
|
803
|
+
logger.error(e);
|
804
|
+
await this.transitionTo('failed');
|
805
|
+
}
|
806
|
+
};
|
807
|
+
this.afterHandleRestore = () => {
|
808
|
+
if (this.afterRestore) {
|
809
|
+
switch (this.afterRestore.action) {
|
810
|
+
case 'refresh': {
|
811
|
+
window.location.reload();
|
812
|
+
break;
|
813
|
+
}
|
814
|
+
case 'redirect': {
|
815
|
+
try {
|
816
|
+
window.location.href = new URL(this.afterRestore.url, window.location.href).toString();
|
806
817
|
}
|
807
|
-
|
808
|
-
|
809
|
-
window.location.href = new URL(this.afterRestore.url, window.location.href).toString();
|
810
|
-
}
|
811
|
-
catch (e) {
|
812
|
-
console.error('Invalid redirect URL', e);
|
813
|
-
}
|
814
|
-
break;
|
818
|
+
catch (e) {
|
819
|
+
console.error('Invalid redirect URL', e);
|
815
820
|
}
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
+
break;
|
822
|
+
}
|
823
|
+
case 'checkout': {
|
824
|
+
const url = this.storeAPI.getCheckoutURL();
|
825
|
+
if (url) {
|
826
|
+
window.location.href = url.toString();
|
821
827
|
}
|
822
828
|
}
|
823
829
|
}
|
824
830
|
}
|
825
|
-
catch (e) {
|
826
|
-
logger.error(e);
|
827
|
-
await this.transitionTo('failed');
|
828
|
-
}
|
829
831
|
};
|
830
832
|
this.onDialogClick = () => {
|
831
833
|
if (this.state == 'loading') {
|
@@ -938,7 +940,7 @@ let BlotoutWallet = class BlotoutWallet extends i$2 {
|
|
938
940
|
this.lastExpiredCart = carts[0];
|
939
941
|
if (carts === null || carts === void 0 ? void 0 : carts.length) {
|
940
942
|
if (this.silentRestore) {
|
941
|
-
this.restoreCart().catch(logger.error);
|
943
|
+
this.restoreCart().then(this.afterHandleRestore).catch(logger.error);
|
942
944
|
}
|
943
945
|
else if (!this.isPopUpDismissed) {
|
944
946
|
this.showModal();
|
package/ui.js
CHANGED
@@ -798,35 +798,37 @@
|
|
798
798
|
if (this.state == 'restored') {
|
799
799
|
this.hideModal('restore');
|
800
800
|
}
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
801
|
+
this.afterHandleRestore();
|
802
|
+
}
|
803
|
+
catch (e) {
|
804
|
+
logger.error(e);
|
805
|
+
await this.transitionTo('failed');
|
806
|
+
}
|
807
|
+
};
|
808
|
+
this.afterHandleRestore = () => {
|
809
|
+
if (this.afterRestore) {
|
810
|
+
switch (this.afterRestore.action) {
|
811
|
+
case 'refresh': {
|
812
|
+
window.location.reload();
|
813
|
+
break;
|
814
|
+
}
|
815
|
+
case 'redirect': {
|
816
|
+
try {
|
817
|
+
window.location.href = new URL(this.afterRestore.url, window.location.href).toString();
|
807
818
|
}
|
808
|
-
|
809
|
-
|
810
|
-
window.location.href = new URL(this.afterRestore.url, window.location.href).toString();
|
811
|
-
}
|
812
|
-
catch (e) {
|
813
|
-
console.error('Invalid redirect URL', e);
|
814
|
-
}
|
815
|
-
break;
|
819
|
+
catch (e) {
|
820
|
+
console.error('Invalid redirect URL', e);
|
816
821
|
}
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
+
break;
|
823
|
+
}
|
824
|
+
case 'checkout': {
|
825
|
+
const url = this.storeAPI.getCheckoutURL();
|
826
|
+
if (url) {
|
827
|
+
window.location.href = url.toString();
|
822
828
|
}
|
823
829
|
}
|
824
830
|
}
|
825
831
|
}
|
826
|
-
catch (e) {
|
827
|
-
logger.error(e);
|
828
|
-
await this.transitionTo('failed');
|
829
|
-
}
|
830
832
|
};
|
831
833
|
this.onDialogClick = () => {
|
832
834
|
if (this.state == 'loading') {
|
@@ -939,7 +941,7 @@
|
|
939
941
|
this.lastExpiredCart = carts[0];
|
940
942
|
if (carts === null || carts === void 0 ? void 0 : carts.length) {
|
941
943
|
if (this.silentRestore) {
|
942
|
-
this.restoreCart().catch(logger.error);
|
944
|
+
this.restoreCart().then(this.afterHandleRestore).catch(logger.error);
|
943
945
|
}
|
944
946
|
else if (!this.isPopUpDismissed) {
|
945
947
|
this.showModal();
|
package/ui.mjs
CHANGED
@@ -795,35 +795,37 @@ let BlotoutWallet = class BlotoutWallet extends i$2 {
|
|
795
795
|
if (this.state == 'restored') {
|
796
796
|
this.hideModal('restore');
|
797
797
|
}
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
798
|
+
this.afterHandleRestore();
|
799
|
+
}
|
800
|
+
catch (e) {
|
801
|
+
logger.error(e);
|
802
|
+
await this.transitionTo('failed');
|
803
|
+
}
|
804
|
+
};
|
805
|
+
this.afterHandleRestore = () => {
|
806
|
+
if (this.afterRestore) {
|
807
|
+
switch (this.afterRestore.action) {
|
808
|
+
case 'refresh': {
|
809
|
+
window.location.reload();
|
810
|
+
break;
|
811
|
+
}
|
812
|
+
case 'redirect': {
|
813
|
+
try {
|
814
|
+
window.location.href = new URL(this.afterRestore.url, window.location.href).toString();
|
804
815
|
}
|
805
|
-
|
806
|
-
|
807
|
-
window.location.href = new URL(this.afterRestore.url, window.location.href).toString();
|
808
|
-
}
|
809
|
-
catch (e) {
|
810
|
-
console.error('Invalid redirect URL', e);
|
811
|
-
}
|
812
|
-
break;
|
816
|
+
catch (e) {
|
817
|
+
console.error('Invalid redirect URL', e);
|
813
818
|
}
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
+
break;
|
820
|
+
}
|
821
|
+
case 'checkout': {
|
822
|
+
const url = this.storeAPI.getCheckoutURL();
|
823
|
+
if (url) {
|
824
|
+
window.location.href = url.toString();
|
819
825
|
}
|
820
826
|
}
|
821
827
|
}
|
822
828
|
}
|
823
|
-
catch (e) {
|
824
|
-
logger.error(e);
|
825
|
-
await this.transitionTo('failed');
|
826
|
-
}
|
827
829
|
};
|
828
830
|
this.onDialogClick = () => {
|
829
831
|
if (this.state == 'loading') {
|
@@ -936,7 +938,7 @@ let BlotoutWallet = class BlotoutWallet extends i$2 {
|
|
936
938
|
this.lastExpiredCart = carts[0];
|
937
939
|
if (carts === null || carts === void 0 ? void 0 : carts.length) {
|
938
940
|
if (this.silentRestore) {
|
939
|
-
this.restoreCart().catch(logger.error);
|
941
|
+
this.restoreCart().then(this.afterHandleRestore).catch(logger.error);
|
940
942
|
}
|
941
943
|
else if (!this.isPopUpDismissed) {
|
942
944
|
this.showModal();
|