@feedmepos/mf-connect 0.1.98-beta.39 → 0.1.98-beta.40

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