@pelcro/react-pelcro-js 3.7.1 → 3.8.1-beta.1
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 +799 -149
- package/dist/index.esm.js +799 -149
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -4935,7 +4935,8 @@ var messages$h = {
|
|
|
4935
4935
|
successfully: "avec succès.",
|
|
4936
4936
|
sourceUpdated: "Vos informations de paiement ont été mises à jour",
|
|
4937
4937
|
cardAuthFailed: "Nous ne parvenons pas à authentifier votre mode de paiement. Veuillez choisir un autre mode de paiement et essayer à nouveau.",
|
|
4938
|
-
cardAuthNotSupported: "Votre carte ne peut être mise à jour puisqu'elle nécessite une authentification. Veuillez utiliser un autre mode de paiement ou contacter le service client."
|
|
4938
|
+
cardAuthNotSupported: "Votre carte ne peut être mise à jour puisqu'elle nécessite une authentification. Veuillez utiliser un autre mode de paiement ou contacter le service client.",
|
|
4939
|
+
tryAgainFromInvoice: "Nous n'avons pas pu authentifier votre paiement, mais votre abonnement a été créé. Veuillez essayer de payer la facture en utilisant un autre mode de paiement depuis le tableau de bord."
|
|
4939
4940
|
};
|
|
4940
4941
|
var errors$2 = {
|
|
4941
4942
|
"": ""
|
|
@@ -4975,7 +4976,8 @@ var messages$g = {
|
|
|
4975
4976
|
successfully: "successfully",
|
|
4976
4977
|
sourceUpdated: "Your payment information has been updated",
|
|
4977
4978
|
cardAuthFailed: "We are unable to authenticate your payment method. Please choose a different payment method and try again.",
|
|
4978
|
-
cardAuthNotSupported: "Updating your payment method to one that requires authentication is currently not possible. Please use a different payment method or contact customer service."
|
|
4979
|
+
cardAuthNotSupported: "Updating your payment method to one that requires authentication is currently not possible. Please use a different payment method or contact customer service.",
|
|
4980
|
+
tryAgainFromInvoice: "We were unable to authenticate your payment, however your subscription was created. Please attempt to pay for the invoice using another payment method from the dashboard."
|
|
4979
4981
|
};
|
|
4980
4982
|
var errors$1 = {
|
|
4981
4983
|
"": ""
|
|
@@ -5015,7 +5017,8 @@ var messages$f = {
|
|
|
5015
5017
|
successfully: "님께 성공적으로 전송되었습니다.",
|
|
5016
5018
|
sourceUpdated: "귀하의 결제 정보가 업데이트되었습니다.",
|
|
5017
5019
|
cardAuthFailed: "해당 결제 수단은 인증할 수 없습니다. 다른 결제 수단을 선택하여 다시 시도해보시기 바랍니다.",
|
|
5018
|
-
cardAuthNotSupported: "인증이 요구되는 결제 수단으로의 업데이트는 현재 지원되지 않습니다. 다른 결제 수단을 이용하거나 고객센터로 문의하시기 바랍니다."
|
|
5020
|
+
cardAuthNotSupported: "인증이 요구되는 결제 수단으로의 업데이트는 현재 지원되지 않습니다. 다른 결제 수단을 이용하거나 고객센터로 문의하시기 바랍니다.",
|
|
5021
|
+
tryAgainFromInvoice: "결제를 인증할 수 없지만 구독이 생성되었습니다. 대시보드에서 다른 결제 수단을 사용하여 인보이스 결제를 시도하세요."
|
|
5019
5022
|
};
|
|
5020
5023
|
var errors = {
|
|
5021
5024
|
"": ""
|
|
@@ -5038,7 +5041,8 @@ var labels$h = {
|
|
|
5038
5041
|
active: "Active",
|
|
5039
5042
|
inTrial: "In trial",
|
|
5040
5043
|
endingSoon: "Ending soon",
|
|
5041
|
-
scheduled: "Scheduled"
|
|
5044
|
+
scheduled: "Scheduled",
|
|
5045
|
+
incomplete: "Incomplete"
|
|
5042
5046
|
},
|
|
5043
5047
|
shipments: "Shipments remaining",
|
|
5044
5048
|
logout: "Logout",
|
|
@@ -5138,9 +5142,10 @@ var labels$g = {
|
|
|
5138
5142
|
status: {
|
|
5139
5143
|
title: "Statut",
|
|
5140
5144
|
active: "Active",
|
|
5141
|
-
inTrial: "
|
|
5142
|
-
endingSoon: "
|
|
5143
|
-
scheduled: "Programmé"
|
|
5145
|
+
inTrial: "En essai",
|
|
5146
|
+
endingSoon: "Expire bientôt",
|
|
5147
|
+
scheduled: "Programmé",
|
|
5148
|
+
incomplete: "Incomplet"
|
|
5144
5149
|
},
|
|
5145
5150
|
shipments: "Expéditions restantes",
|
|
5146
5151
|
logout: "Déconnexion",
|
|
@@ -5242,7 +5247,8 @@ var labels$f = {
|
|
|
5242
5247
|
active: "활성화",
|
|
5243
5248
|
inTrial: "체험판 사용",
|
|
5244
5249
|
endingSoon: "만료 예정",
|
|
5245
|
-
scheduled: "예약"
|
|
5250
|
+
scheduled: "예약",
|
|
5251
|
+
incomplete: "불완전한"
|
|
5246
5252
|
},
|
|
5247
5253
|
shipments: "남은 배송 일정",
|
|
5248
5254
|
logout: "로그아웃",
|
|
@@ -7399,7 +7405,7 @@ class PelcroActions {
|
|
|
7399
7405
|
});
|
|
7400
7406
|
});
|
|
7401
7407
|
|
|
7402
|
-
_defineProperty$3(this, "logout", () => {
|
|
7408
|
+
_defineProperty$3(this, "logout", (displayLogin = true) => {
|
|
7403
7409
|
var _ReactGA$event;
|
|
7404
7410
|
|
|
7405
7411
|
const {
|
|
@@ -7419,7 +7425,10 @@ class PelcroActions {
|
|
|
7419
7425
|
nonInteraction: true
|
|
7420
7426
|
});
|
|
7421
7427
|
resetView();
|
|
7422
|
-
|
|
7428
|
+
|
|
7429
|
+
if (displayLogin) {
|
|
7430
|
+
switchView("login");
|
|
7431
|
+
}
|
|
7423
7432
|
});
|
|
7424
7433
|
|
|
7425
7434
|
_defineProperty$3(this, "addToCart", itemSkuId => {
|
|
@@ -7921,10 +7930,8 @@ const getEntitlementsFromElem = elem => {
|
|
|
7921
7930
|
return elem.dataset.pelcroEntitlements.split(",").map(entitlement => entitlement.trim()).filter(entitlement => entitlement);
|
|
7922
7931
|
};
|
|
7923
7932
|
const getPaymentCardIcon$1 = name => {
|
|
7924
|
-
var _icons$name;
|
|
7925
|
-
|
|
7926
7933
|
const icons = {
|
|
7927
|
-
|
|
7934
|
+
visa: /*#__PURE__*/React__default['default'].createElement("svg", {
|
|
7928
7935
|
className: "plc-w-16",
|
|
7929
7936
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7930
7937
|
viewBox: "0 0 48 48"
|
|
@@ -7935,7 +7942,7 @@ const getPaymentCardIcon$1 = name => {
|
|
|
7935
7942
|
fill: "#FFC107",
|
|
7936
7943
|
d: "M12.212,24.945l-0.966-4.748c0,0-0.437-1.029-1.573-1.029c-1.136,0-4.44,0-4.44,0S10.894,20.84,12.212,24.945z"
|
|
7937
7944
|
})),
|
|
7938
|
-
|
|
7945
|
+
mastercard: /*#__PURE__*/React__default['default'].createElement("svg", {
|
|
7939
7946
|
className: "plc-w-16",
|
|
7940
7947
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7941
7948
|
viewBox: "0 0 48 48"
|
|
@@ -7949,7 +7956,7 @@ const getPaymentCardIcon$1 = name => {
|
|
|
7949
7956
|
fill: "#ff3d00",
|
|
7950
7957
|
d: "M18,24c0,4.755,2.376,8.95,6,11.48c3.624-2.53,6-6.725,6-11.48s-2.376-8.95-6-11.48 C20.376,15.05,18,19.245,18,24z"
|
|
7951
7958
|
})),
|
|
7952
|
-
"
|
|
7959
|
+
"american express": /*#__PURE__*/React__default['default'].createElement("svg", {
|
|
7953
7960
|
className: "plc-w-16",
|
|
7954
7961
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7955
7962
|
viewBox: "0 0 48 48"
|
|
@@ -7961,7 +7968,7 @@ const getPaymentCardIcon$1 = name => {
|
|
|
7961
7968
|
d: "M22.255 20l-2.113 4.683L18.039 20h-2.695v6.726L12.341 20h-2.274L7 26.981h1.815l.671-1.558h3.432l.682 1.558h3.465v-5.185l2.299 5.185h1.563l2.351-5.095v5.095H25V20H22.255zM10.135 23.915l1.026-2.44 1.066 2.44H10.135zM37.883 23.413L41 20.018h-2.217l-1.994 2.164L34.86 20H28v6.982h6.635l2.092-2.311L38.767 27h2.21L37.883 23.413zM33.728 25.516h-4.011v-1.381h3.838v-1.323h-3.838v-1.308l4.234.012 1.693 1.897L33.728 25.516z"
|
|
7962
7969
|
}))
|
|
7963
7970
|
};
|
|
7964
|
-
return
|
|
7971
|
+
return name ? icons[name.toLowerCase()] : /*#__PURE__*/React__default['default'].createElement("svg", {
|
|
7965
7972
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7966
7973
|
className: "plc-w-16",
|
|
7967
7974
|
fill: "none",
|
|
@@ -9972,12 +9979,16 @@ const debounce = (func, waitTime) => {
|
|
|
9972
9979
|
};
|
|
9973
9980
|
};
|
|
9974
9981
|
function getSiteCardProcessor() {
|
|
9975
|
-
var _window$Pelcro$site$r;
|
|
9982
|
+
var _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
9976
9983
|
|
|
9977
9984
|
if ((_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.vantiv_gateway_settings) {
|
|
9978
9985
|
return "vantiv";
|
|
9979
9986
|
}
|
|
9980
9987
|
|
|
9988
|
+
if ((_window$Pelcro$site$r2 = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r2 !== void 0 && _window$Pelcro$site$r2.tap_gateway_settings) {
|
|
9989
|
+
return "tap";
|
|
9990
|
+
}
|
|
9991
|
+
|
|
9981
9992
|
return "stripe";
|
|
9982
9993
|
}
|
|
9983
9994
|
|
|
@@ -10083,6 +10094,14 @@ const loadPaymentSDKs = () => {
|
|
|
10083
10094
|
const scriptUrlToUse = window.Pelcro.site.read().vantiv_gateway_settings.environment === "production" ? PRODUCTION_URL : PRELIVE_URL;
|
|
10084
10095
|
window.Pelcro.helpers.loadSDK(scriptUrlToUse, "vantiv-eprotect-sdk");
|
|
10085
10096
|
}
|
|
10097
|
+
} // Load Tap SDKs
|
|
10098
|
+
|
|
10099
|
+
|
|
10100
|
+
const supportsTap = Boolean(window.Pelcro.site.read().tap_gateway_settings);
|
|
10101
|
+
|
|
10102
|
+
if (supportsTap) {
|
|
10103
|
+
window.Pelcro.helpers.loadSDK("https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js", "tap-bluebird");
|
|
10104
|
+
window.Pelcro.helpers.loadSDK("https://secure.gosell.io/js/sdk/tap.min.js", "tap-sdk");
|
|
10086
10105
|
}
|
|
10087
10106
|
};
|
|
10088
10107
|
const loadAuth0SDK = () => {
|
|
@@ -14195,7 +14214,7 @@ var _generateUserError = /*#__PURE__*/new WeakMap();
|
|
|
14195
14214
|
|
|
14196
14215
|
class Payment {
|
|
14197
14216
|
/**
|
|
14198
|
-
* @param {(StripeGateway|PaypalGateway|VantivGateway)} paymentGateway
|
|
14217
|
+
* @param {(StripeGateway|PaypalGateway|VantivGateway|TapGateway)} paymentGateway
|
|
14199
14218
|
*/
|
|
14200
14219
|
constructor(paymentGateway) {
|
|
14201
14220
|
_defineProperty$3(this, "execute", (options, callback) => {
|
|
@@ -14216,7 +14235,7 @@ class Payment {
|
|
|
14216
14235
|
_isPaymentGatewayInvalid.set(this, {
|
|
14217
14236
|
writable: true,
|
|
14218
14237
|
value: gateway => {
|
|
14219
|
-
return gateway && !(gateway instanceof StripeGateway || gateway instanceof PaypalGateway || gateway instanceof VantivGateway);
|
|
14238
|
+
return gateway && !(gateway instanceof StripeGateway || gateway instanceof PaypalGateway || gateway instanceof VantivGateway || gateway instanceof TapGateway);
|
|
14220
14239
|
}
|
|
14221
14240
|
});
|
|
14222
14241
|
|
|
@@ -14271,7 +14290,8 @@ class Payment {
|
|
|
14271
14290
|
const PAYMENT_GATEWAYS_ENUM = {
|
|
14272
14291
|
stripe: "stripe",
|
|
14273
14292
|
paypal: "braintree",
|
|
14274
|
-
vantiv: "vantiv"
|
|
14293
|
+
vantiv: "vantiv",
|
|
14294
|
+
tap: "tap"
|
|
14275
14295
|
};
|
|
14276
14296
|
/**
|
|
14277
14297
|
* Payment Strategies
|
|
@@ -14839,6 +14859,241 @@ class VantivGateway {
|
|
|
14839
14859
|
|
|
14840
14860
|
}
|
|
14841
14861
|
|
|
14862
|
+
var _paymentGateway4 = /*#__PURE__*/new WeakMap();
|
|
14863
|
+
|
|
14864
|
+
var _createSubscription4 = /*#__PURE__*/new WeakMap();
|
|
14865
|
+
|
|
14866
|
+
var _renewSubscription3 = /*#__PURE__*/new WeakMap();
|
|
14867
|
+
|
|
14868
|
+
var _createGiftedSubscription4 = /*#__PURE__*/new WeakMap();
|
|
14869
|
+
|
|
14870
|
+
var _renewGiftedSubscription3 = /*#__PURE__*/new WeakMap();
|
|
14871
|
+
|
|
14872
|
+
var _purchaseEcommerceOrder3 = /*#__PURE__*/new WeakMap();
|
|
14873
|
+
|
|
14874
|
+
var _payInvoice4 = /*#__PURE__*/new WeakMap();
|
|
14875
|
+
|
|
14876
|
+
class TapGateway {
|
|
14877
|
+
constructor() {
|
|
14878
|
+
_paymentGateway4.set(this, {
|
|
14879
|
+
writable: true,
|
|
14880
|
+
value: PAYMENT_GATEWAYS_ENUM["tap"]
|
|
14881
|
+
});
|
|
14882
|
+
|
|
14883
|
+
_defineProperty$3(this, "execute", (options, callback) => {
|
|
14884
|
+
const types = PAYMENT_TYPES;
|
|
14885
|
+
|
|
14886
|
+
switch (options.type) {
|
|
14887
|
+
case types.CREATE_SUBSCRIPTION:
|
|
14888
|
+
return _classPrivateFieldGet(this, _createSubscription4).call(this, options, callback);
|
|
14889
|
+
|
|
14890
|
+
case types.RENEW_SUBSCRIPTION:
|
|
14891
|
+
return _classPrivateFieldGet(this, _renewSubscription3).call(this, options, callback);
|
|
14892
|
+
|
|
14893
|
+
case types.CREATE_GIFTED_SUBSCRIPTION:
|
|
14894
|
+
return _classPrivateFieldGet(this, _createGiftedSubscription4).call(this, options, callback);
|
|
14895
|
+
|
|
14896
|
+
case types.RENEW_GIFTED_SUBSCRIPTION:
|
|
14897
|
+
return _classPrivateFieldGet(this, _renewGiftedSubscription3).call(this, options, callback);
|
|
14898
|
+
|
|
14899
|
+
case types.PURCHASE_ECOMMERCE_ORDER:
|
|
14900
|
+
return _classPrivateFieldGet(this, _purchaseEcommerceOrder3).call(this, options, callback);
|
|
14901
|
+
|
|
14902
|
+
case types.PAY_INVOICE:
|
|
14903
|
+
return _classPrivateFieldGet(this, _payInvoice4).call(this, options, callback);
|
|
14904
|
+
|
|
14905
|
+
default:
|
|
14906
|
+
console.error("Unsupported payment method: tap Gateway");
|
|
14907
|
+
}
|
|
14908
|
+
});
|
|
14909
|
+
|
|
14910
|
+
_createSubscription4.set(this, {
|
|
14911
|
+
writable: true,
|
|
14912
|
+
value: (options, callback) => {
|
|
14913
|
+
const {
|
|
14914
|
+
token,
|
|
14915
|
+
plan,
|
|
14916
|
+
couponCode,
|
|
14917
|
+
product,
|
|
14918
|
+
quantity = 1,
|
|
14919
|
+
addressId,
|
|
14920
|
+
isExistingSource
|
|
14921
|
+
} = options;
|
|
14922
|
+
const params = isExistingSource ? {
|
|
14923
|
+
source_id: token
|
|
14924
|
+
} : {
|
|
14925
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway4),
|
|
14926
|
+
gateway_token: token
|
|
14927
|
+
};
|
|
14928
|
+
window.Pelcro.subscription.create({
|
|
14929
|
+
quantity,
|
|
14930
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
14931
|
+
plan_id: plan.id,
|
|
14932
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
14933
|
+
coupon_code: couponCode,
|
|
14934
|
+
address_id: product.address_required ? addressId : null,
|
|
14935
|
+
...params
|
|
14936
|
+
}, (err, res) => {
|
|
14937
|
+
callback(err, res);
|
|
14938
|
+
});
|
|
14939
|
+
}
|
|
14940
|
+
});
|
|
14941
|
+
|
|
14942
|
+
_renewSubscription3.set(this, {
|
|
14943
|
+
writable: true,
|
|
14944
|
+
value: (options, callback) => {
|
|
14945
|
+
const {
|
|
14946
|
+
subscriptionIdToRenew,
|
|
14947
|
+
token,
|
|
14948
|
+
plan,
|
|
14949
|
+
couponCode,
|
|
14950
|
+
product,
|
|
14951
|
+
addressId,
|
|
14952
|
+
isExistingSource
|
|
14953
|
+
} = options;
|
|
14954
|
+
const params = isExistingSource ? {
|
|
14955
|
+
source_id: token
|
|
14956
|
+
} : {
|
|
14957
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway4),
|
|
14958
|
+
gateway_token: token
|
|
14959
|
+
};
|
|
14960
|
+
window.Pelcro.subscription.renew({
|
|
14961
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
14962
|
+
plan_id: plan.id,
|
|
14963
|
+
coupon_code: couponCode,
|
|
14964
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
14965
|
+
subscription_id: subscriptionIdToRenew,
|
|
14966
|
+
address_id: product.address_required ? addressId : null,
|
|
14967
|
+
...params
|
|
14968
|
+
}, (err, res) => {
|
|
14969
|
+
callback(err, res);
|
|
14970
|
+
});
|
|
14971
|
+
}
|
|
14972
|
+
});
|
|
14973
|
+
|
|
14974
|
+
_createGiftedSubscription4.set(this, {
|
|
14975
|
+
writable: true,
|
|
14976
|
+
value: (options, callback) => {
|
|
14977
|
+
const {
|
|
14978
|
+
token,
|
|
14979
|
+
plan,
|
|
14980
|
+
couponCode,
|
|
14981
|
+
product,
|
|
14982
|
+
giftRecipient,
|
|
14983
|
+
quantity = 1,
|
|
14984
|
+
addressId,
|
|
14985
|
+
isExistingSource
|
|
14986
|
+
} = options;
|
|
14987
|
+
const params = isExistingSource ? {
|
|
14988
|
+
source_id: token
|
|
14989
|
+
} : {
|
|
14990
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway4),
|
|
14991
|
+
gateway_token: token
|
|
14992
|
+
};
|
|
14993
|
+
window.Pelcro.subscription.create({
|
|
14994
|
+
quantity,
|
|
14995
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
14996
|
+
plan_id: plan.id,
|
|
14997
|
+
coupon_code: couponCode,
|
|
14998
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
14999
|
+
gift_recipient_email: giftRecipient.email,
|
|
15000
|
+
gift_recipient_first_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.firstName,
|
|
15001
|
+
gift_recipient_last_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.lastName,
|
|
15002
|
+
gift_start_date: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.startDate,
|
|
15003
|
+
gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
|
|
15004
|
+
address_id: product.address_required ? addressId : null,
|
|
15005
|
+
...params
|
|
15006
|
+
}, (err, res) => {
|
|
15007
|
+
callback(err, res);
|
|
15008
|
+
});
|
|
15009
|
+
}
|
|
15010
|
+
});
|
|
15011
|
+
|
|
15012
|
+
_renewGiftedSubscription3.set(this, {
|
|
15013
|
+
writable: true,
|
|
15014
|
+
value: (options, callback) => {
|
|
15015
|
+
const {
|
|
15016
|
+
subscriptionIdToRenew,
|
|
15017
|
+
token,
|
|
15018
|
+
product,
|
|
15019
|
+
plan,
|
|
15020
|
+
couponCode,
|
|
15021
|
+
addressId,
|
|
15022
|
+
isExistingSource
|
|
15023
|
+
} = options;
|
|
15024
|
+
const params = isExistingSource ? {
|
|
15025
|
+
source_id: token
|
|
15026
|
+
} : {
|
|
15027
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway4),
|
|
15028
|
+
gateway_token: token
|
|
15029
|
+
};
|
|
15030
|
+
window.Pelcro.subscription.renewGift({
|
|
15031
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
15032
|
+
plan_id: plan.id,
|
|
15033
|
+
coupon_code: couponCode,
|
|
15034
|
+
subscription_id: subscriptionIdToRenew,
|
|
15035
|
+
address_id: product.address_required ? addressId : null,
|
|
15036
|
+
...params
|
|
15037
|
+
}, (err, res) => {
|
|
15038
|
+
callback(err, res);
|
|
15039
|
+
});
|
|
15040
|
+
}
|
|
15041
|
+
});
|
|
15042
|
+
|
|
15043
|
+
_purchaseEcommerceOrder3.set(this, {
|
|
15044
|
+
writable: true,
|
|
15045
|
+
value: (options, callback) => {
|
|
15046
|
+
const {
|
|
15047
|
+
token,
|
|
15048
|
+
items,
|
|
15049
|
+
couponCode,
|
|
15050
|
+
addressId,
|
|
15051
|
+
isExistingSource
|
|
15052
|
+
} = options;
|
|
15053
|
+
const params = isExistingSource ? {
|
|
15054
|
+
source_id: token
|
|
15055
|
+
} : {
|
|
15056
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway4),
|
|
15057
|
+
gateway_token: token
|
|
15058
|
+
};
|
|
15059
|
+
window.Pelcro.ecommerce.order.create({
|
|
15060
|
+
items,
|
|
15061
|
+
coupon_code: couponCode,
|
|
15062
|
+
campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
|
|
15063
|
+
...params,
|
|
15064
|
+
...(addressId && {
|
|
15065
|
+
address_id: addressId
|
|
15066
|
+
})
|
|
15067
|
+
}, (err, res) => {
|
|
15068
|
+
callback(err, res);
|
|
15069
|
+
});
|
|
15070
|
+
}
|
|
15071
|
+
});
|
|
15072
|
+
|
|
15073
|
+
_payInvoice4.set(this, {
|
|
15074
|
+
writable: true,
|
|
15075
|
+
value: (options, callback) => {
|
|
15076
|
+
const {
|
|
15077
|
+
token,
|
|
15078
|
+
invoiceId
|
|
15079
|
+
} = options;
|
|
15080
|
+
const params = options.isExistingSource ? {
|
|
15081
|
+
source_id: token,
|
|
15082
|
+
invoice_id: invoiceId
|
|
15083
|
+
} : {
|
|
15084
|
+
payment_gateway: _classPrivateFieldGet(this, _paymentGateway4),
|
|
15085
|
+
gateway_token: token,
|
|
15086
|
+
invoice_id: invoiceId
|
|
15087
|
+
};
|
|
15088
|
+
window.Pelcro.invoice.pay(params, (err, res) => {
|
|
15089
|
+
callback(err, res);
|
|
15090
|
+
});
|
|
15091
|
+
}
|
|
15092
|
+
});
|
|
15093
|
+
}
|
|
15094
|
+
|
|
15095
|
+
}
|
|
15096
|
+
|
|
14842
15097
|
/**
|
|
14843
15098
|
* @typedef {Object} PaymentStateType
|
|
14844
15099
|
* @property {boolean} disableSubmit
|
|
@@ -14883,55 +15138,324 @@ const {
|
|
|
14883
15138
|
Provider: Provider$j
|
|
14884
15139
|
} = store$j;
|
|
14885
15140
|
|
|
14886
|
-
const PaymentMethodContainerWithoutStripe = ({
|
|
14887
|
-
style,
|
|
14888
|
-
className = "",
|
|
14889
|
-
children,
|
|
14890
|
-
stripe,
|
|
14891
|
-
type,
|
|
14892
|
-
onSuccess = () => {},
|
|
14893
|
-
onGiftRenewalSuccess = () => {},
|
|
14894
|
-
onFailure = () => {},
|
|
14895
|
-
...props
|
|
14896
|
-
}) => {
|
|
14897
|
-
var _props$product, _props$plan, _props$subscriptionId, _props$selectedAddres, _props$giftRecipient, _props$isGift, _props$isRenewingGift, _props$invoice;
|
|
15141
|
+
const PaymentMethodContainerWithoutStripe = ({
|
|
15142
|
+
style,
|
|
15143
|
+
className = "",
|
|
15144
|
+
children,
|
|
15145
|
+
stripe,
|
|
15146
|
+
type,
|
|
15147
|
+
onSuccess = () => {},
|
|
15148
|
+
onGiftRenewalSuccess = () => {},
|
|
15149
|
+
onFailure = () => {},
|
|
15150
|
+
...props
|
|
15151
|
+
}) => {
|
|
15152
|
+
var _props$product, _props$plan, _props$subscriptionId, _props$selectedAddres, _props$giftRecipient, _props$isGift, _props$isRenewingGift, _props$invoice;
|
|
15153
|
+
|
|
15154
|
+
const {
|
|
15155
|
+
t
|
|
15156
|
+
} = useTranslation("payment");
|
|
15157
|
+
const pelcroStore = usePelcro();
|
|
15158
|
+
const {
|
|
15159
|
+
set,
|
|
15160
|
+
order,
|
|
15161
|
+
selectedPaymentMethodId,
|
|
15162
|
+
couponCode
|
|
15163
|
+
} = usePelcro();
|
|
15164
|
+
const product = (_props$product = props.product) !== null && _props$product !== void 0 ? _props$product : pelcroStore.product;
|
|
15165
|
+
const plan = (_props$plan = props.plan) !== null && _props$plan !== void 0 ? _props$plan : pelcroStore.plan;
|
|
15166
|
+
const subscriptionIdToRenew = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : pelcroStore.subscriptionIdToRenew;
|
|
15167
|
+
const selectedAddressId = (_props$selectedAddres = props.selectedAddressId) !== null && _props$selectedAddres !== void 0 ? _props$selectedAddres : pelcroStore.selectedAddressId;
|
|
15168
|
+
const giftRecipient = (_props$giftRecipient = props.giftRecipient) !== null && _props$giftRecipient !== void 0 ? _props$giftRecipient : pelcroStore.giftRecipient;
|
|
15169
|
+
const isGift = (_props$isGift = props.isGift) !== null && _props$isGift !== void 0 ? _props$isGift : pelcroStore.isGift;
|
|
15170
|
+
const isRenewingGift = (_props$isRenewingGift = props.isRenewingGift) !== null && _props$isRenewingGift !== void 0 ? _props$isRenewingGift : pelcroStore.isRenewingGift;
|
|
15171
|
+
const invoice = (_props$invoice = props.invoice) !== null && _props$invoice !== void 0 ? _props$invoice : pelcroStore.invoice;
|
|
15172
|
+
React.useEffect(() => {
|
|
15173
|
+
if (window.Pelcro.coupon.getFromUrl()) {
|
|
15174
|
+
dispatch({
|
|
15175
|
+
type: UPDATE_COUPON_CODE,
|
|
15176
|
+
payload: window.Pelcro.coupon.getFromUrl()
|
|
15177
|
+
});
|
|
15178
|
+
} else if (couponCode) {
|
|
15179
|
+
dispatch({
|
|
15180
|
+
type: UPDATE_COUPON_CODE,
|
|
15181
|
+
payload: couponCode
|
|
15182
|
+
});
|
|
15183
|
+
}
|
|
15184
|
+
|
|
15185
|
+
dispatch({
|
|
15186
|
+
type: INIT_CONTAINER
|
|
15187
|
+
});
|
|
15188
|
+
updateTotalAmountWithTax();
|
|
15189
|
+
}, []);
|
|
15190
|
+
/*====== Start Tap integration ========*/
|
|
15191
|
+
|
|
15192
|
+
const submitUsingTap = () => {
|
|
15193
|
+
var _ref, _ref2, _state$updatedPrice;
|
|
15194
|
+
|
|
15195
|
+
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
15196
|
+
|
|
15197
|
+
if (isUsingExistingPaymentMethod) {
|
|
15198
|
+
// no need to create a new source using tap
|
|
15199
|
+
return handleTapPayment(null);
|
|
15200
|
+
}
|
|
15201
|
+
|
|
15202
|
+
if (!tapInstanceRef.current) {
|
|
15203
|
+
return console.error("Tap sdk script wasn't loaded, you need to load tap sdk before rendering the tap payment flow");
|
|
15204
|
+
}
|
|
15205
|
+
|
|
15206
|
+
const getOrderItemsTotal = () => {
|
|
15207
|
+
if (!order) {
|
|
15208
|
+
return null;
|
|
15209
|
+
}
|
|
15210
|
+
|
|
15211
|
+
const isQuickPurchase = !Array.isArray(order);
|
|
15212
|
+
|
|
15213
|
+
if (isQuickPurchase) {
|
|
15214
|
+
return order.price * order.quantity;
|
|
15215
|
+
}
|
|
15216
|
+
|
|
15217
|
+
if (order.length === 0) {
|
|
15218
|
+
return null;
|
|
15219
|
+
}
|
|
15220
|
+
|
|
15221
|
+
return order.reduce((total, item) => {
|
|
15222
|
+
return total + item.price * item.quantity;
|
|
15223
|
+
}, 0);
|
|
15224
|
+
};
|
|
15225
|
+
|
|
15226
|
+
const totalAmount = (_ref = (_ref2 = (_state$updatedPrice = state === null || state === void 0 ? void 0 : state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref2 !== void 0 ? _ref2 : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining) !== null && _ref !== void 0 ? _ref : getOrderItemsTotal();
|
|
15227
|
+
tapInstanceRef.current.createToken(tapInstanceCard.current).then(function (result) {
|
|
15228
|
+
if (result.error) {
|
|
15229
|
+
// Inform the user if there was an error
|
|
15230
|
+
onFailure(result.error);
|
|
15231
|
+
dispatch({
|
|
15232
|
+
type: DISABLE_SUBMIT,
|
|
15233
|
+
payload: false
|
|
15234
|
+
});
|
|
15235
|
+
dispatch({
|
|
15236
|
+
type: LOADING,
|
|
15237
|
+
payload: false
|
|
15238
|
+
});
|
|
15239
|
+
return dispatch({
|
|
15240
|
+
type: SHOW_ALERT,
|
|
15241
|
+
payload: {
|
|
15242
|
+
type: "error",
|
|
15243
|
+
content: getErrorMessages(result.error)
|
|
15244
|
+
}
|
|
15245
|
+
});
|
|
15246
|
+
} else {
|
|
15247
|
+
console.log("Tap API Call result", result);
|
|
15248
|
+
window.Pelcro.payment.authorize({
|
|
15249
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
15250
|
+
site_id: window.Pelcro.siteid,
|
|
15251
|
+
amount: totalAmount,
|
|
15252
|
+
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,
|
|
15253
|
+
tap_token: result.id,
|
|
15254
|
+
redirect_url: `${window.Pelcro.environment.domain}/webhook/tap/callback/3dsecure?auth_token=${window.Pelcro.user.read().auth_token}`
|
|
15255
|
+
}, (err, res) => {
|
|
15256
|
+
if (err) {
|
|
15257
|
+
// Inform the user if there was an error
|
|
15258
|
+
onFailure(err);
|
|
15259
|
+
dispatch({
|
|
15260
|
+
type: DISABLE_SUBMIT,
|
|
15261
|
+
payload: false
|
|
15262
|
+
});
|
|
15263
|
+
dispatch({
|
|
15264
|
+
type: LOADING,
|
|
15265
|
+
payload: false
|
|
15266
|
+
});
|
|
15267
|
+
return dispatch({
|
|
15268
|
+
type: SHOW_ALERT,
|
|
15269
|
+
payload: {
|
|
15270
|
+
type: "error",
|
|
15271
|
+
content: getErrorMessages(err)
|
|
15272
|
+
}
|
|
15273
|
+
});
|
|
15274
|
+
} else {
|
|
15275
|
+
toggleAuthenticationPendingView(true, res);
|
|
15276
|
+
|
|
15277
|
+
const listenFor3DSecureCompletionMessage = () => {
|
|
15278
|
+
const retrieveSourceInfoFromIframe = event => {
|
|
15279
|
+
const {
|
|
15280
|
+
data
|
|
15281
|
+
} = event;
|
|
15282
|
+
|
|
15283
|
+
if (data.message === "3DS-authentication-complete") {
|
|
15284
|
+
const tapID = data.tapID;
|
|
15285
|
+
toggleAuthenticationPendingView(false);
|
|
15286
|
+
window.removeEventListener("message", retrieveSourceInfoFromIframe);
|
|
15287
|
+
dispatch({
|
|
15288
|
+
type: SHOW_ALERT,
|
|
15289
|
+
payload: {
|
|
15290
|
+
type: "error",
|
|
15291
|
+
content: null
|
|
15292
|
+
}
|
|
15293
|
+
});
|
|
15294
|
+
handleTapPayment(tapID);
|
|
15295
|
+
}
|
|
15296
|
+
}; // listen to injected iframe for authentication complete message
|
|
15297
|
+
|
|
15298
|
+
|
|
15299
|
+
window.addEventListener("message", retrieveSourceInfoFromIframe);
|
|
15300
|
+
};
|
|
15301
|
+
|
|
15302
|
+
listenFor3DSecureCompletionMessage();
|
|
15303
|
+
}
|
|
15304
|
+
});
|
|
15305
|
+
}
|
|
15306
|
+
});
|
|
15307
|
+
};
|
|
15308
|
+
|
|
15309
|
+
function handleTapPayment(paymentRequest) {
|
|
15310
|
+
// if (paymentRequest) {
|
|
15311
|
+
// const SUCCESS_STATUS = "870";
|
|
15312
|
+
// if (paymentRequest.response !== SUCCESS_STATUS) {
|
|
15313
|
+
// switch (paymentRequest.response) {
|
|
15314
|
+
// case "871":
|
|
15315
|
+
// return handlePaymentError({
|
|
15316
|
+
// error: new Error("Invalid account number")
|
|
15317
|
+
// });
|
|
15318
|
+
// default:
|
|
15319
|
+
// return handlePaymentError({
|
|
15320
|
+
// error: new Error(paymentRequest.message)
|
|
15321
|
+
// });
|
|
15322
|
+
// }
|
|
15323
|
+
// }
|
|
15324
|
+
// }
|
|
15325
|
+
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
15326
|
+
|
|
15327
|
+
if (type === "createPayment") {
|
|
15328
|
+
handleTapSubscription();
|
|
15329
|
+
} else if (type === "orderCreate") {
|
|
15330
|
+
purchase(new TapGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
|
|
15331
|
+
} else if (type === "invoicePayment") {
|
|
15332
|
+
payInvoice(new TapGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest);
|
|
15333
|
+
} else if (type === "updatePaymentSource") {
|
|
15334
|
+
createNewTapCard();
|
|
15335
|
+
}
|
|
15336
|
+
|
|
15337
|
+
function createNewTapCard() {
|
|
15338
|
+
window.Pelcro.source.create({
|
|
15339
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
15340
|
+
token: paymentRequest,
|
|
15341
|
+
gateway: "tap"
|
|
15342
|
+
}, (err, res) => {
|
|
15343
|
+
dispatch({
|
|
15344
|
+
type: DISABLE_SUBMIT,
|
|
15345
|
+
payload: false
|
|
15346
|
+
});
|
|
15347
|
+
dispatch({
|
|
15348
|
+
type: LOADING,
|
|
15349
|
+
payload: false
|
|
15350
|
+
});
|
|
15351
|
+
|
|
15352
|
+
if (err) {
|
|
15353
|
+
onFailure(err);
|
|
15354
|
+
return dispatch({
|
|
15355
|
+
type: SHOW_ALERT,
|
|
15356
|
+
payload: {
|
|
15357
|
+
type: "error",
|
|
15358
|
+
content: getErrorMessages(err)
|
|
15359
|
+
}
|
|
15360
|
+
});
|
|
15361
|
+
}
|
|
15362
|
+
|
|
15363
|
+
dispatch({
|
|
15364
|
+
type: SHOW_ALERT,
|
|
15365
|
+
payload: {
|
|
15366
|
+
type: "success",
|
|
15367
|
+
content: t("messages.sourceUpdated")
|
|
15368
|
+
}
|
|
15369
|
+
});
|
|
15370
|
+
onSuccess(res);
|
|
15371
|
+
});
|
|
15372
|
+
}
|
|
15373
|
+
|
|
15374
|
+
function handleTapSubscription() {
|
|
15375
|
+
const payment = new Payment(new TapGateway());
|
|
15376
|
+
const createSubscription = !isGift && !subscriptionIdToRenew;
|
|
15377
|
+
const renewSubscription = !isGift && subscriptionIdToRenew;
|
|
15378
|
+
const giftSubscriprition = isGift && !subscriptionIdToRenew;
|
|
15379
|
+
const renewGift = isRenewingGift;
|
|
15380
|
+
const {
|
|
15381
|
+
couponCode
|
|
15382
|
+
} = state;
|
|
15383
|
+
|
|
15384
|
+
if (renewGift) {
|
|
15385
|
+
return payment.execute({
|
|
15386
|
+
type: PAYMENT_TYPES.RENEW_GIFTED_SUBSCRIPTION,
|
|
15387
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
|
|
15388
|
+
plan,
|
|
15389
|
+
couponCode,
|
|
15390
|
+
product,
|
|
15391
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
15392
|
+
subscriptionIdToRenew,
|
|
15393
|
+
addressId: selectedAddressId
|
|
15394
|
+
}, (err, res) => {
|
|
15395
|
+
if (err) {
|
|
15396
|
+
return handlePaymentError(err);
|
|
15397
|
+
}
|
|
15398
|
+
|
|
15399
|
+
onSuccess(res);
|
|
15400
|
+
});
|
|
15401
|
+
} else if (giftSubscriprition) {
|
|
15402
|
+
return payment.execute({
|
|
15403
|
+
type: PAYMENT_TYPES.CREATE_GIFTED_SUBSCRIPTION,
|
|
15404
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
|
|
15405
|
+
quantity: plan.quantity,
|
|
15406
|
+
plan,
|
|
15407
|
+
couponCode,
|
|
15408
|
+
product,
|
|
15409
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
15410
|
+
giftRecipient,
|
|
15411
|
+
addressId: selectedAddressId
|
|
15412
|
+
}, (err, res) => {
|
|
15413
|
+
if (err) {
|
|
15414
|
+
return handlePaymentError(err);
|
|
15415
|
+
}
|
|
14898
15416
|
|
|
14899
|
-
|
|
14900
|
-
|
|
14901
|
-
|
|
14902
|
-
|
|
14903
|
-
|
|
14904
|
-
|
|
14905
|
-
|
|
14906
|
-
|
|
14907
|
-
|
|
14908
|
-
|
|
14909
|
-
|
|
14910
|
-
|
|
14911
|
-
|
|
14912
|
-
|
|
14913
|
-
|
|
14914
|
-
|
|
14915
|
-
|
|
14916
|
-
|
|
14917
|
-
|
|
14918
|
-
|
|
14919
|
-
|
|
14920
|
-
|
|
14921
|
-
|
|
14922
|
-
|
|
14923
|
-
|
|
14924
|
-
|
|
14925
|
-
|
|
14926
|
-
|
|
14927
|
-
|
|
15417
|
+
onSuccess(res);
|
|
15418
|
+
});
|
|
15419
|
+
} else if (renewSubscription) {
|
|
15420
|
+
return payment.execute({
|
|
15421
|
+
type: PAYMENT_TYPES.RENEW_SUBSCRIPTION,
|
|
15422
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
|
|
15423
|
+
quantity: plan.quantity,
|
|
15424
|
+
plan,
|
|
15425
|
+
couponCode,
|
|
15426
|
+
product,
|
|
15427
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
15428
|
+
subscriptionIdToRenew,
|
|
15429
|
+
addressId: selectedAddressId
|
|
15430
|
+
}, (err, res) => {
|
|
15431
|
+
if (err) {
|
|
15432
|
+
return handlePaymentError(err);
|
|
15433
|
+
}
|
|
15434
|
+
|
|
15435
|
+
onSuccess(res);
|
|
15436
|
+
});
|
|
15437
|
+
} else if (createSubscription) {
|
|
15438
|
+
return payment.execute({
|
|
15439
|
+
type: PAYMENT_TYPES.CREATE_SUBSCRIPTION,
|
|
15440
|
+
token: isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest,
|
|
15441
|
+
quantity: plan.quantity,
|
|
15442
|
+
plan,
|
|
15443
|
+
couponCode,
|
|
15444
|
+
product,
|
|
15445
|
+
isExistingSource: isUsingExistingPaymentMethod,
|
|
15446
|
+
addressId: selectedAddressId
|
|
15447
|
+
}, (err, res) => {
|
|
15448
|
+
if (err) {
|
|
15449
|
+
return handlePaymentError(err);
|
|
15450
|
+
}
|
|
15451
|
+
|
|
15452
|
+
onSuccess(res);
|
|
15453
|
+
});
|
|
15454
|
+
}
|
|
14928
15455
|
}
|
|
15456
|
+
}
|
|
15457
|
+
/*====== End Tap integration ========*/
|
|
14929
15458
|
|
|
14930
|
-
dispatch({
|
|
14931
|
-
type: INIT_CONTAINER
|
|
14932
|
-
});
|
|
14933
|
-
updateTotalAmountWithTax();
|
|
14934
|
-
}, []);
|
|
14935
15459
|
|
|
14936
15460
|
const submitUsingVantiv = () => {
|
|
14937
15461
|
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
@@ -14982,7 +15506,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
14982
15506
|
} else if (type === "orderCreate") {
|
|
14983
15507
|
purchase(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest, state, dispatch);
|
|
14984
15508
|
} else if (type === "invoicePayment") {
|
|
14985
|
-
payInvoice(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest
|
|
15509
|
+
payInvoice(new VantivGateway(), isUsingExistingPaymentMethod ? selectedPaymentMethodId : paymentRequest);
|
|
14986
15510
|
} else if (type === "updatePaymentSource") {
|
|
14987
15511
|
createNewVantivCard();
|
|
14988
15512
|
}
|
|
@@ -15109,6 +15633,8 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15109
15633
|
}
|
|
15110
15634
|
|
|
15111
15635
|
const vantivInstanceRef = React__default['default'].useRef(null);
|
|
15636
|
+
const tapInstanceRef = React__default['default'].useRef(null);
|
|
15637
|
+
const tapInstanceCard = React__default['default'].useRef(null);
|
|
15112
15638
|
React.useEffect(() => {
|
|
15113
15639
|
const cardProcessor = getSiteCardProcessor();
|
|
15114
15640
|
|
|
@@ -15132,10 +15658,78 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15132
15658
|
accountNumber: "1234 1234 1234 1234"
|
|
15133
15659
|
},
|
|
15134
15660
|
enhancedUxFeatures: {
|
|
15135
|
-
inlineFieldValidations: true
|
|
15661
|
+
inlineFieldValidations: true,
|
|
15662
|
+
expDateValidation: true,
|
|
15663
|
+
numericInputsOnly: true
|
|
15136
15664
|
}
|
|
15137
15665
|
});
|
|
15138
15666
|
}
|
|
15667
|
+
|
|
15668
|
+
if (cardProcessor === "tap" && !selectedPaymentMethodId) {
|
|
15669
|
+
var _window$Pelcro$site$r3;
|
|
15670
|
+
|
|
15671
|
+
const tapKey = Tapjsli((_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.tap_gateway_settings.publishable_key);
|
|
15672
|
+
let elements = tapKey.elements({});
|
|
15673
|
+
let style = {
|
|
15674
|
+
base: {
|
|
15675
|
+
color: "#535353",
|
|
15676
|
+
lineHeight: "18px",
|
|
15677
|
+
fontFamily: "sans-serif",
|
|
15678
|
+
fontSmoothing: "antialiased",
|
|
15679
|
+
fontSize: "16px",
|
|
15680
|
+
"::placeholder": {
|
|
15681
|
+
color: "rgba(0, 0, 0, 0.26)",
|
|
15682
|
+
fontSize: "15px"
|
|
15683
|
+
}
|
|
15684
|
+
},
|
|
15685
|
+
invalid: {
|
|
15686
|
+
color: "red"
|
|
15687
|
+
}
|
|
15688
|
+
}; // input labels/placeholders
|
|
15689
|
+
|
|
15690
|
+
let labels = {
|
|
15691
|
+
cardNumber: "Card Number",
|
|
15692
|
+
expirationDate: "MM/YY",
|
|
15693
|
+
cvv: "CVV",
|
|
15694
|
+
cardHolder: "Card Holder Name"
|
|
15695
|
+
}; //payment options
|
|
15696
|
+
|
|
15697
|
+
let paymentOptions = {
|
|
15698
|
+
labels: labels,
|
|
15699
|
+
TextDirection: "ltr"
|
|
15700
|
+
}; //create element, pass style and payment options
|
|
15701
|
+
|
|
15702
|
+
let card = elements.create("card", {
|
|
15703
|
+
style: style
|
|
15704
|
+
}, paymentOptions); //mount element
|
|
15705
|
+
|
|
15706
|
+
card.mount("#tapPaymentIframe"); //card change event listener
|
|
15707
|
+
|
|
15708
|
+
card.addEventListener("change", function (event) {// if (event.error_interactive) {
|
|
15709
|
+
// onFailure(event.error_interactive);
|
|
15710
|
+
// return dispatch({
|
|
15711
|
+
// type: SHOW_ALERT,
|
|
15712
|
+
// payload: {
|
|
15713
|
+
// type: "error",
|
|
15714
|
+
// content: getErrorMessages(event.error_interactive)
|
|
15715
|
+
// }
|
|
15716
|
+
// });
|
|
15717
|
+
// } else {
|
|
15718
|
+
// dispatch({
|
|
15719
|
+
// type: SHOW_ALERT,
|
|
15720
|
+
// payload: { type: "error", content: "" }
|
|
15721
|
+
// });
|
|
15722
|
+
// }
|
|
15723
|
+
// let displayError = document.getElementById("error-handler");
|
|
15724
|
+
// if (event.error) {
|
|
15725
|
+
// displayError.textContent = event.error.message;
|
|
15726
|
+
// } else {
|
|
15727
|
+
// displayError.textContent = "";
|
|
15728
|
+
// }
|
|
15729
|
+
});
|
|
15730
|
+
tapInstanceRef.current = tapKey;
|
|
15731
|
+
tapInstanceCard.current = card;
|
|
15732
|
+
}
|
|
15139
15733
|
}, [selectedPaymentMethodId]);
|
|
15140
15734
|
|
|
15141
15735
|
const initPaymentRequest = (state, dispatch) => {
|
|
@@ -15208,9 +15802,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15208
15802
|
|
|
15209
15803
|
|
|
15210
15804
|
const updateTotalAmountWithTax = () => {
|
|
15211
|
-
var _window$Pelcro$site$
|
|
15805
|
+
var _window$Pelcro$site$r4;
|
|
15212
15806
|
|
|
15213
|
-
const taxesEnabled = (_window$Pelcro$site$
|
|
15807
|
+
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;
|
|
15214
15808
|
|
|
15215
15809
|
if (taxesEnabled && type === "createPayment") {
|
|
15216
15810
|
dispatch({
|
|
@@ -15437,6 +16031,97 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15437
16031
|
updateTotalAmountWithTax();
|
|
15438
16032
|
}
|
|
15439
16033
|
};
|
|
16034
|
+
/**
|
|
16035
|
+
* Attempt to confirm a Stripe card payment via it's PaymentIntent.
|
|
16036
|
+
* Only trigger method if PaymentIntent status is `requires_action`.
|
|
16037
|
+
*
|
|
16038
|
+
* @see https://stripe.com/docs/payments/intents#intent-statuses
|
|
16039
|
+
*
|
|
16040
|
+
* @param response
|
|
16041
|
+
* @param error
|
|
16042
|
+
* @returns {*}
|
|
16043
|
+
*/
|
|
16044
|
+
|
|
16045
|
+
|
|
16046
|
+
const confirmStripeCardPayment = (response, error, isSubCreate = false) => {
|
|
16047
|
+
if (response) {
|
|
16048
|
+
var _response$data;
|
|
16049
|
+
|
|
16050
|
+
const paymentIntent = (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.payment_intent;
|
|
16051
|
+
|
|
16052
|
+
if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_action" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
|
|
16053
|
+
stripe.confirmCardPayment(paymentIntent.client_secret).then(res => {
|
|
16054
|
+
if (!isSubCreate) {
|
|
16055
|
+
dispatch({
|
|
16056
|
+
type: DISABLE_SUBMIT,
|
|
16057
|
+
payload: false
|
|
16058
|
+
});
|
|
16059
|
+
}
|
|
16060
|
+
|
|
16061
|
+
dispatch({
|
|
16062
|
+
type: LOADING,
|
|
16063
|
+
payload: false
|
|
16064
|
+
});
|
|
16065
|
+
|
|
16066
|
+
if (res.error) {
|
|
16067
|
+
onFailure(res.error);
|
|
16068
|
+
return dispatch({
|
|
16069
|
+
type: SHOW_ALERT,
|
|
16070
|
+
payload: {
|
|
16071
|
+
type: "error",
|
|
16072
|
+
content: isSubCreate ? t("messages.tryAgainFromInvoice") : getErrorMessages(res.error)
|
|
16073
|
+
}
|
|
16074
|
+
});
|
|
16075
|
+
}
|
|
16076
|
+
|
|
16077
|
+
onSuccess(res);
|
|
16078
|
+
});
|
|
16079
|
+
} else if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_payment_method" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
|
|
16080
|
+
if (!isSubCreate) {
|
|
16081
|
+
dispatch({
|
|
16082
|
+
type: DISABLE_SUBMIT,
|
|
16083
|
+
payload: false
|
|
16084
|
+
});
|
|
16085
|
+
}
|
|
16086
|
+
|
|
16087
|
+
dispatch({
|
|
16088
|
+
type: LOADING,
|
|
16089
|
+
payload: false
|
|
16090
|
+
});
|
|
16091
|
+
return dispatch({
|
|
16092
|
+
type: SHOW_ALERT,
|
|
16093
|
+
payload: {
|
|
16094
|
+
type: "error",
|
|
16095
|
+
content: isSubCreate ? t("messages.tryAgainFromInvoice") : t("messages.cardAuthFailed")
|
|
16096
|
+
}
|
|
16097
|
+
});
|
|
16098
|
+
} else {
|
|
16099
|
+
onSuccess(response);
|
|
16100
|
+
}
|
|
16101
|
+
} else {
|
|
16102
|
+
dispatch({
|
|
16103
|
+
type: DISABLE_SUBMIT,
|
|
16104
|
+
payload: false
|
|
16105
|
+
});
|
|
16106
|
+
dispatch({
|
|
16107
|
+
type: LOADING,
|
|
16108
|
+
payload: false
|
|
16109
|
+
});
|
|
16110
|
+
|
|
16111
|
+
if (error) {
|
|
16112
|
+
onFailure(error);
|
|
16113
|
+
return dispatch({
|
|
16114
|
+
type: SHOW_ALERT,
|
|
16115
|
+
payload: {
|
|
16116
|
+
type: "error",
|
|
16117
|
+
content: getErrorMessages(error)
|
|
16118
|
+
}
|
|
16119
|
+
});
|
|
16120
|
+
}
|
|
16121
|
+
|
|
16122
|
+
onSuccess(response);
|
|
16123
|
+
}
|
|
16124
|
+
};
|
|
15440
16125
|
|
|
15441
16126
|
const subscribe = (stripeSource, state, dispatch) => {
|
|
15442
16127
|
const {
|
|
@@ -15459,27 +16144,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15459
16144
|
gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
|
|
15460
16145
|
address_id: product.address_required ? selectedAddressId : null
|
|
15461
16146
|
}, (err, res) => {
|
|
15462
|
-
|
|
15463
|
-
type: DISABLE_SUBMIT,
|
|
15464
|
-
payload: false
|
|
15465
|
-
});
|
|
15466
|
-
dispatch({
|
|
15467
|
-
type: LOADING,
|
|
15468
|
-
payload: false
|
|
15469
|
-
});
|
|
15470
|
-
|
|
15471
|
-
if (err) {
|
|
15472
|
-
onFailure(err);
|
|
15473
|
-
return dispatch({
|
|
15474
|
-
type: SHOW_ALERT,
|
|
15475
|
-
payload: {
|
|
15476
|
-
type: "error",
|
|
15477
|
-
content: getErrorMessages(err)
|
|
15478
|
-
}
|
|
15479
|
-
});
|
|
15480
|
-
}
|
|
15481
|
-
|
|
15482
|
-
onSuccess(res);
|
|
16147
|
+
confirmStripeCardPayment(res, err, true);
|
|
15483
16148
|
});
|
|
15484
16149
|
} else {
|
|
15485
16150
|
if (isRenewingGift) {
|
|
@@ -15703,27 +16368,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15703
16368
|
isExistingSource: Boolean(selectedPaymentMethodId),
|
|
15704
16369
|
invoiceId: invoice.id
|
|
15705
16370
|
}, (err, res) => {
|
|
15706
|
-
|
|
15707
|
-
type: DISABLE_SUBMIT,
|
|
15708
|
-
payload: false
|
|
15709
|
-
});
|
|
15710
|
-
dispatch({
|
|
15711
|
-
type: LOADING,
|
|
15712
|
-
payload: false
|
|
15713
|
-
});
|
|
15714
|
-
|
|
15715
|
-
if (err) {
|
|
15716
|
-
onFailure(err);
|
|
15717
|
-
return dispatch({
|
|
15718
|
-
type: SHOW_ALERT,
|
|
15719
|
-
payload: {
|
|
15720
|
-
type: "error",
|
|
15721
|
-
content: getErrorMessages(err)
|
|
15722
|
-
}
|
|
15723
|
-
});
|
|
15724
|
-
}
|
|
15725
|
-
|
|
15726
|
-
onSuccess(res);
|
|
16371
|
+
confirmStripeCardPayment(res, err);
|
|
15727
16372
|
});
|
|
15728
16373
|
};
|
|
15729
16374
|
|
|
@@ -15803,7 +16448,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15803
16448
|
source,
|
|
15804
16449
|
error
|
|
15805
16450
|
}) => {
|
|
15806
|
-
var
|
|
16451
|
+
var _ref3, _ref4, _state$updatedPrice2;
|
|
15807
16452
|
|
|
15808
16453
|
if (error) {
|
|
15809
16454
|
return handlePaymentError(error);
|
|
@@ -15829,25 +16474,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15829
16474
|
}, 0);
|
|
15830
16475
|
};
|
|
15831
16476
|
|
|
15832
|
-
|
|
15833
|
-
|
|
15834
|
-
if ((source === null || source === void 0 ? void 0 : (_source$card3 = source.card) === null || _source$card3 === void 0 ? void 0 : _source$card3.three_d_secure) === "required" && totalAmount > 0) {
|
|
15835
|
-
return resolveTaxCalculation().then(res => {
|
|
15836
|
-
var _res$totalAmountWithT;
|
|
15837
|
-
|
|
15838
|
-
return generate3DSecureSource(source, (_res$totalAmountWithT = res === null || res === void 0 ? void 0 : res.totalAmountWithTax) !== null && _res$totalAmountWithT !== void 0 ? _res$totalAmountWithT : totalAmount).then(({
|
|
15839
|
-
source,
|
|
15840
|
-
error
|
|
15841
|
-
}) => {
|
|
15842
|
-
if (error) {
|
|
15843
|
-
return handlePaymentError(error);
|
|
15844
|
-
}
|
|
15845
|
-
|
|
15846
|
-
toggleAuthenticationPendingView(true, source);
|
|
15847
|
-
});
|
|
15848
|
-
});
|
|
15849
|
-
}
|
|
15850
|
-
|
|
16477
|
+
(_ref3 = (_ref4 = (_state$updatedPrice2 = state === null || state === void 0 ? void 0 : state.updatedPrice) !== null && _state$updatedPrice2 !== void 0 ? _state$updatedPrice2 : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref4 !== void 0 ? _ref4 : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining) !== null && _ref3 !== void 0 ? _ref3 : getOrderItemsTotal();
|
|
15851
16478
|
return handlePayment(source);
|
|
15852
16479
|
}).catch(error => {
|
|
15853
16480
|
return handlePaymentError(error);
|
|
@@ -15860,13 +16487,13 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15860
16487
|
|
|
15861
16488
|
|
|
15862
16489
|
const resolveTaxCalculation = () => {
|
|
15863
|
-
var _window$Pelcro$site$
|
|
16490
|
+
var _window$Pelcro$site$r5;
|
|
15864
16491
|
|
|
15865
16492
|
if (type === "invoicePayment") {
|
|
15866
16493
|
return new Promise(resolve => resolve());
|
|
15867
16494
|
}
|
|
15868
16495
|
|
|
15869
|
-
const taxesEnabled = (_window$Pelcro$site$
|
|
16496
|
+
const taxesEnabled = (_window$Pelcro$site$r5 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r5 === void 0 ? void 0 : _window$Pelcro$site$r5.taxes_enabled;
|
|
15870
16497
|
return new Promise((resolve, reject) => {
|
|
15871
16498
|
// resolve early if taxes isn't enabled
|
|
15872
16499
|
if (!taxesEnabled) {
|
|
@@ -15941,7 +16568,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
15941
16568
|
} else if (stripeSource && type === "orderCreate") {
|
|
15942
16569
|
purchase(new StripeGateway(), stripeSource.id, state, dispatch);
|
|
15943
16570
|
} else if (stripeSource && type === "invoicePayment") {
|
|
15944
|
-
payInvoice(new StripeGateway(), stripeSource.id
|
|
16571
|
+
payInvoice(new StripeGateway(), stripeSource.id);
|
|
15945
16572
|
}
|
|
15946
16573
|
};
|
|
15947
16574
|
|
|
@@ -16018,10 +16645,12 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
16018
16645
|
};
|
|
16019
16646
|
|
|
16020
16647
|
const injectCardAuthenticationIframe = source => {
|
|
16648
|
+
var _source$redirect;
|
|
16649
|
+
|
|
16021
16650
|
const cardAuthContainer = document.querySelector(".card-authentication-container");
|
|
16022
16651
|
const iframe = document.createElement("iframe");
|
|
16023
|
-
iframe.src = source.redirect.url;
|
|
16024
|
-
iframe.style = "position: absolute; width: 100%; height: 100%; left: 0; top:
|
|
16652
|
+
iframe.src = source !== null && source !== void 0 && (_source$redirect = source.redirect) !== null && _source$redirect !== void 0 && _source$redirect.url ? source.redirect.url : source.threeDSecure_url;
|
|
16653
|
+
iframe.style = "position: absolute; width: 100%; height: 100%; left: 0; top: 0; bottom: 0; z-index: 10;";
|
|
16025
16654
|
cardAuthContainer.appendChild(iframe);
|
|
16026
16655
|
};
|
|
16027
16656
|
|
|
@@ -16067,6 +16696,10 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
16067
16696
|
return submitUsingVantiv();
|
|
16068
16697
|
}
|
|
16069
16698
|
|
|
16699
|
+
if (getSiteCardProcessor() === "tap") {
|
|
16700
|
+
return submitUsingTap();
|
|
16701
|
+
}
|
|
16702
|
+
|
|
16070
16703
|
if (selectedPaymentMethodId) {
|
|
16071
16704
|
// pay with selected method (source) if exists already
|
|
16072
16705
|
return handlePayment({
|
|
@@ -16085,7 +16718,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
16085
16718
|
case HANDLE_PAYPAL_SUBSCRIPTION:
|
|
16086
16719
|
return lib_5(state, (state, dispatch) => {
|
|
16087
16720
|
if (type === "invoicePayment") {
|
|
16088
|
-
payInvoice(new PaypalGateway(), action.payload
|
|
16721
|
+
payInvoice(new PaypalGateway(), action.payload);
|
|
16089
16722
|
} else {
|
|
16090
16723
|
handlePaypalSubscription(state, action.payload);
|
|
16091
16724
|
}
|
|
@@ -16280,6 +16913,12 @@ const CheckoutForm = () => {
|
|
|
16280
16913
|
});
|
|
16281
16914
|
}
|
|
16282
16915
|
|
|
16916
|
+
if (cardProcessor === "tap") {
|
|
16917
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
16918
|
+
id: "tapPaymentIframe"
|
|
16919
|
+
});
|
|
16920
|
+
}
|
|
16921
|
+
|
|
16283
16922
|
if (cardProcessor === "stripe") {
|
|
16284
16923
|
return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(PelcroCardNumber, {
|
|
16285
16924
|
autoFocus: true
|
|
@@ -16964,13 +17603,14 @@ function PaymentMethodView({
|
|
|
16964
17603
|
showCoupon,
|
|
16965
17604
|
showExternalPaymentMethods
|
|
16966
17605
|
}) {
|
|
16967
|
-
var _window$Pelcro$site$r;
|
|
17606
|
+
var _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
16968
17607
|
|
|
16969
17608
|
const {
|
|
16970
17609
|
t
|
|
16971
17610
|
} = useTranslation("checkoutForm");
|
|
16972
17611
|
const cardProcessor = getSiteCardProcessor();
|
|
16973
17612
|
const supportsVantiv = Boolean((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.vantiv_gateway_settings);
|
|
17613
|
+
Boolean((_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.tap_gateway_settings);
|
|
16974
17614
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
16975
17615
|
className: "plc-flex plc-flex-col plc-items-center plc-mt-4 sm:plc-px-8 pelcro-payment-block"
|
|
16976
17616
|
}, cardProcessor === "stripe" && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -17922,9 +18562,7 @@ class DefaultNewsLetter extends React.Component {
|
|
|
17922
18562
|
});
|
|
17923
18563
|
|
|
17924
18564
|
_defineProperty$3(this, "postSubmit", () => {
|
|
17925
|
-
|
|
17926
|
-
|
|
17927
|
-
window.Pelcro.paywall.decrementPageViewFrequency((_this$product = this.product) === null || _this$product === void 0 ? void 0 : (_this$product$paywall = _this$product.paywall) === null || _this$product$paywall === void 0 ? void 0 : _this$product$paywall.newsletter_extra_visits, (_this$product2 = this.product) === null || _this$product2 === void 0 ? void 0 : (_this$product2$paywal = _this$product2.paywall) === null || _this$product2$paywal === void 0 ? void 0 : _this$product2$paywal.frequency_limit);
|
|
18565
|
+
window.Pelcro.paywall.setNewsletterExtraVisits(true);
|
|
17928
18566
|
this.props.setView("meter");
|
|
17929
18567
|
});
|
|
17930
18568
|
|
|
@@ -24214,10 +24852,8 @@ var GroupContext = /*#__PURE__*/React.createContext(null);
|
|
|
24214
24852
|
GroupContext.displayName = 'GroupContext';
|
|
24215
24853
|
|
|
24216
24854
|
const getPaymentCardIcon = name => {
|
|
24217
|
-
var _icons$name;
|
|
24218
|
-
|
|
24219
24855
|
const icons = {
|
|
24220
|
-
|
|
24856
|
+
visa: /*#__PURE__*/React__default['default'].createElement("svg", {
|
|
24221
24857
|
className: "plc-w-12",
|
|
24222
24858
|
fill: "#ffffff",
|
|
24223
24859
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -24225,7 +24861,7 @@ const getPaymentCardIcon = name => {
|
|
|
24225
24861
|
}, /*#__PURE__*/React__default['default'].createElement("path", {
|
|
24226
24862
|
d: "M 5 7 C 2.25 7 0 9.25 0 12 L 0 38 C 0 40.75 2.25 43 5 43 L 45 43 C 47.75 43 50 40.75 50 38 L 50 12 C 50 9.25 47.75 7 45 7 Z M 5 9 L 45 9 C 46.667969 9 48 10.332031 48 12 L 48 38 C 48 39.667969 46.667969 41 45 41 L 5 41 C 3.332031 41 2 39.667969 2 38 L 2 12 C 2 10.332031 3.332031 9 5 9 Z M 29.6875 19.40625 C 26.585938 19.40625 25 20.933594 25 22.875 C 25 26.386719 29.0625 25.914063 29.0625 27.71875 C 29.0625 28.023438 28.828125 28.75 27.125 28.75 C 25.417969 28.75 24.3125 28.09375 24.3125 28.09375 L 23.78125 30.46875 C 23.78125 30.46875 24.886719 31.09375 27 31.09375 C 29.113281 31.09375 32.03125 29.476563 32.03125 27.125 C 32.03125 24.296875 27.96875 24.074219 27.96875 22.8125 C 27.96875 22.167969 28.46875 21.6875 29.9375 21.6875 C 30.890625 21.6875 31.96875 22.40625 31.96875 22.40625 L 32.46875 19.96875 C 32.46875 19.96875 31.050781 19.40625 29.6875 19.40625 Z M 16.46875 19.625 L 13.78125 27.5625 C 13.78125 27.5625 13.597656 26.886719 13.53125 26.46875 C 11.996094 23.023438 9.5 21.75 9.5 21.75 L 11.875 30.75 L 15.125 30.75 L 19.625 19.625 Z M 20.78125 19.625 L 19.03125 30.75 L 22 30.75 L 23.78125 19.625 Z M 36.8125 19.625 L 31.96875 30.75 L 34.90625 30.75 L 35.5 29.15625 L 39.1875 29.15625 L 39.5 30.75 L 42.1875 30.75 L 39.90625 19.625 Z M 6.25 19.65625 C 6.25 19.65625 12.054688 21.453125 13.40625 25.8125 L 12.40625 20.75 C 12.40625 20.75 11.976563 19.65625 10.8125 19.65625 Z M 37.9375 22.84375 L 38.75 27.03125 L 36.3125 27.03125 Z"
|
|
24227
24863
|
})),
|
|
24228
|
-
|
|
24864
|
+
mastercard: /*#__PURE__*/React__default['default'].createElement("svg", {
|
|
24229
24865
|
className: "plc-w-12",
|
|
24230
24866
|
fill: "#ffffff",
|
|
24231
24867
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -24233,7 +24869,7 @@ const getPaymentCardIcon = name => {
|
|
|
24233
24869
|
}, /*#__PURE__*/React__default['default'].createElement("path", {
|
|
24234
24870
|
d: "M 5 7 C 2.25 7 0 9.25 0 12 L 0 38 C 0 40.75 2.25 43 5 43 L 45 43 C 47.75 43 50 40.75 50 38 L 50 12 C 50 9.25 47.75 7 45 7 Z M 5 9 L 45 9 C 46.667969 9 48 10.332031 48 12 L 48 38 C 48 39.667969 46.667969 41 45 41 L 5 41 C 3.332031 41 2 39.667969 2 38 L 2 12 C 2 10.332031 3.332031 9 5 9 Z M 17 13 C 10.382812 13 5 18.382812 5 25 C 5 31.617188 10.382812 37 17 37 C 20.078125 37 22.875 35.816406 25 33.90625 C 27.125 35.816406 29.925781 37 33 37 C 39.617188 37 45 31.617188 45 25 C 45 18.382812 39.617188 13 33 13 C 29.925781 13 27.125 14.183594 25 16.09375 C 22.875 14.183594 20.078125 13 17 13 Z M 33 15 C 38.535156 15 43 19.464844 43 25 C 43 30.535156 38.535156 35 33 35 C 30.449219 35 28.109375 34.066406 26.34375 32.5 C 27.996094 30.441406 29 27.839844 29 25 C 29 22.160156 27.996094 19.558594 26.34375 17.5 C 28.109375 15.933594 30.449219 15 33 15 Z M 33 15 "
|
|
24235
24871
|
})),
|
|
24236
|
-
"
|
|
24872
|
+
"american express": /*#__PURE__*/React__default['default'].createElement("svg", {
|
|
24237
24873
|
className: "plc-w-12",
|
|
24238
24874
|
fill: "#ffffff",
|
|
24239
24875
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -24242,7 +24878,7 @@ const getPaymentCardIcon = name => {
|
|
|
24242
24878
|
d: "M 5 7 C 2.25 7 0 9.25 0 12 L 0 38 C 0 40.75 2.25 43 5 43 L 45 43 C 47.75 43 50 40.75 50 38 L 50 12 C 50 9.25 47.75 7 45 7 Z M 5 9 L 45 9 C 46.667969 9 48 10.332031 48 12 L 48 38 C 48 39.667969 46.667969 41 45 41 L 5 41 C 3.332031 41 2 39.667969 2 38 L 2 12 C 2 10.332031 3.332031 9 5 9 Z M 8.5625 19.90625 L 4.84375 28.40625 L 7.0625 28.40625 L 7.875 26.5 L 12.0625 26.5 L 12.875 28.40625 L 17.09375 28.40625 L 17.09375 22.09375 L 19.90625 28.40625 L 21.8125 28.40625 L 24.65625 22.1875 L 24.65625 28.40625 L 26.75 28.40625 L 26.75 19.90625 L 23.40625 19.90625 L 20.84375 25.625 L 18.28125 19.90625 L 15 19.90625 L 15 28.09375 L 11.34375 19.90625 Z M 29.5 19.90625 L 29.5 28.4375 L 37.5 28.4375 L 40 25.59375 L 42.46875 28.4375 L 45.125 28.4375 L 41.375 24.0625 L 45.125 19.90625 L 42.46875 19.90625 L 40.0625 22.5625 L 37.75 19.90625 Z M 9.90625 21.6875 L 11.21875 24.6875 L 8.65625 24.6875 Z M 31.5625 21.71875 L 36.65625 21.75 L 38.6875 24.0625 L 36.40625 26.625 L 31.5625 26.625 L 31.5625 24.9375 L 36.1875 24.9375 L 36.1875 23.3125 L 31.5625 23.3125 Z"
|
|
24243
24879
|
}))
|
|
24244
24880
|
};
|
|
24245
|
-
return
|
|
24881
|
+
return name ? icons[name.toLowerCase()] : /*#__PURE__*/React__default['default'].createElement("svg", {
|
|
24246
24882
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24247
24883
|
className: "plc-w-12",
|
|
24248
24884
|
fill: "none",
|
|
@@ -24740,7 +25376,7 @@ const SubscriptionsItems = ({
|
|
|
24740
25376
|
onClick: onReactivateClick,
|
|
24741
25377
|
disabled: disableSubmit,
|
|
24742
25378
|
"data-key": sub.id
|
|
24743
|
-
}, t("labels.reactivate")), sub.cancel_at_period_end === 1 && /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
25379
|
+
}, t("labels.reactivate")), sub.cancel_at_period_end === 1 && sub.status !== "incomplete" && /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
24744
25380
|
variant: "ghost",
|
|
24745
25381
|
className: "plc-text-blue-400 pelcro-dashboard-sub-renew-button",
|
|
24746
25382
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgRefresh, null),
|
|
@@ -25571,6 +26207,10 @@ class Dashboard extends React.Component {
|
|
|
25571
26207
|
return `${this.locale("labels.canceledOn")} ${formattedCancelDate}`;
|
|
25572
26208
|
}
|
|
25573
26209
|
|
|
26210
|
+
if (subscription.status === "incomplete") {
|
|
26211
|
+
return `${this.locale("labels.status.incomplete")}`;
|
|
26212
|
+
}
|
|
26213
|
+
|
|
25574
26214
|
if (subscription.cancel_at_period_end) {
|
|
25575
26215
|
// DateTime from BE is missing 3 zeros so we add them before instancing a date
|
|
25576
26216
|
const expiryDate = new Date(Number(`${subscription.expires_at}000`));
|
|
@@ -25636,6 +26276,16 @@ class Dashboard extends React.Component {
|
|
|
25636
26276
|
};
|
|
25637
26277
|
}
|
|
25638
26278
|
|
|
26279
|
+
if (sub.status === "incomplete") {
|
|
26280
|
+
return {
|
|
26281
|
+
title: this.locale("labels.status.incomplete"),
|
|
26282
|
+
content: this.getSubscriptionStatusText(sub),
|
|
26283
|
+
textColor: "plc-text-orange-700",
|
|
26284
|
+
bgColor: "plc-bg-orange-100",
|
|
26285
|
+
icon: /*#__PURE__*/React__default['default'].createElement(SvgExclamation, null)
|
|
26286
|
+
};
|
|
26287
|
+
}
|
|
26288
|
+
|
|
25639
26289
|
return {
|
|
25640
26290
|
title: this.locale("labels.status.active"),
|
|
25641
26291
|
content: this.getSubscriptionStatusText(sub),
|