@pelcro/react-pelcro-js 4.0.0-alpha.58 → 4.0.0-alpha.59
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 +458 -140
- package/dist/index.esm.js +455 -141
- package/dist/pelcro.css +21 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -3639,6 +3639,7 @@ var userEdit_en = {
|
|
|
3639
3639
|
|
|
3640
3640
|
var title$z = "Enter your shipping address";
|
|
3641
3641
|
var titleGifting$3 = "Enter your address";
|
|
3642
|
+
var titleBilling = "Enter your billing address";
|
|
3642
3643
|
var selectAddressTitle$3 = "Please select an address";
|
|
3643
3644
|
var selectAddressSubtitle$3 = "Select one of your saved addresses, or add a new one";
|
|
3644
3645
|
var labels$Y = {
|
|
@@ -3664,6 +3665,7 @@ var messages$$ = {
|
|
|
3664
3665
|
var address_en = {
|
|
3665
3666
|
title: title$z,
|
|
3666
3667
|
titleGifting: titleGifting$3,
|
|
3668
|
+
titleBilling: titleBilling,
|
|
3667
3669
|
selectAddressTitle: selectAddressTitle$3,
|
|
3668
3670
|
selectAddressSubtitle: selectAddressSubtitle$3,
|
|
3669
3671
|
labels: labels$Y,
|
|
@@ -3815,7 +3817,11 @@ var labels$W = {
|
|
|
3815
3817
|
dec: "December"
|
|
3816
3818
|
},
|
|
3817
3819
|
checkout: {
|
|
3818
|
-
title: "Payment Information"
|
|
3820
|
+
title: "Payment Information",
|
|
3821
|
+
billingAddress: "Billing Address",
|
|
3822
|
+
NoBillingAddress: "No Billing Address Found",
|
|
3823
|
+
changeBillingAddress: "Change",
|
|
3824
|
+
addNewAddress: "Add New Address"
|
|
3819
3825
|
}
|
|
3820
3826
|
};
|
|
3821
3827
|
var messages$X = {
|
|
@@ -9374,6 +9380,7 @@ const initialState$p = {
|
|
|
9374
9380
|
isAuthenticated: () => window.Pelcro.user.isAuthenticated(),
|
|
9375
9381
|
selectedPaymentMethodId: null,
|
|
9376
9382
|
selectedAddressId: null,
|
|
9383
|
+
selectedBillingAddressId: null,
|
|
9377
9384
|
addressIdToEdit: null
|
|
9378
9385
|
};
|
|
9379
9386
|
|
|
@@ -9533,17 +9540,6 @@ const userHasAddress = () => {
|
|
|
9533
9540
|
const addresses = (_window$Pelcro$user$r2 = (_window$Pelcro$user$r3 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r3 === void 0 ? void 0 : _window$Pelcro$user$r3.addresses) !== null && _window$Pelcro$user$r2 !== void 0 ? _window$Pelcro$user$r2 : [];
|
|
9534
9541
|
return addresses.length > 0;
|
|
9535
9542
|
};
|
|
9536
|
-
/** check wether or not the user have any billing addresses
|
|
9537
|
-
* @return {boolean} true if the user have at least one billing address, false otherwise
|
|
9538
|
-
*/
|
|
9539
|
-
|
|
9540
|
-
const userHasBillingAddress = () => {
|
|
9541
|
-
var _window$Pelcro$user$r4, _window$Pelcro$user$r5;
|
|
9542
|
-
|
|
9543
|
-
const addresses = (_window$Pelcro$user$r4 = (_window$Pelcro$user$r5 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r5 === void 0 ? void 0 : _window$Pelcro$user$r5.addresses) !== null && _window$Pelcro$user$r4 !== void 0 ? _window$Pelcro$user$r4 : [];
|
|
9544
|
-
const billingAddresses = addresses.filter(address => address.type == "billing");
|
|
9545
|
-
return billingAddresses.length > 0;
|
|
9546
|
-
};
|
|
9547
9543
|
const calcAndFormatItemsTotal = (items, currency) => {
|
|
9548
9544
|
if (!Array.isArray(items)) return;
|
|
9549
9545
|
let totalWithoutDividingBy100 = 0;
|
|
@@ -9760,13 +9756,37 @@ const getPaymentCardIcon = name => {
|
|
|
9760
9756
|
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"
|
|
9761
9757
|
})),
|
|
9762
9758
|
bacs_debit: /*#__PURE__*/React__default.createElement("svg", {
|
|
9763
|
-
className: "plc-w-
|
|
9759
|
+
className: "plc-w-16",
|
|
9764
9760
|
xmlns: "http://www.w3.org/2000/svg",
|
|
9765
|
-
viewBox: "0 0
|
|
9761
|
+
viewBox: "0 0 1804.35 528.73"
|
|
9762
|
+
}, /*#__PURE__*/React__default.createElement("defs", null, /*#__PURE__*/React__default.createElement("clipPath", {
|
|
9763
|
+
id: "clip1"
|
|
9766
9764
|
}, /*#__PURE__*/React__default.createElement("path", {
|
|
9767
|
-
|
|
9768
|
-
|
|
9769
|
-
|
|
9765
|
+
d: "M0 0h581v528.73H0zm0 0"
|
|
9766
|
+
})), /*#__PURE__*/React__default.createElement("clipPath", {
|
|
9767
|
+
id: "clip2"
|
|
9768
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
9769
|
+
d: "M584 0h1220.352v528.73H584zm0 0"
|
|
9770
|
+
})), /*#__PURE__*/React__default.createElement("clipPath", {
|
|
9771
|
+
id: "clip3"
|
|
9772
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
9773
|
+
d: "M0 0h581v528.73H0zm0 0"
|
|
9774
|
+
}))), /*#__PURE__*/React__default.createElement("g", null, /*#__PURE__*/React__default.createElement("g", {
|
|
9775
|
+
clipPath: "url(#clip1)"
|
|
9776
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
9777
|
+
fill: "#FFF",
|
|
9778
|
+
d: "M580.68 0H101.277L.02 528.64h302.636c120.051-.808 194.696-98.507 214.168-194.1L580.68 0h-.016.016"
|
|
9779
|
+
})), /*#__PURE__*/React__default.createElement("g", {
|
|
9780
|
+
clipPath: "url(#clip2)"
|
|
9781
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
9782
|
+
fill: "#020202",
|
|
9783
|
+
d: "M1555.66 503.934c16.05 12.386 49.59 24.058 87.512 24.773 74.398 0 134.918-42.289 134.918-116.684 0-39.359-26.969-69.984-66.352-92.586-31.36-17.535-48.136-33.574-48.136-59.09 0-30.644 26.25-53.265 62.738-53.265 26.23 0 48.84 8.777 61.25 16.059l16.762-45.942c-13.114-8.758-41.563-17.515-73.653-17.515-74.39 0-127.629 47.398-127.629 109.402 0 35.75 22.59 67.09 63.442 89.71 36.476 20.411 48.86 37.188 48.86 64.9 0 31.359-26.25 57.632-67.09 57.632-28.454 0-59.071-11.687-75.852-21.883zm-43.851-45.223c-18.23 8.773-45.938 19.707-81.68 19.707-57.598 0-87.508-37.223-87.508-94.102 0-83.128 57.617-173.562 149.488-173.562 26.282 0 45.942 6.543 59.801 13.125l17.52-48.137c-10.93-5.828-40.86-15.32-73.668-15.32-126.883 0-215.864 110.855-215.864 231.191 0 75.153 44.493 137.117 135.66 137.117 47.403 0 83.864-13.132 102.102-21.886zm-309.13-245.766c-8.738-2.191-21.87-5.125-42.288-5.125-91.172 0-165.567 95.559-166.301 193.274 0 39.383 13.87 78.062 60.55 78.062 50.329 0 110.122-65.656 127.63-159.719zm-39.378 307.762c0-21.144 3.668-54.695 8.02-91.168h-1.462c-38.648 72.938-86.789 99.191-137.109 99.191-61.984 0-101.363-49.574-101.363-116.707 0-122.507 90.414-252.34 244.324-252.34 33.559 0 70.719 5.844 94.8 13.868l-35.73 183.789c-11.672 61.265-16.8 124.008-15.32 163.367zm-511.969-136.39c-2.93 11.667-5.11 26.253-4.387 44.507 0 33.535 18.973 52.504 56.895 52.504 91.172 0 146.59-108.664 146.59-186.707 0-43.77-18.973-84.605-67.09-84.605-52.528 0-106.492 53.96-123.988 137.129zM728.622 0l-47.403 231.883h1.457c31.36-47.383 76.586-72.2 123.988-72.2 77.316 0 106.492 64.196 106.492 126.919 0 107.925-78.047 242.128-219.527 242.128-62.004 0-108.668-25.515-108.668-91.148 0-16.781 2.91-37.945 5.844-54.727L668.075 0h60.546"
|
|
9784
|
+
})), /*#__PURE__*/React__default.createElement("g", {
|
|
9785
|
+
clipPath: "url(#clip3)"
|
|
9786
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
9787
|
+
fill: "#E41C3B",
|
|
9788
|
+
d: "M471.438 172.54C466.851 85.647 370 17.19 241.07 0h-14.316c126.144 23.848 218.434 99.512 218.434 189.246 0 68.027-52.993 128.031-133.649 163.457 98.598-37.238 163.836-105.52 159.899-180.164M275.288 0c126.055 27.027 217.73 102.375 222.637 195.703 6.527 123.57-141.555 231.863-330.766 241.824-52.219 2.766-102.101-2.27-147.094-13.578L0 528.641h302.656c120.035-.809 194.696-98.543 214.188-194.157L580.664 0zm-63.332 377.516c117.512-24.829 202.926-99.672 202.926-188.27 0-89.785-87.754-165.453-207.746-189.246h-29.203c120.695 19.223 211.02 96.816 211.02 189.715 0 97.21-98.9 177.754-227.993 192.082 3.254-.125 6.523-.195 9.816-.36 13.989-.734 27.711-2.101 41.18-3.921m-121.129-17.91a328.134 328.134 0 01-57.473-5.055L98.938 12.156C227.925 15.27 331.18 91.801 331.18 185.79c0 95.992-107.61 173.816-240.352 173.816"
|
|
9789
|
+
}))))
|
|
9770
9790
|
};
|
|
9771
9791
|
return (_icons$name$toLowerCa = icons[name.toLowerCase()]) !== null && _icons$name$toLowerCa !== void 0 ? _icons$name$toLowerCa : /*#__PURE__*/React__default.createElement("svg", {
|
|
9772
9792
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -12787,6 +12807,7 @@ const RESET_NEW_PASSWORD_ERROR = "RESET_NEW_PASSWORD_ERROR";
|
|
|
12787
12807
|
const RESET_CONFIRM_NEW_PASSWORD_ERROR = "RESET_CONFIRM_NEW_PASSWORD_ERROR";
|
|
12788
12808
|
const SHOW_ALERT = "SHOW_ALERT";
|
|
12789
12809
|
const SELECT_ADDRESS = "SELECT_ADDRESS";
|
|
12810
|
+
const SELECT_BILLING_ADDRESS = "SELECT_BILLING_ADDRESS";
|
|
12790
12811
|
const LOAD_ADDRESSES = "LOAD_ADDRESSES";
|
|
12791
12812
|
const SET_CROP = "SET_CROP";
|
|
12792
12813
|
const SET_ZOOM = "SET_ZOOM";
|
|
@@ -22444,7 +22465,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
22444
22465
|
onFailure = () => {},
|
|
22445
22466
|
...props
|
|
22446
22467
|
}) => {
|
|
22447
|
-
var _props$product, _props$plan, _props$subscriptionId, _props$selectedAddres, _props$giftRecipient, _props$isGift, _props$isRenewingGift, _props$invoice, _window$Pelcro, _window$Pelcro$uiSett;
|
|
22468
|
+
var _props$product, _props$plan, _props$subscriptionId, _props$selectedAddres, _props$selectedBillin, _props$giftRecipient, _props$isGift, _props$isRenewingGift, _props$invoice, _window$Pelcro, _window$Pelcro$uiSett, _window$Pelcro$user$r, _window, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro2$user$, _window$Pelcro2$user$2, _window$Pelcro$user$r2, _window2, _window2$Pelcro, _window2$Pelcro$user, _window2$Pelcro$user$, _window2$Pelcro$user$2, _billingAddress$line, _billingAddress$line2, _billingAddress$city, _billingAddress$state, _billingAddress$count, _billingAddress$posta;
|
|
22448
22469
|
|
|
22449
22470
|
// Get a reference to Stripe or Elements using hooks.
|
|
22450
22471
|
const stripe = useStripe();
|
|
@@ -22470,6 +22491,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
22470
22491
|
const plan = (_props$plan = props.plan) !== null && _props$plan !== void 0 ? _props$plan : pelcroStore.plan;
|
|
22471
22492
|
const subscriptionIdToRenew = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : pelcroStore.subscriptionIdToRenew;
|
|
22472
22493
|
const selectedAddressId = (_props$selectedAddres = props.selectedAddressId) !== null && _props$selectedAddres !== void 0 ? _props$selectedAddres : pelcroStore.selectedAddressId;
|
|
22494
|
+
const selectedBillingAddressId = (_props$selectedBillin = props.selectedBillingAddressId) !== null && _props$selectedBillin !== void 0 ? _props$selectedBillin : pelcroStore.selectedBillingAddressId;
|
|
22473
22495
|
const giftRecipient = (_props$giftRecipient = props.giftRecipient) !== null && _props$giftRecipient !== void 0 ? _props$giftRecipient : pelcroStore.giftRecipient;
|
|
22474
22496
|
const isGift = (_props$isGift = props.isGift) !== null && _props$isGift !== void 0 ? _props$isGift : pelcroStore.isGift;
|
|
22475
22497
|
const isRenewingGift = (_props$isRenewingGift = props.isRenewingGift) !== null && _props$isRenewingGift !== void 0 ? _props$isRenewingGift : pelcroStore.isRenewingGift;
|
|
@@ -23472,6 +23494,30 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23472
23494
|
}, [selectedPaymentMethodId]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
23473
23495
|
|
|
23474
23496
|
/* ====== Start Stripe integration ======== */
|
|
23497
|
+
// useEffect(() => {
|
|
23498
|
+
// if (!selectedBillingAddressId) {
|
|
23499
|
+
// const defaultAddress = window?.Pelcro?.user
|
|
23500
|
+
// ?.read()
|
|
23501
|
+
// ?.addresses?.find(
|
|
23502
|
+
// (address) => address.type == "billing" && address.is_default
|
|
23503
|
+
// );
|
|
23504
|
+
// if (defaultAddress) {
|
|
23505
|
+
// set({ selectedBillingAddressId: defaultAddress.id });
|
|
23506
|
+
// }
|
|
23507
|
+
// }
|
|
23508
|
+
// }, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
23509
|
+
|
|
23510
|
+
const billingAddress = selectedBillingAddressId ? (_window$Pelcro$user$r = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro2 = _window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$user = _window$Pelcro2.user) === null || _window$Pelcro2$user === void 0 ? void 0 : (_window$Pelcro2$user$ = _window$Pelcro2$user.read()) === null || _window$Pelcro2$user$ === void 0 ? void 0 : (_window$Pelcro2$user$2 = _window$Pelcro2$user$.addresses) === null || _window$Pelcro2$user$2 === void 0 ? void 0 : _window$Pelcro2$user$2.find(address => address.id == selectedBillingAddressId)) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : {} : (_window$Pelcro$user$r2 = (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$Pelcro = _window2.Pelcro) === null || _window2$Pelcro === void 0 ? void 0 : (_window2$Pelcro$user = _window2$Pelcro.user) === null || _window2$Pelcro$user === void 0 ? void 0 : (_window2$Pelcro$user$ = _window2$Pelcro$user.read()) === null || _window2$Pelcro$user$ === void 0 ? void 0 : (_window2$Pelcro$user$2 = _window2$Pelcro$user$.addresses) === null || _window2$Pelcro$user$2 === void 0 ? void 0 : _window2$Pelcro$user$2.find(address => address.type == "billing" && address.is_default)) !== null && _window$Pelcro$user$r2 !== void 0 ? _window$Pelcro$user$r2 : {};
|
|
23511
|
+
const billingDetails = {
|
|
23512
|
+
address: {
|
|
23513
|
+
line1: (_billingAddress$line = billingAddress === null || billingAddress === void 0 ? void 0 : billingAddress.line1) !== null && _billingAddress$line !== void 0 ? _billingAddress$line : null,
|
|
23514
|
+
line2: (_billingAddress$line2 = billingAddress === null || billingAddress === void 0 ? void 0 : billingAddress.line2) !== null && _billingAddress$line2 !== void 0 ? _billingAddress$line2 : null,
|
|
23515
|
+
city: (_billingAddress$city = billingAddress === null || billingAddress === void 0 ? void 0 : billingAddress.city) !== null && _billingAddress$city !== void 0 ? _billingAddress$city : null,
|
|
23516
|
+
state: (_billingAddress$state = billingAddress === null || billingAddress === void 0 ? void 0 : billingAddress.state) !== null && _billingAddress$state !== void 0 ? _billingAddress$state : null,
|
|
23517
|
+
country: (_billingAddress$count = billingAddress === null || billingAddress === void 0 ? void 0 : billingAddress.country) !== null && _billingAddress$count !== void 0 ? _billingAddress$count : null,
|
|
23518
|
+
postal_code: (_billingAddress$posta = billingAddress === null || billingAddress === void 0 ? void 0 : billingAddress.postal_code) !== null && _billingAddress$posta !== void 0 ? _billingAddress$posta : null
|
|
23519
|
+
}
|
|
23520
|
+
};
|
|
23475
23521
|
|
|
23476
23522
|
const initPaymentRequest = (state, dispatch) => {
|
|
23477
23523
|
if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
|
|
@@ -23875,7 +23921,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23875
23921
|
addressId: selectedAddressId,
|
|
23876
23922
|
couponCode
|
|
23877
23923
|
}, (err, orderResponse) => {
|
|
23878
|
-
var _window$
|
|
23924
|
+
var _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro3$user$;
|
|
23879
23925
|
|
|
23880
23926
|
if (err) {
|
|
23881
23927
|
toggleAuthenticationSuccessPendingView(false);
|
|
@@ -23909,7 +23955,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23909
23955
|
}
|
|
23910
23956
|
|
|
23911
23957
|
window.Pelcro.user.refresh({
|
|
23912
|
-
auth_token: (_window$
|
|
23958
|
+
auth_token: (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$user = _window$Pelcro3.user) === null || _window$Pelcro3$user === void 0 ? void 0 : (_window$Pelcro3$user$ = _window$Pelcro3$user.read()) === null || _window$Pelcro3$user$ === void 0 ? void 0 : _window$Pelcro3$user$.auth_token
|
|
23913
23959
|
}, (err, res) => {
|
|
23914
23960
|
dispatch({
|
|
23915
23961
|
type: DISABLE_SUBMIT,
|
|
@@ -23961,14 +24007,16 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23961
24007
|
}
|
|
23962
24008
|
|
|
23963
24009
|
return stripe.createPaymentMethod({
|
|
23964
|
-
elements
|
|
24010
|
+
elements,
|
|
24011
|
+
params: {
|
|
24012
|
+
billing_details: billingDetails
|
|
24013
|
+
}
|
|
23965
24014
|
}).then(result => {
|
|
23966
24015
|
if (result.error) {
|
|
23967
24016
|
return handlePaymentError(result.error);
|
|
23968
24017
|
}
|
|
23969
24018
|
|
|
23970
24019
|
if (result.paymentMethod) {
|
|
23971
|
-
console.log(result.paymentMethod);
|
|
23972
24020
|
window.Pelcro.paymentMethods.create({
|
|
23973
24021
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
23974
24022
|
token: result.paymentMethod.id
|
|
@@ -23994,10 +24042,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
23994
24042
|
});
|
|
23995
24043
|
}
|
|
23996
24044
|
|
|
23997
|
-
if (result.paymentMethod.type == "bacs_debit") {
|
|
23998
|
-
createBillingAddress(result.paymentMethod.billing_details);
|
|
23999
|
-
}
|
|
24000
|
-
|
|
24001
24045
|
if (((_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$setup_inten = _res$data.setup_intent) === null || _res$data$setup_inten === void 0 ? void 0 : _res$data$setup_inten.status) === "requires_action" || ((_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_confirmation") {
|
|
24002
24046
|
confirmStripeIntentSetup(res, "create");
|
|
24003
24047
|
} else {
|
|
@@ -24088,7 +24132,10 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24088
24132
|
}
|
|
24089
24133
|
|
|
24090
24134
|
return stripe.createPaymentMethod({
|
|
24091
|
-
elements
|
|
24135
|
+
elements,
|
|
24136
|
+
params: {
|
|
24137
|
+
billing_details: billingDetails
|
|
24138
|
+
}
|
|
24092
24139
|
}).then(result => {
|
|
24093
24140
|
if (result.error) {
|
|
24094
24141
|
return handlePaymentError(result.error);
|
|
@@ -24112,10 +24159,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24112
24159
|
});
|
|
24113
24160
|
}
|
|
24114
24161
|
|
|
24115
|
-
if (result.paymentMethod.type == "bacs_debit") {
|
|
24116
|
-
createBillingAddress(result.paymentMethod.billing_details);
|
|
24117
|
-
}
|
|
24118
|
-
|
|
24119
24162
|
if (((_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_action" || ((_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_confirmation") {
|
|
24120
24163
|
confirmStripeIntentSetup(res, "replace", paymentMethodId);
|
|
24121
24164
|
} else {
|
|
@@ -24201,17 +24244,16 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24201
24244
|
}
|
|
24202
24245
|
|
|
24203
24246
|
stripe.createPaymentMethod({
|
|
24204
|
-
elements
|
|
24247
|
+
elements,
|
|
24248
|
+
params: {
|
|
24249
|
+
billing_details: billingDetails
|
|
24250
|
+
}
|
|
24205
24251
|
}).then(result => {
|
|
24206
24252
|
if (result.error) {
|
|
24207
24253
|
return handlePaymentError(result.error);
|
|
24208
24254
|
}
|
|
24209
24255
|
|
|
24210
24256
|
if (result.paymentMethod) {
|
|
24211
|
-
if (result.paymentMethod.type == "bacs_debit") {
|
|
24212
|
-
createBillingAddress(result.paymentMethod.billing_details);
|
|
24213
|
-
}
|
|
24214
|
-
|
|
24215
24257
|
return handlePayment(result.paymentMethod);
|
|
24216
24258
|
}
|
|
24217
24259
|
}).catch(error => {
|
|
@@ -24263,37 +24305,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24263
24305
|
type: LOADING,
|
|
24264
24306
|
payload: false
|
|
24265
24307
|
});
|
|
24266
|
-
};
|
|
24267
|
-
|
|
24268
|
-
const createBillingAddress = billingDetails => {
|
|
24269
|
-
const hasBillingAddress = userHasBillingAddress();
|
|
24270
|
-
if (hasBillingAddress) return;
|
|
24271
|
-
const {
|
|
24272
|
-
name,
|
|
24273
|
-
address
|
|
24274
|
-
} = billingDetails;
|
|
24275
|
-
const [firstName, lastName] = name ? name === null || name === void 0 ? void 0 : name.split(" ") : [];
|
|
24276
|
-
window.Pelcro.address.create({
|
|
24277
|
-
auth_token: window.Pelcro.user.read().auth_token,
|
|
24278
|
-
type: "billing",
|
|
24279
|
-
first_name: firstName,
|
|
24280
|
-
last_name: lastName,
|
|
24281
|
-
line1: address === null || address === void 0 ? void 0 : address.line1,
|
|
24282
|
-
line2: address === null || address === void 0 ? void 0 : address.line2,
|
|
24283
|
-
city: address === null || address === void 0 ? void 0 : address.city,
|
|
24284
|
-
state: address === null || address === void 0 ? void 0 : address.state,
|
|
24285
|
-
country: address === null || address === void 0 ? void 0 : address.country,
|
|
24286
|
-
postal_code: address === null || address === void 0 ? void 0 : address.postal_code,
|
|
24287
|
-
is_default: true
|
|
24288
|
-
}, (err, res) => {
|
|
24289
|
-
if (err) {
|
|
24290
|
-
console.error(err);
|
|
24291
|
-
}
|
|
24292
|
-
|
|
24293
|
-
if (res) {
|
|
24294
|
-
console.log(res);
|
|
24295
|
-
}
|
|
24296
|
-
});
|
|
24297
24308
|
}; // TODO: Refactor deprecated stripe implementation
|
|
24298
24309
|
|
|
24299
24310
|
/* Start Stripe deprecated functions */
|
|
@@ -25223,26 +25234,17 @@ const PelcroPaymentRequestButton = props => {
|
|
|
25223
25234
|
const CheckoutForm = ({
|
|
25224
25235
|
type
|
|
25225
25236
|
}) => {
|
|
25226
|
-
var _window
|
|
25237
|
+
var _window, _window$Pelcro, _window$Pelcro$user, _window$Pelcro$user$r, _window2, _window2$Pelcro, _window2$Pelcro$user, _window2$Pelcro$user$, _window3, _window3$Pelcro, _window3$Pelcro$user, _window3$Pelcro$user$;
|
|
25227
25238
|
|
|
25228
25239
|
const {
|
|
25229
25240
|
selectedPaymentMethodId,
|
|
25230
25241
|
paymentMethodToEdit
|
|
25231
25242
|
} = usePelcro();
|
|
25232
25243
|
const cardProcessor = getSiteCardProcessor();
|
|
25233
|
-
const defaultAddress = (_window$Pelcro$user$r = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$user = _window$Pelcro.user) === null || _window$Pelcro$user === void 0 ? void 0 : (_window$Pelcro$user$r2 = _window$Pelcro$user.read()) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : (_window$Pelcro$user$r3 = _window$Pelcro$user$r2.addresses) === null || _window$Pelcro$user$r3 === void 0 ? void 0 : _window$Pelcro$user$r3.find(address => address.type == "billing" && address.is_default)) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : [];
|
|
25234
25244
|
const billingDetails = {
|
|
25235
|
-
name: (
|
|
25236
|
-
email: (
|
|
25237
|
-
phone: (
|
|
25238
|
-
address: {
|
|
25239
|
-
line1: (_defaultAddress$line = defaultAddress === null || defaultAddress === void 0 ? void 0 : defaultAddress.line1) !== null && _defaultAddress$line !== void 0 ? _defaultAddress$line : null,
|
|
25240
|
-
line2: (_defaultAddress$line2 = defaultAddress === null || defaultAddress === void 0 ? void 0 : defaultAddress.line2) !== null && _defaultAddress$line2 !== void 0 ? _defaultAddress$line2 : null,
|
|
25241
|
-
city: (_defaultAddress$city = defaultAddress === null || defaultAddress === void 0 ? void 0 : defaultAddress.city) !== null && _defaultAddress$city !== void 0 ? _defaultAddress$city : null,
|
|
25242
|
-
state: (_defaultAddress$state = defaultAddress === null || defaultAddress === void 0 ? void 0 : defaultAddress.state) !== null && _defaultAddress$state !== void 0 ? _defaultAddress$state : null,
|
|
25243
|
-
country: (_defaultAddress$count = defaultAddress === null || defaultAddress === void 0 ? void 0 : defaultAddress.country) !== null && _defaultAddress$count !== void 0 ? _defaultAddress$count : null,
|
|
25244
|
-
postal_code: (_defaultAddress$posta = defaultAddress === null || defaultAddress === void 0 ? void 0 : defaultAddress.postal_code) !== null && _defaultAddress$posta !== void 0 ? _defaultAddress$posta : null
|
|
25245
|
-
}
|
|
25245
|
+
name: (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$user = _window$Pelcro.user) === null || _window$Pelcro$user === void 0 ? void 0 : (_window$Pelcro$user$r = _window$Pelcro$user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.name,
|
|
25246
|
+
email: (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$Pelcro = _window2.Pelcro) === null || _window2$Pelcro === void 0 ? void 0 : (_window2$Pelcro$user = _window2$Pelcro.user) === null || _window2$Pelcro$user === void 0 ? void 0 : (_window2$Pelcro$user$ = _window2$Pelcro$user.read()) === null || _window2$Pelcro$user$ === void 0 ? void 0 : _window2$Pelcro$user$.email,
|
|
25247
|
+
phone: (_window3 = window) === null || _window3 === void 0 ? void 0 : (_window3$Pelcro = _window3.Pelcro) === null || _window3$Pelcro === void 0 ? void 0 : (_window3$Pelcro$user = _window3$Pelcro.user) === null || _window3$Pelcro$user === void 0 ? void 0 : (_window3$Pelcro$user$ = _window3$Pelcro$user.read()) === null || _window3$Pelcro$user$ === void 0 ? void 0 : _window3$Pelcro$user$.phone
|
|
25246
25248
|
};
|
|
25247
25249
|
const paymentElementOptions = {
|
|
25248
25250
|
layout: {
|
|
@@ -25253,6 +25255,14 @@ const CheckoutForm = ({
|
|
|
25253
25255
|
defaultValues: {
|
|
25254
25256
|
billingDetails: billingDetails
|
|
25255
25257
|
},
|
|
25258
|
+
fields: {
|
|
25259
|
+
billingDetails: {
|
|
25260
|
+
name: "auto",
|
|
25261
|
+
email: "auto",
|
|
25262
|
+
phone: "auto",
|
|
25263
|
+
address: "never"
|
|
25264
|
+
}
|
|
25265
|
+
},
|
|
25256
25266
|
terms: {
|
|
25257
25267
|
applePay: "never",
|
|
25258
25268
|
card: "never",
|
|
@@ -25937,7 +25947,7 @@ const SelectedPaymentMethod = () => {
|
|
|
25937
25947
|
});
|
|
25938
25948
|
return selectedPaymentMethodId && /*#__PURE__*/React__default.createElement("div", {
|
|
25939
25949
|
key: paymentMethod.id,
|
|
25940
|
-
className: "plc-
|
|
25950
|
+
className: "plc-p-4 plc-my-4 plc-text-gray-900 plc-rounded plc-shadow-md_dark pelcro-payment-method-wrapper"
|
|
25941
25951
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
25942
25952
|
className: "plc-flex plc-items-center plc-px-1",
|
|
25943
25953
|
id: `pelcro-payment-method-select-${paymentMethod.id}`
|
|
@@ -26495,8 +26505,76 @@ function PaymentMethodUpdateSetDefault(props) {
|
|
|
26495
26505
|
}, props.label);
|
|
26496
26506
|
}
|
|
26497
26507
|
|
|
26508
|
+
const SelectedAddress = ({
|
|
26509
|
+
type
|
|
26510
|
+
}) => {
|
|
26511
|
+
var _window$Pelcro$user$r, _window, _window$Pelcro, _window$Pelcro$user, _addresses$find, _addresses$find2;
|
|
26512
|
+
|
|
26513
|
+
const {
|
|
26514
|
+
t
|
|
26515
|
+
} = useTranslation("payment");
|
|
26516
|
+
const {
|
|
26517
|
+
state: {
|
|
26518
|
+
isLoading
|
|
26519
|
+
}
|
|
26520
|
+
} = useContext(store$m);
|
|
26521
|
+
const {
|
|
26522
|
+
switchView,
|
|
26523
|
+
set,
|
|
26524
|
+
selectedBillingAddressId
|
|
26525
|
+
} = usePelcro();
|
|
26526
|
+
const {
|
|
26527
|
+
addresses
|
|
26528
|
+
} = (_window$Pelcro$user$r = (_window = window) === null || _window === void 0 ? void 0 : (_window$Pelcro = _window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$user = _window$Pelcro.user) === null || _window$Pelcro$user === void 0 ? void 0 : _window$Pelcro$user.read()) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : [];
|
|
26529
|
+
const address = selectedBillingAddressId ? (_addresses$find = addresses === null || addresses === void 0 ? void 0 : addresses.find(address => address.id == selectedBillingAddressId)) !== null && _addresses$find !== void 0 ? _addresses$find : null : (_addresses$find2 = addresses === null || addresses === void 0 ? void 0 : addresses.find(address => address.type == "billing" && address.is_default)) !== null && _addresses$find2 !== void 0 ? _addresses$find2 : null;
|
|
26530
|
+
|
|
26531
|
+
const onAddNewAddress = () => {
|
|
26532
|
+
set({
|
|
26533
|
+
flow: type
|
|
26534
|
+
});
|
|
26535
|
+
|
|
26536
|
+
if (address) {
|
|
26537
|
+
switchView("billing-address-select");
|
|
26538
|
+
} else {
|
|
26539
|
+
switchView("billing-address-create");
|
|
26540
|
+
}
|
|
26541
|
+
};
|
|
26542
|
+
|
|
26543
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
26544
|
+
className: "plc-p-4 plc-my-4 last:plc-mb-0 plc-rounded plc-text-gray-900 pelcro-address-wrapper plc-bg-white plc-shadow-md_dark plc-relative"
|
|
26545
|
+
}, address && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
26546
|
+
className: "pelcro-select-address-radio plc-order-2",
|
|
26547
|
+
id: `pelcro-address-select-${address.id}`,
|
|
26548
|
+
name: "address"
|
|
26549
|
+
}, /*#__PURE__*/React__default.createElement("p", {
|
|
26550
|
+
className: "pelcro-address-name plc-font-semibold"
|
|
26551
|
+
}, t("labels.checkout.billingAddress")), /*#__PURE__*/React__default.createElement("p", {
|
|
26552
|
+
className: "pelcro-address-company"
|
|
26553
|
+
}, address.company), /*#__PURE__*/React__default.createElement("p", {
|
|
26554
|
+
className: "pelcro-address-line1 plc-text-sm plc-mt-2"
|
|
26555
|
+
}, address.line1), /*#__PURE__*/React__default.createElement("p", {
|
|
26556
|
+
className: "pelcro-address-country plc-text-sm"
|
|
26557
|
+
}, address.city, ", ", address.state_name, " ", address.postal_code, ", ", address.country_name)), /*#__PURE__*/React__default.createElement(Button, {
|
|
26558
|
+
onClick: onAddNewAddress,
|
|
26559
|
+
disabled: isLoading,
|
|
26560
|
+
variant: "ghost",
|
|
26561
|
+
className: "plc-text-primary-500 plc-absolute plc-top-4 plc-right-5"
|
|
26562
|
+
}, t("labels.checkout.changeBillingAddress"))), !address && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
26563
|
+
className: "pelcro-select-address-radio plc-order-2",
|
|
26564
|
+
id: `pelcro-address-select-${address === null || address === void 0 ? void 0 : address.id}`,
|
|
26565
|
+
name: "address"
|
|
26566
|
+
}, /*#__PURE__*/React__default.createElement("p", {
|
|
26567
|
+
className: "pelcro-address-name plc-font-semibold"
|
|
26568
|
+
}, t("labels.checkout.NoBillingAddress"))), /*#__PURE__*/React__default.createElement(Button, {
|
|
26569
|
+
onClick: onAddNewAddress,
|
|
26570
|
+
disabled: isLoading,
|
|
26571
|
+
variant: "ghost",
|
|
26572
|
+
className: "plc-text-primary-500 plc-absolute plc-top-4 plc-right-5"
|
|
26573
|
+
}, t("labels.checkout.addNewAddress"))));
|
|
26574
|
+
};
|
|
26575
|
+
|
|
26498
26576
|
/**
|
|
26499
|
-
|
|
26577
|
+
*@return {paymentMethodView}
|
|
26500
26578
|
*/
|
|
26501
26579
|
|
|
26502
26580
|
function PaymentMethodView({
|
|
@@ -26555,7 +26633,9 @@ function PaymentMethodView({
|
|
|
26555
26633
|
freeOrders: showOrderButton
|
|
26556
26634
|
}, /*#__PURE__*/React__default.createElement(AlertWithContext, {
|
|
26557
26635
|
className: "plc-mb-2"
|
|
26558
|
-
}), showSubscriptionButton && /*#__PURE__*/React__default.createElement(SubscriptionCreateFreePlanButton, null), showOrderButton && /*#__PURE__*/React__default.createElement(OrderCreateFreeButton, null), !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(BankRedirection, null), /*#__PURE__*/React__default.createElement(BankAuthenticationSuccess, null), /*#__PURE__*/React__default.createElement(
|
|
26636
|
+
}), showSubscriptionButton && /*#__PURE__*/React__default.createElement(SubscriptionCreateFreePlanButton, null), showOrderButton && /*#__PURE__*/React__default.createElement(OrderCreateFreeButton, null), !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(BankRedirection, null), /*#__PURE__*/React__default.createElement(BankAuthenticationSuccess, null), /*#__PURE__*/React__default.createElement(SelectedAddress, {
|
|
26637
|
+
type: type
|
|
26638
|
+
}), /*#__PURE__*/React__default.createElement(SelectedPaymentMethod, null), supportsTap && (!isUserFirstName || !isUserLastName || !isUserPhone) && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
26559
26639
|
className: "plc-flex plc-items-start"
|
|
26560
26640
|
}, /*#__PURE__*/React__default.createElement(IncludeFirstName, {
|
|
26561
26641
|
id: "pelcro-input-first-name",
|
|
@@ -29402,7 +29482,7 @@ const AddressCreateContainer = ({
|
|
|
29402
29482
|
};
|
|
29403
29483
|
|
|
29404
29484
|
getCountries();
|
|
29405
|
-
}, []);
|
|
29485
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
29406
29486
|
|
|
29407
29487
|
const submitAddress = ({
|
|
29408
29488
|
firstName,
|
|
@@ -29477,8 +29557,10 @@ const AddressCreateContainer = ({
|
|
|
29477
29557
|
}
|
|
29478
29558
|
|
|
29479
29559
|
if (product || order) {
|
|
29480
|
-
set({
|
|
29560
|
+
type == "shipping" ? set({
|
|
29481
29561
|
selectedAddressId: newAddressId
|
|
29562
|
+
}) : set({
|
|
29563
|
+
selectedBillingAddressId: newAddressId
|
|
29482
29564
|
});
|
|
29483
29565
|
}
|
|
29484
29566
|
|
|
@@ -29613,7 +29695,8 @@ const AddressCreateContainer = ({
|
|
|
29613
29695
|
if (state.country) {
|
|
29614
29696
|
getStates();
|
|
29615
29697
|
}
|
|
29616
|
-
}, [state.country]);
|
|
29698
|
+
}, [state.country]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
29699
|
+
|
|
29617
29700
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
29618
29701
|
style: { ...style
|
|
29619
29702
|
},
|
|
@@ -30135,6 +30218,70 @@ const AddressCreateModal = ({
|
|
|
30135
30218
|
};
|
|
30136
30219
|
AddressCreateModal.viewId = "address-create";
|
|
30137
30220
|
|
|
30221
|
+
const BillingAddressCreateModal = ({
|
|
30222
|
+
onDisplay,
|
|
30223
|
+
onClose,
|
|
30224
|
+
...otherProps
|
|
30225
|
+
}) => {
|
|
30226
|
+
const {
|
|
30227
|
+
switchView,
|
|
30228
|
+
// switchToPaymentView,
|
|
30229
|
+
// resetView,
|
|
30230
|
+
switchToCheckoutForm,
|
|
30231
|
+
flow
|
|
30232
|
+
} = usePelcro();
|
|
30233
|
+
const {
|
|
30234
|
+
t
|
|
30235
|
+
} = useTranslation("address");
|
|
30236
|
+
|
|
30237
|
+
const onSuccess = newAddressId => {
|
|
30238
|
+
var _otherProps$onSuccess;
|
|
30239
|
+
|
|
30240
|
+
(_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, newAddressId);
|
|
30241
|
+
|
|
30242
|
+
switch (flow) {
|
|
30243
|
+
case "createPaymentSource":
|
|
30244
|
+
switchView("payment-method-create");
|
|
30245
|
+
break;
|
|
30246
|
+
|
|
30247
|
+
case "deletePaymentSource":
|
|
30248
|
+
switchView("payment-method-delete");
|
|
30249
|
+
break;
|
|
30250
|
+
|
|
30251
|
+
default:
|
|
30252
|
+
switchToCheckoutForm();
|
|
30253
|
+
break;
|
|
30254
|
+
}
|
|
30255
|
+
}; // const onGiftRedemptionSuccess = () => {
|
|
30256
|
+
// otherProps.onGiftRedemptionSuccess?.();
|
|
30257
|
+
// switchView("subscription-success");
|
|
30258
|
+
// };
|
|
30259
|
+
// FIXME: implement me
|
|
30260
|
+
// const onMembershipAdressUpdateSuccess = () => {
|
|
30261
|
+
// otherProps.onMembershipAdressUpdateSuccess?.();
|
|
30262
|
+
// resetView();
|
|
30263
|
+
// };
|
|
30264
|
+
|
|
30265
|
+
|
|
30266
|
+
return /*#__PURE__*/React__default.createElement(Modal, {
|
|
30267
|
+
id: "pelcro-address-create-modal",
|
|
30268
|
+
onDisplay: onDisplay,
|
|
30269
|
+
onClose: onClose
|
|
30270
|
+
}, /*#__PURE__*/React__default.createElement(ModalHeader, null, /*#__PURE__*/React__default.createElement("div", {
|
|
30271
|
+
className: "plc-text-left plc-text-gray-900 pelcro-title-wrapper plc-flex-1 plc-flex plc-flex-col plc-justify-center"
|
|
30272
|
+
}, /*#__PURE__*/React__default.createElement("h4", {
|
|
30273
|
+
className: "plc-text-xl plc-font-bold"
|
|
30274
|
+
}, t("titleBilling")))), /*#__PURE__*/React__default.createElement(ModalBody, null, /*#__PURE__*/React__default.createElement(AddressCreateView, Object.assign({}, otherProps, {
|
|
30275
|
+
type: "billing",
|
|
30276
|
+
onSuccess: onSuccess // onGiftRedemptionSuccess={onGiftRedemptionSuccess}
|
|
30277
|
+
// onMembershipAdressUpdateSuccess={
|
|
30278
|
+
// onMembershipAdressUpdateSuccess
|
|
30279
|
+
// }
|
|
30280
|
+
|
|
30281
|
+
}))), /*#__PURE__*/React__default.createElement(ModalFooter, null));
|
|
30282
|
+
};
|
|
30283
|
+
BillingAddressCreateModal.viewId = "billing-address-create";
|
|
30284
|
+
|
|
30138
30285
|
const AddressCreateTextInput = props => {
|
|
30139
30286
|
return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({}, props, {
|
|
30140
30287
|
store: store$g
|
|
@@ -30797,6 +30944,28 @@ const AddressUpdateModal = ({
|
|
|
30797
30944
|
};
|
|
30798
30945
|
AddressUpdateModal.viewId = "address-edit";
|
|
30799
30946
|
|
|
30947
|
+
const BillingAddressUpdateModal = ({
|
|
30948
|
+
onDisplay,
|
|
30949
|
+
onClose,
|
|
30950
|
+
...otherProps
|
|
30951
|
+
}) => {
|
|
30952
|
+
const {
|
|
30953
|
+
t
|
|
30954
|
+
} = useTranslation("address");
|
|
30955
|
+
return /*#__PURE__*/React__default.createElement(Modal, {
|
|
30956
|
+
id: "pelcro-address-update-modal",
|
|
30957
|
+
onDisplay: onDisplay,
|
|
30958
|
+
onClose: onClose
|
|
30959
|
+
}, /*#__PURE__*/React__default.createElement(ModalHeader, null, /*#__PURE__*/React__default.createElement("div", {
|
|
30960
|
+
className: "plc-text-left plc-text-gray-900 pelcro-title-wrapper plc-flex-1 plc-flex plc-flex-col plc-justify-center"
|
|
30961
|
+
}, /*#__PURE__*/React__default.createElement("h4", {
|
|
30962
|
+
className: "plc-text-xl plc-font-bold"
|
|
30963
|
+
}, t("titleBilling")))), /*#__PURE__*/React__default.createElement(ModalBody, null, /*#__PURE__*/React__default.createElement(AddressUpdateView, Object.assign({
|
|
30964
|
+
type: "billing"
|
|
30965
|
+
}, otherProps))), /*#__PURE__*/React__default.createElement(ModalFooter, null));
|
|
30966
|
+
};
|
|
30967
|
+
BillingAddressUpdateModal.viewId = "billing-address-edit";
|
|
30968
|
+
|
|
30800
30969
|
const AddressUpdateTextInput = props => {
|
|
30801
30970
|
return /*#__PURE__*/React__default.createElement(TextInput, Object.assign({}, props, {
|
|
30802
30971
|
store: store$f
|
|
@@ -33051,19 +33220,25 @@ const GiftRedeemModal = ({
|
|
|
33051
33220
|
};
|
|
33052
33221
|
GiftRedeemModal.viewId = "gift-redeem";
|
|
33053
33222
|
|
|
33054
|
-
const
|
|
33055
|
-
return addresses.find(address => address.is_default) || false;
|
|
33223
|
+
const getDefaultShippingAddress = addresses => {
|
|
33224
|
+
return addresses.find(address => address.type == "shipping" && address.is_default) || false;
|
|
33056
33225
|
};
|
|
33057
33226
|
|
|
33058
|
-
const
|
|
33059
|
-
|
|
33060
|
-
|
|
33061
|
-
|
|
33062
|
-
|
|
33227
|
+
const getDefaultBillingAddress = addresses => {
|
|
33228
|
+
return addresses.find(address => address.type == "billing" && address.is_default) || false;
|
|
33229
|
+
}; // const moveDefaultAddressToStart = (addresses) => {
|
|
33230
|
+
// const defaultAddress = getDefaultAddress(addresses);
|
|
33231
|
+
// const addressesWithoutDefault = addresses.filter(
|
|
33232
|
+
// (address) => !address.is_default
|
|
33233
|
+
// );
|
|
33234
|
+
// return [defaultAddress, ...addressesWithoutDefault];
|
|
33235
|
+
// };
|
|
33236
|
+
|
|
33063
33237
|
|
|
33064
33238
|
const initialState$7 = {
|
|
33065
33239
|
addresses: [],
|
|
33066
33240
|
selectedAddressId: null,
|
|
33241
|
+
selectedBillingAddressId: null,
|
|
33067
33242
|
isSubmitting: false,
|
|
33068
33243
|
alert: {
|
|
33069
33244
|
type: "error",
|
|
@@ -33078,6 +33253,7 @@ const {
|
|
|
33078
33253
|
const AddressSelectContainer = ({
|
|
33079
33254
|
style,
|
|
33080
33255
|
className = "",
|
|
33256
|
+
type = "shipping",
|
|
33081
33257
|
onGiftRedemptionSuccess = () => {},
|
|
33082
33258
|
onMembershipAdressUpdateSuccess = () => {},
|
|
33083
33259
|
onSuccess = () => {},
|
|
@@ -33173,6 +33349,15 @@ const AddressSelectContainer = ({
|
|
|
33173
33349
|
onSuccess(selectedAddressId);
|
|
33174
33350
|
};
|
|
33175
33351
|
|
|
33352
|
+
const submitBillingAddress = ({
|
|
33353
|
+
selectedBillingAddressId
|
|
33354
|
+
}, dispatch) => {
|
|
33355
|
+
set({
|
|
33356
|
+
selectedBillingAddressId
|
|
33357
|
+
});
|
|
33358
|
+
onSuccess(selectedBillingAddressId);
|
|
33359
|
+
};
|
|
33360
|
+
|
|
33176
33361
|
const [state, dispatch] = useReducerWithSideEffects((state, action) => {
|
|
33177
33362
|
switch (action.type) {
|
|
33178
33363
|
case SELECT_ADDRESS:
|
|
@@ -33180,16 +33365,30 @@ const AddressSelectContainer = ({
|
|
|
33180
33365
|
selectedAddressId: action.payload
|
|
33181
33366
|
});
|
|
33182
33367
|
|
|
33368
|
+
case SELECT_BILLING_ADDRESS:
|
|
33369
|
+
return lib_7({ ...state,
|
|
33370
|
+
selectedBillingAddressId: action.payload
|
|
33371
|
+
});
|
|
33372
|
+
|
|
33183
33373
|
case LOAD_ADDRESSES:
|
|
33184
|
-
if (!
|
|
33374
|
+
if (!getDefaultShippingAddress) {
|
|
33185
33375
|
return switchView("address-select");
|
|
33376
|
+
} else if (!getDefaultBillingAddress) {
|
|
33377
|
+
return switchView("billing-address-select");
|
|
33186
33378
|
} else {
|
|
33187
|
-
|
|
33379
|
+
if (type == "shipping") {
|
|
33380
|
+
var _selectedMembership$a;
|
|
33188
33381
|
|
|
33189
|
-
|
|
33190
|
-
|
|
33191
|
-
|
|
33192
|
-
|
|
33382
|
+
return lib_7({ ...state,
|
|
33383
|
+
addresses: action.payload,
|
|
33384
|
+
selectedAddressId: String((_selectedMembership$a = selectedMembership === null || selectedMembership === void 0 ? void 0 : selectedMembership.address_id) !== null && _selectedMembership$a !== void 0 ? _selectedMembership$a : getDefaultShippingAddress(action.payload).id)
|
|
33385
|
+
});
|
|
33386
|
+
} else {
|
|
33387
|
+
return lib_7({ ...state,
|
|
33388
|
+
addresses: action.payload,
|
|
33389
|
+
selectedBillingAddressId: String(getDefaultBillingAddress(action.payload).id)
|
|
33390
|
+
});
|
|
33391
|
+
}
|
|
33193
33392
|
}
|
|
33194
33393
|
|
|
33195
33394
|
case SHOW_ALERT:
|
|
@@ -33205,7 +33404,7 @@ const AddressSelectContainer = ({
|
|
|
33205
33404
|
case HANDLE_SUBMIT:
|
|
33206
33405
|
return lib_5({ ...state,
|
|
33207
33406
|
isSubmitting: true
|
|
33208
|
-
}, (state, dispatch) => submitAddress(state, dispatch));
|
|
33407
|
+
}, (state, dispatch) => type == "shipping" ? submitAddress(state, dispatch) : submitBillingAddress(state));
|
|
33209
33408
|
|
|
33210
33409
|
default:
|
|
33211
33410
|
return state;
|
|
@@ -33218,7 +33417,8 @@ const AddressSelectContainer = ({
|
|
|
33218
33417
|
type: LOAD_ADDRESSES,
|
|
33219
33418
|
payload: (_window$Pelcro$user$r = window.Pelcro.user.read().addresses) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : []
|
|
33220
33419
|
});
|
|
33221
|
-
}, []);
|
|
33420
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
33421
|
+
|
|
33222
33422
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
33223
33423
|
style: { ...style
|
|
33224
33424
|
},
|
|
@@ -33236,25 +33436,35 @@ const AddressSelectContainer = ({
|
|
|
33236
33436
|
})));
|
|
33237
33437
|
};
|
|
33238
33438
|
|
|
33239
|
-
const AddressSelectList = (
|
|
33439
|
+
const AddressSelectList = ({
|
|
33440
|
+
type = "shipping"
|
|
33441
|
+
}) => {
|
|
33240
33442
|
const {
|
|
33241
33443
|
dispatch,
|
|
33242
33444
|
state: {
|
|
33243
33445
|
addresses,
|
|
33244
|
-
selectedAddressId
|
|
33446
|
+
selectedAddressId,
|
|
33447
|
+
selectedBillingAddressId
|
|
33245
33448
|
}
|
|
33246
33449
|
} = useContext(store$7);
|
|
33247
33450
|
|
|
33248
33451
|
const handleAddressSelect = event => {
|
|
33249
|
-
|
|
33250
|
-
|
|
33251
|
-
|
|
33252
|
-
|
|
33452
|
+
if (type == "shipping") {
|
|
33453
|
+
dispatch({
|
|
33454
|
+
type: SELECT_ADDRESS,
|
|
33455
|
+
payload: event.target.value
|
|
33456
|
+
});
|
|
33457
|
+
} else {
|
|
33458
|
+
dispatch({
|
|
33459
|
+
type: SELECT_BILLING_ADDRESS,
|
|
33460
|
+
payload: event.target.value
|
|
33461
|
+
});
|
|
33462
|
+
}
|
|
33253
33463
|
};
|
|
33254
33464
|
|
|
33255
33465
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
33256
33466
|
className: "plc-overflow-y-auto plc-p-2 plc-max-h-80 pelcro-addresses-select-wrapper"
|
|
33257
|
-
}, addresses.map(address => address.type ===
|
|
33467
|
+
}, addresses.sort((a, b) => a.is_default === b.is_default ? 0 : a.is_default ? -1 : 1).map(address => address.type === type && /*#__PURE__*/React__default.createElement("div", {
|
|
33258
33468
|
key: address.id,
|
|
33259
33469
|
className: "plc-p-4 plc-mb-4 last:plc-mb-0 plc-rounded plc-text-gray-900 pelcro-address-wrapper plc-bg-white plc-shadow-md_dark"
|
|
33260
33470
|
}, /*#__PURE__*/React__default.createElement(Radio, {
|
|
@@ -33262,7 +33472,7 @@ const AddressSelectList = () => {
|
|
|
33262
33472
|
labelClassName: "plc-cursor-pointer plc-w-full plc-ml-0 plc-mr-2 plc-order-1",
|
|
33263
33473
|
id: `pelcro-address-select-${address.id}`,
|
|
33264
33474
|
name: "address",
|
|
33265
|
-
checked: selectedAddressId === String(address.id),
|
|
33475
|
+
checked: type == "shipping" ? selectedAddressId === String(address.id) : selectedBillingAddressId === String(address.id),
|
|
33266
33476
|
value: address.id,
|
|
33267
33477
|
onChange: handleAddressSelect
|
|
33268
33478
|
}, /*#__PURE__*/React__default.createElement("p", {
|
|
@@ -33279,13 +33489,15 @@ const AddressSelectList = () => {
|
|
|
33279
33489
|
const AddressSelectSubmit = ({
|
|
33280
33490
|
name,
|
|
33281
33491
|
onClick,
|
|
33492
|
+
type = "shipping",
|
|
33282
33493
|
...otherProps
|
|
33283
33494
|
}) => {
|
|
33284
33495
|
const {
|
|
33285
33496
|
dispatch,
|
|
33286
33497
|
state: {
|
|
33287
33498
|
selectedAddressId,
|
|
33288
|
-
isSubmitting
|
|
33499
|
+
isSubmitting,
|
|
33500
|
+
selectedBillingAddressId
|
|
33289
33501
|
}
|
|
33290
33502
|
} = useContext(store$7);
|
|
33291
33503
|
const {
|
|
@@ -33298,7 +33510,7 @@ const AddressSelectSubmit = ({
|
|
|
33298
33510
|
});
|
|
33299
33511
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
33300
33512
|
},
|
|
33301
|
-
disabled: selectedAddressId === "undefined" || selectedAddressId === null || !selectedAddressId,
|
|
33513
|
+
disabled: type == "shipping" ? selectedAddressId === "undefined" || selectedAddressId === null || !selectedAddressId : selectedBillingAddressId === "undefined" || selectedBillingAddressId === null || !selectedBillingAddressId,
|
|
33302
33514
|
isLoading: isSubmitting
|
|
33303
33515
|
}, otherProps), name !== null && name !== void 0 ? name : t("buttons.submit"));
|
|
33304
33516
|
};
|
|
@@ -33312,13 +33524,16 @@ const AddressSelectView = props => {
|
|
|
33312
33524
|
}, /*#__PURE__*/React__default.createElement("form", {
|
|
33313
33525
|
action: "javascript:void(0);",
|
|
33314
33526
|
className: "plc-mt-2 pelcro-form"
|
|
33315
|
-
}, /*#__PURE__*/React__default.createElement(AddressSelectContainer, props, /*#__PURE__*/React__default.createElement(AlertWithContext, null), /*#__PURE__*/React__default.createElement(AddressSelectList,
|
|
33527
|
+
}, /*#__PURE__*/React__default.createElement(AddressSelectContainer, props, /*#__PURE__*/React__default.createElement(AlertWithContext, null), /*#__PURE__*/React__default.createElement(AddressSelectList, {
|
|
33528
|
+
type: props.type
|
|
33529
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
33316
33530
|
className: "plc-flex plc-justify-center plc-mt-4"
|
|
33317
33531
|
}, /*#__PURE__*/React__default.createElement(Link, {
|
|
33318
33532
|
id: "pelcro-add-address",
|
|
33319
33533
|
onClick: props.onAddNewAddress,
|
|
33320
33534
|
className: "plc-w-full plc-h-12 plc-flex plc-justify-center plc-border plc-items-center plc-border-solid plc-border-gray-300 plc-rounded plc-bg-white hover:plc-border-primary-800"
|
|
33321
33535
|
}, t("buttons.addAddress"))), /*#__PURE__*/React__default.createElement(AddressSelectSubmit, {
|
|
33536
|
+
type: props.type,
|
|
33322
33537
|
role: "submit",
|
|
33323
33538
|
className: "plc-mt-4 plc-w-full",
|
|
33324
33539
|
name: t("buttons.selectAddress"),
|
|
@@ -33386,6 +33601,78 @@ const AddressSelectModal = ({
|
|
|
33386
33601
|
};
|
|
33387
33602
|
AddressSelectModal.viewId = "address-select";
|
|
33388
33603
|
|
|
33604
|
+
const BillingAddressSelectModal = ({
|
|
33605
|
+
onDisplay,
|
|
33606
|
+
onClose,
|
|
33607
|
+
...otherProps
|
|
33608
|
+
}) => {
|
|
33609
|
+
const {
|
|
33610
|
+
switchView,
|
|
33611
|
+
// switchToPaymentView,
|
|
33612
|
+
// resetView,
|
|
33613
|
+
switchToCheckoutForm,
|
|
33614
|
+
flow
|
|
33615
|
+
} = usePelcro();
|
|
33616
|
+
const {
|
|
33617
|
+
t
|
|
33618
|
+
} = useTranslation("address");
|
|
33619
|
+
|
|
33620
|
+
const onSuccess = selectedBillingAddressId => {
|
|
33621
|
+
var _otherProps$onSuccess;
|
|
33622
|
+
|
|
33623
|
+
(_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, selectedBillingAddressId);
|
|
33624
|
+
|
|
33625
|
+
switch (flow) {
|
|
33626
|
+
case "createPaymentSource":
|
|
33627
|
+
switchView("payment-method-create");
|
|
33628
|
+
break;
|
|
33629
|
+
|
|
33630
|
+
case "deletePaymentSource":
|
|
33631
|
+
switchView("payment-method-delete");
|
|
33632
|
+
break;
|
|
33633
|
+
|
|
33634
|
+
default:
|
|
33635
|
+
switchToCheckoutForm();
|
|
33636
|
+
break;
|
|
33637
|
+
}
|
|
33638
|
+
};
|
|
33639
|
+
|
|
33640
|
+
const onAddNewAddress = () => {
|
|
33641
|
+
switchView("billing-address-create");
|
|
33642
|
+
}; // const onGiftRedemptionSuccess = () => {
|
|
33643
|
+
// otherProps.onGiftRedemptionSuccess?.();
|
|
33644
|
+
// switchView("subscription-success");
|
|
33645
|
+
// };
|
|
33646
|
+
// // FIXME: implement me
|
|
33647
|
+
// const onMembershipAdressUpdateSuccess = () => {
|
|
33648
|
+
// otherProps.onMembershipAdressUpdateSuccess?.();
|
|
33649
|
+
// resetView();
|
|
33650
|
+
// };
|
|
33651
|
+
|
|
33652
|
+
|
|
33653
|
+
return /*#__PURE__*/React__default.createElement(Modal, {
|
|
33654
|
+
onDisplay: onDisplay,
|
|
33655
|
+
onClose: onClose,
|
|
33656
|
+
id: "pelcro-address-select-modal"
|
|
33657
|
+
}, /*#__PURE__*/React__default.createElement(ModalHeader, null, /*#__PURE__*/React__default.createElement("div", {
|
|
33658
|
+
className: "plc-text-left plc-text-gray-900 pelcro-title-wrapper plc-flex-1 plc-flex plc-flex-col plc-justify-center"
|
|
33659
|
+
}, /*#__PURE__*/React__default.createElement("h4", {
|
|
33660
|
+
className: "plc-text-xl plc-font-bold"
|
|
33661
|
+
}, t("selectAddressTitle")), /*#__PURE__*/React__default.createElement("p", {
|
|
33662
|
+
className: "plc-text-sm"
|
|
33663
|
+
}, t("selectAddressSubtitle")))), /*#__PURE__*/React__default.createElement(ModalBody, null, /*#__PURE__*/React__default.createElement(AddressSelectView, Object.assign({
|
|
33664
|
+
onAddNewAddress: onAddNewAddress
|
|
33665
|
+
}, otherProps, {
|
|
33666
|
+
type: "billing",
|
|
33667
|
+
onSuccess: onSuccess // onGiftRedemptionSuccess={onGiftRedemptionSuccess}
|
|
33668
|
+
// onMembershipAdressUpdateSuccess={
|
|
33669
|
+
// onMembershipAdressUpdateSuccess
|
|
33670
|
+
// }
|
|
33671
|
+
|
|
33672
|
+
}))), /*#__PURE__*/React__default.createElement(ModalFooter, null));
|
|
33673
|
+
};
|
|
33674
|
+
BillingAddressSelectModal.viewId = "billing-address-select";
|
|
33675
|
+
|
|
33389
33676
|
const moveDefaultPaymentMethodToStart = paymentMethods => {
|
|
33390
33677
|
var _window$Pelcro$user$r;
|
|
33391
33678
|
|
|
@@ -33523,7 +33810,7 @@ const PaymentMethodSelectList = () => {
|
|
|
33523
33810
|
const isSelected = selectedPaymentMethodId === String(paymentMethod.id);
|
|
33524
33811
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
33525
33812
|
key: paymentMethod.id,
|
|
33526
|
-
className: `plc-p-2 plc-pl-4 plc-shadow-md plc-text-gray-900 plc-rounded pelcro-payment-method-wrapper ${isSelected ? "plc-ring-2 plc-ring-primary-400" : "plc-ring-1 plc-ring-gray-200"}`
|
|
33813
|
+
className: `plc-p-2 plc-pl-4 plc-shadow-md plc-text-gray-900 plc-rounded plc-min-h-14 plc-flex plc-items-center pelcro-payment-method-wrapper ${isSelected ? "plc-ring-2 plc-ring-primary-400" : "plc-ring-1 plc-ring-gray-200"}`
|
|
33527
33814
|
}, /*#__PURE__*/React__default.createElement(Radio, {
|
|
33528
33815
|
className: "plc-flex plc-items-center pelcro-select-payment-method-radio",
|
|
33529
33816
|
labelClassName: "plc-flex plc-items-center plc-space-x-2 plc-cursor-pointer plc-w-full",
|
|
@@ -36705,11 +36992,19 @@ const AddressesMenu = props => {
|
|
|
36705
36992
|
};
|
|
36706
36993
|
|
|
36707
36994
|
const displayAddressEdit = e => {
|
|
36708
|
-
const
|
|
36995
|
+
const addressId = e.currentTarget.dataset.key;
|
|
36996
|
+
const addressType = e.currentTarget.dataset.type;
|
|
36709
36997
|
set({
|
|
36710
|
-
addressIdToEdit:
|
|
36998
|
+
addressIdToEdit: addressId
|
|
36711
36999
|
});
|
|
36712
|
-
|
|
37000
|
+
|
|
37001
|
+
if (addressType === "shipping") {
|
|
37002
|
+
return switchView("address-edit");
|
|
37003
|
+
}
|
|
37004
|
+
|
|
37005
|
+
if (addressType === "billing") {
|
|
37006
|
+
return switchView("billing-address-edit");
|
|
37007
|
+
}
|
|
36713
37008
|
};
|
|
36714
37009
|
|
|
36715
37010
|
return /*#__PURE__*/React__default.createElement(Card, {
|
|
@@ -36732,30 +37027,46 @@ const AddressesItems = props => {
|
|
|
36732
37027
|
|
|
36733
37028
|
const {
|
|
36734
37029
|
t
|
|
36735
|
-
} = useTranslation("dashboard");
|
|
36736
|
-
|
|
36737
|
-
const
|
|
36738
|
-
|
|
36739
|
-
|
|
36740
|
-
|
|
36741
|
-
|
|
36742
|
-
|
|
36743
|
-
|
|
36744
|
-
|
|
36745
|
-
|
|
36746
|
-
|
|
36747
|
-
|
|
36748
|
-
|
|
36749
|
-
|
|
36750
|
-
|
|
36751
|
-
|
|
36752
|
-
|
|
37030
|
+
} = useTranslation("dashboard"); // const [selectedAddressId, setSelectedAddressId] = useState(null);
|
|
37031
|
+
|
|
37032
|
+
const addresses = (_window$Pelcro$user$r = window.Pelcro.user.read().addresses) !== null && _window$Pelcro$user$r !== void 0 ? _window$Pelcro$user$r : []; // useEffect(() => {
|
|
37033
|
+
// setSelectedAddressId(
|
|
37034
|
+
// String(getDefaultShippingAddress(addresses)?.id)
|
|
37035
|
+
// );
|
|
37036
|
+
// }, []);
|
|
37037
|
+
// const getDefaultShippingAddress = (addresses) => {
|
|
37038
|
+
// return (
|
|
37039
|
+
// addresses.find(
|
|
37040
|
+
// (address) => address.type == "shipping" && address.is_default
|
|
37041
|
+
// ) || false
|
|
37042
|
+
// );
|
|
37043
|
+
// };
|
|
37044
|
+
// const getDefaultBillingAddress = (addresses) => {
|
|
37045
|
+
// return (
|
|
37046
|
+
// addresses.find(
|
|
37047
|
+
// (address) => address.type == "billing" && address.is_default
|
|
37048
|
+
// ) || false
|
|
37049
|
+
// );
|
|
37050
|
+
// };
|
|
37051
|
+
// const moveDefaultAddressToStart = (addresses) => {
|
|
37052
|
+
// const defaultShippingAddress =
|
|
37053
|
+
// getDefaultShippingAddress(addresses);
|
|
37054
|
+
// const defaultBillingAddress = getDefaultBillingAddress(addresses);
|
|
37055
|
+
// const addressesWithoutDefault = addresses.filter(
|
|
37056
|
+
// (address) => !address.is_default
|
|
37057
|
+
// );
|
|
37058
|
+
// return [
|
|
37059
|
+
// defaultShippingAddress,
|
|
37060
|
+
// defaultBillingAddress,
|
|
37061
|
+
// ...addressesWithoutDefault
|
|
37062
|
+
// ];
|
|
37063
|
+
// };
|
|
37064
|
+
// const addresses = moveDefaultAddressToStart(allAddresses);
|
|
36753
37065
|
|
|
36754
|
-
const addresses = moveDefaultAddressToStart(allAddresses);
|
|
36755
37066
|
if (addresses.length === 0) return null;
|
|
36756
|
-
return addresses.
|
|
37067
|
+
return addresses.sort((a, b) => a.is_default === b.is_default ? 0 : a.is_default ? -1 : 1).map((address, index) => /*#__PURE__*/React__default.createElement("div", {
|
|
36757
37068
|
key: address.id,
|
|
36758
|
-
className:
|
|
37069
|
+
className: "plc-py-2 plc-px-4 plc-mt-5 plc-flex plc-items-center plc-justify-between last:plc-mb-0 plc-rounded plc-text-gray-900 pelcro-address-wrapper plc-bg-white plc-shadow-md_dark"
|
|
36759
37070
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
36760
37071
|
className: "plc-flex-1 plc-relative"
|
|
36761
37072
|
}, /*#__PURE__*/React__default.createElement("p", {
|
|
@@ -36766,14 +37077,17 @@ const AddressesItems = props => {
|
|
|
36766
37077
|
className: "pelcro-address-line1 plc-text-sm plc-mt-2"
|
|
36767
37078
|
}, address.line1), /*#__PURE__*/React__default.createElement("p", {
|
|
36768
37079
|
className: "pelcro-address-country plc-text-sm"
|
|
36769
|
-
}, address.city, ", ", address.state_name, " ", address.postal_code, ", ", address.country_name)),
|
|
36770
|
-
className: "plc-rounded-full plc-bg-gray-
|
|
37080
|
+
}, address.city, ", ", address.state_name, " ", address.postal_code, ", ", address.country_name)), /*#__PURE__*/React__default.createElement("span", {
|
|
37081
|
+
className: "plc-rounded-full plc-bg-gray-200 plc-text-black plc-inline-flex plc-items-start plc-py-1 plc-px-4 plc-text-sm plc-capitalize"
|
|
37082
|
+
}, address.type === "shipping" ? t("labels.shipping") : t("labels.billing")), address.is_default && /*#__PURE__*/React__default.createElement("span", {
|
|
37083
|
+
className: "plc-rounded-full plc-bg-gray-800 plc-text-white plc-inline-flex plc-items-start plc-py-1 plc-px-4 plc-text-sm plc-mr-4 plc-ml-2"
|
|
36771
37084
|
}, t("labels.default")), /*#__PURE__*/React__default.createElement(Button, {
|
|
36772
37085
|
variant: "icon",
|
|
36773
37086
|
className: "plc-text-gray-500",
|
|
36774
37087
|
icon: /*#__PURE__*/React__default.createElement(SvgEdit, null),
|
|
36775
37088
|
id: "pelcro-button-update-address-" + index,
|
|
36776
37089
|
"data-key": address.id,
|
|
37090
|
+
"data-type": address.type,
|
|
36777
37091
|
onClick: props === null || props === void 0 ? void 0 : props.displayAddressEdit
|
|
36778
37092
|
})));
|
|
36779
37093
|
};
|
|
@@ -36889,7 +37203,7 @@ const PaymentCardsItems = props => {
|
|
|
36889
37203
|
|
|
36890
37204
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
36891
37205
|
key: "dashboard-source-" + source.id,
|
|
36892
|
-
className: "plc-relative plc-py-4 plc-px-6 plc-mt-5 plc-flex plc-items-center plc-justify-between last:plc-mb-0 plc-rounded plc-text-gray-900 plc-bg-white plc-shadow-md_dark"
|
|
37206
|
+
className: "plc-relative plc-py-4 plc-px-6 plc-mt-5 plc-min-h-16 plc-flex plc-items-center plc-justify-between last:plc-mb-0 plc-rounded plc-text-gray-900 plc-bg-white plc-shadow-md_dark"
|
|
36893
37207
|
}, source.is_default && /*#__PURE__*/React__default.createElement("span", {
|
|
36894
37208
|
className: "plc-absolute plc--top-3 plc-right-3 plc-rounded-full plc-bg-gray-800 plc-text-white plc-inline-flex plc-h-7 plc-my-auto plc-items-start plc-py-1 plc-px-4 plc-text-sm"
|
|
36895
37209
|
}, t("labels.default")), /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -41928,4 +42242,4 @@ const QrCodeModal = ({
|
|
|
41928
42242
|
};
|
|
41929
42243
|
QrCodeModal.viewId = "qrcode";
|
|
41930
42244
|
|
|
41931
|
-
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, 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, PaymentMethodDeleteOptions, 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, 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 };
|
|
42245
|
+
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, PaymentMethodDeleteOptions, 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 };
|