@pelcro/react-pelcro-js 3.21.6 → 3.21.7
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 +163 -35
- package/dist/index.esm.js +163 -36
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -3457,7 +3457,8 @@ var labels$10 = {
|
|
|
3457
3457
|
removeCoupon: "REMOVE",
|
|
3458
3458
|
firstName: "First name",
|
|
3459
3459
|
lastName: "Last name",
|
|
3460
|
-
phone: "Phone"
|
|
3460
|
+
phone: "Phone",
|
|
3461
|
+
freeItems: "Free Items"
|
|
3461
3462
|
};
|
|
3462
3463
|
var checkoutForm_en = {
|
|
3463
3464
|
messages: messages$14,
|
|
@@ -4398,7 +4399,8 @@ var labels$H = {
|
|
|
4398
4399
|
removeCoupon: "RETIRER",
|
|
4399
4400
|
firstName: "Prénom",
|
|
4400
4401
|
lastName: "Nom de famille",
|
|
4401
|
-
phone: "Téléphoner"
|
|
4402
|
+
phone: "Téléphoner",
|
|
4403
|
+
freeItems: "Articles gratuits"
|
|
4402
4404
|
};
|
|
4403
4405
|
var checkoutForm_fr = {
|
|
4404
4406
|
messages: messages$M,
|
|
@@ -5225,7 +5227,8 @@ var labels$s = {
|
|
|
5225
5227
|
removeCoupon: "제거",
|
|
5226
5228
|
firstName: "이름",
|
|
5227
5229
|
lastName: "성",
|
|
5228
|
-
phone: "핸드폰"
|
|
5230
|
+
phone: "핸드폰",
|
|
5231
|
+
freeItems: "무료 아이템"
|
|
5229
5232
|
};
|
|
5230
5233
|
var checkoutForm_ko = {
|
|
5231
5234
|
messages: messages$v,
|
|
@@ -6156,7 +6159,8 @@ var labels$d = {
|
|
|
6156
6159
|
removeCoupon: "ELIMINAR",
|
|
6157
6160
|
firstName: "Nombre",
|
|
6158
6161
|
lastName: "Apellido",
|
|
6159
|
-
phone: "Teléfono"
|
|
6162
|
+
phone: "Teléfono",
|
|
6163
|
+
freeItems: "Artículos gratis"
|
|
6160
6164
|
};
|
|
6161
6165
|
var checkoutForm_es = {
|
|
6162
6166
|
messages: messages$e,
|
|
@@ -8707,7 +8711,7 @@ const calcAndFormatItemsTotal = (items, currency) => {
|
|
|
8707
8711
|
if (!Array.isArray(items)) return;
|
|
8708
8712
|
let totalWithoutDividingBy100 = 0;
|
|
8709
8713
|
for (const item of items) {
|
|
8710
|
-
totalWithoutDividingBy100 += parseFloat(item.price ? isCurrencyZeroDecimal(currency) ? item.price * item.quantity : (item.price * item.quantity).toFixed(2) : isCurrencyZeroDecimal(currency) ? item.amount : item.amount.toFixed(2));
|
|
8714
|
+
totalWithoutDividingBy100 += parseFloat(item !== null && item !== void 0 && item.price || (item === null || item === void 0 ? void 0 : item.price) === 0 ? isCurrencyZeroDecimal(currency) ? item.price * item.quantity : (item.price * item.quantity).toFixed(2) : isCurrencyZeroDecimal(currency) ? item.amount : item.amount.toFixed(2));
|
|
8711
8715
|
}
|
|
8712
8716
|
return getFormattedPriceByLocal(totalWithoutDividingBy100, currency, getPageOrDefaultLanguage());
|
|
8713
8717
|
};
|
|
@@ -16842,7 +16846,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16842
16846
|
const tapInstanceRef = React__default['default'].useRef(null);
|
|
16843
16847
|
const tapInstanceCard = React__default['default'].useRef(null);
|
|
16844
16848
|
React.useEffect(() => {
|
|
16845
|
-
if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
|
|
16849
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
16846
16850
|
if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
|
|
16847
16851
|
var _window$Pelcro$site$r2, _window$Pelcro$site$r3;
|
|
16848
16852
|
const payPageId = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.vantiv_gateway_settings.pay_page_id;
|
|
@@ -16878,7 +16882,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16878
16882
|
}, [vantivPaymentRequest]);
|
|
16879
16883
|
React.useEffect(() => {
|
|
16880
16884
|
whenUserReady(() => {
|
|
16881
|
-
if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
|
|
16885
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
16882
16886
|
if (cardProcessor === "tap" && !window.Tapjsli) {
|
|
16883
16887
|
window.Pelcro.helpers.loadSDK("https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js", "tap-bluebird");
|
|
16884
16888
|
window.Pelcro.helpers.loadSDK("https://secure.gosell.io/js/sdk/tap.min.js", "tap-sdk");
|
|
@@ -16892,7 +16896,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16892
16896
|
});
|
|
16893
16897
|
}, [selectedPaymentMethodId]);
|
|
16894
16898
|
const initPaymentRequest = (state, dispatch) => {
|
|
16895
|
-
if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
|
|
16899
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
16896
16900
|
try {
|
|
16897
16901
|
const paymentRequest = stripe.paymentRequest({
|
|
16898
16902
|
country: window.Pelcro.user.location.countryCode || "US",
|
|
@@ -16961,7 +16965,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16961
16965
|
*/
|
|
16962
16966
|
const updateTotalAmountWithTax = () => {
|
|
16963
16967
|
var _window$Pelcro$site$r4;
|
|
16964
|
-
if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
|
|
16968
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
16965
16969
|
const taxesEnabled = (_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.taxes_enabled;
|
|
16966
16970
|
if (taxesEnabled && type === "createPayment") {
|
|
16967
16971
|
dispatch({
|
|
@@ -17458,16 +17462,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17458
17462
|
items: mappedOrderItems,
|
|
17459
17463
|
addressId: selectedAddressId,
|
|
17460
17464
|
couponCode
|
|
17461
|
-
}, (err,
|
|
17462
|
-
|
|
17463
|
-
type: DISABLE_SUBMIT,
|
|
17464
|
-
payload: false
|
|
17465
|
-
});
|
|
17466
|
-
dispatch({
|
|
17467
|
-
type: LOADING,
|
|
17468
|
-
payload: false
|
|
17469
|
-
});
|
|
17465
|
+
}, (err, orderResponse) => {
|
|
17466
|
+
var _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro2$user$;
|
|
17470
17467
|
if (err) {
|
|
17468
|
+
toggleAuthenticationSuccessPendingView(false);
|
|
17469
|
+
dispatch({
|
|
17470
|
+
type: DISABLE_SUBMIT,
|
|
17471
|
+
payload: false
|
|
17472
|
+
});
|
|
17473
|
+
dispatch({
|
|
17474
|
+
type: LOADING,
|
|
17475
|
+
payload: false
|
|
17476
|
+
});
|
|
17471
17477
|
onFailure(err);
|
|
17472
17478
|
return dispatch({
|
|
17473
17479
|
type: SHOW_ALERT,
|
|
@@ -17487,7 +17493,30 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17487
17493
|
cartItems: []
|
|
17488
17494
|
});
|
|
17489
17495
|
}
|
|
17490
|
-
|
|
17496
|
+
window.Pelcro.user.refresh({
|
|
17497
|
+
auth_token: (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$user = _window$Pelcro2.user) === null || _window$Pelcro2$user === void 0 ? void 0 : (_window$Pelcro2$user$ = _window$Pelcro2$user.read()) === null || _window$Pelcro2$user$ === void 0 ? void 0 : _window$Pelcro2$user$.auth_token
|
|
17498
|
+
}, (err, res) => {
|
|
17499
|
+
dispatch({
|
|
17500
|
+
type: DISABLE_SUBMIT,
|
|
17501
|
+
payload: false
|
|
17502
|
+
});
|
|
17503
|
+
dispatch({
|
|
17504
|
+
type: LOADING,
|
|
17505
|
+
payload: false
|
|
17506
|
+
});
|
|
17507
|
+
toggleAuthenticationSuccessPendingView(false);
|
|
17508
|
+
if (err) {
|
|
17509
|
+
onFailure(err);
|
|
17510
|
+
return dispatch({
|
|
17511
|
+
type: SHOW_ALERT,
|
|
17512
|
+
payload: {
|
|
17513
|
+
type: "error",
|
|
17514
|
+
content: getErrorMessages(err)
|
|
17515
|
+
}
|
|
17516
|
+
});
|
|
17517
|
+
}
|
|
17518
|
+
onSuccess(orderResponse);
|
|
17519
|
+
});
|
|
17491
17520
|
});
|
|
17492
17521
|
};
|
|
17493
17522
|
const payInvoice = (gatewayService, gatewayToken, dispatch) => {
|
|
@@ -17565,6 +17594,29 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17565
17594
|
});
|
|
17566
17595
|
};
|
|
17567
17596
|
const submitPayment = (state, dispatch) => {
|
|
17597
|
+
if (skipPayment && props !== null && props !== void 0 && props.freeOrders) {
|
|
17598
|
+
const isQuickPurchase = !Array.isArray(order);
|
|
17599
|
+
const mappedOrderItems = isQuickPurchase ? [{
|
|
17600
|
+
sku_id: order.id,
|
|
17601
|
+
quantity: order.quantity
|
|
17602
|
+
}] : order.map(item => ({
|
|
17603
|
+
sku_id: item.id,
|
|
17604
|
+
quantity: item.quantity
|
|
17605
|
+
}));
|
|
17606
|
+
window.Pelcro.ecommerce.order.create({
|
|
17607
|
+
items: mappedOrderItems,
|
|
17608
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
17609
|
+
...(selectedAddressId && {
|
|
17610
|
+
address_id: selectedAddressId
|
|
17611
|
+
})
|
|
17612
|
+
}, (err, res) => {
|
|
17613
|
+
if (err) {
|
|
17614
|
+
return handlePaymentError(err);
|
|
17615
|
+
}
|
|
17616
|
+
return onSuccess(res);
|
|
17617
|
+
});
|
|
17618
|
+
return;
|
|
17619
|
+
}
|
|
17568
17620
|
stripe.createSource({
|
|
17569
17621
|
type: "card"
|
|
17570
17622
|
}).then(_ref8 => {
|
|
@@ -17798,6 +17850,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17798
17850
|
disableSubmit: true,
|
|
17799
17851
|
isLoading: true
|
|
17800
17852
|
}, (state, dispatch) => {
|
|
17853
|
+
if (skipPayment && props !== null && props !== void 0 && props.freeOrders) {
|
|
17854
|
+
return submitPayment(state);
|
|
17855
|
+
}
|
|
17801
17856
|
if (getSiteCardProcessor() === "vantiv") {
|
|
17802
17857
|
return submitUsingVantiv(state);
|
|
17803
17858
|
}
|
|
@@ -17926,10 +17981,14 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17926
17981
|
state,
|
|
17927
17982
|
dispatch
|
|
17928
17983
|
}
|
|
17929
|
-
}, children.length ? children.map((child, i) =>
|
|
17930
|
-
|
|
17931
|
-
|
|
17932
|
-
|
|
17984
|
+
}, children.length ? children.map((child, i) => {
|
|
17985
|
+
if (child) {
|
|
17986
|
+
return /*#__PURE__*/React__default['default'].cloneElement(child, {
|
|
17987
|
+
store: store$k,
|
|
17988
|
+
key: i
|
|
17989
|
+
});
|
|
17990
|
+
}
|
|
17991
|
+
}) : /*#__PURE__*/React__default['default'].cloneElement(children, {
|
|
17933
17992
|
store: store$k
|
|
17934
17993
|
})));
|
|
17935
17994
|
};
|
|
@@ -18752,11 +18811,47 @@ const SubscriptionCreateFreePlanButton = _ref => {
|
|
|
18752
18811
|
}, otherProps), t("buttons.subscribe"));
|
|
18753
18812
|
};
|
|
18754
18813
|
|
|
18814
|
+
const OrderCreateFreeButton = _ref => {
|
|
18815
|
+
let {
|
|
18816
|
+
name,
|
|
18817
|
+
onClick,
|
|
18818
|
+
...otherProps
|
|
18819
|
+
} = _ref;
|
|
18820
|
+
const {
|
|
18821
|
+
state: {
|
|
18822
|
+
disableSubmit
|
|
18823
|
+
},
|
|
18824
|
+
dispatch
|
|
18825
|
+
} = React.useContext(store$k);
|
|
18826
|
+
const {
|
|
18827
|
+
t
|
|
18828
|
+
} = useTranslation("checkoutForm");
|
|
18829
|
+
const [isDisabled, setDisabled] = React.useState(true);
|
|
18830
|
+
React.useEffect(() => {
|
|
18831
|
+
setDisabled(disableSubmit);
|
|
18832
|
+
}, [disableSubmit]);
|
|
18833
|
+
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
18834
|
+
className: "plc-w-full",
|
|
18835
|
+
onClick: () => {
|
|
18836
|
+
dispatch({
|
|
18837
|
+
type: DISABLE_SUBMIT,
|
|
18838
|
+
payload: true
|
|
18839
|
+
});
|
|
18840
|
+
dispatch({
|
|
18841
|
+
type: SUBMIT_PAYMENT
|
|
18842
|
+
});
|
|
18843
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
18844
|
+
},
|
|
18845
|
+
disabled: isDisabled,
|
|
18846
|
+
isLoading: disableSubmit
|
|
18847
|
+
}, otherProps), t("labels.submit"));
|
|
18848
|
+
};
|
|
18849
|
+
|
|
18755
18850
|
/**
|
|
18756
18851
|
*
|
|
18757
18852
|
*/
|
|
18758
18853
|
function PaymentMethodView(_ref) {
|
|
18759
|
-
var _window$Pelcro$site$r, _window$Pelcro$site$r2
|
|
18854
|
+
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _calcAndFormatItemsTo, _order$;
|
|
18760
18855
|
let {
|
|
18761
18856
|
onSuccess,
|
|
18762
18857
|
onGiftRenewalSuccess,
|
|
@@ -18764,7 +18859,9 @@ function PaymentMethodView(_ref) {
|
|
|
18764
18859
|
type,
|
|
18765
18860
|
showCoupon,
|
|
18766
18861
|
showExternalPaymentMethods,
|
|
18767
|
-
showSubscriptionButton
|
|
18862
|
+
showSubscriptionButton,
|
|
18863
|
+
showOrderButton,
|
|
18864
|
+
order
|
|
18768
18865
|
} = _ref;
|
|
18769
18866
|
const {
|
|
18770
18867
|
t
|
|
@@ -18777,7 +18874,17 @@ function PaymentMethodView(_ref) {
|
|
|
18777
18874
|
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
18778
18875
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18779
18876
|
className: "plc-flex plc-flex-col plc-items-center plc-mt-4 sm:plc-px-8 pelcro-payment-block"
|
|
18780
|
-
},
|
|
18877
|
+
}, order && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18878
|
+
className: "plc-w-full plc-p-2 plc-mb-4 plc-font-semibold plc-text-center plc-text-gray-900 plc-bg-gray-100 plc-border plc-border-gray-200"
|
|
18879
|
+
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
18880
|
+
className: "plc-text-gray-600"
|
|
18881
|
+
}, !Array.isArray(order) ? /*#__PURE__*/React__default['default'].createElement("span", {
|
|
18882
|
+
className: "plc-tracking-wider plc-uppercase"
|
|
18883
|
+
}, order === null || order === void 0 ? void 0 : order.name) : /*#__PURE__*/React__default['default'].createElement("span", {
|
|
18884
|
+
className: "plc-tracking-wider plc-uppercase"
|
|
18885
|
+
}, t("labels.freeItems")), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
18886
|
+
className: "plc-text-xl plc-font-semibold plc-text-primary-600"
|
|
18887
|
+
}, (_calcAndFormatItemsTo = calcAndFormatItemsTotal(order, (_order$ = order[0]) === null || _order$ === void 0 ? void 0 : _order$.currency)) !== null && _calcAndFormatItemsTo !== void 0 ? _calcAndFormatItemsTo : getFormattedPriceByLocal(order === null || order === void 0 ? void 0 : order.price, order === null || order === void 0 ? void 0 : order.currency, getPageOrDefaultLanguage())))), cardProcessor === "stripe" && !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18781
18888
|
className: "plc-flex plc-items-center plc-w-full plc-px-4 plc-py-2 plc-text-center plc-text-green-600 plc-border plc-border-green-400 plc-rounded plc-bg-green-50"
|
|
18782
18889
|
}, /*#__PURE__*/React__default['default'].createElement(SvgLock, {
|
|
18783
18890
|
className: "plc-w-5 plc-h-5 plc-mr-1"
|
|
@@ -18793,10 +18900,11 @@ function PaymentMethodView(_ref) {
|
|
|
18793
18900
|
type: type,
|
|
18794
18901
|
onSuccess: onSuccess,
|
|
18795
18902
|
onGiftRenewalSuccess: onGiftRenewalSuccess,
|
|
18796
|
-
onFailure: onFailure
|
|
18903
|
+
onFailure: onFailure,
|
|
18904
|
+
freeOrders: showOrderButton
|
|
18797
18905
|
}, /*#__PURE__*/React__default['default'].createElement(AlertWithContext, {
|
|
18798
18906
|
className: "plc-mb-2"
|
|
18799
|
-
}), showSubscriptionButton
|
|
18907
|
+
}), showSubscriptionButton && /*#__PURE__*/React__default['default'].createElement(SubscriptionCreateFreePlanButton, null), showOrderButton && /*#__PURE__*/React__default['default'].createElement(OrderCreateFreeButton, null), !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(BankRedirection, null), /*#__PURE__*/React__default['default'].createElement(BankAuthenticationSuccess, null), /*#__PURE__*/React__default['default'].createElement(SelectedPaymentMethod, null), supportsTap && (!isUserFirstName || !isUserLastName || !isUserPhone) && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18800
18908
|
className: "plc-flex plc-items-start"
|
|
18801
18909
|
}, /*#__PURE__*/React__default['default'].createElement(IncludeFirstName, {
|
|
18802
18910
|
id: "pelcro-input-first-name",
|
|
@@ -20551,6 +20659,16 @@ function SubscriptionManageMembersList(props) {
|
|
|
20551
20659
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgCheckMark, null)
|
|
20552
20660
|
};
|
|
20553
20661
|
}, []);
|
|
20662
|
+
const showMemberData = React.useCallback(member => {
|
|
20663
|
+
var _member$customer, _member$customer2, _member$customer3, _member$customer4;
|
|
20664
|
+
let data;
|
|
20665
|
+
if ((member === null || member === void 0 ? void 0 : member.status) !== "active") {
|
|
20666
|
+
data = member === null || member === void 0 ? void 0 : member.invitation_email;
|
|
20667
|
+
return data;
|
|
20668
|
+
}
|
|
20669
|
+
data = (member === null || member === void 0 ? void 0 : (_member$customer = member.customer) === null || _member$customer === void 0 ? void 0 : _member$customer.email) || (member === null || member === void 0 ? void 0 : (_member$customer2 = member.customer) === null || _member$customer2 === void 0 ? void 0 : _member$customer2.first_name) + " " + (member === null || member === void 0 ? void 0 : (_member$customer3 = member.customer) === null || _member$customer3 === void 0 ? void 0 : _member$customer3.last_name) || (member === null || member === void 0 ? void 0 : (_member$customer4 = member.customer) === null || _member$customer4 === void 0 ? void 0 : _member$customer4.username) || "-----";
|
|
20670
|
+
return data;
|
|
20671
|
+
}, []);
|
|
20554
20672
|
if (loading) {
|
|
20555
20673
|
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("tr", null, /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20556
20674
|
className: "plc-animate-pulse"
|
|
@@ -20592,10 +20710,10 @@ function SubscriptionManageMembersList(props) {
|
|
|
20592
20710
|
className: `plc-w-full plc-align-middle plc-cursor-pointer accordion-header hover:plc-bg-gray-50 plc-text-center`
|
|
20593
20711
|
}, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
20594
20712
|
className: "plc-truncate plc-text-left",
|
|
20595
|
-
title: member
|
|
20713
|
+
title: showMemberData(member)
|
|
20596
20714
|
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20597
20715
|
className: "plc-font-semibold plc-text-gray-500"
|
|
20598
|
-
}, member
|
|
20716
|
+
}, showMemberData(member))), /*#__PURE__*/React__default['default'].createElement("td", {
|
|
20599
20717
|
className: "plc-py-2"
|
|
20600
20718
|
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20601
20719
|
className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${getMemberStatus(member).bgColor} plc-uppercase ${getMemberStatus(member).textColor} plc-rounded-lg`
|
|
@@ -24203,9 +24321,15 @@ const OrderCreateContainer = props => /*#__PURE__*/React__default['default'].cre
|
|
|
24203
24321
|
}, props));
|
|
24204
24322
|
|
|
24205
24323
|
const OrderCreateView = props => {
|
|
24324
|
+
var _window$Pelcro, _window$Pelcro$uiSett;
|
|
24206
24325
|
const {
|
|
24207
24326
|
t
|
|
24208
24327
|
} = useTranslation("payment");
|
|
24328
|
+
const {
|
|
24329
|
+
order
|
|
24330
|
+
} = usePelcro();
|
|
24331
|
+
const skipPayment = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.skipPaymentForFreePlans;
|
|
24332
|
+
const showOrderButton = skipPayment && ((order === null || order === void 0 ? void 0 : order.price) === 0 || (order === null || order === void 0 ? void 0 : order.length) > 0 && order.every(item => (item === null || item === void 0 ? void 0 : item.price) === 0));
|
|
24209
24333
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
24210
24334
|
id: "pelcro-order-create-view"
|
|
24211
24335
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -24216,7 +24340,9 @@ const OrderCreateView = props => {
|
|
|
24216
24340
|
}, /*#__PURE__*/React__default['default'].createElement(PaymentMethodView, Object.assign({
|
|
24217
24341
|
type: "orderCreate",
|
|
24218
24342
|
showCoupon: true,
|
|
24219
|
-
showExternalPaymentMethods: false
|
|
24343
|
+
showExternalPaymentMethods: false,
|
|
24344
|
+
showOrderButton: showOrderButton,
|
|
24345
|
+
order: order
|
|
24220
24346
|
}, props))));
|
|
24221
24347
|
};
|
|
24222
24348
|
|
|
@@ -25424,11 +25550,12 @@ const PaymentMethodSelectModal = _ref => {
|
|
|
25424
25550
|
const {
|
|
25425
25551
|
switchToCheckoutForm,
|
|
25426
25552
|
set,
|
|
25427
|
-
plan
|
|
25553
|
+
plan,
|
|
25554
|
+
order
|
|
25428
25555
|
} = usePelcro();
|
|
25429
25556
|
const skipPayment = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.skipPaymentForFreePlans;
|
|
25430
25557
|
React.useEffect(() => {
|
|
25431
|
-
if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) {
|
|
25558
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || (order === null || order === void 0 ? void 0 : order.price) === 0)) {
|
|
25432
25559
|
switchToCheckoutForm();
|
|
25433
25560
|
}
|
|
25434
25561
|
}, []);
|
|
@@ -27536,7 +27663,7 @@ const InvoicesItems = () => {
|
|
|
27536
27663
|
setInvoice,
|
|
27537
27664
|
switchView
|
|
27538
27665
|
} = usePelcro();
|
|
27539
|
-
const invoices = (_window$Pelcro$invoic = (_window$Pelcro$invoic2 = window.Pelcro.invoice.list()) === null || _window$Pelcro$invoic2 === void 0 ? void 0 : _window$Pelcro$invoic2.filter(invoice => invoice.total > 0)) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
27666
|
+
const invoices = (_window$Pelcro$invoic = (_window$Pelcro$invoic2 = window.Pelcro.invoice.list()) === null || _window$Pelcro$invoic2 === void 0 ? void 0 : _window$Pelcro$invoic2.filter(invoice => invoice.order_id || invoice.total > 0)) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
27540
27667
|
const showInvoiceDetails = event => {
|
|
27541
27668
|
if (setInvoice(event.target.dataset.id)) {
|
|
27542
27669
|
switchView("invoice-details");
|
|
@@ -28304,7 +28431,7 @@ class Dashboard extends React.Component {
|
|
|
28304
28431
|
}
|
|
28305
28432
|
function hasInvoices() {
|
|
28306
28433
|
var _window$Pelcro$invoic, _window$Pelcro$invoic2;
|
|
28307
|
-
const invoices = (_window$Pelcro$invoic = (_window$Pelcro$invoic2 = window.Pelcro.invoice.list()) === null || _window$Pelcro$invoic2 === void 0 ? void 0 : _window$Pelcro$invoic2.filter(invoice => invoice.total > 0)) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
28434
|
+
const invoices = (_window$Pelcro$invoic = (_window$Pelcro$invoic2 = window.Pelcro.invoice.list()) === null || _window$Pelcro$invoic2 === void 0 ? void 0 : _window$Pelcro$invoic2.filter(invoice => invoice.order_id || invoice.total > 0)) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
28308
28435
|
return invoices.length > 0;
|
|
28309
28436
|
}
|
|
28310
28437
|
function hasDonationSubs() {
|
|
@@ -32246,6 +32373,7 @@ exports.NewsletterUpdateView = NewsletterUpdateView;
|
|
|
32246
32373
|
exports.Notification = Notification;
|
|
32247
32374
|
exports.OrderConfirmModal = OrderConfirmModal;
|
|
32248
32375
|
exports.OrderCreateContainer = OrderCreateContainer;
|
|
32376
|
+
exports.OrderCreateFreeButton = OrderCreateFreeButton;
|
|
32249
32377
|
exports.OrderCreateModal = OrderCreateModal;
|
|
32250
32378
|
exports.OrderCreateSubmitButton = OrderCreateSubmitButton;
|
|
32251
32379
|
exports.OrderCreateView = OrderCreateView;
|
package/dist/index.esm.js
CHANGED
|
@@ -3427,7 +3427,8 @@ var labels$10 = {
|
|
|
3427
3427
|
removeCoupon: "REMOVE",
|
|
3428
3428
|
firstName: "First name",
|
|
3429
3429
|
lastName: "Last name",
|
|
3430
|
-
phone: "Phone"
|
|
3430
|
+
phone: "Phone",
|
|
3431
|
+
freeItems: "Free Items"
|
|
3431
3432
|
};
|
|
3432
3433
|
var checkoutForm_en = {
|
|
3433
3434
|
messages: messages$14,
|
|
@@ -4368,7 +4369,8 @@ var labels$H = {
|
|
|
4368
4369
|
removeCoupon: "RETIRER",
|
|
4369
4370
|
firstName: "Prénom",
|
|
4370
4371
|
lastName: "Nom de famille",
|
|
4371
|
-
phone: "Téléphoner"
|
|
4372
|
+
phone: "Téléphoner",
|
|
4373
|
+
freeItems: "Articles gratuits"
|
|
4372
4374
|
};
|
|
4373
4375
|
var checkoutForm_fr = {
|
|
4374
4376
|
messages: messages$M,
|
|
@@ -5195,7 +5197,8 @@ var labels$s = {
|
|
|
5195
5197
|
removeCoupon: "제거",
|
|
5196
5198
|
firstName: "이름",
|
|
5197
5199
|
lastName: "성",
|
|
5198
|
-
phone: "핸드폰"
|
|
5200
|
+
phone: "핸드폰",
|
|
5201
|
+
freeItems: "무료 아이템"
|
|
5199
5202
|
};
|
|
5200
5203
|
var checkoutForm_ko = {
|
|
5201
5204
|
messages: messages$v,
|
|
@@ -6126,7 +6129,8 @@ var labels$d = {
|
|
|
6126
6129
|
removeCoupon: "ELIMINAR",
|
|
6127
6130
|
firstName: "Nombre",
|
|
6128
6131
|
lastName: "Apellido",
|
|
6129
|
-
phone: "Teléfono"
|
|
6132
|
+
phone: "Teléfono",
|
|
6133
|
+
freeItems: "Artículos gratis"
|
|
6130
6134
|
};
|
|
6131
6135
|
var checkoutForm_es = {
|
|
6132
6136
|
messages: messages$e,
|
|
@@ -8677,7 +8681,7 @@ const calcAndFormatItemsTotal = (items, currency) => {
|
|
|
8677
8681
|
if (!Array.isArray(items)) return;
|
|
8678
8682
|
let totalWithoutDividingBy100 = 0;
|
|
8679
8683
|
for (const item of items) {
|
|
8680
|
-
totalWithoutDividingBy100 += parseFloat(item.price ? isCurrencyZeroDecimal(currency) ? item.price * item.quantity : (item.price * item.quantity).toFixed(2) : isCurrencyZeroDecimal(currency) ? item.amount : item.amount.toFixed(2));
|
|
8684
|
+
totalWithoutDividingBy100 += parseFloat(item !== null && item !== void 0 && item.price || (item === null || item === void 0 ? void 0 : item.price) === 0 ? isCurrencyZeroDecimal(currency) ? item.price * item.quantity : (item.price * item.quantity).toFixed(2) : isCurrencyZeroDecimal(currency) ? item.amount : item.amount.toFixed(2));
|
|
8681
8685
|
}
|
|
8682
8686
|
return getFormattedPriceByLocal(totalWithoutDividingBy100, currency, getPageOrDefaultLanguage());
|
|
8683
8687
|
};
|
|
@@ -16812,7 +16816,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16812
16816
|
const tapInstanceRef = React__default.useRef(null);
|
|
16813
16817
|
const tapInstanceCard = React__default.useRef(null);
|
|
16814
16818
|
useEffect(() => {
|
|
16815
|
-
if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
|
|
16819
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
16816
16820
|
if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
|
|
16817
16821
|
var _window$Pelcro$site$r2, _window$Pelcro$site$r3;
|
|
16818
16822
|
const payPageId = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.vantiv_gateway_settings.pay_page_id;
|
|
@@ -16848,7 +16852,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16848
16852
|
}, [vantivPaymentRequest]);
|
|
16849
16853
|
useEffect(() => {
|
|
16850
16854
|
whenUserReady(() => {
|
|
16851
|
-
if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
|
|
16855
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
16852
16856
|
if (cardProcessor === "tap" && !window.Tapjsli) {
|
|
16853
16857
|
window.Pelcro.helpers.loadSDK("https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js", "tap-bluebird");
|
|
16854
16858
|
window.Pelcro.helpers.loadSDK("https://secure.gosell.io/js/sdk/tap.min.js", "tap-sdk");
|
|
@@ -16862,7 +16866,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16862
16866
|
});
|
|
16863
16867
|
}, [selectedPaymentMethodId]);
|
|
16864
16868
|
const initPaymentRequest = (state, dispatch) => {
|
|
16865
|
-
if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
|
|
16869
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
16866
16870
|
try {
|
|
16867
16871
|
const paymentRequest = stripe.paymentRequest({
|
|
16868
16872
|
country: window.Pelcro.user.location.countryCode || "US",
|
|
@@ -16931,7 +16935,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16931
16935
|
*/
|
|
16932
16936
|
const updateTotalAmountWithTax = () => {
|
|
16933
16937
|
var _window$Pelcro$site$r4;
|
|
16934
|
-
if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
|
|
16938
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
16935
16939
|
const taxesEnabled = (_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.taxes_enabled;
|
|
16936
16940
|
if (taxesEnabled && type === "createPayment") {
|
|
16937
16941
|
dispatch({
|
|
@@ -17428,16 +17432,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17428
17432
|
items: mappedOrderItems,
|
|
17429
17433
|
addressId: selectedAddressId,
|
|
17430
17434
|
couponCode
|
|
17431
|
-
}, (err,
|
|
17432
|
-
|
|
17433
|
-
type: DISABLE_SUBMIT,
|
|
17434
|
-
payload: false
|
|
17435
|
-
});
|
|
17436
|
-
dispatch({
|
|
17437
|
-
type: LOADING,
|
|
17438
|
-
payload: false
|
|
17439
|
-
});
|
|
17435
|
+
}, (err, orderResponse) => {
|
|
17436
|
+
var _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro2$user$;
|
|
17440
17437
|
if (err) {
|
|
17438
|
+
toggleAuthenticationSuccessPendingView(false);
|
|
17439
|
+
dispatch({
|
|
17440
|
+
type: DISABLE_SUBMIT,
|
|
17441
|
+
payload: false
|
|
17442
|
+
});
|
|
17443
|
+
dispatch({
|
|
17444
|
+
type: LOADING,
|
|
17445
|
+
payload: false
|
|
17446
|
+
});
|
|
17441
17447
|
onFailure(err);
|
|
17442
17448
|
return dispatch({
|
|
17443
17449
|
type: SHOW_ALERT,
|
|
@@ -17457,7 +17463,30 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17457
17463
|
cartItems: []
|
|
17458
17464
|
});
|
|
17459
17465
|
}
|
|
17460
|
-
|
|
17466
|
+
window.Pelcro.user.refresh({
|
|
17467
|
+
auth_token: (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$user = _window$Pelcro2.user) === null || _window$Pelcro2$user === void 0 ? void 0 : (_window$Pelcro2$user$ = _window$Pelcro2$user.read()) === null || _window$Pelcro2$user$ === void 0 ? void 0 : _window$Pelcro2$user$.auth_token
|
|
17468
|
+
}, (err, res) => {
|
|
17469
|
+
dispatch({
|
|
17470
|
+
type: DISABLE_SUBMIT,
|
|
17471
|
+
payload: false
|
|
17472
|
+
});
|
|
17473
|
+
dispatch({
|
|
17474
|
+
type: LOADING,
|
|
17475
|
+
payload: false
|
|
17476
|
+
});
|
|
17477
|
+
toggleAuthenticationSuccessPendingView(false);
|
|
17478
|
+
if (err) {
|
|
17479
|
+
onFailure(err);
|
|
17480
|
+
return dispatch({
|
|
17481
|
+
type: SHOW_ALERT,
|
|
17482
|
+
payload: {
|
|
17483
|
+
type: "error",
|
|
17484
|
+
content: getErrorMessages(err)
|
|
17485
|
+
}
|
|
17486
|
+
});
|
|
17487
|
+
}
|
|
17488
|
+
onSuccess(orderResponse);
|
|
17489
|
+
});
|
|
17461
17490
|
});
|
|
17462
17491
|
};
|
|
17463
17492
|
const payInvoice = (gatewayService, gatewayToken, dispatch) => {
|
|
@@ -17535,6 +17564,29 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17535
17564
|
});
|
|
17536
17565
|
};
|
|
17537
17566
|
const submitPayment = (state, dispatch) => {
|
|
17567
|
+
if (skipPayment && props !== null && props !== void 0 && props.freeOrders) {
|
|
17568
|
+
const isQuickPurchase = !Array.isArray(order);
|
|
17569
|
+
const mappedOrderItems = isQuickPurchase ? [{
|
|
17570
|
+
sku_id: order.id,
|
|
17571
|
+
quantity: order.quantity
|
|
17572
|
+
}] : order.map(item => ({
|
|
17573
|
+
sku_id: item.id,
|
|
17574
|
+
quantity: item.quantity
|
|
17575
|
+
}));
|
|
17576
|
+
window.Pelcro.ecommerce.order.create({
|
|
17577
|
+
items: mappedOrderItems,
|
|
17578
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
17579
|
+
...(selectedAddressId && {
|
|
17580
|
+
address_id: selectedAddressId
|
|
17581
|
+
})
|
|
17582
|
+
}, (err, res) => {
|
|
17583
|
+
if (err) {
|
|
17584
|
+
return handlePaymentError(err);
|
|
17585
|
+
}
|
|
17586
|
+
return onSuccess(res);
|
|
17587
|
+
});
|
|
17588
|
+
return;
|
|
17589
|
+
}
|
|
17538
17590
|
stripe.createSource({
|
|
17539
17591
|
type: "card"
|
|
17540
17592
|
}).then(_ref8 => {
|
|
@@ -17768,6 +17820,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17768
17820
|
disableSubmit: true,
|
|
17769
17821
|
isLoading: true
|
|
17770
17822
|
}, (state, dispatch) => {
|
|
17823
|
+
if (skipPayment && props !== null && props !== void 0 && props.freeOrders) {
|
|
17824
|
+
return submitPayment(state);
|
|
17825
|
+
}
|
|
17771
17826
|
if (getSiteCardProcessor() === "vantiv") {
|
|
17772
17827
|
return submitUsingVantiv(state);
|
|
17773
17828
|
}
|
|
@@ -17896,10 +17951,14 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17896
17951
|
state,
|
|
17897
17952
|
dispatch
|
|
17898
17953
|
}
|
|
17899
|
-
}, children.length ? children.map((child, i) =>
|
|
17900
|
-
|
|
17901
|
-
|
|
17902
|
-
|
|
17954
|
+
}, children.length ? children.map((child, i) => {
|
|
17955
|
+
if (child) {
|
|
17956
|
+
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
17957
|
+
store: store$k,
|
|
17958
|
+
key: i
|
|
17959
|
+
});
|
|
17960
|
+
}
|
|
17961
|
+
}) : /*#__PURE__*/React__default.cloneElement(children, {
|
|
17903
17962
|
store: store$k
|
|
17904
17963
|
})));
|
|
17905
17964
|
};
|
|
@@ -18722,11 +18781,47 @@ const SubscriptionCreateFreePlanButton = _ref => {
|
|
|
18722
18781
|
}, otherProps), t("buttons.subscribe"));
|
|
18723
18782
|
};
|
|
18724
18783
|
|
|
18784
|
+
const OrderCreateFreeButton = _ref => {
|
|
18785
|
+
let {
|
|
18786
|
+
name,
|
|
18787
|
+
onClick,
|
|
18788
|
+
...otherProps
|
|
18789
|
+
} = _ref;
|
|
18790
|
+
const {
|
|
18791
|
+
state: {
|
|
18792
|
+
disableSubmit
|
|
18793
|
+
},
|
|
18794
|
+
dispatch
|
|
18795
|
+
} = useContext(store$k);
|
|
18796
|
+
const {
|
|
18797
|
+
t
|
|
18798
|
+
} = useTranslation("checkoutForm");
|
|
18799
|
+
const [isDisabled, setDisabled] = useState(true);
|
|
18800
|
+
useEffect(() => {
|
|
18801
|
+
setDisabled(disableSubmit);
|
|
18802
|
+
}, [disableSubmit]);
|
|
18803
|
+
return /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
18804
|
+
className: "plc-w-full",
|
|
18805
|
+
onClick: () => {
|
|
18806
|
+
dispatch({
|
|
18807
|
+
type: DISABLE_SUBMIT,
|
|
18808
|
+
payload: true
|
|
18809
|
+
});
|
|
18810
|
+
dispatch({
|
|
18811
|
+
type: SUBMIT_PAYMENT
|
|
18812
|
+
});
|
|
18813
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
18814
|
+
},
|
|
18815
|
+
disabled: isDisabled,
|
|
18816
|
+
isLoading: disableSubmit
|
|
18817
|
+
}, otherProps), t("labels.submit"));
|
|
18818
|
+
};
|
|
18819
|
+
|
|
18725
18820
|
/**
|
|
18726
18821
|
*
|
|
18727
18822
|
*/
|
|
18728
18823
|
function PaymentMethodView(_ref) {
|
|
18729
|
-
var _window$Pelcro$site$r, _window$Pelcro$site$r2
|
|
18824
|
+
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _calcAndFormatItemsTo, _order$;
|
|
18730
18825
|
let {
|
|
18731
18826
|
onSuccess,
|
|
18732
18827
|
onGiftRenewalSuccess,
|
|
@@ -18734,7 +18829,9 @@ function PaymentMethodView(_ref) {
|
|
|
18734
18829
|
type,
|
|
18735
18830
|
showCoupon,
|
|
18736
18831
|
showExternalPaymentMethods,
|
|
18737
|
-
showSubscriptionButton
|
|
18832
|
+
showSubscriptionButton,
|
|
18833
|
+
showOrderButton,
|
|
18834
|
+
order
|
|
18738
18835
|
} = _ref;
|
|
18739
18836
|
const {
|
|
18740
18837
|
t
|
|
@@ -18747,7 +18844,17 @@ function PaymentMethodView(_ref) {
|
|
|
18747
18844
|
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
18748
18845
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
18749
18846
|
className: "plc-flex plc-flex-col plc-items-center plc-mt-4 sm:plc-px-8 pelcro-payment-block"
|
|
18750
|
-
},
|
|
18847
|
+
}, order && /*#__PURE__*/React__default.createElement("div", {
|
|
18848
|
+
className: "plc-w-full plc-p-2 plc-mb-4 plc-font-semibold plc-text-center plc-text-gray-900 plc-bg-gray-100 plc-border plc-border-gray-200"
|
|
18849
|
+
}, /*#__PURE__*/React__default.createElement("p", {
|
|
18850
|
+
className: "plc-text-gray-600"
|
|
18851
|
+
}, !Array.isArray(order) ? /*#__PURE__*/React__default.createElement("span", {
|
|
18852
|
+
className: "plc-tracking-wider plc-uppercase"
|
|
18853
|
+
}, order === null || order === void 0 ? void 0 : order.name) : /*#__PURE__*/React__default.createElement("span", {
|
|
18854
|
+
className: "plc-tracking-wider plc-uppercase"
|
|
18855
|
+
}, t("labels.freeItems")), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", {
|
|
18856
|
+
className: "plc-text-xl plc-font-semibold plc-text-primary-600"
|
|
18857
|
+
}, (_calcAndFormatItemsTo = calcAndFormatItemsTotal(order, (_order$ = order[0]) === null || _order$ === void 0 ? void 0 : _order$.currency)) !== null && _calcAndFormatItemsTo !== void 0 ? _calcAndFormatItemsTo : getFormattedPriceByLocal(order === null || order === void 0 ? void 0 : order.price, order === null || order === void 0 ? void 0 : order.currency, getPageOrDefaultLanguage())))), cardProcessor === "stripe" && !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default.createElement("div", {
|
|
18751
18858
|
className: "plc-flex plc-items-center plc-w-full plc-px-4 plc-py-2 plc-text-center plc-text-green-600 plc-border plc-border-green-400 plc-rounded plc-bg-green-50"
|
|
18752
18859
|
}, /*#__PURE__*/React__default.createElement(SvgLock, {
|
|
18753
18860
|
className: "plc-w-5 plc-h-5 plc-mr-1"
|
|
@@ -18763,10 +18870,11 @@ function PaymentMethodView(_ref) {
|
|
|
18763
18870
|
type: type,
|
|
18764
18871
|
onSuccess: onSuccess,
|
|
18765
18872
|
onGiftRenewalSuccess: onGiftRenewalSuccess,
|
|
18766
|
-
onFailure: onFailure
|
|
18873
|
+
onFailure: onFailure,
|
|
18874
|
+
freeOrders: showOrderButton
|
|
18767
18875
|
}, /*#__PURE__*/React__default.createElement(AlertWithContext, {
|
|
18768
18876
|
className: "plc-mb-2"
|
|
18769
|
-
}), showSubscriptionButton
|
|
18877
|
+
}), showSubscriptionButton && /*#__PURE__*/React__default.createElement(SubscriptionCreateFreePlanButton, null), showOrderButton && /*#__PURE__*/React__default.createElement(OrderCreateFreeButton, null), !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(BankRedirection, null), /*#__PURE__*/React__default.createElement(BankAuthenticationSuccess, null), /*#__PURE__*/React__default.createElement(SelectedPaymentMethod, null), supportsTap && (!isUserFirstName || !isUserLastName || !isUserPhone) && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
18770
18878
|
className: "plc-flex plc-items-start"
|
|
18771
18879
|
}, /*#__PURE__*/React__default.createElement(IncludeFirstName, {
|
|
18772
18880
|
id: "pelcro-input-first-name",
|
|
@@ -20521,6 +20629,16 @@ function SubscriptionManageMembersList(props) {
|
|
|
20521
20629
|
icon: /*#__PURE__*/React__default.createElement(SvgCheckMark, null)
|
|
20522
20630
|
};
|
|
20523
20631
|
}, []);
|
|
20632
|
+
const showMemberData = useCallback(member => {
|
|
20633
|
+
var _member$customer, _member$customer2, _member$customer3, _member$customer4;
|
|
20634
|
+
let data;
|
|
20635
|
+
if ((member === null || member === void 0 ? void 0 : member.status) !== "active") {
|
|
20636
|
+
data = member === null || member === void 0 ? void 0 : member.invitation_email;
|
|
20637
|
+
return data;
|
|
20638
|
+
}
|
|
20639
|
+
data = (member === null || member === void 0 ? void 0 : (_member$customer = member.customer) === null || _member$customer === void 0 ? void 0 : _member$customer.email) || (member === null || member === void 0 ? void 0 : (_member$customer2 = member.customer) === null || _member$customer2 === void 0 ? void 0 : _member$customer2.first_name) + " " + (member === null || member === void 0 ? void 0 : (_member$customer3 = member.customer) === null || _member$customer3 === void 0 ? void 0 : _member$customer3.last_name) || (member === null || member === void 0 ? void 0 : (_member$customer4 = member.customer) === null || _member$customer4 === void 0 ? void 0 : _member$customer4.username) || "-----";
|
|
20640
|
+
return data;
|
|
20641
|
+
}, []);
|
|
20524
20642
|
if (loading) {
|
|
20525
20643
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", null, /*#__PURE__*/React__default.createElement("div", {
|
|
20526
20644
|
className: "plc-animate-pulse"
|
|
@@ -20562,10 +20680,10 @@ function SubscriptionManageMembersList(props) {
|
|
|
20562
20680
|
className: `plc-w-full plc-align-middle plc-cursor-pointer accordion-header hover:plc-bg-gray-50 plc-text-center`
|
|
20563
20681
|
}, /*#__PURE__*/React__default.createElement("td", {
|
|
20564
20682
|
className: "plc-truncate plc-text-left",
|
|
20565
|
-
title: member
|
|
20683
|
+
title: showMemberData(member)
|
|
20566
20684
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
20567
20685
|
className: "plc-font-semibold plc-text-gray-500"
|
|
20568
|
-
}, member
|
|
20686
|
+
}, showMemberData(member))), /*#__PURE__*/React__default.createElement("td", {
|
|
20569
20687
|
className: "plc-py-2"
|
|
20570
20688
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
20571
20689
|
className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${getMemberStatus(member).bgColor} plc-uppercase ${getMemberStatus(member).textColor} plc-rounded-lg`
|
|
@@ -24173,9 +24291,15 @@ const OrderCreateContainer = props => /*#__PURE__*/React__default.createElement(
|
|
|
24173
24291
|
}, props));
|
|
24174
24292
|
|
|
24175
24293
|
const OrderCreateView = props => {
|
|
24294
|
+
var _window$Pelcro, _window$Pelcro$uiSett;
|
|
24176
24295
|
const {
|
|
24177
24296
|
t
|
|
24178
24297
|
} = useTranslation("payment");
|
|
24298
|
+
const {
|
|
24299
|
+
order
|
|
24300
|
+
} = usePelcro();
|
|
24301
|
+
const skipPayment = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.skipPaymentForFreePlans;
|
|
24302
|
+
const showOrderButton = skipPayment && ((order === null || order === void 0 ? void 0 : order.price) === 0 || (order === null || order === void 0 ? void 0 : order.length) > 0 && order.every(item => (item === null || item === void 0 ? void 0 : item.price) === 0));
|
|
24179
24303
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
24180
24304
|
id: "pelcro-order-create-view"
|
|
24181
24305
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -24186,7 +24310,9 @@ const OrderCreateView = props => {
|
|
|
24186
24310
|
}, /*#__PURE__*/React__default.createElement(PaymentMethodView, Object.assign({
|
|
24187
24311
|
type: "orderCreate",
|
|
24188
24312
|
showCoupon: true,
|
|
24189
|
-
showExternalPaymentMethods: false
|
|
24313
|
+
showExternalPaymentMethods: false,
|
|
24314
|
+
showOrderButton: showOrderButton,
|
|
24315
|
+
order: order
|
|
24190
24316
|
}, props))));
|
|
24191
24317
|
};
|
|
24192
24318
|
|
|
@@ -25394,11 +25520,12 @@ const PaymentMethodSelectModal = _ref => {
|
|
|
25394
25520
|
const {
|
|
25395
25521
|
switchToCheckoutForm,
|
|
25396
25522
|
set,
|
|
25397
|
-
plan
|
|
25523
|
+
plan,
|
|
25524
|
+
order
|
|
25398
25525
|
} = usePelcro();
|
|
25399
25526
|
const skipPayment = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.skipPaymentForFreePlans;
|
|
25400
25527
|
useEffect(() => {
|
|
25401
|
-
if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) {
|
|
25528
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || (order === null || order === void 0 ? void 0 : order.price) === 0)) {
|
|
25402
25529
|
switchToCheckoutForm();
|
|
25403
25530
|
}
|
|
25404
25531
|
}, []);
|
|
@@ -27506,7 +27633,7 @@ const InvoicesItems = () => {
|
|
|
27506
27633
|
setInvoice,
|
|
27507
27634
|
switchView
|
|
27508
27635
|
} = usePelcro();
|
|
27509
|
-
const invoices = (_window$Pelcro$invoic = (_window$Pelcro$invoic2 = window.Pelcro.invoice.list()) === null || _window$Pelcro$invoic2 === void 0 ? void 0 : _window$Pelcro$invoic2.filter(invoice => invoice.total > 0)) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
27636
|
+
const invoices = (_window$Pelcro$invoic = (_window$Pelcro$invoic2 = window.Pelcro.invoice.list()) === null || _window$Pelcro$invoic2 === void 0 ? void 0 : _window$Pelcro$invoic2.filter(invoice => invoice.order_id || invoice.total > 0)) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
27510
27637
|
const showInvoiceDetails = event => {
|
|
27511
27638
|
if (setInvoice(event.target.dataset.id)) {
|
|
27512
27639
|
switchView("invoice-details");
|
|
@@ -28274,7 +28401,7 @@ class Dashboard extends Component {
|
|
|
28274
28401
|
}
|
|
28275
28402
|
function hasInvoices() {
|
|
28276
28403
|
var _window$Pelcro$invoic, _window$Pelcro$invoic2;
|
|
28277
|
-
const invoices = (_window$Pelcro$invoic = (_window$Pelcro$invoic2 = window.Pelcro.invoice.list()) === null || _window$Pelcro$invoic2 === void 0 ? void 0 : _window$Pelcro$invoic2.filter(invoice => invoice.total > 0)) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
28404
|
+
const invoices = (_window$Pelcro$invoic = (_window$Pelcro$invoic2 = window.Pelcro.invoice.list()) === null || _window$Pelcro$invoic2 === void 0 ? void 0 : _window$Pelcro$invoic2.filter(invoice => invoice.order_id || invoice.total > 0)) !== null && _window$Pelcro$invoic !== void 0 ? _window$Pelcro$invoic : [];
|
|
28278
28405
|
return invoices.length > 0;
|
|
28279
28406
|
}
|
|
28280
28407
|
function hasDonationSubs() {
|
|
@@ -32103,4 +32230,4 @@ const QrCodeModal = _ref => {
|
|
|
32103
32230
|
};
|
|
32104
32231
|
QrCodeModal.viewId = "qrcode";
|
|
32105
32232
|
|
|
32106
|
-
export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateSetDefault, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateSetDefault, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplyCouponButton, Auth0LoginButton, Badge, BankAuthenticationSuccess, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, IncludeFirstName, IncludeLastName, IncludePhone, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginRequestLoginToken, LoginUsername, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PasswordlessRequestContainer, PasswordlessRequestEmail, PasswordlessRequestModal, PasswordlessRequestView, PasswordlessRequestViewButton, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, QrCodeModal, QrCodeView, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCancelModal, SubscriptionCreateContainer, SubscriptionCreateFreePlanButton, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionManageMembersButton, SubscriptionManageMembersContainer, SubscriptionManageMembersEmails, SubscriptionManageMembersList, SubscriptionManageMembersModal, SubscriptionManageMembersView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, SubscriptionSuspendContainer, SubscriptionSuspendModal, SubscriptionSuspendView, TaxAmount, TextArea, Tooltip, UserNameInput, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateTin, UserUpdateUsername, UserUpdateView, VerifyLinkTokenContainer, VerifyLinkTokenLoader, VerifyLinkTokenModal, VerifyLinkTokenView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, invoicePaymentSubmitButton, notify$1 as notify, unauthenticatedButtons, usePelcro };
|
|
32233
|
+
export { AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateSetDefault, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateSetDefault, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplyCouponButton, Auth0LoginButton, Badge, BankAuthenticationSuccess, BankRedirection, Button, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, DashboardWithHook as Dashboard, DashboardOpenButton, DatePicker, DiscountedPrice, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, IncludeFirstName, IncludeLastName, IncludePhone, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginRequestLoginToken, LoginUsername, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateFreeButton, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PasswordlessRequestContainer, PasswordlessRequestEmail, PasswordlessRequestModal, PasswordlessRequestView, PasswordlessRequestViewButton, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroCardCVC, PelcroCardExpiry, PelcroCardNumber, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, QrCodeModal, QrCodeView, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCancelModal, SubscriptionCreateContainer, SubscriptionCreateFreePlanButton, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionManageMembersButton, SubscriptionManageMembersContainer, SubscriptionManageMembersEmails, SubscriptionManageMembersList, SubscriptionManageMembersModal, SubscriptionManageMembersView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, SubscriptionSuspendContainer, SubscriptionSuspendModal, SubscriptionSuspendView, TaxAmount, TextArea, Tooltip, UserNameInput, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateTin, UserUpdateUsername, UserUpdateView, VerifyLinkTokenContainer, VerifyLinkTokenLoader, VerifyLinkTokenModal, VerifyLinkTokenView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, invoicePaymentSubmitButton, notify$1 as notify, unauthenticatedButtons, usePelcro };
|