@pelcro/react-pelcro-js 3.11.0-beta.5 → 3.11.0-beta.6
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 +96 -14
- package/dist/index.esm.js +96 -14
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -4395,7 +4395,8 @@ var labels$t = {
|
|
|
4395
4395
|
save: "Upload Photo",
|
|
4396
4396
|
selectImage: "Upload new photo",
|
|
4397
4397
|
removeImage: "Remove current photo",
|
|
4398
|
-
zoom: "Zoom"
|
|
4398
|
+
zoom: "Zoom",
|
|
4399
|
+
tin: "Tax Identification Number"
|
|
4399
4400
|
};
|
|
4400
4401
|
var messages$w = {
|
|
4401
4402
|
userUpdated: "Thanks! Your profile was updated successfully.",
|
|
@@ -4421,7 +4422,8 @@ var labels$s = {
|
|
|
4421
4422
|
save: "Téléverser une photo",
|
|
4422
4423
|
selectImage: "Télécharger une nouvelle photo",
|
|
4423
4424
|
removeImage: "supprimer la photo actuelle",
|
|
4424
|
-
zoom: "Zoom"
|
|
4425
|
+
zoom: "Zoom",
|
|
4426
|
+
tin: "Numéro d'identification fiscale"
|
|
4425
4427
|
};
|
|
4426
4428
|
var messages$v = {
|
|
4427
4429
|
userUpdated: "Votre profil a été mis à jour avec succès.",
|
|
@@ -4447,7 +4449,8 @@ var labels$r = {
|
|
|
4447
4449
|
save: "사진 업로드",
|
|
4448
4450
|
selectImage: "새로운 사진 업로드",
|
|
4449
4451
|
removeImage: "기존 사진 제거",
|
|
4450
|
-
zoom: "확대"
|
|
4452
|
+
zoom: "확대",
|
|
4453
|
+
tin: "세금 식별 번호"
|
|
4451
4454
|
};
|
|
4452
4455
|
var messages$u = {
|
|
4453
4456
|
userUpdated: "감사합니다! 프로필이 성공적으로 업데이트되었습니다.",
|
|
@@ -10869,6 +10872,7 @@ const SET_LAST_NAME = "SET_LAST_NAME";
|
|
|
10869
10872
|
const SET_START_DATE = "SET_START_DATE";
|
|
10870
10873
|
const SET_GIFT_MESSAGE = "SET_GIFT_MESSAGE";
|
|
10871
10874
|
const SET_PHONE = "SET_PHONE";
|
|
10875
|
+
const SET_TIN = "SET_TIN";
|
|
10872
10876
|
const GET_COUNTRIES_SUCCESS = "GET_COUNTRIES_SUCCESS";
|
|
10873
10877
|
const GET_COUNTRIES_FETCH = "GET_COUNTRIES_FETCH";
|
|
10874
10878
|
const GET_STATES_SUCCESS = "GET_STATES_SUCCESS";
|
|
@@ -19462,7 +19466,7 @@ function SubscriptionCreateModal({
|
|
|
19462
19466
|
}
|
|
19463
19467
|
SubscriptionCreateModal.viewId = "subscription-create";
|
|
19464
19468
|
|
|
19465
|
-
var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window$Pelcro$user$r3, _window$Pelcro$user$r4, _window$Pelcro$user$r5;
|
|
19469
|
+
var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window$Pelcro$user$r3, _window$Pelcro$user$r4, _window$Pelcro$user$r5, _window$Pelcro$user$r6;
|
|
19466
19470
|
const initialState$f = {
|
|
19467
19471
|
email: (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.email,
|
|
19468
19472
|
emailError: null,
|
|
@@ -19473,6 +19477,7 @@ const initialState$f = {
|
|
|
19473
19477
|
displayName: (_window$Pelcro$user$r4 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r4 === void 0 ? void 0 : _window$Pelcro$user$r4.display_name,
|
|
19474
19478
|
phone: (_window$Pelcro$user$r5 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r5 === void 0 ? void 0 : _window$Pelcro$user$r5.phone,
|
|
19475
19479
|
phoneError: null,
|
|
19480
|
+
tin: (_window$Pelcro$user$r6 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r6 === void 0 ? void 0 : _window$Pelcro$user$r6.tin,
|
|
19476
19481
|
buttonDisabled: false,
|
|
19477
19482
|
textFields: {},
|
|
19478
19483
|
alert: {
|
|
@@ -19503,23 +19508,26 @@ const UserUpdateContainer = ({
|
|
|
19503
19508
|
}, []);
|
|
19504
19509
|
|
|
19505
19510
|
const loadUserDataIntoFields = () => {
|
|
19506
|
-
var _window$Pelcro$user$
|
|
19511
|
+
var _window$Pelcro$user$r7, _window$Pelcro$user$r8, _window$Pelcro$user$r9, _window$Pelcro$user$r10, _window$Pelcro$user$r11, _window$Pelcro$user$r12;
|
|
19507
19512
|
|
|
19508
19513
|
const fields = [{
|
|
19509
19514
|
type: SET_EMAIL,
|
|
19510
|
-
payload: (_window$Pelcro$user$
|
|
19515
|
+
payload: (_window$Pelcro$user$r7 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r7 === void 0 ? void 0 : _window$Pelcro$user$r7.email
|
|
19511
19516
|
}, {
|
|
19512
19517
|
type: SET_FIRST_NAME,
|
|
19513
|
-
payload: (_window$Pelcro$user$
|
|
19518
|
+
payload: (_window$Pelcro$user$r8 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r8 === void 0 ? void 0 : _window$Pelcro$user$r8.first_name
|
|
19514
19519
|
}, {
|
|
19515
19520
|
type: SET_LAST_NAME,
|
|
19516
|
-
payload: (_window$Pelcro$user$
|
|
19521
|
+
payload: (_window$Pelcro$user$r9 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r9 === void 0 ? void 0 : _window$Pelcro$user$r9.last_name
|
|
19517
19522
|
}, {
|
|
19518
19523
|
type: SET_DISPLAY_NAME,
|
|
19519
|
-
payload: (_window$Pelcro$user$
|
|
19524
|
+
payload: (_window$Pelcro$user$r10 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r10 === void 0 ? void 0 : _window$Pelcro$user$r10.display_name
|
|
19520
19525
|
}, {
|
|
19521
19526
|
type: SET_PHONE,
|
|
19522
|
-
payload: (_window$Pelcro$user$
|
|
19527
|
+
payload: (_window$Pelcro$user$r11 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r11 === void 0 ? void 0 : _window$Pelcro$user$r11.phone
|
|
19528
|
+
}, {
|
|
19529
|
+
type: SET_TIN,
|
|
19530
|
+
payload: (_window$Pelcro$user$r12 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r12 === void 0 ? void 0 : _window$Pelcro$user$r12.tin
|
|
19523
19531
|
}];
|
|
19524
19532
|
fields.filter(field => Boolean(field.payload)).forEach(field => {
|
|
19525
19533
|
dispatch(field);
|
|
@@ -19531,6 +19539,7 @@ const UserUpdateContainer = ({
|
|
|
19531
19539
|
firstName,
|
|
19532
19540
|
lastName,
|
|
19533
19541
|
phone,
|
|
19542
|
+
tin,
|
|
19534
19543
|
textFields,
|
|
19535
19544
|
displayName
|
|
19536
19545
|
}, dispatch) => {
|
|
@@ -19541,6 +19550,7 @@ const UserUpdateContainer = ({
|
|
|
19541
19550
|
last_name: lastName,
|
|
19542
19551
|
display_name: displayName,
|
|
19543
19552
|
phone: phone,
|
|
19553
|
+
tin: tin,
|
|
19544
19554
|
metadata: {
|
|
19545
19555
|
updated: "updated",
|
|
19546
19556
|
...textFields
|
|
@@ -19629,6 +19639,11 @@ const UserUpdateContainer = ({
|
|
|
19629
19639
|
phoneError: null
|
|
19630
19640
|
});
|
|
19631
19641
|
|
|
19642
|
+
case SET_TIN:
|
|
19643
|
+
return lib_7({ ...state,
|
|
19644
|
+
tin: action.payload
|
|
19645
|
+
});
|
|
19646
|
+
|
|
19632
19647
|
case SET_PHONE_ERROR:
|
|
19633
19648
|
return lib_7({ ...state,
|
|
19634
19649
|
phoneError: action.payload,
|
|
@@ -19813,6 +19828,66 @@ const UserUpdateProfilePic = ({
|
|
|
19813
19828
|
})));
|
|
19814
19829
|
};
|
|
19815
19830
|
|
|
19831
|
+
function Tin({
|
|
19832
|
+
initWithUserTin = true,
|
|
19833
|
+
store,
|
|
19834
|
+
...otherProps
|
|
19835
|
+
}) {
|
|
19836
|
+
useTranslation("common");
|
|
19837
|
+
const {
|
|
19838
|
+
dispatch,
|
|
19839
|
+
state: {
|
|
19840
|
+
tin: stateTin
|
|
19841
|
+
}
|
|
19842
|
+
} = React.useContext(store);
|
|
19843
|
+
const [tin, setTin] = React.useState(stateTin);
|
|
19844
|
+
const [finishedTyping, setFinishedTyping] = React.useState(false);
|
|
19845
|
+
const handleInputChange = React.useCallback(value => {
|
|
19846
|
+
setTin(value);
|
|
19847
|
+
|
|
19848
|
+
if (finishedTyping) {
|
|
19849
|
+
dispatch({
|
|
19850
|
+
type: SET_TIN,
|
|
19851
|
+
payload: tin
|
|
19852
|
+
});
|
|
19853
|
+
}
|
|
19854
|
+
}, [dispatch, tin, finishedTyping]);
|
|
19855
|
+
React.useEffect(() => {
|
|
19856
|
+
handleInputChange(tin);
|
|
19857
|
+
}, [finishedTyping, tin, handleInputChange]); // Initialize tin field with user's tin (Tax Identification Number)
|
|
19858
|
+
|
|
19859
|
+
const loadTinIntoField = () => {
|
|
19860
|
+
handleInputChange(window.Pelcro.user.read().tin);
|
|
19861
|
+
dispatch({
|
|
19862
|
+
type: SET_TIN,
|
|
19863
|
+
payload: window.Pelcro.user.read().tin
|
|
19864
|
+
});
|
|
19865
|
+
};
|
|
19866
|
+
|
|
19867
|
+
React.useEffect(() => {
|
|
19868
|
+
if (initWithUserTin) {
|
|
19869
|
+
document.addEventListener("PelcroUserLoaded", () => {
|
|
19870
|
+
loadTinIntoField();
|
|
19871
|
+
});
|
|
19872
|
+
loadTinIntoField();
|
|
19873
|
+
return () => {
|
|
19874
|
+
document.removeEventListener("PelcroUserLoaded", handleInputChange);
|
|
19875
|
+
};
|
|
19876
|
+
}
|
|
19877
|
+
}, []);
|
|
19878
|
+
return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
|
|
19879
|
+
type: "text",
|
|
19880
|
+
value: tin,
|
|
19881
|
+
onChange: e => handleInputChange(e.target.value),
|
|
19882
|
+
onBlur: () => setFinishedTyping(true),
|
|
19883
|
+
onFocus: () => setFinishedTyping(false)
|
|
19884
|
+
}, otherProps));
|
|
19885
|
+
}
|
|
19886
|
+
|
|
19887
|
+
const UserUpdateTin = props => /*#__PURE__*/React__default['default'].createElement(Tin, Object.assign({
|
|
19888
|
+
store: store$f
|
|
19889
|
+
}, props));
|
|
19890
|
+
|
|
19816
19891
|
const UserUpdateView = props => {
|
|
19817
19892
|
var _window$Pelcro$site$r;
|
|
19818
19893
|
|
|
@@ -19854,6 +19929,11 @@ const UserUpdateView = props => {
|
|
|
19854
19929
|
errorId: "pelcro-input-phone-error",
|
|
19855
19930
|
label: t("labels.phone"),
|
|
19856
19931
|
required: supportsTap ? true : false
|
|
19932
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19933
|
+
className: "plc-flex plc-items-start"
|
|
19934
|
+
}, /*#__PURE__*/React__default['default'].createElement(UserUpdateTin, {
|
|
19935
|
+
id: "pelcro-input-tin",
|
|
19936
|
+
label: t("labels.tin")
|
|
19857
19937
|
})), /*#__PURE__*/React__default['default'].createElement(UserUpdateButton, {
|
|
19858
19938
|
role: "submit",
|
|
19859
19939
|
className: "plc-w-full plc-mt-2",
|
|
@@ -25755,14 +25835,14 @@ const SubscriptionsItems = ({
|
|
|
25755
25835
|
onClick: onRenewClick,
|
|
25756
25836
|
disabled: disableSubmit,
|
|
25757
25837
|
"data-key": sub.id
|
|
25758
|
-
}, t("labels.renew")), sub.shipments_suspended_until &&
|
|
25838
|
+
}, t("labels.renew")), sub.shipments_suspended_until && isDateAfterToday(sub.shipments_suspended_until) && sub.shipments_remaining > 0 && /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
25759
25839
|
variant: "ghost",
|
|
25760
25840
|
className: "plc-text-blue-400 pelcro-dashboard-sub-suspend-button",
|
|
25761
25841
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgXIconSolid, null),
|
|
25762
25842
|
onClick: onUnSuspendClick,
|
|
25763
25843
|
disabled: disableSubmit,
|
|
25764
25844
|
"data-key": sub.id
|
|
25765
|
-
}, t("labels.unsuspend")), (!sub.shipments_suspended_until && sub.shipments_remaining > 0 || sub.shipments_suspended_until &&
|
|
25845
|
+
}, t("labels.unsuspend")), (!sub.shipments_suspended_until && sub.shipments_remaining > 0 || sub.shipments_suspended_until && !isDateAfterToday(sub.shipments_suspended_until)) && /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
25766
25846
|
variant: "ghost",
|
|
25767
25847
|
className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-suspend-button",
|
|
25768
25848
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgCalendar, null),
|
|
@@ -25822,8 +25902,10 @@ function getNonDonationSubs() {
|
|
|
25822
25902
|
return (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => !sub.plan.is_donation)) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
|
|
25823
25903
|
}
|
|
25824
25904
|
|
|
25825
|
-
function
|
|
25826
|
-
|
|
25905
|
+
function isDateAfterToday(date) {
|
|
25906
|
+
const today = new Date().setHours(0, 0, 0, 0);
|
|
25907
|
+
const newDate = new Date(date).setHours(0, 0, 0, 0);
|
|
25908
|
+
return newDate === today ? true : newDate > today;
|
|
25827
25909
|
}
|
|
25828
25910
|
|
|
25829
25911
|
/**
|
package/dist/index.esm.js
CHANGED
|
@@ -4365,7 +4365,8 @@ var labels$t = {
|
|
|
4365
4365
|
save: "Upload Photo",
|
|
4366
4366
|
selectImage: "Upload new photo",
|
|
4367
4367
|
removeImage: "Remove current photo",
|
|
4368
|
-
zoom: "Zoom"
|
|
4368
|
+
zoom: "Zoom",
|
|
4369
|
+
tin: "Tax Identification Number"
|
|
4369
4370
|
};
|
|
4370
4371
|
var messages$w = {
|
|
4371
4372
|
userUpdated: "Thanks! Your profile was updated successfully.",
|
|
@@ -4391,7 +4392,8 @@ var labels$s = {
|
|
|
4391
4392
|
save: "Téléverser une photo",
|
|
4392
4393
|
selectImage: "Télécharger une nouvelle photo",
|
|
4393
4394
|
removeImage: "supprimer la photo actuelle",
|
|
4394
|
-
zoom: "Zoom"
|
|
4395
|
+
zoom: "Zoom",
|
|
4396
|
+
tin: "Numéro d'identification fiscale"
|
|
4395
4397
|
};
|
|
4396
4398
|
var messages$v = {
|
|
4397
4399
|
userUpdated: "Votre profil a été mis à jour avec succès.",
|
|
@@ -4417,7 +4419,8 @@ var labels$r = {
|
|
|
4417
4419
|
save: "사진 업로드",
|
|
4418
4420
|
selectImage: "새로운 사진 업로드",
|
|
4419
4421
|
removeImage: "기존 사진 제거",
|
|
4420
|
-
zoom: "확대"
|
|
4422
|
+
zoom: "확대",
|
|
4423
|
+
tin: "세금 식별 번호"
|
|
4421
4424
|
};
|
|
4422
4425
|
var messages$u = {
|
|
4423
4426
|
userUpdated: "감사합니다! 프로필이 성공적으로 업데이트되었습니다.",
|
|
@@ -10839,6 +10842,7 @@ const SET_LAST_NAME = "SET_LAST_NAME";
|
|
|
10839
10842
|
const SET_START_DATE = "SET_START_DATE";
|
|
10840
10843
|
const SET_GIFT_MESSAGE = "SET_GIFT_MESSAGE";
|
|
10841
10844
|
const SET_PHONE = "SET_PHONE";
|
|
10845
|
+
const SET_TIN = "SET_TIN";
|
|
10842
10846
|
const GET_COUNTRIES_SUCCESS = "GET_COUNTRIES_SUCCESS";
|
|
10843
10847
|
const GET_COUNTRIES_FETCH = "GET_COUNTRIES_FETCH";
|
|
10844
10848
|
const GET_STATES_SUCCESS = "GET_STATES_SUCCESS";
|
|
@@ -19432,7 +19436,7 @@ function SubscriptionCreateModal({
|
|
|
19432
19436
|
}
|
|
19433
19437
|
SubscriptionCreateModal.viewId = "subscription-create";
|
|
19434
19438
|
|
|
19435
|
-
var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window$Pelcro$user$r3, _window$Pelcro$user$r4, _window$Pelcro$user$r5;
|
|
19439
|
+
var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window$Pelcro$user$r3, _window$Pelcro$user$r4, _window$Pelcro$user$r5, _window$Pelcro$user$r6;
|
|
19436
19440
|
const initialState$f = {
|
|
19437
19441
|
email: (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.email,
|
|
19438
19442
|
emailError: null,
|
|
@@ -19443,6 +19447,7 @@ const initialState$f = {
|
|
|
19443
19447
|
displayName: (_window$Pelcro$user$r4 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r4 === void 0 ? void 0 : _window$Pelcro$user$r4.display_name,
|
|
19444
19448
|
phone: (_window$Pelcro$user$r5 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r5 === void 0 ? void 0 : _window$Pelcro$user$r5.phone,
|
|
19445
19449
|
phoneError: null,
|
|
19450
|
+
tin: (_window$Pelcro$user$r6 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r6 === void 0 ? void 0 : _window$Pelcro$user$r6.tin,
|
|
19446
19451
|
buttonDisabled: false,
|
|
19447
19452
|
textFields: {},
|
|
19448
19453
|
alert: {
|
|
@@ -19473,23 +19478,26 @@ const UserUpdateContainer = ({
|
|
|
19473
19478
|
}, []);
|
|
19474
19479
|
|
|
19475
19480
|
const loadUserDataIntoFields = () => {
|
|
19476
|
-
var _window$Pelcro$user$
|
|
19481
|
+
var _window$Pelcro$user$r7, _window$Pelcro$user$r8, _window$Pelcro$user$r9, _window$Pelcro$user$r10, _window$Pelcro$user$r11, _window$Pelcro$user$r12;
|
|
19477
19482
|
|
|
19478
19483
|
const fields = [{
|
|
19479
19484
|
type: SET_EMAIL,
|
|
19480
|
-
payload: (_window$Pelcro$user$
|
|
19485
|
+
payload: (_window$Pelcro$user$r7 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r7 === void 0 ? void 0 : _window$Pelcro$user$r7.email
|
|
19481
19486
|
}, {
|
|
19482
19487
|
type: SET_FIRST_NAME,
|
|
19483
|
-
payload: (_window$Pelcro$user$
|
|
19488
|
+
payload: (_window$Pelcro$user$r8 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r8 === void 0 ? void 0 : _window$Pelcro$user$r8.first_name
|
|
19484
19489
|
}, {
|
|
19485
19490
|
type: SET_LAST_NAME,
|
|
19486
|
-
payload: (_window$Pelcro$user$
|
|
19491
|
+
payload: (_window$Pelcro$user$r9 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r9 === void 0 ? void 0 : _window$Pelcro$user$r9.last_name
|
|
19487
19492
|
}, {
|
|
19488
19493
|
type: SET_DISPLAY_NAME,
|
|
19489
|
-
payload: (_window$Pelcro$user$
|
|
19494
|
+
payload: (_window$Pelcro$user$r10 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r10 === void 0 ? void 0 : _window$Pelcro$user$r10.display_name
|
|
19490
19495
|
}, {
|
|
19491
19496
|
type: SET_PHONE,
|
|
19492
|
-
payload: (_window$Pelcro$user$
|
|
19497
|
+
payload: (_window$Pelcro$user$r11 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r11 === void 0 ? void 0 : _window$Pelcro$user$r11.phone
|
|
19498
|
+
}, {
|
|
19499
|
+
type: SET_TIN,
|
|
19500
|
+
payload: (_window$Pelcro$user$r12 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r12 === void 0 ? void 0 : _window$Pelcro$user$r12.tin
|
|
19493
19501
|
}];
|
|
19494
19502
|
fields.filter(field => Boolean(field.payload)).forEach(field => {
|
|
19495
19503
|
dispatch(field);
|
|
@@ -19501,6 +19509,7 @@ const UserUpdateContainer = ({
|
|
|
19501
19509
|
firstName,
|
|
19502
19510
|
lastName,
|
|
19503
19511
|
phone,
|
|
19512
|
+
tin,
|
|
19504
19513
|
textFields,
|
|
19505
19514
|
displayName
|
|
19506
19515
|
}, dispatch) => {
|
|
@@ -19511,6 +19520,7 @@ const UserUpdateContainer = ({
|
|
|
19511
19520
|
last_name: lastName,
|
|
19512
19521
|
display_name: displayName,
|
|
19513
19522
|
phone: phone,
|
|
19523
|
+
tin: tin,
|
|
19514
19524
|
metadata: {
|
|
19515
19525
|
updated: "updated",
|
|
19516
19526
|
...textFields
|
|
@@ -19599,6 +19609,11 @@ const UserUpdateContainer = ({
|
|
|
19599
19609
|
phoneError: null
|
|
19600
19610
|
});
|
|
19601
19611
|
|
|
19612
|
+
case SET_TIN:
|
|
19613
|
+
return lib_7({ ...state,
|
|
19614
|
+
tin: action.payload
|
|
19615
|
+
});
|
|
19616
|
+
|
|
19602
19617
|
case SET_PHONE_ERROR:
|
|
19603
19618
|
return lib_7({ ...state,
|
|
19604
19619
|
phoneError: action.payload,
|
|
@@ -19783,6 +19798,66 @@ const UserUpdateProfilePic = ({
|
|
|
19783
19798
|
})));
|
|
19784
19799
|
};
|
|
19785
19800
|
|
|
19801
|
+
function Tin({
|
|
19802
|
+
initWithUserTin = true,
|
|
19803
|
+
store,
|
|
19804
|
+
...otherProps
|
|
19805
|
+
}) {
|
|
19806
|
+
useTranslation("common");
|
|
19807
|
+
const {
|
|
19808
|
+
dispatch,
|
|
19809
|
+
state: {
|
|
19810
|
+
tin: stateTin
|
|
19811
|
+
}
|
|
19812
|
+
} = useContext(store);
|
|
19813
|
+
const [tin, setTin] = useState(stateTin);
|
|
19814
|
+
const [finishedTyping, setFinishedTyping] = useState(false);
|
|
19815
|
+
const handleInputChange = useCallback(value => {
|
|
19816
|
+
setTin(value);
|
|
19817
|
+
|
|
19818
|
+
if (finishedTyping) {
|
|
19819
|
+
dispatch({
|
|
19820
|
+
type: SET_TIN,
|
|
19821
|
+
payload: tin
|
|
19822
|
+
});
|
|
19823
|
+
}
|
|
19824
|
+
}, [dispatch, tin, finishedTyping]);
|
|
19825
|
+
useEffect(() => {
|
|
19826
|
+
handleInputChange(tin);
|
|
19827
|
+
}, [finishedTyping, tin, handleInputChange]); // Initialize tin field with user's tin (Tax Identification Number)
|
|
19828
|
+
|
|
19829
|
+
const loadTinIntoField = () => {
|
|
19830
|
+
handleInputChange(window.Pelcro.user.read().tin);
|
|
19831
|
+
dispatch({
|
|
19832
|
+
type: SET_TIN,
|
|
19833
|
+
payload: window.Pelcro.user.read().tin
|
|
19834
|
+
});
|
|
19835
|
+
};
|
|
19836
|
+
|
|
19837
|
+
useEffect(() => {
|
|
19838
|
+
if (initWithUserTin) {
|
|
19839
|
+
document.addEventListener("PelcroUserLoaded", () => {
|
|
19840
|
+
loadTinIntoField();
|
|
19841
|
+
});
|
|
19842
|
+
loadTinIntoField();
|
|
19843
|
+
return () => {
|
|
19844
|
+
document.removeEventListener("PelcroUserLoaded", handleInputChange);
|
|
19845
|
+
};
|
|
19846
|
+
}
|
|
19847
|
+
}, []);
|
|
19848
|
+
return /*#__PURE__*/React__default.createElement(Input, Object.assign({
|
|
19849
|
+
type: "text",
|
|
19850
|
+
value: tin,
|
|
19851
|
+
onChange: e => handleInputChange(e.target.value),
|
|
19852
|
+
onBlur: () => setFinishedTyping(true),
|
|
19853
|
+
onFocus: () => setFinishedTyping(false)
|
|
19854
|
+
}, otherProps));
|
|
19855
|
+
}
|
|
19856
|
+
|
|
19857
|
+
const UserUpdateTin = props => /*#__PURE__*/React__default.createElement(Tin, Object.assign({
|
|
19858
|
+
store: store$f
|
|
19859
|
+
}, props));
|
|
19860
|
+
|
|
19786
19861
|
const UserUpdateView = props => {
|
|
19787
19862
|
var _window$Pelcro$site$r;
|
|
19788
19863
|
|
|
@@ -19824,6 +19899,11 @@ const UserUpdateView = props => {
|
|
|
19824
19899
|
errorId: "pelcro-input-phone-error",
|
|
19825
19900
|
label: t("labels.phone"),
|
|
19826
19901
|
required: supportsTap ? true : false
|
|
19902
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
19903
|
+
className: "plc-flex plc-items-start"
|
|
19904
|
+
}, /*#__PURE__*/React__default.createElement(UserUpdateTin, {
|
|
19905
|
+
id: "pelcro-input-tin",
|
|
19906
|
+
label: t("labels.tin")
|
|
19827
19907
|
})), /*#__PURE__*/React__default.createElement(UserUpdateButton, {
|
|
19828
19908
|
role: "submit",
|
|
19829
19909
|
className: "plc-w-full plc-mt-2",
|
|
@@ -25725,14 +25805,14 @@ const SubscriptionsItems = ({
|
|
|
25725
25805
|
onClick: onRenewClick,
|
|
25726
25806
|
disabled: disableSubmit,
|
|
25727
25807
|
"data-key": sub.id
|
|
25728
|
-
}, t("labels.renew")), sub.shipments_suspended_until &&
|
|
25808
|
+
}, t("labels.renew")), sub.shipments_suspended_until && isDateAfterToday(sub.shipments_suspended_until) && sub.shipments_remaining > 0 && /*#__PURE__*/React__default.createElement(Button, {
|
|
25729
25809
|
variant: "ghost",
|
|
25730
25810
|
className: "plc-text-blue-400 pelcro-dashboard-sub-suspend-button",
|
|
25731
25811
|
icon: /*#__PURE__*/React__default.createElement(SvgXIconSolid, null),
|
|
25732
25812
|
onClick: onUnSuspendClick,
|
|
25733
25813
|
disabled: disableSubmit,
|
|
25734
25814
|
"data-key": sub.id
|
|
25735
|
-
}, t("labels.unsuspend")), (!sub.shipments_suspended_until && sub.shipments_remaining > 0 || sub.shipments_suspended_until &&
|
|
25815
|
+
}, t("labels.unsuspend")), (!sub.shipments_suspended_until && sub.shipments_remaining > 0 || sub.shipments_suspended_until && !isDateAfterToday(sub.shipments_suspended_until)) && /*#__PURE__*/React__default.createElement(Button, {
|
|
25736
25816
|
variant: "ghost",
|
|
25737
25817
|
className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-suspend-button",
|
|
25738
25818
|
icon: /*#__PURE__*/React__default.createElement(SvgCalendar, null),
|
|
@@ -25792,8 +25872,10 @@ function getNonDonationSubs() {
|
|
|
25792
25872
|
return (_window$Pelcro$subscr = (_window$Pelcro$subscr2 = window.Pelcro.subscription) === null || _window$Pelcro$subscr2 === void 0 ? void 0 : (_window$Pelcro$subscr3 = _window$Pelcro$subscr2.list()) === null || _window$Pelcro$subscr3 === void 0 ? void 0 : _window$Pelcro$subscr3.filter(sub => !sub.plan.is_donation)) !== null && _window$Pelcro$subscr !== void 0 ? _window$Pelcro$subscr : [];
|
|
25793
25873
|
}
|
|
25794
25874
|
|
|
25795
|
-
function
|
|
25796
|
-
|
|
25875
|
+
function isDateAfterToday(date) {
|
|
25876
|
+
const today = new Date().setHours(0, 0, 0, 0);
|
|
25877
|
+
const newDate = new Date(date).setHours(0, 0, 0, 0);
|
|
25878
|
+
return newDate === today ? true : newDate > today;
|
|
25797
25879
|
}
|
|
25798
25880
|
|
|
25799
25881
|
/**
|