@pelcro/react-pelcro-js 4.0.0-alpha.62 → 4.0.0-alpha.64
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 +263 -203
- package/dist/index.esm.js +264 -203
- package/dist/pelcro.css +16 -13
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -3330,12 +3330,19 @@ var paymentMethod_en = {
|
|
|
3330
3330
|
select: select$6,
|
|
3331
3331
|
"delete": {
|
|
3332
3332
|
title: "Delete payment method",
|
|
3333
|
-
subtitle: "
|
|
3333
|
+
subtitle: "Are you sure you want to delete the selected payment method?",
|
|
3334
|
+
details: "Payment method details",
|
|
3335
|
+
message: "This action is irreversible and will permanently remove the payment method from the system. Please ensure that there are no pending transactions or subscriptions associated with this payment method.",
|
|
3336
|
+
buttons: {
|
|
3337
|
+
"delete": "Delete payment method",
|
|
3338
|
+
back: "Go back"
|
|
3339
|
+
},
|
|
3334
3340
|
options: {
|
|
3335
|
-
select: "Select
|
|
3341
|
+
select: "Select a payment method to be the default",
|
|
3336
3342
|
add: "Add a new payment method"
|
|
3337
3343
|
},
|
|
3338
|
-
paymentMethodReplaced: "Payment Method Successfully Deleted and Replaced"
|
|
3344
|
+
paymentMethodReplaced: "Payment Method Successfully Deleted and Replaced",
|
|
3345
|
+
deletedSuccessfully: "Payment Method Successfully Deleted"
|
|
3339
3346
|
},
|
|
3340
3347
|
create: create$5
|
|
3341
3348
|
};
|
|
@@ -9841,6 +9848,21 @@ function notifyBugsnag(callback, startOptions) {
|
|
|
9841
9848
|
|
|
9842
9849
|
callback();
|
|
9843
9850
|
}
|
|
9851
|
+
const refreshUser = () => {
|
|
9852
|
+
var _window$Pelcro6, _window$Pelcro6$user, _window$Pelcro6$user$;
|
|
9853
|
+
|
|
9854
|
+
window.Pelcro.user.refresh({
|
|
9855
|
+
auth_token: (_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$ = _window$Pelcro6$user.read()) === null || _window$Pelcro6$user$ === void 0 ? void 0 : _window$Pelcro6$user$.auth_token
|
|
9856
|
+
}, (err, res) => {
|
|
9857
|
+
if (err) {
|
|
9858
|
+
console.error(err);
|
|
9859
|
+
}
|
|
9860
|
+
|
|
9861
|
+
if (res) {
|
|
9862
|
+
return res.data;
|
|
9863
|
+
}
|
|
9864
|
+
});
|
|
9865
|
+
};
|
|
9844
9866
|
|
|
9845
9867
|
const resources = {
|
|
9846
9868
|
en: {
|
|
@@ -12827,8 +12849,8 @@ const SET_CANCEL_SUBSCRIPTION_REASON = "SET_CANCEL_SUBSCRIPTION_REASON";
|
|
|
12827
12849
|
const SET_CANCEL_SUBSCRIPTION_OPTION = "SET_CANCEL_SUBSCRIPTION_OPTION";
|
|
12828
12850
|
const HANDLE_CHECKBOX_CHANGE = "HANDLE_CHECKBOX_CHANGE";
|
|
12829
12851
|
const SET_IS_DEFAULT_PAYMENT_METHOD = "SET_IS_DEFAULT_PAYMENT_METHOD";
|
|
12830
|
-
const SET_DELETE_PAYMENT_METHOD_OPTION = "SET_DELETE_PAYMENT_METHOD_OPTION";
|
|
12831
12852
|
const SET_PAYMENT_METHODS = "SET_PAYMENT_METHODS";
|
|
12853
|
+
const SHOW_PAYMENT_METHOD_SELECT = "SHOW_PAYMENT_METHOD_SELECT";
|
|
12832
12854
|
const SET_SUBSCRIPTION_SUSPEND_DATE = "SET_SUBSCRIPTION_SUSPEND_DATE";
|
|
12833
12855
|
const SET_EMAILS = "SET_EMAILS";
|
|
12834
12856
|
const SET_EMAILS_ERROR = "SET_EMAILS_ERROR";
|
|
@@ -23227,6 +23249,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23227
23249
|
content: t("messages.sourceCreated")
|
|
23228
23250
|
}
|
|
23229
23251
|
});
|
|
23252
|
+
refreshUser();
|
|
23230
23253
|
onSuccess(res);
|
|
23231
23254
|
});
|
|
23232
23255
|
}
|
|
@@ -23285,6 +23308,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23285
23308
|
});
|
|
23286
23309
|
}
|
|
23287
23310
|
|
|
23311
|
+
refreshUser();
|
|
23288
23312
|
onSuccess(res);
|
|
23289
23313
|
});
|
|
23290
23314
|
}, 2000);
|
|
@@ -23349,6 +23373,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23349
23373
|
content: t("messages.sourceUpdated")
|
|
23350
23374
|
}
|
|
23351
23375
|
});
|
|
23376
|
+
refreshUser();
|
|
23352
23377
|
onSuccess(res);
|
|
23353
23378
|
});
|
|
23354
23379
|
}
|
|
@@ -23755,6 +23780,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23755
23780
|
type: LOADING,
|
|
23756
23781
|
payload: false
|
|
23757
23782
|
});
|
|
23783
|
+
refreshUser();
|
|
23758
23784
|
onSuccess(res);
|
|
23759
23785
|
return;
|
|
23760
23786
|
}
|
|
@@ -23771,6 +23797,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23771
23797
|
content: t("messages.sourceCreated")
|
|
23772
23798
|
}
|
|
23773
23799
|
});
|
|
23800
|
+
refreshUser();
|
|
23774
23801
|
onSuccess(res);
|
|
23775
23802
|
return;
|
|
23776
23803
|
}
|
|
@@ -23791,6 +23818,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23791
23818
|
content: t("messages.sourceUpdated")
|
|
23792
23819
|
}
|
|
23793
23820
|
});
|
|
23821
|
+
refreshUser();
|
|
23794
23822
|
onSuccess(res);
|
|
23795
23823
|
return;
|
|
23796
23824
|
}
|
|
@@ -23821,6 +23849,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23821
23849
|
});
|
|
23822
23850
|
}
|
|
23823
23851
|
|
|
23852
|
+
refreshUser();
|
|
23824
23853
|
onSuccess(res);
|
|
23825
23854
|
});
|
|
23826
23855
|
}, 2000);
|
|
@@ -23855,7 +23884,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23855
23884
|
gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
|
|
23856
23885
|
address_id: product.address_required ? selectedAddressId : null
|
|
23857
23886
|
}, (err, res) => {
|
|
23858
|
-
|
|
23887
|
+
var _res$data;
|
|
23888
|
+
|
|
23889
|
+
if (res !== null && res !== void 0 && (_res$data = res.data) !== null && _res$data !== void 0 && _res$data.setup_intent) {
|
|
23859
23890
|
return confirmStripeIntentSetup(res, "subCreate");
|
|
23860
23891
|
}
|
|
23861
23892
|
|
|
@@ -24056,7 +24087,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24056
24087
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
24057
24088
|
token: result.paymentMethod.id
|
|
24058
24089
|
}, (err, res) => {
|
|
24059
|
-
var _res$
|
|
24090
|
+
var _res$data2, _res$data2$setup_inte, _res$data3, _res$data3$setup_inte;
|
|
24060
24091
|
|
|
24061
24092
|
if (err) {
|
|
24062
24093
|
dispatch({
|
|
@@ -24077,7 +24108,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24077
24108
|
});
|
|
24078
24109
|
}
|
|
24079
24110
|
|
|
24080
|
-
if (((_res$
|
|
24111
|
+
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") {
|
|
24081
24112
|
confirmStripeIntentSetup(res, "create");
|
|
24082
24113
|
} else {
|
|
24083
24114
|
dispatch({
|
|
@@ -24091,6 +24122,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24091
24122
|
content: t("messages.sourceCreated")
|
|
24092
24123
|
}
|
|
24093
24124
|
});
|
|
24125
|
+
refreshUser();
|
|
24094
24126
|
onSuccess(res);
|
|
24095
24127
|
}
|
|
24096
24128
|
});
|
|
@@ -24115,7 +24147,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24115
24147
|
exp_year: year,
|
|
24116
24148
|
is_default: isDefault
|
|
24117
24149
|
}, (err, res) => {
|
|
24118
|
-
var _res$
|
|
24150
|
+
var _res$data4, _res$data4$setup_inte, _res$data5, _res$data5$setup_inte;
|
|
24119
24151
|
|
|
24120
24152
|
dispatch({
|
|
24121
24153
|
type: DISABLE_SUBMIT,
|
|
@@ -24137,7 +24169,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24137
24169
|
});
|
|
24138
24170
|
}
|
|
24139
24171
|
|
|
24140
|
-
if (((_res$
|
|
24172
|
+
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") {
|
|
24141
24173
|
confirmStripeIntentSetup(res, "update");
|
|
24142
24174
|
} else {
|
|
24143
24175
|
dispatch({
|
|
@@ -24147,6 +24179,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24147
24179
|
content: t("messages.sourceUpdated")
|
|
24148
24180
|
}
|
|
24149
24181
|
});
|
|
24182
|
+
refreshUser();
|
|
24150
24183
|
onSuccess(res);
|
|
24151
24184
|
}
|
|
24152
24185
|
});
|
|
@@ -24181,7 +24214,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24181
24214
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
24182
24215
|
token: result.paymentMethod.id
|
|
24183
24216
|
}, (err, res) => {
|
|
24184
|
-
var _res$
|
|
24217
|
+
var _res$data6, _res$data6$setup_inte, _res$data7, _res$data7$setup_inte;
|
|
24185
24218
|
|
|
24186
24219
|
if (err) {
|
|
24187
24220
|
onFailure(err);
|
|
@@ -24194,7 +24227,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24194
24227
|
});
|
|
24195
24228
|
}
|
|
24196
24229
|
|
|
24197
|
-
if (((_res$
|
|
24230
|
+
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") {
|
|
24198
24231
|
confirmStripeIntentSetup(res, "replace", paymentMethodId);
|
|
24199
24232
|
} else {
|
|
24200
24233
|
setTimeout(() => {
|
|
@@ -24222,6 +24255,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24222
24255
|
});
|
|
24223
24256
|
}
|
|
24224
24257
|
|
|
24258
|
+
refreshUser();
|
|
24225
24259
|
onSuccess(res);
|
|
24226
24260
|
});
|
|
24227
24261
|
}, 2000);
|
|
@@ -24806,14 +24840,14 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24806
24840
|
coupon_code: state === null || state === void 0 ? void 0 : state.couponCode,
|
|
24807
24841
|
address_id: selectedAddressId
|
|
24808
24842
|
}, (error, res) => {
|
|
24809
|
-
var _res$
|
|
24843
|
+
var _res$data8, _res$data9;
|
|
24810
24844
|
|
|
24811
24845
|
if (error) {
|
|
24812
24846
|
return reject(error);
|
|
24813
24847
|
}
|
|
24814
24848
|
|
|
24815
|
-
const taxAmount = (_res$
|
|
24816
|
-
const totalAmountWithTax = (_res$
|
|
24849
|
+
const taxAmount = (_res$data8 = res.data) === null || _res$data8 === void 0 ? void 0 : _res$data8.taxes;
|
|
24850
|
+
const totalAmountWithTax = (_res$data9 = res.data) === null || _res$data9 === void 0 ? void 0 : _res$data9.total;
|
|
24817
24851
|
resolve({
|
|
24818
24852
|
totalAmountWithTax,
|
|
24819
24853
|
taxAmount
|
|
@@ -33715,9 +33749,7 @@ const BillingAddressSelectModal = ({
|
|
|
33715
33749
|
BillingAddressSelectModal.viewId = "billing-address-select";
|
|
33716
33750
|
|
|
33717
33751
|
const moveDefaultPaymentMethodToStart = paymentMethods => {
|
|
33718
|
-
|
|
33719
|
-
|
|
33720
|
-
const defaultPaymentMethod = (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.source;
|
|
33752
|
+
const defaultPaymentMethod = getDefaultPaymentMethod(paymentMethods);
|
|
33721
33753
|
const paymentMethodsWithoutDefault = paymentMethods.filter(paymentMethod => paymentMethod.id !== defaultPaymentMethod.id);
|
|
33722
33754
|
|
|
33723
33755
|
if (defaultPaymentMethod.status !== "chargeable") {
|
|
@@ -33727,9 +33759,15 @@ const moveDefaultPaymentMethodToStart = paymentMethods => {
|
|
|
33727
33759
|
return [defaultPaymentMethod, ...paymentMethodsWithoutDefault];
|
|
33728
33760
|
};
|
|
33729
33761
|
|
|
33762
|
+
const getDefaultPaymentMethod = paymentMethods => {
|
|
33763
|
+
const defaultPaymentMethod = paymentMethods.find(paymentMethod => paymentMethod.is_default);
|
|
33764
|
+
return defaultPaymentMethod;
|
|
33765
|
+
};
|
|
33766
|
+
|
|
33730
33767
|
const initialState$6 = {
|
|
33731
33768
|
paymentMethods: [],
|
|
33732
33769
|
selectedPaymentMethodId: null,
|
|
33770
|
+
skeletonLoader: true,
|
|
33733
33771
|
isSubmitting: false,
|
|
33734
33772
|
alert: {
|
|
33735
33773
|
type: "error",
|
|
@@ -33761,14 +33799,12 @@ const PaymentMethodSelectContainer = ({
|
|
|
33761
33799
|
return onSuccess(selectedPaymentMethodId);
|
|
33762
33800
|
};
|
|
33763
33801
|
|
|
33764
|
-
const getInitialSelectedMethodId =
|
|
33765
|
-
var _window$Pelcro$user$r2;
|
|
33766
|
-
|
|
33802
|
+
const getInitialSelectedMethodId = paymentMethods => {
|
|
33767
33803
|
if (selectedPaymentMethodIdFromStore) {
|
|
33768
33804
|
return selectedPaymentMethodIdFromStore;
|
|
33769
33805
|
}
|
|
33770
33806
|
|
|
33771
|
-
const defaultMethod = (
|
|
33807
|
+
const defaultMethod = getDefaultPaymentMethod(paymentMethods);
|
|
33772
33808
|
|
|
33773
33809
|
if (defaultMethod && defaultMethod.status === "chargeable") {
|
|
33774
33810
|
return String(defaultMethod.id);
|
|
@@ -33787,7 +33823,12 @@ const PaymentMethodSelectContainer = ({
|
|
|
33787
33823
|
case LOAD_PAYMENT_METHODS:
|
|
33788
33824
|
return lib_7({ ...state,
|
|
33789
33825
|
paymentMethods: moveDefaultPaymentMethodToStart(action.payload),
|
|
33790
|
-
selectedPaymentMethodId: getInitialSelectedMethodId()
|
|
33826
|
+
selectedPaymentMethodId: getInitialSelectedMethodId(action.payload)
|
|
33827
|
+
});
|
|
33828
|
+
|
|
33829
|
+
case SKELETON_LOADER:
|
|
33830
|
+
return lib_7({ ...state,
|
|
33831
|
+
skeletonLoader: action.payload
|
|
33791
33832
|
});
|
|
33792
33833
|
|
|
33793
33834
|
case HANDLE_SUBMIT:
|
|
@@ -33800,11 +33841,25 @@ const PaymentMethodSelectContainer = ({
|
|
|
33800
33841
|
}
|
|
33801
33842
|
}, initialState$6);
|
|
33802
33843
|
useEffect(() => {
|
|
33803
|
-
|
|
33844
|
+
window.Pelcro.paymentMethods.list({
|
|
33845
|
+
auth_token: window.Pelcro.user.read().auth_token
|
|
33846
|
+
}, (err, res) => {
|
|
33847
|
+
if (err) {
|
|
33848
|
+
return console.error(err);
|
|
33849
|
+
}
|
|
33804
33850
|
|
|
33805
|
-
|
|
33806
|
-
|
|
33807
|
-
|
|
33851
|
+
if (res) {
|
|
33852
|
+
var _res$data;
|
|
33853
|
+
|
|
33854
|
+
dispatch({
|
|
33855
|
+
type: LOAD_PAYMENT_METHODS,
|
|
33856
|
+
payload: (_res$data = res.data) !== null && _res$data !== void 0 ? _res$data : []
|
|
33857
|
+
});
|
|
33858
|
+
dispatch({
|
|
33859
|
+
type: SKELETON_LOADER,
|
|
33860
|
+
payload: false
|
|
33861
|
+
});
|
|
33862
|
+
}
|
|
33808
33863
|
});
|
|
33809
33864
|
}, []);
|
|
33810
33865
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -33832,7 +33887,8 @@ const PaymentMethodSelectList = () => {
|
|
|
33832
33887
|
dispatch,
|
|
33833
33888
|
state: {
|
|
33834
33889
|
paymentMethods,
|
|
33835
|
-
selectedPaymentMethodId
|
|
33890
|
+
selectedPaymentMethodId,
|
|
33891
|
+
skeletonLoader
|
|
33836
33892
|
}
|
|
33837
33893
|
} = useContext(store$6);
|
|
33838
33894
|
|
|
@@ -33843,7 +33899,9 @@ const PaymentMethodSelectList = () => {
|
|
|
33843
33899
|
});
|
|
33844
33900
|
};
|
|
33845
33901
|
|
|
33846
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
33902
|
+
return /*#__PURE__*/React__default.createElement("div", null, skeletonLoader ? /*#__PURE__*/React__default.createElement("div", {
|
|
33903
|
+
className: "plc-w-full plc-h-20 plc-bg-gray-300 plc-rounded-md plc-animate-pulse"
|
|
33904
|
+
}) : /*#__PURE__*/React__default.createElement("div", {
|
|
33847
33905
|
className: "plc-px-3 plc-py-2 plc-space-y-4 plc-overflow-y-scroll plc-max-h-80 pelcro-payment-method-select-wrapper"
|
|
33848
33906
|
}, paymentMethods.map(paymentMethod => {
|
|
33849
33907
|
var _paymentMethod$proper, _paymentMethod$proper2, _paymentMethod$proper3, _paymentMethod$proper4, _paymentMethod$proper5;
|
|
@@ -33867,7 +33925,7 @@ const PaymentMethodSelectList = () => {
|
|
|
33867
33925
|
}, (paymentMethod === null || paymentMethod === void 0 ? void 0 : (_paymentMethod$proper2 = paymentMethod.properties) === null || _paymentMethod$proper2 === void 0 ? void 0 : _paymentMethod$proper2.brand) === "bacs_debit" ? "••••" : "•••• •••• ••••", " ", paymentMethod === null || paymentMethod === void 0 ? void 0 : (_paymentMethod$proper3 = paymentMethod.properties) === null || _paymentMethod$proper3 === void 0 ? void 0 : _paymentMethod$proper3.last4), paymentMethod.properties.brand !== "bacs_debit" && /*#__PURE__*/React__default.createElement("p", {
|
|
33868
33926
|
className: "plc-text-sm plc-text-gray-500"
|
|
33869
33927
|
}, t("select.expires"), " ", (_paymentMethod$proper4 = paymentMethod.properties) === null || _paymentMethod$proper4 === void 0 ? void 0 : _paymentMethod$proper4.exp_month, "/", (_paymentMethod$proper5 = paymentMethod.properties) === null || _paymentMethod$proper5 === void 0 ? void 0 : _paymentMethod$proper5.exp_year))));
|
|
33870
|
-
}));
|
|
33928
|
+
})));
|
|
33871
33929
|
};
|
|
33872
33930
|
|
|
33873
33931
|
const PaymentMethodSelectSubmit = ({
|
|
@@ -33977,10 +34035,10 @@ const initialState$5 = {
|
|
|
33977
34035
|
paymentMethods: [],
|
|
33978
34036
|
selectedPaymentMethodId: null,
|
|
33979
34037
|
isSubmitting: false,
|
|
33980
|
-
|
|
33981
|
-
disableSubmit: false,
|
|
34038
|
+
disableSubmit: true,
|
|
33982
34039
|
isLoading: false,
|
|
33983
34040
|
skeletonLoader: true,
|
|
34041
|
+
showPaymentMethodSelect: false,
|
|
33984
34042
|
alert: {
|
|
33985
34043
|
type: "error",
|
|
33986
34044
|
content: ""
|
|
@@ -34019,20 +34077,20 @@ const PaymentMethodDeleteContainer = ({
|
|
|
34019
34077
|
payload: false
|
|
34020
34078
|
});
|
|
34021
34079
|
|
|
34022
|
-
if (res.data.length !== 1) {
|
|
34023
|
-
dispatch({
|
|
34024
|
-
type: SET_DELETE_PAYMENT_METHOD_OPTION,
|
|
34025
|
-
payload: "select"
|
|
34026
|
-
});
|
|
34027
|
-
} else {
|
|
34080
|
+
if (res.data.length !== 1 && paymentMethodToDelete.is_default && paymentMethodToDelete.deletable) {
|
|
34028
34081
|
dispatch({
|
|
34029
|
-
type:
|
|
34030
|
-
payload:
|
|
34082
|
+
type: SHOW_PAYMENT_METHOD_SELECT,
|
|
34083
|
+
payload: true
|
|
34031
34084
|
});
|
|
34032
34085
|
}
|
|
34086
|
+
|
|
34087
|
+
dispatch({
|
|
34088
|
+
type: DISABLE_SUBMIT,
|
|
34089
|
+
payload: false
|
|
34090
|
+
});
|
|
34033
34091
|
}
|
|
34034
34092
|
});
|
|
34035
|
-
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
34093
|
+
}, [paymentMethodToDelete]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
34036
34094
|
|
|
34037
34095
|
const setDefaultPaymentMethod = () => {
|
|
34038
34096
|
const {
|
|
@@ -34044,6 +34102,15 @@ const PaymentMethodDeleteContainer = ({
|
|
|
34044
34102
|
is_default: true
|
|
34045
34103
|
}, (err, res) => {
|
|
34046
34104
|
if (err) {
|
|
34105
|
+
dispatch({
|
|
34106
|
+
type: DISABLE_SUBMIT,
|
|
34107
|
+
payload: false
|
|
34108
|
+
});
|
|
34109
|
+
dispatch({
|
|
34110
|
+
type: LOADING,
|
|
34111
|
+
payload: false
|
|
34112
|
+
});
|
|
34113
|
+
console.log(err);
|
|
34047
34114
|
onFailure(err);
|
|
34048
34115
|
return dispatch({
|
|
34049
34116
|
type: SHOW_ALERT,
|
|
@@ -34068,6 +34135,15 @@ const PaymentMethodDeleteContainer = ({
|
|
|
34068
34135
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
34069
34136
|
payment_method_id: paymentMethodId
|
|
34070
34137
|
}, (err, res) => {
|
|
34138
|
+
dispatch({
|
|
34139
|
+
type: DISABLE_SUBMIT,
|
|
34140
|
+
payload: false
|
|
34141
|
+
});
|
|
34142
|
+
dispatch({
|
|
34143
|
+
type: LOADING,
|
|
34144
|
+
payload: false
|
|
34145
|
+
});
|
|
34146
|
+
|
|
34071
34147
|
if (err) {
|
|
34072
34148
|
onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
34073
34149
|
return dispatch({
|
|
@@ -34079,14 +34155,7 @@ const PaymentMethodDeleteContainer = ({
|
|
|
34079
34155
|
});
|
|
34080
34156
|
}
|
|
34081
34157
|
|
|
34082
|
-
|
|
34083
|
-
type: DISABLE_SUBMIT,
|
|
34084
|
-
payload: false
|
|
34085
|
-
});
|
|
34086
|
-
dispatch({
|
|
34087
|
-
type: LOADING,
|
|
34088
|
-
payload: false
|
|
34089
|
-
});
|
|
34158
|
+
refreshUser();
|
|
34090
34159
|
onSuccess(res);
|
|
34091
34160
|
});
|
|
34092
34161
|
};
|
|
@@ -34102,11 +34171,12 @@ const PaymentMethodDeleteContainer = ({
|
|
|
34102
34171
|
return lib_5({ ...state,
|
|
34103
34172
|
disableSubmit: true,
|
|
34104
34173
|
isLoading: true
|
|
34105
|
-
}, (state, dispatch) =>
|
|
34106
|
-
|
|
34107
|
-
|
|
34108
|
-
|
|
34109
|
-
|
|
34174
|
+
}, (state, dispatch) => {
|
|
34175
|
+
if (state.showPaymentMethodSelect) {
|
|
34176
|
+
setDefaultPaymentMethod();
|
|
34177
|
+
} else {
|
|
34178
|
+
deletePaymentMethod();
|
|
34179
|
+
}
|
|
34110
34180
|
});
|
|
34111
34181
|
|
|
34112
34182
|
case SET_PAYMENT_METHODS:
|
|
@@ -34134,6 +34204,11 @@ const PaymentMethodDeleteContainer = ({
|
|
|
34134
34204
|
skeletonLoader: action.payload
|
|
34135
34205
|
});
|
|
34136
34206
|
|
|
34207
|
+
case SHOW_PAYMENT_METHOD_SELECT:
|
|
34208
|
+
return lib_7({ ...state,
|
|
34209
|
+
showPaymentMethodSelect: action.payload
|
|
34210
|
+
});
|
|
34211
|
+
|
|
34137
34212
|
default:
|
|
34138
34213
|
return state;
|
|
34139
34214
|
}
|
|
@@ -34155,34 +34230,6 @@ const PaymentMethodDeleteContainer = ({
|
|
|
34155
34230
|
})));
|
|
34156
34231
|
};
|
|
34157
34232
|
|
|
34158
|
-
const PaymentMethodDeleteSubmit = ({
|
|
34159
|
-
name,
|
|
34160
|
-
onClick,
|
|
34161
|
-
...otherProps
|
|
34162
|
-
}) => {
|
|
34163
|
-
const {
|
|
34164
|
-
t
|
|
34165
|
-
} = useTranslation("paymentMethod");
|
|
34166
|
-
const {
|
|
34167
|
-
dispatch,
|
|
34168
|
-
state: {
|
|
34169
|
-
isLoading,
|
|
34170
|
-
isDisabled
|
|
34171
|
-
}
|
|
34172
|
-
} = useContext(store$5);
|
|
34173
|
-
return /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
34174
|
-
onClick: () => {
|
|
34175
|
-
dispatch({
|
|
34176
|
-
type: HANDLE_SUBMIT
|
|
34177
|
-
});
|
|
34178
|
-
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
34179
|
-
},
|
|
34180
|
-
disabled: isDisabled,
|
|
34181
|
-
isLoading: isLoading,
|
|
34182
|
-
className: "plc-w-full"
|
|
34183
|
-
}, otherProps), name !== null && name !== void 0 ? name : t("select.buttons.selectPaymentMethod"));
|
|
34184
|
-
};
|
|
34185
|
-
|
|
34186
34233
|
const PaymentMethodDeleteList = props => {
|
|
34187
34234
|
const {
|
|
34188
34235
|
t
|
|
@@ -34190,16 +34237,28 @@ const PaymentMethodDeleteList = props => {
|
|
|
34190
34237
|
const {
|
|
34191
34238
|
dispatch,
|
|
34192
34239
|
state: {
|
|
34193
|
-
deleteOption,
|
|
34194
34240
|
selectedPaymentMethodId,
|
|
34195
34241
|
paymentMethods,
|
|
34196
|
-
skeletonLoader
|
|
34242
|
+
skeletonLoader,
|
|
34243
|
+
showPaymentMethodSelect
|
|
34197
34244
|
}
|
|
34198
34245
|
} = useContext(store$5);
|
|
34199
34246
|
const {
|
|
34200
34247
|
paymentMethodToDelete
|
|
34201
34248
|
} = usePelcro();
|
|
34202
34249
|
|
|
34250
|
+
const createPaymentMethodItems = () => {
|
|
34251
|
+
if (paymentMethods.length) {
|
|
34252
|
+
return paymentMethods.filter(paymentMethod => (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id) !== (paymentMethodToDelete === null || paymentMethodToDelete === void 0 ? void 0 : paymentMethodToDelete.id)).map(paymentMethod => paymentMethod.properties.brand === "bacs_debit" ? /*#__PURE__*/React__default.createElement("option", {
|
|
34253
|
+
key: paymentMethod.id,
|
|
34254
|
+
value: paymentMethod.id
|
|
34255
|
+
}, "bacs - ", paymentMethod.properties.last4) : /*#__PURE__*/React__default.createElement("option", {
|
|
34256
|
+
key: paymentMethod.id,
|
|
34257
|
+
value: paymentMethod.id
|
|
34258
|
+
}, paymentMethod.properties.brand, " -", " ", paymentMethod.properties.last4, " -", " ", paymentMethod.properties.exp_month, " /", paymentMethod.properties.exp_year));
|
|
34259
|
+
}
|
|
34260
|
+
};
|
|
34261
|
+
|
|
34203
34262
|
const handlePaymentMethodSelect = event => {
|
|
34204
34263
|
dispatch({
|
|
34205
34264
|
type: SELECT_PAYMENT_METHOD,
|
|
@@ -34207,102 +34266,124 @@ const PaymentMethodDeleteList = props => {
|
|
|
34207
34266
|
});
|
|
34208
34267
|
};
|
|
34209
34268
|
|
|
34210
|
-
|
|
34211
|
-
|
|
34212
|
-
|
|
34213
|
-
|
|
34214
|
-
|
|
34215
|
-
|
|
34216
|
-
|
|
34217
|
-
|
|
34218
|
-
|
|
34219
|
-
|
|
34220
|
-
|
|
34221
|
-
|
|
34222
|
-
|
|
34223
|
-
|
|
34224
|
-
|
|
34225
|
-
|
|
34226
|
-
|
|
34227
|
-
|
|
34228
|
-
onChange: handlePaymentMethodSelect
|
|
34229
|
-
}, getPaymentCardIcon((_paymentMethod$proper = paymentMethod.properties) === null || _paymentMethod$proper === void 0 ? void 0 : _paymentMethod$proper.brand), /*#__PURE__*/React__default.createElement("div", {
|
|
34230
|
-
className: "plc-flex plc-flex-col plc-text-lg pelcro-payment-method-details"
|
|
34231
|
-
}, /*#__PURE__*/React__default.createElement("p", {
|
|
34232
|
-
className: "plc-font-semibold"
|
|
34233
|
-
}, (paymentMethod === null || paymentMethod === void 0 ? void 0 : (_paymentMethod$proper2 = paymentMethod.properties) === null || _paymentMethod$proper2 === void 0 ? void 0 : _paymentMethod$proper2.brand) === "bacs_debit" ? "••••" : "•••• •••• ••••", " ", (_paymentMethod$proper3 = paymentMethod.properties) === null || _paymentMethod$proper3 === void 0 ? void 0 : _paymentMethod$proper3.last4), paymentMethod.properties.brand !== "bacs_debit" && /*#__PURE__*/React__default.createElement("p", {
|
|
34234
|
-
className: "plc-text-sm plc-text-gray-500"
|
|
34235
|
-
}, t("select.expires"), " ", (_paymentMethod$proper4 = paymentMethod.properties) === null || _paymentMethod$proper4 === void 0 ? void 0 : _paymentMethod$proper4.exp_month, "/", (_paymentMethod$proper5 = paymentMethod.properties) === null || _paymentMethod$proper5 === void 0 ? void 0 : _paymentMethod$proper5.exp_year))));
|
|
34236
|
-
})), /*#__PURE__*/React__default.createElement("div", {
|
|
34237
|
-
className: "plc-px-3"
|
|
34238
|
-
}, /*#__PURE__*/React__default.createElement(PaymentMethodDeleteSubmit, null))), deleteOption === "add" && /*#__PURE__*/React__default.createElement(PaymentMethodView, {
|
|
34239
|
-
type: "deletePaymentSource",
|
|
34240
|
-
showCoupon: false,
|
|
34241
|
-
showExternalPaymentMethods: false,
|
|
34242
|
-
showApplePayButton: false,
|
|
34243
|
-
onDisplay: props.onDisplay,
|
|
34244
|
-
onFailure: props.onFailure,
|
|
34245
|
-
onSuccess: props.onSuccess,
|
|
34246
|
-
setAsDefault: true
|
|
34247
|
-
})));
|
|
34269
|
+
if (showPaymentMethodSelect) {
|
|
34270
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, skeletonLoader ? /*#__PURE__*/React__default.createElement("div", {
|
|
34271
|
+
className: "plc-w-full plc-h-8 plc-bg-gray-300 plc-rounded-md plc-animate-pulse"
|
|
34272
|
+
}) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, paymentMethods && /*#__PURE__*/React__default.createElement("div", {
|
|
34273
|
+
className: "plc-mt-4"
|
|
34274
|
+
}, /*#__PURE__*/React__default.createElement(Select, {
|
|
34275
|
+
label: t("delete.options.select"),
|
|
34276
|
+
name: "default-payment-method",
|
|
34277
|
+
onChange: handlePaymentMethodSelect,
|
|
34278
|
+
value: selectedPaymentMethodId
|
|
34279
|
+
}, /*#__PURE__*/React__default.createElement("option", {
|
|
34280
|
+
value: "",
|
|
34281
|
+
disabled: true,
|
|
34282
|
+
selected: true
|
|
34283
|
+
}), createPaymentMethodItems()))));
|
|
34284
|
+
} else {
|
|
34285
|
+
return null;
|
|
34286
|
+
}
|
|
34248
34287
|
};
|
|
34249
34288
|
|
|
34250
|
-
const
|
|
34251
|
-
|
|
34252
|
-
|
|
34253
|
-
onClick,
|
|
34254
|
-
className
|
|
34255
|
-
}) => {
|
|
34289
|
+
const PaymentMethodDetails = () => {
|
|
34290
|
+
var _paymentMethodToDelet, _paymentMethodToDelet2, _paymentMethodToDelet3, _paymentMethodToDelet4, _paymentMethodToDelet5;
|
|
34291
|
+
|
|
34256
34292
|
const {
|
|
34257
34293
|
state: {
|
|
34258
|
-
deleteOption,
|
|
34259
|
-
paymentMethods,
|
|
34260
34294
|
skeletonLoader
|
|
34261
|
-
}
|
|
34262
|
-
dispatch
|
|
34295
|
+
}
|
|
34263
34296
|
} = useContext(store$5);
|
|
34264
34297
|
const {
|
|
34265
34298
|
t
|
|
34266
34299
|
} = useTranslation("paymentMethod");
|
|
34267
|
-
|
|
34268
|
-
|
|
34269
|
-
|
|
34270
|
-
type: SET_DELETE_PAYMENT_METHOD_OPTION,
|
|
34271
|
-
payload: event.target.value
|
|
34272
|
-
});
|
|
34273
|
-
};
|
|
34274
|
-
|
|
34300
|
+
const {
|
|
34301
|
+
paymentMethodToDelete
|
|
34302
|
+
} = usePelcro();
|
|
34275
34303
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
34276
34304
|
className: "plc-text-left plc-mr-auto plc-mb-6"
|
|
34277
|
-
},
|
|
34278
|
-
className: "plc-
|
|
34279
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
34280
|
-
className: "plc-animate-
|
|
34281
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
34282
|
-
|
|
34283
|
-
|
|
34284
|
-
className: "plc-animate-pulse"
|
|
34305
|
+
}, /*#__PURE__*/React__default.createElement("h4", {
|
|
34306
|
+
className: "plc-mb-2"
|
|
34307
|
+
}, t("delete.details")), skeletonLoader ? /*#__PURE__*/React__default.createElement("div", {
|
|
34308
|
+
className: "plc-w-full plc-h-16 plc-bg-gray-300 plc-rounded-md plc-animate-pulse"
|
|
34309
|
+
}) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, paymentMethodToDelete && /*#__PURE__*/React__default.createElement("div", {
|
|
34310
|
+
key: paymentMethodToDelete === null || paymentMethodToDelete === void 0 ? void 0 : paymentMethodToDelete.id,
|
|
34311
|
+
className: `plc-p-2 plc-pl-4 plc-shadow-md_dark plc-text-gray-900 plc-rounded pelcro-payment-method-wrapper`
|
|
34285
34312
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
34286
|
-
className: "plc-
|
|
34287
|
-
|
|
34288
|
-
|
|
34289
|
-
|
|
34290
|
-
|
|
34291
|
-
},
|
|
34292
|
-
|
|
34293
|
-
|
|
34294
|
-
|
|
34295
|
-
}, t("
|
|
34313
|
+
className: "plc-flex plc-items-center plc-space-x-2 plc-w-full pelcro-select-payment-method-radio",
|
|
34314
|
+
id: `pelcro-payment-method-select-${paymentMethodToDelete === null || paymentMethodToDelete === void 0 ? void 0 : paymentMethodToDelete.id}`,
|
|
34315
|
+
name: "paymentMethod"
|
|
34316
|
+
}, getPaymentCardIcon((_paymentMethodToDelet = paymentMethodToDelete.properties) === null || _paymentMethodToDelet === void 0 ? void 0 : _paymentMethodToDelet.brand), /*#__PURE__*/React__default.createElement("div", {
|
|
34317
|
+
className: "plc-flex plc-flex-col plc-text-lg pelcro-payment-method-details"
|
|
34318
|
+
}, /*#__PURE__*/React__default.createElement("p", {
|
|
34319
|
+
className: "plc-font-semibold"
|
|
34320
|
+
}, (paymentMethodToDelete === null || paymentMethodToDelete === void 0 ? void 0 : (_paymentMethodToDelet2 = paymentMethodToDelete.properties) === null || _paymentMethodToDelet2 === void 0 ? void 0 : _paymentMethodToDelet2.brand) === "bacs_debit" ? "••••" : "•••• •••• ••••", " ", (_paymentMethodToDelet3 = paymentMethodToDelete.properties) === null || _paymentMethodToDelet3 === void 0 ? void 0 : _paymentMethodToDelet3.last4), paymentMethodToDelete.properties.brand !== "bacs_debit" && /*#__PURE__*/React__default.createElement("p", {
|
|
34321
|
+
className: "plc-text-sm plc-text-gray-500"
|
|
34322
|
+
}, t("select.expires"), " ", (_paymentMethodToDelet4 = paymentMethodToDelete.properties) === null || _paymentMethodToDelet4 === void 0 ? void 0 : _paymentMethodToDelet4.exp_month, "/", (_paymentMethodToDelet5 = paymentMethodToDelete.properties) === null || _paymentMethodToDelet5 === void 0 ? void 0 : _paymentMethodToDelet5.exp_year))))));
|
|
34323
|
+
};
|
|
34324
|
+
|
|
34325
|
+
const PaymentMethodDeleteSubmit = ({
|
|
34326
|
+
name,
|
|
34327
|
+
onClick,
|
|
34328
|
+
...otherProps
|
|
34329
|
+
}) => {
|
|
34330
|
+
const {
|
|
34331
|
+
t
|
|
34332
|
+
} = useTranslation("paymentMethod");
|
|
34333
|
+
const {
|
|
34334
|
+
dispatch,
|
|
34335
|
+
state: {
|
|
34336
|
+
isLoading,
|
|
34337
|
+
disableSubmit,
|
|
34338
|
+
showPaymentMethodSelect,
|
|
34339
|
+
selectedPaymentMethodId
|
|
34340
|
+
}
|
|
34341
|
+
} = useContext(store$5);
|
|
34342
|
+
return /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
34343
|
+
onClick: () => {
|
|
34344
|
+
dispatch({
|
|
34345
|
+
type: HANDLE_SUBMIT
|
|
34346
|
+
});
|
|
34347
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
34348
|
+
},
|
|
34349
|
+
disabled: showPaymentMethodSelect ? !selectedPaymentMethodId : disableSubmit,
|
|
34350
|
+
isLoading: isLoading,
|
|
34351
|
+
className: "plc-w-full"
|
|
34352
|
+
}, otherProps), name !== null && name !== void 0 ? name : t("delete.buttons.delete"));
|
|
34353
|
+
};
|
|
34354
|
+
|
|
34355
|
+
const PaymentMethodDeleteBack = ({
|
|
34356
|
+
name,
|
|
34357
|
+
onClick,
|
|
34358
|
+
...otherProps
|
|
34359
|
+
}) => {
|
|
34360
|
+
const {
|
|
34361
|
+
t
|
|
34362
|
+
} = useTranslation("paymentMethod");
|
|
34363
|
+
const {
|
|
34364
|
+
switchView
|
|
34365
|
+
} = usePelcro();
|
|
34366
|
+
return /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
34367
|
+
variant: "outline",
|
|
34368
|
+
onClick: () => {
|
|
34369
|
+
switchView("dashboard");
|
|
34370
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
34371
|
+
},
|
|
34372
|
+
className: "plc-w-full"
|
|
34373
|
+
}, otherProps), name !== null && name !== void 0 ? name : t("delete.buttons.back"));
|
|
34296
34374
|
};
|
|
34297
34375
|
|
|
34298
34376
|
function PaymentMethodDeleteView(props) {
|
|
34377
|
+
const {
|
|
34378
|
+
t
|
|
34379
|
+
} = useTranslation("paymentMethod");
|
|
34299
34380
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
34300
34381
|
id: "pelcro-payment-method-delete-view"
|
|
34301
|
-
}, /*#__PURE__*/React__default.createElement(PaymentMethodDeleteContainer, props, /*#__PURE__*/React__default.createElement(AlertWithContext, {
|
|
34302
|
-
className: "plc-
|
|
34303
|
-
}
|
|
34304
|
-
|
|
34305
|
-
})));
|
|
34382
|
+
}, /*#__PURE__*/React__default.createElement(PaymentMethodDeleteContainer, props, /*#__PURE__*/React__default.createElement(AlertWithContext, null), /*#__PURE__*/React__default.createElement(PaymentMethodDetails, null), /*#__PURE__*/React__default.createElement(PaymentMethodDeleteList, null), /*#__PURE__*/React__default.createElement("p", {
|
|
34383
|
+
className: "plc-text-sm plc-text-justify"
|
|
34384
|
+
}, t("delete.message")), /*#__PURE__*/React__default.createElement("div", {
|
|
34385
|
+
className: "plc-space-x-0 plc-space-y-3 plc-w-full plc-flex plc-flex-col plc-items-center plc-justify-center plc-mt-4"
|
|
34386
|
+
}, /*#__PURE__*/React__default.createElement(PaymentMethodDeleteSubmit, null), /*#__PURE__*/React__default.createElement(PaymentMethodDeleteBack, null))));
|
|
34306
34387
|
}
|
|
34307
34388
|
|
|
34308
34389
|
const PaymentMethodDeleteModal = props => {
|
|
@@ -34335,7 +34416,7 @@ const PaymentMethodDeleteModal = props => {
|
|
|
34335
34416
|
});
|
|
34336
34417
|
}
|
|
34337
34418
|
|
|
34338
|
-
notify.success(t("delete.
|
|
34419
|
+
notify.success(t("delete.deletedSuccessfully"));
|
|
34339
34420
|
resetView();
|
|
34340
34421
|
};
|
|
34341
34422
|
|
|
@@ -37185,38 +37266,9 @@ const PaymentCardsMenu = props => {
|
|
|
37185
37266
|
return switchView("payment-method-update");
|
|
37186
37267
|
};
|
|
37187
37268
|
|
|
37188
|
-
const deletePaymentMethod = (paymentMethodId, onSuccess, onFailure) => {
|
|
37189
|
-
// disable the Login button to prevent repeated clicks
|
|
37190
|
-
window.Pelcro.paymentMethods.deletePaymentMethod({
|
|
37191
|
-
auth_token: window.Pelcro.user.read().auth_token,
|
|
37192
|
-
payment_method_id: paymentMethodId
|
|
37193
|
-
}, (err, res) => {
|
|
37194
|
-
if (err) {
|
|
37195
|
-
return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
37196
|
-
}
|
|
37197
|
-
|
|
37198
|
-
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
|
|
37199
|
-
});
|
|
37200
|
-
};
|
|
37201
|
-
|
|
37202
37269
|
const onDeletePaymentMethodClick = source => {
|
|
37203
|
-
|
|
37204
|
-
|
|
37205
|
-
if (isDeletable) {
|
|
37206
|
-
notify.confirm((onSuccess, onFailure) => {
|
|
37207
|
-
deletePaymentMethod(source.id, onSuccess, onFailure);
|
|
37208
|
-
}, {
|
|
37209
|
-
confirmMessage: t("messages.paymentMethodDeletion.isSureToDelete"),
|
|
37210
|
-
loadingMessage: t("messages.paymentMethodDeletion.loading"),
|
|
37211
|
-
successMessage: t("messages.paymentMethodDeletion.success"),
|
|
37212
|
-
errorMessage: t("messages.paymentMethodDeletion.error")
|
|
37213
|
-
}, {
|
|
37214
|
-
closeButtonLabel: t("labels.subCancellation.goBack")
|
|
37215
|
-
});
|
|
37216
|
-
} else {
|
|
37217
|
-
setPaymentMethodToDelete(source.id);
|
|
37218
|
-
return switchView("payment-method-delete");
|
|
37219
|
-
}
|
|
37270
|
+
setPaymentMethodToDelete(source.id);
|
|
37271
|
+
return switchView("payment-method-delete");
|
|
37220
37272
|
};
|
|
37221
37273
|
|
|
37222
37274
|
return /*#__PURE__*/React__default.createElement(Card, {
|
|
@@ -38932,6 +38984,9 @@ const DashboardContent = props => {
|
|
|
38932
38984
|
const {
|
|
38933
38985
|
t
|
|
38934
38986
|
} = useTranslation("dashboard");
|
|
38987
|
+
const {
|
|
38988
|
+
dashboardLayout
|
|
38989
|
+
} = props;
|
|
38935
38990
|
const menuRef = useRef(null);
|
|
38936
38991
|
const user = window.Pelcro.user.read();
|
|
38937
38992
|
const userHasName = user.first_name || user.last_name;
|
|
@@ -39097,15 +39152,15 @@ const DashboardContent = props => {
|
|
|
39097
39152
|
};
|
|
39098
39153
|
}, []);
|
|
39099
39154
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Transition, {
|
|
39100
|
-
className:
|
|
39155
|
+
className: `plc-fixed plc-inset-y-0 plc-h-full lg:plc-w-3/12 plc-w-full plc-overflow-y-auto plc-text-left plc-bg-white plc-shadow-xl plc-z-max ${dashboardLayout == "left" ? "plc-left-0" : "plc-right-0"}`,
|
|
39101
39156
|
show: isOpen,
|
|
39102
39157
|
enter: "plc-transform plc-transition plc-duration-500",
|
|
39103
|
-
enterFrom: "plc--translate-x-full"
|
|
39158
|
+
enterFrom: `${dashboardLayout == "left" ? "plc--translate-x-full" : "plc-translate-x-full"}`,
|
|
39104
39159
|
enterTo: "plc-translate-x-0",
|
|
39105
39160
|
afterEnter: initializeHideMenuHandler,
|
|
39106
39161
|
leave: "plc-transform plc-transition plc-duration-500",
|
|
39107
39162
|
leaveFrom: "plc-translate-x-0",
|
|
39108
|
-
leaveTo: "plc--translate-x-full"
|
|
39163
|
+
leaveTo: `${dashboardLayout == "left" ? "plc--translate-x-full" : "plc-translate-x-full"}`,
|
|
39109
39164
|
afterLeave: props === null || props === void 0 ? void 0 : props.onClose
|
|
39110
39165
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
39111
39166
|
id: "pelcro-view-dashboard",
|
|
@@ -39153,7 +39208,7 @@ const DashboardContent = props => {
|
|
|
39153
39208
|
activeDashboardLink: activeDashboardLink
|
|
39154
39209
|
}))), activeDashboardLink && isOpen && /*#__PURE__*/React__default.createElement("div", {
|
|
39155
39210
|
id: "pelcro-view-dashboard-submenus",
|
|
39156
|
-
className:
|
|
39211
|
+
className: `plc-fixed plc-inset-y-0 plc-h-full lg:plc-w-9/12 plc-w-full plc-bg-gray-100 plc-z-max plc-overflow-auto ${dashboardLayout == "left" ? "plc-right-0" : "plc-left-0"}`
|
|
39157
39212
|
}, activeDashboardLink === SUB_MENUS.PROFILE && /*#__PURE__*/React__default.createElement(ProfileMenu, null), activeDashboardLink === SUB_MENUS.QRCODE && /*#__PURE__*/React__default.createElement(QRCodeMenu, null), activeDashboardLink === SUB_MENUS.PASSWORDCHANGE && /*#__PURE__*/React__default.createElement(PasswordChangeMenu, null), activeDashboardLink === SUB_MENUS.SAVED_ITEMS && /*#__PURE__*/React__default.createElement(SavedItemsMenu, null), activeDashboardLink === SUB_MENUS.PAYMENT_CARDS && /*#__PURE__*/React__default.createElement(PaymentCardsMenu, null), activeDashboardLink === SUB_MENUS.ADDRESSES && /*#__PURE__*/React__default.createElement(AddressesMenu, null), activeDashboardLink === SUB_MENUS.SUBSCRIPTIONS && /*#__PURE__*/React__default.createElement(SubscriptionsMenu, {
|
|
39158
39213
|
displayProductSelect: displayProductSelect,
|
|
39159
39214
|
setProductAndPlan: setProductAndPlan,
|
|
@@ -39796,7 +39851,10 @@ const DashboardInvoices = ({
|
|
|
39796
39851
|
*
|
|
39797
39852
|
*/
|
|
39798
39853
|
|
|
39799
|
-
function Dashboard(
|
|
39854
|
+
function Dashboard({
|
|
39855
|
+
dashboardLayout = "left",
|
|
39856
|
+
...props
|
|
39857
|
+
}) {
|
|
39800
39858
|
React__default.useEffect(() => {
|
|
39801
39859
|
var _props$onDisplay;
|
|
39802
39860
|
|
|
@@ -39814,7 +39872,8 @@ function Dashboard(props) {
|
|
|
39814
39872
|
|
|
39815
39873
|
(_props$onClose = props.onClose) === null || _props$onClose === void 0 ? void 0 : _props$onClose.call(props);
|
|
39816
39874
|
resetView();
|
|
39817
|
-
}
|
|
39875
|
+
},
|
|
39876
|
+
dashboardLayout: dashboardLayout
|
|
39818
39877
|
}, props), /*#__PURE__*/React__default.createElement(DashboardHeading, {
|
|
39819
39878
|
title: t("labels.mySettings")
|
|
39820
39879
|
}), /*#__PURE__*/React__default.createElement(DashboardProfile, null), /*#__PURE__*/React__default.createElement(DashboardQRCode, null), /*#__PURE__*/React__default.createElement(DashboardPasswordChange, null), /*#__PURE__*/React__default.createElement(DashboardSavedItems, null), /*#__PURE__*/React__default.createElement(DashboardHeading, {
|
|
@@ -39826,12 +39885,14 @@ function Dashboard(props) {
|
|
|
39826
39885
|
Dashboard.viewId = "dashboard";
|
|
39827
39886
|
|
|
39828
39887
|
// The button in the lower left that shows the dashboard.
|
|
39829
|
-
const DashboardOpenButton = (
|
|
39888
|
+
const DashboardOpenButton = ({
|
|
39889
|
+
layout = "left"
|
|
39890
|
+
}) => {
|
|
39830
39891
|
const {
|
|
39831
39892
|
switchView
|
|
39832
39893
|
} = usePelcro();
|
|
39833
39894
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
39834
|
-
className:
|
|
39895
|
+
className: `plc-fixed plc-bottom-4 pelcro-open-dashboard-btn ${layout == "left" ? "plc-left-4" : "plc-right-4"}`
|
|
39835
39896
|
}, /*#__PURE__*/React__default.createElement("button", {
|
|
39836
39897
|
className: "plc-bg-white plc-border-2 plc-rounded-full focus:plc-outline-none plc-border-primary-300 hover:plc-bg-white",
|
|
39837
39898
|
name: "menu",
|
|
@@ -42283,4 +42344,4 @@ const QrCodeModal = ({
|
|
|
42283
42344
|
};
|
|
42284
42345
|
QrCodeModal.viewId = "qrcode";
|
|
42285
42346
|
|
|
42286
|
-
export { AddNew, AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateSetDefault, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateSetDefault, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplePayButton, ApplyCouponButton, Auth0LoginButton, Badge, BankRedirection, BillingAddressCreateModal, BillingAddressSelectModal, BillingAddressUpdateModal, Button, Card, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, Dashboard, DashboardAddresses, DashboardContainer, DashboardContent, DashboardDonations, DashboardGifts, DashboardHeading, DashboardInvoices, DashboardLink, DashboardMemberships, DashboardNewsletters, DashboardOpenButton, DashboardOrders, DashboardPasswordChange, DashboardPaymentCards, DashboardProfile, DashboardQRCode, DashboardSavedItems, DashboardSubscriptions, DatePicker, DiscountedPrice, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginRequestLoginToken, LoginUsername, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, ModalHeader, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateFreeButton, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PasswordlessRequestContainer, PasswordlessRequestEmail, PasswordlessRequestModal, PasswordlessRequestView, PasswordlessRequestViewButton, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodCreateContainer, PaymentMethodCreateModal, PaymentMethodCreateView, PaymentMethodDeleteContainer, PaymentMethodDeleteList, PaymentMethodDeleteModal,
|
|
42347
|
+
export { AddNew, AddressCreateCity, AddressCreateContainer, AddressCreateCountrySelect, AddressCreateFirstName, AddressCreateLastName, AddressCreateLine1, AddressCreateLine2, AddressCreateModal, AddressCreatePostalCode, AddressCreateSetDefault, AddressCreateStateSelect, AddressCreateSubmit, AddressCreateTextInput, AddressCreateView, AddressSelectContainer, AddressSelectList, AddressSelectModal, AddressSelectSubmit, AddressSelectView, AddressUpdateCity, AddressUpdateContainer, AddressUpdateCountrySelect, AddressUpdateFirstName, AddressUpdateLastName, AddressUpdateLine1, AddressUpdateLine2, AddressUpdateModal, AddressUpdatePostalCode, AddressUpdateSetDefault, AddressUpdateStateSelect, AddressUpdateSubmit, AddressUpdateTextInput, AddressUpdateView, AlertWithContext as Alert, Alert as AlertElement, ApplePayButton, ApplyCouponButton, Auth0LoginButton, Badge, BankRedirection, BillingAddressCreateModal, BillingAddressSelectModal, BillingAddressUpdateModal, Button, Card, CartContainer, CartModal, CartRemoveItemButton, CartSubmit, CartTotalPrice, CartView, Checkbox, CheckoutForm, ConfirmPassword, CouponCode, CouponCodeField, Dashboard, DashboardAddresses, DashboardContainer, DashboardContent, DashboardDonations, DashboardGifts, DashboardHeading, DashboardInvoices, DashboardLink, DashboardMemberships, DashboardNewsletters, DashboardOpenButton, DashboardOrders, DashboardPasswordChange, DashboardPaymentCards, DashboardProfile, DashboardQRCode, DashboardSavedItems, DashboardSubscriptions, DatePicker, DiscountedPrice, Email, EmailVerifyContainer, EmailVerifyModal, EmailVerifyResendButton, EmailVerifyView, FacebookLoginButton, GiftCreateContainer, GiftCreateEmail, GiftCreateFirstName, GiftCreateLastName, GiftCreateMessage, GiftCreateModal, GiftCreateStartDate, GiftCreateSubmitButton, GiftCreateView, GiftRedeemCode, GiftRedeemContainer, GiftRedeemModal, GiftRedeemSubmitButton, GiftRedeemView, GoogleLoginButton, Input, InvoiceDetailsContainer, InvoiceDetailsDownloadButton, InvoiceDetailsModal, InvoiceDetailsPayButton, InvoiceDetailsView, InvoicePaymentContainer, InvoicePaymentModal, InvoicePaymentView, Link, LoginButton, LoginContainer, LoginEmail, LoginModal, LoginPassword, LoginRequestLoginToken, LoginUsername, LoginView, Logout, MeterModal, MeterView, Modal, ModalBody, ModalFooter, ModalHeader, NewsletterWithHook as NewsLetter, NewsletterUpdateButton, NewsletterUpdateContainer, NewsletterUpdateList, NewsletterUpdateModal, NewsletterUpdateView, Notification, OrderConfirmModal, OrderCreateContainer, OrderCreateFreeButton, OrderCreateModal, OrderCreateSubmitButton, OrderCreateView, Password, PasswordChangeButton, PasswordChangeConfirmNewPassword, PasswordChangeContainer, PasswordChangeCurrentPassword, PasswordChangeModal, PasswordChangeNewPassword, PasswordChangeView, PasswordForgotButton, PasswordForgotContainer, PasswordForgotEmail, PasswordForgotModal, PasswordForgotView, PasswordResetButton, PasswordResetConfirmPassword, PasswordResetContainer, PasswordResetEmail, PasswordResetModal, PasswordResetPassword, PasswordResetView, PasswordlessRequestContainer, PasswordlessRequestEmail, PasswordlessRequestModal, PasswordlessRequestView, PasswordlessRequestViewButton, PaymentCreateContainer, PaymentCreateView, PaymentMethodContainer, PaymentMethodCreateContainer, PaymentMethodCreateModal, PaymentMethodCreateView, PaymentMethodDeleteContainer, PaymentMethodDeleteList, PaymentMethodDeleteModal, PaymentMethodDeleteSubmit, PaymentMethodDeleteView, PaymentMethodSelectContainer, PaymentMethodSelectList, PaymentMethodSelectModal, PaymentMethodSelectSubmit, PaymentMethodSelectView, PaymentMethodUpdateContainer, PaymentMethodUpdateModal, PaymentMethodUpdateSetDefault, PaymentMethodUpdateView, PaymentMethodView, PaymentSuccessModal, PaymentSuccessView, PaypalSubscribeButton, PelcroModalController, PelcroPaymentRequestButton, ProfilePicChangeButton, ProfilePicChangeContainer, ProfilePicChangeCropper, ProfilePicChangeModal, ProfilePicChangeRemoveButton, ProfilePicChangeSelectButton, ProfilePicChangeView, ProfilePicChangeZoom, QrCodeModal, QrCodeView, Radio, RegisterButton, RegisterCompany, RegisterContainer, RegisterEmail, RegisterFirstName, RegisterJobTitle, RegisterLastName, RegisterModal, RegisterPassword, RegisterView, Select, SelectModalWithHook as SelectModal, SelectedAddress, SelectedPaymentMethod, ShopPurchaseButton, ShopSelectProductButton, ShopView, SubmitPaymentMethod, SubscriptionCancelModal, SubscriptionCreateContainer, SubscriptionCreateFreePlanButton, SubscriptionCreateModal, SubscriptionCreateView, SubscriptionManageMembersButton, SubscriptionManageMembersContainer, SubscriptionManageMembersEmails, SubscriptionManageMembersList, SubscriptionManageMembersModal, SubscriptionManageMembersView, SubscriptionRenewContainer, SubscriptionRenewModal, SubscriptionRenewView, SubscriptionSuspendContainer, SubscriptionSuspendModal, SubscriptionSuspendView, TaxAmount, TextArea, Tooltip, UserNameInput, UserUpdateButton, UserUpdateContainer, UserUpdateDisplayName, UserUpdateEmail, UserUpdateFirstName, UserUpdateLastName, UserUpdateModal, UserUpdatePhone, UserUpdateProfilePic, UserUpdateTextInput, UserUpdateTin, UserUpdateUsername, UserUpdateView, VerifyLinkTokenContainer, VerifyLinkTokenLoader, VerifyLinkTokenModal, VerifyLinkTokenView, authenticatedButtons, i18next as i18n, init$1 as initButtons, init as initContentEntitlement, invoicePaymentSubmitButton, notify, unauthenticatedButtons, usePelcro };
|