@pelcro/react-pelcro-js 2.5.0 → 2.6.0-beta.4
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/index.cjs.js +243 -47
- package/dist/index.esm.js +243 -48
- package/package.json +2 -1
package/dist/index.cjs.js
CHANGED
|
@@ -6327,13 +6327,34 @@ const getAddressById = id => {
|
|
|
6327
6327
|
};
|
|
6328
6328
|
/**
|
|
6329
6329
|
* Transforms locale names stored in our backend like
|
|
6330
|
-
* "en_US" into the
|
|
6330
|
+
* "en_US" into the standard accepted in core i18n methods: "en-US"
|
|
6331
6331
|
* @param {string} localeName
|
|
6332
6332
|
* @return {string | undefined}
|
|
6333
6333
|
* @example getCanonicalLocaleFormat("en_US") => "en-US"
|
|
6334
6334
|
*/
|
|
6335
6335
|
|
|
6336
6336
|
const getCanonicalLocaleFormat = localeName => localeName === null || localeName === void 0 ? void 0 : localeName.replace("_", "-");
|
|
6337
|
+
/**
|
|
6338
|
+
* @param {string} localeName
|
|
6339
|
+
* @return {string | undefined}
|
|
6340
|
+
* @example getLanguageWithoutRegion("en-US") => "en"
|
|
6341
|
+
*/
|
|
6342
|
+
|
|
6343
|
+
const getLanguageWithoutRegion = localeName => {
|
|
6344
|
+
var _getCanonicalLocaleFo;
|
|
6345
|
+
|
|
6346
|
+
return (_getCanonicalLocaleFo = getCanonicalLocaleFormat(localeName)) === null || _getCanonicalLocaleFo === void 0 ? void 0 : _getCanonicalLocaleFo.split("-")[0];
|
|
6347
|
+
};
|
|
6348
|
+
/**
|
|
6349
|
+
* Gets the current page language or fallbacks to site default
|
|
6350
|
+
* @return {string | undefined}
|
|
6351
|
+
*/
|
|
6352
|
+
|
|
6353
|
+
const getPageOrDefaultLanguage = () => {
|
|
6354
|
+
var _window$Pelcro$helper, _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
6355
|
+
|
|
6356
|
+
return (_window$Pelcro$helper = window.Pelcro.helpers.getHtmlLanguageAttribute()) !== null && _window$Pelcro$helper !== void 0 ? _window$Pelcro$helper : getLanguageWithoutRegion((_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$site = _window$Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r = _window$Pelcro$site.read) === null || _window$Pelcro$site$r === void 0 ? void 0 : (_window$Pelcro$site$r2 = _window$Pelcro$site$r.call(_window$Pelcro$site)) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.default_locale);
|
|
6357
|
+
};
|
|
6337
6358
|
/**
|
|
6338
6359
|
* Returns a formatted price string depending on locale
|
|
6339
6360
|
* @param {number} amount
|
|
@@ -6343,7 +6364,7 @@ const getCanonicalLocaleFormat = localeName => localeName === null || localeName
|
|
|
6343
6364
|
* @example getFormattedPriceByLocal(10, 'USD', 'en-US') => "$10.00"
|
|
6344
6365
|
*/
|
|
6345
6366
|
|
|
6346
|
-
const getFormattedPriceByLocal = (amount, currency = "USD", locale = "en
|
|
6367
|
+
const getFormattedPriceByLocal = (amount, currency = "USD", locale = "en") => {
|
|
6347
6368
|
const formatter = new Intl.NumberFormat(getCanonicalLocaleFormat(locale), {
|
|
6348
6369
|
style: "currency",
|
|
6349
6370
|
currency
|
|
@@ -6368,8 +6389,7 @@ const calcAndFormatItemsTotal = (items, currency) => {
|
|
|
6368
6389
|
totalWithoutDividingBy100 += parseFloat(item.price ? (item.price * item.quantity).toFixed(2) : item.amount.toFixed(2));
|
|
6369
6390
|
}
|
|
6370
6391
|
|
|
6371
|
-
|
|
6372
|
-
return getFormattedPriceByLocal(totalWithoutDividingBy100, currency, locale);
|
|
6392
|
+
return getFormattedPriceByLocal(totalWithoutDividingBy100, currency, getPageOrDefaultLanguage());
|
|
6373
6393
|
};
|
|
6374
6394
|
/**
|
|
6375
6395
|
* returns true if the URL contains a supported view trigger URL
|
|
@@ -6383,12 +6403,15 @@ const isValidViewFromURL = viewID => {
|
|
|
6383
6403
|
}
|
|
6384
6404
|
|
|
6385
6405
|
return false;
|
|
6406
|
+
/**
|
|
6407
|
+
*
|
|
6408
|
+
*/
|
|
6386
6409
|
|
|
6387
6410
|
function hasValidNewsletterUpdateUrl() {
|
|
6388
|
-
var _window$
|
|
6411
|
+
var _window$Pelcro2, _window$Pelcro2$uiSet;
|
|
6389
6412
|
|
|
6390
6413
|
if (viewID !== "newsletter-update") return false;
|
|
6391
|
-
const newsletters = (_window$
|
|
6414
|
+
const newsletters = (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$uiSet = _window$Pelcro2.uiSettings) === null || _window$Pelcro2$uiSet === void 0 ? void 0 : _window$Pelcro2$uiSet.newsletters;
|
|
6392
6415
|
const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
|
|
6393
6416
|
|
|
6394
6417
|
if (!siteHasNewslettersDefined) {
|
|
@@ -6562,9 +6585,8 @@ const getPaymentCardIcon$1 = name => {
|
|
|
6562
6585
|
}));
|
|
6563
6586
|
};
|
|
6564
6587
|
|
|
6565
|
-
var _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
6566
6588
|
const resources = {
|
|
6567
|
-
|
|
6589
|
+
en: {
|
|
6568
6590
|
common: common_en,
|
|
6569
6591
|
paymentMethod: paymentMethod_en,
|
|
6570
6592
|
newsletter: newsletter_en,
|
|
@@ -6586,7 +6608,7 @@ const resources = {
|
|
|
6586
6608
|
select: select_en,
|
|
6587
6609
|
notification: notification_en
|
|
6588
6610
|
},
|
|
6589
|
-
|
|
6611
|
+
fr: {
|
|
6590
6612
|
common: common_fr,
|
|
6591
6613
|
paymentMethod: paymentMethod_fr,
|
|
6592
6614
|
newsletter: newsletter_fr,
|
|
@@ -6608,13 +6630,14 @@ const resources = {
|
|
|
6608
6630
|
select: select_fr,
|
|
6609
6631
|
notification: notification_fr
|
|
6610
6632
|
}
|
|
6611
|
-
};
|
|
6612
|
-
|
|
6613
|
-
|
|
6633
|
+
}; // set UI language to the page language or default to the language in site settings
|
|
6634
|
+
|
|
6635
|
+
const locale = getPageOrDefaultLanguage();
|
|
6614
6636
|
i18next.use(initReactI18next) // passes i18n down to react-i18next,
|
|
6615
6637
|
.init({
|
|
6616
6638
|
resources,
|
|
6617
|
-
lng:
|
|
6639
|
+
lng: locale,
|
|
6640
|
+
fallbackLng: "en",
|
|
6618
6641
|
// debug: true,
|
|
6619
6642
|
interpolation: {
|
|
6620
6643
|
escapeValue: false // react already safes from xss
|
|
@@ -6625,6 +6648,16 @@ i18next.use(initReactI18next) // passes i18n down to react-i18next,
|
|
|
6625
6648
|
|
|
6626
6649
|
}
|
|
6627
6650
|
});
|
|
6651
|
+
const pageLanguageObserver = new MutationObserver(mutationsList => {
|
|
6652
|
+
mutationsList.forEach(mutationRecord => {
|
|
6653
|
+
if (mutationRecord.attributeName === "lang") {
|
|
6654
|
+
i18next.changeLanguage(window.Pelcro.helpers.getHtmlLanguageAttribute());
|
|
6655
|
+
}
|
|
6656
|
+
});
|
|
6657
|
+
});
|
|
6658
|
+
pageLanguageObserver.observe(document.documentElement, {
|
|
6659
|
+
attributes: true
|
|
6660
|
+
});
|
|
6628
6661
|
|
|
6629
6662
|
function _classPrivateFieldGet(receiver, privateMap) {
|
|
6630
6663
|
var descriptor = privateMap.get(receiver);
|
|
@@ -8238,6 +8271,175 @@ function shouldBlurContent(entitlements) {
|
|
|
8238
8271
|
return entitlements.every(entitlement => !window.Pelcro.user.isEntitledTo(entitlement));
|
|
8239
8272
|
}
|
|
8240
8273
|
|
|
8274
|
+
var pure$1 = createCommonjsModule(function (module, exports) {
|
|
8275
|
+
|
|
8276
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
8277
|
+
|
|
8278
|
+
function _typeof(obj) {
|
|
8279
|
+
"@babel/helpers - typeof";
|
|
8280
|
+
|
|
8281
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
8282
|
+
_typeof = function (obj) {
|
|
8283
|
+
return typeof obj;
|
|
8284
|
+
};
|
|
8285
|
+
} else {
|
|
8286
|
+
_typeof = function (obj) {
|
|
8287
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
8288
|
+
};
|
|
8289
|
+
}
|
|
8290
|
+
|
|
8291
|
+
return _typeof(obj);
|
|
8292
|
+
}
|
|
8293
|
+
|
|
8294
|
+
var V3_URL = 'https://js.stripe.com/v3';
|
|
8295
|
+
var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
|
|
8296
|
+
var EXISTING_SCRIPT_MESSAGE = 'loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used';
|
|
8297
|
+
var findScript = function findScript() {
|
|
8298
|
+
var scripts = document.querySelectorAll("script[src^=\"".concat(V3_URL, "\"]"));
|
|
8299
|
+
|
|
8300
|
+
for (var i = 0; i < scripts.length; i++) {
|
|
8301
|
+
var script = scripts[i];
|
|
8302
|
+
|
|
8303
|
+
if (!V3_URL_REGEX.test(script.src)) {
|
|
8304
|
+
continue;
|
|
8305
|
+
}
|
|
8306
|
+
|
|
8307
|
+
return script;
|
|
8308
|
+
}
|
|
8309
|
+
|
|
8310
|
+
return null;
|
|
8311
|
+
};
|
|
8312
|
+
|
|
8313
|
+
var injectScript = function injectScript(params) {
|
|
8314
|
+
var queryString = params && !params.advancedFraudSignals ? '?advancedFraudSignals=false' : '';
|
|
8315
|
+
var script = document.createElement('script');
|
|
8316
|
+
script.src = "".concat(V3_URL).concat(queryString);
|
|
8317
|
+
var headOrBody = document.head || document.body;
|
|
8318
|
+
|
|
8319
|
+
if (!headOrBody) {
|
|
8320
|
+
throw new Error('Expected document.body not to be null. Stripe.js requires a <body> element.');
|
|
8321
|
+
}
|
|
8322
|
+
|
|
8323
|
+
headOrBody.appendChild(script);
|
|
8324
|
+
return script;
|
|
8325
|
+
};
|
|
8326
|
+
|
|
8327
|
+
var registerWrapper = function registerWrapper(stripe, startTime) {
|
|
8328
|
+
if (!stripe || !stripe._registerWrapper) {
|
|
8329
|
+
return;
|
|
8330
|
+
}
|
|
8331
|
+
|
|
8332
|
+
stripe._registerWrapper({
|
|
8333
|
+
name: 'stripe-js',
|
|
8334
|
+
version: "1.21.1",
|
|
8335
|
+
startTime: startTime
|
|
8336
|
+
});
|
|
8337
|
+
};
|
|
8338
|
+
|
|
8339
|
+
var stripePromise = null;
|
|
8340
|
+
var loadScript = function loadScript(params) {
|
|
8341
|
+
// Ensure that we only attempt to load Stripe.js at most once
|
|
8342
|
+
if (stripePromise !== null) {
|
|
8343
|
+
return stripePromise;
|
|
8344
|
+
}
|
|
8345
|
+
|
|
8346
|
+
stripePromise = new Promise(function (resolve, reject) {
|
|
8347
|
+
if (typeof window === 'undefined') {
|
|
8348
|
+
// Resolve to null when imported server side. This makes the module
|
|
8349
|
+
// safe to import in an isomorphic code base.
|
|
8350
|
+
resolve(null);
|
|
8351
|
+
return;
|
|
8352
|
+
}
|
|
8353
|
+
|
|
8354
|
+
if (window.Stripe && params) {
|
|
8355
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
8356
|
+
}
|
|
8357
|
+
|
|
8358
|
+
if (window.Stripe) {
|
|
8359
|
+
resolve(window.Stripe);
|
|
8360
|
+
return;
|
|
8361
|
+
}
|
|
8362
|
+
|
|
8363
|
+
try {
|
|
8364
|
+
var script = findScript();
|
|
8365
|
+
|
|
8366
|
+
if (script && params) {
|
|
8367
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
8368
|
+
} else if (!script) {
|
|
8369
|
+
script = injectScript(params);
|
|
8370
|
+
}
|
|
8371
|
+
|
|
8372
|
+
script.addEventListener('load', function () {
|
|
8373
|
+
if (window.Stripe) {
|
|
8374
|
+
resolve(window.Stripe);
|
|
8375
|
+
} else {
|
|
8376
|
+
reject(new Error('Stripe.js not available'));
|
|
8377
|
+
}
|
|
8378
|
+
});
|
|
8379
|
+
script.addEventListener('error', function () {
|
|
8380
|
+
reject(new Error('Failed to load Stripe.js'));
|
|
8381
|
+
});
|
|
8382
|
+
} catch (error) {
|
|
8383
|
+
reject(error);
|
|
8384
|
+
return;
|
|
8385
|
+
}
|
|
8386
|
+
});
|
|
8387
|
+
return stripePromise;
|
|
8388
|
+
};
|
|
8389
|
+
var initStripe = function initStripe(maybeStripe, args, startTime) {
|
|
8390
|
+
if (maybeStripe === null) {
|
|
8391
|
+
return null;
|
|
8392
|
+
}
|
|
8393
|
+
|
|
8394
|
+
var stripe = maybeStripe.apply(undefined, args);
|
|
8395
|
+
registerWrapper(stripe, startTime);
|
|
8396
|
+
return stripe;
|
|
8397
|
+
};
|
|
8398
|
+
var validateLoadParams = function validateLoadParams(params) {
|
|
8399
|
+
var errorMessage = "invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ".concat(JSON.stringify(params), "\n");
|
|
8400
|
+
|
|
8401
|
+
if (params === null || _typeof(params) !== 'object') {
|
|
8402
|
+
throw new Error(errorMessage);
|
|
8403
|
+
}
|
|
8404
|
+
|
|
8405
|
+
if (Object.keys(params).length === 1 && typeof params.advancedFraudSignals === 'boolean') {
|
|
8406
|
+
return params;
|
|
8407
|
+
}
|
|
8408
|
+
|
|
8409
|
+
throw new Error(errorMessage);
|
|
8410
|
+
};
|
|
8411
|
+
|
|
8412
|
+
var loadParams;
|
|
8413
|
+
var loadStripeCalled = false;
|
|
8414
|
+
var loadStripe = function loadStripe() {
|
|
8415
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
8416
|
+
args[_key] = arguments[_key];
|
|
8417
|
+
}
|
|
8418
|
+
|
|
8419
|
+
loadStripeCalled = true;
|
|
8420
|
+
var startTime = Date.now();
|
|
8421
|
+
return loadScript(loadParams).then(function (maybeStripe) {
|
|
8422
|
+
return initStripe(maybeStripe, args, startTime);
|
|
8423
|
+
});
|
|
8424
|
+
};
|
|
8425
|
+
|
|
8426
|
+
loadStripe.setLoadParameters = function (params) {
|
|
8427
|
+
if (loadStripeCalled) {
|
|
8428
|
+
throw new Error('You cannot change load parameters after calling loadStripe');
|
|
8429
|
+
}
|
|
8430
|
+
|
|
8431
|
+
loadParams = validateLoadParams(params);
|
|
8432
|
+
};
|
|
8433
|
+
|
|
8434
|
+
exports.loadStripe = loadStripe;
|
|
8435
|
+
});
|
|
8436
|
+
|
|
8437
|
+
unwrapExports(pure$1);
|
|
8438
|
+
pure$1.loadStripe;
|
|
8439
|
+
|
|
8440
|
+
var pure = pure$1;
|
|
8441
|
+
var pure_1 = pure.loadStripe;
|
|
8442
|
+
|
|
8241
8443
|
/**
|
|
8242
8444
|
* @typedef {Object} OptionsType
|
|
8243
8445
|
* @property {boolean} loadPaymentSDKs
|
|
@@ -8307,8 +8509,15 @@ const initPaywalls = () => {
|
|
|
8307
8509
|
}
|
|
8308
8510
|
};
|
|
8309
8511
|
const loadPaymentSDKs = () => {
|
|
8310
|
-
//
|
|
8311
|
-
|
|
8512
|
+
// Lazy load stripe's SDK
|
|
8513
|
+
const {
|
|
8514
|
+
whenUserReady
|
|
8515
|
+
} = usePelcro.getStore();
|
|
8516
|
+
whenUserReady(() => {
|
|
8517
|
+
if (!window.Stripe) {
|
|
8518
|
+
pure_1(window.Pelcro.environment.stripe);
|
|
8519
|
+
}
|
|
8520
|
+
}); // Load PayPal SDK's
|
|
8312
8521
|
|
|
8313
8522
|
const supportsPaypal = Boolean(window.Pelcro.site.read().braintree_tokenization);
|
|
8314
8523
|
|
|
@@ -9744,7 +9953,7 @@ const FacebookLoginButton = ({
|
|
|
9744
9953
|
labelClassName = "",
|
|
9745
9954
|
iconClassName = ""
|
|
9746
9955
|
}) => {
|
|
9747
|
-
var _window$Pelcro$site$r
|
|
9956
|
+
var _window$Pelcro$site$r;
|
|
9748
9957
|
|
|
9749
9958
|
const facebookLoginEnabled = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.facebook_app_id;
|
|
9750
9959
|
const {
|
|
@@ -9783,7 +9992,7 @@ const FacebookLoginButton = ({
|
|
|
9783
9992
|
|
|
9784
9993
|
return facebookLoginEnabled ? /*#__PURE__*/React__default['default'].createElement(FacebookLogin, {
|
|
9785
9994
|
appId: window.Pelcro.site.read().facebook_app_id,
|
|
9786
|
-
language: (
|
|
9995
|
+
language: getPageOrDefaultLanguage(),
|
|
9787
9996
|
fields: "first_name,last_name,email,picture",
|
|
9788
9997
|
callback: onSuccess,
|
|
9789
9998
|
onFailure: onFailure,
|
|
@@ -13317,7 +13526,7 @@ const PaymentMethodContainer = props => {
|
|
|
13317
13526
|
return /*#__PURE__*/React__default['default'].createElement(es_13, {
|
|
13318
13527
|
apiKey: window.Pelcro.environment.stripe,
|
|
13319
13528
|
stripeAccount: window.Pelcro.site.read().account_id,
|
|
13320
|
-
locale:
|
|
13529
|
+
locale: getPageOrDefaultLanguage()
|
|
13321
13530
|
}, /*#__PURE__*/React__default['default'].createElement(es_11, null, /*#__PURE__*/React__default['default'].createElement(UnwrappedForm, Object.assign({
|
|
13322
13531
|
store: store$d
|
|
13323
13532
|
}, props))));
|
|
@@ -13429,9 +13638,6 @@ const DiscountedPrice = props => {
|
|
|
13429
13638
|
percentOff
|
|
13430
13639
|
}
|
|
13431
13640
|
} = React.useContext(store$d);
|
|
13432
|
-
const {
|
|
13433
|
-
default_locale
|
|
13434
|
-
} = Pelcro.site.read();
|
|
13435
13641
|
const {
|
|
13436
13642
|
order,
|
|
13437
13643
|
plan
|
|
@@ -13439,7 +13645,7 @@ const DiscountedPrice = props => {
|
|
|
13439
13645
|
const ecommOrderCurrency = (_order$currency = order === null || order === void 0 ? void 0 : order.currency) !== null && _order$currency !== void 0 ? _order$currency : order === null || order === void 0 ? void 0 : (_order$ = order[0]) === null || _order$ === void 0 ? void 0 : _order$.currency;
|
|
13440
13646
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
13441
13647
|
const discountedPriceWithoutTax = updatedPrice - taxAmount;
|
|
13442
|
-
const priceFormatted = getFormattedPriceByLocal(order ? updatedPrice : discountedPriceWithoutTax * planQuantity, ecommOrderCurrency !== null && ecommOrderCurrency !== void 0 ? ecommOrderCurrency : plan === null || plan === void 0 ? void 0 : plan.currency,
|
|
13648
|
+
const priceFormatted = getFormattedPriceByLocal(order ? updatedPrice : discountedPriceWithoutTax * planQuantity, ecommOrderCurrency !== null && ecommOrderCurrency !== void 0 ? ecommOrderCurrency : plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
13443
13649
|
|
|
13444
13650
|
if (percentOff) {
|
|
13445
13651
|
return /*#__PURE__*/React__default['default'].createElement("div", Object.assign({
|
|
@@ -13472,12 +13678,9 @@ const SubmitPaymentMethod = ({
|
|
|
13472
13678
|
updatedPrice
|
|
13473
13679
|
}
|
|
13474
13680
|
} = React.useContext(store$d);
|
|
13475
|
-
const {
|
|
13476
|
-
default_locale
|
|
13477
|
-
} = Pelcro.site.read();
|
|
13478
13681
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
13479
13682
|
const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
|
|
13480
|
-
const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency,
|
|
13683
|
+
const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
13481
13684
|
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
13482
13685
|
role: "submit",
|
|
13483
13686
|
className: "plc-w-full plc-py-3",
|
|
@@ -13722,7 +13925,7 @@ class PaypalClient {
|
|
|
13722
13925
|
this.paypalButton = window.paypal.Buttons({
|
|
13723
13926
|
fundingSource: window.paypal.FUNDING.PAYPAL,
|
|
13724
13927
|
// button locale
|
|
13725
|
-
locale: (_this$config$locale = this.config.locale) !== null && _this$config$locale !== void 0 ? _this$config$locale :
|
|
13928
|
+
locale: (_this$config$locale = this.config.locale) !== null && _this$config$locale !== void 0 ? _this$config$locale : getPageOrDefaultLanguage(),
|
|
13726
13929
|
// button style
|
|
13727
13930
|
style: (_this$config$style = this.config.style) !== null && _this$config$style !== void 0 ? _this$config$style : defaultButtonStyle,
|
|
13728
13931
|
// create payment handler
|
|
@@ -13819,7 +14022,7 @@ class PaypalClient {
|
|
|
13819
14022
|
} : undefined,
|
|
13820
14023
|
shippingAddressEditable: this.config.shippingAddressEditable,
|
|
13821
14024
|
displayName: (_this$config$displayN = this.config.displayName) !== null && _this$config$displayN !== void 0 ? _this$config$displayN : this.siteInfo.name,
|
|
13822
|
-
locale: (_this$config$locale2 = this.config.locale) !== null && _this$config$locale2 !== void 0 ? _this$config$locale2 :
|
|
14025
|
+
locale: (_this$config$locale2 = this.config.locale) !== null && _this$config$locale2 !== void 0 ? _this$config$locale2 : getPageOrDefaultLanguage()
|
|
13823
14026
|
};
|
|
13824
14027
|
}
|
|
13825
14028
|
});
|
|
@@ -13828,7 +14031,7 @@ class PaypalClient {
|
|
|
13828
14031
|
writable: true,
|
|
13829
14032
|
value: () => {
|
|
13830
14033
|
const totalAmount = (this.product.quantity || 1) * this.amount;
|
|
13831
|
-
const priceFormatted = getFormattedPriceByLocal(totalAmount, this.product.currency,
|
|
14034
|
+
const priceFormatted = getFormattedPriceByLocal(totalAmount, this.product.currency, getPageOrDefaultLanguage());
|
|
13832
14035
|
const autoRenewed = this.product.auto_renew;
|
|
13833
14036
|
const {
|
|
13834
14037
|
interval,
|
|
@@ -14025,14 +14228,11 @@ const TaxAmount = () => {
|
|
|
14025
14228
|
taxAmount
|
|
14026
14229
|
}
|
|
14027
14230
|
} = React.useContext(store$d);
|
|
14028
|
-
const {
|
|
14029
|
-
default_locale
|
|
14030
|
-
} = Pelcro.site.read();
|
|
14031
14231
|
const {
|
|
14032
14232
|
plan
|
|
14033
14233
|
} = usePelcro();
|
|
14034
14234
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
14035
|
-
const priceFormatted = getFormattedPriceByLocal(taxAmount * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency,
|
|
14235
|
+
const priceFormatted = getFormattedPriceByLocal(taxAmount * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
14036
14236
|
|
|
14037
14237
|
if (taxAmount) {
|
|
14038
14238
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -14905,10 +15105,7 @@ const SubscriptionCreateView = ({
|
|
|
14905
15105
|
interval,
|
|
14906
15106
|
count: interval_count
|
|
14907
15107
|
});
|
|
14908
|
-
const
|
|
14909
|
-
default_locale
|
|
14910
|
-
} = Pelcro.site.read();
|
|
14911
|
-
const priceFormatted = getFormattedPriceByLocal((plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1), plan === null || plan === void 0 ? void 0 : plan.currency, default_locale);
|
|
15108
|
+
const priceFormatted = getFormattedPriceByLocal((plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1), plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
14912
15109
|
return /*#__PURE__*/React__default['default'].createElement("p", {
|
|
14913
15110
|
className: "plc-text-gray-600"
|
|
14914
15111
|
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
@@ -18085,7 +18282,6 @@ const OrderConfirmModal = props => {
|
|
|
18085
18282
|
const userOrders = window.Pelcro.user.read().orders;
|
|
18086
18283
|
const latestOrder = userOrders === null || userOrders === void 0 ? void 0 : userOrders[userOrders.length - 1];
|
|
18087
18284
|
const latestOrderDiscount = latestOrder === null || latestOrder === void 0 ? void 0 : (_latestOrder$coupon = latestOrder.coupon) === null || _latestOrder$coupon === void 0 ? void 0 : _latestOrder$coupon.percent_off;
|
|
18088
|
-
const locale = window.Pelcro.site.read().default_locale;
|
|
18089
18285
|
const {
|
|
18090
18286
|
t
|
|
18091
18287
|
} = useTranslation("shop");
|
|
@@ -18144,7 +18340,7 @@ const OrderConfirmModal = props => {
|
|
|
18144
18340
|
className: "plc-mr-1 pelcro-summary-total-text"
|
|
18145
18341
|
}, t("labels.total")), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
18146
18342
|
className: "pelcro-summary-total"
|
|
18147
|
-
}, latestOrderDiscount && `(-${latestOrderDiscount}%) `, getFormattedPriceByLocal(latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.amount, latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.currency,
|
|
18343
|
+
}, latestOrderDiscount && `(-${latestOrderDiscount}%) `, getFormattedPriceByLocal(latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.amount, latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.currency, getPageOrDefaultLanguage())))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18148
18344
|
className: "plc-flex plc-justify-center plc-mt-6"
|
|
18149
18345
|
}, /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
18150
18346
|
id: "pelcro-submit",
|
|
@@ -20513,7 +20709,6 @@ const OrderItems = ({
|
|
|
20513
20709
|
const {
|
|
20514
20710
|
t
|
|
20515
20711
|
} = useTranslation("dashboard");
|
|
20516
|
-
const site = window.Pelcro.site.read();
|
|
20517
20712
|
return !(orders !== null && orders !== void 0 && orders.length) ? /*#__PURE__*/React__default['default'].createElement("tbody", null, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
20518
20713
|
colSpan: "3",
|
|
20519
20714
|
className: "plc-text-center plc-text-gray-500"
|
|
@@ -20529,7 +20724,7 @@ const OrderItems = ({
|
|
|
20529
20724
|
className: "plc-py-4 plc-pl-2"
|
|
20530
20725
|
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20531
20726
|
className: "plc-text-xl plc-font-semibold "
|
|
20532
|
-
}, getFormattedPriceByLocal(order.amount, order.currency,
|
|
20727
|
+
}, getFormattedPriceByLocal(order.amount, order.currency, getPageOrDefaultLanguage())), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20533
20728
|
className: "plc-text-xs plc-text-gray-400 plc-uppercase"
|
|
20534
20729
|
}, t("labels.orders.itemsAmount", {
|
|
20535
20730
|
count: getItemsAmount(order.id)
|
|
@@ -20558,7 +20753,7 @@ const OrderItems = ({
|
|
|
20558
20753
|
className: ""
|
|
20559
20754
|
}, item.product_sku_name))), /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20560
20755
|
className: "plc-font-semibold"
|
|
20561
|
-
}, getFormattedPriceByLocal(item.amount, order.currency,
|
|
20756
|
+
}, getFormattedPriceByLocal(item.amount, order.currency, getPageOrDefaultLanguage()))));
|
|
20562
20757
|
}), /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
20563
20758
|
colSpan: "3"
|
|
20564
20759
|
}, /*#__PURE__*/React__default['default'].createElement("hr", {
|
|
@@ -21285,7 +21480,7 @@ class Dashboard extends React.Component {
|
|
|
21285
21480
|
className: "plc-font-semibold plc-text-gray-500"
|
|
21286
21481
|
}, sub.plan.nickname), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21287
21482
|
className: "plc-text-xs plc-text-gray-400"
|
|
21288
|
-
}, getFormattedPriceByLocal(sub.plan.amount, sub.plan.currency,
|
|
21483
|
+
}, getFormattedPriceByLocal(sub.plan.amount, sub.plan.currency, getPageOrDefaultLanguage())))), /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21289
21484
|
className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${this.getSubscriptionStatus(sub).bgColor} plc-uppercase ${this.getSubscriptionStatus(sub).textColor} plc-rounded-lg`
|
|
21290
21485
|
}, this.getSubscriptionStatus(sub).icon, this.getSubscriptionStatus(sub).title), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
21291
21486
|
className: "plc-mb-4 plc-text-xs plc-text-gray-500"
|
|
@@ -21295,21 +21490,21 @@ class Dashboard extends React.Component {
|
|
|
21295
21490
|
className: "plc-inline-block plc-mt-1"
|
|
21296
21491
|
}, sub.shipments_remaining, " ", this.locale("labels.shipments")) : null)), /*#__PURE__*/React__default['default'].createElement("td", null, sub.cancel_at_period_end === 0 && /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
21297
21492
|
variant: "ghost",
|
|
21298
|
-
className: "plc-text-red-500 focus:plc-ring-red-500",
|
|
21493
|
+
className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-cancel-button",
|
|
21299
21494
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgXIconSolid, null),
|
|
21300
21495
|
onClick: onCancelClick,
|
|
21301
21496
|
disabled: this.state.disableSubmit,
|
|
21302
21497
|
"data-key": sub.id
|
|
21303
21498
|
}, this.locale("labels.unsubscribe")), sub.cancel_at_period_end === 1 && sub.plan.auto_renew && !sub.is_gift_recipient && /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
21304
21499
|
variant: "ghost",
|
|
21305
|
-
className: "plc-text-green-400 focus:plc-ring-green-300",
|
|
21500
|
+
className: "plc-text-green-400 focus:plc-ring-green-300 pelcro-dashboard-sub-reactivate-button",
|
|
21306
21501
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgRefresh, null),
|
|
21307
21502
|
onClick: onReactivateClick,
|
|
21308
21503
|
disabled: this.state.disableSubmit,
|
|
21309
21504
|
"data-key": sub.id
|
|
21310
21505
|
}, this.locale("labels.reactivate")), sub.cancel_at_period_end === 1 && /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
21311
21506
|
variant: "ghost",
|
|
21312
|
-
className: "plc-text-blue-400",
|
|
21507
|
+
className: "plc-text-blue-400 pelcro-dashboard-sub-renew-button",
|
|
21313
21508
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgRefresh, null),
|
|
21314
21509
|
onClick: onRenewClick,
|
|
21315
21510
|
disabled: this.state.disableSubmit,
|
|
@@ -21388,7 +21583,7 @@ class Dashboard extends React.Component {
|
|
|
21388
21583
|
className: "plc-font-semibold plc-text-gray-500"
|
|
21389
21584
|
}, recipient.plan.nickname), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21390
21585
|
className: "plc-text-xs plc-text-gray-400"
|
|
21391
|
-
}, getFormattedPriceByLocal(recipient.plan.amount, recipient.plan.currency,
|
|
21586
|
+
}, getFormattedPriceByLocal(recipient.plan.amount, recipient.plan.currency, getPageOrDefaultLanguage())))), recipient.status && /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21392
21587
|
className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${this.getSubscriptionStatus(recipient).bgColor} plc-uppercase ${this.getSubscriptionStatus(recipient).textColor} plc-rounded-lg`
|
|
21393
21588
|
}, this.getSubscriptionStatus(recipient).icon, this.getSubscriptionStatus(recipient).title), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
21394
21589
|
className: "plc-mb-4 plc-text-xs plc-text-gray-500"
|
|
@@ -23527,6 +23722,7 @@ exports.AddressUpdateSubmit = AddressUpdateSubmit;
|
|
|
23527
23722
|
exports.AddressUpdateTextInput = AddressUpdateTextInput;
|
|
23528
23723
|
exports.AddressUpdateView = AddressUpdateView;
|
|
23529
23724
|
exports.Alert = AlertWithContext;
|
|
23725
|
+
exports.AlertElement = Alert;
|
|
23530
23726
|
exports.ApplyCouponButton = ApplyCouponButton;
|
|
23531
23727
|
exports.Badge = Badge;
|
|
23532
23728
|
exports.BankRedirection = BankRedirection;
|
package/dist/index.esm.js
CHANGED
|
@@ -6297,13 +6297,34 @@ const getAddressById = id => {
|
|
|
6297
6297
|
};
|
|
6298
6298
|
/**
|
|
6299
6299
|
* Transforms locale names stored in our backend like
|
|
6300
|
-
* "en_US" into the
|
|
6300
|
+
* "en_US" into the standard accepted in core i18n methods: "en-US"
|
|
6301
6301
|
* @param {string} localeName
|
|
6302
6302
|
* @return {string | undefined}
|
|
6303
6303
|
* @example getCanonicalLocaleFormat("en_US") => "en-US"
|
|
6304
6304
|
*/
|
|
6305
6305
|
|
|
6306
6306
|
const getCanonicalLocaleFormat = localeName => localeName === null || localeName === void 0 ? void 0 : localeName.replace("_", "-");
|
|
6307
|
+
/**
|
|
6308
|
+
* @param {string} localeName
|
|
6309
|
+
* @return {string | undefined}
|
|
6310
|
+
* @example getLanguageWithoutRegion("en-US") => "en"
|
|
6311
|
+
*/
|
|
6312
|
+
|
|
6313
|
+
const getLanguageWithoutRegion = localeName => {
|
|
6314
|
+
var _getCanonicalLocaleFo;
|
|
6315
|
+
|
|
6316
|
+
return (_getCanonicalLocaleFo = getCanonicalLocaleFormat(localeName)) === null || _getCanonicalLocaleFo === void 0 ? void 0 : _getCanonicalLocaleFo.split("-")[0];
|
|
6317
|
+
};
|
|
6318
|
+
/**
|
|
6319
|
+
* Gets the current page language or fallbacks to site default
|
|
6320
|
+
* @return {string | undefined}
|
|
6321
|
+
*/
|
|
6322
|
+
|
|
6323
|
+
const getPageOrDefaultLanguage = () => {
|
|
6324
|
+
var _window$Pelcro$helper, _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
6325
|
+
|
|
6326
|
+
return (_window$Pelcro$helper = window.Pelcro.helpers.getHtmlLanguageAttribute()) !== null && _window$Pelcro$helper !== void 0 ? _window$Pelcro$helper : getLanguageWithoutRegion((_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$site = _window$Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r = _window$Pelcro$site.read) === null || _window$Pelcro$site$r === void 0 ? void 0 : (_window$Pelcro$site$r2 = _window$Pelcro$site$r.call(_window$Pelcro$site)) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.default_locale);
|
|
6327
|
+
};
|
|
6307
6328
|
/**
|
|
6308
6329
|
* Returns a formatted price string depending on locale
|
|
6309
6330
|
* @param {number} amount
|
|
@@ -6313,7 +6334,7 @@ const getCanonicalLocaleFormat = localeName => localeName === null || localeName
|
|
|
6313
6334
|
* @example getFormattedPriceByLocal(10, 'USD', 'en-US') => "$10.00"
|
|
6314
6335
|
*/
|
|
6315
6336
|
|
|
6316
|
-
const getFormattedPriceByLocal = (amount, currency = "USD", locale = "en
|
|
6337
|
+
const getFormattedPriceByLocal = (amount, currency = "USD", locale = "en") => {
|
|
6317
6338
|
const formatter = new Intl.NumberFormat(getCanonicalLocaleFormat(locale), {
|
|
6318
6339
|
style: "currency",
|
|
6319
6340
|
currency
|
|
@@ -6338,8 +6359,7 @@ const calcAndFormatItemsTotal = (items, currency) => {
|
|
|
6338
6359
|
totalWithoutDividingBy100 += parseFloat(item.price ? (item.price * item.quantity).toFixed(2) : item.amount.toFixed(2));
|
|
6339
6360
|
}
|
|
6340
6361
|
|
|
6341
|
-
|
|
6342
|
-
return getFormattedPriceByLocal(totalWithoutDividingBy100, currency, locale);
|
|
6362
|
+
return getFormattedPriceByLocal(totalWithoutDividingBy100, currency, getPageOrDefaultLanguage());
|
|
6343
6363
|
};
|
|
6344
6364
|
/**
|
|
6345
6365
|
* returns true if the URL contains a supported view trigger URL
|
|
@@ -6353,12 +6373,15 @@ const isValidViewFromURL = viewID => {
|
|
|
6353
6373
|
}
|
|
6354
6374
|
|
|
6355
6375
|
return false;
|
|
6376
|
+
/**
|
|
6377
|
+
*
|
|
6378
|
+
*/
|
|
6356
6379
|
|
|
6357
6380
|
function hasValidNewsletterUpdateUrl() {
|
|
6358
|
-
var _window$
|
|
6381
|
+
var _window$Pelcro2, _window$Pelcro2$uiSet;
|
|
6359
6382
|
|
|
6360
6383
|
if (viewID !== "newsletter-update") return false;
|
|
6361
|
-
const newsletters = (_window$
|
|
6384
|
+
const newsletters = (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$uiSet = _window$Pelcro2.uiSettings) === null || _window$Pelcro2$uiSet === void 0 ? void 0 : _window$Pelcro2$uiSet.newsletters;
|
|
6362
6385
|
const siteHasNewslettersDefined = Array.isArray(newsletters) && newsletters.length > 0;
|
|
6363
6386
|
|
|
6364
6387
|
if (!siteHasNewslettersDefined) {
|
|
@@ -6532,9 +6555,8 @@ const getPaymentCardIcon$1 = name => {
|
|
|
6532
6555
|
}));
|
|
6533
6556
|
};
|
|
6534
6557
|
|
|
6535
|
-
var _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
6536
6558
|
const resources = {
|
|
6537
|
-
|
|
6559
|
+
en: {
|
|
6538
6560
|
common: common_en,
|
|
6539
6561
|
paymentMethod: paymentMethod_en,
|
|
6540
6562
|
newsletter: newsletter_en,
|
|
@@ -6556,7 +6578,7 @@ const resources = {
|
|
|
6556
6578
|
select: select_en,
|
|
6557
6579
|
notification: notification_en
|
|
6558
6580
|
},
|
|
6559
|
-
|
|
6581
|
+
fr: {
|
|
6560
6582
|
common: common_fr,
|
|
6561
6583
|
paymentMethod: paymentMethod_fr,
|
|
6562
6584
|
newsletter: newsletter_fr,
|
|
@@ -6578,13 +6600,14 @@ const resources = {
|
|
|
6578
6600
|
select: select_fr,
|
|
6579
6601
|
notification: notification_fr
|
|
6580
6602
|
}
|
|
6581
|
-
};
|
|
6582
|
-
|
|
6583
|
-
|
|
6603
|
+
}; // set UI language to the page language or default to the language in site settings
|
|
6604
|
+
|
|
6605
|
+
const locale = getPageOrDefaultLanguage();
|
|
6584
6606
|
i18next.use(initReactI18next) // passes i18n down to react-i18next,
|
|
6585
6607
|
.init({
|
|
6586
6608
|
resources,
|
|
6587
|
-
lng:
|
|
6609
|
+
lng: locale,
|
|
6610
|
+
fallbackLng: "en",
|
|
6588
6611
|
// debug: true,
|
|
6589
6612
|
interpolation: {
|
|
6590
6613
|
escapeValue: false // react already safes from xss
|
|
@@ -6595,6 +6618,16 @@ i18next.use(initReactI18next) // passes i18n down to react-i18next,
|
|
|
6595
6618
|
|
|
6596
6619
|
}
|
|
6597
6620
|
});
|
|
6621
|
+
const pageLanguageObserver = new MutationObserver(mutationsList => {
|
|
6622
|
+
mutationsList.forEach(mutationRecord => {
|
|
6623
|
+
if (mutationRecord.attributeName === "lang") {
|
|
6624
|
+
i18next.changeLanguage(window.Pelcro.helpers.getHtmlLanguageAttribute());
|
|
6625
|
+
}
|
|
6626
|
+
});
|
|
6627
|
+
});
|
|
6628
|
+
pageLanguageObserver.observe(document.documentElement, {
|
|
6629
|
+
attributes: true
|
|
6630
|
+
});
|
|
6598
6631
|
|
|
6599
6632
|
function _classPrivateFieldGet(receiver, privateMap) {
|
|
6600
6633
|
var descriptor = privateMap.get(receiver);
|
|
@@ -8208,6 +8241,175 @@ function shouldBlurContent(entitlements) {
|
|
|
8208
8241
|
return entitlements.every(entitlement => !window.Pelcro.user.isEntitledTo(entitlement));
|
|
8209
8242
|
}
|
|
8210
8243
|
|
|
8244
|
+
var pure$1 = createCommonjsModule(function (module, exports) {
|
|
8245
|
+
|
|
8246
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
8247
|
+
|
|
8248
|
+
function _typeof(obj) {
|
|
8249
|
+
"@babel/helpers - typeof";
|
|
8250
|
+
|
|
8251
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
8252
|
+
_typeof = function (obj) {
|
|
8253
|
+
return typeof obj;
|
|
8254
|
+
};
|
|
8255
|
+
} else {
|
|
8256
|
+
_typeof = function (obj) {
|
|
8257
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
8258
|
+
};
|
|
8259
|
+
}
|
|
8260
|
+
|
|
8261
|
+
return _typeof(obj);
|
|
8262
|
+
}
|
|
8263
|
+
|
|
8264
|
+
var V3_URL = 'https://js.stripe.com/v3';
|
|
8265
|
+
var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
|
|
8266
|
+
var EXISTING_SCRIPT_MESSAGE = 'loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used';
|
|
8267
|
+
var findScript = function findScript() {
|
|
8268
|
+
var scripts = document.querySelectorAll("script[src^=\"".concat(V3_URL, "\"]"));
|
|
8269
|
+
|
|
8270
|
+
for (var i = 0; i < scripts.length; i++) {
|
|
8271
|
+
var script = scripts[i];
|
|
8272
|
+
|
|
8273
|
+
if (!V3_URL_REGEX.test(script.src)) {
|
|
8274
|
+
continue;
|
|
8275
|
+
}
|
|
8276
|
+
|
|
8277
|
+
return script;
|
|
8278
|
+
}
|
|
8279
|
+
|
|
8280
|
+
return null;
|
|
8281
|
+
};
|
|
8282
|
+
|
|
8283
|
+
var injectScript = function injectScript(params) {
|
|
8284
|
+
var queryString = params && !params.advancedFraudSignals ? '?advancedFraudSignals=false' : '';
|
|
8285
|
+
var script = document.createElement('script');
|
|
8286
|
+
script.src = "".concat(V3_URL).concat(queryString);
|
|
8287
|
+
var headOrBody = document.head || document.body;
|
|
8288
|
+
|
|
8289
|
+
if (!headOrBody) {
|
|
8290
|
+
throw new Error('Expected document.body not to be null. Stripe.js requires a <body> element.');
|
|
8291
|
+
}
|
|
8292
|
+
|
|
8293
|
+
headOrBody.appendChild(script);
|
|
8294
|
+
return script;
|
|
8295
|
+
};
|
|
8296
|
+
|
|
8297
|
+
var registerWrapper = function registerWrapper(stripe, startTime) {
|
|
8298
|
+
if (!stripe || !stripe._registerWrapper) {
|
|
8299
|
+
return;
|
|
8300
|
+
}
|
|
8301
|
+
|
|
8302
|
+
stripe._registerWrapper({
|
|
8303
|
+
name: 'stripe-js',
|
|
8304
|
+
version: "1.21.1",
|
|
8305
|
+
startTime: startTime
|
|
8306
|
+
});
|
|
8307
|
+
};
|
|
8308
|
+
|
|
8309
|
+
var stripePromise = null;
|
|
8310
|
+
var loadScript = function loadScript(params) {
|
|
8311
|
+
// Ensure that we only attempt to load Stripe.js at most once
|
|
8312
|
+
if (stripePromise !== null) {
|
|
8313
|
+
return stripePromise;
|
|
8314
|
+
}
|
|
8315
|
+
|
|
8316
|
+
stripePromise = new Promise(function (resolve, reject) {
|
|
8317
|
+
if (typeof window === 'undefined') {
|
|
8318
|
+
// Resolve to null when imported server side. This makes the module
|
|
8319
|
+
// safe to import in an isomorphic code base.
|
|
8320
|
+
resolve(null);
|
|
8321
|
+
return;
|
|
8322
|
+
}
|
|
8323
|
+
|
|
8324
|
+
if (window.Stripe && params) {
|
|
8325
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
8326
|
+
}
|
|
8327
|
+
|
|
8328
|
+
if (window.Stripe) {
|
|
8329
|
+
resolve(window.Stripe);
|
|
8330
|
+
return;
|
|
8331
|
+
}
|
|
8332
|
+
|
|
8333
|
+
try {
|
|
8334
|
+
var script = findScript();
|
|
8335
|
+
|
|
8336
|
+
if (script && params) {
|
|
8337
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
8338
|
+
} else if (!script) {
|
|
8339
|
+
script = injectScript(params);
|
|
8340
|
+
}
|
|
8341
|
+
|
|
8342
|
+
script.addEventListener('load', function () {
|
|
8343
|
+
if (window.Stripe) {
|
|
8344
|
+
resolve(window.Stripe);
|
|
8345
|
+
} else {
|
|
8346
|
+
reject(new Error('Stripe.js not available'));
|
|
8347
|
+
}
|
|
8348
|
+
});
|
|
8349
|
+
script.addEventListener('error', function () {
|
|
8350
|
+
reject(new Error('Failed to load Stripe.js'));
|
|
8351
|
+
});
|
|
8352
|
+
} catch (error) {
|
|
8353
|
+
reject(error);
|
|
8354
|
+
return;
|
|
8355
|
+
}
|
|
8356
|
+
});
|
|
8357
|
+
return stripePromise;
|
|
8358
|
+
};
|
|
8359
|
+
var initStripe = function initStripe(maybeStripe, args, startTime) {
|
|
8360
|
+
if (maybeStripe === null) {
|
|
8361
|
+
return null;
|
|
8362
|
+
}
|
|
8363
|
+
|
|
8364
|
+
var stripe = maybeStripe.apply(undefined, args);
|
|
8365
|
+
registerWrapper(stripe, startTime);
|
|
8366
|
+
return stripe;
|
|
8367
|
+
};
|
|
8368
|
+
var validateLoadParams = function validateLoadParams(params) {
|
|
8369
|
+
var errorMessage = "invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ".concat(JSON.stringify(params), "\n");
|
|
8370
|
+
|
|
8371
|
+
if (params === null || _typeof(params) !== 'object') {
|
|
8372
|
+
throw new Error(errorMessage);
|
|
8373
|
+
}
|
|
8374
|
+
|
|
8375
|
+
if (Object.keys(params).length === 1 && typeof params.advancedFraudSignals === 'boolean') {
|
|
8376
|
+
return params;
|
|
8377
|
+
}
|
|
8378
|
+
|
|
8379
|
+
throw new Error(errorMessage);
|
|
8380
|
+
};
|
|
8381
|
+
|
|
8382
|
+
var loadParams;
|
|
8383
|
+
var loadStripeCalled = false;
|
|
8384
|
+
var loadStripe = function loadStripe() {
|
|
8385
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
8386
|
+
args[_key] = arguments[_key];
|
|
8387
|
+
}
|
|
8388
|
+
|
|
8389
|
+
loadStripeCalled = true;
|
|
8390
|
+
var startTime = Date.now();
|
|
8391
|
+
return loadScript(loadParams).then(function (maybeStripe) {
|
|
8392
|
+
return initStripe(maybeStripe, args, startTime);
|
|
8393
|
+
});
|
|
8394
|
+
};
|
|
8395
|
+
|
|
8396
|
+
loadStripe.setLoadParameters = function (params) {
|
|
8397
|
+
if (loadStripeCalled) {
|
|
8398
|
+
throw new Error('You cannot change load parameters after calling loadStripe');
|
|
8399
|
+
}
|
|
8400
|
+
|
|
8401
|
+
loadParams = validateLoadParams(params);
|
|
8402
|
+
};
|
|
8403
|
+
|
|
8404
|
+
exports.loadStripe = loadStripe;
|
|
8405
|
+
});
|
|
8406
|
+
|
|
8407
|
+
unwrapExports(pure$1);
|
|
8408
|
+
pure$1.loadStripe;
|
|
8409
|
+
|
|
8410
|
+
var pure = pure$1;
|
|
8411
|
+
var pure_1 = pure.loadStripe;
|
|
8412
|
+
|
|
8211
8413
|
/**
|
|
8212
8414
|
* @typedef {Object} OptionsType
|
|
8213
8415
|
* @property {boolean} loadPaymentSDKs
|
|
@@ -8277,8 +8479,15 @@ const initPaywalls = () => {
|
|
|
8277
8479
|
}
|
|
8278
8480
|
};
|
|
8279
8481
|
const loadPaymentSDKs = () => {
|
|
8280
|
-
//
|
|
8281
|
-
|
|
8482
|
+
// Lazy load stripe's SDK
|
|
8483
|
+
const {
|
|
8484
|
+
whenUserReady
|
|
8485
|
+
} = usePelcro.getStore();
|
|
8486
|
+
whenUserReady(() => {
|
|
8487
|
+
if (!window.Stripe) {
|
|
8488
|
+
pure_1(window.Pelcro.environment.stripe);
|
|
8489
|
+
}
|
|
8490
|
+
}); // Load PayPal SDK's
|
|
8282
8491
|
|
|
8283
8492
|
const supportsPaypal = Boolean(window.Pelcro.site.read().braintree_tokenization);
|
|
8284
8493
|
|
|
@@ -9714,7 +9923,7 @@ const FacebookLoginButton = ({
|
|
|
9714
9923
|
labelClassName = "",
|
|
9715
9924
|
iconClassName = ""
|
|
9716
9925
|
}) => {
|
|
9717
|
-
var _window$Pelcro$site$r
|
|
9926
|
+
var _window$Pelcro$site$r;
|
|
9718
9927
|
|
|
9719
9928
|
const facebookLoginEnabled = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.facebook_app_id;
|
|
9720
9929
|
const {
|
|
@@ -9753,7 +9962,7 @@ const FacebookLoginButton = ({
|
|
|
9753
9962
|
|
|
9754
9963
|
return facebookLoginEnabled ? /*#__PURE__*/React__default.createElement(FacebookLogin, {
|
|
9755
9964
|
appId: window.Pelcro.site.read().facebook_app_id,
|
|
9756
|
-
language: (
|
|
9965
|
+
language: getPageOrDefaultLanguage(),
|
|
9757
9966
|
fields: "first_name,last_name,email,picture",
|
|
9758
9967
|
callback: onSuccess,
|
|
9759
9968
|
onFailure: onFailure,
|
|
@@ -13287,7 +13496,7 @@ const PaymentMethodContainer = props => {
|
|
|
13287
13496
|
return /*#__PURE__*/React__default.createElement(es_13, {
|
|
13288
13497
|
apiKey: window.Pelcro.environment.stripe,
|
|
13289
13498
|
stripeAccount: window.Pelcro.site.read().account_id,
|
|
13290
|
-
locale:
|
|
13499
|
+
locale: getPageOrDefaultLanguage()
|
|
13291
13500
|
}, /*#__PURE__*/React__default.createElement(es_11, null, /*#__PURE__*/React__default.createElement(UnwrappedForm, Object.assign({
|
|
13292
13501
|
store: store$d
|
|
13293
13502
|
}, props))));
|
|
@@ -13399,9 +13608,6 @@ const DiscountedPrice = props => {
|
|
|
13399
13608
|
percentOff
|
|
13400
13609
|
}
|
|
13401
13610
|
} = useContext(store$d);
|
|
13402
|
-
const {
|
|
13403
|
-
default_locale
|
|
13404
|
-
} = Pelcro.site.read();
|
|
13405
13611
|
const {
|
|
13406
13612
|
order,
|
|
13407
13613
|
plan
|
|
@@ -13409,7 +13615,7 @@ const DiscountedPrice = props => {
|
|
|
13409
13615
|
const ecommOrderCurrency = (_order$currency = order === null || order === void 0 ? void 0 : order.currency) !== null && _order$currency !== void 0 ? _order$currency : order === null || order === void 0 ? void 0 : (_order$ = order[0]) === null || _order$ === void 0 ? void 0 : _order$.currency;
|
|
13410
13616
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
13411
13617
|
const discountedPriceWithoutTax = updatedPrice - taxAmount;
|
|
13412
|
-
const priceFormatted = getFormattedPriceByLocal(order ? updatedPrice : discountedPriceWithoutTax * planQuantity, ecommOrderCurrency !== null && ecommOrderCurrency !== void 0 ? ecommOrderCurrency : plan === null || plan === void 0 ? void 0 : plan.currency,
|
|
13618
|
+
const priceFormatted = getFormattedPriceByLocal(order ? updatedPrice : discountedPriceWithoutTax * planQuantity, ecommOrderCurrency !== null && ecommOrderCurrency !== void 0 ? ecommOrderCurrency : plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
13413
13619
|
|
|
13414
13620
|
if (percentOff) {
|
|
13415
13621
|
return /*#__PURE__*/React__default.createElement("div", Object.assign({
|
|
@@ -13442,12 +13648,9 @@ const SubmitPaymentMethod = ({
|
|
|
13442
13648
|
updatedPrice
|
|
13443
13649
|
}
|
|
13444
13650
|
} = useContext(store$d);
|
|
13445
|
-
const {
|
|
13446
|
-
default_locale
|
|
13447
|
-
} = Pelcro.site.read();
|
|
13448
13651
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
13449
13652
|
const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
|
|
13450
|
-
const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency,
|
|
13653
|
+
const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
13451
13654
|
return /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
13452
13655
|
role: "submit",
|
|
13453
13656
|
className: "plc-w-full plc-py-3",
|
|
@@ -13692,7 +13895,7 @@ class PaypalClient {
|
|
|
13692
13895
|
this.paypalButton = window.paypal.Buttons({
|
|
13693
13896
|
fundingSource: window.paypal.FUNDING.PAYPAL,
|
|
13694
13897
|
// button locale
|
|
13695
|
-
locale: (_this$config$locale = this.config.locale) !== null && _this$config$locale !== void 0 ? _this$config$locale :
|
|
13898
|
+
locale: (_this$config$locale = this.config.locale) !== null && _this$config$locale !== void 0 ? _this$config$locale : getPageOrDefaultLanguage(),
|
|
13696
13899
|
// button style
|
|
13697
13900
|
style: (_this$config$style = this.config.style) !== null && _this$config$style !== void 0 ? _this$config$style : defaultButtonStyle,
|
|
13698
13901
|
// create payment handler
|
|
@@ -13789,7 +13992,7 @@ class PaypalClient {
|
|
|
13789
13992
|
} : undefined,
|
|
13790
13993
|
shippingAddressEditable: this.config.shippingAddressEditable,
|
|
13791
13994
|
displayName: (_this$config$displayN = this.config.displayName) !== null && _this$config$displayN !== void 0 ? _this$config$displayN : this.siteInfo.name,
|
|
13792
|
-
locale: (_this$config$locale2 = this.config.locale) !== null && _this$config$locale2 !== void 0 ? _this$config$locale2 :
|
|
13995
|
+
locale: (_this$config$locale2 = this.config.locale) !== null && _this$config$locale2 !== void 0 ? _this$config$locale2 : getPageOrDefaultLanguage()
|
|
13793
13996
|
};
|
|
13794
13997
|
}
|
|
13795
13998
|
});
|
|
@@ -13798,7 +14001,7 @@ class PaypalClient {
|
|
|
13798
14001
|
writable: true,
|
|
13799
14002
|
value: () => {
|
|
13800
14003
|
const totalAmount = (this.product.quantity || 1) * this.amount;
|
|
13801
|
-
const priceFormatted = getFormattedPriceByLocal(totalAmount, this.product.currency,
|
|
14004
|
+
const priceFormatted = getFormattedPriceByLocal(totalAmount, this.product.currency, getPageOrDefaultLanguage());
|
|
13802
14005
|
const autoRenewed = this.product.auto_renew;
|
|
13803
14006
|
const {
|
|
13804
14007
|
interval,
|
|
@@ -13995,14 +14198,11 @@ const TaxAmount = () => {
|
|
|
13995
14198
|
taxAmount
|
|
13996
14199
|
}
|
|
13997
14200
|
} = useContext(store$d);
|
|
13998
|
-
const {
|
|
13999
|
-
default_locale
|
|
14000
|
-
} = Pelcro.site.read();
|
|
14001
14201
|
const {
|
|
14002
14202
|
plan
|
|
14003
14203
|
} = usePelcro();
|
|
14004
14204
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
14005
|
-
const priceFormatted = getFormattedPriceByLocal(taxAmount * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency,
|
|
14205
|
+
const priceFormatted = getFormattedPriceByLocal(taxAmount * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
14006
14206
|
|
|
14007
14207
|
if (taxAmount) {
|
|
14008
14208
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -14875,10 +15075,7 @@ const SubscriptionCreateView = ({
|
|
|
14875
15075
|
interval,
|
|
14876
15076
|
count: interval_count
|
|
14877
15077
|
});
|
|
14878
|
-
const
|
|
14879
|
-
default_locale
|
|
14880
|
-
} = Pelcro.site.read();
|
|
14881
|
-
const priceFormatted = getFormattedPriceByLocal((plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1), plan === null || plan === void 0 ? void 0 : plan.currency, default_locale);
|
|
15078
|
+
const priceFormatted = getFormattedPriceByLocal((plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1), plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
14882
15079
|
return /*#__PURE__*/React__default.createElement("p", {
|
|
14883
15080
|
className: "plc-text-gray-600"
|
|
14884
15081
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
@@ -18055,7 +18252,6 @@ const OrderConfirmModal = props => {
|
|
|
18055
18252
|
const userOrders = window.Pelcro.user.read().orders;
|
|
18056
18253
|
const latestOrder = userOrders === null || userOrders === void 0 ? void 0 : userOrders[userOrders.length - 1];
|
|
18057
18254
|
const latestOrderDiscount = latestOrder === null || latestOrder === void 0 ? void 0 : (_latestOrder$coupon = latestOrder.coupon) === null || _latestOrder$coupon === void 0 ? void 0 : _latestOrder$coupon.percent_off;
|
|
18058
|
-
const locale = window.Pelcro.site.read().default_locale;
|
|
18059
18255
|
const {
|
|
18060
18256
|
t
|
|
18061
18257
|
} = useTranslation("shop");
|
|
@@ -18114,7 +18310,7 @@ const OrderConfirmModal = props => {
|
|
|
18114
18310
|
className: "plc-mr-1 pelcro-summary-total-text"
|
|
18115
18311
|
}, t("labels.total")), /*#__PURE__*/React__default.createElement("p", {
|
|
18116
18312
|
className: "pelcro-summary-total"
|
|
18117
|
-
}, latestOrderDiscount && `(-${latestOrderDiscount}%) `, getFormattedPriceByLocal(latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.amount, latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.currency,
|
|
18313
|
+
}, latestOrderDiscount && `(-${latestOrderDiscount}%) `, getFormattedPriceByLocal(latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.amount, latestOrder === null || latestOrder === void 0 ? void 0 : latestOrder.currency, getPageOrDefaultLanguage())))), /*#__PURE__*/React__default.createElement("div", {
|
|
18118
18314
|
className: "plc-flex plc-justify-center plc-mt-6"
|
|
18119
18315
|
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
18120
18316
|
id: "pelcro-submit",
|
|
@@ -20483,7 +20679,6 @@ const OrderItems = ({
|
|
|
20483
20679
|
const {
|
|
20484
20680
|
t
|
|
20485
20681
|
} = useTranslation("dashboard");
|
|
20486
|
-
const site = window.Pelcro.site.read();
|
|
20487
20682
|
return !(orders !== null && orders !== void 0 && orders.length) ? /*#__PURE__*/React__default.createElement("tbody", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
|
|
20488
20683
|
colSpan: "3",
|
|
20489
20684
|
className: "plc-text-center plc-text-gray-500"
|
|
@@ -20499,7 +20694,7 @@ const OrderItems = ({
|
|
|
20499
20694
|
className: "plc-py-4 plc-pl-2"
|
|
20500
20695
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
20501
20696
|
className: "plc-text-xl plc-font-semibold "
|
|
20502
|
-
}, getFormattedPriceByLocal(order.amount, order.currency,
|
|
20697
|
+
}, getFormattedPriceByLocal(order.amount, order.currency, getPageOrDefaultLanguage())), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", {
|
|
20503
20698
|
className: "plc-text-xs plc-text-gray-400 plc-uppercase"
|
|
20504
20699
|
}, t("labels.orders.itemsAmount", {
|
|
20505
20700
|
count: getItemsAmount(order.id)
|
|
@@ -20528,7 +20723,7 @@ const OrderItems = ({
|
|
|
20528
20723
|
className: ""
|
|
20529
20724
|
}, item.product_sku_name))), /*#__PURE__*/React__default.createElement("td", null, /*#__PURE__*/React__default.createElement("span", {
|
|
20530
20725
|
className: "plc-font-semibold"
|
|
20531
|
-
}, getFormattedPriceByLocal(item.amount, order.currency,
|
|
20726
|
+
}, getFormattedPriceByLocal(item.amount, order.currency, getPageOrDefaultLanguage()))));
|
|
20532
20727
|
}), /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
|
|
20533
20728
|
colSpan: "3"
|
|
20534
20729
|
}, /*#__PURE__*/React__default.createElement("hr", {
|
|
@@ -21255,7 +21450,7 @@ class Dashboard extends Component {
|
|
|
21255
21450
|
className: "plc-font-semibold plc-text-gray-500"
|
|
21256
21451
|
}, sub.plan.nickname), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", {
|
|
21257
21452
|
className: "plc-text-xs plc-text-gray-400"
|
|
21258
|
-
}, getFormattedPriceByLocal(sub.plan.amount, sub.plan.currency,
|
|
21453
|
+
}, getFormattedPriceByLocal(sub.plan.amount, sub.plan.currency, getPageOrDefaultLanguage())))), /*#__PURE__*/React__default.createElement("td", null, /*#__PURE__*/React__default.createElement("span", {
|
|
21259
21454
|
className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${this.getSubscriptionStatus(sub).bgColor} plc-uppercase ${this.getSubscriptionStatus(sub).textColor} plc-rounded-lg`
|
|
21260
21455
|
}, this.getSubscriptionStatus(sub).icon, this.getSubscriptionStatus(sub).title), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("div", {
|
|
21261
21456
|
className: "plc-mb-4 plc-text-xs plc-text-gray-500"
|
|
@@ -21265,21 +21460,21 @@ class Dashboard extends Component {
|
|
|
21265
21460
|
className: "plc-inline-block plc-mt-1"
|
|
21266
21461
|
}, sub.shipments_remaining, " ", this.locale("labels.shipments")) : null)), /*#__PURE__*/React__default.createElement("td", null, sub.cancel_at_period_end === 0 && /*#__PURE__*/React__default.createElement(Button, {
|
|
21267
21462
|
variant: "ghost",
|
|
21268
|
-
className: "plc-text-red-500 focus:plc-ring-red-500",
|
|
21463
|
+
className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-cancel-button",
|
|
21269
21464
|
icon: /*#__PURE__*/React__default.createElement(SvgXIconSolid, null),
|
|
21270
21465
|
onClick: onCancelClick,
|
|
21271
21466
|
disabled: this.state.disableSubmit,
|
|
21272
21467
|
"data-key": sub.id
|
|
21273
21468
|
}, this.locale("labels.unsubscribe")), sub.cancel_at_period_end === 1 && sub.plan.auto_renew && !sub.is_gift_recipient && /*#__PURE__*/React__default.createElement(Button, {
|
|
21274
21469
|
variant: "ghost",
|
|
21275
|
-
className: "plc-text-green-400 focus:plc-ring-green-300",
|
|
21470
|
+
className: "plc-text-green-400 focus:plc-ring-green-300 pelcro-dashboard-sub-reactivate-button",
|
|
21276
21471
|
icon: /*#__PURE__*/React__default.createElement(SvgRefresh, null),
|
|
21277
21472
|
onClick: onReactivateClick,
|
|
21278
21473
|
disabled: this.state.disableSubmit,
|
|
21279
21474
|
"data-key": sub.id
|
|
21280
21475
|
}, this.locale("labels.reactivate")), sub.cancel_at_period_end === 1 && /*#__PURE__*/React__default.createElement(Button, {
|
|
21281
21476
|
variant: "ghost",
|
|
21282
|
-
className: "plc-text-blue-400",
|
|
21477
|
+
className: "plc-text-blue-400 pelcro-dashboard-sub-renew-button",
|
|
21283
21478
|
icon: /*#__PURE__*/React__default.createElement(SvgRefresh, null),
|
|
21284
21479
|
onClick: onRenewClick,
|
|
21285
21480
|
disabled: this.state.disableSubmit,
|
|
@@ -21358,7 +21553,7 @@ class Dashboard extends Component {
|
|
|
21358
21553
|
className: "plc-font-semibold plc-text-gray-500"
|
|
21359
21554
|
}, recipient.plan.nickname), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", {
|
|
21360
21555
|
className: "plc-text-xs plc-text-gray-400"
|
|
21361
|
-
}, getFormattedPriceByLocal(recipient.plan.amount, recipient.plan.currency,
|
|
21556
|
+
}, getFormattedPriceByLocal(recipient.plan.amount, recipient.plan.currency, getPageOrDefaultLanguage())))), recipient.status && /*#__PURE__*/React__default.createElement("td", null, /*#__PURE__*/React__default.createElement("span", {
|
|
21362
21557
|
className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${this.getSubscriptionStatus(recipient).bgColor} plc-uppercase ${this.getSubscriptionStatus(recipient).textColor} plc-rounded-lg`
|
|
21363
21558
|
}, this.getSubscriptionStatus(recipient).icon, this.getSubscriptionStatus(recipient).title), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("div", {
|
|
21364
21559
|
className: "plc-mb-4 plc-text-xs plc-text-gray-500"
|
|
@@ -23465,4 +23660,4 @@ function ProfilePicChangeModal({
|
|
|
23465
23660
|
}
|
|
23466
23661
|
ProfilePicChangeModal.viewId = "profile-picture";
|
|
23467
23662
|
|
|
23468
|
-
export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, ApplyCouponButton, Badge, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, Email, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, Input, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCreateContainer, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, TaxAmount, TextArea, Tooltip, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, notify, unauthenticatedButtons, usePelcro };
|
|
23663
|
+
export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplyCouponButton, Badge, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, Email, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, Input, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCreateContainer, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, TaxAmount, TextArea, Tooltip, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, notify, unauthenticatedButtons, usePelcro };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pelcro/react-pelcro-js",
|
|
3
3
|
"description": "Pelcro's React UI Elements",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.6.0-beta.4",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
7
7
|
"main": "dist/index.cjs.js",
|
|
@@ -104,6 +104,7 @@
|
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
106
|
"@headlessui/react": "^0.3.0",
|
|
107
|
+
"@stripe/stripe-js": "^1.21.1",
|
|
107
108
|
"i18next": "^19.1.0",
|
|
108
109
|
"react-easy-crop": "^3.3.2",
|
|
109
110
|
"react-facebook-login": "^4.1.1",
|