@pelcro/react-pelcro-js 3.26.0-beta.34 → 3.26.0-beta.36
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 +52 -273
- package/dist/index.esm.js +52 -273
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -3678,7 +3678,6 @@ var userEdit_en = {
|
|
|
3678
3678
|
};
|
|
3679
3679
|
|
|
3680
3680
|
var title$x = "Enter your shipping address";
|
|
3681
|
-
var titleBilling = "Enter your billing address";
|
|
3682
3681
|
var titleGifting$3 = "Enter your address";
|
|
3683
3682
|
var selectAddressTitle$3 = "Please select an address";
|
|
3684
3683
|
var selectAddressSubtitle$3 = "Select one of your saved addresses, or add a new one";
|
|
@@ -3691,8 +3690,7 @@ var labels$10 = {
|
|
|
3691
3690
|
firstName: "First name",
|
|
3692
3691
|
lastName: "Last name",
|
|
3693
3692
|
required: "required",
|
|
3694
|
-
isDefault: "Set as default"
|
|
3695
|
-
isBilling: "Set the billing address to be the same as shipping address"
|
|
3693
|
+
isDefault: "Set as default"
|
|
3696
3694
|
};
|
|
3697
3695
|
var buttons$m = {
|
|
3698
3696
|
submit: "Submit",
|
|
@@ -3705,7 +3703,6 @@ var messages$13 = {
|
|
|
3705
3703
|
};
|
|
3706
3704
|
var address_en = {
|
|
3707
3705
|
title: title$x,
|
|
3708
|
-
titleBilling: titleBilling,
|
|
3709
3706
|
titleGifting: titleGifting$3,
|
|
3710
3707
|
selectAddressTitle: selectAddressTitle$3,
|
|
3711
3708
|
selectAddressSubtitle: selectAddressSubtitle$3,
|
|
@@ -9472,9 +9469,7 @@ const initialState$o = {
|
|
|
9472
9469
|
isAuthenticated: () => window.Pelcro.user.isAuthenticated(),
|
|
9473
9470
|
selectedPaymentMethodId: null,
|
|
9474
9471
|
selectedAddressId: null,
|
|
9475
|
-
addressIdToEdit: null
|
|
9476
|
-
newShippingAddressId: null,
|
|
9477
|
-
addressView: null
|
|
9472
|
+
addressIdToEdit: null
|
|
9478
9473
|
};
|
|
9479
9474
|
const createPelcroStore = () => createStore(middleware_3((set, get) => {
|
|
9480
9475
|
const actions = new PelcroActions(set, get);
|
|
@@ -12935,7 +12930,6 @@ const GET_COUNTRIES_SUCCESS = "GET_COUNTRIES_SUCCESS";
|
|
|
12935
12930
|
const GET_COUNTRIES_FETCH = "GET_COUNTRIES_FETCH";
|
|
12936
12931
|
const GET_STATES_SUCCESS = "GET_STATES_SUCCESS";
|
|
12937
12932
|
const GET_STATES_FETCH = "GET_STATES_FETCH";
|
|
12938
|
-
const HANDLE_BILLING_SUBMIT = "HANDLE_BILLING_SUBMIT";
|
|
12939
12933
|
const HANDLE_SUBMIT = "HANDLE_SUBMIT";
|
|
12940
12934
|
const SET_UPDATED_PRICE = "SET_UPDATED_PRICE";
|
|
12941
12935
|
const SET_TAX_AMOUNT = "SET_TAX_AMOUNT";
|
|
@@ -24641,7 +24635,6 @@ const initialState$f = {
|
|
|
24641
24635
|
states: [],
|
|
24642
24636
|
countries: [],
|
|
24643
24637
|
isDefault: false,
|
|
24644
|
-
isBilling: false,
|
|
24645
24638
|
alert: {
|
|
24646
24639
|
type: "error",
|
|
24647
24640
|
content: ""
|
|
@@ -24674,8 +24667,7 @@ const AddressCreateContainer = _ref => {
|
|
|
24674
24667
|
product,
|
|
24675
24668
|
order,
|
|
24676
24669
|
set,
|
|
24677
|
-
selectedMembership
|
|
24678
|
-
newShippingAddressId
|
|
24670
|
+
selectedMembership
|
|
24679
24671
|
} = usePelcro();
|
|
24680
24672
|
const giftCode = (_props$giftCode = props.giftCode) !== null && _props$giftCode !== void 0 ? _props$giftCode : giftCodeFromStore;
|
|
24681
24673
|
const subscriptionIdToRenew = (_ref2 = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : subscriptionIdToRenewFromStore) !== null && _ref2 !== void 0 ? _ref2 : undefined;
|
|
@@ -24711,75 +24703,7 @@ const AddressCreateContainer = _ref => {
|
|
|
24711
24703
|
});
|
|
24712
24704
|
};
|
|
24713
24705
|
getCountries();
|
|
24714
|
-
}, []);
|
|
24715
|
-
|
|
24716
|
-
const handleAfterAddressCreationLogic = newAddressId => {
|
|
24717
|
-
if (selectedMembership) {
|
|
24718
|
-
dispatch({
|
|
24719
|
-
type: LOADING,
|
|
24720
|
-
payload: true
|
|
24721
|
-
});
|
|
24722
|
-
return window.Pelcro.membership.update({
|
|
24723
|
-
auth_token: window.Pelcro.user.read().auth_token,
|
|
24724
|
-
address_id: newAddressId,
|
|
24725
|
-
membership_id: selectedMembership.id
|
|
24726
|
-
}, (err, res) => {
|
|
24727
|
-
dispatch({
|
|
24728
|
-
type: LOADING,
|
|
24729
|
-
payload: false
|
|
24730
|
-
});
|
|
24731
|
-
if (err) {
|
|
24732
|
-
dispatch({
|
|
24733
|
-
type: SHOW_ALERT,
|
|
24734
|
-
payload: {
|
|
24735
|
-
type: "error",
|
|
24736
|
-
content: getErrorMessages(err)
|
|
24737
|
-
}
|
|
24738
|
-
});
|
|
24739
|
-
return onFailure(err);
|
|
24740
|
-
}
|
|
24741
|
-
notify.success(t("messages.addressUpdated"));
|
|
24742
|
-
return onMembershipAdressUpdateSuccess(res);
|
|
24743
|
-
});
|
|
24744
|
-
}
|
|
24745
|
-
if (product || order) {
|
|
24746
|
-
set({
|
|
24747
|
-
selectedAddressId: newAddressId
|
|
24748
|
-
});
|
|
24749
|
-
}
|
|
24750
|
-
if (!giftCode) {
|
|
24751
|
-
dispatch({
|
|
24752
|
-
type: LOADING,
|
|
24753
|
-
payload: false
|
|
24754
|
-
});
|
|
24755
|
-
return onSuccess(newAddressId);
|
|
24756
|
-
}
|
|
24757
|
-
if (giftCode) {
|
|
24758
|
-
window.Pelcro.subscription.redeemGift({
|
|
24759
|
-
auth_token: window.Pelcro.user.read().auth_token,
|
|
24760
|
-
gift_code: giftCode,
|
|
24761
|
-
address_id: newAddressId,
|
|
24762
|
-
// redeem gift as a future phase of an existing subscription
|
|
24763
|
-
subscription_id: subscriptionIdToRenew
|
|
24764
|
-
}, (err, res) => {
|
|
24765
|
-
dispatch({
|
|
24766
|
-
type: LOADING,
|
|
24767
|
-
payload: false
|
|
24768
|
-
});
|
|
24769
|
-
if (err) {
|
|
24770
|
-
dispatch({
|
|
24771
|
-
type: SHOW_ALERT,
|
|
24772
|
-
payload: {
|
|
24773
|
-
type: "error",
|
|
24774
|
-
content: getErrorMessages(err)
|
|
24775
|
-
}
|
|
24776
|
-
});
|
|
24777
|
-
return onFailure(err);
|
|
24778
|
-
}
|
|
24779
|
-
return onGiftRedemptionSuccess(res);
|
|
24780
|
-
});
|
|
24781
|
-
}
|
|
24782
|
-
};
|
|
24706
|
+
}, []);
|
|
24783
24707
|
const submitAddress = (_ref3, dispatch) => {
|
|
24784
24708
|
let {
|
|
24785
24709
|
firstName,
|
|
@@ -24790,8 +24714,7 @@ const AddressCreateContainer = _ref => {
|
|
|
24790
24714
|
state,
|
|
24791
24715
|
country,
|
|
24792
24716
|
postalCode,
|
|
24793
|
-
isDefault
|
|
24794
|
-
isBilling
|
|
24717
|
+
isDefault
|
|
24795
24718
|
} = _ref3;
|
|
24796
24719
|
window.Pelcro.address.create({
|
|
24797
24720
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
@@ -24821,27 +24744,20 @@ const AddressCreateContainer = _ref => {
|
|
|
24821
24744
|
});
|
|
24822
24745
|
}
|
|
24823
24746
|
const newAddressId = String(getNewlyCreatedAddress(res.data.addresses).id);
|
|
24824
|
-
|
|
24825
|
-
newShippingAddressId: newAddressId
|
|
24826
|
-
});
|
|
24827
|
-
if (isBilling) {
|
|
24747
|
+
if (selectedMembership) {
|
|
24828
24748
|
dispatch({
|
|
24829
24749
|
type: LOADING,
|
|
24830
24750
|
payload: true
|
|
24831
24751
|
});
|
|
24832
|
-
window.Pelcro.
|
|
24752
|
+
return window.Pelcro.membership.update({
|
|
24833
24753
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
24834
|
-
|
|
24835
|
-
|
|
24836
|
-
last_name: lastName,
|
|
24837
|
-
line1: line1,
|
|
24838
|
-
line2: line2,
|
|
24839
|
-
city: city,
|
|
24840
|
-
state: state,
|
|
24841
|
-
country: country,
|
|
24842
|
-
postal_code: postalCode,
|
|
24843
|
-
is_default: isDefault
|
|
24754
|
+
address_id: newAddressId,
|
|
24755
|
+
membership_id: selectedMembership.id
|
|
24844
24756
|
}, (err, res) => {
|
|
24757
|
+
dispatch({
|
|
24758
|
+
type: LOADING,
|
|
24759
|
+
payload: false
|
|
24760
|
+
});
|
|
24845
24761
|
if (err) {
|
|
24846
24762
|
dispatch({
|
|
24847
24763
|
type: SHOW_ALERT,
|
|
@@ -24850,67 +24766,49 @@ const AddressCreateContainer = _ref => {
|
|
|
24850
24766
|
content: getErrorMessages(err)
|
|
24851
24767
|
}
|
|
24852
24768
|
});
|
|
24853
|
-
onFailure(err);
|
|
24854
|
-
return dispatch({
|
|
24855
|
-
type: LOADING,
|
|
24856
|
-
payload: false
|
|
24857
|
-
});
|
|
24769
|
+
return onFailure(err);
|
|
24858
24770
|
}
|
|
24859
|
-
|
|
24771
|
+
notify.success(t("messages.addressUpdated"));
|
|
24772
|
+
return onMembershipAdressUpdateSuccess(res);
|
|
24860
24773
|
});
|
|
24861
|
-
}
|
|
24774
|
+
}
|
|
24775
|
+
if (product || order) {
|
|
24862
24776
|
set({
|
|
24863
|
-
|
|
24777
|
+
selectedAddressId: newAddressId
|
|
24864
24778
|
});
|
|
24865
24779
|
}
|
|
24866
|
-
|
|
24867
|
-
};
|
|
24868
|
-
const submitBillingAddress = (_ref4, dispatch) => {
|
|
24869
|
-
let {
|
|
24870
|
-
firstName,
|
|
24871
|
-
lastName,
|
|
24872
|
-
line1,
|
|
24873
|
-
line2,
|
|
24874
|
-
city,
|
|
24875
|
-
state,
|
|
24876
|
-
country,
|
|
24877
|
-
postalCode,
|
|
24878
|
-
isDefault,
|
|
24879
|
-
isBilling
|
|
24880
|
-
} = _ref4;
|
|
24881
|
-
window.Pelcro.address.create({
|
|
24882
|
-
auth_token: window.Pelcro.user.read().auth_token,
|
|
24883
|
-
type: "billing",
|
|
24884
|
-
first_name: firstName,
|
|
24885
|
-
last_name: lastName,
|
|
24886
|
-
line1: line1,
|
|
24887
|
-
line2: line2,
|
|
24888
|
-
city: city,
|
|
24889
|
-
state: state,
|
|
24890
|
-
country: country,
|
|
24891
|
-
postal_code: postalCode,
|
|
24892
|
-
is_default: isDefault
|
|
24893
|
-
}, (err, res) => {
|
|
24894
|
-
if (err) {
|
|
24780
|
+
if (!giftCode) {
|
|
24895
24781
|
dispatch({
|
|
24896
|
-
type: SHOW_ALERT,
|
|
24897
|
-
payload: {
|
|
24898
|
-
type: "error",
|
|
24899
|
-
content: getErrorMessages(err)
|
|
24900
|
-
}
|
|
24901
|
-
});
|
|
24902
|
-
onFailure(err);
|
|
24903
|
-
return dispatch({
|
|
24904
24782
|
type: LOADING,
|
|
24905
24783
|
payload: false
|
|
24906
24784
|
});
|
|
24785
|
+
return onSuccess(newAddressId);
|
|
24786
|
+
}
|
|
24787
|
+
if (giftCode) {
|
|
24788
|
+
window.Pelcro.subscription.redeemGift({
|
|
24789
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
24790
|
+
gift_code: giftCode,
|
|
24791
|
+
address_id: newAddressId,
|
|
24792
|
+
// redeem gift as a future phase of an existing subscription
|
|
24793
|
+
subscription_id: subscriptionIdToRenew
|
|
24794
|
+
}, (err, res) => {
|
|
24795
|
+
dispatch({
|
|
24796
|
+
type: LOADING,
|
|
24797
|
+
payload: false
|
|
24798
|
+
});
|
|
24799
|
+
if (err) {
|
|
24800
|
+
dispatch({
|
|
24801
|
+
type: SHOW_ALERT,
|
|
24802
|
+
payload: {
|
|
24803
|
+
type: "error",
|
|
24804
|
+
content: getErrorMessages(err)
|
|
24805
|
+
}
|
|
24806
|
+
});
|
|
24807
|
+
return onFailure(err);
|
|
24808
|
+
}
|
|
24809
|
+
return onGiftRedemptionSuccess(res);
|
|
24810
|
+
});
|
|
24907
24811
|
}
|
|
24908
|
-
|
|
24909
|
-
// const newAddressId = String(
|
|
24910
|
-
// getNewlyCreatedAddress(res.data.addresses).id
|
|
24911
|
-
// );
|
|
24912
|
-
|
|
24913
|
-
handleAfterAddressCreationLogic(newShippingAddressId);
|
|
24914
24812
|
});
|
|
24915
24813
|
};
|
|
24916
24814
|
const [state, dispatch] = useReducerWithSideEffects((state, action) => {
|
|
@@ -24976,11 +24874,6 @@ const AddressCreateContainer = _ref => {
|
|
|
24976
24874
|
...state,
|
|
24977
24875
|
isSubmitting: true
|
|
24978
24876
|
}, (state, dispatch) => submitAddress(state, dispatch));
|
|
24979
|
-
case HANDLE_BILLING_SUBMIT:
|
|
24980
|
-
return lib_5({
|
|
24981
|
-
...state,
|
|
24982
|
-
isSubmitting: true
|
|
24983
|
-
}, (state, dispatch) => submitBillingAddress(state, dispatch));
|
|
24984
24877
|
default:
|
|
24985
24878
|
return state;
|
|
24986
24879
|
}
|
|
@@ -25010,8 +24903,7 @@ const AddressCreateContainer = _ref => {
|
|
|
25010
24903
|
if (state.country) {
|
|
25011
24904
|
getStates();
|
|
25012
24905
|
}
|
|
25013
|
-
}, [state.country]);
|
|
25014
|
-
|
|
24906
|
+
}, [state.country]);
|
|
25015
24907
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25016
24908
|
style: {
|
|
25017
24909
|
...style
|
|
@@ -25394,24 +25286,6 @@ const AddressCreateSetDefault = props => {
|
|
|
25394
25286
|
}, props.label);
|
|
25395
25287
|
};
|
|
25396
25288
|
|
|
25397
|
-
const AddressCreateSetBilling = props => {
|
|
25398
|
-
const {
|
|
25399
|
-
dispatch
|
|
25400
|
-
} = React.useContext(store$f);
|
|
25401
|
-
const handleCheckboxChange = e => {
|
|
25402
|
-
dispatch({
|
|
25403
|
-
type: HANDLE_CHECKBOX_CHANGE,
|
|
25404
|
-
payload: {
|
|
25405
|
-
isBilling: e.target.checked
|
|
25406
|
-
}
|
|
25407
|
-
});
|
|
25408
|
-
};
|
|
25409
|
-
return /*#__PURE__*/React__default['default'].createElement(Checkbox, {
|
|
25410
|
-
onChange: e => handleCheckboxChange(e),
|
|
25411
|
-
id: props.id
|
|
25412
|
-
}, props.label);
|
|
25413
|
-
};
|
|
25414
|
-
|
|
25415
25289
|
const AddressCreateView = props => {
|
|
25416
25290
|
const {
|
|
25417
25291
|
t
|
|
@@ -25470,11 +25344,6 @@ const AddressCreateView = props => {
|
|
|
25470
25344
|
}, /*#__PURE__*/React__default['default'].createElement(AddressCreateSetDefault, {
|
|
25471
25345
|
id: "pelcro-input-is-default",
|
|
25472
25346
|
label: t("labels.isDefault")
|
|
25473
|
-
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25474
|
-
className: "plc-flex plc-space-x-3 plc-items-start plc-mb-3"
|
|
25475
|
-
}, /*#__PURE__*/React__default['default'].createElement(AddressCreateSetBilling, {
|
|
25476
|
-
id: "pelcro-input-is-billing",
|
|
25477
|
-
label: t("labels.isBilling")
|
|
25478
25347
|
})), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
25479
25348
|
className: "plc-text-gray-900 pelcro-footnote"
|
|
25480
25349
|
}, "* ", t("labels.required")), /*#__PURE__*/React__default['default'].createElement(AddressCreateSubmit, {
|
|
@@ -25485,92 +25354,6 @@ const AddressCreateView = props => {
|
|
|
25485
25354
|
}))));
|
|
25486
25355
|
};
|
|
25487
25356
|
|
|
25488
|
-
const AddressCreateBillingSubmit = _ref => {
|
|
25489
|
-
let {
|
|
25490
|
-
name,
|
|
25491
|
-
onClick,
|
|
25492
|
-
...otherProps
|
|
25493
|
-
} = _ref;
|
|
25494
|
-
const {
|
|
25495
|
-
dispatch,
|
|
25496
|
-
state: {
|
|
25497
|
-
isSubmitting
|
|
25498
|
-
}
|
|
25499
|
-
} = React.useContext(store$f);
|
|
25500
|
-
const {
|
|
25501
|
-
t
|
|
25502
|
-
} = useTranslation("address");
|
|
25503
|
-
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
25504
|
-
onClick: () => {
|
|
25505
|
-
dispatch({
|
|
25506
|
-
type: HANDLE_BILLING_SUBMIT
|
|
25507
|
-
});
|
|
25508
|
-
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
25509
|
-
},
|
|
25510
|
-
isLoading: isSubmitting
|
|
25511
|
-
}, otherProps), name !== null && name !== void 0 ? name : t("buttons.submit"));
|
|
25512
|
-
};
|
|
25513
|
-
|
|
25514
|
-
const AddressCreateBillingView = props => {
|
|
25515
|
-
const {
|
|
25516
|
-
t
|
|
25517
|
-
} = useTranslation("address");
|
|
25518
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25519
|
-
id: "pelcro-address-create-view"
|
|
25520
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25521
|
-
className: "plc-mb-6 plc-text-2xl plc-font-semibold plc-text-center plc-text-gray-900 pelcro-title-wrapper"
|
|
25522
|
-
}, /*#__PURE__*/React__default['default'].createElement("h4", null, t("titleBilling"))), /*#__PURE__*/React__default['default'].createElement("form", {
|
|
25523
|
-
action: "javascript:void(0);",
|
|
25524
|
-
className: "plc-mt-2 pelcro-form"
|
|
25525
|
-
}, /*#__PURE__*/React__default['default'].createElement(AddressCreateContainer, props, /*#__PURE__*/React__default['default'].createElement(AlertWithContext, null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25526
|
-
className: "plc-flex plc-space-x-3 plc-items-start"
|
|
25527
|
-
}, /*#__PURE__*/React__default['default'].createElement(AddressCreateFirstName, {
|
|
25528
|
-
id: "pelcro-input-first-name",
|
|
25529
|
-
errorId: "pelcro-input-first-name-error",
|
|
25530
|
-
label: t("labels.firstName"),
|
|
25531
|
-
autoFocus: true
|
|
25532
|
-
}), /*#__PURE__*/React__default['default'].createElement(AddressCreateLastName, {
|
|
25533
|
-
id: "pelcro-input-last-name",
|
|
25534
|
-
errorId: "pelcro-input-last-name-error",
|
|
25535
|
-
label: t("labels.lastName")
|
|
25536
|
-
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25537
|
-
className: "plc-flex plc-items-start"
|
|
25538
|
-
}, /*#__PURE__*/React__default['default'].createElement(AddressCreateLine1, {
|
|
25539
|
-
id: "pelcro-input-line1",
|
|
25540
|
-
errorId: "pelcro-input-line1-error",
|
|
25541
|
-
required: true,
|
|
25542
|
-
label: t("labels.address")
|
|
25543
|
-
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25544
|
-
className: "plc-flex plc-space-x-3 plc-items-start"
|
|
25545
|
-
}, /*#__PURE__*/React__default['default'].createElement(AddressCreatePostalCode, {
|
|
25546
|
-
id: "pelcro-input-postal-code",
|
|
25547
|
-
errorId: "pelcro-input-postal-code-error",
|
|
25548
|
-
label: t("labels.code")
|
|
25549
|
-
}), /*#__PURE__*/React__default['default'].createElement(AddressCreateCity, {
|
|
25550
|
-
id: "pelcro-input-city",
|
|
25551
|
-
errorId: "pelcro-input-city-error",
|
|
25552
|
-
label: t("labels.city")
|
|
25553
|
-
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25554
|
-
className: "plc-flex plc-space-x-3 plc-items-start"
|
|
25555
|
-
}, /*#__PURE__*/React__default['default'].createElement(AddressCreateCountrySelect, {
|
|
25556
|
-
id: "pelcro-input-country",
|
|
25557
|
-
errorId: "pelcro-input-country-error",
|
|
25558
|
-
label: t("labels.country"),
|
|
25559
|
-
required: true
|
|
25560
|
-
}), /*#__PURE__*/React__default['default'].createElement(AddressCreateStateSelect, {
|
|
25561
|
-
label: t("labels.region"),
|
|
25562
|
-
id: "pelcro-input-state",
|
|
25563
|
-
errorId: "pelcro-input-state-error"
|
|
25564
|
-
})), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
25565
|
-
className: "plc-text-gray-900 pelcro-footnote"
|
|
25566
|
-
}, "* ", t("labels.required")), /*#__PURE__*/React__default['default'].createElement(AddressCreateBillingSubmit, {
|
|
25567
|
-
role: "submit",
|
|
25568
|
-
className: "plc-mt-2 plc-w-full",
|
|
25569
|
-
name: t("buttons.submit"),
|
|
25570
|
-
id: "pelcro-submit"
|
|
25571
|
-
}))));
|
|
25572
|
-
};
|
|
25573
|
-
|
|
25574
25357
|
const AddressCreateModal = _ref => {
|
|
25575
25358
|
let {
|
|
25576
25359
|
onDisplay,
|
|
@@ -25580,8 +25363,7 @@ const AddressCreateModal = _ref => {
|
|
|
25580
25363
|
const {
|
|
25581
25364
|
switchView,
|
|
25582
25365
|
switchToPaymentView,
|
|
25583
|
-
resetView
|
|
25584
|
-
addressView
|
|
25366
|
+
resetView
|
|
25585
25367
|
} = usePelcro();
|
|
25586
25368
|
const onSuccess = newAddressId => {
|
|
25587
25369
|
var _otherProps$onSuccess;
|
|
@@ -25604,11 +25386,7 @@ const AddressCreateModal = _ref => {
|
|
|
25604
25386
|
id: "pelcro-address-create-modal",
|
|
25605
25387
|
onDisplay: onDisplay,
|
|
25606
25388
|
onClose: onClose
|
|
25607
|
-
}, /*#__PURE__*/React__default['default'].createElement(ModalBody, null,
|
|
25608
|
-
onSuccess: onSuccess,
|
|
25609
|
-
onGiftRedemptionSuccess: onGiftRedemptionSuccess,
|
|
25610
|
-
onMembershipAdressUpdateSuccess: onMembershipAdressUpdateSuccess
|
|
25611
|
-
})) : /*#__PURE__*/React__default['default'].createElement(AddressCreateView, Object.assign({}, otherProps, {
|
|
25389
|
+
}, /*#__PURE__*/React__default['default'].createElement(ModalBody, null, /*#__PURE__*/React__default['default'].createElement(AddressCreateView, Object.assign({}, otherProps, {
|
|
25612
25390
|
onSuccess: onSuccess,
|
|
25613
25391
|
onGiftRedemptionSuccess: onGiftRedemptionSuccess,
|
|
25614
25392
|
onMembershipAdressUpdateSuccess: onMembershipAdressUpdateSuccess
|
|
@@ -29034,9 +28812,10 @@ const PaymentMethodDeleteContainer = _ref => {
|
|
|
29034
28812
|
const {
|
|
29035
28813
|
selectedPaymentMethodId: paymentMethodId
|
|
29036
28814
|
} = state;
|
|
29037
|
-
window.Pelcro.paymentMethods.
|
|
28815
|
+
window.Pelcro.paymentMethods.update({
|
|
29038
28816
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
29039
|
-
payment_method_id: paymentMethodId
|
|
28817
|
+
payment_method_id: paymentMethodId,
|
|
28818
|
+
is_default: true
|
|
29040
28819
|
}, (err, res) => {
|
|
29041
28820
|
if (err) {
|
|
29042
28821
|
onFailure(err);
|
package/dist/index.esm.js
CHANGED
|
@@ -3648,7 +3648,6 @@ var userEdit_en = {
|
|
|
3648
3648
|
};
|
|
3649
3649
|
|
|
3650
3650
|
var title$x = "Enter your shipping address";
|
|
3651
|
-
var titleBilling = "Enter your billing address";
|
|
3652
3651
|
var titleGifting$3 = "Enter your address";
|
|
3653
3652
|
var selectAddressTitle$3 = "Please select an address";
|
|
3654
3653
|
var selectAddressSubtitle$3 = "Select one of your saved addresses, or add a new one";
|
|
@@ -3661,8 +3660,7 @@ var labels$10 = {
|
|
|
3661
3660
|
firstName: "First name",
|
|
3662
3661
|
lastName: "Last name",
|
|
3663
3662
|
required: "required",
|
|
3664
|
-
isDefault: "Set as default"
|
|
3665
|
-
isBilling: "Set the billing address to be the same as shipping address"
|
|
3663
|
+
isDefault: "Set as default"
|
|
3666
3664
|
};
|
|
3667
3665
|
var buttons$m = {
|
|
3668
3666
|
submit: "Submit",
|
|
@@ -3675,7 +3673,6 @@ var messages$13 = {
|
|
|
3675
3673
|
};
|
|
3676
3674
|
var address_en = {
|
|
3677
3675
|
title: title$x,
|
|
3678
|
-
titleBilling: titleBilling,
|
|
3679
3676
|
titleGifting: titleGifting$3,
|
|
3680
3677
|
selectAddressTitle: selectAddressTitle$3,
|
|
3681
3678
|
selectAddressSubtitle: selectAddressSubtitle$3,
|
|
@@ -9442,9 +9439,7 @@ const initialState$o = {
|
|
|
9442
9439
|
isAuthenticated: () => window.Pelcro.user.isAuthenticated(),
|
|
9443
9440
|
selectedPaymentMethodId: null,
|
|
9444
9441
|
selectedAddressId: null,
|
|
9445
|
-
addressIdToEdit: null
|
|
9446
|
-
newShippingAddressId: null,
|
|
9447
|
-
addressView: null
|
|
9442
|
+
addressIdToEdit: null
|
|
9448
9443
|
};
|
|
9449
9444
|
const createPelcroStore = () => createStore(middleware_3((set, get) => {
|
|
9450
9445
|
const actions = new PelcroActions(set, get);
|
|
@@ -12905,7 +12900,6 @@ const GET_COUNTRIES_SUCCESS = "GET_COUNTRIES_SUCCESS";
|
|
|
12905
12900
|
const GET_COUNTRIES_FETCH = "GET_COUNTRIES_FETCH";
|
|
12906
12901
|
const GET_STATES_SUCCESS = "GET_STATES_SUCCESS";
|
|
12907
12902
|
const GET_STATES_FETCH = "GET_STATES_FETCH";
|
|
12908
|
-
const HANDLE_BILLING_SUBMIT = "HANDLE_BILLING_SUBMIT";
|
|
12909
12903
|
const HANDLE_SUBMIT = "HANDLE_SUBMIT";
|
|
12910
12904
|
const SET_UPDATED_PRICE = "SET_UPDATED_PRICE";
|
|
12911
12905
|
const SET_TAX_AMOUNT = "SET_TAX_AMOUNT";
|
|
@@ -24611,7 +24605,6 @@ const initialState$f = {
|
|
|
24611
24605
|
states: [],
|
|
24612
24606
|
countries: [],
|
|
24613
24607
|
isDefault: false,
|
|
24614
|
-
isBilling: false,
|
|
24615
24608
|
alert: {
|
|
24616
24609
|
type: "error",
|
|
24617
24610
|
content: ""
|
|
@@ -24644,8 +24637,7 @@ const AddressCreateContainer = _ref => {
|
|
|
24644
24637
|
product,
|
|
24645
24638
|
order,
|
|
24646
24639
|
set,
|
|
24647
|
-
selectedMembership
|
|
24648
|
-
newShippingAddressId
|
|
24640
|
+
selectedMembership
|
|
24649
24641
|
} = usePelcro();
|
|
24650
24642
|
const giftCode = (_props$giftCode = props.giftCode) !== null && _props$giftCode !== void 0 ? _props$giftCode : giftCodeFromStore;
|
|
24651
24643
|
const subscriptionIdToRenew = (_ref2 = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : subscriptionIdToRenewFromStore) !== null && _ref2 !== void 0 ? _ref2 : undefined;
|
|
@@ -24681,75 +24673,7 @@ const AddressCreateContainer = _ref => {
|
|
|
24681
24673
|
});
|
|
24682
24674
|
};
|
|
24683
24675
|
getCountries();
|
|
24684
|
-
}, []);
|
|
24685
|
-
|
|
24686
|
-
const handleAfterAddressCreationLogic = newAddressId => {
|
|
24687
|
-
if (selectedMembership) {
|
|
24688
|
-
dispatch({
|
|
24689
|
-
type: LOADING,
|
|
24690
|
-
payload: true
|
|
24691
|
-
});
|
|
24692
|
-
return window.Pelcro.membership.update({
|
|
24693
|
-
auth_token: window.Pelcro.user.read().auth_token,
|
|
24694
|
-
address_id: newAddressId,
|
|
24695
|
-
membership_id: selectedMembership.id
|
|
24696
|
-
}, (err, res) => {
|
|
24697
|
-
dispatch({
|
|
24698
|
-
type: LOADING,
|
|
24699
|
-
payload: false
|
|
24700
|
-
});
|
|
24701
|
-
if (err) {
|
|
24702
|
-
dispatch({
|
|
24703
|
-
type: SHOW_ALERT,
|
|
24704
|
-
payload: {
|
|
24705
|
-
type: "error",
|
|
24706
|
-
content: getErrorMessages(err)
|
|
24707
|
-
}
|
|
24708
|
-
});
|
|
24709
|
-
return onFailure(err);
|
|
24710
|
-
}
|
|
24711
|
-
notify.success(t("messages.addressUpdated"));
|
|
24712
|
-
return onMembershipAdressUpdateSuccess(res);
|
|
24713
|
-
});
|
|
24714
|
-
}
|
|
24715
|
-
if (product || order) {
|
|
24716
|
-
set({
|
|
24717
|
-
selectedAddressId: newAddressId
|
|
24718
|
-
});
|
|
24719
|
-
}
|
|
24720
|
-
if (!giftCode) {
|
|
24721
|
-
dispatch({
|
|
24722
|
-
type: LOADING,
|
|
24723
|
-
payload: false
|
|
24724
|
-
});
|
|
24725
|
-
return onSuccess(newAddressId);
|
|
24726
|
-
}
|
|
24727
|
-
if (giftCode) {
|
|
24728
|
-
window.Pelcro.subscription.redeemGift({
|
|
24729
|
-
auth_token: window.Pelcro.user.read().auth_token,
|
|
24730
|
-
gift_code: giftCode,
|
|
24731
|
-
address_id: newAddressId,
|
|
24732
|
-
// redeem gift as a future phase of an existing subscription
|
|
24733
|
-
subscription_id: subscriptionIdToRenew
|
|
24734
|
-
}, (err, res) => {
|
|
24735
|
-
dispatch({
|
|
24736
|
-
type: LOADING,
|
|
24737
|
-
payload: false
|
|
24738
|
-
});
|
|
24739
|
-
if (err) {
|
|
24740
|
-
dispatch({
|
|
24741
|
-
type: SHOW_ALERT,
|
|
24742
|
-
payload: {
|
|
24743
|
-
type: "error",
|
|
24744
|
-
content: getErrorMessages(err)
|
|
24745
|
-
}
|
|
24746
|
-
});
|
|
24747
|
-
return onFailure(err);
|
|
24748
|
-
}
|
|
24749
|
-
return onGiftRedemptionSuccess(res);
|
|
24750
|
-
});
|
|
24751
|
-
}
|
|
24752
|
-
};
|
|
24676
|
+
}, []);
|
|
24753
24677
|
const submitAddress = (_ref3, dispatch) => {
|
|
24754
24678
|
let {
|
|
24755
24679
|
firstName,
|
|
@@ -24760,8 +24684,7 @@ const AddressCreateContainer = _ref => {
|
|
|
24760
24684
|
state,
|
|
24761
24685
|
country,
|
|
24762
24686
|
postalCode,
|
|
24763
|
-
isDefault
|
|
24764
|
-
isBilling
|
|
24687
|
+
isDefault
|
|
24765
24688
|
} = _ref3;
|
|
24766
24689
|
window.Pelcro.address.create({
|
|
24767
24690
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
@@ -24791,27 +24714,20 @@ const AddressCreateContainer = _ref => {
|
|
|
24791
24714
|
});
|
|
24792
24715
|
}
|
|
24793
24716
|
const newAddressId = String(getNewlyCreatedAddress(res.data.addresses).id);
|
|
24794
|
-
|
|
24795
|
-
newShippingAddressId: newAddressId
|
|
24796
|
-
});
|
|
24797
|
-
if (isBilling) {
|
|
24717
|
+
if (selectedMembership) {
|
|
24798
24718
|
dispatch({
|
|
24799
24719
|
type: LOADING,
|
|
24800
24720
|
payload: true
|
|
24801
24721
|
});
|
|
24802
|
-
window.Pelcro.
|
|
24722
|
+
return window.Pelcro.membership.update({
|
|
24803
24723
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
24804
|
-
|
|
24805
|
-
|
|
24806
|
-
last_name: lastName,
|
|
24807
|
-
line1: line1,
|
|
24808
|
-
line2: line2,
|
|
24809
|
-
city: city,
|
|
24810
|
-
state: state,
|
|
24811
|
-
country: country,
|
|
24812
|
-
postal_code: postalCode,
|
|
24813
|
-
is_default: isDefault
|
|
24724
|
+
address_id: newAddressId,
|
|
24725
|
+
membership_id: selectedMembership.id
|
|
24814
24726
|
}, (err, res) => {
|
|
24727
|
+
dispatch({
|
|
24728
|
+
type: LOADING,
|
|
24729
|
+
payload: false
|
|
24730
|
+
});
|
|
24815
24731
|
if (err) {
|
|
24816
24732
|
dispatch({
|
|
24817
24733
|
type: SHOW_ALERT,
|
|
@@ -24820,67 +24736,49 @@ const AddressCreateContainer = _ref => {
|
|
|
24820
24736
|
content: getErrorMessages(err)
|
|
24821
24737
|
}
|
|
24822
24738
|
});
|
|
24823
|
-
onFailure(err);
|
|
24824
|
-
return dispatch({
|
|
24825
|
-
type: LOADING,
|
|
24826
|
-
payload: false
|
|
24827
|
-
});
|
|
24739
|
+
return onFailure(err);
|
|
24828
24740
|
}
|
|
24829
|
-
|
|
24741
|
+
notify.success(t("messages.addressUpdated"));
|
|
24742
|
+
return onMembershipAdressUpdateSuccess(res);
|
|
24830
24743
|
});
|
|
24831
|
-
}
|
|
24744
|
+
}
|
|
24745
|
+
if (product || order) {
|
|
24832
24746
|
set({
|
|
24833
|
-
|
|
24747
|
+
selectedAddressId: newAddressId
|
|
24834
24748
|
});
|
|
24835
24749
|
}
|
|
24836
|
-
|
|
24837
|
-
};
|
|
24838
|
-
const submitBillingAddress = (_ref4, dispatch) => {
|
|
24839
|
-
let {
|
|
24840
|
-
firstName,
|
|
24841
|
-
lastName,
|
|
24842
|
-
line1,
|
|
24843
|
-
line2,
|
|
24844
|
-
city,
|
|
24845
|
-
state,
|
|
24846
|
-
country,
|
|
24847
|
-
postalCode,
|
|
24848
|
-
isDefault,
|
|
24849
|
-
isBilling
|
|
24850
|
-
} = _ref4;
|
|
24851
|
-
window.Pelcro.address.create({
|
|
24852
|
-
auth_token: window.Pelcro.user.read().auth_token,
|
|
24853
|
-
type: "billing",
|
|
24854
|
-
first_name: firstName,
|
|
24855
|
-
last_name: lastName,
|
|
24856
|
-
line1: line1,
|
|
24857
|
-
line2: line2,
|
|
24858
|
-
city: city,
|
|
24859
|
-
state: state,
|
|
24860
|
-
country: country,
|
|
24861
|
-
postal_code: postalCode,
|
|
24862
|
-
is_default: isDefault
|
|
24863
|
-
}, (err, res) => {
|
|
24864
|
-
if (err) {
|
|
24750
|
+
if (!giftCode) {
|
|
24865
24751
|
dispatch({
|
|
24866
|
-
type: SHOW_ALERT,
|
|
24867
|
-
payload: {
|
|
24868
|
-
type: "error",
|
|
24869
|
-
content: getErrorMessages(err)
|
|
24870
|
-
}
|
|
24871
|
-
});
|
|
24872
|
-
onFailure(err);
|
|
24873
|
-
return dispatch({
|
|
24874
24752
|
type: LOADING,
|
|
24875
24753
|
payload: false
|
|
24876
24754
|
});
|
|
24755
|
+
return onSuccess(newAddressId);
|
|
24756
|
+
}
|
|
24757
|
+
if (giftCode) {
|
|
24758
|
+
window.Pelcro.subscription.redeemGift({
|
|
24759
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
24760
|
+
gift_code: giftCode,
|
|
24761
|
+
address_id: newAddressId,
|
|
24762
|
+
// redeem gift as a future phase of an existing subscription
|
|
24763
|
+
subscription_id: subscriptionIdToRenew
|
|
24764
|
+
}, (err, res) => {
|
|
24765
|
+
dispatch({
|
|
24766
|
+
type: LOADING,
|
|
24767
|
+
payload: false
|
|
24768
|
+
});
|
|
24769
|
+
if (err) {
|
|
24770
|
+
dispatch({
|
|
24771
|
+
type: SHOW_ALERT,
|
|
24772
|
+
payload: {
|
|
24773
|
+
type: "error",
|
|
24774
|
+
content: getErrorMessages(err)
|
|
24775
|
+
}
|
|
24776
|
+
});
|
|
24777
|
+
return onFailure(err);
|
|
24778
|
+
}
|
|
24779
|
+
return onGiftRedemptionSuccess(res);
|
|
24780
|
+
});
|
|
24877
24781
|
}
|
|
24878
|
-
|
|
24879
|
-
// const newAddressId = String(
|
|
24880
|
-
// getNewlyCreatedAddress(res.data.addresses).id
|
|
24881
|
-
// );
|
|
24882
|
-
|
|
24883
|
-
handleAfterAddressCreationLogic(newShippingAddressId);
|
|
24884
24782
|
});
|
|
24885
24783
|
};
|
|
24886
24784
|
const [state, dispatch] = useReducerWithSideEffects((state, action) => {
|
|
@@ -24946,11 +24844,6 @@ const AddressCreateContainer = _ref => {
|
|
|
24946
24844
|
...state,
|
|
24947
24845
|
isSubmitting: true
|
|
24948
24846
|
}, (state, dispatch) => submitAddress(state, dispatch));
|
|
24949
|
-
case HANDLE_BILLING_SUBMIT:
|
|
24950
|
-
return lib_5({
|
|
24951
|
-
...state,
|
|
24952
|
-
isSubmitting: true
|
|
24953
|
-
}, (state, dispatch) => submitBillingAddress(state, dispatch));
|
|
24954
24847
|
default:
|
|
24955
24848
|
return state;
|
|
24956
24849
|
}
|
|
@@ -24980,8 +24873,7 @@ const AddressCreateContainer = _ref => {
|
|
|
24980
24873
|
if (state.country) {
|
|
24981
24874
|
getStates();
|
|
24982
24875
|
}
|
|
24983
|
-
}, [state.country]);
|
|
24984
|
-
|
|
24876
|
+
}, [state.country]);
|
|
24985
24877
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
24986
24878
|
style: {
|
|
24987
24879
|
...style
|
|
@@ -25364,24 +25256,6 @@ const AddressCreateSetDefault = props => {
|
|
|
25364
25256
|
}, props.label);
|
|
25365
25257
|
};
|
|
25366
25258
|
|
|
25367
|
-
const AddressCreateSetBilling = props => {
|
|
25368
|
-
const {
|
|
25369
|
-
dispatch
|
|
25370
|
-
} = useContext(store$f);
|
|
25371
|
-
const handleCheckboxChange = e => {
|
|
25372
|
-
dispatch({
|
|
25373
|
-
type: HANDLE_CHECKBOX_CHANGE,
|
|
25374
|
-
payload: {
|
|
25375
|
-
isBilling: e.target.checked
|
|
25376
|
-
}
|
|
25377
|
-
});
|
|
25378
|
-
};
|
|
25379
|
-
return /*#__PURE__*/React__default.createElement(Checkbox, {
|
|
25380
|
-
onChange: e => handleCheckboxChange(e),
|
|
25381
|
-
id: props.id
|
|
25382
|
-
}, props.label);
|
|
25383
|
-
};
|
|
25384
|
-
|
|
25385
25259
|
const AddressCreateView = props => {
|
|
25386
25260
|
const {
|
|
25387
25261
|
t
|
|
@@ -25440,11 +25314,6 @@ const AddressCreateView = props => {
|
|
|
25440
25314
|
}, /*#__PURE__*/React__default.createElement(AddressCreateSetDefault, {
|
|
25441
25315
|
id: "pelcro-input-is-default",
|
|
25442
25316
|
label: t("labels.isDefault")
|
|
25443
|
-
})), /*#__PURE__*/React__default.createElement("div", {
|
|
25444
|
-
className: "plc-flex plc-space-x-3 plc-items-start plc-mb-3"
|
|
25445
|
-
}, /*#__PURE__*/React__default.createElement(AddressCreateSetBilling, {
|
|
25446
|
-
id: "pelcro-input-is-billing",
|
|
25447
|
-
label: t("labels.isBilling")
|
|
25448
25317
|
})), /*#__PURE__*/React__default.createElement("p", {
|
|
25449
25318
|
className: "plc-text-gray-900 pelcro-footnote"
|
|
25450
25319
|
}, "* ", t("labels.required")), /*#__PURE__*/React__default.createElement(AddressCreateSubmit, {
|
|
@@ -25455,92 +25324,6 @@ const AddressCreateView = props => {
|
|
|
25455
25324
|
}))));
|
|
25456
25325
|
};
|
|
25457
25326
|
|
|
25458
|
-
const AddressCreateBillingSubmit = _ref => {
|
|
25459
|
-
let {
|
|
25460
|
-
name,
|
|
25461
|
-
onClick,
|
|
25462
|
-
...otherProps
|
|
25463
|
-
} = _ref;
|
|
25464
|
-
const {
|
|
25465
|
-
dispatch,
|
|
25466
|
-
state: {
|
|
25467
|
-
isSubmitting
|
|
25468
|
-
}
|
|
25469
|
-
} = useContext(store$f);
|
|
25470
|
-
const {
|
|
25471
|
-
t
|
|
25472
|
-
} = useTranslation("address");
|
|
25473
|
-
return /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
25474
|
-
onClick: () => {
|
|
25475
|
-
dispatch({
|
|
25476
|
-
type: HANDLE_BILLING_SUBMIT
|
|
25477
|
-
});
|
|
25478
|
-
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
25479
|
-
},
|
|
25480
|
-
isLoading: isSubmitting
|
|
25481
|
-
}, otherProps), name !== null && name !== void 0 ? name : t("buttons.submit"));
|
|
25482
|
-
};
|
|
25483
|
-
|
|
25484
|
-
const AddressCreateBillingView = props => {
|
|
25485
|
-
const {
|
|
25486
|
-
t
|
|
25487
|
-
} = useTranslation("address");
|
|
25488
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
25489
|
-
id: "pelcro-address-create-view"
|
|
25490
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
25491
|
-
className: "plc-mb-6 plc-text-2xl plc-font-semibold plc-text-center plc-text-gray-900 pelcro-title-wrapper"
|
|
25492
|
-
}, /*#__PURE__*/React__default.createElement("h4", null, t("titleBilling"))), /*#__PURE__*/React__default.createElement("form", {
|
|
25493
|
-
action: "javascript:void(0);",
|
|
25494
|
-
className: "plc-mt-2 pelcro-form"
|
|
25495
|
-
}, /*#__PURE__*/React__default.createElement(AddressCreateContainer, props, /*#__PURE__*/React__default.createElement(AlertWithContext, null), /*#__PURE__*/React__default.createElement("div", {
|
|
25496
|
-
className: "plc-flex plc-space-x-3 plc-items-start"
|
|
25497
|
-
}, /*#__PURE__*/React__default.createElement(AddressCreateFirstName, {
|
|
25498
|
-
id: "pelcro-input-first-name",
|
|
25499
|
-
errorId: "pelcro-input-first-name-error",
|
|
25500
|
-
label: t("labels.firstName"),
|
|
25501
|
-
autoFocus: true
|
|
25502
|
-
}), /*#__PURE__*/React__default.createElement(AddressCreateLastName, {
|
|
25503
|
-
id: "pelcro-input-last-name",
|
|
25504
|
-
errorId: "pelcro-input-last-name-error",
|
|
25505
|
-
label: t("labels.lastName")
|
|
25506
|
-
})), /*#__PURE__*/React__default.createElement("div", {
|
|
25507
|
-
className: "plc-flex plc-items-start"
|
|
25508
|
-
}, /*#__PURE__*/React__default.createElement(AddressCreateLine1, {
|
|
25509
|
-
id: "pelcro-input-line1",
|
|
25510
|
-
errorId: "pelcro-input-line1-error",
|
|
25511
|
-
required: true,
|
|
25512
|
-
label: t("labels.address")
|
|
25513
|
-
})), /*#__PURE__*/React__default.createElement("div", {
|
|
25514
|
-
className: "plc-flex plc-space-x-3 plc-items-start"
|
|
25515
|
-
}, /*#__PURE__*/React__default.createElement(AddressCreatePostalCode, {
|
|
25516
|
-
id: "pelcro-input-postal-code",
|
|
25517
|
-
errorId: "pelcro-input-postal-code-error",
|
|
25518
|
-
label: t("labels.code")
|
|
25519
|
-
}), /*#__PURE__*/React__default.createElement(AddressCreateCity, {
|
|
25520
|
-
id: "pelcro-input-city",
|
|
25521
|
-
errorId: "pelcro-input-city-error",
|
|
25522
|
-
label: t("labels.city")
|
|
25523
|
-
})), /*#__PURE__*/React__default.createElement("div", {
|
|
25524
|
-
className: "plc-flex plc-space-x-3 plc-items-start"
|
|
25525
|
-
}, /*#__PURE__*/React__default.createElement(AddressCreateCountrySelect, {
|
|
25526
|
-
id: "pelcro-input-country",
|
|
25527
|
-
errorId: "pelcro-input-country-error",
|
|
25528
|
-
label: t("labels.country"),
|
|
25529
|
-
required: true
|
|
25530
|
-
}), /*#__PURE__*/React__default.createElement(AddressCreateStateSelect, {
|
|
25531
|
-
label: t("labels.region"),
|
|
25532
|
-
id: "pelcro-input-state",
|
|
25533
|
-
errorId: "pelcro-input-state-error"
|
|
25534
|
-
})), /*#__PURE__*/React__default.createElement("p", {
|
|
25535
|
-
className: "plc-text-gray-900 pelcro-footnote"
|
|
25536
|
-
}, "* ", t("labels.required")), /*#__PURE__*/React__default.createElement(AddressCreateBillingSubmit, {
|
|
25537
|
-
role: "submit",
|
|
25538
|
-
className: "plc-mt-2 plc-w-full",
|
|
25539
|
-
name: t("buttons.submit"),
|
|
25540
|
-
id: "pelcro-submit"
|
|
25541
|
-
}))));
|
|
25542
|
-
};
|
|
25543
|
-
|
|
25544
25327
|
const AddressCreateModal = _ref => {
|
|
25545
25328
|
let {
|
|
25546
25329
|
onDisplay,
|
|
@@ -25550,8 +25333,7 @@ const AddressCreateModal = _ref => {
|
|
|
25550
25333
|
const {
|
|
25551
25334
|
switchView,
|
|
25552
25335
|
switchToPaymentView,
|
|
25553
|
-
resetView
|
|
25554
|
-
addressView
|
|
25336
|
+
resetView
|
|
25555
25337
|
} = usePelcro();
|
|
25556
25338
|
const onSuccess = newAddressId => {
|
|
25557
25339
|
var _otherProps$onSuccess;
|
|
@@ -25574,11 +25356,7 @@ const AddressCreateModal = _ref => {
|
|
|
25574
25356
|
id: "pelcro-address-create-modal",
|
|
25575
25357
|
onDisplay: onDisplay,
|
|
25576
25358
|
onClose: onClose
|
|
25577
|
-
}, /*#__PURE__*/React__default.createElement(ModalBody, null,
|
|
25578
|
-
onSuccess: onSuccess,
|
|
25579
|
-
onGiftRedemptionSuccess: onGiftRedemptionSuccess,
|
|
25580
|
-
onMembershipAdressUpdateSuccess: onMembershipAdressUpdateSuccess
|
|
25581
|
-
})) : /*#__PURE__*/React__default.createElement(AddressCreateView, Object.assign({}, otherProps, {
|
|
25359
|
+
}, /*#__PURE__*/React__default.createElement(ModalBody, null, /*#__PURE__*/React__default.createElement(AddressCreateView, Object.assign({}, otherProps, {
|
|
25582
25360
|
onSuccess: onSuccess,
|
|
25583
25361
|
onGiftRedemptionSuccess: onGiftRedemptionSuccess,
|
|
25584
25362
|
onMembershipAdressUpdateSuccess: onMembershipAdressUpdateSuccess
|
|
@@ -29004,9 +28782,10 @@ const PaymentMethodDeleteContainer = _ref => {
|
|
|
29004
28782
|
const {
|
|
29005
28783
|
selectedPaymentMethodId: paymentMethodId
|
|
29006
28784
|
} = state;
|
|
29007
|
-
window.Pelcro.paymentMethods.
|
|
28785
|
+
window.Pelcro.paymentMethods.update({
|
|
29008
28786
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
29009
|
-
payment_method_id: paymentMethodId
|
|
28787
|
+
payment_method_id: paymentMethodId,
|
|
28788
|
+
is_default: true
|
|
29010
28789
|
}, (err, res) => {
|
|
29011
28790
|
if (err) {
|
|
29012
28791
|
onFailure(err);
|