@amogads/ui 1.0.2 → 1.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 +86 -78
- package/dist/index.d.ts +1 -952
- package/dist/index.js +2527 -1406
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2443 -1296
- package/dist/index.mjs.map +1 -1
- package/dist/pages.d.ts +16 -0
- package/dist/pages.js +39982 -0
- package/dist/pages.js.map +1 -0
- package/dist/pages.mjs +40273 -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 +26 -1
- package/dist/index.d.mts +0 -952
- package/dist/tokens.d.mts +0 -56
package/dist/stores.js
ADDED
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/stores/index.ts
|
|
21
|
+
var stores_exports = {};
|
|
22
|
+
__export(stores_exports, {
|
|
23
|
+
useAuthStore: () => useAuthStore,
|
|
24
|
+
useLinkMakerStore: () => useLinkMakerStore,
|
|
25
|
+
useNotificationStore: () => useNotificationStore,
|
|
26
|
+
useVoucherStore: () => useVoucherStore
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(stores_exports);
|
|
29
|
+
|
|
30
|
+
// src/stores/auth-store.ts
|
|
31
|
+
var import_zustand = require("zustand");
|
|
32
|
+
|
|
33
|
+
// src/lib/cookies.ts
|
|
34
|
+
var DEFAULT_MAX_AGE = 60 * 60 * 24 * 7;
|
|
35
|
+
function getCookie(name) {
|
|
36
|
+
if (typeof document === "undefined") return void 0;
|
|
37
|
+
const value = `; ${document.cookie}`;
|
|
38
|
+
const parts = value.split(`; ${name}=`);
|
|
39
|
+
if (parts.length === 2) {
|
|
40
|
+
const cookieValue = parts.pop()?.split(";").shift();
|
|
41
|
+
return cookieValue;
|
|
42
|
+
}
|
|
43
|
+
return void 0;
|
|
44
|
+
}
|
|
45
|
+
function setCookie(name, value, maxAge = DEFAULT_MAX_AGE) {
|
|
46
|
+
if (typeof document === "undefined") return;
|
|
47
|
+
document.cookie = `${name}=${value}; path=/; max-age=${maxAge}`;
|
|
48
|
+
}
|
|
49
|
+
function removeCookie(name) {
|
|
50
|
+
if (typeof document === "undefined") return;
|
|
51
|
+
document.cookie = `${name}=; path=/; max-age=0`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// src/stores/auth-store.ts
|
|
55
|
+
var ACCESS_TOKEN = "thisisjustarandomstring";
|
|
56
|
+
var USER_DATA = "auth_user_data";
|
|
57
|
+
var useAuthStore = (0, import_zustand.create)()((set) => {
|
|
58
|
+
const cookieState = getCookie(ACCESS_TOKEN);
|
|
59
|
+
let initToken = "";
|
|
60
|
+
if (cookieState) {
|
|
61
|
+
try {
|
|
62
|
+
initToken = JSON.parse(cookieState);
|
|
63
|
+
} catch {
|
|
64
|
+
removeCookie(ACCESS_TOKEN);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const userCookie = getCookie(USER_DATA);
|
|
68
|
+
let initUser = null;
|
|
69
|
+
if (userCookie) {
|
|
70
|
+
try {
|
|
71
|
+
const parsed = JSON.parse(decodeURIComponent(userCookie));
|
|
72
|
+
if (parsed.exp && parsed.exp > Date.now()) {
|
|
73
|
+
initUser = parsed;
|
|
74
|
+
} else {
|
|
75
|
+
removeCookie(ACCESS_TOKEN);
|
|
76
|
+
removeCookie(USER_DATA);
|
|
77
|
+
}
|
|
78
|
+
} catch {
|
|
79
|
+
initUser = null;
|
|
80
|
+
removeCookie(USER_DATA);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
auth: {
|
|
85
|
+
user: initUser,
|
|
86
|
+
setUser: (user) => set((state) => {
|
|
87
|
+
if (user) {
|
|
88
|
+
setCookie(USER_DATA, encodeURIComponent(JSON.stringify(user)));
|
|
89
|
+
} else {
|
|
90
|
+
removeCookie(USER_DATA);
|
|
91
|
+
}
|
|
92
|
+
return { ...state, auth: { ...state.auth, user } };
|
|
93
|
+
}),
|
|
94
|
+
accessToken: initUser ? initToken : "",
|
|
95
|
+
setAccessToken: (accessToken) => set((state) => {
|
|
96
|
+
setCookie(ACCESS_TOKEN, JSON.stringify(accessToken));
|
|
97
|
+
return { ...state, auth: { ...state.auth, accessToken } };
|
|
98
|
+
}),
|
|
99
|
+
resetAccessToken: () => set((state) => {
|
|
100
|
+
removeCookie(ACCESS_TOKEN);
|
|
101
|
+
return { ...state, auth: { ...state.auth, accessToken: "" } };
|
|
102
|
+
}),
|
|
103
|
+
reset: () => set((state) => {
|
|
104
|
+
removeCookie(ACCESS_TOKEN);
|
|
105
|
+
removeCookie(USER_DATA);
|
|
106
|
+
return {
|
|
107
|
+
...state,
|
|
108
|
+
auth: { ...state.auth, user: null, accessToken: "" }
|
|
109
|
+
};
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
// src/stores/notification-store.ts
|
|
116
|
+
var import_zustand2 = require("zustand");
|
|
117
|
+
|
|
118
|
+
// src/lib/supabase/client.ts
|
|
119
|
+
var import_ssr = require("@supabase/ssr");
|
|
120
|
+
var clientSingleton = null;
|
|
121
|
+
function createClient() {
|
|
122
|
+
if (typeof window === "undefined") {
|
|
123
|
+
return (0, import_ssr.createBrowserClient)(
|
|
124
|
+
process.env.NEXT_PUBLIC_SUPABASE_URL,
|
|
125
|
+
process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
if (!clientSingleton) {
|
|
129
|
+
clientSingleton = (0, import_ssr.createBrowserClient)(
|
|
130
|
+
process.env.NEXT_PUBLIC_SUPABASE_URL,
|
|
131
|
+
process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
return clientSingleton;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// src/stores/notification-store.ts
|
|
138
|
+
var activeChannel = null;
|
|
139
|
+
var useNotificationStore = (0, import_zustand2.create)((set, get) => ({
|
|
140
|
+
notifications: [],
|
|
141
|
+
unreadCount: 0,
|
|
142
|
+
isLoading: false,
|
|
143
|
+
fetchNotifications: async (userId) => {
|
|
144
|
+
set({ isLoading: true });
|
|
145
|
+
const supabase = createClient();
|
|
146
|
+
try {
|
|
147
|
+
const { data, error } = await supabase.from("notifications").select("*").eq("user_id", userId).order("created_at", { ascending: false });
|
|
148
|
+
if (error) throw error;
|
|
149
|
+
const notifications = data || [];
|
|
150
|
+
const unreadCount = notifications.filter((n) => !n.read).length;
|
|
151
|
+
set({ notifications, unreadCount });
|
|
152
|
+
} catch (e) {
|
|
153
|
+
console.error("[NotificationStore] Failed to fetch notifications:", e);
|
|
154
|
+
} finally {
|
|
155
|
+
set({ isLoading: false });
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
markAsRead: async (notificationId) => {
|
|
159
|
+
const supabase = createClient();
|
|
160
|
+
try {
|
|
161
|
+
const { error } = await supabase.from("notifications").update({ read: true }).eq("id", notificationId);
|
|
162
|
+
if (error) throw error;
|
|
163
|
+
set((state) => {
|
|
164
|
+
const updated = state.notifications.map(
|
|
165
|
+
(n) => n.id === notificationId ? { ...n, read: true } : n
|
|
166
|
+
);
|
|
167
|
+
const unreadCount = updated.filter((n) => !n.read).length;
|
|
168
|
+
return { notifications: updated, unreadCount };
|
|
169
|
+
});
|
|
170
|
+
} catch (e) {
|
|
171
|
+
console.error("[NotificationStore] Failed to mark notification as read:", e);
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
markAllAsRead: async (userId) => {
|
|
175
|
+
const supabase = createClient();
|
|
176
|
+
try {
|
|
177
|
+
const { error } = await supabase.from("notifications").update({ read: true }).eq("user_id", userId).eq("read", false);
|
|
178
|
+
if (error) throw error;
|
|
179
|
+
set((state) => {
|
|
180
|
+
const updated = state.notifications.map((n) => ({ ...n, read: true }));
|
|
181
|
+
return { notifications: updated, unreadCount: 0 };
|
|
182
|
+
});
|
|
183
|
+
} catch (e) {
|
|
184
|
+
console.error("[NotificationStore] Failed to mark all notifications as read:", e);
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
deleteNotification: async (notificationId) => {
|
|
188
|
+
const supabase = createClient();
|
|
189
|
+
try {
|
|
190
|
+
const { error } = await supabase.from("notifications").delete().eq("id", notificationId);
|
|
191
|
+
if (error) throw error;
|
|
192
|
+
set((state) => {
|
|
193
|
+
const updated = state.notifications.filter((n) => n.id !== notificationId);
|
|
194
|
+
const unreadCount = updated.filter((n) => !n.read).length;
|
|
195
|
+
return { notifications: updated, unreadCount };
|
|
196
|
+
});
|
|
197
|
+
} catch (e) {
|
|
198
|
+
console.error("[NotificationStore] Failed to delete notification:", e);
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
subscribeToNotifications: (userId) => {
|
|
202
|
+
try {
|
|
203
|
+
if (!userId) return;
|
|
204
|
+
const supabase = createClient();
|
|
205
|
+
if (activeChannel && activeUserId === userId) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
if (activeChannel) {
|
|
209
|
+
try {
|
|
210
|
+
supabase.removeChannel(activeChannel);
|
|
211
|
+
} catch (_) {
|
|
212
|
+
}
|
|
213
|
+
activeChannel = null;
|
|
214
|
+
activeUserId = null;
|
|
215
|
+
}
|
|
216
|
+
const channelTopic = `notifications-user-${userId}-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
|
|
217
|
+
const channel = supabase.channel(channelTopic);
|
|
218
|
+
channel.on(
|
|
219
|
+
"postgres_changes",
|
|
220
|
+
{
|
|
221
|
+
event: "*",
|
|
222
|
+
schema: "public",
|
|
223
|
+
table: "notifications",
|
|
224
|
+
filter: `user_id=eq.${userId}`
|
|
225
|
+
},
|
|
226
|
+
(payload) => {
|
|
227
|
+
const { eventType, new: newRecord, old: oldRecord } = payload;
|
|
228
|
+
if (eventType === "INSERT") {
|
|
229
|
+
const inserted = newRecord;
|
|
230
|
+
set((state) => {
|
|
231
|
+
if (state.notifications.some((n) => n.id === inserted.id)) {
|
|
232
|
+
return {};
|
|
233
|
+
}
|
|
234
|
+
const updated = [inserted, ...state.notifications];
|
|
235
|
+
const unreadCount = updated.filter((n) => !n.read).length;
|
|
236
|
+
return { notifications: updated, unreadCount };
|
|
237
|
+
});
|
|
238
|
+
} else if (eventType === "UPDATE") {
|
|
239
|
+
const updatedRecord = newRecord;
|
|
240
|
+
set((state) => {
|
|
241
|
+
const updated = state.notifications.map(
|
|
242
|
+
(n) => n.id === updatedRecord.id ? updatedRecord : n
|
|
243
|
+
);
|
|
244
|
+
const unreadCount = updated.filter((n) => !n.read).length;
|
|
245
|
+
return { notifications: updated, unreadCount };
|
|
246
|
+
});
|
|
247
|
+
} else if (eventType === "DELETE") {
|
|
248
|
+
const deletedId = oldRecord?.id;
|
|
249
|
+
if (!deletedId) return;
|
|
250
|
+
set((state) => {
|
|
251
|
+
const updated = state.notifications.filter((n) => n.id !== deletedId);
|
|
252
|
+
const unreadCount = updated.filter((n) => !n.read).length;
|
|
253
|
+
return { notifications: updated, unreadCount };
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
).subscribe();
|
|
258
|
+
activeChannel = channel;
|
|
259
|
+
activeUserId = userId;
|
|
260
|
+
} catch (err) {
|
|
261
|
+
console.warn("[NotificationStore] Realtime subscription error:", err);
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
unsubscribe: () => {
|
|
265
|
+
try {
|
|
266
|
+
if (activeChannel) {
|
|
267
|
+
const supabase = createClient();
|
|
268
|
+
supabase.removeChannel(activeChannel);
|
|
269
|
+
activeChannel = null;
|
|
270
|
+
activeUserId = null;
|
|
271
|
+
}
|
|
272
|
+
} catch (err) {
|
|
273
|
+
console.warn("[NotificationStore] Unsubscribe error:", err);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}));
|
|
277
|
+
|
|
278
|
+
// src/stores/voucher-store.ts
|
|
279
|
+
var import_zustand3 = require("zustand");
|
|
280
|
+
var import_middleware = require("zustand/middleware");
|
|
281
|
+
var useVoucherStore = (0, import_zustand3.create)()(
|
|
282
|
+
(0, import_middleware.persist)(
|
|
283
|
+
(set) => ({
|
|
284
|
+
vouchers: [],
|
|
285
|
+
selectedVoucher: null,
|
|
286
|
+
dbLoaded: false,
|
|
287
|
+
setSelectedVoucher: (voucher) => set({ selectedVoucher: voucher }),
|
|
288
|
+
setDbLoaded: (v) => set({ dbLoaded: v }),
|
|
289
|
+
setVouchers: (vouchers) => set((state) => {
|
|
290
|
+
const map = /* @__PURE__ */ new Map();
|
|
291
|
+
const getFileKey = (v) => {
|
|
292
|
+
const name = (v.fileName || "").toLowerCase().trim();
|
|
293
|
+
const url = (v.originalFileUrl || v.editedFileUrl || v.pdfUrl || "").trim();
|
|
294
|
+
if (name && url) return `${name}_${url}`;
|
|
295
|
+
if (name) return name;
|
|
296
|
+
return v.id;
|
|
297
|
+
};
|
|
298
|
+
for (const v of vouchers) {
|
|
299
|
+
const key = getFileKey(v);
|
|
300
|
+
if (key) map.set(key, v);
|
|
301
|
+
}
|
|
302
|
+
for (const v of state.vouchers) {
|
|
303
|
+
const key = getFileKey(v);
|
|
304
|
+
if (key && !map.has(key)) map.set(key, v);
|
|
305
|
+
}
|
|
306
|
+
const merged = Array.from(map.values()).sort((a, b) => {
|
|
307
|
+
const timeA = a.createdAt ? new Date(a.createdAt).getTime() : 0;
|
|
308
|
+
const timeB = b.createdAt ? new Date(b.createdAt).getTime() : 0;
|
|
309
|
+
return timeB - timeA;
|
|
310
|
+
});
|
|
311
|
+
return { vouchers: merged };
|
|
312
|
+
}),
|
|
313
|
+
addVoucher: (data) => {
|
|
314
|
+
const fileUrlToUse = data.pdfUrl || data.editedFileUrl || data.originalFileUrl;
|
|
315
|
+
const newVoucher = {
|
|
316
|
+
...data,
|
|
317
|
+
pdfUrl: fileUrlToUse,
|
|
318
|
+
id: `voucher-${Date.now()}`,
|
|
319
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
320
|
+
};
|
|
321
|
+
set((state) => ({
|
|
322
|
+
vouchers: [newVoucher, ...state.vouchers],
|
|
323
|
+
selectedVoucher: newVoucher
|
|
324
|
+
}));
|
|
325
|
+
return newVoucher;
|
|
326
|
+
},
|
|
327
|
+
updateVoucher: (id, updates) => {
|
|
328
|
+
set((state) => ({
|
|
329
|
+
vouchers: state.vouchers.map(
|
|
330
|
+
(v) => v.id === id ? { ...v, ...updates } : v
|
|
331
|
+
),
|
|
332
|
+
selectedVoucher: state.selectedVoucher?.id === id ? { ...state.selectedVoucher, ...updates } : state.selectedVoucher
|
|
333
|
+
}));
|
|
334
|
+
},
|
|
335
|
+
deleteVoucher: (id) => {
|
|
336
|
+
set((state) => ({
|
|
337
|
+
vouchers: state.vouchers.filter((v) => v.id !== id),
|
|
338
|
+
selectedVoucher: state.selectedVoucher?.id === id ? null : state.selectedVoucher
|
|
339
|
+
}));
|
|
340
|
+
}
|
|
341
|
+
}),
|
|
342
|
+
{
|
|
343
|
+
name: "vouchers-storage-v4",
|
|
344
|
+
partialize: (state) => ({
|
|
345
|
+
// Do NOT persist vouchers array globally in localStorage to prevent user data leakage across accounts
|
|
346
|
+
selectedVoucher: null
|
|
347
|
+
})
|
|
348
|
+
}
|
|
349
|
+
)
|
|
350
|
+
);
|
|
351
|
+
|
|
352
|
+
// src/features/link-maker/store.ts
|
|
353
|
+
var import_zustand4 = require("zustand");
|
|
354
|
+
var import_middleware2 = require("zustand/middleware");
|
|
355
|
+
var DEFAULT_CONFIG = {
|
|
356
|
+
profile: {
|
|
357
|
+
name: "Alex Rivera",
|
|
358
|
+
bio: "Senior UX Architect & Tech Writer | Crafting digital experiences \u2728",
|
|
359
|
+
avatarUrl: ""
|
|
360
|
+
},
|
|
361
|
+
links: [],
|
|
362
|
+
socials: [],
|
|
363
|
+
theme: {
|
|
364
|
+
preset: "custom",
|
|
365
|
+
appTheme: "system",
|
|
366
|
+
appColorTheme: "zinc"
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
var useLinkMakerStore = (0, import_zustand4.create)()(
|
|
370
|
+
(0, import_middleware2.persist)(
|
|
371
|
+
(set, get) => ({
|
|
372
|
+
config: DEFAULT_CONFIG,
|
|
373
|
+
projects: [],
|
|
374
|
+
activeProjectId: null,
|
|
375
|
+
activeShortUrl: null,
|
|
376
|
+
activeShortUrlSuffix: null,
|
|
377
|
+
activeExpiresAt: null,
|
|
378
|
+
updateProfile: (profileUpdates) => set((state) => ({
|
|
379
|
+
config: {
|
|
380
|
+
...state.config,
|
|
381
|
+
profile: {
|
|
382
|
+
...state.config.profile,
|
|
383
|
+
...profileUpdates
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
})),
|
|
387
|
+
addLink: () => set((state) => {
|
|
388
|
+
const newLink = {
|
|
389
|
+
id: `link-${Date.now()}`,
|
|
390
|
+
title: "New Social Link",
|
|
391
|
+
url: "https://",
|
|
392
|
+
icon: "Link2",
|
|
393
|
+
isEnabled: true,
|
|
394
|
+
animation: "none"
|
|
395
|
+
};
|
|
396
|
+
return {
|
|
397
|
+
config: {
|
|
398
|
+
...state.config,
|
|
399
|
+
links: [...state.config.links, newLink]
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
}),
|
|
403
|
+
updateLink: (id, updates) => set((state) => ({
|
|
404
|
+
config: {
|
|
405
|
+
...state.config,
|
|
406
|
+
links: state.config.links.map(
|
|
407
|
+
(link) => link.id === id ? { ...link, ...updates } : link
|
|
408
|
+
)
|
|
409
|
+
}
|
|
410
|
+
})),
|
|
411
|
+
removeLink: (id) => set((state) => ({
|
|
412
|
+
config: {
|
|
413
|
+
...state.config,
|
|
414
|
+
links: state.config.links.filter((link) => link.id !== id)
|
|
415
|
+
}
|
|
416
|
+
})),
|
|
417
|
+
reorderLinks: (index, direction) => set((state) => {
|
|
418
|
+
const links = [...state.config.links];
|
|
419
|
+
const targetIndex = direction === "up" ? index - 1 : index + 1;
|
|
420
|
+
if (targetIndex < 0 || targetIndex >= links.length) {
|
|
421
|
+
return {};
|
|
422
|
+
}
|
|
423
|
+
const temp = links[index];
|
|
424
|
+
links[index] = links[targetIndex];
|
|
425
|
+
links[targetIndex] = temp;
|
|
426
|
+
return {
|
|
427
|
+
config: {
|
|
428
|
+
...state.config,
|
|
429
|
+
links
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
}),
|
|
433
|
+
updateSocial: (platform, url, isEnabled) => set((state) => {
|
|
434
|
+
const platformExists = state.config.socials.some((s) => s.platform === platform);
|
|
435
|
+
let socials = [];
|
|
436
|
+
if (platformExists) {
|
|
437
|
+
socials = state.config.socials.map(
|
|
438
|
+
(s) => s.platform === platform ? { ...s, url, isEnabled } : s
|
|
439
|
+
);
|
|
440
|
+
} else {
|
|
441
|
+
socials = [...state.config.socials, { platform, url, isEnabled }];
|
|
442
|
+
}
|
|
443
|
+
return {
|
|
444
|
+
config: {
|
|
445
|
+
...state.config,
|
|
446
|
+
socials
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
}),
|
|
450
|
+
updateTheme: (themeUpdates) => set((state) => ({
|
|
451
|
+
config: {
|
|
452
|
+
...state.config,
|
|
453
|
+
theme: {
|
|
454
|
+
...state.config.theme,
|
|
455
|
+
...themeUpdates
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
})),
|
|
459
|
+
saveProject: (name) => {
|
|
460
|
+
const state = get();
|
|
461
|
+
const projectId = state.activeProjectId || `proj-${Date.now()}`;
|
|
462
|
+
const projectName = name || (state.activeProjectId ? state.projects.find((p) => p.id === state.activeProjectId)?.name || "My Link Tree" : "My Link Tree");
|
|
463
|
+
const existingProject = state.projects.find((p) => p.id === projectId);
|
|
464
|
+
const updatedProject = {
|
|
465
|
+
id: projectId,
|
|
466
|
+
name: projectName,
|
|
467
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
468
|
+
config: state.config,
|
|
469
|
+
shortUrl: state.activeShortUrl || existingProject?.shortUrl,
|
|
470
|
+
shortUrlSuffix: state.activeShortUrlSuffix || existingProject?.shortUrlSuffix,
|
|
471
|
+
expiresAt: state.activeExpiresAt || existingProject?.expiresAt
|
|
472
|
+
};
|
|
473
|
+
const projectIndex = state.projects.findIndex((p) => p.id === projectId);
|
|
474
|
+
let updatedProjects = [...state.projects];
|
|
475
|
+
if (projectIndex >= 0) {
|
|
476
|
+
updatedProjects[projectIndex] = updatedProject;
|
|
477
|
+
} else {
|
|
478
|
+
updatedProjects.push(updatedProject);
|
|
479
|
+
}
|
|
480
|
+
set({
|
|
481
|
+
projects: updatedProjects,
|
|
482
|
+
activeProjectId: projectId
|
|
483
|
+
});
|
|
484
|
+
return projectId;
|
|
485
|
+
},
|
|
486
|
+
loadProject: (id) => {
|
|
487
|
+
const state = get();
|
|
488
|
+
const project = state.projects.find((p) => p.id === id);
|
|
489
|
+
if (project) {
|
|
490
|
+
set({
|
|
491
|
+
config: project.config,
|
|
492
|
+
activeProjectId: id,
|
|
493
|
+
activeShortUrl: project.shortUrl || null,
|
|
494
|
+
activeShortUrlSuffix: project.shortUrlSuffix || null,
|
|
495
|
+
activeExpiresAt: project.expiresAt || null
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
},
|
|
499
|
+
deleteProject: (id) => set((state) => {
|
|
500
|
+
const updatedProjects = state.projects.filter((p) => p.id !== id);
|
|
501
|
+
const wasActive = state.activeProjectId === id;
|
|
502
|
+
return {
|
|
503
|
+
projects: updatedProjects,
|
|
504
|
+
activeProjectId: wasActive ? null : state.activeProjectId,
|
|
505
|
+
config: wasActive ? DEFAULT_CONFIG : state.config,
|
|
506
|
+
activeShortUrl: wasActive ? null : state.activeShortUrl,
|
|
507
|
+
activeShortUrlSuffix: wasActive ? null : state.activeShortUrlSuffix,
|
|
508
|
+
activeExpiresAt: wasActive ? null : state.activeExpiresAt
|
|
509
|
+
};
|
|
510
|
+
}),
|
|
511
|
+
createNewProject: (name) => {
|
|
512
|
+
const id = `proj-${Date.now()}`;
|
|
513
|
+
const newProject = {
|
|
514
|
+
id,
|
|
515
|
+
name,
|
|
516
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
517
|
+
config: DEFAULT_CONFIG
|
|
518
|
+
};
|
|
519
|
+
set((state) => ({
|
|
520
|
+
projects: [...state.projects, newProject],
|
|
521
|
+
config: DEFAULT_CONFIG,
|
|
522
|
+
activeProjectId: id,
|
|
523
|
+
activeShortUrl: null,
|
|
524
|
+
activeShortUrlSuffix: null,
|
|
525
|
+
activeExpiresAt: null
|
|
526
|
+
}));
|
|
527
|
+
},
|
|
528
|
+
resetConfig: () => set({
|
|
529
|
+
config: DEFAULT_CONFIG,
|
|
530
|
+
activeProjectId: null,
|
|
531
|
+
activeShortUrl: null,
|
|
532
|
+
activeShortUrlSuffix: null,
|
|
533
|
+
activeExpiresAt: null
|
|
534
|
+
}),
|
|
535
|
+
setShortUrl: (shortUrl, suffix, expiresAt) => set((state) => {
|
|
536
|
+
const updatedProjects = state.activeProjectId ? state.projects.map(
|
|
537
|
+
(p) => p.id === state.activeProjectId ? { ...p, shortUrl, shortUrlSuffix: suffix, expiresAt } : p
|
|
538
|
+
) : state.projects;
|
|
539
|
+
return {
|
|
540
|
+
activeShortUrl: shortUrl,
|
|
541
|
+
activeShortUrlSuffix: suffix,
|
|
542
|
+
activeExpiresAt: expiresAt,
|
|
543
|
+
projects: updatedProjects
|
|
544
|
+
};
|
|
545
|
+
})
|
|
546
|
+
}),
|
|
547
|
+
{
|
|
548
|
+
name: "link-maker-workspace"
|
|
549
|
+
}
|
|
550
|
+
)
|
|
551
|
+
);
|
|
552
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
553
|
+
0 && (module.exports = {
|
|
554
|
+
useAuthStore,
|
|
555
|
+
useLinkMakerStore,
|
|
556
|
+
useNotificationStore,
|
|
557
|
+
useVoucherStore
|
|
558
|
+
});
|
|
559
|
+
//# sourceMappingURL=stores.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/stores/index.ts","../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":["/**\n * Amoga Design System — State Stores\n */\n\nexport * from './auth-store'\nexport * from './notification-store'\nexport * from './voucher-store'\nexport * from './link-maker-store'\n","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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,qBAAuB;;;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;AAAA,EACT;AACA,SAAO;AACT;AAKO,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