@pelcro/react-pelcro-js 3.26.0-beta.29 → 3.26.0-beta.30
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 +267 -49
- package/dist/index.esm.js +267 -49
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -3678,6 +3678,7 @@ var userEdit_en = {
|
|
|
3678
3678
|
};
|
|
3679
3679
|
|
|
3680
3680
|
var title$x = "Enter your shipping address";
|
|
3681
|
+
var titleBilling = "Enter your billing address";
|
|
3681
3682
|
var titleGifting$3 = "Enter your address";
|
|
3682
3683
|
var selectAddressTitle$3 = "Please select an address";
|
|
3683
3684
|
var selectAddressSubtitle$3 = "Select one of your saved addresses, or add a new one";
|
|
@@ -3690,7 +3691,8 @@ var labels$10 = {
|
|
|
3690
3691
|
firstName: "First name",
|
|
3691
3692
|
lastName: "Last name",
|
|
3692
3693
|
required: "required",
|
|
3693
|
-
isDefault: "Set as default"
|
|
3694
|
+
isDefault: "Set as default",
|
|
3695
|
+
isBilling: "Set the billing address to be the same as shipping address"
|
|
3694
3696
|
};
|
|
3695
3697
|
var buttons$m = {
|
|
3696
3698
|
submit: "Submit",
|
|
@@ -3703,6 +3705,7 @@ var messages$13 = {
|
|
|
3703
3705
|
};
|
|
3704
3706
|
var address_en = {
|
|
3705
3707
|
title: title$x,
|
|
3708
|
+
titleBilling: titleBilling,
|
|
3706
3709
|
titleGifting: titleGifting$3,
|
|
3707
3710
|
selectAddressTitle: selectAddressTitle$3,
|
|
3708
3711
|
selectAddressSubtitle: selectAddressSubtitle$3,
|
|
@@ -9465,7 +9468,9 @@ const initialState$o = {
|
|
|
9465
9468
|
isAuthenticated: () => window.Pelcro.user.isAuthenticated(),
|
|
9466
9469
|
selectedPaymentMethodId: null,
|
|
9467
9470
|
selectedAddressId: null,
|
|
9468
|
-
addressIdToEdit: null
|
|
9471
|
+
addressIdToEdit: null,
|
|
9472
|
+
newShippingAddressId: null,
|
|
9473
|
+
addressView: null
|
|
9469
9474
|
};
|
|
9470
9475
|
const createPelcroStore = () => createStore(middleware_3((set, get) => {
|
|
9471
9476
|
const actions = new PelcroActions(set, get);
|
|
@@ -12926,6 +12931,7 @@ const GET_COUNTRIES_SUCCESS = "GET_COUNTRIES_SUCCESS";
|
|
|
12926
12931
|
const GET_COUNTRIES_FETCH = "GET_COUNTRIES_FETCH";
|
|
12927
12932
|
const GET_STATES_SUCCESS = "GET_STATES_SUCCESS";
|
|
12928
12933
|
const GET_STATES_FETCH = "GET_STATES_FETCH";
|
|
12934
|
+
const HANDLE_BILLING_SUBMIT = "HANDLE_BILLING_SUBMIT";
|
|
12929
12935
|
const HANDLE_SUBMIT = "HANDLE_SUBMIT";
|
|
12930
12936
|
const SET_UPDATED_PRICE = "SET_UPDATED_PRICE";
|
|
12931
12937
|
const SET_TAX_AMOUNT = "SET_TAX_AMOUNT";
|
|
@@ -24623,6 +24629,7 @@ const initialState$f = {
|
|
|
24623
24629
|
states: [],
|
|
24624
24630
|
countries: [],
|
|
24625
24631
|
isDefault: false,
|
|
24632
|
+
isBilling: false,
|
|
24626
24633
|
alert: {
|
|
24627
24634
|
type: "error",
|
|
24628
24635
|
content: ""
|
|
@@ -24655,7 +24662,8 @@ const AddressCreateContainer = _ref => {
|
|
|
24655
24662
|
product,
|
|
24656
24663
|
order,
|
|
24657
24664
|
set,
|
|
24658
|
-
selectedMembership
|
|
24665
|
+
selectedMembership,
|
|
24666
|
+
newShippingAddressId
|
|
24659
24667
|
} = usePelcro();
|
|
24660
24668
|
const giftCode = (_props$giftCode = props.giftCode) !== null && _props$giftCode !== void 0 ? _props$giftCode : giftCodeFromStore;
|
|
24661
24669
|
const subscriptionIdToRenew = (_ref2 = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : subscriptionIdToRenewFromStore) !== null && _ref2 !== void 0 ? _ref2 : undefined;
|
|
@@ -24691,7 +24699,75 @@ const AddressCreateContainer = _ref => {
|
|
|
24691
24699
|
});
|
|
24692
24700
|
};
|
|
24693
24701
|
getCountries();
|
|
24694
|
-
}, []);
|
|
24702
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
24703
|
+
|
|
24704
|
+
const handleAfterAddressCreationLogic = newAddressId => {
|
|
24705
|
+
if (selectedMembership) {
|
|
24706
|
+
dispatch({
|
|
24707
|
+
type: LOADING,
|
|
24708
|
+
payload: true
|
|
24709
|
+
});
|
|
24710
|
+
return window.Pelcro.membership.update({
|
|
24711
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
24712
|
+
address_id: newAddressId,
|
|
24713
|
+
membership_id: selectedMembership.id
|
|
24714
|
+
}, (err, res) => {
|
|
24715
|
+
dispatch({
|
|
24716
|
+
type: LOADING,
|
|
24717
|
+
payload: false
|
|
24718
|
+
});
|
|
24719
|
+
if (err) {
|
|
24720
|
+
dispatch({
|
|
24721
|
+
type: SHOW_ALERT,
|
|
24722
|
+
payload: {
|
|
24723
|
+
type: "error",
|
|
24724
|
+
content: getErrorMessages(err)
|
|
24725
|
+
}
|
|
24726
|
+
});
|
|
24727
|
+
return onFailure(err);
|
|
24728
|
+
}
|
|
24729
|
+
notify.success(t("messages.addressUpdated"));
|
|
24730
|
+
return onMembershipAdressUpdateSuccess(res);
|
|
24731
|
+
});
|
|
24732
|
+
}
|
|
24733
|
+
if (product || order) {
|
|
24734
|
+
set({
|
|
24735
|
+
selectedAddressId: newAddressId
|
|
24736
|
+
});
|
|
24737
|
+
}
|
|
24738
|
+
if (!giftCode) {
|
|
24739
|
+
dispatch({
|
|
24740
|
+
type: LOADING,
|
|
24741
|
+
payload: false
|
|
24742
|
+
});
|
|
24743
|
+
return onSuccess(newAddressId);
|
|
24744
|
+
}
|
|
24745
|
+
if (giftCode) {
|
|
24746
|
+
window.Pelcro.subscription.redeemGift({
|
|
24747
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
24748
|
+
gift_code: giftCode,
|
|
24749
|
+
address_id: newAddressId,
|
|
24750
|
+
// redeem gift as a future phase of an existing subscription
|
|
24751
|
+
subscription_id: subscriptionIdToRenew
|
|
24752
|
+
}, (err, res) => {
|
|
24753
|
+
dispatch({
|
|
24754
|
+
type: LOADING,
|
|
24755
|
+
payload: false
|
|
24756
|
+
});
|
|
24757
|
+
if (err) {
|
|
24758
|
+
dispatch({
|
|
24759
|
+
type: SHOW_ALERT,
|
|
24760
|
+
payload: {
|
|
24761
|
+
type: "error",
|
|
24762
|
+
content: getErrorMessages(err)
|
|
24763
|
+
}
|
|
24764
|
+
});
|
|
24765
|
+
return onFailure(err);
|
|
24766
|
+
}
|
|
24767
|
+
return onGiftRedemptionSuccess(res);
|
|
24768
|
+
});
|
|
24769
|
+
}
|
|
24770
|
+
};
|
|
24695
24771
|
const submitAddress = (_ref3, dispatch) => {
|
|
24696
24772
|
let {
|
|
24697
24773
|
firstName,
|
|
@@ -24702,7 +24778,8 @@ const AddressCreateContainer = _ref => {
|
|
|
24702
24778
|
state,
|
|
24703
24779
|
country,
|
|
24704
24780
|
postalCode,
|
|
24705
|
-
isDefault
|
|
24781
|
+
isDefault,
|
|
24782
|
+
isBilling
|
|
24706
24783
|
} = _ref3;
|
|
24707
24784
|
window.Pelcro.address.create({
|
|
24708
24785
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
@@ -24732,20 +24809,27 @@ const AddressCreateContainer = _ref => {
|
|
|
24732
24809
|
});
|
|
24733
24810
|
}
|
|
24734
24811
|
const newAddressId = String(getNewlyCreatedAddress(res.data.addresses).id);
|
|
24735
|
-
|
|
24812
|
+
set({
|
|
24813
|
+
newShippingAddressId: newAddressId
|
|
24814
|
+
});
|
|
24815
|
+
if (isBilling) {
|
|
24736
24816
|
dispatch({
|
|
24737
24817
|
type: LOADING,
|
|
24738
24818
|
payload: true
|
|
24739
24819
|
});
|
|
24740
|
-
|
|
24820
|
+
window.Pelcro.address.create({
|
|
24741
24821
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
24742
|
-
|
|
24743
|
-
|
|
24822
|
+
type: "billing",
|
|
24823
|
+
first_name: firstName,
|
|
24824
|
+
last_name: lastName,
|
|
24825
|
+
line1: line1,
|
|
24826
|
+
line2: line2,
|
|
24827
|
+
city: city,
|
|
24828
|
+
state: state,
|
|
24829
|
+
country: country,
|
|
24830
|
+
postal_code: postalCode,
|
|
24831
|
+
is_default: isDefault
|
|
24744
24832
|
}, (err, res) => {
|
|
24745
|
-
dispatch({
|
|
24746
|
-
type: LOADING,
|
|
24747
|
-
payload: false
|
|
24748
|
-
});
|
|
24749
24833
|
if (err) {
|
|
24750
24834
|
dispatch({
|
|
24751
24835
|
type: SHOW_ALERT,
|
|
@@ -24754,49 +24838,67 @@ const AddressCreateContainer = _ref => {
|
|
|
24754
24838
|
content: getErrorMessages(err)
|
|
24755
24839
|
}
|
|
24756
24840
|
});
|
|
24757
|
-
|
|
24841
|
+
onFailure(err);
|
|
24842
|
+
return dispatch({
|
|
24843
|
+
type: LOADING,
|
|
24844
|
+
payload: false
|
|
24845
|
+
});
|
|
24758
24846
|
}
|
|
24759
|
-
|
|
24760
|
-
return onMembershipAdressUpdateSuccess(res);
|
|
24847
|
+
handleAfterAddressCreationLogic(newAddressId);
|
|
24761
24848
|
});
|
|
24762
|
-
}
|
|
24763
|
-
if (product || order) {
|
|
24849
|
+
} else {
|
|
24764
24850
|
set({
|
|
24765
|
-
|
|
24851
|
+
addressView: "billing"
|
|
24766
24852
|
});
|
|
24767
24853
|
}
|
|
24768
|
-
|
|
24854
|
+
});
|
|
24855
|
+
};
|
|
24856
|
+
const submitBillingAddress = (_ref4, dispatch) => {
|
|
24857
|
+
let {
|
|
24858
|
+
firstName,
|
|
24859
|
+
lastName,
|
|
24860
|
+
line1,
|
|
24861
|
+
line2,
|
|
24862
|
+
city,
|
|
24863
|
+
state,
|
|
24864
|
+
country,
|
|
24865
|
+
postalCode,
|
|
24866
|
+
isDefault,
|
|
24867
|
+
isBilling
|
|
24868
|
+
} = _ref4;
|
|
24869
|
+
window.Pelcro.address.create({
|
|
24870
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
24871
|
+
type: "billing",
|
|
24872
|
+
first_name: firstName,
|
|
24873
|
+
last_name: lastName,
|
|
24874
|
+
line1: line1,
|
|
24875
|
+
line2: line2,
|
|
24876
|
+
city: city,
|
|
24877
|
+
state: state,
|
|
24878
|
+
country: country,
|
|
24879
|
+
postal_code: postalCode,
|
|
24880
|
+
is_default: isDefault
|
|
24881
|
+
}, (err, res) => {
|
|
24882
|
+
if (err) {
|
|
24769
24883
|
dispatch({
|
|
24884
|
+
type: SHOW_ALERT,
|
|
24885
|
+
payload: {
|
|
24886
|
+
type: "error",
|
|
24887
|
+
content: getErrorMessages(err)
|
|
24888
|
+
}
|
|
24889
|
+
});
|
|
24890
|
+
onFailure(err);
|
|
24891
|
+
return dispatch({
|
|
24770
24892
|
type: LOADING,
|
|
24771
24893
|
payload: false
|
|
24772
24894
|
});
|
|
24773
|
-
return onSuccess(newAddressId);
|
|
24774
|
-
}
|
|
24775
|
-
if (giftCode) {
|
|
24776
|
-
window.Pelcro.subscription.redeemGift({
|
|
24777
|
-
auth_token: window.Pelcro.user.read().auth_token,
|
|
24778
|
-
gift_code: giftCode,
|
|
24779
|
-
address_id: newAddressId,
|
|
24780
|
-
// redeem gift as a future phase of an existing subscription
|
|
24781
|
-
subscription_id: subscriptionIdToRenew
|
|
24782
|
-
}, (err, res) => {
|
|
24783
|
-
dispatch({
|
|
24784
|
-
type: LOADING,
|
|
24785
|
-
payload: false
|
|
24786
|
-
});
|
|
24787
|
-
if (err) {
|
|
24788
|
-
dispatch({
|
|
24789
|
-
type: SHOW_ALERT,
|
|
24790
|
-
payload: {
|
|
24791
|
-
type: "error",
|
|
24792
|
-
content: getErrorMessages(err)
|
|
24793
|
-
}
|
|
24794
|
-
});
|
|
24795
|
-
return onFailure(err);
|
|
24796
|
-
}
|
|
24797
|
-
return onGiftRedemptionSuccess(res);
|
|
24798
|
-
});
|
|
24799
24895
|
}
|
|
24896
|
+
|
|
24897
|
+
// const newAddressId = String(
|
|
24898
|
+
// getNewlyCreatedAddress(res.data.addresses).id
|
|
24899
|
+
// );
|
|
24900
|
+
|
|
24901
|
+
handleAfterAddressCreationLogic(newShippingAddressId);
|
|
24800
24902
|
});
|
|
24801
24903
|
};
|
|
24802
24904
|
const [state, dispatch] = useReducerWithSideEffects((state, action) => {
|
|
@@ -24862,6 +24964,11 @@ const AddressCreateContainer = _ref => {
|
|
|
24862
24964
|
...state,
|
|
24863
24965
|
isSubmitting: true
|
|
24864
24966
|
}, (state, dispatch) => submitAddress(state, dispatch));
|
|
24967
|
+
case HANDLE_BILLING_SUBMIT:
|
|
24968
|
+
return lib_5({
|
|
24969
|
+
...state,
|
|
24970
|
+
isSubmitting: true
|
|
24971
|
+
}, (state, dispatch) => submitBillingAddress(state, dispatch));
|
|
24865
24972
|
default:
|
|
24866
24973
|
return state;
|
|
24867
24974
|
}
|
|
@@ -24891,7 +24998,8 @@ const AddressCreateContainer = _ref => {
|
|
|
24891
24998
|
if (state.country) {
|
|
24892
24999
|
getStates();
|
|
24893
25000
|
}
|
|
24894
|
-
}, [state.country]);
|
|
25001
|
+
}, [state.country]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
25002
|
+
|
|
24895
25003
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
24896
25004
|
style: {
|
|
24897
25005
|
...style
|
|
@@ -25274,6 +25382,24 @@ const AddressCreateSetDefault = props => {
|
|
|
25274
25382
|
}, props.label);
|
|
25275
25383
|
};
|
|
25276
25384
|
|
|
25385
|
+
const AddressCreateSetBilling = props => {
|
|
25386
|
+
const {
|
|
25387
|
+
dispatch
|
|
25388
|
+
} = React.useContext(store$f);
|
|
25389
|
+
const handleCheckboxChange = e => {
|
|
25390
|
+
dispatch({
|
|
25391
|
+
type: HANDLE_CHECKBOX_CHANGE,
|
|
25392
|
+
payload: {
|
|
25393
|
+
isBilling: e.target.checked
|
|
25394
|
+
}
|
|
25395
|
+
});
|
|
25396
|
+
};
|
|
25397
|
+
return /*#__PURE__*/React__default['default'].createElement(Checkbox, {
|
|
25398
|
+
onChange: e => handleCheckboxChange(e),
|
|
25399
|
+
id: props.id
|
|
25400
|
+
}, props.label);
|
|
25401
|
+
};
|
|
25402
|
+
|
|
25277
25403
|
const AddressCreateView = props => {
|
|
25278
25404
|
const {
|
|
25279
25405
|
t
|
|
@@ -25332,6 +25458,11 @@ const AddressCreateView = props => {
|
|
|
25332
25458
|
}, /*#__PURE__*/React__default['default'].createElement(AddressCreateSetDefault, {
|
|
25333
25459
|
id: "pelcro-input-is-default",
|
|
25334
25460
|
label: t("labels.isDefault")
|
|
25461
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25462
|
+
className: "plc-flex plc-space-x-3 plc-items-start plc-mb-3"
|
|
25463
|
+
}, /*#__PURE__*/React__default['default'].createElement(AddressCreateSetBilling, {
|
|
25464
|
+
id: "pelcro-input-is-billing",
|
|
25465
|
+
label: t("labels.isBilling")
|
|
25335
25466
|
})), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
25336
25467
|
className: "plc-text-gray-900 pelcro-footnote"
|
|
25337
25468
|
}, "* ", t("labels.required")), /*#__PURE__*/React__default['default'].createElement(AddressCreateSubmit, {
|
|
@@ -25342,6 +25473,92 @@ const AddressCreateView = props => {
|
|
|
25342
25473
|
}))));
|
|
25343
25474
|
};
|
|
25344
25475
|
|
|
25476
|
+
const AddressCreateBillingSubmit = _ref => {
|
|
25477
|
+
let {
|
|
25478
|
+
name,
|
|
25479
|
+
onClick,
|
|
25480
|
+
...otherProps
|
|
25481
|
+
} = _ref;
|
|
25482
|
+
const {
|
|
25483
|
+
dispatch,
|
|
25484
|
+
state: {
|
|
25485
|
+
isSubmitting
|
|
25486
|
+
}
|
|
25487
|
+
} = React.useContext(store$f);
|
|
25488
|
+
const {
|
|
25489
|
+
t
|
|
25490
|
+
} = useTranslation("address");
|
|
25491
|
+
return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
25492
|
+
onClick: () => {
|
|
25493
|
+
dispatch({
|
|
25494
|
+
type: HANDLE_BILLING_SUBMIT
|
|
25495
|
+
});
|
|
25496
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
25497
|
+
},
|
|
25498
|
+
isLoading: isSubmitting
|
|
25499
|
+
}, otherProps), name !== null && name !== void 0 ? name : t("buttons.submit"));
|
|
25500
|
+
};
|
|
25501
|
+
|
|
25502
|
+
const AddressCreateBillingView = props => {
|
|
25503
|
+
const {
|
|
25504
|
+
t
|
|
25505
|
+
} = useTranslation("address");
|
|
25506
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25507
|
+
id: "pelcro-address-create-view"
|
|
25508
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25509
|
+
className: "plc-mb-6 plc-text-2xl plc-font-semibold plc-text-center plc-text-gray-900 pelcro-title-wrapper"
|
|
25510
|
+
}, /*#__PURE__*/React__default['default'].createElement("h4", null, t("titleBilling"))), /*#__PURE__*/React__default['default'].createElement("form", {
|
|
25511
|
+
action: "javascript:void(0);",
|
|
25512
|
+
className: "plc-mt-2 pelcro-form"
|
|
25513
|
+
}, /*#__PURE__*/React__default['default'].createElement(AddressCreateContainer, props, /*#__PURE__*/React__default['default'].createElement(AlertWithContext, null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25514
|
+
className: "plc-flex plc-space-x-3 plc-items-start"
|
|
25515
|
+
}, /*#__PURE__*/React__default['default'].createElement(AddressCreateFirstName, {
|
|
25516
|
+
id: "pelcro-input-first-name",
|
|
25517
|
+
errorId: "pelcro-input-first-name-error",
|
|
25518
|
+
label: t("labels.firstName"),
|
|
25519
|
+
autoFocus: true
|
|
25520
|
+
}), /*#__PURE__*/React__default['default'].createElement(AddressCreateLastName, {
|
|
25521
|
+
id: "pelcro-input-last-name",
|
|
25522
|
+
errorId: "pelcro-input-last-name-error",
|
|
25523
|
+
label: t("labels.lastName")
|
|
25524
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25525
|
+
className: "plc-flex plc-items-start"
|
|
25526
|
+
}, /*#__PURE__*/React__default['default'].createElement(AddressCreateLine1, {
|
|
25527
|
+
id: "pelcro-input-line1",
|
|
25528
|
+
errorId: "pelcro-input-line1-error",
|
|
25529
|
+
required: true,
|
|
25530
|
+
label: t("labels.address")
|
|
25531
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25532
|
+
className: "plc-flex plc-space-x-3 plc-items-start"
|
|
25533
|
+
}, /*#__PURE__*/React__default['default'].createElement(AddressCreatePostalCode, {
|
|
25534
|
+
id: "pelcro-input-postal-code",
|
|
25535
|
+
errorId: "pelcro-input-postal-code-error",
|
|
25536
|
+
label: t("labels.code")
|
|
25537
|
+
}), /*#__PURE__*/React__default['default'].createElement(AddressCreateCity, {
|
|
25538
|
+
id: "pelcro-input-city",
|
|
25539
|
+
errorId: "pelcro-input-city-error",
|
|
25540
|
+
label: t("labels.city")
|
|
25541
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
25542
|
+
className: "plc-flex plc-space-x-3 plc-items-start"
|
|
25543
|
+
}, /*#__PURE__*/React__default['default'].createElement(AddressCreateCountrySelect, {
|
|
25544
|
+
id: "pelcro-input-country",
|
|
25545
|
+
errorId: "pelcro-input-country-error",
|
|
25546
|
+
label: t("labels.country"),
|
|
25547
|
+
required: true
|
|
25548
|
+
}), /*#__PURE__*/React__default['default'].createElement(AddressCreateStateSelect, {
|
|
25549
|
+
label: t("labels.region"),
|
|
25550
|
+
id: "pelcro-input-state",
|
|
25551
|
+
errorId: "pelcro-input-state-error"
|
|
25552
|
+
})), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
25553
|
+
className: "plc-text-gray-900 pelcro-footnote"
|
|
25554
|
+
}, "* ", t("labels.required")), /*#__PURE__*/React__default['default'].createElement(AddressCreateBillingSubmit, {
|
|
25555
|
+
role: "submit",
|
|
25556
|
+
className: "plc-mt-2 plc-w-full",
|
|
25557
|
+
name: t("buttons.submit"),
|
|
25558
|
+
id: "pelcro-submit"
|
|
25559
|
+
}))));
|
|
25560
|
+
};
|
|
25561
|
+
|
|
25345
25562
|
const AddressCreateModal = _ref => {
|
|
25346
25563
|
let {
|
|
25347
25564
|
onDisplay,
|
|
@@ -25351,7 +25568,8 @@ const AddressCreateModal = _ref => {
|
|
|
25351
25568
|
const {
|
|
25352
25569
|
switchView,
|
|
25353
25570
|
switchToPaymentView,
|
|
25354
|
-
resetView
|
|
25571
|
+
resetView,
|
|
25572
|
+
addressView
|
|
25355
25573
|
} = usePelcro();
|
|
25356
25574
|
const onSuccess = newAddressId => {
|
|
25357
25575
|
var _otherProps$onSuccess;
|
|
@@ -25374,7 +25592,7 @@ const AddressCreateModal = _ref => {
|
|
|
25374
25592
|
id: "pelcro-address-create-modal",
|
|
25375
25593
|
onDisplay: onDisplay,
|
|
25376
25594
|
onClose: onClose
|
|
25377
|
-
}, /*#__PURE__*/React__default['default'].createElement(ModalBody, null, /*#__PURE__*/React__default['default'].createElement(AddressCreateView, Object.assign({}, otherProps, {
|
|
25595
|
+
}, /*#__PURE__*/React__default['default'].createElement(ModalBody, null, addressView === "billing" ? /*#__PURE__*/React__default['default'].createElement(AddressCreateBillingView, null) : /*#__PURE__*/React__default['default'].createElement(AddressCreateView, Object.assign({}, otherProps, {
|
|
25378
25596
|
onSuccess: onSuccess,
|
|
25379
25597
|
onGiftRedemptionSuccess: onGiftRedemptionSuccess,
|
|
25380
25598
|
onMembershipAdressUpdateSuccess: onMembershipAdressUpdateSuccess
|
package/dist/index.esm.js
CHANGED
|
@@ -3648,6 +3648,7 @@ var userEdit_en = {
|
|
|
3648
3648
|
};
|
|
3649
3649
|
|
|
3650
3650
|
var title$x = "Enter your shipping address";
|
|
3651
|
+
var titleBilling = "Enter your billing address";
|
|
3651
3652
|
var titleGifting$3 = "Enter your address";
|
|
3652
3653
|
var selectAddressTitle$3 = "Please select an address";
|
|
3653
3654
|
var selectAddressSubtitle$3 = "Select one of your saved addresses, or add a new one";
|
|
@@ -3660,7 +3661,8 @@ var labels$10 = {
|
|
|
3660
3661
|
firstName: "First name",
|
|
3661
3662
|
lastName: "Last name",
|
|
3662
3663
|
required: "required",
|
|
3663
|
-
isDefault: "Set as default"
|
|
3664
|
+
isDefault: "Set as default",
|
|
3665
|
+
isBilling: "Set the billing address to be the same as shipping address"
|
|
3664
3666
|
};
|
|
3665
3667
|
var buttons$m = {
|
|
3666
3668
|
submit: "Submit",
|
|
@@ -3673,6 +3675,7 @@ var messages$13 = {
|
|
|
3673
3675
|
};
|
|
3674
3676
|
var address_en = {
|
|
3675
3677
|
title: title$x,
|
|
3678
|
+
titleBilling: titleBilling,
|
|
3676
3679
|
titleGifting: titleGifting$3,
|
|
3677
3680
|
selectAddressTitle: selectAddressTitle$3,
|
|
3678
3681
|
selectAddressSubtitle: selectAddressSubtitle$3,
|
|
@@ -9435,7 +9438,9 @@ const initialState$o = {
|
|
|
9435
9438
|
isAuthenticated: () => window.Pelcro.user.isAuthenticated(),
|
|
9436
9439
|
selectedPaymentMethodId: null,
|
|
9437
9440
|
selectedAddressId: null,
|
|
9438
|
-
addressIdToEdit: null
|
|
9441
|
+
addressIdToEdit: null,
|
|
9442
|
+
newShippingAddressId: null,
|
|
9443
|
+
addressView: null
|
|
9439
9444
|
};
|
|
9440
9445
|
const createPelcroStore = () => createStore(middleware_3((set, get) => {
|
|
9441
9446
|
const actions = new PelcroActions(set, get);
|
|
@@ -12896,6 +12901,7 @@ const GET_COUNTRIES_SUCCESS = "GET_COUNTRIES_SUCCESS";
|
|
|
12896
12901
|
const GET_COUNTRIES_FETCH = "GET_COUNTRIES_FETCH";
|
|
12897
12902
|
const GET_STATES_SUCCESS = "GET_STATES_SUCCESS";
|
|
12898
12903
|
const GET_STATES_FETCH = "GET_STATES_FETCH";
|
|
12904
|
+
const HANDLE_BILLING_SUBMIT = "HANDLE_BILLING_SUBMIT";
|
|
12899
12905
|
const HANDLE_SUBMIT = "HANDLE_SUBMIT";
|
|
12900
12906
|
const SET_UPDATED_PRICE = "SET_UPDATED_PRICE";
|
|
12901
12907
|
const SET_TAX_AMOUNT = "SET_TAX_AMOUNT";
|
|
@@ -24593,6 +24599,7 @@ const initialState$f = {
|
|
|
24593
24599
|
states: [],
|
|
24594
24600
|
countries: [],
|
|
24595
24601
|
isDefault: false,
|
|
24602
|
+
isBilling: false,
|
|
24596
24603
|
alert: {
|
|
24597
24604
|
type: "error",
|
|
24598
24605
|
content: ""
|
|
@@ -24625,7 +24632,8 @@ const AddressCreateContainer = _ref => {
|
|
|
24625
24632
|
product,
|
|
24626
24633
|
order,
|
|
24627
24634
|
set,
|
|
24628
|
-
selectedMembership
|
|
24635
|
+
selectedMembership,
|
|
24636
|
+
newShippingAddressId
|
|
24629
24637
|
} = usePelcro();
|
|
24630
24638
|
const giftCode = (_props$giftCode = props.giftCode) !== null && _props$giftCode !== void 0 ? _props$giftCode : giftCodeFromStore;
|
|
24631
24639
|
const subscriptionIdToRenew = (_ref2 = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : subscriptionIdToRenewFromStore) !== null && _ref2 !== void 0 ? _ref2 : undefined;
|
|
@@ -24661,7 +24669,75 @@ const AddressCreateContainer = _ref => {
|
|
|
24661
24669
|
});
|
|
24662
24670
|
};
|
|
24663
24671
|
getCountries();
|
|
24664
|
-
}, []);
|
|
24672
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
24673
|
+
|
|
24674
|
+
const handleAfterAddressCreationLogic = newAddressId => {
|
|
24675
|
+
if (selectedMembership) {
|
|
24676
|
+
dispatch({
|
|
24677
|
+
type: LOADING,
|
|
24678
|
+
payload: true
|
|
24679
|
+
});
|
|
24680
|
+
return window.Pelcro.membership.update({
|
|
24681
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
24682
|
+
address_id: newAddressId,
|
|
24683
|
+
membership_id: selectedMembership.id
|
|
24684
|
+
}, (err, res) => {
|
|
24685
|
+
dispatch({
|
|
24686
|
+
type: LOADING,
|
|
24687
|
+
payload: false
|
|
24688
|
+
});
|
|
24689
|
+
if (err) {
|
|
24690
|
+
dispatch({
|
|
24691
|
+
type: SHOW_ALERT,
|
|
24692
|
+
payload: {
|
|
24693
|
+
type: "error",
|
|
24694
|
+
content: getErrorMessages(err)
|
|
24695
|
+
}
|
|
24696
|
+
});
|
|
24697
|
+
return onFailure(err);
|
|
24698
|
+
}
|
|
24699
|
+
notify.success(t("messages.addressUpdated"));
|
|
24700
|
+
return onMembershipAdressUpdateSuccess(res);
|
|
24701
|
+
});
|
|
24702
|
+
}
|
|
24703
|
+
if (product || order) {
|
|
24704
|
+
set({
|
|
24705
|
+
selectedAddressId: newAddressId
|
|
24706
|
+
});
|
|
24707
|
+
}
|
|
24708
|
+
if (!giftCode) {
|
|
24709
|
+
dispatch({
|
|
24710
|
+
type: LOADING,
|
|
24711
|
+
payload: false
|
|
24712
|
+
});
|
|
24713
|
+
return onSuccess(newAddressId);
|
|
24714
|
+
}
|
|
24715
|
+
if (giftCode) {
|
|
24716
|
+
window.Pelcro.subscription.redeemGift({
|
|
24717
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
24718
|
+
gift_code: giftCode,
|
|
24719
|
+
address_id: newAddressId,
|
|
24720
|
+
// redeem gift as a future phase of an existing subscription
|
|
24721
|
+
subscription_id: subscriptionIdToRenew
|
|
24722
|
+
}, (err, res) => {
|
|
24723
|
+
dispatch({
|
|
24724
|
+
type: LOADING,
|
|
24725
|
+
payload: false
|
|
24726
|
+
});
|
|
24727
|
+
if (err) {
|
|
24728
|
+
dispatch({
|
|
24729
|
+
type: SHOW_ALERT,
|
|
24730
|
+
payload: {
|
|
24731
|
+
type: "error",
|
|
24732
|
+
content: getErrorMessages(err)
|
|
24733
|
+
}
|
|
24734
|
+
});
|
|
24735
|
+
return onFailure(err);
|
|
24736
|
+
}
|
|
24737
|
+
return onGiftRedemptionSuccess(res);
|
|
24738
|
+
});
|
|
24739
|
+
}
|
|
24740
|
+
};
|
|
24665
24741
|
const submitAddress = (_ref3, dispatch) => {
|
|
24666
24742
|
let {
|
|
24667
24743
|
firstName,
|
|
@@ -24672,7 +24748,8 @@ const AddressCreateContainer = _ref => {
|
|
|
24672
24748
|
state,
|
|
24673
24749
|
country,
|
|
24674
24750
|
postalCode,
|
|
24675
|
-
isDefault
|
|
24751
|
+
isDefault,
|
|
24752
|
+
isBilling
|
|
24676
24753
|
} = _ref3;
|
|
24677
24754
|
window.Pelcro.address.create({
|
|
24678
24755
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
@@ -24702,20 +24779,27 @@ const AddressCreateContainer = _ref => {
|
|
|
24702
24779
|
});
|
|
24703
24780
|
}
|
|
24704
24781
|
const newAddressId = String(getNewlyCreatedAddress(res.data.addresses).id);
|
|
24705
|
-
|
|
24782
|
+
set({
|
|
24783
|
+
newShippingAddressId: newAddressId
|
|
24784
|
+
});
|
|
24785
|
+
if (isBilling) {
|
|
24706
24786
|
dispatch({
|
|
24707
24787
|
type: LOADING,
|
|
24708
24788
|
payload: true
|
|
24709
24789
|
});
|
|
24710
|
-
|
|
24790
|
+
window.Pelcro.address.create({
|
|
24711
24791
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
24712
|
-
|
|
24713
|
-
|
|
24792
|
+
type: "billing",
|
|
24793
|
+
first_name: firstName,
|
|
24794
|
+
last_name: lastName,
|
|
24795
|
+
line1: line1,
|
|
24796
|
+
line2: line2,
|
|
24797
|
+
city: city,
|
|
24798
|
+
state: state,
|
|
24799
|
+
country: country,
|
|
24800
|
+
postal_code: postalCode,
|
|
24801
|
+
is_default: isDefault
|
|
24714
24802
|
}, (err, res) => {
|
|
24715
|
-
dispatch({
|
|
24716
|
-
type: LOADING,
|
|
24717
|
-
payload: false
|
|
24718
|
-
});
|
|
24719
24803
|
if (err) {
|
|
24720
24804
|
dispatch({
|
|
24721
24805
|
type: SHOW_ALERT,
|
|
@@ -24724,49 +24808,67 @@ const AddressCreateContainer = _ref => {
|
|
|
24724
24808
|
content: getErrorMessages(err)
|
|
24725
24809
|
}
|
|
24726
24810
|
});
|
|
24727
|
-
|
|
24811
|
+
onFailure(err);
|
|
24812
|
+
return dispatch({
|
|
24813
|
+
type: LOADING,
|
|
24814
|
+
payload: false
|
|
24815
|
+
});
|
|
24728
24816
|
}
|
|
24729
|
-
|
|
24730
|
-
return onMembershipAdressUpdateSuccess(res);
|
|
24817
|
+
handleAfterAddressCreationLogic(newAddressId);
|
|
24731
24818
|
});
|
|
24732
|
-
}
|
|
24733
|
-
if (product || order) {
|
|
24819
|
+
} else {
|
|
24734
24820
|
set({
|
|
24735
|
-
|
|
24821
|
+
addressView: "billing"
|
|
24736
24822
|
});
|
|
24737
24823
|
}
|
|
24738
|
-
|
|
24824
|
+
});
|
|
24825
|
+
};
|
|
24826
|
+
const submitBillingAddress = (_ref4, dispatch) => {
|
|
24827
|
+
let {
|
|
24828
|
+
firstName,
|
|
24829
|
+
lastName,
|
|
24830
|
+
line1,
|
|
24831
|
+
line2,
|
|
24832
|
+
city,
|
|
24833
|
+
state,
|
|
24834
|
+
country,
|
|
24835
|
+
postalCode,
|
|
24836
|
+
isDefault,
|
|
24837
|
+
isBilling
|
|
24838
|
+
} = _ref4;
|
|
24839
|
+
window.Pelcro.address.create({
|
|
24840
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
24841
|
+
type: "billing",
|
|
24842
|
+
first_name: firstName,
|
|
24843
|
+
last_name: lastName,
|
|
24844
|
+
line1: line1,
|
|
24845
|
+
line2: line2,
|
|
24846
|
+
city: city,
|
|
24847
|
+
state: state,
|
|
24848
|
+
country: country,
|
|
24849
|
+
postal_code: postalCode,
|
|
24850
|
+
is_default: isDefault
|
|
24851
|
+
}, (err, res) => {
|
|
24852
|
+
if (err) {
|
|
24739
24853
|
dispatch({
|
|
24854
|
+
type: SHOW_ALERT,
|
|
24855
|
+
payload: {
|
|
24856
|
+
type: "error",
|
|
24857
|
+
content: getErrorMessages(err)
|
|
24858
|
+
}
|
|
24859
|
+
});
|
|
24860
|
+
onFailure(err);
|
|
24861
|
+
return dispatch({
|
|
24740
24862
|
type: LOADING,
|
|
24741
24863
|
payload: false
|
|
24742
24864
|
});
|
|
24743
|
-
return onSuccess(newAddressId);
|
|
24744
|
-
}
|
|
24745
|
-
if (giftCode) {
|
|
24746
|
-
window.Pelcro.subscription.redeemGift({
|
|
24747
|
-
auth_token: window.Pelcro.user.read().auth_token,
|
|
24748
|
-
gift_code: giftCode,
|
|
24749
|
-
address_id: newAddressId,
|
|
24750
|
-
// redeem gift as a future phase of an existing subscription
|
|
24751
|
-
subscription_id: subscriptionIdToRenew
|
|
24752
|
-
}, (err, res) => {
|
|
24753
|
-
dispatch({
|
|
24754
|
-
type: LOADING,
|
|
24755
|
-
payload: false
|
|
24756
|
-
});
|
|
24757
|
-
if (err) {
|
|
24758
|
-
dispatch({
|
|
24759
|
-
type: SHOW_ALERT,
|
|
24760
|
-
payload: {
|
|
24761
|
-
type: "error",
|
|
24762
|
-
content: getErrorMessages(err)
|
|
24763
|
-
}
|
|
24764
|
-
});
|
|
24765
|
-
return onFailure(err);
|
|
24766
|
-
}
|
|
24767
|
-
return onGiftRedemptionSuccess(res);
|
|
24768
|
-
});
|
|
24769
24865
|
}
|
|
24866
|
+
|
|
24867
|
+
// const newAddressId = String(
|
|
24868
|
+
// getNewlyCreatedAddress(res.data.addresses).id
|
|
24869
|
+
// );
|
|
24870
|
+
|
|
24871
|
+
handleAfterAddressCreationLogic(newShippingAddressId);
|
|
24770
24872
|
});
|
|
24771
24873
|
};
|
|
24772
24874
|
const [state, dispatch] = useReducerWithSideEffects((state, action) => {
|
|
@@ -24832,6 +24934,11 @@ const AddressCreateContainer = _ref => {
|
|
|
24832
24934
|
...state,
|
|
24833
24935
|
isSubmitting: true
|
|
24834
24936
|
}, (state, dispatch) => submitAddress(state, dispatch));
|
|
24937
|
+
case HANDLE_BILLING_SUBMIT:
|
|
24938
|
+
return lib_5({
|
|
24939
|
+
...state,
|
|
24940
|
+
isSubmitting: true
|
|
24941
|
+
}, (state, dispatch) => submitBillingAddress(state, dispatch));
|
|
24835
24942
|
default:
|
|
24836
24943
|
return state;
|
|
24837
24944
|
}
|
|
@@ -24861,7 +24968,8 @@ const AddressCreateContainer = _ref => {
|
|
|
24861
24968
|
if (state.country) {
|
|
24862
24969
|
getStates();
|
|
24863
24970
|
}
|
|
24864
|
-
}, [state.country]);
|
|
24971
|
+
}, [state.country]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
24972
|
+
|
|
24865
24973
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
24866
24974
|
style: {
|
|
24867
24975
|
...style
|
|
@@ -25244,6 +25352,24 @@ const AddressCreateSetDefault = props => {
|
|
|
25244
25352
|
}, props.label);
|
|
25245
25353
|
};
|
|
25246
25354
|
|
|
25355
|
+
const AddressCreateSetBilling = props => {
|
|
25356
|
+
const {
|
|
25357
|
+
dispatch
|
|
25358
|
+
} = useContext(store$f);
|
|
25359
|
+
const handleCheckboxChange = e => {
|
|
25360
|
+
dispatch({
|
|
25361
|
+
type: HANDLE_CHECKBOX_CHANGE,
|
|
25362
|
+
payload: {
|
|
25363
|
+
isBilling: e.target.checked
|
|
25364
|
+
}
|
|
25365
|
+
});
|
|
25366
|
+
};
|
|
25367
|
+
return /*#__PURE__*/React__default.createElement(Checkbox, {
|
|
25368
|
+
onChange: e => handleCheckboxChange(e),
|
|
25369
|
+
id: props.id
|
|
25370
|
+
}, props.label);
|
|
25371
|
+
};
|
|
25372
|
+
|
|
25247
25373
|
const AddressCreateView = props => {
|
|
25248
25374
|
const {
|
|
25249
25375
|
t
|
|
@@ -25302,6 +25428,11 @@ const AddressCreateView = props => {
|
|
|
25302
25428
|
}, /*#__PURE__*/React__default.createElement(AddressCreateSetDefault, {
|
|
25303
25429
|
id: "pelcro-input-is-default",
|
|
25304
25430
|
label: t("labels.isDefault")
|
|
25431
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
25432
|
+
className: "plc-flex plc-space-x-3 plc-items-start plc-mb-3"
|
|
25433
|
+
}, /*#__PURE__*/React__default.createElement(AddressCreateSetBilling, {
|
|
25434
|
+
id: "pelcro-input-is-billing",
|
|
25435
|
+
label: t("labels.isBilling")
|
|
25305
25436
|
})), /*#__PURE__*/React__default.createElement("p", {
|
|
25306
25437
|
className: "plc-text-gray-900 pelcro-footnote"
|
|
25307
25438
|
}, "* ", t("labels.required")), /*#__PURE__*/React__default.createElement(AddressCreateSubmit, {
|
|
@@ -25312,6 +25443,92 @@ const AddressCreateView = props => {
|
|
|
25312
25443
|
}))));
|
|
25313
25444
|
};
|
|
25314
25445
|
|
|
25446
|
+
const AddressCreateBillingSubmit = _ref => {
|
|
25447
|
+
let {
|
|
25448
|
+
name,
|
|
25449
|
+
onClick,
|
|
25450
|
+
...otherProps
|
|
25451
|
+
} = _ref;
|
|
25452
|
+
const {
|
|
25453
|
+
dispatch,
|
|
25454
|
+
state: {
|
|
25455
|
+
isSubmitting
|
|
25456
|
+
}
|
|
25457
|
+
} = useContext(store$f);
|
|
25458
|
+
const {
|
|
25459
|
+
t
|
|
25460
|
+
} = useTranslation("address");
|
|
25461
|
+
return /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
25462
|
+
onClick: () => {
|
|
25463
|
+
dispatch({
|
|
25464
|
+
type: HANDLE_BILLING_SUBMIT
|
|
25465
|
+
});
|
|
25466
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
25467
|
+
},
|
|
25468
|
+
isLoading: isSubmitting
|
|
25469
|
+
}, otherProps), name !== null && name !== void 0 ? name : t("buttons.submit"));
|
|
25470
|
+
};
|
|
25471
|
+
|
|
25472
|
+
const AddressCreateBillingView = props => {
|
|
25473
|
+
const {
|
|
25474
|
+
t
|
|
25475
|
+
} = useTranslation("address");
|
|
25476
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
25477
|
+
id: "pelcro-address-create-view"
|
|
25478
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
25479
|
+
className: "plc-mb-6 plc-text-2xl plc-font-semibold plc-text-center plc-text-gray-900 pelcro-title-wrapper"
|
|
25480
|
+
}, /*#__PURE__*/React__default.createElement("h4", null, t("titleBilling"))), /*#__PURE__*/React__default.createElement("form", {
|
|
25481
|
+
action: "javascript:void(0);",
|
|
25482
|
+
className: "plc-mt-2 pelcro-form"
|
|
25483
|
+
}, /*#__PURE__*/React__default.createElement(AddressCreateContainer, props, /*#__PURE__*/React__default.createElement(AlertWithContext, null), /*#__PURE__*/React__default.createElement("div", {
|
|
25484
|
+
className: "plc-flex plc-space-x-3 plc-items-start"
|
|
25485
|
+
}, /*#__PURE__*/React__default.createElement(AddressCreateFirstName, {
|
|
25486
|
+
id: "pelcro-input-first-name",
|
|
25487
|
+
errorId: "pelcro-input-first-name-error",
|
|
25488
|
+
label: t("labels.firstName"),
|
|
25489
|
+
autoFocus: true
|
|
25490
|
+
}), /*#__PURE__*/React__default.createElement(AddressCreateLastName, {
|
|
25491
|
+
id: "pelcro-input-last-name",
|
|
25492
|
+
errorId: "pelcro-input-last-name-error",
|
|
25493
|
+
label: t("labels.lastName")
|
|
25494
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
25495
|
+
className: "plc-flex plc-items-start"
|
|
25496
|
+
}, /*#__PURE__*/React__default.createElement(AddressCreateLine1, {
|
|
25497
|
+
id: "pelcro-input-line1",
|
|
25498
|
+
errorId: "pelcro-input-line1-error",
|
|
25499
|
+
required: true,
|
|
25500
|
+
label: t("labels.address")
|
|
25501
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
25502
|
+
className: "plc-flex plc-space-x-3 plc-items-start"
|
|
25503
|
+
}, /*#__PURE__*/React__default.createElement(AddressCreatePostalCode, {
|
|
25504
|
+
id: "pelcro-input-postal-code",
|
|
25505
|
+
errorId: "pelcro-input-postal-code-error",
|
|
25506
|
+
label: t("labels.code")
|
|
25507
|
+
}), /*#__PURE__*/React__default.createElement(AddressCreateCity, {
|
|
25508
|
+
id: "pelcro-input-city",
|
|
25509
|
+
errorId: "pelcro-input-city-error",
|
|
25510
|
+
label: t("labels.city")
|
|
25511
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
25512
|
+
className: "plc-flex plc-space-x-3 plc-items-start"
|
|
25513
|
+
}, /*#__PURE__*/React__default.createElement(AddressCreateCountrySelect, {
|
|
25514
|
+
id: "pelcro-input-country",
|
|
25515
|
+
errorId: "pelcro-input-country-error",
|
|
25516
|
+
label: t("labels.country"),
|
|
25517
|
+
required: true
|
|
25518
|
+
}), /*#__PURE__*/React__default.createElement(AddressCreateStateSelect, {
|
|
25519
|
+
label: t("labels.region"),
|
|
25520
|
+
id: "pelcro-input-state",
|
|
25521
|
+
errorId: "pelcro-input-state-error"
|
|
25522
|
+
})), /*#__PURE__*/React__default.createElement("p", {
|
|
25523
|
+
className: "plc-text-gray-900 pelcro-footnote"
|
|
25524
|
+
}, "* ", t("labels.required")), /*#__PURE__*/React__default.createElement(AddressCreateBillingSubmit, {
|
|
25525
|
+
role: "submit",
|
|
25526
|
+
className: "plc-mt-2 plc-w-full",
|
|
25527
|
+
name: t("buttons.submit"),
|
|
25528
|
+
id: "pelcro-submit"
|
|
25529
|
+
}))));
|
|
25530
|
+
};
|
|
25531
|
+
|
|
25315
25532
|
const AddressCreateModal = _ref => {
|
|
25316
25533
|
let {
|
|
25317
25534
|
onDisplay,
|
|
@@ -25321,7 +25538,8 @@ const AddressCreateModal = _ref => {
|
|
|
25321
25538
|
const {
|
|
25322
25539
|
switchView,
|
|
25323
25540
|
switchToPaymentView,
|
|
25324
|
-
resetView
|
|
25541
|
+
resetView,
|
|
25542
|
+
addressView
|
|
25325
25543
|
} = usePelcro();
|
|
25326
25544
|
const onSuccess = newAddressId => {
|
|
25327
25545
|
var _otherProps$onSuccess;
|
|
@@ -25344,7 +25562,7 @@ const AddressCreateModal = _ref => {
|
|
|
25344
25562
|
id: "pelcro-address-create-modal",
|
|
25345
25563
|
onDisplay: onDisplay,
|
|
25346
25564
|
onClose: onClose
|
|
25347
|
-
}, /*#__PURE__*/React__default.createElement(ModalBody, null, /*#__PURE__*/React__default.createElement(AddressCreateView, Object.assign({}, otherProps, {
|
|
25565
|
+
}, /*#__PURE__*/React__default.createElement(ModalBody, null, addressView === "billing" ? /*#__PURE__*/React__default.createElement(AddressCreateBillingView, null) : /*#__PURE__*/React__default.createElement(AddressCreateView, Object.assign({}, otherProps, {
|
|
25348
25566
|
onSuccess: onSuccess,
|
|
25349
25567
|
onGiftRedemptionSuccess: onGiftRedemptionSuccess,
|
|
25350
25568
|
onMembershipAdressUpdateSuccess: onMembershipAdressUpdateSuccess
|