@pelcro/react-pelcro-js 3.26.0-beta.44 → 3.26.0-beta.46
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 +69 -16
- package/dist/index.esm.js +69 -16
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -3251,7 +3251,8 @@ var validation$3 = {
|
|
|
3251
3251
|
confirmPassword: "Confirm password is required.",
|
|
3252
3252
|
enterFirstName: "First name is required.",
|
|
3253
3253
|
enterLastName: "Last name is required.",
|
|
3254
|
-
enterPhone: "Phone number is required."
|
|
3254
|
+
enterPhone: "Phone number is required.",
|
|
3255
|
+
enterFieldName: "{{fieldName}} is required."
|
|
3255
3256
|
};
|
|
3256
3257
|
var buttons$n = {
|
|
3257
3258
|
account: "My account",
|
|
@@ -4204,7 +4205,8 @@ var validation$2 = {
|
|
|
4204
4205
|
confirmPassword: "Confirmer le mot de passe requis.",
|
|
4205
4206
|
enterFirstName: "Le prénom est requis.",
|
|
4206
4207
|
enterLastName: "Le nom de famille est requis.",
|
|
4207
|
-
enterPhone: "Le numéro de téléphone est requis."
|
|
4208
|
+
enterPhone: "Le numéro de téléphone est requis.",
|
|
4209
|
+
enterFieldName: "{{fieldName}} est requis."
|
|
4208
4210
|
};
|
|
4209
4211
|
var buttons$h = {
|
|
4210
4212
|
account: "Accès abonné(e)s",
|
|
@@ -5147,7 +5149,8 @@ var validation$1 = {
|
|
|
5147
5149
|
enterPassword: "비밀번호는 필수 항목입니다.",
|
|
5148
5150
|
enterFirstName: "이름은 필수 항목입니다.",
|
|
5149
5151
|
enterLastName: "성은 필수 항목입니다.",
|
|
5150
|
-
enterPhone: "전화번호는 필수 항목입니다."
|
|
5152
|
+
enterPhone: "전화번호는 필수 항목입니다.",
|
|
5153
|
+
enterFieldName: "{{fieldName}} 필수."
|
|
5151
5154
|
};
|
|
5152
5155
|
var buttons$b = {
|
|
5153
5156
|
account: "내 계정",
|
|
@@ -6196,7 +6199,8 @@ var validation = {
|
|
|
6196
6199
|
confirmPassword: "Confirmar la contraseña es obligatorio.",
|
|
6197
6200
|
enterFirstName: "El nombre es obligatorio.",
|
|
6198
6201
|
enterLastName: "El apellido es obligatorio.",
|
|
6199
|
-
enterPhone: "El número de teléfono es obligatorio."
|
|
6202
|
+
enterPhone: "El número de teléfono es obligatorio.",
|
|
6203
|
+
enterFieldName: "{{fieldName}} es obligatorio."
|
|
6200
6204
|
};
|
|
6201
6205
|
var buttons$5 = {
|
|
6202
6206
|
account: "Mi cuenta",
|
|
@@ -12890,6 +12894,7 @@ const SET_FIRST_NAME_ERROR = "SET_FIRST_NAME_ERROR";
|
|
|
12890
12894
|
const SET_LAST_NAME_ERROR = "SET_LAST_NAME_ERROR";
|
|
12891
12895
|
const SET_PHONE_ERROR = "SET_PHONE_ERROR";
|
|
12892
12896
|
const SET_TEXT_FIELD = "SET_TEXT_FIELD";
|
|
12897
|
+
const SET_TEXT_FIELD_ERROR = "SET_TEXT_FIELD_ERROR";
|
|
12893
12898
|
const SET_MONTH = "SET_MONTH";
|
|
12894
12899
|
const SET_YEAR = "SET_YEAR";
|
|
12895
12900
|
const SET_TOKEN = "SET_TOKEN";
|
|
@@ -13839,6 +13844,11 @@ const RegisterContainer = _ref => {
|
|
|
13839
13844
|
phoneError: action.payload,
|
|
13840
13845
|
phone: null
|
|
13841
13846
|
});
|
|
13847
|
+
case SET_TEXT_FIELD_ERROR:
|
|
13848
|
+
return lib_7({
|
|
13849
|
+
...state,
|
|
13850
|
+
...action.payload
|
|
13851
|
+
});
|
|
13842
13852
|
case SET_CONFIRM_PASSWORD_ERROR:
|
|
13843
13853
|
return lib_7({
|
|
13844
13854
|
...state,
|
|
@@ -14989,26 +14999,69 @@ function TextInput(_ref) {
|
|
|
14989
14999
|
fieldName,
|
|
14990
15000
|
...otherProps
|
|
14991
15001
|
} = _ref;
|
|
15002
|
+
const {
|
|
15003
|
+
t
|
|
15004
|
+
} = useTranslation("common");
|
|
14992
15005
|
const {
|
|
14993
15006
|
dispatch,
|
|
14994
|
-
state
|
|
15007
|
+
state: {
|
|
15008
|
+
[fieldName]: stateFieldName,
|
|
15009
|
+
[fieldName + "Error"]: fieldNameError,
|
|
15010
|
+
loading
|
|
15011
|
+
}
|
|
14995
15012
|
} = React.useContext(store);
|
|
14996
|
-
const
|
|
14997
|
-
|
|
14998
|
-
|
|
14999
|
-
|
|
15000
|
-
|
|
15013
|
+
const [fieldNameState, setFieldNameState] = React.useState(stateFieldName);
|
|
15014
|
+
const [finishedTyping, setFinishedTyping] = React.useState(false);
|
|
15015
|
+
const handleInputChange = React.useCallback(value => {
|
|
15016
|
+
setFieldNameState(value);
|
|
15017
|
+
if (finishedTyping) {
|
|
15018
|
+
if (fieldNameState !== null && fieldNameState !== void 0 && fieldNameState.length) {
|
|
15019
|
+
dispatch({
|
|
15020
|
+
type: SET_TEXT_FIELD,
|
|
15021
|
+
payload: {
|
|
15022
|
+
[fieldName]: value,
|
|
15023
|
+
[fieldName + "Error"]: null
|
|
15024
|
+
}
|
|
15025
|
+
});
|
|
15026
|
+
} else {
|
|
15027
|
+
if (otherProps.required) {
|
|
15028
|
+
dispatch({
|
|
15029
|
+
type: SET_TEXT_FIELD_ERROR,
|
|
15030
|
+
payload: {
|
|
15031
|
+
[fieldName + "Error"]: t("validation.enterFieldName", {
|
|
15032
|
+
fieldName: otherProps.label
|
|
15033
|
+
}),
|
|
15034
|
+
[fieldName]: null
|
|
15035
|
+
}
|
|
15036
|
+
});
|
|
15037
|
+
} else {
|
|
15038
|
+
dispatch({
|
|
15039
|
+
type: SET_TEXT_FIELD,
|
|
15040
|
+
payload: {
|
|
15041
|
+
[fieldName]: value,
|
|
15042
|
+
[fieldName + "Error"]: null
|
|
15043
|
+
}
|
|
15044
|
+
});
|
|
15045
|
+
}
|
|
15001
15046
|
}
|
|
15002
|
-
}
|
|
15003
|
-
}
|
|
15004
|
-
|
|
15047
|
+
}
|
|
15048
|
+
}, [dispatch, fieldNameState, finishedTyping] // eslint-disable-line react-hooks/exhaustive-deps
|
|
15049
|
+
);
|
|
15050
|
+
|
|
15051
|
+
React.useEffect(() => {
|
|
15052
|
+
handleInputChange(fieldNameState);
|
|
15053
|
+
}, [finishedTyping, fieldNameState, handleInputChange]);
|
|
15054
|
+
if (loading) {
|
|
15005
15055
|
return /*#__PURE__*/React__default['default'].createElement(Loader, null);
|
|
15006
15056
|
}
|
|
15007
15057
|
return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
|
|
15008
15058
|
type: "text",
|
|
15009
|
-
|
|
15059
|
+
error: fieldNameError,
|
|
15060
|
+
value: fieldNameState,
|
|
15010
15061
|
defaultValue: (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : (_window$Pelcro$user$r2 = _window$Pelcro$user$r.metadata) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2[fieldName],
|
|
15011
|
-
onChange: e => handleInputChange(e.target.value)
|
|
15062
|
+
onChange: e => handleInputChange(e.target.value),
|
|
15063
|
+
onBlur: () => setFinishedTyping(true),
|
|
15064
|
+
onFocus: () => setFinishedTyping(false)
|
|
15012
15065
|
}, otherProps));
|
|
15013
15066
|
}
|
|
15014
15067
|
|
|
@@ -22130,7 +22183,7 @@ function PaymentMethodView(_ref) {
|
|
|
22130
22183
|
}, t("labels.amount")), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
22131
22184
|
className: "plc-text-xl plc-font-semibold plc-text-primary-600"
|
|
22132
22185
|
}, (_calcAndFormatItemsTo = calcAndFormatItemsTotal(order, (_order$ = order[0]) === null || _order$ === void 0 ? void 0 : _order$.currency)) !== null && _calcAndFormatItemsTo !== void 0 ? _calcAndFormatItemsTo : getFormattedPriceByLocal(order === null || order === void 0 ? void 0 : order.price, order === null || order === void 0 ? void 0 : order.currency, getPageOrDefaultLanguage())))), cardProcessor === "stripe" && !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
22133
|
-
className: "plc-flex plc-items-center plc-w-full plc-px-4 plc-py-2 plc-text-center plc-text-green-600 plc-border plc-border-green-400 plc-rounded plc-bg-green-50"
|
|
22186
|
+
className: "plc-flex plc-items-center plc-w-full plc-px-4 plc-py-2 plc-text-center plc-text-green-600 plc-border plc-border-green-400 plc-rounded plc-bg-green-50 pelcro-stripe-compliance"
|
|
22134
22187
|
}, /*#__PURE__*/React__default['default'].createElement(SvgLock, {
|
|
22135
22188
|
className: "plc-w-5 plc-h-5 plc-mr-1"
|
|
22136
22189
|
}), /*#__PURE__*/React__default['default'].createElement("span", null, t("messages.youAreSafe"), /*#__PURE__*/React__default['default'].createElement(Link, {
|
package/dist/index.esm.js
CHANGED
|
@@ -3221,7 +3221,8 @@ var validation$3 = {
|
|
|
3221
3221
|
confirmPassword: "Confirm password is required.",
|
|
3222
3222
|
enterFirstName: "First name is required.",
|
|
3223
3223
|
enterLastName: "Last name is required.",
|
|
3224
|
-
enterPhone: "Phone number is required."
|
|
3224
|
+
enterPhone: "Phone number is required.",
|
|
3225
|
+
enterFieldName: "{{fieldName}} is required."
|
|
3225
3226
|
};
|
|
3226
3227
|
var buttons$n = {
|
|
3227
3228
|
account: "My account",
|
|
@@ -4174,7 +4175,8 @@ var validation$2 = {
|
|
|
4174
4175
|
confirmPassword: "Confirmer le mot de passe requis.",
|
|
4175
4176
|
enterFirstName: "Le prénom est requis.",
|
|
4176
4177
|
enterLastName: "Le nom de famille est requis.",
|
|
4177
|
-
enterPhone: "Le numéro de téléphone est requis."
|
|
4178
|
+
enterPhone: "Le numéro de téléphone est requis.",
|
|
4179
|
+
enterFieldName: "{{fieldName}} est requis."
|
|
4178
4180
|
};
|
|
4179
4181
|
var buttons$h = {
|
|
4180
4182
|
account: "Accès abonné(e)s",
|
|
@@ -5117,7 +5119,8 @@ var validation$1 = {
|
|
|
5117
5119
|
enterPassword: "비밀번호는 필수 항목입니다.",
|
|
5118
5120
|
enterFirstName: "이름은 필수 항목입니다.",
|
|
5119
5121
|
enterLastName: "성은 필수 항목입니다.",
|
|
5120
|
-
enterPhone: "전화번호는 필수 항목입니다."
|
|
5122
|
+
enterPhone: "전화번호는 필수 항목입니다.",
|
|
5123
|
+
enterFieldName: "{{fieldName}} 필수."
|
|
5121
5124
|
};
|
|
5122
5125
|
var buttons$b = {
|
|
5123
5126
|
account: "내 계정",
|
|
@@ -6166,7 +6169,8 @@ var validation = {
|
|
|
6166
6169
|
confirmPassword: "Confirmar la contraseña es obligatorio.",
|
|
6167
6170
|
enterFirstName: "El nombre es obligatorio.",
|
|
6168
6171
|
enterLastName: "El apellido es obligatorio.",
|
|
6169
|
-
enterPhone: "El número de teléfono es obligatorio."
|
|
6172
|
+
enterPhone: "El número de teléfono es obligatorio.",
|
|
6173
|
+
enterFieldName: "{{fieldName}} es obligatorio."
|
|
6170
6174
|
};
|
|
6171
6175
|
var buttons$5 = {
|
|
6172
6176
|
account: "Mi cuenta",
|
|
@@ -12860,6 +12864,7 @@ const SET_FIRST_NAME_ERROR = "SET_FIRST_NAME_ERROR";
|
|
|
12860
12864
|
const SET_LAST_NAME_ERROR = "SET_LAST_NAME_ERROR";
|
|
12861
12865
|
const SET_PHONE_ERROR = "SET_PHONE_ERROR";
|
|
12862
12866
|
const SET_TEXT_FIELD = "SET_TEXT_FIELD";
|
|
12867
|
+
const SET_TEXT_FIELD_ERROR = "SET_TEXT_FIELD_ERROR";
|
|
12863
12868
|
const SET_MONTH = "SET_MONTH";
|
|
12864
12869
|
const SET_YEAR = "SET_YEAR";
|
|
12865
12870
|
const SET_TOKEN = "SET_TOKEN";
|
|
@@ -13809,6 +13814,11 @@ const RegisterContainer = _ref => {
|
|
|
13809
13814
|
phoneError: action.payload,
|
|
13810
13815
|
phone: null
|
|
13811
13816
|
});
|
|
13817
|
+
case SET_TEXT_FIELD_ERROR:
|
|
13818
|
+
return lib_7({
|
|
13819
|
+
...state,
|
|
13820
|
+
...action.payload
|
|
13821
|
+
});
|
|
13812
13822
|
case SET_CONFIRM_PASSWORD_ERROR:
|
|
13813
13823
|
return lib_7({
|
|
13814
13824
|
...state,
|
|
@@ -14959,26 +14969,69 @@ function TextInput(_ref) {
|
|
|
14959
14969
|
fieldName,
|
|
14960
14970
|
...otherProps
|
|
14961
14971
|
} = _ref;
|
|
14972
|
+
const {
|
|
14973
|
+
t
|
|
14974
|
+
} = useTranslation("common");
|
|
14962
14975
|
const {
|
|
14963
14976
|
dispatch,
|
|
14964
|
-
state
|
|
14977
|
+
state: {
|
|
14978
|
+
[fieldName]: stateFieldName,
|
|
14979
|
+
[fieldName + "Error"]: fieldNameError,
|
|
14980
|
+
loading
|
|
14981
|
+
}
|
|
14965
14982
|
} = useContext(store);
|
|
14966
|
-
const
|
|
14967
|
-
|
|
14968
|
-
|
|
14969
|
-
|
|
14970
|
-
|
|
14983
|
+
const [fieldNameState, setFieldNameState] = useState(stateFieldName);
|
|
14984
|
+
const [finishedTyping, setFinishedTyping] = useState(false);
|
|
14985
|
+
const handleInputChange = useCallback(value => {
|
|
14986
|
+
setFieldNameState(value);
|
|
14987
|
+
if (finishedTyping) {
|
|
14988
|
+
if (fieldNameState !== null && fieldNameState !== void 0 && fieldNameState.length) {
|
|
14989
|
+
dispatch({
|
|
14990
|
+
type: SET_TEXT_FIELD,
|
|
14991
|
+
payload: {
|
|
14992
|
+
[fieldName]: value,
|
|
14993
|
+
[fieldName + "Error"]: null
|
|
14994
|
+
}
|
|
14995
|
+
});
|
|
14996
|
+
} else {
|
|
14997
|
+
if (otherProps.required) {
|
|
14998
|
+
dispatch({
|
|
14999
|
+
type: SET_TEXT_FIELD_ERROR,
|
|
15000
|
+
payload: {
|
|
15001
|
+
[fieldName + "Error"]: t("validation.enterFieldName", {
|
|
15002
|
+
fieldName: otherProps.label
|
|
15003
|
+
}),
|
|
15004
|
+
[fieldName]: null
|
|
15005
|
+
}
|
|
15006
|
+
});
|
|
15007
|
+
} else {
|
|
15008
|
+
dispatch({
|
|
15009
|
+
type: SET_TEXT_FIELD,
|
|
15010
|
+
payload: {
|
|
15011
|
+
[fieldName]: value,
|
|
15012
|
+
[fieldName + "Error"]: null
|
|
15013
|
+
}
|
|
15014
|
+
});
|
|
15015
|
+
}
|
|
14971
15016
|
}
|
|
14972
|
-
}
|
|
14973
|
-
}
|
|
14974
|
-
|
|
15017
|
+
}
|
|
15018
|
+
}, [dispatch, fieldNameState, finishedTyping] // eslint-disable-line react-hooks/exhaustive-deps
|
|
15019
|
+
);
|
|
15020
|
+
|
|
15021
|
+
useEffect(() => {
|
|
15022
|
+
handleInputChange(fieldNameState);
|
|
15023
|
+
}, [finishedTyping, fieldNameState, handleInputChange]);
|
|
15024
|
+
if (loading) {
|
|
14975
15025
|
return /*#__PURE__*/React__default.createElement(Loader, null);
|
|
14976
15026
|
}
|
|
14977
15027
|
return /*#__PURE__*/React__default.createElement(Input, Object.assign({
|
|
14978
15028
|
type: "text",
|
|
14979
|
-
|
|
15029
|
+
error: fieldNameError,
|
|
15030
|
+
value: fieldNameState,
|
|
14980
15031
|
defaultValue: (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : (_window$Pelcro$user$r2 = _window$Pelcro$user$r.metadata) === null || _window$Pelcro$user$r2 === void 0 ? void 0 : _window$Pelcro$user$r2[fieldName],
|
|
14981
|
-
onChange: e => handleInputChange(e.target.value)
|
|
15032
|
+
onChange: e => handleInputChange(e.target.value),
|
|
15033
|
+
onBlur: () => setFinishedTyping(true),
|
|
15034
|
+
onFocus: () => setFinishedTyping(false)
|
|
14982
15035
|
}, otherProps));
|
|
14983
15036
|
}
|
|
14984
15037
|
|
|
@@ -22100,7 +22153,7 @@ function PaymentMethodView(_ref) {
|
|
|
22100
22153
|
}, t("labels.amount")), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", {
|
|
22101
22154
|
className: "plc-text-xl plc-font-semibold plc-text-primary-600"
|
|
22102
22155
|
}, (_calcAndFormatItemsTo = calcAndFormatItemsTotal(order, (_order$ = order[0]) === null || _order$ === void 0 ? void 0 : _order$.currency)) !== null && _calcAndFormatItemsTo !== void 0 ? _calcAndFormatItemsTo : getFormattedPriceByLocal(order === null || order === void 0 ? void 0 : order.price, order === null || order === void 0 ? void 0 : order.currency, getPageOrDefaultLanguage())))), cardProcessor === "stripe" && !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default.createElement("div", {
|
|
22103
|
-
className: "plc-flex plc-items-center plc-w-full plc-px-4 plc-py-2 plc-text-center plc-text-green-600 plc-border plc-border-green-400 plc-rounded plc-bg-green-50"
|
|
22156
|
+
className: "plc-flex plc-items-center plc-w-full plc-px-4 plc-py-2 plc-text-center plc-text-green-600 plc-border plc-border-green-400 plc-rounded plc-bg-green-50 pelcro-stripe-compliance"
|
|
22104
22157
|
}, /*#__PURE__*/React__default.createElement(SvgLock, {
|
|
22105
22158
|
className: "plc-w-5 plc-h-5 plc-mr-1"
|
|
22106
22159
|
}), /*#__PURE__*/React__default.createElement("span", null, t("messages.youAreSafe"), /*#__PURE__*/React__default.createElement(Link, {
|