@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.esm.js
CHANGED
|
@@ -3218,7 +3218,9 @@ var validation$3 = {
|
|
|
3218
3218
|
enterEmails: "Email addresses are required.",
|
|
3219
3219
|
enterUsername: "User name is required.",
|
|
3220
3220
|
enterPassword: "Password is required.",
|
|
3221
|
-
confirmPassword: "Confirm password is required."
|
|
3221
|
+
confirmPassword: "Confirm password is required.",
|
|
3222
|
+
enterFirstName: "First name is required.",
|
|
3223
|
+
enterLastName: "Last name is required."
|
|
3222
3224
|
};
|
|
3223
3225
|
var buttons$j = {
|
|
3224
3226
|
account: "My account",
|
|
@@ -3446,7 +3448,9 @@ var labels$11 = {
|
|
|
3446
3448
|
lastName: "Last name",
|
|
3447
3449
|
phone: "Phone",
|
|
3448
3450
|
freeItems: "Free Items",
|
|
3449
|
-
isDefault: "Set as default"
|
|
3451
|
+
isDefault: "Set as default",
|
|
3452
|
+
shippingAddress: "Shipping Address",
|
|
3453
|
+
contactDetails: "Contact Details"
|
|
3450
3454
|
};
|
|
3451
3455
|
var checkoutForm_en = {
|
|
3452
3456
|
messages: messages$14,
|
|
@@ -3827,6 +3831,7 @@ var labels$W = {
|
|
|
3827
3831
|
},
|
|
3828
3832
|
checkout: {
|
|
3829
3833
|
title: "Payment Information",
|
|
3834
|
+
shippingAddress: "Shipping Address",
|
|
3830
3835
|
billingAddress: "Billing Address",
|
|
3831
3836
|
NoBillingAddress: "No Billing Address Found",
|
|
3832
3837
|
changeBillingAddress: "Change",
|
|
@@ -4135,7 +4140,9 @@ var validation$2 = {
|
|
|
4135
4140
|
enterEmails: "Les adresses e-mail sont obligatoires.",
|
|
4136
4141
|
enterUsername: "Nom d'utilisateur est nécessaire.",
|
|
4137
4142
|
enterPassword: "Mot de passe requis.",
|
|
4138
|
-
confirmPassword: "Confirmer le mot de passe requis."
|
|
4143
|
+
confirmPassword: "Confirmer le mot de passe requis.",
|
|
4144
|
+
enterFirstName: "Le prénom est requis.",
|
|
4145
|
+
enterLastName: "Le nom de famille est requis."
|
|
4139
4146
|
};
|
|
4140
4147
|
var buttons$e = {
|
|
4141
4148
|
account: "Accès abonné(e)s",
|
|
@@ -13545,6 +13552,8 @@ const initialState$n = {
|
|
|
13545
13552
|
password: "",
|
|
13546
13553
|
emailError: null,
|
|
13547
13554
|
passwordError: null,
|
|
13555
|
+
firstNameError: null,
|
|
13556
|
+
lastNameError: null,
|
|
13548
13557
|
confirmPassword: "",
|
|
13549
13558
|
confirmPasswordError: null,
|
|
13550
13559
|
confirmPasswordUsed: false,
|
|
@@ -13703,12 +13712,14 @@ const RegisterContainer = ({
|
|
|
13703
13712
|
|
|
13704
13713
|
case SET_FIRST_NAME:
|
|
13705
13714
|
return lib_7({ ...state,
|
|
13706
|
-
firstName: action.payload
|
|
13715
|
+
firstName: action.payload,
|
|
13716
|
+
firstNameError: null
|
|
13707
13717
|
});
|
|
13708
13718
|
|
|
13709
13719
|
case SET_LAST_NAME:
|
|
13710
13720
|
return lib_7({ ...state,
|
|
13711
|
-
lastName: action.payload
|
|
13721
|
+
lastName: action.payload,
|
|
13722
|
+
lastNameError: null
|
|
13712
13723
|
});
|
|
13713
13724
|
|
|
13714
13725
|
case SET_TEXT_FIELD:
|
|
@@ -13734,6 +13745,18 @@ const RegisterContainer = ({
|
|
|
13734
13745
|
password: ""
|
|
13735
13746
|
});
|
|
13736
13747
|
|
|
13748
|
+
case SET_FIRST_NAME_ERROR:
|
|
13749
|
+
return lib_7({ ...state,
|
|
13750
|
+
firstNameError: action.payload,
|
|
13751
|
+
firstName: ""
|
|
13752
|
+
});
|
|
13753
|
+
|
|
13754
|
+
case SET_LAST_NAME_ERROR:
|
|
13755
|
+
return lib_7({ ...state,
|
|
13756
|
+
lastNameError: action.payload,
|
|
13757
|
+
lastName: ""
|
|
13758
|
+
});
|
|
13759
|
+
|
|
13737
13760
|
case SET_CONFIRM_PASSWORD_ERROR:
|
|
13738
13761
|
return lib_7({ ...state,
|
|
13739
13762
|
confirmPasswordError: action.payload,
|
|
@@ -14553,117 +14576,77 @@ const RegisterButton = ({
|
|
|
14553
14576
|
}, otherProps), name !== null && name !== void 0 ? name : t("messages.createAccount"));
|
|
14554
14577
|
};
|
|
14555
14578
|
|
|
14556
|
-
const Loader = props => /*#__PURE__*/React__default.createElement("div", {
|
|
14557
|
-
className: `pelcro-loader-wrapper ${props.className}`
|
|
14558
|
-
}, /*#__PURE__*/React__default.createElement("svg", {
|
|
14559
|
-
width: props.width,
|
|
14560
|
-
height: props.height,
|
|
14561
|
-
viewBox: "0 0 120 30",
|
|
14562
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
14563
|
-
fill: "currentColor",
|
|
14564
|
-
"aria-label": props.label
|
|
14565
|
-
}, /*#__PURE__*/React__default.createElement("circle", {
|
|
14566
|
-
cx: "15",
|
|
14567
|
-
cy: "15",
|
|
14568
|
-
r: props.radius + 6
|
|
14569
|
-
}, /*#__PURE__*/React__default.createElement("animate", {
|
|
14570
|
-
attributeName: "r",
|
|
14571
|
-
from: "15",
|
|
14572
|
-
to: "15",
|
|
14573
|
-
begin: "0s",
|
|
14574
|
-
dur: "0.8s",
|
|
14575
|
-
values: "15;9;15",
|
|
14576
|
-
calcMode: "linear",
|
|
14577
|
-
repeatCount: "indefinite"
|
|
14578
|
-
}), /*#__PURE__*/React__default.createElement("animate", {
|
|
14579
|
-
attributeName: "fillOpacity",
|
|
14580
|
-
from: "1",
|
|
14581
|
-
to: "1",
|
|
14582
|
-
begin: "0s",
|
|
14583
|
-
dur: "0.8s",
|
|
14584
|
-
values: "1;.5;1",
|
|
14585
|
-
calcMode: "linear",
|
|
14586
|
-
repeatCount: "indefinite"
|
|
14587
|
-
})), /*#__PURE__*/React__default.createElement("circle", {
|
|
14588
|
-
cx: "60",
|
|
14589
|
-
cy: "15",
|
|
14590
|
-
r: props.radius,
|
|
14591
|
-
attributeName: "fillOpacity",
|
|
14592
|
-
from: "1",
|
|
14593
|
-
to: "0.3"
|
|
14594
|
-
}, /*#__PURE__*/React__default.createElement("animate", {
|
|
14595
|
-
attributeName: "r",
|
|
14596
|
-
from: "9",
|
|
14597
|
-
to: "9",
|
|
14598
|
-
begin: "0s",
|
|
14599
|
-
dur: "0.8s",
|
|
14600
|
-
values: "9;15;9",
|
|
14601
|
-
calcMode: "linear",
|
|
14602
|
-
repeatCount: "indefinite"
|
|
14603
|
-
}), /*#__PURE__*/React__default.createElement("animate", {
|
|
14604
|
-
attributeName: "fillOpacity",
|
|
14605
|
-
from: "0.5",
|
|
14606
|
-
to: "0.5",
|
|
14607
|
-
begin: "0s",
|
|
14608
|
-
dur: "0.8s",
|
|
14609
|
-
values: ".5;1;.5",
|
|
14610
|
-
calcMode: "linear",
|
|
14611
|
-
repeatCount: "indefinite"
|
|
14612
|
-
})), /*#__PURE__*/React__default.createElement("circle", {
|
|
14613
|
-
cx: "105",
|
|
14614
|
-
cy: "15",
|
|
14615
|
-
r: props.radius + 6
|
|
14616
|
-
}, /*#__PURE__*/React__default.createElement("animate", {
|
|
14617
|
-
attributeName: "r",
|
|
14618
|
-
from: "15",
|
|
14619
|
-
to: "15",
|
|
14620
|
-
begin: "0s",
|
|
14621
|
-
dur: "0.8s",
|
|
14622
|
-
values: "15;9;15",
|
|
14623
|
-
calcMode: "linear",
|
|
14624
|
-
repeatCount: "indefinite"
|
|
14625
|
-
}), /*#__PURE__*/React__default.createElement("animate", {
|
|
14626
|
-
attributeName: "fillOpacity",
|
|
14627
|
-
from: "1",
|
|
14628
|
-
to: "1",
|
|
14629
|
-
begin: "0s",
|
|
14630
|
-
dur: "0.8s",
|
|
14631
|
-
values: "1;.5;1",
|
|
14632
|
-
calcMode: "linear",
|
|
14633
|
-
repeatCount: "indefinite"
|
|
14634
|
-
}))));
|
|
14635
|
-
Loader.defaultProps = {
|
|
14636
|
-
height: 50,
|
|
14637
|
-
width: 35,
|
|
14638
|
-
color: "#32aea1",
|
|
14639
|
-
label: "Loading data..",
|
|
14640
|
-
radius: 9
|
|
14641
|
-
};
|
|
14642
|
-
|
|
14643
14579
|
function FirstName({
|
|
14580
|
+
initWithUserFirstName = true,
|
|
14644
14581
|
store,
|
|
14645
14582
|
...otherProps
|
|
14646
14583
|
}) {
|
|
14584
|
+
const {
|
|
14585
|
+
t
|
|
14586
|
+
} = useTranslation("common");
|
|
14647
14587
|
const {
|
|
14648
14588
|
dispatch,
|
|
14649
|
-
state
|
|
14589
|
+
state: {
|
|
14590
|
+
firstName: stateFirstName,
|
|
14591
|
+
firstNameError
|
|
14592
|
+
}
|
|
14650
14593
|
} = useContext(store);
|
|
14594
|
+
const [firstName, setFirstName] = useState(stateFirstName);
|
|
14595
|
+
const [finishedTyping, setFinishedTyping] = useState(false);
|
|
14596
|
+
const handleInputChange = useCallback(value => {
|
|
14597
|
+
setFirstName(value);
|
|
14651
14598
|
|
|
14652
|
-
|
|
14599
|
+
if (finishedTyping) {
|
|
14600
|
+
if (firstName !== null && firstName !== void 0 && firstName.length) {
|
|
14601
|
+
dispatch({
|
|
14602
|
+
type: SET_FIRST_NAME,
|
|
14603
|
+
payload: firstName
|
|
14604
|
+
});
|
|
14605
|
+
} else {
|
|
14606
|
+
if (otherProps.required) {
|
|
14607
|
+
dispatch({
|
|
14608
|
+
type: SET_FIRST_NAME_ERROR,
|
|
14609
|
+
payload: t("validation.enterFirstName")
|
|
14610
|
+
});
|
|
14611
|
+
} else {
|
|
14612
|
+
dispatch({
|
|
14613
|
+
type: SET_FIRST_NAME,
|
|
14614
|
+
payload: firstName
|
|
14615
|
+
});
|
|
14616
|
+
}
|
|
14617
|
+
}
|
|
14618
|
+
}
|
|
14619
|
+
}, [dispatch, firstName, finishedTyping]);
|
|
14620
|
+
useEffect(() => {
|
|
14621
|
+
handleInputChange(firstName);
|
|
14622
|
+
}, [finishedTyping, firstName, handleInputChange]); // Initialize first name field with user's first name
|
|
14623
|
+
|
|
14624
|
+
const loadFirstNameIntoField = () => {
|
|
14625
|
+
handleInputChange(window.Pelcro.user.read().first_name);
|
|
14653
14626
|
dispatch({
|
|
14654
14627
|
type: SET_FIRST_NAME,
|
|
14655
|
-
payload:
|
|
14628
|
+
payload: window.Pelcro.user.read().first_name
|
|
14656
14629
|
});
|
|
14657
14630
|
};
|
|
14658
14631
|
|
|
14659
|
-
|
|
14660
|
-
|
|
14661
|
-
|
|
14662
|
-
|
|
14632
|
+
useEffect(() => {
|
|
14633
|
+
if (initWithUserFirstName) {
|
|
14634
|
+
document.addEventListener("PelcroUserLoaded", () => {
|
|
14635
|
+
loadFirstNameIntoField();
|
|
14636
|
+
});
|
|
14637
|
+
loadFirstNameIntoField();
|
|
14638
|
+
return () => {
|
|
14639
|
+
document.removeEventListener("PelcroUserLoaded", handleInputChange);
|
|
14640
|
+
};
|
|
14641
|
+
}
|
|
14642
|
+
}, []);
|
|
14663
14643
|
return /*#__PURE__*/React__default.createElement(Input, Object.assign({
|
|
14664
14644
|
type: "text",
|
|
14665
|
-
|
|
14666
|
-
|
|
14645
|
+
error: firstNameError,
|
|
14646
|
+
value: firstName,
|
|
14647
|
+
onChange: e => handleInputChange(e.target.value),
|
|
14648
|
+
onBlur: () => setFinishedTyping(true),
|
|
14649
|
+
onFocus: () => setFinishedTyping(false)
|
|
14667
14650
|
}, otherProps));
|
|
14668
14651
|
}
|
|
14669
14652
|
|
|
@@ -14672,29 +14655,76 @@ const RegisterFirstName = props => /*#__PURE__*/React__default.createElement(Fir
|
|
|
14672
14655
|
}, props));
|
|
14673
14656
|
|
|
14674
14657
|
function LastName({
|
|
14658
|
+
initWithUserLastName = true,
|
|
14675
14659
|
store,
|
|
14676
14660
|
...otherProps
|
|
14677
14661
|
}) {
|
|
14662
|
+
const {
|
|
14663
|
+
t
|
|
14664
|
+
} = useTranslation("common");
|
|
14678
14665
|
const {
|
|
14679
14666
|
dispatch,
|
|
14680
|
-
state
|
|
14667
|
+
state: {
|
|
14668
|
+
lastName: stateLastName,
|
|
14669
|
+
lastNameError
|
|
14670
|
+
}
|
|
14681
14671
|
} = useContext(store);
|
|
14672
|
+
const [lastName, setLastName] = useState(stateLastName);
|
|
14673
|
+
const [finishedTyping, setFinishedTyping] = useState(false);
|
|
14674
|
+
const handleInputChange = useCallback(value => {
|
|
14675
|
+
setLastName(value);
|
|
14682
14676
|
|
|
14683
|
-
|
|
14677
|
+
if (finishedTyping) {
|
|
14678
|
+
if (lastName !== null && lastName !== void 0 && lastName.length) {
|
|
14679
|
+
dispatch({
|
|
14680
|
+
type: SET_LAST_NAME,
|
|
14681
|
+
payload: lastName
|
|
14682
|
+
});
|
|
14683
|
+
} else {
|
|
14684
|
+
if (otherProps.required) {
|
|
14685
|
+
dispatch({
|
|
14686
|
+
type: SET_LAST_NAME_ERROR,
|
|
14687
|
+
payload: t("validation.enterLastName")
|
|
14688
|
+
});
|
|
14689
|
+
} else {
|
|
14690
|
+
dispatch({
|
|
14691
|
+
type: SET_LAST_NAME,
|
|
14692
|
+
payload: lastName
|
|
14693
|
+
});
|
|
14694
|
+
}
|
|
14695
|
+
}
|
|
14696
|
+
}
|
|
14697
|
+
}, [dispatch, lastName, finishedTyping]);
|
|
14698
|
+
useEffect(() => {
|
|
14699
|
+
handleInputChange(lastName);
|
|
14700
|
+
}, [finishedTyping, lastName, handleInputChange]); // Initialize last name field with user's last name
|
|
14701
|
+
|
|
14702
|
+
const loadLastNameIntoField = () => {
|
|
14703
|
+
handleInputChange(window.Pelcro.user.read().last_name);
|
|
14684
14704
|
dispatch({
|
|
14685
14705
|
type: SET_LAST_NAME,
|
|
14686
|
-
payload:
|
|
14706
|
+
payload: window.Pelcro.user.read().last_name
|
|
14687
14707
|
});
|
|
14688
14708
|
};
|
|
14689
14709
|
|
|
14690
|
-
|
|
14691
|
-
|
|
14692
|
-
|
|
14693
|
-
|
|
14710
|
+
useEffect(() => {
|
|
14711
|
+
if (initWithUserLastName) {
|
|
14712
|
+
document.addEventListener("PelcroUserLoaded", () => {
|
|
14713
|
+
loadLastNameIntoField();
|
|
14714
|
+
});
|
|
14715
|
+
loadLastNameIntoField();
|
|
14716
|
+
return () => {
|
|
14717
|
+
document.removeEventListener("PelcroUserLoaded", handleInputChange);
|
|
14718
|
+
};
|
|
14719
|
+
}
|
|
14720
|
+
}, []);
|
|
14694
14721
|
return /*#__PURE__*/React__default.createElement(Input, Object.assign({
|
|
14695
14722
|
type: "text",
|
|
14696
|
-
|
|
14697
|
-
|
|
14723
|
+
error: lastNameError,
|
|
14724
|
+
value: lastName,
|
|
14725
|
+
onChange: e => handleInputChange(e.target.value),
|
|
14726
|
+
onBlur: () => setFinishedTyping(true),
|
|
14727
|
+
onFocus: () => setFinishedTyping(false)
|
|
14698
14728
|
}, otherProps));
|
|
14699
14729
|
}
|
|
14700
14730
|
|
|
@@ -14787,6 +14817,93 @@ function hasSecurityTokenEnabled() {
|
|
|
14787
14817
|
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);
|
|
14788
14818
|
}
|
|
14789
14819
|
|
|
14820
|
+
const Loader = props => /*#__PURE__*/React__default.createElement("div", {
|
|
14821
|
+
className: `pelcro-loader-wrapper ${props.className}`
|
|
14822
|
+
}, /*#__PURE__*/React__default.createElement("svg", {
|
|
14823
|
+
width: props.width,
|
|
14824
|
+
height: props.height,
|
|
14825
|
+
viewBox: "0 0 120 30",
|
|
14826
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
14827
|
+
fill: "currentColor",
|
|
14828
|
+
"aria-label": props.label
|
|
14829
|
+
}, /*#__PURE__*/React__default.createElement("circle", {
|
|
14830
|
+
cx: "15",
|
|
14831
|
+
cy: "15",
|
|
14832
|
+
r: props.radius + 6
|
|
14833
|
+
}, /*#__PURE__*/React__default.createElement("animate", {
|
|
14834
|
+
attributeName: "r",
|
|
14835
|
+
from: "15",
|
|
14836
|
+
to: "15",
|
|
14837
|
+
begin: "0s",
|
|
14838
|
+
dur: "0.8s",
|
|
14839
|
+
values: "15;9;15",
|
|
14840
|
+
calcMode: "linear",
|
|
14841
|
+
repeatCount: "indefinite"
|
|
14842
|
+
}), /*#__PURE__*/React__default.createElement("animate", {
|
|
14843
|
+
attributeName: "fillOpacity",
|
|
14844
|
+
from: "1",
|
|
14845
|
+
to: "1",
|
|
14846
|
+
begin: "0s",
|
|
14847
|
+
dur: "0.8s",
|
|
14848
|
+
values: "1;.5;1",
|
|
14849
|
+
calcMode: "linear",
|
|
14850
|
+
repeatCount: "indefinite"
|
|
14851
|
+
})), /*#__PURE__*/React__default.createElement("circle", {
|
|
14852
|
+
cx: "60",
|
|
14853
|
+
cy: "15",
|
|
14854
|
+
r: props.radius,
|
|
14855
|
+
attributeName: "fillOpacity",
|
|
14856
|
+
from: "1",
|
|
14857
|
+
to: "0.3"
|
|
14858
|
+
}, /*#__PURE__*/React__default.createElement("animate", {
|
|
14859
|
+
attributeName: "r",
|
|
14860
|
+
from: "9",
|
|
14861
|
+
to: "9",
|
|
14862
|
+
begin: "0s",
|
|
14863
|
+
dur: "0.8s",
|
|
14864
|
+
values: "9;15;9",
|
|
14865
|
+
calcMode: "linear",
|
|
14866
|
+
repeatCount: "indefinite"
|
|
14867
|
+
}), /*#__PURE__*/React__default.createElement("animate", {
|
|
14868
|
+
attributeName: "fillOpacity",
|
|
14869
|
+
from: "0.5",
|
|
14870
|
+
to: "0.5",
|
|
14871
|
+
begin: "0s",
|
|
14872
|
+
dur: "0.8s",
|
|
14873
|
+
values: ".5;1;.5",
|
|
14874
|
+
calcMode: "linear",
|
|
14875
|
+
repeatCount: "indefinite"
|
|
14876
|
+
})), /*#__PURE__*/React__default.createElement("circle", {
|
|
14877
|
+
cx: "105",
|
|
14878
|
+
cy: "15",
|
|
14879
|
+
r: props.radius + 6
|
|
14880
|
+
}, /*#__PURE__*/React__default.createElement("animate", {
|
|
14881
|
+
attributeName: "r",
|
|
14882
|
+
from: "15",
|
|
14883
|
+
to: "15",
|
|
14884
|
+
begin: "0s",
|
|
14885
|
+
dur: "0.8s",
|
|
14886
|
+
values: "15;9;15",
|
|
14887
|
+
calcMode: "linear",
|
|
14888
|
+
repeatCount: "indefinite"
|
|
14889
|
+
}), /*#__PURE__*/React__default.createElement("animate", {
|
|
14890
|
+
attributeName: "fillOpacity",
|
|
14891
|
+
from: "1",
|
|
14892
|
+
to: "1",
|
|
14893
|
+
begin: "0s",
|
|
14894
|
+
dur: "0.8s",
|
|
14895
|
+
values: "1;.5;1",
|
|
14896
|
+
calcMode: "linear",
|
|
14897
|
+
repeatCount: "indefinite"
|
|
14898
|
+
}))));
|
|
14899
|
+
Loader.defaultProps = {
|
|
14900
|
+
height: 50,
|
|
14901
|
+
width: 35,
|
|
14902
|
+
color: "#32aea1",
|
|
14903
|
+
label: "Loading data..",
|
|
14904
|
+
radius: 9
|
|
14905
|
+
};
|
|
14906
|
+
|
|
14790
14907
|
function TextInput({
|
|
14791
14908
|
store,
|
|
14792
14909
|
fieldName,
|
|
@@ -26640,20 +26757,18 @@ const SelectedAddress = ({
|
|
|
26640
26757
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
26641
26758
|
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"
|
|
26642
26759
|
}, address && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
26643
|
-
className: "pelcro-select-address-radio plc-order-2",
|
|
26644
|
-
id: `pelcro-address-select-${address.id}`,
|
|
26645
26760
|
name: "address"
|
|
26646
26761
|
}, /*#__PURE__*/React__default.createElement("p", {
|
|
26647
26762
|
className: "pelcro-address-name plc-font-semibold"
|
|
26648
|
-
}, t("labels.checkout.billingAddress")), /*#__PURE__*/React__default.createElement("p", {
|
|
26763
|
+
}, t("labels.checkout.billingAddress")), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("p", {
|
|
26649
26764
|
className: "pelcro-address-company"
|
|
26650
26765
|
}, address.company), /*#__PURE__*/React__default.createElement("p", {
|
|
26651
|
-
className: "pelcro-address-
|
|
26766
|
+
className: "pelcro-address-name plc-text-sm plc-mt-2"
|
|
26767
|
+
}, address.first_name, " ", address.last_name), /*#__PURE__*/React__default.createElement("p", {
|
|
26768
|
+
className: "pelcro-address-line1 plc-text-sm"
|
|
26652
26769
|
}, address.line1), /*#__PURE__*/React__default.createElement("p", {
|
|
26653
26770
|
className: "pelcro-address-country plc-text-sm"
|
|
26654
|
-
}, address.city, ", ", address.
|
|
26655
|
-
className: "pelcro-address-phone plc-text-sm"
|
|
26656
|
-
}, address === null || address === void 0 ? void 0 : address.phone)), /*#__PURE__*/React__default.createElement(Button, {
|
|
26771
|
+
}, address.city, ", ", address.state, " ", address.postal_code, ",", " ", address.country, ", ", address === null || address === void 0 ? void 0 : address.phone))), /*#__PURE__*/React__default.createElement(Button, {
|
|
26657
26772
|
onClick: onAddNewAddress,
|
|
26658
26773
|
disabled: isLoading,
|
|
26659
26774
|
variant: "ghost",
|
|
@@ -28275,33 +28390,34 @@ const MeterModal = props => {
|
|
|
28275
28390
|
};
|
|
28276
28391
|
MeterModal.viewId = "meter";
|
|
28277
28392
|
|
|
28278
|
-
const
|
|
28279
|
-
|
|
28280
|
-
onFailure = () => {}
|
|
28281
|
-
}) => {
|
|
28282
|
-
var _window$Pelcro, _window$Pelcro$uiSett;
|
|
28393
|
+
const SubscriptionCreateSummary = () => {
|
|
28394
|
+
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;
|
|
28283
28395
|
|
|
28284
28396
|
const {
|
|
28285
28397
|
t
|
|
28286
28398
|
} = useTranslation("checkoutForm");
|
|
28287
28399
|
const {
|
|
28288
28400
|
product,
|
|
28289
|
-
plan
|
|
28401
|
+
plan,
|
|
28402
|
+
selectedAddressId
|
|
28290
28403
|
} = usePelcro();
|
|
28291
|
-
const
|
|
28292
|
-
|
|
28404
|
+
const {
|
|
28405
|
+
addresses
|
|
28406
|
+
} = (_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 : [];
|
|
28407
|
+
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 : [];
|
|
28408
|
+
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;
|
|
28293
28409
|
|
|
28294
28410
|
const getPricingText = plan => {
|
|
28295
28411
|
var _plan$quantity;
|
|
28296
28412
|
|
|
28297
28413
|
const autoRenewed = plan.auto_renew;
|
|
28298
28414
|
const {
|
|
28299
|
-
interval_translated,
|
|
28300
|
-
interval_count
|
|
28415
|
+
interval_translated: intervalTranslated,
|
|
28416
|
+
interval_count: intervalCount
|
|
28301
28417
|
} = plan;
|
|
28302
28418
|
const intervalText = t("labels.interval", {
|
|
28303
|
-
interval:
|
|
28304
|
-
count:
|
|
28419
|
+
interval: intervalTranslated,
|
|
28420
|
+
count: intervalCount
|
|
28305
28421
|
});
|
|
28306
28422
|
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());
|
|
28307
28423
|
return /*#__PURE__*/React__default.createElement("p", {
|
|
@@ -28315,9 +28431,7 @@ const SubscriptionCreateView = ({
|
|
|
28315
28431
|
}, autoRenewed ? "/" : t("labels.for"), " ", intervalText));
|
|
28316
28432
|
};
|
|
28317
28433
|
|
|
28318
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
28319
|
-
id: "pelcro-subscription-create-view"
|
|
28320
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
28434
|
+
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
|
|
28321
28435
|
className: "plc-flex plc-flex-row plc-items-center plc-mb-6 plc-text-left plc-text-gray-900 pelcro-title-wrapper"
|
|
28322
28436
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
28323
28437
|
className: "plc-w-full plc-font-semibold plc-text-left plc-text-gray-900"
|
|
@@ -28329,7 +28443,49 @@ const SubscriptionCreateView = ({
|
|
|
28329
28443
|
src: product.image,
|
|
28330
28444
|
alt: "",
|
|
28331
28445
|
className: "plc-rounded-md"
|
|
28332
|
-
}))), /*#__PURE__*/React__default.createElement(
|
|
28446
|
+
}))), /*#__PURE__*/React__default.createElement("div", {
|
|
28447
|
+
className: "plc-flex plc-flex-row plc-justify-between"
|
|
28448
|
+
}, address && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
28449
|
+
className: "pelcro-select-address-radio plc-order-2",
|
|
28450
|
+
id: `pelcro-address-select-${address === null || address === void 0 ? void 0 : address.id}`,
|
|
28451
|
+
name: "address"
|
|
28452
|
+
}, /*#__PURE__*/React__default.createElement("p", {
|
|
28453
|
+
className: "pelcro-address-name plc-font-semibold"
|
|
28454
|
+
}, t("labels.shippingAddress")), /*#__PURE__*/React__default.createElement("p", {
|
|
28455
|
+
className: "pelcro-address-company"
|
|
28456
|
+
}, address === null || address === void 0 ? void 0 : address.company), /*#__PURE__*/React__default.createElement("p", {
|
|
28457
|
+
className: "pelcro-address-name plc-text-sm plc-mt-1"
|
|
28458
|
+
}, address === null || address === void 0 ? void 0 : address.first_name, " ", address === null || address === void 0 ? void 0 : address.last_name), /*#__PURE__*/React__default.createElement("p", {
|
|
28459
|
+
className: "pelcro-address-line1 plc-text-sm"
|
|
28460
|
+
}, address === null || address === void 0 ? void 0 : address.line1), /*#__PURE__*/React__default.createElement("p", {
|
|
28461
|
+
className: "pelcro-address-country plc-text-sm"
|
|
28462
|
+
}, 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.createElement("div", {
|
|
28463
|
+
className: "pelcro-select-address-radio plc-order-2",
|
|
28464
|
+
id: `pelcro-address-select-${address === null || address === void 0 ? void 0 : address.id}`,
|
|
28465
|
+
name: "address"
|
|
28466
|
+
}, /*#__PURE__*/React__default.createElement("p", {
|
|
28467
|
+
className: "pelcro-address-name plc-font-semibold"
|
|
28468
|
+
}, t("labels.contactDetails")), /*#__PURE__*/React__default.createElement("p", {
|
|
28469
|
+
className: "pelcro-address-name plc-text-sm plc-mt-1"
|
|
28470
|
+
}, user.email), /*#__PURE__*/React__default.createElement("p", {
|
|
28471
|
+
className: "pelcro-address-line1 plc-text-sm"
|
|
28472
|
+
}, address === null || address === void 0 ? void 0 : address.phone))));
|
|
28473
|
+
};
|
|
28474
|
+
|
|
28475
|
+
const SubscriptionCreateView = ({
|
|
28476
|
+
onSuccess = () => {},
|
|
28477
|
+
onFailure = () => {}
|
|
28478
|
+
}) => {
|
|
28479
|
+
var _window$Pelcro, _window$Pelcro$uiSett;
|
|
28480
|
+
|
|
28481
|
+
const {
|
|
28482
|
+
plan
|
|
28483
|
+
} = usePelcro();
|
|
28484
|
+
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;
|
|
28485
|
+
const showSubscriptionButton = skipPayment && (plan === null || plan === void 0 ? void 0 : plan.amount) === 0;
|
|
28486
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
28487
|
+
id: "pelcro-subscription-create-view"
|
|
28488
|
+
}, /*#__PURE__*/React__default.createElement(SubscriptionCreateSummary, null), /*#__PURE__*/React__default.createElement(PaymentMethodView, {
|
|
28333
28489
|
type: "createPayment",
|
|
28334
28490
|
showCoupon: true,
|
|
28335
28491
|
showExternalPaymentMethods: true,
|
|
@@ -28882,6 +29038,7 @@ const initialState$h = {
|
|
|
28882
29038
|
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,
|
|
28883
29039
|
emailError: null,
|
|
28884
29040
|
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,
|
|
29041
|
+
firstNameError: null,
|
|
28885
29042
|
lastName: (_window$Pelcro$user$r3 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r3 === void 0 ? void 0 : _window$Pelcro$user$r3.last_name,
|
|
28886
29043
|
lastNameError: null,
|
|
28887
29044
|
username: (_window$Pelcro$user$r4 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r4 === void 0 ? void 0 : _window$Pelcro$user$r4.username,
|
|
@@ -29013,17 +29170,26 @@ const UserUpdateContainer = ({
|
|
|
29013
29170
|
|
|
29014
29171
|
case SET_EMAIL:
|
|
29015
29172
|
return lib_7({ ...state,
|
|
29016
|
-
email: action.payload
|
|
29173
|
+
email: action.payload,
|
|
29174
|
+
emailError: null
|
|
29017
29175
|
});
|
|
29018
29176
|
|
|
29019
29177
|
case SET_EMAIL_ERROR:
|
|
29020
29178
|
return lib_7({ ...state,
|
|
29021
|
-
emailError: action.payload
|
|
29179
|
+
emailError: action.payload,
|
|
29180
|
+
email: ""
|
|
29022
29181
|
});
|
|
29023
29182
|
|
|
29024
29183
|
case SET_FIRST_NAME:
|
|
29025
29184
|
return lib_7({ ...state,
|
|
29026
|
-
firstName: action.payload
|
|
29185
|
+
firstName: action.payload,
|
|
29186
|
+
firstNameError: null
|
|
29187
|
+
});
|
|
29188
|
+
|
|
29189
|
+
case SET_FIRST_NAME_ERROR:
|
|
29190
|
+
return lib_7({ ...state,
|
|
29191
|
+
firstNameError: action.payload,
|
|
29192
|
+
firstName: ""
|
|
29027
29193
|
});
|
|
29028
29194
|
|
|
29029
29195
|
case SET_DISPLAY_NAME:
|
|
@@ -29033,7 +29199,14 @@ const UserUpdateContainer = ({
|
|
|
29033
29199
|
|
|
29034
29200
|
case SET_LAST_NAME:
|
|
29035
29201
|
return lib_7({ ...state,
|
|
29036
|
-
lastName: action.payload
|
|
29202
|
+
lastName: action.payload,
|
|
29203
|
+
lastNameError: null
|
|
29204
|
+
});
|
|
29205
|
+
|
|
29206
|
+
case SET_LAST_NAME_ERROR:
|
|
29207
|
+
return lib_7({ ...state,
|
|
29208
|
+
lastNameError: action.payload,
|
|
29209
|
+
lastName: ""
|
|
29037
29210
|
});
|
|
29038
29211
|
|
|
29039
29212
|
case SET_USERNAME:
|
|
@@ -29399,8 +29572,6 @@ const nowDate$1 = new Date();
|
|
|
29399
29572
|
const nowDateISO$1 = nowDate$1.toISOString().substr(0, 10);
|
|
29400
29573
|
const hundredYearsFromNowDateISO = new Date(new Date().setFullYear(nowDate$1.getFullYear() - 100)).toISOString().substr(0, 10);
|
|
29401
29574
|
const UserUpdateDateOfBirth = props => {
|
|
29402
|
-
var _state$dateOfBirth;
|
|
29403
|
-
|
|
29404
29575
|
// const { t } = useTranslation("userEdit");
|
|
29405
29576
|
const {
|
|
29406
29577
|
dispatch,
|
|
@@ -29421,7 +29592,7 @@ const UserUpdateDateOfBirth = props => {
|
|
|
29421
29592
|
return /*#__PURE__*/React__default.createElement(DatePicker, Object.assign({
|
|
29422
29593
|
min: hundredYearsFromNowDateISO,
|
|
29423
29594
|
max: nowDateISO$1,
|
|
29424
|
-
value:
|
|
29595
|
+
value: state.dateOfBirth,
|
|
29425
29596
|
onChange: e => handleInputChange(e.target.value) // tooltipText={t("labels.dateOfBirth")}
|
|
29426
29597
|
|
|
29427
29598
|
}, props));
|
|
@@ -31063,13 +31234,6 @@ function AddressUpdatePhone(props) {
|
|
|
31063
31234
|
}
|
|
31064
31235
|
} = useContext(store$f);
|
|
31065
31236
|
|
|
31066
|
-
const handleBlur = () => {
|
|
31067
|
-
return dispatch({
|
|
31068
|
-
type: VALIDATE_FIELD,
|
|
31069
|
-
payload: "phone"
|
|
31070
|
-
});
|
|
31071
|
-
};
|
|
31072
|
-
|
|
31073
31237
|
const handleInputChange = value => {
|
|
31074
31238
|
dispatch({
|
|
31075
31239
|
type: SET_TEXT_FIELD,
|
|
@@ -31094,7 +31258,6 @@ function AddressUpdatePhone(props) {
|
|
|
31094
31258
|
value: phone,
|
|
31095
31259
|
error: phoneError,
|
|
31096
31260
|
onChange: e => handleInputChange(e.target.value),
|
|
31097
|
-
onBlur: handleBlur,
|
|
31098
31261
|
onFocus: handleFocus
|
|
31099
31262
|
}, props));
|
|
31100
31263
|
}
|
|
@@ -31157,8 +31320,7 @@ const AddressUpdateView = props => {
|
|
|
31157
31320
|
}, /*#__PURE__*/React__default.createElement(AddressUpdatePhone, {
|
|
31158
31321
|
id: "pelcro-input-phone",
|
|
31159
31322
|
errorId: "pelcro-input-phone-error",
|
|
31160
|
-
label: t("labels.phone")
|
|
31161
|
-
required: true
|
|
31323
|
+
label: t("labels.phone")
|
|
31162
31324
|
})), /*#__PURE__*/React__default.createElement("div", {
|
|
31163
31325
|
className: "plc-flex plc-space-x-3 plc-items-start plc-mb-3"
|
|
31164
31326
|
}, /*#__PURE__*/React__default.createElement(AddressUpdateSetDefault, {
|
|
@@ -36185,10 +36347,6 @@ const DashboardContent = ({
|
|
|
36185
36347
|
type: CLOSE_DASHBOARD
|
|
36186
36348
|
});
|
|
36187
36349
|
};
|
|
36188
|
-
|
|
36189
|
-
const closeSubMenusTab = () => {
|
|
36190
|
-
switchDashboardView(null);
|
|
36191
|
-
}; // useEffect(() => {
|
|
36192
36350
|
// return () => {
|
|
36193
36351
|
// document.removeEventListener("click", hideMenuIfClickedOutside);
|
|
36194
36352
|
// };
|
|
@@ -36248,21 +36406,14 @@ const DashboardContent = ({
|
|
|
36248
36406
|
title: t("labels.logout"),
|
|
36249
36407
|
setActiveDashboardLink: setActiveDashboardLink,
|
|
36250
36408
|
activeDashboardLink: activeDashboardLink
|
|
36251
|
-
}))),
|
|
36409
|
+
}))), /*#__PURE__*/React__default.createElement("div", {
|
|
36252
36410
|
id: "pelcro-view-dashboard-submenus",
|
|
36253
36411
|
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"}`
|
|
36254
|
-
}, /*#__PURE__*/React__default.createElement(DashboardViewController, null, subView !== null && subView !== void 0 && subView.length ? subView.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
|
|
36412
|
+
}, dashboardView && isOpen && /*#__PURE__*/React__default.createElement(DashboardViewController, null, subView !== null && subView !== void 0 && subView.length ? subView.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
|
|
36255
36413
|
store: store$4,
|
|
36256
36414
|
key: i
|
|
36257
36415
|
})) : /*#__PURE__*/React__default.cloneElement(subView, {
|
|
36258
36416
|
store: store$4
|
|
36259
|
-
})), /*#__PURE__*/React__default.createElement(Button, {
|
|
36260
|
-
variant: "ghost",
|
|
36261
|
-
type: "button",
|
|
36262
|
-
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"}`,
|
|
36263
|
-
onClick: closeSubMenusTab
|
|
36264
|
-
}, /*#__PURE__*/React__default.createElement(SvgXIcon, {
|
|
36265
|
-
className: "plc-fill-current"
|
|
36266
36417
|
}))));
|
|
36267
36418
|
};
|
|
36268
36419
|
|
|
@@ -36955,6 +37106,7 @@ const Card = ({
|
|
|
36955
37106
|
className = "",
|
|
36956
37107
|
title,
|
|
36957
37108
|
requestStates,
|
|
37109
|
+
dashboardLayout,
|
|
36958
37110
|
back,
|
|
36959
37111
|
...restProps
|
|
36960
37112
|
}) => {
|
|
@@ -36962,11 +37114,16 @@ const Card = ({
|
|
|
36962
37114
|
const {
|
|
36963
37115
|
switchDashboardView
|
|
36964
37116
|
} = usePelcro();
|
|
37117
|
+
|
|
37118
|
+
const closeSubMenusTab = () => {
|
|
37119
|
+
switchDashboardView(null);
|
|
37120
|
+
};
|
|
37121
|
+
|
|
36965
37122
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
36966
|
-
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}`,
|
|
37123
|
+
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}`,
|
|
36967
37124
|
id: "plc-dashboard-card"
|
|
36968
37125
|
}, title && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
36969
|
-
className: "plc-flex plc-items-end plc-justify-between plc-border-b-2 plc-border-primary-400 plc-pb-2 plc-mb-10"
|
|
37126
|
+
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"
|
|
36970
37127
|
}, /*#__PURE__*/React__default.createElement("h3", {
|
|
36971
37128
|
className: "plc-font-bold plc-text-xl"
|
|
36972
37129
|
}, title), (requestStates === null || requestStates === void 0 ? void 0 : requestStates.loading) && /*#__PURE__*/React__default.createElement("span", {
|
|
@@ -36979,7 +37136,14 @@ const Card = ({
|
|
|
36979
37136
|
onClick: () => {
|
|
36980
37137
|
switchDashboardView(back === null || back === void 0 ? void 0 : back.target);
|
|
36981
37138
|
}
|
|
36982
|
-
}, "Back"))), children
|
|
37139
|
+
}, "Back"))), children, /*#__PURE__*/React__default.createElement(Button, {
|
|
37140
|
+
variant: "ghost",
|
|
37141
|
+
type: "button",
|
|
37142
|
+
className: "plc-text-gray-500 plc-rounded-2xl plc-absolute plc-z-max plc-top-1 plc-right-1",
|
|
37143
|
+
onClick: closeSubMenusTab
|
|
37144
|
+
}, /*#__PURE__*/React__default.createElement(SvgXIcon, {
|
|
37145
|
+
className: "plc-fill-current"
|
|
37146
|
+
})));
|
|
36983
37147
|
};
|
|
36984
37148
|
|
|
36985
37149
|
const ProfileMenu = props => {
|