@pelcro/react-pelcro-js 3.22.0-beta.20 → 3.22.0-beta.22
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 +69 -60
- package/dist/index.esm.js +69 -60
- package/dist/pelcro.css +4 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -3459,7 +3459,8 @@ var labels$14 = {
|
|
|
3459
3459
|
lastName: "Last name",
|
|
3460
3460
|
phone: "Phone",
|
|
3461
3461
|
freeItems: "Free Items",
|
|
3462
|
-
email: "Email"
|
|
3462
|
+
email: "Email",
|
|
3463
|
+
password: "Password"
|
|
3463
3464
|
};
|
|
3464
3465
|
var checkoutForm_en = {
|
|
3465
3466
|
messages: messages$18,
|
|
@@ -4455,7 +4456,8 @@ var labels$K = {
|
|
|
4455
4456
|
lastName: "Nom de famille",
|
|
4456
4457
|
phone: "Téléphoner",
|
|
4457
4458
|
freeItems: "Articles gratuits",
|
|
4458
|
-
email: "Courriel"
|
|
4459
|
+
email: "Courriel",
|
|
4460
|
+
password: "Créer un mot de passe"
|
|
4459
4461
|
};
|
|
4460
4462
|
var checkoutForm_fr = {
|
|
4461
4463
|
messages: messages$P,
|
|
@@ -5336,7 +5338,8 @@ var labels$u = {
|
|
|
5336
5338
|
lastName: "성",
|
|
5337
5339
|
phone: "핸드폰",
|
|
5338
5340
|
freeItems: "무료 아이템",
|
|
5339
|
-
email: "이메일"
|
|
5341
|
+
email: "이메일",
|
|
5342
|
+
password: "비밀번호"
|
|
5340
5343
|
};
|
|
5341
5344
|
var checkoutForm_ko = {
|
|
5342
5345
|
messages: messages$x,
|
|
@@ -6322,7 +6325,8 @@ var labels$e = {
|
|
|
6322
6325
|
lastName: "Apellido",
|
|
6323
6326
|
phone: "Teléfono",
|
|
6324
6327
|
freeItems: "Artículos gratis",
|
|
6325
|
-
email: "Correo"
|
|
6328
|
+
email: "Correo",
|
|
6329
|
+
password: "Contraseña"
|
|
6326
6330
|
};
|
|
6327
6331
|
var checkoutForm_es = {
|
|
6328
6332
|
messages: messages$f,
|
|
@@ -9146,17 +9150,6 @@ function notifyBugsnag(callback, startOptions) {
|
|
|
9146
9150
|
callback();
|
|
9147
9151
|
}
|
|
9148
9152
|
|
|
9149
|
-
//create a safe and strong password string with special characters
|
|
9150
|
-
function generatePassword() {
|
|
9151
|
-
const length = 16;
|
|
9152
|
-
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+{}|:<>?`~";
|
|
9153
|
-
let retVal = "";
|
|
9154
|
-
for (let i = 0, n = charset.length; i < length; ++i) {
|
|
9155
|
-
retVal += charset.charAt(Math.floor(Math.random() * n));
|
|
9156
|
-
}
|
|
9157
|
-
return retVal;
|
|
9158
|
-
}
|
|
9159
|
-
|
|
9160
9153
|
const resources = {
|
|
9161
9154
|
en: {
|
|
9162
9155
|
common: common_en,
|
|
@@ -14505,7 +14498,9 @@ class SelectModal extends React.Component {
|
|
|
14505
14498
|
const userDidSelectProduct = Boolean(this.state.mode === "plan");
|
|
14506
14499
|
const productsToShow = userDidSelectProduct ? [this.state.product] : this.state.productList;
|
|
14507
14500
|
return productsToShow.map((product, index) => {
|
|
14508
|
-
|
|
14501
|
+
if (product.plans.filter(plan => plan.type === "regular").length > 0) {
|
|
14502
|
+
return this.renderOneProduct(product, index);
|
|
14503
|
+
}
|
|
14509
14504
|
});
|
|
14510
14505
|
});
|
|
14511
14506
|
_defineProperty$3(this, "renderMatchingProductsFirst", () => {
|
|
@@ -14799,6 +14794,14 @@ class DonationModal extends React.Component {
|
|
|
14799
14794
|
});
|
|
14800
14795
|
}
|
|
14801
14796
|
});
|
|
14797
|
+
_defineProperty$3(this, "componentDidUpdate", (prevProps, prevState) => {
|
|
14798
|
+
var _this$state$planList;
|
|
14799
|
+
if (((_this$state$planList = this.state.planList) === null || _this$state$planList === void 0 ? void 0 : _this$state$planList.length) === 1 && this.state.plan !== this.state.planList[0]) {
|
|
14800
|
+
this.setState({
|
|
14801
|
+
plan: this.state.planList[0]
|
|
14802
|
+
});
|
|
14803
|
+
}
|
|
14804
|
+
});
|
|
14802
14805
|
_defineProperty$3(this, "componentWillUnmount", () => {
|
|
14803
14806
|
document.removeEventListener("keydown", this.handleSubmit);
|
|
14804
14807
|
});
|
|
@@ -14852,9 +14855,7 @@ class DonationModal extends React.Component {
|
|
|
14852
14855
|
className: "plc-text-xs pelcro-select-product-description"
|
|
14853
14856
|
}, product.description)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
14854
14857
|
className: "plc-flex plc-items-end plc-w-full plc-mt-3"
|
|
14855
|
-
},
|
|
14856
|
-
className: "plc-w-1/2 plc-text-xs pelcro-select-product-cost"
|
|
14857
|
-
}, this.locale("labels.startingAt"), " ", this.countStartPrice(product.plans)), /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
14858
|
+
}, /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
14858
14859
|
onClick: productButtonCallback,
|
|
14859
14860
|
"data-key": product.id,
|
|
14860
14861
|
id: "pelcro-select-product-back-button",
|
|
@@ -14985,13 +14986,15 @@ class DonationModal extends React.Component {
|
|
|
14985
14986
|
for (const product of this.state.productList) {
|
|
14986
14987
|
if (+product.id === +id) {
|
|
14987
14988
|
var _this$state$plan;
|
|
14989
|
+
const planList = product.plans.filter(plan => plan.type === "donation");
|
|
14990
|
+
if (planList.length === 1) {
|
|
14991
|
+
this.setState({
|
|
14992
|
+
plan: planList[0]
|
|
14993
|
+
});
|
|
14994
|
+
}
|
|
14988
14995
|
this.setState({
|
|
14989
|
-
product: product
|
|
14990
|
-
|
|
14991
|
-
this.setState({
|
|
14992
|
-
planList: product.plans.filter(plan => plan.type === "donation")
|
|
14993
|
-
});
|
|
14994
|
-
this.setState({
|
|
14996
|
+
product: product,
|
|
14997
|
+
planList: planList,
|
|
14995
14998
|
mode: "plan"
|
|
14996
14999
|
});
|
|
14997
15000
|
const isSelectedPlanPartOfThisProduct = ((_this$state$plan = this.state.plan) === null || _this$state$plan === void 0 ? void 0 : _this$state$plan.product_id) === Number(product.id);
|
|
@@ -15030,7 +15033,7 @@ class DonationModal extends React.Component {
|
|
|
15030
15033
|
mode: "product"
|
|
15031
15034
|
});
|
|
15032
15035
|
});
|
|
15033
|
-
_defineProperty$3(this, "submitOption",
|
|
15036
|
+
_defineProperty$3(this, "submitOption", () => {
|
|
15034
15037
|
this.props.setProductAndPlan(this.state.product, this.state.plan, this.state.isGift, this.state.selectedDonationAmount, this.state.customDonationAmount);
|
|
15035
15038
|
const {
|
|
15036
15039
|
product,
|
|
@@ -15044,7 +15047,7 @@ class DonationModal extends React.Component {
|
|
|
15044
15047
|
switchToAddressView,
|
|
15045
15048
|
switchToPaymentView
|
|
15046
15049
|
} = usePelcro.getStore();
|
|
15047
|
-
if (!isAuthenticated && product.address_required
|
|
15050
|
+
if (!isAuthenticated && product.address_required) {
|
|
15048
15051
|
return setView("register");
|
|
15049
15052
|
}
|
|
15050
15053
|
|
|
@@ -15076,7 +15079,7 @@ class DonationModal extends React.Component {
|
|
|
15076
15079
|
this.closeButton = window.Pelcro.paywall.displayCloseButton();
|
|
15077
15080
|
}
|
|
15078
15081
|
render() {
|
|
15079
|
-
var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r
|
|
15082
|
+
var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
|
|
15080
15083
|
this.props;
|
|
15081
15084
|
if (this.state.mode === "product") {
|
|
15082
15085
|
var _ReactGA$event;
|
|
@@ -15107,26 +15110,9 @@ class DonationModal extends React.Component {
|
|
|
15107
15110
|
className: "pelcro-select-products-wrapper"
|
|
15108
15111
|
}, (_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.restrictive_paywall_metatags_enabled ? this.renderMatchingProductsFirst() : this.renderProducts()), this.state.mode === "plan" && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
15109
15112
|
className: "plc-overflow-y-scroll pelcro-select-plans-wrapper"
|
|
15110
|
-
}, this.renderPlans()),
|
|
15113
|
+
}, this.renderPlans()), /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
15111
15114
|
disabled: this.state.disabled,
|
|
15112
|
-
onClick: () => this.submitOption(
|
|
15113
|
-
id: "pelcro-submit",
|
|
15114
|
-
className: "plc-w-full plc-mt-2"
|
|
15115
|
-
}, this.locale("buttons.signupAndDonate")) : !window.Pelcro.user.isAuthenticated() ? /*#__PURE__*/React__default['default'].createElement("div", {
|
|
15116
|
-
className: "plc-flex plc-items-center plc-mt-2"
|
|
15117
|
-
}, /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
15118
|
-
disabled: this.state.disabled,
|
|
15119
|
-
onClick: () => this.submitOption(true),
|
|
15120
|
-
id: "pelcro-submit",
|
|
15121
|
-
className: "plc-flex-1 plc-mr-2"
|
|
15122
|
-
}, this.locale("buttons.signupAndDonate")), /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
15123
|
-
disabled: this.state.disabled,
|
|
15124
|
-
onClick: () => this.submitOption(false),
|
|
15125
|
-
id: "pelcro-submit",
|
|
15126
|
-
className: "plc-flex-1 pelcro-button-outline"
|
|
15127
|
-
}, this.locale("buttons.donate"))) : /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
15128
|
-
disabled: this.state.disabled,
|
|
15129
|
-
onClick: () => this.submitOption(false),
|
|
15115
|
+
onClick: () => this.submitOption(),
|
|
15130
15116
|
id: "pelcro-submit",
|
|
15131
15117
|
className: "plc-w-full plc-mt-2"
|
|
15132
15118
|
}, this.locale("buttons.donate"))))), /*#__PURE__*/React__default['default'].createElement(ModalFooter, null, /*#__PURE__*/React__default['default'].createElement(Authorship, null)));
|
|
@@ -17345,12 +17331,14 @@ const initialState$k = {
|
|
|
17345
17331
|
lastName: "",
|
|
17346
17332
|
phone: "",
|
|
17347
17333
|
email: "",
|
|
17334
|
+
password: "",
|
|
17348
17335
|
firstNameError: null,
|
|
17349
17336
|
lastNameError: null,
|
|
17350
17337
|
phoneError: null,
|
|
17351
17338
|
emailError: null,
|
|
17352
17339
|
month: "",
|
|
17353
17340
|
year: "",
|
|
17341
|
+
passwordError: null,
|
|
17354
17342
|
alert: {
|
|
17355
17343
|
type: "error",
|
|
17356
17344
|
content: ""
|
|
@@ -17386,7 +17374,8 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17386
17374
|
couponCode,
|
|
17387
17375
|
selectedDonationAmount,
|
|
17388
17376
|
customDonationAmount,
|
|
17389
|
-
isAuthenticated
|
|
17377
|
+
isAuthenticated,
|
|
17378
|
+
switchView
|
|
17390
17379
|
} = usePelcro();
|
|
17391
17380
|
const {
|
|
17392
17381
|
whenUserReady
|
|
@@ -18884,7 +18873,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18884
18873
|
const sendRegisterRequest = (state, callback) => {
|
|
18885
18874
|
window.Pelcro.user.register({
|
|
18886
18875
|
email: state.email,
|
|
18887
|
-
password:
|
|
18876
|
+
password: state.password
|
|
18888
18877
|
}, (err, res) => {
|
|
18889
18878
|
if (err) {
|
|
18890
18879
|
var _err$response, _err$response$data;
|
|
@@ -18895,11 +18884,20 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18895
18884
|
err.response.data.errors = {
|
|
18896
18885
|
...errors
|
|
18897
18886
|
};
|
|
18887
|
+
let errorContent;
|
|
18888
|
+
if (getErrorMessages(err) === "This email is already in use.") {
|
|
18889
|
+
errorContent = /*#__PURE__*/React__default['default'].createElement("p", null, "This email is already in use.", " ", /*#__PURE__*/React__default['default'].createElement("button", {
|
|
18890
|
+
className: "plc-font-bold plc-underline hover:plc-no-underline",
|
|
18891
|
+
onClick: () => switchView("login")
|
|
18892
|
+
}, "Login to continue"));
|
|
18893
|
+
} else {
|
|
18894
|
+
errorContent = getErrorMessages(err);
|
|
18895
|
+
}
|
|
18898
18896
|
dispatch({
|
|
18899
18897
|
type: SHOW_ALERT,
|
|
18900
18898
|
payload: {
|
|
18901
18899
|
type: "error",
|
|
18902
|
-
content:
|
|
18900
|
+
content: errorContent
|
|
18903
18901
|
}
|
|
18904
18902
|
});
|
|
18905
18903
|
dispatch({
|
|
@@ -19335,6 +19333,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19335
19333
|
emailError: action.payload,
|
|
19336
19334
|
email: ""
|
|
19337
19335
|
});
|
|
19336
|
+
case SET_PASSWORD_ERROR:
|
|
19337
|
+
return lib_7({
|
|
19338
|
+
...state,
|
|
19339
|
+
passwordError: action.payload,
|
|
19340
|
+
password: ""
|
|
19341
|
+
});
|
|
19338
19342
|
case SHOW_ALERT:
|
|
19339
19343
|
return lib_7({
|
|
19340
19344
|
...state,
|
|
@@ -19688,6 +19692,7 @@ const SubmitPaymentMethod = _ref => {
|
|
|
19688
19692
|
lastNameError,
|
|
19689
19693
|
phoneError,
|
|
19690
19694
|
emailError,
|
|
19695
|
+
passwordError,
|
|
19691
19696
|
firstName,
|
|
19692
19697
|
lastName,
|
|
19693
19698
|
phone,
|
|
@@ -19698,12 +19703,6 @@ const SubmitPaymentMethod = _ref => {
|
|
|
19698
19703
|
} = React.useContext(store$k);
|
|
19699
19704
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
19700
19705
|
const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
|
|
19701
|
-
// const priceFormatted = getFormattedPriceByLocal(
|
|
19702
|
-
// price * planQuantity,
|
|
19703
|
-
// plan?.currency,
|
|
19704
|
-
// getPageOrDefaultLanguage()
|
|
19705
|
-
// );
|
|
19706
|
-
|
|
19707
19706
|
const priceFormatted = plan.type === "donation" && (selectedDonationAmount || customDonationAmount) ? getFormattedPriceByLocal(selectedDonationAmount ? selectedDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity2 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity2 !== void 0 ? _plan$quantity2 : 1) : customDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity3 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity3 !== void 0 ? _plan$quantity3 : 1), plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage()) : getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
19708
19707
|
const supportsTap = Boolean((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tap_gateway_settings);
|
|
19709
19708
|
const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
|
|
@@ -19714,9 +19713,9 @@ const SubmitPaymentMethod = _ref => {
|
|
|
19714
19713
|
if (supportsTap && isUserFirstName && isUserLastName && isUserPhone) {
|
|
19715
19714
|
setDisabled(disableSubmit);
|
|
19716
19715
|
} else {
|
|
19717
|
-
setDisabled(disableSubmit || supportsTap && firstNameError || supportsTap && lastNameError || supportsTap && phoneError || supportsTap && !(firstName !== null && firstName !== void 0 && firstName.length) || supportsTap && !(lastName !== null && lastName !== void 0 && lastName.length) || supportsTap && !(phone !== null && phone !== void 0 && phone.length) || emailError);
|
|
19716
|
+
setDisabled(disableSubmit || supportsTap && firstNameError || supportsTap && lastNameError || supportsTap && phoneError || supportsTap && !(firstName !== null && firstName !== void 0 && firstName.length) || supportsTap && !(lastName !== null && lastName !== void 0 && lastName.length) || supportsTap && !(phone !== null && phone !== void 0 && phone.length) || emailError || passwordError);
|
|
19718
19717
|
}
|
|
19719
|
-
}, [disableSubmit, firstNameError, lastNameError, phoneError, firstName, lastName, phone, emailError]);
|
|
19718
|
+
}, [disableSubmit, firstNameError, lastNameError, phoneError, firstName, lastName, phone, emailError, passwordError]);
|
|
19720
19719
|
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
19721
19720
|
role: "submit",
|
|
19722
19721
|
className: "plc-w-full plc-py-3",
|
|
@@ -20355,6 +20354,10 @@ const DonationEmail = props => /*#__PURE__*/React__default['default'].createElem
|
|
|
20355
20354
|
store: store$k
|
|
20356
20355
|
}, props));
|
|
20357
20356
|
|
|
20357
|
+
const DonationPassword = props => /*#__PURE__*/React__default['default'].createElement(Password, Object.assign({
|
|
20358
|
+
store: store$k
|
|
20359
|
+
}, props));
|
|
20360
|
+
|
|
20358
20361
|
/**
|
|
20359
20362
|
*
|
|
20360
20363
|
*/
|
|
@@ -20435,13 +20438,18 @@ function PaymentMethodView(_ref) {
|
|
|
20435
20438
|
errorId: "pelcro-input-phone-error",
|
|
20436
20439
|
label: t("labels.phone"),
|
|
20437
20440
|
required: true
|
|
20438
|
-
})), !isAuthenticated() && (plan === null || plan === void 0 ? void 0 : plan.type) === "donation" && /*#__PURE__*/React__default['default'].createElement(DonationEmail, {
|
|
20441
|
+
})), !isAuthenticated() && (plan === null || plan === void 0 ? void 0 : plan.type) === "donation" && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(DonationEmail, {
|
|
20439
20442
|
id: "pelcro-input-email",
|
|
20440
20443
|
errorId: "pelcro-input-email-error",
|
|
20441
20444
|
label: t("labels.email"),
|
|
20442
20445
|
required: true,
|
|
20443
20446
|
autoFocus: true
|
|
20444
|
-
}), /*#__PURE__*/React__default['default'].createElement(
|
|
20447
|
+
}), /*#__PURE__*/React__default['default'].createElement(DonationPassword, {
|
|
20448
|
+
id: "pelcro-input-password",
|
|
20449
|
+
errorId: "pelcro-input-password-error",
|
|
20450
|
+
label: t("labels.password"),
|
|
20451
|
+
required: true
|
|
20452
|
+
})), /*#__PURE__*/React__default['default'].createElement(CheckoutForm, null), showCoupon && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20445
20453
|
className: "plc-mb-2"
|
|
20446
20454
|
}, /*#__PURE__*/React__default['default'].createElement(CouponCode, null), /*#__PURE__*/React__default['default'].createElement(DiscountedPrice, null)), /*#__PURE__*/React__default['default'].createElement(TaxAmount, null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20447
20455
|
className: "plc-grid plc-mt-4 plc-gap-y-2"
|
|
@@ -29047,6 +29055,7 @@ const DonationsMenu = _ref => {
|
|
|
29047
29055
|
setSubscriptionToCancel
|
|
29048
29056
|
} = usePelcro();
|
|
29049
29057
|
const donations = getDonationSubs().sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
|
|
29058
|
+
console.log("Sub", sub);
|
|
29050
29059
|
// Cancel button click handlers
|
|
29051
29060
|
const onCancelClick = () => {
|
|
29052
29061
|
const isImmediateCancelationEnabled = window.Pelcro.site.read().cancel_settings.status;
|
package/dist/index.esm.js
CHANGED
|
@@ -3429,7 +3429,8 @@ var labels$14 = {
|
|
|
3429
3429
|
lastName: "Last name",
|
|
3430
3430
|
phone: "Phone",
|
|
3431
3431
|
freeItems: "Free Items",
|
|
3432
|
-
email: "Email"
|
|
3432
|
+
email: "Email",
|
|
3433
|
+
password: "Password"
|
|
3433
3434
|
};
|
|
3434
3435
|
var checkoutForm_en = {
|
|
3435
3436
|
messages: messages$18,
|
|
@@ -4425,7 +4426,8 @@ var labels$K = {
|
|
|
4425
4426
|
lastName: "Nom de famille",
|
|
4426
4427
|
phone: "Téléphoner",
|
|
4427
4428
|
freeItems: "Articles gratuits",
|
|
4428
|
-
email: "Courriel"
|
|
4429
|
+
email: "Courriel",
|
|
4430
|
+
password: "Créer un mot de passe"
|
|
4429
4431
|
};
|
|
4430
4432
|
var checkoutForm_fr = {
|
|
4431
4433
|
messages: messages$P,
|
|
@@ -5306,7 +5308,8 @@ var labels$u = {
|
|
|
5306
5308
|
lastName: "성",
|
|
5307
5309
|
phone: "핸드폰",
|
|
5308
5310
|
freeItems: "무료 아이템",
|
|
5309
|
-
email: "이메일"
|
|
5311
|
+
email: "이메일",
|
|
5312
|
+
password: "비밀번호"
|
|
5310
5313
|
};
|
|
5311
5314
|
var checkoutForm_ko = {
|
|
5312
5315
|
messages: messages$x,
|
|
@@ -6292,7 +6295,8 @@ var labels$e = {
|
|
|
6292
6295
|
lastName: "Apellido",
|
|
6293
6296
|
phone: "Teléfono",
|
|
6294
6297
|
freeItems: "Artículos gratis",
|
|
6295
|
-
email: "Correo"
|
|
6298
|
+
email: "Correo",
|
|
6299
|
+
password: "Contraseña"
|
|
6296
6300
|
};
|
|
6297
6301
|
var checkoutForm_es = {
|
|
6298
6302
|
messages: messages$f,
|
|
@@ -9116,17 +9120,6 @@ function notifyBugsnag(callback, startOptions) {
|
|
|
9116
9120
|
callback();
|
|
9117
9121
|
}
|
|
9118
9122
|
|
|
9119
|
-
//create a safe and strong password string with special characters
|
|
9120
|
-
function generatePassword() {
|
|
9121
|
-
const length = 16;
|
|
9122
|
-
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+{}|:<>?`~";
|
|
9123
|
-
let retVal = "";
|
|
9124
|
-
for (let i = 0, n = charset.length; i < length; ++i) {
|
|
9125
|
-
retVal += charset.charAt(Math.floor(Math.random() * n));
|
|
9126
|
-
}
|
|
9127
|
-
return retVal;
|
|
9128
|
-
}
|
|
9129
|
-
|
|
9130
9123
|
const resources = {
|
|
9131
9124
|
en: {
|
|
9132
9125
|
common: common_en,
|
|
@@ -14475,7 +14468,9 @@ class SelectModal extends Component {
|
|
|
14475
14468
|
const userDidSelectProduct = Boolean(this.state.mode === "plan");
|
|
14476
14469
|
const productsToShow = userDidSelectProduct ? [this.state.product] : this.state.productList;
|
|
14477
14470
|
return productsToShow.map((product, index) => {
|
|
14478
|
-
|
|
14471
|
+
if (product.plans.filter(plan => plan.type === "regular").length > 0) {
|
|
14472
|
+
return this.renderOneProduct(product, index);
|
|
14473
|
+
}
|
|
14479
14474
|
});
|
|
14480
14475
|
});
|
|
14481
14476
|
_defineProperty$3(this, "renderMatchingProductsFirst", () => {
|
|
@@ -14769,6 +14764,14 @@ class DonationModal extends Component {
|
|
|
14769
14764
|
});
|
|
14770
14765
|
}
|
|
14771
14766
|
});
|
|
14767
|
+
_defineProperty$3(this, "componentDidUpdate", (prevProps, prevState) => {
|
|
14768
|
+
var _this$state$planList;
|
|
14769
|
+
if (((_this$state$planList = this.state.planList) === null || _this$state$planList === void 0 ? void 0 : _this$state$planList.length) === 1 && this.state.plan !== this.state.planList[0]) {
|
|
14770
|
+
this.setState({
|
|
14771
|
+
plan: this.state.planList[0]
|
|
14772
|
+
});
|
|
14773
|
+
}
|
|
14774
|
+
});
|
|
14772
14775
|
_defineProperty$3(this, "componentWillUnmount", () => {
|
|
14773
14776
|
document.removeEventListener("keydown", this.handleSubmit);
|
|
14774
14777
|
});
|
|
@@ -14822,9 +14825,7 @@ class DonationModal extends Component {
|
|
|
14822
14825
|
className: "plc-text-xs pelcro-select-product-description"
|
|
14823
14826
|
}, product.description)), /*#__PURE__*/React__default.createElement("div", {
|
|
14824
14827
|
className: "plc-flex plc-items-end plc-w-full plc-mt-3"
|
|
14825
|
-
},
|
|
14826
|
-
className: "plc-w-1/2 plc-text-xs pelcro-select-product-cost"
|
|
14827
|
-
}, this.locale("labels.startingAt"), " ", this.countStartPrice(product.plans)), /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
14828
|
+
}, /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
14828
14829
|
onClick: productButtonCallback,
|
|
14829
14830
|
"data-key": product.id,
|
|
14830
14831
|
id: "pelcro-select-product-back-button",
|
|
@@ -14955,13 +14956,15 @@ class DonationModal extends Component {
|
|
|
14955
14956
|
for (const product of this.state.productList) {
|
|
14956
14957
|
if (+product.id === +id) {
|
|
14957
14958
|
var _this$state$plan;
|
|
14959
|
+
const planList = product.plans.filter(plan => plan.type === "donation");
|
|
14960
|
+
if (planList.length === 1) {
|
|
14961
|
+
this.setState({
|
|
14962
|
+
plan: planList[0]
|
|
14963
|
+
});
|
|
14964
|
+
}
|
|
14958
14965
|
this.setState({
|
|
14959
|
-
product: product
|
|
14960
|
-
|
|
14961
|
-
this.setState({
|
|
14962
|
-
planList: product.plans.filter(plan => plan.type === "donation")
|
|
14963
|
-
});
|
|
14964
|
-
this.setState({
|
|
14966
|
+
product: product,
|
|
14967
|
+
planList: planList,
|
|
14965
14968
|
mode: "plan"
|
|
14966
14969
|
});
|
|
14967
14970
|
const isSelectedPlanPartOfThisProduct = ((_this$state$plan = this.state.plan) === null || _this$state$plan === void 0 ? void 0 : _this$state$plan.product_id) === Number(product.id);
|
|
@@ -15000,7 +15003,7 @@ class DonationModal extends Component {
|
|
|
15000
15003
|
mode: "product"
|
|
15001
15004
|
});
|
|
15002
15005
|
});
|
|
15003
|
-
_defineProperty$3(this, "submitOption",
|
|
15006
|
+
_defineProperty$3(this, "submitOption", () => {
|
|
15004
15007
|
this.props.setProductAndPlan(this.state.product, this.state.plan, this.state.isGift, this.state.selectedDonationAmount, this.state.customDonationAmount);
|
|
15005
15008
|
const {
|
|
15006
15009
|
product,
|
|
@@ -15014,7 +15017,7 @@ class DonationModal extends Component {
|
|
|
15014
15017
|
switchToAddressView,
|
|
15015
15018
|
switchToPaymentView
|
|
15016
15019
|
} = usePelcro.getStore();
|
|
15017
|
-
if (!isAuthenticated && product.address_required
|
|
15020
|
+
if (!isAuthenticated && product.address_required) {
|
|
15018
15021
|
return setView("register");
|
|
15019
15022
|
}
|
|
15020
15023
|
|
|
@@ -15046,7 +15049,7 @@ class DonationModal extends Component {
|
|
|
15046
15049
|
this.closeButton = window.Pelcro.paywall.displayCloseButton();
|
|
15047
15050
|
}
|
|
15048
15051
|
render() {
|
|
15049
|
-
var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r
|
|
15052
|
+
var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
|
|
15050
15053
|
this.props;
|
|
15051
15054
|
if (this.state.mode === "product") {
|
|
15052
15055
|
var _ReactGA$event;
|
|
@@ -15077,26 +15080,9 @@ class DonationModal extends Component {
|
|
|
15077
15080
|
className: "pelcro-select-products-wrapper"
|
|
15078
15081
|
}, (_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.restrictive_paywall_metatags_enabled ? this.renderMatchingProductsFirst() : this.renderProducts()), this.state.mode === "plan" && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
15079
15082
|
className: "plc-overflow-y-scroll pelcro-select-plans-wrapper"
|
|
15080
|
-
}, this.renderPlans()),
|
|
15083
|
+
}, this.renderPlans()), /*#__PURE__*/React__default.createElement(Button, {
|
|
15081
15084
|
disabled: this.state.disabled,
|
|
15082
|
-
onClick: () => this.submitOption(
|
|
15083
|
-
id: "pelcro-submit",
|
|
15084
|
-
className: "plc-w-full plc-mt-2"
|
|
15085
|
-
}, this.locale("buttons.signupAndDonate")) : !window.Pelcro.user.isAuthenticated() ? /*#__PURE__*/React__default.createElement("div", {
|
|
15086
|
-
className: "plc-flex plc-items-center plc-mt-2"
|
|
15087
|
-
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
15088
|
-
disabled: this.state.disabled,
|
|
15089
|
-
onClick: () => this.submitOption(true),
|
|
15090
|
-
id: "pelcro-submit",
|
|
15091
|
-
className: "plc-flex-1 plc-mr-2"
|
|
15092
|
-
}, this.locale("buttons.signupAndDonate")), /*#__PURE__*/React__default.createElement(Button, {
|
|
15093
|
-
disabled: this.state.disabled,
|
|
15094
|
-
onClick: () => this.submitOption(false),
|
|
15095
|
-
id: "pelcro-submit",
|
|
15096
|
-
className: "plc-flex-1 pelcro-button-outline"
|
|
15097
|
-
}, this.locale("buttons.donate"))) : /*#__PURE__*/React__default.createElement(Button, {
|
|
15098
|
-
disabled: this.state.disabled,
|
|
15099
|
-
onClick: () => this.submitOption(false),
|
|
15085
|
+
onClick: () => this.submitOption(),
|
|
15100
15086
|
id: "pelcro-submit",
|
|
15101
15087
|
className: "plc-w-full plc-mt-2"
|
|
15102
15088
|
}, this.locale("buttons.donate"))))), /*#__PURE__*/React__default.createElement(ModalFooter, null, /*#__PURE__*/React__default.createElement(Authorship, null)));
|
|
@@ -17315,12 +17301,14 @@ const initialState$k = {
|
|
|
17315
17301
|
lastName: "",
|
|
17316
17302
|
phone: "",
|
|
17317
17303
|
email: "",
|
|
17304
|
+
password: "",
|
|
17318
17305
|
firstNameError: null,
|
|
17319
17306
|
lastNameError: null,
|
|
17320
17307
|
phoneError: null,
|
|
17321
17308
|
emailError: null,
|
|
17322
17309
|
month: "",
|
|
17323
17310
|
year: "",
|
|
17311
|
+
passwordError: null,
|
|
17324
17312
|
alert: {
|
|
17325
17313
|
type: "error",
|
|
17326
17314
|
content: ""
|
|
@@ -17356,7 +17344,8 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17356
17344
|
couponCode,
|
|
17357
17345
|
selectedDonationAmount,
|
|
17358
17346
|
customDonationAmount,
|
|
17359
|
-
isAuthenticated
|
|
17347
|
+
isAuthenticated,
|
|
17348
|
+
switchView
|
|
17360
17349
|
} = usePelcro();
|
|
17361
17350
|
const {
|
|
17362
17351
|
whenUserReady
|
|
@@ -18854,7 +18843,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18854
18843
|
const sendRegisterRequest = (state, callback) => {
|
|
18855
18844
|
window.Pelcro.user.register({
|
|
18856
18845
|
email: state.email,
|
|
18857
|
-
password:
|
|
18846
|
+
password: state.password
|
|
18858
18847
|
}, (err, res) => {
|
|
18859
18848
|
if (err) {
|
|
18860
18849
|
var _err$response, _err$response$data;
|
|
@@ -18865,11 +18854,20 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18865
18854
|
err.response.data.errors = {
|
|
18866
18855
|
...errors
|
|
18867
18856
|
};
|
|
18857
|
+
let errorContent;
|
|
18858
|
+
if (getErrorMessages(err) === "This email is already in use.") {
|
|
18859
|
+
errorContent = /*#__PURE__*/React__default.createElement("p", null, "This email is already in use.", " ", /*#__PURE__*/React__default.createElement("button", {
|
|
18860
|
+
className: "plc-font-bold plc-underline hover:plc-no-underline",
|
|
18861
|
+
onClick: () => switchView("login")
|
|
18862
|
+
}, "Login to continue"));
|
|
18863
|
+
} else {
|
|
18864
|
+
errorContent = getErrorMessages(err);
|
|
18865
|
+
}
|
|
18868
18866
|
dispatch({
|
|
18869
18867
|
type: SHOW_ALERT,
|
|
18870
18868
|
payload: {
|
|
18871
18869
|
type: "error",
|
|
18872
|
-
content:
|
|
18870
|
+
content: errorContent
|
|
18873
18871
|
}
|
|
18874
18872
|
});
|
|
18875
18873
|
dispatch({
|
|
@@ -19305,6 +19303,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19305
19303
|
emailError: action.payload,
|
|
19306
19304
|
email: ""
|
|
19307
19305
|
});
|
|
19306
|
+
case SET_PASSWORD_ERROR:
|
|
19307
|
+
return lib_7({
|
|
19308
|
+
...state,
|
|
19309
|
+
passwordError: action.payload,
|
|
19310
|
+
password: ""
|
|
19311
|
+
});
|
|
19308
19312
|
case SHOW_ALERT:
|
|
19309
19313
|
return lib_7({
|
|
19310
19314
|
...state,
|
|
@@ -19658,6 +19662,7 @@ const SubmitPaymentMethod = _ref => {
|
|
|
19658
19662
|
lastNameError,
|
|
19659
19663
|
phoneError,
|
|
19660
19664
|
emailError,
|
|
19665
|
+
passwordError,
|
|
19661
19666
|
firstName,
|
|
19662
19667
|
lastName,
|
|
19663
19668
|
phone,
|
|
@@ -19668,12 +19673,6 @@ const SubmitPaymentMethod = _ref => {
|
|
|
19668
19673
|
} = useContext(store$k);
|
|
19669
19674
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
19670
19675
|
const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
|
|
19671
|
-
// const priceFormatted = getFormattedPriceByLocal(
|
|
19672
|
-
// price * planQuantity,
|
|
19673
|
-
// plan?.currency,
|
|
19674
|
-
// getPageOrDefaultLanguage()
|
|
19675
|
-
// );
|
|
19676
|
-
|
|
19677
19676
|
const priceFormatted = plan.type === "donation" && (selectedDonationAmount || customDonationAmount) ? getFormattedPriceByLocal(selectedDonationAmount ? selectedDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity2 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity2 !== void 0 ? _plan$quantity2 : 1) : customDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity3 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity3 !== void 0 ? _plan$quantity3 : 1), plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage()) : getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
19678
19677
|
const supportsTap = Boolean((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tap_gateway_settings);
|
|
19679
19678
|
const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
|
|
@@ -19684,9 +19683,9 @@ const SubmitPaymentMethod = _ref => {
|
|
|
19684
19683
|
if (supportsTap && isUserFirstName && isUserLastName && isUserPhone) {
|
|
19685
19684
|
setDisabled(disableSubmit);
|
|
19686
19685
|
} else {
|
|
19687
|
-
setDisabled(disableSubmit || supportsTap && firstNameError || supportsTap && lastNameError || supportsTap && phoneError || supportsTap && !(firstName !== null && firstName !== void 0 && firstName.length) || supportsTap && !(lastName !== null && lastName !== void 0 && lastName.length) || supportsTap && !(phone !== null && phone !== void 0 && phone.length) || emailError);
|
|
19686
|
+
setDisabled(disableSubmit || supportsTap && firstNameError || supportsTap && lastNameError || supportsTap && phoneError || supportsTap && !(firstName !== null && firstName !== void 0 && firstName.length) || supportsTap && !(lastName !== null && lastName !== void 0 && lastName.length) || supportsTap && !(phone !== null && phone !== void 0 && phone.length) || emailError || passwordError);
|
|
19688
19687
|
}
|
|
19689
|
-
}, [disableSubmit, firstNameError, lastNameError, phoneError, firstName, lastName, phone, emailError]);
|
|
19688
|
+
}, [disableSubmit, firstNameError, lastNameError, phoneError, firstName, lastName, phone, emailError, passwordError]);
|
|
19690
19689
|
return /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
19691
19690
|
role: "submit",
|
|
19692
19691
|
className: "plc-w-full plc-py-3",
|
|
@@ -20325,6 +20324,10 @@ const DonationEmail = props => /*#__PURE__*/React__default.createElement(Email,
|
|
|
20325
20324
|
store: store$k
|
|
20326
20325
|
}, props));
|
|
20327
20326
|
|
|
20327
|
+
const DonationPassword = props => /*#__PURE__*/React__default.createElement(Password, Object.assign({
|
|
20328
|
+
store: store$k
|
|
20329
|
+
}, props));
|
|
20330
|
+
|
|
20328
20331
|
/**
|
|
20329
20332
|
*
|
|
20330
20333
|
*/
|
|
@@ -20405,13 +20408,18 @@ function PaymentMethodView(_ref) {
|
|
|
20405
20408
|
errorId: "pelcro-input-phone-error",
|
|
20406
20409
|
label: t("labels.phone"),
|
|
20407
20410
|
required: true
|
|
20408
|
-
})), !isAuthenticated() && (plan === null || plan === void 0 ? void 0 : plan.type) === "donation" && /*#__PURE__*/React__default.createElement(DonationEmail, {
|
|
20411
|
+
})), !isAuthenticated() && (plan === null || plan === void 0 ? void 0 : plan.type) === "donation" && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(DonationEmail, {
|
|
20409
20412
|
id: "pelcro-input-email",
|
|
20410
20413
|
errorId: "pelcro-input-email-error",
|
|
20411
20414
|
label: t("labels.email"),
|
|
20412
20415
|
required: true,
|
|
20413
20416
|
autoFocus: true
|
|
20414
|
-
}), /*#__PURE__*/React__default.createElement(
|
|
20417
|
+
}), /*#__PURE__*/React__default.createElement(DonationPassword, {
|
|
20418
|
+
id: "pelcro-input-password",
|
|
20419
|
+
errorId: "pelcro-input-password-error",
|
|
20420
|
+
label: t("labels.password"),
|
|
20421
|
+
required: true
|
|
20422
|
+
})), /*#__PURE__*/React__default.createElement(CheckoutForm, null), showCoupon && /*#__PURE__*/React__default.createElement("div", {
|
|
20415
20423
|
className: "plc-mb-2"
|
|
20416
20424
|
}, /*#__PURE__*/React__default.createElement(CouponCode, null), /*#__PURE__*/React__default.createElement(DiscountedPrice, null)), /*#__PURE__*/React__default.createElement(TaxAmount, null), /*#__PURE__*/React__default.createElement("div", {
|
|
20417
20425
|
className: "plc-grid plc-mt-4 plc-gap-y-2"
|
|
@@ -29017,6 +29025,7 @@ const DonationsMenu = _ref => {
|
|
|
29017
29025
|
setSubscriptionToCancel
|
|
29018
29026
|
} = usePelcro();
|
|
29019
29027
|
const donations = getDonationSubs().sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
|
|
29028
|
+
console.log("Sub", sub);
|
|
29020
29029
|
// Cancel button click handlers
|
|
29021
29030
|
const onCancelClick = () => {
|
|
29022
29031
|
const isImmediateCancelationEnabled = window.Pelcro.site.read().cancel_settings.status;
|
package/dist/pelcro.css
CHANGED