@feedmepos/mf-connect 0.1.38-beta.70 → 0.1.38-beta.72

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 (133) hide show
  1. package/package.json +1 -1
  2. package/dist/Analytic-qVhEo_im.js +0 -761
  3. package/dist/App-Ixv1jrHc.js +0 -4638
  4. package/dist/AuditLogs-B2D62tMF.js +0 -1991
  5. package/dist/Bin-Lj7jtS9m.js +0 -166
  6. package/dist/Broadcast-BpP9VJsx.js +0 -267
  7. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BB43gKXv.js +0 -121
  8. package/dist/Card-CjArjpou.js +0 -909
  9. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +0 -97
  10. package/dist/Collections-CFzUAHxz.js +0 -540
  11. package/dist/Credit-D43x-T3d.js +0 -261
  12. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +0 -128
  13. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +0 -58
  14. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DlgTeQLe.js +0 -3167
  15. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-9UhSzClJ.js +0 -351
  16. package/dist/Experience-BaUbRoHV.js +0 -260
  17. package/dist/FileSaver.min-BO_rbswB.js +0 -74
  18. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +0 -129
  19. package/dist/Game-DaVqgPWQ.js +0 -331
  20. package/dist/GenerateMaterial-DJM8fZyl.js +0 -589
  21. package/dist/Grab-CykZDrWI.js +0 -301
  22. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-C51yGAp9.js +0 -145
  23. package/dist/Index-Do3WIIfM.js +0 -259
  24. package/dist/JsonViewer-v8_C7l5N.js +0 -87
  25. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-BjdBaj4c.js +0 -18737
  26. package/dist/MainLayout-DD-OlYxZ.js +0 -41
  27. package/dist/Marketing-C9bsnUaQ.js +0 -145
  28. package/dist/MarketingMaterialEdit-CbSh8dpn.js +0 -746
  29. package/dist/Member-IcVRwAAS.js +0 -280
  30. package/dist/MemberList-C_A4PrQN.js +0 -1605
  31. package/dist/MemberOverview-wL_ailso.js +0 -58
  32. package/dist/MemberTransactions-CBoaY-gv.js +0 -45
  33. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-Dx28XNPi.js +0 -60798
  34. package/dist/Mission-COY_uhwz.js +0 -335
  35. package/dist/Overview-DDSz2R4K.js +0 -1078
  36. package/dist/Point-C-KEwgx4.js +0 -263
  37. package/dist/Promotion-BpW9qWzf.js +0 -397
  38. package/dist/Queue-CO32O8i6.js +0 -259
  39. package/dist/Record-BrT5DR9L.js +0 -341
  40. package/dist/Reward-CbrEw-If.js +0 -442
  41. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-CpNjlbjZ.js +0 -149
  42. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-BS5jsRiN.js +0 -1912
  43. package/dist/Segment-Cu9_qwXc.js +0 -881
  44. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-BH-hzxSs.js +0 -181
  45. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-DGm3gujH.js +0 -188
  46. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-DcUb8X-q.js +0 -147
  47. package/dist/Setting-CQKfb5b_.js +0 -1999
  48. package/dist/SettingAdvertisements-BxR6Gl-5.js +0 -263
  49. package/dist/Store-6TUpmqAr.js +0 -1995
  50. package/dist/StoreRewards-BOThAOWU.js +0 -534
  51. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BYD229dz.js +0 -1034
  52. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-CAamZtdf.js +0 -7005
  53. package/dist/Tier-MF-ad-xm.js +0 -969
  54. package/dist/Title-MkjTHBzb.js +0 -567
  55. package/dist/Transaction-trYJwTrc.js +0 -39
  56. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-DwlNK1TC.js +0 -130
  57. package/dist/Voucher-BD5dTdht.js +0 -422
  58. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-BhR_s48Q.js +0 -421
  59. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-CcTe5TJL.js +0 -56
  60. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  61. package/dist/app-CybjF-6Q.js +0 -59071
  62. package/dist/app-wDQR6dpb.js +0 -39
  63. package/dist/app.js +0 -7
  64. package/dist/business-2hCbD0JX.js +0 -82
  65. package/dist/campaign-Bv-8uM2S.js +0 -100
  66. package/dist/campaign-CpzFl8Vr.js +0 -4
  67. package/dist/campaign-h1J8NTAo.js +0 -253
  68. package/dist/campaign.enum-Dea0E4o1.js +0 -26
  69. package/dist/campaign.fn-DqxZMyu0.js +0 -776
  70. package/dist/collectible.enum-DOyAoz4F.js +0 -19
  71. package/dist/collection.fn-DU2HuZod.js +0 -26
  72. package/dist/dto-CT65-FHY.js +0 -222
  73. package/dist/duplicateCampaign-YJGHvOqb.js +0 -51
  74. package/dist/effect-XZ767UQ4.js +0 -89
  75. package/dist/email-addresses-DSgkxSnV.js +0 -705
  76. package/dist/export-4gx5C9s9.js +0 -96
  77. package/dist/feedme.ico +0 -0
  78. package/dist/helper-HOLsJca3.js +0 -86
  79. package/dist/index-BO7N-s4K.js +0 -8912
  80. package/dist/index-BfRa1sI3.js +0 -54
  81. package/dist/index-BnCtmlvU.js +0 -28897
  82. package/dist/index-C5VvGYtP.js +0 -56
  83. package/dist/index-CSzvYzf4.js +0 -3419
  84. package/dist/index-CrdkPXsx.js +0 -124
  85. package/dist/index-CuvNtC_M.js +0 -61
  86. package/dist/index-CxE-VVlL.js +0 -76
  87. package/dist/index-Djenbz3F.js +0 -3
  88. package/dist/index-IHteBJ_D.js +0 -32
  89. package/dist/index-dUhOAfj9.js +0 -2423
  90. package/dist/index-vh86FiIQ.js +0 -10
  91. package/dist/index-wm4nGBB_.js +0 -30289
  92. package/dist/index-xTrAj026.js +0 -31
  93. package/dist/index-yViT18i_.js +0 -36
  94. package/dist/index.esm2017-Wq4FUMEv.js +0 -3069
  95. package/dist/loading-D22xapd8.js +0 -215
  96. package/dist/lodash-HM6bxuWV.js +0 -3678
  97. package/dist/membership-CX464ZBI.js +0 -235
  98. package/dist/moment-D7p2TMB-.js +0 -2583
  99. package/dist/money-B3cPZAZu.js +0 -15
  100. package/dist/number-DT65dEZt.js +0 -12
  101. package/dist/object-qECH92oz.js +0 -26
  102. package/dist/objectId-dwaoBfJX.js +0 -7
  103. package/dist/objectid-DZWw4iLL.js +0 -145
  104. package/dist/plugins-D-4BlIGs.js +0 -1817
  105. package/dist/remy-D_Deb3ue.js +0 -13
  106. package/dist/reward-C6B-kn0X.js +0 -36
  107. package/dist/rule-B94SrDX1.js +0 -1969
  108. package/dist/rule-builder-CQ3uHeX4.js +0 -102
  109. package/dist/style.css +0 -13
  110. package/dist/template-CXB2Ez2S.js +0 -188
  111. package/dist/tier-BJDhpH6X.js +0 -4
  112. package/dist/tiers/tier=1.png +0 -0
  113. package/dist/tiers/tier=2.png +0 -0
  114. package/dist/tiers/tier=3.png +0 -0
  115. package/dist/tiers/tier=4.png +0 -0
  116. package/dist/timezone-D3NuV-rx.js +0 -1154
  117. package/dist/titles/type=diamond.png +0 -0
  118. package/dist/titles/type=drinks.png +0 -0
  119. package/dist/titles/type=food.png +0 -0
  120. package/dist/titles/type=heart.png +0 -0
  121. package/dist/titles/type=medal.png +0 -0
  122. package/dist/titles/type=spend.png +0 -0
  123. package/dist/titles/type=thank-you.png +0 -0
  124. package/dist/titles/type=thumbs-up.png +0 -0
  125. package/dist/titles/type=years.png +0 -0
  126. package/dist/trigger-BsCVC_nU.js +0 -213
  127. package/dist/tslib.es6-BCqqvLQ_.js +0 -44
  128. package/dist/type_drinks-D6jnpvwV.js +0 -4
  129. package/dist/usePagination-BOZ0-D67.js +0 -223
  130. package/dist/user-Dxp7kluY.js +0 -55
  131. package/dist/vue-i18n-DpCWu1gI.js +0 -2365
  132. package/dist/xlsx-Cc2a2IL9.js +0 -15491
  133. package/dist/zod-BCSHGdXs.js +0 -91
@@ -1,1912 +0,0 @@
1
- import { defineComponent as P, computed as M, resolveComponent as k, openBlock as r, createElementBlock as V, createElementVNode as C, createVNode as v, unref as e, createTextVNode as ne, toDisplayString as A, withCtx as B, onMounted as Z, createBlock as g, createCommentVNode as N, ref as W, watch as pe, Fragment as q, renderList as $, normalizeClass as K, resolveDynamicComponent as me, onBeforeMount as ce, isRef as fe, createSlots as ye } from "vue";
2
- import { m as ge, C as _e, n as ke, a as he, o as Ee } from "./index-BO7N-s4K.js";
3
- import { R as Y, a as Ve } from "./rule-builder-CQ3uHeX4.js";
4
- import { useDialog as ue, useDialogChild as ve, useSnackbar as Te } from "@feedmepos/ui-library";
5
- import { u as G } from "./vue-i18n-DpCWu1gI.js";
6
- import { a as Se, R as w, S as Fe, C as j, g as xe, W as Re, T as ie, O as de } from "./rule-B94SrDX1.js";
7
- import { p as Ue } from "./plugins-D-4BlIGs.js";
8
- import { h as ae } from "./moment-D7p2TMB-.js";
9
- import { z as Ce } from "./app-CybjF-6Q.js";
10
- import { u as X } from "./membership-CX464ZBI.js";
11
- import { u as te } from "./business-2hCbD0JX.js";
12
- import "./index-wm4nGBB_.js";
13
- import { _ as O } from "./CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js";
14
- import { c as be } from "./object-qECH92oz.js";
15
- import { Z as le } from "./zod-BCSHGdXs.js";
16
- import { _ as Ye } from "./SelectItems.vue_vue_type_script_setup_true_lang-BH-hzxSs.js";
17
- import "./index-dUhOAfj9.js";
18
- import "./index-CSzvYzf4.js";
19
- import "./index-BfRa1sI3.js";
20
- const Oe = { class: "flex items-center justify-between" }, De = { class: "flex items-center gap-8 xs:flex-wrap" }, we = { class: "text-fm-color-primary line-clamp-1 text-ellipsis" }, qe = /* @__PURE__ */ P({
21
- __name: "RuleEntry",
22
- props: {
23
- modelValue: {
24
- type: Object,
25
- required: !0
26
- }
27
- },
28
- emits: ["edit", "remove"],
29
- setup(l, { emit: R }) {
30
- const _ = l, m = M(() => {
31
- const [d, o] = Object.entries(_.modelValue.conditions)[0];
32
- return {
33
- negated: _.modelValue.negated == !0,
34
- property: _.modelValue.property,
35
- operator: d,
36
- equator: o
37
- };
38
- }), f = R, n = M(
39
- () => Se(
40
- m.value.property,
41
- m.value.operator,
42
- m.value.equator,
43
- m.value.negated
44
- )
45
- );
46
- async function t(d) {
47
- d.stopPropagation(), await Ue.remove("Are you sure you want to remove this rule?") && f("remove", _.modelValue);
48
- }
49
- return (d, o) => {
50
- var h;
51
- const i = k("FmChip"), p = k("FmTooltip"), b = k("FmIcon");
52
- return r(), V("div", Oe, [
53
- C("div", De, [
54
- v(i, {
55
- label: (h = e(ge).find((U) => U.property === _.modelValue.property)) == null ? void 0 : h.name,
56
- class: "!text-fm-color-typo-info !bg-fm-color-system-info-100"
57
- }, null, 8, ["label"]),
58
- o[1] || (o[1] = C("div", { class: "h-[26px] border-l-2 rounded-md border-fm-color-neutral-gray-100" }, null, -1)),
59
- C("div", {
60
- onClick: o[0] || (o[0] = (U) => f("edit", _.modelValue)),
61
- class: "inline-flex rounded-md items-center gap-4 justify-center h-[30px] px-8 py-4 text-fm-color-typo-primary !bg-transparent border-dashed border-2 fm-typo-en-body-md-600 cursor-pointer"
62
- }, [
63
- ne(A(e(n)[0]) + " ", 1),
64
- v(p, {
65
- "z-index": 1e3,
66
- content: e(n)[1]
67
- }, {
68
- default: B(() => [
69
- C("div", we, A(e(n)[1]), 1)
70
- ]),
71
- _: 1
72
- }, 8, ["content"])
73
- ])
74
- ]),
75
- v(b, {
76
- name: "close",
77
- size: "md",
78
- class: "cursor-pointer hover:bg-neutral-300 rounded-lg",
79
- onClick: t
80
- })
81
- ]);
82
- };
83
- }
84
- });
85
- Ce.enum([
86
- "MIN_SPEND",
87
- "SPECIFIC_DATE",
88
- "SPECIFIC_TIMERANGE",
89
- "WEEKLY",
90
- "MONTHLY",
91
- "BIRTHDAY",
92
- "TIER",
93
- "TITLE",
94
- "LAST_X_DAY",
95
- "CUSTOM"
96
- ]);
97
- const Be = [
98
- {
99
- type: "MIN_SPEND",
100
- name: "Minimum spend",
101
- for: ["bill"],
102
- rules: []
103
- },
104
- {
105
- type: "SPECIFIC_DATE",
106
- name: "Specific date",
107
- for: ["trigger"],
108
- rules: []
109
- },
110
- {
111
- type: "SPECIFIC_TIMERANGE",
112
- name: "Specific time range",
113
- for: ["trigger"],
114
- rules: []
115
- },
116
- {
117
- type: "WEEKLY",
118
- name: "Weekly",
119
- for: ["trigger"],
120
- rules: [
121
- {
122
- property: "trigger.date",
123
- operator: "_rrule",
124
- equator: "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
125
- }
126
- ]
127
- },
128
- {
129
- type: "MONTHLY",
130
- name: "Monthly",
131
- for: ["trigger"],
132
- rules: [
133
- {
134
- property: "trigger.date",
135
- operator: "_rrule",
136
- equator: "RRULE:FREQ=MONTHLY;WKST=SU;BYMONTHDAY=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
137
- }
138
- ]
139
- },
140
- {
141
- type: "BIRTHDAY",
142
- name: "Birthday",
143
- for: ["user"],
144
- rules: [
145
- {
146
- property: "user.birthday",
147
- operator: "_isRange",
148
- equator: {
149
- op: "this",
150
- unit: "day",
151
- ignoreYear: !0
152
- }
153
- }
154
- ]
155
- },
156
- {
157
- type: "BIRTHDAY",
158
- name: "Birthday Week",
159
- for: ["user"],
160
- rules: [
161
- {
162
- property: "user.birthday",
163
- operator: "_isRange",
164
- equator: {
165
- op: "this",
166
- unit: "week",
167
- ignoreYear: !0
168
- }
169
- }
170
- ]
171
- },
172
- {
173
- type: "BIRTHDAY",
174
- name: "Birthday Month",
175
- for: ["user"],
176
- rules: [
177
- {
178
- property: "user.birthday",
179
- operator: "_isRange",
180
- equator: {
181
- op: "this",
182
- unit: "month",
183
- ignoreYear: !0
184
- }
185
- }
186
- ]
187
- },
188
- {
189
- type: "BIRTHDAY",
190
- name: "N day before birthday",
191
- for: ["user"],
192
- rules: [
193
- {
194
- property: "user.birthday",
195
- operator: "_isDay",
196
- equator: {
197
- op: "before",
198
- x: 1,
199
- ignoreYear: !0
200
- }
201
- }
202
- ]
203
- },
204
- {
205
- type: "TIER",
206
- name: "Specific tier",
207
- for: ["user"],
208
- rules: [
209
- {
210
- property: "user.tier",
211
- operator: "_equal",
212
- equator: 1
213
- }
214
- ]
215
- },
216
- {
217
- type: "TITLE",
218
- name: "Specific title",
219
- for: ["user"],
220
- rules: [
221
- {
222
- property: "user.titles",
223
- operator: "_hasAny",
224
- equator: []
225
- }
226
- ]
227
- },
228
- {
229
- type: "LAST_X_DAY",
230
- name: "Last visit in X days",
231
- for: ["user"],
232
- rules: [
233
- {
234
- property: "user.stats.lastVisit",
235
- operator: "_isRange",
236
- equator: {
237
- op: "last",
238
- unit: "day",
239
- ignoreYear: !0,
240
- x: 0
241
- }
242
- }
243
- ],
244
- premium: !0
245
- },
246
- {
247
- type: "CUSTOM",
248
- name: "Weekday special",
249
- for: ["trigger"],
250
- rules: [
251
- {
252
- property: "trigger.date",
253
- operator: "_rrule",
254
- equator: "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=MO,TU,WE,TH,FR;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
255
- }
256
- ]
257
- },
258
- {
259
- type: "CUSTOM",
260
- name: "Weekend special",
261
- for: ["trigger"],
262
- rules: [
263
- {
264
- property: "trigger.date",
265
- operator: "_rrule",
266
- equator: "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU,SA;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
267
- }
268
- ]
269
- },
270
- {
271
- type: "CUSTOM",
272
- name: "Happy hour",
273
- for: ["trigger"],
274
- rules: [
275
- {
276
- property: "trigger.time",
277
- operator: "_isBetweenTime",
278
- equator: [
279
- {
280
- start: "21:00",
281
- end: "23:59"
282
- }
283
- ]
284
- }
285
- ]
286
- },
287
- {
288
- type: "CUSTOM",
289
- name: "Mother's day special",
290
- for: ["trigger"],
291
- rules: [
292
- {
293
- property: "trigger.date",
294
- operator: "_rrule",
295
- equator: "RRULE:FREQ=YEARLY;WKST=SU;BYDAY=+2SU;BYMONTH=5;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
296
- }
297
- ]
298
- },
299
- {
300
- type: "CUSTOM",
301
- name: "Father's day special",
302
- for: ["trigger"],
303
- rules: [
304
- {
305
- property: "trigger.date",
306
- operator: "_rrule",
307
- equator: "RRULE:FREQ=YEARLY;WKST=SU;BYDAY=+3SU;BYMONTH=6;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
308
- }
309
- ]
310
- },
311
- {
312
- type: "CUSTOM",
313
- name: "Christmas",
314
- for: ["trigger"],
315
- rules: [
316
- {
317
- property: "trigger.date",
318
- operator: "_rrule",
319
- equator: "RRULE:FREQ=YEARLY;WKST=SU;BYMONTH=12;BYMONTHDAY=25;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
320
- }
321
- ]
322
- },
323
- {
324
- type: "CUSTOM",
325
- name: "Feedback rating",
326
- for: ["feedback"],
327
- rules: [
328
- {
329
- property: "feedback.rating",
330
- operator: "_lessThanOrEqual",
331
- equator: 5
332
- }
333
- ]
334
- },
335
- {
336
- type: "CUSTOM",
337
- name: "Custom",
338
- for: ["trigger", "user", "bill", "feedback"],
339
- rules: [
340
- {
341
- property: "trigger.date",
342
- operator: "_isOnDate",
343
- equator: ae().format("YYYY-MM-DD")
344
- }
345
- ]
346
- }
347
- ], Me = { class: "flex flex-nowrap gap-x-4 items-center" }, Ie = /* @__PURE__ */ P({
348
- __name: "IsDayInput",
349
- props: {
350
- modelValue: {
351
- type: Object
352
- }
353
- },
354
- emits: ["update:model-value"],
355
- setup(l, { emit: R }) {
356
- const { t: _ } = G(), m = l, f = R;
357
- Z(() => {
358
- m.modelValue || f("update:model-value", {
359
- op: "before",
360
- x: 1
361
- });
362
- });
363
- function n(t) {
364
- const d = be(
365
- m.modelValue ?? {
366
- op: "before",
367
- x: 1
368
- }
369
- );
370
- f("update:model-value", {
371
- ...d,
372
- ...t
373
- });
374
- }
375
- return (t, d) => {
376
- var i, p, b;
377
- const o = k("FmStepperField");
378
- return r(), V("div", Me, [
379
- v(o, {
380
- class: "w-1/3",
381
- "model-value": ((i = l.modelValue) == null ? void 0 : i.x) ?? null,
382
- max: 365,
383
- "show-steppers": !1,
384
- "append-text": "days",
385
- "onUpdate:modelValue": d[0] || (d[0] = (h) => n({ x: h }))
386
- }, null, 8, ["model-value"]),
387
- v(O, {
388
- "model-value": ((p = l.modelValue) == null ? void 0 : p.op) ?? void 0,
389
- items: [
390
- {
391
- label: e(_)("connect.template.rule.is_day.before"),
392
- value: "before"
393
- },
394
- { label: e(_)("connect.template.rule.is_day.after"), value: "after" }
395
- ],
396
- "onUpdate:modelValue": d[1] || (d[1] = (h) => n({ op: h }))
397
- }, null, 8, ["model-value", "items"]),
398
- v(O, {
399
- "model-value": ((b = l.modelValue) == null ? void 0 : b.ignoreYear) ?? !1,
400
- items: [
401
- {
402
- label: e(_)("connect.template.rule.is_day.same_year"),
403
- value: !1
404
- },
405
- {
406
- label: e(_)("connect.template.rule.is_day.ignore_year"),
407
- value: !0
408
- }
409
- ],
410
- required: !0,
411
- "onUpdate:modelValue": d[2] || (d[2] = (h) => n({ ignoreYear: h == !0 }))
412
- }, null, 8, ["model-value", "items"])
413
- ]);
414
- };
415
- }
416
- }), Ae = { class: "grid grid-cols-4 gap-x-4 items-center" }, Ne = /* @__PURE__ */ P({
417
- __name: "IsRangeInput",
418
- props: {
419
- modelValue: {
420
- type: Object,
421
- default: () => ({
422
- op: "this",
423
- unit: "day",
424
- ignoreYear: !0
425
- })
426
- }
427
- },
428
- emits: ["update:model-value"],
429
- setup(l, { emit: R }) {
430
- const { t: _ } = G(), m = l, f = R;
431
- Z(() => {
432
- m.modelValue || f("update:model-value", {
433
- op: "this",
434
- unit: "day",
435
- ignoreYear: !0
436
- });
437
- });
438
- const n = [
439
- { label: _("connect.template.rule.is_range.duration.day"), value: "day" },
440
- { label: _("connect.template.rule.is_range.duration.week"), value: "week" },
441
- {
442
- label: _("connect.template.rule.is_range.duration.month"),
443
- value: "month"
444
- },
445
- {
446
- label: _("connect.template.rule.is_range.duration.quarter"),
447
- value: "quarter"
448
- },
449
- { label: _("connect.template.rule.is_range.duration.year"), value: "year" }
450
- ], t = [
451
- {
452
- label: _("connect.template.rule.is_range.op.this"),
453
- value: "this"
454
- },
455
- {
456
- label: _("connect.template.rule.is_range.op.last"),
457
- value: "last"
458
- },
459
- {
460
- label: _("connect.template.rule.is_range.op.next"),
461
- value: "next"
462
- }
463
- ];
464
- return (d, o) => {
465
- var p, b, h, U, D;
466
- const i = k("FmStepperField");
467
- return r(), V("div", Ae, [
468
- v(O, {
469
- "model-value": (p = l.modelValue) == null ? void 0 : p.op,
470
- label: "",
471
- items: t,
472
- required: !0,
473
- "onUpdate:modelValue": o[0] || (o[0] = (c) => f("update:model-value", { op: c, unit: "day", ignoreYear: !1 }))
474
- }, null, 8, ["model-value"]),
475
- ((b = l.modelValue) == null ? void 0 : b.op) != "this" ? (r(), g(i, {
476
- key: 0,
477
- "model-value": ((h = l.modelValue) == null ? void 0 : h.x) || 0,
478
- max: 365,
479
- "show-steppers": !1,
480
- "onUpdate:modelValue": o[1] || (o[1] = (c) => f("update:model-value", {
481
- op: l.modelValue.op,
482
- unit: l.modelValue.unit,
483
- ignoreYear: l.modelValue.ignoreYear == !0,
484
- x: c
485
- }))
486
- }, null, 8, ["model-value"])) : N("", !0),
487
- v(O, {
488
- "model-value": (U = l.modelValue) == null ? void 0 : U.unit,
489
- label: "",
490
- items: n,
491
- required: !0,
492
- "onUpdate:modelValue": o[2] || (o[2] = (c) => f("update:model-value", { ...m.modelValue, unit: c }))
493
- }, null, 8, ["model-value"]),
494
- v(O, {
495
- label: "",
496
- "model-value": (D = l.modelValue) == null ? void 0 : D.ignoreYear,
497
- items: [
498
- { label: "same", value: !1 },
499
- { label: "ignore", value: !0 }
500
- ],
501
- required: !0,
502
- "onUpdate:modelValue": o[3] || (o[3] = (c) => f("update:model-value", {
503
- ...m.modelValue,
504
- ignoreYear: c == !0
505
- }))
506
- }, null, 8, ["model-value"])
507
- ]);
508
- };
509
- }
510
- }), Pe = { class: "space-y-8" }, Le = { class: "text-fm-color-primary rounded-md border-dashed border-2 p-8" }, $e = {
511
- key: 0,
512
- class: "flex items-center gap-8"
513
- }, He = { class: "flex gap-4" }, We = {
514
- key: 0,
515
- class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
516
- }, je = ["onClick"], Ke = {
517
- key: 1,
518
- class: "flex items-center gap-8"
519
- }, Ge = { class: "flex gap-4 xs:gap-[2px]" }, Qe = { class: "grid grid-cols-6 gap-8" }, ze = {
520
- key: 0,
521
- class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
522
- }, Xe = ["onClick"], Ze = {
523
- key: 1,
524
- class: "grid grid-cols-2 items-center gap-8"
525
- }, Je = { class: "flex gap-4" }, et = {
526
- key: 4,
527
- class: "flex items-center justify-end gap-8"
528
- }, re = /* @__PURE__ */ P({
529
- __name: "RruleInput",
530
- props: {
531
- modelValue: {
532
- type: String
533
- },
534
- startDate: {
535
- type: Object
536
- },
537
- applyButton: {
538
- type: Boolean
539
- },
540
- fixedFrequency: {
541
- type: Boolean
542
- }
543
- },
544
- emits: ["update:model-value", "cancel"],
545
- setup(l, { emit: R }) {
546
- const { t: _ } = G(), m = l, f = R;
547
- function n(o, i) {
548
- return new w({
549
- ...o,
550
- dtstart: xe({
551
- startDate: m.startDate,
552
- modelValue: i
553
- })
554
- });
555
- }
556
- const t = W(
557
- m.modelValue ? w.fromString(m.modelValue) : n({
558
- dtstart: m.startDate,
559
- freq: w.DAILY,
560
- wkst: w.SU,
561
- interval: 1,
562
- byhour: 0,
563
- byminute: 0,
564
- bysecond: 0
565
- })
566
- );
567
- function d(o) {
568
- var i;
569
- if ("freq" in o)
570
- switch (o.freq) {
571
- case w.WEEKLY:
572
- t.value = n(
573
- {
574
- freq: o.freq,
575
- interval: 1,
576
- byhour: 0,
577
- byminute: 0,
578
- bysecond: 0,
579
- wkst: w.SU,
580
- byweekday: [w.MO]
581
- },
582
- t.value
583
- );
584
- break;
585
- case w.MONTHLY:
586
- t.value = n(
587
- {
588
- freq: o.freq,
589
- interval: 1,
590
- byhour: 0,
591
- byminute: 0,
592
- bysecond: 0,
593
- bymonthday: [(/* @__PURE__ */ new Date()).getDate()],
594
- wkst: w.SU
595
- },
596
- t.value
597
- );
598
- break;
599
- case w.YEARLY:
600
- t.value = n(
601
- {
602
- freq: o.freq,
603
- interval: 1,
604
- byhour: 0,
605
- byminute: 0,
606
- bysecond: 0,
607
- wkst: w.SU,
608
- bymonth: [(/* @__PURE__ */ new Date()).getMonth() + 1],
609
- bymonthday: [(/* @__PURE__ */ new Date()).getDate()]
610
- },
611
- t.value
612
- );
613
- break;
614
- default:
615
- t.value = n(
616
- {
617
- freq: o.freq,
618
- interval: 1,
619
- byhour: 0,
620
- byminute: 0,
621
- bysecond: 0,
622
- wkst: w.SU
623
- },
624
- t.value
625
- );
626
- }
627
- o.interval && o.interval > 0 && (t.value = n(
628
- {
629
- ...t.value.origOptions,
630
- interval: o.interval
631
- },
632
- t.value
633
- )), "byweekday" in o && o.byweekday && Array.isArray(o.byweekday) && o.byweekday.length > 0 && (t.value.options.bymonthday.length > 0 && t.value.options.freq == w.MONTHLY && (t.value.options.bymonthday = []), t.value = n(
634
- {
635
- ...t.value.origOptions,
636
- bymonthday: [],
637
- byweekday: o.byweekday
638
- },
639
- t.value
640
- )), "bysetpos" in o && o.bysetpos != null && (t.value = n(
641
- {
642
- ...t.value.origOptions,
643
- bymonthday: [],
644
- bysetpos: o.bysetpos,
645
- byweekday: ((i = t.value.options.byweekday) == null ? void 0 : i.length) > 0 ? t.value.options.byweekday : [6]
646
- },
647
- t.value
648
- )), "bymonthday" in o && o.bymonthday && Array.isArray(o.bymonthday) && o.bymonthday.length > 0 && (t.value = n(
649
- {
650
- ...t.value.origOptions,
651
- bysetpos: [],
652
- byweekday: [],
653
- bymonthday: o.bymonthday
654
- },
655
- t.value
656
- )), "bymonth" in o && o.bymonth && Array.isArray(o.bymonth) && o.bymonth.length > 0 && (t.value = n(
657
- {
658
- ...t.value.origOptions,
659
- bysetpos: [],
660
- bymonth: o.bymonth
661
- },
662
- t.value
663
- )), "bynweekday" in o && o.bynweekday && (t.value = n(
664
- {
665
- ...t.value.origOptions,
666
- bysetpos: [],
667
- byweekday: new Re(
668
- o.bynweekday[0][0],
669
- o.bynweekday[0][1]
670
- )
671
- },
672
- t.value
673
- )), m.applyButton || f("update:model-value", t.value.toString());
674
- }
675
- return pe(
676
- () => m.modelValue,
677
- (o) => {
678
- !o || o === t.value.toString() || (t.value = w.fromString(o));
679
- }
680
- ), Z(() => {
681
- m.modelValue || f("update:model-value", t.value.toString());
682
- }), (o, i) => {
683
- var D, c, s;
684
- const p = k("FmStepperField"), b = k("FmChip"), h = k("FmButtonGroup"), U = k("FmButton");
685
- return r(), V("div", Pe, [
686
- C("div", Le, A(e(Fe)(e(t).options)), 1),
687
- l.fixedFrequency ? N("", !0) : (r(), V("div", $e, [
688
- C("div", null, A(e(_)("connect.template.rule.rrule.repeat_every")), 1),
689
- v(p, {
690
- class: "w-[100px]",
691
- "model-value": e(t).options.interval,
692
- "onUpdate:modelValue": i[0] || (i[0] = (a) => d({ interval: a > 0 ? a : e(t).options.interval })),
693
- min: 1
694
- }, null, 8, ["model-value"]),
695
- v(O, {
696
- class: "w-min",
697
- items: e(j).frequencies,
698
- "model-value": e(t).origOptions.freq,
699
- "onUpdate:modelValue": i[1] || (i[1] = (a) => d({ freq: a }))
700
- }, null, 8, ["items", "model-value"])
701
- ])),
702
- e(t).options.freq === e(w).WEEKLY ? (r(), V(q, { key: 1 }, [
703
- i[8] || (i[8] = C("div", null, "Repeat on", -1)),
704
- C("div", He, [
705
- (r(!0), V(q, null, $(e(j).weekdays, (a) => {
706
- var y;
707
- return r(), g(b, {
708
- class: K(["cursor-pointer", `${(y = e(t).options.byweekday) != null && y.includes(a.value) ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
709
- label: a.label[0],
710
- key: a.value,
711
- compact: !0,
712
- onClick: () => {
713
- var T, u;
714
- d({
715
- byweekday: (T = e(t).options.byweekday) != null && T.includes(a.value) ? ((u = e(t).options.byweekday) == null ? void 0 : u.filter((x) => x !== a.value)) || [] : [...e(t).options.byweekday || [], a.value]
716
- });
717
- }
718
- }, null, 8, ["class", "label", "onClick"]);
719
- }), 128))
720
- ])
721
- ], 64)) : N("", !0),
722
- e(t).options.freq == e(w).MONTHLY ? (r(), V(q, { key: 2 }, [
723
- v(h, {
724
- "model-value": e(t).options.bymonthday.length ? { label: "Each" } : { label: "On the" },
725
- items: [
726
- {
727
- label: "Each"
728
- },
729
- {
730
- label: "On the"
731
- }
732
- ],
733
- "onUpdate:modelValue": i[2] || (i[2] = (a) => {
734
- a.label == "Each" ? d({ bymonthday: [1] }) : d({ bysetpos: 1 });
735
- })
736
- }, null, 8, ["model-value"]),
737
- e(t).options.bymonthday.length > 0 ? (r(), V("div", We, [
738
- (r(!0), V(q, null, $(e(j).dates, (a) => (r(), V("div", {
739
- key: a.value,
740
- class: K(["cursor-pointer text-center outline-1 outline-fm-color-neutral-gray-100 outline", `${e(t).options.bymonthday.includes(a.value) ? "bg-fm-color-primary text-fm-color-typo-white outline-transparent" : "bg-transparent text-fm-color-typo-primary"} ${a.value == 31 ? "border-r" : ""}`]),
741
- onClick: (y) => d({
742
- bymonthday: e(t).options.bymonthday.includes(a.value) ? e(t).options.bymonthday.filter((T) => T !== a.value) : [...e(t).options.bymonthday, a.value]
743
- })
744
- }, A(a.value), 11, je))), 128))
745
- ])) : (r(), V("div", Ke, [
746
- v(O, {
747
- items: e(j).ordinals,
748
- "model-value": (D = e(t).options.bysetpos) == null ? void 0 : D[0],
749
- "onUpdate:modelValue": i[3] || (i[3] = (a) => d({ bysetpos: a }))
750
- }, null, 8, ["items", "model-value"]),
751
- C("div", Ge, [
752
- (r(!0), V(q, null, $(e(j).weekdays, (a) => {
753
- var y;
754
- return r(), g(b, {
755
- class: K(["cursor-pointer", `${(y = e(t).options.byweekday) != null && y.includes(a.value) ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
756
- label: a.label[0],
757
- key: a.value,
758
- compact: !0,
759
- onClick: () => {
760
- d({
761
- byweekday: [a.value]
762
- });
763
- }
764
- }, null, 8, ["class", "label", "onClick"]);
765
- }), 128))
766
- ])
767
- ]))
768
- ], 64)) : N("", !0),
769
- e(t).options.freq == e(w).YEARLY ? (r(), V(q, { key: 3 }, [
770
- i[9] || (i[9] = C("div", null, "Month", -1)),
771
- C("div", Qe, [
772
- (r(!0), V(q, null, $(e(j).months, (a) => {
773
- var y, T;
774
- return r(), g(b, {
775
- key: a.value,
776
- class: K(["cursor-pointer", {
777
- "bg-fm-color-primary text-white": (y = e(t).options.bymonth) == null ? void 0 : y.includes(
778
- a.value
779
- ),
780
- "bg-fm-color-gray-200 text-fm-color-gray-800": !((T = e(t).options.bymonth) != null && T.includes(a.value))
781
- }]),
782
- label: a.shortName,
783
- compact: !0,
784
- onClick: (u) => d({
785
- bymonth: (e(t).options.bymonth ?? []).includes(a.value) ? (e(t).options.bymonth ?? []).filter((x) => x !== a.value) : [...e(t).options.bymonth ?? [], a.value]
786
- })
787
- }, null, 8, ["class", "label", "onClick"]);
788
- }), 128))
789
- ]),
790
- v(h, {
791
- "model-value": e(t).options.bymonthday.length ? { label: "Each" } : { label: "On the" },
792
- items: [
793
- {
794
- label: "Each"
795
- },
796
- {
797
- label: "On the"
798
- }
799
- ],
800
- "onUpdate:modelValue": i[4] || (i[4] = (a) => {
801
- a.label == "Each" ? d({
802
- bymonthday: [1],
803
- bymonth: e(t).options.bymonth ?? [1]
804
- }) : d({
805
- byweekday: [e(w).SU.nth(1)],
806
- bymonth: e(t).options.bymonth ?? [1]
807
- });
808
- })
809
- }, null, 8, ["model-value"]),
810
- e(t).options.bymonthday.length > 0 ? (r(), V("div", ze, [
811
- (r(!0), V(q, null, $(Array(31).fill(null).map((a, y) => y + 1), (a) => (r(), V("div", {
812
- key: a,
813
- class: K(["cursor-pointer text-center outline-1 outline-fm-color-neutral-gray-100 outline", `${e(t).options.bymonthday.includes(a) ? "bg-fm-color-primary text-fm-color-typo-white outline-transparent" : "bg-transparent text-fm-color-typo-primary"} ${a == 31 ? "border-r" : ""}`]),
814
- onClick: (y) => d({
815
- bymonthday: e(t).options.bymonthday.includes(a) ? e(t).options.bymonthday.filter((T) => T !== a) : [...e(t).options.bymonthday, a]
816
- })
817
- }, A(a), 11, Xe))), 128))
818
- ])) : (r(), V("div", Ze, [
819
- v(O, {
820
- items: e(j).ordinals,
821
- "model-value": (s = (c = e(t).options.bynweekday) == null ? void 0 : c[0]) == null ? void 0 : s[1],
822
- "onUpdate:modelValue": i[5] || (i[5] = (a) => {
823
- var y, T;
824
- return d({
825
- bynweekday: [[((T = (y = e(t).options.bynweekday) == null ? void 0 : y[0]) == null ? void 0 : T[0]) ?? 1, a]]
826
- });
827
- })
828
- }, null, 8, ["items", "model-value"]),
829
- C("div", Je, [
830
- (r(!0), V(q, null, $(e(j).weekdays, (a) => {
831
- var y, T;
832
- return r(), g(b, {
833
- class: K(["cursor-pointer", `${((T = (y = e(t).options.bynweekday) == null ? void 0 : y[0]) == null ? void 0 : T[0]) === a.value ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
834
- label: a.label[0],
835
- key: a.value,
836
- compact: !0,
837
- onClick: () => {
838
- var u, x;
839
- d({
840
- bynweekday: [
841
- [a.value, ((x = (u = e(t).options.bynweekday) == null ? void 0 : u[0]) == null ? void 0 : x[1]) ?? 1]
842
- ]
843
- });
844
- }
845
- }, null, 8, ["class", "label", "onClick"]);
846
- }), 128))
847
- ])
848
- ]))
849
- ], 64)) : N("", !0),
850
- l.applyButton ? (r(), V("div", et, [
851
- v(U, {
852
- label: "Cancel",
853
- variant: "tertiary",
854
- onClick: i[6] || (i[6] = (a) => f("cancel"))
855
- }),
856
- v(U, {
857
- label: "Apply",
858
- onClick: i[7] || (i[7] = (a) => f("update:model-value", e(t).toString()))
859
- })
860
- ])) : N("", !0)
861
- ]);
862
- };
863
- }
864
- }), tt = { class: "grid grid-cols-4 gap-8 w-full flex-wrap py-16" }, lt = /* @__PURE__ */ P({
865
- __name: "IsInMonthInput",
866
- props: {
867
- modelValue: {
868
- type: Object,
869
- required: !0
870
- }
871
- },
872
- emits: ["update:model-value"],
873
- setup(l, { emit: R }) {
874
- const _ = l, m = R, f = ae.months().map((n, t) => ({
875
- name: n,
876
- shortName: ae().month(t).format("MMM"),
877
- value: t
878
- }));
879
- return Z(() => {
880
- _.modelValue || m("update:model-value", []);
881
- }), (n, t) => {
882
- const d = k("FmChip");
883
- return r(), V("div", tt, [
884
- (r(!0), V(q, null, $(e(f), (o) => {
885
- var i, p;
886
- return r(), g(d, {
887
- class: K(["cursor-pointer", {
888
- "bg-fm-color-primary text-white": (i = l.modelValue) == null ? void 0 : i.includes(o.value),
889
- "bg-fm-color-gray-200 text-fm-color-gray-800": !((p = l.modelValue) != null && p.includes(
890
- o.value
891
- ))
892
- }]),
893
- label: o.name,
894
- key: o.value,
895
- compact: !0,
896
- onClick: (b) => m(
897
- "update:model-value",
898
- l.modelValue.includes(o.value) ? l.modelValue.filter((h) => h !== o.value) : [...l.modelValue, o.value]
899
- )
900
- }, null, 8, ["class", "label", "onClick"]);
901
- }), 128))
902
- ]);
903
- };
904
- }
905
- }), ot = { class: "" }, at = { class: "flex justify-end gap-8 w-full" }, rt = /* @__PURE__ */ P({
906
- __name: "MenuDialog",
907
- props: {
908
- modelValue: { type: Boolean },
909
- initialValue: {},
910
- filterItems: { type: Function }
911
- },
912
- emits: ["update:model-value", "confirm"],
913
- setup(l, { emit: R }) {
914
- const _ = l, m = W(), f = W(!1), n = R;
915
- function t() {
916
- var o;
917
- (o = m.value) == null || o.onConfirm(), n("update:model-value", !1);
918
- }
919
- function d() {
920
- n("update:model-value", !1);
921
- }
922
- return pe(
923
- () => _.modelValue,
924
- (o) => {
925
- f.value = o;
926
- }
927
- ), Z(() => {
928
- f.value = _.modelValue;
929
- }), (o, i) => {
930
- const p = k("FmButton"), b = k("FmDialog");
931
- return r(), g(b, {
932
- "content-scrollable": !1,
933
- contentClass: "pt-0",
934
- modelValue: f.value,
935
- "onUpdate:modelValue": i[0] || (i[0] = (h) => f.value = h),
936
- title: "Select Items",
937
- "close-button": !1
938
- }, {
939
- "dialog-header": B(() => [...i[1] || (i[1] = [
940
- C("div", null, "Select Item", -1)
941
- ])]),
942
- "dialog-footer": B(() => [
943
- C("div", at, [
944
- v(p, {
945
- variant: "tertiary",
946
- onClick: d,
947
- label: "Cancel"
948
- }),
949
- v(p, {
950
- variant: "primary",
951
- onClick: t,
952
- label: "Confirm"
953
- })
954
- ])
955
- ]),
956
- default: B(() => [
957
- C("div", ot, [
958
- v(Ye, {
959
- ref_key: "selectItemRef",
960
- ref: m,
961
- "initial-value": l.initialValue,
962
- "filter-items": l.filterItems,
963
- "on-complete": (h) => {
964
- n("confirm", h), d();
965
- }
966
- }, null, 8, ["initial-value", "filter-items", "on-complete"])
967
- ])
968
- ]),
969
- _: 1
970
- }, 8, ["modelValue"]);
971
- };
972
- }
973
- }), nt = { id: "select-menu" }, ut = /* @__PURE__ */ P({
974
- __name: "SelectMenu",
975
- props: {
976
- modelValue: {}
977
- },
978
- emits: ["update:model-value"],
979
- setup(l, { emit: R }) {
980
- const _ = l, m = W(!1), f = M(() => {
981
- var d;
982
- return ((d = _.modelValue) == null ? void 0 : d.length) || 0;
983
- }), n = R;
984
- function t(d) {
985
- n("update:model-value", d);
986
- }
987
- return (d, o) => {
988
- const i = k("FmField");
989
- return r(), V("div", nt, [
990
- v(i, {
991
- class: "text-fm-color-typo-tertiary",
992
- onClick: o[0] || (o[0] = (p) => m.value = !0)
993
- }, {
994
- default: B(() => [
995
- ne(A(f.value) + " item(s) selected ", 1)
996
- ]),
997
- _: 1
998
- }),
999
- v(rt, {
1000
- modelValue: m.value,
1001
- "onUpdate:modelValue": [
1002
- o[1] || (o[1] = (p) => m.value = p),
1003
- o[2] || (o[2] = (p) => m.value = p)
1004
- ],
1005
- "initial-value": l.modelValue,
1006
- onConfirm: t
1007
- }, null, 8, ["modelValue", "initial-value"])
1008
- ]);
1009
- };
1010
- }
1011
- }), st = {
1012
- key: 19,
1013
- class: "fm-typo-en-body-lg-600"
1014
- }, mt = /* @__PURE__ */ P({
1015
- __name: "RuleEquator",
1016
- props: {
1017
- type: {
1018
- type: String,
1019
- required: !0
1020
- },
1021
- operator: {
1022
- type: String,
1023
- required: !0
1024
- },
1025
- modelValue: {
1026
- type: Object
1027
- }
1028
- },
1029
- emits: ["update:model-value"],
1030
- setup(l, { emit: R }) {
1031
- const _ = l, m = R, f = M(() => {
1032
- const n = _e[_.operator].safeParse(_.modelValue);
1033
- return n.success ? [] : n.error.errors;
1034
- });
1035
- return (n, t) => {
1036
- var D, c, s, a, y, T;
1037
- const d = k("FmTextField"), o = k("FmStepperField"), i = k("FmSimpleDatePicker"), p = k("FmSimpleDateRangePicker"), b = k("FmTimeRangePicker"), h = k("FmTimePicker"), U = k("FmHelperText");
1038
- return r(), V("div", {
1039
- class: K({ "pb-4": e(f).length })
1040
- }, [
1041
- l.type === "text" ? (r(), g(d, {
1042
- key: 0,
1043
- "model-value": l.modelValue,
1044
- "onUpdate:modelValue": t[0] || (t[0] = (u) => m("update:model-value", u))
1045
- }, null, 8, ["model-value"])) : l.type === "number" ? (r(), g(o, {
1046
- key: 1,
1047
- "model-value": l.modelValue,
1048
- "onUpdate:modelValue": t[1] || (t[1] = (u) => m("update:model-value", u))
1049
- }, null, 8, ["model-value"])) : l.operator == "_isDay" ? (r(), g(me(Ie), {
1050
- key: 2,
1051
- "model-value": l.modelValue,
1052
- "onUpdate:modelValue": t[2] || (t[2] = (u) => m("update:model-value", u))
1053
- }, null, 8, ["model-value"])) : l.operator == "_isRange" ? (r(), g(me(Ne), {
1054
- key: 3,
1055
- "model-value": l.modelValue,
1056
- "onUpdate:modelValue": t[3] || (t[3] = (u) => m("update:model-value", u))
1057
- }, null, 8, ["model-value"])) : l.operator == "_isOnDate" ? (r(), g(i, {
1058
- key: 4,
1059
- "model-value": l.modelValue,
1060
- "onUpdate:modelValue": t[4] || (t[4] = (u) => m("update:model-value", u))
1061
- }, null, 8, ["model-value"])) : l.operator == "_isBetween" ? (r(), g(p, {
1062
- key: 5,
1063
- "model-value": {
1064
- startDate: (D = l.modelValue) == null ? void 0 : D.start,
1065
- endDate: (c = l.modelValue) == null ? void 0 : c.end
1066
- },
1067
- "onUpdate:modelValue": t[5] || (t[5] = (u) => {
1068
- m("update:model-value", {
1069
- start: u.startDate,
1070
- end: u.endDate
1071
- });
1072
- })
1073
- }, null, 8, ["model-value"])) : l.operator == "_isInMonth" ? (r(), g(lt, {
1074
- key: 6,
1075
- "model-value": l.modelValue,
1076
- "onUpdate:modelValue": t[6] || (t[6] = (u) => m("update:model-value", u))
1077
- }, null, 8, ["model-value"])) : l.operator == "_rrule" ? (r(), g(re, {
1078
- key: 7,
1079
- "model-value": l.modelValue,
1080
- "onUpdate:modelValue": t[7] || (t[7] = (u) => m("update:model-value", u))
1081
- }, null, 8, ["model-value"])) : l.operator == "_isBetweenTime" ? (r(), g(b, {
1082
- key: 8,
1083
- "disable-time-check": !0,
1084
- "model-value": [(a = (s = l.modelValue) == null ? void 0 : s[0]) == null ? void 0 : a.start, (T = (y = l.modelValue) == null ? void 0 : y[0]) == null ? void 0 : T.end],
1085
- "onUpdate:modelValue": t[8] || (t[8] = (u) => m("update:model-value", [
1086
- {
1087
- start: u[0],
1088
- end: u[1]
1089
- }
1090
- ]))
1091
- }, null, 8, ["model-value"])) : l.operator == "_isOnTime" ? (r(), g(h, {
1092
- key: 9,
1093
- "model-value": l.modelValue,
1094
- "onUpdate:modelValue": t[9] || (t[9] = (u) => m("update:model-value", u))
1095
- }, null, 8, ["model-value"])) : l.type == "tier" ? (r(), g(O, {
1096
- key: 10,
1097
- items: (e(X)().sortedTiers ?? []).map((u, x) => ({
1098
- label: `Tier ${x + 1} - ${u.name}`,
1099
- value: x + 1
1100
- })),
1101
- "model-value": l.modelValue,
1102
- "onUpdate:modelValue": t[10] || (t[10] = (u) => m("update:model-value", u))
1103
- }, null, 8, ["items", "model-value"])) : l.type == "boolean" ? (r(), g(O, {
1104
- key: 11,
1105
- multiselect: !0,
1106
- items: [
1107
- { label: "true", value: !0 },
1108
- { label: "false", value: !1 }
1109
- ],
1110
- "model-value": l.modelValue ?? [],
1111
- "onUpdate:modelValue": t[11] || (t[11] = (u) => m("update:model-value", u))
1112
- }, null, 8, ["model-value"])) : l.type == "exist" ? (r(), g(O, {
1113
- key: 12,
1114
- items: [
1115
- { label: "true", value: "true" },
1116
- { label: "false", value: "false" }
1117
- ],
1118
- "model-value": l.modelValue ?? [],
1119
- "onUpdate:modelValue": t[12] || (t[12] = (u) => m("update:model-value", u))
1120
- }, null, 8, ["model-value"])) : l.type == "gender" ? (r(), g(O, {
1121
- key: 13,
1122
- multiselect: !0,
1123
- items: [
1124
- { label: "Male", value: "MALE" },
1125
- { label: "Female", value: "FEMALE" }
1126
- ],
1127
- "model-value": l.modelValue ?? [],
1128
- "onUpdate:modelValue": t[13] || (t[13] = (u) => m("update:model-value", u))
1129
- }, null, 8, ["model-value"])) : l.type == "collectible" ? (r(), g(O, {
1130
- key: 14,
1131
- multiselect: !0,
1132
- items: [],
1133
- "model-value": l.modelValue ?? [],
1134
- "onUpdate:modelValue": t[14] || (t[14] = (u) => m("update:model-value", u))
1135
- }, null, 8, ["model-value"])) : l.type == "segment" ? (r(), g(O, {
1136
- key: 15,
1137
- multiselect: !0,
1138
- items: e(X)().segmentOptions,
1139
- "model-value": l.modelValue ?? [],
1140
- "onUpdate:modelValue": t[15] || (t[15] = (u) => m("update:model-value", u)),
1141
- label: "Select segment(s) to match"
1142
- }, null, 8, ["items", "model-value"])) : l.type == "title" ? (r(), g(O, {
1143
- key: 16,
1144
- multiselect: !0,
1145
- items: (e(X)().sortedTitles ?? []).map((u) => ({
1146
- label: u.name,
1147
- value: u._id
1148
- })),
1149
- "model-value": l.modelValue ?? [],
1150
- "onUpdate:modelValue": t[16] || (t[16] = (u) => m("update:model-value", u))
1151
- }, null, 8, ["items", "model-value"])) : l.type == "product" ? (r(), g(ut, {
1152
- key: 17,
1153
- "model-value": l.modelValue,
1154
- "onUpdate:modelValue": t[17] || (t[17] = (u) => m("update:model-value", u))
1155
- }, null, 8, ["model-value"])) : l.type == "location" ? (r(), g(O, {
1156
- key: 18,
1157
- multiselect: !0,
1158
- items: e(te)().locations.map((u) => ({
1159
- label: u.name,
1160
- value: u._id
1161
- })),
1162
- "model-value": l.modelValue ?? [],
1163
- "onUpdate:modelValue": t[18] || (t[18] = (u) => m("update:model-value", u))
1164
- }, null, 8, ["items", "model-value"])) : (r(), V("div", st, "Rule: " + A(l.type) + " Not implemented", 1)),
1165
- v(U, {
1166
- class: "items-end",
1167
- state: e(le).helperState(e(f), ""),
1168
- text: e(le).helperText(e(f), "")
1169
- }, null, 8, ["state", "text"])
1170
- ], 2);
1171
- };
1172
- }
1173
- }), it = { class: "space-y-4" }, dt = { class: "fm-typo-en-body-lg-400" }, pt = { class: "fm-typo-en-body-lg-400" }, ct = { class: "flex items-center gap-8" }, yt = { class: "fm-typo-en-body-lg-400" }, vt = { class: "flex items-center justify-end gap-8 pt-16 w-full" }, bt = /* @__PURE__ */ P({
1174
- __name: "CustomRuleDialog",
1175
- props: {
1176
- triggerType: {
1177
- type: String,
1178
- required: !0
1179
- },
1180
- includeOnly: {
1181
- type: String
1182
- },
1183
- modelValue: {
1184
- type: Object,
1185
- default: () => {
1186
- }
1187
- }
1188
- },
1189
- setup(l) {
1190
- const R = ue(), _ = X(), { emitData: m, emitAction: f } = ve(), { t: n } = G(), t = {
1191
- "user.member": "connect.template.rule.custom_modal.properties.user_member",
1192
- "user.parentReferralCode": "connect.template.rule.custom_modal.properties.user_parent_referral_code",
1193
- "user.name": "connect.template.rule.custom_modal.properties.user_name",
1194
- "user.phoneNumber": "connect.template.rule.custom_modal.properties.user_phone_number",
1195
- "user.email": "connect.template.rule.custom_modal.properties.user_email",
1196
- "user.birthday": "connect.template.rule.custom_modal.properties.user_birthday",
1197
- "user.joinAt": "connect.template.rule.custom_modal.properties.user_join_at",
1198
- "user.location": "connect.template.rule.custom_modal.properties.user_location",
1199
- "user.gender": "connect.template.rule.custom_modal.properties.user_gender",
1200
- "user.titles": "connect.template.rule.custom_modal.properties.user_titles",
1201
- "user.point": "connect.template.rule.custom_modal.properties.user_point",
1202
- "user.tier": "connect.template.rule.custom_modal.properties.user_tier",
1203
- "user.segment": "connect.template.rule.custom_modal.properties.user_segment",
1204
- "user.stats.avgBillSize": "connect.template.rule.custom_modal.properties.user_stats_avg_bill_size",
1205
- "user.stats.avgVisitFrequency": "connect.template.rule.custom_modal.properties.user_stats_avg_visit_frequency",
1206
- "user.stats.feedbackCount": "connect.template.rule.custom_modal.properties.user_stats_feedback_count",
1207
- "user.stats.lastVisit": "connect.template.rule.custom_modal.properties.user_stats_last_visit",
1208
- "user.stats.topupCount": "connect.template.rule.custom_modal.properties.user_stats_topup_count",
1209
- "user.stats.visitCount": "connect.template.rule.custom_modal.properties.user_stats_visit_count",
1210
- "user.stats.lastSeasonPointEarned": "connect.template.rule.custom_modal.properties.user_stats_last_season_point_earned",
1211
- "user.stats.lastSeasonTierEarned": "connect.template.rule.custom_modal.properties.user_stats_last_season_tier_earned",
1212
- "user.expiringVouchers.days7": "connect.template.rule.custom_modal.properties.user_expiring_vouchers_days_7",
1213
- "user.expiringVouchers.days30": "connect.template.rule.custom_modal.properties.user_expiring_vouchers_days_30",
1214
- "user.expiringVouchers.days90": "connect.template.rule.custom_modal.properties.user_expiring_vouchers_days_90"
1215
- }, d = {
1216
- _is: "connect.template.rule.custom_modal.operators.is",
1217
- _contains: "connect.template.rule.custom_modal.operators.contains",
1218
- _equal: "connect.template.rule.custom_modal.operators.equal",
1219
- _lessThan: "connect.template.rule.custom_modal.operators.less_than",
1220
- _moreThan: "connect.template.rule.custom_modal.operators.more_than",
1221
- _lessThanOrEqual: "connect.template.rule.custom_modal.operators.less_than_or_equal",
1222
- _moreThanOrEqual: "connect.template.rule.custom_modal.operators.more_than_or_equal",
1223
- _isDay: "connect.template.rule.custom_modal.operators.is_day",
1224
- _isRange: "connect.template.rule.custom_modal.operators.is_in_range",
1225
- _isOnDate: "connect.template.rule.custom_modal.operators.is_on_date",
1226
- _isBetween: "connect.template.rule.custom_modal.operators.is_between",
1227
- _isInMonth: "connect.template.rule.custom_modal.operators.is_in_month",
1228
- _rrule: "connect.template.rule.custom_modal.operators.matches_occurrence",
1229
- _isBetweenTime: "connect.template.rule.custom_modal.operators.between_time",
1230
- _isOnTime: "connect.template.rule.custom_modal.operators.is_on_time",
1231
- _isIn: "connect.template.rule.custom_modal.operators.is_in",
1232
- _hasAll: "connect.template.rule.custom_modal.operators.has_all_of",
1233
- _hasAny: "connect.template.rule.custom_modal.operators.has_any_of"
1234
- };
1235
- function o(S) {
1236
- if (!S) return "";
1237
- const F = t[S.property];
1238
- return F ? n(F) : S.name;
1239
- }
1240
- function i(S) {
1241
- const F = d[S];
1242
- return F ? n(F) : de[S].name;
1243
- }
1244
- const p = l, b = M(
1245
- () => ke(p.triggerType, p.includeOnly)
1246
- ), h = M(
1247
- () => b.value.find((S) => {
1248
- var F;
1249
- return S.property == ((F = y.value) == null ? void 0 : F.property);
1250
- })
1251
- ), U = (S) => ie[b.value.find((F) => F.property === S).type], D = M(() => {
1252
- if (!y.value) return [];
1253
- const S = b.value.find(
1254
- (F) => F.property === y.value.property
1255
- );
1256
- return S ? ie[S.type].filter((F) => {
1257
- var L, H;
1258
- return !((H = (L = de[F]) == null ? void 0 : L.exclude) != null && H.includes(y.value.property));
1259
- }).map((F) => ({
1260
- label: i(F),
1261
- value: F
1262
- })) : [];
1263
- }), c = he, s = M(() => {
1264
- const S = c.safeParse(y.value);
1265
- return S.success ? [] : S.error.errors;
1266
- }), a = W(!1), y = W(
1267
- be(p.modelValue) ?? Y.constructEntry(
1268
- b.value[0].property,
1269
- U(b.value[0].property)[0],
1270
- null
1271
- )
1272
- ), T = M(() => {
1273
- var E;
1274
- const { property: S, negated: F, conditions: L } = y.value, H = Object.keys(L || {})[0], Q = Object.values(L || {})[0];
1275
- return {
1276
- property: S,
1277
- negated: F == !0,
1278
- type: (E = b.value.find((z) => z.property === S)) == null ? void 0 : E.type,
1279
- operator: H,
1280
- equator: Q
1281
- };
1282
- });
1283
- function u(S) {
1284
- y.value = Y.constructEntry(
1285
- S,
1286
- U(S)[0],
1287
- null
1288
- );
1289
- }
1290
- function x(S) {
1291
- y.value = { ...y.value, negated: S == !0 };
1292
- }
1293
- function oe(S) {
1294
- y.value = {
1295
- ...y.value,
1296
- conditions: { [S]: null }
1297
- };
1298
- }
1299
- function J(S) {
1300
- y.value.conditions = {
1301
- [T.value.operator]: S
1302
- };
1303
- }
1304
- function ee() {
1305
- m(y.value), f("primary"), R.close();
1306
- }
1307
- return ce(async () => {
1308
- await _.readMembership();
1309
- }), (S, F) => {
1310
- const L = k("FmIcon"), H = k("FmField"), Q = k("FmPill"), E = k("FmMenuItem"), z = k("FmMenu"), se = k("FmButton");
1311
- return r(), V("div", it, [
1312
- C("div", dt, A(e(n)("connect.template.rule.custom_modal.property")), 1),
1313
- v(z, {
1314
- shift: !0,
1315
- placement: "bottom-start",
1316
- modelValue: e(a),
1317
- "onUpdate:modelValue": F[0] || (F[0] = (I) => fe(a) ? a.value = I : null),
1318
- onMenuChanged: F[1] || (F[1] = (I) => a.value = I),
1319
- "max-height": 300
1320
- }, {
1321
- "menu-button": B(() => [
1322
- v(H, null, {
1323
- append: B(() => [
1324
- v(L, {
1325
- name: e(a) ? "expand_less" : "expand_more"
1326
- }, null, 8, ["name"])
1327
- ]),
1328
- default: B(() => [
1329
- ne(A(o(e(h))) + " ", 1)
1330
- ]),
1331
- _: 1
1332
- })
1333
- ]),
1334
- default: B(() => [
1335
- (r(!0), V(q, null, $(e(b), (I) => (r(), g(E, {
1336
- key: I.property,
1337
- "model-value": e(y).property == I.property,
1338
- label: o(I),
1339
- disabled: I.premium && !e(te)().isPremium,
1340
- onClick: (Tt) => I.premium && !e(te)().isPremium ? null : u(I.property)
1341
- }, ye({ _: 2 }, [
1342
- I.premium ? {
1343
- name: "append",
1344
- fn: B(() => [
1345
- v(Q, { variant: "premium" })
1346
- ]),
1347
- key: "0"
1348
- } : void 0
1349
- ]), 1032, ["model-value", "label", "disabled", "onClick"]))), 128))
1350
- ]),
1351
- _: 1
1352
- }, 8, ["modelValue"]),
1353
- C("div", pt, A(e(n)("connect.template.rule.custom_modal.check_to_perform")), 1),
1354
- C("div", ct, [
1355
- v(O, {
1356
- class: "w-1/4",
1357
- items: [
1358
- { label: e(n)("connect.template.rule.custom_modal.is"), value: !1 },
1359
- {
1360
- label: e(n)("connect.template.rule.custom_modal.is_not"),
1361
- value: !0
1362
- }
1363
- ],
1364
- "model-value": e(y).negated ?? !1,
1365
- "onUpdate:modelValue": x
1366
- }, null, 8, ["items", "model-value"]),
1367
- v(O, {
1368
- class: "flex-1",
1369
- items: e(D),
1370
- "model-value": e(T).operator,
1371
- "onUpdate:modelValue": oe
1372
- }, null, 8, ["items", "model-value"])
1373
- ]),
1374
- C("div", null, [
1375
- C("div", yt, A(e(n)("connect.template.rule.custom_modal.criteria")), 1),
1376
- e(T).type ? (r(), g(mt, {
1377
- key: 0,
1378
- type: e(T).type,
1379
- operator: e(T).operator,
1380
- "model-value": e(T).equator,
1381
- "onUpdate:modelValue": J
1382
- }, null, 8, ["type", "operator", "model-value"])) : N("", !0)
1383
- ]),
1384
- C("div", vt, [
1385
- v(se, {
1386
- onClick: F[2] || (F[2] = (I) => e(R).close()),
1387
- label: e(n)("connect.common.cancel"),
1388
- variant: "tertiary"
1389
- }, null, 8, ["label"]),
1390
- v(se, {
1391
- onClick: F[3] || (F[3] = (I) => ee()),
1392
- disabled: e(s).length > 0,
1393
- label: e(n)("connect.common.save")
1394
- }, null, 8, ["disabled", "label"])
1395
- ])
1396
- ]);
1397
- };
1398
- }
1399
- }), ft = { class: "flex flex-col gap-8" }, gt = { class: "grid grid-cols-2 items-center" }, _t = { class: "flex items-center gap-8" }, kt = { class: "pt-16 flex items-center self-end gap-8" }, ht = /* @__PURE__ */ P({
1400
- __name: "PresetRuleDialog",
1401
- props: {
1402
- preset: {
1403
- type: String,
1404
- required: !0
1405
- },
1406
- defaultValue: {
1407
- type: Object
1408
- },
1409
- modelValue: {
1410
- type: Object
1411
- }
1412
- },
1413
- setup(l) {
1414
- const R = ue(), { emitData: _, emitAction: m } = ve(), f = X(), { t: n } = G(), t = l;
1415
- function d() {
1416
- const { operator: c, equator: s } = p.value;
1417
- switch (t.preset) {
1418
- case "MIN_SPEND":
1419
- case "SPECIFIC_DATE":
1420
- case "SPECIFIC_TIMERANGE":
1421
- case "WEEKLY":
1422
- case "MONTHLY":
1423
- case "BIRTHDAY":
1424
- case "TIER": {
1425
- const a = f.sortedTiers.filter((y, T) => c == "_equal" ? T + 1 == s : c == "_moreThanOrEqual" ? T + 1 >= s : T + 1 <= s);
1426
- return n("connect.template.rule.preset_modal.applies_to", {
1427
- tiers: a.map((y) => y.name).join(", ")
1428
- });
1429
- }
1430
- }
1431
- }
1432
- function o() {
1433
- var c, s;
1434
- switch (t.preset) {
1435
- case "MIN_SPEND":
1436
- return Y.constructEntry("bill.amount", "_moreThanOrEqual", 0);
1437
- case "SPECIFIC_DATE":
1438
- return Y.constructEntry(
1439
- "trigger.date",
1440
- "_isOnDate",
1441
- (/* @__PURE__ */ new Date()).toISOString()
1442
- );
1443
- case "SPECIFIC_TIMERANGE":
1444
- return Y.constructEntry("trigger.time", "_isBetweenTime", [
1445
- { start: "00:00", end: "23:59" }
1446
- ]);
1447
- case "WEEKLY":
1448
- return Y.constructEntry(
1449
- "trigger.date",
1450
- "_rrule",
1451
- "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1452
- );
1453
- case "MONTHLY":
1454
- return Y.constructEntry(
1455
- "trigger.date",
1456
- "_rrule",
1457
- "RRULE:FREQ=MONTHLY;WKST=SU;BYMONTHDAY=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1458
- );
1459
- case "BIRTHDAY":
1460
- console.log("birthday", t);
1461
- const a = Y.constructEntry(
1462
- t.defaultValue.property,
1463
- t.defaultValue.operator,
1464
- t.defaultValue.equator
1465
- );
1466
- return console.log(a), a;
1467
- case "TIER":
1468
- return Y.constructEntry("user.tier", "_equal", 1);
1469
- case "TITLE":
1470
- return Y.constructEntry("user.titles", "_hasAny", [
1471
- (s = (c = f.sortedTitles) == null ? void 0 : c[0]) == null ? void 0 : s._id
1472
- ]);
1473
- case "LAST_X_DAY":
1474
- return Y.constructEntry("user.stats.lastVisit", "_isRange", {
1475
- op: "last",
1476
- unit: "day",
1477
- ignoreYear: !0,
1478
- x: 0
1479
- });
1480
- case "CUSTOM":
1481
- throw new Error("Not implemented");
1482
- }
1483
- }
1484
- const i = W(o()), p = M(() => {
1485
- const c = Y.simplify(i.value);
1486
- return {
1487
- ...c,
1488
- equator: c.equator
1489
- };
1490
- });
1491
- function b(c, s) {
1492
- const a = p.value;
1493
- i.value = Y.constructEntry(
1494
- a.property,
1495
- s ?? a.operator,
1496
- c,
1497
- i.value.name
1498
- );
1499
- }
1500
- function h() {
1501
- _(i.value), m("primary"), R.close();
1502
- }
1503
- const U = M(() => {
1504
- const c = Ee.safeParse(i.value);
1505
- return c.success ? [] : c.error.errors;
1506
- });
1507
- ce(async () => {
1508
- await f.readMembership();
1509
- });
1510
- const D = M(() => [
1511
- {
1512
- label: n("connect.template.rule.preset_modal.unit.day"),
1513
- value: "day"
1514
- },
1515
- {
1516
- label: n("connect.template.rule.preset_modal.unit.week"),
1517
- value: "week"
1518
- },
1519
- {
1520
- label: n("connect.template.rule.preset_modal.unit.month"),
1521
- value: "month"
1522
- }
1523
- ]);
1524
- return (c, s) => {
1525
- var S, F, L, H, Q;
1526
- const a = k("FmStepperField"), y = k("FmDatePicker"), T = k("FmTimeRangePicker"), u = k("FmRadio"), x = k("FmSelect"), oe = k("FmRadioGroup"), J = k("FmHelperText"), ee = k("FmButton");
1527
- return r(), V("div", ft, [
1528
- l.preset == "MIN_SPEND" ? (r(), g(a, {
1529
- key: 0,
1530
- label: e(n)("connect.template.rule.preset.minimum_spend"),
1531
- "model-value": e(p).equator,
1532
- "onUpdate:modelValue": s[0] || (s[0] = (E) => b(E))
1533
- }, null, 8, ["label", "model-value"])) : N("", !0),
1534
- l.preset == "LAST_X_DAY" ? (r(), g(a, {
1535
- key: 1,
1536
- label: "",
1537
- min: 0,
1538
- prepent: e(n)("connect.template.rule.preset_modal.day"),
1539
- "model-value": e(p).equator.x,
1540
- rules: [
1541
- (E) => E >= 0 || e(n)(
1542
- "connect.template.rule.preset_modal.value_must_be_greater_than_0"
1543
- )
1544
- ],
1545
- "onUpdate:modelValue": s[1] || (s[1] = (E) => b({
1546
- op: "last",
1547
- unit: "day",
1548
- ignoreYear: !0,
1549
- x: E
1550
- }))
1551
- }, null, 8, ["prepent", "model-value", "rules"])) : l.preset == "SPECIFIC_DATE" ? (r(), g(y, {
1552
- key: 2,
1553
- label: e(n)("connect.template.rule.preset.specific_date"),
1554
- "model-value": e(p).equator,
1555
- "onUpdate:modelValue": s[2] || (s[2] = (E) => b(E))
1556
- }, null, 8, ["label", "model-value"])) : l.preset == "SPECIFIC_TIMERANGE" ? (r(), g(T, {
1557
- key: 3,
1558
- label: e(n)("connect.template.rule.preset_modal.time_is_between"),
1559
- "disable-time-check": !0,
1560
- "model-value": [(F = (S = e(p).equator) == null ? void 0 : S[0]) == null ? void 0 : F.start, (H = (L = e(p).equator) == null ? void 0 : L[0]) == null ? void 0 : H.end],
1561
- "onUpdate:modelValue": s[3] || (s[3] = (E) => b([
1562
- {
1563
- start: E[0],
1564
- end: E[1]
1565
- }
1566
- ]))
1567
- }, null, 8, ["label", "model-value"])) : l.preset == "WEEKLY" ? (r(), g(re, {
1568
- key: 4,
1569
- label: e(n)("connect.template.rule.preset.weekly"),
1570
- "fixed-frequency": !0,
1571
- "model-value": e(p).equator,
1572
- "onUpdate:modelValue": s[4] || (s[4] = (E) => b(E))
1573
- }, null, 8, ["label", "model-value"])) : l.preset == "MONTHLY" ? (r(), g(re, {
1574
- key: 5,
1575
- label: e(n)("connect.template.rule.preset.monthly"),
1576
- "fixed-frequency": !0,
1577
- "model-value": e(p).equator,
1578
- "onUpdate:modelValue": s[5] || (s[5] = (E) => b(E))
1579
- }, null, 8, ["label", "model-value"])) : l.preset == "BIRTHDAY" ? (r(), V(q, { key: 6 }, [
1580
- C("div", gt, [
1581
- v(u, {
1582
- label: e(n)("connect.template.rule.birthday.days_before"),
1583
- value: "_isDay",
1584
- "model-value": e(p).operator,
1585
- "onUpdate:modelValue": s[6] || (s[6] = () => {
1586
- b(
1587
- {
1588
- op: "after",
1589
- x: 1,
1590
- ignoreYear: !0
1591
- },
1592
- "_isDay"
1593
- );
1594
- })
1595
- }, null, 8, ["label", "model-value"]),
1596
- C("div", _t, [
1597
- v(u, {
1598
- label: e(n)("connect.template.rule.preset_modal.is_in_this"),
1599
- value: "_isRange",
1600
- "model-value": e(p).operator,
1601
- "onUpdate:modelValue": s[7] || (s[7] = () => {
1602
- b(
1603
- {
1604
- op: "this",
1605
- unit: "day",
1606
- ignoreYear: !0
1607
- },
1608
- "_isRange"
1609
- );
1610
- })
1611
- }, null, 8, ["label", "model-value"]),
1612
- e(p).operator == "_isRange" ? (r(), g(x, {
1613
- key: 0,
1614
- items: e(D),
1615
- "model-value": e(p).equator.unit,
1616
- "onUpdate:modelValue": s[8] || (s[8] = (E) => b(
1617
- {
1618
- op: "this",
1619
- unit: E,
1620
- ignoreYear: !0
1621
- },
1622
- "_isRange"
1623
- ))
1624
- }, null, 8, ["items", "model-value"])) : N("", !0)
1625
- ])
1626
- ]),
1627
- e(p).operator == "_isDay" ? (r(), g(a, {
1628
- key: 0,
1629
- label: e(n)("connect.template.rule.birthday.days_before_label"),
1630
- "show-steppers": !1,
1631
- "model-value": e(p).equator.x,
1632
- "onUpdate:modelValue": s[9] || (s[9] = (E) => b({
1633
- op: "after",
1634
- x: E,
1635
- ignoreYear: !0
1636
- }))
1637
- }, null, 8, ["label", "model-value"])) : N("", !0)
1638
- ], 64)) : l.preset == "TIER" ? (r(), V(q, { key: 7 }, [
1639
- v(oe, {
1640
- inline: !0,
1641
- "model-value": e(p).operator,
1642
- "onUpdate:modelValue": s[10] || (s[10] = (E) => b(e(p).equator, E))
1643
- }, {
1644
- default: B(() => [
1645
- v(u, {
1646
- value: "_moreThanOrEqual",
1647
- label: e(n)("connect.template.rule.preset_modal.at_least")
1648
- }, null, 8, ["label"]),
1649
- v(u, {
1650
- value: "_equal",
1651
- label: e(n)("connect.template.rule.preset_modal.equal")
1652
- }, null, 8, ["label"]),
1653
- v(u, {
1654
- value: "_lessThanOrEqual",
1655
- label: e(n)("connect.template.rule.preset_modal.at_most")
1656
- }, null, 8, ["label"])
1657
- ]),
1658
- _: 1
1659
- }, 8, ["model-value"]),
1660
- v(O, {
1661
- items: (e(f).sortedTiers ?? []).map((E, z) => ({
1662
- label: `Tier ${z + 1} - ${E.name}`,
1663
- value: z + 1
1664
- })),
1665
- "model-value": e(p).equator,
1666
- "onUpdate:modelValue": s[11] || (s[11] = (E) => b(E))
1667
- }, null, 8, ["items", "model-value"]),
1668
- v(J, {
1669
- text: d()
1670
- }, null, 8, ["text"])
1671
- ], 64)) : l.preset == "TITLE" ? (r(), g(O, {
1672
- key: 8,
1673
- label: e(n)("connect.template.rule.preset_modal.user_has_title"),
1674
- items: (e(f).sortedTitles ?? []).map((E) => ({
1675
- label: E.name,
1676
- value: E._id
1677
- })),
1678
- "model-value": (Q = e(p).equator) == null ? void 0 : Q[0],
1679
- "onUpdate:modelValue": s[12] || (s[12] = (E) => b([E]))
1680
- }, null, 8, ["label", "items", "model-value"])) : N("", !0),
1681
- v(J, {
1682
- class: "mt-[-8px]",
1683
- text: e(le).helperText(e(U), ""),
1684
- state: e(le).helperState(e(U), "")
1685
- }, null, 8, ["text", "state"]),
1686
- C("div", kt, [
1687
- v(ee, {
1688
- onClick: s[13] || (s[13] = (E) => e(R).close()),
1689
- label: e(n)("connect.common.cancel"),
1690
- variant: "tertiary"
1691
- }, null, 8, ["label"]),
1692
- v(ee, {
1693
- onClick: s[14] || (s[14] = (E) => h()),
1694
- disabled: e(U).length > 0,
1695
- label: e(n)("connect.common.save")
1696
- }, null, 8, ["disabled", "label"])
1697
- ])
1698
- ]);
1699
- };
1700
- }
1701
- }), Et = /* @__PURE__ */ P({
1702
- __name: "RuleConfigurator",
1703
- props: {
1704
- triggerType: {
1705
- type: String,
1706
- required: !0
1707
- },
1708
- includeOnly: {
1709
- type: String
1710
- },
1711
- modelValue: {
1712
- type: Object,
1713
- default: () => {
1714
- }
1715
- }
1716
- },
1717
- emits: ["update:model-value"],
1718
- setup(l, { expose: R, emit: _ }) {
1719
- const m = te(), { t: f, te: n } = G(), t = {
1720
- "Minimum spend": "connect.template.rule.preset.minimum_spend",
1721
- "Specific date": "connect.template.rule.preset.specific_date",
1722
- "Specific time range": "connect.template.rule.preset.specific_time_range",
1723
- Weekly: "connect.template.rule.preset.weekly",
1724
- Monthly: "connect.template.rule.preset.monthly",
1725
- Birthday: "connect.template.rule.preset.birthday",
1726
- "Birthday Week": "connect.template.rule.preset.birthday_week",
1727
- "Birthday Month": "connect.template.rule.preset.birthday_month",
1728
- "N day before birthday": "connect.template.rule.preset.n_day_before_birthday",
1729
- "Specific tier": "connect.template.rule.preset.specific_tier",
1730
- "Specific title": "connect.template.rule.preset.specific_title",
1731
- "Last visit in X days": "connect.template.rule.preset.last_visit_in_x_days",
1732
- "Weekday special": "connect.template.rule.preset.weekday_special",
1733
- "Weekend special": "connect.template.rule.preset.weekend_special",
1734
- "Happy hour": "connect.template.rule.preset.happy_hour",
1735
- "Mother's day special": "connect.template.rule.preset.mothers_day_special",
1736
- "Father's day special": "connect.template.rule.preset.fathers_day_special",
1737
- Christmas: "connect.template.rule.preset.christmas",
1738
- "Feedback rating": "connect.template.rule.preset.feedback_rating",
1739
- Custom: "connect.template.rule.preset.custom"
1740
- }, d = l, o = _, i = ue(), p = W();
1741
- function b(c) {
1742
- const [s] = c.rules;
1743
- i.open({
1744
- title: D(c),
1745
- closeButton: !1,
1746
- dismissAway: !1,
1747
- contentComponent: ht,
1748
- contentComponentProps: {
1749
- preset: c.type,
1750
- defaultValue: s,
1751
- modelValue: d.modelValue
1752
- }
1753
- }).onPrimary((a) => o("update:model-value", a));
1754
- }
1755
- function h(c) {
1756
- i.open({
1757
- title: f("connect.template.rule.edit_rule"),
1758
- closeButton: !1,
1759
- dismissAway: !1,
1760
- contentComponent: bt,
1761
- contentComponentProps: {
1762
- triggerType: d.triggerType,
1763
- includeOnly: d.includeOnly,
1764
- modelValue: c
1765
- }
1766
- }).onPrimary((s) => o("update:model-value", s));
1767
- }
1768
- function U(c) {
1769
- if (c.type == "CUSTOM") {
1770
- const [s] = c.rules;
1771
- return h(
1772
- Y.constructEntry(s.property, s.operator, s.equator)
1773
- );
1774
- }
1775
- return b(c);
1776
- }
1777
- function D(c) {
1778
- const s = t[c.name];
1779
- return s && n(s) ? f(s) : c.name;
1780
- }
1781
- return R({
1782
- showCustomDialog: h
1783
- }), (c, s) => {
1784
- const a = k("FmButton"), y = k("FmPill"), T = k("FmMenuItem"), u = k("FmMenu");
1785
- return r(), g(u, {
1786
- shift: !0,
1787
- placement: "top-start"
1788
- }, {
1789
- "menu-button": B(() => [
1790
- v(a, {
1791
- label: e(f)("connect.template.rule.add_condition"),
1792
- icon: "add",
1793
- class: "text-fm-color-primary border-fm-color-primary",
1794
- "icon-color": "primary",
1795
- variant: "secondary"
1796
- }, null, 8, ["label"])
1797
- ]),
1798
- default: B(() => [
1799
- (r(!0), V(q, null, $(e(Be).filter(
1800
- (x) => !l.includeOnly || x.for.includes(l.includeOnly)
1801
- ), (x) => (r(), g(T, {
1802
- key: x.name,
1803
- "model-value": x.name == e(p),
1804
- label: D(x),
1805
- onClick: () => {
1806
- x != null && x.premium && !e(m).isPremium || U(x);
1807
- },
1808
- disabled: (x == null ? void 0 : x.premium) && !e(m).isPremium
1809
- }, ye({ _: 2 }, [
1810
- x != null && x.premium ? {
1811
- name: "append",
1812
- fn: B(() => [
1813
- v(y, { variant: "premium" })
1814
- ]),
1815
- key: "0"
1816
- } : void 0
1817
- ]), 1032, ["model-value", "label", "onClick", "disabled"]))), 128))
1818
- ]),
1819
- _: 1
1820
- });
1821
- };
1822
- }
1823
- }), Vt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Ht = /* @__PURE__ */ P({
1824
- __name: "RuleGroup",
1825
- props: {
1826
- triggerType: {
1827
- type: String,
1828
- required: !0
1829
- },
1830
- includeOnly: {
1831
- type: String
1832
- },
1833
- modelValue: {
1834
- type: Object
1835
- }
1836
- },
1837
- emits: ["update:model-value"],
1838
- setup(l, { emit: R }) {
1839
- const _ = l, m = R, f = Te(), { t: n } = G(), t = M(
1840
- () => _.modelValue ?? Y.scaffoldGroup()
1841
- ), d = M(() => Y.getLogic(t.value)), o = M(() => [
1842
- { label: n("connect.template.rule.and"), value: "&&" },
1843
- { label: n("connect.template.rule.or"), value: "||" }
1844
- ]), i = W();
1845
- function p(b, h) {
1846
- try {
1847
- const U = Y.setRuleToGroup(b, h);
1848
- Y.isRuleExceed(b, h), m("update:model-value", U);
1849
- } catch (U) {
1850
- f.open({
1851
- message: U.message,
1852
- type: "error"
1853
- });
1854
- }
1855
- }
1856
- return (b, h) => {
1857
- const U = k("FmButtonGroup"), D = k("FmCard");
1858
- return r(), g(D, { variant: "outlined" }, {
1859
- default: B(() => [
1860
- v(D, { class: "border-l-4 border-fm-color-primary p-16 space-y-16" }, {
1861
- default: B(() => [
1862
- C("div", Vt, A(e(n)("connect.template.rule.when")), 1),
1863
- v(Et, {
1864
- ref_key: "configuratorRef",
1865
- ref: i,
1866
- "include-only": l.includeOnly,
1867
- "trigger-type": l.triggerType,
1868
- "onUpdate:modelValue": h[0] || (h[0] = (c) => p(e(t), c))
1869
- }, null, 8, ["include-only", "trigger-type"]),
1870
- (r(!0), V(q, null, $(e(t).rules, (c, s) => {
1871
- var a;
1872
- return r(), V(q, null, [
1873
- e(Ve)(c) ? (r(), g(qe, {
1874
- "model-value": c,
1875
- key: s,
1876
- onEdit: (a = e(i)) == null ? void 0 : a.showCustomDialog,
1877
- onRemove: h[1] || (h[1] = (y) => {
1878
- m(
1879
- "update:model-value",
1880
- e(Y).removeEntry(e(t), y.name)
1881
- );
1882
- })
1883
- }, null, 8, ["model-value", "onEdit"])) : N("", !0),
1884
- v(U, {
1885
- class: "w-[200px]",
1886
- disabled: Object.keys(e(t).rules).length < 2,
1887
- items: e(o),
1888
- "model-value": e(o).find((y) => y.value === e(d)) ?? null,
1889
- "onUpdate:modelValue": h[2] || (h[2] = (y) => m(
1890
- "update:model-value",
1891
- e(Y).setRuleToGroup(
1892
- e(t),
1893
- [],
1894
- y.value
1895
- )
1896
- ))
1897
- }, null, 8, ["disabled", "items", "model-value"])
1898
- ], 64);
1899
- }), 256))
1900
- ]),
1901
- _: 1
1902
- })
1903
- ]),
1904
- _: 1
1905
- });
1906
- };
1907
- }
1908
- });
1909
- export {
1910
- Ht as _,
1911
- re as a
1912
- };