@pelcro/react-pelcro-js 3.22.0-beta.1 → 3.22.0-beta.10
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 +80 -48
- package/dist/index.esm.js +80 -48
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -8707,7 +8707,7 @@ const calcAndFormatItemsTotal = (items, currency) => {
|
|
|
8707
8707
|
if (!Array.isArray(items)) return;
|
|
8708
8708
|
let totalWithoutDividingBy100 = 0;
|
|
8709
8709
|
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));
|
|
8710
|
+
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
8711
|
}
|
|
8712
8712
|
return getFormattedPriceByLocal(totalWithoutDividingBy100, currency, getPageOrDefaultLanguage());
|
|
8713
8713
|
};
|
|
@@ -14042,12 +14042,9 @@ class SelectModal extends React.Component {
|
|
|
14042
14042
|
const userCurrency = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$user = _window$Pelcro.user) === null || _window$Pelcro$user === void 0 ? void 0 : _window$Pelcro$user.read().currency;
|
|
14043
14043
|
const userCountry = (_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.location.countryCode;
|
|
14044
14044
|
const userLanguage = (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$user = _window$Pelcro3.user) === null || _window$Pelcro3$user === void 0 ? void 0 : _window$Pelcro3$user.read().language;
|
|
14045
|
-
const productsMatchingUserCurrency = (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : (_window$Pelcro4$site = _window$Pelcro4.site) === null || _window$Pelcro4$site === void 0 ? void 0 : _window$Pelcro4$site.read().products.
|
|
14045
|
+
const productsMatchingUserCurrency = (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : (_window$Pelcro4$site = _window$Pelcro4.site) === null || _window$Pelcro4$site === void 0 ? void 0 : _window$Pelcro4$site.read().products.filter(product => {
|
|
14046
14046
|
const filteredPlans = product.plans.filter(plan => plan.currency === userCurrency || !userCurrency);
|
|
14047
|
-
return
|
|
14048
|
-
...product,
|
|
14049
|
-
plans: filteredPlans
|
|
14050
|
-
};
|
|
14047
|
+
if (filteredPlans.length) return filteredPlans;
|
|
14051
14048
|
});
|
|
14052
14049
|
const productsMatchingUserCountry = productsMatchingUserCurrency.filter(product => {
|
|
14053
14050
|
const filteredPlans = product.plans.filter(plan => {
|
|
@@ -14058,7 +14055,7 @@ class SelectModal extends React.Component {
|
|
|
14058
14055
|
});
|
|
14059
14056
|
notifyBugsnag(() => {
|
|
14060
14057
|
Bugsnag.notify("SelectModal - No data viewed", event => {
|
|
14061
|
-
var _window$Pelcro5, _window$Pelcro5$site, _window$Pelcro6, _window$Pelcro6$user, _window$Pelcro7, _window$Pelcro7$uiSet, _window$Pelcro8, _this$props, _window$Pelcro9, _window$Pelcro9$helpe;
|
|
14058
|
+
var _window$Pelcro5, _window$Pelcro5$site, _window$Pelcro6, _window$Pelcro6$user, _window$Pelcro7, _window$Pelcro7$uiSet, _window$Pelcro8, _this$props, _window$Pelcro9, _window$Pelcro9$helpe, _window$Pelcro10, _window$Pelcro10$site;
|
|
14062
14059
|
event.addMetadata("MetaData", {
|
|
14063
14060
|
site: (_window$Pelcro5 = window.Pelcro) === null || _window$Pelcro5 === void 0 ? void 0 : (_window$Pelcro5$site = _window$Pelcro5.site) === null || _window$Pelcro5$site === void 0 ? void 0 : _window$Pelcro5$site.read(),
|
|
14064
14061
|
user: (_window$Pelcro6 = window.Pelcro) === null || _window$Pelcro6 === void 0 ? void 0 : (_window$Pelcro6$user = _window$Pelcro6.user) === null || _window$Pelcro6$user === void 0 ? void 0 : _window$Pelcro6$user.read(),
|
|
@@ -14075,13 +14072,13 @@ class SelectModal extends React.Component {
|
|
|
14075
14072
|
userCountry: userCountry,
|
|
14076
14073
|
userLanguage: userLanguage,
|
|
14077
14074
|
siteLanguage: (_window$Pelcro9 = window.Pelcro) === null || _window$Pelcro9 === void 0 ? void 0 : (_window$Pelcro9$helpe = _window$Pelcro9.helpers) === null || _window$Pelcro9$helpe === void 0 ? void 0 : _window$Pelcro9$helpe.getHtmlLanguageAttribute(),
|
|
14078
|
-
|
|
14079
|
-
|
|
14080
|
-
|
|
14075
|
+
products: (_window$Pelcro10 = window.Pelcro) === null || _window$Pelcro10 === void 0 ? void 0 : (_window$Pelcro10$site = _window$Pelcro10.site) === null || _window$Pelcro10$site === void 0 ? void 0 : _window$Pelcro10$site.read().products.length,
|
|
14076
|
+
currency_matching_filter: `${productsMatchingUserCurrency.length} Products Passed`,
|
|
14077
|
+
country_matching_filter: `${productsMatchingUserCountry.length} Products Passed`,
|
|
14078
|
+
language_matching_filter: `${productsMatchingUserCountry.filter(productMatchPageLanguage).length} Products Passed`
|
|
14081
14079
|
});
|
|
14082
14080
|
});
|
|
14083
14081
|
});
|
|
14084
|
-
console.log("bugsnag Triggered");
|
|
14085
14082
|
}
|
|
14086
14083
|
});
|
|
14087
14084
|
_defineProperty$3(this, "componentWillUnmount", () => {
|
|
@@ -16357,6 +16354,8 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16357
16354
|
onFailure = () => {},
|
|
16358
16355
|
...props
|
|
16359
16356
|
} = _ref;
|
|
16357
|
+
const [vantivPaymentRequest, setVantivPaymentRequest] = React.useState(null);
|
|
16358
|
+
const [updatedCouponCode, setUpdatedCouponCode] = React.useState("");
|
|
16360
16359
|
const {
|
|
16361
16360
|
t
|
|
16362
16361
|
} = useTranslation("payment");
|
|
@@ -16399,7 +16398,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16399
16398
|
}, []);
|
|
16400
16399
|
|
|
16401
16400
|
/*====== Start Tap integration ========*/
|
|
16402
|
-
const submitUsingTap =
|
|
16401
|
+
const submitUsingTap = state => {
|
|
16403
16402
|
var _ref2, _ref3, _ref4, _state$updatedPrice;
|
|
16404
16403
|
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
16405
16404
|
if (isUsingExistingPaymentMethod) {
|
|
@@ -16494,7 +16493,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16494
16493
|
content: null
|
|
16495
16494
|
}
|
|
16496
16495
|
});
|
|
16497
|
-
handleTapPayment(tapID);
|
|
16496
|
+
handleTapPayment(tapID, state);
|
|
16498
16497
|
}
|
|
16499
16498
|
};
|
|
16500
16499
|
|
|
@@ -16507,7 +16506,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16507
16506
|
}
|
|
16508
16507
|
});
|
|
16509
16508
|
};
|
|
16510
|
-
function handleTapPayment(paymentRequest) {
|
|
16509
|
+
function handleTapPayment(paymentRequest, state) {
|
|
16511
16510
|
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
16512
16511
|
if (type === "createPayment") {
|
|
16513
16512
|
handleTapSubscription();
|
|
@@ -16685,7 +16684,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16685
16684
|
};
|
|
16686
16685
|
/*====== End Tap integration ========*/
|
|
16687
16686
|
|
|
16688
|
-
const submitUsingVantiv =
|
|
16687
|
+
const submitUsingVantiv = state => {
|
|
16689
16688
|
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
16690
16689
|
if (isUsingExistingPaymentMethod) {
|
|
16691
16690
|
// no need to create a new source using vantiv
|
|
@@ -16703,7 +16702,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16703
16702
|
orderId: orderId
|
|
16704
16703
|
});
|
|
16705
16704
|
};
|
|
16706
|
-
function handleVantivPayment(paymentRequest) {
|
|
16705
|
+
function handleVantivPayment(paymentRequest, couponCode) {
|
|
16707
16706
|
if (paymentRequest) {
|
|
16708
16707
|
const SUCCESS_STATUS = "870";
|
|
16709
16708
|
if (paymentRequest.response !== SUCCESS_STATUS) {
|
|
@@ -16769,7 +16768,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16769
16768
|
const renewSubscription = !isGift && subscriptionIdToRenew;
|
|
16770
16769
|
const giftSubscriprition = isGift && !subscriptionIdToRenew;
|
|
16771
16770
|
const renewGift = isRenewingGift;
|
|
16772
|
-
const couponCode = state.couponCode || window.Pelcro.coupon.getFromUrl() || "";
|
|
16773
16771
|
if (renewGift) {
|
|
16774
16772
|
return payment.execute({
|
|
16775
16773
|
type: PAYMENT_TYPES.RENEW_GIFTED_SUBSCRIPTION,
|
|
@@ -16855,7 +16853,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16855
16853
|
height: "245",
|
|
16856
16854
|
timeout: 50000,
|
|
16857
16855
|
div: "eProtectiframe",
|
|
16858
|
-
callback:
|
|
16856
|
+
callback: paymentRequest => setVantivPaymentRequest(paymentRequest),
|
|
16859
16857
|
showCvv: true,
|
|
16860
16858
|
numYears: 8,
|
|
16861
16859
|
placeholderText: {
|
|
@@ -16870,6 +16868,13 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16870
16868
|
});
|
|
16871
16869
|
}
|
|
16872
16870
|
}, [selectedPaymentMethodId]);
|
|
16871
|
+
|
|
16872
|
+
//Trigger the handleVantivPayment method when a vantivePaymentRequest is present
|
|
16873
|
+
React.useEffect(() => {
|
|
16874
|
+
if (vantivPaymentRequest) {
|
|
16875
|
+
handleVantivPayment(vantivPaymentRequest, updatedCouponCode);
|
|
16876
|
+
}
|
|
16877
|
+
}, [vantivPaymentRequest]);
|
|
16873
16878
|
React.useEffect(() => {
|
|
16874
16879
|
whenUserReady(() => {
|
|
16875
16880
|
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || (order === null || order === void 0 ? void 0 : order.price) === 0)) return;
|
|
@@ -16998,6 +17003,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16998
17003
|
});
|
|
16999
17004
|
if (err) {
|
|
17000
17005
|
onFailure(err);
|
|
17006
|
+
|
|
17007
|
+
//reset the coupon code in local state
|
|
17008
|
+
setUpdatedCouponCode("");
|
|
17001
17009
|
dispatch({
|
|
17002
17010
|
type: SET_COUPON_ERROR,
|
|
17003
17011
|
payload: getErrorMessages(err)
|
|
@@ -17056,6 +17064,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17056
17064
|
type: SET_COUPON,
|
|
17057
17065
|
payload: res.data.coupon
|
|
17058
17066
|
});
|
|
17067
|
+
|
|
17068
|
+
//set the coupon code in local state to be able to use with Vantiv
|
|
17069
|
+
setUpdatedCouponCode(res.data.coupon.code);
|
|
17059
17070
|
dispatch({
|
|
17060
17071
|
type: SET_PERCENT_OFF,
|
|
17061
17072
|
payload: `${(_res$data$coupon = res.data.coupon) === null || _res$data$coupon === void 0 ? void 0 : _res$data$coupon.percent_off}%`
|
|
@@ -17126,6 +17137,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17126
17137
|
const debouncedApplyCouponCode = React.useRef(debounce(onApplyCouponCode, 1000)).current;
|
|
17127
17138
|
const removeAppliedCoupon = state => {
|
|
17128
17139
|
state.couponCode = "";
|
|
17140
|
+
|
|
17141
|
+
//reset the coupon code in local state
|
|
17142
|
+
setUpdatedCouponCode("");
|
|
17129
17143
|
dispatch({
|
|
17130
17144
|
type: SET_COUPON_ERROR,
|
|
17131
17145
|
payload: ""
|
|
@@ -17806,11 +17820,14 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17806
17820
|
disableSubmit: true,
|
|
17807
17821
|
isLoading: true
|
|
17808
17822
|
}, (state, dispatch) => {
|
|
17823
|
+
if (skipPayment && (order === null || order === void 0 ? void 0 : order.price) === 0) {
|
|
17824
|
+
return submitPayment(state);
|
|
17825
|
+
}
|
|
17809
17826
|
if (getSiteCardProcessor() === "vantiv") {
|
|
17810
17827
|
return submitUsingVantiv();
|
|
17811
17828
|
}
|
|
17812
17829
|
if (getSiteCardProcessor() === "tap") {
|
|
17813
|
-
return submitUsingTap();
|
|
17830
|
+
return submitUsingTap(state);
|
|
17814
17831
|
}
|
|
17815
17832
|
if (selectedPaymentMethodId) {
|
|
17816
17833
|
// pay with selected method (source) if exists already
|
|
@@ -18812,7 +18829,8 @@ function PaymentMethodView(_ref) {
|
|
|
18812
18829
|
showCoupon,
|
|
18813
18830
|
showExternalPaymentMethods,
|
|
18814
18831
|
showSubscriptionButton,
|
|
18815
|
-
showOrderButton
|
|
18832
|
+
showOrderButton,
|
|
18833
|
+
order
|
|
18816
18834
|
} = _ref;
|
|
18817
18835
|
const {
|
|
18818
18836
|
t
|
|
@@ -18825,7 +18843,15 @@ function PaymentMethodView(_ref) {
|
|
|
18825
18843
|
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
18826
18844
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18827
18845
|
className: "plc-flex plc-flex-col plc-items-center plc-mt-4 sm:plc-px-8 pelcro-payment-block"
|
|
18828
|
-
},
|
|
18846
|
+
}, order && !Array.isArray(order) && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18847
|
+
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"
|
|
18848
|
+
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
18849
|
+
className: "plc-text-gray-600"
|
|
18850
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
18851
|
+
className: "plc-tracking-wider plc-uppercase"
|
|
18852
|
+
}, order === null || order === void 0 ? void 0 : order.name), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
18853
|
+
className: "plc-text-xl plc-font-semibold plc-text-primary-600"
|
|
18854
|
+
}, 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", {
|
|
18829
18855
|
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"
|
|
18830
18856
|
}, /*#__PURE__*/React__default['default'].createElement(SvgLock, {
|
|
18831
18857
|
className: "plc-w-5 plc-h-5 plc-mr-1"
|
|
@@ -20599,6 +20625,16 @@ function SubscriptionManageMembersList(props) {
|
|
|
20599
20625
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgCheckMark, null)
|
|
20600
20626
|
};
|
|
20601
20627
|
}, []);
|
|
20628
|
+
const showMemberData = React.useCallback(member => {
|
|
20629
|
+
var _member$customer, _member$customer2, _member$customer3, _member$customer4;
|
|
20630
|
+
let data;
|
|
20631
|
+
if ((member === null || member === void 0 ? void 0 : member.status) !== "active") {
|
|
20632
|
+
data = member === null || member === void 0 ? void 0 : member.invitation_email;
|
|
20633
|
+
return data;
|
|
20634
|
+
}
|
|
20635
|
+
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) || "-----";
|
|
20636
|
+
return data;
|
|
20637
|
+
}, []);
|
|
20602
20638
|
if (loading) {
|
|
20603
20639
|
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", {
|
|
20604
20640
|
className: "plc-animate-pulse"
|
|
@@ -20635,32 +20671,27 @@ function SubscriptionManageMembersList(props) {
|
|
|
20635
20671
|
type: HANDLE_REMOVE_MEMBER
|
|
20636
20672
|
});
|
|
20637
20673
|
};
|
|
20638
|
-
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, members === null || members === void 0 ? void 0 : members.map(member => {
|
|
20639
|
-
|
|
20640
|
-
|
|
20641
|
-
|
|
20642
|
-
|
|
20643
|
-
|
|
20644
|
-
|
|
20645
|
-
|
|
20646
|
-
|
|
20647
|
-
|
|
20648
|
-
|
|
20649
|
-
|
|
20650
|
-
|
|
20651
|
-
|
|
20652
|
-
|
|
20653
|
-
|
|
20654
|
-
|
|
20655
|
-
|
|
20656
|
-
|
|
20657
|
-
|
|
20658
|
-
|
|
20659
|
-
disabled: member.id === removeMemberId,
|
|
20660
|
-
isLoading: member.id === removeMemberId,
|
|
20661
|
-
"data-key": member.id
|
|
20662
|
-
}, t("labels.remove"))));
|
|
20663
|
-
}));
|
|
20674
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, members === null || members === void 0 ? void 0 : members.map(member => /*#__PURE__*/React__default['default'].createElement("tr", {
|
|
20675
|
+
key: member.id,
|
|
20676
|
+
className: `plc-w-full plc-align-middle plc-cursor-pointer accordion-header hover:plc-bg-gray-50 plc-text-center`
|
|
20677
|
+
}, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
20678
|
+
className: "plc-truncate plc-text-left",
|
|
20679
|
+
title: showMemberData(member)
|
|
20680
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20681
|
+
className: "plc-font-semibold plc-text-gray-500"
|
|
20682
|
+
}, showMemberData(member))), /*#__PURE__*/React__default['default'].createElement("td", {
|
|
20683
|
+
className: "plc-py-2"
|
|
20684
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20685
|
+
className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${getMemberStatus(member).bgColor} plc-uppercase ${getMemberStatus(member).textColor} plc-rounded-lg`
|
|
20686
|
+
}, getMemberStatus(member).icon, getMemberStatus(member).title)), /*#__PURE__*/React__default['default'].createElement("td", null, /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
20687
|
+
variant: "ghost",
|
|
20688
|
+
className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-cancel-button",
|
|
20689
|
+
icon: /*#__PURE__*/React__default['default'].createElement(SvgXIconSolid, null),
|
|
20690
|
+
onClick: () => onRemoveClick(member.id),
|
|
20691
|
+
disabled: member.id === removeMemberId,
|
|
20692
|
+
isLoading: member.id === removeMemberId,
|
|
20693
|
+
"data-key": member.id
|
|
20694
|
+
}, t("labels.remove"))))));
|
|
20664
20695
|
}
|
|
20665
20696
|
|
|
20666
20697
|
/**
|
|
@@ -24274,7 +24305,8 @@ const OrderCreateView = props => {
|
|
|
24274
24305
|
type: "orderCreate",
|
|
24275
24306
|
showCoupon: true,
|
|
24276
24307
|
showExternalPaymentMethods: false,
|
|
24277
|
-
showOrderButton: showOrderButton
|
|
24308
|
+
showOrderButton: showOrderButton,
|
|
24309
|
+
order: order
|
|
24278
24310
|
}, props))));
|
|
24279
24311
|
};
|
|
24280
24312
|
|
package/dist/index.esm.js
CHANGED
|
@@ -8677,7 +8677,7 @@ const calcAndFormatItemsTotal = (items, currency) => {
|
|
|
8677
8677
|
if (!Array.isArray(items)) return;
|
|
8678
8678
|
let totalWithoutDividingBy100 = 0;
|
|
8679
8679
|
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));
|
|
8680
|
+
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
8681
|
}
|
|
8682
8682
|
return getFormattedPriceByLocal(totalWithoutDividingBy100, currency, getPageOrDefaultLanguage());
|
|
8683
8683
|
};
|
|
@@ -14012,12 +14012,9 @@ class SelectModal extends Component {
|
|
|
14012
14012
|
const userCurrency = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$user = _window$Pelcro.user) === null || _window$Pelcro$user === void 0 ? void 0 : _window$Pelcro$user.read().currency;
|
|
14013
14013
|
const userCountry = (_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.location.countryCode;
|
|
14014
14014
|
const userLanguage = (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$user = _window$Pelcro3.user) === null || _window$Pelcro3$user === void 0 ? void 0 : _window$Pelcro3$user.read().language;
|
|
14015
|
-
const productsMatchingUserCurrency = (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : (_window$Pelcro4$site = _window$Pelcro4.site) === null || _window$Pelcro4$site === void 0 ? void 0 : _window$Pelcro4$site.read().products.
|
|
14015
|
+
const productsMatchingUserCurrency = (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : (_window$Pelcro4$site = _window$Pelcro4.site) === null || _window$Pelcro4$site === void 0 ? void 0 : _window$Pelcro4$site.read().products.filter(product => {
|
|
14016
14016
|
const filteredPlans = product.plans.filter(plan => plan.currency === userCurrency || !userCurrency);
|
|
14017
|
-
return
|
|
14018
|
-
...product,
|
|
14019
|
-
plans: filteredPlans
|
|
14020
|
-
};
|
|
14017
|
+
if (filteredPlans.length) return filteredPlans;
|
|
14021
14018
|
});
|
|
14022
14019
|
const productsMatchingUserCountry = productsMatchingUserCurrency.filter(product => {
|
|
14023
14020
|
const filteredPlans = product.plans.filter(plan => {
|
|
@@ -14028,7 +14025,7 @@ class SelectModal extends Component {
|
|
|
14028
14025
|
});
|
|
14029
14026
|
notifyBugsnag(() => {
|
|
14030
14027
|
Bugsnag.notify("SelectModal - No data viewed", event => {
|
|
14031
|
-
var _window$Pelcro5, _window$Pelcro5$site, _window$Pelcro6, _window$Pelcro6$user, _window$Pelcro7, _window$Pelcro7$uiSet, _window$Pelcro8, _this$props, _window$Pelcro9, _window$Pelcro9$helpe;
|
|
14028
|
+
var _window$Pelcro5, _window$Pelcro5$site, _window$Pelcro6, _window$Pelcro6$user, _window$Pelcro7, _window$Pelcro7$uiSet, _window$Pelcro8, _this$props, _window$Pelcro9, _window$Pelcro9$helpe, _window$Pelcro10, _window$Pelcro10$site;
|
|
14032
14029
|
event.addMetadata("MetaData", {
|
|
14033
14030
|
site: (_window$Pelcro5 = window.Pelcro) === null || _window$Pelcro5 === void 0 ? void 0 : (_window$Pelcro5$site = _window$Pelcro5.site) === null || _window$Pelcro5$site === void 0 ? void 0 : _window$Pelcro5$site.read(),
|
|
14034
14031
|
user: (_window$Pelcro6 = window.Pelcro) === null || _window$Pelcro6 === void 0 ? void 0 : (_window$Pelcro6$user = _window$Pelcro6.user) === null || _window$Pelcro6$user === void 0 ? void 0 : _window$Pelcro6$user.read(),
|
|
@@ -14045,13 +14042,13 @@ class SelectModal extends Component {
|
|
|
14045
14042
|
userCountry: userCountry,
|
|
14046
14043
|
userLanguage: userLanguage,
|
|
14047
14044
|
siteLanguage: (_window$Pelcro9 = window.Pelcro) === null || _window$Pelcro9 === void 0 ? void 0 : (_window$Pelcro9$helpe = _window$Pelcro9.helpers) === null || _window$Pelcro9$helpe === void 0 ? void 0 : _window$Pelcro9$helpe.getHtmlLanguageAttribute(),
|
|
14048
|
-
|
|
14049
|
-
|
|
14050
|
-
|
|
14045
|
+
products: (_window$Pelcro10 = window.Pelcro) === null || _window$Pelcro10 === void 0 ? void 0 : (_window$Pelcro10$site = _window$Pelcro10.site) === null || _window$Pelcro10$site === void 0 ? void 0 : _window$Pelcro10$site.read().products.length,
|
|
14046
|
+
currency_matching_filter: `${productsMatchingUserCurrency.length} Products Passed`,
|
|
14047
|
+
country_matching_filter: `${productsMatchingUserCountry.length} Products Passed`,
|
|
14048
|
+
language_matching_filter: `${productsMatchingUserCountry.filter(productMatchPageLanguage).length} Products Passed`
|
|
14051
14049
|
});
|
|
14052
14050
|
});
|
|
14053
14051
|
});
|
|
14054
|
-
console.log("bugsnag Triggered");
|
|
14055
14052
|
}
|
|
14056
14053
|
});
|
|
14057
14054
|
_defineProperty$3(this, "componentWillUnmount", () => {
|
|
@@ -16327,6 +16324,8 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16327
16324
|
onFailure = () => {},
|
|
16328
16325
|
...props
|
|
16329
16326
|
} = _ref;
|
|
16327
|
+
const [vantivPaymentRequest, setVantivPaymentRequest] = useState(null);
|
|
16328
|
+
const [updatedCouponCode, setUpdatedCouponCode] = useState("");
|
|
16330
16329
|
const {
|
|
16331
16330
|
t
|
|
16332
16331
|
} = useTranslation("payment");
|
|
@@ -16369,7 +16368,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16369
16368
|
}, []);
|
|
16370
16369
|
|
|
16371
16370
|
/*====== Start Tap integration ========*/
|
|
16372
|
-
const submitUsingTap =
|
|
16371
|
+
const submitUsingTap = state => {
|
|
16373
16372
|
var _ref2, _ref3, _ref4, _state$updatedPrice;
|
|
16374
16373
|
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
16375
16374
|
if (isUsingExistingPaymentMethod) {
|
|
@@ -16464,7 +16463,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16464
16463
|
content: null
|
|
16465
16464
|
}
|
|
16466
16465
|
});
|
|
16467
|
-
handleTapPayment(tapID);
|
|
16466
|
+
handleTapPayment(tapID, state);
|
|
16468
16467
|
}
|
|
16469
16468
|
};
|
|
16470
16469
|
|
|
@@ -16477,7 +16476,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16477
16476
|
}
|
|
16478
16477
|
});
|
|
16479
16478
|
};
|
|
16480
|
-
function handleTapPayment(paymentRequest) {
|
|
16479
|
+
function handleTapPayment(paymentRequest, state) {
|
|
16481
16480
|
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
16482
16481
|
if (type === "createPayment") {
|
|
16483
16482
|
handleTapSubscription();
|
|
@@ -16655,7 +16654,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16655
16654
|
};
|
|
16656
16655
|
/*====== End Tap integration ========*/
|
|
16657
16656
|
|
|
16658
|
-
const submitUsingVantiv =
|
|
16657
|
+
const submitUsingVantiv = state => {
|
|
16659
16658
|
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
16660
16659
|
if (isUsingExistingPaymentMethod) {
|
|
16661
16660
|
// no need to create a new source using vantiv
|
|
@@ -16673,7 +16672,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16673
16672
|
orderId: orderId
|
|
16674
16673
|
});
|
|
16675
16674
|
};
|
|
16676
|
-
function handleVantivPayment(paymentRequest) {
|
|
16675
|
+
function handleVantivPayment(paymentRequest, couponCode) {
|
|
16677
16676
|
if (paymentRequest) {
|
|
16678
16677
|
const SUCCESS_STATUS = "870";
|
|
16679
16678
|
if (paymentRequest.response !== SUCCESS_STATUS) {
|
|
@@ -16739,7 +16738,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16739
16738
|
const renewSubscription = !isGift && subscriptionIdToRenew;
|
|
16740
16739
|
const giftSubscriprition = isGift && !subscriptionIdToRenew;
|
|
16741
16740
|
const renewGift = isRenewingGift;
|
|
16742
|
-
const couponCode = state.couponCode || window.Pelcro.coupon.getFromUrl() || "";
|
|
16743
16741
|
if (renewGift) {
|
|
16744
16742
|
return payment.execute({
|
|
16745
16743
|
type: PAYMENT_TYPES.RENEW_GIFTED_SUBSCRIPTION,
|
|
@@ -16825,7 +16823,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16825
16823
|
height: "245",
|
|
16826
16824
|
timeout: 50000,
|
|
16827
16825
|
div: "eProtectiframe",
|
|
16828
|
-
callback:
|
|
16826
|
+
callback: paymentRequest => setVantivPaymentRequest(paymentRequest),
|
|
16829
16827
|
showCvv: true,
|
|
16830
16828
|
numYears: 8,
|
|
16831
16829
|
placeholderText: {
|
|
@@ -16840,6 +16838,13 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16840
16838
|
});
|
|
16841
16839
|
}
|
|
16842
16840
|
}, [selectedPaymentMethodId]);
|
|
16841
|
+
|
|
16842
|
+
//Trigger the handleVantivPayment method when a vantivePaymentRequest is present
|
|
16843
|
+
useEffect(() => {
|
|
16844
|
+
if (vantivPaymentRequest) {
|
|
16845
|
+
handleVantivPayment(vantivPaymentRequest, updatedCouponCode);
|
|
16846
|
+
}
|
|
16847
|
+
}, [vantivPaymentRequest]);
|
|
16843
16848
|
useEffect(() => {
|
|
16844
16849
|
whenUserReady(() => {
|
|
16845
16850
|
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || (order === null || order === void 0 ? void 0 : order.price) === 0)) return;
|
|
@@ -16968,6 +16973,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
16968
16973
|
});
|
|
16969
16974
|
if (err) {
|
|
16970
16975
|
onFailure(err);
|
|
16976
|
+
|
|
16977
|
+
//reset the coupon code in local state
|
|
16978
|
+
setUpdatedCouponCode("");
|
|
16971
16979
|
dispatch({
|
|
16972
16980
|
type: SET_COUPON_ERROR,
|
|
16973
16981
|
payload: getErrorMessages(err)
|
|
@@ -17026,6 +17034,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17026
17034
|
type: SET_COUPON,
|
|
17027
17035
|
payload: res.data.coupon
|
|
17028
17036
|
});
|
|
17037
|
+
|
|
17038
|
+
//set the coupon code in local state to be able to use with Vantiv
|
|
17039
|
+
setUpdatedCouponCode(res.data.coupon.code);
|
|
17029
17040
|
dispatch({
|
|
17030
17041
|
type: SET_PERCENT_OFF,
|
|
17031
17042
|
payload: `${(_res$data$coupon = res.data.coupon) === null || _res$data$coupon === void 0 ? void 0 : _res$data$coupon.percent_off}%`
|
|
@@ -17096,6 +17107,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17096
17107
|
const debouncedApplyCouponCode = useRef(debounce(onApplyCouponCode, 1000)).current;
|
|
17097
17108
|
const removeAppliedCoupon = state => {
|
|
17098
17109
|
state.couponCode = "";
|
|
17110
|
+
|
|
17111
|
+
//reset the coupon code in local state
|
|
17112
|
+
setUpdatedCouponCode("");
|
|
17099
17113
|
dispatch({
|
|
17100
17114
|
type: SET_COUPON_ERROR,
|
|
17101
17115
|
payload: ""
|
|
@@ -17776,11 +17790,14 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
17776
17790
|
disableSubmit: true,
|
|
17777
17791
|
isLoading: true
|
|
17778
17792
|
}, (state, dispatch) => {
|
|
17793
|
+
if (skipPayment && (order === null || order === void 0 ? void 0 : order.price) === 0) {
|
|
17794
|
+
return submitPayment(state);
|
|
17795
|
+
}
|
|
17779
17796
|
if (getSiteCardProcessor() === "vantiv") {
|
|
17780
17797
|
return submitUsingVantiv();
|
|
17781
17798
|
}
|
|
17782
17799
|
if (getSiteCardProcessor() === "tap") {
|
|
17783
|
-
return submitUsingTap();
|
|
17800
|
+
return submitUsingTap(state);
|
|
17784
17801
|
}
|
|
17785
17802
|
if (selectedPaymentMethodId) {
|
|
17786
17803
|
// pay with selected method (source) if exists already
|
|
@@ -18782,7 +18799,8 @@ function PaymentMethodView(_ref) {
|
|
|
18782
18799
|
showCoupon,
|
|
18783
18800
|
showExternalPaymentMethods,
|
|
18784
18801
|
showSubscriptionButton,
|
|
18785
|
-
showOrderButton
|
|
18802
|
+
showOrderButton,
|
|
18803
|
+
order
|
|
18786
18804
|
} = _ref;
|
|
18787
18805
|
const {
|
|
18788
18806
|
t
|
|
@@ -18795,7 +18813,15 @@ function PaymentMethodView(_ref) {
|
|
|
18795
18813
|
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
18796
18814
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
18797
18815
|
className: "plc-flex plc-flex-col plc-items-center plc-mt-4 sm:plc-px-8 pelcro-payment-block"
|
|
18798
|
-
},
|
|
18816
|
+
}, order && !Array.isArray(order) && /*#__PURE__*/React__default.createElement("div", {
|
|
18817
|
+
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"
|
|
18818
|
+
}, /*#__PURE__*/React__default.createElement("p", {
|
|
18819
|
+
className: "plc-text-gray-600"
|
|
18820
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
18821
|
+
className: "plc-tracking-wider plc-uppercase"
|
|
18822
|
+
}, order === null || order === void 0 ? void 0 : order.name), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", {
|
|
18823
|
+
className: "plc-text-xl plc-font-semibold plc-text-primary-600"
|
|
18824
|
+
}, 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", {
|
|
18799
18825
|
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"
|
|
18800
18826
|
}, /*#__PURE__*/React__default.createElement(SvgLock, {
|
|
18801
18827
|
className: "plc-w-5 plc-h-5 plc-mr-1"
|
|
@@ -20569,6 +20595,16 @@ function SubscriptionManageMembersList(props) {
|
|
|
20569
20595
|
icon: /*#__PURE__*/React__default.createElement(SvgCheckMark, null)
|
|
20570
20596
|
};
|
|
20571
20597
|
}, []);
|
|
20598
|
+
const showMemberData = useCallback(member => {
|
|
20599
|
+
var _member$customer, _member$customer2, _member$customer3, _member$customer4;
|
|
20600
|
+
let data;
|
|
20601
|
+
if ((member === null || member === void 0 ? void 0 : member.status) !== "active") {
|
|
20602
|
+
data = member === null || member === void 0 ? void 0 : member.invitation_email;
|
|
20603
|
+
return data;
|
|
20604
|
+
}
|
|
20605
|
+
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) || "-----";
|
|
20606
|
+
return data;
|
|
20607
|
+
}, []);
|
|
20572
20608
|
if (loading) {
|
|
20573
20609
|
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", {
|
|
20574
20610
|
className: "plc-animate-pulse"
|
|
@@ -20605,32 +20641,27 @@ function SubscriptionManageMembersList(props) {
|
|
|
20605
20641
|
type: HANDLE_REMOVE_MEMBER
|
|
20606
20642
|
});
|
|
20607
20643
|
};
|
|
20608
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, members === null || members === void 0 ? void 0 : members.map(member => {
|
|
20609
|
-
|
|
20610
|
-
|
|
20611
|
-
|
|
20612
|
-
|
|
20613
|
-
|
|
20614
|
-
|
|
20615
|
-
|
|
20616
|
-
|
|
20617
|
-
|
|
20618
|
-
|
|
20619
|
-
|
|
20620
|
-
|
|
20621
|
-
|
|
20622
|
-
|
|
20623
|
-
|
|
20624
|
-
|
|
20625
|
-
|
|
20626
|
-
|
|
20627
|
-
|
|
20628
|
-
|
|
20629
|
-
disabled: member.id === removeMemberId,
|
|
20630
|
-
isLoading: member.id === removeMemberId,
|
|
20631
|
-
"data-key": member.id
|
|
20632
|
-
}, t("labels.remove"))));
|
|
20633
|
-
}));
|
|
20644
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, members === null || members === void 0 ? void 0 : members.map(member => /*#__PURE__*/React__default.createElement("tr", {
|
|
20645
|
+
key: member.id,
|
|
20646
|
+
className: `plc-w-full plc-align-middle plc-cursor-pointer accordion-header hover:plc-bg-gray-50 plc-text-center`
|
|
20647
|
+
}, /*#__PURE__*/React__default.createElement("td", {
|
|
20648
|
+
className: "plc-truncate plc-text-left",
|
|
20649
|
+
title: showMemberData(member)
|
|
20650
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
20651
|
+
className: "plc-font-semibold plc-text-gray-500"
|
|
20652
|
+
}, showMemberData(member))), /*#__PURE__*/React__default.createElement("td", {
|
|
20653
|
+
className: "plc-py-2"
|
|
20654
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
20655
|
+
className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${getMemberStatus(member).bgColor} plc-uppercase ${getMemberStatus(member).textColor} plc-rounded-lg`
|
|
20656
|
+
}, getMemberStatus(member).icon, getMemberStatus(member).title)), /*#__PURE__*/React__default.createElement("td", null, /*#__PURE__*/React__default.createElement(Button, {
|
|
20657
|
+
variant: "ghost",
|
|
20658
|
+
className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-cancel-button",
|
|
20659
|
+
icon: /*#__PURE__*/React__default.createElement(SvgXIconSolid, null),
|
|
20660
|
+
onClick: () => onRemoveClick(member.id),
|
|
20661
|
+
disabled: member.id === removeMemberId,
|
|
20662
|
+
isLoading: member.id === removeMemberId,
|
|
20663
|
+
"data-key": member.id
|
|
20664
|
+
}, t("labels.remove"))))));
|
|
20634
20665
|
}
|
|
20635
20666
|
|
|
20636
20667
|
/**
|
|
@@ -24244,7 +24275,8 @@ const OrderCreateView = props => {
|
|
|
24244
24275
|
type: "orderCreate",
|
|
24245
24276
|
showCoupon: true,
|
|
24246
24277
|
showExternalPaymentMethods: false,
|
|
24247
|
-
showOrderButton: showOrderButton
|
|
24278
|
+
showOrderButton: showOrderButton,
|
|
24279
|
+
order: order
|
|
24248
24280
|
}, props))));
|
|
24249
24281
|
};
|
|
24250
24282
|
|