@churnkey/react 0.1.2 → 0.3.0
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/README.md +1 -1
- package/dist/{chunk-CPBEP4NW.cjs → chunk-2VQNWZWO.cjs} +35 -23
- package/dist/chunk-2VQNWZWO.cjs.map +1 -0
- package/dist/{chunk-XU7KDCXO.cjs → chunk-42SJA62X.cjs} +9 -7
- package/dist/chunk-42SJA62X.cjs.map +1 -0
- package/dist/{chunk-SIYJ4R4B.cjs → chunk-LVUDBCQ2.cjs} +57 -11
- package/dist/chunk-LVUDBCQ2.cjs.map +1 -0
- package/dist/{chunk-GCQ75J4G.js → chunk-SQ35G4LA.js} +55 -11
- package/dist/chunk-SQ35G4LA.js.map +1 -0
- package/dist/{chunk-IFVMM2LB.js → chunk-UNSSI6KX.js} +35 -23
- package/dist/chunk-UNSSI6KX.js.map +1 -0
- package/dist/{chunk-QTMZI5I2.js → chunk-YZERGV7F.js} +6 -4
- package/dist/chunk-YZERGV7F.js.map +1 -0
- package/dist/core.cjs +20 -12
- package/dist/core.d.cts +14 -3
- package/dist/core.d.ts +14 -3
- package/dist/core.js +2 -2
- package/dist/headless.cjs +3 -3
- package/dist/headless.d.cts +5 -1
- package/dist/headless.d.ts +5 -1
- package/dist/headless.js +2 -2
- package/dist/index.cjs +199 -189
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +116 -114
- package/dist/index.js.map +1 -1
- package/dist/{step-graph-ChdI-VXV.d.ts → step-graph-ChlSCUGk.d.cts} +89 -20
- package/dist/{step-graph-ChdI-VXV.d.cts → step-graph-ChlSCUGk.d.ts} +89 -20
- package/dist/styles.css +173 -67
- package/package.json +1 -1
- package/dist/chunk-CPBEP4NW.cjs.map +0 -1
- package/dist/chunk-GCQ75J4G.js.map +0 -1
- package/dist/chunk-IFVMM2LB.js.map +0 -1
- package/dist/chunk-QTMZI5I2.js.map +0 -1
- package/dist/chunk-SIYJ4R4B.cjs.map +0 -1
- package/dist/chunk-XU7KDCXO.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunk42SJA62X_cjs = require('./chunk-42SJA62X.cjs');
|
|
4
|
+
var chunkLVUDBCQ2_cjs = require('./chunk-LVUDBCQ2.cjs');
|
|
5
|
+
var chunk2VQNWZWO_cjs = require('./chunk-2VQNWZWO.cjs');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
8
|
|
|
@@ -20,18 +20,29 @@ function RichText({ html, as = "p", className }) {
|
|
|
20
20
|
function DefaultConfirm({
|
|
21
21
|
title,
|
|
22
22
|
description,
|
|
23
|
+
subscriptions,
|
|
24
|
+
losses,
|
|
25
|
+
lossesLabel,
|
|
23
26
|
confirmLabel,
|
|
24
27
|
goBackLabel,
|
|
25
|
-
periodEnd,
|
|
26
28
|
onConfirm,
|
|
27
29
|
onGoBack,
|
|
28
30
|
isProcessing,
|
|
29
31
|
classNames
|
|
30
32
|
}) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
const hasLosses = Array.isArray(losses) && losses.length > 0;
|
|
34
|
+
const periodEnd = chunkLVUDBCQ2_cjs.formatPeriodEnd(subscriptions);
|
|
35
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkLVUDBCQ2_cjs.cn("ck-step ck-step-confirm", classNames?.root), children: [
|
|
36
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: chunkLVUDBCQ2_cjs.cn("ck-step-title", classNames?.title), children: title }),
|
|
37
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(RichText, { html: description, className: chunkLVUDBCQ2_cjs.cn("ck-step-description", classNames?.description) }),
|
|
38
|
+
hasLosses && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkLVUDBCQ2_cjs.cn("ck-loss-block", classNames?.lossList), children: [
|
|
39
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkLVUDBCQ2_cjs.cn("ck-loss-label", classNames?.lossLabel), children: lossesLabel ?? "You'll lose access to:" }),
|
|
40
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "ck-loss-list", children: losses.map((item) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: chunkLVUDBCQ2_cjs.cn("ck-loss-item", classNames?.lossItem), children: [
|
|
41
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: chunkLVUDBCQ2_cjs.cn("ck-loss-bullet", classNames?.lossBullet), children: "\u25CF" }),
|
|
42
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: item })
|
|
43
|
+
] }, item)) })
|
|
44
|
+
] }),
|
|
45
|
+
periodEnd && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: chunkLVUDBCQ2_cjs.cn("ck-period-end", classNames?.periodEndNotice), children: [
|
|
35
46
|
"Your access continues until ",
|
|
36
47
|
periodEnd,
|
|
37
48
|
"."
|
|
@@ -40,13 +51,13 @@ function DefaultConfirm({
|
|
|
40
51
|
"button",
|
|
41
52
|
{
|
|
42
53
|
type: "button",
|
|
43
|
-
className:
|
|
54
|
+
className: chunkLVUDBCQ2_cjs.cn("ck-button ck-button-danger", classNames?.confirmButton),
|
|
44
55
|
onClick: onConfirm,
|
|
45
56
|
disabled: isProcessing,
|
|
46
57
|
children: isProcessing ? "Processing..." : confirmLabel
|
|
47
58
|
}
|
|
48
59
|
),
|
|
49
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className:
|
|
60
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: chunkLVUDBCQ2_cjs.cn("ck-button-link", classNames?.goBackButton), onClick: onGoBack, children: goBackLabel })
|
|
50
61
|
] });
|
|
51
62
|
}
|
|
52
63
|
function DefaultFeedback({
|
|
@@ -65,13 +76,13 @@ function DefaultFeedback({
|
|
|
65
76
|
const isUnderMin = hasMin && value.length > 0 && value.length < minLength;
|
|
66
77
|
const isValid = !required || value.length >= minLength;
|
|
67
78
|
const placeholderText = placeholder ?? (hasMin ? `At least ${minLength} characters\u2026` : "Type your thoughts\u2026");
|
|
68
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
69
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { className:
|
|
70
|
-
description && /* @__PURE__ */ jsxRuntime.jsx(RichText, { html: description, className:
|
|
79
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkLVUDBCQ2_cjs.cn("ck-step ck-step-feedback", classNames?.root), children: [
|
|
80
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: chunkLVUDBCQ2_cjs.cn("ck-step-title", classNames?.title), children: title }),
|
|
81
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(RichText, { html: description, className: chunkLVUDBCQ2_cjs.cn("ck-step-description", classNames?.description) }),
|
|
71
82
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
72
83
|
"div",
|
|
73
84
|
{
|
|
74
|
-
className:
|
|
85
|
+
className: chunkLVUDBCQ2_cjs.cn(
|
|
75
86
|
"ck-feedback-field",
|
|
76
87
|
focused && "ck-feedback-field--focused",
|
|
77
88
|
isUnderMin && "ck-feedback-field--invalid"
|
|
@@ -80,7 +91,7 @@ function DefaultFeedback({
|
|
|
80
91
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
81
92
|
"textarea",
|
|
82
93
|
{
|
|
83
|
-
className:
|
|
94
|
+
className: chunkLVUDBCQ2_cjs.cn("ck-textarea", classNames?.textarea),
|
|
84
95
|
placeholder: placeholderText,
|
|
85
96
|
value,
|
|
86
97
|
onChange: (e) => onChange(e.target.value),
|
|
@@ -92,7 +103,7 @@ function DefaultFeedback({
|
|
|
92
103
|
hasMin && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
93
104
|
"div",
|
|
94
105
|
{
|
|
95
|
-
className:
|
|
106
|
+
className: chunkLVUDBCQ2_cjs.cn(
|
|
96
107
|
"ck-character-count",
|
|
97
108
|
isUnderMin && "ck-character-count--invalid",
|
|
98
109
|
classNames?.characterCount
|
|
@@ -111,7 +122,7 @@ function DefaultFeedback({
|
|
|
111
122
|
"button",
|
|
112
123
|
{
|
|
113
124
|
type: "button",
|
|
114
|
-
className:
|
|
125
|
+
className: chunkLVUDBCQ2_cjs.cn("ck-button ck-button-primary", classNames?.submitButton),
|
|
115
126
|
onClick: onSubmit,
|
|
116
127
|
disabled: !isValid,
|
|
117
128
|
children: "Continue"
|
|
@@ -130,21 +141,21 @@ function DefaultContactOffer({
|
|
|
130
141
|
}) {
|
|
131
142
|
const headline = title ?? offer.copy.headline;
|
|
132
143
|
const body = description ?? offer.copy.body;
|
|
133
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
134
|
-
headline && /* @__PURE__ */ jsxRuntime.jsx("h2", { className:
|
|
135
|
-
body && /* @__PURE__ */ jsxRuntime.jsx(RichText, { html: body, className:
|
|
136
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
144
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkLVUDBCQ2_cjs.cn("ck-step ck-step-offer", classNames?.root), children: [
|
|
145
|
+
headline && /* @__PURE__ */ jsxRuntime.jsx("h2", { className: chunkLVUDBCQ2_cjs.cn("ck-step-title", classNames?.title), children: headline }),
|
|
146
|
+
body && /* @__PURE__ */ jsxRuntime.jsx(RichText, { html: body, className: chunkLVUDBCQ2_cjs.cn("ck-step-description", classNames?.description) }),
|
|
147
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkLVUDBCQ2_cjs.cn("ck-offer-card", classNames?.card), children: [
|
|
137
148
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
138
149
|
"button",
|
|
139
150
|
{
|
|
140
151
|
type: "button",
|
|
141
|
-
className:
|
|
152
|
+
className: chunkLVUDBCQ2_cjs.cn("ck-button ck-button-primary", classNames?.acceptButton),
|
|
142
153
|
onClick: () => onAccept(),
|
|
143
154
|
disabled: isProcessing,
|
|
144
155
|
children: isProcessing ? "Processing..." : offer.copy.cta
|
|
145
156
|
}
|
|
146
157
|
),
|
|
147
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className:
|
|
158
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: chunkLVUDBCQ2_cjs.cn("ck-button-link", classNames?.declineButton), onClick: onDecline, children: offer.copy.declineCta })
|
|
148
159
|
] })
|
|
149
160
|
] });
|
|
150
161
|
}
|
|
@@ -160,11 +171,11 @@ function DefaultDiscountOffer({
|
|
|
160
171
|
const o = offer;
|
|
161
172
|
const headline = title ?? offer.copy.headline;
|
|
162
173
|
const body = description ?? offer.copy.body;
|
|
163
|
-
const phrase =
|
|
164
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
165
|
-
headline && /* @__PURE__ */ jsxRuntime.jsx("h2", { className:
|
|
166
|
-
body && /* @__PURE__ */ jsxRuntime.jsx(RichText, { html: body, className:
|
|
167
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
174
|
+
const phrase = chunkLVUDBCQ2_cjs.discountPhrase(o);
|
|
175
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkLVUDBCQ2_cjs.cn("ck-step ck-step-offer", classNames?.root), children: [
|
|
176
|
+
headline && /* @__PURE__ */ jsxRuntime.jsx("h2", { className: chunkLVUDBCQ2_cjs.cn("ck-step-title", classNames?.title), children: headline }),
|
|
177
|
+
body && /* @__PURE__ */ jsxRuntime.jsx(RichText, { html: body, className: chunkLVUDBCQ2_cjs.cn("ck-step-description", classNames?.description) }),
|
|
178
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkLVUDBCQ2_cjs.cn("ck-offer-card", classNames?.card), children: [
|
|
168
179
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ck-offer-details ck-offer-discount", children: [
|
|
169
180
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ck-offer-discount-eyebrow", children: "Limited-time offer" }),
|
|
170
181
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ck-offer-discount-phrase", children: phrase })
|
|
@@ -173,13 +184,13 @@ function DefaultDiscountOffer({
|
|
|
173
184
|
"button",
|
|
174
185
|
{
|
|
175
186
|
type: "button",
|
|
176
|
-
className:
|
|
187
|
+
className: chunkLVUDBCQ2_cjs.cn("ck-button ck-button-primary", classNames?.acceptButton),
|
|
177
188
|
onClick: () => onAccept(),
|
|
178
189
|
disabled: isProcessing,
|
|
179
190
|
children: isProcessing ? "Processing..." : offer.copy.cta
|
|
180
191
|
}
|
|
181
192
|
),
|
|
182
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className:
|
|
193
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: chunkLVUDBCQ2_cjs.cn("ck-button-link", classNames?.declineButton), onClick: onDecline, children: offer.copy.declineCta })
|
|
183
194
|
] })
|
|
184
195
|
] });
|
|
185
196
|
}
|
|
@@ -194,86 +205,54 @@ function DefaultPauseOffer({
|
|
|
194
205
|
}) {
|
|
195
206
|
const o = offer;
|
|
196
207
|
const max = Math.max(1, o.months);
|
|
197
|
-
const [months, setMonths] = react.useState(
|
|
208
|
+
const [months, setMonths] = react.useState(1);
|
|
198
209
|
const headline = title ?? offer.copy.headline;
|
|
199
210
|
const body = description ?? offer.copy.body;
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
/* @__PURE__ */ jsxRuntime.
|
|
209
|
-
|
|
210
|
-
const isSelected = m === months;
|
|
211
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
212
|
-
"button",
|
|
213
|
-
{
|
|
214
|
-
type: "button",
|
|
215
|
-
onClick: () => setMonths(m),
|
|
216
|
-
className: chunkSIYJ4R4B_cjs.cn("ck-pause-segment", isSelected && "ck-pause-segment--selected"),
|
|
217
|
-
children: [
|
|
218
|
-
m,
|
|
219
|
-
" ",
|
|
220
|
-
m === 1 ? "month" : "months"
|
|
221
|
-
]
|
|
222
|
-
},
|
|
223
|
-
m
|
|
224
|
-
);
|
|
225
|
-
}) }),
|
|
226
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ck-pause-resume", children: [
|
|
227
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
228
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ck-pause-resume-label", children: "Billing resumes" }),
|
|
229
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ck-pause-resume-date", children: resumeDate })
|
|
230
|
-
] }),
|
|
231
|
-
/* @__PURE__ */ jsxRuntime.jsx(CalendarIcon, {})
|
|
232
|
-
] })
|
|
233
|
-
] }),
|
|
234
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
211
|
+
const resume = /* @__PURE__ */ new Date();
|
|
212
|
+
resume.setMonth(resume.getMonth() + months);
|
|
213
|
+
const resumeDate = chunkLVUDBCQ2_cjs.formatMonthDayLong(resume);
|
|
214
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkLVUDBCQ2_cjs.cn("ck-step ck-step-offer", classNames?.root), children: [
|
|
215
|
+
headline && /* @__PURE__ */ jsxRuntime.jsx("h2", { className: chunkLVUDBCQ2_cjs.cn("ck-step-title", classNames?.title), children: headline }),
|
|
216
|
+
body && /* @__PURE__ */ jsxRuntime.jsx(RichText, { html: body, className: chunkLVUDBCQ2_cjs.cn("ck-step-description", classNames?.description) }),
|
|
217
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkLVUDBCQ2_cjs.cn("ck-offer-card ck-pause-card", classNames?.card), children: [
|
|
218
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ck-pause-eyebrow", children: "We'll see you back on" }),
|
|
219
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ck-pause-date", children: resumeDate }),
|
|
220
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkLVUDBCQ2_cjs.cn("ck-pause-chips", classNames?.pauseSlider), children: Array.from({ length: max }, (_, i) => i + 1).map((m) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
235
221
|
"button",
|
|
236
222
|
{
|
|
237
223
|
type: "button",
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
children:
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
224
|
+
onClick: () => setMonths(m),
|
|
225
|
+
className: chunkLVUDBCQ2_cjs.cn("ck-pause-chip", m === months && "ck-pause-chip--selected"),
|
|
226
|
+
"aria-pressed": m === months,
|
|
227
|
+
children: [
|
|
228
|
+
m,
|
|
229
|
+
" ",
|
|
230
|
+
m === 1 ? "month" : "months"
|
|
231
|
+
]
|
|
232
|
+
},
|
|
233
|
+
m
|
|
234
|
+
)) })
|
|
235
|
+
] }),
|
|
236
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
237
|
+
"button",
|
|
238
|
+
{
|
|
239
|
+
type: "button",
|
|
240
|
+
className: chunkLVUDBCQ2_cjs.cn("ck-button ck-button-primary", classNames?.acceptButton),
|
|
241
|
+
onClick: () => onAccept({ months }),
|
|
242
|
+
disabled: isProcessing,
|
|
243
|
+
children: isProcessing ? "Processing..." : offer.copy.cta
|
|
244
|
+
}
|
|
245
|
+
),
|
|
246
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: chunkLVUDBCQ2_cjs.cn("ck-button-link", classNames?.declineButton), onClick: onDecline, children: offer.copy.declineCta })
|
|
246
247
|
] });
|
|
247
248
|
}
|
|
248
|
-
function CalendarIcon() {
|
|
249
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
250
|
-
"svg",
|
|
251
|
-
{
|
|
252
|
-
className: "ck-pause-resume-icon",
|
|
253
|
-
width: "18",
|
|
254
|
-
height: "18",
|
|
255
|
-
viewBox: "0 0 24 24",
|
|
256
|
-
fill: "none",
|
|
257
|
-
stroke: "currentColor",
|
|
258
|
-
strokeWidth: "1.75",
|
|
259
|
-
strokeLinecap: "round",
|
|
260
|
-
strokeLinejoin: "round",
|
|
261
|
-
"aria-hidden": "true",
|
|
262
|
-
children: [
|
|
263
|
-
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "3", y: "4", width: "18", height: "18", rx: "3" }),
|
|
264
|
-
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "16", y1: "2", x2: "16", y2: "6" }),
|
|
265
|
-
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "8", y1: "2", x2: "8", y2: "6" }),
|
|
266
|
-
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "3", y1: "10", x2: "21", y2: "10" })
|
|
267
|
-
]
|
|
268
|
-
}
|
|
269
|
-
);
|
|
270
|
-
}
|
|
271
249
|
function Checkmark({ color = "currentColor", size = 14 }) {
|
|
272
250
|
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 8.5L6.5 12L13 5", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
273
251
|
}
|
|
274
252
|
function DefaultPlanChangeOffer({
|
|
275
253
|
title,
|
|
276
254
|
description,
|
|
255
|
+
subscriptions,
|
|
277
256
|
offer,
|
|
278
257
|
onAccept,
|
|
279
258
|
onDecline,
|
|
@@ -282,31 +261,42 @@ function DefaultPlanChangeOffer({
|
|
|
282
261
|
}) {
|
|
283
262
|
const o = offer;
|
|
284
263
|
const plans = o.plans ?? [];
|
|
285
|
-
const
|
|
264
|
+
const currentPlanId = subscriptions[0]?.items[0]?.price.id;
|
|
265
|
+
const initialPlanId = plans.find((p) => p.id !== currentPlanId)?.id ?? null;
|
|
266
|
+
const [selectedPlanId, setSelectedPlanId] = react.useState(initialPlanId);
|
|
286
267
|
const selectedPlan = plans.find((p) => p.id === selectedPlanId) ?? null;
|
|
287
268
|
const headline = title ?? offer.copy.headline;
|
|
288
269
|
const body = description ?? offer.copy.body;
|
|
289
270
|
const ctaLabel = isProcessing ? "Processing..." : selectedPlan?.name ? `Switch to ${selectedPlan.name}` : offer.copy.cta;
|
|
290
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
291
|
-
headline && /* @__PURE__ */ jsxRuntime.jsx("h2", { className:
|
|
292
|
-
body && /* @__PURE__ */ jsxRuntime.jsx(RichText, { html: body, className:
|
|
293
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
271
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkLVUDBCQ2_cjs.cn("ck-step ck-step-offer", classNames?.root), children: [
|
|
272
|
+
headline && /* @__PURE__ */ jsxRuntime.jsx("h2", { className: chunkLVUDBCQ2_cjs.cn("ck-step-title", classNames?.title), children: headline }),
|
|
273
|
+
body && /* @__PURE__ */ jsxRuntime.jsx(RichText, { html: body, className: chunkLVUDBCQ2_cjs.cn("ck-step-description", classNames?.description) }),
|
|
274
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkLVUDBCQ2_cjs.cn("ck-offer-card", classNames?.card), children: [
|
|
294
275
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ck-offer-details ck-plan-grid", children: plans.map((plan) => {
|
|
295
276
|
const interval = plan.duration?.interval ?? "month";
|
|
296
277
|
const currency = plan.amount.currency ?? "USD";
|
|
297
278
|
const isSelected = plan.id === selectedPlanId;
|
|
279
|
+
const isCurrent = plan.id === currentPlanId;
|
|
298
280
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
299
281
|
"button",
|
|
300
282
|
{
|
|
301
283
|
type: "button",
|
|
302
284
|
onClick: () => setSelectedPlanId(plan.id),
|
|
303
|
-
|
|
285
|
+
disabled: isCurrent,
|
|
286
|
+
className: chunkLVUDBCQ2_cjs.cn(
|
|
287
|
+
"ck-plan-card",
|
|
288
|
+
isSelected && "ck-plan-card--selected",
|
|
289
|
+
isCurrent && "ck-plan-card--current"
|
|
290
|
+
),
|
|
304
291
|
"aria-pressed": isSelected,
|
|
305
292
|
children: [
|
|
306
|
-
/* @__PURE__ */ jsxRuntime.
|
|
293
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ck-plan-name", children: [
|
|
294
|
+
plan.name ?? plan.id,
|
|
295
|
+
isCurrent && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ck-plan-current-badge", children: "Current" })
|
|
296
|
+
] }),
|
|
307
297
|
plan.tagline && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ck-plan-tagline", children: plan.tagline }),
|
|
308
298
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ck-plan-price-row", children: [
|
|
309
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ck-plan-amount", children:
|
|
299
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ck-plan-amount", children: chunkLVUDBCQ2_cjs.formatPriceFromMinor(plan.amount.value, currency) }),
|
|
310
300
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ck-plan-period", children: [
|
|
311
301
|
"/",
|
|
312
302
|
interval
|
|
@@ -326,13 +316,13 @@ function DefaultPlanChangeOffer({
|
|
|
326
316
|
"button",
|
|
327
317
|
{
|
|
328
318
|
type: "button",
|
|
329
|
-
className:
|
|
319
|
+
className: chunkLVUDBCQ2_cjs.cn("ck-button ck-button-primary", classNames?.acceptButton),
|
|
330
320
|
onClick: () => selectedPlanId && onAccept({ planId: selectedPlanId }),
|
|
331
321
|
disabled: isProcessing || !selectedPlanId,
|
|
332
322
|
children: ctaLabel
|
|
333
323
|
}
|
|
334
324
|
),
|
|
335
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className:
|
|
325
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: chunkLVUDBCQ2_cjs.cn("ck-button-link", classNames?.declineButton), onClick: onDecline, children: offer.copy.declineCta })
|
|
336
326
|
] })
|
|
337
327
|
] });
|
|
338
328
|
}
|
|
@@ -340,15 +330,15 @@ function DefaultRedirectOffer({ title, description, offer, onDecline, classNames
|
|
|
340
330
|
const url = offer.url;
|
|
341
331
|
const headline = title ?? offer.copy.headline;
|
|
342
332
|
const body = description ?? offer.copy.body;
|
|
343
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
344
|
-
headline && /* @__PURE__ */ jsxRuntime.jsx("h2", { className:
|
|
345
|
-
body && /* @__PURE__ */ jsxRuntime.jsx(RichText, { html: body, className:
|
|
346
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
333
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkLVUDBCQ2_cjs.cn("ck-step ck-step-offer", classNames?.root), children: [
|
|
334
|
+
headline && /* @__PURE__ */ jsxRuntime.jsx("h2", { className: chunkLVUDBCQ2_cjs.cn("ck-step-title", classNames?.title), children: headline }),
|
|
335
|
+
body && /* @__PURE__ */ jsxRuntime.jsx(RichText, { html: body, className: chunkLVUDBCQ2_cjs.cn("ck-step-description", classNames?.description) }),
|
|
336
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkLVUDBCQ2_cjs.cn("ck-offer-card", classNames?.card), children: [
|
|
347
337
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ck-offer-details", children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: "ck-redirect-link", children: [
|
|
348
338
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: offer.copy.cta }),
|
|
349
339
|
/* @__PURE__ */ jsxRuntime.jsx(ExternalIcon, {})
|
|
350
340
|
] }) }),
|
|
351
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className:
|
|
341
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: chunkLVUDBCQ2_cjs.cn("ck-button-link", classNames?.declineButton), onClick: onDecline, children: offer.copy.declineCta })
|
|
352
342
|
] })
|
|
353
343
|
] });
|
|
354
344
|
}
|
|
@@ -388,11 +378,11 @@ function DefaultTrialExtensionOffer({
|
|
|
388
378
|
const body = description ?? offer.copy.body;
|
|
389
379
|
const end = /* @__PURE__ */ new Date();
|
|
390
380
|
end.setDate(end.getDate() + o.days);
|
|
391
|
-
const newEnd =
|
|
392
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
393
|
-
headline && /* @__PURE__ */ jsxRuntime.jsx("h2", { className:
|
|
394
|
-
body && /* @__PURE__ */ jsxRuntime.jsx(RichText, { html: body, className:
|
|
395
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
381
|
+
const newEnd = chunkLVUDBCQ2_cjs.formatMonthDay(end);
|
|
382
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkLVUDBCQ2_cjs.cn("ck-step ck-step-offer", classNames?.root), children: [
|
|
383
|
+
headline && /* @__PURE__ */ jsxRuntime.jsx("h2", { className: chunkLVUDBCQ2_cjs.cn("ck-step-title", classNames?.title), children: headline }),
|
|
384
|
+
body && /* @__PURE__ */ jsxRuntime.jsx(RichText, { html: body, className: chunkLVUDBCQ2_cjs.cn("ck-step-description", classNames?.description) }),
|
|
385
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkLVUDBCQ2_cjs.cn("ck-offer-card", classNames?.card), children: [
|
|
396
386
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ck-offer-details ck-trial-block", children: [
|
|
397
387
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ck-trial-badge", children: [
|
|
398
388
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ck-trial-days", children: [
|
|
@@ -410,13 +400,13 @@ function DefaultTrialExtensionOffer({
|
|
|
410
400
|
"button",
|
|
411
401
|
{
|
|
412
402
|
type: "button",
|
|
413
|
-
className:
|
|
403
|
+
className: chunkLVUDBCQ2_cjs.cn("ck-button ck-button-primary", classNames?.acceptButton),
|
|
414
404
|
onClick: () => onAccept(),
|
|
415
405
|
disabled: isProcessing,
|
|
416
406
|
children: isProcessing ? "Processing..." : offer.copy.cta
|
|
417
407
|
}
|
|
418
408
|
),
|
|
419
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className:
|
|
409
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: chunkLVUDBCQ2_cjs.cn("ck-button-link", classNames?.declineButton), onClick: onDecline, children: offer.copy.declineCta })
|
|
420
410
|
] })
|
|
421
411
|
] });
|
|
422
412
|
}
|
|
@@ -451,11 +441,11 @@ function pickOfferComponent(type, components) {
|
|
|
451
441
|
}
|
|
452
442
|
}
|
|
453
443
|
function DefaultSuccess({ title, description, onClose, classNames }) {
|
|
454
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
455
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
456
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { className:
|
|
457
|
-
description && /* @__PURE__ */ jsxRuntime.jsx(RichText, { html: description, className:
|
|
458
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ck-success-actions", children: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className:
|
|
444
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkLVUDBCQ2_cjs.cn("ck-step ck-step-success", classNames?.root), children: [
|
|
445
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkLVUDBCQ2_cjs.cn("ck-success-icon", classNames?.icon), children: /* @__PURE__ */ jsxRuntime.jsx(Checkmark, { color: "currentColor", size: 26 }) }),
|
|
446
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: chunkLVUDBCQ2_cjs.cn("ck-step-title", classNames?.title), children: title }),
|
|
447
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(RichText, { html: description, className: chunkLVUDBCQ2_cjs.cn("ck-step-description", classNames?.description) }),
|
|
448
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ck-success-actions", children: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: chunkLVUDBCQ2_cjs.cn("ck-button ck-button-primary", classNames?.closeButton), onClick: onClose, children: "Done" }) })
|
|
459
449
|
] });
|
|
460
450
|
}
|
|
461
451
|
function DefaultReasonButton({ reason, index, isSelected, onSelect }) {
|
|
@@ -466,9 +456,8 @@ function DefaultReasonButton({ reason, index, isSelected, onSelect }) {
|
|
|
466
456
|
type: "button",
|
|
467
457
|
role: "radio",
|
|
468
458
|
"aria-checked": isSelected,
|
|
469
|
-
tabIndex: isSelected ? 0 : -1,
|
|
470
459
|
onClick: () => onSelect(reason.id),
|
|
471
|
-
className:
|
|
460
|
+
className: chunkLVUDBCQ2_cjs.cn("ck-reason-button", isSelected && "ck-reason-button--selected"),
|
|
472
461
|
children: [
|
|
473
462
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: "ck-reason-badge", children: isSelected ? /* @__PURE__ */ jsxRuntime.jsx(Checkmark, { color: "#fff", size: 12 }) : letter }),
|
|
474
463
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ck-reason-label", children: reason.label })
|
|
@@ -482,57 +471,44 @@ function DefaultSurvey({
|
|
|
482
471
|
reasons,
|
|
483
472
|
selectedReason,
|
|
484
473
|
onSelectReason,
|
|
474
|
+
followupResponse,
|
|
475
|
+
onFollowupResponseChange,
|
|
485
476
|
onNext,
|
|
486
477
|
classNames,
|
|
487
478
|
components
|
|
488
479
|
}) {
|
|
489
480
|
const ReasonButton = components?.ReasonButton ?? DefaultReasonButton;
|
|
490
|
-
const
|
|
491
|
-
const
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
if (e.key === "ArrowDown") {
|
|
498
|
-
nextIdx = currentIdx < reasons.length - 1 ? currentIdx + 1 : 0;
|
|
499
|
-
} else {
|
|
500
|
-
nextIdx = currentIdx > 0 ? currentIdx - 1 : reasons.length - 1;
|
|
501
|
-
}
|
|
502
|
-
onSelectReason(reasons[nextIdx].id);
|
|
503
|
-
const buttons = listRef.current?.querySelectorAll('[role="radio"]');
|
|
504
|
-
buttons?.[nextIdx]?.focus();
|
|
505
|
-
},
|
|
506
|
-
[reasons, selectedReason, onSelectReason]
|
|
507
|
-
);
|
|
508
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkSIYJ4R4B_cjs.cn("ck-step ck-step-survey", classNames?.root), children: [
|
|
509
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: chunkSIYJ4R4B_cjs.cn("ck-step-title", classNames?.title), children: title }),
|
|
510
|
-
description && /* @__PURE__ */ jsxRuntime.jsx(RichText, { html: description, className: chunkSIYJ4R4B_cjs.cn("ck-step-description", classNames?.description) }),
|
|
511
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
512
|
-
"div",
|
|
481
|
+
const selected = reasons.find((r) => r.id === selectedReason);
|
|
482
|
+
const showFollowup = selected?.freeform === true;
|
|
483
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkLVUDBCQ2_cjs.cn("ck-step ck-step-survey", classNames?.root), children: [
|
|
484
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: chunkLVUDBCQ2_cjs.cn("ck-step-title", classNames?.title), children: title }),
|
|
485
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(RichText, { html: description, className: chunkLVUDBCQ2_cjs.cn("ck-step-description", classNames?.description) }),
|
|
486
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkLVUDBCQ2_cjs.cn("ck-reason-list", classNames?.reasonList), role: "radiogroup", "aria-label": title, children: reasons.map((reason, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
487
|
+
ReasonButton,
|
|
513
488
|
{
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
))
|
|
489
|
+
reason,
|
|
490
|
+
index: i,
|
|
491
|
+
isSelected: selectedReason === reason.id,
|
|
492
|
+
onSelect: onSelectReason
|
|
493
|
+
},
|
|
494
|
+
reason.id
|
|
495
|
+
)) }),
|
|
496
|
+
showFollowup && /* @__PURE__ */ jsxRuntime.jsx(
|
|
497
|
+
"textarea",
|
|
498
|
+
{
|
|
499
|
+
className: chunkLVUDBCQ2_cjs.cn("ck-reason-followup", classNames?.followupInput),
|
|
500
|
+
placeholder: "Tell us more (optional)",
|
|
501
|
+
rows: 3,
|
|
502
|
+
value: followupResponse,
|
|
503
|
+
onChange: (e) => onFollowupResponseChange(e.target.value),
|
|
504
|
+
"aria-label": "Additional detail"
|
|
529
505
|
}
|
|
530
506
|
),
|
|
531
507
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
532
508
|
"button",
|
|
533
509
|
{
|
|
534
510
|
type: "button",
|
|
535
|
-
className:
|
|
511
|
+
className: chunkLVUDBCQ2_cjs.cn("ck-button ck-button-primary", classNames?.continueButton),
|
|
536
512
|
onClick: onNext,
|
|
537
513
|
disabled: !selectedReason,
|
|
538
514
|
children: "Continue"
|
|
@@ -541,7 +517,7 @@ function DefaultSurvey({
|
|
|
541
517
|
] });
|
|
542
518
|
}
|
|
543
519
|
function DefaultBackButton({ onBack, className }) {
|
|
544
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className:
|
|
520
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: chunkLVUDBCQ2_cjs.cn("ck-back-button", className), onClick: onBack, children: [
|
|
545
521
|
/* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
546
522
|
"path",
|
|
547
523
|
{
|
|
@@ -556,7 +532,7 @@ function DefaultBackButton({ onBack, className }) {
|
|
|
556
532
|
] });
|
|
557
533
|
}
|
|
558
534
|
function DefaultCloseButton({ onClose, className }) {
|
|
559
|
-
return /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className:
|
|
535
|
+
return /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: chunkLVUDBCQ2_cjs.cn("ck-close-button", className), onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15 5L5 15M5 5l10 10", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) }) });
|
|
560
536
|
}
|
|
561
537
|
function trapFocus(container) {
|
|
562
538
|
const focusableSelector = [
|
|
@@ -586,7 +562,7 @@ function trapFocus(container) {
|
|
|
586
562
|
container.addEventListener("keydown", handleKeyDown);
|
|
587
563
|
return () => container.removeEventListener("keydown", handleKeyDown);
|
|
588
564
|
}
|
|
589
|
-
function DefaultModal({ open, onClose, children, className }) {
|
|
565
|
+
function DefaultModal({ open, onClose, children, className, overlayClassName }) {
|
|
590
566
|
const overlayRef = react.useRef(null);
|
|
591
567
|
const modalRef = react.useRef(null);
|
|
592
568
|
const previousFocusRef = react.useRef(null);
|
|
@@ -616,7 +592,7 @@ function DefaultModal({ open, onClose, children, className }) {
|
|
|
616
592
|
"div",
|
|
617
593
|
{
|
|
618
594
|
ref: overlayRef,
|
|
619
|
-
className: "ck-overlay",
|
|
595
|
+
className: chunkLVUDBCQ2_cjs.cn("ck-overlay", overlayClassName),
|
|
620
596
|
onClick: (e) => {
|
|
621
597
|
if (e.target === overlayRef.current) onClose();
|
|
622
598
|
},
|
|
@@ -628,7 +604,7 @@ function DefaultModal({ open, onClose, children, className }) {
|
|
|
628
604
|
"aria-modal": "true",
|
|
629
605
|
"aria-labelledby": "ck-dialog-title",
|
|
630
606
|
tabIndex: -1,
|
|
631
|
-
className:
|
|
607
|
+
className: chunkLVUDBCQ2_cjs.cn("ck-modal", className),
|
|
632
608
|
children
|
|
633
609
|
}
|
|
634
610
|
)
|
|
@@ -654,7 +630,7 @@ function useColorScheme(preference) {
|
|
|
654
630
|
return system;
|
|
655
631
|
}
|
|
656
632
|
function CancelFlow(props) {
|
|
657
|
-
const { machine, state, isLoading, loadError, retry } =
|
|
633
|
+
const { machine, state, isLoading, loadError, retry } = chunk42SJA62X_cjs.useCancelFlowMachine(props);
|
|
658
634
|
if (isLoading || loadError) {
|
|
659
635
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
660
636
|
LoadStatus,
|
|
@@ -691,12 +667,12 @@ function LoadStatus({
|
|
|
691
667
|
onRetry
|
|
692
668
|
}) {
|
|
693
669
|
const scheme = useColorScheme(appearance?.colorScheme);
|
|
694
|
-
const appearanceStyle =
|
|
670
|
+
const appearanceStyle = chunkLVUDBCQ2_cjs.appearanceToStyle(appearance);
|
|
695
671
|
const Modal = components?.Modal ?? DefaultModal;
|
|
696
672
|
const CloseButton = components?.CloseButton ?? DefaultCloseButton;
|
|
697
673
|
const handleClose = onClose ?? (() => {
|
|
698
674
|
});
|
|
699
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ck-cancel-flow", "data-color-scheme": scheme, style: appearanceStyle, children: /* @__PURE__ */ jsxRuntime.jsxs(Modal, { open: true, onClose: handleClose, className: classNames?.modal, children: [
|
|
675
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ck-cancel-flow", "data-color-scheme": scheme, style: appearanceStyle, children: /* @__PURE__ */ jsxRuntime.jsxs(Modal, { open: true, onClose: handleClose, className: classNames?.modal, overlayClassName: classNames?.overlay, children: [
|
|
700
676
|
/* @__PURE__ */ jsxRuntime.jsx(CloseButton, { onClose: handleClose, className: classNames?.closeButton }),
|
|
701
677
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ck-content", children: [
|
|
702
678
|
isLoading && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ck-loading", style: { padding: "32px", textAlign: "center" }, children: [
|
|
@@ -744,11 +720,11 @@ function LoadStatus({
|
|
|
744
720
|
}
|
|
745
721
|
function FlowShell({ machine, state, appearance, classNames, components, customComponents }) {
|
|
746
722
|
const scheme = useColorScheme(appearance?.colorScheme);
|
|
747
|
-
const appearanceStyle =
|
|
723
|
+
const appearanceStyle = chunkLVUDBCQ2_cjs.appearanceToStyle(appearance);
|
|
748
724
|
const Modal = components?.Modal ?? DefaultModal;
|
|
749
725
|
const CloseButton = components?.CloseButton ?? DefaultCloseButton;
|
|
750
726
|
const BackButton = components?.BackButton ?? DefaultBackButton;
|
|
751
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ck-cancel-flow", "data-color-scheme": scheme, style: appearanceStyle, children: /* @__PURE__ */ jsxRuntime.jsxs(Modal, { open: true, onClose: machine.close, className: classNames?.modal, children: [
|
|
727
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ck-cancel-flow", "data-color-scheme": scheme, style: appearanceStyle, children: /* @__PURE__ */ jsxRuntime.jsxs(Modal, { open: true, onClose: machine.close, className: classNames?.modal, overlayClassName: classNames?.overlay, children: [
|
|
752
728
|
/* @__PURE__ */ jsxRuntime.jsx(CloseButton, { onClose: machine.close, className: classNames?.closeButton }),
|
|
753
729
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ck-content", children: [
|
|
754
730
|
machine.canGoBack && /* @__PURE__ */ jsxRuntime.jsx(BackButton, { onBack: machine.back, className: classNames?.backButton }),
|
|
@@ -771,11 +747,15 @@ function StepRenderer({
|
|
|
771
747
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
772
748
|
Survey,
|
|
773
749
|
{
|
|
774
|
-
title: config?.title ??
|
|
750
|
+
title: config?.title ?? chunkLVUDBCQ2_cjs.defaultTitles.survey,
|
|
775
751
|
description: config?.description,
|
|
752
|
+
customer: state.customer,
|
|
753
|
+
subscriptions: state.subscriptions,
|
|
776
754
|
reasons: machine.reasons,
|
|
777
755
|
selectedReason: state.selectedReason,
|
|
778
756
|
onSelectReason: machine.selectReason,
|
|
757
|
+
followupResponse: state.followupResponse,
|
|
758
|
+
onFollowupResponseChange: machine.setFollowupResponse,
|
|
779
759
|
onNext: machine.next,
|
|
780
760
|
classNames: config?.classNames,
|
|
781
761
|
components
|
|
@@ -792,12 +772,16 @@ function StepRenderer({
|
|
|
792
772
|
{
|
|
793
773
|
offer,
|
|
794
774
|
customer: state.customer,
|
|
775
|
+
subscriptions: state.subscriptions,
|
|
795
776
|
onAccept: machine.accept,
|
|
796
777
|
onDecline: machine.decline,
|
|
797
778
|
isProcessing: state.isProcessing
|
|
798
779
|
}
|
|
799
780
|
);
|
|
800
781
|
}
|
|
782
|
+
if (!chunkLVUDBCQ2_cjs.BUILT_IN_OFFER_TYPES.includes(offer.type)) {
|
|
783
|
+
return /* @__PURE__ */ jsxRuntime.jsx(UnregisteredOfferFallback, { offerType: offer.type, onSkip: machine.decline });
|
|
784
|
+
}
|
|
801
785
|
const Offer = components?.Offer ?? DefaultOffer;
|
|
802
786
|
const config = stepConfig;
|
|
803
787
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -805,6 +789,8 @@ function StepRenderer({
|
|
|
805
789
|
{
|
|
806
790
|
title: config?.title,
|
|
807
791
|
description: config?.description,
|
|
792
|
+
customer: state.customer,
|
|
793
|
+
subscriptions: state.subscriptions,
|
|
808
794
|
offer,
|
|
809
795
|
onAccept: machine.accept,
|
|
810
796
|
onDecline: machine.decline,
|
|
@@ -820,8 +806,10 @@ function StepRenderer({
|
|
|
820
806
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
821
807
|
Feedback,
|
|
822
808
|
{
|
|
823
|
-
title: config?.title ??
|
|
809
|
+
title: config?.title ?? chunkLVUDBCQ2_cjs.defaultTitles.feedback,
|
|
824
810
|
description: config?.description,
|
|
811
|
+
customer: state.customer,
|
|
812
|
+
subscriptions: state.subscriptions,
|
|
825
813
|
placeholder: config?.placeholder,
|
|
826
814
|
required: config?.required ?? false,
|
|
827
815
|
minLength: config?.minLength ?? 0,
|
|
@@ -838,8 +826,12 @@ function StepRenderer({
|
|
|
838
826
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
839
827
|
Confirm,
|
|
840
828
|
{
|
|
841
|
-
title: config?.title ??
|
|
829
|
+
title: config?.title ?? chunkLVUDBCQ2_cjs.defaultTitles.confirm,
|
|
842
830
|
description: config?.description,
|
|
831
|
+
customer: state.customer,
|
|
832
|
+
subscriptions: state.subscriptions,
|
|
833
|
+
losses: config?.losses,
|
|
834
|
+
lossesLabel: config?.lossesLabel,
|
|
843
835
|
confirmLabel: config?.confirmLabel ?? "Cancel subscription",
|
|
844
836
|
goBackLabel: config?.goBackLabel ?? "Go back",
|
|
845
837
|
onConfirm: machine.cancel,
|
|
@@ -860,6 +852,8 @@ function StepRenderer({
|
|
|
860
852
|
offer: machine.currentOffer ?? void 0,
|
|
861
853
|
title: isSaved ? config?.savedTitle ?? "Welcome back!" : config?.cancelledTitle ?? "Subscription cancelled",
|
|
862
854
|
description: isSaved ? config?.savedDescription ?? "Your offer has been applied." : config?.cancelledDescription ?? "We're sorry to see you go.",
|
|
855
|
+
customer: state.customer,
|
|
856
|
+
subscriptions: state.subscriptions,
|
|
863
857
|
onClose: machine.close,
|
|
864
858
|
classNames: config?.classNames
|
|
865
859
|
}
|
|
@@ -881,6 +875,7 @@ function StepRenderer({
|
|
|
881
875
|
data: config?.data
|
|
882
876
|
},
|
|
883
877
|
customer: state.customer,
|
|
878
|
+
subscriptions: state.subscriptions,
|
|
884
879
|
onNext: machine.next,
|
|
885
880
|
onBack: machine.back
|
|
886
881
|
}
|
|
@@ -895,50 +890,65 @@ function UnregisteredStepFallback({ step, onSkip }) {
|
|
|
895
890
|
}, [step, onSkip]);
|
|
896
891
|
return null;
|
|
897
892
|
}
|
|
893
|
+
function UnregisteredOfferFallback({ offerType, onSkip }) {
|
|
894
|
+
react.useEffect(() => {
|
|
895
|
+
console.warn(`[churnkey] No component registered for offer type "${offerType}". Skipping.`);
|
|
896
|
+
onSkip();
|
|
897
|
+
}, [offerType, onSkip]);
|
|
898
|
+
return null;
|
|
899
|
+
}
|
|
898
900
|
|
|
899
901
|
Object.defineProperty(exports, "useCancelFlow", {
|
|
900
902
|
enumerable: true,
|
|
901
|
-
get: function () { return
|
|
903
|
+
get: function () { return chunk42SJA62X_cjs.useCancelFlow; }
|
|
904
|
+
});
|
|
905
|
+
Object.defineProperty(exports, "BUILT_IN_OFFER_TYPES", {
|
|
906
|
+
enumerable: true,
|
|
907
|
+
get: function () { return chunkLVUDBCQ2_cjs.BUILT_IN_OFFER_TYPES; }
|
|
902
908
|
});
|
|
903
909
|
Object.defineProperty(exports, "BUILT_IN_STEP_TYPES", {
|
|
904
910
|
enumerable: true,
|
|
905
|
-
get: function () { return
|
|
911
|
+
get: function () { return chunkLVUDBCQ2_cjs.BUILT_IN_STEP_TYPES; }
|
|
906
912
|
});
|
|
907
913
|
Object.defineProperty(exports, "appearanceToStyle", {
|
|
908
914
|
enumerable: true,
|
|
909
|
-
get: function () { return
|
|
915
|
+
get: function () { return chunkLVUDBCQ2_cjs.appearanceToStyle; }
|
|
910
916
|
});
|
|
911
917
|
Object.defineProperty(exports, "calculateDiscountedPrice", {
|
|
912
918
|
enumerable: true,
|
|
913
|
-
get: function () { return
|
|
919
|
+
get: function () { return chunkLVUDBCQ2_cjs.calculateDiscountedPrice; }
|
|
914
920
|
});
|
|
915
921
|
Object.defineProperty(exports, "cn", {
|
|
916
922
|
enumerable: true,
|
|
917
|
-
get: function () { return
|
|
923
|
+
get: function () { return chunkLVUDBCQ2_cjs.cn; }
|
|
918
924
|
});
|
|
919
925
|
Object.defineProperty(exports, "defaultTitles", {
|
|
920
926
|
enumerable: true,
|
|
921
|
-
get: function () { return
|
|
927
|
+
get: function () { return chunkLVUDBCQ2_cjs.defaultTitles; }
|
|
928
|
+
});
|
|
929
|
+
Object.defineProperty(exports, "formatPeriodEnd", {
|
|
930
|
+
enumerable: true,
|
|
931
|
+
get: function () { return chunkLVUDBCQ2_cjs.formatPeriodEnd; }
|
|
922
932
|
});
|
|
923
933
|
Object.defineProperty(exports, "formatPrice", {
|
|
924
934
|
enumerable: true,
|
|
925
|
-
get: function () { return
|
|
935
|
+
get: function () { return chunkLVUDBCQ2_cjs.formatPrice; }
|
|
926
936
|
});
|
|
927
937
|
Object.defineProperty(exports, "AnalyticsClient", {
|
|
928
938
|
enumerable: true,
|
|
929
|
-
get: function () { return
|
|
939
|
+
get: function () { return chunk2VQNWZWO_cjs.AnalyticsClient; }
|
|
930
940
|
});
|
|
931
941
|
Object.defineProperty(exports, "CancelFlowMachine", {
|
|
932
942
|
enumerable: true,
|
|
933
|
-
get: function () { return
|
|
943
|
+
get: function () { return chunk2VQNWZWO_cjs.CancelFlowMachine; }
|
|
934
944
|
});
|
|
935
945
|
Object.defineProperty(exports, "ChurnkeyApi", {
|
|
936
946
|
enumerable: true,
|
|
937
|
-
get: function () { return
|
|
947
|
+
get: function () { return chunk2VQNWZWO_cjs.ChurnkeyApi; }
|
|
938
948
|
});
|
|
939
949
|
Object.defineProperty(exports, "decodeSessionToken", {
|
|
940
950
|
enumerable: true,
|
|
941
|
-
get: function () { return
|
|
951
|
+
get: function () { return chunk2VQNWZWO_cjs.decodeSessionToken; }
|
|
942
952
|
});
|
|
943
953
|
exports.CancelFlow = CancelFlow;
|
|
944
954
|
exports.DefaultBackButton = DefaultBackButton;
|