@koloseum/utils 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/utils.d.ts +7 -8
- package/dist/utils.js +141 -46
- package/package.json +2 -2
package/dist/utils.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { Database } from "@koloseum/types/database";
|
|
2
|
-
import type { CustomError, Microservice, MicroserviceGroup, MicroserviceObject
|
|
2
|
+
import type { CustomError, Microservice, MicroserviceGroup, MicroserviceObject } from "@koloseum/types/general";
|
|
3
3
|
import type { PronounsCheckboxes, SocialMediaPlatform } from "@koloseum/types/public-auth";
|
|
4
4
|
import type { Page } from "@sveltejs/kit";
|
|
5
5
|
import type { SupabaseClient, PostgrestError } from "@supabase/supabase-js";
|
|
6
|
-
import type {
|
|
6
|
+
import type { IOptions } from "@suprsend/web-components/dist/types/interface.d.ts";
|
|
7
7
|
import type { MobilePhoneLocale } from "validator";
|
|
8
|
-
import { Novu } from "@novu/api";
|
|
9
8
|
export declare const Status: {
|
|
10
9
|
/**
|
|
11
10
|
* A generic error message.
|
|
@@ -74,12 +73,12 @@ export declare const Utility: {
|
|
|
74
73
|
*/
|
|
75
74
|
getAge: (dateOfBirth: string) => number;
|
|
76
75
|
/**
|
|
77
|
-
*
|
|
78
|
-
* @param
|
|
79
|
-
* @param
|
|
80
|
-
* @returns The
|
|
76
|
+
* Generate a SuprSend configuration object for a user.
|
|
77
|
+
* @param {string} userId - The user ID to generate the configuration for.
|
|
78
|
+
* @param {string} publicApiKey - The public API key to use for SuprSend.
|
|
79
|
+
* @returns The SuprSend configuration object.
|
|
81
80
|
*/
|
|
82
|
-
|
|
81
|
+
getSuprSendConfig: (userId: string, publicApiKey: string) => IOptions;
|
|
83
82
|
/**
|
|
84
83
|
* Handles the click event for pronouns checkboxes.
|
|
85
84
|
* @param {MouseEvent} e - The click event
|
package/dist/utils.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { error as svelteError } from "@sveltejs/kit";
|
|
2
2
|
import { FunctionsFetchError, FunctionsHttpError, FunctionsRelayError } from "@supabase/supabase-js";
|
|
3
|
-
import { ErrorDto } from "@novu/api/models/errors/errordto.js";
|
|
4
3
|
import sanitize from "sanitize-html";
|
|
5
4
|
import validator from "validator";
|
|
6
5
|
/* Helper functions */
|
|
@@ -181,52 +180,148 @@ export const Utility = {
|
|
|
181
180
|
return monthDiff < 0 || (monthDiff === 0 && currentDate.getDate() < birthDate.getDate()) ? --age : age;
|
|
182
181
|
},
|
|
183
182
|
/**
|
|
184
|
-
*
|
|
185
|
-
* @param
|
|
186
|
-
* @param
|
|
187
|
-
* @returns The
|
|
183
|
+
* Generate a SuprSend configuration object for a user.
|
|
184
|
+
* @param {string} userId - The user ID to generate the configuration for.
|
|
185
|
+
* @param {string} publicApiKey - The public API key to use for SuprSend.
|
|
186
|
+
* @returns The SuprSend configuration object.
|
|
188
187
|
*/
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
188
|
+
getSuprSendConfig: (userId, publicApiKey) => ({
|
|
189
|
+
distinctId: userId,
|
|
190
|
+
publicApiKey,
|
|
191
|
+
inbox: {
|
|
192
|
+
stores: [
|
|
193
|
+
{ storeId: "all", label: "Inbox", query: { archived: false } },
|
|
194
|
+
{ storeId: "archived", label: "Archived", query: { archived: true } }
|
|
195
|
+
],
|
|
196
|
+
theme: {
|
|
197
|
+
bell: {
|
|
198
|
+
color: "var(--color-accent)"
|
|
199
|
+
},
|
|
200
|
+
badge: {
|
|
201
|
+
backgroundColor: "var(--color-primary)",
|
|
202
|
+
color: "var(--color-primary-content)"
|
|
203
|
+
},
|
|
204
|
+
header: {
|
|
205
|
+
container: {
|
|
206
|
+
backgroundColor: "var(--color-base-100)",
|
|
207
|
+
borderColor: "var(--color-base-200)"
|
|
208
|
+
},
|
|
209
|
+
headerText: {
|
|
210
|
+
color: "var(--color-neutral)"
|
|
211
|
+
},
|
|
212
|
+
markAllReadText: {
|
|
213
|
+
color: "var(--color-accent)"
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
tabs: {
|
|
217
|
+
color: "var(--color-primary)",
|
|
218
|
+
unselectedColor: "var(--color-accent)",
|
|
219
|
+
bottomColor: "var(--color-primary)",
|
|
220
|
+
badgeColor: "var(--color-base-200)",
|
|
221
|
+
badgeText: "var(--color-accent)"
|
|
222
|
+
},
|
|
223
|
+
notificationsContainer: {
|
|
224
|
+
container: {
|
|
225
|
+
backgroundColor: "var(--color-base-100)",
|
|
226
|
+
borderColor: "var(--color-base-200)",
|
|
227
|
+
height: "75vh",
|
|
228
|
+
marginTop: "0.75rem"
|
|
229
|
+
},
|
|
230
|
+
noNotificationsText: {
|
|
231
|
+
color: "var(--color-warning)"
|
|
232
|
+
},
|
|
233
|
+
noNotificationsSubtext: {
|
|
234
|
+
color: "var(--color-neutral)"
|
|
235
|
+
},
|
|
236
|
+
loader: {
|
|
237
|
+
color: "var(--color-primary)"
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
notification: {
|
|
241
|
+
container: {
|
|
242
|
+
borderColor: "var(--color-base-200)",
|
|
243
|
+
readBackgroundColor: "var(--color-base-100)",
|
|
244
|
+
unreadBackgroundColor: "var(--color-base-150)",
|
|
245
|
+
hoverBackgroundColor: "var(--color-base-200)"
|
|
246
|
+
},
|
|
247
|
+
headerText: {
|
|
248
|
+
color: "var(--color-secondary)"
|
|
249
|
+
},
|
|
250
|
+
bodyText: {
|
|
251
|
+
color: "var(--color-neutral)",
|
|
252
|
+
linkColor: "var(--color-secondary)"
|
|
253
|
+
},
|
|
254
|
+
unseenDot: {
|
|
255
|
+
backgroundColor: "var(--color-warning)"
|
|
256
|
+
},
|
|
257
|
+
createdOnText: {
|
|
258
|
+
color: "var(--color-accent)"
|
|
259
|
+
},
|
|
260
|
+
subtext: {
|
|
261
|
+
color: "var(--color-neutral)"
|
|
262
|
+
},
|
|
263
|
+
expiresText: {
|
|
264
|
+
color: "var(--color-warning)",
|
|
265
|
+
expiringBackgroundColor: "var(--color-warning)",
|
|
266
|
+
expiringColor: "var(--color-neutral)"
|
|
267
|
+
},
|
|
268
|
+
actions: [
|
|
269
|
+
{
|
|
270
|
+
text: {
|
|
271
|
+
color: "var(--color-primary-content)"
|
|
272
|
+
},
|
|
273
|
+
container: {
|
|
274
|
+
backgroundColor: "var(--color-primary)",
|
|
275
|
+
hoverBackgroundColor: "var(--color-secondary)",
|
|
276
|
+
border: "unset"
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
text: {
|
|
281
|
+
color: "var(--color-primary-content)"
|
|
282
|
+
},
|
|
283
|
+
container: {
|
|
284
|
+
backgroundColor: "var(--color-primary)",
|
|
285
|
+
hoverBackgroundColor: "var(--color-secondary)",
|
|
286
|
+
border: "unset"
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
],
|
|
290
|
+
actionsMenuIcon: {
|
|
291
|
+
hoverBackgroundColor: "var(--color-base-200)",
|
|
292
|
+
color: "var(--color-neutral)"
|
|
293
|
+
},
|
|
294
|
+
actionsMenu: {
|
|
295
|
+
backgroundColor: "var(--color-base-100)",
|
|
296
|
+
borderColor: "var(--color-base-200)"
|
|
297
|
+
},
|
|
298
|
+
actionsMenuItem: {
|
|
299
|
+
hoverBackgroundColor: "var(--color-base-200)"
|
|
300
|
+
},
|
|
301
|
+
actionsMenuItemIcon: {
|
|
302
|
+
color: "var(--color-accent)"
|
|
303
|
+
},
|
|
304
|
+
actionsMenuItemText: {
|
|
305
|
+
color: "var(--color-neutral)"
|
|
306
|
+
}
|
|
218
307
|
}
|
|
219
|
-
|
|
220
|
-
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
toast: {
|
|
311
|
+
theme: {
|
|
312
|
+
container: {
|
|
313
|
+
backgroundColor: "var(--color-base-100)",
|
|
314
|
+
borderColor: "var(--color-base-200)"
|
|
315
|
+
},
|
|
316
|
+
headerText: {
|
|
317
|
+
color: "var(--color-primary)"
|
|
318
|
+
},
|
|
319
|
+
bodyText: {
|
|
320
|
+
color: "var(--color-neutral)"
|
|
221
321
|
}
|
|
222
322
|
}
|
|
223
|
-
// Otherwise, log error
|
|
224
|
-
else
|
|
225
|
-
console.error(error);
|
|
226
323
|
}
|
|
227
|
-
|
|
228
|
-
return subscriber;
|
|
229
|
-
},
|
|
324
|
+
}),
|
|
230
325
|
/**
|
|
231
326
|
* Handles the click event for pronouns checkboxes.
|
|
232
327
|
* @param {MouseEvent} e - The click event
|
|
@@ -379,7 +474,7 @@ export const Utility = {
|
|
|
379
474
|
},
|
|
380
475
|
{
|
|
381
476
|
name: "KLSM",
|
|
382
|
-
description: "Management of store products and tracking of orders and payments.",
|
|
477
|
+
description: "Management of KLSM store products and tracking of orders and payments.",
|
|
383
478
|
slug: "commerce",
|
|
384
479
|
features: [
|
|
385
480
|
{
|
|
@@ -428,7 +523,7 @@ export const Utility = {
|
|
|
428
523
|
},
|
|
429
524
|
{
|
|
430
525
|
name: "Staff",
|
|
431
|
-
description: "Management of staff authorisation.",
|
|
526
|
+
description: "Management of Backroom staff authorisation.",
|
|
432
527
|
slug: "staff",
|
|
433
528
|
features: [
|
|
434
529
|
{
|
|
@@ -452,7 +547,7 @@ export const Utility = {
|
|
|
452
547
|
},
|
|
453
548
|
{
|
|
454
549
|
name: "Account",
|
|
455
|
-
description: "Review
|
|
550
|
+
description: "Review Backroom account settings and preferences.",
|
|
456
551
|
slug: "account",
|
|
457
552
|
features: [
|
|
458
553
|
{
|
|
@@ -462,7 +557,7 @@ export const Utility = {
|
|
|
462
557
|
},
|
|
463
558
|
{
|
|
464
559
|
name: "Notifications",
|
|
465
|
-
description: "Review and manage Backroom
|
|
560
|
+
description: "Review and manage Backroom notification preferences.",
|
|
466
561
|
slug: "notifications"
|
|
467
562
|
}
|
|
468
563
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koloseum/utils",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"author": "Koloseum Technologies Limited",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Utility logic for use across Koloseum web apps (TypeScript)",
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"test": "vitest --run"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@novu/api": "^0.6.1",
|
|
33
32
|
"@supabase/supabase-js": "^2.48.1",
|
|
34
33
|
"@sveltejs/kit": "^2.17.1",
|
|
35
34
|
"sanitize-html": "^2.14.0",
|
|
@@ -38,6 +37,7 @@
|
|
|
38
37
|
"devDependencies": {
|
|
39
38
|
"@koloseum/types": "^0.1.12",
|
|
40
39
|
"@playwright/test": "^1.50.1",
|
|
40
|
+
"@suprsend/web-components": "^0.2.1",
|
|
41
41
|
"@types/sanitize-html": "^2.13.0",
|
|
42
42
|
"@types/validator": "^13.12.2",
|
|
43
43
|
"prettier": "^3.5.1",
|