@zaaxch/grasp-vue 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -2
- package/dist/client.d.ts +95 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +222 -0
- package/dist/client.js.map +1 -0
- package/dist/components.d.ts +64 -0
- package/dist/components.d.ts.map +1 -0
- package/dist/components.js +369 -0
- package/dist/components.js.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +84 -0
- package/dist/index.js.map +1 -0
- package/dist/router.d.ts +19 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +92 -0
- package/dist/router.js.map +1 -0
- package/dist/stores.d.ts +596 -0
- package/dist/stores.d.ts.map +1 -0
- package/dist/stores.js +355 -0
- package/dist/stores.js.map +1 -0
- package/dist/theme.d.ts +16 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +26 -0
- package/dist/theme.js.map +1 -0
- package/package.json +71 -3
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
import Button from 'primevue/button';
|
|
2
|
+
import Card from 'primevue/card';
|
|
3
|
+
import Message from 'primevue/message';
|
|
4
|
+
import ProgressBar from 'primevue/progressbar';
|
|
5
|
+
import Tag from 'primevue/tag';
|
|
6
|
+
import { computed, defineComponent, h, inject, onMounted, ref } from 'vue';
|
|
7
|
+
import { RouterLink, RouterView, useRoute, useRouter } from 'vue-router';
|
|
8
|
+
import { GRASP_NAV_KEY, useAuthStore, useBillingStore, useGraspConfig, useNotificationsStore, } from './stores.js';
|
|
9
|
+
function formatCurrency(cents, currency) {
|
|
10
|
+
return new Intl.NumberFormat('en-US', {
|
|
11
|
+
style: 'currency',
|
|
12
|
+
currency: currency.toUpperCase(),
|
|
13
|
+
}).format(cents / 100);
|
|
14
|
+
}
|
|
15
|
+
function safeRedirectTarget(raw, fallback = '/settings') {
|
|
16
|
+
if (typeof raw === 'string' && raw.startsWith('/') && !raw.startsWith('//')) {
|
|
17
|
+
return raw;
|
|
18
|
+
}
|
|
19
|
+
return fallback;
|
|
20
|
+
}
|
|
21
|
+
export const GraspAppRoot = defineComponent({
|
|
22
|
+
name: 'GraspAppRoot',
|
|
23
|
+
setup() {
|
|
24
|
+
const notifications = useNotificationsStore();
|
|
25
|
+
return () => h('div', { class: 'min-h-screen bg-surface-0 text-surface-900', 'data-testid': 'grasp-root' }, [
|
|
26
|
+
notifications.items.length > 0
|
|
27
|
+
? h('div', {
|
|
28
|
+
class: 'fixed top-4 right-4 z-50 flex w-80 flex-col gap-2',
|
|
29
|
+
'data-testid': 'grasp-notifications',
|
|
30
|
+
}, notifications.items.map((item) => h(Message, {
|
|
31
|
+
key: item.id,
|
|
32
|
+
severity: item.severity,
|
|
33
|
+
closable: true,
|
|
34
|
+
onClose: () => notifications.dismiss(item.id),
|
|
35
|
+
}, { default: () => item.detail ?? item.summary })))
|
|
36
|
+
: null,
|
|
37
|
+
h(RouterView),
|
|
38
|
+
]);
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
export const GraspAuthFlow = defineComponent({
|
|
42
|
+
name: 'GraspAuthFlow',
|
|
43
|
+
props: {
|
|
44
|
+
homePath: { type: String, default: '/settings' },
|
|
45
|
+
},
|
|
46
|
+
setup(props) {
|
|
47
|
+
const auth = useAuthStore();
|
|
48
|
+
const config = useGraspConfig();
|
|
49
|
+
const route = useRoute();
|
|
50
|
+
const router = useRouter();
|
|
51
|
+
onMounted(() => {
|
|
52
|
+
if (!auth.ready) {
|
|
53
|
+
void auth.bootstrap();
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
const completeRedirect = async () => {
|
|
57
|
+
const target = safeRedirectTarget(route.query['redirect'], props.homePath);
|
|
58
|
+
await router.replace(target);
|
|
59
|
+
};
|
|
60
|
+
const handleGoogleLogin = async () => {
|
|
61
|
+
await auth.signInWithGoogle();
|
|
62
|
+
await completeRedirect();
|
|
63
|
+
};
|
|
64
|
+
const handleDevLogin = async (uid) => {
|
|
65
|
+
await auth.signInWithDevPersona(uid);
|
|
66
|
+
await completeRedirect();
|
|
67
|
+
};
|
|
68
|
+
return () => h('div', {
|
|
69
|
+
class: 'mx-auto flex min-h-screen max-w-md items-center justify-center px-4',
|
|
70
|
+
'data-testid': 'grasp-auth-flow',
|
|
71
|
+
}, [
|
|
72
|
+
h(Card, { class: 'w-full shadow-md' }, {
|
|
73
|
+
title: () => h('h1', { class: 'text-xl font-semibold' }, `Sign in to ${config.app.displayName}`),
|
|
74
|
+
content: () => h('div', { class: 'flex flex-col gap-4' }, [
|
|
75
|
+
auth.error
|
|
76
|
+
? h(Message, { severity: 'error', 'data-testid': 'grasp-auth-error' }, { default: () => auth.error })
|
|
77
|
+
: null,
|
|
78
|
+
h(Button, {
|
|
79
|
+
label: 'Continue with Google',
|
|
80
|
+
loading: auth.loading,
|
|
81
|
+
disabled: auth.loading,
|
|
82
|
+
class: 'w-full',
|
|
83
|
+
'data-testid': 'grasp-google-signin',
|
|
84
|
+
onClick: handleGoogleLogin,
|
|
85
|
+
}),
|
|
86
|
+
auth.devMode
|
|
87
|
+
? h('div', {
|
|
88
|
+
class: 'border-t border-surface-200 pt-4',
|
|
89
|
+
'data-testid': 'grasp-dev-auth-section',
|
|
90
|
+
}, [
|
|
91
|
+
h('p', {
|
|
92
|
+
class: 'mb-2 text-xs font-medium uppercase tracking-wide opacity-70',
|
|
93
|
+
}, 'Local Dev Personas'),
|
|
94
|
+
h('div', { class: 'flex flex-col gap-2' }, auth.personas.map((persona) => h(Button, {
|
|
95
|
+
key: persona.uid,
|
|
96
|
+
label: `${persona.displayName} (${persona.email})`,
|
|
97
|
+
severity: 'secondary',
|
|
98
|
+
outlined: true,
|
|
99
|
+
size: 'small',
|
|
100
|
+
'data-testid': `grasp-dev-persona-${persona.uid}`,
|
|
101
|
+
onClick: () => handleDevLogin(persona.uid),
|
|
102
|
+
}))),
|
|
103
|
+
])
|
|
104
|
+
: null,
|
|
105
|
+
]),
|
|
106
|
+
}),
|
|
107
|
+
]);
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
export const GraspAccountSettings = defineComponent({
|
|
111
|
+
name: 'GraspAccountSettings',
|
|
112
|
+
setup() {
|
|
113
|
+
const auth = useAuthStore();
|
|
114
|
+
const router = useRouter();
|
|
115
|
+
const confirmingDelete = ref(false);
|
|
116
|
+
const handleLogout = async () => {
|
|
117
|
+
await auth.logout();
|
|
118
|
+
await router.replace('/login');
|
|
119
|
+
};
|
|
120
|
+
const handleDeleteAccount = async () => {
|
|
121
|
+
await auth.deleteAccount();
|
|
122
|
+
confirmingDelete.value = false;
|
|
123
|
+
await router.replace('/');
|
|
124
|
+
};
|
|
125
|
+
return () => h('div', { class: 'mx-auto flex max-w-2xl flex-col gap-6', 'data-testid': 'grasp-account-settings' }, [
|
|
126
|
+
h(Card, {}, {
|
|
127
|
+
title: () => 'Account Profile',
|
|
128
|
+
content: () => h('div', { class: 'flex flex-col gap-3' }, [
|
|
129
|
+
h('div', { class: 'flex items-center justify-between' }, [
|
|
130
|
+
h('span', { class: 'text-sm opacity-70' }, 'User ID'),
|
|
131
|
+
h('code', { 'data-testid': 'grasp-account-id' }, auth.user?.id ?? '—'),
|
|
132
|
+
]),
|
|
133
|
+
h('div', { class: 'flex items-center justify-between' }, [
|
|
134
|
+
h('span', { class: 'text-sm opacity-70' }, 'Name'),
|
|
135
|
+
h('span', { 'data-testid': 'grasp-account-name' }, auth.user?.displayName ?? '—'),
|
|
136
|
+
]),
|
|
137
|
+
h('div', { class: 'flex items-center justify-between' }, [
|
|
138
|
+
h('span', { class: 'text-sm opacity-70' }, 'Email'),
|
|
139
|
+
h('span', { 'data-testid': 'grasp-account-email' }, auth.user?.email ?? '—'),
|
|
140
|
+
]),
|
|
141
|
+
h('div', { class: 'pt-2' }, [
|
|
142
|
+
h(Button, {
|
|
143
|
+
label: 'Sign out',
|
|
144
|
+
severity: 'secondary',
|
|
145
|
+
outlined: true,
|
|
146
|
+
'data-testid': 'grasp-signout-btn',
|
|
147
|
+
onClick: handleLogout,
|
|
148
|
+
}),
|
|
149
|
+
]),
|
|
150
|
+
]),
|
|
151
|
+
}),
|
|
152
|
+
h(Card, {}, {
|
|
153
|
+
title: () => 'Danger Zone',
|
|
154
|
+
content: () => h('div', { class: 'flex flex-col gap-3' }, [
|
|
155
|
+
h('p', { class: 'text-sm opacity-80' }, 'Permanently delete your account, subscriptions, credits, and all associated data.'),
|
|
156
|
+
!confirmingDelete.value
|
|
157
|
+
? h(Button, {
|
|
158
|
+
label: 'Delete Account',
|
|
159
|
+
severity: 'danger',
|
|
160
|
+
outlined: true,
|
|
161
|
+
'data-testid': 'grasp-delete-account-start',
|
|
162
|
+
onClick: () => {
|
|
163
|
+
confirmingDelete.value = true;
|
|
164
|
+
},
|
|
165
|
+
})
|
|
166
|
+
: h('div', {
|
|
167
|
+
class: 'flex items-center gap-2',
|
|
168
|
+
'data-testid': 'grasp-delete-account-confirm-box',
|
|
169
|
+
}, [
|
|
170
|
+
h(Button, {
|
|
171
|
+
label: 'Confirm Permanent Deletion',
|
|
172
|
+
severity: 'danger',
|
|
173
|
+
loading: auth.loading,
|
|
174
|
+
'data-testid': 'grasp-delete-account-confirm',
|
|
175
|
+
onClick: handleDeleteAccount,
|
|
176
|
+
}),
|
|
177
|
+
h(Button, {
|
|
178
|
+
label: 'Cancel',
|
|
179
|
+
severity: 'secondary',
|
|
180
|
+
text: true,
|
|
181
|
+
onClick: () => {
|
|
182
|
+
confirmingDelete.value = false;
|
|
183
|
+
},
|
|
184
|
+
}),
|
|
185
|
+
]),
|
|
186
|
+
]),
|
|
187
|
+
}),
|
|
188
|
+
]);
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
export const GraspPricingTable = defineComponent({
|
|
192
|
+
name: 'GraspPricingTable',
|
|
193
|
+
props: {
|
|
194
|
+
plans: {
|
|
195
|
+
type: Array,
|
|
196
|
+
required: true,
|
|
197
|
+
},
|
|
198
|
+
currentPlanId: { type: String, required: true },
|
|
199
|
+
busy: { type: Boolean, default: false },
|
|
200
|
+
},
|
|
201
|
+
emits: {
|
|
202
|
+
selectPlan: (_planId, _interval) => true,
|
|
203
|
+
},
|
|
204
|
+
setup(props, { emit }) {
|
|
205
|
+
return () => h('div', { class: 'grid gap-4 md:grid-cols-2', 'data-testid': 'grasp-pricing-table' }, props.plans.map((plan) => h(Card, { key: plan.id, 'data-testid': `grasp-plan-card-${plan.id}` }, {
|
|
206
|
+
title: () => h('div', { class: 'flex items-center justify-between' }, [
|
|
207
|
+
h('span', plan.name),
|
|
208
|
+
props.currentPlanId === plan.id
|
|
209
|
+
? h(Tag, { value: 'Current', severity: 'success' })
|
|
210
|
+
: plan.trialDays
|
|
211
|
+
? h(Tag, { value: `${plan.trialDays}d trial`, severity: 'info' })
|
|
212
|
+
: null,
|
|
213
|
+
]),
|
|
214
|
+
content: () => h('div', { class: 'flex flex-col gap-3' }, [
|
|
215
|
+
h('ul', { class: 'flex flex-col gap-1 text-sm' }, Object.entries(plan.limits).map(([key, val]) => h('li', { key }, `${key}: ${String(val)}`))),
|
|
216
|
+
h('div', { class: 'flex flex-wrap gap-2 pt-2' }, [
|
|
217
|
+
plan.prices.month
|
|
218
|
+
? h(Button, {
|
|
219
|
+
label: `Upgrade Monthly (${formatCurrency(plan.prices.month.unitAmount, plan.prices.month.currency)})`,
|
|
220
|
+
disabled: !plan.upgradable || props.busy,
|
|
221
|
+
'data-testid': `grasp-upgrade-${plan.id}-month`,
|
|
222
|
+
onClick: () => emit('selectPlan', plan.id, 'month'),
|
|
223
|
+
})
|
|
224
|
+
: null,
|
|
225
|
+
plan.prices.year
|
|
226
|
+
? h(Button, {
|
|
227
|
+
label: `Upgrade Yearly (${formatCurrency(plan.prices.year.unitAmount, plan.prices.year.currency)})`,
|
|
228
|
+
outlined: true,
|
|
229
|
+
disabled: !plan.upgradable || props.busy,
|
|
230
|
+
'data-testid': `grasp-upgrade-${plan.id}-year`,
|
|
231
|
+
onClick: () => emit('selectPlan', plan.id, 'year'),
|
|
232
|
+
})
|
|
233
|
+
: null,
|
|
234
|
+
]),
|
|
235
|
+
]),
|
|
236
|
+
})));
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
export const GraspBillingPanel = defineComponent({
|
|
240
|
+
name: 'GraspBillingPanel',
|
|
241
|
+
setup() {
|
|
242
|
+
const billing = useBillingStore();
|
|
243
|
+
const notifications = useNotificationsStore();
|
|
244
|
+
onMounted(() => {
|
|
245
|
+
void billing.refresh().catch((err) => notifications.pushError(err));
|
|
246
|
+
});
|
|
247
|
+
const handleSelectPlan = async (planId, interval) => {
|
|
248
|
+
await billing.checkoutPlan(planId, interval);
|
|
249
|
+
};
|
|
250
|
+
const handleBuyCredits = async (packId) => {
|
|
251
|
+
await billing.checkoutCredits(packId);
|
|
252
|
+
};
|
|
253
|
+
const handleManagePortal = async () => {
|
|
254
|
+
await billing.openPortal();
|
|
255
|
+
};
|
|
256
|
+
return () => {
|
|
257
|
+
const s = billing.summary;
|
|
258
|
+
if (!s) {
|
|
259
|
+
return h('div', { 'data-testid': 'grasp-billing-loading' }, [
|
|
260
|
+
billing.loading ? h(ProgressBar, { mode: 'indeterminate' }) : null,
|
|
261
|
+
]);
|
|
262
|
+
}
|
|
263
|
+
return h('div', { class: 'mx-auto flex max-w-4xl flex-col gap-6', 'data-testid': 'grasp-billing-panel' }, [
|
|
264
|
+
h(Card, {}, {
|
|
265
|
+
title: () => 'Current Subscription & Credits',
|
|
266
|
+
content: () => h('div', { class: 'flex flex-col gap-3' }, [
|
|
267
|
+
h('div', { class: 'flex flex-wrap items-center gap-3' }, [
|
|
268
|
+
h('span', { class: 'text-lg font-semibold', 'data-testid': 'grasp-current-plan' }, s.effective.planName),
|
|
269
|
+
h(Tag, { value: s.effective.status, severity: 'info' }),
|
|
270
|
+
h(Tag, {
|
|
271
|
+
value: `${s.effective.creditBalance} credits`,
|
|
272
|
+
severity: 'secondary',
|
|
273
|
+
'data-testid': 'grasp-credit-balance',
|
|
274
|
+
}),
|
|
275
|
+
]),
|
|
276
|
+
s.canManagePortal
|
|
277
|
+
? h('div', [
|
|
278
|
+
h(Button, {
|
|
279
|
+
label: 'Manage Billing in Stripe',
|
|
280
|
+
outlined: true,
|
|
281
|
+
disabled: billing.busy,
|
|
282
|
+
'data-testid': 'grasp-manage-portal-btn',
|
|
283
|
+
onClick: handleManagePortal,
|
|
284
|
+
}),
|
|
285
|
+
])
|
|
286
|
+
: null,
|
|
287
|
+
]),
|
|
288
|
+
}),
|
|
289
|
+
s.enabled && s.plans.length > 0
|
|
290
|
+
? h(GraspPricingTable, {
|
|
291
|
+
plans: s.plans,
|
|
292
|
+
currentPlanId: s.effective.planId,
|
|
293
|
+
busy: billing.busy,
|
|
294
|
+
onSelectPlan: handleSelectPlan,
|
|
295
|
+
})
|
|
296
|
+
: null,
|
|
297
|
+
s.enabled && s.creditPacks.length > 0
|
|
298
|
+
? h(Card, { 'data-testid': 'grasp-credit-packs' }, {
|
|
299
|
+
title: () => 'Credit Packs',
|
|
300
|
+
content: () => h('div', { class: 'flex flex-wrap gap-3' }, s.creditPacks.map((pack) => h(Button, {
|
|
301
|
+
key: pack.id,
|
|
302
|
+
label: pack.unitAmount !== undefined && pack.currency !== undefined
|
|
303
|
+
? `${pack.name} (${formatCurrency(pack.unitAmount, pack.currency)})`
|
|
304
|
+
: pack.name,
|
|
305
|
+
severity: 'secondary',
|
|
306
|
+
disabled: billing.busy,
|
|
307
|
+
'data-testid': `grasp-buy-pack-${pack.id}`,
|
|
308
|
+
onClick: () => handleBuyCredits(pack.id),
|
|
309
|
+
}))),
|
|
310
|
+
})
|
|
311
|
+
: null,
|
|
312
|
+
]);
|
|
313
|
+
};
|
|
314
|
+
},
|
|
315
|
+
});
|
|
316
|
+
export const GraspShellLayout = defineComponent({
|
|
317
|
+
name: 'GraspShellLayout',
|
|
318
|
+
setup(_props, { slots }) {
|
|
319
|
+
const config = useGraspConfig();
|
|
320
|
+
const auth = useAuthStore();
|
|
321
|
+
const navItems = inject(GRASP_NAV_KEY, []);
|
|
322
|
+
const layoutMode = computed(() => config.ui.layout);
|
|
323
|
+
const allNav = computed(() => [
|
|
324
|
+
...navItems,
|
|
325
|
+
{ label: 'Billing', to: '/billing' },
|
|
326
|
+
{ label: 'Settings', to: '/settings' },
|
|
327
|
+
]);
|
|
328
|
+
const renderNavLinks = (row = false) => h('nav', { class: row ? 'flex items-center gap-3' : 'flex flex-col gap-1' }, allNav.value.map((item) => h(RouterLink, {
|
|
329
|
+
key: item.to,
|
|
330
|
+
to: item.to,
|
|
331
|
+
class: 'rounded px-3 py-2 text-sm font-medium hover:bg-surface-100',
|
|
332
|
+
}, { default: () => item.label })));
|
|
333
|
+
return () => {
|
|
334
|
+
if (layoutMode.value === 'minimal') {
|
|
335
|
+
return h('div', { class: 'min-h-screen p-6', 'data-testid': 'grasp-layout-minimal' }, [
|
|
336
|
+
slots['default'] ? slots['default']() : h(RouterView),
|
|
337
|
+
]);
|
|
338
|
+
}
|
|
339
|
+
if (layoutMode.value === 'topnav') {
|
|
340
|
+
return h('div', { class: 'min-h-screen flex flex-col', 'data-testid': 'grasp-layout-topnav' }, [
|
|
341
|
+
h('header', { class: 'flex items-center justify-between border-b border-surface-200 px-6 py-3' }, [
|
|
342
|
+
h('div', { class: 'flex items-center gap-6' }, [
|
|
343
|
+
h('span', { class: 'font-semibold' }, config.app.displayName),
|
|
344
|
+
renderNavLinks(true),
|
|
345
|
+
]),
|
|
346
|
+
h('span', { class: 'text-sm opacity-75' }, auth.user?.displayName ?? auth.user?.email ?? ''),
|
|
347
|
+
]),
|
|
348
|
+
h('main', { class: 'flex-1 p-6' }, [
|
|
349
|
+
slots['default'] ? slots['default']() : h(RouterView),
|
|
350
|
+
]),
|
|
351
|
+
]);
|
|
352
|
+
}
|
|
353
|
+
return h('div', { class: 'flex min-h-screen', 'data-testid': 'grasp-layout-sidebar' }, [
|
|
354
|
+
h('aside', { class: 'w-60 border-r border-surface-200 p-4 flex flex-col justify-between' }, [
|
|
355
|
+
h('div', { class: 'flex flex-col gap-4' }, [
|
|
356
|
+
h('div', { class: 'px-3 font-semibold' }, config.app.displayName),
|
|
357
|
+
renderNavLinks(false),
|
|
358
|
+
]),
|
|
359
|
+
h('div', { class: 'px-3 text-xs opacity-70' }, [
|
|
360
|
+
auth.user?.email ?? '',
|
|
361
|
+
auth.entitlement ? ` · ${auth.entitlement.planName}` : '',
|
|
362
|
+
]),
|
|
363
|
+
]),
|
|
364
|
+
h('main', { class: 'flex-1 p-6' }, [slots['default'] ? slots['default']() : h(RouterView)]),
|
|
365
|
+
]);
|
|
366
|
+
};
|
|
367
|
+
},
|
|
368
|
+
});
|
|
369
|
+
//# sourceMappingURL=components.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAA;AACpC,OAAO,IAAI,MAAM,eAAe,CAAA;AAChC,OAAO,OAAO,MAAM,kBAAkB,CAAA;AACtC,OAAO,WAAW,MAAM,sBAAsB,CAAA;AAC9C,OAAO,GAAG,MAAM,cAAc,CAAA;AAC9B,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC1E,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAExE,OAAO,EACL,aAAa,EACb,YAAY,EACZ,eAAe,EACf,cAAc,EACd,qBAAqB,GACtB,MAAM,aAAa,CAAA;AAEpB,SAAS,cAAc,CAAC,KAAa,EAAE,QAAgB;IACrD,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;QACpC,KAAK,EAAE,UAAU;QACjB,QAAQ,EAAE,QAAQ,CAAC,WAAW,EAAE;KACjC,CAAC,CAAC,MAAM,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BAC7C,IAAI,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE;wBACtB,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE;qBAC1D,CAAC;iBACH,CACF;gBACD,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;aAC5F,CAAC,CAAA;QACJ,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { AnyAppContract, InferClientContract, ResolvedGraspConfig } from '@zaaxch/grasp-core';
|
|
2
|
+
import { type FirebaseOptions } from 'firebase/app';
|
|
3
|
+
import { type Pinia } from 'pinia';
|
|
4
|
+
import { type App, type Component } from 'vue';
|
|
5
|
+
import type { RouteRecordRaw, Router, RouterHistory } from 'vue-router';
|
|
6
|
+
import { type ShellClient } from './client.js';
|
|
7
|
+
import { type GraspNavItem } from './stores.js';
|
|
8
|
+
import { type GraspThemeDefinition } from './theme.js';
|
|
9
|
+
export * from './client.js';
|
|
10
|
+
export * from './stores.js';
|
|
11
|
+
export * from './router.js';
|
|
12
|
+
export * from './theme.js';
|
|
13
|
+
export * from './components.js';
|
|
14
|
+
export interface CreateGraspVueAppOptions<TAppContract extends AnyAppContract> {
|
|
15
|
+
readonly config: ResolvedGraspConfig;
|
|
16
|
+
readonly contract: TAppContract;
|
|
17
|
+
readonly landingComponent: Component;
|
|
18
|
+
readonly featureRoutes: readonly RouteRecordRaw[];
|
|
19
|
+
readonly navItems?: readonly GraspNavItem[];
|
|
20
|
+
readonly layoutComponent?: Component;
|
|
21
|
+
readonly loginComponent?: Component;
|
|
22
|
+
readonly authenticatedHome?: string;
|
|
23
|
+
readonly theme?: GraspThemeDefinition;
|
|
24
|
+
readonly firebaseConfig?: FirebaseOptions;
|
|
25
|
+
readonly baseUrl?: string;
|
|
26
|
+
readonly fetchImpl?: typeof fetch;
|
|
27
|
+
readonly history?: RouterHistory;
|
|
28
|
+
readonly rootComponent?: Component;
|
|
29
|
+
}
|
|
30
|
+
export interface GraspVueAppInstance<TAppContract extends AnyAppContract> {
|
|
31
|
+
readonly app: App;
|
|
32
|
+
readonly pinia: Pinia;
|
|
33
|
+
readonly router: Router;
|
|
34
|
+
readonly api: InferClientContract<TAppContract>;
|
|
35
|
+
readonly shell: ShellClient;
|
|
36
|
+
mount(selectorOrElement: string | Element): void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Bootstraps the standardized Vue 3 + Pinia + PrimeVue 4 + Router Grasp client application.
|
|
40
|
+
*/
|
|
41
|
+
export declare function createGraspVueApp<TAppContract extends AnyAppContract>(options: CreateGraspVueAppOptions<TAppContract>): GraspVueAppInstance<TAppContract>;
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAClG,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,cAAc,CAAA;AAElE,OAAO,EAAe,KAAK,KAAK,EAAE,MAAM,OAAO,CAAA;AAE/C,OAAO,EAAa,KAAK,GAAG,EAAE,KAAK,SAAS,EAAe,MAAM,KAAK,CAAA;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AACvE,OAAO,EAAwC,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAGpF,OAAO,EAQL,KAAK,YAAY,EAClB,MAAM,aA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AK,EAAE,WAAW,CAAA;IAC3B,KAAK,CAAC,iBAAiB,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;CACjD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,SAAS,cAAc,EACnE,OAAO,EAAE,wBAAwB,CAAC,YAAY,CAAC,GAC9C,mBAAmB,CAAC,YAAY,CAAC,CAyEnC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { initializeApp } from 'firebase/app';
|
|
2
|
+
import { getAuth, GoogleAuthProvider } from 'firebase/auth';
|
|
3
|
+
import { createPinia } from 'pinia';
|
|
4
|
+
import PrimeVue, {} from 'primevue/config';
|
|
5
|
+
import { createApp } from 'vue';
|
|
6
|
+
import { createGraspClient, createShellClient } from './client.js';
|
|
7
|
+
import { GraspAppRoot } from './components.js';
|
|
8
|
+
import { createGraspRouter } from './router.js';
|
|
9
|
+
import { GRASP_API_KEY, GRASP_CONFIG_KEY, GRASP_NAV_KEY, GRASP_SHELL_KEY, useAuthStore, useBillingStore, useNotificationsStore, } from './stores.js';
|
|
10
|
+
import { applyGraspCssVariables, defineGraspTheme } from './theme.js';
|
|
11
|
+
export * from './client.js';
|
|
12
|
+
export * from './stores.js';
|
|
13
|
+
export * from './router.js';
|
|
14
|
+
export * from './theme.js';
|
|
15
|
+
export * from './components.js';
|
|
16
|
+
/**
|
|
17
|
+
* Bootstraps the standardized Vue 3 + Pinia + PrimeVue 4 + Router Grasp client application.
|
|
18
|
+
*/
|
|
19
|
+
export function createGraspVueApp(options) {
|
|
20
|
+
const pinia = createPinia();
|
|
21
|
+
const app = createApp(options.rootComponent ?? GraspAppRoot);
|
|
22
|
+
app.use(pinia);
|
|
23
|
+
const theme = options.theme ?? defineGraspTheme();
|
|
24
|
+
app.use(PrimeVue, {
|
|
25
|
+
theme: {
|
|
26
|
+
preset: theme.preset,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
applyGraspCssVariables(theme.cssVariables);
|
|
30
|
+
const authStore = useAuthStore(pinia);
|
|
31
|
+
const billingStore = useBillingStore(pinia);
|
|
32
|
+
const notificationsStore = useNotificationsStore(pinia);
|
|
33
|
+
const clientOptions = {
|
|
34
|
+
...(options.baseUrl !== undefined ? { baseUrl: options.baseUrl } : {}),
|
|
35
|
+
...(options.fetchImpl !== undefined ? { fetchImpl: options.fetchImpl } : {}),
|
|
36
|
+
getAccessToken: () => authStore.getAccessToken(),
|
|
37
|
+
getSessionGeneration: () => authStore.sessionGeneration,
|
|
38
|
+
onError: (err) => {
|
|
39
|
+
notificationsStore.pushError(err);
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
const shell = createShellClient(clientOptions);
|
|
43
|
+
const api = createGraspClient(options.contract, clientOptions);
|
|
44
|
+
let firebaseAuth;
|
|
45
|
+
let googleProvider;
|
|
46
|
+
if (options.firebaseConfig?.apiKey && options.firebaseConfig.projectId) {
|
|
47
|
+
const fbApp = initializeApp(options.firebaseConfig);
|
|
48
|
+
firebaseAuth = getAuth(fbApp);
|
|
49
|
+
googleProvider = new GoogleAuthProvider();
|
|
50
|
+
}
|
|
51
|
+
authStore.configure({
|
|
52
|
+
shellClient: shell,
|
|
53
|
+
...(firebaseAuth !== undefined ? { firebaseAuth } : {}),
|
|
54
|
+
...(googleProvider !== undefined ? { googleProvider } : {}),
|
|
55
|
+
});
|
|
56
|
+
billingStore.configure({ shellClient: shell });
|
|
57
|
+
const router = createGraspRouter({
|
|
58
|
+
config: options.config,
|
|
59
|
+
landingComponent: options.landingComponent,
|
|
60
|
+
featureRoutes: options.featureRoutes,
|
|
61
|
+
...(options.layoutComponent !== undefined ? { layoutComponent: options.layoutComponent } : {}),
|
|
62
|
+
...(options.loginComponent !== undefined ? { loginComponent: options.loginComponent } : {}),
|
|
63
|
+
...(options.authenticatedHome !== undefined
|
|
64
|
+
? { authenticatedHome: options.authenticatedHome }
|
|
65
|
+
: {}),
|
|
66
|
+
...(options.history !== undefined ? { history: options.history } : {}),
|
|
67
|
+
});
|
|
68
|
+
app.use(router);
|
|
69
|
+
app.provide(GRASP_API_KEY, api);
|
|
70
|
+
app.provide(GRASP_SHELL_KEY, shell);
|
|
71
|
+
app.provide(GRASP_CONFIG_KEY, options.config);
|
|
72
|
+
app.provide(GRASP_NAV_KEY, options.navItems ?? []);
|
|
73
|
+
return {
|
|
74
|
+
app,
|
|
75
|
+
pinia,
|
|
76
|
+
router,
|
|
77
|
+
api,
|
|
78
|
+
shell,
|
|
79
|
+
mount(selectorOrElement) {
|
|
80
|
+
app.mount(selectorOrElement);
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAwB,MAAM,cAAc,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAc,MAAM,OAAO,CAAA;AAC/C,OAAO,QAAQ,EAAE,EAA8B,MAAM,iBAAiB,CAAA;AACtE,OAAO,EAAE,SAAS,EAAyC,MAAM,KAAK,CAAA;AAEtE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAoB,MAAM,aAAa,CAAA;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,YAAY,EACZ,eAAe,EACf,qBAAqB,GAEtB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAA6B,MAAM,YAAY,CAAA;AAEhG,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,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CAAC,OAAO,CAAC,iBAAiB,KAAK,SAAS;YACzC,CAAC,CAAC,EAAE,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,EAAE;YAClD,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACvE,CAAC,CAAA;IAEF,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IACf,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAA;IAC/B,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC,CAAA;IACnC,GAAG,CAAC,OAAO,CAAC,gBAAgB,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;IAC7C,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAA;IAElD,OAAO;QACL,GAAG;QACH,KAAK;QACL,MAAM;QACN,GAAG;QACH,KAAK;QACL,KAAK,CAAC,iBAAiB;YACrB,GAAG,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAA;QAC9B,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/router.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ResolvedGraspConfig } from '@zaaxch/grasp-core';
|
|
2
|
+
import type { Component } from 'vue';
|
|
3
|
+
import { type RouteRecordRaw, type Router, type RouterHistory } from 'vue-router';
|
|
4
|
+
export interface CreateGraspRouterOptions {
|
|
5
|
+
readonly config: ResolvedGraspConfig;
|
|
6
|
+
readonly landingComponent: Component;
|
|
7
|
+
readonly featureRoutes: readonly RouteRecordRaw[];
|
|
8
|
+
readonly layoutComponent?: Component;
|
|
9
|
+
readonly loginComponent?: Component;
|
|
10
|
+
readonly authenticatedHome?: string;
|
|
11
|
+
readonly history?: RouterHistory;
|
|
12
|
+
}
|
|
13
|
+
export declare function defineFeatureRoutes(routes: readonly RouteRecordRaw[]): readonly RouteRecordRaw[];
|
|
14
|
+
/**
|
|
15
|
+
* Builds the standardized Grasp Vue Router with built-in `/`, `/login`, `/settings`, `/billing`
|
|
16
|
+
* routes plus automatic auth and `minPlan` route guards.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createGraspRouter(options: CreateGraspRouterOptions): Router;
|
|
19
|
+
//# sourceMappingURL=router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AACpC,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,MAAM,EACX,KAAK,aAAa,EACnB,MAAM,YAAY,CAAA;AASnB,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAA;IACpC,QAAQ,CAAC,gBAAgB,EAAE,SAAS,CAAA;IACpC,QAAQ,CAAC,aAAa,EAAE,SAAS,cAAc,EAAE,CAAA;IACjD,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,CAAA;IACpC,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,CAAA;IACnC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;IACnC,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAA;CACjC;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,GAAG,SAAS,cAAc,EAAE,CAEhG;AASD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,MAAM,CAoF3E"}
|
package/dist/router.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { getPlanRank } from '@zaaxch/grasp-core';
|
|
2
|
+
import { createRouter, createWebHistory, } from 'vue-router';
|
|
3
|
+
import { GraspAccountSettings, GraspAuthFlow, GraspBillingPanel, GraspShellLayout, } from './components.js';
|
|
4
|
+
import { useAuthStore } from './stores.js';
|
|
5
|
+
export function defineFeatureRoutes(routes) {
|
|
6
|
+
return Object.freeze([...routes]);
|
|
7
|
+
}
|
|
8
|
+
function resolveSafeRedirect(candidate, fallback) {
|
|
9
|
+
if (typeof candidate === 'string' && candidate.startsWith('/') && !candidate.startsWith('//')) {
|
|
10
|
+
return candidate;
|
|
11
|
+
}
|
|
12
|
+
return fallback;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Builds the standardized Grasp Vue Router with built-in `/`, `/login`, `/settings`, `/billing`
|
|
16
|
+
* routes plus automatic auth and `minPlan` route guards.
|
|
17
|
+
*/
|
|
18
|
+
export function createGraspRouter(options) {
|
|
19
|
+
const authenticatedHome = options.authenticatedHome ?? '/settings';
|
|
20
|
+
const layoutComponent = options.layoutComponent ?? GraspShellLayout;
|
|
21
|
+
const loginComponent = options.loginComponent ?? GraspAuthFlow;
|
|
22
|
+
const routes = [
|
|
23
|
+
{
|
|
24
|
+
path: '/',
|
|
25
|
+
name: 'grasp-landing',
|
|
26
|
+
component: options.landingComponent,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
path: '/login',
|
|
30
|
+
name: 'grasp-login',
|
|
31
|
+
component: loginComponent,
|
|
32
|
+
meta: { guestOnly: true },
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
path: '/_app',
|
|
36
|
+
component: layoutComponent,
|
|
37
|
+
meta: { auth: 'required' },
|
|
38
|
+
children: [
|
|
39
|
+
{
|
|
40
|
+
path: '/settings',
|
|
41
|
+
name: 'grasp-settings',
|
|
42
|
+
component: GraspAccountSettings,
|
|
43
|
+
meta: { auth: 'required' },
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
path: '/billing',
|
|
47
|
+
name: 'grasp-billing',
|
|
48
|
+
component: GraspBillingPanel,
|
|
49
|
+
meta: { auth: 'required' },
|
|
50
|
+
},
|
|
51
|
+
...options.featureRoutes,
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
const router = createRouter({
|
|
56
|
+
history: options.history ?? createWebHistory(),
|
|
57
|
+
routes,
|
|
58
|
+
});
|
|
59
|
+
router.beforeEach(async (to) => {
|
|
60
|
+
const auth = useAuthStore();
|
|
61
|
+
if (!auth.ready) {
|
|
62
|
+
await auth.bootstrap();
|
|
63
|
+
}
|
|
64
|
+
const requiresAuth = to.matched.some((record) => record.meta['auth'] === 'required');
|
|
65
|
+
const guestOnly = to.matched.some((record) => record.meta['guestOnly'] === true);
|
|
66
|
+
if (requiresAuth && !auth.isAuthenticated) {
|
|
67
|
+
return {
|
|
68
|
+
path: '/login',
|
|
69
|
+
query: { redirect: to.fullPath },
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (guestOnly && auth.isAuthenticated) {
|
|
73
|
+
return resolveSafeRedirect(to.query['redirect'], authenticatedHome);
|
|
74
|
+
}
|
|
75
|
+
const requiredPlanRecord = to.matched.find((record) => typeof record.meta['minPlan'] === 'string');
|
|
76
|
+
if (requiredPlanRecord) {
|
|
77
|
+
const minPlan = requiredPlanRecord.meta['minPlan'];
|
|
78
|
+
const currentPlan = auth.entitlement?.planId ?? 'free';
|
|
79
|
+
const currentRank = getPlanRank(options.config.billing, currentPlan);
|
|
80
|
+
const requiredRank = getPlanRank(options.config.billing, minPlan);
|
|
81
|
+
if (requiredRank >= 0 && currentRank < requiredRank) {
|
|
82
|
+
return {
|
|
83
|
+
path: '/billing',
|
|
84
|
+
query: { upgrade: minPlan },
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return true;
|
|
89
|
+
});
|
|
90
|
+
return router;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=router.js.map
|