@sudobility/subscription_pages 0.0.14 → 0.0.15
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.js +220 -208
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { SubscriptionPlatform as
|
|
4
|
-
import { usePackagesByDuration as
|
|
5
|
-
import { SubscriptionLayout as
|
|
6
|
-
const
|
|
1
|
+
import { jsxs as g, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useState as I, useEffect as ce, useRef as ie } from "react";
|
|
3
|
+
import { SubscriptionPlatform as de } from "@sudobility/types";
|
|
4
|
+
import { usePackagesByDuration as Pe, useUserSubscription as ue, useBackendSubscription as fe, getSubscriptionInstance as pe, refreshSubscription as ge, useAllOfferings as Ae, useOfferingPackages as we, periodToMonths as le } from "@sudobility/subscription_lib";
|
|
5
|
+
import { SubscriptionLayout as P, SubscriptionTile as Ee, SegmentedControl as me } from "@sudobility/subscription-components";
|
|
6
|
+
const Le = {
|
|
7
7
|
web: "Web",
|
|
8
8
|
ios: "iOS",
|
|
9
9
|
android: "Android",
|
|
10
10
|
macos: "macOS"
|
|
11
11
|
};
|
|
12
|
-
function
|
|
13
|
-
backendSubscription:
|
|
14
|
-
managementUrl:
|
|
12
|
+
function be({
|
|
13
|
+
backendSubscription: o,
|
|
14
|
+
managementUrl: s
|
|
15
15
|
}) {
|
|
16
|
-
const
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
/* @__PURE__ */
|
|
16
|
+
const c = o.platform ? Le[o.platform] ?? o.platform : "another platform";
|
|
17
|
+
return /* @__PURE__ */ g("div", { className: "col-span-full rounded-xl border border-amber-200 dark:border-amber-700 bg-amber-50 dark:bg-amber-900/20 p-6 text-center space-y-4", children: [
|
|
18
|
+
/* @__PURE__ */ n("h3", { className: "text-lg font-semibold text-gray-900 dark:text-gray-100", children: "Subscription Active" }),
|
|
19
|
+
/* @__PURE__ */ g("div", { className: "space-y-2 text-sm text-gray-700 dark:text-gray-300", children: [
|
|
20
|
+
/* @__PURE__ */ g("p", { children: [
|
|
21
21
|
"Entitlements:",
|
|
22
22
|
" ",
|
|
23
|
-
/* @__PURE__ */
|
|
23
|
+
/* @__PURE__ */ n("span", { className: "font-medium", children: o.entitlements.join(", ") })
|
|
24
24
|
] }),
|
|
25
|
-
|
|
25
|
+
o.subscriptionStartedAt && /* @__PURE__ */ g("p", { children: [
|
|
26
26
|
"Subscribed since:",
|
|
27
27
|
" ",
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
|
|
28
|
+
/* @__PURE__ */ n("span", { className: "font-medium", children: new Date(
|
|
29
|
+
o.subscriptionStartedAt
|
|
30
30
|
).toLocaleDateString() })
|
|
31
31
|
] })
|
|
32
32
|
] }),
|
|
33
|
-
/* @__PURE__ */
|
|
33
|
+
/* @__PURE__ */ g("p", { className: "text-sm text-amber-800 dark:text-amber-300", children: [
|
|
34
34
|
"Your subscription was purchased on",
|
|
35
35
|
" ",
|
|
36
|
-
/* @__PURE__ */
|
|
36
|
+
/* @__PURE__ */ n("span", { className: "font-semibold", children: c }),
|
|
37
37
|
". To manage your subscription, please visit your ",
|
|
38
|
-
|
|
38
|
+
c,
|
|
39
39
|
" settings."
|
|
40
40
|
] }),
|
|
41
|
-
|
|
41
|
+
s && /* @__PURE__ */ n(
|
|
42
42
|
"a",
|
|
43
43
|
{
|
|
44
|
-
href:
|
|
44
|
+
href: s,
|
|
45
45
|
target: "_blank",
|
|
46
46
|
rel: "noopener noreferrer",
|
|
47
47
|
className: "inline-block rounded-lg px-5 py-2.5 text-sm font-semibold bg-blue-600 text-white hover:bg-blue-700 transition-colors",
|
|
@@ -50,113 +50,113 @@ function ge({
|
|
|
50
50
|
)
|
|
51
51
|
] });
|
|
52
52
|
}
|
|
53
|
-
function
|
|
54
|
-
isLoggedIn:
|
|
55
|
-
onNavigateToLogin:
|
|
56
|
-
userId:
|
|
53
|
+
function Fe({
|
|
54
|
+
isLoggedIn: o,
|
|
55
|
+
onNavigateToLogin: s,
|
|
56
|
+
userId: c,
|
|
57
57
|
userEmail: d,
|
|
58
|
-
featuresByPackage:
|
|
59
|
-
freeFeatures:
|
|
58
|
+
featuresByPackage: m,
|
|
59
|
+
freeFeatures: p,
|
|
60
60
|
title: u = "Choose Your Plan",
|
|
61
|
-
className:
|
|
62
|
-
currentPlatform:
|
|
63
|
-
networkClient:
|
|
64
|
-
baseUrl:
|
|
65
|
-
token:
|
|
66
|
-
testMode:
|
|
61
|
+
className: h,
|
|
62
|
+
currentPlatform: A = de.Web,
|
|
63
|
+
networkClient: w,
|
|
64
|
+
baseUrl: E,
|
|
65
|
+
token: L,
|
|
66
|
+
testMode: j
|
|
67
67
|
}) {
|
|
68
|
-
var
|
|
68
|
+
var _;
|
|
69
69
|
const {
|
|
70
|
-
packagesByDuration:
|
|
71
|
-
availableDurations:
|
|
70
|
+
packagesByDuration: $,
|
|
71
|
+
availableDurations: v,
|
|
72
72
|
isLoading: x,
|
|
73
|
-
error:
|
|
74
|
-
} =
|
|
73
|
+
error: b
|
|
74
|
+
} = Pe(), {
|
|
75
75
|
subscription: r,
|
|
76
|
-
isLoading:
|
|
77
|
-
error:
|
|
78
|
-
} =
|
|
79
|
-
|
|
80
|
-
w ?? "",
|
|
76
|
+
isLoading: W,
|
|
77
|
+
error: q
|
|
78
|
+
} = ue({ userId: c, userEmail: d }), N = fe(
|
|
79
|
+
w ?? {},
|
|
81
80
|
E ?? "",
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
L ?? "",
|
|
82
|
+
c ?? "",
|
|
83
|
+
{ testMode: j, enabled: !!(w && E && L && c) }
|
|
84
|
+
), R = ((_ = N.data) == null ? void 0 : _.platform) ?? null, V = !R || R === A, [D, U] = I(null), [z, i] = I(null), [F, T] = I(!1), k = D ?? v[0] ?? null, Q = x || W, M = b || q, B = async (t, S) => {
|
|
85
85
|
try {
|
|
86
|
-
|
|
86
|
+
T(!0), i(null), await pe().purchase({
|
|
87
87
|
packageId: t,
|
|
88
|
-
offeringId:
|
|
88
|
+
offeringId: S,
|
|
89
89
|
customerEmail: d
|
|
90
|
-
}), await
|
|
91
|
-
} catch (
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
}), await ge();
|
|
91
|
+
} catch (f) {
|
|
92
|
+
i(
|
|
93
|
+
f instanceof Error ? f.message : "Purchase failed"
|
|
94
94
|
);
|
|
95
95
|
} finally {
|
|
96
|
-
|
|
96
|
+
T(!1);
|
|
97
97
|
}
|
|
98
|
-
},
|
|
98
|
+
}, Y = () => o ? (r == null ? void 0 : r.isActive) && r.packageId ? {
|
|
99
99
|
title: "Free",
|
|
100
100
|
price: "$0",
|
|
101
|
-
features:
|
|
101
|
+
features: p ?? []
|
|
102
102
|
} : {
|
|
103
103
|
title: "Free",
|
|
104
104
|
price: "$0",
|
|
105
|
-
features:
|
|
105
|
+
features: p ?? [],
|
|
106
106
|
topBadge: { text: "Current", color: "blue" }
|
|
107
107
|
} : {
|
|
108
108
|
title: "Free",
|
|
109
109
|
price: "$0",
|
|
110
|
-
features:
|
|
110
|
+
features: p ?? [],
|
|
111
111
|
ctaButton: {
|
|
112
112
|
label: "Try it for Free",
|
|
113
|
-
onClick:
|
|
113
|
+
onClick: s
|
|
114
114
|
}
|
|
115
|
-
},
|
|
115
|
+
}, G = () => {
|
|
116
116
|
r != null && r.managementUrl && window.open(r.managementUrl, "_blank");
|
|
117
117
|
}, H = (t) => {
|
|
118
|
-
if (!
|
|
118
|
+
if (!o)
|
|
119
119
|
return {
|
|
120
120
|
label: "Log in to Continue",
|
|
121
|
-
onClick:
|
|
121
|
+
onClick: s
|
|
122
122
|
};
|
|
123
|
-
const
|
|
124
|
-
return
|
|
125
|
-
label:
|
|
126
|
-
onClick:
|
|
123
|
+
const S = (r == null ? void 0 : r.isActive) && r.packageId, f = (r == null ? void 0 : r.packageId) === t.package.packageId && (r == null ? void 0 : r.offeringId) === t.offerId;
|
|
124
|
+
return S ? {
|
|
125
|
+
label: f ? "Manage Subscription" : "Change Subscription",
|
|
126
|
+
onClick: G
|
|
127
127
|
} : {
|
|
128
128
|
label: "Subscribe",
|
|
129
|
-
onClick: () =>
|
|
129
|
+
onClick: () => B(t.package.packageId, t.offerId)
|
|
130
130
|
};
|
|
131
131
|
};
|
|
132
|
-
if (
|
|
133
|
-
return /* @__PURE__ */
|
|
134
|
-
|
|
132
|
+
if (Q)
|
|
133
|
+
return /* @__PURE__ */ n(
|
|
134
|
+
P,
|
|
135
135
|
{
|
|
136
136
|
title: u,
|
|
137
|
-
className:
|
|
137
|
+
className: h,
|
|
138
138
|
variant: "cta",
|
|
139
|
-
children: /* @__PURE__ */
|
|
139
|
+
children: /* @__PURE__ */ n("p", { children: "Loading subscription plans..." })
|
|
140
140
|
}
|
|
141
141
|
);
|
|
142
|
-
if (!V &&
|
|
143
|
-
return /* @__PURE__ */
|
|
144
|
-
|
|
142
|
+
if (!V && N.data)
|
|
143
|
+
return /* @__PURE__ */ n(
|
|
144
|
+
P,
|
|
145
145
|
{
|
|
146
146
|
title: u,
|
|
147
|
-
className:
|
|
147
|
+
className: h,
|
|
148
148
|
variant: "cta",
|
|
149
|
-
children: /* @__PURE__ */
|
|
150
|
-
|
|
149
|
+
children: /* @__PURE__ */ n(
|
|
150
|
+
be,
|
|
151
151
|
{
|
|
152
|
-
backendSubscription:
|
|
152
|
+
backendSubscription: N.data,
|
|
153
153
|
managementUrl: r == null ? void 0 : r.managementUrl,
|
|
154
|
-
currentPlatform:
|
|
154
|
+
currentPlatform: A
|
|
155
155
|
}
|
|
156
156
|
)
|
|
157
157
|
}
|
|
158
158
|
);
|
|
159
|
-
const
|
|
159
|
+
const O = z ?? (M ? M.message : null), J = o && (r != null && r.isActive) && r.packageId ? {
|
|
160
160
|
isActive: !0,
|
|
161
161
|
activeContent: {
|
|
162
162
|
title: "Active Subscription",
|
|
@@ -176,44 +176,44 @@ function $e({
|
|
|
176
176
|
] : []
|
|
177
177
|
]
|
|
178
178
|
}
|
|
179
|
-
} : void 0,
|
|
180
|
-
return /* @__PURE__ */
|
|
181
|
-
|
|
179
|
+
} : void 0, K = k ? $[k] ?? [] : [];
|
|
180
|
+
return /* @__PURE__ */ n(
|
|
181
|
+
P,
|
|
182
182
|
{
|
|
183
183
|
title: u,
|
|
184
|
-
className:
|
|
184
|
+
className: h,
|
|
185
185
|
variant: "cta",
|
|
186
|
-
error:
|
|
187
|
-
currentStatus:
|
|
188
|
-
freeTileConfig:
|
|
189
|
-
aboveProducts:
|
|
190
|
-
|
|
186
|
+
error: O,
|
|
187
|
+
currentStatus: J,
|
|
188
|
+
freeTileConfig: Y(),
|
|
189
|
+
aboveProducts: v.length > 1 ? /* @__PURE__ */ n(
|
|
190
|
+
me,
|
|
191
191
|
{
|
|
192
|
-
options:
|
|
192
|
+
options: v.map((t) => ({
|
|
193
193
|
value: t,
|
|
194
194
|
label: t.charAt(0).toUpperCase() + t.slice(1)
|
|
195
195
|
})),
|
|
196
|
-
value: k ??
|
|
197
|
-
onChange: (t) =>
|
|
196
|
+
value: k ?? v[0],
|
|
197
|
+
onChange: (t) => U(t)
|
|
198
198
|
}
|
|
199
199
|
) : void 0,
|
|
200
|
-
children:
|
|
201
|
-
var
|
|
202
|
-
const
|
|
203
|
-
return /* @__PURE__ */
|
|
204
|
-
|
|
200
|
+
children: K.map((t) => {
|
|
201
|
+
var C;
|
|
202
|
+
const S = o && (r == null ? void 0 : r.isActive) && r.packageId === t.package.packageId && r.offeringId === t.offerId, f = H(t);
|
|
203
|
+
return /* @__PURE__ */ n(
|
|
204
|
+
Ee,
|
|
205
205
|
{
|
|
206
206
|
id: t.package.packageId,
|
|
207
207
|
title: t.package.name,
|
|
208
|
-
price: ((
|
|
208
|
+
price: ((C = t.package.product) == null ? void 0 : C.priceString) ?? "$0",
|
|
209
209
|
periodLabel: t.package.product ? `/${t.package.product.period}` : void 0,
|
|
210
|
-
features: (
|
|
210
|
+
features: (m == null ? void 0 : m[t.package.packageId]) ?? [],
|
|
211
211
|
isSelected: !1,
|
|
212
212
|
onSelect: () => {
|
|
213
213
|
},
|
|
214
|
-
isCurrentPlan:
|
|
215
|
-
ctaButton:
|
|
216
|
-
disabled:
|
|
214
|
+
isCurrentPlan: S,
|
|
215
|
+
ctaButton: f,
|
|
216
|
+
disabled: F
|
|
217
217
|
},
|
|
218
218
|
`${t.offerId}-${t.package.packageId}`
|
|
219
219
|
);
|
|
@@ -221,138 +221,150 @@ function $e({
|
|
|
221
221
|
}
|
|
222
222
|
);
|
|
223
223
|
}
|
|
224
|
-
function
|
|
225
|
-
return
|
|
224
|
+
function se(o) {
|
|
225
|
+
return o.charAt(0).toUpperCase() + o.slice(1);
|
|
226
226
|
}
|
|
227
|
-
const
|
|
227
|
+
const Ne = {
|
|
228
228
|
weekly: "Weekly",
|
|
229
229
|
monthly: "Monthly",
|
|
230
230
|
quarterly: "Quarterly",
|
|
231
231
|
yearly: "Yearly",
|
|
232
232
|
lifetime: "Lifetime"
|
|
233
233
|
};
|
|
234
|
-
function
|
|
235
|
-
if (!
|
|
236
|
-
const
|
|
237
|
-
if (
|
|
238
|
-
const
|
|
239
|
-
if (
|
|
234
|
+
function De(o, s) {
|
|
235
|
+
if (!o.product || !s.product) return null;
|
|
236
|
+
const c = le(o.product.period), d = le(s.product.period);
|
|
237
|
+
if (c <= 0 || d <= 0 || c === 1 / 0 || d === 1 / 0 || c === d) return null;
|
|
238
|
+
const m = o.product.price / c, p = s.product.price / d;
|
|
239
|
+
if (m <= 0) return null;
|
|
240
240
|
const u = Math.round(
|
|
241
|
-
(
|
|
241
|
+
(m - p) / m * 100
|
|
242
242
|
);
|
|
243
243
|
return u > 0 ? u : null;
|
|
244
244
|
}
|
|
245
|
-
function
|
|
246
|
-
isLoggedIn:
|
|
247
|
-
onNavigateToLogin:
|
|
248
|
-
userId:
|
|
245
|
+
function Te({
|
|
246
|
+
isLoggedIn: o,
|
|
247
|
+
onNavigateToLogin: s,
|
|
248
|
+
userId: c,
|
|
249
249
|
userEmail: d,
|
|
250
|
-
featuresByPackage:
|
|
251
|
-
freeFeatures:
|
|
250
|
+
featuresByPackage: m,
|
|
251
|
+
freeFeatures: p,
|
|
252
252
|
title: u = "Choose Your Plan",
|
|
253
|
-
className:
|
|
254
|
-
currentPlatform:
|
|
255
|
-
networkClient:
|
|
256
|
-
baseUrl:
|
|
257
|
-
token:
|
|
258
|
-
testMode:
|
|
259
|
-
t:
|
|
260
|
-
renderOfferingContent:
|
|
253
|
+
className: h,
|
|
254
|
+
currentPlatform: A = de.Web,
|
|
255
|
+
networkClient: w,
|
|
256
|
+
baseUrl: E,
|
|
257
|
+
token: L,
|
|
258
|
+
testMode: j,
|
|
259
|
+
t: $,
|
|
260
|
+
renderOfferingContent: v,
|
|
261
261
|
initialOfferId: x
|
|
262
262
|
}) {
|
|
263
263
|
var Z, ee;
|
|
264
|
-
const
|
|
264
|
+
const b = (a, l) => $ ? $(a, l) : l, {
|
|
265
265
|
offerings: r,
|
|
266
|
-
isLoading:
|
|
267
|
-
error:
|
|
268
|
-
} =
|
|
266
|
+
isLoading: W,
|
|
267
|
+
error: q
|
|
268
|
+
} = Ae(), {
|
|
269
269
|
subscription: e,
|
|
270
|
-
isLoading:
|
|
271
|
-
error:
|
|
272
|
-
} =
|
|
273
|
-
|
|
274
|
-
w ?? "",
|
|
270
|
+
isLoading: N,
|
|
271
|
+
error: R
|
|
272
|
+
} = ue({ userId: c, userEmail: d }), D = fe(
|
|
273
|
+
w ?? {},
|
|
275
274
|
E ?? "",
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
275
|
+
L ?? "",
|
|
276
|
+
c ?? "",
|
|
277
|
+
{ testMode: j, enabled: !!(w && E && L && c) }
|
|
278
|
+
), U = ((Z = D.data) == null ? void 0 : Z.platform) ?? null, z = !U || U === A, [i, F] = I(
|
|
279
279
|
x ?? "free"
|
|
280
280
|
);
|
|
281
|
-
|
|
282
|
-
x &&
|
|
281
|
+
ce(() => {
|
|
282
|
+
x && F(x);
|
|
283
283
|
}, [x]);
|
|
284
|
-
const [
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
284
|
+
const [T, k] = I(null), [Q, M] = I(!1), B = ie(null), Y = ie(i);
|
|
285
|
+
ce(() => {
|
|
286
|
+
var a, l;
|
|
287
|
+
Y.current !== i && B.current && ((l = (a = B.current).animate) == null || l.call(
|
|
288
|
+
a,
|
|
289
|
+
[
|
|
290
|
+
{ opacity: 0, transform: "translateY(8px)" },
|
|
291
|
+
{ opacity: 1, transform: "translateY(0)" }
|
|
292
|
+
],
|
|
293
|
+
{ duration: 200, easing: "ease-out" }
|
|
294
|
+
), Y.current = i);
|
|
295
|
+
}, [i]);
|
|
296
|
+
const G = ((ee = r[0]) == null ? void 0 : ee.offerId) ?? "", H = i !== "free" ? i : G, {
|
|
297
|
+
packages: O,
|
|
298
|
+
isLoading: J,
|
|
299
|
+
error: K
|
|
300
|
+
} = we(H), _ = W || N || J, t = q || R || K, S = async (a, l) => {
|
|
289
301
|
try {
|
|
290
|
-
|
|
291
|
-
packageId:
|
|
302
|
+
M(!0), k(null), await pe().purchase({
|
|
303
|
+
packageId: a,
|
|
292
304
|
offeringId: l,
|
|
293
305
|
customerEmail: d
|
|
294
|
-
}), await
|
|
306
|
+
}), await ge();
|
|
295
307
|
} catch (y) {
|
|
296
308
|
k(
|
|
297
309
|
y instanceof Error ? y.message : "Purchase failed"
|
|
298
310
|
);
|
|
299
311
|
} finally {
|
|
300
|
-
|
|
312
|
+
M(!1);
|
|
301
313
|
}
|
|
302
|
-
},
|
|
303
|
-
{ value: "free", label:
|
|
304
|
-
...r.map((
|
|
305
|
-
value:
|
|
306
|
-
label:
|
|
314
|
+
}, f = [
|
|
315
|
+
{ value: "free", label: b("free", "Free") },
|
|
316
|
+
...r.map((a) => ({
|
|
317
|
+
value: a.offerId,
|
|
318
|
+
label: b(a.offerId, se(a.offerId))
|
|
307
319
|
}))
|
|
308
|
-
],
|
|
309
|
-
title:
|
|
320
|
+
], C = O[0] ?? null, he = () => o ? (e == null ? void 0 : e.isActive) && e.packageId ? {
|
|
321
|
+
title: b("free", "Free"),
|
|
310
322
|
price: "$0",
|
|
311
|
-
features:
|
|
323
|
+
features: p ?? []
|
|
312
324
|
} : {
|
|
313
|
-
title:
|
|
325
|
+
title: b("free", "Free"),
|
|
314
326
|
price: "$0",
|
|
315
|
-
features:
|
|
327
|
+
features: p ?? [],
|
|
316
328
|
topBadge: { text: "Current", color: "blue" }
|
|
317
329
|
} : {
|
|
318
|
-
title:
|
|
330
|
+
title: b("free", "Free"),
|
|
319
331
|
price: "$0",
|
|
320
|
-
features:
|
|
332
|
+
features: p ?? [],
|
|
321
333
|
ctaButton: {
|
|
322
334
|
label: "Try it for Free",
|
|
323
|
-
onClick:
|
|
335
|
+
onClick: s
|
|
324
336
|
}
|
|
325
|
-
},
|
|
337
|
+
}, ve = () => {
|
|
326
338
|
e != null && e.managementUrl && window.open(e.managementUrl, "_blank");
|
|
327
|
-
},
|
|
328
|
-
if (
|
|
329
|
-
return /* @__PURE__ */
|
|
330
|
-
|
|
339
|
+
}, Se = (a) => o ? (e == null ? void 0 : e.isActive) && e.packageId ? (e == null ? void 0 : e.packageId) === a.packageId && (e == null ? void 0 : e.offeringId) === i ? "Manage Subscription" : "Change Subscription" : "Subscribe" : "Log in to Continue", ye = (a, l) => o ? (e == null ? void 0 : e.isActive) && e.packageId ? ve : () => S(a.packageId, l) : s;
|
|
340
|
+
if (_)
|
|
341
|
+
return /* @__PURE__ */ n(
|
|
342
|
+
P,
|
|
331
343
|
{
|
|
332
344
|
title: u,
|
|
333
|
-
className:
|
|
345
|
+
className: h,
|
|
334
346
|
variant: "cta",
|
|
335
|
-
children: /* @__PURE__ */
|
|
347
|
+
children: /* @__PURE__ */ n("p", { children: "Loading subscription plans..." })
|
|
336
348
|
}
|
|
337
349
|
);
|
|
338
|
-
if (!
|
|
339
|
-
return /* @__PURE__ */
|
|
340
|
-
|
|
350
|
+
if (!z && D.data)
|
|
351
|
+
return /* @__PURE__ */ n(
|
|
352
|
+
P,
|
|
341
353
|
{
|
|
342
354
|
title: u,
|
|
343
|
-
className:
|
|
355
|
+
className: h,
|
|
344
356
|
variant: "cta",
|
|
345
|
-
children: /* @__PURE__ */
|
|
346
|
-
|
|
357
|
+
children: /* @__PURE__ */ n(
|
|
358
|
+
be,
|
|
347
359
|
{
|
|
348
|
-
backendSubscription:
|
|
360
|
+
backendSubscription: D.data,
|
|
349
361
|
managementUrl: e == null ? void 0 : e.managementUrl,
|
|
350
|
-
currentPlatform:
|
|
362
|
+
currentPlatform: A
|
|
351
363
|
}
|
|
352
364
|
)
|
|
353
365
|
}
|
|
354
366
|
);
|
|
355
|
-
const
|
|
367
|
+
const xe = T ?? (t ? t.message : null), ke = o && (e != null && e.isActive) && e.packageId ? {
|
|
356
368
|
isActive: !0,
|
|
357
369
|
activeContent: {
|
|
358
370
|
title: "Active Subscription",
|
|
@@ -372,55 +384,55 @@ function Ue({
|
|
|
372
384
|
] : []
|
|
373
385
|
]
|
|
374
386
|
}
|
|
375
|
-
} : void 0, X =
|
|
376
|
-
return /* @__PURE__ */
|
|
377
|
-
|
|
387
|
+
} : void 0, X = i === "free";
|
|
388
|
+
return /* @__PURE__ */ n(
|
|
389
|
+
P,
|
|
378
390
|
{
|
|
379
391
|
title: u,
|
|
380
|
-
className:
|
|
392
|
+
className: h,
|
|
381
393
|
variant: "cta",
|
|
382
|
-
error:
|
|
383
|
-
currentStatus:
|
|
384
|
-
freeTileConfig: X ?
|
|
385
|
-
aboveProducts:
|
|
386
|
-
|
|
394
|
+
error: xe,
|
|
395
|
+
currentStatus: ke,
|
|
396
|
+
freeTileConfig: X ? he() : void 0,
|
|
397
|
+
aboveProducts: f.length > 1 ? /* @__PURE__ */ n("div", { className: "flex justify-center mb-6", children: /* @__PURE__ */ n(
|
|
398
|
+
me,
|
|
387
399
|
{
|
|
388
|
-
options:
|
|
389
|
-
value:
|
|
390
|
-
onChange:
|
|
400
|
+
options: f,
|
|
401
|
+
value: i,
|
|
402
|
+
onChange: F
|
|
391
403
|
}
|
|
392
404
|
) }) : void 0,
|
|
393
|
-
children: !X && /* @__PURE__ */
|
|
394
|
-
|
|
395
|
-
/* @__PURE__ */
|
|
405
|
+
children: !X && /* @__PURE__ */ g("div", { ref: B, className: "col-span-full space-y-6", children: [
|
|
406
|
+
v && /* @__PURE__ */ n("div", { className: "rounded-xl bg-gray-50 dark:bg-gray-800/50 border border-gray-200 dark:border-gray-700 p-5", children: v(i) }),
|
|
407
|
+
/* @__PURE__ */ n("div", { className: "space-y-3", children: O.map((a) => {
|
|
396
408
|
var ne, oe;
|
|
397
|
-
const l = (ne =
|
|
398
|
-
return /* @__PURE__ */
|
|
409
|
+
const l = (ne = a.product) == null ? void 0 : ne.period, y = l ? b(l, Ne[l] ?? se(l)) : a.name, re = o && (e == null ? void 0 : e.isActive) && e.packageId === a.packageId && e.offeringId === i, te = C && a.packageId !== C.packageId ? De(C, a) : null, Ce = Se(a), ae = ye(a, i), Ie = ((oe = a.product) == null ? void 0 : oe.priceString) ?? "$0";
|
|
410
|
+
return /* @__PURE__ */ g(
|
|
399
411
|
"div",
|
|
400
412
|
{
|
|
401
413
|
className: "flex items-center justify-between rounded-xl p-4 transition-all " + (re ? "bg-blue-50 dark:bg-blue-900/20 border-2 border-blue-500 dark:border-blue-400" : "bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700"),
|
|
402
414
|
children: [
|
|
403
|
-
/* @__PURE__ */
|
|
404
|
-
/* @__PURE__ */
|
|
405
|
-
/* @__PURE__ */
|
|
406
|
-
te !== null ? /* @__PURE__ */
|
|
415
|
+
/* @__PURE__ */ g("div", { className: "min-w-0 flex-1", children: [
|
|
416
|
+
/* @__PURE__ */ n("p", { className: "text-base font-semibold text-gray-900 dark:text-gray-100", children: y }),
|
|
417
|
+
/* @__PURE__ */ n("p", { className: "text-xs text-gray-400 dark:text-gray-500", children: a.packageId }),
|
|
418
|
+
te !== null ? /* @__PURE__ */ g("p", { className: "text-sm font-medium text-green-600 dark:text-green-400", children: [
|
|
407
419
|
"Save ",
|
|
408
420
|
te,
|
|
409
421
|
"%"
|
|
410
|
-
] }) : re ? /* @__PURE__ */
|
|
422
|
+
] }) : re ? /* @__PURE__ */ n("p", { className: "text-sm font-medium text-blue-600 dark:text-blue-400", children: "Current Plan" }) : null
|
|
411
423
|
] }),
|
|
412
|
-
/* @__PURE__ */
|
|
424
|
+
/* @__PURE__ */ n(
|
|
413
425
|
"button",
|
|
414
426
|
{
|
|
415
427
|
onClick: ae,
|
|
416
|
-
disabled:
|
|
428
|
+
disabled: Q || !ae,
|
|
417
429
|
className: "ml-4 flex-shrink-0 rounded-lg px-4 py-2 text-sm font-semibold transition-colors bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
418
|
-
children: `${
|
|
430
|
+
children: `${Ie} · ${Ce}`
|
|
419
431
|
}
|
|
420
432
|
)
|
|
421
433
|
]
|
|
422
434
|
},
|
|
423
|
-
|
|
435
|
+
a.packageId
|
|
424
436
|
);
|
|
425
437
|
}) })
|
|
426
438
|
] })
|
|
@@ -428,6 +440,6 @@ function Ue({
|
|
|
428
440
|
);
|
|
429
441
|
}
|
|
430
442
|
export {
|
|
431
|
-
|
|
432
|
-
|
|
443
|
+
Fe as SubscriptionByDurationPage,
|
|
444
|
+
Te as SubscriptionByOfferPage
|
|
433
445
|
};
|