@pelcro/react-pelcro-js 3.22.0-beta.20 → 3.22.0-beta.21
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 +68 -57
- package/dist/index.esm.js +68 -57
- 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
|
});
|
|
@@ -14985,13 +14988,15 @@ class DonationModal extends React.Component {
|
|
|
14985
14988
|
for (const product of this.state.productList) {
|
|
14986
14989
|
if (+product.id === +id) {
|
|
14987
14990
|
var _this$state$plan;
|
|
14991
|
+
const planList = product.plans.filter(plan => plan.type === "donation");
|
|
14992
|
+
if (planList.length === 1) {
|
|
14993
|
+
this.setState({
|
|
14994
|
+
plan: planList[0]
|
|
14995
|
+
});
|
|
14996
|
+
}
|
|
14988
14997
|
this.setState({
|
|
14989
|
-
product: product
|
|
14990
|
-
|
|
14991
|
-
this.setState({
|
|
14992
|
-
planList: product.plans.filter(plan => plan.type === "donation")
|
|
14993
|
-
});
|
|
14994
|
-
this.setState({
|
|
14998
|
+
product: product,
|
|
14999
|
+
planList: planList,
|
|
14995
15000
|
mode: "plan"
|
|
14996
15001
|
});
|
|
14997
15002
|
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 +15035,7 @@ class DonationModal extends React.Component {
|
|
|
15030
15035
|
mode: "product"
|
|
15031
15036
|
});
|
|
15032
15037
|
});
|
|
15033
|
-
_defineProperty$3(this, "submitOption",
|
|
15038
|
+
_defineProperty$3(this, "submitOption", () => {
|
|
15034
15039
|
this.props.setProductAndPlan(this.state.product, this.state.plan, this.state.isGift, this.state.selectedDonationAmount, this.state.customDonationAmount);
|
|
15035
15040
|
const {
|
|
15036
15041
|
product,
|
|
@@ -15044,7 +15049,7 @@ class DonationModal extends React.Component {
|
|
|
15044
15049
|
switchToAddressView,
|
|
15045
15050
|
switchToPaymentView
|
|
15046
15051
|
} = usePelcro.getStore();
|
|
15047
|
-
if (!isAuthenticated && product.address_required
|
|
15052
|
+
if (!isAuthenticated && product.address_required) {
|
|
15048
15053
|
return setView("register");
|
|
15049
15054
|
}
|
|
15050
15055
|
|
|
@@ -15076,7 +15081,7 @@ class DonationModal extends React.Component {
|
|
|
15076
15081
|
this.closeButton = window.Pelcro.paywall.displayCloseButton();
|
|
15077
15082
|
}
|
|
15078
15083
|
render() {
|
|
15079
|
-
var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r
|
|
15084
|
+
var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
|
|
15080
15085
|
this.props;
|
|
15081
15086
|
if (this.state.mode === "product") {
|
|
15082
15087
|
var _ReactGA$event;
|
|
@@ -15107,26 +15112,9 @@ class DonationModal extends React.Component {
|
|
|
15107
15112
|
className: "pelcro-select-products-wrapper"
|
|
15108
15113
|
}, (_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
15114
|
className: "plc-overflow-y-scroll pelcro-select-plans-wrapper"
|
|
15110
|
-
}, this.renderPlans()),
|
|
15111
|
-
disabled: this.state.disabled,
|
|
15112
|
-
onClick: () => this.submitOption(true),
|
|
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, {
|
|
15115
|
+
}, this.renderPlans()), /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
15123
15116
|
disabled: this.state.disabled,
|
|
15124
|
-
onClick: () => this.submitOption(
|
|
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),
|
|
15117
|
+
onClick: () => this.submitOption(),
|
|
15130
15118
|
id: "pelcro-submit",
|
|
15131
15119
|
className: "plc-w-full plc-mt-2"
|
|
15132
15120
|
}, this.locale("buttons.donate"))))), /*#__PURE__*/React__default['default'].createElement(ModalFooter, null, /*#__PURE__*/React__default['default'].createElement(Authorship, null)));
|
|
@@ -17345,12 +17333,14 @@ const initialState$k = {
|
|
|
17345
17333
|
lastName: "",
|
|
17346
17334
|
phone: "",
|
|
17347
17335
|
email: "",
|
|
17336
|
+
password: "",
|
|
17348
17337
|
firstNameError: null,
|
|
17349
17338
|
lastNameError: null,
|
|
17350
17339
|
phoneError: null,
|
|
17351
17340
|
emailError: null,
|
|
17352
17341
|
month: "",
|
|
17353
17342
|
year: "",
|
|
17343
|
+
passwordError: null,
|
|
17354
17344
|
alert: {
|
|
17355
17345
|
type: "error",
|
|
17356
17346
|
content: ""
|
|
@@ -17386,7 +17376,8 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17386
17376
|
couponCode,
|
|
17387
17377
|
selectedDonationAmount,
|
|
17388
17378
|
customDonationAmount,
|
|
17389
|
-
isAuthenticated
|
|
17379
|
+
isAuthenticated,
|
|
17380
|
+
switchView
|
|
17390
17381
|
} = usePelcro();
|
|
17391
17382
|
const {
|
|
17392
17383
|
whenUserReady
|
|
@@ -18884,7 +18875,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18884
18875
|
const sendRegisterRequest = (state, callback) => {
|
|
18885
18876
|
window.Pelcro.user.register({
|
|
18886
18877
|
email: state.email,
|
|
18887
|
-
password:
|
|
18878
|
+
password: state.password
|
|
18888
18879
|
}, (err, res) => {
|
|
18889
18880
|
if (err) {
|
|
18890
18881
|
var _err$response, _err$response$data;
|
|
@@ -18895,11 +18886,20 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18895
18886
|
err.response.data.errors = {
|
|
18896
18887
|
...errors
|
|
18897
18888
|
};
|
|
18889
|
+
let errorContent;
|
|
18890
|
+
if (getErrorMessages(err) === "This email is already in use.") {
|
|
18891
|
+
errorContent = /*#__PURE__*/React__default['default'].createElement("p", null, "This email is already in use.", " ", /*#__PURE__*/React__default['default'].createElement("button", {
|
|
18892
|
+
className: "plc-font-bold plc-underline hover:plc-no-underline",
|
|
18893
|
+
onClick: () => switchView("login")
|
|
18894
|
+
}, "Login to continue"));
|
|
18895
|
+
} else {
|
|
18896
|
+
errorContent = getErrorMessages(err);
|
|
18897
|
+
}
|
|
18898
18898
|
dispatch({
|
|
18899
18899
|
type: SHOW_ALERT,
|
|
18900
18900
|
payload: {
|
|
18901
18901
|
type: "error",
|
|
18902
|
-
content:
|
|
18902
|
+
content: errorContent
|
|
18903
18903
|
}
|
|
18904
18904
|
});
|
|
18905
18905
|
dispatch({
|
|
@@ -19335,6 +19335,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19335
19335
|
emailError: action.payload,
|
|
19336
19336
|
email: ""
|
|
19337
19337
|
});
|
|
19338
|
+
case SET_PASSWORD_ERROR:
|
|
19339
|
+
return lib_7({
|
|
19340
|
+
...state,
|
|
19341
|
+
passwordError: action.payload,
|
|
19342
|
+
password: ""
|
|
19343
|
+
});
|
|
19338
19344
|
case SHOW_ALERT:
|
|
19339
19345
|
return lib_7({
|
|
19340
19346
|
...state,
|
|
@@ -19688,6 +19694,7 @@ const SubmitPaymentMethod = _ref => {
|
|
|
19688
19694
|
lastNameError,
|
|
19689
19695
|
phoneError,
|
|
19690
19696
|
emailError,
|
|
19697
|
+
passwordError,
|
|
19691
19698
|
firstName,
|
|
19692
19699
|
lastName,
|
|
19693
19700
|
phone,
|
|
@@ -19698,12 +19705,6 @@ const SubmitPaymentMethod = _ref => {
|
|
|
19698
19705
|
} = React.useContext(store$k);
|
|
19699
19706
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
19700
19707
|
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
19708
|
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
19709
|
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
19710
|
const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
|
|
@@ -19714,9 +19715,9 @@ const SubmitPaymentMethod = _ref => {
|
|
|
19714
19715
|
if (supportsTap && isUserFirstName && isUserLastName && isUserPhone) {
|
|
19715
19716
|
setDisabled(disableSubmit);
|
|
19716
19717
|
} 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);
|
|
19718
|
+
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
19719
|
}
|
|
19719
|
-
}, [disableSubmit, firstNameError, lastNameError, phoneError, firstName, lastName, phone, emailError]);
|
|
19720
|
+
}, [disableSubmit, firstNameError, lastNameError, phoneError, firstName, lastName, phone, emailError, passwordError]);
|
|
19720
19721
|
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
19721
19722
|
role: "submit",
|
|
19722
19723
|
className: "plc-w-full plc-py-3",
|
|
@@ -20355,6 +20356,10 @@ const DonationEmail = props => /*#__PURE__*/React__default['default'].createElem
|
|
|
20355
20356
|
store: store$k
|
|
20356
20357
|
}, props));
|
|
20357
20358
|
|
|
20359
|
+
const DonationPassword = props => /*#__PURE__*/React__default['default'].createElement(Password, Object.assign({
|
|
20360
|
+
store: store$k
|
|
20361
|
+
}, props));
|
|
20362
|
+
|
|
20358
20363
|
/**
|
|
20359
20364
|
*
|
|
20360
20365
|
*/
|
|
@@ -20435,13 +20440,18 @@ function PaymentMethodView(_ref) {
|
|
|
20435
20440
|
errorId: "pelcro-input-phone-error",
|
|
20436
20441
|
label: t("labels.phone"),
|
|
20437
20442
|
required: true
|
|
20438
|
-
})), !isAuthenticated() && (plan === null || plan === void 0 ? void 0 : plan.type) === "donation" && /*#__PURE__*/React__default['default'].createElement(DonationEmail, {
|
|
20443
|
+
})), !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
20444
|
id: "pelcro-input-email",
|
|
20440
20445
|
errorId: "pelcro-input-email-error",
|
|
20441
20446
|
label: t("labels.email"),
|
|
20442
20447
|
required: true,
|
|
20443
20448
|
autoFocus: true
|
|
20444
|
-
}), /*#__PURE__*/React__default['default'].createElement(
|
|
20449
|
+
}), /*#__PURE__*/React__default['default'].createElement(DonationPassword, {
|
|
20450
|
+
id: "pelcro-input-password",
|
|
20451
|
+
errorId: "pelcro-input-password-error",
|
|
20452
|
+
label: t("labels.password"),
|
|
20453
|
+
required: true
|
|
20454
|
+
})), /*#__PURE__*/React__default['default'].createElement(CheckoutForm, null), showCoupon && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20445
20455
|
className: "plc-mb-2"
|
|
20446
20456
|
}, /*#__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
20457
|
className: "plc-grid plc-mt-4 plc-gap-y-2"
|
|
@@ -29047,6 +29057,7 @@ const DonationsMenu = _ref => {
|
|
|
29047
29057
|
setSubscriptionToCancel
|
|
29048
29058
|
} = usePelcro();
|
|
29049
29059
|
const donations = getDonationSubs().sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
|
|
29060
|
+
console.log("Sub", sub);
|
|
29050
29061
|
// Cancel button click handlers
|
|
29051
29062
|
const onCancelClick = () => {
|
|
29052
29063
|
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
|
});
|
|
@@ -14955,13 +14958,15 @@ class DonationModal extends Component {
|
|
|
14955
14958
|
for (const product of this.state.productList) {
|
|
14956
14959
|
if (+product.id === +id) {
|
|
14957
14960
|
var _this$state$plan;
|
|
14961
|
+
const planList = product.plans.filter(plan => plan.type === "donation");
|
|
14962
|
+
if (planList.length === 1) {
|
|
14963
|
+
this.setState({
|
|
14964
|
+
plan: planList[0]
|
|
14965
|
+
});
|
|
14966
|
+
}
|
|
14958
14967
|
this.setState({
|
|
14959
|
-
product: product
|
|
14960
|
-
|
|
14961
|
-
this.setState({
|
|
14962
|
-
planList: product.plans.filter(plan => plan.type === "donation")
|
|
14963
|
-
});
|
|
14964
|
-
this.setState({
|
|
14968
|
+
product: product,
|
|
14969
|
+
planList: planList,
|
|
14965
14970
|
mode: "plan"
|
|
14966
14971
|
});
|
|
14967
14972
|
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 +15005,7 @@ class DonationModal extends Component {
|
|
|
15000
15005
|
mode: "product"
|
|
15001
15006
|
});
|
|
15002
15007
|
});
|
|
15003
|
-
_defineProperty$3(this, "submitOption",
|
|
15008
|
+
_defineProperty$3(this, "submitOption", () => {
|
|
15004
15009
|
this.props.setProductAndPlan(this.state.product, this.state.plan, this.state.isGift, this.state.selectedDonationAmount, this.state.customDonationAmount);
|
|
15005
15010
|
const {
|
|
15006
15011
|
product,
|
|
@@ -15014,7 +15019,7 @@ class DonationModal extends Component {
|
|
|
15014
15019
|
switchToAddressView,
|
|
15015
15020
|
switchToPaymentView
|
|
15016
15021
|
} = usePelcro.getStore();
|
|
15017
|
-
if (!isAuthenticated && product.address_required
|
|
15022
|
+
if (!isAuthenticated && product.address_required) {
|
|
15018
15023
|
return setView("register");
|
|
15019
15024
|
}
|
|
15020
15025
|
|
|
@@ -15046,7 +15051,7 @@ class DonationModal extends Component {
|
|
|
15046
15051
|
this.closeButton = window.Pelcro.paywall.displayCloseButton();
|
|
15047
15052
|
}
|
|
15048
15053
|
render() {
|
|
15049
|
-
var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r
|
|
15054
|
+
var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
|
|
15050
15055
|
this.props;
|
|
15051
15056
|
if (this.state.mode === "product") {
|
|
15052
15057
|
var _ReactGA$event;
|
|
@@ -15077,26 +15082,9 @@ class DonationModal extends Component {
|
|
|
15077
15082
|
className: "pelcro-select-products-wrapper"
|
|
15078
15083
|
}, (_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
15084
|
className: "plc-overflow-y-scroll pelcro-select-plans-wrapper"
|
|
15080
|
-
}, this.renderPlans()),
|
|
15081
|
-
disabled: this.state.disabled,
|
|
15082
|
-
onClick: () => this.submitOption(true),
|
|
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, {
|
|
15085
|
+
}, this.renderPlans()), /*#__PURE__*/React__default.createElement(Button, {
|
|
15093
15086
|
disabled: this.state.disabled,
|
|
15094
|
-
onClick: () => this.submitOption(
|
|
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),
|
|
15087
|
+
onClick: () => this.submitOption(),
|
|
15100
15088
|
id: "pelcro-submit",
|
|
15101
15089
|
className: "plc-w-full plc-mt-2"
|
|
15102
15090
|
}, this.locale("buttons.donate"))))), /*#__PURE__*/React__default.createElement(ModalFooter, null, /*#__PURE__*/React__default.createElement(Authorship, null)));
|
|
@@ -17315,12 +17303,14 @@ const initialState$k = {
|
|
|
17315
17303
|
lastName: "",
|
|
17316
17304
|
phone: "",
|
|
17317
17305
|
email: "",
|
|
17306
|
+
password: "",
|
|
17318
17307
|
firstNameError: null,
|
|
17319
17308
|
lastNameError: null,
|
|
17320
17309
|
phoneError: null,
|
|
17321
17310
|
emailError: null,
|
|
17322
17311
|
month: "",
|
|
17323
17312
|
year: "",
|
|
17313
|
+
passwordError: null,
|
|
17324
17314
|
alert: {
|
|
17325
17315
|
type: "error",
|
|
17326
17316
|
content: ""
|
|
@@ -17356,7 +17346,8 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17356
17346
|
couponCode,
|
|
17357
17347
|
selectedDonationAmount,
|
|
17358
17348
|
customDonationAmount,
|
|
17359
|
-
isAuthenticated
|
|
17349
|
+
isAuthenticated,
|
|
17350
|
+
switchView
|
|
17360
17351
|
} = usePelcro();
|
|
17361
17352
|
const {
|
|
17362
17353
|
whenUserReady
|
|
@@ -18854,7 +18845,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18854
18845
|
const sendRegisterRequest = (state, callback) => {
|
|
18855
18846
|
window.Pelcro.user.register({
|
|
18856
18847
|
email: state.email,
|
|
18857
|
-
password:
|
|
18848
|
+
password: state.password
|
|
18858
18849
|
}, (err, res) => {
|
|
18859
18850
|
if (err) {
|
|
18860
18851
|
var _err$response, _err$response$data;
|
|
@@ -18865,11 +18856,20 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18865
18856
|
err.response.data.errors = {
|
|
18866
18857
|
...errors
|
|
18867
18858
|
};
|
|
18859
|
+
let errorContent;
|
|
18860
|
+
if (getErrorMessages(err) === "This email is already in use.") {
|
|
18861
|
+
errorContent = /*#__PURE__*/React__default.createElement("p", null, "This email is already in use.", " ", /*#__PURE__*/React__default.createElement("button", {
|
|
18862
|
+
className: "plc-font-bold plc-underline hover:plc-no-underline",
|
|
18863
|
+
onClick: () => switchView("login")
|
|
18864
|
+
}, "Login to continue"));
|
|
18865
|
+
} else {
|
|
18866
|
+
errorContent = getErrorMessages(err);
|
|
18867
|
+
}
|
|
18868
18868
|
dispatch({
|
|
18869
18869
|
type: SHOW_ALERT,
|
|
18870
18870
|
payload: {
|
|
18871
18871
|
type: "error",
|
|
18872
|
-
content:
|
|
18872
|
+
content: errorContent
|
|
18873
18873
|
}
|
|
18874
18874
|
});
|
|
18875
18875
|
dispatch({
|
|
@@ -19305,6 +19305,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19305
19305
|
emailError: action.payload,
|
|
19306
19306
|
email: ""
|
|
19307
19307
|
});
|
|
19308
|
+
case SET_PASSWORD_ERROR:
|
|
19309
|
+
return lib_7({
|
|
19310
|
+
...state,
|
|
19311
|
+
passwordError: action.payload,
|
|
19312
|
+
password: ""
|
|
19313
|
+
});
|
|
19308
19314
|
case SHOW_ALERT:
|
|
19309
19315
|
return lib_7({
|
|
19310
19316
|
...state,
|
|
@@ -19658,6 +19664,7 @@ const SubmitPaymentMethod = _ref => {
|
|
|
19658
19664
|
lastNameError,
|
|
19659
19665
|
phoneError,
|
|
19660
19666
|
emailError,
|
|
19667
|
+
passwordError,
|
|
19661
19668
|
firstName,
|
|
19662
19669
|
lastName,
|
|
19663
19670
|
phone,
|
|
@@ -19668,12 +19675,6 @@ const SubmitPaymentMethod = _ref => {
|
|
|
19668
19675
|
} = useContext(store$k);
|
|
19669
19676
|
const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
|
|
19670
19677
|
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
19678
|
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
19679
|
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
19680
|
const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
|
|
@@ -19684,9 +19685,9 @@ const SubmitPaymentMethod = _ref => {
|
|
|
19684
19685
|
if (supportsTap && isUserFirstName && isUserLastName && isUserPhone) {
|
|
19685
19686
|
setDisabled(disableSubmit);
|
|
19686
19687
|
} 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);
|
|
19688
|
+
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
19689
|
}
|
|
19689
|
-
}, [disableSubmit, firstNameError, lastNameError, phoneError, firstName, lastName, phone, emailError]);
|
|
19690
|
+
}, [disableSubmit, firstNameError, lastNameError, phoneError, firstName, lastName, phone, emailError, passwordError]);
|
|
19690
19691
|
return /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
19691
19692
|
role: "submit",
|
|
19692
19693
|
className: "plc-w-full plc-py-3",
|
|
@@ -20325,6 +20326,10 @@ const DonationEmail = props => /*#__PURE__*/React__default.createElement(Email,
|
|
|
20325
20326
|
store: store$k
|
|
20326
20327
|
}, props));
|
|
20327
20328
|
|
|
20329
|
+
const DonationPassword = props => /*#__PURE__*/React__default.createElement(Password, Object.assign({
|
|
20330
|
+
store: store$k
|
|
20331
|
+
}, props));
|
|
20332
|
+
|
|
20328
20333
|
/**
|
|
20329
20334
|
*
|
|
20330
20335
|
*/
|
|
@@ -20405,13 +20410,18 @@ function PaymentMethodView(_ref) {
|
|
|
20405
20410
|
errorId: "pelcro-input-phone-error",
|
|
20406
20411
|
label: t("labels.phone"),
|
|
20407
20412
|
required: true
|
|
20408
|
-
})), !isAuthenticated() && (plan === null || plan === void 0 ? void 0 : plan.type) === "donation" && /*#__PURE__*/React__default.createElement(DonationEmail, {
|
|
20413
|
+
})), !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
20414
|
id: "pelcro-input-email",
|
|
20410
20415
|
errorId: "pelcro-input-email-error",
|
|
20411
20416
|
label: t("labels.email"),
|
|
20412
20417
|
required: true,
|
|
20413
20418
|
autoFocus: true
|
|
20414
|
-
}), /*#__PURE__*/React__default.createElement(
|
|
20419
|
+
}), /*#__PURE__*/React__default.createElement(DonationPassword, {
|
|
20420
|
+
id: "pelcro-input-password",
|
|
20421
|
+
errorId: "pelcro-input-password-error",
|
|
20422
|
+
label: t("labels.password"),
|
|
20423
|
+
required: true
|
|
20424
|
+
})), /*#__PURE__*/React__default.createElement(CheckoutForm, null), showCoupon && /*#__PURE__*/React__default.createElement("div", {
|
|
20415
20425
|
className: "plc-mb-2"
|
|
20416
20426
|
}, /*#__PURE__*/React__default.createElement(CouponCode, null), /*#__PURE__*/React__default.createElement(DiscountedPrice, null)), /*#__PURE__*/React__default.createElement(TaxAmount, null), /*#__PURE__*/React__default.createElement("div", {
|
|
20417
20427
|
className: "plc-grid plc-mt-4 plc-gap-y-2"
|
|
@@ -29017,6 +29027,7 @@ const DonationsMenu = _ref => {
|
|
|
29017
29027
|
setSubscriptionToCancel
|
|
29018
29028
|
} = usePelcro();
|
|
29019
29029
|
const donations = getDonationSubs().sort((a, b) => a.expires_at - b.expires_at).sort((a, b) => a.renews_at - b.renews_at).map(sub => {
|
|
29030
|
+
console.log("Sub", sub);
|
|
29020
29031
|
// Cancel button click handlers
|
|
29021
29032
|
const onCancelClick = () => {
|
|
29022
29033
|
const isImmediateCancelationEnabled = window.Pelcro.site.read().cancel_settings.status;
|
package/dist/pelcro.css
CHANGED