@timardex/cluemart-server-shared 2.0.0 → 2.0.2

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.
@@ -1,35 +1,15 @@
1
1
  import {
2
2
  AdModel,
3
3
  AffiliateModel,
4
- EnumAdStatus,
5
- EnumAffiliateRewardType,
6
- EnumEventDateStatus,
7
- EnumEventDateStatus2,
8
- EnumInviteStatus,
9
- EnumInviteStatus2,
10
- EnumNotificationResourceType,
11
- EnumNotificationType,
12
- EnumPaymentMethod,
13
- EnumRegions,
14
- EnumResourceType,
15
- EnumSubscriptionStatus,
16
- EnumSubscriptionStatus2,
17
- EnumUserLicence,
18
- EnumUserLicence2,
19
4
  EventModel,
20
5
  GoogleImportedMarketModel,
21
6
  NotificationModel,
22
7
  PartnerModel,
23
8
  PushTokenModel,
24
9
  UserModel,
25
- VendorModel,
26
- dateFormat,
27
- isNonVisitorResourceType,
28
- licenseNiceNames,
29
- timeFormat
30
- } from "../chunk-EGUFWI7R.mjs";
10
+ VendorModel
11
+ } from "../chunk-IICIHY26.mjs";
31
12
  import "../chunk-6PNG5BI5.mjs";
32
- import "../chunk-3QS3WKRC.mjs";
33
13
 
34
14
  // src/service/promoCode/constants.ts
35
15
  var ACTIVE_NOT_DELETED_FILTER = {
@@ -46,1234 +26,13 @@ async function activeAffiliateCodeExists(affiliateCode) {
46
26
  return existing !== null;
47
27
  }
48
28
 
49
- // node_modules/@timardex/cluemart-shared/dist/chunk-YRO6KEZG.mjs
50
- import dayjs from "dayjs";
51
- import customParseFormat from "dayjs/plugin/customParseFormat.js";
52
- import isSameOrAfter from "dayjs/plugin/isSameOrAfter.js";
53
- import timezone from "dayjs/plugin/timezone.js";
54
- import utc from "dayjs/plugin/utc.js";
55
- var mapArrayToOptions = (items) => items.map((item) => ({
56
- label: item,
57
- value: item
58
- }));
59
- var dateFormat2 = "DD-MM-YYYY";
60
- var timeFormat2 = "HH:mm";
61
- dayjs.extend(customParseFormat);
62
- dayjs.extend(utc);
63
- dayjs.extend(timezone);
64
- dayjs.extend(isSameOrAfter);
65
- var formatDate = (dateStr, display = "datetime", timeStr) => {
66
- const dateTimeStr = timeStr ? `${dateStr} ${timeStr}` : dateStr;
67
- const dateTime = timeStr ? dayjs(dateTimeStr, `${dateFormat2} ${timeFormat2}`) : dayjs(dateStr, dateFormat2);
68
- const formattedDate = dateTime.format("dddd, D MMMM, YYYY");
69
- const formattedTime = dateTime.format("h:mm a");
70
- switch (display) {
71
- case "date":
72
- return formattedDate;
73
- case "time":
74
- return formattedTime;
75
- case "datetime":
76
- return `${formattedDate} at ${formattedTime}`;
77
- default:
78
- return formattedDate;
79
- }
80
- };
81
- var futureTimePeriods = mapArrayToOptions(
82
- Object.values(EnumEventDateStatus2)
83
- ).filter(
84
- (period) => period.value !== "Starting_Soon" && period.value !== "Canceled" && period.value !== "Rescheduled" && period.value !== "Started" && period.value !== "Ended" && period.value !== "Invalid"
85
- /* INVALID */
86
- ).map((period) => ({
87
- label: period.value.replaceAll("_", " "),
88
- value: period.value
89
- }));
90
- var RELATION_SHARE_INVITATION = "invitation";
91
- var RELATION_SHARE_APPLICATION = "application";
92
- var SHARE_SITE_URL = "https://cluemart.co.nz";
93
- var SHARE_CALENDAR_ICON = "\u{1F4C5}";
94
- var SHARE_MARKET_DATES_SECTION_HEADING = `${SHARE_CALENDAR_ICON} Market dates:`;
95
- var SHARE_CHECKMARK_ICON = "\u2705";
96
- var SHARE_REQUIREMENTS_SECTION_HEADING = `${SHARE_CHECKMARK_ICON} Requirements:`;
97
- var SHARE_INFO_ICON = "\u2139\uFE0F";
98
- var SHARE_TAGS_SECTION_HEADING = `${SHARE_INFO_ICON} Tags:`;
99
- var SHARE_COMPLIANCE_PREFIX = `${SHARE_CHECKMARK_ICON} Compliance:`;
100
- var SHARE_CATEGORY_ICON = "\u{1F3F7}\uFE0F";
101
- var SHARE_CATEGORIES_SECTION_HEADING = `${SHARE_CATEGORY_ICON} Categories:`;
102
- var SHARE_RULER_ICON = "\u{1F4CF}";
103
- var SHARE_STALL_SIZE_PREFIX = `${SHARE_RULER_ICON} Stall size:`;
104
- var SHARE_DOLLAR_ICON = "$";
105
- var SHARE_PRICE_RANGE_PREFIX = `${SHARE_DOLLAR_ICON} Price range:`;
106
- var SHARE_CLOCK_ICON = "\u23F0";
107
- var SHARE_APPLICATION_DEADLINE_PREFIX = `${SHARE_CLOCK_ICON} Application deadline:`;
108
- var DEFAULT_SHARE_OG_IMAGE = `${SHARE_SITE_URL}/assets/logo.webp`;
109
- var SHARE_RESOURCE_LABEL = {
110
- [RELATION_SHARE_APPLICATION]: "Application",
111
- [RELATION_SHARE_INVITATION]: "Invitation",
112
- clue_bites: "Clue Bites",
113
- market_faces: "Market Faces",
114
- play_and_win: "Play & Win",
115
- market: "Market",
116
- partner: "Partner",
117
- stallholder: "Stallholder",
118
- affiliate: "Affiliate",
119
- school: "School"
120
- };
121
-
122
- // node_modules/@timardex/cluemart-shared/dist/chunk-JJQL6LZE.mjs
123
- var PROMO_CODE_PREFIX = "CM-";
124
- var OBJECT_ID_PATH_SEGMENT = "[a-f0-9]{24}";
125
- var OBJECT_ID_PATH_SEGMENT_END = `${OBJECT_ID_PATH_SEGMENT}$`;
126
- var gameScreenIdentifierList = [
127
- {
128
- clue: "Where conversations happen without speaking.",
129
- id: "chat",
130
- match: "/chat"
131
- },
132
- {
133
- clue: "Where you can find your loyalties.",
134
- id: "coupons",
135
- match: "/profile/account/coupons"
136
- },
137
- {
138
- clue: "A single moment worth showing up for.",
139
- id: "single-event",
140
- match: new RegExp(`^/events/${OBJECT_ID_PATH_SEGMENT_END}`)
141
- },
142
- {
143
- clue: "What\u2019s happening around you, right now.",
144
- id: "events-near-me",
145
- match: "/events/events-near-me"
146
- },
147
- {
148
- clue: "Where events appear as pins on a map.",
149
- id: "events-map",
150
- match: "/events/events-map"
151
- },
152
- {
153
- clue: "A collection of events worth attending.",
154
- id: "events",
155
- match: "/events"
156
- },
157
- {
158
- clue: "What\u2019s happening in a wider area \u2014 not just nearby.",
159
- id: "events-region",
160
- match: /^\/events\/region\/[^/]+$/
161
- },
162
- {
163
- clue: "Where fun becomes a challenge.",
164
- id: "games",
165
- match: "/profile/account/games"
166
- },
167
- {
168
- clue: "Your starting point for everything.",
169
- id: "home",
170
- match: "/home"
171
- },
172
- {
173
- clue: "Where the app whispers what you shouldn\u2019t miss.",
174
- id: "notifications",
175
- match: "/notifications"
176
- },
177
- {
178
- clue: "An organisation or creator supporting the community.",
179
- id: "single-partner",
180
- match: new RegExp(`^/partners/${OBJECT_ID_PATH_SEGMENT_END}`)
181
- },
182
- {
183
- clue: "Organisations and creators supporting the community.",
184
- id: "partners",
185
- match: "/partners"
186
- },
187
- {
188
- clue: "Where your actions turn into a timeline.",
189
- id: "activities",
190
- match: "/profile/account/favourites"
191
- },
192
- {
193
- clue: "The place to redefine who you are.",
194
- id: "edit-profile",
195
- match: "/profile/account"
196
- },
197
- {
198
- clue: "Your identity, on display.",
199
- id: "profile",
200
- match: "/profile"
201
- },
202
- {
203
- clue: "Where you can redeem your rewards.",
204
- id: "rewards",
205
- match: "/profile/account/rewards"
206
- },
207
- {
208
- clue: "A single published post in full view.",
209
- id: "single-visitor-post",
210
- match: new RegExp(`^/visitors/post/${OBJECT_ID_PATH_SEGMENT_END}`)
211
- },
212
- {
213
- clue: "One stallholder offering something valuable.",
214
- id: "single-vendor",
215
- match: new RegExp(`^/vendors/${OBJECT_ID_PATH_SEGMENT_END}`)
216
- },
217
- {
218
- clue: "Where every stallholder waits under the right category.",
219
- id: "vendors",
220
- match: "/vendors"
221
- },
222
- {
223
- clue: "Where you browse articles and posts from around the platform.",
224
- id: "visitors",
225
- match: "/visitors"
226
- },
227
- {
228
- clue: "Where you fine-tune your experience.",
229
- id: "options",
230
- match: "/options"
231
- }
232
- ];
233
-
234
- // node_modules/@timardex/cluemart-shared/dist/chunk-L3SNS6OJ.mjs
235
- import dayjs2 from "dayjs";
236
- var statusOptions = [
237
- ...Object.values(EnumInviteStatus2).map((status) => ({
238
- label: status,
239
- value: status
240
- })).sort((a, b) => a.label.localeCompare(b.label))
241
- // Sort the options alphabetically
242
- ];
243
- var availableRegionTypes = Object.values(EnumRegions);
244
- var availableRegionOptions = mapArrayToOptions(availableRegionTypes);
245
- var paymentMethodOptions = mapArrayToOptions(
246
- Object.values(EnumPaymentMethod)
247
- );
248
- var CM_SCHOOL_PROMO_CODE = `${PROMO_CODE_PREFIX}SCHOOL`;
249
- var CM_AFFILIATE_PROMO_CODE = `${PROMO_CODE_PREFIX}AFFILIATE`;
250
- var clothingAndFashion = [
251
- {
252
- id: "clothing-fashion",
253
- name: "Clothing & Fashion",
254
- description: "New, handmade, or upcycled clothing and accessories with a creative twist.",
255
- subcategories: [
256
- {
257
- id: "apparel-babywear",
258
- name: "Apparel & Babywear",
259
- items: [
260
- {
261
- id: "apparel",
262
- name: "Apparel",
263
- description: "Dresses, t-shirts, jumpers, rompers, sets, kidswear."
264
- },
265
- {
266
- id: "baby-toddler-apparel",
267
- name: "Baby & Toddler Apparel",
268
- description: "Handmade baby clothes, soft shoes, bibs, hats, knitted sets."
269
- },
270
- {
271
- id: "upcycled-fashion",
272
- name: "Upcycled Fashion",
273
- description: "Reworked garments, patchwork pieces, restyled vintage."
274
- },
275
- {
276
- id: "other-wearable-items",
277
- name: "Other wearable items",
278
- description: "Unique clothing not listed above."
279
- }
280
- ]
281
- },
282
- {
283
- id: "fashion-accessories",
284
- name: "Fashion Accessories",
285
- items: [
286
- {
287
- id: "accessories",
288
- name: "Accessories",
289
- description: "Scarves, belts, gloves, hats, headbands, caps."
290
- },
291
- {
292
- id: "shoes",
293
- name: "Shoes",
294
- description: "Handmade shoes, baby booties, sandals, slippers."
295
- },
296
- {
297
- id: "bags-wallets",
298
- name: "Bags & Wallets",
299
- description: "Leather bags, fabric purses, wallets, backpacks, totes."
300
- },
301
- {
302
- id: "other-accessories",
303
- name: "Other accessories",
304
- description: "Brooches, pins, or hybrid functional items."
305
- }
306
- ]
307
- },
308
- {
309
- id: "jewelry-creative-wearables",
310
- name: "Jewelry & Creative Wearables",
311
- items: [
312
- {
313
- id: "jewelry",
314
- name: "Jewelry",
315
- description: "Necklaces, earrings, bracelets, rings, anklets."
316
- },
317
- {
318
- id: "other-creative-wearables",
319
- name: "Other creative wearables",
320
- description: "Wearable art, statement pieces, bold handmade designs."
321
- }
322
- ]
323
- },
324
- {
325
- id: "traditional-cultural-clothing-accessories",
326
- name: "Traditional & Cultural Clothing and Accessories",
327
- items: [
328
- {
329
- id: "traditional-clothing-accessories",
330
- name: "Traditional Clothing & Accessories ",
331
- description: "raditional clothing, jewellery, accessories and footwear from around the world, including both handmade and non-handmade items."
332
- },
333
- {
334
- id: "other-traditional-cultural-items",
335
- name: "Other Traditional & Cultural Items",
336
- description: "traditional or culturally inspired wearables and decorative cultural pieces such as plates, table linens and similar items."
337
- }
338
- ]
339
- }
340
- ]
341
- }
342
- ];
343
- var electronicsAndTechnology = [
344
- {
345
- id: "electronics-technology",
346
- name: "Electronics & Technology",
347
- description: "New, second-hand, or handmade tech and digital items commonly found at markets.",
348
- subcategories: [
349
- {
350
- id: "mobile-everyday-tech",
351
- name: "Mobile & Everyday Tech",
352
- items: [
353
- {
354
- id: "mobile-phone-accessories",
355
- name: "Mobile & Phone Accessories",
356
- description: "Phone cases, holders, screen protectors, charging cables, power banks, grips."
357
- },
358
- {
359
- id: "other-mobile-gadgets",
360
- name: "Other mobile gadgets",
361
- description: "Stands, styluses, SIM tools, cleaning kits, wallet accessories."
362
- }
363
- ]
364
- },
365
- {
366
- id: "audio-music-creative-tech",
367
- name: "Audio, Music & Creative Tech",
368
- items: [
369
- {
370
- id: "audio-music-tech",
371
- name: "Audio & Music Tech",
372
- description: "Portable speakers, headphones, mini radios, Bluetooth adapters, sound accessories."
373
- },
374
- {
375
- id: "instruments-music-gear",
376
- name: "Instruments & Music Gear",
377
- description: "Small electronic instruments, DIY synth kits, drum pads, loop machines."
378
- },
379
- {
380
- id: "recording-creative-devices",
381
- name: "Recording & Creative Devices",
382
- description: "USB microphones, podcast tools, voice recorders, mobile lighting, content tools."
383
- },
384
- {
385
- id: "other-audio-music-items",
386
- name: "Other audio or music-related items",
387
- description: "Musical gadgets or creative gear not listed above."
388
- }
389
- ]
390
- },
391
- {
392
- id: "diy-gadgets-secondhand-finds",
393
- name: "DIY, Gadgets & Second-Hand Finds",
394
- items: [
395
- {
396
- id: "diy-electronics-tools",
397
- name: "DIY Electronics & Tools",
398
- description: "LED lights, USB gadgets, circuit boards, repair kits, tech-themed toys, novelty items."
399
- },
400
- {
401
- id: "other-tech-finds",
402
- name: "Other Tech Finds",
403
- description: "Used electronics, smart gadgets, wearable tech, calculators, tablet stands, e-waste upcycles."
404
- },
405
- {
406
- id: "other-technology-innovation-items",
407
- name: "Other technology or innovation-related items",
408
- description: "Anything not covered but clearly tech-driven."
409
- }
410
- ]
411
- }
412
- ]
413
- }
414
- ];
415
- var foodAndBeverages = [
416
- {
417
- id: "food-beverages",
418
- name: "Food & Beverages",
419
- description: "Fresh produce, drinks, sweet and savoury street food, ready-to-eat meals, and packaged goods.",
420
- subcategories: [
421
- {
422
- id: "fresh-food-groceries",
423
- name: "Fresh Food & Groceries",
424
- items: [
425
- {
426
- id: "fruits-vegetables",
427
- name: "Fruits & Vegetables",
428
- description: "Fresh seasonal fruit, organic vegetables, specialty produce, berries, tropical fruit, heritage varieties."
429
- },
430
- {
431
- id: "meat-seafood",
432
- name: "Meat & Seafood",
433
- description: "Butcher cuts, fresh fish, smoked meats, sausages, seafood platters, artisanal jerky."
434
- },
435
- {
436
- id: "dairy-eggs",
437
- name: "Dairy & Eggs",
438
- description: "Farm eggs, handmade cheeses, yoghurt, fresh milk, goat\u2019s milk products."
439
- },
440
- {
441
- id: "bakery-pastries",
442
- name: "Bakery & Pastries",
443
- description: "Freshly baked bread, sourdough, bagels, croissants, focaccia, traditional baked goods."
444
- },
445
- {
446
- id: "spices-condiments",
447
- name: "Spices & Condiments",
448
- description: "Dried herbs, spice blends, specialty salts, hot sauces, infused oils, chutneys."
449
- },
450
- {
451
- id: "packaged-specialty-foods",
452
- name: "Packaged & Specialty Foods",
453
- description: "Honey, jams, preserves, pickles, nut butters, sauces, pre-packaged snacks."
454
- },
455
- {
456
- id: "other-fresh-food-items",
457
- name: "Other fresh food items",
458
- description: "Items that don\u2019t fit above, e.g. fermented foods, plant-based substitutes."
459
- }
460
- ]
461
- },
462
- {
463
- id: "beverages-specialty-drinks",
464
- name: "Beverages & Specialty Drinks",
465
- items: [
466
- {
467
- id: "fresh-juices-smoothies",
468
- name: "Fresh Juices & Smoothies",
469
- description: "Cold-pressed juices, detox blends, fruit smoothies, tropical mixes."
470
- },
471
- {
472
- id: "coffee-teas",
473
- name: "Coffee & Teas",
474
- description: "Espresso, pour-over coffee, herbal teas, matcha, bubble tea, locally blended tea."
475
- },
476
- {
477
- id: "dairy-plant-based-drinks",
478
- name: "Dairy & Plant-Based Drinks",
479
- description: "Milkshakes, lassis, almond/oat milk drinks, coconut water."
480
- },
481
- {
482
- id: "alcoholic-beverages",
483
- name: "Alcoholic Beverages",
484
- description: "Local wines, craft beer, mead, cider, infused spirits, cocktail kits."
485
- },
486
- {
487
- id: "other-beverages",
488
- name: "Other beverages",
489
- description: "Kombucha, kefir, energy drinks, non-alcoholic wines or beers."
490
- }
491
- ]
492
- },
493
- {
494
- id: "savoury-prepared-foods-street-food",
495
- name: "Savoury Prepared Foods & Street Food",
496
- items: [
497
- {
498
- id: "local-specialties",
499
- name: "Local Specialties",
500
- description: "Meat pies, hangi, seafood chowder, fry bread, traditional NZ dishes."
501
- },
502
- {
503
- id: "asian-cuisine",
504
- name: "Asian Cuisine",
505
- description: "Sushi, bao buns, dumplings, ramen, satay, spring rolls, fried rice."
506
- },
507
- {
508
- id: "mediterranean-cuisine",
509
- name: "Mediterranean Cuisine",
510
- description: "Falafel, hummus wraps, souvlaki, Greek salad, dolma."
511
- },
512
- {
513
- id: "italian-delights",
514
- name: "Italian Delights",
515
- description: "Pizza, calzone, focaccia, fresh pasta, arancini."
516
- },
517
- {
518
- id: "bbq-grilled-foods",
519
- name: "BBQ & Grilled Foods",
520
- description: "Kebabs, grilled chicken, ribs, burgers, sausages."
521
- },
522
- {
523
- id: "savoury-crepes-pancakes",
524
- name: "Savoury Crepes & Pancakes",
525
- description: "Filled savoury crepes, mini savoury pancakes."
526
- },
527
- {
528
- id: "savoury-baked-goods-pastries",
529
- name: "Savoury Baked Goods & Pastries",
530
- description: "Quiches, savoury muffins, filled savoury pastries, empanadas."
531
- },
532
- {
533
- id: "vegan-vegetarian-dishes",
534
- name: "Vegan & Vegetarian Dishes",
535
- description: "Buddha bowls, plant-based burgers, salads, vegan sushi."
536
- },
537
- {
538
- id: "other-savoury-foods",
539
- name: "Other Savoury Foods",
540
- description: "Fusion dishes, mixed platters, savoury meal kits."
541
- }
542
- ]
543
- },
544
- {
545
- id: "sweet-prepared-foods",
546
- name: "Sweet Prepared Foods",
547
- items: [
548
- {
549
- id: "sweet-crepes-pancakes-fried-treats",
550
- name: "Sweet Crepes, Pancakes & Fried Treats",
551
- description: "Crepes, waffles, mini pancakes, muffins, doughnuts."
552
- },
553
- {
554
- id: "sweet-baked-goods-desserts",
555
- name: "Sweet Baked Goods & Desserts",
556
- description: "Cakes, pastries, slices, trifles, layered desserts."
557
- },
558
- {
559
- id: "fruit-based-snacks",
560
- name: "Fruit-Based Snacks",
561
- description: "Fruit skewers, dried fruit packs, chocolate-dipped fruit."
562
- },
563
- {
564
- id: "candy-confectionery",
565
- name: "Candy & Confectionery",
566
- description: "Fudge, handmade candies, toffee, nougat, brittle."
567
- },
568
- {
569
- id: "other-sweet-foods",
570
- name: "Other Sweet Foods",
571
- description: "Fusion desserts, sweet platters, sweet meal kits."
572
- }
573
- ]
574
- }
575
- ]
576
- }
577
- ];
578
- var handmadeAndLocalProducts = [
579
- {
580
- id: "handmade-local-products",
581
- name: "Handmade & Local Products",
582
- description: "Unique, handmade, or locally produced artisan goods.",
583
- subcategories: [
584
- {
585
- id: "home-living",
586
- name: "Home & Living",
587
- items: [
588
- {
589
- id: "ceramics-pottery",
590
- name: "Ceramics & Pottery",
591
- description: "Handmade mugs, vases, bowls, decorative plates, plant pots."
592
- },
593
- {
594
- id: "candles-home-scents",
595
- name: "Candles & Home Scents",
596
- description: "Soy candles, beeswax candles, wax melts, incense sticks, room sprays and herbal sachets."
597
- },
598
- {
599
- id: "botanical-crafts",
600
- name: "Botanical Crafts",
601
- description: "Dried-flower d\xE9cor and pressed-flower crafts"
602
- },
603
- {
604
- id: "textiles-embroidery",
605
- name: "Textiles & Embroidery",
606
- description: "Handsewn items, embroidered napkins, home linens, aprons, fabric gift wraps, handmade fabric bags, quilted goods, personalized textile gifts."
607
- },
608
- {
609
- id: "woodcraft-metalcraft",
610
- name: "Woodcraft & Metalcraft",
611
- description: "Wooden boards, handmade frames, sculptures, metal signs, furniture."
612
- },
613
- {
614
- id: "handmade-soaps-natural-body-goods",
615
- name: "Handmade Soaps & Natural Body Goods",
616
- description: "Handmade soaps, balms, oils, bath items"
617
- },
618
- {
619
- id: "seasonal-festive-crafts",
620
- name: "Seasonal & Festive Crafts",
621
- description: "Christmas, Easter and seasonal handmade decor"
622
- },
623
- {
624
- id: "other-home-living-products",
625
- name: "Other home & living products",
626
- description: "Items that don't fit above but serve home-related purposes."
627
- }
628
- ]
629
- },
630
- {
631
- id: "art-personal-expression",
632
- name: "Art & Personal Expression",
633
- items: [
634
- {
635
- id: "paintings-illustrations",
636
- name: "Paintings & Illustrations",
637
- description: "Paintings, canvas art, hand-drawn illustrations, digital prints, graphic art and calligraphy pieces."
638
- },
639
- {
640
- id: "sculptures-carvings",
641
- name: "Sculptures & Carvings ",
642
- description: "Sculptures made from wood, stone, metal, clay or resin, carved decorative pieces and artistic 3D works."
643
- },
644
- {
645
- id: "creative-handmade-alternative-art",
646
- name: "Creative Handmade & Alternative Art",
647
- description: "Handmade textile d\xE9cor, fabric ornaments, mixed-media art, creative craft pieces and modern handmade artworks."
648
- },
649
- {
650
- id: "handmade-mini-figures-decor",
651
- name: "Handmade Mini Figures & D\xE9cor",
652
- description: "Small handmade figures, tiny houses and crafted mini decorative items."
653
- },
654
- {
655
- id: "other-artistic-expressive-products",
656
- name: "Other Artistic or Expressive Products",
657
- description: "Custom artworks, specialty handmade d\xE9cor, unique crafts."
658
- }
659
- ]
660
- },
661
- {
662
- id: "handmade-jewellery-accessories-cultural-crafts",
663
- name: "Handmade Jewellery, Accessories & Cultural Crafts",
664
- items: [
665
- {
666
- id: "jewellery-handmade-items-nz-traditional-materials",
667
- name: "Jewellery & Handmade Items from NZ Traditional Materials",
668
- description: "Handmade jewellery and decorative or functional items crafted from pounamu, bone, wood and other traditional New Zealand materials."
669
- },
670
- {
671
- id: "maori-pasifika-cultural-crafts-clothing",
672
- name: "M\u0101ori & Pasifika Cultural Crafts and Clothing",
673
- description: "Culturally inspired handmade items, accessories and garments featuring M\u0101ori or Pasifika motifs, traditional patterns and regional craftsmanship."
674
- },
675
- {
676
- id: "traditional-handmade-clothing-jewellery-crafts-global-cultures",
677
- name: "Traditional Handmade Clothing, Jewellery & Crafts from Global Cultures",
678
- description: "Handcrafted clothing, jewellery and cultural items from diverse traditions \u2014 including Asian, African, European, Middle Eastern, Indian, Chinese, Japanese, Pacific, and other culturally significant handmade pieces."
679
- },
680
- {
681
- id: "other-handmade-cultural-items",
682
- name: "Other Handmade Cultural Items",
683
- description: "Unique or culturally inspired handmade pieces not specifically covered in the categories above."
684
- }
685
- ]
686
- },
687
- {
688
- id: "gift-ideas-accessories",
689
- name: "Gift Ideas & Accessories",
690
- items: [
691
- {
692
- id: "handmade-pens-keychains-fridge-magnets",
693
- name: "Handmade Pens, Keychains and Fridge Magnets",
694
- description: null
695
- },
696
- {
697
- id: "gift-packaging-wrapping-accessories",
698
- name: "Gift Packaging & Wrapping Accessories",
699
- description: null
700
- },
701
- {
702
- id: "handmade-crochet-knitting-fibre-crafts",
703
- name: "Handmade Crochet, Knitting & Fibre Crafts",
704
- description: "Handmade crochet and knitted items, fabric-based crafts, small decorative pieces, creative fibre artworks and unique handcrafted accessories."
705
- },
706
- {
707
- id: "handmade-toys-mini-play-items",
708
- name: "Handmade Toys & Mini Play Items",
709
- description: "small handmade toys, soft toys, wooden miniatures, crochet or felt play pieces"
710
- },
711
- {
712
- id: "other-small-handmade-gifts-accessories",
713
- name: "Other small handmade gifts or accessories",
714
- description: "Compact creative items made to surprise or delight."
715
- }
716
- ]
717
- }
718
- ]
719
- }
720
- ];
721
- var healthAndWellness = [
722
- {
723
- id: "health-wellness",
724
- name: "Health & Wellness",
725
- description: "Natural products and services that promote wellbeing, body care, and holistic health.",
726
- subcategories: [
727
- {
728
- id: "body-skincare",
729
- name: "Body & Skincare",
730
- items: [
731
- {
732
- id: "skincare-body-products",
733
- name: "Skincare & Body Products",
734
- description: "Soaps, creams, lip balms, bath salts, bath bombs, body oils, natural deodorants."
735
- },
736
- {
737
- id: "other-body-care-items",
738
- name: "Other body care items",
739
- description: "Additional handmade or eco-conscious personal care goods."
740
- }
741
- ]
742
- },
743
- {
744
- id: "aromatherapy-herbal-wellness",
745
- name: "Aromatherapy & Herbal Wellness",
746
- items: [
747
- {
748
- id: "aromatherapy-herbal-remedies",
749
- name: "Aromatherapy & Herbal Remedies",
750
- description: "Essential oils, herbal balms, massage oils, salves, natural teas, rollers."
751
- },
752
- {
753
- id: "other-herbal-aroma-products",
754
- name: "Other herbal or aroma-based products",
755
- description: "Wellness blends, herb sachets, custom infusions."
756
- }
757
- ]
758
- },
759
- {
760
- id: "wellness-tools-accessories",
761
- name: "Wellness Tools & Accessories",
762
- items: [
763
- {
764
- id: "wellness-accessories",
765
- name: "Wellness Accessories",
766
- description: "Yoga mats, meditation cushions, eye pillows, incense, smudging sticks, eco water bottles, wellness journals."
767
- },
768
- {
769
- id: "spiritual-tools-crystals",
770
- name: "Spiritual Tools & Crystals",
771
- description: "Healing crystals, gemstone bracelets, pendulums, sprays, spiritual kits, altar decor."
772
- },
773
- {
774
- id: "other-wellness-spiritual-items",
775
- name: "Other wellness or spiritual items",
776
- description: "Items that aid relaxation, focus, or inner work."
777
- }
778
- ]
779
- }
780
- ]
781
- }
782
- ];
783
- var homeGardenHousehold = [
784
- {
785
- id: "home-garden-household-goods",
786
- name: "Home, Garden & Household Goods",
787
- description: "Functional, decorative, and eco-conscious products designed for everyday use indoors and outdoors.",
788
- subcategories: [
789
- {
790
- id: "home-decor-living",
791
- name: "Home Decor & Living",
792
- items: [
793
- {
794
- id: "home-decor",
795
- name: "Home Decor",
796
- description: "Cushions, wall art, table runners, vases, trays, mirrors, handmade centerpieces."
797
- },
798
- {
799
- id: "kitchenware-dining",
800
- name: "Kitchenware & Dining",
801
- description: "Mugs, bowls, cutting boards, utensils, jars, coasters, kitchen textiles."
802
- },
803
- {
804
- id: "mini-figures-decor",
805
- name: "Mini Figures & D\xE9cor",
806
- description: "handmade or non-handmade small figures, tiny houses and miniature decorative items."
807
- },
808
- {
809
- id: "other-indoor-home-items",
810
- name: "Other indoor home items",
811
- description: "Any decorative or practical household items not listed above."
812
- }
813
- ]
814
- },
815
- {
816
- id: "cleaning-eco-essentials",
817
- name: "Cleaning & Eco Essentials",
818
- items: [
819
- {
820
- id: "cleaning-eco-supplies",
821
- name: "Cleaning & Eco Supplies",
822
- description: "Beeswax wraps, reusable cloths, brushes, natural soaps, detergent bars, eco sponges."
823
- },
824
- {
825
- id: "other-eco-cleaning-items",
826
- name: "Other eco or cleaning items",
827
- description: "Environmentally friendly goods not listed above."
828
- }
829
- ]
830
- },
831
- {
832
- id: "garden-outdoor-living",
833
- name: "Garden & Outdoor Living",
834
- items: [
835
- {
836
- id: "plants-botanical-decor",
837
- name: "Plants & Botanical Decor",
838
- description: "Potted herbs, succulents, dried flowers, terrariums, plant-based ornaments."
839
- },
840
- {
841
- id: "fresh-flowers-botanical-bouquets",
842
- name: "Fresh Flowers & Botanical Bouquets",
843
- description: "Cut flowers, seasonal bouquets, simple floral arrangements, native flower selections, and other fresh botanical items."
844
- },
845
- {
846
- id: "natural-decor-nature-inspired-elements",
847
- name: "Natural Decor & Nature-Inspired Elements",
848
- description: "Seashell d\xE9cor, driftwood pieces, sand ornaments, natural wood accents, stone or mineral decorations, and other nature-based decorative items."
849
- },
850
- {
851
- id: "garden-tools-outdoor-items",
852
- name: "Garden Tools & Outdoor Items",
853
- description: "Plant markers, garden signs, stakes, small tools, wind chimes, gifts."
854
- },
855
- {
856
- id: "other-outdoor-garden-products",
857
- name: "Other outdoor or garden products",
858
- description: "Functional or decorative items for outside use."
859
- }
860
- ]
861
- }
862
- ]
863
- }
864
- ];
865
- var petProductsAndAnimalGoods = [
866
- {
867
- id: "pet-products-animal-goods",
868
- name: "Pet Products & Animal Goods",
869
- description: "Items for pets, pet lovers, or animal-themed market stalls.",
870
- subcategories: [
871
- {
872
- id: "products-for-pets",
873
- name: "Products for Pets",
874
- items: [
875
- {
876
- id: "pet-food-treats",
877
- name: "Pet Food & Treats",
878
- description: "Homemade dog biscuits, cat snacks, natural chews, pet-safe cakes, training treats."
879
- },
880
- {
881
- id: "apparel-toys-accessories",
882
- name: "Apparel, Toys & Accessories",
883
- description: "Leashes, collars, harnesses, toys, grooming tools, beds, travel gear, jumpers, bandanas."
884
- },
885
- {
886
- id: "other-pet-products",
887
- name: "Other pet products",
888
- description: "Any pet-related items not listed above."
889
- }
890
- ]
891
- },
892
- {
893
- id: "small-pets-birds-exotic-animals",
894
- name: "Small Pets, Birds & Exotic Animals",
895
- items: [
896
- {
897
- id: "products-small-pets-birds-exotics",
898
- name: "Products for Small Pets, Birds & Exotics",
899
- description: "Toys, enclosures, perches, feeding bowls, bedding, habitat decor, transport gear, and care items for birds, rabbits, hamsters, reptiles, turtles, aquarium pets, and other exotic species."
900
- },
901
- {
902
- id: "other-small-exotic-animal-items",
903
- name: "Other small or exotic animal items",
904
- description: "Unusual accessories for non-mainstream pets."
905
- }
906
- ]
907
- },
908
- {
909
- id: "farm-working-animals",
910
- name: "Farm & Working Animals",
911
- items: [
912
- {
913
- id: "goods-for-farm-working-animals",
914
- name: "Goods for Farm & Working Animals",
915
- description: "Treats, care products, equipment, signage and accessories for chickens, goats, alpacas, horses, and other livestock."
916
- },
917
- {
918
- id: "other-farm-animal-items",
919
- name: "Other farm animal-related items",
920
- description: "Rural, barnyard, or utility-specific gear not listed above."
921
- }
922
- ]
923
- },
924
- {
925
- id: "animal-themed-gifts-custom-items",
926
- name: "Animal-Themed Gifts & Custom Items",
927
- items: [
928
- {
929
- id: "pet-art-custom-gifts",
930
- name: "Pet Art & Custom Gifts",
931
- description: "Pet portraits, name tags, personalized bowls, breed-specific items, pet-themed home decor and stationery."
932
- },
933
- {
934
- id: "other-animal-themed-gifts",
935
- name: "Other animal-themed gifts",
936
- description: "Artistic or sentimental items made for animal lovers."
937
- }
938
- ]
939
- }
940
- ]
941
- }
942
- ];
943
- var serviceAndExperience = [
944
- {
945
- id: "services-experiences",
946
- name: "Services & Experiences",
947
- description: "On-site offerings that provide entertainment, personal care, learning, or interactive activities beyond products.",
948
- subcategories: [
949
- {
950
- id: "personal-care-body-art",
951
- name: "Personal Care & Body Art",
952
- items: [
953
- {
954
- id: "nails-handcare",
955
- name: "Nails & Handcare",
956
- description: "Nail painting, decoration, quick manicures, temporary nail extensions."
957
- },
958
- {
959
- id: "hair-styling-braiding",
960
- name: "Hair Styling & Braiding",
961
- description: "Hair braiding, plaits, child-friendly festival hairstyles."
962
- },
963
- {
964
- id: "face-body-decoration",
965
- name: "Face & Body Decoration",
966
- description: "Henna, glitter tattoos, face painting, light makeup, eyelash styling, professional tattooing (where permitted)."
967
- },
968
- {
969
- id: "other-beauty-grooming-services",
970
- name: "Other beauty or grooming services",
971
- description: "Small-scale personal care options offered on-site."
972
- }
973
- ]
974
- },
975
- {
976
- id: "practical-wellness-services",
977
- name: "Practical & Wellness Services",
978
- items: [
979
- {
980
- id: "mobile-practical-services",
981
- name: "Mobile & Practical Services",
982
- description: "Shoe repair, phone repairs, knife sharpening, key cutting, battery replacement, bike repairs, engraving."
983
- },
984
- {
985
- id: "wellness-alternative-therapies",
986
- name: "Wellness & Alternative Therapies",
987
- description: "Massage, aromatherapy, reflexology, energy healing (e.g. Reiki), natural consultations."
988
- },
989
- {
990
- id: "other-service-based-offerings",
991
- name: "Other service-based offerings",
992
- description: "Wellness or functional services not listed above."
993
- }
994
- ]
995
- },
996
- {
997
- id: "creative-educational-experiences",
998
- name: "Creative & Educational Experiences",
999
- items: [
1000
- {
1001
- id: "creative-workshops-maker-services",
1002
- name: "Creative Workshops & Maker Services",
1003
- description: "Candle making, pottery, jewelry crafting, soap or balm workshops, calligraphy, seasonal crafts."
1004
- },
1005
- {
1006
- id: "education-awareness-stalls",
1007
- name: "Education & Awareness Stalls",
1008
- description: "Eco awareness, cultural storytelling, local history, first aid demos, health booths, sustainability education, kids\u2019 science displays."
1009
- },
1010
- {
1011
- id: "other-creative-educational-services",
1012
- name: "Other creative or educational services",
1013
- description: "Informal learning, demonstrations, or community-focused sessions."
1014
- }
1015
- ]
1016
- },
1017
- {
1018
- id: "kids-activities-family-fun",
1019
- name: "Kids\u2019 Activities & Family Fun",
1020
- items: [
1021
- {
1022
- id: "kids-activities-fun",
1023
- name: "Kids\u2019 Activities & Fun",
1024
- description: "Face painting, glitter tattoos, pony rides, bouncy castles, small amusement rides, balloon twisting, animal petting zones."
1025
- },
1026
- {
1027
- id: "other-family-oriented-activities",
1028
- name: "Other family-oriented activities",
1029
- description: "On-site entertainment that engages children or family groups."
1030
- }
1031
- ]
1032
- }
1033
- ]
1034
- }
1035
- ];
1036
- var toysChildren = [
1037
- {
1038
- id: "toys-childrens-items",
1039
- name: "Toys & Children\u2019s Items",
1040
- description: "Products and services made for or inspired by children.",
1041
- subcategories: [
1042
- {
1043
- id: "toys-playthings",
1044
- name: "Toys & Playthings",
1045
- items: [
1046
- {
1047
- id: "toys-classic-electric-character",
1048
- name: "Toys \u2013 Classic, Electric & Character-Based",
1049
- description: "Building blocks, dolls, puzzles, plush animals, toy vehicles, remote-control toys, light-up gadgets, character figurines, themed playsets."
1050
- },
1051
- {
1052
- id: "handmade-toys-crafty-playthings",
1053
- name: "Handmade Toys & Crafty Playthings",
1054
- description: "Wooden puzzles, crocheted animals, felt toys, fabric dolls, DIY kits, nature-inspired games, sensory toys."
1055
- },
1056
- {
1057
- id: "other-play-items",
1058
- name: "Other play items",
1059
- description: "Toys not listed above, including limited-edition or hybrid items."
1060
- }
1061
- ]
1062
- },
1063
- {
1064
- id: "educational-developmental",
1065
- name: "Educational & Developmental",
1066
- items: [
1067
- {
1068
- id: "educational-developmental-tools",
1069
- name: "Educational & Developmental Tools",
1070
- description: "STEM kits, Montessori toys, storybooks, picture books, flashcards, early learning games, language tools."
1071
- },
1072
- {
1073
- id: "other-educational-experience-based-items",
1074
- name: "Other educational or experience-based items",
1075
- description: "Creative experiences or learning aids not listed above."
1076
- }
1077
- ]
1078
- },
1079
- {
1080
- id: "baby-kidswear-accessories",
1081
- name: "Baby & Kidswear + Accessories",
1082
- items: [
1083
- {
1084
- id: "baby-kidswear-accessories",
1085
- name: "Baby & Kidswear + Accessories",
1086
- description: "Handmade baby clothes, toddler outfits, bibs, hats, headbands, bags, pacifier clips, soft shoes."
1087
- },
1088
- {
1089
- id: "baby-developmental-soft-toys",
1090
- name: "Baby Developmental Soft Toys",
1091
- description: "Sensory toys, rattles, fabric books, teething items, high-contrast cards, and early-skill. Montessori materials designed to support infants\u2019 cognitive and motor development."
1092
- },
1093
- {
1094
- id: "other-childrens-clothing-accessories",
1095
- name: "Other children\u2019s clothing or accessories",
1096
- description: "Unique fashion or functional pieces for kids."
1097
- }
1098
- ]
1099
- }
1100
- ]
1101
- }
1102
- ];
1103
- var vintageAndAntique = [
1104
- {
1105
- id: "vintage-antique",
1106
- name: "Vintage & Antique",
1107
- description: "Unique, historic, or nostalgic items with collectible or decorative value.",
1108
- subcategories: [
1109
- {
1110
- id: "vintage-antique-clothing-accessories",
1111
- name: "Vintage & Antique Clothing & Accessories",
1112
- items: [
1113
- {
1114
- id: "clothing-vintage-fashion",
1115
- name: "Clothing and wearable items from past eras",
1116
- description: "Vintage dresses, jackets, hats, gloves, belts, bags, shoes, jewellery."
1117
- },
1118
- {
1119
- id: "other-clothing-accessory-items",
1120
- name: "Other clothing-related items",
1121
- description: "Hair clips, brooches, pins, scarf rings, small fashion accessories."
1122
- }
1123
- ]
1124
- },
1125
- {
1126
- id: "collectibles-memorabilia",
1127
- name: "Collectibles & Memorabilia",
1128
- items: [
1129
- {
1130
- id: "small-collectible-items",
1131
- name: "Small collectible items with historical or nostalgic significance",
1132
- description: "Coins, stamps, toys, postcards, comics, sports cards, vintage packaging."
1133
- },
1134
- {
1135
- id: "other-collectible-items",
1136
- name: "Other collectible items",
1137
- description: "Rare small objects, miniature figurines, special-edition items."
1138
- }
1139
- ]
1140
- },
1141
- {
1142
- id: "homewares-decor-curiosities",
1143
- name: "Homewares, Decor & Curiosities",
1144
- items: [
1145
- {
1146
- id: "decorative-functional-vintage-items",
1147
- name: "Decorative or functional items with a vintage or antique aesthetic",
1148
- description: "Teacups, plates, vases, mirrors, clocks, furniture, old tools, lanterns, typewriters, curiosities."
1149
- },
1150
- {
1151
- id: "handmade-vintage-art",
1152
- name: "Handmade vintage art",
1153
- description: "Paintings, sculptures, crafted pieces."
1154
- },
1155
- {
1156
- id: "other-home-decor-items",
1157
- name: "Other home or decor items",
1158
- description: "Decorative pieces not listed above, unique household objects."
1159
- }
1160
- ]
1161
- },
1162
- {
1163
- id: "vintage-media-printed-nostalgia",
1164
- name: "Vintage Media & Printed Nostalgia",
1165
- items: [
1166
- {
1167
- id: "older-media-printed-works",
1168
- name: "Older media formats and printed works",
1169
- description: "Vinyl records, cassette tapes, CDs, DVDs, books, magazines, board games, posters."
1170
- },
1171
- {
1172
- id: "other-media-printed-items",
1173
- name: "Other media or printed items",
1174
- description: "Maps, manuals, leaflets, out-of-print materials."
1175
- }
1176
- ]
1177
- },
1178
- {
1179
- id: "other-vintage-antique-items",
1180
- name: "Other Vintage & Antique Items",
1181
- items: [
1182
- {
1183
- id: "any-vintage-antique-items-not-listed",
1184
- name: "Any vintage or antique items not listed above",
1185
- description: "Unique, rare or uncategorised pieces."
1186
- }
1187
- ]
1188
- }
1189
- ]
1190
- }
1191
- ];
1192
- var categoryColors = {
1193
- "clothing-fashion": "#9D4EDD",
1194
- "electronics-technology": "#3AF3FF",
1195
- "food-beverages": "#FF0D1F",
1196
- "handmade-local-products": "#EE7E54",
1197
- "health-wellness": "#E23794",
1198
- "home-garden-household-goods": "#067325",
1199
- "pet-products-animal-goods": "#68E788",
1200
- "services-experiences": "#2E16A5",
1201
- "toys-childrens-items": "#FFF966",
1202
- "vintage-antique": "#8D6748"
1203
- };
1204
- var assignColorToCategories = (categories) => {
1205
- const result = categories.map((category) => ({
1206
- ...category,
1207
- color: categoryColors[category.id]
1208
- }));
1209
- return result;
1210
- };
1211
- var availableCategories = assignColorToCategories([
1212
- ...foodAndBeverages,
1213
- ...handmadeAndLocalProducts,
1214
- ...clothingAndFashion,
1215
- ...homeGardenHousehold,
1216
- ...toysChildren,
1217
- ...healthAndWellness,
1218
- ...electronicsAndTechnology,
1219
- ...vintageAndAntique,
1220
- ...petProductsAndAnimalGoods,
1221
- ...serviceAndExperience
1222
- ]);
1223
- var AFFILIATE_REWARDS = {
1224
- [
1225
- "NEW_EVENT_REGISTRATION"
1226
- /* NEW_EVENT_REGISTRATION */
1227
- ]: {
1228
- description: "10 points for new event registration (one-time reward)",
1229
- value: 10
1230
- },
1231
- [
1232
- "NEW_VENDOR_REGISTRATION"
1233
- /* NEW_VENDOR_REGISTRATION */
1234
- ]: {
1235
- description: "5 points for new vendor registration (one-time reward)",
1236
- value: 5
1237
- },
1238
- [
1239
- "ACTIVE_VENDOR_PRO_SUBSCRIPTION"
1240
- /* ACTIVE_VENDOR_PRO_SUBSCRIPTION */
1241
- ]: {
1242
- description: "3 points for active vendor pro subscription (monthly reward)",
1243
- value: 3
1244
- },
1245
- [
1246
- "ACTIVE_VENDOR_STANDARD_SUBSCRIPTION"
1247
- /* ACTIVE_VENDOR_STANDARD_SUBSCRIPTION */
1248
- ]: {
1249
- description: "1 point for active vendor standard subscription (monthly reward)",
1250
- value: 1
1251
- },
1252
- [
1253
- "ACTIVE_VENDOR_BONUS_REWARD"
1254
- /* ACTIVE_VENDOR_BONUS_REWARD */
1255
- ]: {
1256
- description: "5 bonus points for every 10th active vendor (one-time reward)",
1257
- value: 5
1258
- },
1259
- [
1260
- "ACTIVE_EVENT_WITH_VENDOR_REGISTRATIONS"
1261
- /* ACTIVE_EVENT_WITH_VENDOR_REGISTRATIONS */
1262
- ]: {
1263
- description: "40 points for active event with vendor registrations (one-time reward)",
1264
- value: 40
1265
- }
1266
- };
1267
- function createAffiliateReward(rewardType, createdAt) {
1268
- const reward = AFFILIATE_REWARDS[rewardType];
1269
- return {
1270
- createdAt,
1271
- redeemedAt: null,
1272
- rewardDescription: reward.description,
1273
- rewardType,
1274
- rewardValue: reward.value
1275
- };
1276
- }
29
+ // src/service/affiliate/awardAffiliateVendorSubscriptionRewards.ts
30
+ import {
31
+ EnumNotificationResourceType,
32
+ EnumNotificationType,
33
+ EnumResourceType
34
+ } from "@timardex/cluemart-shared";
35
+ import { createAffiliateReward } from "@timardex/cluemart-shared/utils";
1277
36
 
1278
37
  // src/service/saveNotificationsInDb.ts
1279
38
  async function saveNotificationsInDb(payload) {
@@ -1409,18 +168,26 @@ async function sendPushNotifications({
1409
168
  }
1410
169
 
1411
170
  // src/service/affiliate/vendorSubscriptionRewards.ts
1412
- import dayjs3 from "dayjs";
1413
- import timezone2 from "dayjs/plugin/timezone";
1414
- import utc2 from "dayjs/plugin/utc";
171
+ import {
172
+ EnumAffiliateRewardType,
173
+ EnumUserLicence as EnumUserLicence2
174
+ } from "@timardex/cluemart-shared";
175
+ import dayjs from "dayjs";
176
+ import timezone from "dayjs/plugin/timezone";
177
+ import utc from "dayjs/plugin/utc";
1415
178
 
1416
179
  // src/service/license/stripe/stripe.ts
180
+ import {
181
+ EnumSubscriptionStatus,
182
+ EnumUserLicence
183
+ } from "@timardex/cluemart-shared/enums";
1417
184
  var PRO_EVENT_PLANS = /* @__PURE__ */ new Set([
1418
- EnumUserLicence2.PRO_EVENT,
1419
- EnumUserLicence2.PRO_PLUS_EVENT
185
+ EnumUserLicence.PRO_EVENT,
186
+ EnumUserLicence.PRO_PLUS_EVENT
1420
187
  ]);
1421
188
  var PRO_VENDOR_PLANS = /* @__PURE__ */ new Set([
1422
- EnumUserLicence2.PRO_VENDOR,
1423
- EnumUserLicence2.PRO_PLUS_VENDOR
189
+ EnumUserLicence.PRO_VENDOR,
190
+ EnumUserLicence.PRO_PLUS_VENDOR
1424
191
  ]);
1425
192
  var PRO_PLANS = /* @__PURE__ */ new Set([
1426
193
  ...PRO_EVENT_PLANS,
@@ -1441,7 +208,7 @@ async function getPayingStripePlanFor(userId, now, payingPlans) {
1441
208
  if (stripe == null || stripe.subscriptionId == null) {
1442
209
  return { hasSubscription: false, plan: null, validTypes };
1443
210
  }
1444
- const hasActiveStatus = stripe.status === EnumSubscriptionStatus2.ACTIVE || stripe.status === EnumSubscriptionStatus2.TRIALING;
211
+ const hasActiveStatus = stripe.status === EnumSubscriptionStatus.ACTIVE || stripe.status === EnumSubscriptionStatus.TRIALING;
1445
212
  if (!hasActiveStatus || stripe.currentPlan == null) {
1446
213
  return { hasSubscription: false, plan: null, validTypes };
1447
214
  }
@@ -1459,25 +226,25 @@ async function getPayingEventStripeSubscriptionPlan(userId, now = /* @__PURE__ *
1459
226
  }
1460
227
 
1461
228
  // src/service/affiliate/vendorSubscriptionRewards.ts
1462
- dayjs3.extend(utc2);
1463
- dayjs3.extend(timezone2);
229
+ dayjs.extend(utc);
230
+ dayjs.extend(timezone);
1464
231
  var SUBSCRIPTION_REWARD_TIMEZONE = "Pacific/Auckland";
1465
232
  async function mapVendorLicenceToSubscriptionRewardType(userId, now = /* @__PURE__ */ new Date()) {
1466
233
  const { hasSubscription, validTypes } = await getPayingVendorStripeSubscriptionPlan(userId, now);
1467
- if (validTypes.has(EnumUserLicence.PRO_VENDOR) || validTypes.has(EnumUserLicence.PRO_PLUS_VENDOR)) {
234
+ if (validTypes.has(EnumUserLicence2.PRO_VENDOR) || validTypes.has(EnumUserLicence2.PRO_PLUS_VENDOR)) {
1468
235
  if (hasSubscription) {
1469
236
  return EnumAffiliateRewardType.ACTIVE_VENDOR_PRO_SUBSCRIPTION;
1470
237
  }
1471
238
  return EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
1472
239
  }
1473
- if (validTypes.has(EnumUserLicence.STANDARD_VENDOR)) {
240
+ if (validTypes.has(EnumUserLicence2.STANDARD_VENDOR)) {
1474
241
  return EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
1475
242
  }
1476
243
  return null;
1477
244
  }
1478
245
  function getSubscriptionRewardPeriodBounds(now = /* @__PURE__ */ new Date()) {
1479
- const periodStart = dayjs3(now).tz(SUBSCRIPTION_REWARD_TIMEZONE).startOf("month").toDate();
1480
- const periodEnd = dayjs3(now).tz(SUBSCRIPTION_REWARD_TIMEZONE).startOf("month").add(1, "month").toDate();
246
+ const periodStart = dayjs(now).tz(SUBSCRIPTION_REWARD_TIMEZONE).startOf("month").toDate();
247
+ const periodEnd = dayjs(now).tz(SUBSCRIPTION_REWARD_TIMEZONE).startOf("month").add(1, "month").toDate();
1481
248
  return { periodEnd, periodStart };
1482
249
  }
1483
250
 
@@ -1738,6 +505,7 @@ async function notifyUsers({
1738
505
  }
1739
506
 
1740
507
  // src/service/updateAdStatus.ts
508
+ import { EnumAdStatus } from "@timardex/cluemart-shared";
1741
509
  async function updateAdStatuses() {
1742
510
  const now = /* @__PURE__ */ new Date();
1743
511
  const invalidResult = await AdModel.updateMany(
@@ -1801,11 +569,16 @@ function convertObjectIdsToStrings(obj) {
1801
569
  }
1802
570
 
1803
571
  // src/service/event/updateAllEventDateTimeStatuses.ts
1804
- import dayjs4 from "dayjs";
1805
- import customParseFormat2 from "dayjs/plugin/customParseFormat";
572
+ import {
573
+ dateFormat,
574
+ EnumEventDateStatus,
575
+ timeFormat
576
+ } from "@timardex/cluemart-shared";
577
+ import dayjs2 from "dayjs";
578
+ import customParseFormat from "dayjs/plugin/customParseFormat";
1806
579
  import isoWeek from "dayjs/plugin/isoWeek";
1807
- dayjs4.extend(customParseFormat2);
1808
- dayjs4.extend(isoWeek);
580
+ dayjs2.extend(customParseFormat);
581
+ dayjs2.extend(isoWeek);
1809
582
  function getFutureEventStatus(startDateTime, now) {
1810
583
  const hoursUntilStart = startDateTime.diff(now, "hour", true);
1811
584
  if (hoursUntilStart > 0 && hoursUntilStart <= 4) {
@@ -1825,14 +598,14 @@ function getFutureEventStatus(startDateTime, now) {
1825
598
  }
1826
599
  return EnumEventDateStatus.UPCOMING;
1827
600
  }
1828
- function updateSingleDateTimeStatus(dateTime, now = dayjs4()) {
601
+ function updateSingleDateTimeStatus(dateTime, now = dayjs2()) {
1829
602
  const dateTimeFormat = `${dateFormat} ${timeFormat}`;
1830
- const startDateTime = dayjs4(
603
+ const startDateTime = dayjs2(
1831
604
  `${dateTime.startDate} ${dateTime.startTime}`,
1832
605
  dateTimeFormat,
1833
606
  true
1834
607
  );
1835
- const endDateTime = dayjs4(
608
+ const endDateTime = dayjs2(
1836
609
  `${dateTime.endDate} ${dateTime.endTime}`,
1837
610
  dateTimeFormat,
1838
611
  true
@@ -1914,7 +687,7 @@ async function updateModelDateTimeStatuses(model, now) {
1914
687
  return updated;
1915
688
  }
1916
689
  async function updateAllEventDateTimeStatuses() {
1917
- const now = dayjs4();
690
+ const now = dayjs2();
1918
691
  const [eventCount, marketCount] = await Promise.all([
1919
692
  updateModelDateTimeStatuses(EventModel, now),
1920
693
  updateModelDateTimeStatuses(
@@ -1934,13 +707,16 @@ async function findEventOrImportedMarketById(resourceId) {
1934
707
  }
1935
708
  const normalizedId = convertObjectIdsToStrings(resourceId);
1936
709
  const [eventDoc, googleImportedDoc] = await Promise.all([
1937
- EventModel.findById(normalizedId).select("_id name dateTime").lean().exec(),
710
+ EventModel.findById(normalizedId).select("_id name dateTime owner").lean().exec(),
1938
711
  GoogleImportedMarketModel.findById(normalizedId).select("_id name dateTime").lean().exec()
1939
712
  ]);
1940
713
  return eventDoc ?? googleImportedDoc;
1941
714
  }
1942
715
 
1943
716
  // src/service/relations.ts
717
+ import {
718
+ EnumInviteStatus
719
+ } from "@timardex/cluemart-shared";
1944
720
  function didRemoveAnyEventDates(previousDateTime, nextDateTime) {
1945
721
  if (!previousDateTime?.length) {
1946
722
  return false;
@@ -1964,16 +740,20 @@ function updateRelationDatesToUnavailable(relationDates, eventDateTime) {
1964
740
  }
1965
741
 
1966
742
  // src/service/license/compliance/ensureUserLicenseCompliance.ts
1967
- import dayjs8 from "dayjs";
743
+ import dayjs6 from "dayjs";
1968
744
 
1969
745
  // src/service/license/compliance/utils.ts
1970
- import dayjs7 from "dayjs";
746
+ import {
747
+ EnumUserLicence as EnumUserLicence7
748
+ } from "@timardex/cluemart-shared";
749
+ import dayjs5 from "dayjs";
1971
750
 
1972
751
  // src/service/license/compliance/event.ts
752
+ import { EnumUserLicence as EnumUserLicence3 } from "@timardex/cluemart-shared";
1973
753
  var eventLicences = [
1974
- EnumUserLicence.STANDARD_EVENT,
1975
- EnumUserLicence.PRO_EVENT,
1976
- EnumUserLicence.PRO_PLUS_EVENT
754
+ EnumUserLicence3.STANDARD_EVENT,
755
+ EnumUserLicence3.PRO_EVENT,
756
+ EnumUserLicence3.PRO_PLUS_EVENT
1977
757
  ];
1978
758
  async function handleEventLicenceCompliance(user, now) {
1979
759
  if (!user.licences || !user.events?.length) {
@@ -2185,8 +965,9 @@ function buildLicenceExpiryPipeline(params) {
2185
965
  }
2186
966
 
2187
967
  // src/service/license/compliance/partner.ts
968
+ import { EnumUserLicence as EnumUserLicence4 } from "@timardex/cluemart-shared";
2188
969
  var partnerLicences = [
2189
- EnumUserLicence.STANDARD_PARTNER
970
+ EnumUserLicence4.STANDARD_PARTNER
2190
971
  ];
2191
972
  async function handlePartnerLicenceCompliance(user, now) {
2192
973
  if (!user.licences || !user.partner) {
@@ -2196,10 +977,21 @@ async function handlePartnerLicenceCompliance(user, now) {
2196
977
  }
2197
978
 
2198
979
  // src/service/license/compliance/vendor.ts
2199
- import dayjs6 from "dayjs";
980
+ import {
981
+ EnumNotificationResourceType as EnumNotificationResourceType2,
982
+ EnumNotificationType as EnumNotificationType2,
983
+ EnumSubscriptionStatus as EnumSubscriptionStatus2,
984
+ EnumUserLicence as EnumUserLicence6
985
+ } from "@timardex/cluemart-shared";
986
+ import dayjs4 from "dayjs";
2200
987
 
2201
988
  // src/service/license/models.ts
2202
- import dayjs5 from "dayjs";
989
+ import {
990
+ EnumResourceType as EnumResourceType2,
991
+ EnumUserLicence as EnumUserLicence5,
992
+ isNonVisitorResourceType
993
+ } from "@timardex/cluemart-shared";
994
+ import dayjs3 from "dayjs";
2203
995
  import { GraphQLError } from "graphql";
2204
996
  var LicenceExpiryDate = /* @__PURE__ */ ((LicenceExpiryDate2) => {
2205
997
  LicenceExpiryDate2["ONE_YEAR"] = "1 year";
@@ -2216,31 +1008,31 @@ var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
2216
1008
  return LicenceCategory2;
2217
1009
  })(LicenceCategory || {});
2218
1010
  var licenceCategoryMapping = {
2219
- [EnumUserLicence.PRO_EVENT]: "event" /* EVENT */,
2220
- [EnumUserLicence.PRO_PLUS_EVENT]: "event" /* EVENT */,
2221
- [EnumUserLicence.PRO_PLUS_VENDOR]: "vendor" /* VENDOR */,
2222
- [EnumUserLicence.PRO_VENDOR]: "vendor" /* VENDOR */,
2223
- [EnumUserLicence.STANDARD_EVENT]: "event" /* EVENT */,
2224
- [EnumUserLicence.STANDARD_PARTNER]: "partner" /* PARTNER */,
2225
- [EnumUserLicence.STANDARD_VENDOR]: "vendor" /* VENDOR */,
2226
- [EnumUserLicence.STANDARD_AFFILIATE]: "affiliate" /* AFFILIATE */,
2227
- [EnumUserLicence.STANDARD_SCHOOL]: "school" /* SCHOOL */
1011
+ [EnumUserLicence5.PRO_EVENT]: "event" /* EVENT */,
1012
+ [EnumUserLicence5.PRO_PLUS_EVENT]: "event" /* EVENT */,
1013
+ [EnumUserLicence5.PRO_PLUS_VENDOR]: "vendor" /* VENDOR */,
1014
+ [EnumUserLicence5.PRO_VENDOR]: "vendor" /* VENDOR */,
1015
+ [EnumUserLicence5.STANDARD_EVENT]: "event" /* EVENT */,
1016
+ [EnumUserLicence5.STANDARD_PARTNER]: "partner" /* PARTNER */,
1017
+ [EnumUserLicence5.STANDARD_VENDOR]: "vendor" /* VENDOR */,
1018
+ [EnumUserLicence5.STANDARD_AFFILIATE]: "affiliate" /* AFFILIATE */,
1019
+ [EnumUserLicence5.STANDARD_SCHOOL]: "school" /* SCHOOL */
2228
1020
  };
2229
1021
  var licencePriority = {
2230
- [EnumUserLicence.PRO_PLUS_EVENT]: 3,
2231
- [EnumUserLicence.PRO_EVENT]: 2,
2232
- [EnumUserLicence.STANDARD_EVENT]: 1,
2233
- [EnumUserLicence.PRO_PLUS_VENDOR]: 3,
2234
- [EnumUserLicence.PRO_VENDOR]: 2,
2235
- [EnumUserLicence.STANDARD_VENDOR]: 1,
2236
- [EnumUserLicence.STANDARD_PARTNER]: 1,
2237
- [EnumUserLicence.STANDARD_AFFILIATE]: 1,
2238
- [EnumUserLicence.STANDARD_SCHOOL]: 1
1022
+ [EnumUserLicence5.PRO_PLUS_EVENT]: 3,
1023
+ [EnumUserLicence5.PRO_EVENT]: 2,
1024
+ [EnumUserLicence5.STANDARD_EVENT]: 1,
1025
+ [EnumUserLicence5.PRO_PLUS_VENDOR]: 3,
1026
+ [EnumUserLicence5.PRO_VENDOR]: 2,
1027
+ [EnumUserLicence5.STANDARD_VENDOR]: 1,
1028
+ [EnumUserLicence5.STANDARD_PARTNER]: 1,
1029
+ [EnumUserLicence5.STANDARD_AFFILIATE]: 1,
1030
+ [EnumUserLicence5.STANDARD_SCHOOL]: 1
2239
1031
  };
2240
1032
  var standardLicences = [
2241
- EnumUserLicence.STANDARD_VENDOR,
2242
- EnumUserLicence.STANDARD_EVENT,
2243
- EnumUserLicence.STANDARD_PARTNER
1033
+ EnumUserLicence5.STANDARD_VENDOR,
1034
+ EnumUserLicence5.STANDARD_EVENT,
1035
+ EnumUserLicence5.STANDARD_PARTNER
2244
1036
  ];
2245
1037
  var standardLicenceSet = new Set(standardLicences);
2246
1038
  function isStandardLicence(licence) {
@@ -2254,11 +1046,11 @@ var categoryRegexMapping = {
2254
1046
  ["school" /* SCHOOL */]: /_school$/
2255
1047
  };
2256
1048
  var categoryFallbackLicence = {
2257
- ["event" /* EVENT */]: EnumUserLicence.STANDARD_EVENT,
2258
- ["partner" /* PARTNER */]: EnumUserLicence.STANDARD_PARTNER,
2259
- ["vendor" /* VENDOR */]: EnumUserLicence.STANDARD_VENDOR,
2260
- ["affiliate" /* AFFILIATE */]: EnumUserLicence.STANDARD_AFFILIATE,
2261
- ["school" /* SCHOOL */]: EnumUserLicence.STANDARD_SCHOOL
1049
+ ["event" /* EVENT */]: EnumUserLicence5.STANDARD_EVENT,
1050
+ ["partner" /* PARTNER */]: EnumUserLicence5.STANDARD_PARTNER,
1051
+ ["vendor" /* VENDOR */]: EnumUserLicence5.STANDARD_VENDOR,
1052
+ ["affiliate" /* AFFILIATE */]: EnumUserLicence5.STANDARD_AFFILIATE,
1053
+ ["school" /* SCHOOL */]: EnumUserLicence5.STANDARD_SCHOOL
2262
1054
  };
2263
1055
  var LicenceFilterInput = {
2264
1056
  INPUT_USER_LICENCES: "$licences"
@@ -2286,7 +1078,7 @@ function getHighestLicenceForCategory(licences, category) {
2286
1078
  return highestLicence;
2287
1079
  }
2288
1080
  function createLicenceObject(expiryDate, licenceType) {
2289
- const today = dayjs5();
1081
+ const today = dayjs3();
2290
1082
  const expiryDateMapping = {
2291
1083
  ["1 year" /* ONE_YEAR */]: today.add(1, "year").endOf("day").toDate(),
2292
1084
  ["1 month" /* ONE_MONTH */]: today.add(1, "month").endOf("day").toDate(),
@@ -2394,11 +1186,11 @@ async function checkOwnerHasLicence({
2394
1186
  const owner = await UserModel.findById(userId);
2395
1187
  if (!owner) throw new GraphQLError("Owner not found");
2396
1188
  const categoryByResource = {
2397
- [EnumResourceType.EVENT]: "event" /* EVENT */,
2398
- [EnumResourceType.PARTNER]: "partner" /* PARTNER */,
2399
- [EnumResourceType.VENDOR]: "vendor" /* VENDOR */,
2400
- [EnumResourceType.AFFILIATE]: "affiliate" /* AFFILIATE */,
2401
- [EnumResourceType.SCHOOL]: "school" /* SCHOOL */
1189
+ [EnumResourceType2.EVENT]: "event" /* EVENT */,
1190
+ [EnumResourceType2.PARTNER]: "partner" /* PARTNER */,
1191
+ [EnumResourceType2.VENDOR]: "vendor" /* VENDOR */,
1192
+ [EnumResourceType2.AFFILIATE]: "affiliate" /* AFFILIATE */,
1193
+ [EnumResourceType2.SCHOOL]: "school" /* SCHOOL */
2402
1194
  };
2403
1195
  if (!isNonVisitorResourceType(resourceType)) {
2404
1196
  throw new GraphQLError(`Invalid resource type: ${resourceType}.`);
@@ -2437,7 +1229,7 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
2437
1229
  return;
2438
1230
  }
2439
1231
  const updateData = {};
2440
- const isStandardVendor = licenceType === EnumUserLicence.STANDARD_VENDOR;
1232
+ const isStandardVendor = licenceType === EnumUserLicence6.STANDARD_VENDOR;
2441
1233
  if (isStandardVendor) {
2442
1234
  updateData.availability = {
2443
1235
  corporate: false,
@@ -2463,19 +1255,19 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
2463
1255
  }
2464
1256
  }
2465
1257
  var vendorLicences = [
2466
- EnumUserLicence.STANDARD_VENDOR,
2467
- EnumUserLicence.PRO_VENDOR,
2468
- EnumUserLicence.PRO_PLUS_VENDOR
1258
+ EnumUserLicence6.STANDARD_VENDOR,
1259
+ EnumUserLicence6.PRO_VENDOR,
1260
+ EnumUserLicence6.PRO_PLUS_VENDOR
2469
1261
  ];
2470
1262
  function isProtectedByCurrentStripeSubscription(user, licenceType, now) {
2471
1263
  const stripe = user.stripe;
2472
- if (!stripe?.subscriptionId || stripe.currentPlan !== licenceType || stripe.status !== EnumSubscriptionStatus.ACTIVE && stripe.status !== EnumSubscriptionStatus.TRIALING) {
1264
+ if (!stripe?.subscriptionId || stripe.currentPlan !== licenceType || stripe.status !== EnumSubscriptionStatus2.ACTIVE && stripe.status !== EnumSubscriptionStatus2.TRIALING) {
2473
1265
  return false;
2474
1266
  }
2475
1267
  if (stripe.cancelAtPeriodEnd !== true || !stripe.endDate) {
2476
1268
  return true;
2477
1269
  }
2478
- const paidThrough = dayjs6(stripe.endDate);
1270
+ const paidThrough = dayjs4(stripe.endDate);
2479
1271
  return !paidThrough.isValid() || paidThrough.isAfter(now);
2480
1272
  }
2481
1273
  async function handleVendorLicenceCompliance(user, now) {
@@ -2489,10 +1281,10 @@ async function handleVendorLicenceCompliance(user, now) {
2489
1281
  return;
2490
1282
  }
2491
1283
  const proLicences = vendorLicencesOfUser.filter(
2492
- (licence) => licence.licenceType !== EnumUserLicence.STANDARD_VENDOR
1284
+ (licence) => licence.licenceType !== EnumUserLicence6.STANDARD_VENDOR
2493
1285
  );
2494
1286
  const expiredProLicences = proLicences.filter(
2495
- (licence) => !dayjs6(licence.expiryDate).isAfter(now)
1287
+ (licence) => !dayjs4(licence.expiryDate).isAfter(now)
2496
1288
  );
2497
1289
  const stripeProtectedLicenceTypes = new Set(
2498
1290
  expiredProLicences.filter(
@@ -2504,7 +1296,7 @@ async function handleVendorLicenceCompliance(user, now) {
2504
1296
  );
2505
1297
  const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, vendorLicences, now);
2506
1298
  const hasExpiredVendorLicence = vendorLicencesOfUser.some(
2507
- (licence) => !dayjs6(licence.expiryDate).isAfter(now) && !stripeProtectedLicenceTypes.has(licence.licenceType)
1299
+ (licence) => !dayjs4(licence.expiryDate).isAfter(now) && !stripeProtectedLicenceTypes.has(licence.licenceType)
2508
1300
  );
2509
1301
  if (!hasExpiredVendorLicence) {
2510
1302
  return;
@@ -2527,17 +1319,17 @@ async function handleVendorLicenceCompliance(user, now) {
2527
1319
  }
2528
1320
  await updateVendorBasedOnUserLicense(
2529
1321
  user._id,
2530
- EnumUserLicence.STANDARD_VENDOR
1322
+ EnumUserLicence6.STANDARD_VENDOR
2531
1323
  );
2532
1324
  const payload = {
2533
1325
  data: {
2534
1326
  resourceId: String(vendor._id),
2535
1327
  resourceName: vendor.name,
2536
- resourceType: EnumNotificationResourceType.DOWNGRADED_VENDOR
1328
+ resourceType: EnumNotificationResourceType2.DOWNGRADED_VENDOR
2537
1329
  },
2538
1330
  message: `Your Vendor license has been downgraded due to licence expiration.`,
2539
1331
  title: `Vendor License Downgraded`,
2540
- type: EnumNotificationType.SYSTEM,
1332
+ type: EnumNotificationType2.SYSTEM,
2541
1333
  userIds: [user._id]
2542
1334
  };
2543
1335
  await sendDeactivationNotification(payload, user._id, vendor.name, "vendor");
@@ -2556,7 +1348,7 @@ async function vendorOwnerHasProLicence(vendorId) {
2556
1348
  owner?.licences,
2557
1349
  "vendor" /* VENDOR */
2558
1350
  );
2559
- return highestVendorLicence !== null && licencePriority[highestVendorLicence] >= licencePriority[EnumUserLicence.PRO_VENDOR];
1351
+ return highestVendorLicence !== null && licencePriority[highestVendorLicence] >= licencePriority[EnumUserLicence6.PRO_VENDOR];
2560
1352
  }
2561
1353
 
2562
1354
  // src/service/license/compliance/utils.ts
@@ -2566,12 +1358,12 @@ async function syncUserLicencesAfterExpiry(userId, licenceTypes, now, mode = "do
2566
1358
  const pipeline = buildLicenceExpiryPipeline({
2567
1359
  downgradeBranches: [
2568
1360
  {
2569
- case: EnumUserLicence.PRO_PLUS_VENDOR,
2570
- then: EnumUserLicence.STANDARD_VENDOR
1361
+ case: EnumUserLicence7.PRO_PLUS_VENDOR,
1362
+ then: EnumUserLicence7.STANDARD_VENDOR
2571
1363
  },
2572
1364
  {
2573
- case: EnumUserLicence.PRO_VENDOR,
2574
- then: EnumUserLicence.STANDARD_VENDOR
1365
+ case: EnumUserLicence7.PRO_VENDOR,
1366
+ then: EnumUserLicence7.STANDARD_VENDOR
2575
1367
  }
2576
1368
  ],
2577
1369
  licenceTypes,
@@ -2583,7 +1375,7 @@ async function syncUserLicencesAfterExpiry(userId, licenceTypes, now, mode = "do
2583
1375
  }
2584
1376
  function hasValidLicence(licences, licenceTypes, now) {
2585
1377
  return licences.some(
2586
- (licence) => licenceTypes.includes(licence.licenceType) && dayjs7(licence.expiryDate).isAfter(now)
1378
+ (licence) => licenceTypes.includes(licence.licenceType) && dayjs5(licence.expiryDate).isAfter(now)
2587
1379
  );
2588
1380
  }
2589
1381
  async function sendDeactivationNotification(payload, userId, resourceName, resourceType) {
@@ -2610,7 +1402,7 @@ async function processUserCompliance(user, now) {
2610
1402
  }
2611
1403
 
2612
1404
  // src/service/license/compliance/ensureUserLicenseCompliance.ts
2613
- async function ensureUserLicenseComplianceForUser(userId, now = dayjs8()) {
1405
+ async function ensureUserLicenseComplianceForUser(userId, now = dayjs6()) {
2614
1406
  const user = await UserModel.findById(userId);
2615
1407
  if (!user) {
2616
1408
  return;
@@ -2618,7 +1410,7 @@ async function ensureUserLicenseComplianceForUser(userId, now = dayjs8()) {
2618
1410
  await processUserCompliance(user, now);
2619
1411
  }
2620
1412
  async function ensureUserLicenseCompliance() {
2621
- const now = dayjs8();
1413
+ const now = dayjs6();
2622
1414
  console.log(`\u{1F50D} Checking license compliance at ${now.format()}`);
2623
1415
  const nowDate = now.toDate();
2624
1416
  const users = await UserModel.find({
@@ -2693,14 +1485,22 @@ async function getPartnerResourceInfo(userId, partnerId) {
2693
1485
  }
2694
1486
 
2695
1487
  // src/service/license/reminder/remindUsersAboutLicenseExpiration.ts
2696
- import dayjs10 from "dayjs";
1488
+ import dayjs8 from "dayjs";
2697
1489
 
2698
1490
  // src/service/license/reminder/reminderWindow.ts
2699
1491
  var REMINDER_WINDOW_MIN_HOURS = 6.5 * 24;
2700
1492
  var REMINDER_WINDOW_MAX_HOURS = 7.5 * 24;
2701
1493
 
2702
1494
  // src/service/license/reminder/utils.ts
2703
- import dayjs9 from "dayjs";
1495
+ import {
1496
+ dateFormat as dateFormat2,
1497
+ EnumNotificationResourceType as EnumNotificationResourceType4,
1498
+ EnumNotificationType as EnumNotificationType4,
1499
+ EnumUserLicence as EnumUserLicence8,
1500
+ licenseNiceNames
1501
+ } from "@timardex/cluemart-shared";
1502
+ import { formatDate } from "@timardex/cluemart-shared/utils";
1503
+ import dayjs7 from "dayjs";
2704
1504
 
2705
1505
  // src/service/license/reminder/vendor.ts
2706
1506
  async function getVendorResourceInfo(userId, vendorId) {
@@ -2759,7 +1559,7 @@ async function checkAndCreateNotification(payload) {
2759
1559
  }
2760
1560
  }
2761
1561
  function isLicenseExpiringIn7Days(expiryDate, now) {
2762
- const expiry = dayjs9(expiryDate);
1562
+ const expiry = dayjs7(expiryDate);
2763
1563
  const hoursUntilExpiry = expiry.diff(now, "hour", true);
2764
1564
  return hoursUntilExpiry >= REMINDER_WINDOW_MIN_HOURS && hoursUntilExpiry <= REMINDER_WINDOW_MAX_HOURS;
2765
1565
  }
@@ -2769,19 +1569,19 @@ function getLicenseName(licenceType) {
2769
1569
  function getNotificationTypes(isVendorLicense, isPartnerLicense) {
2770
1570
  if (isVendorLicense) {
2771
1571
  return {
2772
- notificationType: EnumNotificationType.SYSTEM,
2773
- resourceType: EnumNotificationResourceType.EXPIRATION_REMINDER_VENDOR
1572
+ notificationType: EnumNotificationType4.SYSTEM,
1573
+ resourceType: EnumNotificationResourceType4.EXPIRATION_REMINDER_VENDOR
2774
1574
  };
2775
1575
  }
2776
1576
  if (isPartnerLicense) {
2777
1577
  return {
2778
- notificationType: EnumNotificationType.SYSTEM,
2779
- resourceType: EnumNotificationResourceType.EXPIRATION_REMINDER_PARTNER
1578
+ notificationType: EnumNotificationType4.SYSTEM,
1579
+ resourceType: EnumNotificationResourceType4.EXPIRATION_REMINDER_PARTNER
2780
1580
  };
2781
1581
  }
2782
1582
  return {
2783
- notificationType: EnumNotificationType.SYSTEM,
2784
- resourceType: EnumNotificationResourceType.EXPIRATION_REMINDER_EVENT
1583
+ notificationType: EnumNotificationType4.SYSTEM,
1584
+ resourceType: EnumNotificationResourceType4.EXPIRATION_REMINDER_EVENT
2785
1585
  };
2786
1586
  }
2787
1587
  async function getLicenseResourceInfo(user, licence) {
@@ -2833,11 +1633,11 @@ async function getLicenseResourceInfo(user, licence) {
2833
1633
  };
2834
1634
  }
2835
1635
  function getLicenceExpiryMode(licenceType) {
2836
- return licenceType === EnumUserLicence.PRO_VENDOR || licenceType === EnumUserLicence.PRO_PLUS_VENDOR ? "downgrade" : "extend";
1636
+ return licenceType === EnumUserLicence8.PRO_VENDOR || licenceType === EnumUserLicence8.PRO_PLUS_VENDOR ? "downgrade" : "extend";
2837
1637
  }
2838
1638
  async function sendLicenseReminder(user, licence) {
2839
1639
  const licenceName = getLicenseName(licence.licenceType);
2840
- const expiryDate = dayjs9(licence.expiryDate).format(dateFormat);
1640
+ const expiryDate = dayjs7(licence.expiryDate).format(dateFormat2);
2841
1641
  const userId = String(user._id);
2842
1642
  const resourceInfo = await getLicenseResourceInfo(user, licence);
2843
1643
  if (!resourceInfo) {
@@ -2869,7 +1669,7 @@ async function sendLicenseReminder(user, licence) {
2869
1669
  console.log(`\u2705 Sent 7-day reminder to user ${userId} for ${licenceName}`);
2870
1670
  }
2871
1671
  async function processLicenseReminder(licence, now) {
2872
- if (dayjs9(licence.expiryDate).isBefore(now)) {
1672
+ if (dayjs7(licence.expiryDate).isBefore(now)) {
2873
1673
  return false;
2874
1674
  }
2875
1675
  if (!isLicenseExpiringIn7Days(licence.expiryDate, now)) {
@@ -2923,7 +1723,7 @@ async function processUserLicenseReminders(user, now) {
2923
1723
 
2924
1724
  // src/service/license/reminder/remindUsersAboutLicenseExpiration.ts
2925
1725
  async function remindUsersAboutLicenseExpiration() {
2926
- const now = dayjs10();
1726
+ const now = dayjs8();
2927
1727
  console.log(`\u{1F50D} Checking for licenses expiring in 7 days at ${now.format()}`);
2928
1728
  const minExpiryDate = now.add(REMINDER_WINDOW_MIN_HOURS, "hour").toDate();
2929
1729
  const maxExpiryDate = now.add(REMINDER_WINDOW_MAX_HOURS, "hour").toDate();