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