@pelcro/react-pelcro-js 3.10.1-beta.2 → 3.10.1-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +107 -102
- package/dist/index.esm.js +107 -102
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -10531,35 +10531,38 @@ const showInvoiceDetailsFromUrl = () => {
|
|
|
10531
10531
|
isAuthenticated,
|
|
10532
10532
|
setInvoice,
|
|
10533
10533
|
whenUserReady,
|
|
10534
|
+
whenSiteReady,
|
|
10534
10535
|
switchView
|
|
10535
10536
|
} = usePelcro.getStore();
|
|
10536
|
-
|
|
10537
|
-
const invoiceId = window.Pelcro.helpers.getURLParameter("id");
|
|
10538
|
-
const wasSetSuccessfully = setInvoice(invoiceId);
|
|
10539
|
-
|
|
10540
|
-
if (!wasSetSuccessfully) {
|
|
10541
|
-
const errorMessage = i18next.t("messages:invalidInvoice", {
|
|
10542
|
-
returnObjects: true
|
|
10543
|
-
});
|
|
10544
|
-
return notify.error(errorMessage);
|
|
10545
|
-
}
|
|
10546
|
-
|
|
10537
|
+
whenSiteReady(() => {
|
|
10547
10538
|
if (!isAuthenticated()) {
|
|
10548
10539
|
return switchView("login");
|
|
10549
10540
|
}
|
|
10550
10541
|
|
|
10551
|
-
|
|
10552
|
-
|
|
10553
|
-
|
|
10542
|
+
whenUserReady(() => {
|
|
10543
|
+
const invoiceId = window.Pelcro.helpers.getURLParameter("id");
|
|
10544
|
+
const wasSetSuccessfully = setInvoice(invoiceId);
|
|
10554
10545
|
|
|
10555
|
-
|
|
10556
|
-
|
|
10557
|
-
|
|
10558
|
-
|
|
10559
|
-
|
|
10560
|
-
|
|
10546
|
+
if (!wasSetSuccessfully) {
|
|
10547
|
+
const errorMessage = i18next.t("messages:invalidInvoice", {
|
|
10548
|
+
returnObjects: true
|
|
10549
|
+
});
|
|
10550
|
+
return notify.error(errorMessage);
|
|
10551
|
+
}
|
|
10552
|
+
|
|
10553
|
+
const {
|
|
10554
|
+
invoice
|
|
10555
|
+
} = usePelcro.getStore();
|
|
10556
|
+
|
|
10557
|
+
if (invoice.total === 0) {
|
|
10558
|
+
const errorMessage = i18next.t("messages:zeroTotalInvoice", {
|
|
10559
|
+
returnObjects: true
|
|
10560
|
+
});
|
|
10561
|
+
return notify.error(errorMessage);
|
|
10562
|
+
}
|
|
10561
10563
|
|
|
10562
|
-
|
|
10564
|
+
return switchView("invoice-details");
|
|
10565
|
+
});
|
|
10563
10566
|
});
|
|
10564
10567
|
};
|
|
10565
10568
|
|
|
@@ -12239,17 +12242,18 @@ function LoginModal({
|
|
|
12239
12242
|
const onSuccess = res => {
|
|
12240
12243
|
var _props$onSuccess;
|
|
12241
12244
|
|
|
12242
|
-
(_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
|
|
12243
|
-
|
|
12244
|
-
if (invoice) {
|
|
12245
|
-
switchView("invoice-details");
|
|
12246
|
-
}
|
|
12245
|
+
(_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
|
|
12247
12246
|
|
|
12248
12247
|
if (window.Pelcro.paywall.isArticleRestricted()) {
|
|
12249
12248
|
initPaywalls();
|
|
12250
12249
|
}
|
|
12251
12250
|
|
|
12252
12251
|
resetView();
|
|
12252
|
+
const viewFromURL = getStableViewID(window.Pelcro.helpers.getURLParameter("view"));
|
|
12253
|
+
|
|
12254
|
+
if (viewFromURL === "invoice-details") {
|
|
12255
|
+
initViewFromURL();
|
|
12256
|
+
}
|
|
12253
12257
|
};
|
|
12254
12258
|
|
|
12255
12259
|
const onCreateAccountClick = () => {
|
|
@@ -15401,6 +15405,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15401
15405
|
selectedPaymentMethodId,
|
|
15402
15406
|
couponCode
|
|
15403
15407
|
} = usePelcro();
|
|
15408
|
+
const {
|
|
15409
|
+
whenUserReady
|
|
15410
|
+
} = usePelcro.getStore();
|
|
15404
15411
|
const product = (_props$product = props.product) !== null && _props$product !== void 0 ? _props$product : pelcroStore.product;
|
|
15405
15412
|
const plan = (_props$plan = props.plan) !== null && _props$plan !== void 0 ? _props$plan : pelcroStore.plan;
|
|
15406
15413
|
const subscriptionIdToRenew = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : pelcroStore.subscriptionIdToRenew;
|
|
@@ -15409,6 +15416,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15409
15416
|
const isGift = (_props$isGift = props.isGift) !== null && _props$isGift !== void 0 ? _props$isGift : pelcroStore.isGift;
|
|
15410
15417
|
const isRenewingGift = (_props$isRenewingGift = props.isRenewingGift) !== null && _props$isRenewingGift !== void 0 ? _props$isRenewingGift : pelcroStore.isRenewingGift;
|
|
15411
15418
|
const invoice = (_props$invoice = props.invoice) !== null && _props$invoice !== void 0 ? _props$invoice : pelcroStore.invoice;
|
|
15419
|
+
const cardProcessor = getSiteCardProcessor();
|
|
15412
15420
|
React.useEffect(() => {
|
|
15413
15421
|
if (window.Pelcro.coupon.getFromUrl()) {
|
|
15414
15422
|
dispatch({
|
|
@@ -15682,6 +15690,52 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15682
15690
|
}
|
|
15683
15691
|
}
|
|
15684
15692
|
}
|
|
15693
|
+
|
|
15694
|
+
const initTapScript = () => {
|
|
15695
|
+
var _window$Pelcro$site$r;
|
|
15696
|
+
|
|
15697
|
+
const tapKey = window.Tapjsli((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tap_gateway_settings.publishable_key);
|
|
15698
|
+
let elements = tapKey.elements({});
|
|
15699
|
+
let style = {
|
|
15700
|
+
base: {
|
|
15701
|
+
color: "#535353",
|
|
15702
|
+
lineHeight: "18px",
|
|
15703
|
+
fontFamily: "sans-serif",
|
|
15704
|
+
fontSmoothing: "antialiased",
|
|
15705
|
+
fontSize: "16px",
|
|
15706
|
+
"::placeholder": {
|
|
15707
|
+
color: "rgba(0, 0, 0, 0.26)",
|
|
15708
|
+
fontSize: "15px"
|
|
15709
|
+
}
|
|
15710
|
+
},
|
|
15711
|
+
invalid: {
|
|
15712
|
+
color: "red"
|
|
15713
|
+
}
|
|
15714
|
+
}; // input labels/placeholders
|
|
15715
|
+
|
|
15716
|
+
let labels = {
|
|
15717
|
+
cardNumber: "Card Number",
|
|
15718
|
+
expirationDate: "MM/YY",
|
|
15719
|
+
cvv: "CVV",
|
|
15720
|
+
cardHolder: "Card Holder Name"
|
|
15721
|
+
}; //payment options
|
|
15722
|
+
|
|
15723
|
+
let paymentOptions = {
|
|
15724
|
+
labels: labels,
|
|
15725
|
+
TextDirection: "ltr"
|
|
15726
|
+
}; //create element, pass style and payment options
|
|
15727
|
+
|
|
15728
|
+
let card = elements.create("card", {
|
|
15729
|
+
style: style
|
|
15730
|
+
}, paymentOptions); //mount element
|
|
15731
|
+
|
|
15732
|
+
card.mount("#tapPaymentIframe"); //card change event listener
|
|
15733
|
+
|
|
15734
|
+
card.addEventListener("change", function (event) {//If needed
|
|
15735
|
+
});
|
|
15736
|
+
tapInstanceRef.current = tapKey;
|
|
15737
|
+
tapInstanceCard.current = card;
|
|
15738
|
+
};
|
|
15685
15739
|
/*====== End Tap integration ========*/
|
|
15686
15740
|
|
|
15687
15741
|
|
|
@@ -15864,13 +15918,11 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15864
15918
|
const tapInstanceRef = React__default['default'].useRef(null);
|
|
15865
15919
|
const tapInstanceCard = React__default['default'].useRef(null);
|
|
15866
15920
|
React.useEffect(() => {
|
|
15867
|
-
const cardProcessor = getSiteCardProcessor();
|
|
15868
|
-
|
|
15869
15921
|
if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
|
|
15870
|
-
var _window$Pelcro$site$
|
|
15922
|
+
var _window$Pelcro$site$r2, _window$Pelcro$site$r3;
|
|
15871
15923
|
|
|
15872
|
-
const payPageId = (_window$Pelcro$site$
|
|
15873
|
-
const reportGroup = (_window$Pelcro$site$
|
|
15924
|
+
const payPageId = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.vantiv_gateway_settings.pay_page_id;
|
|
15925
|
+
const reportGroup = (_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.vantiv_gateway_settings.report_group;
|
|
15874
15926
|
vantivInstanceRef.current = new window.EprotectIframeClient({
|
|
15875
15927
|
paypageId: payPageId,
|
|
15876
15928
|
reportGroup: reportGroup,
|
|
@@ -15892,72 +15944,21 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15892
15944
|
}
|
|
15893
15945
|
});
|
|
15894
15946
|
}
|
|
15947
|
+
}, [selectedPaymentMethodId]);
|
|
15948
|
+
React.useEffect(() => {
|
|
15949
|
+
whenUserReady(() => {
|
|
15950
|
+
if (cardProcessor === "tap" && !window.Tapjsli) {
|
|
15951
|
+
window.Pelcro.helpers.loadSDK("https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js", "tap-bluebird");
|
|
15952
|
+
window.Pelcro.helpers.loadSDK("https://secure.gosell.io/js/sdk/tap.min.js", "tap-sdk");
|
|
15953
|
+
document.querySelector('script[src="https://secure.gosell.io/js/sdk/tap.min.js"]').addEventListener("load", () => {
|
|
15954
|
+
initTapScript();
|
|
15955
|
+
});
|
|
15956
|
+
}
|
|
15895
15957
|
|
|
15896
|
-
|
|
15897
|
-
|
|
15898
|
-
|
|
15899
|
-
|
|
15900
|
-
let elements = tapKey.elements({});
|
|
15901
|
-
let style = {
|
|
15902
|
-
base: {
|
|
15903
|
-
color: "#535353",
|
|
15904
|
-
lineHeight: "18px",
|
|
15905
|
-
fontFamily: "sans-serif",
|
|
15906
|
-
fontSmoothing: "antialiased",
|
|
15907
|
-
fontSize: "16px",
|
|
15908
|
-
"::placeholder": {
|
|
15909
|
-
color: "rgba(0, 0, 0, 0.26)",
|
|
15910
|
-
fontSize: "15px"
|
|
15911
|
-
}
|
|
15912
|
-
},
|
|
15913
|
-
invalid: {
|
|
15914
|
-
color: "red"
|
|
15915
|
-
}
|
|
15916
|
-
}; // input labels/placeholders
|
|
15917
|
-
|
|
15918
|
-
let labels = {
|
|
15919
|
-
cardNumber: "Card Number",
|
|
15920
|
-
expirationDate: "MM/YY",
|
|
15921
|
-
cvv: "CVV",
|
|
15922
|
-
cardHolder: "Card Holder Name"
|
|
15923
|
-
}; //payment options
|
|
15924
|
-
|
|
15925
|
-
let paymentOptions = {
|
|
15926
|
-
labels: labels,
|
|
15927
|
-
TextDirection: "ltr"
|
|
15928
|
-
}; //create element, pass style and payment options
|
|
15929
|
-
|
|
15930
|
-
let card = elements.create("card", {
|
|
15931
|
-
style: style
|
|
15932
|
-
}, paymentOptions); //mount element
|
|
15933
|
-
|
|
15934
|
-
card.mount("#tapPaymentIframe"); //card change event listener
|
|
15935
|
-
|
|
15936
|
-
card.addEventListener("change", function (event) {// if (event.error_interactive) {
|
|
15937
|
-
// onFailure(event.error_interactive);
|
|
15938
|
-
// return dispatch({
|
|
15939
|
-
// type: SHOW_ALERT,
|
|
15940
|
-
// payload: {
|
|
15941
|
-
// type: "error",
|
|
15942
|
-
// content: getErrorMessages(event.error_interactive)
|
|
15943
|
-
// }
|
|
15944
|
-
// });
|
|
15945
|
-
// } else {
|
|
15946
|
-
// dispatch({
|
|
15947
|
-
// type: SHOW_ALERT,
|
|
15948
|
-
// payload: { type: "error", content: "" }
|
|
15949
|
-
// });
|
|
15950
|
-
// }
|
|
15951
|
-
// let displayError = document.getElementById("error-handler");
|
|
15952
|
-
// if (event.error) {
|
|
15953
|
-
// displayError.textContent = event.error.message;
|
|
15954
|
-
// } else {
|
|
15955
|
-
// displayError.textContent = "";
|
|
15956
|
-
// }
|
|
15957
|
-
});
|
|
15958
|
-
tapInstanceRef.current = tapKey;
|
|
15959
|
-
tapInstanceCard.current = card;
|
|
15960
|
-
}
|
|
15958
|
+
if (cardProcessor === "tap" && !selectedPaymentMethodId && window.Tapjsli) {
|
|
15959
|
+
initTapScript();
|
|
15960
|
+
}
|
|
15961
|
+
});
|
|
15961
15962
|
}, [selectedPaymentMethodId]);
|
|
15962
15963
|
|
|
15963
15964
|
const initPaymentRequest = (state, dispatch) => {
|
|
@@ -16079,7 +16080,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
16079
16080
|
|
|
16080
16081
|
if (err) {
|
|
16081
16082
|
onFailure(err);
|
|
16082
|
-
console.error(err);
|
|
16083
16083
|
dispatch({
|
|
16084
16084
|
type: SET_COUPON_ERROR,
|
|
16085
16085
|
payload: getErrorMessages(err)
|
|
@@ -17081,12 +17081,17 @@ const UnwrappedForm = es_12(PaymentMethodContainerWithoutStripe);
|
|
|
17081
17081
|
|
|
17082
17082
|
const PaymentMethodContainer = props => {
|
|
17083
17083
|
const [isStripeLoaded, setIsStripeLoaded] = React.useState(Boolean(window.Stripe));
|
|
17084
|
+
const {
|
|
17085
|
+
whenUserReady
|
|
17086
|
+
} = usePelcro.getStore();
|
|
17084
17087
|
React.useEffect(() => {
|
|
17085
|
-
|
|
17086
|
-
|
|
17087
|
-
|
|
17088
|
-
|
|
17089
|
-
|
|
17088
|
+
whenUserReady(() => {
|
|
17089
|
+
if (!window.Stripe) {
|
|
17090
|
+
document.querySelector('script[src="https://js.stripe.com/v3"]').addEventListener("load", () => {
|
|
17091
|
+
setIsStripeLoaded(true);
|
|
17092
|
+
});
|
|
17093
|
+
}
|
|
17094
|
+
});
|
|
17090
17095
|
}, []);
|
|
17091
17096
|
|
|
17092
17097
|
if (isStripeLoaded) {
|
package/dist/index.esm.js
CHANGED
|
@@ -10501,35 +10501,38 @@ const showInvoiceDetailsFromUrl = () => {
|
|
|
10501
10501
|
isAuthenticated,
|
|
10502
10502
|
setInvoice,
|
|
10503
10503
|
whenUserReady,
|
|
10504
|
+
whenSiteReady,
|
|
10504
10505
|
switchView
|
|
10505
10506
|
} = usePelcro.getStore();
|
|
10506
|
-
|
|
10507
|
-
const invoiceId = window.Pelcro.helpers.getURLParameter("id");
|
|
10508
|
-
const wasSetSuccessfully = setInvoice(invoiceId);
|
|
10509
|
-
|
|
10510
|
-
if (!wasSetSuccessfully) {
|
|
10511
|
-
const errorMessage = i18next.t("messages:invalidInvoice", {
|
|
10512
|
-
returnObjects: true
|
|
10513
|
-
});
|
|
10514
|
-
return notify.error(errorMessage);
|
|
10515
|
-
}
|
|
10516
|
-
|
|
10507
|
+
whenSiteReady(() => {
|
|
10517
10508
|
if (!isAuthenticated()) {
|
|
10518
10509
|
return switchView("login");
|
|
10519
10510
|
}
|
|
10520
10511
|
|
|
10521
|
-
|
|
10522
|
-
|
|
10523
|
-
|
|
10512
|
+
whenUserReady(() => {
|
|
10513
|
+
const invoiceId = window.Pelcro.helpers.getURLParameter("id");
|
|
10514
|
+
const wasSetSuccessfully = setInvoice(invoiceId);
|
|
10524
10515
|
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
|
|
10530
|
-
|
|
10516
|
+
if (!wasSetSuccessfully) {
|
|
10517
|
+
const errorMessage = i18next.t("messages:invalidInvoice", {
|
|
10518
|
+
returnObjects: true
|
|
10519
|
+
});
|
|
10520
|
+
return notify.error(errorMessage);
|
|
10521
|
+
}
|
|
10522
|
+
|
|
10523
|
+
const {
|
|
10524
|
+
invoice
|
|
10525
|
+
} = usePelcro.getStore();
|
|
10526
|
+
|
|
10527
|
+
if (invoice.total === 0) {
|
|
10528
|
+
const errorMessage = i18next.t("messages:zeroTotalInvoice", {
|
|
10529
|
+
returnObjects: true
|
|
10530
|
+
});
|
|
10531
|
+
return notify.error(errorMessage);
|
|
10532
|
+
}
|
|
10531
10533
|
|
|
10532
|
-
|
|
10534
|
+
return switchView("invoice-details");
|
|
10535
|
+
});
|
|
10533
10536
|
});
|
|
10534
10537
|
};
|
|
10535
10538
|
|
|
@@ -12209,17 +12212,18 @@ function LoginModal({
|
|
|
12209
12212
|
const onSuccess = res => {
|
|
12210
12213
|
var _props$onSuccess;
|
|
12211
12214
|
|
|
12212
|
-
(_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
|
|
12213
|
-
|
|
12214
|
-
if (invoice) {
|
|
12215
|
-
switchView("invoice-details");
|
|
12216
|
-
}
|
|
12215
|
+
(_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 ? void 0 : _props$onSuccess.call(props, res);
|
|
12217
12216
|
|
|
12218
12217
|
if (window.Pelcro.paywall.isArticleRestricted()) {
|
|
12219
12218
|
initPaywalls();
|
|
12220
12219
|
}
|
|
12221
12220
|
|
|
12222
12221
|
resetView();
|
|
12222
|
+
const viewFromURL = getStableViewID(window.Pelcro.helpers.getURLParameter("view"));
|
|
12223
|
+
|
|
12224
|
+
if (viewFromURL === "invoice-details") {
|
|
12225
|
+
initViewFromURL();
|
|
12226
|
+
}
|
|
12223
12227
|
};
|
|
12224
12228
|
|
|
12225
12229
|
const onCreateAccountClick = () => {
|
|
@@ -15371,6 +15375,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15371
15375
|
selectedPaymentMethodId,
|
|
15372
15376
|
couponCode
|
|
15373
15377
|
} = usePelcro();
|
|
15378
|
+
const {
|
|
15379
|
+
whenUserReady
|
|
15380
|
+
} = usePelcro.getStore();
|
|
15374
15381
|
const product = (_props$product = props.product) !== null && _props$product !== void 0 ? _props$product : pelcroStore.product;
|
|
15375
15382
|
const plan = (_props$plan = props.plan) !== null && _props$plan !== void 0 ? _props$plan : pelcroStore.plan;
|
|
15376
15383
|
const subscriptionIdToRenew = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : pelcroStore.subscriptionIdToRenew;
|
|
@@ -15379,6 +15386,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15379
15386
|
const isGift = (_props$isGift = props.isGift) !== null && _props$isGift !== void 0 ? _props$isGift : pelcroStore.isGift;
|
|
15380
15387
|
const isRenewingGift = (_props$isRenewingGift = props.isRenewingGift) !== null && _props$isRenewingGift !== void 0 ? _props$isRenewingGift : pelcroStore.isRenewingGift;
|
|
15381
15388
|
const invoice = (_props$invoice = props.invoice) !== null && _props$invoice !== void 0 ? _props$invoice : pelcroStore.invoice;
|
|
15389
|
+
const cardProcessor = getSiteCardProcessor();
|
|
15382
15390
|
useEffect(() => {
|
|
15383
15391
|
if (window.Pelcro.coupon.getFromUrl()) {
|
|
15384
15392
|
dispatch({
|
|
@@ -15652,6 +15660,52 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15652
15660
|
}
|
|
15653
15661
|
}
|
|
15654
15662
|
}
|
|
15663
|
+
|
|
15664
|
+
const initTapScript = () => {
|
|
15665
|
+
var _window$Pelcro$site$r;
|
|
15666
|
+
|
|
15667
|
+
const tapKey = window.Tapjsli((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tap_gateway_settings.publishable_key);
|
|
15668
|
+
let elements = tapKey.elements({});
|
|
15669
|
+
let style = {
|
|
15670
|
+
base: {
|
|
15671
|
+
color: "#535353",
|
|
15672
|
+
lineHeight: "18px",
|
|
15673
|
+
fontFamily: "sans-serif",
|
|
15674
|
+
fontSmoothing: "antialiased",
|
|
15675
|
+
fontSize: "16px",
|
|
15676
|
+
"::placeholder": {
|
|
15677
|
+
color: "rgba(0, 0, 0, 0.26)",
|
|
15678
|
+
fontSize: "15px"
|
|
15679
|
+
}
|
|
15680
|
+
},
|
|
15681
|
+
invalid: {
|
|
15682
|
+
color: "red"
|
|
15683
|
+
}
|
|
15684
|
+
}; // input labels/placeholders
|
|
15685
|
+
|
|
15686
|
+
let labels = {
|
|
15687
|
+
cardNumber: "Card Number",
|
|
15688
|
+
expirationDate: "MM/YY",
|
|
15689
|
+
cvv: "CVV",
|
|
15690
|
+
cardHolder: "Card Holder Name"
|
|
15691
|
+
}; //payment options
|
|
15692
|
+
|
|
15693
|
+
let paymentOptions = {
|
|
15694
|
+
labels: labels,
|
|
15695
|
+
TextDirection: "ltr"
|
|
15696
|
+
}; //create element, pass style and payment options
|
|
15697
|
+
|
|
15698
|
+
let card = elements.create("card", {
|
|
15699
|
+
style: style
|
|
15700
|
+
}, paymentOptions); //mount element
|
|
15701
|
+
|
|
15702
|
+
card.mount("#tapPaymentIframe"); //card change event listener
|
|
15703
|
+
|
|
15704
|
+
card.addEventListener("change", function (event) {//If needed
|
|
15705
|
+
});
|
|
15706
|
+
tapInstanceRef.current = tapKey;
|
|
15707
|
+
tapInstanceCard.current = card;
|
|
15708
|
+
};
|
|
15655
15709
|
/*====== End Tap integration ========*/
|
|
15656
15710
|
|
|
15657
15711
|
|
|
@@ -15834,13 +15888,11 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15834
15888
|
const tapInstanceRef = React__default.useRef(null);
|
|
15835
15889
|
const tapInstanceCard = React__default.useRef(null);
|
|
15836
15890
|
useEffect(() => {
|
|
15837
|
-
const cardProcessor = getSiteCardProcessor();
|
|
15838
|
-
|
|
15839
15891
|
if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
|
|
15840
|
-
var _window$Pelcro$site$
|
|
15892
|
+
var _window$Pelcro$site$r2, _window$Pelcro$site$r3;
|
|
15841
15893
|
|
|
15842
|
-
const payPageId = (_window$Pelcro$site$
|
|
15843
|
-
const reportGroup = (_window$Pelcro$site$
|
|
15894
|
+
const payPageId = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.vantiv_gateway_settings.pay_page_id;
|
|
15895
|
+
const reportGroup = (_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.vantiv_gateway_settings.report_group;
|
|
15844
15896
|
vantivInstanceRef.current = new window.EprotectIframeClient({
|
|
15845
15897
|
paypageId: payPageId,
|
|
15846
15898
|
reportGroup: reportGroup,
|
|
@@ -15862,72 +15914,21 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15862
15914
|
}
|
|
15863
15915
|
});
|
|
15864
15916
|
}
|
|
15917
|
+
}, [selectedPaymentMethodId]);
|
|
15918
|
+
useEffect(() => {
|
|
15919
|
+
whenUserReady(() => {
|
|
15920
|
+
if (cardProcessor === "tap" && !window.Tapjsli) {
|
|
15921
|
+
window.Pelcro.helpers.loadSDK("https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js", "tap-bluebird");
|
|
15922
|
+
window.Pelcro.helpers.loadSDK("https://secure.gosell.io/js/sdk/tap.min.js", "tap-sdk");
|
|
15923
|
+
document.querySelector('script[src="https://secure.gosell.io/js/sdk/tap.min.js"]').addEventListener("load", () => {
|
|
15924
|
+
initTapScript();
|
|
15925
|
+
});
|
|
15926
|
+
}
|
|
15865
15927
|
|
|
15866
|
-
|
|
15867
|
-
|
|
15868
|
-
|
|
15869
|
-
|
|
15870
|
-
let elements = tapKey.elements({});
|
|
15871
|
-
let style = {
|
|
15872
|
-
base: {
|
|
15873
|
-
color: "#535353",
|
|
15874
|
-
lineHeight: "18px",
|
|
15875
|
-
fontFamily: "sans-serif",
|
|
15876
|
-
fontSmoothing: "antialiased",
|
|
15877
|
-
fontSize: "16px",
|
|
15878
|
-
"::placeholder": {
|
|
15879
|
-
color: "rgba(0, 0, 0, 0.26)",
|
|
15880
|
-
fontSize: "15px"
|
|
15881
|
-
}
|
|
15882
|
-
},
|
|
15883
|
-
invalid: {
|
|
15884
|
-
color: "red"
|
|
15885
|
-
}
|
|
15886
|
-
}; // input labels/placeholders
|
|
15887
|
-
|
|
15888
|
-
let labels = {
|
|
15889
|
-
cardNumber: "Card Number",
|
|
15890
|
-
expirationDate: "MM/YY",
|
|
15891
|
-
cvv: "CVV",
|
|
15892
|
-
cardHolder: "Card Holder Name"
|
|
15893
|
-
}; //payment options
|
|
15894
|
-
|
|
15895
|
-
let paymentOptions = {
|
|
15896
|
-
labels: labels,
|
|
15897
|
-
TextDirection: "ltr"
|
|
15898
|
-
}; //create element, pass style and payment options
|
|
15899
|
-
|
|
15900
|
-
let card = elements.create("card", {
|
|
15901
|
-
style: style
|
|
15902
|
-
}, paymentOptions); //mount element
|
|
15903
|
-
|
|
15904
|
-
card.mount("#tapPaymentIframe"); //card change event listener
|
|
15905
|
-
|
|
15906
|
-
card.addEventListener("change", function (event) {// if (event.error_interactive) {
|
|
15907
|
-
// onFailure(event.error_interactive);
|
|
15908
|
-
// return dispatch({
|
|
15909
|
-
// type: SHOW_ALERT,
|
|
15910
|
-
// payload: {
|
|
15911
|
-
// type: "error",
|
|
15912
|
-
// content: getErrorMessages(event.error_interactive)
|
|
15913
|
-
// }
|
|
15914
|
-
// });
|
|
15915
|
-
// } else {
|
|
15916
|
-
// dispatch({
|
|
15917
|
-
// type: SHOW_ALERT,
|
|
15918
|
-
// payload: { type: "error", content: "" }
|
|
15919
|
-
// });
|
|
15920
|
-
// }
|
|
15921
|
-
// let displayError = document.getElementById("error-handler");
|
|
15922
|
-
// if (event.error) {
|
|
15923
|
-
// displayError.textContent = event.error.message;
|
|
15924
|
-
// } else {
|
|
15925
|
-
// displayError.textContent = "";
|
|
15926
|
-
// }
|
|
15927
|
-
});
|
|
15928
|
-
tapInstanceRef.current = tapKey;
|
|
15929
|
-
tapInstanceCard.current = card;
|
|
15930
|
-
}
|
|
15928
|
+
if (cardProcessor === "tap" && !selectedPaymentMethodId && window.Tapjsli) {
|
|
15929
|
+
initTapScript();
|
|
15930
|
+
}
|
|
15931
|
+
});
|
|
15931
15932
|
}, [selectedPaymentMethodId]);
|
|
15932
15933
|
|
|
15933
15934
|
const initPaymentRequest = (state, dispatch) => {
|
|
@@ -16049,7 +16050,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
16049
16050
|
|
|
16050
16051
|
if (err) {
|
|
16051
16052
|
onFailure(err);
|
|
16052
|
-
console.error(err);
|
|
16053
16053
|
dispatch({
|
|
16054
16054
|
type: SET_COUPON_ERROR,
|
|
16055
16055
|
payload: getErrorMessages(err)
|
|
@@ -17051,12 +17051,17 @@ const UnwrappedForm = es_12(PaymentMethodContainerWithoutStripe);
|
|
|
17051
17051
|
|
|
17052
17052
|
const PaymentMethodContainer = props => {
|
|
17053
17053
|
const [isStripeLoaded, setIsStripeLoaded] = useState(Boolean(window.Stripe));
|
|
17054
|
+
const {
|
|
17055
|
+
whenUserReady
|
|
17056
|
+
} = usePelcro.getStore();
|
|
17054
17057
|
useEffect(() => {
|
|
17055
|
-
|
|
17056
|
-
|
|
17057
|
-
|
|
17058
|
-
|
|
17059
|
-
|
|
17058
|
+
whenUserReady(() => {
|
|
17059
|
+
if (!window.Stripe) {
|
|
17060
|
+
document.querySelector('script[src="https://js.stripe.com/v3"]').addEventListener("load", () => {
|
|
17061
|
+
setIsStripeLoaded(true);
|
|
17062
|
+
});
|
|
17063
|
+
}
|
|
17064
|
+
});
|
|
17060
17065
|
}, []);
|
|
17061
17066
|
|
|
17062
17067
|
if (isStripeLoaded) {
|