@pelcro/react-pelcro-js 4.0.0-alpha.16 → 4.0.0-alpha.17
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 +36101 -0
- package/dist/{components-0f4ebe18.js → index.esm.js} +13093 -9810
- package/package.json +3 -4
- package/dist/SubscriptionCancelView-2bdb2b25.js +0 -248
- package/dist/components.js +0 -4
- package/dist/index-242ce79e.js +0 -4649
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pelcro/react-pelcro-js",
|
|
3
3
|
"description": "Pelcro's React UI Elements",
|
|
4
|
-
"version": "4.0.0-alpha.
|
|
4
|
+
"version": "4.0.0-alpha.17",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
7
|
-
"main": "dist/index.js",
|
|
8
|
-
"module": "dist/index.js",
|
|
7
|
+
"main": "dist/index.cjs.js",
|
|
8
|
+
"module": "dist/index.esm.js",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
@@ -80,7 +80,6 @@
|
|
|
80
80
|
"react": "^16.6.1",
|
|
81
81
|
"react-dom": "^16.6.1",
|
|
82
82
|
"react-ga": "^2.7.0",
|
|
83
|
-
"react-ga4": "^1.4.1",
|
|
84
83
|
"react-refresh": "^0.9.0",
|
|
85
84
|
"react-test-renderer": "^17.0.2",
|
|
86
85
|
"request": "^2.88.2",
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import React__default, { createContext, useContext } from 'react';
|
|
2
|
-
import { u as useTranslation, a as useReducerWithSideEffects, S as SET_CANCEL_SUBSCRIPTION_REASON, l as lib_7, T as TextArea, R as ReactGA4, b as ReactGA1, c as usePelcro, B as Button, n as notify, d as SvgSubscription } from './components-0f4ebe18.js';
|
|
3
|
-
import 'react-dom';
|
|
4
|
-
import 'prop-types';
|
|
5
|
-
|
|
6
|
-
const initialState = {
|
|
7
|
-
cancelationReason: ""
|
|
8
|
-
};
|
|
9
|
-
const store = /*#__PURE__*/createContext(initialState);
|
|
10
|
-
const {
|
|
11
|
-
Provider
|
|
12
|
-
} = store;
|
|
13
|
-
|
|
14
|
-
const SubscriptionCancelContainer = ({
|
|
15
|
-
style,
|
|
16
|
-
className = "",
|
|
17
|
-
onSuccess = () => {},
|
|
18
|
-
onFailure = () => {},
|
|
19
|
-
children,
|
|
20
|
-
...props
|
|
21
|
-
}) => {
|
|
22
|
-
useTranslation("verifyEmail");
|
|
23
|
-
const [state, dispatch] = useReducerWithSideEffects((state, action) => {
|
|
24
|
-
switch (action.type) {
|
|
25
|
-
case SET_CANCEL_SUBSCRIPTION_REASON:
|
|
26
|
-
return lib_7({ ...state,
|
|
27
|
-
cancelationReason: action.payload
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
default:
|
|
31
|
-
return state;
|
|
32
|
-
}
|
|
33
|
-
}, initialState);
|
|
34
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
35
|
-
style: { ...style
|
|
36
|
-
},
|
|
37
|
-
className: `pelcro-container pelcro-subscription-cancel-container ${className}`
|
|
38
|
-
}, /*#__PURE__*/React__default.createElement(Provider, {
|
|
39
|
-
value: {
|
|
40
|
-
state,
|
|
41
|
-
dispatch
|
|
42
|
-
}
|
|
43
|
-
}, children.length ? children.map((child, i) => /*#__PURE__*/React__default.cloneElement(child, {
|
|
44
|
-
store,
|
|
45
|
-
key: i
|
|
46
|
-
})) : /*#__PURE__*/React__default.cloneElement(children, {
|
|
47
|
-
store
|
|
48
|
-
})));
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const SubscriptionCancelReason = props => {
|
|
52
|
-
const {
|
|
53
|
-
t
|
|
54
|
-
} = useTranslation("subscriptionCancel");
|
|
55
|
-
const {
|
|
56
|
-
dispatch,
|
|
57
|
-
state
|
|
58
|
-
} = useContext(store);
|
|
59
|
-
|
|
60
|
-
const handleOnTextAreaBlur = e => {
|
|
61
|
-
dispatch({
|
|
62
|
-
type: SET_CANCEL_SUBSCRIPTION_REASON,
|
|
63
|
-
payload: e.target.value.trim()
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
return /*#__PURE__*/React__default.createElement(TextArea, Object.assign({
|
|
68
|
-
label: t("labels.cancelReason"),
|
|
69
|
-
onBlur: e => handleOnTextAreaBlur(e)
|
|
70
|
-
}, props));
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
var _window$1, _window$Pelcro$1, _window$Pelcro$uiSett$1;
|
|
74
|
-
const ReactGA$1 = (_window$1 = window) !== null && _window$1 !== void 0 && (_window$Pelcro$1 = _window$1.Pelcro) !== null && _window$Pelcro$1 !== void 0 && (_window$Pelcro$uiSett$1 = _window$Pelcro$1.uiSettings) !== null && _window$Pelcro$uiSett$1 !== void 0 && _window$Pelcro$uiSett$1.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
75
|
-
const SubscriptionCancelNowButton = ({
|
|
76
|
-
subscription,
|
|
77
|
-
onClick,
|
|
78
|
-
className
|
|
79
|
-
}) => {
|
|
80
|
-
const {
|
|
81
|
-
switchView
|
|
82
|
-
} = usePelcro();
|
|
83
|
-
const {
|
|
84
|
-
state: {
|
|
85
|
-
cancelationReason
|
|
86
|
-
},
|
|
87
|
-
dispatch
|
|
88
|
-
} = useContext(store);
|
|
89
|
-
const {
|
|
90
|
-
t
|
|
91
|
-
} = useTranslation("subscriptionCancel");
|
|
92
|
-
|
|
93
|
-
const cancelSubscription = (payload, onSuccess, onFailure) => {
|
|
94
|
-
window.Pelcro.subscription.cancel({
|
|
95
|
-
auth_token: window.Pelcro.user.read().auth_token,
|
|
96
|
-
subscription_id: payload.subscription_id,
|
|
97
|
-
mode: payload.mode,
|
|
98
|
-
...(payload.reason && {
|
|
99
|
-
reason: payload.reason
|
|
100
|
-
})
|
|
101
|
-
}, (err, res) => {
|
|
102
|
-
var _ReactGA$event;
|
|
103
|
-
|
|
104
|
-
if (err) {
|
|
105
|
-
return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
ReactGA$1 === null || ReactGA$1 === void 0 ? void 0 : (_ReactGA$event = ReactGA$1.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA$1, {
|
|
109
|
-
category: "ACTIONS",
|
|
110
|
-
action: "Canceled",
|
|
111
|
-
nonInteraction: true
|
|
112
|
-
});
|
|
113
|
-
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
const handleCancelNowClick = () => {
|
|
118
|
-
const payload = {
|
|
119
|
-
subscription_id: subscription.id,
|
|
120
|
-
mode: "now",
|
|
121
|
-
...(cancelationReason && {
|
|
122
|
-
reason: cancelationReason
|
|
123
|
-
})
|
|
124
|
-
};
|
|
125
|
-
onClick === null || onClick === void 0 ? void 0 : onClick(); //Close the modal
|
|
126
|
-
|
|
127
|
-
switchView(null); //Show confirmation alert after closing the modal
|
|
128
|
-
|
|
129
|
-
notify.confirm((onSuccess, onFailure) => {
|
|
130
|
-
cancelSubscription(payload, onSuccess, onFailure);
|
|
131
|
-
}, {
|
|
132
|
-
confirmMessage: t("messages.subCancellation.isSureToCancelNow"),
|
|
133
|
-
loadingMessage: t("messages.subCancellation.loading"),
|
|
134
|
-
successMessage: t("messages.subCancellation.success"),
|
|
135
|
-
errorMessage: t("messages.subCancellation.error")
|
|
136
|
-
}, {
|
|
137
|
-
closeButtonLabel: t("labels.subCancellation.goBack")
|
|
138
|
-
});
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
return /*#__PURE__*/React__default.createElement(Button, {
|
|
142
|
-
onClick: handleCancelNowClick,
|
|
143
|
-
className: `${className}`
|
|
144
|
-
}, t("messages.cancelNow"));
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
var _window, _window$Pelcro, _window$Pelcro$uiSett;
|
|
148
|
-
const ReactGA = (_window = window) !== null && _window !== void 0 && (_window$Pelcro = _window.Pelcro) !== null && _window$Pelcro !== void 0 && (_window$Pelcro$uiSett = _window$Pelcro.uiSettings) !== null && _window$Pelcro$uiSett !== void 0 && _window$Pelcro$uiSett.enableReactGA4 ? ReactGA4 : ReactGA1;
|
|
149
|
-
const SubscriptionCancelLaterButton = ({
|
|
150
|
-
subscription,
|
|
151
|
-
onClick,
|
|
152
|
-
className
|
|
153
|
-
}) => {
|
|
154
|
-
const {
|
|
155
|
-
switchView
|
|
156
|
-
} = usePelcro();
|
|
157
|
-
const {
|
|
158
|
-
state: {
|
|
159
|
-
cancelationReason
|
|
160
|
-
},
|
|
161
|
-
dispatch
|
|
162
|
-
} = useContext(store);
|
|
163
|
-
const {
|
|
164
|
-
t
|
|
165
|
-
} = useTranslation("subscriptionCancel");
|
|
166
|
-
|
|
167
|
-
const cancelSubscription = (payload, onSuccess, onFailure) => {
|
|
168
|
-
window.Pelcro.subscription.cancel({
|
|
169
|
-
auth_token: window.Pelcro.user.read().auth_token,
|
|
170
|
-
subscription_id: payload.subscription_id,
|
|
171
|
-
mode: payload.mode,
|
|
172
|
-
...(payload.reason && {
|
|
173
|
-
reason: payload.reason
|
|
174
|
-
})
|
|
175
|
-
}, (err, res) => {
|
|
176
|
-
var _ReactGA$event;
|
|
177
|
-
|
|
178
|
-
if (err) {
|
|
179
|
-
return onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
ReactGA === null || ReactGA === void 0 ? void 0 : (_ReactGA$event = ReactGA.event) === null || _ReactGA$event === void 0 ? void 0 : _ReactGA$event.call(ReactGA, {
|
|
183
|
-
category: "ACTIONS",
|
|
184
|
-
action: "Canceled",
|
|
185
|
-
nonInteraction: true
|
|
186
|
-
});
|
|
187
|
-
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(res);
|
|
188
|
-
});
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
const handleCancelNowClick = () => {
|
|
192
|
-
const payload = {
|
|
193
|
-
subscription_id: subscription.id,
|
|
194
|
-
mode: "period_end",
|
|
195
|
-
...(cancelationReason && {
|
|
196
|
-
reason: cancelationReason
|
|
197
|
-
})
|
|
198
|
-
};
|
|
199
|
-
onClick === null || onClick === void 0 ? void 0 : onClick(); //Close the modal
|
|
200
|
-
|
|
201
|
-
switchView(null); //Show confirmation alert after closing the modal
|
|
202
|
-
|
|
203
|
-
notify.confirm((onSuccess, onFailure) => {
|
|
204
|
-
cancelSubscription(payload, onSuccess, onFailure);
|
|
205
|
-
}, {
|
|
206
|
-
confirmMessage: t("messages.subCancellation.isSureToCancel"),
|
|
207
|
-
loadingMessage: t("messages.subCancellation.loading"),
|
|
208
|
-
successMessage: t("messages.subCancellation.success"),
|
|
209
|
-
errorMessage: t("messages.subCancellation.error")
|
|
210
|
-
}, {
|
|
211
|
-
closeButtonLabel: t("labels.subCancellation.goBack")
|
|
212
|
-
});
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
return /*#__PURE__*/React__default.createElement(Button, {
|
|
216
|
-
onClick: handleCancelNowClick,
|
|
217
|
-
className: `${className}`
|
|
218
|
-
}, t("messages.cancelLater"));
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
const SubscriptionCancelView = props => {
|
|
222
|
-
const {
|
|
223
|
-
subscriptionToCancel
|
|
224
|
-
} = usePelcro();
|
|
225
|
-
const {
|
|
226
|
-
t
|
|
227
|
-
} = useTranslation("subscriptionCancel");
|
|
228
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
229
|
-
id: "pelcro-subscription-cancel-view"
|
|
230
|
-
}, /*#__PURE__*/React__default.createElement(SubscriptionCancelContainer, props, /*#__PURE__*/React__default.createElement("div", {
|
|
231
|
-
className: "plc-flex plc-flex-col plc-items-center plc-justify-center plc-mt-4"
|
|
232
|
-
}, /*#__PURE__*/React__default.createElement(SvgSubscription, {
|
|
233
|
-
className: "plc-w-32 plc-h-32"
|
|
234
|
-
}), /*#__PURE__*/React__default.createElement("p", {
|
|
235
|
-
className: "plc-mb-3 plc-text-gray-900 plc-text-center plc-whitespace-pre-line"
|
|
236
|
-
}, t("messages.subscriptionEnd"), " ", new Date(subscriptionToCancel === null || subscriptionToCancel === void 0 ? void 0 : subscriptionToCancel.current_period_end).toLocaleDateString("en-CA", {
|
|
237
|
-
year: "numeric",
|
|
238
|
-
month: "short",
|
|
239
|
-
day: "numeric"
|
|
240
|
-
}), "."), /*#__PURE__*/React__default.createElement(SubscriptionCancelReason, null), /*#__PURE__*/React__default.createElement(SubscriptionCancelNowButton, {
|
|
241
|
-
className: "plc-mb-2",
|
|
242
|
-
subscription: subscriptionToCancel
|
|
243
|
-
}), subscriptionToCancel.cancel_at_period_end === 0 && /*#__PURE__*/React__default.createElement(SubscriptionCancelLaterButton, {
|
|
244
|
-
subscription: subscriptionToCancel
|
|
245
|
-
}))));
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
export { SubscriptionCancelView };
|
package/dist/components.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { ay as AddressCreateCity, ap as AddressCreateContainer, aA as AddressCreateCountrySelect, as as AddressCreateFirstName, at as AddressCreateLastName, aw as AddressCreateLine1, ax as AddressCreateLine2, aq as AddressCreateModal, az as AddressCreatePostalCode, aC as AddressCreateSetDefault, aB as AddressCreateStateSelect, ar as AddressCreateSubmit, av as AddressCreateTextInput, au as AddressCreateView, bT as AddressSelectContainer, bW as AddressSelectList, bU as AddressSelectModal, bV as AddressSelectSubmit, bX as AddressSelectView, aP as AddressUpdateCity, aJ as AddressUpdateContainer, aK as AddressUpdateCountrySelect, aL as AddressUpdateFirstName, aM as AddressUpdateLastName, aN as AddressUpdateLine1, aO as AddressUpdateLine2, aR as AddressUpdateModal, aQ as AddressUpdatePostalCode, aW as AddressUpdateSetDefault, aS as AddressUpdateStateSelect, aT as AddressUpdateSubmit, aU as AddressUpdateTextInput, aV as AddressUpdateView, cs as Alert, ct as AlertElement, a4 as ApplyCouponButton, H as Auth0LoginButton, cu as Badge, a7 as BankAuthenticationSuccess, a6 as BankRedirection, B as Button, br as CartContainer, bs as CartModal, bu as CartRemoveItemButton, bv as CartSubmit, bw as CartTotalPrice, bt as CartView, cv as Checkbox, aH as CheckoutForm, C as ConfirmPassword, a5 as CouponCode, a8 as CouponCodeField, c1 as Dashboard, c2 as DashboardOpenButton, cw as DatePicker, ac as DiscountedPrice, E as Email, cb as EmailVerifyContainer, cc as EmailVerifyModal, cd as EmailVerifyResendButton, ce as EmailVerifyView, F as FacebookLoginButton, bH as GiftCreateContainer, bL as GiftCreateEmail, bJ as GiftCreateFirstName, bK as GiftCreateLastName, bN as GiftCreateMessage, bF as GiftCreateModal, bM as GiftCreateStartDate, bI as GiftCreateSubmitButton, bG as GiftCreateView, bO as GiftRedeemCode, bP as GiftRedeemContainer, bQ as GiftRedeemModal, bS as GiftRedeemSubmitButton, bR as GiftRedeemView, G as GoogleLoginButton, cJ as IncludeFirstName, cK as IncludeLastName, cL as IncludePhone, cx as Input, cn as InvoiceDetailsContainer, cq as InvoiceDetailsDownloadButton, co as InvoiceDetailsModal, cp as InvoiceDetailsPayButton, cr as InvoiceDetailsView, cj as InvoicePaymentContainer, ck as InvoicePaymentModal, cm as InvoicePaymentView, cy as Link, j as LoginButton, L as LoginContainer, m as LoginEmail, q as LoginModal, o as LoginPassword, k as LoginRequestLoginToken, p as LoginView, i as Logout, $ as MeterModal, a0 as MeterView, cz as Modal, cB as ModalBody, cC as ModalFooter, cA as ModalHeader, V as NewsLetter, X as NewsletterUpdateButton, Y as NewsletterUpdateContainer, _ as NewsletterUpdateList, W as NewsletterUpdateModal, Z as NewsletterUpdateView, cF as Notification, bE as OrderConfirmModal, bB as OrderCreateContainer, bC as OrderCreateModal, bA as OrderCreateSubmitButton, bD as OrderCreateView, h as Password, bq as PasswordChangeButton, bp as PasswordChangeConfirmNewPassword, bl as PasswordChangeContainer, bn as PasswordChangeCurrentPassword, bm as PasswordChangeModal, bo as PasswordChangeNewPassword, bk as PasswordChangeView, ba as PasswordForgotButton, bb as PasswordForgotContainer, bc as PasswordForgotEmail, bd as PasswordForgotModal, be as PasswordForgotView, b9 as PasswordResetButton, b7 as PasswordResetConfirmPassword, b5 as PasswordResetContainer, b6 as PasswordResetEmail, b3 as PasswordResetModal, b8 as PasswordResetPassword, b4 as PasswordResetView, bf as PasswordlessRequestContainer, bh as PasswordlessRequestEmail, bi as PasswordlessRequestModal, bj as PasswordlessRequestView, bg as PasswordlessRequestViewButton, a_ as PaymentCreateContainer, a$ as PaymentCreateView, a1 as PaymentMethodContainer, bY as PaymentMethodSelectContainer, c0 as PaymentMethodSelectList, bZ as PaymentMethodSelectModal, b$ as PaymentMethodSelectSubmit, b_ as PaymentMethodSelectView, b0 as PaymentMethodUpdateContainer, b1 as PaymentMethodUpdateModal, b2 as PaymentMethodUpdateView, a2 as PaymentMethodView, Q as PaymentSuccessModal, U as PaymentSuccessView, aI as PaypalSubscribeButton, aD as PelcroCardCVC, aE as PelcroCardExpiry, aF as PelcroCardNumber, P as PelcroModalController, aG as PelcroPaymentRequestButton, c3 as ProfilePicChangeButton, c4 as ProfilePicChangeContainer, c5 as ProfilePicChangeCropper, ca as ProfilePicChangeModal, c8 as ProfilePicChangeRemoveButton, c7 as ProfilePicChangeSelectButton, c9 as ProfilePicChangeView, c6 as ProfilePicChangeZoom, cH as QrCodeModal, cI as QrCodeView, cD as Radio, y as RegisterButton, A as RegisterCompany, r as RegisterContainer, t as RegisterEmail, w as RegisterFirstName, z as RegisterJobTitle, x as RegisterLastName, D as RegisterModal, v as RegisterPassword, s as RegisterView, cE as Select, I as SelectModal, a3 as SelectedPaymentMethod, by as ShopPurchaseButton, bx as ShopSelectProductButton, bz as ShopView, a9 as SubmitPaymentMethod, K as SubscriptionCancelModal, aX as SubscriptionCreateContainer, aa as SubscriptionCreateModal, ab as SubscriptionCreateView, aY as SubscriptionRenewContainer, J as SubscriptionRenewModal, O as SubscriptionRenewView, aZ as SubscriptionSuspendContainer, M as SubscriptionSuspendModal, N as SubscriptionSuspendView, ad as TaxAmount, T as TextArea, cG as Tooltip, af as UserUpdateButton, ag as UserUpdateContainer, ak as UserUpdateDisplayName, ae as UserUpdateEmail, aj as UserUpdateFirstName, al as UserUpdateLastName, ai as UserUpdateModal, am as UserUpdatePhone, ao as UserUpdateProfilePic, an as UserUpdateTextInput, ah as UserUpdateView, cf as VerifyLinkTokenContainer, ci as VerifyLinkTokenLoader, cg as VerifyLinkTokenModal, ch as VerifyLinkTokenView, cO as authenticatedButtons, cM as i18n, cN as initButtons, cQ as initContentEntitlement, cl as invoicePaymentSubmitButton, n as notify, cP as unauthenticatedButtons, c as usePelcro } from './components-0f4ebe18.js';
|
|
2
|
-
import 'react';
|
|
3
|
-
import 'react-dom';
|
|
4
|
-
import 'prop-types';
|