stripe-pwa-elements 3.2.0 → 4.0.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/dist/cjs/app-globals-V2Kpy_OQ.js +0 -3
- package/dist/cjs/error-FFC4kSs5.js +0 -3
- package/dist/cjs/{factory-CbbbSvkg.js → factory-da3xAKkz.js} +194 -73
- package/dist/cjs/{index-Ba1pBePA.js → index-CYbA1N_k.js} +24 -6
- package/dist/cjs/index-Dkb0SxZc.js +4694 -0
- package/dist/cjs/index.cjs.js +0 -1
- package/dist/cjs/ion-icon.cjs.entry.js +22 -13
- package/dist/cjs/loader.cjs.js +2 -3
- package/dist/cjs/stripe-address-element.cjs.entry.js +34 -26
- package/dist/cjs/stripe-card-element-modal.cjs.entry.js +6 -7
- package/dist/cjs/stripe-card-element_2.cjs.entry.js +106 -67
- package/dist/cjs/stripe-currency-selector.cjs.entry.js +13 -10
- package/dist/cjs/stripe-elements.cjs.js +31 -5
- package/dist/cjs/stripe-express-checkout-element.cjs.entry.js +25 -22
- package/dist/cjs/stripe-link-authentication-element.cjs.entry.js +13 -10
- package/dist/cjs/stripe-payment-element.cjs.entry.js +190 -131
- package/dist/cjs/stripe-payment-request-button.cjs.entry.js +12 -7
- package/dist/collection/collection-manifest.json +3 -2
- package/dist/collection/components/stripe-address-element/stripe-address-element.js +29 -21
- package/dist/collection/components/stripe-card-element/stripe-card-element.helpers.js +57 -0
- package/dist/collection/components/stripe-card-element/stripe-card-element.js +55 -68
- package/dist/collection/components/stripe-card-element-modal/stripe-card-element-modal.js +15 -11
- package/dist/collection/components/stripe-currency-selector/stripe-currency-selector.js +10 -6
- package/dist/collection/components/stripe-express-checkout-element/stripe-express-checkout-element.js +28 -20
- package/dist/collection/components/stripe-link-authentication-element/stripe-link-authentication-element.js +12 -7
- package/dist/collection/components/stripe-modal/stripe-modal.js +0 -1
- package/dist/collection/components/stripe-payment-element/stripe-payment-element.helpers.js +114 -0
- package/dist/collection/components/stripe-payment-element/stripe-payment-element.js +69 -126
- package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js +34 -12
- package/dist/collection/index.js +0 -1
- package/dist/collection/interfaces.js +0 -1
- package/dist/collection/services/address-element-manager.js +3 -4
- package/dist/collection/services/card-element-manager.js +3 -4
- package/dist/collection/services/currency-selector-element-manager.js +3 -4
- package/dist/collection/services/express-checkout-element-manager.js +9 -10
- package/dist/collection/services/factory.js +0 -1
- package/dist/collection/services/interfaces.js +0 -1
- package/dist/collection/services/link-authentication-element-manager.js +3 -4
- package/dist/collection/services/payment-element-manager.js +4 -5
- package/dist/collection/services/stripe-service.js +5 -6
- package/dist/collection/utils/element-finder.js +2 -3
- package/dist/collection/utils/error.js +0 -1
- package/dist/collection/utils/i18n.js +0 -1
- package/dist/collection/utils/platform.js +0 -1
- package/dist/collection/utils/test-setup.js +0 -1
- package/dist/collection/utils/utils.js +2 -3
- package/dist/components/error.js +1 -16
- package/dist/components/factory.js +1 -3736
- package/dist/components/icon.js +1 -459
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +1 -4
- package/dist/components/index2.js +1 -192
- package/dist/components/ion-icon.js +1 -9
- package/dist/components/stripe-address-element.js +1 -327
- package/dist/components/stripe-card-element-modal.js +1 -174
- package/dist/components/stripe-card-element.js +1 -9
- package/dist/components/stripe-card-element2.js +1 -440
- package/dist/components/stripe-currency-selector.js +1 -218
- package/dist/components/stripe-express-checkout-element.js +1 -332
- package/dist/components/stripe-link-authentication-element.js +1 -256
- package/dist/components/stripe-modal.js +1 -9
- package/dist/components/stripe-modal2.js +1 -112
- package/dist/components/stripe-payment-element.js +1 -510
- package/dist/components/stripe-payment-request-button.js +1 -9
- package/dist/components/stripe-payment-request-button2.js +1 -224
- package/dist/components/utils.js +1 -89
- package/dist/esm/app-globals-DQuL1Twl.js +0 -3
- package/dist/esm/error-XRfh5Wrs.js +0 -3
- package/dist/esm/{factory-Drde6-y7.js → factory-DeqoYLf_.js} +194 -73
- package/dist/esm/index-C6bbmyga.js +4677 -0
- package/dist/esm/{index-BHDCxQOb.js → index-CBXaOfXU.js} +24 -6
- package/dist/esm/index.js +0 -1
- package/dist/esm/ion-icon.entry.js +22 -13
- package/dist/esm/loader.js +3 -4
- package/dist/esm/stripe-address-element.entry.js +34 -26
- package/dist/esm/stripe-card-element-modal.entry.js +6 -7
- package/dist/esm/stripe-card-element_2.entry.js +106 -67
- package/dist/esm/stripe-currency-selector.entry.js +13 -10
- package/dist/esm/stripe-elements.js +32 -6
- package/dist/esm/stripe-express-checkout-element.entry.js +25 -22
- package/dist/esm/stripe-link-authentication-element.entry.js +13 -10
- package/dist/esm/stripe-payment-element.entry.js +190 -131
- package/dist/esm/stripe-payment-request-button.entry.js +12 -7
- package/dist/stripe-elements/index.esm.js +0 -2
- package/dist/stripe-elements/p--sA2m1ad.js +1 -0
- package/dist/stripe-elements/p-38e7b187.entry.js +1 -0
- package/dist/stripe-elements/p-44495284.entry.js +1 -0
- package/dist/stripe-elements/p-4ba675fa.entry.js +1 -0
- package/dist/stripe-elements/p-5cf62945.entry.js +1 -0
- package/dist/stripe-elements/p-C6bbmyga.js +2 -0
- package/dist/stripe-elements/p-CBXaOfXU.js +1 -0
- package/dist/stripe-elements/p-DQuL1Twl.js +1 -2
- package/dist/stripe-elements/p-XRfh5Wrs.js +1 -2
- package/dist/stripe-elements/p-c24ae181.entry.js +1 -0
- package/dist/stripe-elements/p-d9e86451.entry.js +1 -0
- package/dist/stripe-elements/p-f09c86a0.entry.js +1 -0
- package/dist/stripe-elements/p-f64f394d.entry.js +1 -0
- package/dist/stripe-elements/p-f6d2425e.entry.js +1 -0
- package/dist/stripe-elements/stripe-elements.esm.js +1 -2
- package/dist/stripe-elements/svg/.gitignore +4 -0
- package/dist/types/components/stripe-card-element/stripe-card-element.d.ts +5 -1
- package/dist/types/components/stripe-card-element/stripe-card-element.helpers.d.ts +29 -0
- package/dist/types/components/stripe-card-element-modal/stripe-card-element-modal.d.ts +4 -4
- package/dist/types/components/stripe-payment-element/stripe-payment-element.d.ts +2 -2
- package/dist/types/components/stripe-payment-element/stripe-payment-element.helpers.d.ts +54 -0
- package/dist/types/components/stripe-payment-request-button/stripe-payment-request-button.d.ts +8 -0
- package/dist/types/components.d.ts +139 -29
- package/dist/types/index.d.ts +1 -0
- package/dist/types/services/interfaces.d.ts +3 -3
- package/dist/types/services/stripe-service.d.ts +2 -2
- package/dist/types/stencil-public-runtime.d.ts +110 -5
- package/package.json +50 -30
- package/readme.md +386 -133
- package/dist/cjs/app-globals-V2Kpy_OQ.js.map +0 -1
- package/dist/cjs/error-FFC4kSs5.js.map +0 -1
- package/dist/cjs/factory-CbbbSvkg.js.map +0 -1
- package/dist/cjs/index-BXVW_rzh.js +0 -1932
- package/dist/cjs/index-BXVW_rzh.js.map +0 -1
- package/dist/cjs/index-Ba1pBePA.js.map +0 -1
- package/dist/cjs/index.cjs.js.map +0 -1
- package/dist/cjs/ion-icon.entry.cjs.js.map +0 -1
- package/dist/cjs/loader.cjs.js.map +0 -1
- package/dist/cjs/stripe-address-element.entry.cjs.js.map +0 -1
- package/dist/cjs/stripe-card-element-modal.entry.cjs.js.map +0 -1
- package/dist/cjs/stripe-card-element.stripe-modal.entry.cjs.js.map +0 -1
- package/dist/cjs/stripe-currency-selector.entry.cjs.js.map +0 -1
- package/dist/cjs/stripe-elements.cjs.js.map +0 -1
- package/dist/cjs/stripe-express-checkout-element.entry.cjs.js.map +0 -1
- package/dist/cjs/stripe-link-authentication-element.entry.cjs.js.map +0 -1
- package/dist/cjs/stripe-payment-element.entry.cjs.js.map +0 -1
- package/dist/cjs/stripe-payment-request-button.entry.cjs.js.map +0 -1
- package/dist/collection/components/stripe-address-element/stripe-address-element.js.map +0 -1
- package/dist/collection/components/stripe-card-element/stripe-card-element.js.map +0 -1
- package/dist/collection/components/stripe-card-element-modal/stripe-card-element-modal.js.map +0 -1
- package/dist/collection/components/stripe-currency-selector/stripe-currency-selector.js.map +0 -1
- package/dist/collection/components/stripe-express-checkout-element/stripe-express-checkout-element.js.map +0 -1
- package/dist/collection/components/stripe-link-authentication-element/stripe-link-authentication-element.js.map +0 -1
- package/dist/collection/components/stripe-modal/stripe-modal.js.map +0 -1
- package/dist/collection/components/stripe-payment-element/stripe-payment-element.js.map +0 -1
- package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js.map +0 -1
- package/dist/collection/index.js.map +0 -1
- package/dist/collection/interfaces.js.map +0 -1
- package/dist/collection/services/address-element-manager.js.map +0 -1
- package/dist/collection/services/card-element-manager.js.map +0 -1
- package/dist/collection/services/currency-selector-element-manager.js.map +0 -1
- package/dist/collection/services/express-checkout-element-manager.js.map +0 -1
- package/dist/collection/services/factory.js.map +0 -1
- package/dist/collection/services/interfaces.js.map +0 -1
- package/dist/collection/services/link-authentication-element-manager.js.map +0 -1
- package/dist/collection/services/payment-element-manager.js.map +0 -1
- package/dist/collection/services/stripe-service.js.map +0 -1
- package/dist/collection/utils/element-finder.js.map +0 -1
- package/dist/collection/utils/error.js.map +0 -1
- package/dist/collection/utils/i18n.js.map +0 -1
- package/dist/collection/utils/platform.js.map +0 -1
- package/dist/collection/utils/test-setup.js.map +0 -1
- package/dist/collection/utils/utils.js.map +0 -1
- package/dist/components/error.js.map +0 -1
- package/dist/components/factory.js.map +0 -1
- package/dist/components/icon.js.map +0 -1
- package/dist/components/index.js.map +0 -1
- package/dist/components/index2.js.map +0 -1
- package/dist/components/ion-icon.js.map +0 -1
- package/dist/components/stripe-address-element.js.map +0 -1
- package/dist/components/stripe-card-element-modal.js.map +0 -1
- package/dist/components/stripe-card-element.js.map +0 -1
- package/dist/components/stripe-card-element2.js.map +0 -1
- package/dist/components/stripe-currency-selector.js.map +0 -1
- package/dist/components/stripe-express-checkout-element.js.map +0 -1
- package/dist/components/stripe-link-authentication-element.js.map +0 -1
- package/dist/components/stripe-modal.js.map +0 -1
- package/dist/components/stripe-modal2.js.map +0 -1
- package/dist/components/stripe-payment-element.js.map +0 -1
- package/dist/components/stripe-payment-request-button.js.map +0 -1
- package/dist/components/stripe-payment-request-button2.js.map +0 -1
- package/dist/components/utils.js.map +0 -1
- package/dist/esm/app-globals-DQuL1Twl.js.map +0 -1
- package/dist/esm/error-XRfh5Wrs.js.map +0 -1
- package/dist/esm/factory-Drde6-y7.js.map +0 -1
- package/dist/esm/index-BHDCxQOb.js.map +0 -1
- package/dist/esm/index-DJwTOfxZ.js +0 -1920
- package/dist/esm/index-DJwTOfxZ.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/ion-icon.entry.js.map +0 -1
- package/dist/esm/loader.js.map +0 -1
- package/dist/esm/stripe-address-element.entry.js.map +0 -1
- package/dist/esm/stripe-card-element-modal.entry.js.map +0 -1
- package/dist/esm/stripe-card-element.stripe-modal.entry.js.map +0 -1
- package/dist/esm/stripe-currency-selector.entry.js.map +0 -1
- package/dist/esm/stripe-elements.js.map +0 -1
- package/dist/esm/stripe-express-checkout-element.entry.js.map +0 -1
- package/dist/esm/stripe-link-authentication-element.entry.js.map +0 -1
- package/dist/esm/stripe-payment-element.entry.js.map +0 -1
- package/dist/esm/stripe-payment-request-button.entry.js.map +0 -1
- package/dist/stripe-elements/index.esm.js.map +0 -1
- package/dist/stripe-elements/ion-icon.entry.esm.js.map +0 -1
- package/dist/stripe-elements/loader.esm.js.map +0 -1
- package/dist/stripe-elements/p-02f6e421.entry.js +0 -2
- package/dist/stripe-elements/p-02f6e421.entry.js.map +0 -1
- package/dist/stripe-elements/p-19888fa6.entry.js +0 -2
- package/dist/stripe-elements/p-19888fa6.entry.js.map +0 -1
- package/dist/stripe-elements/p-4d505729.entry.js +0 -2
- package/dist/stripe-elements/p-4d505729.entry.js.map +0 -1
- package/dist/stripe-elements/p-7e7ad92a.entry.js +0 -2
- package/dist/stripe-elements/p-7e7ad92a.entry.js.map +0 -1
- package/dist/stripe-elements/p-8bb4212c.entry.js +0 -2
- package/dist/stripe-elements/p-8bb4212c.entry.js.map +0 -1
- package/dist/stripe-elements/p-9aee2b6b.entry.js +0 -2
- package/dist/stripe-elements/p-9aee2b6b.entry.js.map +0 -1
- package/dist/stripe-elements/p-BHDCxQOb.js +0 -2
- package/dist/stripe-elements/p-BHDCxQOb.js.map +0 -1
- package/dist/stripe-elements/p-DI2vmGaI.js +0 -2
- package/dist/stripe-elements/p-DI2vmGaI.js.map +0 -1
- package/dist/stripe-elements/p-DJwTOfxZ.js +0 -3
- package/dist/stripe-elements/p-DJwTOfxZ.js.map +0 -1
- package/dist/stripe-elements/p-DQuL1Twl.js.map +0 -1
- package/dist/stripe-elements/p-XRfh5Wrs.js.map +0 -1
- package/dist/stripe-elements/p-ba251393.entry.js +0 -2
- package/dist/stripe-elements/p-ba251393.entry.js.map +0 -1
- package/dist/stripe-elements/p-c649edfc.entry.js +0 -2
- package/dist/stripe-elements/p-c649edfc.entry.js.map +0 -1
- package/dist/stripe-elements/p-e8bb43ae.entry.js +0 -2
- package/dist/stripe-elements/p-e8bb43ae.entry.js.map +0 -1
- package/dist/stripe-elements/stripe-address-element.entry.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-card-element-modal.entry.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-card-element.stripe-modal.entry.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-currency-selector.entry.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-elements.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-express-checkout-element.entry.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-link-authentication-element.entry.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-payment-element.entry.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-payment-request-button.entry.esm.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var index$1 = require('./index-
|
|
3
|
+
var index = require('./index-Dkb0SxZc.js');
|
|
4
|
+
var index$1 = require('./index-CYbA1N_k.js');
|
|
5
5
|
|
|
6
6
|
const getPlatforms = (win) => setupPlatforms(win);
|
|
7
7
|
const setupPlatforms = (win = window) => {
|
|
@@ -278,7 +278,7 @@ const deepFind = (obj, path, keySeparator = '.') => {
|
|
|
278
278
|
}
|
|
279
279
|
return current;
|
|
280
280
|
};
|
|
281
|
-
const getCleanedCode = code => code?.replace(
|
|
281
|
+
const getCleanedCode = code => code?.replace(/_/g, '-');
|
|
282
282
|
|
|
283
283
|
const consoleLogger = {
|
|
284
284
|
type: 'logger',
|
|
@@ -539,7 +539,16 @@ function keysFromSelector(selector, opts) {
|
|
|
539
539
|
const {
|
|
540
540
|
[PATH_KEY]: path
|
|
541
541
|
} = selector(createProxy());
|
|
542
|
-
|
|
542
|
+
const keySeparator = opts?.keySeparator ?? '.';
|
|
543
|
+
const nsSeparator = opts?.nsSeparator ?? ':';
|
|
544
|
+
if (path.length > 1 && nsSeparator) {
|
|
545
|
+
const ns = opts?.ns;
|
|
546
|
+
const nsArray = Array.isArray(ns) ? ns : null;
|
|
547
|
+
if (nsArray && nsArray.length > 1 && nsArray.slice(1).includes(path[0])) {
|
|
548
|
+
return `${path[0]}${nsSeparator}${path.slice(1).join(keySeparator)}`;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
return path.join(keySeparator);
|
|
543
552
|
}
|
|
544
553
|
|
|
545
554
|
const checkedLoadedFor = {};
|
|
@@ -613,6 +622,10 @@ class Translator extends EventEmitter {
|
|
|
613
622
|
...opt
|
|
614
623
|
});
|
|
615
624
|
if (!Array.isArray(keys)) keys = [String(keys)];
|
|
625
|
+
keys = keys.map(k => typeof k === 'function' ? keysFromSelector(k, {
|
|
626
|
+
...this.options,
|
|
627
|
+
...opt
|
|
628
|
+
}) : String(k));
|
|
616
629
|
const returnDetails = opt.returnDetails !== undefined ? opt.returnDetails : this.options.returnDetails;
|
|
617
630
|
const keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator;
|
|
618
631
|
const {
|
|
@@ -859,6 +872,10 @@ class Translator extends EventEmitter {
|
|
|
859
872
|
let usedLng;
|
|
860
873
|
let usedNS;
|
|
861
874
|
if (isString(keys)) keys = [keys];
|
|
875
|
+
if (Array.isArray(keys)) keys = keys.map(k => typeof k === 'function' ? keysFromSelector(k, {
|
|
876
|
+
...this.options,
|
|
877
|
+
...opt
|
|
878
|
+
}) : k);
|
|
862
879
|
keys.forEach(k => {
|
|
863
880
|
if (this.isValidLookup(found)) return;
|
|
864
881
|
const extracted = this.extractFromKey(k, opt);
|
|
@@ -1099,9 +1116,6 @@ class PluralResolver {
|
|
|
1099
1116
|
this.logger = baseLogger.create('pluralResolver');
|
|
1100
1117
|
this.pluralRulesCache = {};
|
|
1101
1118
|
}
|
|
1102
|
-
addRule(lng, obj) {
|
|
1103
|
-
this.rules[lng] = obj;
|
|
1104
|
-
}
|
|
1105
1119
|
clearCache() {
|
|
1106
1120
|
this.pluralRulesCache = {};
|
|
1107
1121
|
}
|
|
@@ -1121,7 +1135,7 @@ class PluralResolver {
|
|
|
1121
1135
|
type
|
|
1122
1136
|
});
|
|
1123
1137
|
} catch (err) {
|
|
1124
|
-
if (
|
|
1138
|
+
if (typeof Intl === 'undefined') {
|
|
1125
1139
|
this.logger.error('No Intl support, please use an Intl polyfill!');
|
|
1126
1140
|
return dummyRule;
|
|
1127
1141
|
}
|
|
@@ -1302,13 +1316,13 @@ class Interpolator {
|
|
|
1302
1316
|
const handleHasOptions = (key, inheritedOptions) => {
|
|
1303
1317
|
const sep = this.nestingOptionsSeparator;
|
|
1304
1318
|
if (key.indexOf(sep) < 0) return key;
|
|
1305
|
-
const c = key.split(new RegExp(`${sep}[ ]*{`));
|
|
1319
|
+
const c = key.split(new RegExp(`${regexEscape(sep)}[ ]*{`));
|
|
1306
1320
|
let optionsString = `{${c[1]}`;
|
|
1307
1321
|
key = c[0];
|
|
1308
1322
|
optionsString = this.interpolate(optionsString, clonedOptions);
|
|
1309
1323
|
const matchedSingleQuotes = optionsString.match(/'/g);
|
|
1310
1324
|
const matchedDoubleQuotes = optionsString.match(/"/g);
|
|
1311
|
-
if ((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes
|
|
1325
|
+
if ((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes || (matchedDoubleQuotes?.length ?? 0) % 2 !== 0) {
|
|
1312
1326
|
optionsString = optionsString.replace(/'/g, '"');
|
|
1313
1327
|
}
|
|
1314
1328
|
try {
|
|
@@ -1790,6 +1804,28 @@ const bindMemberFunctions = inst => {
|
|
|
1790
1804
|
}
|
|
1791
1805
|
});
|
|
1792
1806
|
};
|
|
1807
|
+
const SUPPORT_NOTICE_KEY = '__i18next_supportNoticeShown';
|
|
1808
|
+
const getSupportNoticeShown = () => {
|
|
1809
|
+
if (typeof globalThis !== 'undefined' && !!globalThis[SUPPORT_NOTICE_KEY]) return true;
|
|
1810
|
+
if (typeof process !== 'undefined' && process.env && process.env.I18NEXT_NO_SUPPORT_NOTICE) return true;
|
|
1811
|
+
if (typeof process !== 'undefined' && process.env && "production" === 'production') return true;
|
|
1812
|
+
return false;
|
|
1813
|
+
};
|
|
1814
|
+
const setSupportNoticeShown = () => {
|
|
1815
|
+
if (typeof globalThis !== 'undefined') globalThis[SUPPORT_NOTICE_KEY] = true;
|
|
1816
|
+
};
|
|
1817
|
+
const usesLocize = inst => {
|
|
1818
|
+
if (inst?.modules?.backend?.name?.indexOf('Locize') > 0) return true;
|
|
1819
|
+
if (inst?.modules?.backend?.constructor?.name?.indexOf('Locize') > 0) return true;
|
|
1820
|
+
if (inst?.options?.backend?.backends) {
|
|
1821
|
+
if (inst.options.backend.backends.some(b => b?.name?.indexOf('Locize') > 0 || b?.constructor?.name?.indexOf('Locize') > 0)) return true;
|
|
1822
|
+
}
|
|
1823
|
+
if (inst?.options?.backend?.projectId) return true;
|
|
1824
|
+
if (inst?.options?.backend?.backendOptions) {
|
|
1825
|
+
if (inst.options.backend.backendOptions.some(b => b?.projectId)) return true;
|
|
1826
|
+
}
|
|
1827
|
+
return false;
|
|
1828
|
+
};
|
|
1793
1829
|
class I18n extends EventEmitter {
|
|
1794
1830
|
constructor(options = {}, callback) {
|
|
1795
1831
|
super();
|
|
@@ -1839,6 +1875,13 @@ class I18n extends EventEmitter {
|
|
|
1839
1875
|
if (options.nsSeparator !== undefined) {
|
|
1840
1876
|
this.options.userDefinedNsSeparator = options.nsSeparator;
|
|
1841
1877
|
}
|
|
1878
|
+
if (typeof this.options.overloadTranslationOptionHandler !== 'function') {
|
|
1879
|
+
this.options.overloadTranslationOptionHandler = defOpts.overloadTranslationOptionHandler;
|
|
1880
|
+
}
|
|
1881
|
+
if (this.options.showSupportNotice !== false && !usesLocize(this) && !getSupportNoticeShown()) {
|
|
1882
|
+
if (typeof console !== 'undefined' && typeof console.info !== 'undefined') console.info('🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙');
|
|
1883
|
+
setSupportNoticeShown();
|
|
1884
|
+
}
|
|
1842
1885
|
const createClassOnDemand = ClassOrObject => {
|
|
1843
1886
|
if (!ClassOrObject) return null;
|
|
1844
1887
|
if (typeof ClassOrObject === 'function') return new ClassOrObject();
|
|
@@ -2099,21 +2142,20 @@ class I18n extends EventEmitter {
|
|
|
2099
2142
|
o.lngs = o.lngs || fixedT.lngs;
|
|
2100
2143
|
o.ns = o.ns || fixedT.ns;
|
|
2101
2144
|
if (o.keyPrefix !== '') o.keyPrefix = o.keyPrefix || keyPrefix || fixedT.keyPrefix;
|
|
2145
|
+
const selectorOpts = {
|
|
2146
|
+
...this.options,
|
|
2147
|
+
...o
|
|
2148
|
+
};
|
|
2149
|
+
if (typeof o.keyPrefix === 'function') o.keyPrefix = keysFromSelector(o.keyPrefix, selectorOpts);
|
|
2102
2150
|
const keySeparator = this.options.keySeparator || '.';
|
|
2103
2151
|
let resultKey;
|
|
2104
2152
|
if (o.keyPrefix && Array.isArray(key)) {
|
|
2105
2153
|
resultKey = key.map(k => {
|
|
2106
|
-
if (typeof k === 'function') k = keysFromSelector(k,
|
|
2107
|
-
...this.options,
|
|
2108
|
-
...opts
|
|
2109
|
-
});
|
|
2154
|
+
if (typeof k === 'function') k = keysFromSelector(k, selectorOpts);
|
|
2110
2155
|
return `${o.keyPrefix}${keySeparator}${k}`;
|
|
2111
2156
|
});
|
|
2112
2157
|
} else {
|
|
2113
|
-
if (typeof key === 'function') key = keysFromSelector(key,
|
|
2114
|
-
...this.options,
|
|
2115
|
-
...opts
|
|
2116
|
-
});
|
|
2158
|
+
if (typeof key === 'function') key = keysFromSelector(key, selectorOpts);
|
|
2117
2159
|
resultKey = o.keyPrefix ? `${o.keyPrefix}${keySeparator}${key}` : key;
|
|
2118
2160
|
}
|
|
2119
2161
|
return this.t(resultKey, o);
|
|
@@ -2254,6 +2296,19 @@ class I18n extends EventEmitter {
|
|
|
2254
2296
|
clone.store = new ResourceStore(clonedData, mergedOptions);
|
|
2255
2297
|
clone.services.resourceStore = clone.store;
|
|
2256
2298
|
}
|
|
2299
|
+
if (options.interpolation) {
|
|
2300
|
+
const defOpts = get();
|
|
2301
|
+
const mergedInterpolation = {
|
|
2302
|
+
...defOpts.interpolation,
|
|
2303
|
+
...this.options.interpolation,
|
|
2304
|
+
...options.interpolation
|
|
2305
|
+
};
|
|
2306
|
+
const mergedForInterpolator = {
|
|
2307
|
+
...mergedOptions,
|
|
2308
|
+
interpolation: mergedInterpolation
|
|
2309
|
+
};
|
|
2310
|
+
clone.services.interpolator = new Interpolator(mergedForInterpolator);
|
|
2311
|
+
}
|
|
2257
2312
|
clone.translator = new Translator(clone.services, mergedOptions);
|
|
2258
2313
|
clone.translator.on('*', (event, ...args) => {
|
|
2259
2314
|
clone.emit(event, ...args);
|
|
@@ -2760,12 +2815,13 @@ instance.use(Browser).init({
|
|
|
2760
2815
|
const i18n = instance;
|
|
2761
2816
|
|
|
2762
2817
|
const appendToMap = (map, propName, value) => {
|
|
2763
|
-
|
|
2764
|
-
if (!
|
|
2765
|
-
|
|
2818
|
+
let refs = map.get(propName);
|
|
2819
|
+
if (!refs) {
|
|
2820
|
+
refs = [];
|
|
2821
|
+
map.set(propName, refs);
|
|
2766
2822
|
}
|
|
2767
|
-
|
|
2768
|
-
|
|
2823
|
+
if (!refs.some((ref) => ref.deref() === value)) {
|
|
2824
|
+
refs.push(new WeakRef(value));
|
|
2769
2825
|
}
|
|
2770
2826
|
};
|
|
2771
2827
|
const debounce = (fn, ms) => {
|
|
@@ -2793,33 +2849,54 @@ const debounce = (fn, ms) => {
|
|
|
2793
2849
|
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
2794
2850
|
const cleanupElements = debounce((map) => {
|
|
2795
2851
|
for (let key of map.keys()) {
|
|
2796
|
-
|
|
2852
|
+
const refs = map.get(key).filter((ref) => {
|
|
2853
|
+
const elm = ref.deref();
|
|
2854
|
+
return elm && isConnected(elm);
|
|
2855
|
+
});
|
|
2856
|
+
map.set(key, refs);
|
|
2797
2857
|
}
|
|
2798
2858
|
}, 2_000);
|
|
2859
|
+
const core = index.StencilCore;
|
|
2860
|
+
const forceUpdate = core.forceUpdate;
|
|
2861
|
+
const getRenderingRef = core.getRenderingRef;
|
|
2799
2862
|
const stencilSubscription = () => {
|
|
2800
|
-
if (typeof
|
|
2863
|
+
if (typeof getRenderingRef !== 'function' || typeof forceUpdate !== 'function') {
|
|
2801
2864
|
// If we are not in a stencil project, we do nothing.
|
|
2802
2865
|
// This function is not really exported by @stencil/core.
|
|
2803
2866
|
return {};
|
|
2804
2867
|
}
|
|
2868
|
+
const ensureForceUpdate = forceUpdate;
|
|
2869
|
+
const ensureGetRenderingRef = getRenderingRef;
|
|
2805
2870
|
const elmsToUpdate = new Map();
|
|
2806
2871
|
return {
|
|
2807
2872
|
dispose: () => elmsToUpdate.clear(),
|
|
2808
2873
|
get: (propName) => {
|
|
2809
|
-
const elm =
|
|
2874
|
+
const elm = ensureGetRenderingRef();
|
|
2810
2875
|
if (elm) {
|
|
2811
2876
|
appendToMap(elmsToUpdate, propName, elm);
|
|
2812
2877
|
}
|
|
2813
2878
|
},
|
|
2814
2879
|
set: (propName) => {
|
|
2815
|
-
const
|
|
2816
|
-
if (
|
|
2817
|
-
|
|
2880
|
+
const refs = elmsToUpdate.get(propName);
|
|
2881
|
+
if (refs) {
|
|
2882
|
+
const nextRefs = refs.filter((ref) => {
|
|
2883
|
+
const elm = ref.deref();
|
|
2884
|
+
if (!elm)
|
|
2885
|
+
return false;
|
|
2886
|
+
return ensureForceUpdate(elm);
|
|
2887
|
+
});
|
|
2888
|
+
elmsToUpdate.set(propName, nextRefs);
|
|
2818
2889
|
}
|
|
2819
2890
|
cleanupElements(elmsToUpdate);
|
|
2820
2891
|
},
|
|
2821
2892
|
reset: () => {
|
|
2822
|
-
elmsToUpdate.forEach((
|
|
2893
|
+
elmsToUpdate.forEach((refs) => {
|
|
2894
|
+
refs.forEach((ref) => {
|
|
2895
|
+
const elm = ref.deref();
|
|
2896
|
+
if (elm)
|
|
2897
|
+
ensureForceUpdate(elm);
|
|
2898
|
+
});
|
|
2899
|
+
});
|
|
2823
2900
|
cleanupElements(elmsToUpdate);
|
|
2824
2901
|
},
|
|
2825
2902
|
};
|
|
@@ -2827,8 +2904,11 @@ const stencilSubscription = () => {
|
|
|
2827
2904
|
|
|
2828
2905
|
const unwrap = (val) => (typeof val === 'function' ? val() : val);
|
|
2829
2906
|
const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
2830
|
-
const
|
|
2831
|
-
|
|
2907
|
+
const resolveDefaultState = () => (unwrap(defaultState) ?? {});
|
|
2908
|
+
const initialState = resolveDefaultState();
|
|
2909
|
+
let states = new Map(Object.entries(initialState));
|
|
2910
|
+
const proxyAvailable = typeof Proxy !== 'undefined';
|
|
2911
|
+
const plainState = proxyAvailable ? null : {};
|
|
2832
2912
|
const handlers = {
|
|
2833
2913
|
dispose: [],
|
|
2834
2914
|
get: [],
|
|
@@ -2840,7 +2920,10 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2840
2920
|
const reset = () => {
|
|
2841
2921
|
// When resetting the state, the default state may be a function - unwrap it to invoke it.
|
|
2842
2922
|
// otherwise, the state won't be properly reset
|
|
2843
|
-
states = new Map(Object.entries(
|
|
2923
|
+
states = new Map(Object.entries(resolveDefaultState()));
|
|
2924
|
+
if (!proxyAvailable) {
|
|
2925
|
+
syncPlainStateKeys();
|
|
2926
|
+
}
|
|
2844
2927
|
handlers.reset.forEach((cb) => cb());
|
|
2845
2928
|
};
|
|
2846
2929
|
const dispose = () => {
|
|
@@ -2857,12 +2940,14 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2857
2940
|
const oldValue = states.get(propName);
|
|
2858
2941
|
if (shouldUpdate(value, oldValue, propName)) {
|
|
2859
2942
|
states.set(propName, value);
|
|
2943
|
+
if (!proxyAvailable) {
|
|
2944
|
+
ensurePlainProperty(propName);
|
|
2945
|
+
}
|
|
2860
2946
|
handlers.set.forEach((cb) => cb(propName, value, oldValue));
|
|
2861
2947
|
}
|
|
2862
2948
|
};
|
|
2863
|
-
const state = (
|
|
2864
|
-
? {
|
|
2865
|
-
: new Proxy(unwrappedState, {
|
|
2949
|
+
const state = (proxyAvailable
|
|
2950
|
+
? new Proxy(initialState, {
|
|
2866
2951
|
get(_, propName) {
|
|
2867
2952
|
return get(propName);
|
|
2868
2953
|
},
|
|
@@ -2882,7 +2967,11 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2882
2967
|
set(propName, value);
|
|
2883
2968
|
return true;
|
|
2884
2969
|
},
|
|
2885
|
-
})
|
|
2970
|
+
})
|
|
2971
|
+
: (() => {
|
|
2972
|
+
syncPlainStateKeys();
|
|
2973
|
+
return plainState;
|
|
2974
|
+
})());
|
|
2886
2975
|
const on = (eventName, callback) => {
|
|
2887
2976
|
handlers[eventName].push(callback);
|
|
2888
2977
|
return () => {
|
|
@@ -2895,7 +2984,10 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2895
2984
|
cb(newValue);
|
|
2896
2985
|
}
|
|
2897
2986
|
};
|
|
2898
|
-
const resetHandler = () =>
|
|
2987
|
+
const resetHandler = () => {
|
|
2988
|
+
const snapshot = resolveDefaultState();
|
|
2989
|
+
cb(snapshot[propName]);
|
|
2990
|
+
};
|
|
2899
2991
|
// Register the handlers
|
|
2900
2992
|
const unSet = on('set', setHandler);
|
|
2901
2993
|
const unReset = on('reset', resetHandler);
|
|
@@ -2938,6 +3030,38 @@ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) =>
|
|
|
2938
3030
|
changeListeners.delete(listener);
|
|
2939
3031
|
}
|
|
2940
3032
|
};
|
|
3033
|
+
function ensurePlainProperty(key) {
|
|
3034
|
+
if (proxyAvailable || !plainState) {
|
|
3035
|
+
return;
|
|
3036
|
+
}
|
|
3037
|
+
if (Object.prototype.hasOwnProperty.call(plainState, key)) {
|
|
3038
|
+
return;
|
|
3039
|
+
}
|
|
3040
|
+
Object.defineProperty(plainState, key, {
|
|
3041
|
+
configurable: true,
|
|
3042
|
+
enumerable: true,
|
|
3043
|
+
get() {
|
|
3044
|
+
return get(key);
|
|
3045
|
+
},
|
|
3046
|
+
set(value) {
|
|
3047
|
+
set(key, value);
|
|
3048
|
+
},
|
|
3049
|
+
});
|
|
3050
|
+
}
|
|
3051
|
+
function syncPlainStateKeys() {
|
|
3052
|
+
if (proxyAvailable || !plainState) {
|
|
3053
|
+
return;
|
|
3054
|
+
}
|
|
3055
|
+
const knownKeys = new Set(states.keys());
|
|
3056
|
+
for (const key of Object.keys(plainState)) {
|
|
3057
|
+
if (!knownKeys.has(key)) {
|
|
3058
|
+
delete plainState[key];
|
|
3059
|
+
}
|
|
3060
|
+
}
|
|
3061
|
+
for (const key of knownKeys) {
|
|
3062
|
+
ensurePlainProperty(key);
|
|
3063
|
+
}
|
|
3064
|
+
}
|
|
2941
3065
|
return {
|
|
2942
3066
|
state,
|
|
2943
3067
|
get,
|
|
@@ -3010,10 +3134,10 @@ class StripeServiceClass {
|
|
|
3010
3134
|
// Update configuration
|
|
3011
3135
|
this.store.state.publishableKey = publishableKey;
|
|
3012
3136
|
this.store.state.isCheckoutSession = false;
|
|
3013
|
-
if (options === null || options === void 0 ? void 0 : options.stripeAccount) {
|
|
3137
|
+
if ((options === null || options === void 0 ? void 0 : options.stripeAccount) != null && (options === null || options === void 0 ? void 0 : options.stripeAccount) !== '') {
|
|
3014
3138
|
this.store.state.stripeAccount = options.stripeAccount;
|
|
3015
3139
|
}
|
|
3016
|
-
if (options === null || options === void 0 ? void 0 : options.applicationName) {
|
|
3140
|
+
if ((options === null || options === void 0 ? void 0 : options.applicationName) != null && (options === null || options === void 0 ? void 0 : options.applicationName) !== '') {
|
|
3017
3141
|
this.store.state.applicationName = options.applicationName;
|
|
3018
3142
|
}
|
|
3019
3143
|
// If Stripe.js already loaded with same config, do nothing
|
|
@@ -3049,10 +3173,10 @@ class StripeServiceClass {
|
|
|
3049
3173
|
// Update configuration
|
|
3050
3174
|
this.store.state.publishableKey = publishableKey;
|
|
3051
3175
|
this.store.state.isCheckoutSession = true;
|
|
3052
|
-
if (options === null || options === void 0 ? void 0 : options.stripeAccount) {
|
|
3176
|
+
if ((options === null || options === void 0 ? void 0 : options.stripeAccount) != null && (options === null || options === void 0 ? void 0 : options.stripeAccount) !== '') {
|
|
3053
3177
|
this.store.state.stripeAccount = options.stripeAccount;
|
|
3054
3178
|
}
|
|
3055
|
-
if (options === null || options === void 0 ? void 0 : options.applicationName) {
|
|
3179
|
+
if ((options === null || options === void 0 ? void 0 : options.applicationName) != null && (options === null || options === void 0 ? void 0 : options.applicationName) !== '') {
|
|
3056
3180
|
this.store.state.applicationName = options.applicationName;
|
|
3057
3181
|
}
|
|
3058
3182
|
this.store.state.loadStripeStatus = 'loading';
|
|
@@ -3066,7 +3190,7 @@ class StripeServiceClass {
|
|
|
3066
3190
|
});
|
|
3067
3191
|
this.store.state.stripe = stripe;
|
|
3068
3192
|
// Initialize Checkout instance instead of Elements
|
|
3069
|
-
const checkout = stripe.
|
|
3193
|
+
const checkout = stripe.initCheckoutElementsSdk({
|
|
3070
3194
|
clientSecret: checkoutSessionClientSecret,
|
|
3071
3195
|
elementsOptions: options === null || options === void 0 ? void 0 : options.elementsOptions,
|
|
3072
3196
|
});
|
|
@@ -3136,7 +3260,7 @@ new StripeServiceClass();
|
|
|
3136
3260
|
function findElement(containerElement, selector, timeout = 5000) {
|
|
3137
3261
|
return new Promise((resolve, reject) => {
|
|
3138
3262
|
const elem = containerElement.querySelector(selector);
|
|
3139
|
-
if (elem) {
|
|
3263
|
+
if (elem != null) {
|
|
3140
3264
|
return resolve(elem);
|
|
3141
3265
|
}
|
|
3142
3266
|
const timeoutId = setTimeout(() => {
|
|
@@ -3145,7 +3269,7 @@ function findElement(containerElement, selector, timeout = 5000) {
|
|
|
3145
3269
|
}, timeout);
|
|
3146
3270
|
const observer = new MutationObserver(() => {
|
|
3147
3271
|
const elem = containerElement.querySelector(selector);
|
|
3148
|
-
if (elem) {
|
|
3272
|
+
if (elem != null) {
|
|
3149
3273
|
clearTimeout(timeoutId);
|
|
3150
3274
|
observer.disconnect();
|
|
3151
3275
|
resolve(elem);
|
|
@@ -3188,11 +3312,11 @@ class CardElementManager {
|
|
|
3188
3312
|
*/
|
|
3189
3313
|
async initialize(containerElement) {
|
|
3190
3314
|
const elements = this.stripeService.getElements();
|
|
3191
|
-
if (
|
|
3315
|
+
if (elements == null) {
|
|
3192
3316
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3193
3317
|
}
|
|
3194
3318
|
// Unmount if already initialized
|
|
3195
|
-
if (this.cardElements) {
|
|
3319
|
+
if (this.cardElements != null) {
|
|
3196
3320
|
this.unmount();
|
|
3197
3321
|
}
|
|
3198
3322
|
// Create and mount card number element
|
|
@@ -3243,7 +3367,7 @@ class CardElementManager {
|
|
|
3243
3367
|
*/
|
|
3244
3368
|
unmount() {
|
|
3245
3369
|
var _a, _b, _c;
|
|
3246
|
-
if (
|
|
3370
|
+
if (this.cardElements == null) {
|
|
3247
3371
|
return;
|
|
3248
3372
|
}
|
|
3249
3373
|
(_a = this.cardElements.cardNumber) === null || _a === void 0 ? void 0 : _a.unmount();
|
|
@@ -3305,13 +3429,13 @@ class PaymentElementManager {
|
|
|
3305
3429
|
async initialize(containerElement, options) {
|
|
3306
3430
|
const isCheckoutSession = this.stripeService.state.isCheckoutSession;
|
|
3307
3431
|
// Unmount if already initialized
|
|
3308
|
-
if (this.paymentElement) {
|
|
3432
|
+
if (this.paymentElement != null) {
|
|
3309
3433
|
this.unmount();
|
|
3310
3434
|
}
|
|
3311
3435
|
if (isCheckoutSession) {
|
|
3312
3436
|
// Checkout Session mode: use checkout.createPaymentElement()
|
|
3313
3437
|
const checkout = this.stripeService.getCheckout();
|
|
3314
|
-
if (
|
|
3438
|
+
if (checkout == null) {
|
|
3315
3439
|
throw new Error('StripeService not initialized with Checkout Session. Call StripeService.initializeWithCheckoutSession() first.');
|
|
3316
3440
|
}
|
|
3317
3441
|
// Create payment element using Checkout instance
|
|
@@ -3320,7 +3444,7 @@ class PaymentElementManager {
|
|
|
3320
3444
|
else {
|
|
3321
3445
|
// Payment Intent mode: use elements.create('payment')
|
|
3322
3446
|
const elements = this.stripeService.getElements();
|
|
3323
|
-
if (
|
|
3447
|
+
if (elements == null) {
|
|
3324
3448
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3325
3449
|
}
|
|
3326
3450
|
// Create payment element with options
|
|
@@ -3357,7 +3481,7 @@ class PaymentElementManager {
|
|
|
3357
3481
|
* Unmount payment element
|
|
3358
3482
|
*/
|
|
3359
3483
|
unmount() {
|
|
3360
|
-
if (
|
|
3484
|
+
if (this.paymentElement == null) {
|
|
3361
3485
|
return;
|
|
3362
3486
|
}
|
|
3363
3487
|
this.paymentElement.unmount();
|
|
@@ -3396,11 +3520,11 @@ class AddressElementManager {
|
|
|
3396
3520
|
*/
|
|
3397
3521
|
async initialize(containerElement, options) {
|
|
3398
3522
|
const elements = this.stripeService.getElements();
|
|
3399
|
-
if (
|
|
3523
|
+
if (elements == null) {
|
|
3400
3524
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3401
3525
|
}
|
|
3402
3526
|
// Unmount if already initialized
|
|
3403
|
-
if (this.addressElement) {
|
|
3527
|
+
if (this.addressElement != null) {
|
|
3404
3528
|
this.unmount();
|
|
3405
3529
|
}
|
|
3406
3530
|
// Create and mount address element
|
|
@@ -3438,7 +3562,7 @@ class AddressElementManager {
|
|
|
3438
3562
|
* Unmount address element
|
|
3439
3563
|
*/
|
|
3440
3564
|
unmount() {
|
|
3441
|
-
if (
|
|
3565
|
+
if (this.addressElement == null) {
|
|
3442
3566
|
return;
|
|
3443
3567
|
}
|
|
3444
3568
|
this.addressElement.unmount();
|
|
@@ -3486,11 +3610,11 @@ class LinkAuthenticationElementManager {
|
|
|
3486
3610
|
*/
|
|
3487
3611
|
async initialize(containerElement, options) {
|
|
3488
3612
|
const elements = this.stripeService.getElements();
|
|
3489
|
-
if (
|
|
3613
|
+
if (elements == null) {
|
|
3490
3614
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3491
3615
|
}
|
|
3492
3616
|
// Unmount if already initialized
|
|
3493
|
-
if (this.linkAuthenticationElement) {
|
|
3617
|
+
if (this.linkAuthenticationElement != null) {
|
|
3494
3618
|
this.unmount();
|
|
3495
3619
|
}
|
|
3496
3620
|
// Create link authentication element
|
|
@@ -3529,7 +3653,7 @@ class LinkAuthenticationElementManager {
|
|
|
3529
3653
|
* Unmount link authentication element
|
|
3530
3654
|
*/
|
|
3531
3655
|
unmount() {
|
|
3532
|
-
if (
|
|
3656
|
+
if (this.linkAuthenticationElement == null) {
|
|
3533
3657
|
return;
|
|
3534
3658
|
}
|
|
3535
3659
|
this.linkAuthenticationElement.unmount();
|
|
@@ -3569,11 +3693,11 @@ class CurrencySelectorElementManager {
|
|
|
3569
3693
|
*/
|
|
3570
3694
|
async initialize(containerElement, options) {
|
|
3571
3695
|
const elements = this.stripeService.getElements();
|
|
3572
|
-
if (
|
|
3696
|
+
if (elements == null) {
|
|
3573
3697
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3574
3698
|
}
|
|
3575
3699
|
// Unmount if already initialized
|
|
3576
|
-
if (this.currencySelectorElement) {
|
|
3700
|
+
if (this.currencySelectorElement != null) {
|
|
3577
3701
|
this.unmount();
|
|
3578
3702
|
}
|
|
3579
3703
|
// Find mount point first to avoid element leak if findElement throws
|
|
@@ -3619,7 +3743,7 @@ class CurrencySelectorElementManager {
|
|
|
3619
3743
|
* Unmount currency selector element
|
|
3620
3744
|
*/
|
|
3621
3745
|
unmount() {
|
|
3622
|
-
if (
|
|
3746
|
+
if (this.currencySelectorElement == null) {
|
|
3623
3747
|
return;
|
|
3624
3748
|
}
|
|
3625
3749
|
this.currencySelectorElement.unmount();
|
|
@@ -3659,11 +3783,11 @@ class ExpressCheckoutElementManager {
|
|
|
3659
3783
|
*/
|
|
3660
3784
|
async initialize(containerElement, options, eventHandlers) {
|
|
3661
3785
|
const elements = this.stripeService.getElements();
|
|
3662
|
-
if (
|
|
3786
|
+
if (elements == null) {
|
|
3663
3787
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
3664
3788
|
}
|
|
3665
3789
|
// Unmount if already initialized
|
|
3666
|
-
if (this.expressCheckoutElement) {
|
|
3790
|
+
if (this.expressCheckoutElement != null) {
|
|
3667
3791
|
this.unmount();
|
|
3668
3792
|
}
|
|
3669
3793
|
// Convert buttonHeight from string to number if present
|
|
@@ -3681,19 +3805,19 @@ class ExpressCheckoutElementManager {
|
|
|
3681
3805
|
// Find the mount point
|
|
3682
3806
|
const mountPoint = await findElement(containerElement, '#express-checkout-element');
|
|
3683
3807
|
// Set up event handlers before mounting
|
|
3684
|
-
if (eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onConfirm) {
|
|
3808
|
+
if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onConfirm) != null) {
|
|
3685
3809
|
expressCheckout.on('confirm', eventHandlers.onConfirm);
|
|
3686
3810
|
}
|
|
3687
|
-
if (eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onClick) {
|
|
3811
|
+
if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onClick) != null) {
|
|
3688
3812
|
expressCheckout.on('click', eventHandlers.onClick);
|
|
3689
3813
|
}
|
|
3690
|
-
if (eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onCancel) {
|
|
3814
|
+
if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onCancel) != null) {
|
|
3691
3815
|
expressCheckout.on('cancel', eventHandlers.onCancel);
|
|
3692
3816
|
}
|
|
3693
|
-
if (eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onShippingAddressChange) {
|
|
3817
|
+
if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onShippingAddressChange) != null) {
|
|
3694
3818
|
expressCheckout.on('shippingaddresschange', eventHandlers.onShippingAddressChange);
|
|
3695
3819
|
}
|
|
3696
|
-
if (eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onShippingRateChange) {
|
|
3820
|
+
if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onShippingRateChange) != null) {
|
|
3697
3821
|
expressCheckout.on('shippingratechange', eventHandlers.onShippingRateChange);
|
|
3698
3822
|
}
|
|
3699
3823
|
// Add ready event handler
|
|
@@ -3716,7 +3840,7 @@ class ExpressCheckoutElementManager {
|
|
|
3716
3840
|
* @param options - Partial options to update
|
|
3717
3841
|
*/
|
|
3718
3842
|
update(options) {
|
|
3719
|
-
if (
|
|
3843
|
+
if (this.expressCheckoutElement == null) {
|
|
3720
3844
|
console.warn('Express Checkout Element not initialized. Cannot update options.');
|
|
3721
3845
|
return;
|
|
3722
3846
|
}
|
|
@@ -3747,7 +3871,7 @@ class ExpressCheckoutElementManager {
|
|
|
3747
3871
|
* Unmount express checkout element
|
|
3748
3872
|
*/
|
|
3749
3873
|
unmount() {
|
|
3750
|
-
if (
|
|
3874
|
+
if (this.expressCheckoutElement == null) {
|
|
3751
3875
|
return;
|
|
3752
3876
|
}
|
|
3753
3877
|
this.expressCheckoutElement.unmount();
|
|
@@ -3820,6 +3944,3 @@ const serviceFactory = new ServiceFactory();
|
|
|
3820
3944
|
exports.checkPlatform = checkPlatform;
|
|
3821
3945
|
exports.i18n = i18n;
|
|
3822
3946
|
exports.serviceFactory = serviceFactory;
|
|
3823
|
-
//# sourceMappingURL=factory-CbbbSvkg.js.map
|
|
3824
|
-
|
|
3825
|
-
//# sourceMappingURL=factory-CbbbSvkg.js.map
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
function _typeof(obj) {
|
|
4
|
+
"@babel/helpers - typeof";
|
|
5
|
+
|
|
6
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
7
|
+
_typeof = function (obj) {
|
|
8
|
+
return typeof obj;
|
|
9
|
+
};
|
|
10
|
+
} else {
|
|
11
|
+
_typeof = function (obj) {
|
|
12
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return _typeof(obj);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
var RELEASE_TRAIN = 'dahlia';
|
|
4
20
|
|
|
5
21
|
var runtimeVersionToUrlVersion = function runtimeVersionToUrlVersion(version) {
|
|
6
22
|
return version === 3 ? 'v3' : version;
|
|
@@ -52,7 +68,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
|
|
|
52
68
|
|
|
53
69
|
stripe._registerWrapper({
|
|
54
70
|
name: 'stripe-js',
|
|
55
|
-
version: "
|
|
71
|
+
version: "9.17.0",
|
|
56
72
|
startTime: startTime
|
|
57
73
|
});
|
|
58
74
|
};
|
|
@@ -136,13 +152,18 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
|
|
|
136
152
|
}
|
|
137
153
|
|
|
138
154
|
var pk = args[0];
|
|
155
|
+
|
|
156
|
+
if (typeof pk !== 'string') {
|
|
157
|
+
throw new Error("Expected publishable key to be of type string, got type ".concat(_typeof(pk), " instead."));
|
|
158
|
+
}
|
|
159
|
+
|
|
139
160
|
var isTestKey = pk.match(/^pk_test/); // @ts-expect-error this is not publicly typed
|
|
140
161
|
|
|
141
162
|
var version = runtimeVersionToUrlVersion(maybeStripe.version);
|
|
142
163
|
var expectedVersion = RELEASE_TRAIN;
|
|
143
164
|
|
|
144
165
|
if (isTestKey && version !== expectedVersion) {
|
|
145
|
-
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("
|
|
166
|
+
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.17.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
|
|
146
167
|
}
|
|
147
168
|
|
|
148
169
|
var stripe = maybeStripe.apply(undefined, args);
|
|
@@ -189,6 +210,3 @@ var loadStripe = function loadStripe() {
|
|
|
189
210
|
};
|
|
190
211
|
|
|
191
212
|
exports.loadStripe = loadStripe;
|
|
192
|
-
//# sourceMappingURL=index-Ba1pBePA.js.map
|
|
193
|
-
|
|
194
|
-
//# sourceMappingURL=index-Ba1pBePA.js.map
|