@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.cjs.js
CHANGED
|
@@ -3360,12 +3360,19 @@ var paymentMethod_en = {
|
|
|
3360
3360
|
select: select$6,
|
|
3361
3361
|
"delete": {
|
|
3362
3362
|
title: "Delete payment method",
|
|
3363
|
-
subtitle: "
|
|
3363
|
+
subtitle: "Are you sure you want to delete the selected payment method?",
|
|
3364
|
+
details: "Payment method details",
|
|
3365
|
+
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.",
|
|
3366
|
+
buttons: {
|
|
3367
|
+
"delete": "Delete payment method",
|
|
3368
|
+
back: "Go back"
|
|
3369
|
+
},
|
|
3364
3370
|
options: {
|
|
3365
|
-
select: "Select
|
|
3371
|
+
select: "Select a payment method to be the default",
|
|
3366
3372
|
add: "Add a new payment method"
|
|
3367
3373
|
},
|
|
3368
|
-
paymentMethodReplaced: "Payment Method Successfully Deleted and Replaced"
|
|
3374
|
+
paymentMethodReplaced: "Payment Method Successfully Deleted and Replaced",
|
|
3375
|
+
deletedSuccessfully: "Payment Method Successfully Deleted"
|
|
3369
3376
|
},
|
|
3370
3377
|
create: create$5
|
|
3371
3378
|
};
|
|
@@ -9871,6 +9878,21 @@ function notifyBugsnag(callback, startOptions) {
|
|
|
9871
9878
|
|
|
9872
9879
|
callback();
|
|
9873
9880
|
}
|
|
9881
|
+
const refreshUser = () => {
|
|
9882
|
+
var _window$Pelcro6, _window$Pelcro6$user, _window$Pelcro6$user$;
|
|
9883
|
+
|
|
9884
|
+
window.Pelcro.user.refresh({
|
|
9885
|
+
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
|
|
9886
|
+
}, (err, res) => {
|
|
9887
|
+
if (err) {
|
|
9888
|
+
console.error(err);
|
|
9889
|
+
}
|
|
9890
|
+
|
|
9891
|
+
if (res) {
|
|
9892
|
+
return res.data;
|
|
9893
|
+
}
|
|
9894
|
+
});
|
|
9895
|
+
};
|
|
9874
9896
|
|
|
9875
9897
|
const resources = {
|
|
9876
9898
|
en: {
|
|
@@ -12857,8 +12879,8 @@ const SET_CANCEL_SUBSCRIPTION_REASON = "SET_CANCEL_SUBSCRIPTION_REASON";
|
|
|
12857
12879
|
const SET_CANCEL_SUBSCRIPTION_OPTION = "SET_CANCEL_SUBSCRIPTION_OPTION";
|
|
12858
12880
|
const HANDLE_CHECKBOX_CHANGE = "HANDLE_CHECKBOX_CHANGE";
|
|
12859
12881
|
const SET_IS_DEFAULT_PAYMENT_METHOD = "SET_IS_DEFAULT_PAYMENT_METHOD";
|
|
12860
|
-
const SET_DELETE_PAYMENT_METHOD_OPTION = "SET_DELETE_PAYMENT_METHOD_OPTION";
|
|
12861
12882
|
const SET_PAYMENT_METHODS = "SET_PAYMENT_METHODS";
|
|
12883
|
+
const SHOW_PAYMENT_METHOD_SELECT = "SHOW_PAYMENT_METHOD_SELECT";
|
|
12862
12884
|
const SET_SUBSCRIPTION_SUSPEND_DATE = "SET_SUBSCRIPTION_SUSPEND_DATE";
|
|
12863
12885
|
const SET_EMAILS = "SET_EMAILS";
|
|
12864
12886
|
const SET_EMAILS_ERROR = "SET_EMAILS_ERROR";
|
|
@@ -23257,6 +23279,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23257
23279
|
content: t("messages.sourceCreated")
|
|
23258
23280
|
}
|
|
23259
23281
|
});
|
|
23282
|
+
refreshUser();
|
|
23260
23283
|
onSuccess(res);
|
|
23261
23284
|
});
|
|
23262
23285
|
}
|
|
@@ -23315,6 +23338,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23315
23338
|
});
|
|
23316
23339
|
}
|
|
23317
23340
|
|
|
23341
|
+
refreshUser();
|
|
23318
23342
|
onSuccess(res);
|
|
23319
23343
|
});
|
|
23320
23344
|
}, 2000);
|
|
@@ -23379,6 +23403,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23379
23403
|
content: t("messages.sourceUpdated")
|
|
23380
23404
|
}
|
|
23381
23405
|
});
|
|
23406
|
+
refreshUser();
|
|
23382
23407
|
onSuccess(res);
|
|
23383
23408
|
});
|
|
23384
23409
|
}
|
|
@@ -23785,6 +23810,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23785
23810
|
type: LOADING,
|
|
23786
23811
|
payload: false
|
|
23787
23812
|
});
|
|
23813
|
+
refreshUser();
|
|
23788
23814
|
onSuccess(res);
|
|
23789
23815
|
return;
|
|
23790
23816
|
}
|
|
@@ -23801,6 +23827,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23801
23827
|
content: t("messages.sourceCreated")
|
|
23802
23828
|
}
|
|
23803
23829
|
});
|
|
23830
|
+
refreshUser();
|
|
23804
23831
|
onSuccess(res);
|
|
23805
23832
|
return;
|
|
23806
23833
|
}
|
|
@@ -23821,6 +23848,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23821
23848
|
content: t("messages.sourceUpdated")
|
|
23822
23849
|
}
|
|
23823
23850
|
});
|
|
23851
|
+
refreshUser();
|
|
23824
23852
|
onSuccess(res);
|
|
23825
23853
|
return;
|
|
23826
23854
|
}
|
|
@@ -23851,6 +23879,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23851
23879
|
});
|
|
23852
23880
|
}
|
|
23853
23881
|
|
|
23882
|
+
refreshUser();
|
|
23854
23883
|
onSuccess(res);
|
|
23855
23884
|
});
|
|
23856
23885
|
}, 2000);
|
|
@@ -23885,7 +23914,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23885
23914
|
gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
|
|
23886
23915
|
address_id: product.address_required ? selectedAddressId : null
|
|
23887
23916
|
}, (err, res) => {
|
|
23888
|
-
|
|
23917
|
+
var _res$data;
|
|
23918
|
+
|
|
23919
|
+
if (res !== null && res !== void 0 && (_res$data = res.data) !== null && _res$data !== void 0 && _res$data.setup_intent) {
|
|
23889
23920
|
return confirmStripeIntentSetup(res, "subCreate");
|
|
23890
23921
|
}
|
|
23891
23922
|
|
|
@@ -24086,7 +24117,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24086
24117
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
24087
24118
|
token: result.paymentMethod.id
|
|
24088
24119
|
}, (err, res) => {
|
|
24089
|
-
var _res$
|
|
24120
|
+
var _res$data2, _res$data2$setup_inte, _res$data3, _res$data3$setup_inte;
|
|
24090
24121
|
|
|
24091
24122
|
if (err) {
|
|
24092
24123
|
dispatch({
|
|
@@ -24107,7 +24138,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24107
24138
|
});
|
|
24108
24139
|
}
|
|
24109
24140
|
|
|
24110
|
-
if (((_res$
|
|
24141
|
+
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") {
|
|
24111
24142
|
confirmStripeIntentSetup(res, "create");
|
|
24112
24143
|
} else {
|
|
24113
24144
|
dispatch({
|
|
@@ -24121,6 +24152,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24121
24152
|
content: t("messages.sourceCreated")
|
|
24122
24153
|
}
|
|
24123
24154
|
});
|
|
24155
|
+
refreshUser();
|
|
24124
24156
|
onSuccess(res);
|
|
24125
24157
|
}
|
|
24126
24158
|
});
|
|
@@ -24145,7 +24177,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24145
24177
|
exp_year: year,
|
|
24146
24178
|
is_default: isDefault
|
|
24147
24179
|
}, (err, res) => {
|
|
24148
|
-
var _res$
|
|
24180
|
+
var _res$data4, _res$data4$setup_inte, _res$data5, _res$data5$setup_inte;
|
|
24149
24181
|
|
|
24150
24182
|
dispatch({
|
|
24151
24183
|
type: DISABLE_SUBMIT,
|
|
@@ -24167,7 +24199,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24167
24199
|
});
|
|
24168
24200
|
}
|
|
24169
24201
|
|
|
24170
|
-
if (((_res$
|
|
24202
|
+
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") {
|
|
24171
24203
|
confirmStripeIntentSetup(res, "update");
|
|
24172
24204
|
} else {
|
|
24173
24205
|
dispatch({
|
|
@@ -24177,6 +24209,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24177
24209
|
content: t("messages.sourceUpdated")
|
|
24178
24210
|
}
|
|
24179
24211
|
});
|
|
24212
|
+
refreshUser();
|
|
24180
24213
|
onSuccess(res);
|
|
24181
24214
|
}
|
|
24182
24215
|
});
|
|
@@ -24211,7 +24244,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24211
24244
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
24212
24245
|
token: result.paymentMethod.id
|
|
24213
24246
|
}, (err, res) => {
|
|
24214
|
-
var _res$
|
|
24247
|
+
var _res$data6, _res$data6$setup_inte, _res$data7, _res$data7$setup_inte;
|
|
24215
24248
|
|
|
24216
24249
|
if (err) {
|
|
24217
24250
|
onFailure(err);
|
|
@@ -24224,7 +24257,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24224
24257
|
});
|
|
24225
24258
|
}
|
|
24226
24259
|
|
|
24227
|
-
if (((_res$
|
|
24260
|
+
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") {
|
|
24228
24261
|
confirmStripeIntentSetup(res, "replace", paymentMethodId);
|
|
24229
24262
|
} else {
|
|
24230
24263
|
setTimeout(() => {
|
|
@@ -24252,6 +24285,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24252
24285
|
});
|
|
24253
24286
|
}
|
|
24254
24287
|
|
|
24288
|
+
refreshUser();
|
|
24255
24289
|
onSuccess(res);
|
|
24256
24290
|
});
|
|
24257
24291
|
}, 2000);
|
|
@@ -24836,14 +24870,14 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24836
24870
|
coupon_code: state === null || state === void 0 ? void 0 : state.couponCode,
|
|
24837
24871
|
address_id: selectedAddressId
|
|
24838
24872
|
}, (error, res) => {
|
|
24839
|
-
var _res$
|
|
24873
|
+
var _res$data8, _res$data9;
|
|
24840
24874
|
|
|
24841
24875
|
if (error) {
|
|
24842
24876
|
return reject(error);
|
|
24843
24877
|
}
|
|
24844
24878
|
|
|
24845
|
-
const taxAmount = (_res$
|
|
24846
|
-
const totalAmountWithTax = (_res$
|
|
24879
|
+
const taxAmount = (_res$data8 = res.data) === null || _res$data8 === void 0 ? void 0 : _res$data8.taxes;
|
|
24880
|
+
const totalAmountWithTax = (_res$data9 = res.data) === null || _res$data9 === void 0 ? void 0 : _res$data9.total;
|
|
24847
24881
|
resolve({
|
|
24848
24882
|
totalAmountWithTax,
|
|
24849
24883
|
taxAmount
|
|
@@ -33745,9 +33779,7 @@ const BillingAddressSelectModal = ({
|
|
|
33745
33779
|
BillingAddressSelectModal.viewId = "billing-address-select";
|
|
33746
33780
|
|
|
33747
33781
|
const moveDefaultPaymentMethodToStart = paymentMethods => {
|
|
33748
|
-
|
|
33749
|
-
|
|
33750
|
-
const defaultPaymentMethod = (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.source;
|
|
33782
|
+
const defaultPaymentMethod = getDefaultPaymentMethod(paymentMethods);
|
|
33751
33783
|
const paymentMethodsWithoutDefault = paymentMethods.filter(paymentMethod => paymentMethod.id !== defaultPaymentMethod.id);
|
|
33752
33784
|
|
|
33753
33785
|
if (defaultPaymentMethod.status !== "chargeable") {
|
|
@@ -33757,9 +33789,15 @@ const moveDefaultPaymentMethodToStart = paymentMethods => {
|
|
|
33757
33789
|
return [defaultPaymentMethod, ...paymentMethodsWithoutDefault];
|
|
33758
33790
|
};
|
|
33759
33791
|
|
|
33792
|
+
const getDefaultPaymentMethod = paymentMethods => {
|
|
33793
|
+
const defaultPaymentMethod = paymentMethods.find(paymentMethod => paymentMethod.is_default);
|
|
33794
|
+
return defaultPaymentMethod;
|
|
33795
|
+
};
|
|
33796
|
+
|
|
33760
33797
|
const initialState$6 = {
|
|
33761
33798
|
paymentMethods: [],
|
|
33762
33799
|
selectedPaymentMethodId: null,
|
|
33800
|
+
skeletonLoader: true,
|
|
33763
33801
|
isSubmitting: false,
|
|
33764
33802
|
alert: {
|
|
33765
33803
|
type: "error",
|
|
@@ -33791,14 +33829,12 @@ const PaymentMethodSelectContainer = ({
|
|
|
33791
33829
|
return onSuccess(selectedPaymentMethodId);
|
|
33792
33830
|
};
|
|
33793
33831
|
|
|
33794
|
-
const getInitialSelectedMethodId =
|
|
33795
|
-
var _window$Pelcro$user$r2;
|
|
33796
|
-
|
|
33832
|
+
const getInitialSelectedMethodId = paymentMethods => {
|
|
33797
33833
|
if (selectedPaymentMethodIdFromStore) {
|
|
33798
33834
|
return selectedPaymentMethodIdFromStore;
|
|
33799
33835
|
}
|
|
33800
33836
|
|
|
33801
|
-
const defaultMethod = (
|
|
33837
|
+
const defaultMethod = getDefaultPaymentMethod(paymentMethods);
|
|
33802
33838
|
|
|
33803
33839
|
if (defaultMethod && defaultMethod.status === "chargeable") {
|
|
33804
33840
|
return String(defaultMethod.id);
|
|
@@ -33817,7 +33853,12 @@ const PaymentMethodSelectContainer = ({
|
|
|
33817
33853
|
case LOAD_PAYMENT_METHODS:
|
|
33818
33854
|
return lib_7({ ...state,
|
|
33819
33855
|
paymentMethods: moveDefaultPaymentMethodToStart(action.payload),
|
|
33820
|
-
selectedPaymentMethodId: getInitialSelectedMethodId()
|
|
33856
|
+
selectedPaymentMethodId: getInitialSelectedMethodId(action.payload)
|
|
33857
|
+
});
|
|
33858
|
+
|
|
33859
|
+
case SKELETON_LOADER:
|
|
33860
|
+
return lib_7({ ...state,
|
|
33861
|
+
skeletonLoader: action.payload
|
|
33821
33862
|
});
|
|
33822
33863
|
|
|
33823
33864
|
case HANDLE_SUBMIT:
|
|
@@ -33830,11 +33871,25 @@ const PaymentMethodSelectContainer = ({
|
|
|
33830
33871
|
}
|
|
33831
33872
|
}, initialState$6);
|
|
33832
33873
|
React.useEffect(() => {
|
|
33833
|
-
|
|
33874
|
+
window.Pelcro.paymentMethods.list({
|
|
33875
|
+
auth_token: window.Pelcro.user.read().auth_token
|
|
33876
|
+
}, (err, res) => {
|
|
33877
|
+
if (err) {
|
|
33878
|
+
return console.error(err);
|
|
33879
|
+
}
|
|
33834
33880
|
|
|
33835
|
-
|
|
33836
|
-
|
|
33837
|
-
|
|
33881
|
+
if (res) {
|
|
33882
|
+
var _res$data;
|
|
33883
|
+
|
|
33884
|
+
dispatch({
|
|
33885
|
+
type: LOAD_PAYMENT_METHODS,
|
|
33886
|
+
payload: (_res$data = res.data) !== null && _res$data !== void 0 ? _res$data : []
|
|
33887
|
+
});
|
|
33888
|
+
dispatch({
|
|
33889
|
+
type: SKELETON_LOADER,
|
|
33890
|
+
payload: false
|
|
33891
|
+
});
|
|
33892
|
+
}
|
|
33838
33893
|
});
|
|
33839
33894
|
}, []);
|
|
33840
33895
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -33862,7 +33917,8 @@ const PaymentMethodSelectList = () => {
|
|
|
33862
33917
|
dispatch,
|
|
33863
33918
|
state: {
|
|
33864
33919
|
paymentMethods,
|
|
33865
|
-
selectedPaymentMethodId
|
|
33920
|
+
selectedPaymentMethodId,
|
|
33921
|
+
skeletonLoader
|
|
33866
33922
|
}
|
|
33867
33923
|
} = React.useContext(store$6);
|
|
33868
33924
|
|
|
@@ -33873,7 +33929,9 @@ const PaymentMethodSelectList = () => {
|
|
|
33873
33929
|
});
|
|
33874
33930
|
};
|
|
33875
33931
|
|
|
33876
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
33932
|
+
return /*#__PURE__*/React__default['default'].createElement("div", null, skeletonLoader ? /*#__PURE__*/React__default['default'].createElement("div", {
|
|
33933
|
+
className: "plc-w-full plc-h-20 plc-bg-gray-300 plc-rounded-md plc-animate-pulse"
|
|
33934
|
+
}) : /*#__PURE__*/React__default['default'].createElement("div", {
|
|
33877
33935
|
className: "plc-px-3 plc-py-2 plc-space-y-4 plc-overflow-y-scroll plc-max-h-80 pelcro-payment-method-select-wrapper"
|
|
33878
33936
|
}, paymentMethods.map(paymentMethod => {
|
|
33879
33937
|
var _paymentMethod$proper, _paymentMethod$proper2, _paymentMethod$proper3, _paymentMethod$proper4, _paymentMethod$proper5;
|
|
@@ -33897,7 +33955,7 @@ const PaymentMethodSelectList = () => {
|
|
|
33897
33955
|
}, (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['default'].createElement("p", {
|
|
33898
33956
|
className: "plc-text-sm plc-text-gray-500"
|
|
33899
33957
|
}, 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))));
|
|
33900
|
-
}));
|
|
33958
|
+
})));
|
|
33901
33959
|
};
|
|
33902
33960
|
|
|
33903
33961
|
const PaymentMethodSelectSubmit = ({
|
|
@@ -34007,10 +34065,10 @@ const initialState$5 = {
|
|
|
34007
34065
|
paymentMethods: [],
|
|
34008
34066
|
selectedPaymentMethodId: null,
|
|
34009
34067
|
isSubmitting: false,
|
|
34010
|
-
|
|
34011
|
-
disableSubmit: false,
|
|
34068
|
+
disableSubmit: true,
|
|
34012
34069
|
isLoading: false,
|
|
34013
34070
|
skeletonLoader: true,
|
|
34071
|
+
showPaymentMethodSelect: false,
|
|
34014
34072
|
alert: {
|
|
34015
34073
|
type: "error",
|
|
34016
34074
|
content: ""
|
|
@@ -34049,20 +34107,20 @@ const PaymentMethodDeleteContainer = ({
|
|
|
34049
34107
|
payload: false
|
|
34050
34108
|
});
|
|
34051
34109
|
|
|
34052
|
-
if (res.data.length !== 1) {
|
|
34053
|
-
dispatch({
|
|
34054
|
-
type: SET_DELETE_PAYMENT_METHOD_OPTION,
|
|
34055
|
-
payload: "select"
|
|
34056
|
-
});
|
|
34057
|
-
} else {
|
|
34110
|
+
if (res.data.length !== 1 && paymentMethodToDelete.is_default && paymentMethodToDelete.deletable) {
|
|
34058
34111
|
dispatch({
|
|
34059
|
-
type:
|
|
34060
|
-
payload:
|
|
34112
|
+
type: SHOW_PAYMENT_METHOD_SELECT,
|
|
34113
|
+
payload: true
|
|
34061
34114
|
});
|
|
34062
34115
|
}
|
|
34116
|
+
|
|
34117
|
+
dispatch({
|
|
34118
|
+
type: DISABLE_SUBMIT,
|
|
34119
|
+
payload: false
|
|
34120
|
+
});
|
|
34063
34121
|
}
|
|
34064
34122
|
});
|
|
34065
|
-
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
34123
|
+
}, [paymentMethodToDelete]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
34066
34124
|
|
|
34067
34125
|
const setDefaultPaymentMethod = () => {
|
|
34068
34126
|
const {
|
|
@@ -34074,6 +34132,15 @@ const PaymentMethodDeleteContainer = ({
|
|
|
34074
34132
|
is_default: true
|
|
34075
34133
|
}, (err, res) => {
|
|
34076
34134
|
if (err) {
|
|
34135
|
+
dispatch({
|
|
34136
|
+
type: DISABLE_SUBMIT,
|
|
34137
|
+
payload: false
|
|
34138
|
+
});
|
|
34139
|
+
dispatch({
|
|
34140
|
+
type: LOADING,
|
|
34141
|
+
payload: false
|
|
34142
|
+
});
|
|
34143
|
+
console.log(err);
|
|
34077
34144
|
onFailure(err);
|
|
34078
34145
|
return dispatch({
|
|
34079
34146
|
type: SHOW_ALERT,
|
|
@@ -34098,6 +34165,15 @@ const PaymentMethodDeleteContainer = ({
|
|
|
34098
34165
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
34099
34166
|
payment_method_id: paymentMethodId
|
|
34100
34167
|
}, (err, res) => {
|
|
34168
|
+
dispatch({
|
|
34169
|
+
type: DISABLE_SUBMIT,
|
|
34170
|
+
payload: false
|
|
34171
|
+
});
|
|
34172
|
+
dispatch({
|
|
34173
|
+
type: LOADING,
|
|
34174
|
+
payload: false
|
|
34175
|
+
});
|
|
34176
|
+
|
|
34101
34177
|
if (err) {
|
|
34102
34178
|
onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
34103
34179
|
return dispatch({
|
|
@@ -34109,14 +34185,7 @@ const PaymentMethodDeleteContainer = ({
|
|
|
34109
34185
|
});
|
|
34110
34186
|
}
|
|
34111
34187
|
|
|
34112
|
-
|
|
34113
|
-
type: DISABLE_SUBMIT,
|
|
34114
|
-
payload: false
|
|
34115
|
-
});
|
|
34116
|
-
dispatch({
|
|
34117
|
-
type: LOADING,
|
|
34118
|
-
payload: false
|
|
34119
|
-
});
|
|
34188
|
+
refreshUser();
|
|
34120
34189
|
onSuccess(res);
|
|
34121
34190
|
});
|
|
34122
34191
|
};
|
|
@@ -34132,11 +34201,12 @@ const PaymentMethodDeleteContainer = ({
|
|
|
34132
34201
|
return lib_5({ ...state,
|
|
34133
34202
|
disableSubmit: true,
|
|
34134
34203
|
isLoading: true
|
|
34135
|
-
}, (state, dispatch) =>
|
|
34136
|
-
|
|
34137
|
-
|
|
34138
|
-
|
|
34139
|
-
|
|
34204
|
+
}, (state, dispatch) => {
|
|
34205
|
+
if (state.showPaymentMethodSelect) {
|
|
34206
|
+
setDefaultPaymentMethod();
|
|
34207
|
+
} else {
|
|
34208
|
+
deletePaymentMethod();
|
|
34209
|
+
}
|
|
34140
34210
|
});
|
|
34141
34211
|
|
|
34142
34212
|
case SET_PAYMENT_METHODS:
|
|
@@ -34164,6 +34234,11 @@ const PaymentMethodDeleteContainer = ({
|
|
|
34164
34234
|
skeletonLoader: action.payload
|
|
34165
34235
|
});
|
|
34166
34236
|
|
|
34237
|
+
case SHOW_PAYMENT_METHOD_SELECT:
|
|
34238
|
+
return lib_7({ ...state,
|
|
34239
|
+
showPaymentMethodSelect: action.payload
|
|
34240
|
+
});
|
|
34241
|
+
|
|
34167
34242
|
default:
|
|
34168
34243
|
return state;
|
|
34169
34244
|
}
|
|
@@ -34185,34 +34260,6 @@ const PaymentMethodDeleteContainer = ({
|
|
|
34185
34260
|
})));
|
|
34186
34261
|
};
|
|
34187
34262
|
|
|
34188
|
-
const PaymentMethodDeleteSubmit = ({
|
|
34189
|
-
name,
|
|
34190
|
-
onClick,
|
|
34191
|
-
...otherProps
|
|
34192
|
-
}) => {
|
|
34193
|
-
const {
|
|
34194
|
-
t
|
|
34195
|
-
} = useTranslation("paymentMethod");
|
|
34196
|
-
const {
|
|
34197
|
-
dispatch,
|
|
34198
|
-
state: {
|
|
34199
|
-
isLoading,
|
|
34200
|
-
isDisabled
|
|
34201
|
-
}
|
|
34202
|
-
} = React.useContext(store$5);
|
|
34203
|
-
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
34204
|
-
onClick: () => {
|
|
34205
|
-
dispatch({
|
|
34206
|
-
type: HANDLE_SUBMIT
|
|
34207
|
-
});
|
|
34208
|
-
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
34209
|
-
},
|
|
34210
|
-
disabled: isDisabled,
|
|
34211
|
-
isLoading: isLoading,
|
|
34212
|
-
className: "plc-w-full"
|
|
34213
|
-
}, otherProps), name !== null && name !== void 0 ? name : t("select.buttons.selectPaymentMethod"));
|
|
34214
|
-
};
|
|
34215
|
-
|
|
34216
34263
|
const PaymentMethodDeleteList = props => {
|
|
34217
34264
|
const {
|
|
34218
34265
|
t
|
|
@@ -34220,16 +34267,28 @@ const PaymentMethodDeleteList = props => {
|
|
|
34220
34267
|
const {
|
|
34221
34268
|
dispatch,
|
|
34222
34269
|
state: {
|
|
34223
|
-
deleteOption,
|
|
34224
34270
|
selectedPaymentMethodId,
|
|
34225
34271
|
paymentMethods,
|
|
34226
|
-
skeletonLoader
|
|
34272
|
+
skeletonLoader,
|
|
34273
|
+
showPaymentMethodSelect
|
|
34227
34274
|
}
|
|
34228
34275
|
} = React.useContext(store$5);
|
|
34229
34276
|
const {
|
|
34230
34277
|
paymentMethodToDelete
|
|
34231
34278
|
} = usePelcro();
|
|
34232
34279
|
|
|
34280
|
+
const createPaymentMethodItems = () => {
|
|
34281
|
+
if (paymentMethods.length) {
|
|
34282
|
+
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['default'].createElement("option", {
|
|
34283
|
+
key: paymentMethod.id,
|
|
34284
|
+
value: paymentMethod.id
|
|
34285
|
+
}, "bacs - ", paymentMethod.properties.last4) : /*#__PURE__*/React__default['default'].createElement("option", {
|
|
34286
|
+
key: paymentMethod.id,
|
|
34287
|
+
value: paymentMethod.id
|
|
34288
|
+
}, paymentMethod.properties.brand, " -", " ", paymentMethod.properties.last4, " -", " ", paymentMethod.properties.exp_month, " /", paymentMethod.properties.exp_year));
|
|
34289
|
+
}
|
|
34290
|
+
};
|
|
34291
|
+
|
|
34233
34292
|
const handlePaymentMethodSelect = event => {
|
|
34234
34293
|
dispatch({
|
|
34235
34294
|
type: SELECT_PAYMENT_METHOD,
|
|
@@ -34237,102 +34296,124 @@ const PaymentMethodDeleteList = props => {
|
|
|
34237
34296
|
});
|
|
34238
34297
|
};
|
|
34239
34298
|
|
|
34240
|
-
|
|
34241
|
-
|
|
34242
|
-
|
|
34243
|
-
|
|
34244
|
-
|
|
34245
|
-
|
|
34246
|
-
|
|
34247
|
-
|
|
34248
|
-
|
|
34249
|
-
|
|
34250
|
-
|
|
34251
|
-
|
|
34252
|
-
|
|
34253
|
-
|
|
34254
|
-
|
|
34255
|
-
|
|
34256
|
-
|
|
34257
|
-
|
|
34258
|
-
onChange: handlePaymentMethodSelect
|
|
34259
|
-
}, getPaymentCardIcon((_paymentMethod$proper = paymentMethod.properties) === null || _paymentMethod$proper === void 0 ? void 0 : _paymentMethod$proper.brand), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
34260
|
-
className: "plc-flex plc-flex-col plc-text-lg pelcro-payment-method-details"
|
|
34261
|
-
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
34262
|
-
className: "plc-font-semibold"
|
|
34263
|
-
}, (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['default'].createElement("p", {
|
|
34264
|
-
className: "plc-text-sm plc-text-gray-500"
|
|
34265
|
-
}, 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))));
|
|
34266
|
-
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
34267
|
-
className: "plc-px-3"
|
|
34268
|
-
}, /*#__PURE__*/React__default['default'].createElement(PaymentMethodDeleteSubmit, null))), deleteOption === "add" && /*#__PURE__*/React__default['default'].createElement(PaymentMethodView, {
|
|
34269
|
-
type: "deletePaymentSource",
|
|
34270
|
-
showCoupon: false,
|
|
34271
|
-
showExternalPaymentMethods: false,
|
|
34272
|
-
showApplePayButton: false,
|
|
34273
|
-
onDisplay: props.onDisplay,
|
|
34274
|
-
onFailure: props.onFailure,
|
|
34275
|
-
onSuccess: props.onSuccess,
|
|
34276
|
-
setAsDefault: true
|
|
34277
|
-
})));
|
|
34299
|
+
if (showPaymentMethodSelect) {
|
|
34300
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, skeletonLoader ? /*#__PURE__*/React__default['default'].createElement("div", {
|
|
34301
|
+
className: "plc-w-full plc-h-8 plc-bg-gray-300 plc-rounded-md plc-animate-pulse"
|
|
34302
|
+
}) : /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, paymentMethods && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
34303
|
+
className: "plc-mt-4"
|
|
34304
|
+
}, /*#__PURE__*/React__default['default'].createElement(Select, {
|
|
34305
|
+
label: t("delete.options.select"),
|
|
34306
|
+
name: "default-payment-method",
|
|
34307
|
+
onChange: handlePaymentMethodSelect,
|
|
34308
|
+
value: selectedPaymentMethodId
|
|
34309
|
+
}, /*#__PURE__*/React__default['default'].createElement("option", {
|
|
34310
|
+
value: "",
|
|
34311
|
+
disabled: true,
|
|
34312
|
+
selected: true
|
|
34313
|
+
}), createPaymentMethodItems()))));
|
|
34314
|
+
} else {
|
|
34315
|
+
return null;
|
|
34316
|
+
}
|
|
34278
34317
|
};
|
|
34279
34318
|
|
|
34280
|
-
const
|
|
34281
|
-
|
|
34282
|
-
|
|
34283
|
-
onClick,
|
|
34284
|
-
className
|
|
34285
|
-
}) => {
|
|
34319
|
+
const PaymentMethodDetails = () => {
|
|
34320
|
+
var _paymentMethodToDelet, _paymentMethodToDelet2, _paymentMethodToDelet3, _paymentMethodToDelet4, _paymentMethodToDelet5;
|
|
34321
|
+
|
|
34286
34322
|
const {
|
|
34287
34323
|
state: {
|
|
34288
|
-
deleteOption,
|
|
34289
|
-
paymentMethods,
|
|
34290
34324
|
skeletonLoader
|
|
34291
|
-
}
|
|
34292
|
-
dispatch
|
|
34325
|
+
}
|
|
34293
34326
|
} = React.useContext(store$5);
|
|
34294
34327
|
const {
|
|
34295
34328
|
t
|
|
34296
34329
|
} = useTranslation("paymentMethod");
|
|
34297
|
-
|
|
34298
|
-
|
|
34299
|
-
|
|
34300
|
-
type: SET_DELETE_PAYMENT_METHOD_OPTION,
|
|
34301
|
-
payload: event.target.value
|
|
34302
|
-
});
|
|
34303
|
-
};
|
|
34304
|
-
|
|
34330
|
+
const {
|
|
34331
|
+
paymentMethodToDelete
|
|
34332
|
+
} = usePelcro();
|
|
34305
34333
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
34306
34334
|
className: "plc-text-left plc-mr-auto plc-mb-6"
|
|
34307
|
-
},
|
|
34308
|
-
className: "plc-
|
|
34309
|
-
}, /*#__PURE__*/React__default['default'].createElement(
|
|
34310
|
-
className: "plc-animate-
|
|
34311
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
34312
|
-
|
|
34313
|
-
|
|
34314
|
-
className: "plc-animate-pulse"
|
|
34335
|
+
}, /*#__PURE__*/React__default['default'].createElement("h4", {
|
|
34336
|
+
className: "plc-mb-2"
|
|
34337
|
+
}, t("delete.details")), skeletonLoader ? /*#__PURE__*/React__default['default'].createElement("div", {
|
|
34338
|
+
className: "plc-w-full plc-h-16 plc-bg-gray-300 plc-rounded-md plc-animate-pulse"
|
|
34339
|
+
}) : /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, paymentMethodToDelete && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
34340
|
+
key: paymentMethodToDelete === null || paymentMethodToDelete === void 0 ? void 0 : paymentMethodToDelete.id,
|
|
34341
|
+
className: `plc-p-2 plc-pl-4 plc-shadow-md_dark plc-text-gray-900 plc-rounded pelcro-payment-method-wrapper`
|
|
34315
34342
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
34316
|
-
className: "plc-
|
|
34317
|
-
|
|
34318
|
-
|
|
34319
|
-
|
|
34320
|
-
|
|
34321
|
-
},
|
|
34322
|
-
|
|
34323
|
-
|
|
34324
|
-
|
|
34325
|
-
}, t("
|
|
34343
|
+
className: "plc-flex plc-items-center plc-space-x-2 plc-w-full pelcro-select-payment-method-radio",
|
|
34344
|
+
id: `pelcro-payment-method-select-${paymentMethodToDelete === null || paymentMethodToDelete === void 0 ? void 0 : paymentMethodToDelete.id}`,
|
|
34345
|
+
name: "paymentMethod"
|
|
34346
|
+
}, getPaymentCardIcon((_paymentMethodToDelet = paymentMethodToDelete.properties) === null || _paymentMethodToDelet === void 0 ? void 0 : _paymentMethodToDelet.brand), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
34347
|
+
className: "plc-flex plc-flex-col plc-text-lg pelcro-payment-method-details"
|
|
34348
|
+
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
34349
|
+
className: "plc-font-semibold"
|
|
34350
|
+
}, (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['default'].createElement("p", {
|
|
34351
|
+
className: "plc-text-sm plc-text-gray-500"
|
|
34352
|
+
}, 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))))));
|
|
34353
|
+
};
|
|
34354
|
+
|
|
34355
|
+
const PaymentMethodDeleteSubmit = ({
|
|
34356
|
+
name,
|
|
34357
|
+
onClick,
|
|
34358
|
+
...otherProps
|
|
34359
|
+
}) => {
|
|
34360
|
+
const {
|
|
34361
|
+
t
|
|
34362
|
+
} = useTranslation("paymentMethod");
|
|
34363
|
+
const {
|
|
34364
|
+
dispatch,
|
|
34365
|
+
state: {
|
|
34366
|
+
isLoading,
|
|
34367
|
+
disableSubmit,
|
|
34368
|
+
showPaymentMethodSelect,
|
|
34369
|
+
selectedPaymentMethodId
|
|
34370
|
+
}
|
|
34371
|
+
} = React.useContext(store$5);
|
|
34372
|
+
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
34373
|
+
onClick: () => {
|
|
34374
|
+
dispatch({
|
|
34375
|
+
type: HANDLE_SUBMIT
|
|
34376
|
+
});
|
|
34377
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
34378
|
+
},
|
|
34379
|
+
disabled: showPaymentMethodSelect ? !selectedPaymentMethodId : disableSubmit,
|
|
34380
|
+
isLoading: isLoading,
|
|
34381
|
+
className: "plc-w-full"
|
|
34382
|
+
}, otherProps), name !== null && name !== void 0 ? name : t("delete.buttons.delete"));
|
|
34383
|
+
};
|
|
34384
|
+
|
|
34385
|
+
const PaymentMethodDeleteBack = ({
|
|
34386
|
+
name,
|
|
34387
|
+
onClick,
|
|
34388
|
+
...otherProps
|
|
34389
|
+
}) => {
|
|
34390
|
+
const {
|
|
34391
|
+
t
|
|
34392
|
+
} = useTranslation("paymentMethod");
|
|
34393
|
+
const {
|
|
34394
|
+
switchView
|
|
34395
|
+
} = usePelcro();
|
|
34396
|
+
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
34397
|
+
variant: "outline",
|
|
34398
|
+
onClick: () => {
|
|
34399
|
+
switchView("dashboard");
|
|
34400
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
34401
|
+
},
|
|
34402
|
+
className: "plc-w-full"
|
|
34403
|
+
}, otherProps), name !== null && name !== void 0 ? name : t("delete.buttons.back"));
|
|
34326
34404
|
};
|
|
34327
34405
|
|
|
34328
34406
|
function PaymentMethodDeleteView(props) {
|
|
34407
|
+
const {
|
|
34408
|
+
t
|
|
34409
|
+
} = useTranslation("paymentMethod");
|
|
34329
34410
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
34330
34411
|
id: "pelcro-payment-method-delete-view"
|
|
34331
|
-
}, /*#__PURE__*/React__default['default'].createElement(PaymentMethodDeleteContainer, props, /*#__PURE__*/React__default['default'].createElement(AlertWithContext, {
|
|
34332
|
-
className: "plc-
|
|
34333
|
-
}
|
|
34334
|
-
|
|
34335
|
-
})));
|
|
34412
|
+
}, /*#__PURE__*/React__default['default'].createElement(PaymentMethodDeleteContainer, props, /*#__PURE__*/React__default['default'].createElement(AlertWithContext, null), /*#__PURE__*/React__default['default'].createElement(PaymentMethodDetails, null), /*#__PURE__*/React__default['default'].createElement(PaymentMethodDeleteList, null), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
34413
|
+
className: "plc-text-sm plc-text-justify"
|
|
34414
|
+
}, t("delete.message")), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
34415
|
+
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"
|
|
34416
|
+
}, /*#__PURE__*/React__default['default'].createElement(PaymentMethodDeleteSubmit, null), /*#__PURE__*/React__default['default'].createElement(PaymentMethodDeleteBack, null))));
|
|
34336
34417
|
}
|
|
34337
34418
|
|
|
34338
34419
|
const PaymentMethodDeleteModal = props => {
|
|
@@ -34365,7 +34446,7 @@ const PaymentMethodDeleteModal = props => {
|
|
|
34365
34446
|
});
|
|
34366
34447
|
}
|
|
34367
34448
|
|
|
34368
|
-
notify.success(t("delete.
|
|
34449
|
+
notify.success(t("delete.deletedSuccessfully"));
|
|
34369
34450
|
resetView();
|
|
34370
34451
|
};
|
|
34371
34452
|
|
|
@@ -37215,38 +37296,9 @@ const PaymentCardsMenu = props => {
|
|
|
37215
37296
|
return switchView("payment-method-update");
|
|
37216
37297
|
};
|
|
37217
37298
|
|
|
37218
|
-
const deletePaymentMethod = (paymentMethodId, onSuccess, onFailure) => {
|
|
37219
|
-
// disable the Login button to prevent repeated clicks
|
|
37220
|
-
window.Pelcro.paymentMethods.deletePaymentMethod({
|
|
37221
|
-
auth_token: window.Pelcro.user.read().auth_token,
|
|
37222
|
-
payment_method_id: paymentMethodId
|
|
37223
|
-
}, (err, res) => {
|
|
37224
|
-
if (err) {
|
|
37225
|
-
return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
37226
|
-
}
|
|
37227
|
-
|
|
37228
|
-
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
|
|
37229
|
-
});
|
|
37230
|
-
};
|
|
37231
|
-
|
|
37232
37299
|
const onDeletePaymentMethodClick = source => {
|
|
37233
|
-
|
|
37234
|
-
|
|
37235
|
-
if (isDeletable) {
|
|
37236
|
-
notify.confirm((onSuccess, onFailure) => {
|
|
37237
|
-
deletePaymentMethod(source.id, onSuccess, onFailure);
|
|
37238
|
-
}, {
|
|
37239
|
-
confirmMessage: t("messages.paymentMethodDeletion.isSureToDelete"),
|
|
37240
|
-
loadingMessage: t("messages.paymentMethodDeletion.loading"),
|
|
37241
|
-
successMessage: t("messages.paymentMethodDeletion.success"),
|
|
37242
|
-
errorMessage: t("messages.paymentMethodDeletion.error")
|
|
37243
|
-
}, {
|
|
37244
|
-
closeButtonLabel: t("labels.subCancellation.goBack")
|
|
37245
|
-
});
|
|
37246
|
-
} else {
|
|
37247
|
-
setPaymentMethodToDelete(source.id);
|
|
37248
|
-
return switchView("payment-method-delete");
|
|
37249
|
-
}
|
|
37300
|
+
setPaymentMethodToDelete(source.id);
|
|
37301
|
+
return switchView("payment-method-delete");
|
|
37250
37302
|
};
|
|
37251
37303
|
|
|
37252
37304
|
return /*#__PURE__*/React__default['default'].createElement(Card, {
|
|
@@ -38962,6 +39014,9 @@ const DashboardContent = props => {
|
|
|
38962
39014
|
const {
|
|
38963
39015
|
t
|
|
38964
39016
|
} = useTranslation("dashboard");
|
|
39017
|
+
const {
|
|
39018
|
+
dashboardLayout
|
|
39019
|
+
} = props;
|
|
38965
39020
|
const menuRef = React.useRef(null);
|
|
38966
39021
|
const user = window.Pelcro.user.read();
|
|
38967
39022
|
const userHasName = user.first_name || user.last_name;
|
|
@@ -39127,15 +39182,15 @@ const DashboardContent = props => {
|
|
|
39127
39182
|
};
|
|
39128
39183
|
}, []);
|
|
39129
39184
|
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(Transition, {
|
|
39130
|
-
className:
|
|
39185
|
+
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"}`,
|
|
39131
39186
|
show: isOpen,
|
|
39132
39187
|
enter: "plc-transform plc-transition plc-duration-500",
|
|
39133
|
-
enterFrom: "plc--translate-x-full"
|
|
39188
|
+
enterFrom: `${dashboardLayout == "left" ? "plc--translate-x-full" : "plc-translate-x-full"}`,
|
|
39134
39189
|
enterTo: "plc-translate-x-0",
|
|
39135
39190
|
afterEnter: initializeHideMenuHandler,
|
|
39136
39191
|
leave: "plc-transform plc-transition plc-duration-500",
|
|
39137
39192
|
leaveFrom: "plc-translate-x-0",
|
|
39138
|
-
leaveTo: "plc--translate-x-full"
|
|
39193
|
+
leaveTo: `${dashboardLayout == "left" ? "plc--translate-x-full" : "plc-translate-x-full"}`,
|
|
39139
39194
|
afterLeave: props === null || props === void 0 ? void 0 : props.onClose
|
|
39140
39195
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
39141
39196
|
id: "pelcro-view-dashboard",
|
|
@@ -39183,7 +39238,7 @@ const DashboardContent = props => {
|
|
|
39183
39238
|
activeDashboardLink: activeDashboardLink
|
|
39184
39239
|
}))), activeDashboardLink && isOpen && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
39185
39240
|
id: "pelcro-view-dashboard-submenus",
|
|
39186
|
-
className:
|
|
39241
|
+
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"}`
|
|
39187
39242
|
}, activeDashboardLink === SUB_MENUS.PROFILE && /*#__PURE__*/React__default['default'].createElement(ProfileMenu, null), activeDashboardLink === SUB_MENUS.QRCODE && /*#__PURE__*/React__default['default'].createElement(QRCodeMenu, null), activeDashboardLink === SUB_MENUS.PASSWORDCHANGE && /*#__PURE__*/React__default['default'].createElement(PasswordChangeMenu, null), activeDashboardLink === SUB_MENUS.SAVED_ITEMS && /*#__PURE__*/React__default['default'].createElement(SavedItemsMenu, null), activeDashboardLink === SUB_MENUS.PAYMENT_CARDS && /*#__PURE__*/React__default['default'].createElement(PaymentCardsMenu, null), activeDashboardLink === SUB_MENUS.ADDRESSES && /*#__PURE__*/React__default['default'].createElement(AddressesMenu, null), activeDashboardLink === SUB_MENUS.SUBSCRIPTIONS && /*#__PURE__*/React__default['default'].createElement(SubscriptionsMenu, {
|
|
39188
39243
|
displayProductSelect: displayProductSelect,
|
|
39189
39244
|
setProductAndPlan: setProductAndPlan,
|
|
@@ -39826,7 +39881,10 @@ const DashboardInvoices = ({
|
|
|
39826
39881
|
*
|
|
39827
39882
|
*/
|
|
39828
39883
|
|
|
39829
|
-
function Dashboard(
|
|
39884
|
+
function Dashboard({
|
|
39885
|
+
dashboardLayout = "left",
|
|
39886
|
+
...props
|
|
39887
|
+
}) {
|
|
39830
39888
|
React__default['default'].useEffect(() => {
|
|
39831
39889
|
var _props$onDisplay;
|
|
39832
39890
|
|
|
@@ -39844,7 +39902,8 @@ function Dashboard(props) {
|
|
|
39844
39902
|
|
|
39845
39903
|
(_props$onClose = props.onClose) === null || _props$onClose === void 0 ? void 0 : _props$onClose.call(props);
|
|
39846
39904
|
resetView();
|
|
39847
|
-
}
|
|
39905
|
+
},
|
|
39906
|
+
dashboardLayout: dashboardLayout
|
|
39848
39907
|
}, props), /*#__PURE__*/React__default['default'].createElement(DashboardHeading, {
|
|
39849
39908
|
title: t("labels.mySettings")
|
|
39850
39909
|
}), /*#__PURE__*/React__default['default'].createElement(DashboardProfile, null), /*#__PURE__*/React__default['default'].createElement(DashboardQRCode, null), /*#__PURE__*/React__default['default'].createElement(DashboardPasswordChange, null), /*#__PURE__*/React__default['default'].createElement(DashboardSavedItems, null), /*#__PURE__*/React__default['default'].createElement(DashboardHeading, {
|
|
@@ -39856,12 +39915,14 @@ function Dashboard(props) {
|
|
|
39856
39915
|
Dashboard.viewId = "dashboard";
|
|
39857
39916
|
|
|
39858
39917
|
// The button in the lower left that shows the dashboard.
|
|
39859
|
-
const DashboardOpenButton = (
|
|
39918
|
+
const DashboardOpenButton = ({
|
|
39919
|
+
layout = "left"
|
|
39920
|
+
}) => {
|
|
39860
39921
|
const {
|
|
39861
39922
|
switchView
|
|
39862
39923
|
} = usePelcro();
|
|
39863
39924
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
39864
|
-
className:
|
|
39925
|
+
className: `plc-fixed plc-bottom-4 pelcro-open-dashboard-btn ${layout == "left" ? "plc-left-4" : "plc-right-4"}`
|
|
39865
39926
|
}, /*#__PURE__*/React__default['default'].createElement("button", {
|
|
39866
39927
|
className: "plc-bg-white plc-border-2 plc-rounded-full focus:plc-outline-none plc-border-primary-300 hover:plc-bg-white",
|
|
39867
39928
|
name: "menu",
|
|
@@ -42484,7 +42545,6 @@ exports.PaymentMethodCreateView = PaymentMethodCreateView;
|
|
|
42484
42545
|
exports.PaymentMethodDeleteContainer = PaymentMethodDeleteContainer;
|
|
42485
42546
|
exports.PaymentMethodDeleteList = PaymentMethodDeleteList;
|
|
42486
42547
|
exports.PaymentMethodDeleteModal = PaymentMethodDeleteModal;
|
|
42487
|
-
exports.PaymentMethodDeleteOptions = PaymentMethodDeleteOptions;
|
|
42488
42548
|
exports.PaymentMethodDeleteSubmit = PaymentMethodDeleteSubmit;
|
|
42489
42549
|
exports.PaymentMethodDeleteView = PaymentMethodDeleteView;
|
|
42490
42550
|
exports.PaymentMethodSelectContainer = PaymentMethodSelectContainer;
|