@amogads/ui 1.0.2 → 1.1.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/README.md +295 -287
- package/dist/index.d.ts +1 -952
- package/dist/index.js +4446 -1698
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4108 -1281
- package/dist/index.mjs.map +1 -1
- package/dist/pages.d.ts +16 -0
- package/dist/pages.js +40135 -0
- package/dist/pages.js.map +1 -0
- package/dist/pages.mjs +40482 -0
- package/dist/pages.mjs.map +1 -0
- package/dist/sdk.d.ts +1 -0
- package/dist/sdk.js +520 -0
- package/dist/sdk.js.map +1 -0
- package/dist/sdk.mjs +476 -0
- package/dist/sdk.mjs.map +1 -0
- package/dist/server.d.ts +20 -0
- package/dist/server.js +2713 -0
- package/dist/server.js.map +1 -0
- package/dist/server.mjs +2662 -0
- package/dist/server.mjs.map +1 -0
- package/dist/services.d.ts +1 -0
- package/dist/services.js +2042 -0
- package/dist/services.js.map +1 -0
- package/dist/services.mjs +1983 -0
- package/dist/services.mjs.map +1 -0
- package/dist/stores.d.ts +1 -0
- package/dist/stores.js +559 -0
- package/dist/stores.js.map +1 -0
- package/dist/stores.mjs +531 -0
- package/dist/stores.mjs.map +1 -0
- package/dist/tokens.d.ts +1 -56
- package/dist/tokens.js +0 -1
- package/dist/tokens.js.map +1 -1
- package/package.json +257 -232
- package/dist/index.d.mts +0 -952
- package/dist/tokens.d.mts +0 -56
package/dist/stores.mjs
ADDED
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
// src/stores/auth-store.ts
|
|
4
|
+
import { create } from "zustand";
|
|
5
|
+
|
|
6
|
+
// src/lib/cookies.ts
|
|
7
|
+
var DEFAULT_MAX_AGE = 60 * 60 * 24 * 7;
|
|
8
|
+
function getCookie(name) {
|
|
9
|
+
if (typeof document === "undefined") return void 0;
|
|
10
|
+
const value = `; ${document.cookie}`;
|
|
11
|
+
const parts = value.split(`; ${name}=`);
|
|
12
|
+
if (parts.length === 2) {
|
|
13
|
+
const cookieValue = parts.pop()?.split(";").shift();
|
|
14
|
+
return cookieValue;
|
|
15
|
+
}
|
|
16
|
+
return void 0;
|
|
17
|
+
}
|
|
18
|
+
function setCookie(name, value, maxAge = DEFAULT_MAX_AGE) {
|
|
19
|
+
if (typeof document === "undefined") return;
|
|
20
|
+
document.cookie = `${name}=${value}; path=/; max-age=${maxAge}`;
|
|
21
|
+
}
|
|
22
|
+
function removeCookie(name) {
|
|
23
|
+
if (typeof document === "undefined") return;
|
|
24
|
+
document.cookie = `${name}=; path=/; max-age=0`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// src/stores/auth-store.ts
|
|
28
|
+
var ACCESS_TOKEN = "thisisjustarandomstring";
|
|
29
|
+
var USER_DATA = "auth_user_data";
|
|
30
|
+
var useAuthStore = create()((set) => {
|
|
31
|
+
const cookieState = getCookie(ACCESS_TOKEN);
|
|
32
|
+
let initToken = "";
|
|
33
|
+
if (cookieState) {
|
|
34
|
+
try {
|
|
35
|
+
initToken = JSON.parse(cookieState);
|
|
36
|
+
} catch {
|
|
37
|
+
removeCookie(ACCESS_TOKEN);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const userCookie = getCookie(USER_DATA);
|
|
41
|
+
let initUser = null;
|
|
42
|
+
if (userCookie) {
|
|
43
|
+
try {
|
|
44
|
+
const parsed = JSON.parse(decodeURIComponent(userCookie));
|
|
45
|
+
if (parsed.exp && parsed.exp > Date.now()) {
|
|
46
|
+
initUser = parsed;
|
|
47
|
+
} else {
|
|
48
|
+
removeCookie(ACCESS_TOKEN);
|
|
49
|
+
removeCookie(USER_DATA);
|
|
50
|
+
}
|
|
51
|
+
} catch {
|
|
52
|
+
initUser = null;
|
|
53
|
+
removeCookie(USER_DATA);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
auth: {
|
|
58
|
+
user: initUser,
|
|
59
|
+
setUser: (user) => set((state) => {
|
|
60
|
+
if (user) {
|
|
61
|
+
setCookie(USER_DATA, encodeURIComponent(JSON.stringify(user)));
|
|
62
|
+
} else {
|
|
63
|
+
removeCookie(USER_DATA);
|
|
64
|
+
}
|
|
65
|
+
return { ...state, auth: { ...state.auth, user } };
|
|
66
|
+
}),
|
|
67
|
+
accessToken: initUser ? initToken : "",
|
|
68
|
+
setAccessToken: (accessToken) => set((state) => {
|
|
69
|
+
setCookie(ACCESS_TOKEN, JSON.stringify(accessToken));
|
|
70
|
+
return { ...state, auth: { ...state.auth, accessToken } };
|
|
71
|
+
}),
|
|
72
|
+
resetAccessToken: () => set((state) => {
|
|
73
|
+
removeCookie(ACCESS_TOKEN);
|
|
74
|
+
return { ...state, auth: { ...state.auth, accessToken: "" } };
|
|
75
|
+
}),
|
|
76
|
+
reset: () => set((state) => {
|
|
77
|
+
removeCookie(ACCESS_TOKEN);
|
|
78
|
+
removeCookie(USER_DATA);
|
|
79
|
+
return {
|
|
80
|
+
...state,
|
|
81
|
+
auth: { ...state.auth, user: null, accessToken: "" }
|
|
82
|
+
};
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// src/stores/notification-store.ts
|
|
89
|
+
import { create as create2 } from "zustand";
|
|
90
|
+
|
|
91
|
+
// src/lib/supabase/client.ts
|
|
92
|
+
import { createBrowserClient } from "@supabase/ssr";
|
|
93
|
+
var clientSingleton = null;
|
|
94
|
+
function createClient() {
|
|
95
|
+
if (typeof window === "undefined") {
|
|
96
|
+
return createBrowserClient(
|
|
97
|
+
process.env.NEXT_PUBLIC_SUPABASE_URL,
|
|
98
|
+
process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
if (!clientSingleton) {
|
|
102
|
+
clientSingleton = createBrowserClient(
|
|
103
|
+
process.env.NEXT_PUBLIC_SUPABASE_URL,
|
|
104
|
+
process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
return clientSingleton;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// src/stores/notification-store.ts
|
|
111
|
+
var activeChannel = null;
|
|
112
|
+
var useNotificationStore = create2((set, get) => ({
|
|
113
|
+
notifications: [],
|
|
114
|
+
unreadCount: 0,
|
|
115
|
+
isLoading: false,
|
|
116
|
+
fetchNotifications: async (userId) => {
|
|
117
|
+
set({ isLoading: true });
|
|
118
|
+
const supabase = createClient();
|
|
119
|
+
try {
|
|
120
|
+
const { data, error } = await supabase.from("notifications").select("*").eq("user_id", userId).order("created_at", { ascending: false });
|
|
121
|
+
if (error) throw error;
|
|
122
|
+
const notifications = data || [];
|
|
123
|
+
const unreadCount = notifications.filter((n) => !n.read).length;
|
|
124
|
+
set({ notifications, unreadCount });
|
|
125
|
+
} catch (e) {
|
|
126
|
+
console.error("[NotificationStore] Failed to fetch notifications:", e);
|
|
127
|
+
} finally {
|
|
128
|
+
set({ isLoading: false });
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
markAsRead: async (notificationId) => {
|
|
132
|
+
const supabase = createClient();
|
|
133
|
+
try {
|
|
134
|
+
const { error } = await supabase.from("notifications").update({ read: true }).eq("id", notificationId);
|
|
135
|
+
if (error) throw error;
|
|
136
|
+
set((state) => {
|
|
137
|
+
const updated = state.notifications.map(
|
|
138
|
+
(n) => n.id === notificationId ? { ...n, read: true } : n
|
|
139
|
+
);
|
|
140
|
+
const unreadCount = updated.filter((n) => !n.read).length;
|
|
141
|
+
return { notifications: updated, unreadCount };
|
|
142
|
+
});
|
|
143
|
+
} catch (e) {
|
|
144
|
+
console.error("[NotificationStore] Failed to mark notification as read:", e);
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
markAllAsRead: async (userId) => {
|
|
148
|
+
const supabase = createClient();
|
|
149
|
+
try {
|
|
150
|
+
const { error } = await supabase.from("notifications").update({ read: true }).eq("user_id", userId).eq("read", false);
|
|
151
|
+
if (error) throw error;
|
|
152
|
+
set((state) => {
|
|
153
|
+
const updated = state.notifications.map((n) => ({ ...n, read: true }));
|
|
154
|
+
return { notifications: updated, unreadCount: 0 };
|
|
155
|
+
});
|
|
156
|
+
} catch (e) {
|
|
157
|
+
console.error("[NotificationStore] Failed to mark all notifications as read:", e);
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
deleteNotification: async (notificationId) => {
|
|
161
|
+
const supabase = createClient();
|
|
162
|
+
try {
|
|
163
|
+
const { error } = await supabase.from("notifications").delete().eq("id", notificationId);
|
|
164
|
+
if (error) throw error;
|
|
165
|
+
set((state) => {
|
|
166
|
+
const updated = state.notifications.filter((n) => n.id !== notificationId);
|
|
167
|
+
const unreadCount = updated.filter((n) => !n.read).length;
|
|
168
|
+
return { notifications: updated, unreadCount };
|
|
169
|
+
});
|
|
170
|
+
} catch (e) {
|
|
171
|
+
console.error("[NotificationStore] Failed to delete notification:", e);
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
subscribeToNotifications: (userId) => {
|
|
175
|
+
try {
|
|
176
|
+
if (!userId) return;
|
|
177
|
+
const supabase = createClient();
|
|
178
|
+
if (activeChannel && activeUserId === userId) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (activeChannel) {
|
|
182
|
+
try {
|
|
183
|
+
supabase.removeChannel(activeChannel);
|
|
184
|
+
} catch (_) {
|
|
185
|
+
}
|
|
186
|
+
activeChannel = null;
|
|
187
|
+
activeUserId = null;
|
|
188
|
+
}
|
|
189
|
+
const channelTopic = `notifications-user-${userId}-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
|
|
190
|
+
const channel = supabase.channel(channelTopic);
|
|
191
|
+
channel.on(
|
|
192
|
+
"postgres_changes",
|
|
193
|
+
{
|
|
194
|
+
event: "*",
|
|
195
|
+
schema: "public",
|
|
196
|
+
table: "notifications",
|
|
197
|
+
filter: `user_id=eq.${userId}`
|
|
198
|
+
},
|
|
199
|
+
(payload) => {
|
|
200
|
+
const { eventType, new: newRecord, old: oldRecord } = payload;
|
|
201
|
+
if (eventType === "INSERT") {
|
|
202
|
+
const inserted = newRecord;
|
|
203
|
+
set((state) => {
|
|
204
|
+
if (state.notifications.some((n) => n.id === inserted.id)) {
|
|
205
|
+
return {};
|
|
206
|
+
}
|
|
207
|
+
const updated = [inserted, ...state.notifications];
|
|
208
|
+
const unreadCount = updated.filter((n) => !n.read).length;
|
|
209
|
+
return { notifications: updated, unreadCount };
|
|
210
|
+
});
|
|
211
|
+
} else if (eventType === "UPDATE") {
|
|
212
|
+
const updatedRecord = newRecord;
|
|
213
|
+
set((state) => {
|
|
214
|
+
const updated = state.notifications.map(
|
|
215
|
+
(n) => n.id === updatedRecord.id ? updatedRecord : n
|
|
216
|
+
);
|
|
217
|
+
const unreadCount = updated.filter((n) => !n.read).length;
|
|
218
|
+
return { notifications: updated, unreadCount };
|
|
219
|
+
});
|
|
220
|
+
} else if (eventType === "DELETE") {
|
|
221
|
+
const deletedId = oldRecord?.id;
|
|
222
|
+
if (!deletedId) return;
|
|
223
|
+
set((state) => {
|
|
224
|
+
const updated = state.notifications.filter((n) => n.id !== deletedId);
|
|
225
|
+
const unreadCount = updated.filter((n) => !n.read).length;
|
|
226
|
+
return { notifications: updated, unreadCount };
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
).subscribe();
|
|
231
|
+
activeChannel = channel;
|
|
232
|
+
activeUserId = userId;
|
|
233
|
+
} catch (err) {
|
|
234
|
+
console.warn("[NotificationStore] Realtime subscription error:", err);
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
unsubscribe: () => {
|
|
238
|
+
try {
|
|
239
|
+
if (activeChannel) {
|
|
240
|
+
const supabase = createClient();
|
|
241
|
+
supabase.removeChannel(activeChannel);
|
|
242
|
+
activeChannel = null;
|
|
243
|
+
activeUserId = null;
|
|
244
|
+
}
|
|
245
|
+
} catch (err) {
|
|
246
|
+
console.warn("[NotificationStore] Unsubscribe error:", err);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}));
|
|
250
|
+
|
|
251
|
+
// src/stores/voucher-store.ts
|
|
252
|
+
import { create as create3 } from "zustand";
|
|
253
|
+
import { persist } from "zustand/middleware";
|
|
254
|
+
var useVoucherStore = create3()(
|
|
255
|
+
persist(
|
|
256
|
+
(set) => ({
|
|
257
|
+
vouchers: [],
|
|
258
|
+
selectedVoucher: null,
|
|
259
|
+
dbLoaded: false,
|
|
260
|
+
setSelectedVoucher: (voucher) => set({ selectedVoucher: voucher }),
|
|
261
|
+
setDbLoaded: (v) => set({ dbLoaded: v }),
|
|
262
|
+
setVouchers: (vouchers) => set((state) => {
|
|
263
|
+
const map = /* @__PURE__ */ new Map();
|
|
264
|
+
const getFileKey = (v) => {
|
|
265
|
+
const name = (v.fileName || "").toLowerCase().trim();
|
|
266
|
+
const url = (v.originalFileUrl || v.editedFileUrl || v.pdfUrl || "").trim();
|
|
267
|
+
if (name && url) return `${name}_${url}`;
|
|
268
|
+
if (name) return name;
|
|
269
|
+
return v.id;
|
|
270
|
+
};
|
|
271
|
+
for (const v of vouchers) {
|
|
272
|
+
const key = getFileKey(v);
|
|
273
|
+
if (key) map.set(key, v);
|
|
274
|
+
}
|
|
275
|
+
for (const v of state.vouchers) {
|
|
276
|
+
const key = getFileKey(v);
|
|
277
|
+
if (key && !map.has(key)) map.set(key, v);
|
|
278
|
+
}
|
|
279
|
+
const merged = Array.from(map.values()).sort((a, b) => {
|
|
280
|
+
const timeA = a.createdAt ? new Date(a.createdAt).getTime() : 0;
|
|
281
|
+
const timeB = b.createdAt ? new Date(b.createdAt).getTime() : 0;
|
|
282
|
+
return timeB - timeA;
|
|
283
|
+
});
|
|
284
|
+
return { vouchers: merged };
|
|
285
|
+
}),
|
|
286
|
+
addVoucher: (data) => {
|
|
287
|
+
const fileUrlToUse = data.pdfUrl || data.editedFileUrl || data.originalFileUrl;
|
|
288
|
+
const newVoucher = {
|
|
289
|
+
...data,
|
|
290
|
+
pdfUrl: fileUrlToUse,
|
|
291
|
+
id: `voucher-${Date.now()}`,
|
|
292
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
293
|
+
};
|
|
294
|
+
set((state) => ({
|
|
295
|
+
vouchers: [newVoucher, ...state.vouchers],
|
|
296
|
+
selectedVoucher: newVoucher
|
|
297
|
+
}));
|
|
298
|
+
return newVoucher;
|
|
299
|
+
},
|
|
300
|
+
updateVoucher: (id, updates) => {
|
|
301
|
+
set((state) => ({
|
|
302
|
+
vouchers: state.vouchers.map(
|
|
303
|
+
(v) => v.id === id ? { ...v, ...updates } : v
|
|
304
|
+
),
|
|
305
|
+
selectedVoucher: state.selectedVoucher?.id === id ? { ...state.selectedVoucher, ...updates } : state.selectedVoucher
|
|
306
|
+
}));
|
|
307
|
+
},
|
|
308
|
+
deleteVoucher: (id) => {
|
|
309
|
+
set((state) => ({
|
|
310
|
+
vouchers: state.vouchers.filter((v) => v.id !== id),
|
|
311
|
+
selectedVoucher: state.selectedVoucher?.id === id ? null : state.selectedVoucher
|
|
312
|
+
}));
|
|
313
|
+
}
|
|
314
|
+
}),
|
|
315
|
+
{
|
|
316
|
+
name: "vouchers-storage-v4",
|
|
317
|
+
partialize: (state) => ({
|
|
318
|
+
// Do NOT persist vouchers array globally in localStorage to prevent user data leakage across accounts
|
|
319
|
+
selectedVoucher: null
|
|
320
|
+
})
|
|
321
|
+
}
|
|
322
|
+
)
|
|
323
|
+
);
|
|
324
|
+
|
|
325
|
+
// src/features/link-maker/store.ts
|
|
326
|
+
import { create as create4 } from "zustand";
|
|
327
|
+
import { persist as persist2 } from "zustand/middleware";
|
|
328
|
+
var DEFAULT_CONFIG = {
|
|
329
|
+
profile: {
|
|
330
|
+
name: "Alex Rivera",
|
|
331
|
+
bio: "Senior UX Architect & Tech Writer | Crafting digital experiences \u2728",
|
|
332
|
+
avatarUrl: ""
|
|
333
|
+
},
|
|
334
|
+
links: [],
|
|
335
|
+
socials: [],
|
|
336
|
+
theme: {
|
|
337
|
+
preset: "custom",
|
|
338
|
+
appTheme: "system",
|
|
339
|
+
appColorTheme: "zinc"
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
var useLinkMakerStore = create4()(
|
|
343
|
+
persist2(
|
|
344
|
+
(set, get) => ({
|
|
345
|
+
config: DEFAULT_CONFIG,
|
|
346
|
+
projects: [],
|
|
347
|
+
activeProjectId: null,
|
|
348
|
+
activeShortUrl: null,
|
|
349
|
+
activeShortUrlSuffix: null,
|
|
350
|
+
activeExpiresAt: null,
|
|
351
|
+
updateProfile: (profileUpdates) => set((state) => ({
|
|
352
|
+
config: {
|
|
353
|
+
...state.config,
|
|
354
|
+
profile: {
|
|
355
|
+
...state.config.profile,
|
|
356
|
+
...profileUpdates
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
})),
|
|
360
|
+
addLink: () => set((state) => {
|
|
361
|
+
const newLink = {
|
|
362
|
+
id: `link-${Date.now()}`,
|
|
363
|
+
title: "New Social Link",
|
|
364
|
+
url: "https://",
|
|
365
|
+
icon: "Link2",
|
|
366
|
+
isEnabled: true,
|
|
367
|
+
animation: "none"
|
|
368
|
+
};
|
|
369
|
+
return {
|
|
370
|
+
config: {
|
|
371
|
+
...state.config,
|
|
372
|
+
links: [...state.config.links, newLink]
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
}),
|
|
376
|
+
updateLink: (id, updates) => set((state) => ({
|
|
377
|
+
config: {
|
|
378
|
+
...state.config,
|
|
379
|
+
links: state.config.links.map(
|
|
380
|
+
(link) => link.id === id ? { ...link, ...updates } : link
|
|
381
|
+
)
|
|
382
|
+
}
|
|
383
|
+
})),
|
|
384
|
+
removeLink: (id) => set((state) => ({
|
|
385
|
+
config: {
|
|
386
|
+
...state.config,
|
|
387
|
+
links: state.config.links.filter((link) => link.id !== id)
|
|
388
|
+
}
|
|
389
|
+
})),
|
|
390
|
+
reorderLinks: (index, direction) => set((state) => {
|
|
391
|
+
const links = [...state.config.links];
|
|
392
|
+
const targetIndex = direction === "up" ? index - 1 : index + 1;
|
|
393
|
+
if (targetIndex < 0 || targetIndex >= links.length) {
|
|
394
|
+
return {};
|
|
395
|
+
}
|
|
396
|
+
const temp = links[index];
|
|
397
|
+
links[index] = links[targetIndex];
|
|
398
|
+
links[targetIndex] = temp;
|
|
399
|
+
return {
|
|
400
|
+
config: {
|
|
401
|
+
...state.config,
|
|
402
|
+
links
|
|
403
|
+
}
|
|
404
|
+
};
|
|
405
|
+
}),
|
|
406
|
+
updateSocial: (platform, url, isEnabled) => set((state) => {
|
|
407
|
+
const platformExists = state.config.socials.some((s) => s.platform === platform);
|
|
408
|
+
let socials = [];
|
|
409
|
+
if (platformExists) {
|
|
410
|
+
socials = state.config.socials.map(
|
|
411
|
+
(s) => s.platform === platform ? { ...s, url, isEnabled } : s
|
|
412
|
+
);
|
|
413
|
+
} else {
|
|
414
|
+
socials = [...state.config.socials, { platform, url, isEnabled }];
|
|
415
|
+
}
|
|
416
|
+
return {
|
|
417
|
+
config: {
|
|
418
|
+
...state.config,
|
|
419
|
+
socials
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
}),
|
|
423
|
+
updateTheme: (themeUpdates) => set((state) => ({
|
|
424
|
+
config: {
|
|
425
|
+
...state.config,
|
|
426
|
+
theme: {
|
|
427
|
+
...state.config.theme,
|
|
428
|
+
...themeUpdates
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
})),
|
|
432
|
+
saveProject: (name) => {
|
|
433
|
+
const state = get();
|
|
434
|
+
const projectId = state.activeProjectId || `proj-${Date.now()}`;
|
|
435
|
+
const projectName = name || (state.activeProjectId ? state.projects.find((p) => p.id === state.activeProjectId)?.name || "My Link Tree" : "My Link Tree");
|
|
436
|
+
const existingProject = state.projects.find((p) => p.id === projectId);
|
|
437
|
+
const updatedProject = {
|
|
438
|
+
id: projectId,
|
|
439
|
+
name: projectName,
|
|
440
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
441
|
+
config: state.config,
|
|
442
|
+
shortUrl: state.activeShortUrl || existingProject?.shortUrl,
|
|
443
|
+
shortUrlSuffix: state.activeShortUrlSuffix || existingProject?.shortUrlSuffix,
|
|
444
|
+
expiresAt: state.activeExpiresAt || existingProject?.expiresAt
|
|
445
|
+
};
|
|
446
|
+
const projectIndex = state.projects.findIndex((p) => p.id === projectId);
|
|
447
|
+
let updatedProjects = [...state.projects];
|
|
448
|
+
if (projectIndex >= 0) {
|
|
449
|
+
updatedProjects[projectIndex] = updatedProject;
|
|
450
|
+
} else {
|
|
451
|
+
updatedProjects.push(updatedProject);
|
|
452
|
+
}
|
|
453
|
+
set({
|
|
454
|
+
projects: updatedProjects,
|
|
455
|
+
activeProjectId: projectId
|
|
456
|
+
});
|
|
457
|
+
return projectId;
|
|
458
|
+
},
|
|
459
|
+
loadProject: (id) => {
|
|
460
|
+
const state = get();
|
|
461
|
+
const project = state.projects.find((p) => p.id === id);
|
|
462
|
+
if (project) {
|
|
463
|
+
set({
|
|
464
|
+
config: project.config,
|
|
465
|
+
activeProjectId: id,
|
|
466
|
+
activeShortUrl: project.shortUrl || null,
|
|
467
|
+
activeShortUrlSuffix: project.shortUrlSuffix || null,
|
|
468
|
+
activeExpiresAt: project.expiresAt || null
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
},
|
|
472
|
+
deleteProject: (id) => set((state) => {
|
|
473
|
+
const updatedProjects = state.projects.filter((p) => p.id !== id);
|
|
474
|
+
const wasActive = state.activeProjectId === id;
|
|
475
|
+
return {
|
|
476
|
+
projects: updatedProjects,
|
|
477
|
+
activeProjectId: wasActive ? null : state.activeProjectId,
|
|
478
|
+
config: wasActive ? DEFAULT_CONFIG : state.config,
|
|
479
|
+
activeShortUrl: wasActive ? null : state.activeShortUrl,
|
|
480
|
+
activeShortUrlSuffix: wasActive ? null : state.activeShortUrlSuffix,
|
|
481
|
+
activeExpiresAt: wasActive ? null : state.activeExpiresAt
|
|
482
|
+
};
|
|
483
|
+
}),
|
|
484
|
+
createNewProject: (name) => {
|
|
485
|
+
const id = `proj-${Date.now()}`;
|
|
486
|
+
const newProject = {
|
|
487
|
+
id,
|
|
488
|
+
name,
|
|
489
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
490
|
+
config: DEFAULT_CONFIG
|
|
491
|
+
};
|
|
492
|
+
set((state) => ({
|
|
493
|
+
projects: [...state.projects, newProject],
|
|
494
|
+
config: DEFAULT_CONFIG,
|
|
495
|
+
activeProjectId: id,
|
|
496
|
+
activeShortUrl: null,
|
|
497
|
+
activeShortUrlSuffix: null,
|
|
498
|
+
activeExpiresAt: null
|
|
499
|
+
}));
|
|
500
|
+
},
|
|
501
|
+
resetConfig: () => set({
|
|
502
|
+
config: DEFAULT_CONFIG,
|
|
503
|
+
activeProjectId: null,
|
|
504
|
+
activeShortUrl: null,
|
|
505
|
+
activeShortUrlSuffix: null,
|
|
506
|
+
activeExpiresAt: null
|
|
507
|
+
}),
|
|
508
|
+
setShortUrl: (shortUrl, suffix, expiresAt) => set((state) => {
|
|
509
|
+
const updatedProjects = state.activeProjectId ? state.projects.map(
|
|
510
|
+
(p) => p.id === state.activeProjectId ? { ...p, shortUrl, shortUrlSuffix: suffix, expiresAt } : p
|
|
511
|
+
) : state.projects;
|
|
512
|
+
return {
|
|
513
|
+
activeShortUrl: shortUrl,
|
|
514
|
+
activeShortUrlSuffix: suffix,
|
|
515
|
+
activeExpiresAt: expiresAt,
|
|
516
|
+
projects: updatedProjects
|
|
517
|
+
};
|
|
518
|
+
})
|
|
519
|
+
}),
|
|
520
|
+
{
|
|
521
|
+
name: "link-maker-workspace"
|
|
522
|
+
}
|
|
523
|
+
)
|
|
524
|
+
);
|
|
525
|
+
export {
|
|
526
|
+
useAuthStore,
|
|
527
|
+
useLinkMakerStore,
|
|
528
|
+
useNotificationStore,
|
|
529
|
+
useVoucherStore
|
|
530
|
+
};
|
|
531
|
+
//# sourceMappingURL=stores.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/stores/auth-store.ts","../src/lib/cookies.ts","../src/stores/notification-store.ts","../src/lib/supabase/client.ts","../src/stores/voucher-store.ts","../src/features/link-maker/store.ts"],"sourcesContent":["import { create } from 'zustand'\r\nimport { getCookie, setCookie, removeCookie } from '@/lib/cookies'\r\n\r\nconst ACCESS_TOKEN = 'thisisjustarandomstring'\r\nconst USER_DATA = 'auth_user_data'\r\n\r\ninterface AuthUser {\r\n id: string // 👈 ADD THIS - the auth.uid() from Supabase\r\n accountNo: string\r\n email: string\r\n name?: string\r\n picture?: string\r\n role: string[]\r\n exp: number\r\n}\r\n\r\ninterface AuthState {\r\n auth: {\r\n user: AuthUser | null\r\n setUser: (user: AuthUser | null) => void\r\n accessToken: string\r\n setAccessToken: (accessToken: string) => void\r\n resetAccessToken: () => void\r\n reset: () => void\r\n }\r\n}\r\n\r\nexport const useAuthStore = create<AuthState>()((set) => {\r\n const cookieState = getCookie(ACCESS_TOKEN)\r\n let initToken = ''\r\n if (cookieState) {\r\n try {\r\n initToken = JSON.parse(cookieState)\r\n } catch {\r\n removeCookie(ACCESS_TOKEN)\r\n }\r\n }\r\n\r\n const userCookie = getCookie(USER_DATA)\r\n let initUser: AuthUser | null = null\r\n if (userCookie) {\r\n try {\r\n const parsed = JSON.parse(decodeURIComponent(userCookie))\r\n if (parsed.exp && parsed.exp > Date.now()) {\r\n initUser = parsed\r\n } else {\r\n removeCookie(ACCESS_TOKEN)\r\n removeCookie(USER_DATA)\r\n }\r\n } catch {\r\n initUser = null\r\n removeCookie(USER_DATA)\r\n }\r\n }\r\n\r\n return {\r\n auth: {\r\n user: initUser,\r\n setUser: (user) =>\r\n set((state) => {\r\n if (user) {\r\n setCookie(USER_DATA, encodeURIComponent(JSON.stringify(user)))\r\n } else {\r\n removeCookie(USER_DATA)\r\n }\r\n return { ...state, auth: { ...state.auth, user } }\r\n }),\r\n accessToken: initUser ? initToken : '',\r\n setAccessToken: (accessToken) =>\r\n set((state) => {\r\n setCookie(ACCESS_TOKEN, JSON.stringify(accessToken))\r\n return { ...state, auth: { ...state.auth, accessToken } }\r\n }),\r\n resetAccessToken: () =>\r\n set((state) => {\r\n removeCookie(ACCESS_TOKEN)\r\n return { ...state, auth: { ...state.auth, accessToken: '' } }\r\n }),\r\n reset: () =>\r\n set((state) => {\r\n removeCookie(ACCESS_TOKEN)\r\n removeCookie(USER_DATA)\r\n return {\r\n ...state,\r\n auth: { ...state.auth, user: null, accessToken: '' },\r\n }\r\n }),\r\n },\r\n }\r\n})","/**\r\n * Cookie utility functions using manual document.cookie approach\r\n * Replaces js-cookie dependency for better consistency\r\n */\r\n\r\nconst DEFAULT_MAX_AGE = 60 * 60 * 24 * 7 // 7 days\r\n\r\n/**\r\n * Get a cookie value by name\r\n */\r\nexport function getCookie(name: string): string | undefined {\r\n if (typeof document === 'undefined') return undefined\r\n\r\n const value = `; ${document.cookie}`\r\n const parts = value.split(`; ${name}=`)\r\n if (parts.length === 2) {\r\n const cookieValue = parts.pop()?.split(';').shift()\r\n return cookieValue\r\n }\r\n return undefined\r\n}\r\n\r\n/**\r\n * Set a cookie with name, value, and optional max age\r\n */\r\nexport function setCookie(\r\n name: string,\r\n value: string,\r\n maxAge: number = DEFAULT_MAX_AGE\r\n): void {\r\n if (typeof document === 'undefined') return\r\n\r\n document.cookie = `${name}=${value}; path=/; max-age=${maxAge}`\r\n}\r\n\r\n/**\r\n * Remove a cookie by setting its max age to 0\r\n */\r\nexport function removeCookie(name: string): void {\r\n if (typeof document === 'undefined') return\r\n\r\n document.cookie = `${name}=; path=/; max-age=0`\r\n}\r\n","import { create } from 'zustand'\r\nimport { createClient } from '@/lib/supabase/client'\r\nimport { RealtimeChannel } from '@supabase/supabase-js'\r\n\r\nexport interface DbNotification {\r\n id: string\r\n user_id: string\r\n sender_id: string | null\r\n message_id: string | null\r\n message_text: string\r\n read: boolean\r\n created_at: string\r\n}\r\n\r\ninterface NotificationState {\r\n notifications: DbNotification[]\r\n unreadCount: number\r\n isLoading: boolean\r\n fetchNotifications: (userId: string) => Promise<void>\r\n markAsRead: (notificationId: string) => Promise<void>\r\n markAllAsRead: (userId: string) => Promise<void>\r\n deleteNotification: (notificationId: string) => Promise<void>\r\n subscribeToNotifications: (userId: string) => void\r\n unsubscribe: () => void\r\n}\r\n\r\nlet activeChannel: RealtimeChannel | null = null\r\n\r\nexport const useNotificationStore = create<NotificationState>((set, get) => ({\r\n notifications: [],\r\n unreadCount: 0,\r\n isLoading: false,\r\n\r\n fetchNotifications: async (userId: string) => {\r\n set({ isLoading: true })\r\n const supabase = createClient()\r\n try {\r\n const { data, error } = await supabase\r\n .from('notifications')\r\n .select('*')\r\n .eq('user_id', userId)\r\n .order('created_at', { ascending: false })\r\n\r\n if (error) throw error\r\n\r\n const notifications = data || []\r\n const unreadCount = notifications.filter((n: DbNotification) => !n.read).length\r\n set({ notifications, unreadCount })\r\n } catch (e) {\r\n console.error('[NotificationStore] Failed to fetch notifications:', e)\r\n } finally {\r\n set({ isLoading: false })\r\n }\r\n },\r\n\r\n markAsRead: async (notificationId: string) => {\r\n const supabase = createClient()\r\n try {\r\n const { error } = await supabase\r\n .from('notifications')\r\n .update({ read: true })\r\n .eq('id', notificationId)\r\n\r\n if (error) throw error\r\n\r\n set((state) => {\r\n const updated = state.notifications.map((n) =>\r\n n.id === notificationId ? { ...n, read: true } : n\r\n )\r\n const unreadCount = updated.filter((n) => !n.read).length\r\n return { notifications: updated, unreadCount }\r\n })\r\n } catch (e) {\r\n console.error('[NotificationStore] Failed to mark notification as read:', e)\r\n }\r\n },\r\n\r\n markAllAsRead: async (userId: string) => {\r\n const supabase = createClient()\r\n try {\r\n const { error } = await supabase\r\n .from('notifications')\r\n .update({ read: true })\r\n .eq('user_id', userId)\r\n .eq('read', false)\r\n\r\n if (error) throw error\r\n\r\n set((state) => {\r\n const updated = state.notifications.map((n) => ({ ...n, read: true }))\r\n return { notifications: updated, unreadCount: 0 }\r\n })\r\n } catch (e) {\r\n console.error('[NotificationStore] Failed to mark all notifications as read:', e)\r\n }\r\n },\r\n\r\n deleteNotification: async (notificationId: string) => {\r\n const supabase = createClient()\r\n try {\r\n const { error } = await supabase\r\n .from('notifications')\r\n .delete()\r\n .eq('id', notificationId)\r\n\r\n if (error) throw error\r\n\r\n set((state) => {\r\n const updated = state.notifications.filter((n) => n.id !== notificationId)\r\n const unreadCount = updated.filter((n) => !n.read).length\r\n return { notifications: updated, unreadCount }\r\n })\r\n } catch (e) {\r\n console.error('[NotificationStore] Failed to delete notification:', e)\r\n }\r\n },\r\n\r\n subscribeToNotifications: (userId: string) => {\r\n try {\r\n if (!userId) return\r\n\r\n const supabase = createClient()\r\n\r\n if (activeChannel && activeUserId === userId) {\r\n return\r\n }\r\n\r\n if (activeChannel) {\r\n try {\r\n supabase.removeChannel(activeChannel)\r\n } catch (_) {}\r\n activeChannel = null\r\n activeUserId = null\r\n }\r\n\r\n const channelTopic = `notifications-user-${userId}-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`\r\n const channel = supabase.channel(channelTopic)\r\n\r\n channel\r\n .on(\r\n 'postgres_changes',\r\n {\r\n event: '*',\r\n schema: 'public',\r\n table: 'notifications',\r\n filter: `user_id=eq.${userId}`,\r\n },\r\n (payload: any) => {\r\n const { eventType, new: newRecord, old: oldRecord } = payload\r\n\r\n if (eventType === 'INSERT') {\r\n const inserted = newRecord as DbNotification\r\n set((state) => {\r\n if (state.notifications.some((n) => n.id === inserted.id)) {\r\n return {}\r\n }\r\n const updated = [inserted, ...state.notifications]\r\n const unreadCount = updated.filter((n) => !n.read).length\r\n return { notifications: updated, unreadCount }\r\n })\r\n } else if (eventType === 'UPDATE') {\r\n const updatedRecord = newRecord as DbNotification\r\n set((state) => {\r\n const updated = state.notifications.map((n) =>\r\n n.id === updatedRecord.id ? updatedRecord : n\r\n )\r\n const unreadCount = updated.filter((n) => !n.read).length\r\n return { notifications: updated, unreadCount }\r\n })\r\n } else if (eventType === 'DELETE') {\r\n const deletedId = oldRecord?.id\r\n if (!deletedId) return\r\n set((state) => {\r\n const updated = state.notifications.filter((n) => n.id !== deletedId)\r\n const unreadCount = updated.filter((n) => !n.read).length\r\n return { notifications: updated, unreadCount }\r\n })\r\n }\r\n }\r\n )\r\n .subscribe()\r\n\r\n activeChannel = channel\r\n activeUserId = userId\r\n } catch (err) {\r\n console.warn('[NotificationStore] Realtime subscription error:', err)\r\n }\r\n },\r\n\r\n unsubscribe: () => {\r\n try {\r\n if (activeChannel) {\r\n const supabase = createClient()\r\n supabase.removeChannel(activeChannel)\r\n activeChannel = null\r\n activeUserId = null\r\n }\r\n } catch (err) {\r\n console.warn('[NotificationStore] Unsubscribe error:', err)\r\n }\r\n },\r\n}))\r\n","import { createBrowserClient } from '@supabase/ssr'\r\n\r\nlet clientSingleton: ReturnType<typeof createBrowserClient> | null = null\r\n\r\nexport function createClient() {\r\n if (typeof window === 'undefined') {\r\n return createBrowserClient(\r\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\r\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!\r\n )\r\n }\r\n\r\n if (!clientSingleton) {\r\n clientSingleton = createBrowserClient(\r\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\r\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!\r\n )\r\n }\r\n return clientSingleton;\r\n}\r\n","import { create } from 'zustand'\nimport { persist } from 'zustand/middleware'\n\nexport interface SavedVoucher {\n id: string\n voucherNo: string\n date: string\n from: string\n userName: string\n status: 'Active' | 'Redeemed' | 'Expired'\n fileName: string\n pdfUrl?: string\n editedJson?: any\n createdAt: string\n // DB-specific fields\n originalFileUrl?: string\n editedFileUrl?: string\n dbId?: string\n _selectedAt?: number\n}\n\ninterface VoucherStoreState {\n // Local vouchers (from DB fetch or local persist fallback)\n vouchers: SavedVoucher[]\n selectedVoucher: SavedVoucher | null\n dbLoaded: boolean\n\n setSelectedVoucher: (voucher: SavedVoucher | null) => void\n setVouchers: (vouchers: SavedVoucher[]) => void\n addVoucher: (voucher: Omit<SavedVoucher, 'id' | 'createdAt'>) => SavedVoucher\n updateVoucher: (id: string, updates: Partial<SavedVoucher>) => void\n deleteVoucher: (id: string) => void\n setDbLoaded: (v: boolean) => void\n}\n\nexport const useVoucherStore = create<VoucherStoreState>()(\n persist(\n (set) => ({\n vouchers: [],\n selectedVoucher: null,\n dbLoaded: false,\n setSelectedVoucher: (voucher) => set({ selectedVoucher: voucher }),\n setDbLoaded: (v) => set({ dbLoaded: v }),\n\n setVouchers: (vouchers) =>\n set((state) => {\n const map = new Map<string, SavedVoucher>()\n const getFileKey = (v: SavedVoucher) => {\n const name = (v.fileName || '').toLowerCase().trim()\n const url = (v.originalFileUrl || v.editedFileUrl || v.pdfUrl || '').trim()\n if (name && url) return `${name}_${url}`\n if (name) return name\n return v.id\n }\n\n for (const v of vouchers) {\n const key = getFileKey(v)\n if (key) map.set(key, v)\n }\n for (const v of state.vouchers) {\n const key = getFileKey(v)\n if (key && !map.has(key)) map.set(key, v)\n }\n const merged = Array.from(map.values()).sort((a, b) => {\n const timeA = a.createdAt ? new Date(a.createdAt).getTime() : 0\n const timeB = b.createdAt ? new Date(b.createdAt).getTime() : 0\n return timeB - timeA\n })\n return { vouchers: merged }\n }),\n\n addVoucher: (data) => {\n const fileUrlToUse = data.pdfUrl || data.editedFileUrl || data.originalFileUrl\n const newVoucher: SavedVoucher = {\n ...data,\n pdfUrl: fileUrlToUse,\n id: `voucher-${Date.now()}`,\n createdAt: new Date().toISOString(),\n }\n set((state) => ({\n vouchers: [newVoucher, ...state.vouchers],\n selectedVoucher: newVoucher,\n }))\n return newVoucher\n },\n\n updateVoucher: (id, updates) => {\n set((state) => ({\n vouchers: state.vouchers.map((v) =>\n v.id === id ? { ...v, ...updates } : v\n ),\n selectedVoucher:\n state.selectedVoucher?.id === id\n ? { ...state.selectedVoucher, ...updates }\n : state.selectedVoucher,\n }))\n },\n\n deleteVoucher: (id) => {\n set((state) => ({\n vouchers: state.vouchers.filter((v) => v.id !== id),\n selectedVoucher:\n state.selectedVoucher?.id === id ? null : state.selectedVoucher,\n }))\n },\n }),\n {\n name: 'vouchers-storage-v4',\n partialize: (state) => ({\n // Do NOT persist vouchers array globally in localStorage to prevent user data leakage across accounts\n selectedVoucher: null,\n }),\n }\n\n )\n)\n","import { create } from 'zustand'\r\nimport { persist } from 'zustand/middleware'\r\nimport { LinkTreeConfig, Project, LinkItem, SocialItem, ThemeConfig, ProfileConfig } from './types'\r\n\r\ninterface LinkMakerState {\r\n config: LinkTreeConfig\r\n projects: Project[]\r\n activeProjectId: string | null\r\n activeShortUrl: string | null\r\n activeShortUrlSuffix: string | null\r\n activeExpiresAt: string | null\r\n \r\n // Profile actions\r\n updateProfile: (profile: Partial<ProfileConfig>) => void\r\n \r\n // Link actions\r\n addLink: () => void\r\n updateLink: (id: string, updates: Partial<LinkItem>) => void\r\n removeLink: (id: string) => void\r\n reorderLinks: (index: number, direction: 'up' | 'down') => void\r\n \r\n // Social actions\r\n updateSocial: (platform: string, url: string, isEnabled: boolean) => void\r\n \r\n // Theme actions\r\n updateTheme: (themeUpdates: Partial<ThemeConfig>) => void\r\n \r\n // Project management actions\r\n saveProject: (name?: string) => string\r\n loadProject: (id: string) => void\r\n deleteProject: (id: string) => void\r\n createNewProject: (name: string) => void\r\n resetConfig: () => void\r\n\r\n // Tracking actions\r\n setShortUrl: (shortUrl: string, suffix: string, expiresAt: string) => void\r\n}\r\n\r\nconst DEFAULT_CONFIG: LinkTreeConfig = {\r\n profile: {\r\n name: 'Alex Rivera',\r\n bio: 'Senior UX Architect & Tech Writer | Crafting digital experiences ✨',\r\n avatarUrl: ''\r\n },\r\n links: [],\r\n socials: [],\r\n theme: {\r\n preset: 'custom',\r\n appTheme: 'system',\r\n appColorTheme: 'zinc'\r\n }\r\n}\r\n\r\nexport const useLinkMakerStore = create<LinkMakerState>()(\r\n persist(\r\n (set, get) => ({\r\n config: DEFAULT_CONFIG,\r\n projects: [],\r\n activeProjectId: null,\r\n activeShortUrl: null,\r\n activeShortUrlSuffix: null,\r\n activeExpiresAt: null,\r\n\r\n updateProfile: (profileUpdates) =>\r\n set((state) => ({\r\n config: {\r\n ...state.config,\r\n profile: {\r\n ...state.config.profile,\r\n ...profileUpdates\r\n }\r\n }\r\n })),\r\n\r\n addLink: () =>\r\n set((state) => {\r\n const newLink: LinkItem = {\r\n id: `link-${Date.now()}`,\r\n title: 'New Social Link',\r\n url: 'https://',\r\n icon: 'Link2',\r\n isEnabled: true,\r\n animation: 'none'\r\n }\r\n return {\r\n config: {\r\n ...state.config,\r\n links: [...state.config.links, newLink]\r\n }\r\n }\r\n }),\r\n\r\n updateLink: (id, updates) =>\r\n set((state) => ({\r\n config: {\r\n ...state.config,\r\n links: state.config.links.map((link) =>\r\n link.id === id ? { ...link, ...updates } : link\r\n )\r\n }\r\n })),\r\n\r\n removeLink: (id) =>\r\n set((state) => ({\r\n config: {\r\n ...state.config,\r\n links: state.config.links.filter((link) => link.id !== id)\r\n }\r\n })),\r\n\r\n reorderLinks: (index, direction) =>\r\n set((state) => {\r\n const links = [...state.config.links]\r\n const targetIndex = direction === 'up' ? index - 1 : index + 1\r\n \r\n if (targetIndex < 0 || targetIndex >= links.length) {\r\n return {} // Out of bounds\r\n }\r\n \r\n // Swap links\r\n const temp = links[index]\r\n links[index] = links[targetIndex]\r\n links[targetIndex] = temp\r\n \r\n return {\r\n config: {\r\n ...state.config,\r\n links\r\n }\r\n }\r\n }),\r\n\r\n updateSocial: (platform, url, isEnabled) =>\r\n set((state) => {\r\n const platformExists = state.config.socials.some((s) => s.platform === platform)\r\n let socials = []\r\n \r\n if (platformExists) {\r\n socials = state.config.socials.map((s) =>\r\n s.platform === platform ? { ...s, url, isEnabled } : s\r\n )\r\n } else {\r\n socials = [...state.config.socials, { platform, url, isEnabled }]\r\n }\r\n \r\n return {\r\n config: {\r\n ...state.config,\r\n socials\r\n }\r\n }\r\n }),\r\n\r\n updateTheme: (themeUpdates) =>\r\n set((state) => ({\r\n config: {\r\n ...state.config,\r\n theme: {\r\n ...state.config.theme,\r\n ...themeUpdates\r\n }\r\n }\r\n })),\r\n\r\n saveProject: (name) => {\r\n const state = get()\r\n const projectId = state.activeProjectId || `proj-${Date.now()}`\r\n const projectName = name || (state.activeProjectId \r\n ? state.projects.find((p) => p.id === state.activeProjectId)?.name || 'My Link Tree'\r\n : 'My Link Tree')\r\n \r\n const existingProject = state.projects.find((p) => p.id === projectId)\r\n\r\n const updatedProject: Project = {\r\n id: projectId,\r\n name: projectName,\r\n updatedAt: new Date().toISOString(),\r\n config: state.config,\r\n shortUrl: state.activeShortUrl || existingProject?.shortUrl,\r\n shortUrlSuffix: state.activeShortUrlSuffix || existingProject?.shortUrlSuffix,\r\n expiresAt: state.activeExpiresAt || existingProject?.expiresAt,\r\n }\r\n \r\n const projectIndex = state.projects.findIndex((p) => p.id === projectId)\r\n let updatedProjects = [...state.projects]\r\n \r\n if (projectIndex >= 0) {\r\n updatedProjects[projectIndex] = updatedProject\r\n } else {\r\n updatedProjects.push(updatedProject)\r\n }\r\n \r\n set({\r\n projects: updatedProjects,\r\n activeProjectId: projectId\r\n })\r\n \r\n return projectId\r\n },\r\n\r\n loadProject: (id) => {\r\n const state = get()\r\n const project = state.projects.find((p) => p.id === id)\r\n if (project) {\r\n set({\r\n config: project.config,\r\n activeProjectId: id,\r\n activeShortUrl: project.shortUrl || null,\r\n activeShortUrlSuffix: project.shortUrlSuffix || null,\r\n activeExpiresAt: project.expiresAt || null,\r\n })\r\n }\r\n },\r\n\r\n deleteProject: (id) =>\r\n set((state) => {\r\n const updatedProjects = state.projects.filter((p) => p.id !== id)\r\n const wasActive = state.activeProjectId === id\r\n return {\r\n projects: updatedProjects,\r\n activeProjectId: wasActive ? null : state.activeProjectId,\r\n config: wasActive ? DEFAULT_CONFIG : state.config,\r\n activeShortUrl: wasActive ? null : state.activeShortUrl,\r\n activeShortUrlSuffix: wasActive ? null : state.activeShortUrlSuffix,\r\n activeExpiresAt: wasActive ? null : state.activeExpiresAt,\r\n }\r\n }),\r\n\r\n createNewProject: (name) => {\r\n const id = `proj-${Date.now()}`\r\n const newProject: Project = {\r\n id,\r\n name,\r\n updatedAt: new Date().toISOString(),\r\n config: DEFAULT_CONFIG\r\n }\r\n \r\n set((state) => ({\r\n projects: [...state.projects, newProject],\r\n config: DEFAULT_CONFIG,\r\n activeProjectId: id,\r\n activeShortUrl: null,\r\n activeShortUrlSuffix: null,\r\n activeExpiresAt: null,\r\n }))\r\n },\r\n\r\n resetConfig: () =>\r\n set({\r\n config: DEFAULT_CONFIG,\r\n activeProjectId: null,\r\n activeShortUrl: null,\r\n activeShortUrlSuffix: null,\r\n activeExpiresAt: null,\r\n }),\r\n\r\n setShortUrl: (shortUrl, suffix, expiresAt) =>\r\n set((state) => {\r\n const updatedProjects = state.activeProjectId\r\n ? state.projects.map((p) =>\r\n p.id === state.activeProjectId\r\n ? { ...p, shortUrl, shortUrlSuffix: suffix, expiresAt }\r\n : p\r\n )\r\n : state.projects\r\n\r\n return {\r\n activeShortUrl: shortUrl,\r\n activeShortUrlSuffix: suffix,\r\n activeExpiresAt: expiresAt,\r\n projects: updatedProjects\r\n }\r\n })\r\n }),\r\n {\r\n name: 'link-maker-workspace'\r\n }\r\n )\r\n)\r\n\r\n// Export compatibility alias for cloned components\r\nexport const useLinkBuilderStore = useLinkMakerStore\r\n"],"mappings":";;;AAAA,SAAS,cAAc;;;ACKvB,IAAM,kBAAkB,KAAK,KAAK,KAAK;AAKhC,SAAS,UAAU,MAAkC;AAC1D,MAAI,OAAO,aAAa,YAAa,QAAO;AAE5C,QAAM,QAAQ,KAAK,SAAS,MAAM;AAClC,QAAM,QAAQ,MAAM,MAAM,KAAK,IAAI,GAAG;AACtC,MAAI,MAAM,WAAW,GAAG;AACtB,UAAM,cAAc,MAAM,IAAI,GAAG,MAAM,GAAG,EAAE,MAAM;AAClD,WAAO;AAA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ACZ;AAAA,MACF,CAAC;AAAA,IACL;AAAA,IACA;AAAA,MACE,MAAM;AAAA,IACR;AAAA,EACF;AACF;","names":["create","create","create","create","persist"]}
|
package/dist/tokens.d.ts
CHANGED
|
@@ -1,56 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Amoga Design System — Tokens Module
|
|
3
|
-
*
|
|
4
|
-
* Exposes design token constants and metadata for TypeScript usage.
|
|
5
|
-
*/
|
|
6
|
-
declare const SEMANTIC_TOKENS: {
|
|
7
|
-
readonly background: "var(--background)";
|
|
8
|
-
readonly foreground: "var(--foreground)";
|
|
9
|
-
readonly card: "var(--card)";
|
|
10
|
-
readonly cardForeground: "var(--card-foreground)";
|
|
11
|
-
readonly popover: "var(--popover)";
|
|
12
|
-
readonly popoverForeground: "var(--popover-foreground)";
|
|
13
|
-
readonly primary: "var(--primary)";
|
|
14
|
-
readonly primaryForeground: "var(--primary-foreground)";
|
|
15
|
-
readonly secondary: "var(--secondary)";
|
|
16
|
-
readonly secondaryForeground: "var(--secondary-foreground)";
|
|
17
|
-
readonly muted: "var(--muted)";
|
|
18
|
-
readonly mutedForeground: "var(--muted-foreground)";
|
|
19
|
-
readonly accent: "var(--accent)";
|
|
20
|
-
readonly accentForeground: "var(--accent-foreground)";
|
|
21
|
-
readonly destructive: "var(--destructive)";
|
|
22
|
-
readonly destructiveForeground: "var(--destructive-foreground)";
|
|
23
|
-
readonly success: "var(--success)";
|
|
24
|
-
readonly successForeground: "var(--success-foreground)";
|
|
25
|
-
readonly warning: "var(--warning)";
|
|
26
|
-
readonly warningForeground: "var(--warning-foreground)";
|
|
27
|
-
readonly info: "var(--info)";
|
|
28
|
-
readonly infoForeground: "var(--info-foreground)";
|
|
29
|
-
readonly border: "var(--border)";
|
|
30
|
-
readonly input: "var(--input)";
|
|
31
|
-
readonly ring: "var(--ring)";
|
|
32
|
-
readonly radius: "var(--radius)";
|
|
33
|
-
readonly radiusSm: "var(--radius-sm)";
|
|
34
|
-
readonly radiusMd: "var(--radius-md)";
|
|
35
|
-
readonly radiusLg: "var(--radius-lg)";
|
|
36
|
-
readonly radiusXl: "var(--radius-xl)";
|
|
37
|
-
};
|
|
38
|
-
declare const CHART_TOKENS: {
|
|
39
|
-
readonly chart1: "var(--chart-1)";
|
|
40
|
-
readonly chart2: "var(--chart-2)";
|
|
41
|
-
readonly chart3: "var(--chart-3)";
|
|
42
|
-
readonly chart4: "var(--chart-4)";
|
|
43
|
-
readonly chart5: "var(--chart-5)";
|
|
44
|
-
};
|
|
45
|
-
declare const SIDEBAR_TOKENS: {
|
|
46
|
-
readonly sidebar: "var(--sidebar)";
|
|
47
|
-
readonly sidebarForeground: "var(--sidebar-foreground)";
|
|
48
|
-
readonly sidebarPrimary: "var(--sidebar-primary)";
|
|
49
|
-
readonly sidebarPrimaryForeground: "var(--sidebar-primary-foreground)";
|
|
50
|
-
readonly sidebarAccent: "var(--sidebar-accent)";
|
|
51
|
-
readonly sidebarAccentForeground: "var(--sidebar-accent-foreground)";
|
|
52
|
-
readonly sidebarBorder: "var(--sidebar-border)";
|
|
53
|
-
readonly sidebarRing: "var(--sidebar-ring)";
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export { CHART_TOKENS, SEMANTIC_TOKENS, SIDEBAR_TOKENS };
|
|
1
|
+
export * from './src/design-system/tokens';
|