@pelcro/react-pelcro-js 4.0.0-alpha.4 → 4.0.0-alpha.5
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 +133 -12
- package/dist/index.esm.js +133 -12
- 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: "감사합니다! 프로필이 성공적으로 업데이트되었습니다.",
|
|
@@ -8095,6 +8098,7 @@ class PelcroActions {
|
|
|
8095
8098
|
} = this.get();
|
|
8096
8099
|
switchView(null);
|
|
8097
8100
|
resetState();
|
|
8101
|
+
window.sessionStorage.setItem("paywall_conversion_id", null);
|
|
8098
8102
|
});
|
|
8099
8103
|
|
|
8100
8104
|
_defineProperty$3(this, "switchToPaymentView", () => {
|
|
@@ -10907,6 +10911,8 @@ const initPaywalls = () => {
|
|
|
10907
10911
|
} else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayNewsletterPaywall()) {
|
|
10908
10912
|
switchView("newsletter");
|
|
10909
10913
|
} else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayPaywall()) {
|
|
10914
|
+
const paywallId = window.Pelcro.paywall.read().id;
|
|
10915
|
+
window.sessionStorage.setItem("paywall_conversion_id", paywallId);
|
|
10910
10916
|
switchView("plan-select");
|
|
10911
10917
|
}
|
|
10912
10918
|
}
|
|
@@ -11695,6 +11701,7 @@ const SET_LAST_NAME = "SET_LAST_NAME";
|
|
|
11695
11701
|
const SET_START_DATE = "SET_START_DATE";
|
|
11696
11702
|
const SET_GIFT_MESSAGE = "SET_GIFT_MESSAGE";
|
|
11697
11703
|
const SET_PHONE = "SET_PHONE";
|
|
11704
|
+
const SET_TIN = "SET_TIN";
|
|
11698
11705
|
const GET_COUNTRIES_SUCCESS = "GET_COUNTRIES_SUCCESS";
|
|
11699
11706
|
const GET_COUNTRIES_FETCH = "GET_COUNTRIES_FETCH";
|
|
11700
11707
|
const GET_STATES_SUCCESS = "GET_STATES_SUCCESS";
|
|
@@ -15317,6 +15324,10 @@ class SelectModal extends React.Component {
|
|
|
15317
15324
|
});
|
|
15318
15325
|
}
|
|
15319
15326
|
|
|
15327
|
+
if (this.state.productList.length === 0 && !window.Pelcro.user.isAuthenticated()) {
|
|
15328
|
+
this.props.setView('register');
|
|
15329
|
+
}
|
|
15330
|
+
|
|
15320
15331
|
document.addEventListener("keydown", this.handleSubmit);
|
|
15321
15332
|
});
|
|
15322
15333
|
|
|
@@ -18702,6 +18713,23 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18702
18713
|
updateTotalAmountWithTax();
|
|
18703
18714
|
}
|
|
18704
18715
|
};
|
|
18716
|
+
|
|
18717
|
+
const trackPaywallConversion = subscriptionId => {
|
|
18718
|
+
const paywallId = window.sessionStorage.getItem("paywall_conversion_id");
|
|
18719
|
+
const userId = window.Pelcro.user.read().id;
|
|
18720
|
+
const planId = plan.id;
|
|
18721
|
+
const productId = product.id;
|
|
18722
|
+
|
|
18723
|
+
if (paywallId) {
|
|
18724
|
+
window.Pelcro.insight.track(`Paywall Conversion: ${paywallId}`, {
|
|
18725
|
+
userId,
|
|
18726
|
+
subscriptionId,
|
|
18727
|
+
planId,
|
|
18728
|
+
productId
|
|
18729
|
+
});
|
|
18730
|
+
window.sessionStorage.setItem("paywall_conversion_id", null);
|
|
18731
|
+
}
|
|
18732
|
+
};
|
|
18705
18733
|
/**
|
|
18706
18734
|
* Attempt to confirm a Stripe card payment via it's PaymentIntent.
|
|
18707
18735
|
* Only trigger method if PaymentIntent status is `requires_action`.
|
|
@@ -18722,6 +18750,8 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18722
18750
|
|
|
18723
18751
|
if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_action" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
|
|
18724
18752
|
stripe.confirmCardPayment(paymentIntent.client_secret).then(res => {
|
|
18753
|
+
var _response$data2;
|
|
18754
|
+
|
|
18725
18755
|
if (!isSubCreate) {
|
|
18726
18756
|
dispatch({
|
|
18727
18757
|
type: DISABLE_SUBMIT,
|
|
@@ -18745,6 +18775,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18745
18775
|
});
|
|
18746
18776
|
}
|
|
18747
18777
|
|
|
18778
|
+
trackPaywallConversion((_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.id);
|
|
18748
18779
|
onSuccess(res);
|
|
18749
18780
|
});
|
|
18750
18781
|
} else if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_payment_method" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
|
|
@@ -18767,9 +18798,14 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18767
18798
|
}
|
|
18768
18799
|
});
|
|
18769
18800
|
} else {
|
|
18801
|
+
var _response$data3;
|
|
18802
|
+
|
|
18803
|
+
trackPaywallConversion((_response$data3 = response.data) === null || _response$data3 === void 0 ? void 0 : _response$data3.id);
|
|
18770
18804
|
onSuccess(response);
|
|
18771
18805
|
}
|
|
18772
18806
|
} else {
|
|
18807
|
+
var _response$data4;
|
|
18808
|
+
|
|
18773
18809
|
dispatch({
|
|
18774
18810
|
type: DISABLE_SUBMIT,
|
|
18775
18811
|
payload: false
|
|
@@ -18790,6 +18826,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18790
18826
|
});
|
|
18791
18827
|
}
|
|
18792
18828
|
|
|
18829
|
+
trackPaywallConversion((_response$data4 = response.data) === null || _response$data4 === void 0 ? void 0 : _response$data4.id);
|
|
18793
18830
|
onSuccess(response);
|
|
18794
18831
|
}
|
|
18795
18832
|
};
|
|
@@ -18849,6 +18886,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18849
18886
|
});
|
|
18850
18887
|
}
|
|
18851
18888
|
|
|
18889
|
+
trackPaywallConversion(subscriptionIdToRenew);
|
|
18852
18890
|
onGiftRenewalSuccess(res);
|
|
18853
18891
|
});
|
|
18854
18892
|
} else {
|
|
@@ -18882,6 +18920,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18882
18920
|
});
|
|
18883
18921
|
}
|
|
18884
18922
|
|
|
18923
|
+
trackPaywallConversion(subscriptionIdToRenew);
|
|
18885
18924
|
onSuccess(res);
|
|
18886
18925
|
});
|
|
18887
18926
|
}
|
|
@@ -21916,7 +21955,7 @@ function SubscriptionCreateModal({
|
|
|
21916
21955
|
}
|
|
21917
21956
|
SubscriptionCreateModal.viewId = "subscription-create";
|
|
21918
21957
|
|
|
21919
|
-
var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window$Pelcro$user$r3, _window$Pelcro$user$r4, _window$Pelcro$user$r5;
|
|
21958
|
+
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;
|
|
21920
21959
|
const initialState$f = {
|
|
21921
21960
|
email: (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.email,
|
|
21922
21961
|
emailError: null,
|
|
@@ -21927,6 +21966,7 @@ const initialState$f = {
|
|
|
21927
21966
|
displayName: (_window$Pelcro$user$r4 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r4 === void 0 ? void 0 : _window$Pelcro$user$r4.display_name,
|
|
21928
21967
|
phone: (_window$Pelcro$user$r5 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r5 === void 0 ? void 0 : _window$Pelcro$user$r5.phone,
|
|
21929
21968
|
phoneError: null,
|
|
21969
|
+
tin: (_window$Pelcro$user$r6 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r6 === void 0 ? void 0 : _window$Pelcro$user$r6.tin,
|
|
21930
21970
|
buttonDisabled: false,
|
|
21931
21971
|
textFields: {},
|
|
21932
21972
|
alert: {
|
|
@@ -21957,23 +21997,26 @@ const UserUpdateContainer = ({
|
|
|
21957
21997
|
}, []);
|
|
21958
21998
|
|
|
21959
21999
|
const loadUserDataIntoFields = () => {
|
|
21960
|
-
var _window$Pelcro$user$
|
|
22000
|
+
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;
|
|
21961
22001
|
|
|
21962
22002
|
const fields = [{
|
|
21963
22003
|
type: SET_EMAIL,
|
|
21964
|
-
payload: (_window$Pelcro$user$
|
|
22004
|
+
payload: (_window$Pelcro$user$r7 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r7 === void 0 ? void 0 : _window$Pelcro$user$r7.email
|
|
21965
22005
|
}, {
|
|
21966
22006
|
type: SET_FIRST_NAME,
|
|
21967
|
-
payload: (_window$Pelcro$user$
|
|
22007
|
+
payload: (_window$Pelcro$user$r8 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r8 === void 0 ? void 0 : _window$Pelcro$user$r8.first_name
|
|
21968
22008
|
}, {
|
|
21969
22009
|
type: SET_LAST_NAME,
|
|
21970
|
-
payload: (_window$Pelcro$user$
|
|
22010
|
+
payload: (_window$Pelcro$user$r9 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r9 === void 0 ? void 0 : _window$Pelcro$user$r9.last_name
|
|
21971
22011
|
}, {
|
|
21972
22012
|
type: SET_DISPLAY_NAME,
|
|
21973
|
-
payload: (_window$Pelcro$user$
|
|
22013
|
+
payload: (_window$Pelcro$user$r10 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r10 === void 0 ? void 0 : _window$Pelcro$user$r10.display_name
|
|
21974
22014
|
}, {
|
|
21975
22015
|
type: SET_PHONE,
|
|
21976
|
-
payload: (_window$Pelcro$user$
|
|
22016
|
+
payload: (_window$Pelcro$user$r11 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r11 === void 0 ? void 0 : _window$Pelcro$user$r11.phone
|
|
22017
|
+
}, {
|
|
22018
|
+
type: SET_TIN,
|
|
22019
|
+
payload: (_window$Pelcro$user$r12 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r12 === void 0 ? void 0 : _window$Pelcro$user$r12.tin
|
|
21977
22020
|
}];
|
|
21978
22021
|
fields.filter(field => Boolean(field.payload)).forEach(field => {
|
|
21979
22022
|
dispatch(field);
|
|
@@ -21985,6 +22028,7 @@ const UserUpdateContainer = ({
|
|
|
21985
22028
|
firstName,
|
|
21986
22029
|
lastName,
|
|
21987
22030
|
phone,
|
|
22031
|
+
tin,
|
|
21988
22032
|
textFields,
|
|
21989
22033
|
displayName
|
|
21990
22034
|
}, dispatch) => {
|
|
@@ -21995,6 +22039,7 @@ const UserUpdateContainer = ({
|
|
|
21995
22039
|
last_name: lastName,
|
|
21996
22040
|
display_name: displayName,
|
|
21997
22041
|
phone: phone,
|
|
22042
|
+
tin: tin,
|
|
21998
22043
|
metadata: {
|
|
21999
22044
|
updated: "updated",
|
|
22000
22045
|
...textFields
|
|
@@ -22083,6 +22128,11 @@ const UserUpdateContainer = ({
|
|
|
22083
22128
|
phoneError: null
|
|
22084
22129
|
});
|
|
22085
22130
|
|
|
22131
|
+
case SET_TIN:
|
|
22132
|
+
return lib_7({ ...state,
|
|
22133
|
+
tin: action.payload
|
|
22134
|
+
});
|
|
22135
|
+
|
|
22086
22136
|
case SET_PHONE_ERROR:
|
|
22087
22137
|
return lib_7({ ...state,
|
|
22088
22138
|
phoneError: action.payload,
|
|
@@ -22267,6 +22317,66 @@ const UserUpdateProfilePic = ({
|
|
|
22267
22317
|
})));
|
|
22268
22318
|
};
|
|
22269
22319
|
|
|
22320
|
+
function Tin({
|
|
22321
|
+
initWithUserTin = true,
|
|
22322
|
+
store,
|
|
22323
|
+
...otherProps
|
|
22324
|
+
}) {
|
|
22325
|
+
useTranslation$1("common");
|
|
22326
|
+
const {
|
|
22327
|
+
dispatch,
|
|
22328
|
+
state: {
|
|
22329
|
+
tin: stateTin
|
|
22330
|
+
}
|
|
22331
|
+
} = React.useContext(store);
|
|
22332
|
+
const [tin, setTin] = React.useState(stateTin);
|
|
22333
|
+
const [finishedTyping, setFinishedTyping] = React.useState(false);
|
|
22334
|
+
const handleInputChange = React.useCallback(value => {
|
|
22335
|
+
setTin(value);
|
|
22336
|
+
|
|
22337
|
+
if (finishedTyping) {
|
|
22338
|
+
dispatch({
|
|
22339
|
+
type: SET_TIN,
|
|
22340
|
+
payload: tin
|
|
22341
|
+
});
|
|
22342
|
+
}
|
|
22343
|
+
}, [dispatch, tin, finishedTyping]);
|
|
22344
|
+
React.useEffect(() => {
|
|
22345
|
+
handleInputChange(tin);
|
|
22346
|
+
}, [finishedTyping, tin, handleInputChange]); // Initialize tin field with user's tin (Tax Identification Number)
|
|
22347
|
+
|
|
22348
|
+
const loadTinIntoField = () => {
|
|
22349
|
+
handleInputChange(window.Pelcro.user.read().tin);
|
|
22350
|
+
dispatch({
|
|
22351
|
+
type: SET_TIN,
|
|
22352
|
+
payload: window.Pelcro.user.read().tin
|
|
22353
|
+
});
|
|
22354
|
+
};
|
|
22355
|
+
|
|
22356
|
+
React.useEffect(() => {
|
|
22357
|
+
if (initWithUserTin) {
|
|
22358
|
+
document.addEventListener("PelcroUserLoaded", () => {
|
|
22359
|
+
loadTinIntoField();
|
|
22360
|
+
});
|
|
22361
|
+
loadTinIntoField();
|
|
22362
|
+
return () => {
|
|
22363
|
+
document.removeEventListener("PelcroUserLoaded", handleInputChange);
|
|
22364
|
+
};
|
|
22365
|
+
}
|
|
22366
|
+
}, []);
|
|
22367
|
+
return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
|
|
22368
|
+
type: "text",
|
|
22369
|
+
value: tin,
|
|
22370
|
+
onChange: e => handleInputChange(e.target.value),
|
|
22371
|
+
onBlur: () => setFinishedTyping(true),
|
|
22372
|
+
onFocus: () => setFinishedTyping(false)
|
|
22373
|
+
}, otherProps));
|
|
22374
|
+
}
|
|
22375
|
+
|
|
22376
|
+
const UserUpdateTin = props => /*#__PURE__*/React__default['default'].createElement(Tin, Object.assign({
|
|
22377
|
+
store: store$f
|
|
22378
|
+
}, props));
|
|
22379
|
+
|
|
22270
22380
|
const UserUpdateView = props => {
|
|
22271
22381
|
var _window$Pelcro$site$r;
|
|
22272
22382
|
|
|
@@ -22304,6 +22414,11 @@ const UserUpdateView = props => {
|
|
|
22304
22414
|
errorId: "pelcro-input-phone-error",
|
|
22305
22415
|
label: t("labels.phone"),
|
|
22306
22416
|
required: supportsTap ? true : false
|
|
22417
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
22418
|
+
className: "plc-flex plc-items-start"
|
|
22419
|
+
}, /*#__PURE__*/React__default['default'].createElement(UserUpdateTin, {
|
|
22420
|
+
id: "pelcro-input-tin",
|
|
22421
|
+
label: t("labels.tin")
|
|
22307
22422
|
})), /*#__PURE__*/React__default['default'].createElement(UserUpdateButton, {
|
|
22308
22423
|
role: "submit",
|
|
22309
22424
|
className: "plc-w-full plc-mt-2",
|
|
@@ -28355,14 +28470,14 @@ const SubscriptionsItems = ({
|
|
|
28355
28470
|
onClick: onRenewClick,
|
|
28356
28471
|
disabled: disableSubmit,
|
|
28357
28472
|
"data-key": sub.id
|
|
28358
|
-
}, t("labels.renew")), sub.shipments_suspended_until && sub.shipments_remaining > 0 && /*#__PURE__*/React__default['default'].createElement(Button$1, {
|
|
28473
|
+
}, t("labels.renew")), sub.shipments_suspended_until && isDateAfterToday(sub.shipments_suspended_until) && sub.shipments_remaining > 0 && /*#__PURE__*/React__default['default'].createElement(Button$1, {
|
|
28359
28474
|
variant: "ghost",
|
|
28360
28475
|
className: "plc-text-blue-400 pelcro-dashboard-sub-suspend-button",
|
|
28361
28476
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgXIconSolid, null),
|
|
28362
28477
|
onClick: onUnSuspendClick,
|
|
28363
28478
|
disabled: disableSubmit,
|
|
28364
28479
|
"data-key": sub.id
|
|
28365
|
-
}, t("labels.unsuspend")), !sub.shipments_suspended_until && sub.shipments_remaining > 0 && /*#__PURE__*/React__default['default'].createElement(Button$1, {
|
|
28480
|
+
}, 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$1, {
|
|
28366
28481
|
variant: "ghost",
|
|
28367
28482
|
className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-suspend-button",
|
|
28368
28483
|
icon: /*#__PURE__*/React__default['default'].createElement(SvgCalendar, null),
|
|
@@ -28422,6 +28537,12 @@ function getNonDonationSubs() {
|
|
|
28422
28537
|
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 : [];
|
|
28423
28538
|
}
|
|
28424
28539
|
|
|
28540
|
+
function isDateAfterToday(date) {
|
|
28541
|
+
const today = new Date().setHours(0, 0, 0, 0);
|
|
28542
|
+
const newDate = new Date(date).setHours(0, 0, 0, 0);
|
|
28543
|
+
return newDate === today ? true : newDate > today;
|
|
28544
|
+
}
|
|
28545
|
+
|
|
28425
28546
|
/**
|
|
28426
28547
|
* @typedef {Object} AccordionPropsType
|
|
28427
28548
|
* @property {string} initialActiveMenu the initial active menu
|
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: "감사합니다! 프로필이 성공적으로 업데이트되었습니다.",
|
|
@@ -8065,6 +8068,7 @@ class PelcroActions {
|
|
|
8065
8068
|
} = this.get();
|
|
8066
8069
|
switchView(null);
|
|
8067
8070
|
resetState();
|
|
8071
|
+
window.sessionStorage.setItem("paywall_conversion_id", null);
|
|
8068
8072
|
});
|
|
8069
8073
|
|
|
8070
8074
|
_defineProperty$3(this, "switchToPaymentView", () => {
|
|
@@ -10877,6 +10881,8 @@ const initPaywalls = () => {
|
|
|
10877
10881
|
} else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayNewsletterPaywall()) {
|
|
10878
10882
|
switchView("newsletter");
|
|
10879
10883
|
} else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayPaywall()) {
|
|
10884
|
+
const paywallId = window.Pelcro.paywall.read().id;
|
|
10885
|
+
window.sessionStorage.setItem("paywall_conversion_id", paywallId);
|
|
10880
10886
|
switchView("plan-select");
|
|
10881
10887
|
}
|
|
10882
10888
|
}
|
|
@@ -11665,6 +11671,7 @@ const SET_LAST_NAME = "SET_LAST_NAME";
|
|
|
11665
11671
|
const SET_START_DATE = "SET_START_DATE";
|
|
11666
11672
|
const SET_GIFT_MESSAGE = "SET_GIFT_MESSAGE";
|
|
11667
11673
|
const SET_PHONE = "SET_PHONE";
|
|
11674
|
+
const SET_TIN = "SET_TIN";
|
|
11668
11675
|
const GET_COUNTRIES_SUCCESS = "GET_COUNTRIES_SUCCESS";
|
|
11669
11676
|
const GET_COUNTRIES_FETCH = "GET_COUNTRIES_FETCH";
|
|
11670
11677
|
const GET_STATES_SUCCESS = "GET_STATES_SUCCESS";
|
|
@@ -15287,6 +15294,10 @@ class SelectModal extends Component {
|
|
|
15287
15294
|
});
|
|
15288
15295
|
}
|
|
15289
15296
|
|
|
15297
|
+
if (this.state.productList.length === 0 && !window.Pelcro.user.isAuthenticated()) {
|
|
15298
|
+
this.props.setView('register');
|
|
15299
|
+
}
|
|
15300
|
+
|
|
15290
15301
|
document.addEventListener("keydown", this.handleSubmit);
|
|
15291
15302
|
});
|
|
15292
15303
|
|
|
@@ -18672,6 +18683,23 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18672
18683
|
updateTotalAmountWithTax();
|
|
18673
18684
|
}
|
|
18674
18685
|
};
|
|
18686
|
+
|
|
18687
|
+
const trackPaywallConversion = subscriptionId => {
|
|
18688
|
+
const paywallId = window.sessionStorage.getItem("paywall_conversion_id");
|
|
18689
|
+
const userId = window.Pelcro.user.read().id;
|
|
18690
|
+
const planId = plan.id;
|
|
18691
|
+
const productId = product.id;
|
|
18692
|
+
|
|
18693
|
+
if (paywallId) {
|
|
18694
|
+
window.Pelcro.insight.track(`Paywall Conversion: ${paywallId}`, {
|
|
18695
|
+
userId,
|
|
18696
|
+
subscriptionId,
|
|
18697
|
+
planId,
|
|
18698
|
+
productId
|
|
18699
|
+
});
|
|
18700
|
+
window.sessionStorage.setItem("paywall_conversion_id", null);
|
|
18701
|
+
}
|
|
18702
|
+
};
|
|
18675
18703
|
/**
|
|
18676
18704
|
* Attempt to confirm a Stripe card payment via it's PaymentIntent.
|
|
18677
18705
|
* Only trigger method if PaymentIntent status is `requires_action`.
|
|
@@ -18692,6 +18720,8 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18692
18720
|
|
|
18693
18721
|
if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_action" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
|
|
18694
18722
|
stripe.confirmCardPayment(paymentIntent.client_secret).then(res => {
|
|
18723
|
+
var _response$data2;
|
|
18724
|
+
|
|
18695
18725
|
if (!isSubCreate) {
|
|
18696
18726
|
dispatch({
|
|
18697
18727
|
type: DISABLE_SUBMIT,
|
|
@@ -18715,6 +18745,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18715
18745
|
});
|
|
18716
18746
|
}
|
|
18717
18747
|
|
|
18748
|
+
trackPaywallConversion((_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.id);
|
|
18718
18749
|
onSuccess(res);
|
|
18719
18750
|
});
|
|
18720
18751
|
} else if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_payment_method" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
|
|
@@ -18737,9 +18768,14 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18737
18768
|
}
|
|
18738
18769
|
});
|
|
18739
18770
|
} else {
|
|
18771
|
+
var _response$data3;
|
|
18772
|
+
|
|
18773
|
+
trackPaywallConversion((_response$data3 = response.data) === null || _response$data3 === void 0 ? void 0 : _response$data3.id);
|
|
18740
18774
|
onSuccess(response);
|
|
18741
18775
|
}
|
|
18742
18776
|
} else {
|
|
18777
|
+
var _response$data4;
|
|
18778
|
+
|
|
18743
18779
|
dispatch({
|
|
18744
18780
|
type: DISABLE_SUBMIT,
|
|
18745
18781
|
payload: false
|
|
@@ -18760,6 +18796,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18760
18796
|
});
|
|
18761
18797
|
}
|
|
18762
18798
|
|
|
18799
|
+
trackPaywallConversion((_response$data4 = response.data) === null || _response$data4 === void 0 ? void 0 : _response$data4.id);
|
|
18763
18800
|
onSuccess(response);
|
|
18764
18801
|
}
|
|
18765
18802
|
};
|
|
@@ -18819,6 +18856,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18819
18856
|
});
|
|
18820
18857
|
}
|
|
18821
18858
|
|
|
18859
|
+
trackPaywallConversion(subscriptionIdToRenew);
|
|
18822
18860
|
onGiftRenewalSuccess(res);
|
|
18823
18861
|
});
|
|
18824
18862
|
} else {
|
|
@@ -18852,6 +18890,7 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18852
18890
|
});
|
|
18853
18891
|
}
|
|
18854
18892
|
|
|
18893
|
+
trackPaywallConversion(subscriptionIdToRenew);
|
|
18855
18894
|
onSuccess(res);
|
|
18856
18895
|
});
|
|
18857
18896
|
}
|
|
@@ -21886,7 +21925,7 @@ function SubscriptionCreateModal({
|
|
|
21886
21925
|
}
|
|
21887
21926
|
SubscriptionCreateModal.viewId = "subscription-create";
|
|
21888
21927
|
|
|
21889
|
-
var _window$Pelcro$user$r, _window$Pelcro$user$r2, _window$Pelcro$user$r3, _window$Pelcro$user$r4, _window$Pelcro$user$r5;
|
|
21928
|
+
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;
|
|
21890
21929
|
const initialState$f = {
|
|
21891
21930
|
email: (_window$Pelcro$user$r = window.Pelcro.user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.email,
|
|
21892
21931
|
emailError: null,
|
|
@@ -21897,6 +21936,7 @@ const initialState$f = {
|
|
|
21897
21936
|
displayName: (_window$Pelcro$user$r4 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r4 === void 0 ? void 0 : _window$Pelcro$user$r4.display_name,
|
|
21898
21937
|
phone: (_window$Pelcro$user$r5 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r5 === void 0 ? void 0 : _window$Pelcro$user$r5.phone,
|
|
21899
21938
|
phoneError: null,
|
|
21939
|
+
tin: (_window$Pelcro$user$r6 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r6 === void 0 ? void 0 : _window$Pelcro$user$r6.tin,
|
|
21900
21940
|
buttonDisabled: false,
|
|
21901
21941
|
textFields: {},
|
|
21902
21942
|
alert: {
|
|
@@ -21927,23 +21967,26 @@ const UserUpdateContainer = ({
|
|
|
21927
21967
|
}, []);
|
|
21928
21968
|
|
|
21929
21969
|
const loadUserDataIntoFields = () => {
|
|
21930
|
-
var _window$Pelcro$user$
|
|
21970
|
+
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;
|
|
21931
21971
|
|
|
21932
21972
|
const fields = [{
|
|
21933
21973
|
type: SET_EMAIL,
|
|
21934
|
-
payload: (_window$Pelcro$user$
|
|
21974
|
+
payload: (_window$Pelcro$user$r7 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r7 === void 0 ? void 0 : _window$Pelcro$user$r7.email
|
|
21935
21975
|
}, {
|
|
21936
21976
|
type: SET_FIRST_NAME,
|
|
21937
|
-
payload: (_window$Pelcro$user$
|
|
21977
|
+
payload: (_window$Pelcro$user$r8 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r8 === void 0 ? void 0 : _window$Pelcro$user$r8.first_name
|
|
21938
21978
|
}, {
|
|
21939
21979
|
type: SET_LAST_NAME,
|
|
21940
|
-
payload: (_window$Pelcro$user$
|
|
21980
|
+
payload: (_window$Pelcro$user$r9 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r9 === void 0 ? void 0 : _window$Pelcro$user$r9.last_name
|
|
21941
21981
|
}, {
|
|
21942
21982
|
type: SET_DISPLAY_NAME,
|
|
21943
|
-
payload: (_window$Pelcro$user$
|
|
21983
|
+
payload: (_window$Pelcro$user$r10 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r10 === void 0 ? void 0 : _window$Pelcro$user$r10.display_name
|
|
21944
21984
|
}, {
|
|
21945
21985
|
type: SET_PHONE,
|
|
21946
|
-
payload: (_window$Pelcro$user$
|
|
21986
|
+
payload: (_window$Pelcro$user$r11 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r11 === void 0 ? void 0 : _window$Pelcro$user$r11.phone
|
|
21987
|
+
}, {
|
|
21988
|
+
type: SET_TIN,
|
|
21989
|
+
payload: (_window$Pelcro$user$r12 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r12 === void 0 ? void 0 : _window$Pelcro$user$r12.tin
|
|
21947
21990
|
}];
|
|
21948
21991
|
fields.filter(field => Boolean(field.payload)).forEach(field => {
|
|
21949
21992
|
dispatch(field);
|
|
@@ -21955,6 +21998,7 @@ const UserUpdateContainer = ({
|
|
|
21955
21998
|
firstName,
|
|
21956
21999
|
lastName,
|
|
21957
22000
|
phone,
|
|
22001
|
+
tin,
|
|
21958
22002
|
textFields,
|
|
21959
22003
|
displayName
|
|
21960
22004
|
}, dispatch) => {
|
|
@@ -21965,6 +22009,7 @@ const UserUpdateContainer = ({
|
|
|
21965
22009
|
last_name: lastName,
|
|
21966
22010
|
display_name: displayName,
|
|
21967
22011
|
phone: phone,
|
|
22012
|
+
tin: tin,
|
|
21968
22013
|
metadata: {
|
|
21969
22014
|
updated: "updated",
|
|
21970
22015
|
...textFields
|
|
@@ -22053,6 +22098,11 @@ const UserUpdateContainer = ({
|
|
|
22053
22098
|
phoneError: null
|
|
22054
22099
|
});
|
|
22055
22100
|
|
|
22101
|
+
case SET_TIN:
|
|
22102
|
+
return lib_7({ ...state,
|
|
22103
|
+
tin: action.payload
|
|
22104
|
+
});
|
|
22105
|
+
|
|
22056
22106
|
case SET_PHONE_ERROR:
|
|
22057
22107
|
return lib_7({ ...state,
|
|
22058
22108
|
phoneError: action.payload,
|
|
@@ -22237,6 +22287,66 @@ const UserUpdateProfilePic = ({
|
|
|
22237
22287
|
})));
|
|
22238
22288
|
};
|
|
22239
22289
|
|
|
22290
|
+
function Tin({
|
|
22291
|
+
initWithUserTin = true,
|
|
22292
|
+
store,
|
|
22293
|
+
...otherProps
|
|
22294
|
+
}) {
|
|
22295
|
+
useTranslation$1("common");
|
|
22296
|
+
const {
|
|
22297
|
+
dispatch,
|
|
22298
|
+
state: {
|
|
22299
|
+
tin: stateTin
|
|
22300
|
+
}
|
|
22301
|
+
} = useContext(store);
|
|
22302
|
+
const [tin, setTin] = useState(stateTin);
|
|
22303
|
+
const [finishedTyping, setFinishedTyping] = useState(false);
|
|
22304
|
+
const handleInputChange = useCallback(value => {
|
|
22305
|
+
setTin(value);
|
|
22306
|
+
|
|
22307
|
+
if (finishedTyping) {
|
|
22308
|
+
dispatch({
|
|
22309
|
+
type: SET_TIN,
|
|
22310
|
+
payload: tin
|
|
22311
|
+
});
|
|
22312
|
+
}
|
|
22313
|
+
}, [dispatch, tin, finishedTyping]);
|
|
22314
|
+
useEffect(() => {
|
|
22315
|
+
handleInputChange(tin);
|
|
22316
|
+
}, [finishedTyping, tin, handleInputChange]); // Initialize tin field with user's tin (Tax Identification Number)
|
|
22317
|
+
|
|
22318
|
+
const loadTinIntoField = () => {
|
|
22319
|
+
handleInputChange(window.Pelcro.user.read().tin);
|
|
22320
|
+
dispatch({
|
|
22321
|
+
type: SET_TIN,
|
|
22322
|
+
payload: window.Pelcro.user.read().tin
|
|
22323
|
+
});
|
|
22324
|
+
};
|
|
22325
|
+
|
|
22326
|
+
useEffect(() => {
|
|
22327
|
+
if (initWithUserTin) {
|
|
22328
|
+
document.addEventListener("PelcroUserLoaded", () => {
|
|
22329
|
+
loadTinIntoField();
|
|
22330
|
+
});
|
|
22331
|
+
loadTinIntoField();
|
|
22332
|
+
return () => {
|
|
22333
|
+
document.removeEventListener("PelcroUserLoaded", handleInputChange);
|
|
22334
|
+
};
|
|
22335
|
+
}
|
|
22336
|
+
}, []);
|
|
22337
|
+
return /*#__PURE__*/React__default.createElement(Input, Object.assign({
|
|
22338
|
+
type: "text",
|
|
22339
|
+
value: tin,
|
|
22340
|
+
onChange: e => handleInputChange(e.target.value),
|
|
22341
|
+
onBlur: () => setFinishedTyping(true),
|
|
22342
|
+
onFocus: () => setFinishedTyping(false)
|
|
22343
|
+
}, otherProps));
|
|
22344
|
+
}
|
|
22345
|
+
|
|
22346
|
+
const UserUpdateTin = props => /*#__PURE__*/React__default.createElement(Tin, Object.assign({
|
|
22347
|
+
store: store$f
|
|
22348
|
+
}, props));
|
|
22349
|
+
|
|
22240
22350
|
const UserUpdateView = props => {
|
|
22241
22351
|
var _window$Pelcro$site$r;
|
|
22242
22352
|
|
|
@@ -22274,6 +22384,11 @@ const UserUpdateView = props => {
|
|
|
22274
22384
|
errorId: "pelcro-input-phone-error",
|
|
22275
22385
|
label: t("labels.phone"),
|
|
22276
22386
|
required: supportsTap ? true : false
|
|
22387
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
22388
|
+
className: "plc-flex plc-items-start"
|
|
22389
|
+
}, /*#__PURE__*/React__default.createElement(UserUpdateTin, {
|
|
22390
|
+
id: "pelcro-input-tin",
|
|
22391
|
+
label: t("labels.tin")
|
|
22277
22392
|
})), /*#__PURE__*/React__default.createElement(UserUpdateButton, {
|
|
22278
22393
|
role: "submit",
|
|
22279
22394
|
className: "plc-w-full plc-mt-2",
|
|
@@ -28325,14 +28440,14 @@ const SubscriptionsItems = ({
|
|
|
28325
28440
|
onClick: onRenewClick,
|
|
28326
28441
|
disabled: disableSubmit,
|
|
28327
28442
|
"data-key": sub.id
|
|
28328
|
-
}, t("labels.renew")), sub.shipments_suspended_until && sub.shipments_remaining > 0 && /*#__PURE__*/React__default.createElement(Button$1, {
|
|
28443
|
+
}, t("labels.renew")), sub.shipments_suspended_until && isDateAfterToday(sub.shipments_suspended_until) && sub.shipments_remaining > 0 && /*#__PURE__*/React__default.createElement(Button$1, {
|
|
28329
28444
|
variant: "ghost",
|
|
28330
28445
|
className: "plc-text-blue-400 pelcro-dashboard-sub-suspend-button",
|
|
28331
28446
|
icon: /*#__PURE__*/React__default.createElement(SvgXIconSolid, null),
|
|
28332
28447
|
onClick: onUnSuspendClick,
|
|
28333
28448
|
disabled: disableSubmit,
|
|
28334
28449
|
"data-key": sub.id
|
|
28335
|
-
}, t("labels.unsuspend")), !sub.shipments_suspended_until && sub.shipments_remaining > 0 && /*#__PURE__*/React__default.createElement(Button$1, {
|
|
28450
|
+
}, 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$1, {
|
|
28336
28451
|
variant: "ghost",
|
|
28337
28452
|
className: "plc-text-red-500 focus:plc-ring-red-500 pelcro-dashboard-sub-suspend-button",
|
|
28338
28453
|
icon: /*#__PURE__*/React__default.createElement(SvgCalendar, null),
|
|
@@ -28392,6 +28507,12 @@ function getNonDonationSubs() {
|
|
|
28392
28507
|
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 : [];
|
|
28393
28508
|
}
|
|
28394
28509
|
|
|
28510
|
+
function isDateAfterToday(date) {
|
|
28511
|
+
const today = new Date().setHours(0, 0, 0, 0);
|
|
28512
|
+
const newDate = new Date(date).setHours(0, 0, 0, 0);
|
|
28513
|
+
return newDate === today ? true : newDate > today;
|
|
28514
|
+
}
|
|
28515
|
+
|
|
28395
28516
|
/**
|
|
28396
28517
|
* @typedef {Object} AccordionPropsType
|
|
28397
28518
|
* @property {string} initialActiveMenu the initial active menu
|