@pelcro/react-pelcro-js 4.0.0-alpha.35 → 4.0.0-alpha.37
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 +408 -158
- package/dist/index.esm.js +408 -159
- package/dist/pelcro.css +79 -193
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -3453,7 +3453,8 @@ var labels$10 = {
|
|
|
3453
3453
|
removeCoupon: "REMOVE",
|
|
3454
3454
|
firstName: "First name",
|
|
3455
3455
|
lastName: "Last name",
|
|
3456
|
-
phone: "Phone"
|
|
3456
|
+
phone: "Phone",
|
|
3457
|
+
freeItems: "Free Items"
|
|
3457
3458
|
};
|
|
3458
3459
|
var checkoutForm_en = {
|
|
3459
3460
|
messages: messages$14,
|
|
@@ -3997,7 +3998,8 @@ var labels$T = {
|
|
|
3997
3998
|
var buttons$g = {
|
|
3998
3999
|
next: "Next",
|
|
3999
4000
|
select: "Select",
|
|
4000
|
-
back: "Back"
|
|
4001
|
+
back: "Back",
|
|
4002
|
+
gift: "Gift"
|
|
4001
4003
|
};
|
|
4002
4004
|
var select_en = {
|
|
4003
4005
|
messages: messages$V,
|
|
@@ -4397,7 +4399,8 @@ var labels$H = {
|
|
|
4397
4399
|
removeCoupon: "RETIRER",
|
|
4398
4400
|
firstName: "Prénom",
|
|
4399
4401
|
lastName: "Nom de famille",
|
|
4400
|
-
phone: "Téléphoner"
|
|
4402
|
+
phone: "Téléphoner",
|
|
4403
|
+
freeItems: "Articles gratuits"
|
|
4401
4404
|
};
|
|
4402
4405
|
var checkoutForm_fr = {
|
|
4403
4406
|
messages: messages$M,
|
|
@@ -4942,7 +4945,8 @@ var labels$y = {
|
|
|
4942
4945
|
var buttons$b = {
|
|
4943
4946
|
next: "Prochain",
|
|
4944
4947
|
select: "Choisir",
|
|
4945
|
-
back: "Retour"
|
|
4948
|
+
back: "Retour",
|
|
4949
|
+
gift: "cadeau"
|
|
4946
4950
|
};
|
|
4947
4951
|
var select_fr = {
|
|
4948
4952
|
messages: messages$B,
|
|
@@ -5288,7 +5292,8 @@ var labels$s = {
|
|
|
5288
5292
|
removeCoupon: "제거",
|
|
5289
5293
|
firstName: "이름",
|
|
5290
5294
|
lastName: "성",
|
|
5291
|
-
phone: "핸드폰"
|
|
5295
|
+
phone: "핸드폰",
|
|
5296
|
+
freeItems: "무료 아이템"
|
|
5292
5297
|
};
|
|
5293
5298
|
var checkoutForm_ko = {
|
|
5294
5299
|
messages: messages$v,
|
|
@@ -5942,7 +5947,8 @@ var labels$j = {
|
|
|
5942
5947
|
var buttons$6 = {
|
|
5943
5948
|
next: "다음",
|
|
5944
5949
|
select: "선택",
|
|
5945
|
-
back: "뒤로"
|
|
5950
|
+
back: "뒤로",
|
|
5951
|
+
gift: "선물"
|
|
5946
5952
|
};
|
|
5947
5953
|
var select_ko = {
|
|
5948
5954
|
messages: messages$k,
|
|
@@ -6228,7 +6234,8 @@ var labels$d = {
|
|
|
6228
6234
|
removeCoupon: "ELIMINAR",
|
|
6229
6235
|
firstName: "Nombre",
|
|
6230
6236
|
lastName: "Apellido",
|
|
6231
|
-
phone: "Teléfono"
|
|
6237
|
+
phone: "Teléfono",
|
|
6238
|
+
freeItems: "Artículos gratis"
|
|
6232
6239
|
};
|
|
6233
6240
|
var checkoutForm_es = {
|
|
6234
6241
|
messages: messages$e,
|
|
@@ -6763,7 +6770,8 @@ var labels$4 = {
|
|
|
6763
6770
|
var buttons$1 = {
|
|
6764
6771
|
next: "Siguiente",
|
|
6765
6772
|
select: "Seleccionar",
|
|
6766
|
-
back: "Volver"
|
|
6773
|
+
back: "Volver",
|
|
6774
|
+
gift: "regalo"
|
|
6767
6775
|
};
|
|
6768
6776
|
var select_es = {
|
|
6769
6777
|
messages: messages$3,
|
|
@@ -8865,7 +8873,7 @@ const calcAndFormatItemsTotal = (items, currency) => {
|
|
|
8865
8873
|
let totalWithoutDividingBy100 = 0;
|
|
8866
8874
|
|
|
8867
8875
|
for (const item of items) {
|
|
8868
|
-
totalWithoutDividingBy100 += parseFloat(item.price ? isCurrencyZeroDecimal(currency) ? item.price * item.quantity : (item.price * item.quantity).toFixed(2) : isCurrencyZeroDecimal(currency) ? item.amount : item.amount.toFixed(2));
|
|
8876
|
+
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));
|
|
8869
8877
|
}
|
|
8870
8878
|
|
|
8871
8879
|
return getFormattedPriceByLocal(totalWithoutDividingBy100, currency, getPageOrDefaultLanguage());
|
|
@@ -11478,6 +11486,10 @@ const initViewFromURL = () => {
|
|
|
11478
11486
|
return showSubscriptionManageMembersFromUrl();
|
|
11479
11487
|
}
|
|
11480
11488
|
|
|
11489
|
+
if (view === "payment-method-update") {
|
|
11490
|
+
return showPaymentMethodUpdateFromUrl();
|
|
11491
|
+
}
|
|
11492
|
+
|
|
11481
11493
|
switchView(view);
|
|
11482
11494
|
});
|
|
11483
11495
|
}
|
|
@@ -11713,6 +11725,47 @@ const showPasswordlessRequestFromUrl = () => {
|
|
|
11713
11725
|
return switchView("passwordless-request");
|
|
11714
11726
|
};
|
|
11715
11727
|
|
|
11728
|
+
const showPaymentMethodUpdateFromUrl = () => {
|
|
11729
|
+
const {
|
|
11730
|
+
isAuthenticated,
|
|
11731
|
+
whenSiteReady,
|
|
11732
|
+
whenUserReady,
|
|
11733
|
+
switchView
|
|
11734
|
+
} = usePelcro.getStore();
|
|
11735
|
+
whenSiteReady(() => {
|
|
11736
|
+
if (!isAuthenticated()) {
|
|
11737
|
+
return switchView("login");
|
|
11738
|
+
}
|
|
11739
|
+
|
|
11740
|
+
whenUserReady(() => {
|
|
11741
|
+
const supportsVantiv = Boolean(window.Pelcro.site.read().vantiv_gateway_settings);
|
|
11742
|
+
const supportsTap = Boolean(window.Pelcro.site.read().tap_gateway_settings);
|
|
11743
|
+
|
|
11744
|
+
if (!window.Stripe && !supportsVantiv && !supportsTap) {
|
|
11745
|
+
document.querySelector('script[src="https://js.stripe.com/v3"]').addEventListener("load", () => {
|
|
11746
|
+
return switchView("payment-method-update");
|
|
11747
|
+
});
|
|
11748
|
+
return;
|
|
11749
|
+
} //vantiv
|
|
11750
|
+
|
|
11751
|
+
|
|
11752
|
+
if (supportsVantiv) {
|
|
11753
|
+
document.querySelector("#vantiv-eprotect-sdk").addEventListener("load", () => {
|
|
11754
|
+
return switchView("payment-method-update");
|
|
11755
|
+
});
|
|
11756
|
+
return;
|
|
11757
|
+
} //Tap
|
|
11758
|
+
|
|
11759
|
+
|
|
11760
|
+
if (supportsTap && document.querySelector("#tap-sdk")) {
|
|
11761
|
+
return switchView("payment-method-update");
|
|
11762
|
+
}
|
|
11763
|
+
|
|
11764
|
+
return switchView("payment-method-update");
|
|
11765
|
+
});
|
|
11766
|
+
});
|
|
11767
|
+
};
|
|
11768
|
+
|
|
11716
11769
|
const showInvoiceDetailsFromUrl = () => {
|
|
11717
11770
|
const {
|
|
11718
11771
|
isAuthenticated,
|
|
@@ -13670,7 +13723,7 @@ function LoginModal({
|
|
|
13670
13723
|
|
|
13671
13724
|
resetView();
|
|
13672
13725
|
const viewFromURL = getStableViewID(window.Pelcro.helpers.getURLParameter("view"));
|
|
13673
|
-
const viewsURLs = ["invoice-details", "gift-redeem", "plan-select"];
|
|
13726
|
+
const viewsURLs = ["invoice-details", "gift-redeem", "plan-select", "payment-method-update"];
|
|
13674
13727
|
|
|
13675
13728
|
if (viewsURLs.includes(viewFromURL)) {
|
|
13676
13729
|
initViewFromURL();
|
|
@@ -18862,7 +18915,8 @@ function SvgArrowThinLeft(props) {
|
|
|
18862
18915
|
|
|
18863
18916
|
const NextArrow = ({
|
|
18864
18917
|
onClick,
|
|
18865
|
-
className
|
|
18918
|
+
className,
|
|
18919
|
+
size = "normal"
|
|
18866
18920
|
}) => /*#__PURE__*/React__default['default'].createElement("button", {
|
|
18867
18921
|
className: `sm:plc-flex plc-hidden plc-text-gray-500 plc-w-11 plc-h-11 plc-items-center plc-justify-center plc-rounded-full plc-text-sm plc-absolute plc-top-1/2 plc--right-12 plc-transform plc--translate-y-1/2 hover:plc-text-gray-900 ${className}`,
|
|
18868
18922
|
onClick: onClick
|
|
@@ -18870,12 +18924,13 @@ const NextArrow = ({
|
|
|
18870
18924
|
stroke: "currentColor",
|
|
18871
18925
|
"aria-hidden": "true",
|
|
18872
18926
|
focusable: "false",
|
|
18873
|
-
className: "plc-h-7 plc-w-
|
|
18927
|
+
className: `${size === "normal" ? "plc-w-7 plc-h-7" : size === "small" ? "plc-w-4 plc-h-4" : "plc-w-9 plc-h-9"}`
|
|
18874
18928
|
}));
|
|
18875
18929
|
|
|
18876
18930
|
const PrevArrow = ({
|
|
18877
18931
|
onClick,
|
|
18878
|
-
className
|
|
18932
|
+
className,
|
|
18933
|
+
size = "normal"
|
|
18879
18934
|
}) => /*#__PURE__*/React__default['default'].createElement("button", {
|
|
18880
18935
|
className: `sm:plc-flex plc-hidden plc-text-gray-500 plc-w-11 plc-h-11 plc-items-center plc-justify-center plc-rounded-full plc-text-sm plc-absolute plc-top-1/2 plc--left-12 plc-transform plc--translate-y-1/2 hover:plc-text-gray-900 ${className}`,
|
|
18881
18936
|
onClick: onClick
|
|
@@ -18883,28 +18938,40 @@ const PrevArrow = ({
|
|
|
18883
18938
|
stroke: "currentColor",
|
|
18884
18939
|
"aria-hidden": "true",
|
|
18885
18940
|
focusable: "false",
|
|
18886
|
-
className: "plc-h-7 plc-w-
|
|
18941
|
+
className: `${size === "normal" ? "plc-w-7 plc-h-7" : size === "small" ? "plc-w-4 plc-h-4" : "plc-w-9 plc-h-9"}`
|
|
18887
18942
|
}));
|
|
18888
18943
|
|
|
18889
18944
|
function Carousel({
|
|
18890
18945
|
slidesToShow = 3,
|
|
18891
18946
|
slidesToScroll = 1,
|
|
18947
|
+
initialSlide = 0,
|
|
18948
|
+
dots = true,
|
|
18892
18949
|
slidesCount,
|
|
18950
|
+
arrowsSize = "normal",
|
|
18951
|
+
paddingSize = "small",
|
|
18893
18952
|
children,
|
|
18894
18953
|
...otherProps
|
|
18895
18954
|
}) {
|
|
18896
18955
|
const ref = React.useRef(null);
|
|
18956
|
+
React.useEffect(() => {
|
|
18957
|
+
ref.current.slickGoTo(initialSlide, true);
|
|
18958
|
+
}, [initialSlide]);
|
|
18897
18959
|
const settings = {
|
|
18898
18960
|
dots: true,
|
|
18899
18961
|
infinite: false,
|
|
18900
18962
|
speed: 200,
|
|
18901
18963
|
slidesToShow: slidesToShow,
|
|
18902
18964
|
slidesToScroll: slidesToScroll,
|
|
18903
|
-
nextArrow: /*#__PURE__*/React__default['default'].createElement(NextArrow,
|
|
18904
|
-
|
|
18905
|
-
|
|
18965
|
+
nextArrow: /*#__PURE__*/React__default['default'].createElement(NextArrow, {
|
|
18966
|
+
size: arrowsSize
|
|
18967
|
+
}),
|
|
18968
|
+
prevArrow: /*#__PURE__*/React__default['default'].createElement(PrevArrow, {
|
|
18969
|
+
size: arrowsSize
|
|
18970
|
+
}),
|
|
18971
|
+
initialSlide: initialSlide,
|
|
18972
|
+
dots: dots,
|
|
18906
18973
|
customPaging: i => /*#__PURE__*/React__default['default'].createElement("span", {
|
|
18907
|
-
className: "plc-w-3 plc-h-3 plc-rounded-full plc-transition-all plc-bg-gray-400 plc-inline-flex plc-cursor-pointer hover:plc-
|
|
18974
|
+
className: "plc-w-3 plc-h-3 plc-rounded-full plc-transition-all plc-bg-gray-400 plc-inline-flex plc-cursor-pointer hover:plc-bg-primary"
|
|
18908
18975
|
}),
|
|
18909
18976
|
responsive: [{
|
|
18910
18977
|
breakpoint: 1280,
|
|
@@ -18919,7 +18986,7 @@ function Carousel({
|
|
|
18919
18986
|
}]
|
|
18920
18987
|
};
|
|
18921
18988
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
18922
|
-
className:
|
|
18989
|
+
className: `carousel-wrapper plc-relative ${paddingSize === "small" ? "sm:plc-px-8 plc-px-0" : paddingSize === "medium" ? "sm:plc-px-10 plc-px-0" : "sm:plc-px-14 plc-px-0"}`
|
|
18923
18990
|
}, /*#__PURE__*/React__default['default'].createElement(Slider, Object.assign({
|
|
18924
18991
|
ref: ref
|
|
18925
18992
|
}, settings), children));
|
|
@@ -18985,6 +19052,29 @@ function SelectModalWithHook(props) {
|
|
|
18985
19052
|
matchingEntitlements: view === "_plan-select-entitlements" ? entitlements : null
|
|
18986
19053
|
});
|
|
18987
19054
|
}
|
|
19055
|
+
|
|
19056
|
+
function productsWithMatchedTaggedFirst() {
|
|
19057
|
+
var _window$Pelcro$produc;
|
|
19058
|
+
|
|
19059
|
+
const allProducts = (_window$Pelcro$produc = window.Pelcro.product.list()) !== null && _window$Pelcro$produc !== void 0 ? _window$Pelcro$produc : [];
|
|
19060
|
+
const productsThatMatchArticleTag = window.Pelcro.product.getByMatchingPageTags();
|
|
19061
|
+
const allProductsMinusMatched = allProducts.filter(product => !productsThatMatchArticleTag.some(matchedProduct => matchedProduct.id === product.id));
|
|
19062
|
+
return [productsThatMatchArticleTag, allProductsMinusMatched];
|
|
19063
|
+
}
|
|
19064
|
+
|
|
19065
|
+
function productMatchPageLanguage(product) {
|
|
19066
|
+
if (!product) {
|
|
19067
|
+
return false;
|
|
19068
|
+
}
|
|
19069
|
+
|
|
19070
|
+
if (product.language === null) {
|
|
19071
|
+
return true;
|
|
19072
|
+
}
|
|
19073
|
+
|
|
19074
|
+
const siteLanguage = window.Pelcro.helpers.getHtmlLanguageAttribute();
|
|
19075
|
+
return product.language === siteLanguage;
|
|
19076
|
+
}
|
|
19077
|
+
|
|
18988
19078
|
SelectModalWithHook.viewId = "plan-select";
|
|
18989
19079
|
|
|
18990
19080
|
class SelectModal extends React.Component {
|
|
@@ -19029,19 +19119,50 @@ class SelectModal extends React.Component {
|
|
|
19029
19119
|
document.addEventListener("keydown", this.handleSubmit);
|
|
19030
19120
|
|
|
19031
19121
|
if (!document.querySelector("#pelcro-selection-view") || !document.querySelector(".pelcro-select-product-wrapper")) {
|
|
19122
|
+
var _window$Pelcro, _window$Pelcro$user, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$site;
|
|
19123
|
+
|
|
19124
|
+
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;
|
|
19125
|
+
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;
|
|
19126
|
+
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;
|
|
19127
|
+
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 => {
|
|
19128
|
+
const filteredPlans = product.plans.filter(plan => plan.currency === userCurrency || !userCurrency);
|
|
19129
|
+
if (filteredPlans.length) return filteredPlans;
|
|
19130
|
+
});
|
|
19131
|
+
const productsMatchingUserCountry = productsMatchingUserCurrency.filter(product => {
|
|
19132
|
+
const filteredPlans = product.plans.filter(plan => {
|
|
19133
|
+
var _plan$countries;
|
|
19134
|
+
|
|
19135
|
+
return plan.countries && ((_plan$countries = plan.countries) === null || _plan$countries === void 0 ? void 0 : _plan$countries.includes(userCountry)) || !plan.countries || !plan.countries.length;
|
|
19136
|
+
});
|
|
19137
|
+
if (filteredPlans.length) return filteredPlans;
|
|
19138
|
+
});
|
|
19032
19139
|
notifyBugsnag(() => {
|
|
19033
19140
|
Bugsnag.notify("SelectModal - No data viewed", event => {
|
|
19034
|
-
var _window$
|
|
19141
|
+
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;
|
|
19035
19142
|
|
|
19036
19143
|
event.addMetadata("MetaData", {
|
|
19037
|
-
site: (_window$
|
|
19038
|
-
user: (_window$
|
|
19039
|
-
uiVersion: (_window$
|
|
19040
|
-
environment: (_window$
|
|
19144
|
+
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(),
|
|
19145
|
+
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(),
|
|
19146
|
+
uiVersion: (_window$Pelcro7 = window.Pelcro) === null || _window$Pelcro7 === void 0 ? void 0 : (_window$Pelcro7$uiSet = _window$Pelcro7.uiSettings) === null || _window$Pelcro7$uiSet === void 0 ? void 0 : _window$Pelcro7$uiSet.uiVersion,
|
|
19147
|
+
environment: (_window$Pelcro8 = window.Pelcro) === null || _window$Pelcro8 === void 0 ? void 0 : _window$Pelcro8.environment,
|
|
19148
|
+
matchingEntitlementsProps: (_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.matchingEntitlements,
|
|
19149
|
+
productListState: this.state.productList,
|
|
19150
|
+
methods: {
|
|
19151
|
+
productsWithMatchedTaggedFirst: productsWithMatchedTaggedFirst(),
|
|
19152
|
+
pelcroSDKProductsListMethod: window.Pelcro.product.list(),
|
|
19153
|
+
pelcroSDKGetByEntitlements: this.props.matchingEntitlements ? window.Pelcro.product.getByEntitlements(this.props.matchingEntitlements) : null
|
|
19154
|
+
},
|
|
19155
|
+
userCurrency: userCurrency,
|
|
19156
|
+
userCountry: userCountry,
|
|
19157
|
+
userLanguage: userLanguage,
|
|
19158
|
+
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(),
|
|
19159
|
+
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,
|
|
19160
|
+
currency_matching_filter: `${productsMatchingUserCurrency.length} Products Passed`,
|
|
19161
|
+
country_matching_filter: `${productsMatchingUserCountry.length} Products Passed`,
|
|
19162
|
+
language_matching_filter: `${productsMatchingUserCountry.filter(productMatchPageLanguage).length} Products Passed`
|
|
19041
19163
|
});
|
|
19042
19164
|
});
|
|
19043
19165
|
});
|
|
19044
|
-
console.log("bugsnag Triggered");
|
|
19045
19166
|
}
|
|
19046
19167
|
});
|
|
19047
19168
|
|
|
@@ -19122,7 +19243,7 @@ class SelectModal extends React.Component {
|
|
|
19122
19243
|
onClick: productButtonCallback,
|
|
19123
19244
|
"data-key": product.id,
|
|
19124
19245
|
id: "pelcro-select-product-back-button",
|
|
19125
|
-
className: `plc-w-full ${options !== null && options !== void 0 && options.emphasize ? "plc-bg-primary-700" : ""}`
|
|
19246
|
+
className: `plc-w-full plc-capitalize plc-border-2 plc-border-primary hover:plc-bg-white hover:plc-text-primary plc-transition-all focus:plc-outline-none ${options !== null && options !== void 0 && options.emphasize ? "plc-bg-primary-700" : ""}`
|
|
19126
19247
|
}, index === 0 && {
|
|
19127
19248
|
autoFocus: true
|
|
19128
19249
|
}), productButtonLabel)));
|
|
@@ -19143,38 +19264,83 @@ class SelectModal extends React.Component {
|
|
|
19143
19264
|
}, items);
|
|
19144
19265
|
});
|
|
19145
19266
|
|
|
19267
|
+
_defineProperty$3(this, "handleScrollLeft", () => {
|
|
19268
|
+
this.productsTabRef.current.scrollLeft -= 100; // Adjust the scroll value as needed
|
|
19269
|
+
});
|
|
19270
|
+
|
|
19271
|
+
_defineProperty$3(this, "handleScrollRight", () => {
|
|
19272
|
+
this.productsTabRef.current.scrollLeft += 100; // Adjust the scroll value as needed
|
|
19273
|
+
});
|
|
19274
|
+
|
|
19275
|
+
_defineProperty$3(this, "toggleProdDescExpanded", () => {
|
|
19276
|
+
this.setState({
|
|
19277
|
+
prodDescExpanded: !this.state.prodDescExpanded
|
|
19278
|
+
});
|
|
19279
|
+
});
|
|
19280
|
+
|
|
19146
19281
|
_defineProperty$3(this, "renderProductTabs", () => {
|
|
19147
|
-
const
|
|
19282
|
+
const {
|
|
19283
|
+
prodDescExpanded
|
|
19284
|
+
} = this.state;
|
|
19285
|
+
|
|
19286
|
+
const productButtonCallback = e => {
|
|
19287
|
+
this.setState({
|
|
19288
|
+
scrollToTab: false
|
|
19289
|
+
});
|
|
19290
|
+
this.selectProduct(e);
|
|
19291
|
+
};
|
|
19292
|
+
|
|
19148
19293
|
const {
|
|
19149
19294
|
image,
|
|
19150
19295
|
description
|
|
19151
19296
|
} = this.state.product;
|
|
19152
|
-
|
|
19153
|
-
|
|
19154
|
-
|
|
19155
|
-
|
|
19156
|
-
|
|
19157
|
-
|
|
19158
|
-
|
|
19159
|
-
|
|
19160
|
-
|
|
19161
|
-
|
|
19162
|
-
|
|
19297
|
+
const tabs = this.state.productList.map((product, index) => {
|
|
19298
|
+
if (product.id === this.state.product.id && this.state.scrollToTab) {
|
|
19299
|
+
this.setState(oldState => {
|
|
19300
|
+
if (+oldState.initialTabSlide !== +index) {
|
|
19301
|
+
return {
|
|
19302
|
+
initialTabSlide: index
|
|
19303
|
+
};
|
|
19304
|
+
}
|
|
19305
|
+
});
|
|
19306
|
+
}
|
|
19307
|
+
|
|
19308
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19309
|
+
key: product.id
|
|
19163
19310
|
}, /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19164
|
-
onClick: productButtonCallback,
|
|
19311
|
+
onClick: e => productButtonCallback(e),
|
|
19165
19312
|
"data-key": product.id,
|
|
19166
|
-
|
|
19313
|
+
"data-index": index,
|
|
19314
|
+
className: `plc-px-4 plc-py-2 focus:plc-outline-none plc-border-b-4 hover:plc-text-primary hover:plc-border-primary plc-transition-all plc-h-full plc-flex ${product.id === this.state.product.id ? "plc-border-primary plc-text-primary" : "plc-border-transparent plc-font-normal plc-text-gray-500"}`
|
|
19167
19315
|
}, product.name));
|
|
19168
|
-
})
|
|
19169
|
-
|
|
19316
|
+
});
|
|
19317
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19318
|
+
className: "plc-flex plc-flex-col"
|
|
19319
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19320
|
+
className: "productTabs plc-relative plc-max-w-xl plc-mx-auto"
|
|
19321
|
+
}, /*#__PURE__*/React__default['default'].createElement(Carousel, {
|
|
19322
|
+
slidesCount: tabs.length,
|
|
19323
|
+
initialSlide: this.state.initialTabSlide,
|
|
19324
|
+
dots: false,
|
|
19325
|
+
arrowsSize: "small"
|
|
19326
|
+
}, tabs)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19327
|
+
className: "selectedProduct plc-flex plc-flex-col plc-items-center plc-justify-center plc-max-w-3xl plc-mx-auto plc-mt-6"
|
|
19170
19328
|
}, image && /*#__PURE__*/React__default['default'].createElement("figure", {
|
|
19171
19329
|
className: "plc-mb-2"
|
|
19172
19330
|
}, /*#__PURE__*/React__default['default'].createElement("img", {
|
|
19173
19331
|
src: image,
|
|
19174
19332
|
alt: "Product Image"
|
|
19175
|
-
})), description && /*#__PURE__*/React__default['default'].createElement("
|
|
19176
|
-
className: "plc-text-center"
|
|
19177
|
-
},
|
|
19333
|
+
})), description && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19334
|
+
className: "plc-max-w-xl plc-text-center"
|
|
19335
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19336
|
+
className: `plc-overflow-x-hidden ${prodDescExpanded ? "plc-whitespace-normal" : "plc-whitespace-nowrap"}`
|
|
19337
|
+
}, prodDescExpanded ? /*#__PURE__*/React__default['default'].createElement("span", null, description, " ", /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19338
|
+
onClick: this.toggleProdDescExpanded,
|
|
19339
|
+
className: "plc-text-primary plc-underline plc-cursor-pointer plc-outline-none focus:plc-outline-none hover:plc-no-underline"
|
|
19340
|
+
}, "Read less")) : /*#__PURE__*/React__default['default'].createElement("span", null, description.slice(0, 50), " ", /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19341
|
+
onClick: this.toggleProdDescExpanded,
|
|
19342
|
+
className: "plc-text-primary plc-underline plc-cursor-pointer plc-outline-none focus:plc-outline-none hover:plc-no-underline"
|
|
19343
|
+
}, "Read more"))))));
|
|
19178
19344
|
});
|
|
19179
19345
|
|
|
19180
19346
|
_defineProperty$3(this, "renderMatchingProductsFirst", () => {
|
|
@@ -19199,34 +19365,22 @@ class SelectModal extends React.Component {
|
|
|
19199
19365
|
}), /*#__PURE__*/React__default['default'].createElement("h3", {
|
|
19200
19366
|
className: "plc-text-sm plc-font-semibold"
|
|
19201
19367
|
}, this.locale("labels.restrictiveArticles.or")), allProductsMinusMatched.map((product, index) => this.renderOneProduct(product, index))));
|
|
19202
|
-
|
|
19203
|
-
function productsWithMatchedTaggedFirst() {
|
|
19204
|
-
var _window$Pelcro$produc;
|
|
19205
|
-
|
|
19206
|
-
const allProducts = (_window$Pelcro$produc = window.Pelcro.product.list()) !== null && _window$Pelcro$produc !== void 0 ? _window$Pelcro$produc : [];
|
|
19207
|
-
const productsThatMatchArticleTag = window.Pelcro.product.getByMatchingPageTags();
|
|
19208
|
-
const allProductsMinusMatched = allProducts.filter(product => !productsThatMatchArticleTag.some(matchedProduct => matchedProduct.id === product.id));
|
|
19209
|
-
return [productsThatMatchArticleTag, allProductsMinusMatched];
|
|
19210
|
-
}
|
|
19211
19368
|
});
|
|
19212
19369
|
|
|
19213
19370
|
_defineProperty$3(this, "renderPlans", () => {
|
|
19371
|
+
const {
|
|
19372
|
+
disableGifting
|
|
19373
|
+
} = this.props;
|
|
19214
19374
|
const items = this.state.planList.map(plan => {
|
|
19215
|
-
var _this$state
|
|
19375
|
+
var _this$state;
|
|
19216
19376
|
|
|
19217
|
-
|
|
19377
|
+
this.state.plan.id === plan.id ? true : false;
|
|
19218
19378
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19219
19379
|
key: plan.id,
|
|
19220
19380
|
className: `${((_this$state = this.state) === null || _this$state === void 0 ? void 0 : _this$state.plan.id) === plan.id ? "plc-border-2 plc-border-primary" : "plc-border plc-border-gray-300"} plc-h-full plc-flex plc-flex-col plc-items-start plc-text-gray-900 plc-border-solid plc-rounded-md plc-bg-white pelcro-select-plan-wrapper`
|
|
19221
|
-
}, /*#__PURE__*/React__default['default'].createElement(
|
|
19222
|
-
|
|
19223
|
-
|
|
19224
|
-
labelClassName: "plc-cursor-pointer plc-w-full plc-h-full plc-m-0 plc-flex-1 plc-flex plc-flex-col",
|
|
19225
|
-
id: `pelcro-select-plan-${plan.id}`,
|
|
19226
|
-
name: "plan",
|
|
19227
|
-
checked: isChecked,
|
|
19228
|
-
"data-key": plan.id,
|
|
19229
|
-
onChange: this.selectPlan
|
|
19381
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19382
|
+
className: "plc-w-full plc-flex plc-flex-col plc-h-full",
|
|
19383
|
+
id: `pelcro-select-plan-${plan.id}`
|
|
19230
19384
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19231
19385
|
className: "plc-p-4 plc-text-center plc-flex plc-flex-col plc-justify-center plc-items-center plc-w-full"
|
|
19232
19386
|
}, /*#__PURE__*/React__default['default'].createElement("h4", {
|
|
@@ -19246,8 +19400,16 @@ class SelectModal extends React.Component {
|
|
|
19246
19400
|
}, plan.currency), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
19247
19401
|
className: "plc-capitalize"
|
|
19248
19402
|
}, "/ ", plan.interval))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19249
|
-
className:
|
|
19250
|
-
},
|
|
19403
|
+
className: `plc-grid ${disableGifting ? "plc-grid-cols-1" : "plc-grid-cols-2 plc-gap-2"}`
|
|
19404
|
+
}, /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19405
|
+
className: `plc-flex plc-items-center plc-justify-center plc-text-center plc-py-2 plc-px-4 plc-w-full plc-border-2 plc-rounded-md plc-border-primary focus:plc-outline-none plc-text-white plc-bg-primary hover:plc-bg-white hover:plc-text-primary plc-transition-all`,
|
|
19406
|
+
"data-key": plan.id,
|
|
19407
|
+
onClick: e => this.selectPlan(e, false)
|
|
19408
|
+
}, this.locale("buttons.select")), !disableGifting && /*#__PURE__*/React__default['default'].createElement("button", {
|
|
19409
|
+
className: `plc-flex plc-items-center plc-justify-center plc-text-center plc-py-2 plc-px-4 plc-w-full plc-border-2 plc-rounded-md plc-border-primary focus:plc-outline-none plc-text-primary plc-bg-white hover:plc-bg-primary hover:plc-text-white plc-transition-all`,
|
|
19410
|
+
"data-key": plan.id,
|
|
19411
|
+
onClick: e => this.selectPlan(e, true)
|
|
19412
|
+
}, this.locale("buttons.gift"))))));
|
|
19251
19413
|
});
|
|
19252
19414
|
return /*#__PURE__*/React__default['default'].createElement(Carousel, {
|
|
19253
19415
|
slidesCount: items.length
|
|
@@ -19281,39 +19443,30 @@ class SelectModal extends React.Component {
|
|
|
19281
19443
|
}
|
|
19282
19444
|
});
|
|
19283
19445
|
|
|
19284
|
-
_defineProperty$3(this, "selectPlan", e => {
|
|
19446
|
+
_defineProperty$3(this, "selectPlan", (e, isGift) => {
|
|
19285
19447
|
const id = e.target.dataset.key;
|
|
19286
19448
|
|
|
19287
19449
|
for (const plan of this.state.planList) {
|
|
19288
19450
|
if (+plan.id === +id) {
|
|
19289
|
-
plan.isCheked = true;
|
|
19290
19451
|
this.setState({
|
|
19291
|
-
plan: plan
|
|
19452
|
+
plan: plan,
|
|
19453
|
+
isGift: isGift
|
|
19292
19454
|
});
|
|
19293
|
-
this.
|
|
19294
|
-
|
|
19295
|
-
});
|
|
19296
|
-
} else {
|
|
19297
|
-
plan.isCheked = false;
|
|
19455
|
+
this.props.setProductAndPlan(this.state.product, plan, isGift);
|
|
19456
|
+
this.submitOption(this.state.product, isGift);
|
|
19298
19457
|
}
|
|
19299
19458
|
}
|
|
19300
19459
|
});
|
|
19301
19460
|
|
|
19302
19461
|
_defineProperty$3(this, "goBack", () => {
|
|
19303
19462
|
this.setState({
|
|
19304
|
-
disabled: true
|
|
19305
|
-
|
|
19306
|
-
|
|
19307
|
-
mode: "product"
|
|
19463
|
+
disabled: true,
|
|
19464
|
+
mode: "product",
|
|
19465
|
+
scrollToTab: true
|
|
19308
19466
|
});
|
|
19309
19467
|
});
|
|
19310
19468
|
|
|
19311
|
-
_defineProperty$3(this, "submitOption", () => {
|
|
19312
|
-
this.props.setProductAndPlan(this.state.product, this.state.plan, this.state.isGift);
|
|
19313
|
-
const {
|
|
19314
|
-
product,
|
|
19315
|
-
isGift
|
|
19316
|
-
} = this.state;
|
|
19469
|
+
_defineProperty$3(this, "submitOption", (product, isGift) => {
|
|
19317
19470
|
const {
|
|
19318
19471
|
setView
|
|
19319
19472
|
} = this.props;
|
|
@@ -19348,31 +19501,20 @@ class SelectModal extends React.Component {
|
|
|
19348
19501
|
isGift: props.isGift,
|
|
19349
19502
|
disabled: true,
|
|
19350
19503
|
mode: "product",
|
|
19504
|
+
initialTabSlide: 0,
|
|
19505
|
+
scrollToTab: true,
|
|
19506
|
+
prodDescExpanded: false,
|
|
19351
19507
|
productList: props.matchingEntitlements ? window.Pelcro.product.getByEntitlements(props.matchingEntitlements) : window.Pelcro.product.list()
|
|
19352
19508
|
};
|
|
19353
19509
|
this.product = this.props.product || window.Pelcro.paywall.getProduct();
|
|
19354
19510
|
this.locale = this.props.t;
|
|
19355
19511
|
this.closeButton = window.Pelcro.paywall.displayCloseButton();
|
|
19356
|
-
|
|
19357
|
-
|
|
19358
|
-
componentDidUpdate(prevProps, prevState) {
|
|
19359
|
-
//Scroll to active tab
|
|
19360
|
-
const activeElement = document.getElementById("activeTab");
|
|
19361
|
-
|
|
19362
|
-
if (activeElement) {
|
|
19363
|
-
activeElement.parentNode.scrollLeft = activeElement.offsetLeft - 80;
|
|
19364
|
-
} else {
|
|
19365
|
-
console.log(document.getElementById("activeTab"));
|
|
19366
|
-
}
|
|
19512
|
+
this.productsTabRef = /*#__PURE__*/React__default['default'].createRef();
|
|
19367
19513
|
}
|
|
19368
19514
|
|
|
19369
19515
|
render() {
|
|
19370
19516
|
var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
|
|
19371
19517
|
|
|
19372
|
-
const {
|
|
19373
|
-
disableGifting
|
|
19374
|
-
} = this.props;
|
|
19375
|
-
|
|
19376
19518
|
if (this.state.mode === "product") {
|
|
19377
19519
|
var _ReactGA$event;
|
|
19378
19520
|
|
|
@@ -19408,27 +19550,9 @@ class SelectModal extends React.Component {
|
|
|
19408
19550
|
id: "pelcro-selection-view"
|
|
19409
19551
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19410
19552
|
className: "pelcro-select-products-wrapper"
|
|
19411
|
-
}, (_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.restrictive_paywall_metatags_enabled ? this.renderMatchingProductsFirst() : this.renderProducts()), this.state.mode === "plan" && /*#__PURE__*/React__default['default'].createElement(
|
|
19553
|
+
}, (_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.restrictive_paywall_metatags_enabled ? this.renderMatchingProductsFirst() : this.renderProducts()), this.state.mode === "plan" && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19412
19554
|
className: "pelcro-select-plans-wrapper plc-mt-4"
|
|
19413
|
-
}, this.renderPlans()),
|
|
19414
|
-
className: "plc-flex plc-justify-center plc-mt-4"
|
|
19415
|
-
}, /*#__PURE__*/React__default['default'].createElement(Checkbox, {
|
|
19416
|
-
onChange: this.onIsGiftChange,
|
|
19417
|
-
checked: this.state.isGift,
|
|
19418
|
-
id: "pelcro-input-is-gift"
|
|
19419
|
-
}, this.locale("messages.checkbox"))), /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
19420
|
-
disabled: this.state.disabled,
|
|
19421
|
-
onClick: this.submitOption,
|
|
19422
|
-
id: "pelcro-submit",
|
|
19423
|
-
className: "plc-mt-2 plc-w-full plc-max-w-sm plc-ml-auto plc-mr-auto plc-block"
|
|
19424
|
-
}, this.locale("buttons.next"))))), /*#__PURE__*/React__default['default'].createElement(ModalFooter, null, !window.Pelcro.user.isAuthenticated() && /*#__PURE__*/React__default['default'].createElement("p", {
|
|
19425
|
-
className: "plc-mb-9"
|
|
19426
|
-
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
19427
|
-
className: "plc-font-medium"
|
|
19428
|
-
}, this.locale("messages.alreadyHaveAccount") + " "), /*#__PURE__*/React__default['default'].createElement(Link, {
|
|
19429
|
-
id: "pelcro-link-login",
|
|
19430
|
-
onClick: this.displayLoginView
|
|
19431
|
-
}, this.locale("messages.loginHere")))));
|
|
19555
|
+
}, this.renderPlans()))), /*#__PURE__*/React__default['default'].createElement(ModalFooter, null));
|
|
19432
19556
|
}
|
|
19433
19557
|
|
|
19434
19558
|
}
|
|
@@ -21541,6 +21665,8 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
21541
21665
|
}) => {
|
|
21542
21666
|
var _props$product, _props$plan, _props$subscriptionId, _props$selectedAddres, _props$giftRecipient, _props$isGift, _props$isRenewingGift, _props$invoice, _window$Pelcro, _window$Pelcro$uiSett;
|
|
21543
21667
|
|
|
21668
|
+
const [vantivPaymentRequest, setVantivPaymentRequest] = React.useState(null);
|
|
21669
|
+
const [updatedCouponCode, setUpdatedCouponCode] = React.useState("");
|
|
21544
21670
|
const {
|
|
21545
21671
|
t
|
|
21546
21672
|
} = useTranslation("payment");
|
|
@@ -21584,7 +21710,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
21584
21710
|
}, []);
|
|
21585
21711
|
/*====== Start Tap integration ========*/
|
|
21586
21712
|
|
|
21587
|
-
const submitUsingTap =
|
|
21713
|
+
const submitUsingTap = state => {
|
|
21588
21714
|
var _ref, _ref2, _ref3, _state$updatedPrice;
|
|
21589
21715
|
|
|
21590
21716
|
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
@@ -21639,7 +21765,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
21639
21765
|
}
|
|
21640
21766
|
});
|
|
21641
21767
|
} else {
|
|
21642
|
-
window.Pelcro.payment.
|
|
21768
|
+
window.Pelcro.payment.verify({
|
|
21643
21769
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
21644
21770
|
first_name: window.Pelcro.user.read().first_name || state.firstName,
|
|
21645
21771
|
last_name: window.Pelcro.user.read().last_name || state.lastName,
|
|
@@ -21648,7 +21774,8 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
21648
21774
|
amount: totalAmount,
|
|
21649
21775
|
currency: (plan === null || plan === void 0 ? void 0 : plan.currency) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency) || window.Pelcro.site.read().default_currency,
|
|
21650
21776
|
tap_token: result.id,
|
|
21651
|
-
|
|
21777
|
+
funding: result.card.funding,
|
|
21778
|
+
redirect_url: `${window.Pelcro.environment.domain}/webhook/tap/callback/3dsecure?auth_token=${window.Pelcro.user.read().auth_token}&type=verify_card&site_id=${window.Pelcro.siteid}`
|
|
21652
21779
|
}, (err, res) => {
|
|
21653
21780
|
if (err) {
|
|
21654
21781
|
// Inform the user if there was an error
|
|
@@ -21689,7 +21816,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
21689
21816
|
content: null
|
|
21690
21817
|
}
|
|
21691
21818
|
});
|
|
21692
|
-
handleTapPayment(tapID);
|
|
21819
|
+
handleTapPayment(tapID, state);
|
|
21693
21820
|
}
|
|
21694
21821
|
}; // listen to injected iframe for authentication complete message
|
|
21695
21822
|
|
|
@@ -21704,7 +21831,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
21704
21831
|
});
|
|
21705
21832
|
};
|
|
21706
21833
|
|
|
21707
|
-
function handleTapPayment(paymentRequest) {
|
|
21834
|
+
function handleTapPayment(paymentRequest, state) {
|
|
21708
21835
|
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
21709
21836
|
|
|
21710
21837
|
if (type === "createPayment") {
|
|
@@ -21731,6 +21858,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
21731
21858
|
type: LOADING,
|
|
21732
21859
|
payload: false
|
|
21733
21860
|
});
|
|
21861
|
+
toggleAuthenticationSuccessPendingView(false);
|
|
21734
21862
|
|
|
21735
21863
|
if (err) {
|
|
21736
21864
|
onFailure(err);
|
|
@@ -21751,7 +21879,8 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
21751
21879
|
}
|
|
21752
21880
|
});
|
|
21753
21881
|
onSuccess(res);
|
|
21754
|
-
}
|
|
21882
|
+
} //
|
|
21883
|
+
);
|
|
21755
21884
|
}
|
|
21756
21885
|
|
|
21757
21886
|
function handleTapSubscription() {
|
|
@@ -21886,7 +22015,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
21886
22015
|
/*====== End Tap integration ========*/
|
|
21887
22016
|
|
|
21888
22017
|
|
|
21889
|
-
const submitUsingVantiv =
|
|
22018
|
+
const submitUsingVantiv = state => {
|
|
21890
22019
|
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
21891
22020
|
|
|
21892
22021
|
if (isUsingExistingPaymentMethod) {
|
|
@@ -21909,7 +22038,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
21909
22038
|
});
|
|
21910
22039
|
};
|
|
21911
22040
|
|
|
21912
|
-
function handleVantivPayment(paymentRequest) {
|
|
22041
|
+
function handleVantivPayment(paymentRequest, couponCode) {
|
|
21913
22042
|
if (paymentRequest) {
|
|
21914
22043
|
const SUCCESS_STATUS = "870";
|
|
21915
22044
|
|
|
@@ -21983,9 +22112,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
21983
22112
|
const renewSubscription = !isGift && subscriptionIdToRenew;
|
|
21984
22113
|
const giftSubscriprition = isGift && !subscriptionIdToRenew;
|
|
21985
22114
|
const renewGift = isRenewingGift;
|
|
21986
|
-
const {
|
|
21987
|
-
couponCode
|
|
21988
|
-
} = state;
|
|
21989
22115
|
|
|
21990
22116
|
if (renewGift) {
|
|
21991
22117
|
return payment.execute({
|
|
@@ -22065,6 +22191,8 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
22065
22191
|
const tapInstanceRef = React__default['default'].useRef(null);
|
|
22066
22192
|
const tapInstanceCard = React__default['default'].useRef(null);
|
|
22067
22193
|
React.useEffect(() => {
|
|
22194
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
22195
|
+
|
|
22068
22196
|
if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
|
|
22069
22197
|
var _window$Pelcro$site$r2, _window$Pelcro$site$r3;
|
|
22070
22198
|
|
|
@@ -22077,7 +22205,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
22077
22205
|
height: "245",
|
|
22078
22206
|
timeout: 50000,
|
|
22079
22207
|
div: "eProtectiframe",
|
|
22080
|
-
callback:
|
|
22208
|
+
callback: paymentRequest => setVantivPaymentRequest(paymentRequest),
|
|
22081
22209
|
showCvv: true,
|
|
22082
22210
|
numYears: 8,
|
|
22083
22211
|
placeholderText: {
|
|
@@ -22091,9 +22219,17 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
22091
22219
|
}
|
|
22092
22220
|
});
|
|
22093
22221
|
}
|
|
22094
|
-
}, [selectedPaymentMethodId]);
|
|
22222
|
+
}, [selectedPaymentMethodId]); //Trigger the handleVantivPayment method when a vantivePaymentRequest is present
|
|
22223
|
+
|
|
22224
|
+
React.useEffect(() => {
|
|
22225
|
+
if (vantivPaymentRequest) {
|
|
22226
|
+
handleVantivPayment(vantivPaymentRequest, updatedCouponCode);
|
|
22227
|
+
}
|
|
22228
|
+
}, [vantivPaymentRequest]);
|
|
22095
22229
|
React.useEffect(() => {
|
|
22096
22230
|
whenUserReady(() => {
|
|
22231
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
22232
|
+
|
|
22097
22233
|
if (cardProcessor === "tap" && !window.Tapjsli) {
|
|
22098
22234
|
window.Pelcro.helpers.loadSDK("https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js", "tap-bluebird");
|
|
22099
22235
|
window.Pelcro.helpers.loadSDK("https://secure.gosell.io/js/sdk/tap.min.js", "tap-sdk");
|
|
@@ -22109,7 +22245,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
22109
22245
|
}, [selectedPaymentMethodId]);
|
|
22110
22246
|
|
|
22111
22247
|
const initPaymentRequest = (state, dispatch) => {
|
|
22112
|
-
if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
|
|
22248
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
22113
22249
|
|
|
22114
22250
|
try {
|
|
22115
22251
|
const paymentRequest = stripe.paymentRequest({
|
|
@@ -22182,7 +22318,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
22182
22318
|
const updateTotalAmountWithTax = () => {
|
|
22183
22319
|
var _window$Pelcro$site$r4;
|
|
22184
22320
|
|
|
22185
|
-
if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) return;
|
|
22321
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
22186
22322
|
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;
|
|
22187
22323
|
|
|
22188
22324
|
if (taxesEnabled && type === "createPayment") {
|
|
@@ -22229,7 +22365,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
22229
22365
|
});
|
|
22230
22366
|
|
|
22231
22367
|
if (err) {
|
|
22232
|
-
onFailure(err);
|
|
22368
|
+
onFailure(err); //reset the coupon code in local state
|
|
22369
|
+
|
|
22370
|
+
setUpdatedCouponCode("");
|
|
22233
22371
|
dispatch({
|
|
22234
22372
|
type: SET_COUPON_ERROR,
|
|
22235
22373
|
payload: getErrorMessages(err)
|
|
@@ -22289,7 +22427,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
22289
22427
|
dispatch({
|
|
22290
22428
|
type: SET_COUPON,
|
|
22291
22429
|
payload: res.data.coupon
|
|
22292
|
-
});
|
|
22430
|
+
}); //set the coupon code in local state to be able to use with Vantiv
|
|
22431
|
+
|
|
22432
|
+
setUpdatedCouponCode(res.data.coupon.code);
|
|
22293
22433
|
dispatch({
|
|
22294
22434
|
type: SET_PERCENT_OFF,
|
|
22295
22435
|
payload: `${(_res$data$coupon = res.data.coupon) === null || _res$data$coupon === void 0 ? void 0 : _res$data$coupon.percent_off}%`
|
|
@@ -22364,7 +22504,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
22364
22504
|
const debouncedApplyCouponCode = React.useRef(debounce$1(onApplyCouponCode, 1000)).current;
|
|
22365
22505
|
|
|
22366
22506
|
const removeAppliedCoupon = state => {
|
|
22367
|
-
state.couponCode = "";
|
|
22507
|
+
state.couponCode = ""; //reset the coupon code in local state
|
|
22508
|
+
|
|
22509
|
+
setUpdatedCouponCode("");
|
|
22368
22510
|
dispatch({
|
|
22369
22511
|
type: SET_COUPON_ERROR,
|
|
22370
22512
|
payload: ""
|
|
@@ -22821,6 +22963,31 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
22821
22963
|
};
|
|
22822
22964
|
|
|
22823
22965
|
const submitPayment = (state, dispatch) => {
|
|
22966
|
+
if (skipPayment && props !== null && props !== void 0 && props.freeOrders) {
|
|
22967
|
+
const isQuickPurchase = !Array.isArray(order);
|
|
22968
|
+
const mappedOrderItems = isQuickPurchase ? [{
|
|
22969
|
+
sku_id: order.id,
|
|
22970
|
+
quantity: order.quantity
|
|
22971
|
+
}] : order.map(item => ({
|
|
22972
|
+
sku_id: item.id,
|
|
22973
|
+
quantity: item.quantity
|
|
22974
|
+
}));
|
|
22975
|
+
window.Pelcro.ecommerce.order.create({
|
|
22976
|
+
items: mappedOrderItems,
|
|
22977
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
22978
|
+
...(selectedAddressId && {
|
|
22979
|
+
address_id: selectedAddressId
|
|
22980
|
+
})
|
|
22981
|
+
}, (err, res) => {
|
|
22982
|
+
if (err) {
|
|
22983
|
+
return handlePaymentError(err);
|
|
22984
|
+
}
|
|
22985
|
+
|
|
22986
|
+
return onSuccess(res);
|
|
22987
|
+
});
|
|
22988
|
+
return;
|
|
22989
|
+
}
|
|
22990
|
+
|
|
22824
22991
|
stripe.createSource({
|
|
22825
22992
|
type: "card"
|
|
22826
22993
|
}).then(({
|
|
@@ -23085,12 +23252,16 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23085
23252
|
disableSubmit: true,
|
|
23086
23253
|
isLoading: true
|
|
23087
23254
|
}, (state, dispatch) => {
|
|
23255
|
+
if (skipPayment && props !== null && props !== void 0 && props.freeOrders) {
|
|
23256
|
+
return submitPayment(state);
|
|
23257
|
+
}
|
|
23258
|
+
|
|
23088
23259
|
if (getSiteCardProcessor() === "vantiv") {
|
|
23089
23260
|
return submitUsingVantiv();
|
|
23090
23261
|
}
|
|
23091
23262
|
|
|
23092
23263
|
if (getSiteCardProcessor() === "tap") {
|
|
23093
|
-
return submitUsingTap();
|
|
23264
|
+
return submitUsingTap(state);
|
|
23094
23265
|
}
|
|
23095
23266
|
|
|
23096
23267
|
if (selectedPaymentMethodId) {
|
|
@@ -23219,10 +23390,14 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23219
23390
|
state,
|
|
23220
23391
|
dispatch
|
|
23221
23392
|
}
|
|
23222
|
-
}, children.length ? children.map((child, i) =>
|
|
23223
|
-
|
|
23224
|
-
|
|
23225
|
-
|
|
23393
|
+
}, children.length ? children.map((child, i) => {
|
|
23394
|
+
if (child) {
|
|
23395
|
+
return /*#__PURE__*/React__default['default'].cloneElement(child, {
|
|
23396
|
+
store: store$l,
|
|
23397
|
+
key: i
|
|
23398
|
+
});
|
|
23399
|
+
}
|
|
23400
|
+
}) : /*#__PURE__*/React__default['default'].cloneElement(children, {
|
|
23226
23401
|
store: store$l
|
|
23227
23402
|
})));
|
|
23228
23403
|
};
|
|
@@ -23253,11 +23428,13 @@ const PaymentMethodContainer = props => {
|
|
|
23253
23428
|
}, /*#__PURE__*/React__default['default'].createElement(es_11, null, /*#__PURE__*/React__default['default'].createElement(UnwrappedForm, Object.assign({
|
|
23254
23429
|
store: store$l
|
|
23255
23430
|
}, props))));
|
|
23256
|
-
} else {
|
|
23431
|
+
} else if (cardProcessor !== "stripe") {
|
|
23257
23432
|
return /*#__PURE__*/React__default['default'].createElement(PaymentMethodContainerWithoutStripe, Object.assign({
|
|
23258
23433
|
store: store$l
|
|
23259
23434
|
}, props));
|
|
23260
23435
|
}
|
|
23436
|
+
|
|
23437
|
+
return null;
|
|
23261
23438
|
};
|
|
23262
23439
|
|
|
23263
23440
|
const StripeInputStyle = {
|
|
@@ -23828,7 +24005,7 @@ const PaypalSubscribeButton = props => {
|
|
|
23828
24005
|
var _ref, _ref2, _state$updatedPrice, _props$plan, _props$selectedAddres;
|
|
23829
24006
|
|
|
23830
24007
|
// sometimes, price is updated. eg. Coupon codes.
|
|
23831
|
-
const updatedPrice = (_ref = (_ref2 = (_state$updatedPrice = state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : (_props$plan = props.plan) === null || _props$plan === void 0 ? void 0 : _props$plan.amount) !== null && _ref2 !== void 0 ? _ref2 : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref !== void 0 ? _ref : invoice.amount_remaining;
|
|
24008
|
+
const updatedPrice = (_ref = (_ref2 = (_state$updatedPrice = state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : (_props$plan = props.plan) === null || _props$plan === void 0 ? void 0 : _props$plan.amount) !== null && _ref2 !== void 0 ? _ref2 : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref !== void 0 ? _ref : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining;
|
|
23832
24009
|
const selectedAddress = getAddressById((_props$selectedAddres = props.selectedAddressId) !== null && _props$selectedAddres !== void 0 ? _props$selectedAddres : selectedAddressId); // initialize paypal client, then render paypal button.
|
|
23833
24010
|
|
|
23834
24011
|
const initializePaypal = async () => {
|
|
@@ -24093,6 +24270,41 @@ const BankAuthenticationSuccess = () => {
|
|
|
24093
24270
|
}));
|
|
24094
24271
|
};
|
|
24095
24272
|
|
|
24273
|
+
const OrderCreateFreeButton = ({
|
|
24274
|
+
name,
|
|
24275
|
+
onClick,
|
|
24276
|
+
...otherProps
|
|
24277
|
+
}) => {
|
|
24278
|
+
const {
|
|
24279
|
+
state: {
|
|
24280
|
+
disableSubmit
|
|
24281
|
+
},
|
|
24282
|
+
dispatch
|
|
24283
|
+
} = React.useContext(store$l);
|
|
24284
|
+
const {
|
|
24285
|
+
t
|
|
24286
|
+
} = useTranslation("checkoutForm");
|
|
24287
|
+
const [isDisabled, setDisabled] = React.useState(true);
|
|
24288
|
+
React.useEffect(() => {
|
|
24289
|
+
setDisabled(disableSubmit);
|
|
24290
|
+
}, [disableSubmit]);
|
|
24291
|
+
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
24292
|
+
className: "plc-w-full",
|
|
24293
|
+
onClick: () => {
|
|
24294
|
+
dispatch({
|
|
24295
|
+
type: DISABLE_SUBMIT,
|
|
24296
|
+
payload: true
|
|
24297
|
+
});
|
|
24298
|
+
dispatch({
|
|
24299
|
+
type: SUBMIT_PAYMENT
|
|
24300
|
+
});
|
|
24301
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
24302
|
+
},
|
|
24303
|
+
disabled: isDisabled,
|
|
24304
|
+
isLoading: disableSubmit
|
|
24305
|
+
}, otherProps), t("labels.submit"));
|
|
24306
|
+
};
|
|
24307
|
+
|
|
24096
24308
|
/**
|
|
24097
24309
|
*
|
|
24098
24310
|
*/
|
|
@@ -24104,9 +24316,11 @@ function PaymentMethodView({
|
|
|
24104
24316
|
type,
|
|
24105
24317
|
showCoupon,
|
|
24106
24318
|
showExternalPaymentMethods,
|
|
24107
|
-
showSubscriptionButton
|
|
24319
|
+
showSubscriptionButton,
|
|
24320
|
+
showOrderButton,
|
|
24321
|
+
order
|
|
24108
24322
|
}) {
|
|
24109
|
-
var _window$Pelcro$site$r, _window$Pelcro$site$r2
|
|
24323
|
+
var _window$Pelcro$site$r, _window$Pelcro$site$r2, _calcAndFormatItemsTo, _order$;
|
|
24110
24324
|
|
|
24111
24325
|
const {
|
|
24112
24326
|
t
|
|
@@ -24119,7 +24333,17 @@ function PaymentMethodView({
|
|
|
24119
24333
|
const isUserPhone = Boolean(window.Pelcro.user.read().phone);
|
|
24120
24334
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
24121
24335
|
className: "plc-flex plc-flex-col plc-items-center plc-mt-4 sm:plc-px-8 pelcro-payment-block"
|
|
24122
|
-
},
|
|
24336
|
+
}, order && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
24337
|
+
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"
|
|
24338
|
+
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
24339
|
+
className: "plc-text-gray-600"
|
|
24340
|
+
}, !Array.isArray(order) ? /*#__PURE__*/React__default['default'].createElement("span", {
|
|
24341
|
+
className: "plc-tracking-wider plc-uppercase"
|
|
24342
|
+
}, order === null || order === void 0 ? void 0 : order.name) : /*#__PURE__*/React__default['default'].createElement("span", {
|
|
24343
|
+
className: "plc-tracking-wider plc-uppercase"
|
|
24344
|
+
}, t("labels.freeItems")), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
24345
|
+
className: "plc-text-xl plc-font-semibold plc-text-primary-600"
|
|
24346
|
+
}, (_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", {
|
|
24123
24347
|
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"
|
|
24124
24348
|
}, /*#__PURE__*/React__default['default'].createElement(SvgLock, {
|
|
24125
24349
|
className: "plc-w-5 plc-h-5 plc-mr-1"
|
|
@@ -24135,10 +24359,11 @@ function PaymentMethodView({
|
|
|
24135
24359
|
type: type,
|
|
24136
24360
|
onSuccess: onSuccess,
|
|
24137
24361
|
onGiftRenewalSuccess: onGiftRenewalSuccess,
|
|
24138
|
-
onFailure: onFailure
|
|
24362
|
+
onFailure: onFailure,
|
|
24363
|
+
freeOrders: showOrderButton
|
|
24139
24364
|
}, /*#__PURE__*/React__default['default'].createElement(AlertWithContext, {
|
|
24140
24365
|
className: "plc-mb-2"
|
|
24141
|
-
}), showSubscriptionButton
|
|
24366
|
+
}), 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", {
|
|
24142
24367
|
className: "plc-flex plc-items-start"
|
|
24143
24368
|
}, /*#__PURE__*/React__default['default'].createElement(IncludeFirstName, {
|
|
24144
24369
|
id: "pelcro-input-first-name",
|
|
@@ -26014,6 +26239,19 @@ function SubscriptionManageMembersList(props) {
|
|
|
26014
26239
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgCheckMark, null)
|
|
26015
26240
|
};
|
|
26016
26241
|
}, []);
|
|
26242
|
+
const showMemberData = React.useCallback(member => {
|
|
26243
|
+
var _member$customer, _member$customer2, _member$customer3, _member$customer4;
|
|
26244
|
+
|
|
26245
|
+
let data;
|
|
26246
|
+
|
|
26247
|
+
if ((member === null || member === void 0 ? void 0 : member.status) !== "active") {
|
|
26248
|
+
data = member === null || member === void 0 ? void 0 : member.invitation_email;
|
|
26249
|
+
return data;
|
|
26250
|
+
}
|
|
26251
|
+
|
|
26252
|
+
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) || "-----";
|
|
26253
|
+
return data;
|
|
26254
|
+
}, []);
|
|
26017
26255
|
|
|
26018
26256
|
if (loading) {
|
|
26019
26257
|
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", {
|
|
@@ -26058,10 +26296,10 @@ function SubscriptionManageMembersList(props) {
|
|
|
26058
26296
|
className: `plc-w-full plc-align-middle plc-cursor-pointer accordion-header hover:plc-bg-gray-50 plc-text-center`
|
|
26059
26297
|
}, /*#__PURE__*/React__default['default'].createElement("td", {
|
|
26060
26298
|
className: "plc-truncate plc-text-left",
|
|
26061
|
-
title: member
|
|
26299
|
+
title: showMemberData(member)
|
|
26062
26300
|
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
26063
26301
|
className: "plc-font-semibold plc-text-gray-500"
|
|
26064
|
-
}, member
|
|
26302
|
+
}, showMemberData(member))), /*#__PURE__*/React__default['default'].createElement("td", {
|
|
26065
26303
|
className: "plc-py-2"
|
|
26066
26304
|
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
26067
26305
|
className: `plc-inline-flex plc-p-1 plc-text-xs plc-font-semibold ${getMemberStatus(member).bgColor} plc-uppercase ${getMemberStatus(member).textColor} plc-rounded-lg`
|
|
@@ -29738,6 +29976,14 @@ const OrderCreateContainer = props => /*#__PURE__*/React__default['default'].cre
|
|
|
29738
29976
|
}, props));
|
|
29739
29977
|
|
|
29740
29978
|
const OrderCreateView = props => {
|
|
29979
|
+
var _window$Pelcro, _window$Pelcro$uiSett;
|
|
29980
|
+
|
|
29981
|
+
useTranslation("payment");
|
|
29982
|
+
const {
|
|
29983
|
+
order
|
|
29984
|
+
} = usePelcro();
|
|
29985
|
+
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;
|
|
29986
|
+
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));
|
|
29741
29987
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
29742
29988
|
id: "pelcro-order-create-view"
|
|
29743
29989
|
}, /*#__PURE__*/React__default['default'].createElement("form", {
|
|
@@ -29746,7 +29992,9 @@ const OrderCreateView = props => {
|
|
|
29746
29992
|
}, /*#__PURE__*/React__default['default'].createElement(PaymentMethodView, Object.assign({
|
|
29747
29993
|
type: "orderCreate",
|
|
29748
29994
|
showCoupon: true,
|
|
29749
|
-
showExternalPaymentMethods: false
|
|
29995
|
+
showExternalPaymentMethods: false,
|
|
29996
|
+
showOrderButton: showOrderButton,
|
|
29997
|
+
order: order
|
|
29750
29998
|
}, props))));
|
|
29751
29999
|
};
|
|
29752
30000
|
|
|
@@ -31029,17 +31277,18 @@ const PaymentMethodSelectModal = ({
|
|
|
31029
31277
|
}) => {
|
|
31030
31278
|
var _window$Pelcro, _window$Pelcro$uiSett;
|
|
31031
31279
|
|
|
31280
|
+
const {
|
|
31281
|
+
t
|
|
31282
|
+
} = useTranslation("paymentMethod");
|
|
31032
31283
|
const {
|
|
31033
31284
|
switchToCheckoutForm,
|
|
31034
31285
|
set,
|
|
31035
|
-
plan
|
|
31286
|
+
plan,
|
|
31287
|
+
order
|
|
31036
31288
|
} = usePelcro();
|
|
31037
|
-
const {
|
|
31038
|
-
t
|
|
31039
|
-
} = useTranslation("paymentMethod");
|
|
31040
31289
|
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;
|
|
31041
31290
|
React.useEffect(() => {
|
|
31042
|
-
if (skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0) {
|
|
31291
|
+
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || (order === null || order === void 0 ? void 0 : order.price) === 0)) {
|
|
31043
31292
|
switchToCheckoutForm();
|
|
31044
31293
|
}
|
|
31045
31294
|
}, []);
|
|
@@ -38964,6 +39213,7 @@ exports.NewsletterUpdateView = NewsletterUpdateView;
|
|
|
38964
39213
|
exports.Notification = Notification;
|
|
38965
39214
|
exports.OrderConfirmModal = OrderConfirmModal;
|
|
38966
39215
|
exports.OrderCreateContainer = OrderCreateContainer;
|
|
39216
|
+
exports.OrderCreateFreeButton = OrderCreateFreeButton;
|
|
38967
39217
|
exports.OrderCreateModal = OrderCreateModal;
|
|
38968
39218
|
exports.OrderCreateSubmitButton = OrderCreateSubmitButton;
|
|
38969
39219
|
exports.OrderCreateView = OrderCreateView;
|