@pelcro/react-pelcro-js 4.0.0-alpha.70 → 4.0.0-alpha.72
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 +330 -166
- package/dist/index.esm.js +330 -166
- package/dist/pelcro.css +0 -20
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -3248,7 +3248,9 @@ var validation$3 = {
|
|
|
3248
3248
|
enterEmails: "Email addresses are required.",
|
|
3249
3249
|
enterUsername: "User name is required.",
|
|
3250
3250
|
enterPassword: "Password is required.",
|
|
3251
|
-
confirmPassword: "Confirm password is required."
|
|
3251
|
+
confirmPassword: "Confirm password is required.",
|
|
3252
|
+
enterFirstName: "First name is required.",
|
|
3253
|
+
enterLastName: "Last name is required."
|
|
3252
3254
|
};
|
|
3253
3255
|
var buttons$j = {
|
|
3254
3256
|
account: "My account",
|
|
@@ -3476,7 +3478,9 @@ var labels$11 = {
|
|
|
3476
3478
|
lastName: "Last name",
|
|
3477
3479
|
phone: "Phone",
|
|
3478
3480
|
freeItems: "Free Items",
|
|
3479
|
-
isDefault: "Set as default"
|
|
3481
|
+
isDefault: "Set as default",
|
|
3482
|
+
shippingAddress: "Shipping Address",
|
|
3483
|
+
contactDetails: "Contact Details"
|
|
3480
3484
|
};
|
|
3481
3485
|
var checkoutForm_en = {
|
|
3482
3486
|
messages: messages$14,
|
|
@@ -3857,6 +3861,7 @@ var labels$W = {
|
|
|
3857
3861
|
},
|
|
3858
3862
|
checkout: {
|
|
3859
3863
|
title: "Payment Information",
|
|
3864
|
+
shippingAddress: "Shipping Address",
|
|
3860
3865
|
billingAddress: "Billing Address",
|
|
3861
3866
|
NoBillingAddress: "No Billing Address Found",
|
|
3862
3867
|
changeBillingAddress: "Change",
|
|
@@ -4165,7 +4170,9 @@ var validation$2 = {
|
|
|
4165
4170
|
enterEmails: "Les adresses e-mail sont obligatoires.",
|
|
4166
4171
|
enterUsername: "Nom d'utilisateur est nécessaire.",
|
|
4167
4172
|
enterPassword: "Mot de passe requis.",
|
|
4168
|
-
confirmPassword: "Confirmer le mot de passe requis."
|
|
4173
|
+
confirmPassword: "Confirmer le mot de passe requis.",
|
|
4174
|
+
enterFirstName: "Le prénom est requis.",
|
|
4175
|
+
enterLastName: "Le nom de famille est requis."
|
|
4169
4176
|
};
|
|
4170
4177
|
var buttons$e = {
|
|
4171
4178
|
account: "Accès abonné(e)s",
|
|
@@ -13575,6 +13582,8 @@ const initialState$n = {
|
|
|
13575
13582
|
password: "",
|
|
13576
13583
|
emailError: null,
|
|
13577
13584
|
passwordError: null,
|
|
13585
|
+
firstNameError: null,
|
|
13586
|
+
lastNameError: null,
|
|
13578
13587
|
confirmPassword: "",
|
|
13579
13588
|
confirmPasswordError: null,
|
|
13580
13589
|
confirmPasswordUsed: false,
|
|
@@ -13733,12 +13742,14 @@ const RegisterContainer = ({
|
|
|
13733
13742
|
|
|
13734
13743
|
case SET_FIRST_NAME:
|
|
13735
13744
|
return lib_7({ ...state,
|
|
13736
|
-
firstName: action.payload
|
|
13745
|
+
firstName: action.payload,
|
|
13746
|
+
firstNameError: null
|
|
13737
13747
|
});
|
|
13738
13748
|
|
|
13739
13749
|
case SET_LAST_NAME:
|
|
13740
13750
|
return lib_7({ ...state,
|
|
13741
|
-
lastName: action.payload
|
|
13751
|
+
lastName: action.payload,
|
|
13752
|
+
lastNameError: null
|
|
13742
13753
|
});
|
|
13743
13754
|
|
|
13744
13755
|
case SET_TEXT_FIELD:
|
|
@@ -13764,6 +13775,18 @@ const RegisterContainer = ({
|
|
|
13764
13775
|
password: ""
|
|
13765
13776
|
});
|
|
13766
13777
|
|
|
13778
|
+
case SET_FIRST_NAME_ERROR:
|
|
13779
|
+
return lib_7({ ...state,
|
|
13780
|
+
firstNameError: action.payload,
|
|
13781
|
+
firstName: ""
|
|
13782
|
+
});
|
|
13783
|
+
|
|
13784
|
+
case SET_LAST_NAME_ERROR:
|
|
13785
|
+
return lib_7({ ...state,
|
|
13786
|
+
lastNameError: action.payload,
|
|
13787
|
+
lastName: ""
|
|
13788
|
+
});
|
|
13789
|
+
|
|
13767
13790
|
case SET_CONFIRM_PASSWORD_ERROR:
|
|
13768
13791
|
return lib_7({ ...state,
|
|
13769
13792
|
confirmPasswordError: action.payload,
|
|
@@ -14583,117 +14606,77 @@ const RegisterButton = ({
|
|
|
14583
14606
|
}, otherProps), name !== null && name !== void 0 ? name : t("messages.createAccount"));
|
|
14584
14607
|
};
|
|
14585
14608
|
|
|
14586
|
-
const Loader = props => /*#__PURE__*/React__default['default'].createElement("div", {
|
|
14587
|
-
className: `pelcro-loader-wrapper ${props.className}`
|
|
14588
|
-
}, /*#__PURE__*/React__default['default'].createElement("svg", {
|
|
14589
|
-
width: props.width,
|
|
14590
|
-
height: props.height,
|
|
14591
|
-
viewBox: "0 0 120 30",
|
|
14592
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
14593
|
-
fill: "currentColor",
|
|
14594
|
-
"aria-label": props.label
|
|
14595
|
-
}, /*#__PURE__*/React__default['default'].createElement("circle", {
|
|
14596
|
-
cx: "15",
|
|
14597
|
-
cy: "15",
|
|
14598
|
-
r: props.radius + 6
|
|
14599
|
-
}, /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
14600
|
-
attributeName: "r",
|
|
14601
|
-
from: "15",
|
|
14602
|
-
to: "15",
|
|
14603
|
-
begin: "0s",
|
|
14604
|
-
dur: "0.8s",
|
|
14605
|
-
values: "15;9;15",
|
|
14606
|
-
calcMode: "linear",
|
|
14607
|
-
repeatCount: "indefinite"
|
|
14608
|
-
}), /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
14609
|
-
attributeName: "fillOpacity",
|
|
14610
|
-
from: "1",
|
|
14611
|
-
to: "1",
|
|
14612
|
-
begin: "0s",
|
|
14613
|
-
dur: "0.8s",
|
|
14614
|
-
values: "1;.5;1",
|
|
14615
|
-
calcMode: "linear",
|
|
14616
|
-
repeatCount: "indefinite"
|
|
14617
|
-
})), /*#__PURE__*/React__default['default'].createElement("circle", {
|
|
14618
|
-
cx: "60",
|
|
14619
|
-
cy: "15",
|
|
14620
|
-
r: props.radius,
|
|
14621
|
-
attributeName: "fillOpacity",
|
|
14622
|
-
from: "1",
|
|
14623
|
-
to: "0.3"
|
|
14624
|
-
}, /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
14625
|
-
attributeName: "r",
|
|
14626
|
-
from: "9",
|
|
14627
|
-
to: "9",
|
|
14628
|
-
begin: "0s",
|
|
14629
|
-
dur: "0.8s",
|
|
14630
|
-
values: "9;15;9",
|
|
14631
|
-
calcMode: "linear",
|
|
14632
|
-
repeatCount: "indefinite"
|
|
14633
|
-
}), /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
14634
|
-
attributeName: "fillOpacity",
|
|
14635
|
-
from: "0.5",
|
|
14636
|
-
to: "0.5",
|
|
14637
|
-
begin: "0s",
|
|
14638
|
-
dur: "0.8s",
|
|
14639
|
-
values: ".5;1;.5",
|
|
14640
|
-
calcMode: "linear",
|
|
14641
|
-
repeatCount: "indefinite"
|
|
14642
|
-
})), /*#__PURE__*/React__default['default'].createElement("circle", {
|
|
14643
|
-
cx: "105",
|
|
14644
|
-
cy: "15",
|
|
14645
|
-
r: props.radius + 6
|
|
14646
|
-
}, /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
14647
|
-
attributeName: "r",
|
|
14648
|
-
from: "15",
|
|
14649
|
-
to: "15",
|
|
14650
|
-
begin: "0s",
|
|
14651
|
-
dur: "0.8s",
|
|
14652
|
-
values: "15;9;15",
|
|
14653
|
-
calcMode: "linear",
|
|
14654
|
-
repeatCount: "indefinite"
|
|
14655
|
-
}), /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
14656
|
-
attributeName: "fillOpacity",
|
|
14657
|
-
from: "1",
|
|
14658
|
-
to: "1",
|
|
14659
|
-
begin: "0s",
|
|
14660
|
-
dur: "0.8s",
|
|
14661
|
-
values: "1;.5;1",
|
|
14662
|
-
calcMode: "linear",
|
|
14663
|
-
repeatCount: "indefinite"
|
|
14664
|
-
}))));
|
|
14665
|
-
Loader.defaultProps = {
|
|
14666
|
-
height: 50,
|
|
14667
|
-
width: 35,
|
|
14668
|
-
color: "#32aea1",
|
|
14669
|
-
label: "Loading data..",
|
|
14670
|
-
radius: 9
|
|
14671
|
-
};
|
|
14672
|
-
|
|
14673
14609
|
function FirstName({
|
|
14610
|
+
initWithUserFirstName = true,
|
|
14674
14611
|
store,
|
|
14675
14612
|
...otherProps
|
|
14676
14613
|
}) {
|
|
14614
|
+
const {
|
|
14615
|
+
t
|
|
14616
|
+
} = useTranslation("common");
|
|
14677
14617
|
const {
|
|
14678
14618
|
dispatch,
|
|
14679
|
-
state
|
|
14619
|
+
state: {
|
|
14620
|
+
firstName: stateFirstName,
|
|
14621
|
+
firstNameError
|
|
14622
|
+
}
|
|
14680
14623
|
} = React.useContext(store);
|
|
14624
|
+
const [firstName, setFirstName] = React.useState(stateFirstName);
|
|
14625
|
+
const [finishedTyping, setFinishedTyping] = React.useState(false);
|
|
14626
|
+
const handleInputChange = React.useCallback(value => {
|
|
14627
|
+
setFirstName(value);
|
|
14681
14628
|
|
|
14682
|
-
|
|
14629
|
+
if (finishedTyping) {
|
|
14630
|
+
if (firstName !== null && firstName !== void 0 && firstName.length) {
|
|
14631
|
+
dispatch({
|
|
14632
|
+
type: SET_FIRST_NAME,
|
|
14633
|
+
payload: firstName
|
|
14634
|
+
});
|
|
14635
|
+
} else {
|
|
14636
|
+
if (otherProps.required) {
|
|
14637
|
+
dispatch({
|
|
14638
|
+
type: SET_FIRST_NAME_ERROR,
|
|
14639
|
+
payload: t("validation.enterFirstName")
|
|
14640
|
+
});
|
|
14641
|
+
} else {
|
|
14642
|
+
dispatch({
|
|
14643
|
+
type: SET_FIRST_NAME,
|
|
14644
|
+
payload: firstName
|
|
14645
|
+
});
|
|
14646
|
+
}
|
|
14647
|
+
}
|
|
14648
|
+
}
|
|
14649
|
+
}, [dispatch, firstName, finishedTyping]);
|
|
14650
|
+
React.useEffect(() => {
|
|
14651
|
+
handleInputChange(firstName);
|
|
14652
|
+
}, [finishedTyping, firstName, handleInputChange]); // Initialize first name field with user's first name
|
|
14653
|
+
|
|
14654
|
+
const loadFirstNameIntoField = () => {
|
|
14655
|
+
handleInputChange(window.Pelcro.user.read().first_name);
|
|
14683
14656
|
dispatch({
|
|
14684
14657
|
type: SET_FIRST_NAME,
|
|
14685
|
-
payload:
|
|
14658
|
+
payload: window.Pelcro.user.read().first_name
|
|
14686
14659
|
});
|
|
14687
14660
|
};
|
|
14688
14661
|
|
|
14689
|
-
|
|
14690
|
-
|
|
14691
|
-
|
|
14692
|
-
|
|
14662
|
+
React.useEffect(() => {
|
|
14663
|
+
if (initWithUserFirstName) {
|
|
14664
|
+
document.addEventListener("PelcroUserLoaded", () => {
|
|
14665
|
+
loadFirstNameIntoField();
|
|
14666
|
+
});
|
|
14667
|
+
loadFirstNameIntoField();
|
|
14668
|
+
return () => {
|
|
14669
|
+
document.removeEventListener("PelcroUserLoaded", handleInputChange);
|
|
14670
|
+
};
|
|
14671
|
+
}
|
|
14672
|
+
}, []);
|
|
14693
14673
|
return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
|
|
14694
14674
|
type: "text",
|
|
14695
|
-
|
|
14696
|
-
|
|
14675
|
+
error: firstNameError,
|
|
14676
|
+
value: firstName,
|
|
14677
|
+
onChange: e => handleInputChange(e.target.value),
|
|
14678
|
+
onBlur: () => setFinishedTyping(true),
|
|
14679
|
+
onFocus: () => setFinishedTyping(false)
|
|
14697
14680
|
}, otherProps));
|
|
14698
14681
|
}
|
|
14699
14682
|
|
|
@@ -14702,29 +14685,76 @@ const RegisterFirstName = props => /*#__PURE__*/React__default['default'].create
|
|
|
14702
14685
|
}, props));
|
|
14703
14686
|
|
|
14704
14687
|
function LastName({
|
|
14688
|
+
initWithUserLastName = true,
|
|
14705
14689
|
store,
|
|
14706
14690
|
...otherProps
|
|
14707
14691
|
}) {
|
|
14692
|
+
const {
|
|
14693
|
+
t
|
|
14694
|
+
} = useTranslation("common");
|
|
14708
14695
|
const {
|
|
14709
14696
|
dispatch,
|
|
14710
|
-
state
|
|
14697
|
+
state: {
|
|
14698
|
+
lastName: stateLastName,
|
|
14699
|
+
lastNameError
|
|
14700
|
+
}
|
|
14711
14701
|
} = React.useContext(store);
|
|
14702
|
+
const [lastName, setLastName] = React.useState(stateLastName);
|
|
14703
|
+
const [finishedTyping, setFinishedTyping] = React.useState(false);
|
|
14704
|
+
const handleInputChange = React.useCallback(value => {
|
|
14705
|
+
setLastName(value);
|
|
14712
14706
|
|
|
14713
|
-
|
|
14707
|
+
if (finishedTyping) {
|
|
14708
|
+
if (lastName !== null && lastName !== void 0 && lastName.length) {
|
|
14709
|
+
dispatch({
|
|
14710
|
+
type: SET_LAST_NAME,
|
|
14711
|
+
payload: lastName
|
|
14712
|
+
});
|
|
14713
|
+
} else {
|
|
14714
|
+
if (otherProps.required) {
|
|
14715
|
+
dispatch({
|
|
14716
|
+
type: SET_LAST_NAME_ERROR,
|
|
14717
|
+
payload: t("validation.enterLastName")
|
|
14718
|
+
});
|
|
14719
|
+
} else {
|
|
14720
|
+
dispatch({
|
|
14721
|
+
type: SET_LAST_NAME,
|
|
14722
|
+
payload: lastName
|
|
14723
|
+
});
|
|
14724
|
+
}
|
|
14725
|
+
}
|
|
14726
|
+
}
|
|
14727
|
+
}, [dispatch, lastName, finishedTyping]);
|
|
14728
|
+
React.useEffect(() => {
|
|
14729
|
+
handleInputChange(lastName);
|
|
14730
|
+
}, [finishedTyping, lastName, handleInputChange]); // Initialize last name field with user's last name
|
|
14731
|
+
|
|
14732
|
+
const loadLastNameIntoField = () => {
|
|
14733
|
+
handleInputChange(window.Pelcro.user.read().last_name);
|
|
14714
14734
|
dispatch({
|
|
14715
14735
|
type: SET_LAST_NAME,
|
|
14716
|
-
payload:
|
|
14736
|
+
payload: window.Pelcro.user.read().last_name
|
|
14717
14737
|
});
|
|
14718
14738
|
};
|
|
14719
14739
|
|
|
14720
|
-
|
|
14721
|
-
|
|
14722
|
-
|
|
14723
|
-
|
|
14740
|
+
React.useEffect(() => {
|
|
14741
|
+
if (initWithUserLastName) {
|
|
14742
|
+
document.addEventListener("PelcroUserLoaded", () => {
|
|
14743
|
+
loadLastNameIntoField();
|
|
14744
|
+
});
|
|
14745
|
+
loadLastNameIntoField();
|
|
14746
|
+
return () => {
|
|
14747
|
+
document.removeEventListener("PelcroUserLoaded", handleInputChange);
|
|
14748
|
+
};
|
|
14749
|
+
}
|
|
14750
|
+
}, []);
|
|
14724
14751
|
return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
|
|
14725
14752
|
type: "text",
|
|
14726
|
-
|
|
14727
|
-
|
|
14753
|
+
error: lastNameError,
|
|
14754
|
+
value: lastName,
|
|
14755
|
+
onChange: e => handleInputChange(e.target.value),
|
|
14756
|
+
onBlur: () => setFinishedTyping(true),
|
|
14757
|
+
onFocus: () => setFinishedTyping(false)
|
|
14728
14758
|
}, otherProps));
|
|
14729
14759
|
}
|
|
14730
14760
|
|
|
@@ -14817,6 +14847,93 @@ function hasSecurityTokenEnabled() {
|
|
|
14817
14847
|
return Boolean((_window$Pelcro$site = window.Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : (_window$Pelcro$site$r4 = _window$Pelcro$site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.security_key);
|
|
14818
14848
|
}
|
|
14819
14849
|
|
|
14850
|
+
const Loader = props => /*#__PURE__*/React__default['default'].createElement("div", {
|
|
14851
|
+
className: `pelcro-loader-wrapper ${props.className}`
|
|
14852
|
+
}, /*#__PURE__*/React__default['default'].createElement("svg", {
|
|
14853
|
+
width: props.width,
|
|
14854
|
+
height: props.height,
|
|
14855
|
+
viewBox: "0 0 120 30",
|
|
14856
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
14857
|
+
fill: "currentColor",
|
|
14858
|
+
"aria-label": props.label
|
|
14859
|
+
}, /*#__PURE__*/React__default['default'].createElement("circle", {
|
|
14860
|
+
cx: "15",
|
|
14861
|
+
cy: "15",
|
|
14862
|
+
r: props.radius + 6
|
|
14863
|
+
}, /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
14864
|
+
attributeName: "r",
|
|
14865
|
+
from: "15",
|
|
14866
|
+
to: "15",
|
|
14867
|
+
begin: "0s",
|
|
14868
|
+
dur: "0.8s",
|
|
14869
|
+
values: "15;9;15",
|
|
14870
|
+
calcMode: "linear",
|
|
14871
|
+
repeatCount: "indefinite"
|
|
14872
|
+
}), /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
14873
|
+
attributeName: "fillOpacity",
|
|
14874
|
+
from: "1",
|
|
14875
|
+
to: "1",
|
|
14876
|
+
begin: "0s",
|
|
14877
|
+
dur: "0.8s",
|
|
14878
|
+
values: "1;.5;1",
|
|
14879
|
+
calcMode: "linear",
|
|
14880
|
+
repeatCount: "indefinite"
|
|
14881
|
+
})), /*#__PURE__*/React__default['default'].createElement("circle", {
|
|
14882
|
+
cx: "60",
|
|
14883
|
+
cy: "15",
|
|
14884
|
+
r: props.radius,
|
|
14885
|
+
attributeName: "fillOpacity",
|
|
14886
|
+
from: "1",
|
|
14887
|
+
to: "0.3"
|
|
14888
|
+
}, /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
14889
|
+
attributeName: "r",
|
|
14890
|
+
from: "9",
|
|
14891
|
+
to: "9",
|
|
14892
|
+
begin: "0s",
|
|
14893
|
+
dur: "0.8s",
|
|
14894
|
+
values: "9;15;9",
|
|
14895
|
+
calcMode: "linear",
|
|
14896
|
+
repeatCount: "indefinite"
|
|
14897
|
+
}), /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
14898
|
+
attributeName: "fillOpacity",
|
|
14899
|
+
from: "0.5",
|
|
14900
|
+
to: "0.5",
|
|
14901
|
+
begin: "0s",
|
|
14902
|
+
dur: "0.8s",
|
|
14903
|
+
values: ".5;1;.5",
|
|
14904
|
+
calcMode: "linear",
|
|
14905
|
+
repeatCount: "indefinite"
|
|
14906
|
+
})), /*#__PURE__*/React__default['default'].createElement("circle", {
|
|
14907
|
+
cx: "105",
|
|
14908
|
+
cy: "15",
|
|
14909
|
+
r: props.radius + 6
|
|
14910
|
+
}, /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
14911
|
+
attributeName: "r",
|
|
14912
|
+
from: "15",
|
|
14913
|
+
to: "15",
|
|
14914
|
+
begin: "0s",
|
|
14915
|
+
dur: "0.8s",
|
|
14916
|
+
values: "15;9;15",
|
|
14917
|
+
calcMode: "linear",
|
|
14918
|
+
repeatCount: "indefinite"
|
|
14919
|
+
}), /*#__PURE__*/React__default['default'].createElement("animate", {
|
|
14920
|
+
attributeName: "fillOpacity",
|
|
14921
|
+
from: "1",
|
|
14922
|
+
to: "1",
|
|
14923
|
+
begin: "0s",
|
|
14924
|
+
dur: "0.8s",
|
|
14925
|
+
values: "1;.5;1",
|
|
14926
|
+
calcMode: "linear",
|
|
14927
|
+
repeatCount: "indefinite"
|
|
14928
|
+
}))));
|
|
14929
|
+
Loader.defaultProps = {
|
|
14930
|
+
height: 50,
|
|
14931
|
+
width: 35,
|
|
14932
|
+
color: "#32aea1",
|
|
14933
|
+
label: "Loading data..",
|
|
14934
|
+
radius: 9
|
|
14935
|
+
};
|
|
14936
|
+
|
|
14820
14937
|
function TextInput({
|
|
14821
14938
|
store,
|
|
14822
14939
|
fieldName,
|
|
@@ -26670,20 +26787,18 @@ const SelectedAddress = ({
|
|
|
26670
26787
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
26671
26788
|
className: "plc-p-4 plc-my-4 last:plc-mb-0 plc-rounded plc-text-gray-900 pelcro-address-wrapper plc-shadow-md_dark plc-relative"
|
|
26672
26789
|
}, address && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
26673
|
-
className: "pelcro-select-address-radio plc-order-2",
|
|
26674
|
-
id: `pelcro-address-select-${address.id}`,
|
|
26675
26790
|
name: "address"
|
|
26676
26791
|
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
26677
26792
|
className: "pelcro-address-name plc-font-semibold"
|
|
26678
|
-
}, t("labels.checkout.billingAddress")), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
26793
|
+
}, t("labels.checkout.billingAddress")), /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
26679
26794
|
className: "pelcro-address-company"
|
|
26680
26795
|
}, address.company), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
26681
|
-
className: "pelcro-address-
|
|
26796
|
+
className: "pelcro-address-name plc-text-sm plc-mt-2"
|
|
26797
|
+
}, address.first_name, " ", address.last_name), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
26798
|
+
className: "pelcro-address-line1 plc-text-sm"
|
|
26682
26799
|
}, address.line1), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
26683
26800
|
className: "pelcro-address-country plc-text-sm"
|
|
26684
|
-
}, address.city, ", ", address.
|
|
26685
|
-
className: "pelcro-address-phone plc-text-sm"
|
|
26686
|
-
}, address === null || address === void 0 ? void 0 : address.phone)), /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
26801
|
+
}, address.city, ", ", address.state, " ", address.postal_code, ",", " ", address.country, ", ", address === null || address === void 0 ? void 0 : address.phone))), /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
26687
26802
|
onClick: onAddNewAddress,
|
|
26688
26803
|
disabled: isLoading,
|
|
26689
26804
|
variant: "ghost",
|
|
@@ -28305,33 +28420,34 @@ const MeterModal = props => {
|
|
|
28305
28420
|
};
|
|
28306
28421
|
MeterModal.viewId = "meter";
|
|
28307
28422
|
|
|
28308
|
-
const
|
|
28309
|
-
|
|
28310
|
-
onFailure = () => {}
|
|
28311
|
-
}) => {
|
|
28312
|
-
var _window$Pelcro, _window$Pelcro$uiSett;
|
|
28423
|
+
const SubscriptionCreateSummary = () => {
|
|
28424
|
+
var _window$Pelcro$user$r, _window, _window$Pelcro, _window$Pelcro$user, _window$Pelcro$user$r2, _window2, _window2$Pelcro, _window2$Pelcro$user, _addresses$find, _addresses$find2;
|
|
28313
28425
|
|
|
28314
28426
|
const {
|
|
28315
28427
|
t
|
|
28316
28428
|
} = useTranslation("checkoutForm");
|
|
28317
28429
|
const {
|
|
28318
28430
|
product,
|
|
28319
|
-
plan
|
|
28431
|
+
plan,
|
|
28432
|
+
selectedAddressId
|
|
28320
28433
|
} = usePelcro();
|
|
28321
|
-
const
|
|
28322
|
-
|
|
28434
|
+
const {
|
|
28435
|
+
addresses
|
|
28436
|
+
} = (_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 : [];
|
|
28437
|
+
const user = (_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.read()) !== null && _window$Pelcro$user$r2 !== void 0 ? _window$Pelcro$user$r2 : [];
|
|
28438
|
+
const address = selectedAddressId ? (_addresses$find = addresses === null || addresses === void 0 ? void 0 : addresses.find(address => address.id == selectedAddressId)) !== null && _addresses$find !== void 0 ? _addresses$find : null : (_addresses$find2 = addresses === null || addresses === void 0 ? void 0 : addresses.find(address => address.type == "shipping" && address.is_default)) !== null && _addresses$find2 !== void 0 ? _addresses$find2 : null;
|
|
28323
28439
|
|
|
28324
28440
|
const getPricingText = plan => {
|
|
28325
28441
|
var _plan$quantity;
|
|
28326
28442
|
|
|
28327
28443
|
const autoRenewed = plan.auto_renew;
|
|
28328
28444
|
const {
|
|
28329
|
-
interval_translated,
|
|
28330
|
-
interval_count
|
|
28445
|
+
interval_translated: intervalTranslated,
|
|
28446
|
+
interval_count: intervalCount
|
|
28331
28447
|
} = plan;
|
|
28332
28448
|
const intervalText = t("labels.interval", {
|
|
28333
|
-
interval:
|
|
28334
|
-
count:
|
|
28449
|
+
interval: intervalTranslated,
|
|
28450
|
+
count: intervalCount
|
|
28335
28451
|
});
|
|
28336
28452
|
const priceFormatted = getFormattedPriceByLocal((plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1), plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
|
|
28337
28453
|
return /*#__PURE__*/React__default['default'].createElement("p", {
|
|
@@ -28345,9 +28461,7 @@ const SubscriptionCreateView = ({
|
|
|
28345
28461
|
}, autoRenewed ? "/" : t("labels.for"), " ", intervalText));
|
|
28346
28462
|
};
|
|
28347
28463
|
|
|
28348
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28349
|
-
id: "pelcro-subscription-create-view"
|
|
28350
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28464
|
+
return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28351
28465
|
className: "plc-flex plc-flex-row plc-items-center plc-mb-6 plc-text-left plc-text-gray-900 pelcro-title-wrapper"
|
|
28352
28466
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28353
28467
|
className: "plc-w-full plc-font-semibold plc-text-left plc-text-gray-900"
|
|
@@ -28359,7 +28473,49 @@ const SubscriptionCreateView = ({
|
|
|
28359
28473
|
src: product.image,
|
|
28360
28474
|
alt: "",
|
|
28361
28475
|
className: "plc-rounded-md"
|
|
28362
|
-
}))), /*#__PURE__*/React__default['default'].createElement(
|
|
28476
|
+
}))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28477
|
+
className: "plc-flex plc-flex-row plc-justify-between"
|
|
28478
|
+
}, address && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28479
|
+
className: "pelcro-select-address-radio plc-order-2",
|
|
28480
|
+
id: `pelcro-address-select-${address === null || address === void 0 ? void 0 : address.id}`,
|
|
28481
|
+
name: "address"
|
|
28482
|
+
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
28483
|
+
className: "pelcro-address-name plc-font-semibold"
|
|
28484
|
+
}, t("labels.shippingAddress")), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
28485
|
+
className: "pelcro-address-company"
|
|
28486
|
+
}, address === null || address === void 0 ? void 0 : address.company), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
28487
|
+
className: "pelcro-address-name plc-text-sm plc-mt-1"
|
|
28488
|
+
}, address === null || address === void 0 ? void 0 : address.first_name, " ", address === null || address === void 0 ? void 0 : address.last_name), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
28489
|
+
className: "pelcro-address-line1 plc-text-sm"
|
|
28490
|
+
}, address === null || address === void 0 ? void 0 : address.line1), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
28491
|
+
className: "pelcro-address-country plc-text-sm"
|
|
28492
|
+
}, address === null || address === void 0 ? void 0 : address.city, ", ", address === null || address === void 0 ? void 0 : address.state, " ", address === null || address === void 0 ? void 0 : address.postal_code, ", ", address === null || address === void 0 ? void 0 : address.country))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28493
|
+
className: "pelcro-select-address-radio plc-order-2",
|
|
28494
|
+
id: `pelcro-address-select-${address === null || address === void 0 ? void 0 : address.id}`,
|
|
28495
|
+
name: "address"
|
|
28496
|
+
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
28497
|
+
className: "pelcro-address-name plc-font-semibold"
|
|
28498
|
+
}, t("labels.contactDetails")), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
28499
|
+
className: "pelcro-address-name plc-text-sm plc-mt-1"
|
|
28500
|
+
}, user.email), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
28501
|
+
className: "pelcro-address-line1 plc-text-sm"
|
|
28502
|
+
}, address === null || address === void 0 ? void 0 : address.phone))));
|
|
28503
|
+
};
|
|
28504
|
+
|
|
28505
|
+
const SubscriptionCreateView = ({
|
|
28506
|
+
onSuccess = () => {},
|
|
28507
|
+
onFailure = () => {}
|
|
28508
|
+
}) => {
|
|
28509
|
+
var _window$Pelcro, _window$Pelcro$uiSett;
|
|
28510
|
+
|
|
28511
|
+
const {
|
|
28512
|
+
plan
|
|
28513
|
+
} = usePelcro();
|
|
28514
|
+
const skipPayment = (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) === null || _window$Pelcro$uiSett === void 0 ? void 0 : _window$Pelcro$uiSett.skipPaymentForFreePlans;
|
|
28515
|
+
const showSubscriptionButton = skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0;
|
|
28516
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
28517
|
+
id: "pelcro-subscription-create-view"
|
|
28518
|
+
}, /*#__PURE__*/React__default['default'].createElement(SubscriptionCreateSummary, null), /*#__PURE__*/React__default['default'].createElement(PaymentMethodView, {
|
|
28363
28519
|
type: "createPayment",
|
|
28364
28520
|
showCoupon: true,
|
|
28365
28521
|
showExternalPaymentMethods: true,
|
|
@@ -28912,6 +29068,7 @@ const initialState$h = {
|
|
|
28912
29068
|
email: (_window$Pelcro$user$r$1 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r$1 === void 0 ? void 0 : _window$Pelcro$user$r$1.email,
|
|
28913
29069
|
emailError: null,
|
|
28914
29070
|
firstName: (_window$Pelcro$user$r2$1 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r2$1 === void 0 ? void 0 : _window$Pelcro$user$r2$1.first_name,
|
|
29071
|
+
firstNameError: null,
|
|
28915
29072
|
lastName: (_window$Pelcro$user$r3 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r3 === void 0 ? void 0 : _window$Pelcro$user$r3.last_name,
|
|
28916
29073
|
lastNameError: null,
|
|
28917
29074
|
username: (_window$Pelcro$user$r4 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r4 === void 0 ? void 0 : _window$Pelcro$user$r4.username,
|
|
@@ -29043,17 +29200,26 @@ const UserUpdateContainer = ({
|
|
|
29043
29200
|
|
|
29044
29201
|
case SET_EMAIL:
|
|
29045
29202
|
return lib_7({ ...state,
|
|
29046
|
-
email: action.payload
|
|
29203
|
+
email: action.payload,
|
|
29204
|
+
emailError: null
|
|
29047
29205
|
});
|
|
29048
29206
|
|
|
29049
29207
|
case SET_EMAIL_ERROR:
|
|
29050
29208
|
return lib_7({ ...state,
|
|
29051
|
-
emailError: action.payload
|
|
29209
|
+
emailError: action.payload,
|
|
29210
|
+
email: ""
|
|
29052
29211
|
});
|
|
29053
29212
|
|
|
29054
29213
|
case SET_FIRST_NAME:
|
|
29055
29214
|
return lib_7({ ...state,
|
|
29056
|
-
firstName: action.payload
|
|
29215
|
+
firstName: action.payload,
|
|
29216
|
+
firstNameError: null
|
|
29217
|
+
});
|
|
29218
|
+
|
|
29219
|
+
case SET_FIRST_NAME_ERROR:
|
|
29220
|
+
return lib_7({ ...state,
|
|
29221
|
+
firstNameError: action.payload,
|
|
29222
|
+
firstName: ""
|
|
29057
29223
|
});
|
|
29058
29224
|
|
|
29059
29225
|
case SET_DISPLAY_NAME:
|
|
@@ -29063,7 +29229,14 @@ const UserUpdateContainer = ({
|
|
|
29063
29229
|
|
|
29064
29230
|
case SET_LAST_NAME:
|
|
29065
29231
|
return lib_7({ ...state,
|
|
29066
|
-
lastName: action.payload
|
|
29232
|
+
lastName: action.payload,
|
|
29233
|
+
lastNameError: null
|
|
29234
|
+
});
|
|
29235
|
+
|
|
29236
|
+
case SET_LAST_NAME_ERROR:
|
|
29237
|
+
return lib_7({ ...state,
|
|
29238
|
+
lastNameError: action.payload,
|
|
29239
|
+
lastName: ""
|
|
29067
29240
|
});
|
|
29068
29241
|
|
|
29069
29242
|
case SET_USERNAME:
|
|
@@ -29429,8 +29602,6 @@ const nowDate$1 = new Date();
|
|
|
29429
29602
|
const nowDateISO$1 = nowDate$1.toISOString().substr(0, 10);
|
|
29430
29603
|
const hundredYearsFromNowDateISO = new Date(new Date().setFullYear(nowDate$1.getFullYear() - 100)).toISOString().substr(0, 10);
|
|
29431
29604
|
const UserUpdateDateOfBirth = props => {
|
|
29432
|
-
var _state$dateOfBirth;
|
|
29433
|
-
|
|
29434
29605
|
// const { t } = useTranslation("userEdit");
|
|
29435
29606
|
const {
|
|
29436
29607
|
dispatch,
|
|
@@ -29451,7 +29622,7 @@ const UserUpdateDateOfBirth = props => {
|
|
|
29451
29622
|
return /*#__PURE__*/React__default['default'].createElement(DatePicker, Object.assign({
|
|
29452
29623
|
min: hundredYearsFromNowDateISO,
|
|
29453
29624
|
max: nowDateISO$1,
|
|
29454
|
-
value:
|
|
29625
|
+
value: state.dateOfBirth,
|
|
29455
29626
|
onChange: e => handleInputChange(e.target.value) // tooltipText={t("labels.dateOfBirth")}
|
|
29456
29627
|
|
|
29457
29628
|
}, props));
|
|
@@ -31093,13 +31264,6 @@ function AddressUpdatePhone(props) {
|
|
|
31093
31264
|
}
|
|
31094
31265
|
} = React.useContext(store$f);
|
|
31095
31266
|
|
|
31096
|
-
const handleBlur = () => {
|
|
31097
|
-
return dispatch({
|
|
31098
|
-
type: VALIDATE_FIELD,
|
|
31099
|
-
payload: "phone"
|
|
31100
|
-
});
|
|
31101
|
-
};
|
|
31102
|
-
|
|
31103
31267
|
const handleInputChange = value => {
|
|
31104
31268
|
dispatch({
|
|
31105
31269
|
type: SET_TEXT_FIELD,
|
|
@@ -31124,7 +31288,6 @@ function AddressUpdatePhone(props) {
|
|
|
31124
31288
|
value: phone,
|
|
31125
31289
|
error: phoneError,
|
|
31126
31290
|
onChange: e => handleInputChange(e.target.value),
|
|
31127
|
-
onBlur: handleBlur,
|
|
31128
31291
|
onFocus: handleFocus
|
|
31129
31292
|
}, props));
|
|
31130
31293
|
}
|
|
@@ -31187,8 +31350,7 @@ const AddressUpdateView = props => {
|
|
|
31187
31350
|
}, /*#__PURE__*/React__default['default'].createElement(AddressUpdatePhone, {
|
|
31188
31351
|
id: "pelcro-input-phone",
|
|
31189
31352
|
errorId: "pelcro-input-phone-error",
|
|
31190
|
-
label: t("labels.phone")
|
|
31191
|
-
required: true
|
|
31353
|
+
label: t("labels.phone")
|
|
31192
31354
|
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
31193
31355
|
className: "plc-flex plc-space-x-3 plc-items-start plc-mb-3"
|
|
31194
31356
|
}, /*#__PURE__*/React__default['default'].createElement(AddressUpdateSetDefault, {
|
|
@@ -36215,10 +36377,6 @@ const DashboardContent = ({
|
|
|
36215
36377
|
type: CLOSE_DASHBOARD
|
|
36216
36378
|
});
|
|
36217
36379
|
};
|
|
36218
|
-
|
|
36219
|
-
const closeSubMenusTab = () => {
|
|
36220
|
-
switchDashboardView(null);
|
|
36221
|
-
}; // useEffect(() => {
|
|
36222
36380
|
// return () => {
|
|
36223
36381
|
// document.removeEventListener("click", hideMenuIfClickedOutside);
|
|
36224
36382
|
// };
|
|
@@ -36278,21 +36436,14 @@ const DashboardContent = ({
|
|
|
36278
36436
|
title: t("labels.logout"),
|
|
36279
36437
|
setActiveDashboardLink: setActiveDashboardLink,
|
|
36280
36438
|
activeDashboardLink: activeDashboardLink
|
|
36281
|
-
}))),
|
|
36439
|
+
}))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
36282
36440
|
id: "pelcro-view-dashboard-submenus",
|
|
36283
36441
|
className: `plc-fixed plc-inset-y-0 plc-h-full lg:plc-w-9/12 plc-w-full plc-bg-gray-100 plc-z-max plc-overflow-auto ${dashboardLayout == "left" ? "plc-right-0" : "plc-left-0"}`
|
|
36284
|
-
}, /*#__PURE__*/React__default['default'].createElement(DashboardViewController, null, subView !== null && subView !== void 0 && subView.length ? subView.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
|
|
36442
|
+
}, dashboardView && isOpen && /*#__PURE__*/React__default['default'].createElement(DashboardViewController, null, subView !== null && subView !== void 0 && subView.length ? subView.map((child, i) => /*#__PURE__*/React__default['default'].cloneElement(child, {
|
|
36285
36443
|
store: store$4,
|
|
36286
36444
|
key: i
|
|
36287
36445
|
})) : /*#__PURE__*/React__default['default'].cloneElement(subView, {
|
|
36288
36446
|
store: store$4
|
|
36289
|
-
})), /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
36290
|
-
variant: "ghost",
|
|
36291
|
-
type: "button",
|
|
36292
|
-
className: `plc-text-gray-500 plc-rounded-2xl plc-absolute plc-z-max plc-top-2 md:plc-top-5 ${dashboardLayout == "left" ? "plc-right-2 md:plc-right-10" : "plc-left-2 md:plc-left-10"}`,
|
|
36293
|
-
onClick: closeSubMenusTab
|
|
36294
|
-
}, /*#__PURE__*/React__default['default'].createElement(SvgXIcon, {
|
|
36295
|
-
className: "plc-fill-current"
|
|
36296
36447
|
}))));
|
|
36297
36448
|
};
|
|
36298
36449
|
|
|
@@ -36985,6 +37136,7 @@ const Card = ({
|
|
|
36985
37136
|
className = "",
|
|
36986
37137
|
title,
|
|
36987
37138
|
requestStates,
|
|
37139
|
+
dashboardLayout,
|
|
36988
37140
|
back,
|
|
36989
37141
|
...restProps
|
|
36990
37142
|
}) => {
|
|
@@ -36992,11 +37144,16 @@ const Card = ({
|
|
|
36992
37144
|
const {
|
|
36993
37145
|
switchDashboardView
|
|
36994
37146
|
} = usePelcro();
|
|
37147
|
+
|
|
37148
|
+
const closeSubMenusTab = () => {
|
|
37149
|
+
switchDashboardView(null);
|
|
37150
|
+
};
|
|
37151
|
+
|
|
36995
37152
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
36996
|
-
className: `plc-bg-white plc-border-2 plc-p-6 md:plc-p-8 plc-rounded plc-my-11 md:plc-mb-20 md:plc-mt-40 ${className}`,
|
|
37153
|
+
className: `plc-relative plc-bg-white plc-border-2 plc-p-6 md:plc-p-8 plc-rounded plc-my-11 md:plc-mb-20 md:plc-mt-40 ${className}`,
|
|
36997
37154
|
id: "plc-dashboard-card"
|
|
36998
37155
|
}, title && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
36999
|
-
className: "plc-flex plc-items-end plc-justify-between plc-border-b-2 plc-border-primary-400 plc-pb-2 plc-mb-10"
|
|
37156
|
+
className: "plc-flex plc-items-end plc-justify-between plc-border-b-2 plc-border-primary-400 plc-pb-2 plc-mb-10 plc-mt-5"
|
|
37000
37157
|
}, /*#__PURE__*/React__default['default'].createElement("h3", {
|
|
37001
37158
|
className: "plc-font-bold plc-text-xl"
|
|
37002
37159
|
}, title), (requestStates === null || requestStates === void 0 ? void 0 : requestStates.loading) && /*#__PURE__*/React__default['default'].createElement("span", {
|
|
@@ -37009,7 +37166,14 @@ const Card = ({
|
|
|
37009
37166
|
onClick: () => {
|
|
37010
37167
|
switchDashboardView(back === null || back === void 0 ? void 0 : back.target);
|
|
37011
37168
|
}
|
|
37012
|
-
}, "Back"))), children
|
|
37169
|
+
}, "Back"))), children, /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
37170
|
+
variant: "ghost",
|
|
37171
|
+
type: "button",
|
|
37172
|
+
className: "plc-text-gray-500 plc-rounded-2xl plc-absolute plc-z-max plc-top-1 plc-right-1",
|
|
37173
|
+
onClick: closeSubMenusTab
|
|
37174
|
+
}, /*#__PURE__*/React__default['default'].createElement(SvgXIcon, {
|
|
37175
|
+
className: "plc-fill-current"
|
|
37176
|
+
})));
|
|
37013
37177
|
};
|
|
37014
37178
|
|
|
37015
37179
|
const ProfileMenu = props => {
|