@pelcro/react-pelcro-js 3.26.0-beta.66 → 3.26.0-beta.68
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 -55
- package/dist/index.esm.js +107 -55
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -18701,6 +18701,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18701
18701
|
title
|
|
18702
18702
|
} = _ref2;
|
|
18703
18703
|
notifyBugsnag(() => {
|
|
18704
|
+
// eslint-disable-next-line no-undef
|
|
18704
18705
|
Bugsnag.notify(title !== null && title !== void 0 ? title : "ERROR", event => {
|
|
18705
18706
|
var _document$getElementB, _document$querySelect;
|
|
18706
18707
|
event.addMetadata("MetaData", {
|
|
@@ -18953,6 +18954,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18953
18954
|
key: jwk
|
|
18954
18955
|
} = res;
|
|
18955
18956
|
// SETUP MICROFORM
|
|
18957
|
+
// eslint-disable-next-line no-undef
|
|
18956
18958
|
FLEX.microform({
|
|
18957
18959
|
keyId: jwk.kid,
|
|
18958
18960
|
keystore: jwk,
|
|
@@ -20505,13 +20507,14 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20505
20507
|
* @param error
|
|
20506
20508
|
* @returns {*}
|
|
20507
20509
|
*/
|
|
20508
|
-
const confirmStripeCardPayment = function (response, error) {
|
|
20510
|
+
const confirmStripeCardPayment = async function (response, error) {
|
|
20509
20511
|
let isSubCreate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
20510
|
-
|
|
20511
|
-
|
|
20512
|
-
|
|
20513
|
-
|
|
20514
|
-
|
|
20512
|
+
try {
|
|
20513
|
+
if (response) {
|
|
20514
|
+
var _response$data;
|
|
20515
|
+
const paymentIntent = (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.payment_intent;
|
|
20516
|
+
if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_action" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
|
|
20517
|
+
const res = await stripe.confirmCardPayment(paymentIntent.client_secret);
|
|
20515
20518
|
if (!isSubCreate) {
|
|
20516
20519
|
dispatch({
|
|
20517
20520
|
type: DISABLE_SUBMIT,
|
|
@@ -20523,50 +20526,106 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20523
20526
|
payload: false
|
|
20524
20527
|
});
|
|
20525
20528
|
if (res.error) {
|
|
20529
|
+
notifyBugsnag(() => {
|
|
20530
|
+
// eslint-disable-next-line no-undef
|
|
20531
|
+
Bugsnag.notify(`Payment ${res.error}`, event => {
|
|
20532
|
+
var _error$response, _error$response$data, _error$response$data$, _window$Pelcro2, _window$Pelcro2$site, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4;
|
|
20533
|
+
event.addMetadata("Stripe Error MetaData", {
|
|
20534
|
+
message: res.error.message,
|
|
20535
|
+
type: res.error.type,
|
|
20536
|
+
code: res.error.code,
|
|
20537
|
+
error_message: error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : (_error$response$data$ = _error$response$data.error) === null || _error$response$data$ === void 0 ? void 0 : _error$response$data$.message,
|
|
20538
|
+
site: (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$site = _window$Pelcro2.site) === null || _window$Pelcro2$site === void 0 ? void 0 : _window$Pelcro2$site.read(),
|
|
20539
|
+
user: (_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(),
|
|
20540
|
+
environment: (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : _window$Pelcro4.environment
|
|
20541
|
+
});
|
|
20542
|
+
});
|
|
20543
|
+
});
|
|
20526
20544
|
onFailure(res.error);
|
|
20527
|
-
dispatch({
|
|
20545
|
+
return dispatch({
|
|
20528
20546
|
type: SHOW_ALERT,
|
|
20529
20547
|
payload: {
|
|
20530
20548
|
type: "error",
|
|
20531
20549
|
content: isSubCreate ? t("messages.tryAgainFromInvoice") : getErrorMessages(res.error)
|
|
20532
20550
|
}
|
|
20533
20551
|
});
|
|
20534
|
-
fireBugSnag({
|
|
20535
|
-
error: getErrorMessages(res.error),
|
|
20536
|
-
title: "StripeConfirmCardPayment - ERROR"
|
|
20537
|
-
});
|
|
20538
|
-
return;
|
|
20539
20552
|
}
|
|
20540
20553
|
onSuccess(res);
|
|
20541
|
-
})
|
|
20542
|
-
|
|
20543
|
-
|
|
20554
|
+
} else if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_payment_method" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
|
|
20555
|
+
if (!isSubCreate) {
|
|
20556
|
+
dispatch({
|
|
20557
|
+
type: DISABLE_SUBMIT,
|
|
20558
|
+
payload: false
|
|
20559
|
+
});
|
|
20560
|
+
}
|
|
20544
20561
|
dispatch({
|
|
20545
|
-
type:
|
|
20562
|
+
type: LOADING,
|
|
20546
20563
|
payload: false
|
|
20547
20564
|
});
|
|
20565
|
+
onFailure(error);
|
|
20566
|
+
return dispatch({
|
|
20567
|
+
type: SHOW_ALERT,
|
|
20568
|
+
payload: {
|
|
20569
|
+
type: "error",
|
|
20570
|
+
content: isSubCreate ? t("messages.tryAgainFromInvoice") : t("messages.cardAuthFailed")
|
|
20571
|
+
}
|
|
20572
|
+
});
|
|
20573
|
+
} else {
|
|
20574
|
+
onSuccess(response);
|
|
20548
20575
|
}
|
|
20576
|
+
} else {
|
|
20549
20577
|
dispatch({
|
|
20550
|
-
type:
|
|
20578
|
+
type: DISABLE_SUBMIT,
|
|
20551
20579
|
payload: false
|
|
20552
20580
|
});
|
|
20553
|
-
onFailure(error);
|
|
20554
20581
|
dispatch({
|
|
20555
|
-
type:
|
|
20556
|
-
payload:
|
|
20557
|
-
type: "error",
|
|
20558
|
-
content: isSubCreate ? t("messages.tryAgainFromInvoice") : t("messages.cardAuthFailed")
|
|
20559
|
-
}
|
|
20560
|
-
});
|
|
20561
|
-
fireBugSnag({
|
|
20562
|
-
error: getErrorMessages(error),
|
|
20563
|
-
title: "StripeConfirmCardPayment - ERROR"
|
|
20582
|
+
type: LOADING,
|
|
20583
|
+
payload: false
|
|
20564
20584
|
});
|
|
20565
|
-
|
|
20566
|
-
|
|
20585
|
+
if (error) {
|
|
20586
|
+
notifyBugsnag(() => {
|
|
20587
|
+
// eslint-disable-next-line no-undef
|
|
20588
|
+
Bugsnag.notify(`Payment ${error}`, event => {
|
|
20589
|
+
var _error$response2, _error$response3, _error$response3$data, _error$response3$data2, _window$Pelcro5, _window$Pelcro5$site, _window$Pelcro6, _window$Pelcro6$user, _window$Pelcro7;
|
|
20590
|
+
event.addMetadata("MetaData", {
|
|
20591
|
+
name: error === null || error === void 0 ? void 0 : error.name,
|
|
20592
|
+
message: error === null || error === void 0 ? void 0 : error.message,
|
|
20593
|
+
type: error === null || error === void 0 ? void 0 : error.type,
|
|
20594
|
+
code: error === null || error === void 0 ? void 0 : error.code,
|
|
20595
|
+
status: error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.status,
|
|
20596
|
+
error_message: error === null || error === void 0 ? void 0 : (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : (_error$response3$data = _error$response3.data) === null || _error$response3$data === void 0 ? void 0 : (_error$response3$data2 = _error$response3$data.error) === null || _error$response3$data2 === void 0 ? void 0 : _error$response3$data2.message,
|
|
20597
|
+
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(),
|
|
20598
|
+
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(),
|
|
20599
|
+
environment: (_window$Pelcro7 = window.Pelcro) === null || _window$Pelcro7 === void 0 ? void 0 : _window$Pelcro7.environment
|
|
20600
|
+
});
|
|
20601
|
+
});
|
|
20602
|
+
});
|
|
20603
|
+
onFailure(error);
|
|
20604
|
+
return dispatch({
|
|
20605
|
+
type: SHOW_ALERT,
|
|
20606
|
+
payload: {
|
|
20607
|
+
type: "error",
|
|
20608
|
+
content: getErrorMessages(error)
|
|
20609
|
+
}
|
|
20610
|
+
});
|
|
20611
|
+
}
|
|
20567
20612
|
onSuccess(response);
|
|
20568
20613
|
}
|
|
20569
|
-
}
|
|
20614
|
+
} catch (error) {
|
|
20615
|
+
notifyBugsnag(() => {
|
|
20616
|
+
// eslint-disable-next-line no-undef
|
|
20617
|
+
Bugsnag.notify(`Payment ${error}`, event => {
|
|
20618
|
+
var _error$response4, _error$response4$data, _error$response4$data2, _window$Pelcro8, _window$Pelcro8$site, _window$Pelcro9, _window$Pelcro9$user, _window$Pelcro10;
|
|
20619
|
+
event.addMetadata("UnexpectedError", {
|
|
20620
|
+
message: error.message,
|
|
20621
|
+
stack: error.stack,
|
|
20622
|
+
error_message: error === null || error === void 0 ? void 0 : (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : (_error$response4$data = _error$response4.data) === null || _error$response4$data === void 0 ? void 0 : (_error$response4$data2 = _error$response4$data.error) === null || _error$response4$data2 === void 0 ? void 0 : _error$response4$data2.message,
|
|
20623
|
+
site: (_window$Pelcro8 = window.Pelcro) === null || _window$Pelcro8 === void 0 ? void 0 : (_window$Pelcro8$site = _window$Pelcro8.site) === null || _window$Pelcro8$site === void 0 ? void 0 : _window$Pelcro8$site.read(),
|
|
20624
|
+
user: (_window$Pelcro9 = window.Pelcro) === null || _window$Pelcro9 === void 0 ? void 0 : (_window$Pelcro9$user = _window$Pelcro9.user) === null || _window$Pelcro9$user === void 0 ? void 0 : _window$Pelcro9$user.read(),
|
|
20625
|
+
environment: (_window$Pelcro10 = window.Pelcro) === null || _window$Pelcro10 === void 0 ? void 0 : _window$Pelcro10.environment
|
|
20626
|
+
});
|
|
20627
|
+
});
|
|
20628
|
+
});
|
|
20570
20629
|
dispatch({
|
|
20571
20630
|
type: DISABLE_SUBMIT,
|
|
20572
20631
|
payload: false
|
|
@@ -20575,22 +20634,14 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20575
20634
|
type: LOADING,
|
|
20576
20635
|
payload: false
|
|
20577
20636
|
});
|
|
20578
|
-
|
|
20579
|
-
|
|
20580
|
-
|
|
20581
|
-
|
|
20582
|
-
|
|
20583
|
-
|
|
20584
|
-
|
|
20585
|
-
|
|
20586
|
-
});
|
|
20587
|
-
fireBugSnag({
|
|
20588
|
-
error: getErrorMessages(error),
|
|
20589
|
-
title: "StripeConfirmCardPayment - ERROR"
|
|
20590
|
-
});
|
|
20591
|
-
return;
|
|
20592
|
-
}
|
|
20593
|
-
onSuccess(response);
|
|
20637
|
+
onFailure(error);
|
|
20638
|
+
return dispatch({
|
|
20639
|
+
type: SHOW_ALERT,
|
|
20640
|
+
payload: {
|
|
20641
|
+
type: "error",
|
|
20642
|
+
content: t("messages.unexpectedError")
|
|
20643
|
+
}
|
|
20644
|
+
});
|
|
20594
20645
|
}
|
|
20595
20646
|
};
|
|
20596
20647
|
const confirmStripeIntentSetup = (response, flow, paymentMethodId) => {
|
|
@@ -20901,7 +20952,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20901
20952
|
addressId: selectedAddressId,
|
|
20902
20953
|
couponCode
|
|
20903
20954
|
}, (err, orderResponse) => {
|
|
20904
|
-
var _window$
|
|
20955
|
+
var _window$Pelcro11, _window$Pelcro11$user, _window$Pelcro11$user2;
|
|
20905
20956
|
if (err) {
|
|
20906
20957
|
toggleAuthenticationSuccessPendingView(false);
|
|
20907
20958
|
dispatch({
|
|
@@ -20932,7 +20983,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20932
20983
|
});
|
|
20933
20984
|
}
|
|
20934
20985
|
window.Pelcro.user.refresh({
|
|
20935
|
-
auth_token: (_window$
|
|
20986
|
+
auth_token: (_window$Pelcro11 = window.Pelcro) === null || _window$Pelcro11 === void 0 ? void 0 : (_window$Pelcro11$user = _window$Pelcro11.user) === null || _window$Pelcro11$user === void 0 ? void 0 : (_window$Pelcro11$user2 = _window$Pelcro11$user.read()) === null || _window$Pelcro11$user2 === void 0 ? void 0 : _window$Pelcro11$user2.auth_token
|
|
20936
20987
|
}, (err, res) => {
|
|
20937
20988
|
dispatch({
|
|
20938
20989
|
type: DISABLE_SUBMIT,
|
|
@@ -23127,7 +23178,7 @@ function PaymentMethodUpdateSetDefault(props) {
|
|
|
23127
23178
|
paymentMethodToEdit
|
|
23128
23179
|
} = usePelcro();
|
|
23129
23180
|
React.useEffect(() => {
|
|
23130
|
-
if (paymentMethodToEdit !== null && paymentMethodToEdit !== void 0 && paymentMethodToEdit.is_default) {
|
|
23181
|
+
if (paymentMethodToEdit !== null && paymentMethodToEdit !== void 0 && paymentMethodToEdit.is_default || props !== null && props !== void 0 && props.paymentMethodDefaultChecked) {
|
|
23131
23182
|
dispatch({
|
|
23132
23183
|
type: SET_IS_DEFAULT_PAYMENT_METHOD,
|
|
23133
23184
|
payload: {
|
|
@@ -23135,7 +23186,7 @@ function PaymentMethodUpdateSetDefault(props) {
|
|
|
23135
23186
|
}
|
|
23136
23187
|
});
|
|
23137
23188
|
}
|
|
23138
|
-
}, [paymentMethodToEdit]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
23189
|
+
}, [paymentMethodToEdit, props === null || props === void 0 ? void 0 : props.paymentMethodDefaultChecked]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
23139
23190
|
|
|
23140
23191
|
const handleCheckboxChange = e => {
|
|
23141
23192
|
dispatch({
|
|
@@ -23169,7 +23220,8 @@ function PaymentMethodView(_ref) {
|
|
|
23169
23220
|
showOrderButton,
|
|
23170
23221
|
showApplePayButton,
|
|
23171
23222
|
order,
|
|
23172
|
-
subCreateMetadata
|
|
23223
|
+
subCreateMetadata,
|
|
23224
|
+
...props
|
|
23173
23225
|
} = _ref;
|
|
23174
23226
|
const {
|
|
23175
23227
|
t
|
|
@@ -23244,10 +23296,10 @@ function PaymentMethodView(_ref) {
|
|
|
23244
23296
|
type: type
|
|
23245
23297
|
}), showCoupon && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
23246
23298
|
className: "plc-mb-2"
|
|
23247
|
-
}, /*#__PURE__*/React__default['default'].createElement(CouponCode, null), /*#__PURE__*/React__default['default'].createElement(DiscountedPrice, null)), /*#__PURE__*/React__default['default'].createElement(TaxAmount, null), type === "updatePaymentSource" && /*#__PURE__*/React__default['default'].createElement(PaymentMethodUpdateSetDefault, {
|
|
23299
|
+
}, /*#__PURE__*/React__default['default'].createElement(CouponCode, null), /*#__PURE__*/React__default['default'].createElement(DiscountedPrice, null)), /*#__PURE__*/React__default['default'].createElement(TaxAmount, null), type === "updatePaymentSource" && /*#__PURE__*/React__default['default'].createElement(PaymentMethodUpdateSetDefault, Object.assign({
|
|
23248
23300
|
id: "pelcro-input-is-default",
|
|
23249
23301
|
label: t("labels.isDefault")
|
|
23250
|
-
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
23302
|
+
}, props)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
23251
23303
|
className: "plc-grid plc-mt-4 plc-gap-y-2"
|
|
23252
23304
|
}, /*#__PURE__*/React__default['default'].createElement(SubmitPaymentMethod, null), showExternalPaymentMethods && !supportsVantiv && !supportsCybersource && !supportsTap ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(PelcroPaymentRequestButton, null), /*#__PURE__*/React__default['default'].createElement(PaypalSubscribeButton, null)) : showExternalPaymentMethods && supportsVantiv ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(PaypalSubscribeButton, null)) : null, showApplePayButton && supportsVantiv ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(ApplePayButton, null)) : null)))));
|
|
23253
23305
|
}
|
|
@@ -27623,7 +27675,7 @@ function PaymentMethodUpdateView(props) {
|
|
|
27623
27675
|
className: "plc-mb-2 plc-text-center plc-text-gray-900 pelcro-title-wrapper"
|
|
27624
27676
|
}, /*#__PURE__*/React__default['default'].createElement("h4", {
|
|
27625
27677
|
className: "plc-text-2xl plc-font-semibold "
|
|
27626
|
-
}, t("update.title")), /*#__PURE__*/React__default['default'].createElement("p", null, t("update.subtitle"))), /*#__PURE__*/React__default['default'].createElement(PaymentMethodView, {
|
|
27678
|
+
}, t("update.title")), /*#__PURE__*/React__default['default'].createElement("p", null, t("update.subtitle"))), /*#__PURE__*/React__default['default'].createElement(PaymentMethodView, Object.assign({
|
|
27627
27679
|
type: "updatePaymentSource",
|
|
27628
27680
|
showCoupon: false,
|
|
27629
27681
|
showExternalPaymentMethods: false,
|
|
@@ -27631,7 +27683,7 @@ function PaymentMethodUpdateView(props) {
|
|
|
27631
27683
|
onDisplay: props.onDisplay,
|
|
27632
27684
|
onFailure: props.onFailure,
|
|
27633
27685
|
onSuccess: props.onSuccess
|
|
27634
|
-
}));
|
|
27686
|
+
}, props)));
|
|
27635
27687
|
}
|
|
27636
27688
|
|
|
27637
27689
|
const PaymentMethodUpdateModal = props => {
|
package/dist/index.esm.js
CHANGED
|
@@ -18671,6 +18671,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18671
18671
|
title
|
|
18672
18672
|
} = _ref2;
|
|
18673
18673
|
notifyBugsnag(() => {
|
|
18674
|
+
// eslint-disable-next-line no-undef
|
|
18674
18675
|
Bugsnag.notify(title !== null && title !== void 0 ? title : "ERROR", event => {
|
|
18675
18676
|
var _document$getElementB, _document$querySelect;
|
|
18676
18677
|
event.addMetadata("MetaData", {
|
|
@@ -18923,6 +18924,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18923
18924
|
key: jwk
|
|
18924
18925
|
} = res;
|
|
18925
18926
|
// SETUP MICROFORM
|
|
18927
|
+
// eslint-disable-next-line no-undef
|
|
18926
18928
|
FLEX.microform({
|
|
18927
18929
|
keyId: jwk.kid,
|
|
18928
18930
|
keystore: jwk,
|
|
@@ -20475,13 +20477,14 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20475
20477
|
* @param error
|
|
20476
20478
|
* @returns {*}
|
|
20477
20479
|
*/
|
|
20478
|
-
const confirmStripeCardPayment = function (response, error) {
|
|
20480
|
+
const confirmStripeCardPayment = async function (response, error) {
|
|
20479
20481
|
let isSubCreate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
20480
|
-
|
|
20481
|
-
|
|
20482
|
-
|
|
20483
|
-
|
|
20484
|
-
|
|
20482
|
+
try {
|
|
20483
|
+
if (response) {
|
|
20484
|
+
var _response$data;
|
|
20485
|
+
const paymentIntent = (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.payment_intent;
|
|
20486
|
+
if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_action" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
|
|
20487
|
+
const res = await stripe.confirmCardPayment(paymentIntent.client_secret);
|
|
20485
20488
|
if (!isSubCreate) {
|
|
20486
20489
|
dispatch({
|
|
20487
20490
|
type: DISABLE_SUBMIT,
|
|
@@ -20493,50 +20496,106 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20493
20496
|
payload: false
|
|
20494
20497
|
});
|
|
20495
20498
|
if (res.error) {
|
|
20499
|
+
notifyBugsnag(() => {
|
|
20500
|
+
// eslint-disable-next-line no-undef
|
|
20501
|
+
Bugsnag.notify(`Payment ${res.error}`, event => {
|
|
20502
|
+
var _error$response, _error$response$data, _error$response$data$, _window$Pelcro2, _window$Pelcro2$site, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4;
|
|
20503
|
+
event.addMetadata("Stripe Error MetaData", {
|
|
20504
|
+
message: res.error.message,
|
|
20505
|
+
type: res.error.type,
|
|
20506
|
+
code: res.error.code,
|
|
20507
|
+
error_message: error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : (_error$response$data$ = _error$response$data.error) === null || _error$response$data$ === void 0 ? void 0 : _error$response$data$.message,
|
|
20508
|
+
site: (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$site = _window$Pelcro2.site) === null || _window$Pelcro2$site === void 0 ? void 0 : _window$Pelcro2$site.read(),
|
|
20509
|
+
user: (_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(),
|
|
20510
|
+
environment: (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : _window$Pelcro4.environment
|
|
20511
|
+
});
|
|
20512
|
+
});
|
|
20513
|
+
});
|
|
20496
20514
|
onFailure(res.error);
|
|
20497
|
-
dispatch({
|
|
20515
|
+
return dispatch({
|
|
20498
20516
|
type: SHOW_ALERT,
|
|
20499
20517
|
payload: {
|
|
20500
20518
|
type: "error",
|
|
20501
20519
|
content: isSubCreate ? t("messages.tryAgainFromInvoice") : getErrorMessages(res.error)
|
|
20502
20520
|
}
|
|
20503
20521
|
});
|
|
20504
|
-
fireBugSnag({
|
|
20505
|
-
error: getErrorMessages(res.error),
|
|
20506
|
-
title: "StripeConfirmCardPayment - ERROR"
|
|
20507
|
-
});
|
|
20508
|
-
return;
|
|
20509
20522
|
}
|
|
20510
20523
|
onSuccess(res);
|
|
20511
|
-
})
|
|
20512
|
-
|
|
20513
|
-
|
|
20524
|
+
} else if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_payment_method" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
|
|
20525
|
+
if (!isSubCreate) {
|
|
20526
|
+
dispatch({
|
|
20527
|
+
type: DISABLE_SUBMIT,
|
|
20528
|
+
payload: false
|
|
20529
|
+
});
|
|
20530
|
+
}
|
|
20514
20531
|
dispatch({
|
|
20515
|
-
type:
|
|
20532
|
+
type: LOADING,
|
|
20516
20533
|
payload: false
|
|
20517
20534
|
});
|
|
20535
|
+
onFailure(error);
|
|
20536
|
+
return dispatch({
|
|
20537
|
+
type: SHOW_ALERT,
|
|
20538
|
+
payload: {
|
|
20539
|
+
type: "error",
|
|
20540
|
+
content: isSubCreate ? t("messages.tryAgainFromInvoice") : t("messages.cardAuthFailed")
|
|
20541
|
+
}
|
|
20542
|
+
});
|
|
20543
|
+
} else {
|
|
20544
|
+
onSuccess(response);
|
|
20518
20545
|
}
|
|
20546
|
+
} else {
|
|
20519
20547
|
dispatch({
|
|
20520
|
-
type:
|
|
20548
|
+
type: DISABLE_SUBMIT,
|
|
20521
20549
|
payload: false
|
|
20522
20550
|
});
|
|
20523
|
-
onFailure(error);
|
|
20524
20551
|
dispatch({
|
|
20525
|
-
type:
|
|
20526
|
-
payload:
|
|
20527
|
-
type: "error",
|
|
20528
|
-
content: isSubCreate ? t("messages.tryAgainFromInvoice") : t("messages.cardAuthFailed")
|
|
20529
|
-
}
|
|
20530
|
-
});
|
|
20531
|
-
fireBugSnag({
|
|
20532
|
-
error: getErrorMessages(error),
|
|
20533
|
-
title: "StripeConfirmCardPayment - ERROR"
|
|
20552
|
+
type: LOADING,
|
|
20553
|
+
payload: false
|
|
20534
20554
|
});
|
|
20535
|
-
|
|
20536
|
-
|
|
20555
|
+
if (error) {
|
|
20556
|
+
notifyBugsnag(() => {
|
|
20557
|
+
// eslint-disable-next-line no-undef
|
|
20558
|
+
Bugsnag.notify(`Payment ${error}`, event => {
|
|
20559
|
+
var _error$response2, _error$response3, _error$response3$data, _error$response3$data2, _window$Pelcro5, _window$Pelcro5$site, _window$Pelcro6, _window$Pelcro6$user, _window$Pelcro7;
|
|
20560
|
+
event.addMetadata("MetaData", {
|
|
20561
|
+
name: error === null || error === void 0 ? void 0 : error.name,
|
|
20562
|
+
message: error === null || error === void 0 ? void 0 : error.message,
|
|
20563
|
+
type: error === null || error === void 0 ? void 0 : error.type,
|
|
20564
|
+
code: error === null || error === void 0 ? void 0 : error.code,
|
|
20565
|
+
status: error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.status,
|
|
20566
|
+
error_message: error === null || error === void 0 ? void 0 : (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : (_error$response3$data = _error$response3.data) === null || _error$response3$data === void 0 ? void 0 : (_error$response3$data2 = _error$response3$data.error) === null || _error$response3$data2 === void 0 ? void 0 : _error$response3$data2.message,
|
|
20567
|
+
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(),
|
|
20568
|
+
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(),
|
|
20569
|
+
environment: (_window$Pelcro7 = window.Pelcro) === null || _window$Pelcro7 === void 0 ? void 0 : _window$Pelcro7.environment
|
|
20570
|
+
});
|
|
20571
|
+
});
|
|
20572
|
+
});
|
|
20573
|
+
onFailure(error);
|
|
20574
|
+
return dispatch({
|
|
20575
|
+
type: SHOW_ALERT,
|
|
20576
|
+
payload: {
|
|
20577
|
+
type: "error",
|
|
20578
|
+
content: getErrorMessages(error)
|
|
20579
|
+
}
|
|
20580
|
+
});
|
|
20581
|
+
}
|
|
20537
20582
|
onSuccess(response);
|
|
20538
20583
|
}
|
|
20539
|
-
}
|
|
20584
|
+
} catch (error) {
|
|
20585
|
+
notifyBugsnag(() => {
|
|
20586
|
+
// eslint-disable-next-line no-undef
|
|
20587
|
+
Bugsnag.notify(`Payment ${error}`, event => {
|
|
20588
|
+
var _error$response4, _error$response4$data, _error$response4$data2, _window$Pelcro8, _window$Pelcro8$site, _window$Pelcro9, _window$Pelcro9$user, _window$Pelcro10;
|
|
20589
|
+
event.addMetadata("UnexpectedError", {
|
|
20590
|
+
message: error.message,
|
|
20591
|
+
stack: error.stack,
|
|
20592
|
+
error_message: error === null || error === void 0 ? void 0 : (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : (_error$response4$data = _error$response4.data) === null || _error$response4$data === void 0 ? void 0 : (_error$response4$data2 = _error$response4$data.error) === null || _error$response4$data2 === void 0 ? void 0 : _error$response4$data2.message,
|
|
20593
|
+
site: (_window$Pelcro8 = window.Pelcro) === null || _window$Pelcro8 === void 0 ? void 0 : (_window$Pelcro8$site = _window$Pelcro8.site) === null || _window$Pelcro8$site === void 0 ? void 0 : _window$Pelcro8$site.read(),
|
|
20594
|
+
user: (_window$Pelcro9 = window.Pelcro) === null || _window$Pelcro9 === void 0 ? void 0 : (_window$Pelcro9$user = _window$Pelcro9.user) === null || _window$Pelcro9$user === void 0 ? void 0 : _window$Pelcro9$user.read(),
|
|
20595
|
+
environment: (_window$Pelcro10 = window.Pelcro) === null || _window$Pelcro10 === void 0 ? void 0 : _window$Pelcro10.environment
|
|
20596
|
+
});
|
|
20597
|
+
});
|
|
20598
|
+
});
|
|
20540
20599
|
dispatch({
|
|
20541
20600
|
type: DISABLE_SUBMIT,
|
|
20542
20601
|
payload: false
|
|
@@ -20545,22 +20604,14 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20545
20604
|
type: LOADING,
|
|
20546
20605
|
payload: false
|
|
20547
20606
|
});
|
|
20548
|
-
|
|
20549
|
-
|
|
20550
|
-
|
|
20551
|
-
|
|
20552
|
-
|
|
20553
|
-
|
|
20554
|
-
|
|
20555
|
-
|
|
20556
|
-
});
|
|
20557
|
-
fireBugSnag({
|
|
20558
|
-
error: getErrorMessages(error),
|
|
20559
|
-
title: "StripeConfirmCardPayment - ERROR"
|
|
20560
|
-
});
|
|
20561
|
-
return;
|
|
20562
|
-
}
|
|
20563
|
-
onSuccess(response);
|
|
20607
|
+
onFailure(error);
|
|
20608
|
+
return dispatch({
|
|
20609
|
+
type: SHOW_ALERT,
|
|
20610
|
+
payload: {
|
|
20611
|
+
type: "error",
|
|
20612
|
+
content: t("messages.unexpectedError")
|
|
20613
|
+
}
|
|
20614
|
+
});
|
|
20564
20615
|
}
|
|
20565
20616
|
};
|
|
20566
20617
|
const confirmStripeIntentSetup = (response, flow, paymentMethodId) => {
|
|
@@ -20871,7 +20922,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20871
20922
|
addressId: selectedAddressId,
|
|
20872
20923
|
couponCode
|
|
20873
20924
|
}, (err, orderResponse) => {
|
|
20874
|
-
var _window$
|
|
20925
|
+
var _window$Pelcro11, _window$Pelcro11$user, _window$Pelcro11$user2;
|
|
20875
20926
|
if (err) {
|
|
20876
20927
|
toggleAuthenticationSuccessPendingView(false);
|
|
20877
20928
|
dispatch({
|
|
@@ -20902,7 +20953,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20902
20953
|
});
|
|
20903
20954
|
}
|
|
20904
20955
|
window.Pelcro.user.refresh({
|
|
20905
|
-
auth_token: (_window$
|
|
20956
|
+
auth_token: (_window$Pelcro11 = window.Pelcro) === null || _window$Pelcro11 === void 0 ? void 0 : (_window$Pelcro11$user = _window$Pelcro11.user) === null || _window$Pelcro11$user === void 0 ? void 0 : (_window$Pelcro11$user2 = _window$Pelcro11$user.read()) === null || _window$Pelcro11$user2 === void 0 ? void 0 : _window$Pelcro11$user2.auth_token
|
|
20906
20957
|
}, (err, res) => {
|
|
20907
20958
|
dispatch({
|
|
20908
20959
|
type: DISABLE_SUBMIT,
|
|
@@ -23097,7 +23148,7 @@ function PaymentMethodUpdateSetDefault(props) {
|
|
|
23097
23148
|
paymentMethodToEdit
|
|
23098
23149
|
} = usePelcro();
|
|
23099
23150
|
useEffect(() => {
|
|
23100
|
-
if (paymentMethodToEdit !== null && paymentMethodToEdit !== void 0 && paymentMethodToEdit.is_default) {
|
|
23151
|
+
if (paymentMethodToEdit !== null && paymentMethodToEdit !== void 0 && paymentMethodToEdit.is_default || props !== null && props !== void 0 && props.paymentMethodDefaultChecked) {
|
|
23101
23152
|
dispatch({
|
|
23102
23153
|
type: SET_IS_DEFAULT_PAYMENT_METHOD,
|
|
23103
23154
|
payload: {
|
|
@@ -23105,7 +23156,7 @@ function PaymentMethodUpdateSetDefault(props) {
|
|
|
23105
23156
|
}
|
|
23106
23157
|
});
|
|
23107
23158
|
}
|
|
23108
|
-
}, [paymentMethodToEdit]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
23159
|
+
}, [paymentMethodToEdit, props === null || props === void 0 ? void 0 : props.paymentMethodDefaultChecked]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
23109
23160
|
|
|
23110
23161
|
const handleCheckboxChange = e => {
|
|
23111
23162
|
dispatch({
|
|
@@ -23139,7 +23190,8 @@ function PaymentMethodView(_ref) {
|
|
|
23139
23190
|
showOrderButton,
|
|
23140
23191
|
showApplePayButton,
|
|
23141
23192
|
order,
|
|
23142
|
-
subCreateMetadata
|
|
23193
|
+
subCreateMetadata,
|
|
23194
|
+
...props
|
|
23143
23195
|
} = _ref;
|
|
23144
23196
|
const {
|
|
23145
23197
|
t
|
|
@@ -23214,10 +23266,10 @@ function PaymentMethodView(_ref) {
|
|
|
23214
23266
|
type: type
|
|
23215
23267
|
}), showCoupon && /*#__PURE__*/React__default.createElement("div", {
|
|
23216
23268
|
className: "plc-mb-2"
|
|
23217
|
-
}, /*#__PURE__*/React__default.createElement(CouponCode, null), /*#__PURE__*/React__default.createElement(DiscountedPrice, null)), /*#__PURE__*/React__default.createElement(TaxAmount, null), type === "updatePaymentSource" && /*#__PURE__*/React__default.createElement(PaymentMethodUpdateSetDefault, {
|
|
23269
|
+
}, /*#__PURE__*/React__default.createElement(CouponCode, null), /*#__PURE__*/React__default.createElement(DiscountedPrice, null)), /*#__PURE__*/React__default.createElement(TaxAmount, null), type === "updatePaymentSource" && /*#__PURE__*/React__default.createElement(PaymentMethodUpdateSetDefault, Object.assign({
|
|
23218
23270
|
id: "pelcro-input-is-default",
|
|
23219
23271
|
label: t("labels.isDefault")
|
|
23220
|
-
}), /*#__PURE__*/React__default.createElement("div", {
|
|
23272
|
+
}, props)), /*#__PURE__*/React__default.createElement("div", {
|
|
23221
23273
|
className: "plc-grid plc-mt-4 plc-gap-y-2"
|
|
23222
23274
|
}, /*#__PURE__*/React__default.createElement(SubmitPaymentMethod, null), showExternalPaymentMethods && !supportsVantiv && !supportsCybersource && !supportsTap ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PelcroPaymentRequestButton, null), /*#__PURE__*/React__default.createElement(PaypalSubscribeButton, null)) : showExternalPaymentMethods && supportsVantiv ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PaypalSubscribeButton, null)) : null, showApplePayButton && supportsVantiv ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ApplePayButton, null)) : null)))));
|
|
23223
23275
|
}
|
|
@@ -27593,7 +27645,7 @@ function PaymentMethodUpdateView(props) {
|
|
|
27593
27645
|
className: "plc-mb-2 plc-text-center plc-text-gray-900 pelcro-title-wrapper"
|
|
27594
27646
|
}, /*#__PURE__*/React__default.createElement("h4", {
|
|
27595
27647
|
className: "plc-text-2xl plc-font-semibold "
|
|
27596
|
-
}, t("update.title")), /*#__PURE__*/React__default.createElement("p", null, t("update.subtitle"))), /*#__PURE__*/React__default.createElement(PaymentMethodView, {
|
|
27648
|
+
}, t("update.title")), /*#__PURE__*/React__default.createElement("p", null, t("update.subtitle"))), /*#__PURE__*/React__default.createElement(PaymentMethodView, Object.assign({
|
|
27597
27649
|
type: "updatePaymentSource",
|
|
27598
27650
|
showCoupon: false,
|
|
27599
27651
|
showExternalPaymentMethods: false,
|
|
@@ -27601,7 +27653,7 @@ function PaymentMethodUpdateView(props) {
|
|
|
27601
27653
|
onDisplay: props.onDisplay,
|
|
27602
27654
|
onFailure: props.onFailure,
|
|
27603
27655
|
onSuccess: props.onSuccess
|
|
27604
|
-
}));
|
|
27656
|
+
}, props)));
|
|
27605
27657
|
}
|
|
27606
27658
|
|
|
27607
27659
|
const PaymentMethodUpdateModal = props => {
|