@feedmepos/mf-connect 0.0.16-beta.10 → 0.0.16-beta.12

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.
Files changed (85) hide show
  1. package/dist/{Analytic-BVk0jPDU.js → Analytic-DIc9BYb0.js} +32 -20
  2. package/dist/{App-BbAalq1k.js → App-BzzL9_Jw.js} +33 -27
  3. package/dist/Broadcast-dVPgK5QV.js +223 -0
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DiU3MnH0.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-TnEPvafD.js} +18 -11
  5. package/dist/{Card-B5in1RMa.js → Card-Bj2Yd2pr.js} +178 -158
  6. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +97 -0
  7. package/dist/Collections-Fkb_zzqZ.js +453 -0
  8. package/dist/{Credit-Bc9EzdsC.js → Credit-DHn9OkE8.js} +78 -69
  9. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-C1ZXQski.js +2788 -0
  10. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-D6mWny8y.js +344 -0
  11. package/dist/{Experience-CgKak5ik.js → Experience-DX3aJihS.js} +64 -55
  12. package/dist/{Game-QhfKqrN_.js → Game-CcVQvETd.js} +54 -45
  13. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js +144 -0
  14. package/dist/JsonViewer-v8_C7l5N.js +87 -0
  15. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js +18737 -0
  16. package/dist/MainLayout-B1aJoR95.js +41 -0
  17. package/dist/{Marketing-CSx4N7UJ.js → Marketing-B9kykWEh.js} +79 -72
  18. package/dist/{Member-CY6WMD8D.js → Member-RoJSCSC5.js} +25 -22
  19. package/dist/{MemberList-8iRwm7Sz.js → MemberList-BUDxqMEK.js} +321 -307
  20. package/dist/{MemberTransactions-CknqkWO3.js → MemberTransactions-Bh_tT1Rp.js} +1 -1
  21. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-Cj3-JHOX.js +432 -0
  22. package/dist/{Mission-BTy1p7lU.js → Mission-DDvgCLy0.js} +50 -40
  23. package/dist/{Point-A6B_ggSy.js → Point-BbPkt4kF.js} +67 -58
  24. package/dist/Promotion-DEo-lxpX.js +221 -0
  25. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-BGjeTeqS.js +1751 -0
  26. package/dist/{Segment-CFVXtyEj.js → Segment-DAcpZWIN.js} +145 -130
  27. package/dist/{Setting-Jmtw-_DV.js → Setting-CgXohUPt.js} +167 -154
  28. package/dist/{Store-DQypT-7e.js → Store-BVyHbQ8o.js} +504 -489
  29. package/dist/{StoreRewards-M-utm0iI.js → StoreRewards-sccMDbkj.js} +124 -108
  30. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-B60mQ5kq.js → StoreTransactions.vue_vue_type_script_setup_true_lang--sdQ_l8g.js} +131 -123
  31. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-CXlkvt2u.js +139 -0
  32. package/dist/{Tier-D1jymeLK.js → Tier--P27XXbB.js} +144 -125
  33. package/dist/{Title-DN9DIP2k.js → Title-B27S3SxD.js} +107 -90
  34. package/dist/{Transaction-BAJvAoU6.js → Transaction-CYTtwwHY.js} +2 -2
  35. package/dist/Voucher-BZ8PKgO5.js +488 -0
  36. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-CWt4tVdk.js +55 -0
  37. package/dist/_commonjsHelpers-BkfeUUK-.js +28 -0
  38. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  39. package/dist/app-CnKzqAcN.js +53428 -0
  40. package/dist/app-FfENBuoE.js +5381 -0
  41. package/dist/app-wDQR6dpb.js +39 -0
  42. package/dist/app.js +2 -1
  43. package/dist/business-CXyP9G7A.js +78 -0
  44. package/dist/campaign-0aM2KYOy.js +96 -0
  45. package/dist/campaign-CpzFl8Vr.js +4 -0
  46. package/dist/collection.fn-FicQhH1t.js +26 -0
  47. package/dist/dto-BiYLkVdL.js +1169 -0
  48. package/dist/effect-Cg-eNEjg.js +61 -0
  49. package/dist/{export-DjeNY5Pc.js → export-D7BuObOL.js} +19 -16
  50. package/dist/helper-DvD-D7c7.js +71 -0
  51. package/dist/index-B1Q0GAWp.js +95 -0
  52. package/dist/index-B4UZgSB-.js +28058 -0
  53. package/dist/index-B6c-fUij.js +203 -0
  54. package/dist/index-BP_5cfKa.js +38 -0
  55. package/dist/index-BRXg5Si1.js +2071 -0
  56. package/dist/index-BuDwICBJ.js +761 -0
  57. package/dist/index-CDMC-8iO.js +94 -0
  58. package/dist/index-CcZt3OrE.js +73 -0
  59. package/dist/index-CuvNtC_M.js +61 -0
  60. package/dist/index-DA-fzkRR.js +1737 -0
  61. package/dist/index-Dbd4WA4r.js +61 -0
  62. package/dist/index-Dkeb_9ER.js +8832 -0
  63. package/dist/index-DmdKoKk_.js +298 -0
  64. package/dist/index-G-88ujCM.js +3 -0
  65. package/dist/loading-uCNeZibp.js +32697 -0
  66. package/dist/lodash-B5I3zXaY.js +3678 -0
  67. package/dist/membership-DFRO9TyM.js +221 -0
  68. package/dist/moment-BWErdI6_.js +2578 -0
  69. package/dist/money-OtkT4Pzp.js +15 -0
  70. package/dist/number-Cg3NCouc.js +12 -0
  71. package/dist/object-qECH92oz.js +26 -0
  72. package/dist/objectId-dwaoBfJX.js +7 -0
  73. package/dist/rule-Ch2HRiGw.js +1973 -0
  74. package/dist/rule-builder-B_M9yvEe.js +89 -0
  75. package/dist/template-1o0LbOoJ.js +190 -0
  76. package/dist/usePagination-BeF5K3M7.js +223 -0
  77. package/dist/vue-i18n-AtGIa4qH.js +2365 -0
  78. package/dist/xlsx-pChq0adn.js +15491 -0
  79. package/dist/zod-W_PvIofQ.js +90 -0
  80. package/package.json +3 -3
  81. package/dist/Collections-CFCZ9YIG.js +0 -4
  82. package/dist/MainLayout-JbHzENFy.js +0 -4
  83. package/dist/app-BpzzygYP.js +0 -87765
  84. package/dist/money-DKGIIplY.js +0 -15
  85. package/dist/number-tPodRxTN.js +0 -12
@@ -0,0 +1,761 @@
1
+ import { z as e, F as n, e as A, m as p } from "./loading-uCNeZibp.js";
2
+ import { e as _, F as D, a as c, h as X, g as Z, j as d, k as Q, m as $ } from "./index-Dkeb_9ER.js";
3
+ import { b as T } from "./index-DA-fzkRR.js";
4
+ import { b as L, c as ee } from "./index-B6c-fUij.js";
5
+ import { d as ne } from "./index-DmdKoKk_.js";
6
+ const P = e.enum([
7
+ "VOUCHER",
8
+ "PROMOTION",
9
+ "POINT",
10
+ "CREDIT",
11
+ "MEMBERSHIP",
12
+ "BROADCAST",
13
+ "COIN",
14
+ "REWARD_POOL",
15
+ "GAME",
16
+ "MISSION"
17
+ ]), M = e.enum(["TIME_BASED_PROMOTION", "GAME_PROMOTION"]), Ke = {
18
+ [M.enum.TIME_BASED_PROMOTION]: "7.7.4",
19
+ [M.enum.GAME_PROMOTION]: "7.7.4"
20
+ };
21
+ e.object({
22
+ location: n,
23
+ memberId: n,
24
+ nettTotal: A,
25
+ remark: e.string().optional()
26
+ });
27
+ const te = e.enum(["COUNTER", "POS"]);
28
+ e.object({
29
+ id: e.string(),
30
+ userId: e.string(),
31
+ name: e.string().nullish(),
32
+ birthday: e.string().nullish(),
33
+ phoneNumber: e.string().nullish(),
34
+ balance: e.number().nullish(),
35
+ level: e.number().nullish(),
36
+ mostPurchasedItems: e.array(e.string()).nullish()
37
+ });
38
+ const oe = {
39
+ collectionName: "Bills"
40
+ }, ie = e.object({
41
+ _id: e.string(),
42
+ items: e.record(e.string(), e.number()).nullish(),
43
+ // business: z.string(),
44
+ // adjustments: z.record(FdoBillAdjustment),
45
+ // refundedFrom: z.string().nullish(),
46
+ user: e.string().nullish(),
47
+ memberid: e.string().nullish(),
48
+ // roundToNearest: z.number().nullish(),
49
+ nettTotal: A,
50
+ // activeItems: z.array(z.string()),
51
+ remark: e.string().nullish(),
52
+ createdAt: e.coerce.date(),
53
+ completedAt: e.coerce.date(),
54
+ location: e.string(),
55
+ channel: te.optional()
56
+ }).transform((o) => ({
57
+ ...o,
58
+ createdTime: o.createdAt,
59
+ completedTime: o.completedAt,
60
+ get amount() {
61
+ return o.nettTotal.amount / 10 ** o.nettTotal.precision;
62
+ }
63
+ })).describe(p.describe(oe)), se = e.object({
64
+ _id: e.string(),
65
+ rating: e.coerce.number(),
66
+ user: e.string(),
67
+ restaurant: e.string(),
68
+ message: e.string(),
69
+ submittedAt: e.coerce.date()
70
+ }), i = e.enum([
71
+ "SIMPLE_CLAIM",
72
+ "LINK_CLAIM",
73
+ "BILL_COMPLETED",
74
+ "SCHEDULE",
75
+ "BIRTHDAY",
76
+ "FEEDBACK",
77
+ "ENTER_SEGMENT",
78
+ "MEMBERSHIP_JOINED",
79
+ "TIER_UPGRADED",
80
+ "MAKING_ORDER",
81
+ "ISSUE_REWARD",
82
+ "MEMBER_REWARD",
83
+ "GAME_COMPLETED",
84
+ "PAGINATE_SCHEDULE"
85
+ ]), Je = i.extract([
86
+ "BILL_COMPLETED",
87
+ "FEEDBACK",
88
+ "GAME_COMPLETED",
89
+ "MAKING_ORDER",
90
+ "MEMBERSHIP_JOINED",
91
+ "SCHEDULE",
92
+ "SIMPLE_CLAIM",
93
+ "TIER_UPGRADED",
94
+ "ISSUE_REWARD"
95
+ ]);
96
+ e.enum(["START_OF", "BEFORE"]);
97
+ e.enum(["WEEK", "MONTH"]);
98
+ const s = e.object({
99
+ // type: F_EVENT_TYPE,
100
+ rule: _.optional()
101
+ }), ae = s.extend({
102
+ type: e.literal(i.enum.BILL_COMPLETED)
103
+ }), le = s.extend({
104
+ type: e.literal(i.enum.FEEDBACK)
105
+ }), re = s.extend({
106
+ type: e.literal(i.enum.SIMPLE_CLAIM)
107
+ });
108
+ s.extend({
109
+ type: e.literal(i.enum.ENTER_SEGMENT),
110
+ segment: e.string()
111
+ });
112
+ const ce = s.extend({
113
+ type: e.literal(i.enum.MEMBER_REWARD)
114
+ }), de = s.extend({
115
+ type: e.literal(i.enum.SCHEDULE)
116
+ // option: FdoCronRule,
117
+ }), me = s.extend({
118
+ type: e.literal(i.enum.MEMBERSHIP_JOINED)
119
+ }), ue = s.extend({
120
+ type: e.literal(i.enum.TIER_UPGRADED)
121
+ }), pe = s.extend({
122
+ type: e.literal(i.enum.MAKING_ORDER)
123
+ }), Ee = s.extend({
124
+ type: e.literal(i.enum.ISSUE_REWARD)
125
+ }), ge = s.extend({
126
+ type: e.literal(i.enum.GAME_COMPLETED)
127
+ }), be = e.discriminatedUnion("type", [
128
+ re,
129
+ ae,
130
+ de,
131
+ le,
132
+ me,
133
+ ue,
134
+ pe,
135
+ Ee,
136
+ ce,
137
+ ge
138
+ ]);
139
+ e.object({
140
+ _id: n,
141
+ type: i,
142
+ ref: e.string(),
143
+ context: e.record(e.string(), e.any()).optional()
144
+ }).describe(JSON.stringify({ collectionName: "EventLogs" }));
145
+ const m = e.object({
146
+ type: i,
147
+ context: e.any(),
148
+ businessIds: e.array(n).optional(),
149
+ campaignIds: e.array(n).optional(),
150
+ slackWebhookUrl: e.string().optional(),
151
+ emittedAt: e.coerce.date().default(/* @__PURE__ */ new Date())
152
+ }), ye = m.extend({
153
+ type: e.literal(i.enum.BILL_COMPLETED),
154
+ context: e.object({
155
+ bill: ie,
156
+ rawBill: e.any()
157
+ })
158
+ }), Ce = m.extend({
159
+ type: e.literal(i.enum.SCHEDULE),
160
+ context: e.object({
161
+ triggeredAt: e.coerce.date()
162
+ })
163
+ }), Re = m.extend({
164
+ type: e.literal(i.enum.PAGINATE_SCHEDULE),
165
+ context: e.object({
166
+ triggeredAt: e.coerce.date(),
167
+ business: n,
168
+ skip: e.coerce.number(),
169
+ limit: e.coerce.number()
170
+ })
171
+ }), _e = m.extend({
172
+ type: e.literal(i.enum.FEEDBACK),
173
+ context: e.object({
174
+ feedback: se
175
+ })
176
+ }), Ie = m.extend({
177
+ type: e.literal(i.enum.MEMBERSHIP_JOINED),
178
+ context: e.object({
179
+ user: T
180
+ })
181
+ }), he = m.extend({
182
+ type: e.literal(i.enum.TIER_UPGRADED),
183
+ context: e.object({
184
+ transaction: L
185
+ })
186
+ }), fe = m.extend({
187
+ type: e.literal(i.enum.ISSUE_REWARD),
188
+ context: e.object({
189
+ transaction: L,
190
+ collection: ee
191
+ })
192
+ });
193
+ e.discriminatedUnion("type", [
194
+ ye,
195
+ Ce,
196
+ _e,
197
+ Ie,
198
+ he,
199
+ fe,
200
+ Re
201
+ ]);
202
+ const Oe = e.object({
203
+ from: e.coerce.number(),
204
+ to: e.coerce.number().optional()
205
+ }).superRefine((o, a) => {
206
+ o.from && o.to && o.from > o.to && a.addIssue({
207
+ code: "custom",
208
+ message: "Max experience must be more than min experience"
209
+ });
210
+ }), Me = e.enum(["MULTIPLIER", "FIXED"]);
211
+ e.object({
212
+ type: Me
213
+ });
214
+ const Fe = e.object({
215
+ _id: n.optional(),
216
+ rule: _,
217
+ tierExpression: e.string().nullish(),
218
+ expExpression: e.string().nullish()
219
+ }), I = e.object({
220
+ _id: n,
221
+ name: e.string().min(1),
222
+ image: e.string().nullish(),
223
+ option: Oe,
224
+ cycleOptions: e.array(e.lazy(() => Fe)).nullish(),
225
+ member_count: e.number().optional()
226
+ });
227
+ I.partial({
228
+ _id: !0
229
+ });
230
+ const Ye = I.partial({
231
+ _id: !0
232
+ }), Ae = {
233
+ collectionName: "Cards",
234
+ transform: {
235
+ _id: "oid",
236
+ business: "oid",
237
+ member: "oid",
238
+ redeemedAt: "date"
239
+ },
240
+ lookups: {
241
+ business: {
242
+ as: "business",
243
+ fromCollection: "Business"
244
+ },
245
+ member: {
246
+ as: "pf_member",
247
+ fromCollection: "UsersV2"
248
+ }
249
+ }
250
+ };
251
+ e.object({
252
+ _id: n,
253
+ business: n,
254
+ serialNumber: e.string(),
255
+ setCardOnBind: e.boolean().nullish(),
256
+ redeemedAt: e.date().nullish(),
257
+ member: n.nullish(),
258
+ design: e.string().nullish(),
259
+ bundle: e.string().nullish(),
260
+ subscriptionBundle: e.string().nullish(),
261
+ pf_member: e.lazy(() => T).nullish(),
262
+ pf_transaction: e.lazy(() => ne).nullish()
263
+ }).describe(p.describe(Ae));
264
+ const De = e.object({
265
+ length: e.coerce.number().optional(),
266
+ charset: e.string(),
267
+ prefix: e.string().optional(),
268
+ suffix: e.string().optional(),
269
+ pattern: e.string().optional()
270
+ });
271
+ e.object({
272
+ quantity: e.number(),
273
+ code: e.string(),
274
+ codeConfig: De,
275
+ setCardOnBind: e.boolean().optional(),
276
+ design: e.string().nullish(),
277
+ bundle: e.string().optional(),
278
+ subscriptionBundle: e.string().optional()
279
+ });
280
+ const Te = e.enum(["SMS", "EMAIL"]), E = e.object({
281
+ channel: Te,
282
+ variables: e.array(e.string()),
283
+ title: e.string().nullish(),
284
+ design: e.any(),
285
+ content: e.string(),
286
+ language: e.string(),
287
+ imageUrl: e.string().nullish()
288
+ }).superRefine((o, a) => {
289
+ o.content.length == 0 && a.addIssue({
290
+ code: e.ZodIssueCode.custom,
291
+ message: "Content is required"
292
+ });
293
+ const C = /{{(.*?)}}/g, R = [...o.content.matchAll(C)].map((u) => u[1]), O = o.variables, b = R.filter((u) => O.indexOf(u) < 0);
294
+ b.length && a.addIssue({
295
+ code: e.ZodIssueCode.custom,
296
+ message: "Invalid variable(s): " + b.join(", ")
297
+ });
298
+ });
299
+ function qe(o, a) {
300
+ return o.replace(/{{(.*?)}}/g, (C, R) => {
301
+ const b = R.trim().split(".").reduce((u, q) => (u != null ? u[q] : null) ?? null, a);
302
+ return b !== null ? b : C;
303
+ });
304
+ }
305
+ const h = e.enum(["NO_REWARD", "VOUCHER", "LOYALTY"]), S = e.number().min(0, "Weight need to be at least 0"), x = e.number().int("Must be integer").min(0, "Threshold need to be at least 0"), N = e.object({
306
+ type: e.literal(h.enum.NO_REWARD),
307
+ collectible: e.null(),
308
+ weight: S
309
+ }), B = e.object({
310
+ type: e.literal(h.enum.VOUCHER),
311
+ collectible: n,
312
+ collectibleConfig: e.lazy(() => D._def.right.options[0]),
313
+ earningOption: e.lazy(() => c)
314
+ }), f = e.object({
315
+ type: e.literal(h.enum.LOYALTY),
316
+ collectible: n,
317
+ earningOption: e.lazy(() => c),
318
+ validityOption: e.lazy(() => X)
319
+ }), U = B.extend({
320
+ weight: S
321
+ }), j = f.extend({
322
+ weight: e.number().min(0, "Weight need to be at least 0")
323
+ }), Xe = f.extend({
324
+ validityOption: Z
325
+ }), Le = e.discriminatedUnion("type", [
326
+ U,
327
+ j,
328
+ N
329
+ ]), F = e.discriminatedUnion("type", [
330
+ U.extend({
331
+ collectible: n.nullish(),
332
+ business: n.nullish()
333
+ }),
334
+ j.extend({
335
+ collectible: n.nullish(),
336
+ business: n.nullish()
337
+ }),
338
+ N
339
+ ]), G = B.extend({
340
+ threshold: x
341
+ }), z = f.extend({
342
+ threshold: x
343
+ }), v = e.discriminatedUnion("type", [
344
+ G,
345
+ z
346
+ ]), Pe = e.discriminatedUnion("type", [
347
+ G.extend({
348
+ collectible: n.nullish(),
349
+ business: n.nullish()
350
+ }),
351
+ z.extend({
352
+ collectible: n.nullish(),
353
+ collectibleConfig: D.nullish(),
354
+ business: n.nullish()
355
+ })
356
+ ]), Se = {
357
+ collectionName: "Locations",
358
+ transform: {
359
+ _id: "oid",
360
+ business: "oid"
361
+ }
362
+ }, w = e.object({
363
+ _id: n,
364
+ business: n,
365
+ name: e.string(),
366
+ code: e.string().nullish(),
367
+ otp: e.string().nullish(),
368
+ otpExpiredAt: e.coerce.date().nullish(),
369
+ apiToken: e.string().nullish()
370
+ }).describe(p.describe(Se));
371
+ e.object({
372
+ _id: n,
373
+ name: e.string(),
374
+ location: n,
375
+ os: e.string(),
376
+ apiToken: e.string().nullish()
377
+ }).describe(p.describe({
378
+ collectionName: "LocationDevices",
379
+ transform: {
380
+ _id: "oid",
381
+ location: "oid"
382
+ }
383
+ }));
384
+ const xe = e.enum(["PROGRESSIVE", "STAMP"]), Ne = e.object({
385
+ type: xe,
386
+ end: e.number().int().min(0, "Threshold need to be at least 1"),
387
+ rewards: e.array(e.lazy(() => v)).nullish()
388
+ }).superRefine((o, a) => {
389
+ o.type == "STAMP" && o.end > 40 && (a.addIssue({
390
+ code: "custom",
391
+ path: [],
392
+ message: "Stamp mission can have at most 40 threshold"
393
+ }), a.addIssue({
394
+ code: "custom",
395
+ path: ["end"],
396
+ message: "Stamp mission can have at most 40 threshold"
397
+ }));
398
+ }), Be = {
399
+ collectionName: "Groups",
400
+ transform: {
401
+ _id: "oid",
402
+ business: "oid"
403
+ },
404
+ lookups: {
405
+ business: {
406
+ fromCollection: "Businesses",
407
+ as: "pf_business"
408
+ },
409
+ pf_campaigns: {
410
+ fromCollection: "Campaigns",
411
+ as: "pf_campaigns",
412
+ localField: "_id",
413
+ foreignField: "group"
414
+ }
415
+ }
416
+ }, Ze = e.object({
417
+ _id: n,
418
+ name: e.string().min(1).max(300),
419
+ business: n,
420
+ pf_campaigns: e.array(e.any()).optional()
421
+ }).describe(p.describe(Be)), Ue = e.object({
422
+ from: e.string().email().nullish(),
423
+ name: e.string().min(1).max(50).nullish()
424
+ }), je = e.object({
425
+ type: e.literal(P.enum.MEMBERSHIP),
426
+ business: n,
427
+ name: e.string().min(1).max(50),
428
+ image: e.string().nullish(),
429
+ url: e.string().nullish(),
430
+ tiers: e.array(e.lazy(() => I)),
431
+ titles: e.array(n),
432
+ tierCycleEnable: e.boolean().optional(),
433
+ tierCycle: e.lazy(() => _).nullish(),
434
+ welcomeMessage: E.optional(),
435
+ advertisements: e.array(e.string()).optional(),
436
+ cardEnable: e.boolean().optional(),
437
+ design: e.array(
438
+ e.object({
439
+ _id: n,
440
+ image: e.string()
441
+ })
442
+ ).optional(),
443
+ targetLocation: e.array(n).nullish(),
444
+ brand: e.string().nullish(),
445
+ email: Ue.nullish(),
446
+ freeCreditAsDiscount: e.boolean().optional(),
447
+ pf_title: e.array(e.lazy(() => d)).optional(),
448
+ pf_targetLocation: e.array(e.lazy(() => w)).optional(),
449
+ // new structure
450
+ group: e.string().nullish(),
451
+ templateId: n.nullish()
452
+ }), t = P.exclude(["MEMBERSHIP"]), l = e.object({
453
+ _id: n.nullish(),
454
+ type: t,
455
+ // common information
456
+ business: n,
457
+ name: e.string().min(1).max(50),
458
+ image: e.string().nullish(),
459
+ description: e.string().max(500).nullish(),
460
+ timeframeOptions: Q.superRefine((o, a) => {
461
+ o.start && o.end && o.end < o.start && a.addIssue({
462
+ code: "custom",
463
+ path: [],
464
+ params: {
465
+ i18n: { key: "timeframe.end_before_start" }
466
+ }
467
+ });
468
+ }).nullish(),
469
+ targetLocation: e.array(n).nullish(),
470
+ event: be,
471
+ config: $.nullish(),
472
+ currentReceive: e.coerce.number().optional(),
473
+ // new group structure
474
+ group: n.nullish(),
475
+ templateId: n.nullish(),
476
+ pf_targetLocation: e.array(e.lazy(() => w)).optional()
477
+ }), r = {
478
+ [t.enum.VOUCHER]: [
479
+ "BILL_COMPLETED",
480
+ "FEEDBACK",
481
+ "MEMBERSHIP_JOINED",
482
+ "TIER_UPGRADED",
483
+ "SCHEDULE",
484
+ "SIMPLE_CLAIM"
485
+ ],
486
+ [t.enum.PROMOTION]: ["MAKING_ORDER"],
487
+ [t.enum.POINT]: [
488
+ "BILL_COMPLETED",
489
+ "FEEDBACK",
490
+ "MEMBERSHIP_JOINED",
491
+ "TIER_UPGRADED",
492
+ "SCHEDULE"
493
+ ],
494
+ [t.enum.CREDIT]: [
495
+ "BILL_COMPLETED",
496
+ "FEEDBACK",
497
+ "MEMBERSHIP_JOINED",
498
+ "TIER_UPGRADED",
499
+ "SCHEDULE"
500
+ ],
501
+ [t.enum.BROADCAST]: [
502
+ "SCHEDULE",
503
+ "ISSUE_REWARD",
504
+ "FEEDBACK"
505
+ ],
506
+ [t.enum.COIN]: [
507
+ "BILL_COMPLETED",
508
+ "FEEDBACK",
509
+ "MEMBERSHIP_JOINED",
510
+ "TIER_UPGRADED",
511
+ "SCHEDULE"
512
+ ],
513
+ [t.enum.REWARD_POOL]: ["GAME_COMPLETED"],
514
+ [t.enum.GAME]: [
515
+ "BILL_COMPLETED",
516
+ "FEEDBACK",
517
+ "MEMBERSHIP_JOINED",
518
+ "TIER_UPGRADED",
519
+ "SCHEDULE",
520
+ "SIMPLE_CLAIM"
521
+ ],
522
+ [t.enum.MISSION]: [
523
+ "BILL_COMPLETED",
524
+ "FEEDBACK",
525
+ "SCHEDULE"
526
+ ]
527
+ }, H = l.extend({
528
+ type: e.literal(t.enum.VOUCHER),
529
+ // event
530
+ code: e.string().min(0).max(15).optional(),
531
+ event: s.merge(
532
+ e.object({
533
+ type: e.enum(r[t.enum.VOUCHER])
534
+ })
535
+ ),
536
+ earningOption: c.default({
537
+ amount: 1,
538
+ type: "FIXED"
539
+ }),
540
+ collectible: n,
541
+ notify: e.boolean().optional(),
542
+ notifyMessage: e.lazy(() => E).optional(),
543
+ notifyCampaign: n.nullish(),
544
+ pf_collectible: e.lazy(() => d).optional(),
545
+ pf_notifyCampaign: e.lazy(() => g).optional()
546
+ }), Ge = e.object({
547
+ gameType: e.string()
548
+ }), k = l.extend({
549
+ type: e.literal(t.enum.PROMOTION),
550
+ // event
551
+ event: s.merge(
552
+ e.object({
553
+ type: e.enum(r[t.enum.PROMOTION])
554
+ })
555
+ ),
556
+ effect: e.custom().superRefine((o, a) => {
557
+ o || a.addIssue({
558
+ code: "custom",
559
+ path: [],
560
+ params: {
561
+ i18n: { key: "zodCustom.campaign.effect_required" }
562
+ }
563
+ });
564
+ }),
565
+ gameConfig: Ge.nullish()
566
+ }), W = l.extend({
567
+ type: e.literal(t.enum.POINT),
568
+ // event
569
+ event: s.merge(
570
+ e.object({
571
+ type: e.enum(r[t.enum.POINT])
572
+ })
573
+ ),
574
+ earningOption: c,
575
+ collectible: n,
576
+ notify: e.boolean().optional(),
577
+ notifyMessage: e.lazy(() => E).optional(),
578
+ notifyCampaign: n.nullish(),
579
+ pf_collectible: e.lazy(() => d).optional(),
580
+ pf_notifyCampaign: e.lazy(() => g).optional()
581
+ }), V = l.extend({
582
+ type: e.literal(t.enum.CREDIT),
583
+ // event
584
+ event: s.merge(
585
+ e.object({
586
+ type: e.enum(r[t.enum.CREDIT])
587
+ })
588
+ ),
589
+ earningOption: c,
590
+ collectible: n,
591
+ notify: e.boolean().optional(),
592
+ notifyMessage: e.lazy(() => E).optional(),
593
+ notifyCampaign: n.nullish(),
594
+ pf_collectible: e.lazy(() => d).optional(),
595
+ pf_notifyCampaign: e.lazy(() => g).optional()
596
+ }), g = l.extend({
597
+ type: e.literal(t.enum.BROADCAST),
598
+ // event
599
+ event: s.merge(
600
+ e.object({
601
+ type: e.enum(r[t.enum.BROADCAST])
602
+ })
603
+ ),
604
+ message: E,
605
+ linkedCampaign: n.nullish()
606
+ }), K = l.extend({
607
+ type: e.literal(t.enum.COIN),
608
+ // event
609
+ event: s.merge(
610
+ e.object({
611
+ type: e.enum(r[t.enum.COIN])
612
+ })
613
+ ),
614
+ earningOption: c,
615
+ collectible: n,
616
+ notify: e.boolean().optional(),
617
+ notifyMessage: e.lazy(() => E).optional(),
618
+ notifyCampaign: n.nullish(),
619
+ pf_collectible: e.lazy(() => d).optional(),
620
+ pf_notifyCampaign: e.lazy(() => g).optional()
621
+ }), y = l.extend({
622
+ type: e.literal(t.enum.REWARD_POOL),
623
+ // event
624
+ event: s.merge(
625
+ e.object({
626
+ type: e.enum(r[t.enum.REWARD_POOL])
627
+ })
628
+ ),
629
+ rewards: e.array(e.lazy(() => Le)).min(1, "Requires at least 1 reward")
630
+ }), J = l.extend({
631
+ type: e.literal(t.enum.GAME),
632
+ // event
633
+ event: s.merge(
634
+ e.object({
635
+ type: e.enum(r[t.enum.GAME])
636
+ })
637
+ ),
638
+ earningOption: c,
639
+ collectible: n,
640
+ game: e.lazy(() => y).optional(),
641
+ pf_collectible: e.lazy(() => d).optional(),
642
+ rewardPool: n.optional()
643
+ }), Y = l.extend({
644
+ type: e.literal(t.enum.MISSION),
645
+ event: s.merge(
646
+ e.object({
647
+ type: e.enum(r[t.enum.MISSION])
648
+ })
649
+ ),
650
+ earningOption: c,
651
+ collectible: n,
652
+ pf_collectible: e.lazy(() => d).optional(),
653
+ mission: e.lazy(() => Ne),
654
+ rewards: e.array(e.lazy(() => v)).min(1, "Requires at least 1 reward")
655
+ }), ze = {
656
+ collectionName: "Campaigns",
657
+ transform: {
658
+ _id: "oid",
659
+ business: "oid",
660
+ collectible: "oid",
661
+ templateId: "oid",
662
+ group: "oid",
663
+ notifyCampaign: "oid",
664
+ linkedCampaign: "oid",
665
+ rewardPool: "oid"
666
+ },
667
+ lookups: {
668
+ business: {
669
+ fromCollection: "Businesses",
670
+ as: "pf_business"
671
+ },
672
+ targetLocation: {
673
+ fromCollection: "Locations",
674
+ as: "pf_targetLocation"
675
+ },
676
+ collectible: {
677
+ fromCollection: "CollectibleConfigs",
678
+ as: "pf_collectible"
679
+ },
680
+ titles: {
681
+ fromCollection: "CollectibleConfigs",
682
+ as: "pf_title"
683
+ },
684
+ templateId: {
685
+ fromCollection: "Templates",
686
+ as: "template"
687
+ },
688
+ notifyCampaign: {
689
+ fromCollection: "Campaigns",
690
+ as: "pf_notifyCampaign"
691
+ },
692
+ rewardPool: {
693
+ fromCollection: "Campaigns",
694
+ as: "game"
695
+ }
696
+ }
697
+ }, Qe = e.object({ _id: n }).and(
698
+ e.discriminatedUnion("type", [
699
+ je,
700
+ H,
701
+ k,
702
+ W,
703
+ V,
704
+ g,
705
+ K,
706
+ y,
707
+ J,
708
+ Y
709
+ ])
710
+ ).describe(p.describe(ze)), $e = e.discriminatedUnion("type", [
711
+ H.extend({
712
+ business: n.nullish()
713
+ }),
714
+ k.extend({
715
+ business: n.nullish()
716
+ }),
717
+ W.extend({
718
+ business: n.nullish()
719
+ }),
720
+ V.extend({
721
+ business: n.nullish()
722
+ }),
723
+ g.extend({
724
+ business: n.nullish()
725
+ }),
726
+ K.extend({
727
+ business: n.nullish()
728
+ }),
729
+ y.extend({
730
+ rewards: e.array(e.lazy(() => F)).min(1, "Requires at least 1 reward")
731
+ }),
732
+ J.extend({
733
+ business: n.nullish(),
734
+ game: y.extend({
735
+ business: n.nullish(),
736
+ rewards: e.array(e.lazy(() => F)).min(1, "Requires at least 1 reward")
737
+ })
738
+ }),
739
+ Y.extend({
740
+ business: n.nullish(),
741
+ rewards: e.array(e.lazy(() => Pe)).min(1, "Requires at least 1 reward")
742
+ })
743
+ ]);
744
+ export {
745
+ r as C,
746
+ Ye as F,
747
+ t as a,
748
+ Je as b,
749
+ Xe as c,
750
+ F as d,
751
+ xe as e,
752
+ Pe as f,
753
+ Ne as g,
754
+ Ke as h,
755
+ P as i,
756
+ Ze as j,
757
+ $e as k,
758
+ Qe as l,
759
+ je as m,
760
+ qe as r
761
+ };