@pelcro/react-pelcro-js 3.26.0-beta.55 → 3.26.0-beta.57
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 +67 -36
- package/dist/index.esm.js +67 -36
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -20448,7 +20448,8 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20448
20448
|
gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
|
|
20449
20449
|
address_id: product.address_required ? selectedAddressId : null
|
|
20450
20450
|
}, (err, res) => {
|
|
20451
|
-
|
|
20451
|
+
var _res$data;
|
|
20452
|
+
if (res !== null && res !== void 0 && (_res$data = res.data) !== null && _res$data !== void 0 && _res$data.setup_intent) {
|
|
20452
20453
|
return confirmStripeIntentSetup(res, "subCreate");
|
|
20453
20454
|
}
|
|
20454
20455
|
confirmStripeCardPayment(res, err, true);
|
|
@@ -20737,7 +20738,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20737
20738
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
20738
20739
|
token: source.id
|
|
20739
20740
|
}, (err, res) => {
|
|
20740
|
-
var _res$
|
|
20741
|
+
var _res$data2, _res$data2$setup_inte, _res$data3, _res$data3$setup_inte;
|
|
20741
20742
|
if (err) {
|
|
20742
20743
|
dispatch({
|
|
20743
20744
|
type: DISABLE_SUBMIT,
|
|
@@ -20756,7 +20757,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20756
20757
|
}
|
|
20757
20758
|
});
|
|
20758
20759
|
}
|
|
20759
|
-
if (((_res$
|
|
20760
|
+
if (((_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : (_res$data2$setup_inte = _res$data2.setup_intent) === null || _res$data2$setup_inte === void 0 ? void 0 : _res$data2$setup_inte.status) === "requires_action" || ((_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : (_res$data3$setup_inte = _res$data3.setup_intent) === null || _res$data3$setup_inte === void 0 ? void 0 : _res$data3$setup_inte.status) === "requires_confirmation") {
|
|
20760
20761
|
confirmStripeIntentSetup(res, "create");
|
|
20761
20762
|
} else {
|
|
20762
20763
|
dispatch({
|
|
@@ -20792,7 +20793,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20792
20793
|
exp_year: year,
|
|
20793
20794
|
is_default: isDefault
|
|
20794
20795
|
}, (err, res) => {
|
|
20795
|
-
var _res$
|
|
20796
|
+
var _res$data4, _res$data4$setup_inte, _res$data5, _res$data5$setup_inte;
|
|
20796
20797
|
dispatch({
|
|
20797
20798
|
type: DISABLE_SUBMIT,
|
|
20798
20799
|
payload: false
|
|
@@ -20811,7 +20812,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20811
20812
|
}
|
|
20812
20813
|
});
|
|
20813
20814
|
}
|
|
20814
|
-
if (((_res$
|
|
20815
|
+
if (((_res$data4 = res.data) === null || _res$data4 === void 0 ? void 0 : (_res$data4$setup_inte = _res$data4.setup_intent) === null || _res$data4$setup_inte === void 0 ? void 0 : _res$data4$setup_inte.status) === "requires_action" || ((_res$data5 = res.data) === null || _res$data5 === void 0 ? void 0 : (_res$data5$setup_inte = _res$data5.setup_intent) === null || _res$data5$setup_inte === void 0 ? void 0 : _res$data5$setup_inte.status) === "requires_confirmation") {
|
|
20815
20816
|
confirmStripeIntentSetup(res, "update");
|
|
20816
20817
|
} else {
|
|
20817
20818
|
dispatch({
|
|
@@ -20853,7 +20854,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20853
20854
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
20854
20855
|
token: source.id
|
|
20855
20856
|
}, (err, res) => {
|
|
20856
|
-
var _res$
|
|
20857
|
+
var _res$data6, _res$data6$setup_inte, _res$data7, _res$data7$setup_inte;
|
|
20857
20858
|
if (err) {
|
|
20858
20859
|
onFailure(err);
|
|
20859
20860
|
return dispatch({
|
|
@@ -20864,7 +20865,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20864
20865
|
}
|
|
20865
20866
|
});
|
|
20866
20867
|
}
|
|
20867
|
-
if (((_res$
|
|
20868
|
+
if (((_res$data6 = res.data) === null || _res$data6 === void 0 ? void 0 : (_res$data6$setup_inte = _res$data6.setup_intent) === null || _res$data6$setup_inte === void 0 ? void 0 : _res$data6$setup_inte.status) === "requires_action" || ((_res$data7 = res.data) === null || _res$data7 === void 0 ? void 0 : (_res$data7$setup_inte = _res$data7.setup_intent) === null || _res$data7$setup_inte === void 0 ? void 0 : _res$data7$setup_inte.status) === "requires_confirmation") {
|
|
20868
20869
|
confirmStripeIntentSetup(res, "replace", paymentMethodId);
|
|
20869
20870
|
} else {
|
|
20870
20871
|
setTimeout(() => {
|
|
@@ -21029,12 +21030,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
21029
21030
|
coupon_code: state === null || state === void 0 ? void 0 : state.couponCode,
|
|
21030
21031
|
address_id: selectedAddressId
|
|
21031
21032
|
}, (error, res) => {
|
|
21032
|
-
var _res$
|
|
21033
|
+
var _res$data8, _res$data9;
|
|
21033
21034
|
if (error) {
|
|
21034
21035
|
return reject(error);
|
|
21035
21036
|
}
|
|
21036
|
-
const taxAmount = (_res$
|
|
21037
|
-
const totalAmountWithTax = (_res$
|
|
21037
|
+
const taxAmount = (_res$data8 = res.data) === null || _res$data8 === void 0 ? void 0 : _res$data8.taxes;
|
|
21038
|
+
const totalAmountWithTax = (_res$data9 = res.data) === null || _res$data9 === void 0 ? void 0 : _res$data9.total;
|
|
21038
21039
|
resolve({
|
|
21039
21040
|
totalAmountWithTax,
|
|
21040
21041
|
taxAmount
|
|
@@ -27283,7 +27284,8 @@ const PasswordResetContainer = _ref => {
|
|
|
27283
27284
|
email,
|
|
27284
27285
|
password,
|
|
27285
27286
|
password_confirmation: confirmPassword,
|
|
27286
|
-
token
|
|
27287
|
+
token,
|
|
27288
|
+
referer: window.location.origin
|
|
27287
27289
|
}, (err, res) => {
|
|
27288
27290
|
dispatch({
|
|
27289
27291
|
type: DISABLE_SUBMIT,
|
|
@@ -27515,7 +27517,8 @@ const PasswordForgotContainer = _ref => {
|
|
|
27515
27517
|
email
|
|
27516
27518
|
} = _ref2;
|
|
27517
27519
|
window.Pelcro.password.forgot({
|
|
27518
|
-
email
|
|
27520
|
+
email,
|
|
27521
|
+
referer: window.location.origin
|
|
27519
27522
|
}, (err, res) => {
|
|
27520
27523
|
dispatch({
|
|
27521
27524
|
type: DISABLE_SUBMIT,
|
|
@@ -29640,17 +29643,21 @@ const AddressSelectModal = _ref => {
|
|
|
29640
29643
|
AddressSelectModal.viewId = "address-select";
|
|
29641
29644
|
|
|
29642
29645
|
const moveDefaultPaymentMethodToStart = paymentMethods => {
|
|
29643
|
-
|
|
29644
|
-
const defaultPaymentMethod = (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.source;
|
|
29646
|
+
const defaultPaymentMethod = getDefaultPaymentMethod(paymentMethods);
|
|
29645
29647
|
const paymentMethodsWithoutDefault = paymentMethods.filter(paymentMethod => paymentMethod.id !== defaultPaymentMethod.id);
|
|
29646
29648
|
if (defaultPaymentMethod.status !== "chargeable") {
|
|
29647
29649
|
return paymentMethodsWithoutDefault;
|
|
29648
29650
|
}
|
|
29649
29651
|
return [defaultPaymentMethod, ...paymentMethodsWithoutDefault];
|
|
29650
29652
|
};
|
|
29653
|
+
const getDefaultPaymentMethod = paymentMethods => {
|
|
29654
|
+
const defaultPaymentMethod = paymentMethods.find(paymentMethod => paymentMethod.is_default);
|
|
29655
|
+
return defaultPaymentMethod;
|
|
29656
|
+
};
|
|
29651
29657
|
const initialState$5 = {
|
|
29652
29658
|
paymentMethods: [],
|
|
29653
29659
|
selectedPaymentMethodId: null,
|
|
29660
|
+
skeletonLoader: true,
|
|
29654
29661
|
isSubmitting: false,
|
|
29655
29662
|
alert: {
|
|
29656
29663
|
type: "error",
|
|
@@ -29681,12 +29688,11 @@ const PaymentMethodSelectContainer = _ref => {
|
|
|
29681
29688
|
});
|
|
29682
29689
|
return onSuccess(selectedPaymentMethodId);
|
|
29683
29690
|
};
|
|
29684
|
-
const getInitialSelectedMethodId =
|
|
29685
|
-
var _window$Pelcro$user$r2;
|
|
29691
|
+
const getInitialSelectedMethodId = paymentMethods => {
|
|
29686
29692
|
if (selectedPaymentMethodIdFromStore) {
|
|
29687
29693
|
return selectedPaymentMethodIdFromStore;
|
|
29688
29694
|
}
|
|
29689
|
-
const defaultMethod = (
|
|
29695
|
+
const defaultMethod = getDefaultPaymentMethod(paymentMethods);
|
|
29690
29696
|
if (defaultMethod && defaultMethod.status === "chargeable") {
|
|
29691
29697
|
return String(defaultMethod.id);
|
|
29692
29698
|
}
|
|
@@ -29703,7 +29709,12 @@ const PaymentMethodSelectContainer = _ref => {
|
|
|
29703
29709
|
return lib_7({
|
|
29704
29710
|
...state,
|
|
29705
29711
|
paymentMethods: moveDefaultPaymentMethodToStart(action.payload),
|
|
29706
|
-
selectedPaymentMethodId: getInitialSelectedMethodId()
|
|
29712
|
+
selectedPaymentMethodId: getInitialSelectedMethodId(action.payload)
|
|
29713
|
+
});
|
|
29714
|
+
case SKELETON_LOADER:
|
|
29715
|
+
return lib_7({
|
|
29716
|
+
...state,
|
|
29717
|
+
skeletonLoader: action.payload
|
|
29707
29718
|
});
|
|
29708
29719
|
case HANDLE_SUBMIT:
|
|
29709
29720
|
return lib_5({
|
|
@@ -29715,10 +29726,23 @@ const PaymentMethodSelectContainer = _ref => {
|
|
|
29715
29726
|
}
|
|
29716
29727
|
}, initialState$5);
|
|
29717
29728
|
React.useEffect(() => {
|
|
29718
|
-
|
|
29719
|
-
|
|
29720
|
-
|
|
29721
|
-
|
|
29729
|
+
window.Pelcro.paymentMethods.list({
|
|
29730
|
+
auth_token: window.Pelcro.user.read().auth_token
|
|
29731
|
+
}, (err, res) => {
|
|
29732
|
+
if (err) {
|
|
29733
|
+
return console.error(err);
|
|
29734
|
+
}
|
|
29735
|
+
if (res) {
|
|
29736
|
+
var _res$data;
|
|
29737
|
+
dispatch({
|
|
29738
|
+
type: LOAD_PAYMENT_METHODS,
|
|
29739
|
+
payload: (_res$data = res.data) !== null && _res$data !== void 0 ? _res$data : []
|
|
29740
|
+
});
|
|
29741
|
+
dispatch({
|
|
29742
|
+
type: SKELETON_LOADER,
|
|
29743
|
+
payload: false
|
|
29744
|
+
});
|
|
29745
|
+
}
|
|
29722
29746
|
});
|
|
29723
29747
|
}, []);
|
|
29724
29748
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -29747,7 +29771,8 @@ const PaymentMethodSelectList = () => {
|
|
|
29747
29771
|
dispatch,
|
|
29748
29772
|
state: {
|
|
29749
29773
|
paymentMethods,
|
|
29750
|
-
selectedPaymentMethodId
|
|
29774
|
+
selectedPaymentMethodId,
|
|
29775
|
+
skeletonLoader
|
|
29751
29776
|
}
|
|
29752
29777
|
} = React.useContext(store$5);
|
|
29753
29778
|
const handlePaymentMethodSelect = event => {
|
|
@@ -29756,7 +29781,9 @@ const PaymentMethodSelectList = () => {
|
|
|
29756
29781
|
payload: event.target.value
|
|
29757
29782
|
});
|
|
29758
29783
|
};
|
|
29759
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
29784
|
+
return /*#__PURE__*/React__default['default'].createElement("div", null, skeletonLoader ? /*#__PURE__*/React__default['default'].createElement("div", {
|
|
29785
|
+
className: "plc-w-full plc-h-20 plc-bg-gray-300 plc-rounded-md plc-animate-pulse"
|
|
29786
|
+
}) : /*#__PURE__*/React__default['default'].createElement("div", {
|
|
29760
29787
|
className: "plc-px-3 plc-py-2 plc-space-y-4 plc-overflow-y-scroll plc-max-h-80 pelcro-payment-method-select-wrapper"
|
|
29761
29788
|
}, paymentMethods.map(paymentMethod => {
|
|
29762
29789
|
var _paymentMethod$proper, _paymentMethod$proper2, _paymentMethod$proper3, _paymentMethod$proper4;
|
|
@@ -29779,7 +29806,7 @@ const PaymentMethodSelectList = () => {
|
|
|
29779
29806
|
}, "\u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 ", (_paymentMethod$proper2 = paymentMethod.properties) === null || _paymentMethod$proper2 === void 0 ? void 0 : _paymentMethod$proper2.last4), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
29780
29807
|
className: "plc-text-sm plc-text-gray-500"
|
|
29781
29808
|
}, t("select.expires"), " ", (_paymentMethod$proper3 = paymentMethod.properties) === null || _paymentMethod$proper3 === void 0 ? void 0 : _paymentMethod$proper3.exp_month, "/", (_paymentMethod$proper4 = paymentMethod.properties) === null || _paymentMethod$proper4 === void 0 ? void 0 : _paymentMethod$proper4.exp_year))));
|
|
29782
|
-
}));
|
|
29809
|
+
})));
|
|
29783
29810
|
};
|
|
29784
29811
|
|
|
29785
29812
|
const PaymentMethodSelectSubmit = _ref => {
|
|
@@ -29881,7 +29908,7 @@ const initialState$4 = {
|
|
|
29881
29908
|
paymentMethods: [],
|
|
29882
29909
|
selectedPaymentMethodId: null,
|
|
29883
29910
|
isSubmitting: false,
|
|
29884
|
-
disableSubmit:
|
|
29911
|
+
disableSubmit: true,
|
|
29885
29912
|
isLoading: false,
|
|
29886
29913
|
skeletonLoader: true,
|
|
29887
29914
|
showPaymentMethodSelect: false,
|
|
@@ -29927,6 +29954,10 @@ const PaymentMethodDeleteContainer = _ref => {
|
|
|
29927
29954
|
payload: true
|
|
29928
29955
|
});
|
|
29929
29956
|
}
|
|
29957
|
+
dispatch({
|
|
29958
|
+
type: DISABLE_SUBMIT,
|
|
29959
|
+
payload: false
|
|
29960
|
+
});
|
|
29930
29961
|
}
|
|
29931
29962
|
});
|
|
29932
29963
|
}, [paymentMethodToDelete]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
@@ -29940,15 +29971,15 @@ const PaymentMethodDeleteContainer = _ref => {
|
|
|
29940
29971
|
payment_method_id: paymentMethodId,
|
|
29941
29972
|
is_default: true
|
|
29942
29973
|
}, (err, res) => {
|
|
29943
|
-
dispatch({
|
|
29944
|
-
type: DISABLE_SUBMIT,
|
|
29945
|
-
payload: false
|
|
29946
|
-
});
|
|
29947
|
-
dispatch({
|
|
29948
|
-
type: LOADING,
|
|
29949
|
-
payload: false
|
|
29950
|
-
});
|
|
29951
29974
|
if (err) {
|
|
29975
|
+
dispatch({
|
|
29976
|
+
type: DISABLE_SUBMIT,
|
|
29977
|
+
payload: false
|
|
29978
|
+
});
|
|
29979
|
+
dispatch({
|
|
29980
|
+
type: LOADING,
|
|
29981
|
+
payload: false
|
|
29982
|
+
});
|
|
29952
29983
|
console.log(err);
|
|
29953
29984
|
onFailure(err);
|
|
29954
29985
|
return dispatch({
|
|
@@ -30162,7 +30193,7 @@ const PaymentMethodDeleteSubmit = _ref => {
|
|
|
30162
30193
|
dispatch,
|
|
30163
30194
|
state: {
|
|
30164
30195
|
isLoading,
|
|
30165
|
-
|
|
30196
|
+
disableSubmit,
|
|
30166
30197
|
showPaymentMethodSelect,
|
|
30167
30198
|
selectedPaymentMethodId
|
|
30168
30199
|
}
|
|
@@ -30174,7 +30205,7 @@ const PaymentMethodDeleteSubmit = _ref => {
|
|
|
30174
30205
|
});
|
|
30175
30206
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
30176
30207
|
},
|
|
30177
|
-
disabled: showPaymentMethodSelect ?
|
|
30208
|
+
disabled: showPaymentMethodSelect ? !selectedPaymentMethodId : disableSubmit,
|
|
30178
30209
|
isLoading: isLoading,
|
|
30179
30210
|
className: "plc-w-full"
|
|
30180
30211
|
}, otherProps), name !== null && name !== void 0 ? name : t("delete.buttons.delete"));
|
package/dist/index.esm.js
CHANGED
|
@@ -20418,7 +20418,8 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20418
20418
|
gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
|
|
20419
20419
|
address_id: product.address_required ? selectedAddressId : null
|
|
20420
20420
|
}, (err, res) => {
|
|
20421
|
-
|
|
20421
|
+
var _res$data;
|
|
20422
|
+
if (res !== null && res !== void 0 && (_res$data = res.data) !== null && _res$data !== void 0 && _res$data.setup_intent) {
|
|
20422
20423
|
return confirmStripeIntentSetup(res, "subCreate");
|
|
20423
20424
|
}
|
|
20424
20425
|
confirmStripeCardPayment(res, err, true);
|
|
@@ -20707,7 +20708,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20707
20708
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
20708
20709
|
token: source.id
|
|
20709
20710
|
}, (err, res) => {
|
|
20710
|
-
var _res$
|
|
20711
|
+
var _res$data2, _res$data2$setup_inte, _res$data3, _res$data3$setup_inte;
|
|
20711
20712
|
if (err) {
|
|
20712
20713
|
dispatch({
|
|
20713
20714
|
type: DISABLE_SUBMIT,
|
|
@@ -20726,7 +20727,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20726
20727
|
}
|
|
20727
20728
|
});
|
|
20728
20729
|
}
|
|
20729
|
-
if (((_res$
|
|
20730
|
+
if (((_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : (_res$data2$setup_inte = _res$data2.setup_intent) === null || _res$data2$setup_inte === void 0 ? void 0 : _res$data2$setup_inte.status) === "requires_action" || ((_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : (_res$data3$setup_inte = _res$data3.setup_intent) === null || _res$data3$setup_inte === void 0 ? void 0 : _res$data3$setup_inte.status) === "requires_confirmation") {
|
|
20730
20731
|
confirmStripeIntentSetup(res, "create");
|
|
20731
20732
|
} else {
|
|
20732
20733
|
dispatch({
|
|
@@ -20762,7 +20763,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20762
20763
|
exp_year: year,
|
|
20763
20764
|
is_default: isDefault
|
|
20764
20765
|
}, (err, res) => {
|
|
20765
|
-
var _res$
|
|
20766
|
+
var _res$data4, _res$data4$setup_inte, _res$data5, _res$data5$setup_inte;
|
|
20766
20767
|
dispatch({
|
|
20767
20768
|
type: DISABLE_SUBMIT,
|
|
20768
20769
|
payload: false
|
|
@@ -20781,7 +20782,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20781
20782
|
}
|
|
20782
20783
|
});
|
|
20783
20784
|
}
|
|
20784
|
-
if (((_res$
|
|
20785
|
+
if (((_res$data4 = res.data) === null || _res$data4 === void 0 ? void 0 : (_res$data4$setup_inte = _res$data4.setup_intent) === null || _res$data4$setup_inte === void 0 ? void 0 : _res$data4$setup_inte.status) === "requires_action" || ((_res$data5 = res.data) === null || _res$data5 === void 0 ? void 0 : (_res$data5$setup_inte = _res$data5.setup_intent) === null || _res$data5$setup_inte === void 0 ? void 0 : _res$data5$setup_inte.status) === "requires_confirmation") {
|
|
20785
20786
|
confirmStripeIntentSetup(res, "update");
|
|
20786
20787
|
} else {
|
|
20787
20788
|
dispatch({
|
|
@@ -20823,7 +20824,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20823
20824
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
20824
20825
|
token: source.id
|
|
20825
20826
|
}, (err, res) => {
|
|
20826
|
-
var _res$
|
|
20827
|
+
var _res$data6, _res$data6$setup_inte, _res$data7, _res$data7$setup_inte;
|
|
20827
20828
|
if (err) {
|
|
20828
20829
|
onFailure(err);
|
|
20829
20830
|
return dispatch({
|
|
@@ -20834,7 +20835,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20834
20835
|
}
|
|
20835
20836
|
});
|
|
20836
20837
|
}
|
|
20837
|
-
if (((_res$
|
|
20838
|
+
if (((_res$data6 = res.data) === null || _res$data6 === void 0 ? void 0 : (_res$data6$setup_inte = _res$data6.setup_intent) === null || _res$data6$setup_inte === void 0 ? void 0 : _res$data6$setup_inte.status) === "requires_action" || ((_res$data7 = res.data) === null || _res$data7 === void 0 ? void 0 : (_res$data7$setup_inte = _res$data7.setup_intent) === null || _res$data7$setup_inte === void 0 ? void 0 : _res$data7$setup_inte.status) === "requires_confirmation") {
|
|
20838
20839
|
confirmStripeIntentSetup(res, "replace", paymentMethodId);
|
|
20839
20840
|
} else {
|
|
20840
20841
|
setTimeout(() => {
|
|
@@ -20999,12 +21000,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20999
21000
|
coupon_code: state === null || state === void 0 ? void 0 : state.couponCode,
|
|
21000
21001
|
address_id: selectedAddressId
|
|
21001
21002
|
}, (error, res) => {
|
|
21002
|
-
var _res$
|
|
21003
|
+
var _res$data8, _res$data9;
|
|
21003
21004
|
if (error) {
|
|
21004
21005
|
return reject(error);
|
|
21005
21006
|
}
|
|
21006
|
-
const taxAmount = (_res$
|
|
21007
|
-
const totalAmountWithTax = (_res$
|
|
21007
|
+
const taxAmount = (_res$data8 = res.data) === null || _res$data8 === void 0 ? void 0 : _res$data8.taxes;
|
|
21008
|
+
const totalAmountWithTax = (_res$data9 = res.data) === null || _res$data9 === void 0 ? void 0 : _res$data9.total;
|
|
21008
21009
|
resolve({
|
|
21009
21010
|
totalAmountWithTax,
|
|
21010
21011
|
taxAmount
|
|
@@ -27253,7 +27254,8 @@ const PasswordResetContainer = _ref => {
|
|
|
27253
27254
|
email,
|
|
27254
27255
|
password,
|
|
27255
27256
|
password_confirmation: confirmPassword,
|
|
27256
|
-
token
|
|
27257
|
+
token,
|
|
27258
|
+
referer: window.location.origin
|
|
27257
27259
|
}, (err, res) => {
|
|
27258
27260
|
dispatch({
|
|
27259
27261
|
type: DISABLE_SUBMIT,
|
|
@@ -27485,7 +27487,8 @@ const PasswordForgotContainer = _ref => {
|
|
|
27485
27487
|
email
|
|
27486
27488
|
} = _ref2;
|
|
27487
27489
|
window.Pelcro.password.forgot({
|
|
27488
|
-
email
|
|
27490
|
+
email,
|
|
27491
|
+
referer: window.location.origin
|
|
27489
27492
|
}, (err, res) => {
|
|
27490
27493
|
dispatch({
|
|
27491
27494
|
type: DISABLE_SUBMIT,
|
|
@@ -29610,17 +29613,21 @@ const AddressSelectModal = _ref => {
|
|
|
29610
29613
|
AddressSelectModal.viewId = "address-select";
|
|
29611
29614
|
|
|
29612
29615
|
const moveDefaultPaymentMethodToStart = paymentMethods => {
|
|
29613
|
-
|
|
29614
|
-
const defaultPaymentMethod = (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.source;
|
|
29616
|
+
const defaultPaymentMethod = getDefaultPaymentMethod(paymentMethods);
|
|
29615
29617
|
const paymentMethodsWithoutDefault = paymentMethods.filter(paymentMethod => paymentMethod.id !== defaultPaymentMethod.id);
|
|
29616
29618
|
if (defaultPaymentMethod.status !== "chargeable") {
|
|
29617
29619
|
return paymentMethodsWithoutDefault;
|
|
29618
29620
|
}
|
|
29619
29621
|
return [defaultPaymentMethod, ...paymentMethodsWithoutDefault];
|
|
29620
29622
|
};
|
|
29623
|
+
const getDefaultPaymentMethod = paymentMethods => {
|
|
29624
|
+
const defaultPaymentMethod = paymentMethods.find(paymentMethod => paymentMethod.is_default);
|
|
29625
|
+
return defaultPaymentMethod;
|
|
29626
|
+
};
|
|
29621
29627
|
const initialState$5 = {
|
|
29622
29628
|
paymentMethods: [],
|
|
29623
29629
|
selectedPaymentMethodId: null,
|
|
29630
|
+
skeletonLoader: true,
|
|
29624
29631
|
isSubmitting: false,
|
|
29625
29632
|
alert: {
|
|
29626
29633
|
type: "error",
|
|
@@ -29651,12 +29658,11 @@ const PaymentMethodSelectContainer = _ref => {
|
|
|
29651
29658
|
});
|
|
29652
29659
|
return onSuccess(selectedPaymentMethodId);
|
|
29653
29660
|
};
|
|
29654
|
-
const getInitialSelectedMethodId =
|
|
29655
|
-
var _window$Pelcro$user$r2;
|
|
29661
|
+
const getInitialSelectedMethodId = paymentMethods => {
|
|
29656
29662
|
if (selectedPaymentMethodIdFromStore) {
|
|
29657
29663
|
return selectedPaymentMethodIdFromStore;
|
|
29658
29664
|
}
|
|
29659
|
-
const defaultMethod = (
|
|
29665
|
+
const defaultMethod = getDefaultPaymentMethod(paymentMethods);
|
|
29660
29666
|
if (defaultMethod && defaultMethod.status === "chargeable") {
|
|
29661
29667
|
return String(defaultMethod.id);
|
|
29662
29668
|
}
|
|
@@ -29673,7 +29679,12 @@ const PaymentMethodSelectContainer = _ref => {
|
|
|
29673
29679
|
return lib_7({
|
|
29674
29680
|
...state,
|
|
29675
29681
|
paymentMethods: moveDefaultPaymentMethodToStart(action.payload),
|
|
29676
|
-
selectedPaymentMethodId: getInitialSelectedMethodId()
|
|
29682
|
+
selectedPaymentMethodId: getInitialSelectedMethodId(action.payload)
|
|
29683
|
+
});
|
|
29684
|
+
case SKELETON_LOADER:
|
|
29685
|
+
return lib_7({
|
|
29686
|
+
...state,
|
|
29687
|
+
skeletonLoader: action.payload
|
|
29677
29688
|
});
|
|
29678
29689
|
case HANDLE_SUBMIT:
|
|
29679
29690
|
return lib_5({
|
|
@@ -29685,10 +29696,23 @@ const PaymentMethodSelectContainer = _ref => {
|
|
|
29685
29696
|
}
|
|
29686
29697
|
}, initialState$5);
|
|
29687
29698
|
useEffect(() => {
|
|
29688
|
-
|
|
29689
|
-
|
|
29690
|
-
|
|
29691
|
-
|
|
29699
|
+
window.Pelcro.paymentMethods.list({
|
|
29700
|
+
auth_token: window.Pelcro.user.read().auth_token
|
|
29701
|
+
}, (err, res) => {
|
|
29702
|
+
if (err) {
|
|
29703
|
+
return console.error(err);
|
|
29704
|
+
}
|
|
29705
|
+
if (res) {
|
|
29706
|
+
var _res$data;
|
|
29707
|
+
dispatch({
|
|
29708
|
+
type: LOAD_PAYMENT_METHODS,
|
|
29709
|
+
payload: (_res$data = res.data) !== null && _res$data !== void 0 ? _res$data : []
|
|
29710
|
+
});
|
|
29711
|
+
dispatch({
|
|
29712
|
+
type: SKELETON_LOADER,
|
|
29713
|
+
payload: false
|
|
29714
|
+
});
|
|
29715
|
+
}
|
|
29692
29716
|
});
|
|
29693
29717
|
}, []);
|
|
29694
29718
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -29717,7 +29741,8 @@ const PaymentMethodSelectList = () => {
|
|
|
29717
29741
|
dispatch,
|
|
29718
29742
|
state: {
|
|
29719
29743
|
paymentMethods,
|
|
29720
|
-
selectedPaymentMethodId
|
|
29744
|
+
selectedPaymentMethodId,
|
|
29745
|
+
skeletonLoader
|
|
29721
29746
|
}
|
|
29722
29747
|
} = useContext(store$5);
|
|
29723
29748
|
const handlePaymentMethodSelect = event => {
|
|
@@ -29726,7 +29751,9 @@ const PaymentMethodSelectList = () => {
|
|
|
29726
29751
|
payload: event.target.value
|
|
29727
29752
|
});
|
|
29728
29753
|
};
|
|
29729
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
29754
|
+
return /*#__PURE__*/React__default.createElement("div", null, skeletonLoader ? /*#__PURE__*/React__default.createElement("div", {
|
|
29755
|
+
className: "plc-w-full plc-h-20 plc-bg-gray-300 plc-rounded-md plc-animate-pulse"
|
|
29756
|
+
}) : /*#__PURE__*/React__default.createElement("div", {
|
|
29730
29757
|
className: "plc-px-3 plc-py-2 plc-space-y-4 plc-overflow-y-scroll plc-max-h-80 pelcro-payment-method-select-wrapper"
|
|
29731
29758
|
}, paymentMethods.map(paymentMethod => {
|
|
29732
29759
|
var _paymentMethod$proper, _paymentMethod$proper2, _paymentMethod$proper3, _paymentMethod$proper4;
|
|
@@ -29749,7 +29776,7 @@ const PaymentMethodSelectList = () => {
|
|
|
29749
29776
|
}, "\u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 ", (_paymentMethod$proper2 = paymentMethod.properties) === null || _paymentMethod$proper2 === void 0 ? void 0 : _paymentMethod$proper2.last4), /*#__PURE__*/React__default.createElement("p", {
|
|
29750
29777
|
className: "plc-text-sm plc-text-gray-500"
|
|
29751
29778
|
}, t("select.expires"), " ", (_paymentMethod$proper3 = paymentMethod.properties) === null || _paymentMethod$proper3 === void 0 ? void 0 : _paymentMethod$proper3.exp_month, "/", (_paymentMethod$proper4 = paymentMethod.properties) === null || _paymentMethod$proper4 === void 0 ? void 0 : _paymentMethod$proper4.exp_year))));
|
|
29752
|
-
}));
|
|
29779
|
+
})));
|
|
29753
29780
|
};
|
|
29754
29781
|
|
|
29755
29782
|
const PaymentMethodSelectSubmit = _ref => {
|
|
@@ -29851,7 +29878,7 @@ const initialState$4 = {
|
|
|
29851
29878
|
paymentMethods: [],
|
|
29852
29879
|
selectedPaymentMethodId: null,
|
|
29853
29880
|
isSubmitting: false,
|
|
29854
|
-
disableSubmit:
|
|
29881
|
+
disableSubmit: true,
|
|
29855
29882
|
isLoading: false,
|
|
29856
29883
|
skeletonLoader: true,
|
|
29857
29884
|
showPaymentMethodSelect: false,
|
|
@@ -29897,6 +29924,10 @@ const PaymentMethodDeleteContainer = _ref => {
|
|
|
29897
29924
|
payload: true
|
|
29898
29925
|
});
|
|
29899
29926
|
}
|
|
29927
|
+
dispatch({
|
|
29928
|
+
type: DISABLE_SUBMIT,
|
|
29929
|
+
payload: false
|
|
29930
|
+
});
|
|
29900
29931
|
}
|
|
29901
29932
|
});
|
|
29902
29933
|
}, [paymentMethodToDelete]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
@@ -29910,15 +29941,15 @@ const PaymentMethodDeleteContainer = _ref => {
|
|
|
29910
29941
|
payment_method_id: paymentMethodId,
|
|
29911
29942
|
is_default: true
|
|
29912
29943
|
}, (err, res) => {
|
|
29913
|
-
dispatch({
|
|
29914
|
-
type: DISABLE_SUBMIT,
|
|
29915
|
-
payload: false
|
|
29916
|
-
});
|
|
29917
|
-
dispatch({
|
|
29918
|
-
type: LOADING,
|
|
29919
|
-
payload: false
|
|
29920
|
-
});
|
|
29921
29944
|
if (err) {
|
|
29945
|
+
dispatch({
|
|
29946
|
+
type: DISABLE_SUBMIT,
|
|
29947
|
+
payload: false
|
|
29948
|
+
});
|
|
29949
|
+
dispatch({
|
|
29950
|
+
type: LOADING,
|
|
29951
|
+
payload: false
|
|
29952
|
+
});
|
|
29922
29953
|
console.log(err);
|
|
29923
29954
|
onFailure(err);
|
|
29924
29955
|
return dispatch({
|
|
@@ -30132,7 +30163,7 @@ const PaymentMethodDeleteSubmit = _ref => {
|
|
|
30132
30163
|
dispatch,
|
|
30133
30164
|
state: {
|
|
30134
30165
|
isLoading,
|
|
30135
|
-
|
|
30166
|
+
disableSubmit,
|
|
30136
30167
|
showPaymentMethodSelect,
|
|
30137
30168
|
selectedPaymentMethodId
|
|
30138
30169
|
}
|
|
@@ -30144,7 +30175,7 @@ const PaymentMethodDeleteSubmit = _ref => {
|
|
|
30144
30175
|
});
|
|
30145
30176
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
30146
30177
|
},
|
|
30147
|
-
disabled: showPaymentMethodSelect ?
|
|
30178
|
+
disabled: showPaymentMethodSelect ? !selectedPaymentMethodId : disableSubmit,
|
|
30148
30179
|
isLoading: isLoading,
|
|
30149
30180
|
className: "plc-w-full"
|
|
30150
30181
|
}, otherProps), name !== null && name !== void 0 ? name : t("delete.buttons.delete"));
|