@feedmepos/mf-connect 0.1.98-beta.8 → 0.1.98-prod

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 (116) hide show
  1. package/dist/Analytic-BHDjuMfN.js +426 -0
  2. package/dist/{App-DsB2o1oB.js → App-BSSze_b9.js} +106 -118
  3. package/dist/{Bin-DMr7K8Kj.js → Bin-DfzoQbE0.js} +8 -8
  4. package/dist/{Broadcast-C9akM-TB.js → Broadcast-DsqO4SXX.js} +17 -18
  5. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CwGoEBsW.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DQ0x2VJp.js} +6 -5
  6. package/dist/{Card-DRkIYs0M.js → Card-VxbqomXV.js} +19 -19
  7. package/dist/{Collections-B0uGC2FE.js → Collections-CvD98I3M.js} +185 -197
  8. package/dist/{Credit-V5YA_hGx.js → Credit-BhM2m2L2.js} +53 -54
  9. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DvfrrjHc.js +2223 -0
  10. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-DJLxGk7W.js → EffectSheet.vue_vue_type_style_index_0_lang-CPx9U9fU.js} +6 -6
  11. package/dist/{Experience-WTWy5yY6.js → Experience-uWQRb-qf.js} +34 -35
  12. package/dist/{FileSaver.min-BlA0oZEC.js → FileSaver.min-DKNoHTvP.js} +1 -1
  13. package/dist/{Game-BwOfTCW5.js → Game-BgT3oNx7.js} +15 -16
  14. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-DNtLW0yQ.js → ImageInput.vue_vue_type_script_setup_true_lang-ClqrJbU6.js} +1 -1
  15. package/dist/{Index-m7l4insz.js → Index-D3RgVj9V.js} +10 -10
  16. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-Dsg2sWjF.js → LottieAnimation.vue_vue_type_script_setup_true_lang-CkCpumzB.js} +1 -1
  17. package/dist/{MainLayout-Du5kZOtA.js → MainLayout-B2RiPsIR.js} +1 -1
  18. package/dist/{Marketing-C9pSIdBU.js → Marketing-FrE7k7eW.js} +4 -4
  19. package/dist/{MarketingMaterialEdit-BEF2T9LR.js → MarketingMaterialEdit-DGNjEUu-.js} +211 -214
  20. package/dist/{Member-DUV_vbPI.js → Member-CgTagUQ9.js} +20 -20
  21. package/dist/{MemberList-Ye4nOk-i.js → MemberList-CKbzsDMX.js} +51 -50
  22. package/dist/{MemberTransactions-CAut1TQb.js → MemberTransactions-CnY5cFdv.js} +1 -1
  23. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-1AuHixPC.js → MessageInput.vue_vue_type_script_setup_true_lang-DqivG_O4.js} +11 -11
  24. package/dist/{Mission-BBmCGpt8.js → Mission-BGNqy7wQ.js} +34 -35
  25. package/dist/{Overview-DOJj4XvO.js → Overview-CnpF74wa.js} +19 -19
  26. package/dist/{Point-Bzg6hi6o.js → Point-BHgIy7Bz.js} +29 -30
  27. package/dist/{Promotion-BMXIp_ef.js → Promotion-CNQvO5Lq.js} +105 -111
  28. package/dist/{Queue-55G2gtP5.js → Queue-CoPBE0UP.js} +43 -43
  29. package/dist/{Record-DNPI02c6.js → Record-BuDQ15FJ.js} +10 -10
  30. package/dist/{Reward-CnP8R2pS.js → Reward-BQlCO3Dk.js} +17 -17
  31. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-BN71h9IK.js → RewardGroup.vue_vue_type_script_setup_true_lang-nhNr_T7D.js} +12 -12
  32. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-lnxwLa8o.js +1888 -0
  33. package/dist/{Segment-CxiQnnyj.js → Segment-DKFAXGzY.js} +78 -77
  34. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-C4vohf6c.js → SelectItems.vue_vue_type_script_setup_true_lang-CUR7djaM.js} +3 -3
  35. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-B1vj5f7T.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-CZ3s2W8Q.js} +12 -12
  36. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-cWx0G3nM.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-BbilZk82.js} +4 -4
  37. package/dist/{Setting-jHAjccod.js → Setting-hrDZ1cQR.js} +248 -259
  38. package/dist/{SettingAdvertisements-Vt7w1WN3.js → SettingAdvertisements-CQsx4JqQ.js} +13 -13
  39. package/dist/{Store-Cu-hKmVa.js → Store-Cgmsklnt.js} +24 -24
  40. package/dist/{StoreRewards-DILeipMG.js → StoreRewards-CrPO4DKG.js} +16 -16
  41. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-yesp6BoT.js +1118 -0
  42. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-BnKybdKJ.js +142 -0
  43. package/dist/{Tier-BAZ1xuKL.js → Tier-DgKMMyKr.js} +469 -544
  44. package/dist/{Title-CcNAt47f.js → Title-BKijiEFV.js} +92 -93
  45. package/dist/{Transaction-D7DO3dKQ.js → Transaction-zHL4q_wj.js} +2 -2
  46. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-hUjQVZ_U.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-DjafpVOa.js} +6 -6
  47. package/dist/{Voucher-Cq-n1CaC.js → Voucher-DW4-SD1w.js} +27 -28
  48. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-CTQDxc5l.js → VoucherEditor.vue_vue_type_script_setup_true_lang-y2wm2Bcu.js} +12 -12
  49. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DuRKA4cj.js → ZodTextField.vue_vue_type_script_setup_true_lang-BWZUE554.js} +2 -2
  50. package/dist/{app-Z-UKRG5V.js → app-B23RANXL.js} +3083 -3663
  51. package/dist/app.js +3 -4
  52. package/dist/{business-C7EF6cKC.js → business-BFU-2tpT.js} +1 -1
  53. package/dist/{campaign-DHBuP4UA.js → campaign-BEKKOWya.js} +64 -114
  54. package/dist/{campaign--MjoY1Mn.js → campaign-CwlWx58O.js} +7 -13
  55. package/dist/{campaign.enum-BNN2gLFY.js → campaign.enum-5KIiekYl.js} +2 -3
  56. package/dist/{campaign.fn-Bd34dVnx.js → campaign.fn-CyWn_KL-.js} +130 -130
  57. package/dist/{collectible.enum-DO9HdJGH.js → collectible.enum-DmmR-4Nj.js} +1 -1
  58. package/dist/collection.fn-BB1OjBHL.js +26 -0
  59. package/dist/dto-p31OYANk.js +216 -0
  60. package/dist/{effect-BcB8IlTI.js → effect-DNDXE2iM.js} +1 -1
  61. package/dist/{email-addresses-BcTeU4Sh.js → email-addresses-DXSkxrZ6.js} +2 -2
  62. package/dist/{export-CjB7qxZ9.js → export-zMj-UAnF.js} +3 -3
  63. package/dist/{helper-BSgrCJRv.js → helper-D32ml7Qv.js} +1 -1
  64. package/dist/{index-HXiYGO4_.js → index-9jgqbdnt.js} +7 -7
  65. package/dist/{index-hlyg-wxV.js → index-B2OiTtF5.js} +1 -1
  66. package/dist/{index-CoHWpylO.js → index-B9-jeiQR.js} +1281 -1518
  67. package/dist/{index-iMPtFp54.js → index-BWHk6oqv.js} +3 -3
  68. package/dist/{index-hbyCVNa7.js → index-BmmFSQPd.js} +3 -3
  69. package/dist/{index-CsoBDon4.js → index-CA09A75h.js} +1968 -1996
  70. package/dist/index-Cc15IFUt.js +55 -0
  71. package/dist/{index-BpI-BI4H.js → index-CcnOzrwY.js} +1 -1
  72. package/dist/{index-VlFWaBrg.js → index-DSGHkaP0.js} +1 -1
  73. package/dist/{index-BoYEqLif.js → index-DvHLsdIR.js} +205 -817
  74. package/dist/{index-Bf6jNZit.js → index-PrTZHXNT.js} +1 -1
  75. package/dist/{index-BIAjmMga.js → index-txVWLdtz.js} +1 -1
  76. package/dist/{index.esm2017-CM7OnEyP.js → index.esm2017-BJG8dqci.js} +209 -209
  77. package/dist/{loading-CSXr0Yqz.js → loading-DuZVM_Ow.js} +1 -1
  78. package/dist/{lodash-Bh7XKI-R.js → lodash-DqQem5rZ.js} +1 -1
  79. package/dist/{membership-CfredTm3.js → membership-CvoEzwor.js} +3 -3
  80. package/dist/{money-BZIST_m9.js → money-B9PJ_JYh.js} +1 -1
  81. package/dist/{number-DXLR2w95.js → number-GIC15kny.js} +1 -1
  82. package/dist/object-qECH92oz.js +26 -0
  83. package/dist/objectid-CtJ4pTf2.js +145 -0
  84. package/dist/{plugins-4FlbwoES.js → plugins-XAhAFHmZ.js} +95 -94
  85. package/dist/{reward-DUbl79bZ.js → reward-Dy0Z6PLL.js} +1 -1
  86. package/dist/{rule-BQUoZ4l_.js → rule-CUu9I1Ly.js} +487 -505
  87. package/dist/rule-builder-DPmaehAO.js +102 -0
  88. package/dist/style.css +1 -1
  89. package/dist/template-BHtdbnoX.js +236 -0
  90. package/dist/{index-CIBPhxlC.js → timezone-BE1YhvLN.js} +20 -21
  91. package/dist/{trigger-D5g5m6tT.js → trigger-BcHfjuiZ.js} +5 -5
  92. package/dist/{useMarketingMaterialActions-B-Jlw2Z9.js → useMarketingMaterialActions-YQq4LWOp.js} +3 -3
  93. package/dist/{usePagination-DHePBBoR.js → usePagination-B1KK2gTx.js} +1 -1
  94. package/dist/{user-C_ToSo-g.js → user-BTRRi1B3.js} +1 -1
  95. package/dist/{vue-i18n-BcYh6_51.js → vue-i18n-D8NX5Rry.js} +298 -298
  96. package/dist/{xlsx-h4G1C-xj.js → xlsx-C9LzK7Kg.js} +1 -1
  97. package/dist/{zod-CgigfJar.js → zod-D3ciRzE4.js} +1 -1
  98. package/package.json +4 -8
  99. package/dist/AuditLogs-BcfgiYnJ.js +0 -2013
  100. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +0 -58
  101. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-CYQMXARx.js +0 -3377
  102. package/dist/Grab-DmmwrGzk.js +0 -300
  103. package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-B9sJ-M20.js +0 -48
  104. package/dist/LoyaltyDashboard-CJdhYiea.js +0 -1082
  105. package/dist/Review-CYNPPxYU.js +0 -1141
  106. package/dist/ReviewFacebookCallback-0SUkKAaC.js +0 -243
  107. package/dist/ReviewGoogleCallback-BZEzx68n.js +0 -208
  108. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CtB9Ls5-.js +0 -1911
  109. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CGz6CTWA.js +0 -1130
  110. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-C7lVeybl.js +0 -7007
  111. package/dist/duplicateCampaign-2ODeDw3a.js +0 -51
  112. package/dist/index-Bm0QPucw.js +0 -67
  113. package/dist/index-Bv4MBLQ5.js +0 -52
  114. package/dist/object-BYyQ0PZp.js +0 -18
  115. package/dist/objectid-Dg4ZodlT.js +0 -145
  116. package/dist/template-BoiSG7G7.js +0 -188
@@ -0,0 +1,1888 @@
1
+ import { defineComponent as P, computed as M, resolveComponent as _, openBlock as n, createElementBlock as V, createElementVNode as U, createVNode as c, unref as e, createTextVNode as ne, toDisplayString as A, withCtx as B, onMounted as Z, createBlock as f, createCommentVNode as N, ref as W, Fragment as q, renderList as $, normalizeClass as K, watch as be, resolveDynamicComponent as me, onBeforeMount as pe, isRef as fe, createSlots as ce } from "vue";
2
+ import { m as ge, C as _e, n as ke, a as he, o as Ee } from "./index-CA09A75h.js";
3
+ import { R as O, a as Ve } from "./rule-builder-DPmaehAO.js";
4
+ import { useDialog as ue, useDialogChild as ye, useSnackbar as Te } from "@feedmepos/ui-library";
5
+ import { u as G } from "./vue-i18n-D8NX5Rry.js";
6
+ import { a as Se, R as F, S as Fe, C as j, W as xe, T as ie, O as de } from "./rule-CUu9I1Ly.js";
7
+ import { p as Re } from "./plugins-XAhAFHmZ.js";
8
+ import { h as ae } from "./moment-D7p2TMB-.js";
9
+ import { z as Ue } from "./app-B23RANXL.js";
10
+ import { u as X } from "./membership-CvoEzwor.js";
11
+ import { u as te } from "./business-BFU-2tpT.js";
12
+ import "./index-BmmFSQPd.js";
13
+ import { _ as w } from "./CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js";
14
+ import { c as ve } from "./object-qECH92oz.js";
15
+ import { Z as le } from "./zod-D3ciRzE4.js";
16
+ import { _ as Ce } from "./SelectItems.vue_vue_type_script_setup_true_lang-CUR7djaM.js";
17
+ import "./index-B9-jeiQR.js";
18
+ import "./index-DvHLsdIR.js";
19
+ import "./index-BWHk6oqv.js";
20
+ const Ye = { class: "flex items-center justify-between" }, Oe = { class: "flex items-center gap-8 xs:flex-wrap" }, we = { class: "text-fm-color-primary line-clamp-1 text-ellipsis" }, De = /* @__PURE__ */ P({
21
+ __name: "RuleEntry",
22
+ props: {
23
+ modelValue: {
24
+ type: Object,
25
+ required: !0
26
+ }
27
+ },
28
+ emits: ["edit", "remove"],
29
+ setup(o, { emit: x }) {
30
+ const g = o, u = M(() => {
31
+ const [s, r] = Object.entries(g.modelValue.conditions)[0];
32
+ return {
33
+ negated: g.modelValue.negated == !0,
34
+ property: g.modelValue.property,
35
+ operator: s,
36
+ equator: r
37
+ };
38
+ }), v = x, t = M(
39
+ () => Se(
40
+ u.value.property,
41
+ u.value.operator,
42
+ u.value.equator,
43
+ u.value.negated
44
+ )
45
+ );
46
+ async function a(s) {
47
+ s.stopPropagation(), await Re.remove("Are you sure you want to remove this rule?") && v("remove", g.modelValue);
48
+ }
49
+ return (s, r) => {
50
+ var k;
51
+ const E = _("FmChip"), i = _("FmTooltip"), b = _("FmIcon");
52
+ return n(), V("div", Ye, [
53
+ U("div", Oe, [
54
+ c(E, {
55
+ label: (k = e(ge).find((R) => R.property === g.modelValue.property)) == null ? void 0 : k.name,
56
+ class: "!text-fm-color-typo-info !bg-fm-color-system-info-100"
57
+ }, null, 8, ["label"]),
58
+ r[1] || (r[1] = U("div", { class: "h-[26px] border-l-2 rounded-md border-fm-color-neutral-gray-100" }, null, -1)),
59
+ U("div", {
60
+ onClick: r[0] || (r[0] = (R) => v("edit", g.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(t)[0]) + " ", 1),
64
+ c(i, {
65
+ "z-index": 1e3,
66
+ content: e(t)[1]
67
+ }, {
68
+ default: B(() => [
69
+ U("div", we, A(e(t)[1]), 1)
70
+ ]),
71
+ _: 1
72
+ }, 8, ["content"])
73
+ ])
74
+ ]),
75
+ c(b, {
76
+ name: "close",
77
+ size: "md",
78
+ class: "cursor-pointer hover:bg-neutral-300 rounded-lg",
79
+ onClick: a
80
+ })
81
+ ]);
82
+ };
83
+ }
84
+ });
85
+ Ue.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 qe = [
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
+ ], Be = { class: "flex flex-nowrap gap-x-4 items-center" }, Me = /* @__PURE__ */ P({
348
+ __name: "IsDayInput",
349
+ props: {
350
+ modelValue: {
351
+ type: Object
352
+ }
353
+ },
354
+ emits: ["update:model-value"],
355
+ setup(o, { emit: x }) {
356
+ const { t: g } = G(), u = o, v = x;
357
+ Z(() => {
358
+ u.modelValue || v("update:model-value", {
359
+ op: "before",
360
+ x: 1
361
+ });
362
+ });
363
+ function t(a) {
364
+ const s = ve(
365
+ u.modelValue ?? {
366
+ op: "before",
367
+ x: 1
368
+ }
369
+ );
370
+ v("update:model-value", {
371
+ ...s,
372
+ ...a
373
+ });
374
+ }
375
+ return (a, s) => {
376
+ var E, i, b;
377
+ const r = _("FmStepperField");
378
+ return n(), V("div", Be, [
379
+ c(r, {
380
+ class: "w-1/3",
381
+ "model-value": ((E = o.modelValue) == null ? void 0 : E.x) ?? null,
382
+ max: 365,
383
+ "show-steppers": !1,
384
+ "append-text": "days",
385
+ "onUpdate:modelValue": s[0] || (s[0] = (k) => t({ x: k }))
386
+ }, null, 8, ["model-value"]),
387
+ c(w, {
388
+ "model-value": ((i = o.modelValue) == null ? void 0 : i.op) ?? void 0,
389
+ items: [
390
+ {
391
+ label: e(g)("connect.template.rule.is_day.before"),
392
+ value: "before"
393
+ },
394
+ { label: e(g)("connect.template.rule.is_day.after"), value: "after" }
395
+ ],
396
+ "onUpdate:modelValue": s[1] || (s[1] = (k) => t({ op: k }))
397
+ }, null, 8, ["model-value", "items"]),
398
+ c(w, {
399
+ "model-value": ((b = o.modelValue) == null ? void 0 : b.ignoreYear) ?? !1,
400
+ items: [
401
+ {
402
+ label: e(g)("connect.template.rule.is_day.same_year"),
403
+ value: !1
404
+ },
405
+ {
406
+ label: e(g)("connect.template.rule.is_day.ignore_year"),
407
+ value: !0
408
+ }
409
+ ],
410
+ required: !0,
411
+ "onUpdate:modelValue": s[2] || (s[2] = (k) => t({ ignoreYear: k == !0 }))
412
+ }, null, 8, ["model-value", "items"])
413
+ ]);
414
+ };
415
+ }
416
+ }), Ie = { class: "grid grid-cols-4 gap-x-4 items-center" }, Ae = /* @__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(o, { emit: x }) {
430
+ const { t: g } = G(), u = o, v = x;
431
+ Z(() => {
432
+ u.modelValue || v("update:model-value", {
433
+ op: "this",
434
+ unit: "day",
435
+ ignoreYear: !0
436
+ });
437
+ });
438
+ const t = [
439
+ { label: g("connect.template.rule.is_range.duration.day"), value: "day" },
440
+ { label: g("connect.template.rule.is_range.duration.week"), value: "week" },
441
+ {
442
+ label: g("connect.template.rule.is_range.duration.month"),
443
+ value: "month"
444
+ },
445
+ {
446
+ label: g("connect.template.rule.is_range.duration.quarter"),
447
+ value: "quarter"
448
+ },
449
+ { label: g("connect.template.rule.is_range.duration.year"), value: "year" }
450
+ ], a = [
451
+ {
452
+ label: g("connect.template.rule.is_range.op.this"),
453
+ value: "this"
454
+ },
455
+ {
456
+ label: g("connect.template.rule.is_range.op.last"),
457
+ value: "last"
458
+ },
459
+ {
460
+ label: g("connect.template.rule.is_range.op.next"),
461
+ value: "next"
462
+ }
463
+ ];
464
+ return (s, r) => {
465
+ var i, b, k, R, D;
466
+ const E = _("FmStepperField");
467
+ return n(), V("div", Ie, [
468
+ c(w, {
469
+ "model-value": (i = o.modelValue) == null ? void 0 : i.op,
470
+ label: "",
471
+ items: a,
472
+ required: !0,
473
+ "onUpdate:modelValue": r[0] || (r[0] = (d) => v("update:model-value", { op: d, unit: "day", ignoreYear: !1 }))
474
+ }, null, 8, ["model-value"]),
475
+ ((b = o.modelValue) == null ? void 0 : b.op) != "this" ? (n(), f(E, {
476
+ key: 0,
477
+ "model-value": ((k = o.modelValue) == null ? void 0 : k.x) || 0,
478
+ max: 365,
479
+ "show-steppers": !1,
480
+ "onUpdate:modelValue": r[1] || (r[1] = (d) => v("update:model-value", {
481
+ op: o.modelValue.op,
482
+ unit: o.modelValue.unit,
483
+ ignoreYear: o.modelValue.ignoreYear == !0,
484
+ x: d
485
+ }))
486
+ }, null, 8, ["model-value"])) : N("", !0),
487
+ c(w, {
488
+ "model-value": (R = o.modelValue) == null ? void 0 : R.unit,
489
+ label: "",
490
+ items: t,
491
+ required: !0,
492
+ "onUpdate:modelValue": r[2] || (r[2] = (d) => v("update:model-value", { ...u.modelValue, unit: d }))
493
+ }, null, 8, ["model-value"]),
494
+ c(w, {
495
+ label: "",
496
+ "model-value": (D = o.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": r[3] || (r[3] = (d) => v("update:model-value", {
503
+ ...u.modelValue,
504
+ ignoreYear: d == !0
505
+ }))
506
+ }, null, 8, ["model-value"])
507
+ ]);
508
+ };
509
+ }
510
+ }), Ne = { class: "space-y-8" }, Pe = { class: "text-fm-color-primary rounded-md border-dashed border-2 p-8" }, Le = {
511
+ key: 0,
512
+ class: "flex items-center gap-8"
513
+ }, $e = { class: "flex gap-4" }, He = {
514
+ key: 0,
515
+ class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
516
+ }, We = ["onClick"], je = {
517
+ key: 1,
518
+ class: "flex items-center gap-8"
519
+ }, Ke = { class: "flex gap-4 xs:gap-[2px]" }, Ge = { class: "grid grid-cols-6 gap-8" }, Qe = {
520
+ key: 0,
521
+ class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
522
+ }, ze = ["onClick"], Xe = {
523
+ key: 1,
524
+ class: "grid grid-cols-2 items-center gap-8"
525
+ }, Ze = { class: "flex gap-4" }, Je = {
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(o, { emit: x }) {
546
+ const { t: g } = G(), u = o, v = x, t = W(
547
+ u.modelValue ? F.fromString(u.modelValue) : new F({
548
+ dtstart: u.startDate,
549
+ freq: F.DAILY,
550
+ wkst: F.SU,
551
+ interval: 1,
552
+ byhour: 0,
553
+ byminute: 0,
554
+ bysecond: 0
555
+ })
556
+ );
557
+ function a(s) {
558
+ var r;
559
+ if ("freq" in s)
560
+ switch (s.freq) {
561
+ case F.WEEKLY:
562
+ t.value = new F({
563
+ dtstart: u.startDate,
564
+ freq: s.freq,
565
+ interval: 1,
566
+ byhour: 0,
567
+ byminute: 0,
568
+ bysecond: 0,
569
+ wkst: F.SU,
570
+ byweekday: [F.MO]
571
+ });
572
+ break;
573
+ case F.MONTHLY:
574
+ t.value = new F({
575
+ dtstart: u.startDate,
576
+ freq: s.freq,
577
+ interval: 1,
578
+ byhour: 0,
579
+ byminute: 0,
580
+ bysecond: 0,
581
+ bymonthday: [(/* @__PURE__ */ new Date()).getDate()],
582
+ wkst: F.SU
583
+ });
584
+ break;
585
+ case F.YEARLY:
586
+ t.value = new F({
587
+ dtstart: u.startDate,
588
+ freq: s.freq,
589
+ interval: 1,
590
+ byhour: 0,
591
+ byminute: 0,
592
+ bysecond: 0,
593
+ wkst: F.SU,
594
+ bymonth: [(/* @__PURE__ */ new Date()).getMonth() + 1],
595
+ bymonthday: [(/* @__PURE__ */ new Date()).getDate()]
596
+ });
597
+ break;
598
+ default:
599
+ t.value = new F({
600
+ dtstart: u.startDate,
601
+ freq: s.freq,
602
+ interval: 1,
603
+ byhour: 0,
604
+ byminute: 0,
605
+ bysecond: 0,
606
+ wkst: F.SU
607
+ });
608
+ }
609
+ s.interval && s.interval > 0 && (t.value = new F({
610
+ ...t.value.origOptions,
611
+ dtstart: u.startDate,
612
+ interval: s.interval
613
+ })), "byweekday" in s && s.byweekday && Array.isArray(s.byweekday) && s.byweekday.length > 0 && (t.value.options.bymonthday.length > 0 && t.value.options.freq == F.MONTHLY && (t.value.options.bymonthday = []), t.value = new F({
614
+ ...t.value.origOptions,
615
+ dtstart: u.startDate,
616
+ bymonthday: [],
617
+ byweekday: s.byweekday
618
+ })), "bysetpos" in s && s.bysetpos != null && (t.value = new F({
619
+ ...t.value.origOptions,
620
+ dtstart: u.startDate,
621
+ bymonthday: [],
622
+ bysetpos: s.bysetpos,
623
+ byweekday: ((r = t.value.options.byweekday) == null ? void 0 : r.length) > 0 ? t.value.options.byweekday : [6]
624
+ })), "bymonthday" in s && s.bymonthday && Array.isArray(s.bymonthday) && s.bymonthday.length > 0 && (t.value = new F({
625
+ ...t.value.origOptions,
626
+ dtstart: u.startDate,
627
+ bysetpos: [],
628
+ byweekday: [],
629
+ bymonthday: s.bymonthday
630
+ })), "bymonth" in s && s.bymonth && Array.isArray(s.bymonth) && s.bymonth.length > 0 && (t.value = new F({
631
+ ...t.value.origOptions,
632
+ dtstart: u.startDate,
633
+ bysetpos: [],
634
+ bymonth: s.bymonth
635
+ })), "bynweekday" in s && s.bynweekday && (t.value = new F({
636
+ ...t.value.origOptions,
637
+ dtstart: u.startDate,
638
+ bysetpos: [],
639
+ byweekday: new xe(
640
+ s.bynweekday[0][0],
641
+ s.bynweekday[0][1]
642
+ )
643
+ })), u.applyButton || v("update:model-value", t.value.toString());
644
+ }
645
+ return Z(() => {
646
+ u.modelValue || v(
647
+ "update:model-value",
648
+ new F({
649
+ dtstart: u.startDate,
650
+ freq: F.DAILY,
651
+ wkst: F.SU,
652
+ interval: 1,
653
+ byhour: 0,
654
+ byminute: 0,
655
+ bysecond: 0
656
+ }).toString()
657
+ );
658
+ }), (s, r) => {
659
+ var R, D, d;
660
+ const E = _("FmStepperField"), i = _("FmChip"), b = _("FmButtonGroup"), k = _("FmButton");
661
+ return n(), V("div", Ne, [
662
+ U("div", Pe, A(e(Fe)(e(t).options)), 1),
663
+ o.fixedFrequency ? N("", !0) : (n(), V("div", Le, [
664
+ U("div", null, A(e(g)("connect.template.rule.rrule.repeat_every")), 1),
665
+ c(E, {
666
+ class: "w-[100px]",
667
+ "model-value": e(t).options.interval,
668
+ "onUpdate:modelValue": r[0] || (r[0] = (l) => a({ interval: l > 0 ? l : e(t).options.interval })),
669
+ min: 1
670
+ }, null, 8, ["model-value"]),
671
+ c(w, {
672
+ class: "w-min",
673
+ items: e(j).frequencies,
674
+ "model-value": e(t).origOptions.freq,
675
+ "onUpdate:modelValue": r[1] || (r[1] = (l) => a({ freq: l }))
676
+ }, null, 8, ["items", "model-value"])
677
+ ])),
678
+ e(t).options.freq === e(F).WEEKLY ? (n(), V(q, { key: 1 }, [
679
+ r[8] || (r[8] = U("div", null, "Repeat on", -1)),
680
+ U("div", $e, [
681
+ (n(!0), V(q, null, $(e(j).weekdays, (l) => {
682
+ var y;
683
+ return n(), f(i, {
684
+ class: K(["cursor-pointer", `${(y = e(t).options.byweekday) != null && y.includes(l.value) ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
685
+ label: l.label[0],
686
+ key: l.value,
687
+ compact: !0,
688
+ onClick: () => {
689
+ var p, C;
690
+ a({
691
+ byweekday: (p = e(t).options.byweekday) != null && p.includes(l.value) ? ((C = e(t).options.byweekday) == null ? void 0 : C.filter((m) => m !== l.value)) || [] : [...e(t).options.byweekday || [], l.value]
692
+ });
693
+ }
694
+ }, null, 8, ["class", "label", "onClick"]);
695
+ }), 128))
696
+ ])
697
+ ], 64)) : N("", !0),
698
+ e(t).options.freq == e(F).MONTHLY ? (n(), V(q, { key: 2 }, [
699
+ c(b, {
700
+ "model-value": e(t).options.bymonthday.length ? { label: "Each" } : { label: "On the" },
701
+ items: [
702
+ {
703
+ label: "Each"
704
+ },
705
+ {
706
+ label: "On the"
707
+ }
708
+ ],
709
+ "onUpdate:modelValue": r[2] || (r[2] = (l) => {
710
+ l.label == "Each" ? a({ bymonthday: [1] }) : a({ bysetpos: 1 });
711
+ })
712
+ }, null, 8, ["model-value"]),
713
+ e(t).options.bymonthday.length > 0 ? (n(), V("div", He, [
714
+ (n(!0), V(q, null, $(e(j).dates, (l) => (n(), V("div", {
715
+ key: l.value,
716
+ class: K(["cursor-pointer text-center outline-1 outline-fm-color-neutral-gray-100 outline", `${e(t).options.bymonthday.includes(l.value) ? "bg-fm-color-primary text-fm-color-typo-white outline-transparent" : "bg-transparent text-fm-color-typo-primary"} ${l.value == 31 ? "border-r" : ""}`]),
717
+ onClick: (y) => a({
718
+ bymonthday: e(t).options.bymonthday.includes(l.value) ? e(t).options.bymonthday.filter((p) => p !== l.value) : [...e(t).options.bymonthday, l.value]
719
+ })
720
+ }, A(l.value), 11, We))), 128))
721
+ ])) : (n(), V("div", je, [
722
+ c(w, {
723
+ items: e(j).ordinals,
724
+ "model-value": (R = e(t).options.bysetpos) == null ? void 0 : R[0],
725
+ "onUpdate:modelValue": r[3] || (r[3] = (l) => a({ bysetpos: l }))
726
+ }, null, 8, ["items", "model-value"]),
727
+ U("div", Ke, [
728
+ (n(!0), V(q, null, $(e(j).weekdays, (l) => {
729
+ var y;
730
+ return n(), f(i, {
731
+ class: K(["cursor-pointer", `${(y = e(t).options.byweekday) != null && y.includes(l.value) ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
732
+ label: l.label[0],
733
+ key: l.value,
734
+ compact: !0,
735
+ onClick: () => {
736
+ a({
737
+ byweekday: [l.value]
738
+ });
739
+ }
740
+ }, null, 8, ["class", "label", "onClick"]);
741
+ }), 128))
742
+ ])
743
+ ]))
744
+ ], 64)) : N("", !0),
745
+ e(t).options.freq == e(F).YEARLY ? (n(), V(q, { key: 3 }, [
746
+ r[9] || (r[9] = U("div", null, "Month", -1)),
747
+ U("div", Ge, [
748
+ (n(!0), V(q, null, $(e(j).months, (l) => {
749
+ var y, p;
750
+ return n(), f(i, {
751
+ key: l.value,
752
+ class: K(["cursor-pointer", {
753
+ "bg-fm-color-primary text-white": (y = e(t).options.bymonth) == null ? void 0 : y.includes(
754
+ l.value
755
+ ),
756
+ "bg-fm-color-gray-200 text-fm-color-gray-800": !((p = e(t).options.bymonth) != null && p.includes(l.value))
757
+ }]),
758
+ label: l.shortName,
759
+ compact: !0,
760
+ onClick: (C) => a({
761
+ bymonth: (e(t).options.bymonth ?? []).includes(l.value) ? (e(t).options.bymonth ?? []).filter((m) => m !== l.value) : [...e(t).options.bymonth ?? [], l.value]
762
+ })
763
+ }, null, 8, ["class", "label", "onClick"]);
764
+ }), 128))
765
+ ]),
766
+ c(b, {
767
+ "model-value": e(t).options.bymonthday.length ? { label: "Each" } : { label: "On the" },
768
+ items: [
769
+ {
770
+ label: "Each"
771
+ },
772
+ {
773
+ label: "On the"
774
+ }
775
+ ],
776
+ "onUpdate:modelValue": r[4] || (r[4] = (l) => {
777
+ l.label == "Each" ? a({
778
+ bymonthday: [1],
779
+ bymonth: e(t).options.bymonth ?? [1]
780
+ }) : a({
781
+ byweekday: [e(F).SU.nth(1)],
782
+ bymonth: e(t).options.bymonth ?? [1]
783
+ });
784
+ })
785
+ }, null, 8, ["model-value"]),
786
+ e(t).options.bymonthday.length > 0 ? (n(), V("div", Qe, [
787
+ (n(!0), V(q, null, $(Array(31).fill(null).map((l, y) => y + 1), (l) => (n(), V("div", {
788
+ key: l,
789
+ class: K(["cursor-pointer text-center outline-1 outline-fm-color-neutral-gray-100 outline", `${e(t).options.bymonthday.includes(l) ? "bg-fm-color-primary text-fm-color-typo-white outline-transparent" : "bg-transparent text-fm-color-typo-primary"} ${l == 31 ? "border-r" : ""}`]),
790
+ onClick: (y) => a({
791
+ bymonthday: e(t).options.bymonthday.includes(l) ? e(t).options.bymonthday.filter((p) => p !== l) : [...e(t).options.bymonthday, l]
792
+ })
793
+ }, A(l), 11, ze))), 128))
794
+ ])) : (n(), V("div", Xe, [
795
+ c(w, {
796
+ items: e(j).ordinals,
797
+ "model-value": (d = (D = e(t).options.bynweekday) == null ? void 0 : D[0]) == null ? void 0 : d[1],
798
+ "onUpdate:modelValue": r[5] || (r[5] = (l) => {
799
+ var y, p;
800
+ return a({
801
+ bynweekday: [[((p = (y = e(t).options.bynweekday) == null ? void 0 : y[0]) == null ? void 0 : p[0]) ?? 1, l]]
802
+ });
803
+ })
804
+ }, null, 8, ["items", "model-value"]),
805
+ U("div", Ze, [
806
+ (n(!0), V(q, null, $(e(j).weekdays, (l) => {
807
+ var y, p;
808
+ return n(), f(i, {
809
+ class: K(["cursor-pointer", `${((p = (y = e(t).options.bynweekday) == null ? void 0 : y[0]) == null ? void 0 : p[0]) === l.value ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
810
+ label: l.label[0],
811
+ key: l.value,
812
+ compact: !0,
813
+ onClick: () => {
814
+ var C, m;
815
+ a({
816
+ bynweekday: [
817
+ [l.value, ((m = (C = e(t).options.bynweekday) == null ? void 0 : C[0]) == null ? void 0 : m[1]) ?? 1]
818
+ ]
819
+ });
820
+ }
821
+ }, null, 8, ["class", "label", "onClick"]);
822
+ }), 128))
823
+ ])
824
+ ]))
825
+ ], 64)) : N("", !0),
826
+ o.applyButton ? (n(), V("div", Je, [
827
+ c(k, {
828
+ label: "Cancel",
829
+ variant: "tertiary",
830
+ onClick: r[6] || (r[6] = (l) => v("cancel"))
831
+ }),
832
+ c(k, {
833
+ label: "Apply",
834
+ onClick: r[7] || (r[7] = (l) => v("update:model-value", e(t).toString()))
835
+ })
836
+ ])) : N("", !0)
837
+ ]);
838
+ };
839
+ }
840
+ }), et = { class: "grid grid-cols-4 gap-8 w-full flex-wrap py-16" }, tt = /* @__PURE__ */ P({
841
+ __name: "IsInMonthInput",
842
+ props: {
843
+ modelValue: {
844
+ type: Object,
845
+ required: !0
846
+ }
847
+ },
848
+ emits: ["update:model-value"],
849
+ setup(o, { emit: x }) {
850
+ const g = o, u = x, v = ae.months().map((t, a) => ({
851
+ name: t,
852
+ shortName: ae().month(a).format("MMM"),
853
+ value: a
854
+ }));
855
+ return Z(() => {
856
+ g.modelValue || u("update:model-value", []);
857
+ }), (t, a) => {
858
+ const s = _("FmChip");
859
+ return n(), V("div", et, [
860
+ (n(!0), V(q, null, $(e(v), (r) => {
861
+ var E, i;
862
+ return n(), f(s, {
863
+ class: K(["cursor-pointer", {
864
+ "bg-fm-color-primary text-white": (E = o.modelValue) == null ? void 0 : E.includes(r.value),
865
+ "bg-fm-color-gray-200 text-fm-color-gray-800": !((i = o.modelValue) != null && i.includes(
866
+ r.value
867
+ ))
868
+ }]),
869
+ label: r.name,
870
+ key: r.value,
871
+ compact: !0,
872
+ onClick: (b) => u(
873
+ "update:model-value",
874
+ o.modelValue.includes(r.value) ? o.modelValue.filter((k) => k !== r.value) : [...o.modelValue, r.value]
875
+ )
876
+ }, null, 8, ["class", "label", "onClick"]);
877
+ }), 128))
878
+ ]);
879
+ };
880
+ }
881
+ }), lt = { class: "" }, ot = { class: "flex justify-end gap-8 w-full" }, at = /* @__PURE__ */ P({
882
+ __name: "MenuDialog",
883
+ props: {
884
+ modelValue: { type: Boolean },
885
+ initialValue: {},
886
+ filterItems: { type: Function }
887
+ },
888
+ emits: ["update:model-value", "confirm"],
889
+ setup(o, { emit: x }) {
890
+ const g = o, u = W(), v = W(!1), t = x;
891
+ function a() {
892
+ var r;
893
+ (r = u.value) == null || r.onConfirm(), t("update:model-value", !1);
894
+ }
895
+ function s() {
896
+ t("update:model-value", !1);
897
+ }
898
+ return be(
899
+ () => g.modelValue,
900
+ (r) => {
901
+ v.value = r;
902
+ }
903
+ ), Z(() => {
904
+ v.value = g.modelValue;
905
+ }), (r, E) => {
906
+ const i = _("FmButton"), b = _("FmDialog");
907
+ return n(), f(b, {
908
+ "content-scrollable": !1,
909
+ contentClass: "pt-0",
910
+ modelValue: v.value,
911
+ "onUpdate:modelValue": E[0] || (E[0] = (k) => v.value = k),
912
+ title: "Select Items",
913
+ "close-button": !1
914
+ }, {
915
+ "dialog-header": B(() => [...E[1] || (E[1] = [
916
+ U("div", null, "Select Item", -1)
917
+ ])]),
918
+ "dialog-footer": B(() => [
919
+ U("div", ot, [
920
+ c(i, {
921
+ variant: "tertiary",
922
+ onClick: s,
923
+ label: "Cancel"
924
+ }),
925
+ c(i, {
926
+ variant: "primary",
927
+ onClick: a,
928
+ label: "Confirm"
929
+ })
930
+ ])
931
+ ]),
932
+ default: B(() => [
933
+ U("div", lt, [
934
+ c(Ce, {
935
+ ref_key: "selectItemRef",
936
+ ref: u,
937
+ "initial-value": o.initialValue,
938
+ "filter-items": o.filterItems,
939
+ "on-complete": (k) => {
940
+ t("confirm", k), s();
941
+ }
942
+ }, null, 8, ["initial-value", "filter-items", "on-complete"])
943
+ ])
944
+ ]),
945
+ _: 1
946
+ }, 8, ["modelValue"]);
947
+ };
948
+ }
949
+ }), rt = { id: "select-menu" }, nt = /* @__PURE__ */ P({
950
+ __name: "SelectMenu",
951
+ props: {
952
+ modelValue: {}
953
+ },
954
+ emits: ["update:model-value"],
955
+ setup(o, { emit: x }) {
956
+ const g = o, u = W(!1), v = M(() => {
957
+ var s;
958
+ return ((s = g.modelValue) == null ? void 0 : s.length) || 0;
959
+ }), t = x;
960
+ function a(s) {
961
+ t("update:model-value", s);
962
+ }
963
+ return (s, r) => {
964
+ const E = _("FmField");
965
+ return n(), V("div", rt, [
966
+ c(E, {
967
+ class: "text-fm-color-typo-tertiary",
968
+ onClick: r[0] || (r[0] = (i) => u.value = !0)
969
+ }, {
970
+ default: B(() => [
971
+ ne(A(v.value) + " item(s) selected ", 1)
972
+ ]),
973
+ _: 1
974
+ }),
975
+ c(at, {
976
+ modelValue: u.value,
977
+ "onUpdate:modelValue": [
978
+ r[1] || (r[1] = (i) => u.value = i),
979
+ r[2] || (r[2] = (i) => u.value = i)
980
+ ],
981
+ "initial-value": o.modelValue,
982
+ onConfirm: a
983
+ }, null, 8, ["modelValue", "initial-value"])
984
+ ]);
985
+ };
986
+ }
987
+ }), ut = {
988
+ key: 19,
989
+ class: "fm-typo-en-body-lg-600"
990
+ }, st = /* @__PURE__ */ P({
991
+ __name: "RuleEquator",
992
+ props: {
993
+ type: {
994
+ type: String,
995
+ required: !0
996
+ },
997
+ operator: {
998
+ type: String,
999
+ required: !0
1000
+ },
1001
+ modelValue: {
1002
+ type: Object
1003
+ }
1004
+ },
1005
+ emits: ["update:model-value"],
1006
+ setup(o, { emit: x }) {
1007
+ const g = o, u = x, v = M(() => {
1008
+ const t = _e[g.operator].safeParse(g.modelValue);
1009
+ return t.success ? [] : t.error.errors;
1010
+ });
1011
+ return (t, a) => {
1012
+ var D, d, l, y, p, C;
1013
+ const s = _("FmTextField"), r = _("FmStepperField"), E = _("FmSimpleDatePicker"), i = _("FmSimpleDateRangePicker"), b = _("FmTimeRangePicker"), k = _("FmTimePicker"), R = _("FmHelperText");
1014
+ return n(), V("div", {
1015
+ class: K({ "pb-4": e(v).length })
1016
+ }, [
1017
+ o.type === "text" ? (n(), f(s, {
1018
+ key: 0,
1019
+ "model-value": o.modelValue,
1020
+ "onUpdate:modelValue": a[0] || (a[0] = (m) => u("update:model-value", m))
1021
+ }, null, 8, ["model-value"])) : o.type === "number" ? (n(), f(r, {
1022
+ key: 1,
1023
+ "model-value": o.modelValue,
1024
+ "onUpdate:modelValue": a[1] || (a[1] = (m) => u("update:model-value", m))
1025
+ }, null, 8, ["model-value"])) : o.operator == "_isDay" ? (n(), f(me(Me), {
1026
+ key: 2,
1027
+ "model-value": o.modelValue,
1028
+ "onUpdate:modelValue": a[2] || (a[2] = (m) => u("update:model-value", m))
1029
+ }, null, 8, ["model-value"])) : o.operator == "_isRange" ? (n(), f(me(Ae), {
1030
+ key: 3,
1031
+ "model-value": o.modelValue,
1032
+ "onUpdate:modelValue": a[3] || (a[3] = (m) => u("update:model-value", m))
1033
+ }, null, 8, ["model-value"])) : o.operator == "_isOnDate" ? (n(), f(E, {
1034
+ key: 4,
1035
+ "model-value": o.modelValue,
1036
+ "onUpdate:modelValue": a[4] || (a[4] = (m) => u("update:model-value", m))
1037
+ }, null, 8, ["model-value"])) : o.operator == "_isBetween" ? (n(), f(i, {
1038
+ key: 5,
1039
+ "model-value": {
1040
+ startDate: (D = o.modelValue) == null ? void 0 : D.start,
1041
+ endDate: (d = o.modelValue) == null ? void 0 : d.end
1042
+ },
1043
+ "onUpdate:modelValue": a[5] || (a[5] = (m) => {
1044
+ u("update:model-value", {
1045
+ start: m.startDate,
1046
+ end: m.endDate
1047
+ });
1048
+ })
1049
+ }, null, 8, ["model-value"])) : o.operator == "_isInMonth" ? (n(), f(tt, {
1050
+ key: 6,
1051
+ "model-value": o.modelValue,
1052
+ "onUpdate:modelValue": a[6] || (a[6] = (m) => u("update:model-value", m))
1053
+ }, null, 8, ["model-value"])) : o.operator == "_rrule" ? (n(), f(re, {
1054
+ key: 7,
1055
+ "model-value": o.modelValue,
1056
+ "onUpdate:modelValue": a[7] || (a[7] = (m) => u("update:model-value", m))
1057
+ }, null, 8, ["model-value"])) : o.operator == "_isBetweenTime" ? (n(), f(b, {
1058
+ key: 8,
1059
+ "disable-time-check": !0,
1060
+ "model-value": [(y = (l = o.modelValue) == null ? void 0 : l[0]) == null ? void 0 : y.start, (C = (p = o.modelValue) == null ? void 0 : p[0]) == null ? void 0 : C.end],
1061
+ "onUpdate:modelValue": a[8] || (a[8] = (m) => u("update:model-value", [
1062
+ {
1063
+ start: m[0],
1064
+ end: m[1]
1065
+ }
1066
+ ]))
1067
+ }, null, 8, ["model-value"])) : o.operator == "_isOnTime" ? (n(), f(k, {
1068
+ key: 9,
1069
+ "model-value": o.modelValue,
1070
+ "onUpdate:modelValue": a[9] || (a[9] = (m) => u("update:model-value", m))
1071
+ }, null, 8, ["model-value"])) : o.type == "tier" ? (n(), f(w, {
1072
+ key: 10,
1073
+ items: (e(X)().sortedTiers ?? []).map((m, Y) => ({
1074
+ label: `Tier ${Y + 1} - ${m.name}`,
1075
+ value: Y + 1
1076
+ })),
1077
+ "model-value": o.modelValue,
1078
+ "onUpdate:modelValue": a[10] || (a[10] = (m) => u("update:model-value", m))
1079
+ }, null, 8, ["items", "model-value"])) : o.type == "boolean" ? (n(), f(w, {
1080
+ key: 11,
1081
+ multiselect: !0,
1082
+ items: [
1083
+ { label: "true", value: !0 },
1084
+ { label: "false", value: !1 }
1085
+ ],
1086
+ "model-value": o.modelValue ?? [],
1087
+ "onUpdate:modelValue": a[11] || (a[11] = (m) => u("update:model-value", m))
1088
+ }, null, 8, ["model-value"])) : o.type == "exist" ? (n(), f(w, {
1089
+ key: 12,
1090
+ items: [
1091
+ { label: "true", value: "true" },
1092
+ { label: "false", value: "false" }
1093
+ ],
1094
+ "model-value": o.modelValue ?? [],
1095
+ "onUpdate:modelValue": a[12] || (a[12] = (m) => u("update:model-value", m))
1096
+ }, null, 8, ["model-value"])) : o.type == "gender" ? (n(), f(w, {
1097
+ key: 13,
1098
+ multiselect: !0,
1099
+ items: [
1100
+ { label: "Male", value: "MALE" },
1101
+ { label: "Female", value: "FEMALE" }
1102
+ ],
1103
+ "model-value": o.modelValue ?? [],
1104
+ "onUpdate:modelValue": a[13] || (a[13] = (m) => u("update:model-value", m))
1105
+ }, null, 8, ["model-value"])) : o.type == "collectible" ? (n(), f(w, {
1106
+ key: 14,
1107
+ multiselect: !0,
1108
+ items: [],
1109
+ "model-value": o.modelValue ?? [],
1110
+ "onUpdate:modelValue": a[14] || (a[14] = (m) => u("update:model-value", m))
1111
+ }, null, 8, ["model-value"])) : o.type == "segment" ? (n(), f(w, {
1112
+ key: 15,
1113
+ multiselect: !0,
1114
+ items: e(X)().segmentOptions,
1115
+ "model-value": o.modelValue ?? [],
1116
+ "onUpdate:modelValue": a[15] || (a[15] = (m) => u("update:model-value", m)),
1117
+ label: "Select segment(s) to match"
1118
+ }, null, 8, ["items", "model-value"])) : o.type == "title" ? (n(), f(w, {
1119
+ key: 16,
1120
+ multiselect: !0,
1121
+ items: (e(X)().sortedTitles ?? []).map((m) => ({
1122
+ label: m.name,
1123
+ value: m._id
1124
+ })),
1125
+ "model-value": o.modelValue ?? [],
1126
+ "onUpdate:modelValue": a[16] || (a[16] = (m) => u("update:model-value", m))
1127
+ }, null, 8, ["items", "model-value"])) : o.type == "product" ? (n(), f(nt, {
1128
+ key: 17,
1129
+ "model-value": o.modelValue,
1130
+ "onUpdate:modelValue": a[17] || (a[17] = (m) => u("update:model-value", m))
1131
+ }, null, 8, ["model-value"])) : o.type == "location" ? (n(), f(w, {
1132
+ key: 18,
1133
+ multiselect: !0,
1134
+ items: e(te)().locations.map((m) => ({
1135
+ label: m.name,
1136
+ value: m._id
1137
+ })),
1138
+ "model-value": o.modelValue ?? [],
1139
+ "onUpdate:modelValue": a[18] || (a[18] = (m) => u("update:model-value", m))
1140
+ }, null, 8, ["items", "model-value"])) : (n(), V("div", ut, "Rule: " + A(o.type) + " Not implemented", 1)),
1141
+ c(R, {
1142
+ class: "items-end",
1143
+ state: e(le).helperState(e(v), ""),
1144
+ text: e(le).helperText(e(v), "")
1145
+ }, null, 8, ["state", "text"])
1146
+ ], 2);
1147
+ };
1148
+ }
1149
+ }), mt = { class: "space-y-4" }, it = { class: "fm-typo-en-body-lg-400" }, dt = { class: "fm-typo-en-body-lg-400" }, pt = { class: "flex items-center gap-8" }, ct = { class: "fm-typo-en-body-lg-400" }, yt = { class: "flex items-center justify-end gap-8 pt-16 w-full" }, vt = /* @__PURE__ */ P({
1150
+ __name: "CustomRuleDialog",
1151
+ props: {
1152
+ triggerType: {
1153
+ type: String,
1154
+ required: !0
1155
+ },
1156
+ includeOnly: {
1157
+ type: String
1158
+ },
1159
+ modelValue: {
1160
+ type: Object,
1161
+ default: () => {
1162
+ }
1163
+ }
1164
+ },
1165
+ setup(o) {
1166
+ const x = ue(), g = X(), { emitData: u, emitAction: v } = ye(), { t } = G(), a = {
1167
+ "user.member": "connect.template.rule.custom_modal.properties.user_member",
1168
+ "user.parentReferralCode": "connect.template.rule.custom_modal.properties.user_parent_referral_code",
1169
+ "user.name": "connect.template.rule.custom_modal.properties.user_name",
1170
+ "user.phoneNumber": "connect.template.rule.custom_modal.properties.user_phone_number",
1171
+ "user.email": "connect.template.rule.custom_modal.properties.user_email",
1172
+ "user.birthday": "connect.template.rule.custom_modal.properties.user_birthday",
1173
+ "user.joinAt": "connect.template.rule.custom_modal.properties.user_join_at",
1174
+ "user.location": "connect.template.rule.custom_modal.properties.user_location",
1175
+ "user.gender": "connect.template.rule.custom_modal.properties.user_gender",
1176
+ "user.titles": "connect.template.rule.custom_modal.properties.user_titles",
1177
+ "user.point": "connect.template.rule.custom_modal.properties.user_point",
1178
+ "user.tier": "connect.template.rule.custom_modal.properties.user_tier",
1179
+ "user.segment": "connect.template.rule.custom_modal.properties.user_segment",
1180
+ "user.stats.avgBillSize": "connect.template.rule.custom_modal.properties.user_stats_avg_bill_size",
1181
+ "user.stats.avgVisitFrequency": "connect.template.rule.custom_modal.properties.user_stats_avg_visit_frequency",
1182
+ "user.stats.feedbackCount": "connect.template.rule.custom_modal.properties.user_stats_feedback_count",
1183
+ "user.stats.lastVisit": "connect.template.rule.custom_modal.properties.user_stats_last_visit",
1184
+ "user.stats.topupCount": "connect.template.rule.custom_modal.properties.user_stats_topup_count",
1185
+ "user.stats.visitCount": "connect.template.rule.custom_modal.properties.user_stats_visit_count",
1186
+ "user.stats.lastSeasonPointEarned": "connect.template.rule.custom_modal.properties.user_stats_last_season_point_earned",
1187
+ "user.stats.lastSeasonTierEarned": "connect.template.rule.custom_modal.properties.user_stats_last_season_tier_earned",
1188
+ "user.expiringVouchers.days7": "connect.template.rule.custom_modal.properties.user_expiring_vouchers_days_7",
1189
+ "user.expiringVouchers.days30": "connect.template.rule.custom_modal.properties.user_expiring_vouchers_days_30",
1190
+ "user.expiringVouchers.days90": "connect.template.rule.custom_modal.properties.user_expiring_vouchers_days_90"
1191
+ }, s = {
1192
+ _is: "connect.template.rule.custom_modal.operators.is",
1193
+ _contains: "connect.template.rule.custom_modal.operators.contains",
1194
+ _equal: "connect.template.rule.custom_modal.operators.equal",
1195
+ _lessThan: "connect.template.rule.custom_modal.operators.less_than",
1196
+ _moreThan: "connect.template.rule.custom_modal.operators.more_than",
1197
+ _lessThanOrEqual: "connect.template.rule.custom_modal.operators.less_than_or_equal",
1198
+ _moreThanOrEqual: "connect.template.rule.custom_modal.operators.more_than_or_equal",
1199
+ _isDay: "connect.template.rule.custom_modal.operators.is_day",
1200
+ _isRange: "connect.template.rule.custom_modal.operators.is_in_range",
1201
+ _isOnDate: "connect.template.rule.custom_modal.operators.is_on_date",
1202
+ _isBetween: "connect.template.rule.custom_modal.operators.is_between",
1203
+ _isInMonth: "connect.template.rule.custom_modal.operators.is_in_month",
1204
+ _rrule: "connect.template.rule.custom_modal.operators.matches_occurrence",
1205
+ _isBetweenTime: "connect.template.rule.custom_modal.operators.between_time",
1206
+ _isOnTime: "connect.template.rule.custom_modal.operators.is_on_time",
1207
+ _isIn: "connect.template.rule.custom_modal.operators.is_in",
1208
+ _hasAll: "connect.template.rule.custom_modal.operators.has_all_of",
1209
+ _hasAny: "connect.template.rule.custom_modal.operators.has_any_of"
1210
+ };
1211
+ function r(T) {
1212
+ if (!T) return "";
1213
+ const S = a[T.property];
1214
+ return S ? t(S) : T.name;
1215
+ }
1216
+ function E(T) {
1217
+ const S = s[T];
1218
+ return S ? t(S) : de[T].name;
1219
+ }
1220
+ const i = o, b = M(
1221
+ () => ke(i.triggerType, i.includeOnly)
1222
+ ), k = M(
1223
+ () => b.value.find((T) => {
1224
+ var S;
1225
+ return T.property == ((S = p.value) == null ? void 0 : S.property);
1226
+ })
1227
+ ), R = (T) => ie[b.value.find((S) => S.property === T).type], D = M(() => {
1228
+ if (!p.value) return [];
1229
+ const T = b.value.find(
1230
+ (S) => S.property === p.value.property
1231
+ );
1232
+ return T ? ie[T.type].filter((S) => {
1233
+ var L, H;
1234
+ return !((H = (L = de[S]) == null ? void 0 : L.exclude) != null && H.includes(p.value.property));
1235
+ }).map((S) => ({
1236
+ label: E(S),
1237
+ value: S
1238
+ })) : [];
1239
+ }), d = he, l = M(() => {
1240
+ const T = d.safeParse(p.value);
1241
+ return T.success ? [] : T.error.errors;
1242
+ }), y = W(!1), p = W(
1243
+ ve(i.modelValue) ?? O.constructEntry(
1244
+ b.value[0].property,
1245
+ R(b.value[0].property)[0],
1246
+ null
1247
+ )
1248
+ ), C = M(() => {
1249
+ var h;
1250
+ const { property: T, negated: S, conditions: L } = p.value, H = Object.keys(L || {})[0], Q = Object.values(L || {})[0];
1251
+ return {
1252
+ property: T,
1253
+ negated: S == !0,
1254
+ type: (h = b.value.find((z) => z.property === T)) == null ? void 0 : h.type,
1255
+ operator: H,
1256
+ equator: Q
1257
+ };
1258
+ });
1259
+ function m(T) {
1260
+ p.value = O.constructEntry(
1261
+ T,
1262
+ R(T)[0],
1263
+ null
1264
+ );
1265
+ }
1266
+ function Y(T) {
1267
+ p.value = { ...p.value, negated: T == !0 };
1268
+ }
1269
+ function oe(T) {
1270
+ p.value = {
1271
+ ...p.value,
1272
+ conditions: { [T]: null }
1273
+ };
1274
+ }
1275
+ function J(T) {
1276
+ p.value.conditions = {
1277
+ [C.value.operator]: T
1278
+ };
1279
+ }
1280
+ function ee() {
1281
+ u(p.value), v("primary"), x.close();
1282
+ }
1283
+ return pe(async () => {
1284
+ await g.readMembership();
1285
+ }), (T, S) => {
1286
+ const L = _("FmIcon"), H = _("FmField"), Q = _("FmPill"), h = _("FmMenuItem"), z = _("FmMenu"), se = _("FmButton");
1287
+ return n(), V("div", mt, [
1288
+ U("div", it, A(e(t)("connect.template.rule.custom_modal.property")), 1),
1289
+ c(z, {
1290
+ shift: !0,
1291
+ placement: "bottom-start",
1292
+ modelValue: e(y),
1293
+ "onUpdate:modelValue": S[0] || (S[0] = (I) => fe(y) ? y.value = I : null),
1294
+ onMenuChanged: S[1] || (S[1] = (I) => y.value = I),
1295
+ "max-height": 300
1296
+ }, {
1297
+ "menu-button": B(() => [
1298
+ c(H, null, {
1299
+ append: B(() => [
1300
+ c(L, {
1301
+ name: e(y) ? "expand_less" : "expand_more"
1302
+ }, null, 8, ["name"])
1303
+ ]),
1304
+ default: B(() => [
1305
+ ne(A(r(e(k))) + " ", 1)
1306
+ ]),
1307
+ _: 1
1308
+ })
1309
+ ]),
1310
+ default: B(() => [
1311
+ (n(!0), V(q, null, $(e(b), (I) => (n(), f(h, {
1312
+ key: I.property,
1313
+ "model-value": e(p).property == I.property,
1314
+ label: r(I),
1315
+ disabled: I.premium && !e(te)().isPremium,
1316
+ onClick: (Vt) => I.premium && !e(te)().isPremium ? null : m(I.property)
1317
+ }, ce({ _: 2 }, [
1318
+ I.premium ? {
1319
+ name: "append",
1320
+ fn: B(() => [
1321
+ c(Q, { variant: "premium" })
1322
+ ]),
1323
+ key: "0"
1324
+ } : void 0
1325
+ ]), 1032, ["model-value", "label", "disabled", "onClick"]))), 128))
1326
+ ]),
1327
+ _: 1
1328
+ }, 8, ["modelValue"]),
1329
+ U("div", dt, A(e(t)("connect.template.rule.custom_modal.check_to_perform")), 1),
1330
+ U("div", pt, [
1331
+ c(w, {
1332
+ class: "w-1/4",
1333
+ items: [
1334
+ { label: e(t)("connect.template.rule.custom_modal.is"), value: !1 },
1335
+ {
1336
+ label: e(t)("connect.template.rule.custom_modal.is_not"),
1337
+ value: !0
1338
+ }
1339
+ ],
1340
+ "model-value": e(p).negated ?? !1,
1341
+ "onUpdate:modelValue": Y
1342
+ }, null, 8, ["items", "model-value"]),
1343
+ c(w, {
1344
+ class: "flex-1",
1345
+ items: e(D),
1346
+ "model-value": e(C).operator,
1347
+ "onUpdate:modelValue": oe
1348
+ }, null, 8, ["items", "model-value"])
1349
+ ]),
1350
+ U("div", null, [
1351
+ U("div", ct, A(e(t)("connect.template.rule.custom_modal.criteria")), 1),
1352
+ e(C).type ? (n(), f(st, {
1353
+ key: 0,
1354
+ type: e(C).type,
1355
+ operator: e(C).operator,
1356
+ "model-value": e(C).equator,
1357
+ "onUpdate:modelValue": J
1358
+ }, null, 8, ["type", "operator", "model-value"])) : N("", !0)
1359
+ ]),
1360
+ U("div", yt, [
1361
+ c(se, {
1362
+ onClick: S[2] || (S[2] = (I) => e(x).close()),
1363
+ label: e(t)("connect.common.cancel"),
1364
+ variant: "tertiary"
1365
+ }, null, 8, ["label"]),
1366
+ c(se, {
1367
+ onClick: S[3] || (S[3] = (I) => ee()),
1368
+ disabled: e(l).length > 0,
1369
+ label: e(t)("connect.common.save")
1370
+ }, null, 8, ["disabled", "label"])
1371
+ ])
1372
+ ]);
1373
+ };
1374
+ }
1375
+ }), bt = { class: "flex flex-col gap-8" }, ft = { class: "grid grid-cols-2 items-center" }, gt = { class: "flex items-center gap-8" }, _t = { class: "pt-16 flex items-center self-end gap-8" }, kt = /* @__PURE__ */ P({
1376
+ __name: "PresetRuleDialog",
1377
+ props: {
1378
+ preset: {
1379
+ type: String,
1380
+ required: !0
1381
+ },
1382
+ defaultValue: {
1383
+ type: Object
1384
+ },
1385
+ modelValue: {
1386
+ type: Object
1387
+ }
1388
+ },
1389
+ setup(o) {
1390
+ const x = ue(), { emitData: g, emitAction: u } = ye(), v = X(), { t } = G(), a = o;
1391
+ function s() {
1392
+ const { operator: d, equator: l } = i.value;
1393
+ switch (a.preset) {
1394
+ case "MIN_SPEND":
1395
+ case "SPECIFIC_DATE":
1396
+ case "SPECIFIC_TIMERANGE":
1397
+ case "WEEKLY":
1398
+ case "MONTHLY":
1399
+ case "BIRTHDAY":
1400
+ case "TIER": {
1401
+ const y = v.sortedTiers.filter((p, C) => d == "_equal" ? C + 1 == l : d == "_moreThanOrEqual" ? C + 1 >= l : C + 1 <= l);
1402
+ return t("connect.template.rule.preset_modal.applies_to", {
1403
+ tiers: y.map((p) => p.name).join(", ")
1404
+ });
1405
+ }
1406
+ }
1407
+ }
1408
+ function r() {
1409
+ var d, l;
1410
+ switch (a.preset) {
1411
+ case "MIN_SPEND":
1412
+ return O.constructEntry("bill.amount", "_moreThanOrEqual", 0);
1413
+ case "SPECIFIC_DATE":
1414
+ return O.constructEntry(
1415
+ "trigger.date",
1416
+ "_isOnDate",
1417
+ (/* @__PURE__ */ new Date()).toISOString()
1418
+ );
1419
+ case "SPECIFIC_TIMERANGE":
1420
+ return O.constructEntry("trigger.time", "_isBetweenTime", [
1421
+ { start: "00:00", end: "23:59" }
1422
+ ]);
1423
+ case "WEEKLY":
1424
+ return O.constructEntry(
1425
+ "trigger.date",
1426
+ "_rrule",
1427
+ "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1428
+ );
1429
+ case "MONTHLY":
1430
+ return O.constructEntry(
1431
+ "trigger.date",
1432
+ "_rrule",
1433
+ "RRULE:FREQ=MONTHLY;WKST=SU;BYMONTHDAY=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1434
+ );
1435
+ case "BIRTHDAY":
1436
+ console.log("birthday", a);
1437
+ const y = O.constructEntry(
1438
+ a.defaultValue.property,
1439
+ a.defaultValue.operator,
1440
+ a.defaultValue.equator
1441
+ );
1442
+ return console.log(y), y;
1443
+ case "TIER":
1444
+ return O.constructEntry("user.tier", "_equal", 1);
1445
+ case "TITLE":
1446
+ return O.constructEntry("user.titles", "_hasAny", [
1447
+ (l = (d = v.sortedTitles) == null ? void 0 : d[0]) == null ? void 0 : l._id
1448
+ ]);
1449
+ case "LAST_X_DAY":
1450
+ return O.constructEntry("user.stats.lastVisit", "_isRange", {
1451
+ op: "last",
1452
+ unit: "day",
1453
+ ignoreYear: !0,
1454
+ x: 0
1455
+ });
1456
+ case "CUSTOM":
1457
+ throw new Error("Not implemented");
1458
+ }
1459
+ }
1460
+ const E = W(r()), i = M(() => {
1461
+ const d = O.simplify(E.value);
1462
+ return {
1463
+ ...d,
1464
+ equator: d.equator
1465
+ };
1466
+ });
1467
+ function b(d, l) {
1468
+ const y = i.value;
1469
+ E.value = O.constructEntry(
1470
+ y.property,
1471
+ l ?? y.operator,
1472
+ d,
1473
+ E.value.name
1474
+ );
1475
+ }
1476
+ function k() {
1477
+ g(E.value), u("primary"), x.close();
1478
+ }
1479
+ const R = M(() => {
1480
+ const d = Ee.safeParse(E.value);
1481
+ return d.success ? [] : d.error.errors;
1482
+ });
1483
+ pe(async () => {
1484
+ await v.readMembership();
1485
+ });
1486
+ const D = M(() => [
1487
+ {
1488
+ label: t("connect.template.rule.preset_modal.unit.day"),
1489
+ value: "day"
1490
+ },
1491
+ {
1492
+ label: t("connect.template.rule.preset_modal.unit.week"),
1493
+ value: "week"
1494
+ },
1495
+ {
1496
+ label: t("connect.template.rule.preset_modal.unit.month"),
1497
+ value: "month"
1498
+ }
1499
+ ]);
1500
+ return (d, l) => {
1501
+ var T, S, L, H, Q;
1502
+ const y = _("FmStepperField"), p = _("FmDatePicker"), C = _("FmTimeRangePicker"), m = _("FmRadio"), Y = _("FmSelect"), oe = _("FmRadioGroup"), J = _("FmHelperText"), ee = _("FmButton");
1503
+ return n(), V("div", bt, [
1504
+ o.preset == "MIN_SPEND" ? (n(), f(y, {
1505
+ key: 0,
1506
+ label: e(t)("connect.template.rule.preset.minimum_spend"),
1507
+ "model-value": e(i).equator,
1508
+ "onUpdate:modelValue": l[0] || (l[0] = (h) => b(h))
1509
+ }, null, 8, ["label", "model-value"])) : N("", !0),
1510
+ o.preset == "LAST_X_DAY" ? (n(), f(y, {
1511
+ key: 1,
1512
+ label: "",
1513
+ min: 0,
1514
+ prepent: e(t)("connect.template.rule.preset_modal.day"),
1515
+ "model-value": e(i).equator.x,
1516
+ rules: [
1517
+ (h) => h >= 0 || e(t)(
1518
+ "connect.template.rule.preset_modal.value_must_be_greater_than_0"
1519
+ )
1520
+ ],
1521
+ "onUpdate:modelValue": l[1] || (l[1] = (h) => b({
1522
+ op: "last",
1523
+ unit: "day",
1524
+ ignoreYear: !0,
1525
+ x: h
1526
+ }))
1527
+ }, null, 8, ["prepent", "model-value", "rules"])) : o.preset == "SPECIFIC_DATE" ? (n(), f(p, {
1528
+ key: 2,
1529
+ label: e(t)("connect.template.rule.preset.specific_date"),
1530
+ "model-value": e(i).equator,
1531
+ "onUpdate:modelValue": l[2] || (l[2] = (h) => b(h))
1532
+ }, null, 8, ["label", "model-value"])) : o.preset == "SPECIFIC_TIMERANGE" ? (n(), f(C, {
1533
+ key: 3,
1534
+ label: e(t)("connect.template.rule.preset_modal.time_is_between"),
1535
+ "disable-time-check": !0,
1536
+ "model-value": [(S = (T = e(i).equator) == null ? void 0 : T[0]) == null ? void 0 : S.start, (H = (L = e(i).equator) == null ? void 0 : L[0]) == null ? void 0 : H.end],
1537
+ "onUpdate:modelValue": l[3] || (l[3] = (h) => b([
1538
+ {
1539
+ start: h[0],
1540
+ end: h[1]
1541
+ }
1542
+ ]))
1543
+ }, null, 8, ["label", "model-value"])) : o.preset == "WEEKLY" ? (n(), f(re, {
1544
+ key: 4,
1545
+ label: e(t)("connect.template.rule.preset.weekly"),
1546
+ "fixed-frequency": !0,
1547
+ "model-value": e(i).equator,
1548
+ "onUpdate:modelValue": l[4] || (l[4] = (h) => b(h))
1549
+ }, null, 8, ["label", "model-value"])) : o.preset == "MONTHLY" ? (n(), f(re, {
1550
+ key: 5,
1551
+ label: e(t)("connect.template.rule.preset.monthly"),
1552
+ "fixed-frequency": !0,
1553
+ "model-value": e(i).equator,
1554
+ "onUpdate:modelValue": l[5] || (l[5] = (h) => b(h))
1555
+ }, null, 8, ["label", "model-value"])) : o.preset == "BIRTHDAY" ? (n(), V(q, { key: 6 }, [
1556
+ U("div", ft, [
1557
+ c(m, {
1558
+ label: e(t)("connect.template.rule.birthday.days_before"),
1559
+ value: "_isDay",
1560
+ "model-value": e(i).operator,
1561
+ "onUpdate:modelValue": l[6] || (l[6] = () => {
1562
+ b(
1563
+ {
1564
+ op: "after",
1565
+ x: 1,
1566
+ ignoreYear: !0
1567
+ },
1568
+ "_isDay"
1569
+ );
1570
+ })
1571
+ }, null, 8, ["label", "model-value"]),
1572
+ U("div", gt, [
1573
+ c(m, {
1574
+ label: e(t)("connect.template.rule.preset_modal.is_in_this"),
1575
+ value: "_isRange",
1576
+ "model-value": e(i).operator,
1577
+ "onUpdate:modelValue": l[7] || (l[7] = () => {
1578
+ b(
1579
+ {
1580
+ op: "this",
1581
+ unit: "day",
1582
+ ignoreYear: !0
1583
+ },
1584
+ "_isRange"
1585
+ );
1586
+ })
1587
+ }, null, 8, ["label", "model-value"]),
1588
+ e(i).operator == "_isRange" ? (n(), f(Y, {
1589
+ key: 0,
1590
+ items: e(D),
1591
+ "model-value": e(i).equator.unit,
1592
+ "onUpdate:modelValue": l[8] || (l[8] = (h) => b(
1593
+ {
1594
+ op: "this",
1595
+ unit: h,
1596
+ ignoreYear: !0
1597
+ },
1598
+ "_isRange"
1599
+ ))
1600
+ }, null, 8, ["items", "model-value"])) : N("", !0)
1601
+ ])
1602
+ ]),
1603
+ e(i).operator == "_isDay" ? (n(), f(y, {
1604
+ key: 0,
1605
+ label: e(t)("connect.template.rule.birthday.days_before_label"),
1606
+ "show-steppers": !1,
1607
+ "model-value": e(i).equator.x,
1608
+ "onUpdate:modelValue": l[9] || (l[9] = (h) => b({
1609
+ op: "after",
1610
+ x: h,
1611
+ ignoreYear: !0
1612
+ }))
1613
+ }, null, 8, ["label", "model-value"])) : N("", !0)
1614
+ ], 64)) : o.preset == "TIER" ? (n(), V(q, { key: 7 }, [
1615
+ c(oe, {
1616
+ inline: !0,
1617
+ "model-value": e(i).operator,
1618
+ "onUpdate:modelValue": l[10] || (l[10] = (h) => b(e(i).equator, h))
1619
+ }, {
1620
+ default: B(() => [
1621
+ c(m, {
1622
+ value: "_moreThanOrEqual",
1623
+ label: e(t)("connect.template.rule.preset_modal.at_least")
1624
+ }, null, 8, ["label"]),
1625
+ c(m, {
1626
+ value: "_equal",
1627
+ label: e(t)("connect.template.rule.preset_modal.equal")
1628
+ }, null, 8, ["label"]),
1629
+ c(m, {
1630
+ value: "_lessThanOrEqual",
1631
+ label: e(t)("connect.template.rule.preset_modal.at_most")
1632
+ }, null, 8, ["label"])
1633
+ ]),
1634
+ _: 1
1635
+ }, 8, ["model-value"]),
1636
+ c(w, {
1637
+ items: (e(v).sortedTiers ?? []).map((h, z) => ({
1638
+ label: `Tier ${z + 1} - ${h.name}`,
1639
+ value: z + 1
1640
+ })),
1641
+ "model-value": e(i).equator,
1642
+ "onUpdate:modelValue": l[11] || (l[11] = (h) => b(h))
1643
+ }, null, 8, ["items", "model-value"]),
1644
+ c(J, {
1645
+ text: s()
1646
+ }, null, 8, ["text"])
1647
+ ], 64)) : o.preset == "TITLE" ? (n(), f(w, {
1648
+ key: 8,
1649
+ label: e(t)("connect.template.rule.preset_modal.user_has_title"),
1650
+ items: (e(v).sortedTitles ?? []).map((h) => ({
1651
+ label: h.name,
1652
+ value: h._id
1653
+ })),
1654
+ "model-value": (Q = e(i).equator) == null ? void 0 : Q[0],
1655
+ "onUpdate:modelValue": l[12] || (l[12] = (h) => b([h]))
1656
+ }, null, 8, ["label", "items", "model-value"])) : N("", !0),
1657
+ c(J, {
1658
+ class: "mt-[-8px]",
1659
+ text: e(le).helperText(e(R), ""),
1660
+ state: e(le).helperState(e(R), "")
1661
+ }, null, 8, ["text", "state"]),
1662
+ U("div", _t, [
1663
+ c(ee, {
1664
+ onClick: l[13] || (l[13] = (h) => e(x).close()),
1665
+ label: e(t)("connect.common.cancel"),
1666
+ variant: "tertiary"
1667
+ }, null, 8, ["label"]),
1668
+ c(ee, {
1669
+ onClick: l[14] || (l[14] = (h) => k()),
1670
+ disabled: e(R).length > 0,
1671
+ label: e(t)("connect.common.save")
1672
+ }, null, 8, ["disabled", "label"])
1673
+ ])
1674
+ ]);
1675
+ };
1676
+ }
1677
+ }), ht = /* @__PURE__ */ P({
1678
+ __name: "RuleConfigurator",
1679
+ props: {
1680
+ triggerType: {
1681
+ type: String,
1682
+ required: !0
1683
+ },
1684
+ includeOnly: {
1685
+ type: String
1686
+ },
1687
+ modelValue: {
1688
+ type: Object,
1689
+ default: () => {
1690
+ }
1691
+ }
1692
+ },
1693
+ emits: ["update:model-value"],
1694
+ setup(o, { expose: x, emit: g }) {
1695
+ const u = te(), { t: v, te: t } = G(), a = {
1696
+ "Minimum spend": "connect.template.rule.preset.minimum_spend",
1697
+ "Specific date": "connect.template.rule.preset.specific_date",
1698
+ "Specific time range": "connect.template.rule.preset.specific_time_range",
1699
+ Weekly: "connect.template.rule.preset.weekly",
1700
+ Monthly: "connect.template.rule.preset.monthly",
1701
+ Birthday: "connect.template.rule.preset.birthday",
1702
+ "Birthday Week": "connect.template.rule.preset.birthday_week",
1703
+ "Birthday Month": "connect.template.rule.preset.birthday_month",
1704
+ "N day before birthday": "connect.template.rule.preset.n_day_before_birthday",
1705
+ "Specific tier": "connect.template.rule.preset.specific_tier",
1706
+ "Specific title": "connect.template.rule.preset.specific_title",
1707
+ "Last visit in X days": "connect.template.rule.preset.last_visit_in_x_days",
1708
+ "Weekday special": "connect.template.rule.preset.weekday_special",
1709
+ "Weekend special": "connect.template.rule.preset.weekend_special",
1710
+ "Happy hour": "connect.template.rule.preset.happy_hour",
1711
+ "Mother's day special": "connect.template.rule.preset.mothers_day_special",
1712
+ "Father's day special": "connect.template.rule.preset.fathers_day_special",
1713
+ Christmas: "connect.template.rule.preset.christmas",
1714
+ "Feedback rating": "connect.template.rule.preset.feedback_rating",
1715
+ Custom: "connect.template.rule.preset.custom"
1716
+ }, s = o, r = g, E = ue(), i = W();
1717
+ function b(d) {
1718
+ const [l] = d.rules;
1719
+ E.open({
1720
+ title: D(d),
1721
+ closeButton: !1,
1722
+ dismissAway: !1,
1723
+ contentComponent: kt,
1724
+ contentComponentProps: {
1725
+ preset: d.type,
1726
+ defaultValue: l,
1727
+ modelValue: s.modelValue
1728
+ }
1729
+ }).onPrimary((y) => r("update:model-value", y));
1730
+ }
1731
+ function k(d) {
1732
+ E.open({
1733
+ title: v("connect.template.rule.edit_rule"),
1734
+ closeButton: !1,
1735
+ dismissAway: !1,
1736
+ contentComponent: vt,
1737
+ contentComponentProps: {
1738
+ triggerType: s.triggerType,
1739
+ includeOnly: s.includeOnly,
1740
+ modelValue: d
1741
+ }
1742
+ }).onPrimary((l) => r("update:model-value", l));
1743
+ }
1744
+ function R(d) {
1745
+ if (d.type == "CUSTOM") {
1746
+ const [l] = d.rules;
1747
+ return k(
1748
+ O.constructEntry(l.property, l.operator, l.equator)
1749
+ );
1750
+ }
1751
+ return b(d);
1752
+ }
1753
+ function D(d) {
1754
+ const l = a[d.name];
1755
+ return l && t(l) ? v(l) : d.name;
1756
+ }
1757
+ return x({
1758
+ showCustomDialog: k
1759
+ }), (d, l) => {
1760
+ const y = _("FmButton"), p = _("FmPill"), C = _("FmMenuItem"), m = _("FmMenu");
1761
+ return n(), f(m, {
1762
+ shift: !0,
1763
+ placement: "top-start"
1764
+ }, {
1765
+ "menu-button": B(() => [
1766
+ c(y, {
1767
+ label: e(v)("connect.template.rule.add_condition"),
1768
+ icon: "add",
1769
+ class: "text-fm-color-primary border-fm-color-primary",
1770
+ "icon-color": "primary",
1771
+ variant: "secondary"
1772
+ }, null, 8, ["label"])
1773
+ ]),
1774
+ default: B(() => [
1775
+ (n(!0), V(q, null, $(e(qe).filter(
1776
+ (Y) => !o.includeOnly || Y.for.includes(o.includeOnly)
1777
+ ), (Y) => (n(), f(C, {
1778
+ key: Y.name,
1779
+ "model-value": Y.name == e(i),
1780
+ label: D(Y),
1781
+ onClick: () => {
1782
+ Y != null && Y.premium && !e(u).isPremium || R(Y);
1783
+ },
1784
+ disabled: (Y == null ? void 0 : Y.premium) && !e(u).isPremium
1785
+ }, ce({ _: 2 }, [
1786
+ Y != null && Y.premium ? {
1787
+ name: "append",
1788
+ fn: B(() => [
1789
+ c(p, { variant: "premium" })
1790
+ ]),
1791
+ key: "0"
1792
+ } : void 0
1793
+ ]), 1032, ["model-value", "label", "onClick", "disabled"]))), 128))
1794
+ ]),
1795
+ _: 1
1796
+ });
1797
+ };
1798
+ }
1799
+ }), Et = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, $t = /* @__PURE__ */ P({
1800
+ __name: "RuleGroup",
1801
+ props: {
1802
+ triggerType: {
1803
+ type: String,
1804
+ required: !0
1805
+ },
1806
+ includeOnly: {
1807
+ type: String
1808
+ },
1809
+ modelValue: {
1810
+ type: Object
1811
+ }
1812
+ },
1813
+ emits: ["update:model-value"],
1814
+ setup(o, { emit: x }) {
1815
+ const g = o, u = x, v = Te(), { t } = G(), a = M(
1816
+ () => g.modelValue ?? O.scaffoldGroup()
1817
+ ), s = M(() => O.getLogic(a.value)), r = M(() => [
1818
+ { label: t("connect.template.rule.and"), value: "&&" },
1819
+ { label: t("connect.template.rule.or"), value: "||" }
1820
+ ]), E = W();
1821
+ function i(b, k) {
1822
+ try {
1823
+ const R = O.setRuleToGroup(b, k);
1824
+ O.isRuleExceed(b, k), u("update:model-value", R);
1825
+ } catch (R) {
1826
+ v.open({
1827
+ message: R.message,
1828
+ type: "error"
1829
+ });
1830
+ }
1831
+ }
1832
+ return (b, k) => {
1833
+ const R = _("FmButtonGroup"), D = _("FmCard");
1834
+ return n(), f(D, { variant: "outlined" }, {
1835
+ default: B(() => [
1836
+ c(D, { class: "border-l-4 border-fm-color-primary p-16 space-y-16" }, {
1837
+ default: B(() => [
1838
+ U("div", Et, A(e(t)("connect.template.rule.when")), 1),
1839
+ c(ht, {
1840
+ ref_key: "configuratorRef",
1841
+ ref: E,
1842
+ "include-only": o.includeOnly,
1843
+ "trigger-type": o.triggerType,
1844
+ "onUpdate:modelValue": k[0] || (k[0] = (d) => i(e(a), d))
1845
+ }, null, 8, ["include-only", "trigger-type"]),
1846
+ (n(!0), V(q, null, $(e(a).rules, (d, l) => {
1847
+ var y;
1848
+ return n(), V(q, null, [
1849
+ e(Ve)(d) ? (n(), f(De, {
1850
+ "model-value": d,
1851
+ key: l,
1852
+ onEdit: (y = e(E)) == null ? void 0 : y.showCustomDialog,
1853
+ onRemove: k[1] || (k[1] = (p) => {
1854
+ u(
1855
+ "update:model-value",
1856
+ e(O).removeEntry(e(a), p.name)
1857
+ );
1858
+ })
1859
+ }, null, 8, ["model-value", "onEdit"])) : N("", !0),
1860
+ c(R, {
1861
+ class: "w-[200px]",
1862
+ disabled: Object.keys(e(a).rules).length < 2,
1863
+ items: e(r),
1864
+ "model-value": e(r).find((p) => p.value === e(s)) ?? null,
1865
+ "onUpdate:modelValue": k[2] || (k[2] = (p) => u(
1866
+ "update:model-value",
1867
+ e(O).setRuleToGroup(
1868
+ e(a),
1869
+ [],
1870
+ p.value
1871
+ )
1872
+ ))
1873
+ }, null, 8, ["disabled", "items", "model-value"])
1874
+ ], 64);
1875
+ }), 256))
1876
+ ]),
1877
+ _: 1
1878
+ })
1879
+ ]),
1880
+ _: 1
1881
+ });
1882
+ };
1883
+ }
1884
+ });
1885
+ export {
1886
+ $t as _,
1887
+ re as a
1888
+ };