@feedmepos/mf-connect 0.1.0-beta.3 → 0.1.0-beta.31
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/Analytic-C-QC9ivZ.js +424 -0
- package/dist/{App-gzbM97vW.js → App-NASVRSh2.js} +397 -384
- package/dist/{Broadcast-BwYZkTs0.js → Broadcast-Cffg7nbY.js} +32 -32
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DIh9rz6T.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CA4kVwMl.js} +8 -8
- package/dist/Card-CmYFb1_Y.js +897 -0
- package/dist/{Collections-Df6tlo8S.js → Collections-CibvGIpU.js} +4 -4
- package/dist/{Credit-BPel8vA9.js → Credit-Ck6i9ySs.js} +14 -14
- package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +108 -0
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-B35zbHHI.js +2198 -0
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-BT8ucS5G.js → EffectSheet.vue_vue_type_style_index_0_lang-CQV77_cx.js} +8 -8
- package/dist/{Experience-CPpz1Zwx.js → Experience-CWUX2QvS.js} +8 -8
- package/dist/{Game-ByLblISC.js → Game-D3cdZrlc.js} +15 -15
- package/dist/Index-CWLZiYXT.js +255 -0
- package/dist/Marketing-Bol8eY5d.js +20070 -0
- package/dist/{Member-CCc_FEZY.js → Member-Cso-T2Xk.js} +4 -4
- package/dist/MemberList-Bqns9wko.js +1045 -0
- package/dist/{MemberTransactions-DD5ahSbY.js → MemberTransactions-zNw-30Xu.js} +1 -1
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-DSPvWk4C.js → MessageInput.vue_vue_type_script_setup_true_lang-BLS5fNr6.js} +2 -2
- package/dist/{Mission-VH4057I-.js → Mission-C0-K0A_5.js} +98 -86
- package/dist/Overview-fZ9NvFKz.js +1024 -0
- package/dist/{Point-Bu3IlpH4.js → Point-D3gGhQlP.js} +23 -23
- package/dist/{Promotion-B45AOHis.js → Promotion-COCJIfu-.js} +53 -47
- package/dist/Record-C0a4Cn1U.js +209 -0
- package/dist/Reward-D0G4CBYd.js +411 -0
- package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-zSOwxAcS.js +151 -0
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-AmIdaAeX.js +1639 -0
- package/dist/Segment-eBM3aveX.js +567 -0
- package/dist/SelectItems.vue_vue_type_script_setup_true_lang-BgMuKAjE.js +181 -0
- package/dist/{Setting-CF09eRQJ.js → Setting-Dfye6fs5.js} +8 -8
- package/dist/Store-rQfwc8d6.js +1745 -0
- package/dist/{StoreRewards-0iGExjqQ.js → StoreRewards-DVTNMWdG.js} +12 -12
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-3dvBoXz2.js +957 -0
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-BEfxin47.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-DxGIUrmO.js} +1 -1
- package/dist/{Tier-IaeWe7rM.js → Tier-DekrYu5l.js} +327 -317
- package/dist/{Title-DD67Zxh5.js → Title-oAWsBqoM.js} +199 -183
- package/dist/{Transaction-BsPDnLzB.js → Transaction-Ss2XCksi.js} +2 -2
- package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-BMIqnBts.js +130 -0
- package/dist/{Voucher-M7JfcKo0.js → Voucher-CjPJxdw8.js} +31 -31
- package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DlWCpoOp.js +419 -0
- package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-k0lprU2i.js → ZodTextField.vue_vue_type_script_setup_true_lang-FXQNhMrv.js} +1 -1
- package/dist/{app-HFICF0vL.js → app-C_zlbFNe.js} +1285 -1283
- package/dist/{app-DwujUNP-.js → app-WUJQRyEM.js} +1 -1
- package/dist/app.js +1 -1
- package/dist/{business-BaF1QJXa.js → business-C0e_E2xp.js} +1 -1
- package/dist/{campaign-CTDtmAE9.js → campaign-iWzbtNA5.js} +2 -2
- package/dist/collectible.enum-QITAo8Jg.js +19 -0
- package/dist/{collection.fn-DMW03W4R.js → collection.fn-R3hvasuZ.js} +2 -2
- package/dist/{dto-gpaNZHzQ.js → dto-D_tjJ72q.js} +78 -86
- package/dist/{effect-CBUmtwet.js → effect-_bpW5fmr.js} +9 -9
- package/dist/email-addresses-DUKn8uD0.js +705 -0
- package/dist/{export-Bdh_PbsW.js → export-CEBWZ8ko.js} +3 -3
- package/dist/{helper-Cu9elRvl.js → helper-CuF45pbY.js} +1 -1
- package/dist/{index-NXiDu42U.js → index-BO8RnVxy.js} +1 -1
- package/dist/{index-CArqG03W.js → index-BPc3wxOE.js} +39 -35
- package/dist/index-BXTQ6onZ.js +1067 -0
- package/dist/index-C4aPU80a.js +38 -0
- package/dist/{index-At6yms5t.js → index-CBzSPD25.js} +30 -26
- package/dist/{index-Ch6XwPzF.js → index-CR0ZVZQG.js} +1 -1
- package/dist/{index-DrGrOgZB.js → index-CXFwMV0s.js} +13 -1
- package/dist/index-CsaQJMAR.js +66 -0
- package/dist/{index-Dfdg2Q3E.js → index-Dh6xIUXJ.js} +1 -1
- package/dist/{index-ogzk-Mj4.js → index-LMvyNoHf.js} +1 -1
- package/dist/{index-Crw-Vgo5.js → index-S6sFiBxK.js} +1500 -1479
- package/dist/index-SpDFfOz_.js +54 -0
- package/dist/{index-CtH2S49l.js → index-Urbp7cdO.js} +203 -195
- package/dist/index-pHbs1GrF.js +29000 -0
- package/dist/{index.esm2017-CeJpvUbA.js → index.esm2017-BunOalUj.js} +33 -33
- package/dist/{loading-Cn8ml_vy.js → loading-CYFsZ9UB.js} +591 -597
- package/dist/{membership-CX4AKMlH.js → membership-C9089j0H.js} +51 -43
- package/dist/money-D-zGFohv.js +15 -0
- package/dist/number-UFl4zW6h.js +12 -0
- package/dist/objectid-BKIyQ5iE.js +145 -0
- package/dist/remy-vue-client-Cpppk9h-.js +1693 -0
- package/dist/reward-LYKGLzXz.js +36 -0
- package/dist/{rule-Cv83Y59R.js → rule-BUUKmR4_.js} +180 -177
- package/dist/{rule-builder-Dew4yB5Q.js → rule-builder-9JUuOcMH.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{template-CSnbgM1o.js → template-CkXuF0cN.js} +5 -5
- package/dist/trigger-DjAx9efN.js +114 -0
- package/dist/user-DbsZta3D.js +54 -0
- package/dist/{vue-i18n-CNH_IhVd.js → vue-i18n-yYO72Mbp.js} +2 -2
- package/dist/{xlsx-D4DUZHix.js → xlsx-Dagi6ArS.js} +1 -1
- package/package.json +8 -7
- package/dist/Analytic-BC5BA6pN.js +0 -622
- package/dist/Card-CBYQGKwY.js +0 -825
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-PsrS7I0r.js +0 -2809
- package/dist/Marketing-D0vm80e_.js +0 -316
- package/dist/MemberList-CrnipE9y.js +0 -1733
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Ijc2OYh9.js +0 -1753
- package/dist/Segment-ZWsp48aC.js +0 -437
- package/dist/Store-B_G6Dhmq.js +0 -1511
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CaxUr9zl.js +0 -890
- package/dist/index-8MaN7rez.js +0 -762
- package/dist/index-BjdHxGDn.js +0 -298
- package/dist/index-CuvNtC_M.js +0 -61
- package/dist/index-RP0XOPRL.js +0 -29193
- package/dist/money-BTejgvKu.js +0 -15
- package/dist/number-Cen5TucC.js +0 -12
- package/dist/user-Bm4KttFq.js +0 -37
|
@@ -0,0 +1,1067 @@
|
|
|
1
|
+
import { z as e, F as n, e as b, m as l, g as se, d as _ } from "./loading-CYFsZ9UB.js";
|
|
2
|
+
import { c as f, F as P, e as m, f as ae, g as re, i as p, j as le, k as ce } from "./index-S6sFiBxK.js";
|
|
3
|
+
import { b as S } from "./index-BPc3wxOE.js";
|
|
4
|
+
import { d as x, e as de } from "./index-CBzSPD25.js";
|
|
5
|
+
import "vue";
|
|
6
|
+
const L = e.enum([
|
|
7
|
+
"VOUCHER",
|
|
8
|
+
"PROMOTION",
|
|
9
|
+
"POINT",
|
|
10
|
+
"CREDIT",
|
|
11
|
+
"MEMBERSHIP",
|
|
12
|
+
"BROADCAST",
|
|
13
|
+
"COIN",
|
|
14
|
+
"REWARD_POOL",
|
|
15
|
+
"GAME",
|
|
16
|
+
"MISSION"
|
|
17
|
+
]), T = e.enum(["TIME_BASED_PROMOTION", "GAME_PROMOTION"]), bn = {
|
|
18
|
+
[T.enum.TIME_BASED_PROMOTION]: "7.7.4",
|
|
19
|
+
[T.enum.GAME_PROMOTION]: "7.7.4"
|
|
20
|
+
};
|
|
21
|
+
e.object({
|
|
22
|
+
location: n,
|
|
23
|
+
memberId: n,
|
|
24
|
+
nettTotal: b,
|
|
25
|
+
remark: e.string().optional()
|
|
26
|
+
});
|
|
27
|
+
const me = 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 ue = {
|
|
39
|
+
collectionName: "Bills"
|
|
40
|
+
}, pe = 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: b,
|
|
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: me.optional()
|
|
56
|
+
}).transform((t) => ({
|
|
57
|
+
...t,
|
|
58
|
+
createdTime: t.createdAt,
|
|
59
|
+
completedTime: t.completedAt,
|
|
60
|
+
get amount() {
|
|
61
|
+
return t.nettTotal.amount / 10 ** t.nettTotal.precision;
|
|
62
|
+
}
|
|
63
|
+
})).describe(l.describe(ue)), ge = 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
|
+
}), s = 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
|
+
"REFERRAL_ADDED"
|
|
86
|
+
]), yn = s.extract([
|
|
87
|
+
"BILL_COMPLETED",
|
|
88
|
+
"FEEDBACK",
|
|
89
|
+
"GAME_COMPLETED",
|
|
90
|
+
"MAKING_ORDER",
|
|
91
|
+
"MEMBERSHIP_JOINED",
|
|
92
|
+
"SCHEDULE",
|
|
93
|
+
"SIMPLE_CLAIM",
|
|
94
|
+
"TIER_UPGRADED",
|
|
95
|
+
"ISSUE_REWARD"
|
|
96
|
+
]);
|
|
97
|
+
e.enum(["START_OF", "BEFORE"]);
|
|
98
|
+
e.enum(["WEEK", "MONTH"]);
|
|
99
|
+
const a = e.object({
|
|
100
|
+
// type: F_EVENT_TYPE,
|
|
101
|
+
rule: f.optional()
|
|
102
|
+
}), Ee = a.extend({
|
|
103
|
+
type: e.literal(s.enum.BILL_COMPLETED)
|
|
104
|
+
}), be = a.extend({
|
|
105
|
+
type: e.literal(s.enum.FEEDBACK)
|
|
106
|
+
}), ye = a.extend({
|
|
107
|
+
type: e.literal(s.enum.SIMPLE_CLAIM)
|
|
108
|
+
});
|
|
109
|
+
a.extend({
|
|
110
|
+
type: e.literal(s.enum.ENTER_SEGMENT),
|
|
111
|
+
segment: e.string()
|
|
112
|
+
});
|
|
113
|
+
const he = a.extend({
|
|
114
|
+
type: e.literal(s.enum.MEMBER_REWARD)
|
|
115
|
+
}), Ce = a.extend({
|
|
116
|
+
type: e.literal(s.enum.SCHEDULE)
|
|
117
|
+
// option: FdoCronRule,
|
|
118
|
+
}), fe = a.extend({
|
|
119
|
+
type: e.literal(s.enum.MEMBERSHIP_JOINED)
|
|
120
|
+
}), Ie = a.extend({
|
|
121
|
+
type: e.literal(s.enum.TIER_UPGRADED)
|
|
122
|
+
}), Re = a.extend({
|
|
123
|
+
type: e.literal(s.enum.MAKING_ORDER)
|
|
124
|
+
}), _e = a.extend({
|
|
125
|
+
type: e.literal(s.enum.ISSUE_REWARD)
|
|
126
|
+
}), Fe = a.extend({
|
|
127
|
+
type: e.literal(s.enum.GAME_COMPLETED)
|
|
128
|
+
});
|
|
129
|
+
a.extend({
|
|
130
|
+
type: e.literal(s.enum.REFERRAL_ADDED)
|
|
131
|
+
});
|
|
132
|
+
const De = e.discriminatedUnion("type", [
|
|
133
|
+
ye,
|
|
134
|
+
Ee,
|
|
135
|
+
Ce,
|
|
136
|
+
be,
|
|
137
|
+
fe,
|
|
138
|
+
Ie,
|
|
139
|
+
Re,
|
|
140
|
+
_e,
|
|
141
|
+
he,
|
|
142
|
+
Fe
|
|
143
|
+
]);
|
|
144
|
+
e.object({
|
|
145
|
+
_id: n,
|
|
146
|
+
type: s,
|
|
147
|
+
ref: e.string(),
|
|
148
|
+
context: e.record(e.string(), e.any()).optional()
|
|
149
|
+
}).describe(JSON.stringify({ collectionName: "EventLogs" }));
|
|
150
|
+
const u = e.object({
|
|
151
|
+
type: s,
|
|
152
|
+
context: e.any(),
|
|
153
|
+
businessIds: e.array(n).optional(),
|
|
154
|
+
campaignIds: e.array(n).optional(),
|
|
155
|
+
slackWebhookUrl: e.string().optional(),
|
|
156
|
+
emittedAt: e.coerce.date().default(/* @__PURE__ */ new Date())
|
|
157
|
+
}), Me = u.extend({
|
|
158
|
+
type: e.literal(s.enum.BILL_COMPLETED),
|
|
159
|
+
context: e.object({
|
|
160
|
+
bill: pe,
|
|
161
|
+
rawBill: e.any()
|
|
162
|
+
})
|
|
163
|
+
}), Oe = u.extend({
|
|
164
|
+
type: e.literal(s.enum.SCHEDULE),
|
|
165
|
+
context: e.object({
|
|
166
|
+
triggeredAt: e.coerce.date()
|
|
167
|
+
})
|
|
168
|
+
}), Te = u.extend({
|
|
169
|
+
type: e.literal(s.enum.PAGINATE_SCHEDULE),
|
|
170
|
+
context: e.object({
|
|
171
|
+
triggeredAt: e.coerce.date(),
|
|
172
|
+
business: n,
|
|
173
|
+
skip: e.coerce.number(),
|
|
174
|
+
limit: e.coerce.number()
|
|
175
|
+
})
|
|
176
|
+
}), Ae = u.extend({
|
|
177
|
+
type: e.literal(s.enum.FEEDBACK),
|
|
178
|
+
context: e.object({
|
|
179
|
+
feedback: ge
|
|
180
|
+
})
|
|
181
|
+
}), Pe = u.extend({
|
|
182
|
+
type: e.literal(s.enum.MEMBERSHIP_JOINED),
|
|
183
|
+
context: e.object({
|
|
184
|
+
user: S
|
|
185
|
+
})
|
|
186
|
+
}), Se = u.extend({
|
|
187
|
+
type: e.literal(s.enum.TIER_UPGRADED),
|
|
188
|
+
context: e.object({
|
|
189
|
+
transaction: x
|
|
190
|
+
})
|
|
191
|
+
}), xe = u.extend({
|
|
192
|
+
type: e.literal(s.enum.ISSUE_REWARD),
|
|
193
|
+
context: e.object({
|
|
194
|
+
transaction: x,
|
|
195
|
+
collection: de
|
|
196
|
+
})
|
|
197
|
+
});
|
|
198
|
+
u.extend({
|
|
199
|
+
type: e.literal(s.enum.ISSUE_REWARD),
|
|
200
|
+
context: e.object({})
|
|
201
|
+
});
|
|
202
|
+
e.discriminatedUnion("type", [
|
|
203
|
+
Me,
|
|
204
|
+
Oe,
|
|
205
|
+
Ae,
|
|
206
|
+
Pe,
|
|
207
|
+
Se,
|
|
208
|
+
xe,
|
|
209
|
+
Te
|
|
210
|
+
]);
|
|
211
|
+
const Le = e.object({
|
|
212
|
+
from: e.coerce.number(),
|
|
213
|
+
to: e.coerce.number().optional()
|
|
214
|
+
}).superRefine((t, i) => {
|
|
215
|
+
t.from && t.to && t.from > t.to && i.addIssue({
|
|
216
|
+
code: "custom",
|
|
217
|
+
message: "Max experience must be more than min experience"
|
|
218
|
+
});
|
|
219
|
+
}), Ne = e.enum(["MULTIPLIER", "FIXED"]);
|
|
220
|
+
e.object({
|
|
221
|
+
type: Ne
|
|
222
|
+
});
|
|
223
|
+
const je = e.object({
|
|
224
|
+
_id: n.optional(),
|
|
225
|
+
rule: f,
|
|
226
|
+
tierExpression: e.string().nullish(),
|
|
227
|
+
expExpression: e.string().nullish()
|
|
228
|
+
}), F = e.object({
|
|
229
|
+
_id: n,
|
|
230
|
+
name: e.string().min(1),
|
|
231
|
+
image: e.string().nullish(),
|
|
232
|
+
option: Le,
|
|
233
|
+
cycleOptions: e.array(e.lazy(() => je)).nullish(),
|
|
234
|
+
member_count: e.number().optional()
|
|
235
|
+
});
|
|
236
|
+
F.partial({
|
|
237
|
+
_id: !0
|
|
238
|
+
});
|
|
239
|
+
const hn = F.partial({
|
|
240
|
+
_id: !0
|
|
241
|
+
}), Be = e.object({
|
|
242
|
+
icon: e.string(),
|
|
243
|
+
label: e.string(),
|
|
244
|
+
value: e.string()
|
|
245
|
+
}), Ue = e.object({
|
|
246
|
+
gatewayKey: e.enum([
|
|
247
|
+
"REVENUE_MONSTER",
|
|
248
|
+
"FEEDME",
|
|
249
|
+
"FEEDME_MEMBER_CREDIT",
|
|
250
|
+
"RAZER_MERCHANT_SERVICE"
|
|
251
|
+
]),
|
|
252
|
+
checkoutUrl: e.string().optional(),
|
|
253
|
+
checkoutId: e.string().optional(),
|
|
254
|
+
callbackUrl: e.string().optional(),
|
|
255
|
+
vcode: e.string().optional(),
|
|
256
|
+
merchantId: e.string().optional(),
|
|
257
|
+
amount: e.string().optional(),
|
|
258
|
+
currency: e.string().optional(),
|
|
259
|
+
returnUrl: e.string().optional(),
|
|
260
|
+
notifyUrl: e.string().optional(),
|
|
261
|
+
channels: e.array(Be).optional(),
|
|
262
|
+
transactionId: e.string().optional()
|
|
263
|
+
});
|
|
264
|
+
e.object({
|
|
265
|
+
trx: e.lazy(() => H),
|
|
266
|
+
onlineTrx: Ue.optional(),
|
|
267
|
+
url: e.string().optional()
|
|
268
|
+
});
|
|
269
|
+
const N = e.enum(["POS", "APP", "ADMIN"]), j = e.enum(["topupCount"]), Ge = e.object({
|
|
270
|
+
line1: e.string(),
|
|
271
|
+
line2: e.string().optional(),
|
|
272
|
+
state: e.string(),
|
|
273
|
+
city: e.string(),
|
|
274
|
+
postcode: e.string(),
|
|
275
|
+
country: e.string()
|
|
276
|
+
}), B = e.object({
|
|
277
|
+
name: e.string(),
|
|
278
|
+
regNo: e.string(),
|
|
279
|
+
address: Ge,
|
|
280
|
+
phoneNo: e.string(),
|
|
281
|
+
sstRegNo: e.string().optional()
|
|
282
|
+
}), U = e.object({
|
|
283
|
+
systemCode: e.string(),
|
|
284
|
+
inclusive: e.boolean()
|
|
285
|
+
}), we = e.object({
|
|
286
|
+
id: n,
|
|
287
|
+
dayToExpire: e.number()
|
|
288
|
+
}), ze = e.object({
|
|
289
|
+
normal: e.coerce.number(),
|
|
290
|
+
free: e.object({
|
|
291
|
+
day: e.coerce.number(),
|
|
292
|
+
amount: e.coerce.number(),
|
|
293
|
+
remark: e.string().nullish()
|
|
294
|
+
}).nullish()
|
|
295
|
+
}), He = e.object({
|
|
296
|
+
systemCode: e.string(),
|
|
297
|
+
taxCode: e.string()
|
|
298
|
+
}), ke = e.object({
|
|
299
|
+
name: e.string(),
|
|
300
|
+
systemCode: e.string(),
|
|
301
|
+
taxCode: e.string(),
|
|
302
|
+
rate: se,
|
|
303
|
+
total: b
|
|
304
|
+
});
|
|
305
|
+
e.object({
|
|
306
|
+
canPurchase: e.boolean(),
|
|
307
|
+
reason: e.string()
|
|
308
|
+
});
|
|
309
|
+
e.object({
|
|
310
|
+
type: j
|
|
311
|
+
});
|
|
312
|
+
e.object({
|
|
313
|
+
type: j,
|
|
314
|
+
min: e.number().nullish(),
|
|
315
|
+
max: e.number().nullish()
|
|
316
|
+
});
|
|
317
|
+
const ve = e.object({
|
|
318
|
+
options: e.object({
|
|
319
|
+
maxReceive: e.number().min(0).nullish(),
|
|
320
|
+
maxPerUser: e.number().min(0).nullish()
|
|
321
|
+
}),
|
|
322
|
+
rule: f.nullish()
|
|
323
|
+
}), Ve = (t, i) => {
|
|
324
|
+
const r = t;
|
|
325
|
+
r.isFeedvibe && _.Dinero.fromFdoDinero(r.price).toUnit() < 0.1 && i.addIssue({
|
|
326
|
+
code: "custom",
|
|
327
|
+
path: ["price"],
|
|
328
|
+
message: "Price must be at least RM10"
|
|
329
|
+
});
|
|
330
|
+
}, G = e.object({
|
|
331
|
+
_id: e.string(),
|
|
332
|
+
isFeedvibe: e.boolean().nullish(),
|
|
333
|
+
// conditions: z.array(FdoTopupCountCondition),
|
|
334
|
+
image: e.string().nullish(),
|
|
335
|
+
rule: f.nullish(),
|
|
336
|
+
name: e.string(),
|
|
337
|
+
price: b,
|
|
338
|
+
originalPrice: b.nullish(),
|
|
339
|
+
// new field to indicate coinPrice
|
|
340
|
+
coinPrice: e.number().nullish(),
|
|
341
|
+
titles: e.array(we),
|
|
342
|
+
credit: ze,
|
|
343
|
+
taxes: e.array(He),
|
|
344
|
+
taxTotals: e.array(ke),
|
|
345
|
+
priceWithTaxes: b.nullish(),
|
|
346
|
+
vouchers: e.array(n),
|
|
347
|
+
_inclusiveTaxes: e.array(U).nullish(),
|
|
348
|
+
_taxSystem: e.array(e.string()).nullish(),
|
|
349
|
+
stripePriceId: e.string().nullish(),
|
|
350
|
+
subscriptionValidity: e.number().min(1, "Must be at least 1 day").max(365, "Maximum is 365").nullish(),
|
|
351
|
+
redeemWithCode: e.boolean().nullish(),
|
|
352
|
+
internal: e.boolean().optional(),
|
|
353
|
+
hideInPos: e.boolean().optional(),
|
|
354
|
+
config: ve.optional(),
|
|
355
|
+
pf_titles: e.array(e.any()).optional(),
|
|
356
|
+
pf_vouchers: e.array(e.any()).optional(),
|
|
357
|
+
pf_credit: e.number().optional()
|
|
358
|
+
}).superRefine((t, i) => {
|
|
359
|
+
var r, g;
|
|
360
|
+
t.stripePriceId && !t.subscriptionValidity && i.addIssue({
|
|
361
|
+
code: "custom",
|
|
362
|
+
message: "Validity is required when stripePriceId is provided",
|
|
363
|
+
path: ["subscriptionValidity"]
|
|
364
|
+
}), t.originalPrice && t.originalPrice.amount && t.originalPrice.amount < t.price.amount && i.addIssue({
|
|
365
|
+
code: "custom",
|
|
366
|
+
message: "Original price must be greater than price",
|
|
367
|
+
path: ["originalPrice"]
|
|
368
|
+
}), t.price.amount < 0 && i.addIssue({
|
|
369
|
+
code: "custom",
|
|
370
|
+
path: ["price"],
|
|
371
|
+
message: "Price cannot be less than 0"
|
|
372
|
+
}), t.coinPrice && t.coinPrice < 0 && i.addIssue({
|
|
373
|
+
code: "custom",
|
|
374
|
+
path: ["coinPrice"],
|
|
375
|
+
message: "Point price cannot be less than 0"
|
|
376
|
+
}), t.credit.normal < 0 && i.addIssue({
|
|
377
|
+
code: "custom",
|
|
378
|
+
path: ["credit", "normal"],
|
|
379
|
+
message: "Normal credit cannot be less than 0"
|
|
380
|
+
}), t.credit.free && (t.credit.free.amount < 0 && i.addIssue({
|
|
381
|
+
code: "custom",
|
|
382
|
+
path: ["credit", "free", "amount"],
|
|
383
|
+
message: "Free credit cannot be less than 0"
|
|
384
|
+
}), t.credit.free.amount && t.credit.free.day < 0 && i.addIssue({
|
|
385
|
+
code: "custom",
|
|
386
|
+
path: ["credit", "free", "day"],
|
|
387
|
+
message: "Expiry must be at least 0 (expire same day)"
|
|
388
|
+
})), t.credit.normal && t.coinPrice && i.addIssue({
|
|
389
|
+
code: "custom",
|
|
390
|
+
message: "Bundle redeem with point cannot set normal credit.",
|
|
391
|
+
path: ["credit", "normal"]
|
|
392
|
+
}), t.credit.normal > _.Dinero.fromFdoDinero(t.price).toUnit() && i.addIssue({
|
|
393
|
+
code: "custom",
|
|
394
|
+
message: `Normal credit cannot be more than price. Max: ${_.Dinero.fromFdoDinero(
|
|
395
|
+
t.price
|
|
396
|
+
).toUnit()}`,
|
|
397
|
+
path: ["credit", "normal"]
|
|
398
|
+
}), t.titles.length > 0 && t.titles.some((I) => I.dayToExpire < 0) && i.addIssue({
|
|
399
|
+
code: "custom",
|
|
400
|
+
path: ["titles"],
|
|
401
|
+
message: "Title expiry must be at least 0 day (expire same day)"
|
|
402
|
+
}), (((g = (r = t.config) == null ? void 0 : r.options) == null ? void 0 : g.maxPerUser) || 0) < 0 && i.addIssue({
|
|
403
|
+
code: "custom",
|
|
404
|
+
path: ["config.options.maxPerUser"],
|
|
405
|
+
message: "Max purchase per user cannot be negative"
|
|
406
|
+
});
|
|
407
|
+
}).superRefine(Ve), w = e.object({
|
|
408
|
+
name: e.string(),
|
|
409
|
+
bundles: e.array(G)
|
|
410
|
+
});
|
|
411
|
+
e.object({
|
|
412
|
+
_id: e.string(),
|
|
413
|
+
name: e.string(),
|
|
414
|
+
expiredAt: e.string()
|
|
415
|
+
});
|
|
416
|
+
const We = e.object({
|
|
417
|
+
apiKey: e.string(),
|
|
418
|
+
webhookSecret: e.string()
|
|
419
|
+
}), Ke = e.object({
|
|
420
|
+
company: B.nullish(),
|
|
421
|
+
inclusiveTaxes: e.array(U).nullish(),
|
|
422
|
+
stripe: We.nullable().optional()
|
|
423
|
+
}), Ye = {
|
|
424
|
+
collectionName: "Stores",
|
|
425
|
+
transform: {
|
|
426
|
+
_id: "oid",
|
|
427
|
+
business: "oid"
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
Ke.extend({
|
|
431
|
+
_id: n,
|
|
432
|
+
business: n,
|
|
433
|
+
categories: e.array(w)
|
|
434
|
+
}).describe(l.describe(Ye));
|
|
435
|
+
const Je = e.object({
|
|
436
|
+
refundedAt: e.coerce.date(),
|
|
437
|
+
reason: e.string(),
|
|
438
|
+
transactions: e.array(n)
|
|
439
|
+
}), z = e.object({
|
|
440
|
+
type: e.enum(["ONLINE", "OFFLINE", "COIN", "STRIPE", "CARD", "FEEDVIBE", "ADMIN"]),
|
|
441
|
+
extra: e.string().nullish()
|
|
442
|
+
}), qe = {
|
|
443
|
+
collectionName: "StoreTransactions",
|
|
444
|
+
transform: {
|
|
445
|
+
_id: "oid",
|
|
446
|
+
business: "oid",
|
|
447
|
+
location: "oid",
|
|
448
|
+
member: "oid",
|
|
449
|
+
transactions: "oid"
|
|
450
|
+
},
|
|
451
|
+
lookups: {
|
|
452
|
+
member: {
|
|
453
|
+
fromCollection: "UsersV2",
|
|
454
|
+
as: "pf_member"
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}, H = e.object({
|
|
458
|
+
_id: n,
|
|
459
|
+
source: N,
|
|
460
|
+
// can be memberStorePurchase
|
|
461
|
+
ref: e.string(),
|
|
462
|
+
business: n,
|
|
463
|
+
company: B,
|
|
464
|
+
location: n.optional(),
|
|
465
|
+
member: n,
|
|
466
|
+
// createdAt: z.coerce.date(),
|
|
467
|
+
bundle: G,
|
|
468
|
+
transactions: e.array(n),
|
|
469
|
+
// array of transaction id (voucher, credit, title)
|
|
470
|
+
status: e.enum([
|
|
471
|
+
"PENDING_PAYMENT",
|
|
472
|
+
"PENDING_TRANSACTION",
|
|
473
|
+
"COMPLETED",
|
|
474
|
+
"REFUNDED"
|
|
475
|
+
]),
|
|
476
|
+
refund: Je.nullish(),
|
|
477
|
+
paymentType: z.nullish(),
|
|
478
|
+
paymentRef: e.string().nullish(),
|
|
479
|
+
webhookUrl: e.string().optional(),
|
|
480
|
+
webhookSent: e.boolean().optional(),
|
|
481
|
+
pf_transactions: e.array(e.any()).optional(),
|
|
482
|
+
pf_member: e.any().optional(),
|
|
483
|
+
pf_location: e.any().optional(),
|
|
484
|
+
pf_ref: e.any().optional()
|
|
485
|
+
}).describe(l.describe(qe));
|
|
486
|
+
e.object({
|
|
487
|
+
bundle: n,
|
|
488
|
+
member: e.string(),
|
|
489
|
+
ref: e.string(),
|
|
490
|
+
paymentType: z.nullish(),
|
|
491
|
+
withCoin: e.boolean().optional(),
|
|
492
|
+
card: e.string().optional(),
|
|
493
|
+
location: n.optional(),
|
|
494
|
+
source: N,
|
|
495
|
+
webhookUrl: e.string().optional()
|
|
496
|
+
});
|
|
497
|
+
e.object({
|
|
498
|
+
categories: e.array(w)
|
|
499
|
+
});
|
|
500
|
+
e.object({
|
|
501
|
+
id: n,
|
|
502
|
+
reason: e.string(),
|
|
503
|
+
location: n.optional()
|
|
504
|
+
});
|
|
505
|
+
e.object({
|
|
506
|
+
_id: n,
|
|
507
|
+
business: n,
|
|
508
|
+
user: n,
|
|
509
|
+
bundleId: e.string(),
|
|
510
|
+
transaction: e.array(n),
|
|
511
|
+
subscriptionId: e.string(),
|
|
512
|
+
expiredAt: e.coerce.date()
|
|
513
|
+
}).describe(
|
|
514
|
+
l.describe({
|
|
515
|
+
collectionName: "StoreSubscriptions",
|
|
516
|
+
transform: {
|
|
517
|
+
_id: "oid",
|
|
518
|
+
business: "oid",
|
|
519
|
+
user: "oid",
|
|
520
|
+
transaction: "oid",
|
|
521
|
+
expiredAt: "date"
|
|
522
|
+
}
|
|
523
|
+
})
|
|
524
|
+
);
|
|
525
|
+
e.object({
|
|
526
|
+
member: e.string(),
|
|
527
|
+
subscriptionId: e.string()
|
|
528
|
+
});
|
|
529
|
+
const Ze = {
|
|
530
|
+
collectionName: "Cards",
|
|
531
|
+
transform: {
|
|
532
|
+
_id: "oid",
|
|
533
|
+
business: "oid",
|
|
534
|
+
member: "oid",
|
|
535
|
+
redeemedAt: "date"
|
|
536
|
+
},
|
|
537
|
+
lookups: {
|
|
538
|
+
business: {
|
|
539
|
+
as: "business",
|
|
540
|
+
fromCollection: "Business"
|
|
541
|
+
},
|
|
542
|
+
member: {
|
|
543
|
+
as: "pf_member",
|
|
544
|
+
fromCollection: "UsersV2"
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
e.object({
|
|
549
|
+
_id: n,
|
|
550
|
+
business: n,
|
|
551
|
+
serialNumber: e.string(),
|
|
552
|
+
setCardOnBind: e.boolean().nullish(),
|
|
553
|
+
redeemedAt: e.date().nullish(),
|
|
554
|
+
member: n.nullish(),
|
|
555
|
+
design: e.string().nullish(),
|
|
556
|
+
bundle: e.string().nullish(),
|
|
557
|
+
subscriptionBundle: e.string().nullish(),
|
|
558
|
+
pf_member: e.lazy(() => S).nullish(),
|
|
559
|
+
pf_transaction: e.lazy(() => H).nullish()
|
|
560
|
+
}).describe(l.describe(Ze));
|
|
561
|
+
const Xe = e.object({
|
|
562
|
+
length: e.coerce.number().optional(),
|
|
563
|
+
charset: e.string(),
|
|
564
|
+
prefix: e.string().optional(),
|
|
565
|
+
suffix: e.string().optional(),
|
|
566
|
+
pattern: e.string().optional()
|
|
567
|
+
});
|
|
568
|
+
e.object({
|
|
569
|
+
quantity: e.number(),
|
|
570
|
+
code: e.string(),
|
|
571
|
+
codeConfig: Xe,
|
|
572
|
+
setCardOnBind: e.boolean().optional(),
|
|
573
|
+
design: e.string().nullish(),
|
|
574
|
+
bundle: e.string().optional(),
|
|
575
|
+
subscriptionBundle: e.string().optional()
|
|
576
|
+
});
|
|
577
|
+
const $e = e.enum(["SMS", "EMAIL"]), y = e.object({
|
|
578
|
+
channel: $e,
|
|
579
|
+
variables: e.array(e.string()),
|
|
580
|
+
title: e.string().nullish(),
|
|
581
|
+
design: e.any(),
|
|
582
|
+
content: e.string(),
|
|
583
|
+
language: e.string(),
|
|
584
|
+
imageUrl: e.string().nullish()
|
|
585
|
+
}).superRefine((t, i) => {
|
|
586
|
+
t.content.length == 0 && i.addIssue({
|
|
587
|
+
code: e.ZodIssueCode.custom,
|
|
588
|
+
message: "Content is required"
|
|
589
|
+
});
|
|
590
|
+
const r = /{{(.*?)}}/g, g = [...t.content.matchAll(r)].map((E) => E[1]), I = t.variables, C = g.filter((E) => I.indexOf(E) < 0);
|
|
591
|
+
C.length && i.addIssue({
|
|
592
|
+
code: e.ZodIssueCode.custom,
|
|
593
|
+
message: "Invalid variable(s): " + C.join(", ")
|
|
594
|
+
});
|
|
595
|
+
});
|
|
596
|
+
function Cn(t, i) {
|
|
597
|
+
return t.replace(/{{(.*?)}}/g, (r, g) => {
|
|
598
|
+
const C = g.trim().split(".").reduce((E, ie) => (E != null ? E[ie] : null) ?? null, i);
|
|
599
|
+
return C !== null ? C : r;
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
const D = e.enum(["NO_REWARD", "VOUCHER", "LOYALTY"]), M = e.number().min(0, "Weight need to be at least 0"), k = e.number().int("Must be integer").min(0, "Threshold need to be at least 0"), v = e.object({
|
|
603
|
+
type: e.literal(D.enum.NO_REWARD),
|
|
604
|
+
collectible: e.null(),
|
|
605
|
+
weight: M
|
|
606
|
+
}), V = e.object({
|
|
607
|
+
type: e.literal(D.enum.VOUCHER),
|
|
608
|
+
collectible: n,
|
|
609
|
+
collectibleConfig: e.lazy(() => P._def.right.options[0]),
|
|
610
|
+
earningOption: e.lazy(() => m)
|
|
611
|
+
}), O = e.object({
|
|
612
|
+
type: e.literal(D.enum.LOYALTY),
|
|
613
|
+
collectible: n,
|
|
614
|
+
earningOption: e.lazy(() => m),
|
|
615
|
+
validityOption: e.lazy(() => ae)
|
|
616
|
+
}), W = V.extend({
|
|
617
|
+
weight: M
|
|
618
|
+
}), K = O.extend({
|
|
619
|
+
weight: e.number().min(0, "Weight need to be at least 0")
|
|
620
|
+
}), fn = O.extend({
|
|
621
|
+
validityOption: re,
|
|
622
|
+
weight: M
|
|
623
|
+
}), Qe = e.discriminatedUnion("type", [
|
|
624
|
+
W,
|
|
625
|
+
K,
|
|
626
|
+
v
|
|
627
|
+
]), A = e.discriminatedUnion("type", [
|
|
628
|
+
W.extend({
|
|
629
|
+
collectible: n.nullish(),
|
|
630
|
+
business: n.nullish()
|
|
631
|
+
}),
|
|
632
|
+
K.extend({
|
|
633
|
+
collectible: n.nullish(),
|
|
634
|
+
business: n.nullish()
|
|
635
|
+
}),
|
|
636
|
+
v
|
|
637
|
+
]), Y = V.extend({
|
|
638
|
+
threshold: k
|
|
639
|
+
}), J = O.extend({
|
|
640
|
+
threshold: k
|
|
641
|
+
}), q = e.discriminatedUnion("type", [
|
|
642
|
+
Y,
|
|
643
|
+
J
|
|
644
|
+
]), en = e.discriminatedUnion("type", [
|
|
645
|
+
Y.extend({
|
|
646
|
+
collectible: n.nullish(),
|
|
647
|
+
business: n.nullish()
|
|
648
|
+
}),
|
|
649
|
+
J.extend({
|
|
650
|
+
collectible: n.nullish(),
|
|
651
|
+
collectibleConfig: P.nullish(),
|
|
652
|
+
business: n.nullish()
|
|
653
|
+
})
|
|
654
|
+
]), nn = {
|
|
655
|
+
collectionName: "Locations",
|
|
656
|
+
transform: {
|
|
657
|
+
_id: "oid",
|
|
658
|
+
business: "oid"
|
|
659
|
+
}
|
|
660
|
+
}, Z = e.object({
|
|
661
|
+
_id: n,
|
|
662
|
+
business: n,
|
|
663
|
+
name: e.string(),
|
|
664
|
+
code: e.string().nullish(),
|
|
665
|
+
otp: e.string().nullish(),
|
|
666
|
+
otpExpiredAt: e.coerce.date().nullish(),
|
|
667
|
+
apiToken: e.string().nullish()
|
|
668
|
+
}).describe(l.describe(nn));
|
|
669
|
+
e.object({
|
|
670
|
+
_id: n,
|
|
671
|
+
name: e.string(),
|
|
672
|
+
location: n,
|
|
673
|
+
os: e.string(),
|
|
674
|
+
apiToken: e.string().nullish()
|
|
675
|
+
}).describe(l.describe({
|
|
676
|
+
collectionName: "LocationDevices",
|
|
677
|
+
transform: {
|
|
678
|
+
_id: "oid",
|
|
679
|
+
location: "oid"
|
|
680
|
+
}
|
|
681
|
+
}));
|
|
682
|
+
const tn = e.enum(["PROGRESSIVE", "STAMP"]), on = e.object({
|
|
683
|
+
type: tn,
|
|
684
|
+
end: e.number().int().min(0, "Threshold need to be at least 1"),
|
|
685
|
+
rewards: e.array(e.lazy(() => q)).nullish()
|
|
686
|
+
}).superRefine((t, i) => {
|
|
687
|
+
t.type == "STAMP" && t.end > 40 && (i.addIssue({
|
|
688
|
+
code: "custom",
|
|
689
|
+
path: [],
|
|
690
|
+
message: "Stamp mission can have at most 40 threshold"
|
|
691
|
+
}), i.addIssue({
|
|
692
|
+
code: "custom",
|
|
693
|
+
path: ["end"],
|
|
694
|
+
message: "Stamp mission can have at most 40 threshold"
|
|
695
|
+
}));
|
|
696
|
+
}), sn = {
|
|
697
|
+
collectionName: "Groups",
|
|
698
|
+
transform: {
|
|
699
|
+
_id: "oid",
|
|
700
|
+
business: "oid"
|
|
701
|
+
},
|
|
702
|
+
lookups: {
|
|
703
|
+
business: {
|
|
704
|
+
fromCollection: "Businesses",
|
|
705
|
+
as: "pf_business"
|
|
706
|
+
},
|
|
707
|
+
pf_campaigns: {
|
|
708
|
+
fromCollection: "Campaigns",
|
|
709
|
+
as: "pf_campaigns",
|
|
710
|
+
localField: "_id",
|
|
711
|
+
foreignField: "group"
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}, In = e.object({
|
|
715
|
+
_id: n,
|
|
716
|
+
name: e.string().min(1).max(300),
|
|
717
|
+
business: n,
|
|
718
|
+
pf_campaigns: e.array(e.any()).optional()
|
|
719
|
+
}).describe(l.describe(sn)), an = e.object({
|
|
720
|
+
from: e.string().email().nullish(),
|
|
721
|
+
name: e.string().min(1).max(50).nullish()
|
|
722
|
+
}), rn = e.object({
|
|
723
|
+
type: e.literal(L.enum.MEMBERSHIP),
|
|
724
|
+
business: n,
|
|
725
|
+
name: e.string().min(1).max(50),
|
|
726
|
+
image: e.string().nullish(),
|
|
727
|
+
url: e.string().nullish(),
|
|
728
|
+
tiers: e.array(e.lazy(() => F)),
|
|
729
|
+
titles: e.array(n),
|
|
730
|
+
tierCycleEnable: e.boolean().optional(),
|
|
731
|
+
tierCycle: e.lazy(() => f).nullish(),
|
|
732
|
+
welcomeMessage: y.optional(),
|
|
733
|
+
advertisements: e.array(e.string()).optional(),
|
|
734
|
+
cardEnable: e.boolean().optional(),
|
|
735
|
+
design: e.array(
|
|
736
|
+
e.object({
|
|
737
|
+
_id: n,
|
|
738
|
+
image: e.string()
|
|
739
|
+
})
|
|
740
|
+
).optional(),
|
|
741
|
+
targetLocation: e.array(n).nullish(),
|
|
742
|
+
brand: e.string().nullish(),
|
|
743
|
+
email: an.nullish(),
|
|
744
|
+
freeCreditAsDiscount: e.boolean().optional(),
|
|
745
|
+
pf_title: e.array(e.lazy(() => p)).optional(),
|
|
746
|
+
pf_targetLocation: e.array(e.lazy(() => Z)).optional(),
|
|
747
|
+
// new structure
|
|
748
|
+
group: e.string().nullish(),
|
|
749
|
+
templateId: n.nullish()
|
|
750
|
+
}), o = L.exclude(["MEMBERSHIP"]), c = e.object({
|
|
751
|
+
_id: n.nullish(),
|
|
752
|
+
type: o,
|
|
753
|
+
// common information
|
|
754
|
+
business: n,
|
|
755
|
+
name: e.string().min(1).max(50),
|
|
756
|
+
image: e.string().nullish(),
|
|
757
|
+
description: e.string().max(500).nullish(),
|
|
758
|
+
timeframeOptions: le.superRefine((t, i) => {
|
|
759
|
+
t.start && t.end && t.end < t.start && i.addIssue({
|
|
760
|
+
code: "custom",
|
|
761
|
+
path: [],
|
|
762
|
+
params: {
|
|
763
|
+
i18n: { key: "timeframe.end_before_start" }
|
|
764
|
+
}
|
|
765
|
+
});
|
|
766
|
+
}).nullish(),
|
|
767
|
+
targetLocation: e.array(n).nullish(),
|
|
768
|
+
event: De,
|
|
769
|
+
config: ce.nullish(),
|
|
770
|
+
currentReceive: e.coerce.number().optional(),
|
|
771
|
+
// new group structure
|
|
772
|
+
group: n.nullish(),
|
|
773
|
+
templateId: n.nullish(),
|
|
774
|
+
pf_targetLocation: e.array(e.lazy(() => Z)).optional()
|
|
775
|
+
}), d = {
|
|
776
|
+
[o.enum.VOUCHER]: [
|
|
777
|
+
"BILL_COMPLETED",
|
|
778
|
+
"FEEDBACK",
|
|
779
|
+
"MEMBERSHIP_JOINED",
|
|
780
|
+
"TIER_UPGRADED",
|
|
781
|
+
"SCHEDULE",
|
|
782
|
+
"SIMPLE_CLAIM"
|
|
783
|
+
],
|
|
784
|
+
[o.enum.PROMOTION]: ["MAKING_ORDER"],
|
|
785
|
+
[o.enum.POINT]: [
|
|
786
|
+
"BILL_COMPLETED",
|
|
787
|
+
"FEEDBACK",
|
|
788
|
+
"MEMBERSHIP_JOINED",
|
|
789
|
+
"TIER_UPGRADED",
|
|
790
|
+
"SCHEDULE"
|
|
791
|
+
],
|
|
792
|
+
[o.enum.CREDIT]: [
|
|
793
|
+
"BILL_COMPLETED",
|
|
794
|
+
"FEEDBACK",
|
|
795
|
+
"MEMBERSHIP_JOINED",
|
|
796
|
+
"TIER_UPGRADED",
|
|
797
|
+
"SCHEDULE"
|
|
798
|
+
],
|
|
799
|
+
[o.enum.BROADCAST]: [
|
|
800
|
+
"SCHEDULE",
|
|
801
|
+
"ISSUE_REWARD",
|
|
802
|
+
"FEEDBACK"
|
|
803
|
+
],
|
|
804
|
+
[o.enum.COIN]: [
|
|
805
|
+
"BILL_COMPLETED",
|
|
806
|
+
"FEEDBACK",
|
|
807
|
+
"MEMBERSHIP_JOINED",
|
|
808
|
+
"TIER_UPGRADED",
|
|
809
|
+
"SCHEDULE"
|
|
810
|
+
],
|
|
811
|
+
[o.enum.REWARD_POOL]: ["GAME_COMPLETED"],
|
|
812
|
+
[o.enum.GAME]: [
|
|
813
|
+
"BILL_COMPLETED",
|
|
814
|
+
"FEEDBACK",
|
|
815
|
+
"MEMBERSHIP_JOINED",
|
|
816
|
+
"TIER_UPGRADED",
|
|
817
|
+
"SCHEDULE",
|
|
818
|
+
"SIMPLE_CLAIM"
|
|
819
|
+
],
|
|
820
|
+
[o.enum.MISSION]: [
|
|
821
|
+
"BILL_COMPLETED",
|
|
822
|
+
"FEEDBACK",
|
|
823
|
+
"SCHEDULE"
|
|
824
|
+
]
|
|
825
|
+
}, X = c.extend({
|
|
826
|
+
type: e.literal(o.enum.VOUCHER),
|
|
827
|
+
// event
|
|
828
|
+
code: e.string().min(0).max(15).optional(),
|
|
829
|
+
event: a.merge(
|
|
830
|
+
e.object({
|
|
831
|
+
type: e.enum(d[o.enum.VOUCHER])
|
|
832
|
+
})
|
|
833
|
+
),
|
|
834
|
+
earningOption: m.default({
|
|
835
|
+
amount: 1,
|
|
836
|
+
type: "FIXED"
|
|
837
|
+
}),
|
|
838
|
+
collectible: n,
|
|
839
|
+
hideInApp: e.boolean().optional(),
|
|
840
|
+
notify: e.boolean().optional(),
|
|
841
|
+
notifyMessage: e.lazy(() => y).optional(),
|
|
842
|
+
notifyCampaign: n.nullish(),
|
|
843
|
+
pf_collectible: e.lazy(() => p).optional(),
|
|
844
|
+
pf_notifyCampaign: e.lazy(() => h).optional()
|
|
845
|
+
}), ln = e.object({
|
|
846
|
+
gameType: e.string()
|
|
847
|
+
}), $ = c.extend({
|
|
848
|
+
type: e.literal(o.enum.PROMOTION),
|
|
849
|
+
// event
|
|
850
|
+
event: a.merge(
|
|
851
|
+
e.object({
|
|
852
|
+
type: e.enum(d[o.enum.PROMOTION])
|
|
853
|
+
})
|
|
854
|
+
),
|
|
855
|
+
effect: e.custom().superRefine((t, i) => {
|
|
856
|
+
t || i.addIssue({
|
|
857
|
+
code: "custom",
|
|
858
|
+
path: [],
|
|
859
|
+
params: {
|
|
860
|
+
i18n: { key: "zodCustom.campaign.effect_required" }
|
|
861
|
+
}
|
|
862
|
+
});
|
|
863
|
+
}),
|
|
864
|
+
gameConfig: ln.nullish()
|
|
865
|
+
}), Q = c.extend({
|
|
866
|
+
type: e.literal(o.enum.POINT),
|
|
867
|
+
// event
|
|
868
|
+
event: a.merge(
|
|
869
|
+
e.object({
|
|
870
|
+
type: e.enum(d[o.enum.POINT])
|
|
871
|
+
})
|
|
872
|
+
),
|
|
873
|
+
earningOption: m,
|
|
874
|
+
collectible: n,
|
|
875
|
+
notify: e.boolean().optional(),
|
|
876
|
+
notifyMessage: e.lazy(() => y).optional(),
|
|
877
|
+
notifyCampaign: n.nullish(),
|
|
878
|
+
pf_collectible: e.lazy(() => p).optional(),
|
|
879
|
+
pf_notifyCampaign: e.lazy(() => h).optional()
|
|
880
|
+
}), ee = c.extend({
|
|
881
|
+
type: e.literal(o.enum.CREDIT),
|
|
882
|
+
// event
|
|
883
|
+
event: a.merge(
|
|
884
|
+
e.object({
|
|
885
|
+
type: e.enum(d[o.enum.CREDIT])
|
|
886
|
+
})
|
|
887
|
+
),
|
|
888
|
+
earningOption: m,
|
|
889
|
+
collectible: n,
|
|
890
|
+
notify: e.boolean().optional(),
|
|
891
|
+
notifyMessage: e.lazy(() => y).optional(),
|
|
892
|
+
notifyCampaign: n.nullish(),
|
|
893
|
+
pf_collectible: e.lazy(() => p).optional(),
|
|
894
|
+
pf_notifyCampaign: e.lazy(() => h).optional()
|
|
895
|
+
}), h = c.extend({
|
|
896
|
+
type: e.literal(o.enum.BROADCAST),
|
|
897
|
+
// event
|
|
898
|
+
event: a.merge(
|
|
899
|
+
e.object({
|
|
900
|
+
type: e.enum(d[o.enum.BROADCAST])
|
|
901
|
+
})
|
|
902
|
+
),
|
|
903
|
+
message: y,
|
|
904
|
+
linkedCampaign: n.nullish()
|
|
905
|
+
}), ne = c.extend({
|
|
906
|
+
type: e.literal(o.enum.COIN),
|
|
907
|
+
// event
|
|
908
|
+
event: a.merge(
|
|
909
|
+
e.object({
|
|
910
|
+
type: e.enum(d[o.enum.COIN])
|
|
911
|
+
})
|
|
912
|
+
),
|
|
913
|
+
earningOption: m,
|
|
914
|
+
collectible: n,
|
|
915
|
+
notify: e.boolean().optional(),
|
|
916
|
+
notifyMessage: e.lazy(() => y).optional(),
|
|
917
|
+
notifyCampaign: n.nullish(),
|
|
918
|
+
pf_collectible: e.lazy(() => p).optional(),
|
|
919
|
+
pf_notifyCampaign: e.lazy(() => h).optional()
|
|
920
|
+
}), R = c.extend({
|
|
921
|
+
type: e.literal(o.enum.REWARD_POOL),
|
|
922
|
+
// event
|
|
923
|
+
event: a.merge(
|
|
924
|
+
e.object({
|
|
925
|
+
type: e.enum(d[o.enum.REWARD_POOL])
|
|
926
|
+
})
|
|
927
|
+
),
|
|
928
|
+
rewards: e.array(e.lazy(() => Qe)).min(1, "Requires at least 1 reward")
|
|
929
|
+
}), te = c.extend({
|
|
930
|
+
type: e.literal(o.enum.GAME),
|
|
931
|
+
// event
|
|
932
|
+
event: a.merge(
|
|
933
|
+
e.object({
|
|
934
|
+
type: e.enum(d[o.enum.GAME])
|
|
935
|
+
})
|
|
936
|
+
),
|
|
937
|
+
earningOption: m,
|
|
938
|
+
collectible: n,
|
|
939
|
+
game: e.lazy(() => R).optional(),
|
|
940
|
+
pf_collectible: e.lazy(() => p).optional(),
|
|
941
|
+
rewardPool: n.optional()
|
|
942
|
+
}), oe = c.extend({
|
|
943
|
+
type: e.literal(o.enum.MISSION),
|
|
944
|
+
event: a.merge(
|
|
945
|
+
e.object({
|
|
946
|
+
type: e.enum(d[o.enum.MISSION])
|
|
947
|
+
})
|
|
948
|
+
),
|
|
949
|
+
earningOption: m,
|
|
950
|
+
collectible: n,
|
|
951
|
+
pf_collectible: e.lazy(() => p).optional(),
|
|
952
|
+
mission: e.lazy(() => on),
|
|
953
|
+
rewards: e.array(e.lazy(() => q)).min(1, "Requires at least 1 reward")
|
|
954
|
+
}), cn = {
|
|
955
|
+
collectionName: "Campaigns",
|
|
956
|
+
transform: {
|
|
957
|
+
_id: "oid",
|
|
958
|
+
business: "oid",
|
|
959
|
+
collectible: "oid",
|
|
960
|
+
templateId: "oid",
|
|
961
|
+
group: "oid",
|
|
962
|
+
notifyCampaign: "oid",
|
|
963
|
+
linkedCampaign: "oid",
|
|
964
|
+
rewardPool: "oid"
|
|
965
|
+
},
|
|
966
|
+
lookups: {
|
|
967
|
+
business: {
|
|
968
|
+
fromCollection: "Businesses",
|
|
969
|
+
as: "pf_business"
|
|
970
|
+
},
|
|
971
|
+
targetLocation: {
|
|
972
|
+
fromCollection: "Locations",
|
|
973
|
+
as: "pf_targetLocation"
|
|
974
|
+
},
|
|
975
|
+
collectible: {
|
|
976
|
+
fromCollection: "CollectibleConfigs",
|
|
977
|
+
as: "pf_collectible"
|
|
978
|
+
},
|
|
979
|
+
titles: {
|
|
980
|
+
fromCollection: "CollectibleConfigs",
|
|
981
|
+
as: "pf_title"
|
|
982
|
+
},
|
|
983
|
+
templateId: {
|
|
984
|
+
fromCollection: "Templates",
|
|
985
|
+
as: "template"
|
|
986
|
+
},
|
|
987
|
+
notifyCampaign: {
|
|
988
|
+
fromCollection: "Campaigns",
|
|
989
|
+
as: "pf_notifyCampaign"
|
|
990
|
+
},
|
|
991
|
+
rewardPool: {
|
|
992
|
+
fromCollection: "Campaigns",
|
|
993
|
+
as: "game"
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
}, Rn = e.object({ _id: n }).and(
|
|
997
|
+
e.discriminatedUnion("type", [
|
|
998
|
+
rn,
|
|
999
|
+
X,
|
|
1000
|
+
$,
|
|
1001
|
+
Q,
|
|
1002
|
+
ee,
|
|
1003
|
+
h,
|
|
1004
|
+
ne,
|
|
1005
|
+
R,
|
|
1006
|
+
te,
|
|
1007
|
+
oe
|
|
1008
|
+
])
|
|
1009
|
+
).describe(l.describe(cn)), _n = e.discriminatedUnion("type", [
|
|
1010
|
+
X.extend({
|
|
1011
|
+
business: n.nullish()
|
|
1012
|
+
}),
|
|
1013
|
+
$.extend({
|
|
1014
|
+
business: n.nullish()
|
|
1015
|
+
}),
|
|
1016
|
+
Q.extend({
|
|
1017
|
+
business: n.nullish()
|
|
1018
|
+
}),
|
|
1019
|
+
ee.extend({
|
|
1020
|
+
business: n.nullish()
|
|
1021
|
+
}),
|
|
1022
|
+
h.extend({
|
|
1023
|
+
business: n.nullish()
|
|
1024
|
+
}),
|
|
1025
|
+
ne.extend({
|
|
1026
|
+
business: n.nullish()
|
|
1027
|
+
}),
|
|
1028
|
+
R.extend({
|
|
1029
|
+
rewards: e.array(e.lazy(() => A)).min(1, "Requires at least 1 reward")
|
|
1030
|
+
}),
|
|
1031
|
+
te.extend({
|
|
1032
|
+
business: n.nullish(),
|
|
1033
|
+
game: R.extend({
|
|
1034
|
+
business: n.nullish(),
|
|
1035
|
+
rewards: e.array(e.lazy(() => A)).min(1, "Requires at least 1 reward")
|
|
1036
|
+
})
|
|
1037
|
+
}),
|
|
1038
|
+
oe.extend({
|
|
1039
|
+
business: n.nullish(),
|
|
1040
|
+
rewards: e.array(e.lazy(() => en)).min(1, "Requires at least 1 reward")
|
|
1041
|
+
})
|
|
1042
|
+
]);
|
|
1043
|
+
export {
|
|
1044
|
+
d as C,
|
|
1045
|
+
hn as F,
|
|
1046
|
+
o as a,
|
|
1047
|
+
fn as b,
|
|
1048
|
+
A as c,
|
|
1049
|
+
tn as d,
|
|
1050
|
+
en as e,
|
|
1051
|
+
on as f,
|
|
1052
|
+
bn as g,
|
|
1053
|
+
L as h,
|
|
1054
|
+
In as i,
|
|
1055
|
+
_n as j,
|
|
1056
|
+
Rn as k,
|
|
1057
|
+
yn as l,
|
|
1058
|
+
s as m,
|
|
1059
|
+
Ke as n,
|
|
1060
|
+
B as o,
|
|
1061
|
+
Ge as p,
|
|
1062
|
+
G as q,
|
|
1063
|
+
N as r,
|
|
1064
|
+
De as s,
|
|
1065
|
+
rn as t,
|
|
1066
|
+
Cn as u
|
|
1067
|
+
};
|