@pelcro/react-pelcro-js 3.11.0-beta.4 → 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 +100 -14
- package/dist/index.esm.js +100 -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";
|
|
@@ -12987,6 +12991,10 @@ class SelectModal extends React.Component {
|
|
|
12987
12991
|
});
|
|
12988
12992
|
}
|
|
12989
12993
|
|
|
12994
|
+
if (this.state.productList.length === 0 && !window.Pelcro.user.isAuthenticated()) {
|
|
12995
|
+
this.props.setView('register');
|
|
12996
|
+
}
|
|
12997
|
+
|
|
12990
12998
|
document.addEventListener("keydown", this.handleSubmit);
|
|
12991
12999
|
});
|
|
12992
13000
|
|
|
@@ -19458,7 +19466,7 @@ function SubscriptionCreateModal({
|
|
|
19458
19466
|
}
|
|
19459
19467
|
SubscriptionCreateModal.viewId = "subscription-create";
|
|
19460
19468
|
|
|
19461
|
-
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;
|
|
19462
19470
|
const initialState$f = {
|
|
19463
19471
|
email: (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.email,
|
|
19464
19472
|
emailError: null,
|
|
@@ -19469,6 +19477,7 @@ const initialState$f = {
|
|
|
19469
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,
|
|
19470
19478
|
phone: (_window$Pelcro$user$r5 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r5 === void 0 ? void 0 : _window$Pelcro$user$r5.phone,
|
|
19471
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,
|
|
19472
19481
|
buttonDisabled: false,
|
|
19473
19482
|
textFields: {},
|
|
19474
19483
|
alert: {
|
|
@@ -19499,23 +19508,26 @@ const UserUpdateContainer = ({
|
|
|
19499
19508
|
}, []);
|
|
19500
19509
|
|
|
19501
19510
|
const loadUserDataIntoFields = () => {
|
|
19502
|
-
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;
|
|
19503
19512
|
|
|
19504
19513
|
const fields = [{
|
|
19505
19514
|
type: SET_EMAIL,
|
|
19506
|
-
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
|
|
19507
19516
|
}, {
|
|
19508
19517
|
type: SET_FIRST_NAME,
|
|
19509
|
-
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
|
|
19510
19519
|
}, {
|
|
19511
19520
|
type: SET_LAST_NAME,
|
|
19512
|
-
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
|
|
19513
19522
|
}, {
|
|
19514
19523
|
type: SET_DISPLAY_NAME,
|
|
19515
|
-
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
|
|
19516
19525
|
}, {
|
|
19517
19526
|
type: SET_PHONE,
|
|
19518
|
-
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
|
|
19519
19531
|
}];
|
|
19520
19532
|
fields.filter(field => Boolean(field.payload)).forEach(field => {
|
|
19521
19533
|
dispatch(field);
|
|
@@ -19527,6 +19539,7 @@ const UserUpdateContainer = ({
|
|
|
19527
19539
|
firstName,
|
|
19528
19540
|
lastName,
|
|
19529
19541
|
phone,
|
|
19542
|
+
tin,
|
|
19530
19543
|
textFields,
|
|
19531
19544
|
displayName
|
|
19532
19545
|
}, dispatch) => {
|
|
@@ -19537,6 +19550,7 @@ const UserUpdateContainer = ({
|
|
|
19537
19550
|
last_name: lastName,
|
|
19538
19551
|
display_name: displayName,
|
|
19539
19552
|
phone: phone,
|
|
19553
|
+
tin: tin,
|
|
19540
19554
|
metadata: {
|
|
19541
19555
|
updated: "updated",
|
|
19542
19556
|
...textFields
|
|
@@ -19625,6 +19639,11 @@ const UserUpdateContainer = ({
|
|
|
19625
19639
|
phoneError: null
|
|
19626
19640
|
});
|
|
19627
19641
|
|
|
19642
|
+
case SET_TIN:
|
|
19643
|
+
return lib_7({ ...state,
|
|
19644
|
+
tin: action.payload
|
|
19645
|
+
});
|
|
19646
|
+
|
|
19628
19647
|
case SET_PHONE_ERROR:
|
|
19629
19648
|
return lib_7({ ...state,
|
|
19630
19649
|
phoneError: action.payload,
|
|
@@ -19809,6 +19828,66 @@ const UserUpdateProfilePic = ({
|
|
|
19809
19828
|
})));
|
|
19810
19829
|
};
|
|
19811
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
|
+
|
|
19812
19891
|
const UserUpdateView = props => {
|
|
19813
19892
|
var _window$Pelcro$site$r;
|
|
19814
19893
|
|
|
@@ -19850,6 +19929,11 @@ const UserUpdateView = props => {
|
|
|
19850
19929
|
errorId: "pelcro-input-phone-error",
|
|
19851
19930
|
label: t("labels.phone"),
|
|
19852
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")
|
|
19853
19937
|
})), /*#__PURE__*/React__default['default'].createElement(UserUpdateButton, {
|
|
19854
19938
|
role: "submit",
|
|
19855
19939
|
className: "plc-w-full plc-mt-2",
|
|
@@ -25751,14 +25835,14 @@ const SubscriptionsItems = ({
|
|
|
25751
25835
|
onClick: onRenewClick,
|
|
25752
25836
|
disabled: disableSubmit,
|
|
25753
25837
|
"data-key": sub.id
|
|
25754
|
-
}, 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, {
|
|
25755
25839
|
variant: "ghost",
|
|
25756
25840
|
className: "plc-text-blue-400 pelcro-dashboard-sub-suspend-button",
|
|
25757
25841
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgXIconSolid, null),
|
|
25758
25842
|
onClick: onUnSuspendClick,
|
|
25759
25843
|
disabled: disableSubmit,
|
|
25760
25844
|
"data-key": sub.id
|
|
25761
|
-
}, 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, {
|
|
25762
25846
|
variant: "ghost",
|
|
25763
25847
|
className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-suspend-button",
|
|
25764
25848
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgCalendar, null),
|
|
@@ -25818,8 +25902,10 @@ function getNonDonationSubs() {
|
|
|
25818
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 : [];
|
|
25819
25903
|
}
|
|
25820
25904
|
|
|
25821
|
-
function
|
|
25822
|
-
|
|
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;
|
|
25823
25909
|
}
|
|
25824
25910
|
|
|
25825
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";
|
|
@@ -12957,6 +12961,10 @@ class SelectModal extends Component {
|
|
|
12957
12961
|
});
|
|
12958
12962
|
}
|
|
12959
12963
|
|
|
12964
|
+
if (this.state.productList.length === 0 && !window.Pelcro.user.isAuthenticated()) {
|
|
12965
|
+
this.props.setView('register');
|
|
12966
|
+
}
|
|
12967
|
+
|
|
12960
12968
|
document.addEventListener("keydown", this.handleSubmit);
|
|
12961
12969
|
});
|
|
12962
12970
|
|
|
@@ -19428,7 +19436,7 @@ function SubscriptionCreateModal({
|
|
|
19428
19436
|
}
|
|
19429
19437
|
SubscriptionCreateModal.viewId = "subscription-create";
|
|
19430
19438
|
|
|
19431
|
-
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;
|
|
19432
19440
|
const initialState$f = {
|
|
19433
19441
|
email: (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.email,
|
|
19434
19442
|
emailError: null,
|
|
@@ -19439,6 +19447,7 @@ const initialState$f = {
|
|
|
19439
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,
|
|
19440
19448
|
phone: (_window$Pelcro$user$r5 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r5 === void 0 ? void 0 : _window$Pelcro$user$r5.phone,
|
|
19441
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,
|
|
19442
19451
|
buttonDisabled: false,
|
|
19443
19452
|
textFields: {},
|
|
19444
19453
|
alert: {
|
|
@@ -19469,23 +19478,26 @@ const UserUpdateContainer = ({
|
|
|
19469
19478
|
}, []);
|
|
19470
19479
|
|
|
19471
19480
|
const loadUserDataIntoFields = () => {
|
|
19472
|
-
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;
|
|
19473
19482
|
|
|
19474
19483
|
const fields = [{
|
|
19475
19484
|
type: SET_EMAIL,
|
|
19476
|
-
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
|
|
19477
19486
|
}, {
|
|
19478
19487
|
type: SET_FIRST_NAME,
|
|
19479
|
-
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
|
|
19480
19489
|
}, {
|
|
19481
19490
|
type: SET_LAST_NAME,
|
|
19482
|
-
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
|
|
19483
19492
|
}, {
|
|
19484
19493
|
type: SET_DISPLAY_NAME,
|
|
19485
|
-
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
|
|
19486
19495
|
}, {
|
|
19487
19496
|
type: SET_PHONE,
|
|
19488
|
-
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
|
|
19489
19501
|
}];
|
|
19490
19502
|
fields.filter(field => Boolean(field.payload)).forEach(field => {
|
|
19491
19503
|
dispatch(field);
|
|
@@ -19497,6 +19509,7 @@ const UserUpdateContainer = ({
|
|
|
19497
19509
|
firstName,
|
|
19498
19510
|
lastName,
|
|
19499
19511
|
phone,
|
|
19512
|
+
tin,
|
|
19500
19513
|
textFields,
|
|
19501
19514
|
displayName
|
|
19502
19515
|
}, dispatch) => {
|
|
@@ -19507,6 +19520,7 @@ const UserUpdateContainer = ({
|
|
|
19507
19520
|
last_name: lastName,
|
|
19508
19521
|
display_name: displayName,
|
|
19509
19522
|
phone: phone,
|
|
19523
|
+
tin: tin,
|
|
19510
19524
|
metadata: {
|
|
19511
19525
|
updated: "updated",
|
|
19512
19526
|
...textFields
|
|
@@ -19595,6 +19609,11 @@ const UserUpdateContainer = ({
|
|
|
19595
19609
|
phoneError: null
|
|
19596
19610
|
});
|
|
19597
19611
|
|
|
19612
|
+
case SET_TIN:
|
|
19613
|
+
return lib_7({ ...state,
|
|
19614
|
+
tin: action.payload
|
|
19615
|
+
});
|
|
19616
|
+
|
|
19598
19617
|
case SET_PHONE_ERROR:
|
|
19599
19618
|
return lib_7({ ...state,
|
|
19600
19619
|
phoneError: action.payload,
|
|
@@ -19779,6 +19798,66 @@ const UserUpdateProfilePic = ({
|
|
|
19779
19798
|
})));
|
|
19780
19799
|
};
|
|
19781
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
|
+
|
|
19782
19861
|
const UserUpdateView = props => {
|
|
19783
19862
|
var _window$Pelcro$site$r;
|
|
19784
19863
|
|
|
@@ -19820,6 +19899,11 @@ const UserUpdateView = props => {
|
|
|
19820
19899
|
errorId: "pelcro-input-phone-error",
|
|
19821
19900
|
label: t("labels.phone"),
|
|
19822
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")
|
|
19823
19907
|
})), /*#__PURE__*/React__default.createElement(UserUpdateButton, {
|
|
19824
19908
|
role: "submit",
|
|
19825
19909
|
className: "plc-w-full plc-mt-2",
|
|
@@ -25721,14 +25805,14 @@ const SubscriptionsItems = ({
|
|
|
25721
25805
|
onClick: onRenewClick,
|
|
25722
25806
|
disabled: disableSubmit,
|
|
25723
25807
|
"data-key": sub.id
|
|
25724
|
-
}, 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, {
|
|
25725
25809
|
variant: "ghost",
|
|
25726
25810
|
className: "plc-text-blue-400 pelcro-dashboard-sub-suspend-button",
|
|
25727
25811
|
icon: /*#__PURE__*/React__default.createElement(SvgXIconSolid, null),
|
|
25728
25812
|
onClick: onUnSuspendClick,
|
|
25729
25813
|
disabled: disableSubmit,
|
|
25730
25814
|
"data-key": sub.id
|
|
25731
|
-
}, 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, {
|
|
25732
25816
|
variant: "ghost",
|
|
25733
25817
|
className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-suspend-button",
|
|
25734
25818
|
icon: /*#__PURE__*/React__default.createElement(SvgCalendar, null),
|
|
@@ -25788,8 +25872,10 @@ function getNonDonationSubs() {
|
|
|
25788
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 : [];
|
|
25789
25873
|
}
|
|
25790
25874
|
|
|
25791
|
-
function
|
|
25792
|
-
|
|
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;
|
|
25793
25879
|
}
|
|
25794
25880
|
|
|
25795
25881
|
/**
|