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