@pelcro/react-pelcro-js 3.26.0-sandbox.20 → 3.26.0-sandbox.22
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 +110 -90
- package/dist/index.esm.js +110 -90
- package/dist/pelcro.css +35 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -4048,12 +4048,16 @@ var invoiceDetails_en = {
|
|
|
4048
4048
|
var labels$R = {
|
|
4049
4049
|
title: "Cancel subscription",
|
|
4050
4050
|
cancelReason: "Cancellation reason",
|
|
4051
|
+
endOn: "End on",
|
|
4052
|
+
endImmediately: "End immediately",
|
|
4053
|
+
cancel: "Cancel",
|
|
4051
4054
|
subCancellation: {
|
|
4052
4055
|
goBack: "Go back"
|
|
4053
4056
|
}
|
|
4054
4057
|
};
|
|
4055
4058
|
var messages$T = {
|
|
4056
4059
|
subscriptionEnd: "This subscription is set to expire on",
|
|
4060
|
+
cancelWhen: "When would you like to cancel?",
|
|
4057
4061
|
cancelNow: "Cancel Subscription Now",
|
|
4058
4062
|
cancelLater: "Cancel at Period End",
|
|
4059
4063
|
subCancellation: {
|
|
@@ -4916,12 +4920,16 @@ var invoiceDetails_fr = {
|
|
|
4916
4920
|
var labels$A = {
|
|
4917
4921
|
title: "Annuler l'abonnement",
|
|
4918
4922
|
cancelReason: "Motif d'annulation",
|
|
4923
|
+
endOn: "Fin sur",
|
|
4924
|
+
endImmediately: "Fin immédiate",
|
|
4925
|
+
cancel: "Annuler",
|
|
4919
4926
|
subCancellation: {
|
|
4920
4927
|
goBack: "Retourner"
|
|
4921
4928
|
}
|
|
4922
4929
|
};
|
|
4923
4930
|
var messages$B = {
|
|
4924
4931
|
subscriptionEnd: "Cet abonnement doit expirer le",
|
|
4932
|
+
cancelWhen: "Quand voulez-vous annuler?",
|
|
4925
4933
|
cancelNow: "Cancel Subscription Now",
|
|
4926
4934
|
cancelLater: "Annuler l'abonnement maintenant",
|
|
4927
4935
|
subCancellation: {
|
|
@@ -5890,12 +5898,16 @@ var invoiceDetails_ko = {
|
|
|
5890
5898
|
var labels$j = {
|
|
5891
5899
|
title: "구독 취소",
|
|
5892
5900
|
cancelReason: "취소 사유",
|
|
5901
|
+
endOn: "종료",
|
|
5902
|
+
endImmediately: "즉시 종료",
|
|
5903
|
+
cancel: "취소",
|
|
5893
5904
|
subCancellation: {
|
|
5894
5905
|
goBack: "돌아가기"
|
|
5895
5906
|
}
|
|
5896
5907
|
};
|
|
5897
5908
|
var messages$j = {
|
|
5898
5909
|
subscriptionEnd: "이 구독은 다음 날짜에 만료되도록 설정되었습니다.",
|
|
5910
|
+
cancelWhen: "언제 취소하시겠습니까?",
|
|
5899
5911
|
cancelNow: "지금 구독 취소",
|
|
5900
5912
|
cancelLater: "기간 종료 시 취소",
|
|
5901
5913
|
subCancellation: {
|
|
@@ -6750,12 +6762,16 @@ var invoiceDetails_es = {
|
|
|
6750
6762
|
var labels$2 = {
|
|
6751
6763
|
title: "Cancelar suscripción",
|
|
6752
6764
|
cancelReason: "Razón de la cancelación",
|
|
6765
|
+
endOn: "Fin de",
|
|
6766
|
+
endImmediately: "Fin inmediato",
|
|
6767
|
+
cancel: "Cancelar",
|
|
6753
6768
|
subCancellation: {
|
|
6754
6769
|
goBack: "Volver"
|
|
6755
6770
|
}
|
|
6756
6771
|
};
|
|
6757
6772
|
var messages$1 = {
|
|
6758
6773
|
subscriptionEnd: "Esta suscripción expirará el",
|
|
6774
|
+
cancelWhen: "¿Cuándo desea cancelar?",
|
|
6759
6775
|
cancelNow: "Cancelar Suscripción Ahora",
|
|
6760
6776
|
cancelLater: "Cancelar al Final del Periodo",
|
|
6761
6777
|
subCancellation: {
|
|
@@ -11635,14 +11651,10 @@ const initGATracking = () => {
|
|
|
11635
11651
|
}
|
|
11636
11652
|
}
|
|
11637
11653
|
});
|
|
11638
|
-
console.log("enableReactGA4: ", enableReactGA4);
|
|
11639
|
-
console.log("GA4 is initialized");
|
|
11640
11654
|
} else {
|
|
11641
11655
|
var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
|
|
11642
11656
|
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$initialize = ReactGA.initialize) === null || _ReactGA$initialize === void 0 ? void 0 : _ReactGA$initialize.call(ReactGA, window.Pelcro.site.read().google_analytics_id);
|
|
11643
11657
|
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin = ReactGA.plugin) === null || _ReactGA$plugin === void 0 ? void 0 : (_ReactGA$plugin$requi = _ReactGA$plugin.require) === null || _ReactGA$plugin$requi === void 0 ? void 0 : _ReactGA$plugin$requi.call(_ReactGA$plugin, "ecommerce");
|
|
11644
|
-
console.log("enableReactGA4: " + enableReactGA4);
|
|
11645
|
-
console.log("GA3 is initialized");
|
|
11646
11658
|
}
|
|
11647
11659
|
}
|
|
11648
11660
|
};
|
|
@@ -11654,7 +11666,6 @@ const dispatchModalDisplayEvents = modalName => {
|
|
|
11654
11666
|
ReactGA4.event(`${formattedAction} viewed`, {
|
|
11655
11667
|
nonInteraction: true
|
|
11656
11668
|
});
|
|
11657
|
-
console.log("GA4 view event is fired");
|
|
11658
11669
|
} else {
|
|
11659
11670
|
var _ReactGA$event;
|
|
11660
11671
|
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
@@ -11662,7 +11673,6 @@ const dispatchModalDisplayEvents = modalName => {
|
|
|
11662
11673
|
action: `${formattedAction} viewed`,
|
|
11663
11674
|
nonInteraction: true
|
|
11664
11675
|
});
|
|
11665
|
-
console.log("GA3 view event is fired");
|
|
11666
11676
|
}
|
|
11667
11677
|
window.Pelcro.insight.track("Modal Displayed", {
|
|
11668
11678
|
name: `${modalName === null || modalName === void 0 ? void 0 : (_modalName$replace2 = modalName.replace("pelcro-", "")) === null || _modalName$replace2 === void 0 ? void 0 : _modalName$replace2.replaceAll("-", " ")}`
|
|
@@ -12455,6 +12465,7 @@ const GET_NEWSLETTERS_SUCCESS = "GET_NEWSLETTERS_SUCCESS";
|
|
|
12455
12465
|
const SWITCH_TO_UPDATE = "SWITCH_TO_UPDATE";
|
|
12456
12466
|
const LINK_TOKEN_VERIFY = "LINK_TOKEN_VERIFY";
|
|
12457
12467
|
const SET_CANCEL_SUBSCRIPTION_REASON = "SET_CANCEL_SUBSCRIPTION_REASON";
|
|
12468
|
+
const SET_CANCEL_SUBSCRIPTION_OPTION = "SET_CANCEL_SUBSCRIPTION_OPTION";
|
|
12458
12469
|
const HANDLE_CHECKBOX_CHANGE = "HANDLE_CHECKBOX_CHANGE";
|
|
12459
12470
|
const SET_SUBSCRIPTION_SUSPEND_DATE = "SET_SUBSCRIPTION_SUSPEND_DATE";
|
|
12460
12471
|
const SET_EMAILS = "SET_EMAILS";
|
|
@@ -20468,7 +20479,8 @@ function SubscriptionRenewModal(_ref) {
|
|
|
20468
20479
|
SubscriptionRenewModal.viewId = "subscription-renew";
|
|
20469
20480
|
|
|
20470
20481
|
const initialState$j = {
|
|
20471
|
-
cancelationReason: ""
|
|
20482
|
+
cancelationReason: "",
|
|
20483
|
+
cancelationOption: ""
|
|
20472
20484
|
};
|
|
20473
20485
|
const store$j = /*#__PURE__*/React.createContext(initialState$j);
|
|
20474
20486
|
const {
|
|
@@ -20483,7 +20495,6 @@ const SubscriptionCancelContainer = _ref => {
|
|
|
20483
20495
|
children,
|
|
20484
20496
|
...props
|
|
20485
20497
|
} = _ref;
|
|
20486
|
-
useTranslation("verifyEmail");
|
|
20487
20498
|
const [state, dispatch] = useReducerWithSideEffects((state, action) => {
|
|
20488
20499
|
switch (action.type) {
|
|
20489
20500
|
case SET_CANCEL_SUBSCRIPTION_REASON:
|
|
@@ -20491,6 +20502,11 @@ const SubscriptionCancelContainer = _ref => {
|
|
|
20491
20502
|
...state,
|
|
20492
20503
|
cancelationReason: action.payload
|
|
20493
20504
|
});
|
|
20505
|
+
case SET_CANCEL_SUBSCRIPTION_OPTION:
|
|
20506
|
+
return lib_7({
|
|
20507
|
+
...state,
|
|
20508
|
+
cancelationOption: action.payload
|
|
20509
|
+
});
|
|
20494
20510
|
default:
|
|
20495
20511
|
return state;
|
|
20496
20512
|
}
|
|
@@ -20590,8 +20606,7 @@ const SubscriptionCancelReason = props => {
|
|
|
20590
20606
|
t
|
|
20591
20607
|
} = useTranslation("subscriptionCancel");
|
|
20592
20608
|
const {
|
|
20593
|
-
dispatch
|
|
20594
|
-
state
|
|
20609
|
+
dispatch
|
|
20595
20610
|
} = React.useContext(store$j);
|
|
20596
20611
|
const handleOnTextAreaBlur = e => {
|
|
20597
20612
|
dispatch({
|
|
@@ -20623,7 +20638,7 @@ function SvgSubscription(props) {
|
|
|
20623
20638
|
}))))));
|
|
20624
20639
|
}
|
|
20625
20640
|
|
|
20626
|
-
const
|
|
20641
|
+
const SubscriptionCancelButton = _ref => {
|
|
20627
20642
|
let {
|
|
20628
20643
|
subscription,
|
|
20629
20644
|
onClick,
|
|
@@ -20634,9 +20649,9 @@ const SubscriptionCancelNowButton = _ref => {
|
|
|
20634
20649
|
} = usePelcro();
|
|
20635
20650
|
const {
|
|
20636
20651
|
state: {
|
|
20637
|
-
cancelationReason
|
|
20638
|
-
|
|
20639
|
-
|
|
20652
|
+
cancelationReason,
|
|
20653
|
+
cancelationOption
|
|
20654
|
+
}
|
|
20640
20655
|
} = React.useContext(store$j);
|
|
20641
20656
|
const {
|
|
20642
20657
|
t
|
|
@@ -20670,10 +20685,10 @@ const SubscriptionCancelNowButton = _ref => {
|
|
|
20670
20685
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
|
|
20671
20686
|
});
|
|
20672
20687
|
};
|
|
20673
|
-
const
|
|
20688
|
+
const handleCancelClick = () => {
|
|
20674
20689
|
const payload = {
|
|
20675
20690
|
subscription_id: subscription.id,
|
|
20676
|
-
mode:
|
|
20691
|
+
mode: cancelationOption,
|
|
20677
20692
|
...(cancelationReason && {
|
|
20678
20693
|
reason: cancelationReason
|
|
20679
20694
|
})
|
|
@@ -20687,7 +20702,7 @@ const SubscriptionCancelNowButton = _ref => {
|
|
|
20687
20702
|
notify$1.confirm((onSuccess, onFailure) => {
|
|
20688
20703
|
cancelSubscription(payload, onSuccess, onFailure);
|
|
20689
20704
|
}, {
|
|
20690
|
-
confirmMessage: t("messages.subCancellation.isSureToCancelNow"),
|
|
20705
|
+
confirmMessage: cancelationOption === "now" ? t("messages.subCancellation.isSureToCancelNow") : t("messages.subCancellation.isSureToCancel"),
|
|
20691
20706
|
loadingMessage: t("messages.subCancellation.loading"),
|
|
20692
20707
|
successMessage: t("messages.subCancellation.success"),
|
|
20693
20708
|
errorMessage: t("messages.subCancellation.error")
|
|
@@ -20696,96 +20711,88 @@ const SubscriptionCancelNowButton = _ref => {
|
|
|
20696
20711
|
});
|
|
20697
20712
|
};
|
|
20698
20713
|
return /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
20699
|
-
onClick:
|
|
20700
|
-
className: `${className}
|
|
20701
|
-
|
|
20714
|
+
onClick: handleCancelClick,
|
|
20715
|
+
className: `${className}`,
|
|
20716
|
+
disabled: !cancelationOption
|
|
20717
|
+
}, t("labels.cancel"));
|
|
20702
20718
|
};
|
|
20703
20719
|
|
|
20704
|
-
const
|
|
20720
|
+
const SubscriptionCancelOptions = _ref => {
|
|
20721
|
+
var _subscription$schedul;
|
|
20705
20722
|
let {
|
|
20706
20723
|
subscription,
|
|
20724
|
+
hasPhases,
|
|
20707
20725
|
onClick,
|
|
20708
20726
|
className
|
|
20709
20727
|
} = _ref;
|
|
20710
|
-
const {
|
|
20711
|
-
switchView
|
|
20712
|
-
} = usePelcro();
|
|
20713
20728
|
const {
|
|
20714
20729
|
state: {
|
|
20715
|
-
|
|
20730
|
+
cancelationOption
|
|
20716
20731
|
},
|
|
20717
20732
|
dispatch
|
|
20718
20733
|
} = React.useContext(store$j);
|
|
20719
20734
|
const {
|
|
20720
20735
|
t
|
|
20721
20736
|
} = useTranslation("subscriptionCancel");
|
|
20722
|
-
const
|
|
20723
|
-
|
|
20724
|
-
|
|
20725
|
-
|
|
20726
|
-
|
|
20727
|
-
|
|
20728
|
-
mode: payload.mode,
|
|
20729
|
-
...(payload.reason && {
|
|
20730
|
-
reason: payload.reason
|
|
20731
|
-
})
|
|
20732
|
-
}, (err, res) => {
|
|
20733
|
-
if (err) {
|
|
20734
|
-
return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
20735
|
-
}
|
|
20736
|
-
if (enableReactGA4) {
|
|
20737
|
-
ReactGA4.event("Canceled", {
|
|
20738
|
-
nonInteraction: true
|
|
20739
|
-
});
|
|
20740
|
-
} else {
|
|
20741
|
-
var _ReactGA$event;
|
|
20742
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
20743
|
-
category: "ACTIONS",
|
|
20744
|
-
action: "Canceled",
|
|
20745
|
-
nonInteraction: true
|
|
20746
|
-
});
|
|
20747
|
-
}
|
|
20748
|
-
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
|
|
20749
|
-
});
|
|
20750
|
-
};
|
|
20751
|
-
const handleCancelNowClick = () => {
|
|
20752
|
-
const payload = {
|
|
20753
|
-
subscription_id: subscription.id,
|
|
20754
|
-
mode: "period_end",
|
|
20755
|
-
...(cancelationReason && {
|
|
20756
|
-
reason: cancelationReason
|
|
20757
|
-
})
|
|
20758
|
-
};
|
|
20759
|
-
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
20760
|
-
|
|
20761
|
-
// Close the modal
|
|
20762
|
-
switchView(null);
|
|
20763
|
-
|
|
20764
|
-
// Show confirmation alert after closing the modal
|
|
20765
|
-
notify$1.confirm((onSuccess, onFailure) => {
|
|
20766
|
-
cancelSubscription(payload, onSuccess, onFailure);
|
|
20767
|
-
}, {
|
|
20768
|
-
confirmMessage: t("messages.subCancellation.isSureToCancel"),
|
|
20769
|
-
loadingMessage: t("messages.subCancellation.loading"),
|
|
20770
|
-
successMessage: t("messages.subCancellation.success"),
|
|
20771
|
-
errorMessage: t("messages.subCancellation.error")
|
|
20772
|
-
}, {
|
|
20773
|
-
closeButtonLabel: t("labels.subCancellation.goBack")
|
|
20737
|
+
const phases = subscription === null || subscription === void 0 ? void 0 : (_subscription$schedul = subscription.schedule) === null || _subscription$schedul === void 0 ? void 0 : _subscription$schedul.phases;
|
|
20738
|
+
const lastPhase = phases[(phases === null || phases === void 0 ? void 0 : phases.length) - 1];
|
|
20739
|
+
const handleOptionSelect = event => {
|
|
20740
|
+
dispatch({
|
|
20741
|
+
type: SET_CANCEL_SUBSCRIPTION_OPTION,
|
|
20742
|
+
payload: event.target.value
|
|
20774
20743
|
});
|
|
20775
20744
|
};
|
|
20776
|
-
return /*#__PURE__*/React__default['default'].createElement(
|
|
20777
|
-
|
|
20778
|
-
|
|
20779
|
-
|
|
20745
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20746
|
+
className: "plc-text-left plc-mr-auto plc-mb-6"
|
|
20747
|
+
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
20748
|
+
className: "plc-mb-3"
|
|
20749
|
+
}, t("messages.cancelWhen")), hasPhases && /*#__PURE__*/React__default['default'].createElement(Radio, {
|
|
20750
|
+
onChange: handleOptionSelect,
|
|
20751
|
+
checked: cancelationOption === "period_end",
|
|
20752
|
+
value: "period_end"
|
|
20753
|
+
}, t("labels.endOn"), " ", new Date(Number(`${lastPhase === null || lastPhase === void 0 ? void 0 : lastPhase.end_date}000`)).toLocaleDateString("en-CA", {
|
|
20754
|
+
year: "numeric",
|
|
20755
|
+
month: "short",
|
|
20756
|
+
day: "numeric"
|
|
20757
|
+
})), /*#__PURE__*/React__default['default'].createElement(Radio, {
|
|
20758
|
+
onChange: handleOptionSelect,
|
|
20759
|
+
checked: cancelationOption === "current_period_end",
|
|
20760
|
+
value: "current_period_end"
|
|
20761
|
+
}, t("labels.endOn"), " ", new Date(subscription === null || subscription === void 0 ? void 0 : subscription.current_period_end).toLocaleDateString("en-CA", {
|
|
20762
|
+
year: "numeric",
|
|
20763
|
+
month: "short",
|
|
20764
|
+
day: "numeric"
|
|
20765
|
+
})), /*#__PURE__*/React__default['default'].createElement(Radio, {
|
|
20766
|
+
onChange: handleOptionSelect,
|
|
20767
|
+
checked: cancelationOption === "now",
|
|
20768
|
+
value: "now"
|
|
20769
|
+
}, t("labels.endImmediately")));
|
|
20780
20770
|
};
|
|
20781
20771
|
|
|
20782
20772
|
const SubscriptionCancelView = props => {
|
|
20773
|
+
var _subscriptionToCancel7, _subscriptionToCancel8;
|
|
20783
20774
|
const {
|
|
20784
|
-
subscriptionToCancel
|
|
20775
|
+
subscriptionToCancel,
|
|
20776
|
+
switchView
|
|
20785
20777
|
} = usePelcro();
|
|
20786
20778
|
const {
|
|
20787
20779
|
t
|
|
20788
20780
|
} = useTranslation("subscriptionCancel");
|
|
20781
|
+
const getPhases = () => {
|
|
20782
|
+
var _subscriptionToCancel, _subscriptionToCancel2, _subscriptionToCancel3, _subscriptionToCancel4, _subscriptionToCancel5, _subscriptionToCancel6;
|
|
20783
|
+
if (!subscriptionToCancel.schedule) return [];
|
|
20784
|
+
const currentPhaseStartDate = subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel = subscriptionToCancel.schedule) === null || _subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel2 = _subscriptionToCancel.current_phase) === null || _subscriptionToCancel2 === void 0 ? void 0 : _subscriptionToCancel2.start_date;
|
|
20785
|
+
const currentPhase = subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel3 = subscriptionToCancel.schedule) === null || _subscriptionToCancel3 === void 0 ? void 0 : (_subscriptionToCancel4 = _subscriptionToCancel3.phases) === null || _subscriptionToCancel4 === void 0 ? void 0 : _subscriptionToCancel4.find(phase => {
|
|
20786
|
+
return (phase === null || phase === void 0 ? void 0 : phase.start_date) === currentPhaseStartDate;
|
|
20787
|
+
});
|
|
20788
|
+
const futurePhases = subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel5 = subscriptionToCancel.schedule) === null || _subscriptionToCancel5 === void 0 ? void 0 : (_subscriptionToCancel6 = _subscriptionToCancel5.phases) === null || _subscriptionToCancel6 === void 0 ? void 0 : _subscriptionToCancel6.filter(phase => {
|
|
20789
|
+
return (phase === null || phase === void 0 ? void 0 : phase.start_date) > currentPhaseStartDate;
|
|
20790
|
+
});
|
|
20791
|
+
return [currentPhase, ...futurePhases];
|
|
20792
|
+
};
|
|
20793
|
+
const hasPhases = getPhases().length > 0;
|
|
20794
|
+
const phases = subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel7 = subscriptionToCancel.schedule) === null || _subscriptionToCancel7 === void 0 ? void 0 : _subscriptionToCancel7.phases;
|
|
20795
|
+
const lastPhase = phases[(phases === null || phases === void 0 ? void 0 : phases.length) - 1];
|
|
20789
20796
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20790
20797
|
id: "pelcro-subscription-cancel-view"
|
|
20791
20798
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
@@ -20794,22 +20801,35 @@ const SubscriptionCancelView = props => {
|
|
|
20794
20801
|
className: "plc-text-2xl plc-font-semibold"
|
|
20795
20802
|
}, t("labels.title"), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
20796
20803
|
className: "plc-text-gray-400 plc-text-base plc-block"
|
|
20797
|
-
}, "(", subscriptionToCancel.plan.nickname, ")"))), /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelContainer, props, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20804
|
+
}, "(", subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel8 = subscriptionToCancel.plan) === null || _subscriptionToCancel8 === void 0 ? void 0 : _subscriptionToCancel8.nickname, ")"))), /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelContainer, props, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20798
20805
|
className: "plc-flex plc-flex-col plc-items-center plc-justify-center plc-mt-4"
|
|
20799
20806
|
}, /*#__PURE__*/React__default['default'].createElement(SvgSubscription, {
|
|
20800
20807
|
className: "plc-w-32 plc-h-32"
|
|
20801
20808
|
}), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
20802
|
-
className: "plc-mb-3 plc-text-gray-900 plc-text-
|
|
20803
|
-
}, t("messages.subscriptionEnd"), " ", new Date(
|
|
20809
|
+
className: "plc-mb-3 plc-text-gray-900 plc-text-left plc-mr-auto plc-whitespace-pre-line"
|
|
20810
|
+
}, t("messages.subscriptionEnd"), " ", hasPhases ? new Date(Number(`${lastPhase === null || lastPhase === void 0 ? void 0 : lastPhase.end_date}000`)).toLocaleDateString("en-CA", {
|
|
20804
20811
|
year: "numeric",
|
|
20805
20812
|
month: "short",
|
|
20806
20813
|
day: "numeric"
|
|
20807
|
-
})
|
|
20808
|
-
|
|
20809
|
-
|
|
20810
|
-
|
|
20814
|
+
}) : new Date(subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : subscriptionToCancel.current_period_end).toLocaleDateString("en-CA", {
|
|
20815
|
+
year: "numeric",
|
|
20816
|
+
month: "short",
|
|
20817
|
+
day: "numeric"
|
|
20818
|
+
}), "."), /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelOptions, {
|
|
20819
|
+
subscription: subscriptionToCancel,
|
|
20820
|
+
hasPhases: hasPhases
|
|
20821
|
+
}), /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelReason, null), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
20822
|
+
className: "plc-space-x-0 plc-space-y-3 md:plc-space-x-3 md:plc-space-y-0 plc-w-full plc-flex plc-flex-col md:plc-flex-row plc-items-center plc-justify-center"
|
|
20823
|
+
}, /*#__PURE__*/React__default['default'].createElement(SubscriptionCancelButton, {
|
|
20824
|
+
className: "plc-w-3/4 md:plc-w-2/5",
|
|
20811
20825
|
subscription: subscriptionToCancel
|
|
20812
|
-
})
|
|
20826
|
+
}), /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
20827
|
+
variant: "outline",
|
|
20828
|
+
className: "plc-w-3/4 md:plc-w-2/5",
|
|
20829
|
+
onClick: () => {
|
|
20830
|
+
switchView("dashboard");
|
|
20831
|
+
}
|
|
20832
|
+
}, t("labels.subCancellation.goBack"))))));
|
|
20813
20833
|
};
|
|
20814
20834
|
|
|
20815
20835
|
const SubscriptionCancelModal = _ref => {
|
package/dist/index.esm.js
CHANGED
|
@@ -4018,12 +4018,16 @@ var invoiceDetails_en = {
|
|
|
4018
4018
|
var labels$R = {
|
|
4019
4019
|
title: "Cancel subscription",
|
|
4020
4020
|
cancelReason: "Cancellation reason",
|
|
4021
|
+
endOn: "End on",
|
|
4022
|
+
endImmediately: "End immediately",
|
|
4023
|
+
cancel: "Cancel",
|
|
4021
4024
|
subCancellation: {
|
|
4022
4025
|
goBack: "Go back"
|
|
4023
4026
|
}
|
|
4024
4027
|
};
|
|
4025
4028
|
var messages$T = {
|
|
4026
4029
|
subscriptionEnd: "This subscription is set to expire on",
|
|
4030
|
+
cancelWhen: "When would you like to cancel?",
|
|
4027
4031
|
cancelNow: "Cancel Subscription Now",
|
|
4028
4032
|
cancelLater: "Cancel at Period End",
|
|
4029
4033
|
subCancellation: {
|
|
@@ -4886,12 +4890,16 @@ var invoiceDetails_fr = {
|
|
|
4886
4890
|
var labels$A = {
|
|
4887
4891
|
title: "Annuler l'abonnement",
|
|
4888
4892
|
cancelReason: "Motif d'annulation",
|
|
4893
|
+
endOn: "Fin sur",
|
|
4894
|
+
endImmediately: "Fin immédiate",
|
|
4895
|
+
cancel: "Annuler",
|
|
4889
4896
|
subCancellation: {
|
|
4890
4897
|
goBack: "Retourner"
|
|
4891
4898
|
}
|
|
4892
4899
|
};
|
|
4893
4900
|
var messages$B = {
|
|
4894
4901
|
subscriptionEnd: "Cet abonnement doit expirer le",
|
|
4902
|
+
cancelWhen: "Quand voulez-vous annuler?",
|
|
4895
4903
|
cancelNow: "Cancel Subscription Now",
|
|
4896
4904
|
cancelLater: "Annuler l'abonnement maintenant",
|
|
4897
4905
|
subCancellation: {
|
|
@@ -5860,12 +5868,16 @@ var invoiceDetails_ko = {
|
|
|
5860
5868
|
var labels$j = {
|
|
5861
5869
|
title: "구독 취소",
|
|
5862
5870
|
cancelReason: "취소 사유",
|
|
5871
|
+
endOn: "종료",
|
|
5872
|
+
endImmediately: "즉시 종료",
|
|
5873
|
+
cancel: "취소",
|
|
5863
5874
|
subCancellation: {
|
|
5864
5875
|
goBack: "돌아가기"
|
|
5865
5876
|
}
|
|
5866
5877
|
};
|
|
5867
5878
|
var messages$j = {
|
|
5868
5879
|
subscriptionEnd: "이 구독은 다음 날짜에 만료되도록 설정되었습니다.",
|
|
5880
|
+
cancelWhen: "언제 취소하시겠습니까?",
|
|
5869
5881
|
cancelNow: "지금 구독 취소",
|
|
5870
5882
|
cancelLater: "기간 종료 시 취소",
|
|
5871
5883
|
subCancellation: {
|
|
@@ -6720,12 +6732,16 @@ var invoiceDetails_es = {
|
|
|
6720
6732
|
var labels$2 = {
|
|
6721
6733
|
title: "Cancelar suscripción",
|
|
6722
6734
|
cancelReason: "Razón de la cancelación",
|
|
6735
|
+
endOn: "Fin de",
|
|
6736
|
+
endImmediately: "Fin inmediato",
|
|
6737
|
+
cancel: "Cancelar",
|
|
6723
6738
|
subCancellation: {
|
|
6724
6739
|
goBack: "Volver"
|
|
6725
6740
|
}
|
|
6726
6741
|
};
|
|
6727
6742
|
var messages$1 = {
|
|
6728
6743
|
subscriptionEnd: "Esta suscripción expirará el",
|
|
6744
|
+
cancelWhen: "¿Cuándo desea cancelar?",
|
|
6729
6745
|
cancelNow: "Cancelar Suscripción Ahora",
|
|
6730
6746
|
cancelLater: "Cancelar al Final del Periodo",
|
|
6731
6747
|
subCancellation: {
|
|
@@ -11605,14 +11621,10 @@ const initGATracking = () => {
|
|
|
11605
11621
|
}
|
|
11606
11622
|
}
|
|
11607
11623
|
});
|
|
11608
|
-
console.log("enableReactGA4: ", enableReactGA4);
|
|
11609
|
-
console.log("GA4 is initialized");
|
|
11610
11624
|
} else {
|
|
11611
11625
|
var _ReactGA$initialize, _ReactGA$plugin, _ReactGA$plugin$requi;
|
|
11612
11626
|
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$initialize = ReactGA.initialize) === null || _ReactGA$initialize === void 0 ? void 0 : _ReactGA$initialize.call(ReactGA, window.Pelcro.site.read().google_analytics_id);
|
|
11613
11627
|
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$plugin = ReactGA.plugin) === null || _ReactGA$plugin === void 0 ? void 0 : (_ReactGA$plugin$requi = _ReactGA$plugin.require) === null || _ReactGA$plugin$requi === void 0 ? void 0 : _ReactGA$plugin$requi.call(_ReactGA$plugin, "ecommerce");
|
|
11614
|
-
console.log("enableReactGA4: " + enableReactGA4);
|
|
11615
|
-
console.log("GA3 is initialized");
|
|
11616
11628
|
}
|
|
11617
11629
|
}
|
|
11618
11630
|
};
|
|
@@ -11624,7 +11636,6 @@ const dispatchModalDisplayEvents = modalName => {
|
|
|
11624
11636
|
ReactGA4.event(`${formattedAction} viewed`, {
|
|
11625
11637
|
nonInteraction: true
|
|
11626
11638
|
});
|
|
11627
|
-
console.log("GA4 view event is fired");
|
|
11628
11639
|
} else {
|
|
11629
11640
|
var _ReactGA$event;
|
|
11630
11641
|
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
@@ -11632,7 +11643,6 @@ const dispatchModalDisplayEvents = modalName => {
|
|
|
11632
11643
|
action: `${formattedAction} viewed`,
|
|
11633
11644
|
nonInteraction: true
|
|
11634
11645
|
});
|
|
11635
|
-
console.log("GA3 view event is fired");
|
|
11636
11646
|
}
|
|
11637
11647
|
window.Pelcro.insight.track("Modal Displayed", {
|
|
11638
11648
|
name: `${modalName === null || modalName === void 0 ? void 0 : (_modalName$replace2 = modalName.replace("pelcro-", "")) === null || _modalName$replace2 === void 0 ? void 0 : _modalName$replace2.replaceAll("-", " ")}`
|
|
@@ -12425,6 +12435,7 @@ const GET_NEWSLETTERS_SUCCESS = "GET_NEWSLETTERS_SUCCESS";
|
|
|
12425
12435
|
const SWITCH_TO_UPDATE = "SWITCH_TO_UPDATE";
|
|
12426
12436
|
const LINK_TOKEN_VERIFY = "LINK_TOKEN_VERIFY";
|
|
12427
12437
|
const SET_CANCEL_SUBSCRIPTION_REASON = "SET_CANCEL_SUBSCRIPTION_REASON";
|
|
12438
|
+
const SET_CANCEL_SUBSCRIPTION_OPTION = "SET_CANCEL_SUBSCRIPTION_OPTION";
|
|
12428
12439
|
const HANDLE_CHECKBOX_CHANGE = "HANDLE_CHECKBOX_CHANGE";
|
|
12429
12440
|
const SET_SUBSCRIPTION_SUSPEND_DATE = "SET_SUBSCRIPTION_SUSPEND_DATE";
|
|
12430
12441
|
const SET_EMAILS = "SET_EMAILS";
|
|
@@ -20438,7 +20449,8 @@ function SubscriptionRenewModal(_ref) {
|
|
|
20438
20449
|
SubscriptionRenewModal.viewId = "subscription-renew";
|
|
20439
20450
|
|
|
20440
20451
|
const initialState$j = {
|
|
20441
|
-
cancelationReason: ""
|
|
20452
|
+
cancelationReason: "",
|
|
20453
|
+
cancelationOption: ""
|
|
20442
20454
|
};
|
|
20443
20455
|
const store$j = /*#__PURE__*/createContext(initialState$j);
|
|
20444
20456
|
const {
|
|
@@ -20453,7 +20465,6 @@ const SubscriptionCancelContainer = _ref => {
|
|
|
20453
20465
|
children,
|
|
20454
20466
|
...props
|
|
20455
20467
|
} = _ref;
|
|
20456
|
-
useTranslation("verifyEmail");
|
|
20457
20468
|
const [state, dispatch] = useReducerWithSideEffects((state, action) => {
|
|
20458
20469
|
switch (action.type) {
|
|
20459
20470
|
case SET_CANCEL_SUBSCRIPTION_REASON:
|
|
@@ -20461,6 +20472,11 @@ const SubscriptionCancelContainer = _ref => {
|
|
|
20461
20472
|
...state,
|
|
20462
20473
|
cancelationReason: action.payload
|
|
20463
20474
|
});
|
|
20475
|
+
case SET_CANCEL_SUBSCRIPTION_OPTION:
|
|
20476
|
+
return lib_7({
|
|
20477
|
+
...state,
|
|
20478
|
+
cancelationOption: action.payload
|
|
20479
|
+
});
|
|
20464
20480
|
default:
|
|
20465
20481
|
return state;
|
|
20466
20482
|
}
|
|
@@ -20560,8 +20576,7 @@ const SubscriptionCancelReason = props => {
|
|
|
20560
20576
|
t
|
|
20561
20577
|
} = useTranslation("subscriptionCancel");
|
|
20562
20578
|
const {
|
|
20563
|
-
dispatch
|
|
20564
|
-
state
|
|
20579
|
+
dispatch
|
|
20565
20580
|
} = useContext(store$j);
|
|
20566
20581
|
const handleOnTextAreaBlur = e => {
|
|
20567
20582
|
dispatch({
|
|
@@ -20593,7 +20608,7 @@ function SvgSubscription(props) {
|
|
|
20593
20608
|
}))))));
|
|
20594
20609
|
}
|
|
20595
20610
|
|
|
20596
|
-
const
|
|
20611
|
+
const SubscriptionCancelButton = _ref => {
|
|
20597
20612
|
let {
|
|
20598
20613
|
subscription,
|
|
20599
20614
|
onClick,
|
|
@@ -20604,9 +20619,9 @@ const SubscriptionCancelNowButton = _ref => {
|
|
|
20604
20619
|
} = usePelcro();
|
|
20605
20620
|
const {
|
|
20606
20621
|
state: {
|
|
20607
|
-
cancelationReason
|
|
20608
|
-
|
|
20609
|
-
|
|
20622
|
+
cancelationReason,
|
|
20623
|
+
cancelationOption
|
|
20624
|
+
}
|
|
20610
20625
|
} = useContext(store$j);
|
|
20611
20626
|
const {
|
|
20612
20627
|
t
|
|
@@ -20640,10 +20655,10 @@ const SubscriptionCancelNowButton = _ref => {
|
|
|
20640
20655
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
|
|
20641
20656
|
});
|
|
20642
20657
|
};
|
|
20643
|
-
const
|
|
20658
|
+
const handleCancelClick = () => {
|
|
20644
20659
|
const payload = {
|
|
20645
20660
|
subscription_id: subscription.id,
|
|
20646
|
-
mode:
|
|
20661
|
+
mode: cancelationOption,
|
|
20647
20662
|
...(cancelationReason && {
|
|
20648
20663
|
reason: cancelationReason
|
|
20649
20664
|
})
|
|
@@ -20657,7 +20672,7 @@ const SubscriptionCancelNowButton = _ref => {
|
|
|
20657
20672
|
notify$1.confirm((onSuccess, onFailure) => {
|
|
20658
20673
|
cancelSubscription(payload, onSuccess, onFailure);
|
|
20659
20674
|
}, {
|
|
20660
|
-
confirmMessage: t("messages.subCancellation.isSureToCancelNow"),
|
|
20675
|
+
confirmMessage: cancelationOption === "now" ? t("messages.subCancellation.isSureToCancelNow") : t("messages.subCancellation.isSureToCancel"),
|
|
20661
20676
|
loadingMessage: t("messages.subCancellation.loading"),
|
|
20662
20677
|
successMessage: t("messages.subCancellation.success"),
|
|
20663
20678
|
errorMessage: t("messages.subCancellation.error")
|
|
@@ -20666,96 +20681,88 @@ const SubscriptionCancelNowButton = _ref => {
|
|
|
20666
20681
|
});
|
|
20667
20682
|
};
|
|
20668
20683
|
return /*#__PURE__*/React__default.createElement(Button, {
|
|
20669
|
-
onClick:
|
|
20670
|
-
className: `${className}
|
|
20671
|
-
|
|
20684
|
+
onClick: handleCancelClick,
|
|
20685
|
+
className: `${className}`,
|
|
20686
|
+
disabled: !cancelationOption
|
|
20687
|
+
}, t("labels.cancel"));
|
|
20672
20688
|
};
|
|
20673
20689
|
|
|
20674
|
-
const
|
|
20690
|
+
const SubscriptionCancelOptions = _ref => {
|
|
20691
|
+
var _subscription$schedul;
|
|
20675
20692
|
let {
|
|
20676
20693
|
subscription,
|
|
20694
|
+
hasPhases,
|
|
20677
20695
|
onClick,
|
|
20678
20696
|
className
|
|
20679
20697
|
} = _ref;
|
|
20680
|
-
const {
|
|
20681
|
-
switchView
|
|
20682
|
-
} = usePelcro();
|
|
20683
20698
|
const {
|
|
20684
20699
|
state: {
|
|
20685
|
-
|
|
20700
|
+
cancelationOption
|
|
20686
20701
|
},
|
|
20687
20702
|
dispatch
|
|
20688
20703
|
} = useContext(store$j);
|
|
20689
20704
|
const {
|
|
20690
20705
|
t
|
|
20691
20706
|
} = useTranslation("subscriptionCancel");
|
|
20692
|
-
const
|
|
20693
|
-
|
|
20694
|
-
|
|
20695
|
-
|
|
20696
|
-
|
|
20697
|
-
|
|
20698
|
-
mode: payload.mode,
|
|
20699
|
-
...(payload.reason && {
|
|
20700
|
-
reason: payload.reason
|
|
20701
|
-
})
|
|
20702
|
-
}, (err, res) => {
|
|
20703
|
-
if (err) {
|
|
20704
|
-
return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
20705
|
-
}
|
|
20706
|
-
if (enableReactGA4) {
|
|
20707
|
-
ReactGA4.event("Canceled", {
|
|
20708
|
-
nonInteraction: true
|
|
20709
|
-
});
|
|
20710
|
-
} else {
|
|
20711
|
-
var _ReactGA$event;
|
|
20712
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
20713
|
-
category: "ACTIONS",
|
|
20714
|
-
action: "Canceled",
|
|
20715
|
-
nonInteraction: true
|
|
20716
|
-
});
|
|
20717
|
-
}
|
|
20718
|
-
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
|
|
20719
|
-
});
|
|
20720
|
-
};
|
|
20721
|
-
const handleCancelNowClick = () => {
|
|
20722
|
-
const payload = {
|
|
20723
|
-
subscription_id: subscription.id,
|
|
20724
|
-
mode: "period_end",
|
|
20725
|
-
...(cancelationReason && {
|
|
20726
|
-
reason: cancelationReason
|
|
20727
|
-
})
|
|
20728
|
-
};
|
|
20729
|
-
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
20730
|
-
|
|
20731
|
-
// Close the modal
|
|
20732
|
-
switchView(null);
|
|
20733
|
-
|
|
20734
|
-
// Show confirmation alert after closing the modal
|
|
20735
|
-
notify$1.confirm((onSuccess, onFailure) => {
|
|
20736
|
-
cancelSubscription(payload, onSuccess, onFailure);
|
|
20737
|
-
}, {
|
|
20738
|
-
confirmMessage: t("messages.subCancellation.isSureToCancel"),
|
|
20739
|
-
loadingMessage: t("messages.subCancellation.loading"),
|
|
20740
|
-
successMessage: t("messages.subCancellation.success"),
|
|
20741
|
-
errorMessage: t("messages.subCancellation.error")
|
|
20742
|
-
}, {
|
|
20743
|
-
closeButtonLabel: t("labels.subCancellation.goBack")
|
|
20707
|
+
const phases = subscription === null || subscription === void 0 ? void 0 : (_subscription$schedul = subscription.schedule) === null || _subscription$schedul === void 0 ? void 0 : _subscription$schedul.phases;
|
|
20708
|
+
const lastPhase = phases[(phases === null || phases === void 0 ? void 0 : phases.length) - 1];
|
|
20709
|
+
const handleOptionSelect = event => {
|
|
20710
|
+
dispatch({
|
|
20711
|
+
type: SET_CANCEL_SUBSCRIPTION_OPTION,
|
|
20712
|
+
payload: event.target.value
|
|
20744
20713
|
});
|
|
20745
20714
|
};
|
|
20746
|
-
return /*#__PURE__*/React__default.createElement(
|
|
20747
|
-
|
|
20748
|
-
|
|
20749
|
-
|
|
20715
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
20716
|
+
className: "plc-text-left plc-mr-auto plc-mb-6"
|
|
20717
|
+
}, /*#__PURE__*/React__default.createElement("p", {
|
|
20718
|
+
className: "plc-mb-3"
|
|
20719
|
+
}, t("messages.cancelWhen")), hasPhases && /*#__PURE__*/React__default.createElement(Radio, {
|
|
20720
|
+
onChange: handleOptionSelect,
|
|
20721
|
+
checked: cancelationOption === "period_end",
|
|
20722
|
+
value: "period_end"
|
|
20723
|
+
}, t("labels.endOn"), " ", new Date(Number(`${lastPhase === null || lastPhase === void 0 ? void 0 : lastPhase.end_date}000`)).toLocaleDateString("en-CA", {
|
|
20724
|
+
year: "numeric",
|
|
20725
|
+
month: "short",
|
|
20726
|
+
day: "numeric"
|
|
20727
|
+
})), /*#__PURE__*/React__default.createElement(Radio, {
|
|
20728
|
+
onChange: handleOptionSelect,
|
|
20729
|
+
checked: cancelationOption === "current_period_end",
|
|
20730
|
+
value: "current_period_end"
|
|
20731
|
+
}, t("labels.endOn"), " ", new Date(subscription === null || subscription === void 0 ? void 0 : subscription.current_period_end).toLocaleDateString("en-CA", {
|
|
20732
|
+
year: "numeric",
|
|
20733
|
+
month: "short",
|
|
20734
|
+
day: "numeric"
|
|
20735
|
+
})), /*#__PURE__*/React__default.createElement(Radio, {
|
|
20736
|
+
onChange: handleOptionSelect,
|
|
20737
|
+
checked: cancelationOption === "now",
|
|
20738
|
+
value: "now"
|
|
20739
|
+
}, t("labels.endImmediately")));
|
|
20750
20740
|
};
|
|
20751
20741
|
|
|
20752
20742
|
const SubscriptionCancelView = props => {
|
|
20743
|
+
var _subscriptionToCancel7, _subscriptionToCancel8;
|
|
20753
20744
|
const {
|
|
20754
|
-
subscriptionToCancel
|
|
20745
|
+
subscriptionToCancel,
|
|
20746
|
+
switchView
|
|
20755
20747
|
} = usePelcro();
|
|
20756
20748
|
const {
|
|
20757
20749
|
t
|
|
20758
20750
|
} = useTranslation("subscriptionCancel");
|
|
20751
|
+
const getPhases = () => {
|
|
20752
|
+
var _subscriptionToCancel, _subscriptionToCancel2, _subscriptionToCancel3, _subscriptionToCancel4, _subscriptionToCancel5, _subscriptionToCancel6;
|
|
20753
|
+
if (!subscriptionToCancel.schedule) return [];
|
|
20754
|
+
const currentPhaseStartDate = subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel = subscriptionToCancel.schedule) === null || _subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel2 = _subscriptionToCancel.current_phase) === null || _subscriptionToCancel2 === void 0 ? void 0 : _subscriptionToCancel2.start_date;
|
|
20755
|
+
const currentPhase = subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel3 = subscriptionToCancel.schedule) === null || _subscriptionToCancel3 === void 0 ? void 0 : (_subscriptionToCancel4 = _subscriptionToCancel3.phases) === null || _subscriptionToCancel4 === void 0 ? void 0 : _subscriptionToCancel4.find(phase => {
|
|
20756
|
+
return (phase === null || phase === void 0 ? void 0 : phase.start_date) === currentPhaseStartDate;
|
|
20757
|
+
});
|
|
20758
|
+
const futurePhases = subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel5 = subscriptionToCancel.schedule) === null || _subscriptionToCancel5 === void 0 ? void 0 : (_subscriptionToCancel6 = _subscriptionToCancel5.phases) === null || _subscriptionToCancel6 === void 0 ? void 0 : _subscriptionToCancel6.filter(phase => {
|
|
20759
|
+
return (phase === null || phase === void 0 ? void 0 : phase.start_date) > currentPhaseStartDate;
|
|
20760
|
+
});
|
|
20761
|
+
return [currentPhase, ...futurePhases];
|
|
20762
|
+
};
|
|
20763
|
+
const hasPhases = getPhases().length > 0;
|
|
20764
|
+
const phases = subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel7 = subscriptionToCancel.schedule) === null || _subscriptionToCancel7 === void 0 ? void 0 : _subscriptionToCancel7.phases;
|
|
20765
|
+
const lastPhase = phases[(phases === null || phases === void 0 ? void 0 : phases.length) - 1];
|
|
20759
20766
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
20760
20767
|
id: "pelcro-subscription-cancel-view"
|
|
20761
20768
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -20764,22 +20771,35 @@ const SubscriptionCancelView = props => {
|
|
|
20764
20771
|
className: "plc-text-2xl plc-font-semibold"
|
|
20765
20772
|
}, t("labels.title"), /*#__PURE__*/React__default.createElement("span", {
|
|
20766
20773
|
className: "plc-text-gray-400 plc-text-base plc-block"
|
|
20767
|
-
}, "(", subscriptionToCancel.plan.nickname, ")"))), /*#__PURE__*/React__default.createElement(SubscriptionCancelContainer, props, /*#__PURE__*/React__default.createElement("div", {
|
|
20774
|
+
}, "(", subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : (_subscriptionToCancel8 = subscriptionToCancel.plan) === null || _subscriptionToCancel8 === void 0 ? void 0 : _subscriptionToCancel8.nickname, ")"))), /*#__PURE__*/React__default.createElement(SubscriptionCancelContainer, props, /*#__PURE__*/React__default.createElement("div", {
|
|
20768
20775
|
className: "plc-flex plc-flex-col plc-items-center plc-justify-center plc-mt-4"
|
|
20769
20776
|
}, /*#__PURE__*/React__default.createElement(SvgSubscription, {
|
|
20770
20777
|
className: "plc-w-32 plc-h-32"
|
|
20771
20778
|
}), /*#__PURE__*/React__default.createElement("p", {
|
|
20772
|
-
className: "plc-mb-3 plc-text-gray-900 plc-text-
|
|
20773
|
-
}, t("messages.subscriptionEnd"), " ", new Date(
|
|
20779
|
+
className: "plc-mb-3 plc-text-gray-900 plc-text-left plc-mr-auto plc-whitespace-pre-line"
|
|
20780
|
+
}, t("messages.subscriptionEnd"), " ", hasPhases ? new Date(Number(`${lastPhase === null || lastPhase === void 0 ? void 0 : lastPhase.end_date}000`)).toLocaleDateString("en-CA", {
|
|
20774
20781
|
year: "numeric",
|
|
20775
20782
|
month: "short",
|
|
20776
20783
|
day: "numeric"
|
|
20777
|
-
})
|
|
20778
|
-
|
|
20779
|
-
|
|
20780
|
-
|
|
20784
|
+
}) : new Date(subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : subscriptionToCancel.current_period_end).toLocaleDateString("en-CA", {
|
|
20785
|
+
year: "numeric",
|
|
20786
|
+
month: "short",
|
|
20787
|
+
day: "numeric"
|
|
20788
|
+
}), "."), /*#__PURE__*/React__default.createElement(SubscriptionCancelOptions, {
|
|
20789
|
+
subscription: subscriptionToCancel,
|
|
20790
|
+
hasPhases: hasPhases
|
|
20791
|
+
}), /*#__PURE__*/React__default.createElement(SubscriptionCancelReason, null), /*#__PURE__*/React__default.createElement("div", {
|
|
20792
|
+
className: "plc-space-x-0 plc-space-y-3 md:plc-space-x-3 md:plc-space-y-0 plc-w-full plc-flex plc-flex-col md:plc-flex-row plc-items-center plc-justify-center"
|
|
20793
|
+
}, /*#__PURE__*/React__default.createElement(SubscriptionCancelButton, {
|
|
20794
|
+
className: "plc-w-3/4 md:plc-w-2/5",
|
|
20781
20795
|
subscription: subscriptionToCancel
|
|
20782
|
-
})
|
|
20796
|
+
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
20797
|
+
variant: "outline",
|
|
20798
|
+
className: "plc-w-3/4 md:plc-w-2/5",
|
|
20799
|
+
onClick: () => {
|
|
20800
|
+
switchView("dashboard");
|
|
20801
|
+
}
|
|
20802
|
+
}, t("labels.subCancellation.goBack"))))));
|
|
20783
20803
|
};
|
|
20784
20804
|
|
|
20785
20805
|
const SubscriptionCancelModal = _ref => {
|
package/dist/pelcro.css
CHANGED
|
@@ -1724,6 +1724,12 @@ in order to scope selectors under pelcro-root
|
|
|
1724
1724
|
|
|
1725
1725
|
/* utilities */
|
|
1726
1726
|
|
|
1727
|
+
.pelcro-root .plc-space-x-0 > :not([hidden]) ~ :not([hidden]) {
|
|
1728
|
+
--tw-space-x-reverse: 0;
|
|
1729
|
+
margin-right: calc(0px * var(--tw-space-x-reverse));
|
|
1730
|
+
margin-left: calc(0px * calc(1 - var(--tw-space-x-reverse)));
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1727
1733
|
.pelcro-root .plc-space-y-2 > :not([hidden]) ~ :not([hidden]) {
|
|
1728
1734
|
--tw-space-y-reverse: 0;
|
|
1729
1735
|
margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));
|
|
@@ -1736,6 +1742,12 @@ in order to scope selectors under pelcro-root
|
|
|
1736
1742
|
margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));
|
|
1737
1743
|
}
|
|
1738
1744
|
|
|
1745
|
+
.pelcro-root .plc-space-y-3 > :not([hidden]) ~ :not([hidden]) {
|
|
1746
|
+
--tw-space-y-reverse: 0;
|
|
1747
|
+
margin-top: calc(0.75rem * calc(1 - var(--tw-space-y-reverse)));
|
|
1748
|
+
margin-bottom: calc(0.75rem * var(--tw-space-y-reverse));
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1739
1751
|
.pelcro-root .plc-space-x-3 > :not([hidden]) ~ :not([hidden]) {
|
|
1740
1752
|
--tw-space-x-reverse: 0;
|
|
1741
1753
|
margin-right: calc(0.75rem * var(--tw-space-x-reverse));
|
|
@@ -2320,6 +2332,10 @@ in order to scope selectors under pelcro-root
|
|
|
2320
2332
|
margin-top: auto;
|
|
2321
2333
|
}
|
|
2322
2334
|
|
|
2335
|
+
.pelcro-root .plc-mr-auto {
|
|
2336
|
+
margin-right: auto;
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2323
2339
|
.pelcro-root .plc-ml-auto {
|
|
2324
2340
|
margin-left: auto;
|
|
2325
2341
|
}
|
|
@@ -3218,6 +3234,25 @@ in order to scope selectors under pelcro-root
|
|
|
3218
3234
|
}
|
|
3219
3235
|
|
|
3220
3236
|
@media (min-width: 768px) {
|
|
3237
|
+
.pelcro-root .md\:plc-space-y-0 > :not([hidden]) ~ :not([hidden]) {
|
|
3238
|
+
--tw-space-y-reverse: 0;
|
|
3239
|
+
margin-top: calc(0px * calc(1 - var(--tw-space-y-reverse)));
|
|
3240
|
+
margin-bottom: calc(0px * var(--tw-space-y-reverse));
|
|
3241
|
+
}
|
|
3242
|
+
|
|
3243
|
+
.pelcro-root .md\:plc-space-x-3 > :not([hidden]) ~ :not([hidden]) {
|
|
3244
|
+
--tw-space-x-reverse: 0;
|
|
3245
|
+
margin-right: calc(0.75rem * var(--tw-space-x-reverse));
|
|
3246
|
+
margin-left: calc(0.75rem * calc(1 - var(--tw-space-x-reverse)));
|
|
3247
|
+
}
|
|
3248
|
+
|
|
3249
|
+
.pelcro-root .md\:plc-flex-row {
|
|
3250
|
+
flex-direction: row;
|
|
3251
|
+
}
|
|
3252
|
+
|
|
3253
|
+
.pelcro-root .md\:plc-w-2\/5 {
|
|
3254
|
+
width: 40%;
|
|
3255
|
+
}
|
|
3221
3256
|
}
|
|
3222
3257
|
|
|
3223
3258
|
@media (min-width: 1024px) {
|