@pelcro/react-pelcro-js 3.35.0 → 3.37.0
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 +273 -175
- package/dist/index.esm.js +274 -175
- package/dist/pelcro.css +13 -13
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -3363,12 +3363,19 @@ var paymentMethod_en = {
|
|
|
3363
3363
|
select: select$6,
|
|
3364
3364
|
"delete": {
|
|
3365
3365
|
title: "Delete payment method",
|
|
3366
|
-
subtitle: "
|
|
3366
|
+
subtitle: "Are you sure you want to delete the selected payment method?",
|
|
3367
|
+
details: "Payment method details",
|
|
3368
|
+
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.",
|
|
3369
|
+
buttons: {
|
|
3370
|
+
"delete": "Delete payment method",
|
|
3371
|
+
back: "Go back"
|
|
3372
|
+
},
|
|
3367
3373
|
options: {
|
|
3368
|
-
select: "Select
|
|
3374
|
+
select: "Select a payment method to be the default",
|
|
3369
3375
|
add: "Add a new payment method"
|
|
3370
3376
|
},
|
|
3371
|
-
paymentMethodReplaced: "Payment Method Successfully Deleted and Replaced"
|
|
3377
|
+
paymentMethodReplaced: "Payment Method Successfully Deleted and Replaced",
|
|
3378
|
+
deletedSuccessfully: "Payment Method Successfully Deleted"
|
|
3372
3379
|
},
|
|
3373
3380
|
create: create$5
|
|
3374
3381
|
};
|
|
@@ -9589,6 +9596,17 @@ const getPaymentCardIcon$1 = name => {
|
|
|
9589
9596
|
}), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
9590
9597
|
fill: "#FFF",
|
|
9591
9598
|
d: "M22.255 20l-2.113 4.683L18.039 20h-2.695v6.726L12.341 20h-2.274L7 26.981h1.815l.671-1.558h3.432l.682 1.558h3.465v-5.185l2.299 5.185h1.563l2.351-5.095v5.095H25V20H22.255zM10.135 23.915l1.026-2.44 1.066 2.44H10.135zM37.883 23.413L41 20.018h-2.217l-1.994 2.164L34.86 20H28v6.982h6.635l2.092-2.311L38.767 27h2.21L37.883 23.413zM33.728 25.516h-4.011v-1.381h3.838v-1.323h-3.838v-1.308l4.234.012 1.693 1.897L33.728 25.516z"
|
|
9599
|
+
})),
|
|
9600
|
+
amex: /*#__PURE__*/React__default['default'].createElement("svg", {
|
|
9601
|
+
className: "plc-w-16",
|
|
9602
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9603
|
+
viewBox: "0 0 48 48"
|
|
9604
|
+
}, /*#__PURE__*/React__default['default'].createElement("path", {
|
|
9605
|
+
fill: "#1976D2",
|
|
9606
|
+
d: "M45,35c0,2.209-1.791,4-4,4H7c-2.209,0-4-1.791-4-4V13c0-2.209,1.791-4,4-4h34c2.209,0,4,1.791,4,4V35z"
|
|
9607
|
+
}), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
9608
|
+
fill: "#FFF",
|
|
9609
|
+
d: "M22.255 20l-2.113 4.683L18.039 20h-2.695v6.726L12.341 20h-2.274L7 26.981h1.815l.671-1.558h3.432l.682 1.558h3.465v-5.185l2.299 5.185h1.563l2.351-5.095v5.095H25V20H22.255zM10.135 23.915l1.026-2.44 1.066 2.44H10.135zM37.883 23.413L41 20.018h-2.217l-1.994 2.164L34.86 20H28v6.982h6.635l2.092-2.311L38.767 27h2.21L37.883 23.413zM33.728 25.516h-4.011v-1.381h3.838v-1.323h-3.838v-1.308l4.234.012 1.693 1.897L33.728 25.516z"
|
|
9592
9610
|
}))
|
|
9593
9611
|
};
|
|
9594
9612
|
return name ? icons[name.toLowerCase()] : /*#__PURE__*/React__default['default'].createElement("svg", {
|
|
@@ -9640,6 +9658,19 @@ function notifyBugsnag(callback, startOptions) {
|
|
|
9640
9658
|
}
|
|
9641
9659
|
callback();
|
|
9642
9660
|
}
|
|
9661
|
+
const refreshUser = () => {
|
|
9662
|
+
var _window$Pelcro6, _window$Pelcro6$user, _window$Pelcro6$user$;
|
|
9663
|
+
window.Pelcro.user.refresh({
|
|
9664
|
+
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
|
|
9665
|
+
}, (err, res) => {
|
|
9666
|
+
if (err) {
|
|
9667
|
+
console.error(err);
|
|
9668
|
+
}
|
|
9669
|
+
if (res) {
|
|
9670
|
+
return res.data;
|
|
9671
|
+
}
|
|
9672
|
+
});
|
|
9673
|
+
};
|
|
9643
9674
|
|
|
9644
9675
|
const resources = {
|
|
9645
9676
|
en: {
|
|
@@ -12610,8 +12641,8 @@ const SET_CANCEL_SUBSCRIPTION_REASON = "SET_CANCEL_SUBSCRIPTION_REASON";
|
|
|
12610
12641
|
const SET_CANCEL_SUBSCRIPTION_OPTION = "SET_CANCEL_SUBSCRIPTION_OPTION";
|
|
12611
12642
|
const HANDLE_CHECKBOX_CHANGE = "HANDLE_CHECKBOX_CHANGE";
|
|
12612
12643
|
const SET_IS_DEFAULT_PAYMENT_METHOD = "SET_IS_DEFAULT_PAYMENT_METHOD";
|
|
12613
|
-
const SET_DELETE_PAYMENT_METHOD_OPTION = "SET_DELETE_PAYMENT_METHOD_OPTION";
|
|
12614
12644
|
const SET_PAYMENT_METHODS = "SET_PAYMENT_METHODS";
|
|
12645
|
+
const SHOW_PAYMENT_METHOD_SELECT = "SHOW_PAYMENT_METHOD_SELECT";
|
|
12615
12646
|
const SET_SUBSCRIPTION_SUSPEND_DATE = "SET_SUBSCRIPTION_SUSPEND_DATE";
|
|
12616
12647
|
const SET_EMAILS = "SET_EMAILS";
|
|
12617
12648
|
const SET_EMAILS_ERROR = "SET_EMAILS_ERROR";
|
|
@@ -18125,6 +18156,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18125
18156
|
content: t("messages.sourceCreated")
|
|
18126
18157
|
}
|
|
18127
18158
|
});
|
|
18159
|
+
refreshUser();
|
|
18128
18160
|
onSuccess(res);
|
|
18129
18161
|
});
|
|
18130
18162
|
}
|
|
@@ -18179,6 +18211,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18179
18211
|
}
|
|
18180
18212
|
});
|
|
18181
18213
|
}
|
|
18214
|
+
refreshUser();
|
|
18182
18215
|
onSuccess(res);
|
|
18183
18216
|
});
|
|
18184
18217
|
}, 2000);
|
|
@@ -18240,6 +18273,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18240
18273
|
content: t("messages.sourceUpdated")
|
|
18241
18274
|
}
|
|
18242
18275
|
});
|
|
18276
|
+
refreshUser();
|
|
18243
18277
|
onSuccess(res);
|
|
18244
18278
|
});
|
|
18245
18279
|
}
|
|
@@ -18765,7 +18799,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18765
18799
|
const confirmStripeIntentSetup = (response, flow, paymentMethodId) => {
|
|
18766
18800
|
var _response$data2;
|
|
18767
18801
|
const setupIntent = (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.setup_intent;
|
|
18768
|
-
if (setupIntent !== null && setupIntent !== void 0 && setupIntent.client_secret) {
|
|
18802
|
+
if ((setupIntent === null || setupIntent === void 0 ? void 0 : setupIntent.status) === "requires_action" && setupIntent !== null && setupIntent !== void 0 && setupIntent.client_secret) {
|
|
18769
18803
|
var _response$data3, _response$data3$sourc;
|
|
18770
18804
|
stripe.confirmCardSetup(setupIntent.client_secret, {
|
|
18771
18805
|
payment_method: (_response$data3 = response.data) === null || _response$data3 === void 0 ? void 0 : (_response$data3$sourc = _response$data3.source) === null || _response$data3$sourc === void 0 ? void 0 : _response$data3$sourc.object_id
|
|
@@ -18789,6 +18823,19 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18789
18823
|
}
|
|
18790
18824
|
});
|
|
18791
18825
|
}
|
|
18826
|
+
if (flow === "subCreate") {
|
|
18827
|
+
dispatch({
|
|
18828
|
+
type: DISABLE_SUBMIT,
|
|
18829
|
+
payload: false
|
|
18830
|
+
});
|
|
18831
|
+
dispatch({
|
|
18832
|
+
type: LOADING,
|
|
18833
|
+
payload: false
|
|
18834
|
+
});
|
|
18835
|
+
refreshUser();
|
|
18836
|
+
onSuccess(res);
|
|
18837
|
+
return;
|
|
18838
|
+
}
|
|
18792
18839
|
if (flow === "create") {
|
|
18793
18840
|
dispatch({
|
|
18794
18841
|
type: LOADING,
|
|
@@ -18801,6 +18848,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18801
18848
|
content: t("messages.sourceCreated")
|
|
18802
18849
|
}
|
|
18803
18850
|
});
|
|
18851
|
+
refreshUser();
|
|
18804
18852
|
onSuccess(res);
|
|
18805
18853
|
return;
|
|
18806
18854
|
}
|
|
@@ -18820,6 +18868,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18820
18868
|
content: t("messages.sourceUpdated")
|
|
18821
18869
|
}
|
|
18822
18870
|
});
|
|
18871
|
+
refreshUser();
|
|
18823
18872
|
onSuccess(res);
|
|
18824
18873
|
return;
|
|
18825
18874
|
}
|
|
@@ -18847,6 +18896,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18847
18896
|
}
|
|
18848
18897
|
});
|
|
18849
18898
|
}
|
|
18899
|
+
refreshUser();
|
|
18850
18900
|
onSuccess(res);
|
|
18851
18901
|
});
|
|
18852
18902
|
}, 2000);
|
|
@@ -18878,6 +18928,10 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18878
18928
|
gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
|
|
18879
18929
|
address_id: product.address_required ? selectedAddressId : null
|
|
18880
18930
|
}, (err, res) => {
|
|
18931
|
+
var _res$data;
|
|
18932
|
+
if (res !== null && res !== void 0 && (_res$data = res.data) !== null && _res$data !== void 0 && _res$data.setup_intent) {
|
|
18933
|
+
return confirmStripeIntentSetup(res, "subCreate");
|
|
18934
|
+
}
|
|
18881
18935
|
confirmStripeCardPayment(res, err, true);
|
|
18882
18936
|
});
|
|
18883
18937
|
} else {
|
|
@@ -19141,7 +19195,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19141
19195
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
19142
19196
|
token: source.id
|
|
19143
19197
|
}, (err, res) => {
|
|
19144
|
-
var _res$
|
|
19198
|
+
var _res$data2, _res$data2$setup_inte, _res$data3, _res$data3$setup_inte;
|
|
19145
19199
|
if (err) {
|
|
19146
19200
|
dispatch({
|
|
19147
19201
|
type: DISABLE_SUBMIT,
|
|
@@ -19160,7 +19214,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19160
19214
|
}
|
|
19161
19215
|
});
|
|
19162
19216
|
}
|
|
19163
|
-
if (((_res$
|
|
19217
|
+
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") {
|
|
19164
19218
|
confirmStripeIntentSetup(res, "create");
|
|
19165
19219
|
} else {
|
|
19166
19220
|
dispatch({
|
|
@@ -19174,6 +19228,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19174
19228
|
content: t("messages.sourceCreated")
|
|
19175
19229
|
}
|
|
19176
19230
|
});
|
|
19231
|
+
refreshUser();
|
|
19177
19232
|
onSuccess(res);
|
|
19178
19233
|
}
|
|
19179
19234
|
});
|
|
@@ -19196,7 +19251,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19196
19251
|
exp_year: year,
|
|
19197
19252
|
is_default: isDefault
|
|
19198
19253
|
}, (err, res) => {
|
|
19199
|
-
var _res$
|
|
19254
|
+
var _res$data4, _res$data4$setup_inte, _res$data5, _res$data5$setup_inte;
|
|
19200
19255
|
dispatch({
|
|
19201
19256
|
type: DISABLE_SUBMIT,
|
|
19202
19257
|
payload: false
|
|
@@ -19215,7 +19270,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19215
19270
|
}
|
|
19216
19271
|
});
|
|
19217
19272
|
}
|
|
19218
|
-
if (((_res$
|
|
19273
|
+
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") {
|
|
19219
19274
|
confirmStripeIntentSetup(res, "update");
|
|
19220
19275
|
} else {
|
|
19221
19276
|
dispatch({
|
|
@@ -19225,6 +19280,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19225
19280
|
content: t("messages.sourceUpdated")
|
|
19226
19281
|
}
|
|
19227
19282
|
});
|
|
19283
|
+
refreshUser();
|
|
19228
19284
|
onSuccess(res);
|
|
19229
19285
|
}
|
|
19230
19286
|
});
|
|
@@ -19257,7 +19313,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19257
19313
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
19258
19314
|
token: source.id
|
|
19259
19315
|
}, (err, res) => {
|
|
19260
|
-
var _res$
|
|
19316
|
+
var _res$data6, _res$data6$setup_inte, _res$data7, _res$data7$setup_inte;
|
|
19261
19317
|
if (err) {
|
|
19262
19318
|
onFailure(err);
|
|
19263
19319
|
return dispatch({
|
|
@@ -19268,7 +19324,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19268
19324
|
}
|
|
19269
19325
|
});
|
|
19270
19326
|
}
|
|
19271
|
-
if (((_res$
|
|
19327
|
+
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") {
|
|
19272
19328
|
confirmStripeIntentSetup(res, "replace", paymentMethodId);
|
|
19273
19329
|
} else {
|
|
19274
19330
|
setTimeout(() => {
|
|
@@ -19294,6 +19350,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19294
19350
|
}
|
|
19295
19351
|
});
|
|
19296
19352
|
}
|
|
19353
|
+
refreshUser();
|
|
19297
19354
|
onSuccess(res);
|
|
19298
19355
|
});
|
|
19299
19356
|
}, 2000);
|
|
@@ -19389,12 +19446,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19389
19446
|
coupon_code: state === null || state === void 0 ? void 0 : state.couponCode,
|
|
19390
19447
|
address_id: selectedAddressId
|
|
19391
19448
|
}, (error, res) => {
|
|
19392
|
-
var _res$
|
|
19449
|
+
var _res$data8, _res$data9;
|
|
19393
19450
|
if (error) {
|
|
19394
19451
|
return reject(error);
|
|
19395
19452
|
}
|
|
19396
|
-
const taxAmount = (_res$
|
|
19397
|
-
const totalAmountWithTax = (_res$
|
|
19453
|
+
const taxAmount = (_res$data8 = res.data) === null || _res$data8 === void 0 ? void 0 : _res$data8.taxes;
|
|
19454
|
+
const totalAmountWithTax = (_res$data9 = res.data) === null || _res$data9 === void 0 ? void 0 : _res$data9.total;
|
|
19398
19455
|
resolve({
|
|
19399
19456
|
totalAmountWithTax,
|
|
19400
19457
|
taxAmount
|
|
@@ -25320,7 +25377,8 @@ const PasswordResetContainer = _ref => {
|
|
|
25320
25377
|
email,
|
|
25321
25378
|
password,
|
|
25322
25379
|
password_confirmation: confirmPassword,
|
|
25323
|
-
token
|
|
25380
|
+
token,
|
|
25381
|
+
referer: window.location.origin
|
|
25324
25382
|
}, (err, res) => {
|
|
25325
25383
|
dispatch({
|
|
25326
25384
|
type: DISABLE_SUBMIT,
|
|
@@ -25552,7 +25610,8 @@ const PasswordForgotContainer = _ref => {
|
|
|
25552
25610
|
email
|
|
25553
25611
|
} = _ref2;
|
|
25554
25612
|
window.Pelcro.password.forgot({
|
|
25555
|
-
email
|
|
25613
|
+
email,
|
|
25614
|
+
referer: window.location.origin
|
|
25556
25615
|
}, (err, res) => {
|
|
25557
25616
|
dispatch({
|
|
25558
25617
|
type: DISABLE_SUBMIT,
|
|
@@ -27677,17 +27736,21 @@ const AddressSelectModal = _ref => {
|
|
|
27677
27736
|
AddressSelectModal.viewId = "address-select";
|
|
27678
27737
|
|
|
27679
27738
|
const moveDefaultPaymentMethodToStart = paymentMethods => {
|
|
27680
|
-
|
|
27681
|
-
const defaultPaymentMethod = (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.source;
|
|
27739
|
+
const defaultPaymentMethod = getDefaultPaymentMethod(paymentMethods);
|
|
27682
27740
|
const paymentMethodsWithoutDefault = paymentMethods.filter(paymentMethod => paymentMethod.id !== defaultPaymentMethod.id);
|
|
27683
27741
|
if (defaultPaymentMethod.status !== "chargeable") {
|
|
27684
27742
|
return paymentMethodsWithoutDefault;
|
|
27685
27743
|
}
|
|
27686
27744
|
return [defaultPaymentMethod, ...paymentMethodsWithoutDefault];
|
|
27687
27745
|
};
|
|
27746
|
+
const getDefaultPaymentMethod = paymentMethods => {
|
|
27747
|
+
const defaultPaymentMethod = paymentMethods.find(paymentMethod => paymentMethod.is_default);
|
|
27748
|
+
return defaultPaymentMethod;
|
|
27749
|
+
};
|
|
27688
27750
|
const initialState$5 = {
|
|
27689
27751
|
paymentMethods: [],
|
|
27690
27752
|
selectedPaymentMethodId: null,
|
|
27753
|
+
skeletonLoader: true,
|
|
27691
27754
|
isSubmitting: false,
|
|
27692
27755
|
alert: {
|
|
27693
27756
|
type: "error",
|
|
@@ -27718,12 +27781,11 @@ const PaymentMethodSelectContainer = _ref => {
|
|
|
27718
27781
|
});
|
|
27719
27782
|
return onSuccess(selectedPaymentMethodId);
|
|
27720
27783
|
};
|
|
27721
|
-
const getInitialSelectedMethodId =
|
|
27722
|
-
var _window$Pelcro$user$r2;
|
|
27784
|
+
const getInitialSelectedMethodId = paymentMethods => {
|
|
27723
27785
|
if (selectedPaymentMethodIdFromStore) {
|
|
27724
27786
|
return selectedPaymentMethodIdFromStore;
|
|
27725
27787
|
}
|
|
27726
|
-
const defaultMethod = (
|
|
27788
|
+
const defaultMethod = getDefaultPaymentMethod(paymentMethods);
|
|
27727
27789
|
if (defaultMethod && defaultMethod.status === "chargeable") {
|
|
27728
27790
|
return String(defaultMethod.id);
|
|
27729
27791
|
}
|
|
@@ -27740,7 +27802,12 @@ const PaymentMethodSelectContainer = _ref => {
|
|
|
27740
27802
|
return lib_7({
|
|
27741
27803
|
...state,
|
|
27742
27804
|
paymentMethods: moveDefaultPaymentMethodToStart(action.payload),
|
|
27743
|
-
selectedPaymentMethodId: getInitialSelectedMethodId()
|
|
27805
|
+
selectedPaymentMethodId: getInitialSelectedMethodId(action.payload)
|
|
27806
|
+
});
|
|
27807
|
+
case SKELETON_LOADER:
|
|
27808
|
+
return lib_7({
|
|
27809
|
+
...state,
|
|
27810
|
+
skeletonLoader: action.payload
|
|
27744
27811
|
});
|
|
27745
27812
|
case HANDLE_SUBMIT:
|
|
27746
27813
|
return lib_5({
|
|
@@ -27752,10 +27819,23 @@ const PaymentMethodSelectContainer = _ref => {
|
|
|
27752
27819
|
}
|
|
27753
27820
|
}, initialState$5);
|
|
27754
27821
|
React.useEffect(() => {
|
|
27755
|
-
|
|
27756
|
-
|
|
27757
|
-
|
|
27758
|
-
|
|
27822
|
+
window.Pelcro.paymentMethods.list({
|
|
27823
|
+
auth_token: window.Pelcro.user.read().auth_token
|
|
27824
|
+
}, (err, res) => {
|
|
27825
|
+
if (err) {
|
|
27826
|
+
return console.error(err);
|
|
27827
|
+
}
|
|
27828
|
+
if (res) {
|
|
27829
|
+
var _res$data;
|
|
27830
|
+
dispatch({
|
|
27831
|
+
type: LOAD_PAYMENT_METHODS,
|
|
27832
|
+
payload: (_res$data = res.data) !== null && _res$data !== void 0 ? _res$data : []
|
|
27833
|
+
});
|
|
27834
|
+
dispatch({
|
|
27835
|
+
type: SKELETON_LOADER,
|
|
27836
|
+
payload: false
|
|
27837
|
+
});
|
|
27838
|
+
}
|
|
27759
27839
|
});
|
|
27760
27840
|
}, []);
|
|
27761
27841
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -27784,7 +27864,8 @@ const PaymentMethodSelectList = () => {
|
|
|
27784
27864
|
dispatch,
|
|
27785
27865
|
state: {
|
|
27786
27866
|
paymentMethods,
|
|
27787
|
-
selectedPaymentMethodId
|
|
27867
|
+
selectedPaymentMethodId,
|
|
27868
|
+
skeletonLoader
|
|
27788
27869
|
}
|
|
27789
27870
|
} = React.useContext(store$5);
|
|
27790
27871
|
const handlePaymentMethodSelect = event => {
|
|
@@ -27793,7 +27874,9 @@ const PaymentMethodSelectList = () => {
|
|
|
27793
27874
|
payload: event.target.value
|
|
27794
27875
|
});
|
|
27795
27876
|
};
|
|
27796
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
27877
|
+
return /*#__PURE__*/React__default['default'].createElement("div", null, skeletonLoader ? /*#__PURE__*/React__default['default'].createElement("div", {
|
|
27878
|
+
className: "plc-w-full plc-h-20 plc-bg-gray-300 plc-rounded-md plc-animate-pulse"
|
|
27879
|
+
}) : /*#__PURE__*/React__default['default'].createElement("div", {
|
|
27797
27880
|
className: "plc-px-3 plc-py-2 plc-space-y-4 plc-overflow-y-scroll plc-max-h-80 pelcro-payment-method-select-wrapper"
|
|
27798
27881
|
}, paymentMethods.map(paymentMethod => {
|
|
27799
27882
|
var _paymentMethod$proper, _paymentMethod$proper2, _paymentMethod$proper3, _paymentMethod$proper4;
|
|
@@ -27816,7 +27899,7 @@ const PaymentMethodSelectList = () => {
|
|
|
27816
27899
|
}, "\u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 ", (_paymentMethod$proper2 = paymentMethod.properties) === null || _paymentMethod$proper2 === void 0 ? void 0 : _paymentMethod$proper2.last4), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
27817
27900
|
className: "plc-text-sm plc-text-gray-500"
|
|
27818
27901
|
}, t("select.expires"), " ", (_paymentMethod$proper3 = paymentMethod.properties) === null || _paymentMethod$proper3 === void 0 ? void 0 : _paymentMethod$proper3.exp_month, "/", (_paymentMethod$proper4 = paymentMethod.properties) === null || _paymentMethod$proper4 === void 0 ? void 0 : _paymentMethod$proper4.exp_year))));
|
|
27819
|
-
}));
|
|
27902
|
+
})));
|
|
27820
27903
|
};
|
|
27821
27904
|
|
|
27822
27905
|
const PaymentMethodSelectSubmit = _ref => {
|
|
@@ -27918,10 +28001,10 @@ const initialState$4 = {
|
|
|
27918
28001
|
paymentMethods: [],
|
|
27919
28002
|
selectedPaymentMethodId: null,
|
|
27920
28003
|
isSubmitting: false,
|
|
27921
|
-
|
|
27922
|
-
disableSubmit: false,
|
|
28004
|
+
disableSubmit: true,
|
|
27923
28005
|
isLoading: false,
|
|
27924
28006
|
skeletonLoader: true,
|
|
28007
|
+
showPaymentMethodSelect: false,
|
|
27925
28008
|
alert: {
|
|
27926
28009
|
type: "error",
|
|
27927
28010
|
content: ""
|
|
@@ -27958,20 +28041,19 @@ const PaymentMethodDeleteContainer = _ref => {
|
|
|
27958
28041
|
type: SKELETON_LOADER,
|
|
27959
28042
|
payload: false
|
|
27960
28043
|
});
|
|
27961
|
-
if (res.data.length !== 1) {
|
|
28044
|
+
if (res.data.length !== 1 && paymentMethodToDelete.is_default && paymentMethodToDelete.deletable) {
|
|
27962
28045
|
dispatch({
|
|
27963
|
-
type:
|
|
27964
|
-
payload:
|
|
27965
|
-
});
|
|
27966
|
-
} else {
|
|
27967
|
-
dispatch({
|
|
27968
|
-
type: SET_DELETE_PAYMENT_METHOD_OPTION,
|
|
27969
|
-
payload: "add"
|
|
28046
|
+
type: SHOW_PAYMENT_METHOD_SELECT,
|
|
28047
|
+
payload: true
|
|
27970
28048
|
});
|
|
27971
28049
|
}
|
|
28050
|
+
dispatch({
|
|
28051
|
+
type: DISABLE_SUBMIT,
|
|
28052
|
+
payload: false
|
|
28053
|
+
});
|
|
27972
28054
|
}
|
|
27973
28055
|
});
|
|
27974
|
-
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
28056
|
+
}, [paymentMethodToDelete]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
27975
28057
|
|
|
27976
28058
|
const setDefaultPaymentMethod = () => {
|
|
27977
28059
|
const {
|
|
@@ -27983,6 +28065,15 @@ const PaymentMethodDeleteContainer = _ref => {
|
|
|
27983
28065
|
is_default: true
|
|
27984
28066
|
}, (err, res) => {
|
|
27985
28067
|
if (err) {
|
|
28068
|
+
dispatch({
|
|
28069
|
+
type: DISABLE_SUBMIT,
|
|
28070
|
+
payload: false
|
|
28071
|
+
});
|
|
28072
|
+
dispatch({
|
|
28073
|
+
type: LOADING,
|
|
28074
|
+
payload: false
|
|
28075
|
+
});
|
|
28076
|
+
console.log(err);
|
|
27986
28077
|
onFailure(err);
|
|
27987
28078
|
return dispatch({
|
|
27988
28079
|
type: SHOW_ALERT,
|
|
@@ -28005,6 +28096,14 @@ const PaymentMethodDeleteContainer = _ref => {
|
|
|
28005
28096
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
28006
28097
|
payment_method_id: paymentMethodId
|
|
28007
28098
|
}, (err, res) => {
|
|
28099
|
+
dispatch({
|
|
28100
|
+
type: DISABLE_SUBMIT,
|
|
28101
|
+
payload: false
|
|
28102
|
+
});
|
|
28103
|
+
dispatch({
|
|
28104
|
+
type: LOADING,
|
|
28105
|
+
payload: false
|
|
28106
|
+
});
|
|
28008
28107
|
if (err) {
|
|
28009
28108
|
onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
28010
28109
|
return dispatch({
|
|
@@ -28015,14 +28114,6 @@ const PaymentMethodDeleteContainer = _ref => {
|
|
|
28015
28114
|
}
|
|
28016
28115
|
});
|
|
28017
28116
|
}
|
|
28018
|
-
dispatch({
|
|
28019
|
-
type: DISABLE_SUBMIT,
|
|
28020
|
-
payload: false
|
|
28021
|
-
});
|
|
28022
|
-
dispatch({
|
|
28023
|
-
type: LOADING,
|
|
28024
|
-
payload: false
|
|
28025
|
-
});
|
|
28026
28117
|
onSuccess(res);
|
|
28027
28118
|
});
|
|
28028
28119
|
};
|
|
@@ -28038,11 +28129,12 @@ const PaymentMethodDeleteContainer = _ref => {
|
|
|
28038
28129
|
...state,
|
|
28039
28130
|
disableSubmit: true,
|
|
28040
28131
|
isLoading: true
|
|
28041
|
-
}, (state, dispatch) =>
|
|
28042
|
-
|
|
28043
|
-
|
|
28044
|
-
|
|
28045
|
-
|
|
28132
|
+
}, (state, dispatch) => {
|
|
28133
|
+
if (state.showPaymentMethodSelect) {
|
|
28134
|
+
setDefaultPaymentMethod();
|
|
28135
|
+
} else {
|
|
28136
|
+
deletePaymentMethod();
|
|
28137
|
+
}
|
|
28046
28138
|
});
|
|
28047
28139
|
case SET_PAYMENT_METHODS:
|
|
28048
28140
|
return lib_7({
|
|
@@ -28069,6 +28161,11 @@ const PaymentMethodDeleteContainer = _ref => {
|
|
|
28069
28161
|
...state,
|
|
28070
28162
|
skeletonLoader: action.payload
|
|
28071
28163
|
});
|
|
28164
|
+
case SHOW_PAYMENT_METHOD_SELECT:
|
|
28165
|
+
return lib_7({
|
|
28166
|
+
...state,
|
|
28167
|
+
showPaymentMethodSelect: action.payload
|
|
28168
|
+
});
|
|
28072
28169
|
default:
|
|
28073
28170
|
return state;
|
|
28074
28171
|
}
|
|
@@ -28091,6 +28188,91 @@ const PaymentMethodDeleteContainer = _ref => {
|
|
|
28091
28188
|
})));
|
|
28092
28189
|
};
|
|
28093
28190
|
|
|
28191
|
+
const PaymentMethodDeleteList = props => {
|
|
28192
|
+
const {
|
|
28193
|
+
t
|
|
28194
|
+
} = useTranslation("paymentMethod");
|
|
28195
|
+
const {
|
|
28196
|
+
dispatch,
|
|
28197
|
+
state: {
|
|
28198
|
+
selectedPaymentMethodId,
|
|
28199
|
+
paymentMethods,
|
|
28200
|
+
skeletonLoader,
|
|
28201
|
+
showPaymentMethodSelect
|
|
28202
|
+
}
|
|
28203
|
+
} = React.useContext(store$4);
|
|
28204
|
+
const {
|
|
28205
|
+
paymentMethodToDelete
|
|
28206
|
+
} = usePelcro();
|
|
28207
|
+
const createPaymentMethodItems = () => {
|
|
28208
|
+
if (paymentMethods.length) {
|
|
28209
|
+
return paymentMethods.filter(paymentMethod => (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id) !== (paymentMethodToDelete === null || paymentMethodToDelete === void 0 ? void 0 : paymentMethodToDelete.id)).map(paymentMethod => /*#__PURE__*/React__default['default'].createElement("option", {
|
|
28210
|
+
key: paymentMethod.id,
|
|
28211
|
+
value: paymentMethod.id
|
|
28212
|
+
}, paymentMethod.properties.brand, " -", " ", paymentMethod.properties.last4, " -", " ", paymentMethod.properties.exp_month, " /", paymentMethod.properties.exp_year));
|
|
28213
|
+
}
|
|
28214
|
+
};
|
|
28215
|
+
const handlePaymentMethodSelect = event => {
|
|
28216
|
+
dispatch({
|
|
28217
|
+
type: SELECT_PAYMENT_METHOD,
|
|
28218
|
+
payload: event.target.value
|
|
28219
|
+
});
|
|
28220
|
+
};
|
|
28221
|
+
if (showPaymentMethodSelect) {
|
|
28222
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, skeletonLoader ? /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28223
|
+
className: "plc-w-full plc-h-8 plc-bg-gray-300 plc-rounded-md plc-animate-pulse"
|
|
28224
|
+
}) : /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, paymentMethods && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28225
|
+
className: "plc-mt-4"
|
|
28226
|
+
}, /*#__PURE__*/React__default['default'].createElement(Select, {
|
|
28227
|
+
label: t("delete.options.select"),
|
|
28228
|
+
name: "default-payment-method",
|
|
28229
|
+
onChange: handlePaymentMethodSelect,
|
|
28230
|
+
value: selectedPaymentMethodId
|
|
28231
|
+
}, /*#__PURE__*/React__default['default'].createElement("option", {
|
|
28232
|
+
value: "",
|
|
28233
|
+
disabled: true,
|
|
28234
|
+
selected: true
|
|
28235
|
+
}), createPaymentMethodItems()))));
|
|
28236
|
+
} else {
|
|
28237
|
+
return null;
|
|
28238
|
+
}
|
|
28239
|
+
};
|
|
28240
|
+
|
|
28241
|
+
const PaymentMethodDetails = () => {
|
|
28242
|
+
var _paymentMethodToDelet, _paymentMethodToDelet2, _paymentMethodToDelet3, _paymentMethodToDelet4;
|
|
28243
|
+
const {
|
|
28244
|
+
state: {
|
|
28245
|
+
skeletonLoader
|
|
28246
|
+
}
|
|
28247
|
+
} = React.useContext(store$4);
|
|
28248
|
+
const {
|
|
28249
|
+
t
|
|
28250
|
+
} = useTranslation("paymentMethod");
|
|
28251
|
+
const {
|
|
28252
|
+
paymentMethodToDelete
|
|
28253
|
+
} = usePelcro();
|
|
28254
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28255
|
+
className: "plc-text-left plc-mr-auto plc-mb-6"
|
|
28256
|
+
}, /*#__PURE__*/React__default['default'].createElement("h4", {
|
|
28257
|
+
className: "plc-mb-2"
|
|
28258
|
+
}, t("delete.details")), skeletonLoader ? /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28259
|
+
className: "plc-w-full plc-h-16 plc-bg-gray-300 plc-rounded-md plc-animate-pulse"
|
|
28260
|
+
}) : /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, paymentMethodToDelete && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28261
|
+
key: paymentMethodToDelete === null || paymentMethodToDelete === void 0 ? void 0 : paymentMethodToDelete.id,
|
|
28262
|
+
className: `plc-p-2 plc-pl-4 plc-shadow-md_dark plc-text-gray-900 plc-rounded pelcro-payment-method-wrapper`
|
|
28263
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28264
|
+
className: "plc-flex plc-items-center plc-space-x-2 plc-w-full pelcro-select-payment-method-radio",
|
|
28265
|
+
id: `pelcro-payment-method-select-${paymentMethodToDelete === null || paymentMethodToDelete === void 0 ? void 0 : paymentMethodToDelete.id}`,
|
|
28266
|
+
name: "paymentMethod"
|
|
28267
|
+
}, getPaymentCardIcon$1((_paymentMethodToDelet = paymentMethodToDelete.properties) === null || _paymentMethodToDelet === void 0 ? void 0 : _paymentMethodToDelet.brand), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28268
|
+
className: "plc-flex plc-flex-col plc-text-lg pelcro-payment-method-details"
|
|
28269
|
+
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
28270
|
+
className: "plc-font-semibold"
|
|
28271
|
+
}, "\u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022", " ", (_paymentMethodToDelet2 = paymentMethodToDelete.properties) === null || _paymentMethodToDelet2 === void 0 ? void 0 : _paymentMethodToDelet2.last4), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
28272
|
+
className: "plc-text-sm plc-text-gray-500"
|
|
28273
|
+
}, t("select.expires"), " ", (_paymentMethodToDelet3 = paymentMethodToDelete.properties) === null || _paymentMethodToDelet3 === void 0 ? void 0 : _paymentMethodToDelet3.exp_month, "/", (_paymentMethodToDelet4 = paymentMethodToDelete.properties) === null || _paymentMethodToDelet4 === void 0 ? void 0 : _paymentMethodToDelet4.exp_year))))));
|
|
28274
|
+
};
|
|
28275
|
+
|
|
28094
28276
|
const PaymentMethodDeleteSubmit = _ref => {
|
|
28095
28277
|
let {
|
|
28096
28278
|
name,
|
|
@@ -28104,7 +28286,9 @@ const PaymentMethodDeleteSubmit = _ref => {
|
|
|
28104
28286
|
dispatch,
|
|
28105
28287
|
state: {
|
|
28106
28288
|
isLoading,
|
|
28107
|
-
|
|
28289
|
+
disableSubmit,
|
|
28290
|
+
showPaymentMethodSelect,
|
|
28291
|
+
selectedPaymentMethodId
|
|
28108
28292
|
}
|
|
28109
28293
|
} = React.useContext(store$4);
|
|
28110
28294
|
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
@@ -28114,116 +28298,38 @@ const PaymentMethodDeleteSubmit = _ref => {
|
|
|
28114
28298
|
});
|
|
28115
28299
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
28116
28300
|
},
|
|
28117
|
-
disabled:
|
|
28301
|
+
disabled: showPaymentMethodSelect ? !selectedPaymentMethodId : disableSubmit,
|
|
28118
28302
|
isLoading: isLoading,
|
|
28119
28303
|
className: "plc-w-full"
|
|
28120
|
-
}, otherProps), name !== null && name !== void 0 ? name : t("
|
|
28304
|
+
}, otherProps), name !== null && name !== void 0 ? name : t("delete.buttons.delete"));
|
|
28121
28305
|
};
|
|
28122
28306
|
|
|
28123
|
-
const
|
|
28307
|
+
const PaymentMethodDeleteBack = _ref => {
|
|
28308
|
+
let {
|
|
28309
|
+
name,
|
|
28310
|
+
onClick,
|
|
28311
|
+
...otherProps
|
|
28312
|
+
} = _ref;
|
|
28124
28313
|
const {
|
|
28125
28314
|
t
|
|
28126
28315
|
} = useTranslation("paymentMethod");
|
|
28127
28316
|
const {
|
|
28128
|
-
|
|
28129
|
-
state: {
|
|
28130
|
-
deleteOption,
|
|
28131
|
-
selectedPaymentMethodId,
|
|
28132
|
-
paymentMethods,
|
|
28133
|
-
skeletonLoader
|
|
28134
|
-
}
|
|
28135
|
-
} = React.useContext(store$4);
|
|
28136
|
-
const {
|
|
28137
|
-
paymentMethodToDelete
|
|
28317
|
+
switchView
|
|
28138
28318
|
} = usePelcro();
|
|
28139
|
-
|
|
28140
|
-
|
|
28141
|
-
|
|
28142
|
-
|
|
28143
|
-
|
|
28144
|
-
|
|
28145
|
-
|
|
28146
|
-
|
|
28147
|
-
}) : /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, paymentMethods && deleteOption === "select" && /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28148
|
-
className: "plc-px-3 plc-py-2 plc-space-y-4 plc-overflow-y-scroll no-scrollbar plc-max-h-80 pelcro-payment-method-select-wrapper plc-mb-4"
|
|
28149
|
-
}, paymentMethods.filter(paymentMethod => (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id) !== (paymentMethodToDelete === null || paymentMethodToDelete === void 0 ? void 0 : paymentMethodToDelete.id)).map(paymentMethod => {
|
|
28150
|
-
var _paymentMethod$proper, _paymentMethod$proper2, _paymentMethod$proper3, _paymentMethod$proper4;
|
|
28151
|
-
const isSelected = selectedPaymentMethodId === String(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id);
|
|
28152
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28153
|
-
key: paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id,
|
|
28154
|
-
className: `plc-p-2 plc-pl-4 plc-shadow-md plc-text-gray-900 plc-rounded pelcro-payment-method-wrapper`
|
|
28155
|
-
}, /*#__PURE__*/React__default['default'].createElement(Radio, {
|
|
28156
|
-
className: "plc-flex plc-items-center pelcro-select-payment-method-radio",
|
|
28157
|
-
labelClassName: "plc-flex plc-items-center plc-space-x-2 plc-cursor-pointer plc-w-full",
|
|
28158
|
-
id: `pelcro-payment-method-select-${paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id}`,
|
|
28159
|
-
name: "paymentMethod",
|
|
28160
|
-
checked: isSelected,
|
|
28161
|
-
value: paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id,
|
|
28162
|
-
onChange: handlePaymentMethodSelect
|
|
28163
|
-
}, getPaymentCardIcon$1((_paymentMethod$proper = paymentMethod.properties) === null || _paymentMethod$proper === void 0 ? void 0 : _paymentMethod$proper.brand), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28164
|
-
className: "plc-flex plc-flex-col plc-text-lg pelcro-payment-method-details"
|
|
28165
|
-
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
28166
|
-
className: "plc-font-semibold"
|
|
28167
|
-
}, "\u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022", " ", (_paymentMethod$proper2 = paymentMethod.properties) === null || _paymentMethod$proper2 === void 0 ? void 0 : _paymentMethod$proper2.last4), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
28168
|
-
className: "plc-text-sm plc-text-gray-500"
|
|
28169
|
-
}, t("select.expires"), " ", (_paymentMethod$proper3 = paymentMethod.properties) === null || _paymentMethod$proper3 === void 0 ? void 0 : _paymentMethod$proper3.exp_month, "/", (_paymentMethod$proper4 = paymentMethod.properties) === null || _paymentMethod$proper4 === void 0 ? void 0 : _paymentMethod$proper4.exp_year))));
|
|
28170
|
-
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28171
|
-
className: "plc-px-3"
|
|
28172
|
-
}, /*#__PURE__*/React__default['default'].createElement(PaymentMethodDeleteSubmit, null))), deleteOption === "add" && /*#__PURE__*/React__default['default'].createElement(PaymentMethodView, {
|
|
28173
|
-
type: "deletePaymentSource",
|
|
28174
|
-
showCoupon: false,
|
|
28175
|
-
showExternalPaymentMethods: false,
|
|
28176
|
-
showApplePayButton: false,
|
|
28177
|
-
onDisplay: props.onDisplay,
|
|
28178
|
-
onFailure: props.onFailure,
|
|
28179
|
-
onSuccess: props.onSuccess,
|
|
28180
|
-
setAsDefault: true
|
|
28181
|
-
})));
|
|
28319
|
+
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
28320
|
+
variant: "outline",
|
|
28321
|
+
onClick: () => {
|
|
28322
|
+
switchView("dashboard");
|
|
28323
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
28324
|
+
},
|
|
28325
|
+
className: "plc-w-full"
|
|
28326
|
+
}, otherProps), name !== null && name !== void 0 ? name : t("delete.buttons.back"));
|
|
28182
28327
|
};
|
|
28183
28328
|
|
|
28184
|
-
|
|
28185
|
-
const {
|
|
28186
|
-
state: {
|
|
28187
|
-
deleteOption,
|
|
28188
|
-
paymentMethods,
|
|
28189
|
-
skeletonLoader
|
|
28190
|
-
},
|
|
28191
|
-
dispatch
|
|
28192
|
-
} = React.useContext(store$4);
|
|
28329
|
+
function PaymentMethodDeleteView(props) {
|
|
28193
28330
|
const {
|
|
28194
28331
|
t
|
|
28195
28332
|
} = useTranslation("paymentMethod");
|
|
28196
|
-
const handleOptionSelect = event => {
|
|
28197
|
-
dispatch({
|
|
28198
|
-
type: SET_DELETE_PAYMENT_METHOD_OPTION,
|
|
28199
|
-
payload: event.target.value
|
|
28200
|
-
});
|
|
28201
|
-
};
|
|
28202
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28203
|
-
className: "plc-text-left plc-mr-auto plc-mb-6"
|
|
28204
|
-
}, skeletonLoader ? /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28205
|
-
className: "plc-flex plc-flex-col plc-space-y-3"
|
|
28206
|
-
}, /*#__PURE__*/React__default['default'].createElement(Radio, {
|
|
28207
|
-
className: "plc-animate-puls"
|
|
28208
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28209
|
-
className: "plc-w-36 plc-bg-gray-300 plc-h-4 plc-rounded-md plc-animate-pulse"
|
|
28210
|
-
})), /*#__PURE__*/React__default['default'].createElement(Radio, {
|
|
28211
|
-
className: "plc-animate-pulse"
|
|
28212
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28213
|
-
className: "plc-w-36 plc-bg-gray-300 plc-h-4 plc-rounded-md plc-animate-pulse"
|
|
28214
|
-
}))) : /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, paymentMethods && paymentMethods.length !== 1 && /*#__PURE__*/React__default['default'].createElement(Radio, {
|
|
28215
|
-
onChange: handleOptionSelect,
|
|
28216
|
-
checked: deleteOption === "select",
|
|
28217
|
-
value: "select"
|
|
28218
|
-
}, t("delete.options.select")), /*#__PURE__*/React__default['default'].createElement(Radio, {
|
|
28219
|
-
onChange: handleOptionSelect,
|
|
28220
|
-
checked: deleteOption === "add",
|
|
28221
|
-
value: "add"
|
|
28222
|
-
}, t("delete.options.add"))));
|
|
28223
|
-
};
|
|
28224
|
-
|
|
28225
|
-
function PaymentMethodDeleteView(props) {
|
|
28226
|
-
const [t] = useTranslation("paymentMethod");
|
|
28227
28333
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28228
28334
|
id: "pelcro-payment-method-delete-view"
|
|
28229
28335
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -28231,12 +28337,12 @@ function PaymentMethodDeleteView(props) {
|
|
|
28231
28337
|
}, /*#__PURE__*/React__default['default'].createElement("h4", {
|
|
28232
28338
|
className: "plc-text-2xl plc-font-semibold plc-mb-2"
|
|
28233
28339
|
}, t("delete.title")), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
28234
|
-
className: ""
|
|
28235
|
-
}, t("delete.subtitle"))), /*#__PURE__*/React__default['default'].createElement(PaymentMethodDeleteContainer, props, /*#__PURE__*/React__default['default'].createElement(AlertWithContext, {
|
|
28236
|
-
className: "plc-
|
|
28237
|
-
}
|
|
28238
|
-
|
|
28239
|
-
})));
|
|
28340
|
+
className: "plc-text-sm"
|
|
28341
|
+
}, t("delete.subtitle"))), /*#__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", {
|
|
28342
|
+
className: "plc-text-sm plc-text-justify"
|
|
28343
|
+
}, t("delete.message")), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28344
|
+
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"
|
|
28345
|
+
}, /*#__PURE__*/React__default['default'].createElement(PaymentMethodDeleteSubmit, null), /*#__PURE__*/React__default['default'].createElement(PaymentMethodDeleteBack, null))));
|
|
28240
28346
|
}
|
|
28241
28347
|
|
|
28242
28348
|
const PaymentMethodDeleteModal = props => {
|
|
@@ -28263,7 +28369,7 @@ const PaymentMethodDeleteModal = props => {
|
|
|
28263
28369
|
nonInteraction: true
|
|
28264
28370
|
});
|
|
28265
28371
|
}
|
|
28266
|
-
notify$1.success(t("delete.
|
|
28372
|
+
notify$1.success(t("delete.deletedSuccessfully"));
|
|
28267
28373
|
resetView();
|
|
28268
28374
|
};
|
|
28269
28375
|
return /*#__PURE__*/React__default['default'].createElement(Modal, {
|
|
@@ -29449,6 +29555,14 @@ const getPaymentCardIcon = name => {
|
|
|
29449
29555
|
viewBox: "0 0 50 50"
|
|
29450
29556
|
}, /*#__PURE__*/React__default['default'].createElement("path", {
|
|
29451
29557
|
d: "M 5 7 C 2.25 7 0 9.25 0 12 L 0 38 C 0 40.75 2.25 43 5 43 L 45 43 C 47.75 43 50 40.75 50 38 L 50 12 C 50 9.25 47.75 7 45 7 Z M 5 9 L 45 9 C 46.667969 9 48 10.332031 48 12 L 48 38 C 48 39.667969 46.667969 41 45 41 L 5 41 C 3.332031 41 2 39.667969 2 38 L 2 12 C 2 10.332031 3.332031 9 5 9 Z M 8.5625 19.90625 L 4.84375 28.40625 L 7.0625 28.40625 L 7.875 26.5 L 12.0625 26.5 L 12.875 28.40625 L 17.09375 28.40625 L 17.09375 22.09375 L 19.90625 28.40625 L 21.8125 28.40625 L 24.65625 22.1875 L 24.65625 28.40625 L 26.75 28.40625 L 26.75 19.90625 L 23.40625 19.90625 L 20.84375 25.625 L 18.28125 19.90625 L 15 19.90625 L 15 28.09375 L 11.34375 19.90625 Z M 29.5 19.90625 L 29.5 28.4375 L 37.5 28.4375 L 40 25.59375 L 42.46875 28.4375 L 45.125 28.4375 L 41.375 24.0625 L 45.125 19.90625 L 42.46875 19.90625 L 40.0625 22.5625 L 37.75 19.90625 Z M 9.90625 21.6875 L 11.21875 24.6875 L 8.65625 24.6875 Z M 31.5625 21.71875 L 36.65625 21.75 L 38.6875 24.0625 L 36.40625 26.625 L 31.5625 26.625 L 31.5625 24.9375 L 36.1875 24.9375 L 36.1875 23.3125 L 31.5625 23.3125 Z"
|
|
29558
|
+
})),
|
|
29559
|
+
amex: /*#__PURE__*/React__default['default'].createElement("svg", {
|
|
29560
|
+
className: "plc-w-12",
|
|
29561
|
+
fill: "#ffffff",
|
|
29562
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
29563
|
+
viewBox: "0 0 50 50"
|
|
29564
|
+
}, /*#__PURE__*/React__default['default'].createElement("path", {
|
|
29565
|
+
d: "M 5 7 C 2.25 7 0 9.25 0 12 L 0 38 C 0 40.75 2.25 43 5 43 L 45 43 C 47.75 43 50 40.75 50 38 L 50 12 C 50 9.25 47.75 7 45 7 Z M 5 9 L 45 9 C 46.667969 9 48 10.332031 48 12 L 48 38 C 48 39.667969 46.667969 41 45 41 L 5 41 C 3.332031 41 2 39.667969 2 38 L 2 12 C 2 10.332031 3.332031 9 5 9 Z M 8.5625 19.90625 L 4.84375 28.40625 L 7.0625 28.40625 L 7.875 26.5 L 12.0625 26.5 L 12.875 28.40625 L 17.09375 28.40625 L 17.09375 22.09375 L 19.90625 28.40625 L 21.8125 28.40625 L 24.65625 22.1875 L 24.65625 28.40625 L 26.75 28.40625 L 26.75 19.90625 L 23.40625 19.90625 L 20.84375 25.625 L 18.28125 19.90625 L 15 19.90625 L 15 28.09375 L 11.34375 19.90625 Z M 29.5 19.90625 L 29.5 28.4375 L 37.5 28.4375 L 40 25.59375 L 42.46875 28.4375 L 45.125 28.4375 L 41.375 24.0625 L 45.125 19.90625 L 42.46875 19.90625 L 40.0625 22.5625 L 37.75 19.90625 Z M 9.90625 21.6875 L 11.21875 24.6875 L 8.65625 24.6875 Z M 31.5625 21.71875 L 36.65625 21.75 L 38.6875 24.0625 L 36.40625 26.625 L 31.5625 26.625 L 31.5625 24.9375 L 36.1875 24.9375 L 36.1875 23.3125 L 31.5625 23.3125 Z"
|
|
29452
29566
|
}))
|
|
29453
29567
|
};
|
|
29454
29568
|
return (_icons$name$toLowerCa = icons[name === null || name === void 0 ? void 0 : name.toLowerCase()]) !== null && _icons$name$toLowerCa !== void 0 ? _icons$name$toLowerCa : /*#__PURE__*/React__default['default'].createElement("svg", {
|
|
@@ -30775,23 +30889,8 @@ class Dashboard extends React.Component {
|
|
|
30775
30889
|
});
|
|
30776
30890
|
});
|
|
30777
30891
|
_defineProperty$3(this, "onDeletePaymentMethodClick", source => {
|
|
30778
|
-
|
|
30779
|
-
|
|
30780
|
-
this.props.onClose();
|
|
30781
|
-
notify$1.confirm((onSuccess, onFailure) => {
|
|
30782
|
-
this.deletePaymentMethod(source.id, onSuccess, onFailure);
|
|
30783
|
-
}, {
|
|
30784
|
-
confirmMessage: this.locale("messages.paymentMethodDeletion.isSureToDelete"),
|
|
30785
|
-
loadingMessage: this.locale("messages.paymentMethodDeletion.loading"),
|
|
30786
|
-
successMessage: this.locale("messages.paymentMethodDeletion.success"),
|
|
30787
|
-
errorMessage: this.locale("messages.paymentMethodDeletion.error")
|
|
30788
|
-
}, {
|
|
30789
|
-
closeButtonLabel: this.locale("labels.subCancellation.goBack")
|
|
30790
|
-
});
|
|
30791
|
-
} else {
|
|
30792
|
-
this.props.setPaymentMethodToDelete(source.id);
|
|
30793
|
-
return this.props.setView("payment-method-delete");
|
|
30794
|
-
}
|
|
30892
|
+
this.props.setPaymentMethodToDelete(source.id);
|
|
30893
|
+
return this.props.setView("payment-method-delete");
|
|
30795
30894
|
});
|
|
30796
30895
|
_defineProperty$3(this, "displayRedeem", () => {
|
|
30797
30896
|
return this.props.setView("gift-redeem");
|
|
@@ -35288,7 +35387,6 @@ exports.PaymentMethodCreateView = PaymentMethodCreateView;
|
|
|
35288
35387
|
exports.PaymentMethodDeleteContainer = PaymentMethodDeleteContainer;
|
|
35289
35388
|
exports.PaymentMethodDeleteList = PaymentMethodDeleteList;
|
|
35290
35389
|
exports.PaymentMethodDeleteModal = PaymentMethodDeleteModal;
|
|
35291
|
-
exports.PaymentMethodDeleteOptions = PaymentMethodDeleteOptions;
|
|
35292
35390
|
exports.PaymentMethodDeleteSubmit = PaymentMethodDeleteSubmit;
|
|
35293
35391
|
exports.PaymentMethodDeleteView = PaymentMethodDeleteView;
|
|
35294
35392
|
exports.PaymentMethodSelectContainer = PaymentMethodSelectContainer;
|