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