@pelcro/react-pelcro-js 2.6.0-beta.1 → 2.6.0-beta.5
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 +256 -50
- package/dist/index.esm.js +256 -50
- 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) {
|
|
@@ -6561,10 +6584,20 @@ const getPaymentCardIcon$1 = name => {
|
|
|
6561
6584
|
d: "M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"
|
|
6562
6585
|
}));
|
|
6563
6586
|
};
|
|
6587
|
+
/**
|
|
6588
|
+
* Gets the current date with time set to 0
|
|
6589
|
+
* @param {Date} dateObject
|
|
6590
|
+
* @return {Date}
|
|
6591
|
+
*/
|
|
6592
|
+
|
|
6593
|
+
function getDateWithoutTime(dateObject) {
|
|
6594
|
+
const date = new Date(dateObject.getTime());
|
|
6595
|
+
date.setHours(0, 0, 0, 0);
|
|
6596
|
+
return date;
|
|
6597
|
+
}
|
|
6564
6598
|
|
|
6565
|
-
var _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
6566
6599
|
const resources = {
|
|
6567
|
-
|
|
6600
|
+
en: {
|
|
6568
6601
|
common: common_en,
|
|
6569
6602
|
paymentMethod: paymentMethod_en,
|
|
6570
6603
|
newsletter: newsletter_en,
|
|
@@ -6586,7 +6619,7 @@ const resources = {
|
|
|
6586
6619
|
select: select_en,
|
|
6587
6620
|
notification: notification_en
|
|
6588
6621
|
},
|
|
6589
|
-
|
|
6622
|
+
fr: {
|
|
6590
6623
|
common: common_fr,
|
|
6591
6624
|
paymentMethod: paymentMethod_fr,
|
|
6592
6625
|
newsletter: newsletter_fr,
|
|
@@ -6608,13 +6641,14 @@ const resources = {
|
|
|
6608
6641
|
select: select_fr,
|
|
6609
6642
|
notification: notification_fr
|
|
6610
6643
|
}
|
|
6611
|
-
};
|
|
6612
|
-
|
|
6613
|
-
|
|
6644
|
+
}; // set UI language to the page language or default to the language in site settings
|
|
6645
|
+
|
|
6646
|
+
const locale = getPageOrDefaultLanguage();
|
|
6614
6647
|
i18next.use(initReactI18next) // passes i18n down to react-i18next,
|
|
6615
6648
|
.init({
|
|
6616
6649
|
resources,
|
|
6617
|
-
lng:
|
|
6650
|
+
lng: locale,
|
|
6651
|
+
fallbackLng: "en",
|
|
6618
6652
|
// debug: true,
|
|
6619
6653
|
interpolation: {
|
|
6620
6654
|
escapeValue: false // react already safes from xss
|
|
@@ -6625,6 +6659,16 @@ i18next.use(initReactI18next) // passes i18n down to react-i18next,
|
|
|
6625
6659
|
|
|
6626
6660
|
}
|
|
6627
6661
|
});
|
|
6662
|
+
const pageLanguageObserver = new MutationObserver(mutationsList => {
|
|
6663
|
+
mutationsList.forEach(mutationRecord => {
|
|
6664
|
+
if (mutationRecord.attributeName === "lang") {
|
|
6665
|
+
i18next.changeLanguage(window.Pelcro.helpers.getHtmlLanguageAttribute());
|
|
6666
|
+
}
|
|
6667
|
+
});
|
|
6668
|
+
});
|
|
6669
|
+
pageLanguageObserver.observe(document.documentElement, {
|
|
6670
|
+
attributes: true
|
|
6671
|
+
});
|
|
6628
6672
|
|
|
6629
6673
|
function _classPrivateFieldGet(receiver, privateMap) {
|
|
6630
6674
|
var descriptor = privateMap.get(receiver);
|
|
@@ -8238,6 +8282,175 @@ function shouldBlurContent(entitlements) {
|
|
|
8238
8282
|
return entitlements.every(entitlement => !window.Pelcro.user.isEntitledTo(entitlement));
|
|
8239
8283
|
}
|
|
8240
8284
|
|
|
8285
|
+
var pure$1 = createCommonjsModule(function (module, exports) {
|
|
8286
|
+
|
|
8287
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
8288
|
+
|
|
8289
|
+
function _typeof(obj) {
|
|
8290
|
+
"@babel/helpers - typeof";
|
|
8291
|
+
|
|
8292
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
8293
|
+
_typeof = function (obj) {
|
|
8294
|
+
return typeof obj;
|
|
8295
|
+
};
|
|
8296
|
+
} else {
|
|
8297
|
+
_typeof = function (obj) {
|
|
8298
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
8299
|
+
};
|
|
8300
|
+
}
|
|
8301
|
+
|
|
8302
|
+
return _typeof(obj);
|
|
8303
|
+
}
|
|
8304
|
+
|
|
8305
|
+
var V3_URL = 'https://js.stripe.com/v3';
|
|
8306
|
+
var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
|
|
8307
|
+
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';
|
|
8308
|
+
var findScript = function findScript() {
|
|
8309
|
+
var scripts = document.querySelectorAll("script[src^=\"".concat(V3_URL, "\"]"));
|
|
8310
|
+
|
|
8311
|
+
for (var i = 0; i < scripts.length; i++) {
|
|
8312
|
+
var script = scripts[i];
|
|
8313
|
+
|
|
8314
|
+
if (!V3_URL_REGEX.test(script.src)) {
|
|
8315
|
+
continue;
|
|
8316
|
+
}
|
|
8317
|
+
|
|
8318
|
+
return script;
|
|
8319
|
+
}
|
|
8320
|
+
|
|
8321
|
+
return null;
|
|
8322
|
+
};
|
|
8323
|
+
|
|
8324
|
+
var injectScript = function injectScript(params) {
|
|
8325
|
+
var queryString = params && !params.advancedFraudSignals ? '?advancedFraudSignals=false' : '';
|
|
8326
|
+
var script = document.createElement('script');
|
|
8327
|
+
script.src = "".concat(V3_URL).concat(queryString);
|
|
8328
|
+
var headOrBody = document.head || document.body;
|
|
8329
|
+
|
|
8330
|
+
if (!headOrBody) {
|
|
8331
|
+
throw new Error('Expected document.body not to be null. Stripe.js requires a <body> element.');
|
|
8332
|
+
}
|
|
8333
|
+
|
|
8334
|
+
headOrBody.appendChild(script);
|
|
8335
|
+
return script;
|
|
8336
|
+
};
|
|
8337
|
+
|
|
8338
|
+
var registerWrapper = function registerWrapper(stripe, startTime) {
|
|
8339
|
+
if (!stripe || !stripe._registerWrapper) {
|
|
8340
|
+
return;
|
|
8341
|
+
}
|
|
8342
|
+
|
|
8343
|
+
stripe._registerWrapper({
|
|
8344
|
+
name: 'stripe-js',
|
|
8345
|
+
version: "1.21.1",
|
|
8346
|
+
startTime: startTime
|
|
8347
|
+
});
|
|
8348
|
+
};
|
|
8349
|
+
|
|
8350
|
+
var stripePromise = null;
|
|
8351
|
+
var loadScript = function loadScript(params) {
|
|
8352
|
+
// Ensure that we only attempt to load Stripe.js at most once
|
|
8353
|
+
if (stripePromise !== null) {
|
|
8354
|
+
return stripePromise;
|
|
8355
|
+
}
|
|
8356
|
+
|
|
8357
|
+
stripePromise = new Promise(function (resolve, reject) {
|
|
8358
|
+
if (typeof window === 'undefined') {
|
|
8359
|
+
// Resolve to null when imported server side. This makes the module
|
|
8360
|
+
// safe to import in an isomorphic code base.
|
|
8361
|
+
resolve(null);
|
|
8362
|
+
return;
|
|
8363
|
+
}
|
|
8364
|
+
|
|
8365
|
+
if (window.Stripe && params) {
|
|
8366
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
8367
|
+
}
|
|
8368
|
+
|
|
8369
|
+
if (window.Stripe) {
|
|
8370
|
+
resolve(window.Stripe);
|
|
8371
|
+
return;
|
|
8372
|
+
}
|
|
8373
|
+
|
|
8374
|
+
try {
|
|
8375
|
+
var script = findScript();
|
|
8376
|
+
|
|
8377
|
+
if (script && params) {
|
|
8378
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
8379
|
+
} else if (!script) {
|
|
8380
|
+
script = injectScript(params);
|
|
8381
|
+
}
|
|
8382
|
+
|
|
8383
|
+
script.addEventListener('load', function () {
|
|
8384
|
+
if (window.Stripe) {
|
|
8385
|
+
resolve(window.Stripe);
|
|
8386
|
+
} else {
|
|
8387
|
+
reject(new Error('Stripe.js not available'));
|
|
8388
|
+
}
|
|
8389
|
+
});
|
|
8390
|
+
script.addEventListener('error', function () {
|
|
8391
|
+
reject(new Error('Failed to load Stripe.js'));
|
|
8392
|
+
});
|
|
8393
|
+
} catch (error) {
|
|
8394
|
+
reject(error);
|
|
8395
|
+
return;
|
|
8396
|
+
}
|
|
8397
|
+
});
|
|
8398
|
+
return stripePromise;
|
|
8399
|
+
};
|
|
8400
|
+
var initStripe = function initStripe(maybeStripe, args, startTime) {
|
|
8401
|
+
if (maybeStripe === null) {
|
|
8402
|
+
return null;
|
|
8403
|
+
}
|
|
8404
|
+
|
|
8405
|
+
var stripe = maybeStripe.apply(undefined, args);
|
|
8406
|
+
registerWrapper(stripe, startTime);
|
|
8407
|
+
return stripe;
|
|
8408
|
+
};
|
|
8409
|
+
var validateLoadParams = function validateLoadParams(params) {
|
|
8410
|
+
var errorMessage = "invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ".concat(JSON.stringify(params), "\n");
|
|
8411
|
+
|
|
8412
|
+
if (params === null || _typeof(params) !== 'object') {
|
|
8413
|
+
throw new Error(errorMessage);
|
|
8414
|
+
}
|
|
8415
|
+
|
|
8416
|
+
if (Object.keys(params).length === 1 && typeof params.advancedFraudSignals === 'boolean') {
|
|
8417
|
+
return params;
|
|
8418
|
+
}
|
|
8419
|
+
|
|
8420
|
+
throw new Error(errorMessage);
|
|
8421
|
+
};
|
|
8422
|
+
|
|
8423
|
+
var loadParams;
|
|
8424
|
+
var loadStripeCalled = false;
|
|
8425
|
+
var loadStripe = function loadStripe() {
|
|
8426
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
8427
|
+
args[_key] = arguments[_key];
|
|
8428
|
+
}
|
|
8429
|
+
|
|
8430
|
+
loadStripeCalled = true;
|
|
8431
|
+
var startTime = Date.now();
|
|
8432
|
+
return loadScript(loadParams).then(function (maybeStripe) {
|
|
8433
|
+
return initStripe(maybeStripe, args, startTime);
|
|
8434
|
+
});
|
|
8435
|
+
};
|
|
8436
|
+
|
|
8437
|
+
loadStripe.setLoadParameters = function (params) {
|
|
8438
|
+
if (loadStripeCalled) {
|
|
8439
|
+
throw new Error('You cannot change load parameters after calling loadStripe');
|
|
8440
|
+
}
|
|
8441
|
+
|
|
8442
|
+
loadParams = validateLoadParams(params);
|
|
8443
|
+
};
|
|
8444
|
+
|
|
8445
|
+
exports.loadStripe = loadStripe;
|
|
8446
|
+
});
|
|
8447
|
+
|
|
8448
|
+
unwrapExports(pure$1);
|
|
8449
|
+
pure$1.loadStripe;
|
|
8450
|
+
|
|
8451
|
+
var pure = pure$1;
|
|
8452
|
+
var pure_1 = pure.loadStripe;
|
|
8453
|
+
|
|
8241
8454
|
/**
|
|
8242
8455
|
* @typedef {Object} OptionsType
|
|
8243
8456
|
* @property {boolean} loadPaymentSDKs
|
|
@@ -8307,8 +8520,15 @@ const initPaywalls = () => {
|
|
|
8307
8520
|
}
|
|
8308
8521
|
};
|
|
8309
8522
|
const loadPaymentSDKs = () => {
|
|
8310
|
-
//
|
|
8311
|
-
|
|
8523
|
+
// Lazy load stripe's SDK
|
|
8524
|
+
const {
|
|
8525
|
+
whenUserReady
|
|
8526
|
+
} = usePelcro.getStore();
|
|
8527
|
+
whenUserReady(() => {
|
|
8528
|
+
if (!window.Stripe) {
|
|
8529
|
+
pure_1(window.Pelcro.environment.stripe);
|
|
8530
|
+
}
|
|
8531
|
+
}); // Load PayPal SDK's
|
|
8312
8532
|
|
|
8313
8533
|
const supportsPaypal = Boolean(window.Pelcro.site.read().braintree_tokenization);
|
|
8314
8534
|
|
|
@@ -9744,7 +9964,7 @@ const FacebookLoginButton = ({
|
|
|
9744
9964
|
labelClassName = "",
|
|
9745
9965
|
iconClassName = ""
|
|
9746
9966
|
}) => {
|
|
9747
|
-
var _window$Pelcro$site$r
|
|
9967
|
+
var _window$Pelcro$site$r;
|
|
9748
9968
|
|
|
9749
9969
|
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
9970
|
const {
|
|
@@ -9783,7 +10003,7 @@ const FacebookLoginButton = ({
|
|
|
9783
10003
|
|
|
9784
10004
|
return facebookLoginEnabled ? /*#__PURE__*/React__default['default'].createElement(FacebookLogin, {
|
|
9785
10005
|
appId: window.Pelcro.site.read().facebook_app_id,
|
|
9786
|
-
language: (
|
|
10006
|
+
language: getPageOrDefaultLanguage(),
|
|
9787
10007
|
fields: "first_name,last_name,email,picture",
|
|
9788
10008
|
callback: onSuccess,
|
|
9789
10009
|
onFailure: onFailure,
|
|
@@ -13317,7 +13537,7 @@ const PaymentMethodContainer = props => {
|
|
|
13317
13537
|
return /*#__PURE__*/React__default['default'].createElement(es_13, {
|
|
13318
13538
|
apiKey: window.Pelcro.environment.stripe,
|
|
13319
13539
|
stripeAccount: window.Pelcro.site.read().account_id,
|
|
13320
|
-
locale:
|
|
13540
|
+
locale: getPageOrDefaultLanguage()
|
|
13321
13541
|
}, /*#__PURE__*/React__default['default'].createElement(es_11, null, /*#__PURE__*/React__default['default'].createElement(UnwrappedForm, Object.assign({
|
|
13322
13542
|
store: store$d
|
|
13323
13543
|
}, props))));
|
|
@@ -13429,9 +13649,6 @@ const DiscountedPrice = props => {
|
|
|
13429
13649
|
percentOff
|
|
13430
13650
|
}
|
|
13431
13651
|
} = React.useContext(store$d);
|
|
13432
|
-
const {
|
|
13433
|
-
default_locale
|
|
13434
|
-
} = Pelcro.site.read();
|
|
13435
13652
|
const {
|
|
13436
13653
|
order,
|
|
13437
13654
|
plan
|
|
@@ -13439,7 +13656,7 @@ const DiscountedPrice = props => {
|
|
|
13439
13656
|
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
13657
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
13441
13658
|
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,
|
|
13659
|
+
const priceFormatted = getFormattedPriceByLocal(order ? updatedPrice : discountedPriceWithoutTax * planQuantity, ecommOrderCurrency !== null && ecommOrderCurrency !== void 0 ? ecommOrderCurrency : plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
13443
13660
|
|
|
13444
13661
|
if (percentOff) {
|
|
13445
13662
|
return /*#__PURE__*/React__default['default'].createElement("div", Object.assign({
|
|
@@ -13472,12 +13689,9 @@ const SubmitPaymentMethod = ({
|
|
|
13472
13689
|
updatedPrice
|
|
13473
13690
|
}
|
|
13474
13691
|
} = React.useContext(store$d);
|
|
13475
|
-
const {
|
|
13476
|
-
default_locale
|
|
13477
|
-
} = Pelcro.site.read();
|
|
13478
13692
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
13479
13693
|
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,
|
|
13694
|
+
const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
13481
13695
|
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
13482
13696
|
role: "submit",
|
|
13483
13697
|
className: "plc-w-full plc-py-3",
|
|
@@ -13722,7 +13936,7 @@ class PaypalClient {
|
|
|
13722
13936
|
this.paypalButton = window.paypal.Buttons({
|
|
13723
13937
|
fundingSource: window.paypal.FUNDING.PAYPAL,
|
|
13724
13938
|
// button locale
|
|
13725
|
-
locale: (_this$config$locale = this.config.locale) !== null && _this$config$locale !== void 0 ? _this$config$locale :
|
|
13939
|
+
locale: (_this$config$locale = this.config.locale) !== null && _this$config$locale !== void 0 ? _this$config$locale : getPageOrDefaultLanguage(),
|
|
13726
13940
|
// button style
|
|
13727
13941
|
style: (_this$config$style = this.config.style) !== null && _this$config$style !== void 0 ? _this$config$style : defaultButtonStyle,
|
|
13728
13942
|
// create payment handler
|
|
@@ -13819,7 +14033,7 @@ class PaypalClient {
|
|
|
13819
14033
|
} : undefined,
|
|
13820
14034
|
shippingAddressEditable: this.config.shippingAddressEditable,
|
|
13821
14035
|
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 :
|
|
14036
|
+
locale: (_this$config$locale2 = this.config.locale) !== null && _this$config$locale2 !== void 0 ? _this$config$locale2 : getPageOrDefaultLanguage()
|
|
13823
14037
|
};
|
|
13824
14038
|
}
|
|
13825
14039
|
});
|
|
@@ -13828,7 +14042,7 @@ class PaypalClient {
|
|
|
13828
14042
|
writable: true,
|
|
13829
14043
|
value: () => {
|
|
13830
14044
|
const totalAmount = (this.product.quantity || 1) * this.amount;
|
|
13831
|
-
const priceFormatted = getFormattedPriceByLocal(totalAmount, this.product.currency,
|
|
14045
|
+
const priceFormatted = getFormattedPriceByLocal(totalAmount, this.product.currency, getPageOrDefaultLanguage());
|
|
13832
14046
|
const autoRenewed = this.product.auto_renew;
|
|
13833
14047
|
const {
|
|
13834
14048
|
interval,
|
|
@@ -14025,14 +14239,11 @@ const TaxAmount = () => {
|
|
|
14025
14239
|
taxAmount
|
|
14026
14240
|
}
|
|
14027
14241
|
} = React.useContext(store$d);
|
|
14028
|
-
const {
|
|
14029
|
-
default_locale
|
|
14030
|
-
} = Pelcro.site.read();
|
|
14031
14242
|
const {
|
|
14032
14243
|
plan
|
|
14033
14244
|
} = usePelcro();
|
|
14034
14245
|
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,
|
|
14246
|
+
const priceFormatted = getFormattedPriceByLocal(taxAmount * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
14036
14247
|
|
|
14037
14248
|
if (taxAmount) {
|
|
14038
14249
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -14905,10 +15116,7 @@ const SubscriptionCreateView = ({
|
|
|
14905
15116
|
interval,
|
|
14906
15117
|
count: interval_count
|
|
14907
15118
|
});
|
|
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);
|
|
15119
|
+
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
15120
|
return /*#__PURE__*/React__default['default'].createElement("p", {
|
|
14913
15121
|
className: "plc-text-gray-600"
|
|
14914
15122
|
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
@@ -18085,7 +18293,6 @@ const OrderConfirmModal = props => {
|
|
|
18085
18293
|
const userOrders = window.Pelcro.user.read().orders;
|
|
18086
18294
|
const latestOrder = userOrders === null || userOrders === void 0 ? void 0 : userOrders[userOrders.length - 1];
|
|
18087
18295
|
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
18296
|
const {
|
|
18090
18297
|
t
|
|
18091
18298
|
} = useTranslation("shop");
|
|
@@ -18144,7 +18351,7 @@ const OrderConfirmModal = props => {
|
|
|
18144
18351
|
className: "plc-mr-1 pelcro-summary-total-text"
|
|
18145
18352
|
}, t("labels.total")), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
18146
18353
|
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,
|
|
18354
|
+
}, 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
18355
|
className: "plc-flex plc-justify-center plc-mt-6"
|
|
18149
18356
|
}, /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
18150
18357
|
id: "pelcro-submit",
|
|
@@ -18206,9 +18413,9 @@ const GiftCreateContainer = ({
|
|
|
18206
18413
|
}
|
|
18207
18414
|
|
|
18208
18415
|
if (giftRecipient.startDate) {
|
|
18209
|
-
const nowDate = new Date();
|
|
18210
|
-
const yearFromNowDate = new Date(new Date().setFullYear(nowDate.getFullYear() + 1));
|
|
18211
|
-
const submittedDate = new Date(giftRecipient.startDate);
|
|
18416
|
+
const nowDate = getDateWithoutTime(new Date());
|
|
18417
|
+
const yearFromNowDate = getDateWithoutTime(new Date(new Date().setFullYear(nowDate.getFullYear() + 1)));
|
|
18418
|
+
const submittedDate = getDateWithoutTime(new Date(giftRecipient.startDate));
|
|
18212
18419
|
|
|
18213
18420
|
if (submittedDate < nowDate || submittedDate > yearFromNowDate) {
|
|
18214
18421
|
dispatch({
|
|
@@ -20513,7 +20720,6 @@ const OrderItems = ({
|
|
|
20513
20720
|
const {
|
|
20514
20721
|
t
|
|
20515
20722
|
} = useTranslation("dashboard");
|
|
20516
|
-
const site = window.Pelcro.site.read();
|
|
20517
20723
|
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
20724
|
colSpan: "3",
|
|
20519
20725
|
className: "plc-text-center plc-text-gray-500"
|
|
@@ -20529,7 +20735,7 @@ const OrderItems = ({
|
|
|
20529
20735
|
className: "plc-py-4 plc-pl-2"
|
|
20530
20736
|
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20531
20737
|
className: "plc-text-xl plc-font-semibold "
|
|
20532
|
-
}, getFormattedPriceByLocal(order.amount, order.currency,
|
|
20738
|
+
}, getFormattedPriceByLocal(order.amount, order.currency, getPageOrDefaultLanguage())), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20533
20739
|
className: "plc-text-xs plc-text-gray-400 plc-uppercase"
|
|
20534
20740
|
}, t("labels.orders.itemsAmount", {
|
|
20535
20741
|
count: getItemsAmount(order.id)
|
|
@@ -20558,7 +20764,7 @@ const OrderItems = ({
|
|
|
20558
20764
|
className: ""
|
|
20559
20765
|
}, item.product_sku_name))), /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20560
20766
|
className: "plc-font-semibold"
|
|
20561
|
-
}, getFormattedPriceByLocal(item.amount, order.currency,
|
|
20767
|
+
}, getFormattedPriceByLocal(item.amount, order.currency, getPageOrDefaultLanguage()))));
|
|
20562
20768
|
}), /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
20563
20769
|
colSpan: "3"
|
|
20564
20770
|
}, /*#__PURE__*/React__default['default'].createElement("hr", {
|
|
@@ -21285,7 +21491,7 @@ class Dashboard extends React.Component {
|
|
|
21285
21491
|
className: "plc-font-semibold plc-text-gray-500"
|
|
21286
21492
|
}, sub.plan.nickname), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21287
21493
|
className: "plc-text-xs plc-text-gray-400"
|
|
21288
|
-
}, getFormattedPriceByLocal(sub.plan.amount, sub.plan.currency,
|
|
21494
|
+
}, getFormattedPriceByLocal(sub.plan.amount, sub.plan.currency, getPageOrDefaultLanguage())))), /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21289
21495
|
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
21496
|
}, this.getSubscriptionStatus(sub).icon, this.getSubscriptionStatus(sub).title), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
21291
21497
|
className: "plc-mb-4 plc-text-xs plc-text-gray-500"
|
|
@@ -21295,21 +21501,21 @@ class Dashboard extends React.Component {
|
|
|
21295
21501
|
className: "plc-inline-block plc-mt-1"
|
|
21296
21502
|
}, 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
21503
|
variant: "ghost",
|
|
21298
|
-
className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-
|
|
21504
|
+
className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-cancel-button",
|
|
21299
21505
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgXIconSolid, null),
|
|
21300
21506
|
onClick: onCancelClick,
|
|
21301
21507
|
disabled: this.state.disableSubmit,
|
|
21302
21508
|
"data-key": sub.id
|
|
21303
21509
|
}, 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
21510
|
variant: "ghost",
|
|
21305
|
-
className: "plc-text-green-400 focus:plc-ring-green-300 pelcro-
|
|
21511
|
+
className: "plc-text-green-400 focus:plc-ring-green-300 pelcro-dashboard-sub-reactivate-button",
|
|
21306
21512
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgRefresh, null),
|
|
21307
21513
|
onClick: onReactivateClick,
|
|
21308
21514
|
disabled: this.state.disableSubmit,
|
|
21309
21515
|
"data-key": sub.id
|
|
21310
21516
|
}, this.locale("labels.reactivate")), sub.cancel_at_period_end === 1 && /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
21311
21517
|
variant: "ghost",
|
|
21312
|
-
className: "plc-text-blue-400 pelcro-
|
|
21518
|
+
className: "plc-text-blue-400 pelcro-dashboard-sub-renew-button",
|
|
21313
21519
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgRefresh, null),
|
|
21314
21520
|
onClick: onRenewClick,
|
|
21315
21521
|
disabled: this.state.disableSubmit,
|
|
@@ -21388,7 +21594,7 @@ class Dashboard extends React.Component {
|
|
|
21388
21594
|
className: "plc-font-semibold plc-text-gray-500"
|
|
21389
21595
|
}, recipient.plan.nickname), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21390
21596
|
className: "plc-text-xs plc-text-gray-400"
|
|
21391
|
-
}, getFormattedPriceByLocal(recipient.plan.amount, recipient.plan.currency,
|
|
21597
|
+
}, getFormattedPriceByLocal(recipient.plan.amount, recipient.plan.currency, getPageOrDefaultLanguage())))), recipient.status && /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
21392
21598
|
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
21599
|
}, this.getSubscriptionStatus(recipient).icon, this.getSubscriptionStatus(recipient).title), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
21394
21600
|
className: "plc-mb-4 plc-text-xs plc-text-gray-500"
|
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) {
|
|
@@ -6531,10 +6554,20 @@ const getPaymentCardIcon$1 = name => {
|
|
|
6531
6554
|
d: "M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"
|
|
6532
6555
|
}));
|
|
6533
6556
|
};
|
|
6557
|
+
/**
|
|
6558
|
+
* Gets the current date with time set to 0
|
|
6559
|
+
* @param {Date} dateObject
|
|
6560
|
+
* @return {Date}
|
|
6561
|
+
*/
|
|
6562
|
+
|
|
6563
|
+
function getDateWithoutTime(dateObject) {
|
|
6564
|
+
const date = new Date(dateObject.getTime());
|
|
6565
|
+
date.setHours(0, 0, 0, 0);
|
|
6566
|
+
return date;
|
|
6567
|
+
}
|
|
6534
6568
|
|
|
6535
|
-
var _window$Pelcro, _window$Pelcro$site, _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
6536
6569
|
const resources = {
|
|
6537
|
-
|
|
6570
|
+
en: {
|
|
6538
6571
|
common: common_en,
|
|
6539
6572
|
paymentMethod: paymentMethod_en,
|
|
6540
6573
|
newsletter: newsletter_en,
|
|
@@ -6556,7 +6589,7 @@ const resources = {
|
|
|
6556
6589
|
select: select_en,
|
|
6557
6590
|
notification: notification_en
|
|
6558
6591
|
},
|
|
6559
|
-
|
|
6592
|
+
fr: {
|
|
6560
6593
|
common: common_fr,
|
|
6561
6594
|
paymentMethod: paymentMethod_fr,
|
|
6562
6595
|
newsletter: newsletter_fr,
|
|
@@ -6578,13 +6611,14 @@ const resources = {
|
|
|
6578
6611
|
select: select_fr,
|
|
6579
6612
|
notification: notification_fr
|
|
6580
6613
|
}
|
|
6581
|
-
};
|
|
6582
|
-
|
|
6583
|
-
|
|
6614
|
+
}; // set UI language to the page language or default to the language in site settings
|
|
6615
|
+
|
|
6616
|
+
const locale = getPageOrDefaultLanguage();
|
|
6584
6617
|
i18next.use(initReactI18next) // passes i18n down to react-i18next,
|
|
6585
6618
|
.init({
|
|
6586
6619
|
resources,
|
|
6587
|
-
lng:
|
|
6620
|
+
lng: locale,
|
|
6621
|
+
fallbackLng: "en",
|
|
6588
6622
|
// debug: true,
|
|
6589
6623
|
interpolation: {
|
|
6590
6624
|
escapeValue: false // react already safes from xss
|
|
@@ -6595,6 +6629,16 @@ i18next.use(initReactI18next) // passes i18n down to react-i18next,
|
|
|
6595
6629
|
|
|
6596
6630
|
}
|
|
6597
6631
|
});
|
|
6632
|
+
const pageLanguageObserver = new MutationObserver(mutationsList => {
|
|
6633
|
+
mutationsList.forEach(mutationRecord => {
|
|
6634
|
+
if (mutationRecord.attributeName === "lang") {
|
|
6635
|
+
i18next.changeLanguage(window.Pelcro.helpers.getHtmlLanguageAttribute());
|
|
6636
|
+
}
|
|
6637
|
+
});
|
|
6638
|
+
});
|
|
6639
|
+
pageLanguageObserver.observe(document.documentElement, {
|
|
6640
|
+
attributes: true
|
|
6641
|
+
});
|
|
6598
6642
|
|
|
6599
6643
|
function _classPrivateFieldGet(receiver, privateMap) {
|
|
6600
6644
|
var descriptor = privateMap.get(receiver);
|
|
@@ -8208,6 +8252,175 @@ function shouldBlurContent(entitlements) {
|
|
|
8208
8252
|
return entitlements.every(entitlement => !window.Pelcro.user.isEntitledTo(entitlement));
|
|
8209
8253
|
}
|
|
8210
8254
|
|
|
8255
|
+
var pure$1 = createCommonjsModule(function (module, exports) {
|
|
8256
|
+
|
|
8257
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
8258
|
+
|
|
8259
|
+
function _typeof(obj) {
|
|
8260
|
+
"@babel/helpers - typeof";
|
|
8261
|
+
|
|
8262
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
8263
|
+
_typeof = function (obj) {
|
|
8264
|
+
return typeof obj;
|
|
8265
|
+
};
|
|
8266
|
+
} else {
|
|
8267
|
+
_typeof = function (obj) {
|
|
8268
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
8269
|
+
};
|
|
8270
|
+
}
|
|
8271
|
+
|
|
8272
|
+
return _typeof(obj);
|
|
8273
|
+
}
|
|
8274
|
+
|
|
8275
|
+
var V3_URL = 'https://js.stripe.com/v3';
|
|
8276
|
+
var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
|
|
8277
|
+
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';
|
|
8278
|
+
var findScript = function findScript() {
|
|
8279
|
+
var scripts = document.querySelectorAll("script[src^=\"".concat(V3_URL, "\"]"));
|
|
8280
|
+
|
|
8281
|
+
for (var i = 0; i < scripts.length; i++) {
|
|
8282
|
+
var script = scripts[i];
|
|
8283
|
+
|
|
8284
|
+
if (!V3_URL_REGEX.test(script.src)) {
|
|
8285
|
+
continue;
|
|
8286
|
+
}
|
|
8287
|
+
|
|
8288
|
+
return script;
|
|
8289
|
+
}
|
|
8290
|
+
|
|
8291
|
+
return null;
|
|
8292
|
+
};
|
|
8293
|
+
|
|
8294
|
+
var injectScript = function injectScript(params) {
|
|
8295
|
+
var queryString = params && !params.advancedFraudSignals ? '?advancedFraudSignals=false' : '';
|
|
8296
|
+
var script = document.createElement('script');
|
|
8297
|
+
script.src = "".concat(V3_URL).concat(queryString);
|
|
8298
|
+
var headOrBody = document.head || document.body;
|
|
8299
|
+
|
|
8300
|
+
if (!headOrBody) {
|
|
8301
|
+
throw new Error('Expected document.body not to be null. Stripe.js requires a <body> element.');
|
|
8302
|
+
}
|
|
8303
|
+
|
|
8304
|
+
headOrBody.appendChild(script);
|
|
8305
|
+
return script;
|
|
8306
|
+
};
|
|
8307
|
+
|
|
8308
|
+
var registerWrapper = function registerWrapper(stripe, startTime) {
|
|
8309
|
+
if (!stripe || !stripe._registerWrapper) {
|
|
8310
|
+
return;
|
|
8311
|
+
}
|
|
8312
|
+
|
|
8313
|
+
stripe._registerWrapper({
|
|
8314
|
+
name: 'stripe-js',
|
|
8315
|
+
version: "1.21.1",
|
|
8316
|
+
startTime: startTime
|
|
8317
|
+
});
|
|
8318
|
+
};
|
|
8319
|
+
|
|
8320
|
+
var stripePromise = null;
|
|
8321
|
+
var loadScript = function loadScript(params) {
|
|
8322
|
+
// Ensure that we only attempt to load Stripe.js at most once
|
|
8323
|
+
if (stripePromise !== null) {
|
|
8324
|
+
return stripePromise;
|
|
8325
|
+
}
|
|
8326
|
+
|
|
8327
|
+
stripePromise = new Promise(function (resolve, reject) {
|
|
8328
|
+
if (typeof window === 'undefined') {
|
|
8329
|
+
// Resolve to null when imported server side. This makes the module
|
|
8330
|
+
// safe to import in an isomorphic code base.
|
|
8331
|
+
resolve(null);
|
|
8332
|
+
return;
|
|
8333
|
+
}
|
|
8334
|
+
|
|
8335
|
+
if (window.Stripe && params) {
|
|
8336
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
8337
|
+
}
|
|
8338
|
+
|
|
8339
|
+
if (window.Stripe) {
|
|
8340
|
+
resolve(window.Stripe);
|
|
8341
|
+
return;
|
|
8342
|
+
}
|
|
8343
|
+
|
|
8344
|
+
try {
|
|
8345
|
+
var script = findScript();
|
|
8346
|
+
|
|
8347
|
+
if (script && params) {
|
|
8348
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
8349
|
+
} else if (!script) {
|
|
8350
|
+
script = injectScript(params);
|
|
8351
|
+
}
|
|
8352
|
+
|
|
8353
|
+
script.addEventListener('load', function () {
|
|
8354
|
+
if (window.Stripe) {
|
|
8355
|
+
resolve(window.Stripe);
|
|
8356
|
+
} else {
|
|
8357
|
+
reject(new Error('Stripe.js not available'));
|
|
8358
|
+
}
|
|
8359
|
+
});
|
|
8360
|
+
script.addEventListener('error', function () {
|
|
8361
|
+
reject(new Error('Failed to load Stripe.js'));
|
|
8362
|
+
});
|
|
8363
|
+
} catch (error) {
|
|
8364
|
+
reject(error);
|
|
8365
|
+
return;
|
|
8366
|
+
}
|
|
8367
|
+
});
|
|
8368
|
+
return stripePromise;
|
|
8369
|
+
};
|
|
8370
|
+
var initStripe = function initStripe(maybeStripe, args, startTime) {
|
|
8371
|
+
if (maybeStripe === null) {
|
|
8372
|
+
return null;
|
|
8373
|
+
}
|
|
8374
|
+
|
|
8375
|
+
var stripe = maybeStripe.apply(undefined, args);
|
|
8376
|
+
registerWrapper(stripe, startTime);
|
|
8377
|
+
return stripe;
|
|
8378
|
+
};
|
|
8379
|
+
var validateLoadParams = function validateLoadParams(params) {
|
|
8380
|
+
var errorMessage = "invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ".concat(JSON.stringify(params), "\n");
|
|
8381
|
+
|
|
8382
|
+
if (params === null || _typeof(params) !== 'object') {
|
|
8383
|
+
throw new Error(errorMessage);
|
|
8384
|
+
}
|
|
8385
|
+
|
|
8386
|
+
if (Object.keys(params).length === 1 && typeof params.advancedFraudSignals === 'boolean') {
|
|
8387
|
+
return params;
|
|
8388
|
+
}
|
|
8389
|
+
|
|
8390
|
+
throw new Error(errorMessage);
|
|
8391
|
+
};
|
|
8392
|
+
|
|
8393
|
+
var loadParams;
|
|
8394
|
+
var loadStripeCalled = false;
|
|
8395
|
+
var loadStripe = function loadStripe() {
|
|
8396
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
8397
|
+
args[_key] = arguments[_key];
|
|
8398
|
+
}
|
|
8399
|
+
|
|
8400
|
+
loadStripeCalled = true;
|
|
8401
|
+
var startTime = Date.now();
|
|
8402
|
+
return loadScript(loadParams).then(function (maybeStripe) {
|
|
8403
|
+
return initStripe(maybeStripe, args, startTime);
|
|
8404
|
+
});
|
|
8405
|
+
};
|
|
8406
|
+
|
|
8407
|
+
loadStripe.setLoadParameters = function (params) {
|
|
8408
|
+
if (loadStripeCalled) {
|
|
8409
|
+
throw new Error('You cannot change load parameters after calling loadStripe');
|
|
8410
|
+
}
|
|
8411
|
+
|
|
8412
|
+
loadParams = validateLoadParams(params);
|
|
8413
|
+
};
|
|
8414
|
+
|
|
8415
|
+
exports.loadStripe = loadStripe;
|
|
8416
|
+
});
|
|
8417
|
+
|
|
8418
|
+
unwrapExports(pure$1);
|
|
8419
|
+
pure$1.loadStripe;
|
|
8420
|
+
|
|
8421
|
+
var pure = pure$1;
|
|
8422
|
+
var pure_1 = pure.loadStripe;
|
|
8423
|
+
|
|
8211
8424
|
/**
|
|
8212
8425
|
* @typedef {Object} OptionsType
|
|
8213
8426
|
* @property {boolean} loadPaymentSDKs
|
|
@@ -8277,8 +8490,15 @@ const initPaywalls = () => {
|
|
|
8277
8490
|
}
|
|
8278
8491
|
};
|
|
8279
8492
|
const loadPaymentSDKs = () => {
|
|
8280
|
-
//
|
|
8281
|
-
|
|
8493
|
+
// Lazy load stripe's SDK
|
|
8494
|
+
const {
|
|
8495
|
+
whenUserReady
|
|
8496
|
+
} = usePelcro.getStore();
|
|
8497
|
+
whenUserReady(() => {
|
|
8498
|
+
if (!window.Stripe) {
|
|
8499
|
+
pure_1(window.Pelcro.environment.stripe);
|
|
8500
|
+
}
|
|
8501
|
+
}); // Load PayPal SDK's
|
|
8282
8502
|
|
|
8283
8503
|
const supportsPaypal = Boolean(window.Pelcro.site.read().braintree_tokenization);
|
|
8284
8504
|
|
|
@@ -9714,7 +9934,7 @@ const FacebookLoginButton = ({
|
|
|
9714
9934
|
labelClassName = "",
|
|
9715
9935
|
iconClassName = ""
|
|
9716
9936
|
}) => {
|
|
9717
|
-
var _window$Pelcro$site$r
|
|
9937
|
+
var _window$Pelcro$site$r;
|
|
9718
9938
|
|
|
9719
9939
|
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
9940
|
const {
|
|
@@ -9753,7 +9973,7 @@ const FacebookLoginButton = ({
|
|
|
9753
9973
|
|
|
9754
9974
|
return facebookLoginEnabled ? /*#__PURE__*/React__default.createElement(FacebookLogin, {
|
|
9755
9975
|
appId: window.Pelcro.site.read().facebook_app_id,
|
|
9756
|
-
language: (
|
|
9976
|
+
language: getPageOrDefaultLanguage(),
|
|
9757
9977
|
fields: "first_name,last_name,email,picture",
|
|
9758
9978
|
callback: onSuccess,
|
|
9759
9979
|
onFailure: onFailure,
|
|
@@ -13287,7 +13507,7 @@ const PaymentMethodContainer = props => {
|
|
|
13287
13507
|
return /*#__PURE__*/React__default.createElement(es_13, {
|
|
13288
13508
|
apiKey: window.Pelcro.environment.stripe,
|
|
13289
13509
|
stripeAccount: window.Pelcro.site.read().account_id,
|
|
13290
|
-
locale:
|
|
13510
|
+
locale: getPageOrDefaultLanguage()
|
|
13291
13511
|
}, /*#__PURE__*/React__default.createElement(es_11, null, /*#__PURE__*/React__default.createElement(UnwrappedForm, Object.assign({
|
|
13292
13512
|
store: store$d
|
|
13293
13513
|
}, props))));
|
|
@@ -13399,9 +13619,6 @@ const DiscountedPrice = props => {
|
|
|
13399
13619
|
percentOff
|
|
13400
13620
|
}
|
|
13401
13621
|
} = useContext(store$d);
|
|
13402
|
-
const {
|
|
13403
|
-
default_locale
|
|
13404
|
-
} = Pelcro.site.read();
|
|
13405
13622
|
const {
|
|
13406
13623
|
order,
|
|
13407
13624
|
plan
|
|
@@ -13409,7 +13626,7 @@ const DiscountedPrice = props => {
|
|
|
13409
13626
|
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
13627
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
13411
13628
|
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,
|
|
13629
|
+
const priceFormatted = getFormattedPriceByLocal(order ? updatedPrice : discountedPriceWithoutTax * planQuantity, ecommOrderCurrency !== null && ecommOrderCurrency !== void 0 ? ecommOrderCurrency : plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
13413
13630
|
|
|
13414
13631
|
if (percentOff) {
|
|
13415
13632
|
return /*#__PURE__*/React__default.createElement("div", Object.assign({
|
|
@@ -13442,12 +13659,9 @@ const SubmitPaymentMethod = ({
|
|
|
13442
13659
|
updatedPrice
|
|
13443
13660
|
}
|
|
13444
13661
|
} = useContext(store$d);
|
|
13445
|
-
const {
|
|
13446
|
-
default_locale
|
|
13447
|
-
} = Pelcro.site.read();
|
|
13448
13662
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
13449
13663
|
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,
|
|
13664
|
+
const priceFormatted = getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
13451
13665
|
return /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
13452
13666
|
role: "submit",
|
|
13453
13667
|
className: "plc-w-full plc-py-3",
|
|
@@ -13692,7 +13906,7 @@ class PaypalClient {
|
|
|
13692
13906
|
this.paypalButton = window.paypal.Buttons({
|
|
13693
13907
|
fundingSource: window.paypal.FUNDING.PAYPAL,
|
|
13694
13908
|
// button locale
|
|
13695
|
-
locale: (_this$config$locale = this.config.locale) !== null && _this$config$locale !== void 0 ? _this$config$locale :
|
|
13909
|
+
locale: (_this$config$locale = this.config.locale) !== null && _this$config$locale !== void 0 ? _this$config$locale : getPageOrDefaultLanguage(),
|
|
13696
13910
|
// button style
|
|
13697
13911
|
style: (_this$config$style = this.config.style) !== null && _this$config$style !== void 0 ? _this$config$style : defaultButtonStyle,
|
|
13698
13912
|
// create payment handler
|
|
@@ -13789,7 +14003,7 @@ class PaypalClient {
|
|
|
13789
14003
|
} : undefined,
|
|
13790
14004
|
shippingAddressEditable: this.config.shippingAddressEditable,
|
|
13791
14005
|
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 :
|
|
14006
|
+
locale: (_this$config$locale2 = this.config.locale) !== null && _this$config$locale2 !== void 0 ? _this$config$locale2 : getPageOrDefaultLanguage()
|
|
13793
14007
|
};
|
|
13794
14008
|
}
|
|
13795
14009
|
});
|
|
@@ -13798,7 +14012,7 @@ class PaypalClient {
|
|
|
13798
14012
|
writable: true,
|
|
13799
14013
|
value: () => {
|
|
13800
14014
|
const totalAmount = (this.product.quantity || 1) * this.amount;
|
|
13801
|
-
const priceFormatted = getFormattedPriceByLocal(totalAmount, this.product.currency,
|
|
14015
|
+
const priceFormatted = getFormattedPriceByLocal(totalAmount, this.product.currency, getPageOrDefaultLanguage());
|
|
13802
14016
|
const autoRenewed = this.product.auto_renew;
|
|
13803
14017
|
const {
|
|
13804
14018
|
interval,
|
|
@@ -13995,14 +14209,11 @@ const TaxAmount = () => {
|
|
|
13995
14209
|
taxAmount
|
|
13996
14210
|
}
|
|
13997
14211
|
} = useContext(store$d);
|
|
13998
|
-
const {
|
|
13999
|
-
default_locale
|
|
14000
|
-
} = Pelcro.site.read();
|
|
14001
14212
|
const {
|
|
14002
14213
|
plan
|
|
14003
14214
|
} = usePelcro();
|
|
14004
14215
|
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,
|
|
14216
|
+
const priceFormatted = getFormattedPriceByLocal(taxAmount * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
14006
14217
|
|
|
14007
14218
|
if (taxAmount) {
|
|
14008
14219
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -14875,10 +15086,7 @@ const SubscriptionCreateView = ({
|
|
|
14875
15086
|
interval,
|
|
14876
15087
|
count: interval_count
|
|
14877
15088
|
});
|
|
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);
|
|
15089
|
+
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
15090
|
return /*#__PURE__*/React__default.createElement("p", {
|
|
14883
15091
|
className: "plc-text-gray-600"
|
|
14884
15092
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
@@ -18055,7 +18263,6 @@ const OrderConfirmModal = props => {
|
|
|
18055
18263
|
const userOrders = window.Pelcro.user.read().orders;
|
|
18056
18264
|
const latestOrder = userOrders === null || userOrders === void 0 ? void 0 : userOrders[userOrders.length - 1];
|
|
18057
18265
|
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
18266
|
const {
|
|
18060
18267
|
t
|
|
18061
18268
|
} = useTranslation("shop");
|
|
@@ -18114,7 +18321,7 @@ const OrderConfirmModal = props => {
|
|
|
18114
18321
|
className: "plc-mr-1 pelcro-summary-total-text"
|
|
18115
18322
|
}, t("labels.total")), /*#__PURE__*/React__default.createElement("p", {
|
|
18116
18323
|
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,
|
|
18324
|
+
}, 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
18325
|
className: "plc-flex plc-justify-center plc-mt-6"
|
|
18119
18326
|
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
18120
18327
|
id: "pelcro-submit",
|
|
@@ -18176,9 +18383,9 @@ const GiftCreateContainer = ({
|
|
|
18176
18383
|
}
|
|
18177
18384
|
|
|
18178
18385
|
if (giftRecipient.startDate) {
|
|
18179
|
-
const nowDate = new Date();
|
|
18180
|
-
const yearFromNowDate = new Date(new Date().setFullYear(nowDate.getFullYear() + 1));
|
|
18181
|
-
const submittedDate = new Date(giftRecipient.startDate);
|
|
18386
|
+
const nowDate = getDateWithoutTime(new Date());
|
|
18387
|
+
const yearFromNowDate = getDateWithoutTime(new Date(new Date().setFullYear(nowDate.getFullYear() + 1)));
|
|
18388
|
+
const submittedDate = getDateWithoutTime(new Date(giftRecipient.startDate));
|
|
18182
18389
|
|
|
18183
18390
|
if (submittedDate < nowDate || submittedDate > yearFromNowDate) {
|
|
18184
18391
|
dispatch({
|
|
@@ -20483,7 +20690,6 @@ const OrderItems = ({
|
|
|
20483
20690
|
const {
|
|
20484
20691
|
t
|
|
20485
20692
|
} = useTranslation("dashboard");
|
|
20486
|
-
const site = window.Pelcro.site.read();
|
|
20487
20693
|
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
20694
|
colSpan: "3",
|
|
20489
20695
|
className: "plc-text-center plc-text-gray-500"
|
|
@@ -20499,7 +20705,7 @@ const OrderItems = ({
|
|
|
20499
20705
|
className: "plc-py-4 plc-pl-2"
|
|
20500
20706
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
20501
20707
|
className: "plc-text-xl plc-font-semibold "
|
|
20502
|
-
}, getFormattedPriceByLocal(order.amount, order.currency,
|
|
20708
|
+
}, getFormattedPriceByLocal(order.amount, order.currency, getPageOrDefaultLanguage())), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", {
|
|
20503
20709
|
className: "plc-text-xs plc-text-gray-400 plc-uppercase"
|
|
20504
20710
|
}, t("labels.orders.itemsAmount", {
|
|
20505
20711
|
count: getItemsAmount(order.id)
|
|
@@ -20528,7 +20734,7 @@ const OrderItems = ({
|
|
|
20528
20734
|
className: ""
|
|
20529
20735
|
}, item.product_sku_name))), /*#__PURE__*/React__default.createElement("td", null, /*#__PURE__*/React__default.createElement("span", {
|
|
20530
20736
|
className: "plc-font-semibold"
|
|
20531
|
-
}, getFormattedPriceByLocal(item.amount, order.currency,
|
|
20737
|
+
}, getFormattedPriceByLocal(item.amount, order.currency, getPageOrDefaultLanguage()))));
|
|
20532
20738
|
}), /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
|
|
20533
20739
|
colSpan: "3"
|
|
20534
20740
|
}, /*#__PURE__*/React__default.createElement("hr", {
|
|
@@ -21255,7 +21461,7 @@ class Dashboard extends Component {
|
|
|
21255
21461
|
className: "plc-font-semibold plc-text-gray-500"
|
|
21256
21462
|
}, sub.plan.nickname), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", {
|
|
21257
21463
|
className: "plc-text-xs plc-text-gray-400"
|
|
21258
|
-
}, getFormattedPriceByLocal(sub.plan.amount, sub.plan.currency,
|
|
21464
|
+
}, getFormattedPriceByLocal(sub.plan.amount, sub.plan.currency, getPageOrDefaultLanguage())))), /*#__PURE__*/React__default.createElement("td", null, /*#__PURE__*/React__default.createElement("span", {
|
|
21259
21465
|
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
21466
|
}, this.getSubscriptionStatus(sub).icon, this.getSubscriptionStatus(sub).title), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("div", {
|
|
21261
21467
|
className: "plc-mb-4 plc-text-xs plc-text-gray-500"
|
|
@@ -21265,21 +21471,21 @@ class Dashboard extends Component {
|
|
|
21265
21471
|
className: "plc-inline-block plc-mt-1"
|
|
21266
21472
|
}, 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
21473
|
variant: "ghost",
|
|
21268
|
-
className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-
|
|
21474
|
+
className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-cancel-button",
|
|
21269
21475
|
icon: /*#__PURE__*/React__default.createElement(SvgXIconSolid, null),
|
|
21270
21476
|
onClick: onCancelClick,
|
|
21271
21477
|
disabled: this.state.disableSubmit,
|
|
21272
21478
|
"data-key": sub.id
|
|
21273
21479
|
}, this.locale("labels.unsubscribe")), sub.cancel_at_period_end === 1 && sub.plan.auto_renew && !sub.is_gift_recipient && /*#__PURE__*/React__default.createElement(Button, {
|
|
21274
21480
|
variant: "ghost",
|
|
21275
|
-
className: "plc-text-green-400 focus:plc-ring-green-300 pelcro-
|
|
21481
|
+
className: "plc-text-green-400 focus:plc-ring-green-300 pelcro-dashboard-sub-reactivate-button",
|
|
21276
21482
|
icon: /*#__PURE__*/React__default.createElement(SvgRefresh, null),
|
|
21277
21483
|
onClick: onReactivateClick,
|
|
21278
21484
|
disabled: this.state.disableSubmit,
|
|
21279
21485
|
"data-key": sub.id
|
|
21280
21486
|
}, this.locale("labels.reactivate")), sub.cancel_at_period_end === 1 && /*#__PURE__*/React__default.createElement(Button, {
|
|
21281
21487
|
variant: "ghost",
|
|
21282
|
-
className: "plc-text-blue-400 pelcro-
|
|
21488
|
+
className: "plc-text-blue-400 pelcro-dashboard-sub-renew-button",
|
|
21283
21489
|
icon: /*#__PURE__*/React__default.createElement(SvgRefresh, null),
|
|
21284
21490
|
onClick: onRenewClick,
|
|
21285
21491
|
disabled: this.state.disableSubmit,
|
|
@@ -21358,7 +21564,7 @@ class Dashboard extends Component {
|
|
|
21358
21564
|
className: "plc-font-semibold plc-text-gray-500"
|
|
21359
21565
|
}, recipient.plan.nickname), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", {
|
|
21360
21566
|
className: "plc-text-xs plc-text-gray-400"
|
|
21361
|
-
}, getFormattedPriceByLocal(recipient.plan.amount, recipient.plan.currency,
|
|
21567
|
+
}, getFormattedPriceByLocal(recipient.plan.amount, recipient.plan.currency, getPageOrDefaultLanguage())))), recipient.status && /*#__PURE__*/React__default.createElement("td", null, /*#__PURE__*/React__default.createElement("span", {
|
|
21362
21568
|
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
21569
|
}, this.getSubscriptionStatus(recipient).icon, this.getSubscriptionStatus(recipient).title), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("div", {
|
|
21364
21570
|
className: "plc-mb-4 plc-text-xs plc-text-gray-500"
|
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.6.0-beta.
|
|
4
|
+
"version": "2.6.0-beta.5",
|
|
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",
|