@burdenoff/microfe-billing 2026.1113.4 → 2026.1114.1
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/billing/modules/addons/pages/AddonsBrowsePage.js +293 -291
- package/dist/billing/modules/addons/pages/AddonsBrowsePage.js.map +1 -1
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js +25 -24
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js.map +1 -1
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js +25 -24
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js.map +1 -1
- package/dist/billing/modules/billing/hooks/index.js +5 -5
- package/dist/billing/modules/billing/hooks/useInvoices.js +20 -39
- package/dist/billing/modules/billing/hooks/useInvoices.js.map +1 -1
- package/dist/billing/modules/billing/index.js +14 -14
- package/dist/billing/modules/billing/pages/InvoicesListPage.js +92 -89
- package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/TransactionsPage.js +2 -2
- package/dist/billing/modules/billing/pages/UserRefundsPage.js +140 -140
- package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CouponDetailPage.js +16 -15
- package/dist/billing/modules/coupons/pages/CouponDetailPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +1 -1
- package/dist/billing/modules/credits/pages/CreditsPage.js +164 -137
- package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -1
- package/dist/billing/modules/dashboard/pages/OverviewPage.js +444 -594
- package/dist/billing/modules/dashboard/pages/OverviewPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/EarningsPage.js +20 -20
- package/dist/billing/modules/earnings/pages/EarningsPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/PayoutsPage.js +1 -1
- package/dist/billing/modules/plans/pages/PlansBrowsePage.js +32 -32
- package/dist/billing/modules/settings/pages/SettingsPage.js +4 -4
- package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js +577 -640
- package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js.map +1 -1
- package/dist/billing/shared/components/HeaderActions.d.ts +10 -0
- package/dist/billing/shared/components/HeaderActions.js +33 -0
- package/dist/billing/shared/components/HeaderActions.js.map +1 -0
- package/dist/billing/shared/components/index.d.ts +1 -0
- package/dist/billing/shared/components/index.js +2 -1
- package/dist/billing/shared/utils/format.js +4 -16
- package/dist/billing/shared/utils/format.js.map +1 -1
- package/dist/billing/shared/utils/index.js +8 -8
- package/dist/generated/global-operations.js +286 -294
- package/dist/generated/global-operations.js.map +1 -1
- package/package.json +1 -1
- package/dist/billing/modules/dashboard/utils/overviewSummary.d.ts +0 -46
- package/dist/billing/modules/dashboard/utils/overviewSummary.js +0 -37
- package/dist/billing/modules/dashboard/utils/overviewSummary.js.map +0 -1
- package/dist/billing/modules/subscriptions/utils/subscriptionDetailView.d.ts +0 -30
- package/dist/billing/modules/subscriptions/utils/subscriptionDetailView.js +0 -20
- package/dist/billing/modules/subscriptions/utils/subscriptionDetailView.js.map +0 -1
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { useDefaultBillingCurrency as e } from "../../../hooks/useDefaultBillingCurrency.js";
|
|
2
2
|
import { useBillingNavigate as t } from "../../../hooks/useBillingNavigate.js";
|
|
3
|
-
import {
|
|
3
|
+
import { useIsFluidgridsVariant as n } from "../../../hooks/useBillingVariant.js";
|
|
4
|
+
import { useBilling as r } from "../../../providers/BillingProvider.js";
|
|
4
5
|
import "../hooks/index.js";
|
|
5
|
-
import { useAddonCartStore as
|
|
6
|
-
import { useAddons as
|
|
7
|
-
import { useAddonPurchaseEligibility as
|
|
8
|
-
import { formatCurrency as
|
|
9
|
-
import { getPlanFeatureQuantity as
|
|
10
|
-
import { useMemo as
|
|
11
|
-
import { IllustratedEmptyState as
|
|
12
|
-
import { Lock as
|
|
13
|
-
import { Fragment as
|
|
14
|
-
import { useI18n as
|
|
15
|
-
import { createPortal as
|
|
16
|
-
import { ASSISTANT_BOTTOM_CHROME_CLEARANCE as
|
|
6
|
+
import { useAddonCartStore as i } from "../store/addonCartStore.js";
|
|
7
|
+
import { useAddons as a } from "../hooks/useAddons.js";
|
|
8
|
+
import { useAddonPurchaseEligibility as o } from "../hooks/useAddonPurchaseEligibility.js";
|
|
9
|
+
import { formatCurrency as s, formatPlanDuration as c, formatPlanDurationLabel as l } from "../../../shared/utils/format.js";
|
|
10
|
+
import { getPlanFeatureQuantity as u } from "../../../shared/utils/planFeatureQuantity.js";
|
|
11
|
+
import { useMemo as d, useState as f } from "react";
|
|
12
|
+
import { IllustratedEmptyState as p, PagePurpose as m } from "@burdenoff/fe-libs/ui";
|
|
13
|
+
import { Lock as h, Minus as g, Package as _, Plus as v, ShoppingCart as y, Trash2 as b, X as x } from "lucide-react";
|
|
14
|
+
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
15
|
+
import { useI18n as T } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
16
|
+
import { createPortal as E } from "react-dom";
|
|
17
|
+
import { ASSISTANT_BOTTOM_CHROME_CLEARANCE as D } from "@burdenoff/fe-libs/shared/assistant";
|
|
17
18
|
// src/billing/modules/addons/pages/AddonsBrowsePage.tsx
|
|
18
|
-
function
|
|
19
|
+
function O(e) {
|
|
19
20
|
let t = /* @__PURE__ */ new Map();
|
|
20
21
|
for (let n of e) {
|
|
21
22
|
let e = n.name.indexOf(" — "), r = e === -1 ? n.name : n.name.slice(0, e).trim(), i = t.get(r) ?? [];
|
|
@@ -32,11 +33,11 @@ function D(e) {
|
|
|
32
33
|
});
|
|
33
34
|
return n;
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
+
function k(e) {
|
|
36
37
|
let t = /* @__PURE__ */ new Map();
|
|
37
38
|
for (let n of e) {
|
|
38
39
|
if (!n.quota) continue;
|
|
39
|
-
let e = n.quota.id, r =
|
|
40
|
+
let e = n.quota.id, r = u(n), i = t.get(e);
|
|
40
41
|
i ? i.totalValue += r : t.set(e, {
|
|
41
42
|
quotaId: e,
|
|
42
43
|
name: n.quota.name ?? "Unknown Quota",
|
|
@@ -45,7 +46,7 @@ function O(e) {
|
|
|
45
46
|
}
|
|
46
47
|
return Array.from(t.values());
|
|
47
48
|
}
|
|
48
|
-
function
|
|
49
|
+
function A(e, t = "USD") {
|
|
49
50
|
if (e.currencyPrices && typeof e.currencyPrices == "object") {
|
|
50
51
|
let n = e.currencyPrices;
|
|
51
52
|
if (n[t] !== void 0 && n[t] !== null) return {
|
|
@@ -58,143 +59,143 @@ function k(e, t = "USD") {
|
|
|
58
59
|
currency: e.currency || "USD"
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
|
-
var
|
|
62
|
-
let { t:
|
|
63
|
-
let n =
|
|
62
|
+
var j = () => {
|
|
63
|
+
let { t: s } = T(), c = (e, t) => {
|
|
64
|
+
let n = s(e);
|
|
64
65
|
return n === e ? t : n;
|
|
65
|
-
},
|
|
66
|
+
}, l = t(), { productId: u } = r(), { addons: g, isLoading: _, error: v, refetch: y } = a({
|
|
66
67
|
includeFree: !1,
|
|
67
|
-
productId:
|
|
68
|
-
}), { addToCart:
|
|
69
|
-
return
|
|
68
|
+
productId: u ?? void 0
|
|
69
|
+
}), { addToCart: b, removeFromCart: x, updateQuantity: S, isInCart: E, getCartItem: D } = i(), [k, A] = f("grid"), [j, I] = f("all"), L = e(), R = n(), z = g.filter((e) => !(!e.isActive || j !== "all" && e.duration !== j)), B = d(() => O(z), [z]), V = d(() => z.map((e) => e.id), [z]), { blocked: H, isBlocked: U } = o(V), W = c("billing.addons.paidPlanRequiredShort", "Add-ons need a paid plan. Upgrade first.");
|
|
70
|
+
return _ && g.length === 0 ? /* @__PURE__ */ w("div", {
|
|
70
71
|
className: "space-y-6 p-6",
|
|
71
|
-
children: [/* @__PURE__ */
|
|
72
|
+
children: [/* @__PURE__ */ C("div", { className: "h-8 w-48 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ C("div", {
|
|
72
73
|
className: "grid grid-cols-1 md:grid-cols-3 gap-6",
|
|
73
74
|
children: [
|
|
74
75
|
1,
|
|
75
76
|
2,
|
|
76
77
|
3
|
|
77
|
-
].map((e) => /* @__PURE__ */
|
|
78
|
+
].map((e) => /* @__PURE__ */ w("div", {
|
|
78
79
|
className: "border border-border-subtle rounded-lg p-6 space-y-4",
|
|
79
80
|
children: [
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
/* @__PURE__ */
|
|
81
|
+
/* @__PURE__ */ C("div", { className: "h-6 w-24 bg-bg-sunken animate-pulse rounded" }),
|
|
82
|
+
/* @__PURE__ */ C("div", { className: "h-8 w-32 bg-bg-sunken animate-pulse rounded" }),
|
|
83
|
+
/* @__PURE__ */ C("div", {
|
|
83
84
|
className: "space-y-2",
|
|
84
85
|
children: [
|
|
85
86
|
1,
|
|
86
87
|
2,
|
|
87
88
|
3
|
|
88
|
-
].map((e) => /* @__PURE__ */
|
|
89
|
+
].map((e) => /* @__PURE__ */ C("div", { className: "h-4 w-full bg-bg-sunken animate-pulse rounded" }, e))
|
|
89
90
|
})
|
|
90
91
|
]
|
|
91
92
|
}, e))
|
|
92
93
|
})]
|
|
93
|
-
}) :
|
|
94
|
+
}) : v ? /* @__PURE__ */ C("div", {
|
|
94
95
|
className: "flex items-center justify-center h-full min-h-[400px]",
|
|
95
|
-
children: /* @__PURE__ */
|
|
96
|
+
children: /* @__PURE__ */ w("div", {
|
|
96
97
|
className: "text-center space-y-4",
|
|
97
98
|
children: [
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ C("h2", {
|
|
99
100
|
className: "text-lg font-semibold text-text-primary",
|
|
100
|
-
children:
|
|
101
|
+
children: c("billing.addons.failedToLoad", "Failed to load addons")
|
|
101
102
|
}),
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ C("p", {
|
|
103
104
|
className: "text-sm text-text-secondary",
|
|
104
|
-
children:
|
|
105
|
+
children: v.message
|
|
105
106
|
}),
|
|
106
|
-
/* @__PURE__ */
|
|
107
|
+
/* @__PURE__ */ C("button", {
|
|
107
108
|
type: "button",
|
|
108
|
-
onClick: () =>
|
|
109
|
+
onClick: () => y(),
|
|
109
110
|
className: "px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-md hover:bg-action-primary-bg/90 transition-colors",
|
|
110
111
|
children: "Try Again"
|
|
111
112
|
})
|
|
112
113
|
]
|
|
113
114
|
})
|
|
114
|
-
}) : /* @__PURE__ */
|
|
115
|
+
}) : /* @__PURE__ */ w("div", {
|
|
115
116
|
className: "space-y-6 p-6",
|
|
116
117
|
children: [
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
/* @__PURE__ */
|
|
118
|
+
/* @__PURE__ */ w("div", { children: [
|
|
119
|
+
/* @__PURE__ */ C("h1", {
|
|
119
120
|
className: "text-2xl font-bold text-text-primary",
|
|
120
|
-
children:
|
|
121
|
+
children: c("billing.addons.title", "Addons")
|
|
121
122
|
}),
|
|
122
|
-
/* @__PURE__ */
|
|
123
|
+
/* @__PURE__ */ C("p", {
|
|
123
124
|
className: "text-sm text-text-secondary mt-1",
|
|
124
|
-
children:
|
|
125
|
+
children: c("billing.addons.subtitle", "Enhance your subscription with additional features")
|
|
125
126
|
}),
|
|
126
|
-
/* @__PURE__ */
|
|
127
|
+
/* @__PURE__ */ C(m, {
|
|
127
128
|
className: "mt-3",
|
|
128
|
-
children:
|
|
129
|
+
children: c("billing.addons.browsePurpose", "Add extra capacity or capabilities on top of your current plan — like more seats, storage or usage credits — without upgrading your whole subscription. Add the add-ons you want to your cart and check out when ready.")
|
|
129
130
|
})
|
|
130
131
|
] }),
|
|
131
|
-
|
|
132
|
+
H.size > 0 && /* @__PURE__ */ w("div", {
|
|
132
133
|
role: "status",
|
|
133
134
|
"data-testid": "addons-paid-plan-required",
|
|
134
135
|
className: "flex flex-col gap-3 rounded-lg border border-status-warning-border bg-status-warning-bg-subtle p-4 sm:flex-row sm:items-center sm:justify-between",
|
|
135
|
-
children: [/* @__PURE__ */
|
|
136
|
+
children: [/* @__PURE__ */ w("div", {
|
|
136
137
|
className: "flex items-start gap-3",
|
|
137
|
-
children: [/* @__PURE__ */
|
|
138
|
+
children: [/* @__PURE__ */ C(h, {
|
|
138
139
|
className: "mt-0.5 size-4 shrink-0 text-status-warning-text",
|
|
139
140
|
"aria-hidden": "true"
|
|
140
|
-
}), /* @__PURE__ */
|
|
141
|
+
}), /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("p", {
|
|
141
142
|
className: "text-sm font-medium text-text-primary",
|
|
142
|
-
children:
|
|
143
|
-
}), /* @__PURE__ */
|
|
143
|
+
children: c("billing.addons.paidPlanRequiredTitle", "Add-ons need a paid plan")
|
|
144
|
+
}), /* @__PURE__ */ C("p", {
|
|
144
145
|
className: "mt-1 text-sm text-text-secondary",
|
|
145
|
-
children:
|
|
146
|
+
children: c("billing.addons.paidPlanRequiredBody", "Add-ons extend a paid subscription. You are on the Free plan for this product, so upgrade to a paid plan first, then come back to add extra capacity.")
|
|
146
147
|
})] })]
|
|
147
|
-
}), /* @__PURE__ */
|
|
148
|
+
}), /* @__PURE__ */ C("button", {
|
|
148
149
|
type: "button",
|
|
149
|
-
onClick: () =>
|
|
150
|
+
onClick: () => l("/plans"),
|
|
150
151
|
className: "shrink-0 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90",
|
|
151
|
-
children:
|
|
152
|
+
children: c("billing.addons.viewPlans", "View plans")
|
|
152
153
|
})]
|
|
153
154
|
}),
|
|
154
|
-
/* @__PURE__ */
|
|
155
|
+
/* @__PURE__ */ w("div", {
|
|
155
156
|
className: "flex flex-wrap items-center gap-4 pb-4 border-b border-border-subtle",
|
|
156
|
-
children: [/* @__PURE__ */
|
|
157
|
+
children: [/* @__PURE__ */ C("div", {
|
|
157
158
|
className: "inline-flex rounded-lg border border-border-subtle p-1 bg-bg-sunken/50",
|
|
158
159
|
children: [
|
|
159
160
|
"all",
|
|
160
161
|
"monthly",
|
|
161
162
|
"yearly"
|
|
162
|
-
].map((e) => /* @__PURE__ */
|
|
163
|
+
].map((e) => /* @__PURE__ */ C("button", {
|
|
163
164
|
type: "button",
|
|
164
|
-
onClick: () =>
|
|
165
|
-
className: `px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${
|
|
165
|
+
onClick: () => I(e),
|
|
166
|
+
className: `px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${j === e ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
|
|
166
167
|
children: e === "all" ? "All" : e === "monthly" ? "Monthly" : "Yearly"
|
|
167
168
|
}, e))
|
|
168
|
-
}), /* @__PURE__ */
|
|
169
|
+
}), /* @__PURE__ */ w("div", {
|
|
169
170
|
className: "ml-auto inline-flex rounded-lg border border-border-subtle p-1 bg-bg-sunken/50",
|
|
170
|
-
children: [/* @__PURE__ */
|
|
171
|
+
children: [/* @__PURE__ */ C("button", {
|
|
171
172
|
type: "button",
|
|
172
|
-
onClick: () =>
|
|
173
|
-
className: `p-1.5 rounded-md transition-colors ${
|
|
173
|
+
onClick: () => A("grid"),
|
|
174
|
+
className: `p-1.5 rounded-md transition-colors ${k === "grid" ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
|
|
174
175
|
title: "Grid view",
|
|
175
|
-
children: /* @__PURE__ */
|
|
176
|
+
children: /* @__PURE__ */ C("svg", {
|
|
176
177
|
className: "size-4",
|
|
177
178
|
fill: "none",
|
|
178
179
|
viewBox: "0 0 24 24",
|
|
179
180
|
stroke: "currentColor",
|
|
180
|
-
children: /* @__PURE__ */
|
|
181
|
+
children: /* @__PURE__ */ C("path", {
|
|
181
182
|
strokeLinecap: "round",
|
|
182
183
|
strokeLinejoin: "round",
|
|
183
184
|
strokeWidth: 2,
|
|
184
185
|
d: "M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"
|
|
185
186
|
})
|
|
186
187
|
})
|
|
187
|
-
}), /* @__PURE__ */
|
|
188
|
+
}), /* @__PURE__ */ C("button", {
|
|
188
189
|
type: "button",
|
|
189
|
-
onClick: () =>
|
|
190
|
-
className: `p-1.5 rounded-md transition-colors ${
|
|
190
|
+
onClick: () => A("list"),
|
|
191
|
+
className: `p-1.5 rounded-md transition-colors ${k === "list" ? "bg-bg-surface text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
|
|
191
192
|
title: "List view",
|
|
192
|
-
children: /* @__PURE__ */
|
|
193
|
+
children: /* @__PURE__ */ C("svg", {
|
|
193
194
|
className: "size-4",
|
|
194
195
|
fill: "none",
|
|
195
196
|
viewBox: "0 0 24 24",
|
|
196
197
|
stroke: "currentColor",
|
|
197
|
-
children: /* @__PURE__ */
|
|
198
|
+
children: /* @__PURE__ */ C("path", {
|
|
198
199
|
strokeLinecap: "round",
|
|
199
200
|
strokeLinejoin: "round",
|
|
200
201
|
strokeWidth: 2,
|
|
@@ -204,60 +205,61 @@ var A = () => {
|
|
|
204
205
|
})]
|
|
205
206
|
})]
|
|
206
207
|
}),
|
|
207
|
-
|
|
208
|
+
z.length === 0 ? /* @__PURE__ */ C(p, {
|
|
208
209
|
illustration: "empty-data",
|
|
209
|
-
title:
|
|
210
|
-
description:
|
|
211
|
-
}) : /* @__PURE__ */
|
|
212
|
-
className: "space-y-8",
|
|
213
|
-
children:
|
|
214
|
-
if (e.type === "group") return /* @__PURE__ */
|
|
210
|
+
title: c("billing.addons.noAddonsAvailable", "No addons available"),
|
|
211
|
+
description: c("billing.addons.checkBackLater", "Check back later for new addons.")
|
|
212
|
+
}) : /* @__PURE__ */ C("div", {
|
|
213
|
+
className: R && k === "grid" ? "grid grid-cols-1 items-stretch gap-6 md:grid-cols-2 xl:grid-cols-3" : "space-y-8",
|
|
214
|
+
children: B.map((e) => {
|
|
215
|
+
if (e.type === "group") return /* @__PURE__ */ C(M, {
|
|
216
|
+
className: R && k === "grid" ? "col-span-full" : void 0,
|
|
215
217
|
groupName: e.name,
|
|
216
218
|
addons: e.addons,
|
|
217
|
-
viewMode:
|
|
218
|
-
getCartItem:
|
|
219
|
-
isInCart:
|
|
220
|
-
addToCart:
|
|
221
|
-
updateQuantity:
|
|
222
|
-
removeFromCart:
|
|
223
|
-
displayCurrency:
|
|
224
|
-
navigateTo:
|
|
225
|
-
isBlocked:
|
|
226
|
-
blockedLabel:
|
|
219
|
+
viewMode: k,
|
|
220
|
+
getCartItem: D,
|
|
221
|
+
isInCart: E,
|
|
222
|
+
addToCart: b,
|
|
223
|
+
updateQuantity: S,
|
|
224
|
+
removeFromCart: x,
|
|
225
|
+
displayCurrency: L,
|
|
226
|
+
navigateTo: l,
|
|
227
|
+
isBlocked: U,
|
|
228
|
+
blockedLabel: W
|
|
227
229
|
}, e.name);
|
|
228
|
-
let t = e.addon, n =
|
|
229
|
-
return
|
|
230
|
+
let t = e.addon, n = D(t.id);
|
|
231
|
+
return C(k === "grid" ? N : P, {
|
|
230
232
|
addon: t,
|
|
231
|
-
onView: () =>
|
|
232
|
-
isInCart:
|
|
233
|
+
onView: () => l(`/addons/${t.id}`),
|
|
234
|
+
isInCart: E(t.id),
|
|
233
235
|
cartQuantity: n?.quantity || 0,
|
|
234
|
-
onAddToCart:
|
|
235
|
-
onUpdateQuantity:
|
|
236
|
-
onRemoveFromCart:
|
|
237
|
-
displayCurrency:
|
|
238
|
-
purchaseBlocked:
|
|
239
|
-
blockedLabel:
|
|
236
|
+
onAddToCart: b,
|
|
237
|
+
onUpdateQuantity: S,
|
|
238
|
+
onRemoveFromCart: x,
|
|
239
|
+
displayCurrency: L,
|
|
240
|
+
purchaseBlocked: U(t.id),
|
|
241
|
+
blockedLabel: W
|
|
240
242
|
}, t.id);
|
|
241
243
|
})
|
|
242
244
|
}),
|
|
243
|
-
/* @__PURE__ */
|
|
245
|
+
/* @__PURE__ */ C(F, { displayCurrency: L })
|
|
244
246
|
]
|
|
245
247
|
});
|
|
246
|
-
},
|
|
247
|
-
let
|
|
248
|
-
return /* @__PURE__ */
|
|
249
|
-
className:
|
|
250
|
-
children: [/* @__PURE__ */
|
|
248
|
+
}, M = ({ groupName: e, addons: t, viewMode: n, getCartItem: r, isInCart: i, addToCart: a, updateQuantity: o, removeFromCart: u, displayCurrency: d, navigateTo: f, isBlocked: p, blockedLabel: m, className: h }) => {
|
|
249
|
+
let x = t.filter((e) => i(e.id)).length;
|
|
250
|
+
return /* @__PURE__ */ w("div", {
|
|
251
|
+
className: `border border-border-subtle rounded-xl overflow-hidden ${h ?? ""}`,
|
|
252
|
+
children: [/* @__PURE__ */ w("div", {
|
|
251
253
|
className: "flex items-center justify-between px-5 py-3 bg-bg-sunken/40 border-b border-border-subtle",
|
|
252
|
-
children: [/* @__PURE__ */
|
|
254
|
+
children: [/* @__PURE__ */ w("div", {
|
|
253
255
|
className: "flex items-center gap-2",
|
|
254
256
|
children: [
|
|
255
|
-
/* @__PURE__ */
|
|
256
|
-
/* @__PURE__ */
|
|
257
|
+
/* @__PURE__ */ C(_, { className: "size-4 text-text-secondary" }),
|
|
258
|
+
/* @__PURE__ */ C("h2", {
|
|
257
259
|
className: "font-semibold text-text-primary",
|
|
258
260
|
children: e
|
|
259
261
|
}),
|
|
260
|
-
/* @__PURE__ */
|
|
262
|
+
/* @__PURE__ */ w("span", {
|
|
261
263
|
className: "text-xs text-text-secondary",
|
|
262
264
|
children: [
|
|
263
265
|
t.length,
|
|
@@ -266,14 +268,14 @@ var A = () => {
|
|
|
266
268
|
]
|
|
267
269
|
})
|
|
268
270
|
]
|
|
269
|
-
}),
|
|
271
|
+
}), x > 0 && /* @__PURE__ */ w("span", {
|
|
270
272
|
className: "text-xs font-medium px-2 py-0.5 bg-action-primary-bg text-action-primary-text rounded-full",
|
|
271
|
-
children: [
|
|
273
|
+
children: [x, " in cart"]
|
|
272
274
|
})]
|
|
273
|
-
}), n === "grid" ? /* @__PURE__ */
|
|
275
|
+
}), n === "grid" ? /* @__PURE__ */ C("div", {
|
|
274
276
|
className: "p-4 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",
|
|
275
277
|
children: t.map((e) => {
|
|
276
|
-
let t = r(e.id), n = e.name.includes(" — ") ? e.name.slice(e.name.indexOf(" — ") + 3).trim() : e.name,
|
|
278
|
+
let t = r(e.id), n = e.name.includes(" — ") ? e.name.slice(e.name.indexOf(" — ") + 3).trim() : e.name, h = i(e.id), _ = t?.quantity ?? 0, { price: x, currency: S } = (() => {
|
|
277
279
|
if (e.currencyPrices && typeof e.currencyPrices == "object") {
|
|
278
280
|
let t = e.currencyPrices;
|
|
279
281
|
if (t[d] != null) return {
|
|
@@ -286,64 +288,64 @@ var A = () => {
|
|
|
286
288
|
currency: e.currency || "USD"
|
|
287
289
|
};
|
|
288
290
|
})();
|
|
289
|
-
return /* @__PURE__ */
|
|
290
|
-
className: `relative flex flex-col rounded-lg border p-4 transition-all ${
|
|
291
|
+
return /* @__PURE__ */ w("div", {
|
|
292
|
+
className: `relative flex flex-col rounded-lg border p-4 transition-all ${h ? "border-primary bg-action-primary-bg/5" : "border-border-subtle bg-bg-surface hover:border-primary/40 hover:shadow-sm"}`,
|
|
291
293
|
children: [
|
|
292
|
-
|
|
294
|
+
h && /* @__PURE__ */ w("span", {
|
|
293
295
|
className: "absolute top-2 right-2 text-xs font-medium bg-action-primary-bg text-action-primary-text px-1.5 py-0.5 rounded",
|
|
294
|
-
children: ["×",
|
|
296
|
+
children: ["×", _]
|
|
295
297
|
}),
|
|
296
|
-
/* @__PURE__ */
|
|
298
|
+
/* @__PURE__ */ C("p", {
|
|
297
299
|
className: "font-semibold text-text-primary text-sm mb-1",
|
|
298
300
|
children: n
|
|
299
301
|
}),
|
|
300
|
-
/* @__PURE__ */
|
|
302
|
+
/* @__PURE__ */ C("p", {
|
|
301
303
|
className: "text-xs text-text-secondary mb-3",
|
|
302
|
-
children:
|
|
304
|
+
children: l(e.duration)
|
|
303
305
|
}),
|
|
304
|
-
/* @__PURE__ */
|
|
306
|
+
/* @__PURE__ */ w("p", {
|
|
305
307
|
className: "text-lg font-bold text-text-primary mb-3",
|
|
306
|
-
children: [
|
|
308
|
+
children: [s(x, S), /* @__PURE__ */ w("span", {
|
|
307
309
|
className: "text-xs font-normal text-text-secondary ml-1",
|
|
308
|
-
children: ["/ ",
|
|
310
|
+
children: ["/ ", c(e.duration)]
|
|
309
311
|
})]
|
|
310
312
|
}),
|
|
311
|
-
/* @__PURE__ */
|
|
313
|
+
/* @__PURE__ */ w("div", {
|
|
312
314
|
className: "mt-auto flex flex-col gap-2",
|
|
313
|
-
children: [
|
|
315
|
+
children: [h ? /* @__PURE__ */ w("div", {
|
|
314
316
|
className: "flex items-center gap-1",
|
|
315
317
|
children: [
|
|
316
|
-
/* @__PURE__ */
|
|
318
|
+
/* @__PURE__ */ C("button", {
|
|
317
319
|
type: "button",
|
|
318
|
-
onClick: () =>
|
|
320
|
+
onClick: () => o(e.id, _ - 1),
|
|
319
321
|
className: "p-1 rounded border border-border-subtle hover:bg-bg-sunken transition-colors",
|
|
320
|
-
children: /* @__PURE__ */
|
|
322
|
+
children: /* @__PURE__ */ C(g, { className: "size-3" })
|
|
321
323
|
}),
|
|
322
|
-
/* @__PURE__ */
|
|
324
|
+
/* @__PURE__ */ C("span", {
|
|
323
325
|
className: "flex-1 text-center text-sm font-medium",
|
|
324
|
-
children:
|
|
326
|
+
children: _
|
|
325
327
|
}),
|
|
326
|
-
/* @__PURE__ */
|
|
328
|
+
/* @__PURE__ */ C("button", {
|
|
327
329
|
type: "button",
|
|
328
|
-
onClick: () =>
|
|
330
|
+
onClick: () => o(e.id, _ + 1),
|
|
329
331
|
className: "p-1 rounded border border-border-subtle hover:bg-bg-sunken transition-colors",
|
|
330
|
-
children: /* @__PURE__ */
|
|
332
|
+
children: /* @__PURE__ */ C(v, { className: "size-3" })
|
|
331
333
|
}),
|
|
332
|
-
/* @__PURE__ */
|
|
334
|
+
/* @__PURE__ */ C("button", {
|
|
333
335
|
type: "button",
|
|
334
336
|
onClick: () => u(e.id),
|
|
335
337
|
className: "p-1 rounded text-status-error-text hover:bg-status-error-bg/10 transition-colors",
|
|
336
|
-
children: /* @__PURE__ */
|
|
338
|
+
children: /* @__PURE__ */ C(b, { className: "size-3" })
|
|
337
339
|
})
|
|
338
340
|
]
|
|
339
|
-
}) : /* @__PURE__ */
|
|
341
|
+
}) : /* @__PURE__ */ w("button", {
|
|
340
342
|
type: "button",
|
|
341
343
|
onClick: () => a(e),
|
|
342
344
|
disabled: p(e.id),
|
|
343
345
|
title: p(e.id) ? m : void 0,
|
|
344
346
|
className: "w-full py-1.5 text-xs font-medium bg-action-primary-bg text-action-primary-text rounded-md hover:bg-action-primary-bg/90 transition-colors flex items-center justify-center gap-1 disabled:cursor-not-allowed disabled:opacity-50",
|
|
345
|
-
children: [/* @__PURE__ */
|
|
346
|
-
}), /* @__PURE__ */
|
|
347
|
+
children: [/* @__PURE__ */ C(y, { className: "size-3" }), "Add to Cart"]
|
|
348
|
+
}), /* @__PURE__ */ C("button", {
|
|
347
349
|
type: "button",
|
|
348
350
|
onClick: () => f(`/addons/${e.id}`),
|
|
349
351
|
className: "w-full py-1.5 text-xs font-medium border border-border-subtle text-text-primary rounded-md hover:bg-bg-sunken transition-colors",
|
|
@@ -353,10 +355,10 @@ var A = () => {
|
|
|
353
355
|
]
|
|
354
356
|
}, e.id);
|
|
355
357
|
})
|
|
356
|
-
}) : /* @__PURE__ */
|
|
358
|
+
}) : /* @__PURE__ */ C("div", {
|
|
357
359
|
className: "divide-y divide-border",
|
|
358
360
|
children: t.map((e) => {
|
|
359
|
-
let t = r(e.id), n = e.name.includes(" — ") ? e.name.slice(e.name.indexOf(" — ") + 3).trim() : e.name,
|
|
361
|
+
let t = r(e.id), n = e.name.includes(" — ") ? e.name.slice(e.name.indexOf(" — ") + 3).trim() : e.name, h = i(e.id), _ = t?.quantity ?? 0, { price: x, currency: S } = (() => {
|
|
360
362
|
if (e.currencyPrices && typeof e.currencyPrices == "object") {
|
|
361
363
|
let t = e.currencyPrices;
|
|
362
364
|
if (t[d] != null) return {
|
|
@@ -369,61 +371,61 @@ var A = () => {
|
|
|
369
371
|
currency: e.currency || "USD"
|
|
370
372
|
};
|
|
371
373
|
})();
|
|
372
|
-
return /* @__PURE__ */
|
|
373
|
-
className: `flex items-center gap-4 px-5 py-3 transition-colors ${
|
|
374
|
+
return /* @__PURE__ */ w("div", {
|
|
375
|
+
className: `flex items-center gap-4 px-5 py-3 transition-colors ${h ? "bg-action-primary-bg/5" : "hover:bg-bg-sunken/30"}`,
|
|
374
376
|
children: [
|
|
375
|
-
/* @__PURE__ */
|
|
377
|
+
/* @__PURE__ */ w("div", {
|
|
376
378
|
className: "flex-1 min-w-0",
|
|
377
|
-
children: [/* @__PURE__ */
|
|
379
|
+
children: [/* @__PURE__ */ C("p", {
|
|
378
380
|
className: "font-medium text-text-primary text-sm",
|
|
379
381
|
children: n
|
|
380
|
-
}), /* @__PURE__ */
|
|
382
|
+
}), /* @__PURE__ */ C("p", {
|
|
381
383
|
className: "text-xs text-text-secondary",
|
|
382
|
-
children:
|
|
384
|
+
children: l(e.duration)
|
|
383
385
|
})]
|
|
384
386
|
}),
|
|
385
|
-
/* @__PURE__ */
|
|
387
|
+
/* @__PURE__ */ w("p", {
|
|
386
388
|
className: "font-semibold text-text-primary text-sm whitespace-nowrap",
|
|
387
|
-
children: [
|
|
389
|
+
children: [s(x, S), /* @__PURE__ */ w("span", {
|
|
388
390
|
className: "text-xs font-normal text-text-secondary ml-1",
|
|
389
|
-
children: ["/ ",
|
|
391
|
+
children: ["/ ", c(e.duration)]
|
|
390
392
|
})]
|
|
391
393
|
}),
|
|
392
|
-
|
|
394
|
+
h ? /* @__PURE__ */ w("div", {
|
|
393
395
|
className: "flex items-center gap-1",
|
|
394
396
|
children: [
|
|
395
|
-
/* @__PURE__ */
|
|
397
|
+
/* @__PURE__ */ C("button", {
|
|
396
398
|
type: "button",
|
|
397
|
-
onClick: () =>
|
|
399
|
+
onClick: () => o(e.id, _ - 1),
|
|
398
400
|
className: "p-1 rounded border border-border-subtle hover:bg-bg-sunken transition-colors",
|
|
399
|
-
children: /* @__PURE__ */
|
|
401
|
+
children: /* @__PURE__ */ C(g, { className: "size-3" })
|
|
400
402
|
}),
|
|
401
|
-
/* @__PURE__ */
|
|
403
|
+
/* @__PURE__ */ C("span", {
|
|
402
404
|
className: "w-6 text-center text-sm font-medium",
|
|
403
|
-
children:
|
|
405
|
+
children: _
|
|
404
406
|
}),
|
|
405
|
-
/* @__PURE__ */
|
|
407
|
+
/* @__PURE__ */ C("button", {
|
|
406
408
|
type: "button",
|
|
407
|
-
onClick: () =>
|
|
409
|
+
onClick: () => o(e.id, _ + 1),
|
|
408
410
|
className: "p-1 rounded border border-border-subtle hover:bg-bg-sunken transition-colors",
|
|
409
|
-
children: /* @__PURE__ */
|
|
411
|
+
children: /* @__PURE__ */ C(v, { className: "size-3" })
|
|
410
412
|
}),
|
|
411
|
-
/* @__PURE__ */
|
|
413
|
+
/* @__PURE__ */ C("button", {
|
|
412
414
|
type: "button",
|
|
413
415
|
onClick: () => u(e.id),
|
|
414
416
|
className: "p-1 rounded text-status-error-text hover:bg-status-error-bg/10 transition-colors",
|
|
415
|
-
children: /* @__PURE__ */
|
|
417
|
+
children: /* @__PURE__ */ C(b, { className: "size-3" })
|
|
416
418
|
})
|
|
417
419
|
]
|
|
418
|
-
}) : /* @__PURE__ */
|
|
420
|
+
}) : /* @__PURE__ */ w("button", {
|
|
419
421
|
type: "button",
|
|
420
422
|
onClick: () => a(e),
|
|
421
423
|
disabled: p(e.id),
|
|
422
424
|
title: p(e.id) ? m : void 0,
|
|
423
425
|
className: "px-2 py-1 text-xs font-medium bg-action-primary-bg text-action-primary-text rounded-md hover:bg-action-primary-bg/90 transition-colors flex items-center gap-1 disabled:cursor-not-allowed disabled:opacity-50",
|
|
424
|
-
children: [/* @__PURE__ */
|
|
426
|
+
children: [/* @__PURE__ */ C(y, { className: "size-3" }), "Add"]
|
|
425
427
|
}),
|
|
426
|
-
/* @__PURE__ */
|
|
428
|
+
/* @__PURE__ */ C("button", {
|
|
427
429
|
type: "button",
|
|
428
430
|
onClick: () => f(`/addons/${e.id}`),
|
|
429
431
|
className: "px-2 py-1 text-xs font-medium border border-border-subtle text-text-primary rounded-md hover:bg-bg-sunken transition-colors",
|
|
@@ -434,12 +436,12 @@ var A = () => {
|
|
|
434
436
|
})
|
|
435
437
|
})]
|
|
436
438
|
});
|
|
437
|
-
},
|
|
438
|
-
let
|
|
439
|
-
return /* @__PURE__ */
|
|
439
|
+
}, N = ({ addon: e, onView: t, isInCart: n, cartQuantity: r, onAddToCart: i, onUpdateQuantity: a, onRemoveFromCart: o, displayCurrency: u, purchaseBlocked: f, blockedLabel: p }) => {
|
|
440
|
+
let m = d(() => k(e.features || []), [e.features]);
|
|
441
|
+
return /* @__PURE__ */ w("div", {
|
|
440
442
|
className: `relative border rounded-lg p-6 transition-all hover:shadow-md flex flex-col h-full ${n ? "border-primary bg-action-primary-bg/5" : "border-border-subtle bg-bg-surface"}`,
|
|
441
443
|
children: [
|
|
442
|
-
n && /* @__PURE__ */
|
|
444
|
+
n && /* @__PURE__ */ w("span", {
|
|
443
445
|
className: "absolute top-4 right-4 px-2 py-1 text-xs font-medium bg-action-primary-bg text-action-primary-text rounded",
|
|
444
446
|
children: [
|
|
445
447
|
"In Cart (",
|
|
@@ -447,14 +449,14 @@ var A = () => {
|
|
|
447
449
|
")"
|
|
448
450
|
]
|
|
449
451
|
}),
|
|
450
|
-
/* @__PURE__ */
|
|
452
|
+
/* @__PURE__ */ C("div", {
|
|
451
453
|
className: "size-10 rounded-lg bg-action-primary-bg/10 flex items-center justify-center mb-4",
|
|
452
|
-
children: /* @__PURE__ */
|
|
454
|
+
children: /* @__PURE__ */ C("svg", {
|
|
453
455
|
className: "size-5 text-primary",
|
|
454
456
|
fill: "none",
|
|
455
457
|
viewBox: "0 0 24 24",
|
|
456
458
|
stroke: "currentColor",
|
|
457
|
-
children: /* @__PURE__ */
|
|
459
|
+
children: /* @__PURE__ */ C("path", {
|
|
458
460
|
strokeLinecap: "round",
|
|
459
461
|
strokeLinejoin: "round",
|
|
460
462
|
strokeWidth: 2,
|
|
@@ -462,102 +464,102 @@ var A = () => {
|
|
|
462
464
|
})
|
|
463
465
|
})
|
|
464
466
|
}),
|
|
465
|
-
/* @__PURE__ */
|
|
467
|
+
/* @__PURE__ */ w("div", {
|
|
466
468
|
className: "mb-4",
|
|
467
|
-
children: [/* @__PURE__ */
|
|
469
|
+
children: [/* @__PURE__ */ C("h3", {
|
|
468
470
|
className: "text-lg font-bold text-text-primary",
|
|
469
471
|
children: e.name
|
|
470
|
-
}), /* @__PURE__ */
|
|
472
|
+
}), /* @__PURE__ */ C("span", {
|
|
471
473
|
className: "text-sm text-text-secondary",
|
|
472
|
-
children:
|
|
474
|
+
children: l(e.duration)
|
|
473
475
|
})]
|
|
474
476
|
}),
|
|
475
|
-
/* @__PURE__ */
|
|
477
|
+
/* @__PURE__ */ w("div", {
|
|
476
478
|
className: "flex items-baseline gap-1 mb-4",
|
|
477
|
-
children: [/* @__PURE__ */
|
|
479
|
+
children: [/* @__PURE__ */ C("span", {
|
|
478
480
|
className: "text-2xl font-bold text-text-primary",
|
|
479
481
|
children: (() => {
|
|
480
|
-
let { price: t, currency: n } =
|
|
481
|
-
return
|
|
482
|
+
let { price: t, currency: n } = A(e, u);
|
|
483
|
+
return s(t, n);
|
|
482
484
|
})()
|
|
483
|
-
}), /* @__PURE__ */
|
|
485
|
+
}), /* @__PURE__ */ w("span", {
|
|
484
486
|
className: "text-text-secondary text-sm",
|
|
485
|
-
children: ["/ ",
|
|
487
|
+
children: ["/ ", c(e.duration)]
|
|
486
488
|
})]
|
|
487
489
|
}),
|
|
488
|
-
|
|
490
|
+
m.length > 0 && /* @__PURE__ */ w("ul", {
|
|
489
491
|
className: "space-y-2 mb-4",
|
|
490
|
-
children: [
|
|
492
|
+
children: [m.slice(0, 4).map((e) => /* @__PURE__ */ w("li", {
|
|
491
493
|
className: "flex items-center justify-between text-sm",
|
|
492
|
-
children: [/* @__PURE__ */
|
|
494
|
+
children: [/* @__PURE__ */ w("div", {
|
|
493
495
|
className: "flex items-center gap-2",
|
|
494
|
-
children: [/* @__PURE__ */
|
|
496
|
+
children: [/* @__PURE__ */ C("svg", {
|
|
495
497
|
className: "size-4 text-status-success-text shrink-0",
|
|
496
498
|
fill: "none",
|
|
497
499
|
viewBox: "0 0 24 24",
|
|
498
500
|
stroke: "currentColor",
|
|
499
|
-
children: /* @__PURE__ */
|
|
501
|
+
children: /* @__PURE__ */ C("path", {
|
|
500
502
|
strokeLinecap: "round",
|
|
501
503
|
strokeLinejoin: "round",
|
|
502
504
|
strokeWidth: 2,
|
|
503
505
|
d: "M5 13l4 4L19 7"
|
|
504
506
|
})
|
|
505
|
-
}), /* @__PURE__ */
|
|
507
|
+
}), /* @__PURE__ */ C("span", {
|
|
506
508
|
className: "text-text-primary",
|
|
507
509
|
children: e.name
|
|
508
510
|
})]
|
|
509
|
-
}), /* @__PURE__ */
|
|
511
|
+
}), /* @__PURE__ */ C("span", {
|
|
510
512
|
className: "font-medium text-text-primary",
|
|
511
513
|
children: e.totalValue.toLocaleString()
|
|
512
514
|
})]
|
|
513
|
-
}, e.quotaId)),
|
|
515
|
+
}, e.quotaId)), m.length > 4 && /* @__PURE__ */ w("li", {
|
|
514
516
|
className: "text-sm text-text-secondary pl-6",
|
|
515
517
|
children: [
|
|
516
518
|
"+",
|
|
517
|
-
|
|
519
|
+
m.length - 4,
|
|
518
520
|
" more quotas"
|
|
519
521
|
]
|
|
520
522
|
})]
|
|
521
523
|
}),
|
|
522
|
-
/* @__PURE__ */
|
|
524
|
+
/* @__PURE__ */ w("div", {
|
|
523
525
|
className: "space-y-2 pt-4 border-t border-border-subtle mt-auto",
|
|
524
|
-
children: [n ? /* @__PURE__ */
|
|
526
|
+
children: [n ? /* @__PURE__ */ w("div", {
|
|
525
527
|
className: "flex items-center justify-between gap-2",
|
|
526
|
-
children: [/* @__PURE__ */
|
|
528
|
+
children: [/* @__PURE__ */ w("div", {
|
|
527
529
|
className: "flex items-center gap-1",
|
|
528
530
|
children: [
|
|
529
|
-
/* @__PURE__ */
|
|
531
|
+
/* @__PURE__ */ C("button", {
|
|
530
532
|
type: "button",
|
|
531
533
|
onClick: () => a(e.id, r - 1),
|
|
532
534
|
className: "p-1.5 rounded border border-border-subtle hover:bg-bg-sunken transition-colors",
|
|
533
|
-
children: /* @__PURE__ */
|
|
535
|
+
children: /* @__PURE__ */ C(g, { className: "size-4" })
|
|
534
536
|
}),
|
|
535
|
-
/* @__PURE__ */
|
|
537
|
+
/* @__PURE__ */ C("span", {
|
|
536
538
|
className: "w-10 text-center font-medium",
|
|
537
539
|
children: r
|
|
538
540
|
}),
|
|
539
|
-
/* @__PURE__ */
|
|
541
|
+
/* @__PURE__ */ C("button", {
|
|
540
542
|
type: "button",
|
|
541
543
|
onClick: () => a(e.id, r + 1),
|
|
542
544
|
className: "p-1.5 rounded border border-border-subtle hover:bg-bg-sunken transition-colors",
|
|
543
|
-
children: /* @__PURE__ */
|
|
545
|
+
children: /* @__PURE__ */ C(v, { className: "size-4" })
|
|
544
546
|
})
|
|
545
547
|
]
|
|
546
|
-
}), /* @__PURE__ */
|
|
548
|
+
}), /* @__PURE__ */ C("button", {
|
|
547
549
|
type: "button",
|
|
548
|
-
onClick: () =>
|
|
550
|
+
onClick: () => o(e.id),
|
|
549
551
|
className: "p-1.5 rounded text-status-error-text hover:bg-status-error-bg/10 transition-colors",
|
|
550
552
|
title: "Remove from cart",
|
|
551
|
-
children: /* @__PURE__ */
|
|
553
|
+
children: /* @__PURE__ */ C(b, { className: "size-4" })
|
|
552
554
|
})]
|
|
553
|
-
}) : /* @__PURE__ */
|
|
555
|
+
}) : /* @__PURE__ */ w("button", {
|
|
554
556
|
type: "button",
|
|
555
557
|
onClick: () => i(e),
|
|
556
558
|
disabled: f,
|
|
557
559
|
title: f ? p : void 0,
|
|
558
560
|
className: "w-full px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-md hover:bg-action-primary-bg/90 transition-colors flex items-center justify-center gap-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
559
|
-
children: [
|
|
560
|
-
}), /* @__PURE__ */
|
|
561
|
+
children: [C(f ? h : y, { className: "size-4" }), "Add to Cart"]
|
|
562
|
+
}), /* @__PURE__ */ C("button", {
|
|
561
563
|
type: "button",
|
|
562
564
|
onClick: t,
|
|
563
565
|
className: "w-full px-4 py-2 text-sm font-medium border border-border-subtle text-text-primary rounded-md hover:bg-bg-sunken transition-colors",
|
|
@@ -566,19 +568,19 @@ var A = () => {
|
|
|
566
568
|
})
|
|
567
569
|
]
|
|
568
570
|
});
|
|
569
|
-
},
|
|
570
|
-
let p =
|
|
571
|
-
return /* @__PURE__ */
|
|
571
|
+
}, P = ({ addon: e, onView: t, isInCart: n, cartQuantity: r, onAddToCart: i, onUpdateQuantity: a, onRemoveFromCart: o, displayCurrency: l, purchaseBlocked: u, blockedLabel: f }) => {
|
|
572
|
+
let p = d(() => k(e.features || []), [e.features]);
|
|
573
|
+
return /* @__PURE__ */ w("div", {
|
|
572
574
|
className: `flex items-center gap-4 p-4 border rounded-lg transition-all hover:shadow-sm ${n ? "border-primary bg-action-primary-bg/5" : "border-border-subtle bg-bg-surface"}`,
|
|
573
575
|
children: [
|
|
574
|
-
/* @__PURE__ */
|
|
576
|
+
/* @__PURE__ */ C("div", {
|
|
575
577
|
className: "size-10 rounded-lg bg-action-primary-bg/10 flex items-center justify-center shrink-0",
|
|
576
|
-
children: /* @__PURE__ */
|
|
578
|
+
children: /* @__PURE__ */ C("svg", {
|
|
577
579
|
className: "size-5 text-primary",
|
|
578
580
|
fill: "none",
|
|
579
581
|
viewBox: "0 0 24 24",
|
|
580
582
|
stroke: "currentColor",
|
|
581
|
-
children: /* @__PURE__ */
|
|
583
|
+
children: /* @__PURE__ */ C("path", {
|
|
582
584
|
strokeLinecap: "round",
|
|
583
585
|
strokeLinejoin: "round",
|
|
584
586
|
strokeWidth: 2,
|
|
@@ -586,14 +588,14 @@ var A = () => {
|
|
|
586
588
|
})
|
|
587
589
|
})
|
|
588
590
|
}),
|
|
589
|
-
/* @__PURE__ */
|
|
591
|
+
/* @__PURE__ */ w("div", {
|
|
590
592
|
className: "flex-1 min-w-0",
|
|
591
|
-
children: [/* @__PURE__ */
|
|
593
|
+
children: [/* @__PURE__ */ w("div", {
|
|
592
594
|
className: "flex items-center gap-2",
|
|
593
|
-
children: [/* @__PURE__ */
|
|
595
|
+
children: [/* @__PURE__ */ C("h3", {
|
|
594
596
|
className: "font-semibold text-text-primary truncate",
|
|
595
597
|
children: e.name
|
|
596
|
-
}), n && /* @__PURE__ */
|
|
598
|
+
}), n && /* @__PURE__ */ w("span", {
|
|
597
599
|
className: "px-2 py-0.5 text-xs font-medium bg-action-primary-bg text-action-primary-text rounded",
|
|
598
600
|
children: [
|
|
599
601
|
"In Cart (",
|
|
@@ -601,7 +603,7 @@ var A = () => {
|
|
|
601
603
|
")"
|
|
602
604
|
]
|
|
603
605
|
})]
|
|
604
|
-
}), /* @__PURE__ */
|
|
606
|
+
}), /* @__PURE__ */ w("p", {
|
|
605
607
|
className: "text-sm text-text-secondary",
|
|
606
608
|
children: [
|
|
607
609
|
p.length,
|
|
@@ -610,55 +612,55 @@ var A = () => {
|
|
|
610
612
|
]
|
|
611
613
|
})]
|
|
612
614
|
}),
|
|
613
|
-
/* @__PURE__ */
|
|
615
|
+
/* @__PURE__ */ w("div", {
|
|
614
616
|
className: "text-right",
|
|
615
|
-
children: [/* @__PURE__ */
|
|
617
|
+
children: [/* @__PURE__ */ C("div", {
|
|
616
618
|
className: "font-semibold text-text-primary",
|
|
617
619
|
children: (() => {
|
|
618
|
-
let { price: t, currency: n } =
|
|
619
|
-
return
|
|
620
|
+
let { price: t, currency: n } = A(e, l);
|
|
621
|
+
return s(t, n);
|
|
620
622
|
})()
|
|
621
|
-
}), /* @__PURE__ */
|
|
623
|
+
}), /* @__PURE__ */ w("div", {
|
|
622
624
|
className: "text-sm text-text-secondary",
|
|
623
|
-
children: ["per ",
|
|
625
|
+
children: ["per ", c(e.duration)]
|
|
624
626
|
})]
|
|
625
627
|
}),
|
|
626
|
-
n ? /* @__PURE__ */
|
|
628
|
+
n ? /* @__PURE__ */ w("div", {
|
|
627
629
|
className: "flex items-center gap-1",
|
|
628
630
|
children: [
|
|
629
|
-
/* @__PURE__ */
|
|
631
|
+
/* @__PURE__ */ C("button", {
|
|
630
632
|
type: "button",
|
|
631
633
|
onClick: () => a(e.id, r - 1),
|
|
632
634
|
className: "p-1.5 rounded border border-border-subtle hover:bg-bg-sunken transition-colors",
|
|
633
|
-
children: /* @__PURE__ */
|
|
635
|
+
children: /* @__PURE__ */ C(g, { className: "size-4" })
|
|
634
636
|
}),
|
|
635
|
-
/* @__PURE__ */
|
|
637
|
+
/* @__PURE__ */ C("span", {
|
|
636
638
|
className: "w-8 text-center font-medium",
|
|
637
639
|
children: r
|
|
638
640
|
}),
|
|
639
|
-
/* @__PURE__ */
|
|
641
|
+
/* @__PURE__ */ C("button", {
|
|
640
642
|
type: "button",
|
|
641
643
|
onClick: () => a(e.id, r + 1),
|
|
642
644
|
className: "p-1.5 rounded border border-border-subtle hover:bg-bg-sunken transition-colors",
|
|
643
|
-
children: /* @__PURE__ */
|
|
645
|
+
children: /* @__PURE__ */ C(v, { className: "size-4" })
|
|
644
646
|
}),
|
|
645
|
-
/* @__PURE__ */
|
|
647
|
+
/* @__PURE__ */ C("button", {
|
|
646
648
|
type: "button",
|
|
647
|
-
onClick: () =>
|
|
649
|
+
onClick: () => o(e.id),
|
|
648
650
|
className: "p-1.5 rounded text-status-error-text hover:bg-status-error-bg/10 transition-colors ml-1",
|
|
649
651
|
title: "Remove from cart",
|
|
650
|
-
children: /* @__PURE__ */
|
|
652
|
+
children: /* @__PURE__ */ C(b, { className: "size-4" })
|
|
651
653
|
})
|
|
652
654
|
]
|
|
653
|
-
}) : /* @__PURE__ */
|
|
655
|
+
}) : /* @__PURE__ */ w("button", {
|
|
654
656
|
type: "button",
|
|
655
657
|
onClick: () => i(e),
|
|
656
|
-
disabled:
|
|
657
|
-
title:
|
|
658
|
+
disabled: u,
|
|
659
|
+
title: u ? f : void 0,
|
|
658
660
|
className: "px-3 py-1.5 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-md hover:bg-action-primary-bg/90 transition-colors flex items-center gap-1.5 disabled:cursor-not-allowed disabled:opacity-50",
|
|
659
|
-
children: [
|
|
661
|
+
children: [C(u ? h : y, { className: "size-4" }), "Add"]
|
|
660
662
|
}),
|
|
661
|
-
/* @__PURE__ */
|
|
663
|
+
/* @__PURE__ */ C("button", {
|
|
662
664
|
type: "button",
|
|
663
665
|
onClick: t,
|
|
664
666
|
className: "px-3 py-1.5 text-sm font-medium border border-border-subtle text-text-primary rounded-md hover:bg-bg-sunken transition-colors",
|
|
@@ -666,156 +668,156 @@ var A = () => {
|
|
|
666
668
|
})
|
|
667
669
|
]
|
|
668
670
|
});
|
|
669
|
-
},
|
|
670
|
-
let { t: n } =
|
|
671
|
+
}, F = ({ displayCurrency: e }) => {
|
|
672
|
+
let { t: n } = T(), r = (e, t) => {
|
|
671
673
|
let r = n(e);
|
|
672
674
|
return r === e ? t : r;
|
|
673
|
-
}, a = t(), { items:
|
|
674
|
-
return
|
|
675
|
+
}, a = t(), { items: o, isCartOpen: l, toggleCart: u, closeCart: d, removeFromCart: f, updateQuantity: p, clearCart: m } = i(), h = o.reduce((e, t) => e + t.quantity, 0);
|
|
676
|
+
return o.length === 0 && !l ? null : /* @__PURE__ */ w(S, { children: [!l && o.length > 0 && E(/* @__PURE__ */ w("button", {
|
|
675
677
|
type: "button",
|
|
676
678
|
onClick: u,
|
|
677
|
-
style: { bottom: `calc(1.5rem + ${
|
|
679
|
+
style: { bottom: `calc(1.5rem + ${D})` },
|
|
678
680
|
className: "fixed left-6 sm:left-auto sm:right-6 z-50 flex items-center gap-2 px-4 py-3 bg-action-primary-bg text-action-primary-text rounded-full shadow-lg hover:bg-action-primary-bg/90 transition-all",
|
|
679
681
|
children: [
|
|
680
|
-
/* @__PURE__ */
|
|
681
|
-
/* @__PURE__ */
|
|
682
|
+
/* @__PURE__ */ C(y, { className: "size-5" }),
|
|
683
|
+
/* @__PURE__ */ w("span", {
|
|
682
684
|
className: "font-medium",
|
|
683
685
|
children: [
|
|
684
|
-
|
|
686
|
+
h,
|
|
685
687
|
" item",
|
|
686
|
-
|
|
688
|
+
h === 1 ? "" : "s"
|
|
687
689
|
]
|
|
688
690
|
}),
|
|
689
|
-
/* @__PURE__ */
|
|
691
|
+
/* @__PURE__ */ C("span", {
|
|
690
692
|
className: "px-2 py-0.5 bg-primary-foreground/20 rounded-full text-sm",
|
|
691
693
|
children: (() => {
|
|
692
|
-
let t =
|
|
693
|
-
let { price: i } =
|
|
694
|
+
let t = o.reduce((t, { addon: n, quantity: r }) => {
|
|
695
|
+
let { price: i } = A(n, e);
|
|
694
696
|
return t + i * r;
|
|
695
697
|
}, 0);
|
|
696
|
-
return
|
|
698
|
+
return s(t, e);
|
|
697
699
|
})()
|
|
698
700
|
})
|
|
699
701
|
]
|
|
700
|
-
}), document.body), l && /* @__PURE__ */
|
|
702
|
+
}), document.body), l && /* @__PURE__ */ w("div", {
|
|
701
703
|
className: "fixed inset-0 z-50 flex items-end sm:items-center justify-center",
|
|
702
|
-
children: [/* @__PURE__ */
|
|
704
|
+
children: [/* @__PURE__ */ C("div", {
|
|
703
705
|
className: "absolute inset-0 bg-overlay-scrim",
|
|
704
706
|
onClick: d
|
|
705
|
-
}), /* @__PURE__ */
|
|
707
|
+
}), /* @__PURE__ */ w("div", {
|
|
706
708
|
className: "relative w-full max-w-md max-h-[80vh] bg-bg-surface border border-border-subtle rounded-t-xl sm:rounded-xl shadow-xl overflow-hidden",
|
|
707
709
|
children: [
|
|
708
|
-
/* @__PURE__ */
|
|
710
|
+
/* @__PURE__ */ w("div", {
|
|
709
711
|
className: "flex items-center justify-between px-4 py-3 border-b border-border-subtle bg-bg-sunken/30",
|
|
710
|
-
children: [/* @__PURE__ */
|
|
712
|
+
children: [/* @__PURE__ */ w("div", {
|
|
711
713
|
className: "flex items-center gap-2",
|
|
712
714
|
children: [
|
|
713
|
-
/* @__PURE__ */
|
|
714
|
-
/* @__PURE__ */
|
|
715
|
+
/* @__PURE__ */ C(y, { className: "size-5 text-text-primary" }),
|
|
716
|
+
/* @__PURE__ */ C("h3", {
|
|
715
717
|
className: "font-semibold text-text-primary",
|
|
716
|
-
children:
|
|
718
|
+
children: r("billing.addons.yourCart", "Your Cart")
|
|
717
719
|
}),
|
|
718
|
-
/* @__PURE__ */
|
|
720
|
+
/* @__PURE__ */ w("span", {
|
|
719
721
|
className: "px-2 py-0.5 text-xs bg-action-primary-bg text-action-primary-text rounded-full",
|
|
720
722
|
children: [
|
|
721
|
-
|
|
723
|
+
h,
|
|
722
724
|
" item",
|
|
723
|
-
|
|
725
|
+
h === 1 ? "" : "s"
|
|
724
726
|
]
|
|
725
727
|
})
|
|
726
728
|
]
|
|
727
|
-
}), /* @__PURE__ */
|
|
729
|
+
}), /* @__PURE__ */ C("button", {
|
|
728
730
|
type: "button",
|
|
729
731
|
onClick: d,
|
|
730
732
|
className: "p-1.5 rounded hover:bg-bg-sunken transition-colors",
|
|
731
|
-
children: /* @__PURE__ */
|
|
733
|
+
children: /* @__PURE__ */ C(x, { className: "size-5" })
|
|
732
734
|
})]
|
|
733
735
|
}),
|
|
734
|
-
/* @__PURE__ */
|
|
736
|
+
/* @__PURE__ */ C("div", {
|
|
735
737
|
className: "overflow-y-auto max-h-[50vh] divide-y divide-border",
|
|
736
|
-
children:
|
|
738
|
+
children: o.map(({ addon: t, quantity: n }) => /* @__PURE__ */ w("div", {
|
|
737
739
|
className: "p-4 flex items-center gap-3",
|
|
738
740
|
children: [
|
|
739
|
-
/* @__PURE__ */
|
|
741
|
+
/* @__PURE__ */ w("div", {
|
|
740
742
|
className: "flex-1 min-w-0",
|
|
741
|
-
children: [/* @__PURE__ */
|
|
743
|
+
children: [/* @__PURE__ */ C("h4", {
|
|
742
744
|
className: "font-medium text-text-primary truncate",
|
|
743
745
|
children: t.name
|
|
744
|
-
}), /* @__PURE__ */
|
|
746
|
+
}), /* @__PURE__ */ w("p", {
|
|
745
747
|
className: "text-sm text-text-secondary",
|
|
746
748
|
children: [
|
|
747
749
|
(() => {
|
|
748
|
-
let { price: n, currency: r } =
|
|
749
|
-
return
|
|
750
|
+
let { price: n, currency: r } = A(t, e);
|
|
751
|
+
return s(n, r);
|
|
750
752
|
})(),
|
|
751
753
|
" ",
|
|
752
754
|
"/ ",
|
|
753
|
-
|
|
755
|
+
c(t.duration)
|
|
754
756
|
]
|
|
755
757
|
})]
|
|
756
758
|
}),
|
|
757
|
-
/* @__PURE__ */
|
|
759
|
+
/* @__PURE__ */ w("div", {
|
|
758
760
|
className: "flex items-center gap-1",
|
|
759
761
|
children: [
|
|
760
|
-
/* @__PURE__ */
|
|
762
|
+
/* @__PURE__ */ C("button", {
|
|
761
763
|
type: "button",
|
|
762
764
|
onClick: () => p(t.id, n - 1),
|
|
763
765
|
className: "p-1 rounded border border-border-subtle hover:bg-bg-sunken transition-colors",
|
|
764
|
-
children: /* @__PURE__ */
|
|
766
|
+
children: /* @__PURE__ */ C(g, { className: "size-3" })
|
|
765
767
|
}),
|
|
766
|
-
/* @__PURE__ */
|
|
768
|
+
/* @__PURE__ */ C("span", {
|
|
767
769
|
className: "w-6 text-center text-sm font-medium",
|
|
768
770
|
children: n
|
|
769
771
|
}),
|
|
770
|
-
/* @__PURE__ */
|
|
772
|
+
/* @__PURE__ */ C("button", {
|
|
771
773
|
type: "button",
|
|
772
774
|
onClick: () => p(t.id, n + 1),
|
|
773
775
|
className: "p-1 rounded border border-border-subtle hover:bg-bg-sunken transition-colors",
|
|
774
|
-
children: /* @__PURE__ */
|
|
776
|
+
children: /* @__PURE__ */ C(v, { className: "size-3" })
|
|
775
777
|
})
|
|
776
778
|
]
|
|
777
779
|
}),
|
|
778
|
-
/* @__PURE__ */
|
|
780
|
+
/* @__PURE__ */ C("p", {
|
|
779
781
|
className: "font-medium text-text-primary",
|
|
780
782
|
children: (() => {
|
|
781
|
-
let { price: r, currency: i } =
|
|
782
|
-
return
|
|
783
|
+
let { price: r, currency: i } = A(t, e);
|
|
784
|
+
return s(r * n, i);
|
|
783
785
|
})()
|
|
784
786
|
}),
|
|
785
|
-
/* @__PURE__ */
|
|
787
|
+
/* @__PURE__ */ C("button", {
|
|
786
788
|
type: "button",
|
|
787
789
|
onClick: () => f(t.id),
|
|
788
790
|
className: "p-1.5 rounded text-status-error-text hover:bg-status-error-bg/10 transition-colors",
|
|
789
|
-
children: /* @__PURE__ */
|
|
791
|
+
children: /* @__PURE__ */ C(b, { className: "size-4" })
|
|
790
792
|
})
|
|
791
793
|
]
|
|
792
794
|
}, t.id))
|
|
793
795
|
}),
|
|
794
|
-
/* @__PURE__ */
|
|
796
|
+
/* @__PURE__ */ w("div", {
|
|
795
797
|
className: "border-t border-border-subtle p-4 space-y-3 bg-bg-sunken/20",
|
|
796
|
-
children: [/* @__PURE__ */
|
|
798
|
+
children: [/* @__PURE__ */ w("div", {
|
|
797
799
|
className: "flex items-center justify-between text-lg font-semibold",
|
|
798
|
-
children: [/* @__PURE__ */
|
|
800
|
+
children: [/* @__PURE__ */ C("span", {
|
|
799
801
|
className: "text-text-primary",
|
|
800
|
-
children:
|
|
801
|
-
}), /* @__PURE__ */
|
|
802
|
+
children: r("billing.addons.total", "Total")
|
|
803
|
+
}), /* @__PURE__ */ C("span", {
|
|
802
804
|
className: "text-text-primary",
|
|
803
805
|
children: (() => {
|
|
804
|
-
let t =
|
|
805
|
-
let { price: i } =
|
|
806
|
+
let t = o.reduce((t, { addon: n, quantity: r }) => {
|
|
807
|
+
let { price: i } = A(n, e);
|
|
806
808
|
return t + i * r;
|
|
807
809
|
}, 0);
|
|
808
|
-
return
|
|
810
|
+
return s(t, e);
|
|
809
811
|
})()
|
|
810
812
|
})]
|
|
811
|
-
}), /* @__PURE__ */
|
|
813
|
+
}), /* @__PURE__ */ w("div", {
|
|
812
814
|
className: "flex gap-2",
|
|
813
|
-
children: [/* @__PURE__ */
|
|
815
|
+
children: [/* @__PURE__ */ C("button", {
|
|
814
816
|
type: "button",
|
|
815
817
|
onClick: m,
|
|
816
818
|
className: "flex-1 px-4 py-2.5 text-sm font-medium border border-border-subtle text-text-primary rounded-md hover:bg-bg-sunken transition-colors",
|
|
817
819
|
children: "Clear Cart"
|
|
818
|
-
}), /* @__PURE__ */
|
|
820
|
+
}), /* @__PURE__ */ C("button", {
|
|
819
821
|
type: "button",
|
|
820
822
|
onClick: () => {
|
|
821
823
|
d(), a("/checkout/addons");
|
|
@@ -829,6 +831,6 @@ var A = () => {
|
|
|
829
831
|
})]
|
|
830
832
|
})] });
|
|
831
833
|
};
|
|
832
|
-
export {
|
|
834
|
+
export { j as AddonsBrowsePage };
|
|
833
835
|
|
|
834
836
|
//# sourceMappingURL=AddonsBrowsePage.js.map
|