@feedmepos/mf-connect 0.1.38-beta.6 → 0.1.38-beta.61

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 (148) hide show
  1. package/dist/{Analytic-NBx32reB.js → Analytic-CM7mh-iO.js} +16 -16
  2. package/dist/{App-CaK9PvMd.js → App-CeCzzsDu.js} +625 -619
  3. package/dist/AuditLogs-VWx8DFKA.js +1991 -0
  4. package/dist/{Bin-CL6o1JSs.js → Bin-vUuol_I9.js} +10 -10
  5. package/dist/Broadcast-6VXz4-IG.js +233 -0
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BIySMYGP.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CV-zhJ15.js} +6 -6
  7. package/dist/{Card-DNdEjt6s.js → Card-CeIeGET1.js} +144 -140
  8. package/dist/Collections-CF_OcAL3.js +540 -0
  9. package/dist/Credit-BUqGOyp_.js +226 -0
  10. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +128 -0
  11. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-BUzUIIUW.js → DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js} +1 -1
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-0DMFuBoG.js +3150 -0
  13. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-BZfchHlT.js +347 -0
  14. package/dist/Experience-BxiFH_uV.js +225 -0
  15. package/dist/{FileSaver.min-NlMItPOc.js → FileSaver.min-lgg_oBvT.js} +1 -1
  16. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +129 -0
  17. package/dist/Game-BzYW0LfY.js +300 -0
  18. package/dist/GenerateMaterial-B5A7mx2y.js +589 -0
  19. package/dist/Grab-BgiMqwvj.js +301 -0
  20. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js → ImageInput.vue_vue_type_script_setup_true_lang-DZ8DHrQ_.js} +49 -48
  21. package/dist/{Index-2wokhhFB.js → Index-B85ops8K.js} +54 -54
  22. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js → LottieAnimation.vue_vue_type_script_setup_true_lang-B5rIjxYd.js} +1 -1
  23. package/dist/{MainLayout-B1aJoR95.js → MainLayout-CXGVkD-W.js} +1 -1
  24. package/dist/Marketing-Bnijl7lA.js +145 -0
  25. package/dist/MarketingMaterialEdit-BlUKwSoP.js +746 -0
  26. package/dist/{Member-2xV4Izwa.js → Member-sT853g51.js} +38 -37
  27. package/dist/{MemberList-CYgBdyJt.js → MemberList-DYT5_fSP.js} +158 -159
  28. package/dist/{MemberTransactions-DWDV01N4.js → MemberTransactions-Cqce5ebe.js} +1 -1
  29. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-Becsw31k.js → MessageInput.vue_vue_type_script_setup_true_lang-Dq0Hswj8.js} +5940 -5668
  30. package/dist/Mission-Q5_sGgrm.js +304 -0
  31. package/dist/{Overview-BZjto86d.js → Overview-B0rwrHR1.js} +24 -25
  32. package/dist/Point-BGYFMvev.js +228 -0
  33. package/dist/Promotion-0acd63nA.js +364 -0
  34. package/dist/{Queue-D62r2qjy.js → Queue-SVqRUlD_.js} +14 -15
  35. package/dist/{Record-0iF3dG7y.js → Record-BTjg4ihy.js} +10 -10
  36. package/dist/{Reward-C5IEJYu6.js → Reward-DW58VMRO.js} +16 -16
  37. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-S2Fd0qO8.js → RewardGroup.vue_vue_type_script_setup_true_lang-s1RI55Rc.js} +13 -14
  38. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Os17lXBX.js +1766 -0
  39. package/dist/{Segment-BknjBrUP.js → Segment-Dny8pxP1.js} +273 -274
  40. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-BLQlkp-j.js → SelectItems.vue_vue_type_script_setup_true_lang-Czx7rqiq.js} +12 -12
  41. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-CaPi4hYB.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-EgVxUG_N.js} +12 -12
  42. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-BoZ0ZpNZ.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-CO0fgI3K.js} +4 -4
  43. package/dist/Setting-CjcnxK34.js +1992 -0
  44. package/dist/SettingAdvertisements-CIyDF4C8.js +263 -0
  45. package/dist/Store-B8k5YVqU.js +1934 -0
  46. package/dist/StoreRewards-BW08rwpL.js +534 -0
  47. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BfFSfE2H.js +1034 -0
  48. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-CZkKjUNQ.js +8093 -0
  49. package/dist/{Tier-B168DtFj.js → Tier-DKzu4tYw.js} +561 -480
  50. package/dist/{Title-uH0RI1N3.js → Title-BK-TXatJ.js} +149 -147
  51. package/dist/{Transaction-Bx-pmLrJ.js → Transaction-Duayg1jd.js} +2 -2
  52. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-Ce_55V7l.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-BAR9h1TV.js} +7 -7
  53. package/dist/{Voucher-Dzpz2AEB.js → Voucher-BEVAkNeJ.js} +140 -124
  54. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DvFy9Z6X.js +421 -0
  55. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-CfLiUj9f.js → ZodTextField.vue_vue_type_script_setup_true_lang-CU_Sx2PM.js} +2 -2
  56. package/dist/app-IvbII0ql.js +45026 -0
  57. package/dist/app.js +1 -1
  58. package/dist/{business-B65OtB5B.js → business-BFIwFfkq.js} +11 -8
  59. package/dist/campaign-RuIwxc4y.js +253 -0
  60. package/dist/{campaign-qGy6uzrC.js → campaign-w9j4I4jn.js} +29 -25
  61. package/dist/{campaign.enum-CZp2DmXI.js → campaign.enum-IHLsfdik.js} +3 -2
  62. package/dist/campaign.fn-B_P1MkRV.js +776 -0
  63. package/dist/{collectible.enum-CN-lnG1m.js → collectible.enum-CUgSjO08.js} +1 -1
  64. package/dist/{collection.fn-mMwGQWce.js → collection.fn-CrfnNb41.js} +2 -2
  65. package/dist/dto-jwO_sX9I.js +222 -0
  66. package/dist/{effect-Bg3yb9T6.js → effect--0g8PNyt.js} +1 -1
  67. package/dist/{email-addresses-CQsN724N.js → email-addresses-HtsxvXw9.js} +2 -2
  68. package/dist/{export-BLf2dhFd.js → export-CFEwMRmd.js} +9 -10
  69. package/dist/{helper-CFaph16Q.js → helper-CCfb24PO.js} +22 -7
  70. package/dist/index-B-AMMFfT.js +3419 -0
  71. package/dist/{index-BPyac0fq.js → index-BR3UbZ0F.js} +1 -1
  72. package/dist/{index-Dy5p_b1S.js → index-BZEM0T2A.js} +1 -1
  73. package/dist/index-Bflu4Rft.js +8884 -0
  74. package/dist/{index-Dkmn0jmX.js → index-CR3f3BXQ.js} +2552 -2356
  75. package/dist/{index-BkySejFg.js → index-CZPcwcUo.js} +3 -3
  76. package/dist/{index-BPZtjcTm.js → index-CkuPY85X.js} +1 -1
  77. package/dist/index-CppLPpqB.js +30933 -0
  78. package/dist/index-CuvNtC_M.js +61 -0
  79. package/dist/{index-BKOgzVx6.js → index-DDYH-IEX.js} +1 -1
  80. package/dist/{index-DaEQgaiW.js → index-DdZdHioZ.js} +455 -245
  81. package/dist/{index-BBPIZjw6.js → index-Dic_WcAL.js} +3 -3
  82. package/dist/{index-CH2d_B8c.js → index-DpjYgKTN.js} +4 -1
  83. package/dist/index-wzSeRJAd.js +36 -0
  84. package/dist/{index.esm2017-B9vJTKYg.js → index.esm2017-CUnjzfU-.js} +89 -89
  85. package/dist/loading-CivgDw5C.js +215 -0
  86. package/dist/{lodash-B5I3zXaY.js → lodash-BSbv_9TG.js} +1 -1
  87. package/dist/{membership-Du79A0Pl.js → membership-j2w1YUO-.js} +3 -3
  88. package/dist/{moment-BWErdI6_.js → moment-D7p2TMB-.js} +6 -1
  89. package/dist/{money-DXgYs2-R.js → money-DL-x8hiT.js} +1 -1
  90. package/dist/{number-CBMkNZvH.js → number-D1yoFGEr.js} +1 -1
  91. package/dist/objectid-CHab6j3r.js +145 -0
  92. package/dist/{campaign-iKI-L84v.js → plugins-P-V4XWmW.js} +784 -777
  93. package/dist/remy-D_Deb3ue.js +13 -0
  94. package/dist/{reward-ClX_lWcQ.js → reward-BqMlBQRu.js} +1 -1
  95. package/dist/{rule-BfidJ75Y.js → rule-CztsLdki.js} +4 -4
  96. package/dist/rule-builder-DANv7Rmz.js +102 -0
  97. package/dist/style.css +11 -2
  98. package/dist/template-Dbz3FhHK.js +188 -0
  99. package/dist/timezone-BgVqObBq.js +1151 -0
  100. package/dist/trigger-CbriUibd.js +213 -0
  101. package/dist/usePagination-DtNK7W0U.js +223 -0
  102. package/dist/user-CVapqHfr.js +55 -0
  103. package/dist/vue-i18n-tpDAnnmD.js +2365 -0
  104. package/dist/{xlsx-Be4bARvl.js → xlsx-EewcN2uY.js} +1 -1
  105. package/dist/{zod-Bg2FbC-D.js → zod-D-wiCQRJ.js} +32 -31
  106. package/package.json +13 -5
  107. package/dist/AuditLogs-C-gCCPvF.js +0 -1887
  108. package/dist/Broadcast-B2-itjvZ.js +0 -227
  109. package/dist/Collections-DepGq6WJ.js +0 -465
  110. package/dist/Credit-D7K0gFwc.js +0 -222
  111. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +0 -108
  112. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-HMjbuy2C.js +0 -2185
  113. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-DrbMJlm5.js +0 -347
  114. package/dist/Experience-FlBX3eyN.js +0 -223
  115. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-d8rh38tD.js +0 -114
  116. package/dist/Game-Cc3D7lKV.js +0 -278
  117. package/dist/Marketing-D7PXYloN.js +0 -20073
  118. package/dist/Mission-BSGc9822.js +0 -296
  119. package/dist/Point-0U4TTdPW.js +0 -226
  120. package/dist/Promotion-DiUa0GcV.js +0 -289
  121. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CxlamGFP.js +0 -1751
  122. package/dist/Setting-RLI7RgmN.js +0 -1936
  123. package/dist/Store-gxmv8hWJ.js +0 -1842
  124. package/dist/StoreRewards-C_6gY_Nk.js +0 -423
  125. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-B5uzSYM4.js +0 -1029
  126. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-yjI96ZL0.js +0 -139
  127. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-dbA6_6b9.js +0 -419
  128. package/dist/_commonjsHelpers-BkfeUUK-.js +0 -28
  129. package/dist/app-B90wINOO.js +0 -33357
  130. package/dist/app-DuUxQ1ZP.js +0 -7086
  131. package/dist/campaign.fn-DKScnmjX.js +0 -758
  132. package/dist/dto-C5ri8Nws.js +0 -214
  133. package/dist/index-BCGDOgxb.js +0 -38
  134. package/dist/index-BCPBmANe.js +0 -3120
  135. package/dist/index-BN2Uyvj4.js +0 -30038
  136. package/dist/index-CrbnfAk8.js +0 -8861
  137. package/dist/index-CsaQJMAR.js +0 -66
  138. package/dist/index-DJwQICyC.js +0 -146
  139. package/dist/loading-MEQuW9Xa.js +0 -71
  140. package/dist/objectid-BeZTZYqi.js +0 -145
  141. package/dist/plugins-KiMuDTPp.js +0 -208
  142. package/dist/remy-vue-client-Cpppk9h-.js +0 -1693
  143. package/dist/rule-builder-BTcZx77a.js +0 -89
  144. package/dist/template-DPpMK30W.js +0 -190
  145. package/dist/trigger-DLp1bkZP.js +0 -144
  146. package/dist/usePagination-BeF5K3M7.js +0 -223
  147. package/dist/user-Cq9CGBHZ.js +0 -54
  148. package/dist/vue-i18n-COzqUgQy.js +0 -2365
@@ -0,0 +1,1766 @@
1
+ import { defineComponent as A, computed as B, resolveComponent as k, openBlock as n, createElementBlock as T, createElementVNode as C, createVNode as b, unref as e, createTextVNode as te, toDisplayString as $, withCtx as q, onMounted as z, createBlock as g, createCommentVNode as M, ref as L, Fragment as h, renderList as N, normalizeClass as W, watch as pe, resolveDynamicComponent as ae, onBeforeMount as ue, isRef as ye, createSlots as se } from "vue";
2
+ import { m as ce, C as ve, n as be, a as fe, o as ge } from "./index-Bflu4Rft.js";
3
+ import { R as D, a as ke } from "./rule-builder-DANv7Rmz.js";
4
+ import { useDialog as le, useDialogChild as ie, useSnackbar as Ve } from "@feedmepos/ui-library";
5
+ import { u as me } from "./vue-i18n-tpDAnnmD.js";
6
+ import { a as Ee, R, S as Te, C as H, W as Se, T as re, O as ne } from "./rule-CztsLdki.js";
7
+ import { p as Fe } from "./plugins-P-V4XWmW.js";
8
+ import { h as J } from "./moment-D7p2TMB-.js";
9
+ import { z as Ue } from "./app-IvbII0ql.js";
10
+ import { u as Q } from "./membership-j2w1YUO-.js";
11
+ import { u as X } from "./business-BFIwFfkq.js";
12
+ import "./index-CR3f3BXQ.js";
13
+ import { _ as O } from "./CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js";
14
+ import { c as de } from "./object-qECH92oz.js";
15
+ import { Z } from "./zod-D-wiCQRJ.js";
16
+ import { _ as xe } from "./SelectItems.vue_vue_type_script_setup_true_lang-Czx7rqiq.js";
17
+ import "./index-DdZdHioZ.js";
18
+ import "./index-B-AMMFfT.js";
19
+ import "./index-CZPcwcUo.js";
20
+ const Re = { class: "flex items-center justify-between" }, Ye = { class: "flex items-center gap-8 xs:flex-wrap" }, Ce = { class: "text-fm-color-primary line-clamp-1 text-ellipsis" }, De = /* @__PURE__ */ A({
21
+ __name: "RuleEntry",
22
+ props: {
23
+ modelValue: {
24
+ type: Object,
25
+ required: !0
26
+ }
27
+ },
28
+ emits: ["edit", "remove"],
29
+ setup(l, { emit: Y }) {
30
+ const c = l, i = B(() => {
31
+ const [u, y] = Object.entries(c.modelValue.conditions)[0];
32
+ return {
33
+ negated: c.modelValue.negated == !0,
34
+ property: c.modelValue.property,
35
+ operator: u,
36
+ equator: y
37
+ };
38
+ }), o = Y, d = B(
39
+ () => Ee(
40
+ i.value.property,
41
+ i.value.operator,
42
+ i.value.equator,
43
+ i.value.negated
44
+ )
45
+ );
46
+ async function t(u) {
47
+ u.stopPropagation(), await Fe.remove("Are you sure you want to remove this rule?") && o("remove", c.modelValue);
48
+ }
49
+ return (u, y) => {
50
+ var m;
51
+ const p = k("FmChip"), f = k("FmTooltip"), S = k("FmIcon");
52
+ return n(), T("div", Re, [
53
+ C("div", Ye, [
54
+ b(p, {
55
+ label: (m = e(ce).find((v) => v.property === c.modelValue.property)) == null ? void 0 : m.name,
56
+ class: "!text-fm-color-typo-info !bg-fm-color-system-info-100"
57
+ }, null, 8, ["label"]),
58
+ y[1] || (y[1] = C("div", { class: "h-[26px] border-l-2 rounded-md border-fm-color-neutral-gray-100" }, null, -1)),
59
+ C("div", {
60
+ onClick: y[0] || (y[0] = (v) => o("edit", c.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
+ te($(e(d)[0]) + " ", 1),
64
+ b(f, {
65
+ "z-index": 1e3,
66
+ content: e(d)[1]
67
+ }, {
68
+ default: q(() => [
69
+ C("div", Ce, $(e(d)[1]), 1)
70
+ ]),
71
+ _: 1
72
+ }, 8, ["content"])
73
+ ])
74
+ ]),
75
+ b(S, {
76
+ name: "close",
77
+ size: "md",
78
+ class: "cursor-pointer hover:bg-neutral-300 rounded-lg",
79
+ onClick: t
80
+ })
81
+ ]);
82
+ };
83
+ }
84
+ });
85
+ 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 Oe = [
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: J().format("YYYY-MM-DD")
344
+ }
345
+ ]
346
+ }
347
+ ], we = { class: "flex flex-nowrap gap-x-4 items-center" }, he = /* @__PURE__ */ A({
348
+ __name: "IsDayInput",
349
+ props: {
350
+ modelValue: {
351
+ type: Object
352
+ }
353
+ },
354
+ emits: ["update:model-value"],
355
+ setup(l, { emit: Y }) {
356
+ const c = l, i = Y;
357
+ z(() => {
358
+ c.modelValue || i("update:model-value", {
359
+ op: "before",
360
+ x: 1
361
+ });
362
+ });
363
+ function o(d) {
364
+ const t = de(
365
+ c.modelValue ?? {
366
+ op: "before",
367
+ x: 1
368
+ }
369
+ );
370
+ i("update:model-value", {
371
+ ...t,
372
+ ...d
373
+ });
374
+ }
375
+ return (d, t) => {
376
+ var y, p, f;
377
+ const u = k("FmStepperField");
378
+ return n(), T("div", we, [
379
+ b(u, {
380
+ class: "w-1/3",
381
+ "model-value": ((y = l.modelValue) == null ? void 0 : y.x) ?? null,
382
+ max: 365,
383
+ "show-steppers": !1,
384
+ "append-text": "days",
385
+ "onUpdate:modelValue": t[0] || (t[0] = (S) => o({ x: S }))
386
+ }, null, 8, ["model-value"]),
387
+ b(O, {
388
+ "model-value": ((p = l.modelValue) == null ? void 0 : p.op) ?? void 0,
389
+ items: [
390
+ { label: "before", value: "before" },
391
+ { label: "after", value: "after" }
392
+ ],
393
+ "onUpdate:modelValue": t[1] || (t[1] = (S) => o({ op: S }))
394
+ }, null, 8, ["model-value"]),
395
+ b(O, {
396
+ "model-value": ((f = l.modelValue) == null ? void 0 : f.ignoreYear) ?? !1,
397
+ items: [
398
+ { label: "same year", value: !1 },
399
+ { label: "ignore year", value: !0 }
400
+ ],
401
+ required: !0,
402
+ "onUpdate:modelValue": t[2] || (t[2] = (S) => o({ ignoreYear: S == !0 }))
403
+ }, null, 8, ["model-value"])
404
+ ]);
405
+ };
406
+ }
407
+ }), qe = { class: "grid grid-cols-4 gap-x-4 items-center" }, Ie = /* @__PURE__ */ A({
408
+ __name: "IsRangeInput",
409
+ props: {
410
+ modelValue: {
411
+ type: Object,
412
+ default: () => ({
413
+ op: "this",
414
+ unit: "day",
415
+ ignoreYear: !0
416
+ })
417
+ }
418
+ },
419
+ emits: ["update:model-value"],
420
+ setup(l, { emit: Y }) {
421
+ const c = l, i = Y;
422
+ z(() => {
423
+ c.modelValue || i("update:model-value", {
424
+ op: "this",
425
+ unit: "day",
426
+ ignoreYear: !0
427
+ });
428
+ });
429
+ const o = [
430
+ { label: "day", value: "day" },
431
+ { label: "week", value: "week" },
432
+ { label: "month", value: "month" },
433
+ { label: "quarter", value: "quarter" },
434
+ { label: "year", value: "year" }
435
+ ], d = [
436
+ {
437
+ label: "this",
438
+ value: "this"
439
+ },
440
+ {
441
+ label: "last",
442
+ value: "last"
443
+ },
444
+ {
445
+ label: "next",
446
+ value: "next"
447
+ }
448
+ ];
449
+ return (t, u) => {
450
+ var p, f, S, m, v;
451
+ const y = k("FmStepperField");
452
+ return n(), T("div", qe, [
453
+ b(O, {
454
+ "model-value": (p = l.modelValue) == null ? void 0 : p.op,
455
+ label: "",
456
+ items: d,
457
+ required: !0,
458
+ "onUpdate:modelValue": u[0] || (u[0] = (s) => i("update:model-value", { op: s, unit: "day", ignoreYear: !1 }))
459
+ }, null, 8, ["model-value"]),
460
+ ((f = l.modelValue) == null ? void 0 : f.op) != "this" ? (n(), g(y, {
461
+ key: 0,
462
+ "model-value": ((S = l.modelValue) == null ? void 0 : S.x) || 0,
463
+ max: 365,
464
+ "show-steppers": !1,
465
+ "onUpdate:modelValue": u[1] || (u[1] = (s) => i("update:model-value", {
466
+ op: l.modelValue.op,
467
+ unit: l.modelValue.unit,
468
+ ignoreYear: l.modelValue.ignoreYear == !0,
469
+ x: s
470
+ }))
471
+ }, null, 8, ["model-value"])) : M("", !0),
472
+ b(O, {
473
+ "model-value": (m = l.modelValue) == null ? void 0 : m.unit,
474
+ label: "",
475
+ items: o,
476
+ required: !0,
477
+ "onUpdate:modelValue": u[2] || (u[2] = (s) => i("update:model-value", { ...c.modelValue, unit: s }))
478
+ }, null, 8, ["model-value"]),
479
+ b(O, {
480
+ label: "",
481
+ "model-value": (v = l.modelValue) == null ? void 0 : v.ignoreYear,
482
+ items: [
483
+ { label: "same", value: !1 },
484
+ { label: "ignore", value: !0 }
485
+ ],
486
+ required: !0,
487
+ "onUpdate:modelValue": u[3] || (u[3] = (s) => i("update:model-value", {
488
+ ...c.modelValue,
489
+ ignoreYear: s == !0
490
+ }))
491
+ }, null, 8, ["model-value"])
492
+ ]);
493
+ };
494
+ }
495
+ }), Be = { class: "space-y-8" }, Me = { class: "text-fm-color-primary rounded-md border-dashed border-2 p-8" }, Ae = {
496
+ key: 0,
497
+ class: "flex items-center gap-8"
498
+ }, Ne = { class: "flex gap-4" }, Pe = {
499
+ key: 0,
500
+ class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
501
+ }, $e = ["onClick"], Le = {
502
+ key: 1,
503
+ class: "flex items-center gap-8"
504
+ }, He = { class: "flex gap-4 xs:gap-[2px]" }, We = { class: "grid grid-cols-6 gap-8" }, _e = {
505
+ key: 0,
506
+ class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
507
+ }, je = ["onClick"], Ke = {
508
+ key: 1,
509
+ class: "grid grid-cols-2 items-center gap-8"
510
+ }, Ge = { class: "flex gap-4" }, Qe = {
511
+ key: 4,
512
+ class: "flex items-center justify-end gap-8"
513
+ }, ee = /* @__PURE__ */ A({
514
+ __name: "RruleInput",
515
+ props: {
516
+ modelValue: {
517
+ type: String
518
+ },
519
+ startDate: {
520
+ type: Object
521
+ },
522
+ applyButton: {
523
+ type: Boolean
524
+ },
525
+ fixedFrequency: {
526
+ type: Boolean
527
+ }
528
+ },
529
+ emits: ["update:model-value", "cancel"],
530
+ setup(l, { emit: Y }) {
531
+ const c = l, i = Y, o = L(
532
+ c.modelValue ? R.fromString(c.modelValue) : new R({
533
+ dtstart: c.startDate,
534
+ freq: R.DAILY,
535
+ wkst: R.SU,
536
+ interval: 1,
537
+ byhour: 0,
538
+ byminute: 0,
539
+ bysecond: 0
540
+ })
541
+ );
542
+ function d(t) {
543
+ var u;
544
+ if ("freq" in t)
545
+ switch (t.freq) {
546
+ case R.WEEKLY:
547
+ o.value = new R({
548
+ dtstart: c.startDate,
549
+ freq: t.freq,
550
+ interval: 1,
551
+ byhour: 0,
552
+ byminute: 0,
553
+ bysecond: 0,
554
+ wkst: R.SU,
555
+ byweekday: [R.MO]
556
+ });
557
+ break;
558
+ case R.MONTHLY:
559
+ o.value = new R({
560
+ dtstart: c.startDate,
561
+ freq: t.freq,
562
+ interval: 1,
563
+ byhour: 0,
564
+ byminute: 0,
565
+ bysecond: 0,
566
+ bymonthday: [(/* @__PURE__ */ new Date()).getDate()],
567
+ wkst: R.SU
568
+ });
569
+ break;
570
+ case R.YEARLY:
571
+ o.value = new R({
572
+ dtstart: c.startDate,
573
+ freq: t.freq,
574
+ interval: 1,
575
+ byhour: 0,
576
+ byminute: 0,
577
+ bysecond: 0,
578
+ wkst: R.SU,
579
+ bymonth: [(/* @__PURE__ */ new Date()).getMonth() + 1],
580
+ bymonthday: [(/* @__PURE__ */ new Date()).getDate()]
581
+ });
582
+ break;
583
+ default:
584
+ o.value = new R({
585
+ dtstart: c.startDate,
586
+ freq: t.freq,
587
+ interval: 1,
588
+ byhour: 0,
589
+ byminute: 0,
590
+ bysecond: 0,
591
+ wkst: R.SU
592
+ });
593
+ }
594
+ t.interval && t.interval > 0 && (o.value = new R({
595
+ ...o.value.origOptions,
596
+ dtstart: c.startDate,
597
+ interval: t.interval
598
+ })), "byweekday" in t && t.byweekday && Array.isArray(t.byweekday) && t.byweekday.length > 0 && (o.value.options.bymonthday.length > 0 && o.value.options.freq == R.MONTHLY && (o.value.options.bymonthday = []), o.value = new R({
599
+ ...o.value.origOptions,
600
+ dtstart: c.startDate,
601
+ bymonthday: [],
602
+ byweekday: t.byweekday
603
+ })), "bysetpos" in t && t.bysetpos != null && (o.value = new R({
604
+ ...o.value.origOptions,
605
+ dtstart: c.startDate,
606
+ bymonthday: [],
607
+ bysetpos: t.bysetpos,
608
+ byweekday: ((u = o.value.options.byweekday) == null ? void 0 : u.length) > 0 ? o.value.options.byweekday : [6]
609
+ })), "bymonthday" in t && t.bymonthday && Array.isArray(t.bymonthday) && t.bymonthday.length > 0 && (o.value = new R({
610
+ ...o.value.origOptions,
611
+ dtstart: c.startDate,
612
+ bysetpos: [],
613
+ byweekday: [],
614
+ bymonthday: t.bymonthday
615
+ })), "bymonth" in t && t.bymonth && Array.isArray(t.bymonth) && t.bymonth.length > 0 && (o.value = new R({
616
+ ...o.value.origOptions,
617
+ dtstart: c.startDate,
618
+ bysetpos: [],
619
+ bymonth: t.bymonth
620
+ })), "bynweekday" in t && t.bynweekday && (o.value = new R({
621
+ ...o.value.origOptions,
622
+ dtstart: c.startDate,
623
+ bysetpos: [],
624
+ byweekday: new Se(
625
+ t.bynweekday[0][0],
626
+ t.bynweekday[0][1]
627
+ )
628
+ })), c.applyButton || i("update:model-value", o.value.toString());
629
+ }
630
+ return z(() => {
631
+ c.modelValue || i(
632
+ "update:model-value",
633
+ new R({
634
+ dtstart: c.startDate,
635
+ freq: R.DAILY,
636
+ wkst: R.SU,
637
+ interval: 1,
638
+ byhour: 0,
639
+ byminute: 0,
640
+ bysecond: 0
641
+ }).toString()
642
+ );
643
+ }), (t, u) => {
644
+ var m, v, s;
645
+ const y = k("FmStepperField"), p = k("FmChip"), f = k("FmButtonGroup"), S = k("FmButton");
646
+ return n(), T("div", Be, [
647
+ C("div", Me, $(e(Te)(e(o).options)), 1),
648
+ l.fixedFrequency ? M("", !0) : (n(), T("div", Ae, [
649
+ u[8] || (u[8] = C("div", null, "Repeat every", -1)),
650
+ b(y, {
651
+ class: "w-[100px]",
652
+ "model-value": e(o).options.interval,
653
+ "onUpdate:modelValue": u[0] || (u[0] = (a) => d({ interval: a > 0 ? a : e(o).options.interval })),
654
+ min: 1
655
+ }, null, 8, ["model-value"]),
656
+ b(O, {
657
+ class: "w-min",
658
+ items: e(H).frequencies,
659
+ "model-value": e(o).origOptions.freq,
660
+ "onUpdate:modelValue": u[1] || (u[1] = (a) => d({ freq: a }))
661
+ }, null, 8, ["items", "model-value"])
662
+ ])),
663
+ e(o).options.freq === e(R).WEEKLY ? (n(), T(h, { key: 1 }, [
664
+ u[9] || (u[9] = C("div", null, "Repeat on", -1)),
665
+ C("div", Ne, [
666
+ (n(!0), T(h, null, N(e(H).weekdays, (a) => {
667
+ var F;
668
+ return n(), g(p, {
669
+ class: W(["cursor-pointer", `${(F = e(o).options.byweekday) != null && F.includes(a.value) ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
670
+ label: a.label[0],
671
+ key: a.value,
672
+ compact: !0,
673
+ onClick: () => {
674
+ var x, V;
675
+ d({
676
+ byweekday: (x = e(o).options.byweekday) != null && x.includes(a.value) ? ((V = e(o).options.byweekday) == null ? void 0 : V.filter((U) => U !== a.value)) || [] : [...e(o).options.byweekday || [], a.value]
677
+ });
678
+ }
679
+ }, null, 8, ["class", "label", "onClick"]);
680
+ }), 128))
681
+ ])
682
+ ], 64)) : M("", !0),
683
+ e(o).options.freq == e(R).MONTHLY ? (n(), T(h, { key: 2 }, [
684
+ b(f, {
685
+ "model-value": e(o).options.bymonthday.length ? { label: "Each" } : { label: "On the" },
686
+ items: [
687
+ {
688
+ label: "Each"
689
+ },
690
+ {
691
+ label: "On the"
692
+ }
693
+ ],
694
+ "onUpdate:modelValue": u[2] || (u[2] = (a) => {
695
+ a.label == "Each" ? d({ bymonthday: [1] }) : d({ bysetpos: 1 });
696
+ })
697
+ }, null, 8, ["model-value"]),
698
+ e(o).options.bymonthday.length > 0 ? (n(), T("div", Pe, [
699
+ (n(!0), T(h, null, N(e(H).dates, (a) => (n(), T("div", {
700
+ key: a.value,
701
+ class: W(["cursor-pointer text-center outline-1 outline-fm-color-neutral-gray-100 outline", `${e(o).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" : ""}`]),
702
+ onClick: (F) => d({
703
+ bymonthday: e(o).options.bymonthday.includes(a.value) ? e(o).options.bymonthday.filter((x) => x !== a.value) : [...e(o).options.bymonthday, a.value]
704
+ })
705
+ }, $(a.value), 11, $e))), 128))
706
+ ])) : (n(), T("div", Le, [
707
+ b(O, {
708
+ items: e(H).ordinals,
709
+ "model-value": (m = e(o).options.bysetpos) == null ? void 0 : m[0],
710
+ "onUpdate:modelValue": u[3] || (u[3] = (a) => d({ bysetpos: a }))
711
+ }, null, 8, ["items", "model-value"]),
712
+ C("div", He, [
713
+ (n(!0), T(h, null, N(e(H).weekdays, (a) => {
714
+ var F;
715
+ return n(), g(p, {
716
+ class: W(["cursor-pointer", `${(F = e(o).options.byweekday) != null && F.includes(a.value) ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
717
+ label: a.label[0],
718
+ key: a.value,
719
+ compact: !0,
720
+ onClick: () => {
721
+ d({
722
+ byweekday: [a.value]
723
+ });
724
+ }
725
+ }, null, 8, ["class", "label", "onClick"]);
726
+ }), 128))
727
+ ])
728
+ ]))
729
+ ], 64)) : M("", !0),
730
+ e(o).options.freq == e(R).YEARLY ? (n(), T(h, { key: 3 }, [
731
+ u[10] || (u[10] = C("div", null, "Month", -1)),
732
+ C("div", We, [
733
+ (n(!0), T(h, null, N(e(H).months, (a) => {
734
+ var F, x;
735
+ return n(), g(p, {
736
+ key: a.value,
737
+ class: W(["cursor-pointer", {
738
+ "bg-fm-color-primary text-white": (F = e(o).options.bymonth) == null ? void 0 : F.includes(
739
+ a.value
740
+ ),
741
+ "bg-fm-color-gray-200 text-fm-color-gray-800": !((x = e(o).options.bymonth) != null && x.includes(a.value))
742
+ }]),
743
+ label: a.shortName,
744
+ compact: !0,
745
+ onClick: (V) => d({
746
+ bymonth: (e(o).options.bymonth ?? []).includes(a.value) ? (e(o).options.bymonth ?? []).filter((U) => U !== a.value) : [...e(o).options.bymonth ?? [], a.value]
747
+ })
748
+ }, null, 8, ["class", "label", "onClick"]);
749
+ }), 128))
750
+ ]),
751
+ b(f, {
752
+ "model-value": e(o).options.bymonthday.length ? { label: "Each" } : { label: "On the" },
753
+ items: [
754
+ {
755
+ label: "Each"
756
+ },
757
+ {
758
+ label: "On the"
759
+ }
760
+ ],
761
+ "onUpdate:modelValue": u[4] || (u[4] = (a) => {
762
+ a.label == "Each" ? d({
763
+ bymonthday: [1],
764
+ bymonth: e(o).options.bymonth ?? [1]
765
+ }) : d({
766
+ byweekday: [e(R).SU.nth(1)],
767
+ bymonth: e(o).options.bymonth ?? [1]
768
+ });
769
+ })
770
+ }, null, 8, ["model-value"]),
771
+ e(o).options.bymonthday.length > 0 ? (n(), T("div", _e, [
772
+ (n(!0), T(h, null, N(Array(31).fill(null).map((a, F) => F + 1), (a) => (n(), T("div", {
773
+ key: a,
774
+ class: W(["cursor-pointer text-center outline-1 outline-fm-color-neutral-gray-100 outline", `${e(o).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" : ""}`]),
775
+ onClick: (F) => d({
776
+ bymonthday: e(o).options.bymonthday.includes(a) ? e(o).options.bymonthday.filter((x) => x !== a) : [...e(o).options.bymonthday, a]
777
+ })
778
+ }, $(a), 11, je))), 128))
779
+ ])) : (n(), T("div", Ke, [
780
+ b(O, {
781
+ items: e(H).ordinals,
782
+ "model-value": (s = (v = e(o).options.bynweekday) == null ? void 0 : v[0]) == null ? void 0 : s[1],
783
+ "onUpdate:modelValue": u[5] || (u[5] = (a) => {
784
+ var F, x;
785
+ return d({
786
+ bynweekday: [[((x = (F = e(o).options.bynweekday) == null ? void 0 : F[0]) == null ? void 0 : x[0]) ?? 1, a]]
787
+ });
788
+ })
789
+ }, null, 8, ["items", "model-value"]),
790
+ C("div", Ge, [
791
+ (n(!0), T(h, null, N(e(H).weekdays, (a) => {
792
+ var F, x;
793
+ return n(), g(p, {
794
+ class: W(["cursor-pointer", `${((x = (F = e(o).options.bynweekday) == null ? void 0 : F[0]) == null ? void 0 : x[0]) === a.value ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
795
+ label: a.label[0],
796
+ key: a.value,
797
+ compact: !0,
798
+ onClick: () => {
799
+ var V, U;
800
+ d({
801
+ bynweekday: [
802
+ [a.value, ((U = (V = e(o).options.bynweekday) == null ? void 0 : V[0]) == null ? void 0 : U[1]) ?? 1]
803
+ ]
804
+ });
805
+ }
806
+ }, null, 8, ["class", "label", "onClick"]);
807
+ }), 128))
808
+ ])
809
+ ]))
810
+ ], 64)) : M("", !0),
811
+ l.applyButton ? (n(), T("div", Qe, [
812
+ b(S, {
813
+ label: "Cancel",
814
+ variant: "tertiary",
815
+ onClick: u[6] || (u[6] = (a) => i("cancel"))
816
+ }),
817
+ b(S, {
818
+ label: "Apply",
819
+ onClick: u[7] || (u[7] = (a) => i("update:model-value", e(o).toString()))
820
+ })
821
+ ])) : M("", !0)
822
+ ]);
823
+ };
824
+ }
825
+ }), ze = { class: "grid grid-cols-4 gap-8 w-full flex-wrap py-16" }, Xe = /* @__PURE__ */ A({
826
+ __name: "IsInMonthInput",
827
+ props: {
828
+ modelValue: {
829
+ type: Object,
830
+ required: !0
831
+ }
832
+ },
833
+ emits: ["update:model-value"],
834
+ setup(l, { emit: Y }) {
835
+ const c = l, i = Y, o = J.months().map((d, t) => ({
836
+ name: d,
837
+ shortName: J().month(t).format("MMM"),
838
+ value: t
839
+ }));
840
+ return z(() => {
841
+ c.modelValue || i("update:model-value", []);
842
+ }), (d, t) => {
843
+ const u = k("FmChip");
844
+ return n(), T("div", ze, [
845
+ (n(!0), T(h, null, N(e(o), (y) => {
846
+ var p, f;
847
+ return n(), g(u, {
848
+ class: W(["cursor-pointer", {
849
+ "bg-fm-color-primary text-white": (p = l.modelValue) == null ? void 0 : p.includes(y.value),
850
+ "bg-fm-color-gray-200 text-fm-color-gray-800": !((f = l.modelValue) != null && f.includes(
851
+ y.value
852
+ ))
853
+ }]),
854
+ label: y.name,
855
+ key: y.value,
856
+ compact: !0,
857
+ onClick: (S) => i(
858
+ "update:model-value",
859
+ l.modelValue.includes(y.value) ? l.modelValue.filter((m) => m !== y.value) : [...l.modelValue, y.value]
860
+ )
861
+ }, null, 8, ["class", "label", "onClick"]);
862
+ }), 128))
863
+ ]);
864
+ };
865
+ }
866
+ }), Ze = { class: "" }, Je = { class: "flex justify-end gap-8 w-full" }, et = /* @__PURE__ */ A({
867
+ __name: "MenuDialog",
868
+ props: {
869
+ modelValue: { type: Boolean },
870
+ initialValue: {},
871
+ filterItems: { type: Function }
872
+ },
873
+ emits: ["update:model-value", "confirm"],
874
+ setup(l, { emit: Y }) {
875
+ const c = l, i = L(), o = L(!1), d = Y;
876
+ function t() {
877
+ var y;
878
+ (y = i.value) == null || y.onConfirm(), d("update:model-value", !1);
879
+ }
880
+ function u() {
881
+ d("update:model-value", !1);
882
+ }
883
+ return pe(
884
+ () => c.modelValue,
885
+ (y) => {
886
+ o.value = y;
887
+ }
888
+ ), z(() => {
889
+ o.value = c.modelValue;
890
+ }), (y, p) => {
891
+ const f = k("FmButton"), S = k("FmDialog");
892
+ return n(), g(S, {
893
+ "content-scrollable": !1,
894
+ contentClass: "pt-0",
895
+ modelValue: o.value,
896
+ "onUpdate:modelValue": p[0] || (p[0] = (m) => o.value = m),
897
+ title: "Select Items",
898
+ "close-button": !1
899
+ }, {
900
+ "dialog-header": q(() => [...p[1] || (p[1] = [
901
+ C("div", null, "Select Item", -1)
902
+ ])]),
903
+ "dialog-footer": q(() => [
904
+ C("div", Je, [
905
+ b(f, {
906
+ variant: "tertiary",
907
+ onClick: u,
908
+ label: "Cancel"
909
+ }),
910
+ b(f, {
911
+ variant: "primary",
912
+ onClick: t,
913
+ label: "Confirm"
914
+ })
915
+ ])
916
+ ]),
917
+ default: q(() => [
918
+ C("div", Ze, [
919
+ b(xe, {
920
+ ref_key: "selectItemRef",
921
+ ref: i,
922
+ "initial-value": l.initialValue,
923
+ "filter-items": l.filterItems,
924
+ "on-complete": (m) => {
925
+ d("confirm", m), u();
926
+ }
927
+ }, null, 8, ["initial-value", "filter-items", "on-complete"])
928
+ ])
929
+ ]),
930
+ _: 1
931
+ }, 8, ["modelValue"]);
932
+ };
933
+ }
934
+ }), tt = { id: "select-menu" }, lt = /* @__PURE__ */ A({
935
+ __name: "SelectMenu",
936
+ props: {
937
+ modelValue: {}
938
+ },
939
+ emits: ["update:model-value"],
940
+ setup(l, { emit: Y }) {
941
+ const c = l, i = L(!1), o = B(() => {
942
+ var u;
943
+ return ((u = c.modelValue) == null ? void 0 : u.length) || 0;
944
+ }), d = Y;
945
+ function t(u) {
946
+ d("update:model-value", u);
947
+ }
948
+ return (u, y) => {
949
+ const p = k("FmField");
950
+ return n(), T("div", tt, [
951
+ b(p, {
952
+ class: "text-fm-color-typo-tertiary",
953
+ onClick: y[0] || (y[0] = (f) => i.value = !0)
954
+ }, {
955
+ default: q(() => [
956
+ te($(o.value) + " item(s) selected ", 1)
957
+ ]),
958
+ _: 1
959
+ }),
960
+ b(et, {
961
+ modelValue: i.value,
962
+ "onUpdate:modelValue": [
963
+ y[1] || (y[1] = (f) => i.value = f),
964
+ y[2] || (y[2] = (f) => i.value = f)
965
+ ],
966
+ "initial-value": l.modelValue,
967
+ onConfirm: t
968
+ }, null, 8, ["modelValue", "initial-value"])
969
+ ]);
970
+ };
971
+ }
972
+ }), ot = {
973
+ key: 19,
974
+ class: "fm-typo-en-body-lg-600"
975
+ }, at = /* @__PURE__ */ A({
976
+ __name: "RuleEquator",
977
+ props: {
978
+ type: {
979
+ type: String,
980
+ required: !0
981
+ },
982
+ operator: {
983
+ type: String,
984
+ required: !0
985
+ },
986
+ modelValue: {
987
+ type: Object
988
+ }
989
+ },
990
+ emits: ["update:model-value"],
991
+ setup(l, { emit: Y }) {
992
+ const c = l, i = Y, o = B(() => {
993
+ const d = ve[c.operator].safeParse(c.modelValue);
994
+ return d.success ? [] : d.error.errors;
995
+ });
996
+ return (d, t) => {
997
+ var s, a, F, x, V, U;
998
+ const u = k("FmTextField"), y = k("FmStepperField"), p = k("FmSimpleDatePicker"), f = k("FmSimpleDateRangePicker"), S = k("FmTimeRangePicker"), m = k("FmTimePicker"), v = k("FmHelperText");
999
+ return n(), T("div", {
1000
+ class: W({ "pb-4": e(o).length })
1001
+ }, [
1002
+ l.type === "text" ? (n(), g(u, {
1003
+ key: 0,
1004
+ "model-value": l.modelValue,
1005
+ "onUpdate:modelValue": t[0] || (t[0] = (r) => i("update:model-value", r))
1006
+ }, null, 8, ["model-value"])) : l.type === "number" ? (n(), g(y, {
1007
+ key: 1,
1008
+ "model-value": l.modelValue,
1009
+ "onUpdate:modelValue": t[1] || (t[1] = (r) => i("update:model-value", r))
1010
+ }, null, 8, ["model-value"])) : l.operator == "_isDay" ? (n(), g(ae(he), {
1011
+ key: 2,
1012
+ "model-value": l.modelValue,
1013
+ "onUpdate:modelValue": t[2] || (t[2] = (r) => i("update:model-value", r))
1014
+ }, null, 8, ["model-value"])) : l.operator == "_isRange" ? (n(), g(ae(Ie), {
1015
+ key: 3,
1016
+ "model-value": l.modelValue,
1017
+ "onUpdate:modelValue": t[3] || (t[3] = (r) => i("update:model-value", r))
1018
+ }, null, 8, ["model-value"])) : l.operator == "_isOnDate" ? (n(), g(p, {
1019
+ key: 4,
1020
+ "model-value": l.modelValue,
1021
+ "onUpdate:modelValue": t[4] || (t[4] = (r) => i("update:model-value", r))
1022
+ }, null, 8, ["model-value"])) : l.operator == "_isBetween" ? (n(), g(f, {
1023
+ key: 5,
1024
+ "model-value": {
1025
+ startDate: (s = l.modelValue) == null ? void 0 : s.start,
1026
+ endDate: (a = l.modelValue) == null ? void 0 : a.end
1027
+ },
1028
+ "onUpdate:modelValue": t[5] || (t[5] = (r) => {
1029
+ i("update:model-value", {
1030
+ start: r.startDate,
1031
+ end: r.endDate
1032
+ });
1033
+ })
1034
+ }, null, 8, ["model-value"])) : l.operator == "_isInMonth" ? (n(), g(Xe, {
1035
+ key: 6,
1036
+ "model-value": l.modelValue,
1037
+ "onUpdate:modelValue": t[6] || (t[6] = (r) => i("update:model-value", r))
1038
+ }, null, 8, ["model-value"])) : l.operator == "_rrule" ? (n(), g(ee, {
1039
+ key: 7,
1040
+ "model-value": l.modelValue,
1041
+ "onUpdate:modelValue": t[7] || (t[7] = (r) => i("update:model-value", r))
1042
+ }, null, 8, ["model-value"])) : l.operator == "_isBetweenTime" ? (n(), g(S, {
1043
+ key: 8,
1044
+ "disable-time-check": !0,
1045
+ "model-value": [(x = (F = l.modelValue) == null ? void 0 : F[0]) == null ? void 0 : x.start, (U = (V = l.modelValue) == null ? void 0 : V[0]) == null ? void 0 : U.end],
1046
+ "onUpdate:modelValue": t[8] || (t[8] = (r) => i("update:model-value", [
1047
+ {
1048
+ start: r[0],
1049
+ end: r[1]
1050
+ }
1051
+ ]))
1052
+ }, null, 8, ["model-value"])) : l.operator == "_isOnTime" ? (n(), g(m, {
1053
+ key: 9,
1054
+ "model-value": l.modelValue,
1055
+ "onUpdate:modelValue": t[9] || (t[9] = (r) => i("update:model-value", r))
1056
+ }, null, 8, ["model-value"])) : l.type == "tier" ? (n(), g(O, {
1057
+ key: 10,
1058
+ items: (e(Q)().sortedTiers ?? []).map((r, I) => ({
1059
+ label: `Tier ${I + 1} - ${r.name}`,
1060
+ value: I + 1
1061
+ })),
1062
+ "model-value": l.modelValue,
1063
+ "onUpdate:modelValue": t[10] || (t[10] = (r) => i("update:model-value", r))
1064
+ }, null, 8, ["items", "model-value"])) : l.type == "boolean" ? (n(), g(O, {
1065
+ key: 11,
1066
+ multiselect: !0,
1067
+ items: [
1068
+ { label: "true", value: !0 },
1069
+ { label: "false", value: !1 }
1070
+ ],
1071
+ "model-value": l.modelValue ?? [],
1072
+ "onUpdate:modelValue": t[11] || (t[11] = (r) => i("update:model-value", r))
1073
+ }, null, 8, ["model-value"])) : l.type == "exist" ? (n(), g(O, {
1074
+ key: 12,
1075
+ items: [
1076
+ { label: "true", value: "true" },
1077
+ { label: "false", value: "false" }
1078
+ ],
1079
+ "model-value": l.modelValue ?? [],
1080
+ "onUpdate:modelValue": t[12] || (t[12] = (r) => i("update:model-value", r))
1081
+ }, null, 8, ["model-value"])) : l.type == "gender" ? (n(), g(O, {
1082
+ key: 13,
1083
+ multiselect: !0,
1084
+ items: [
1085
+ { label: "Male", value: "MALE" },
1086
+ { label: "Female", value: "FEMALE" }
1087
+ ],
1088
+ "model-value": l.modelValue ?? [],
1089
+ "onUpdate:modelValue": t[13] || (t[13] = (r) => i("update:model-value", r))
1090
+ }, null, 8, ["model-value"])) : l.type == "collectible" ? (n(), g(O, {
1091
+ key: 14,
1092
+ multiselect: !0,
1093
+ items: [],
1094
+ "model-value": l.modelValue ?? [],
1095
+ "onUpdate:modelValue": t[14] || (t[14] = (r) => i("update:model-value", r))
1096
+ }, null, 8, ["model-value"])) : l.type == "segment" ? (n(), g(O, {
1097
+ key: 15,
1098
+ multiselect: !0,
1099
+ items: e(Q)().segmentOptions,
1100
+ "model-value": l.modelValue ?? [],
1101
+ "onUpdate:modelValue": t[15] || (t[15] = (r) => i("update:model-value", r)),
1102
+ label: "Select segment(s) to match"
1103
+ }, null, 8, ["items", "model-value"])) : l.type == "title" ? (n(), g(O, {
1104
+ key: 16,
1105
+ multiselect: !0,
1106
+ items: (e(Q)().sortedTitles ?? []).map((r) => ({
1107
+ label: r.name,
1108
+ value: r._id
1109
+ })),
1110
+ "model-value": l.modelValue ?? [],
1111
+ "onUpdate:modelValue": t[16] || (t[16] = (r) => i("update:model-value", r))
1112
+ }, null, 8, ["items", "model-value"])) : l.type == "product" ? (n(), g(lt, {
1113
+ key: 17,
1114
+ "model-value": l.modelValue,
1115
+ "onUpdate:modelValue": t[17] || (t[17] = (r) => i("update:model-value", r))
1116
+ }, null, 8, ["model-value"])) : l.type == "location" ? (n(), g(O, {
1117
+ key: 18,
1118
+ multiselect: !0,
1119
+ items: e(X)().locations.map((r) => ({
1120
+ label: r.name,
1121
+ value: r._id
1122
+ })),
1123
+ "model-value": l.modelValue ?? [],
1124
+ "onUpdate:modelValue": t[18] || (t[18] = (r) => i("update:model-value", r))
1125
+ }, null, 8, ["items", "model-value"])) : (n(), T("div", ot, "Rule: " + $(l.type) + " Not implemented", 1)),
1126
+ b(v, {
1127
+ class: "items-end",
1128
+ state: e(Z).helperState(e(o), ""),
1129
+ text: e(Z).helperText(e(o), "")
1130
+ }, null, 8, ["state", "text"])
1131
+ ], 2);
1132
+ };
1133
+ }
1134
+ }), rt = { class: "space-y-4" }, nt = { class: "flex items-center gap-8" }, ut = { class: "flex items-center justify-end gap-8 pt-16 w-full" }, st = /* @__PURE__ */ A({
1135
+ __name: "CustomRuleDialog",
1136
+ props: {
1137
+ triggerType: {
1138
+ type: String,
1139
+ required: !0
1140
+ },
1141
+ includeOnly: {
1142
+ type: String
1143
+ },
1144
+ modelValue: {
1145
+ type: Object,
1146
+ default: () => {
1147
+ }
1148
+ }
1149
+ },
1150
+ setup(l) {
1151
+ const Y = le(), c = Q(), { emitData: i, emitAction: o } = ie(), d = l, t = B(
1152
+ () => be(d.triggerType, d.includeOnly)
1153
+ ), u = (U) => re[t.value.find((r) => r.property === U).type], y = B(() => {
1154
+ if (!m.value) return [];
1155
+ const U = t.value.find(
1156
+ (r) => r.property === m.value.property
1157
+ );
1158
+ return U ? re[U.type].filter((r) => {
1159
+ var I, P;
1160
+ return !((P = (I = ne[r]) == null ? void 0 : I.exclude) != null && P.includes(m.value.property));
1161
+ }).map((r) => ({
1162
+ label: ne[r].name,
1163
+ value: r
1164
+ })) : [];
1165
+ }), p = fe, f = B(() => {
1166
+ const U = p.safeParse(m.value);
1167
+ return U.success ? [] : U.error.errors;
1168
+ }), S = L(!1), m = L(
1169
+ de(d.modelValue) ?? D.constructEntry(
1170
+ t.value[0].property,
1171
+ u(t.value[0].property)[0],
1172
+ null
1173
+ )
1174
+ ), v = B(() => {
1175
+ var _;
1176
+ const { property: U, negated: r, conditions: I } = m.value, P = Object.keys(I || {})[0], j = Object.values(I || {})[0];
1177
+ return {
1178
+ property: U,
1179
+ negated: r == !0,
1180
+ type: (_ = t.value.find((K) => K.property === U)) == null ? void 0 : _.type,
1181
+ operator: P,
1182
+ equator: j
1183
+ };
1184
+ });
1185
+ function s(U) {
1186
+ m.value = D.constructEntry(
1187
+ U,
1188
+ u(U)[0],
1189
+ null
1190
+ );
1191
+ }
1192
+ function a(U) {
1193
+ m.value = { ...m.value, negated: U == !0 };
1194
+ }
1195
+ function F(U) {
1196
+ m.value = {
1197
+ ...m.value,
1198
+ conditions: { [U]: null }
1199
+ };
1200
+ }
1201
+ function x(U) {
1202
+ m.value.conditions = {
1203
+ [v.value.operator]: U
1204
+ };
1205
+ }
1206
+ function V() {
1207
+ i(m.value), o("primary"), Y.close();
1208
+ }
1209
+ return ue(async () => {
1210
+ await c.readMembership();
1211
+ }), (U, r) => {
1212
+ const I = k("FmIcon"), P = k("FmField"), j = k("FmPill"), _ = k("FmMenuItem"), K = k("FmMenu"), G = k("FmButton");
1213
+ return n(), T("div", rt, [
1214
+ r[5] || (r[5] = C("div", { class: "fm-typo-en-body-lg-400" }, "Property", -1)),
1215
+ b(K, {
1216
+ shift: !0,
1217
+ placement: "bottom-start",
1218
+ modelValue: e(S),
1219
+ "onUpdate:modelValue": r[0] || (r[0] = (w) => ye(S) ? S.value = w : null),
1220
+ onMenuChanged: r[1] || (r[1] = (w) => S.value = w),
1221
+ "max-height": 300
1222
+ }, {
1223
+ "menu-button": q(() => [
1224
+ b(P, null, {
1225
+ append: q(() => [
1226
+ b(I, {
1227
+ name: e(S) ? "expand_less" : "expand_more"
1228
+ }, null, 8, ["name"])
1229
+ ]),
1230
+ default: q(() => {
1231
+ var w;
1232
+ return [
1233
+ te($((w = e(t).find((E) => E.property == e(m).property)) == null ? void 0 : w.name) + " ", 1)
1234
+ ];
1235
+ }),
1236
+ _: 1
1237
+ })
1238
+ ]),
1239
+ default: q(() => [
1240
+ (n(!0), T(h, null, N(e(t), (w) => (n(), g(_, {
1241
+ key: w.property,
1242
+ "model-value": e(m).property == w.property,
1243
+ label: w.name,
1244
+ disabled: w.premium && !e(X)().isPremium,
1245
+ onClick: (E) => w.premium && !e(X)().isPremium ? null : s(w.property)
1246
+ }, se({ _: 2 }, [
1247
+ w.premium ? {
1248
+ name: "append",
1249
+ fn: q(() => [
1250
+ b(j, { variant: "premium" })
1251
+ ]),
1252
+ key: "0"
1253
+ } : void 0
1254
+ ]), 1032, ["model-value", "label", "disabled", "onClick"]))), 128))
1255
+ ]),
1256
+ _: 1
1257
+ }, 8, ["modelValue"]),
1258
+ r[6] || (r[6] = C("div", { class: "fm-typo-en-body-lg-400" }, "Check to perform", -1)),
1259
+ C("div", nt, [
1260
+ b(O, {
1261
+ class: "w-1/4",
1262
+ items: [
1263
+ { label: "is", value: !1 },
1264
+ { label: "is not", value: !0 }
1265
+ ],
1266
+ "model-value": e(m).negated ?? !1,
1267
+ "onUpdate:modelValue": a
1268
+ }, null, 8, ["model-value"]),
1269
+ b(O, {
1270
+ class: "flex-1",
1271
+ items: e(y),
1272
+ "model-value": e(v).operator,
1273
+ "onUpdate:modelValue": F
1274
+ }, null, 8, ["items", "model-value"])
1275
+ ]),
1276
+ C("div", null, [
1277
+ r[4] || (r[4] = C("div", { class: "fm-typo-en-body-lg-400" }, "Criteria", -1)),
1278
+ e(v).type ? (n(), g(at, {
1279
+ key: 0,
1280
+ type: e(v).type,
1281
+ operator: e(v).operator,
1282
+ "model-value": e(v).equator,
1283
+ "onUpdate:modelValue": x
1284
+ }, null, 8, ["type", "operator", "model-value"])) : M("", !0)
1285
+ ]),
1286
+ C("div", ut, [
1287
+ b(G, {
1288
+ onClick: r[2] || (r[2] = (w) => e(Y).close()),
1289
+ label: "Cancel",
1290
+ variant: "tertiary"
1291
+ }),
1292
+ b(G, {
1293
+ onClick: r[3] || (r[3] = (w) => V()),
1294
+ disabled: e(f).length > 0,
1295
+ label: "Save"
1296
+ }, null, 8, ["disabled"])
1297
+ ])
1298
+ ]);
1299
+ };
1300
+ }
1301
+ }), it = { class: "flex flex-col gap-8" }, mt = { class: "grid grid-cols-2 items-center" }, dt = { class: "flex items-center gap-8" }, pt = { class: "pt-16 flex items-center self-end gap-8" }, yt = /* @__PURE__ */ A({
1302
+ __name: "PresetRuleDialog",
1303
+ props: {
1304
+ preset: {
1305
+ type: String,
1306
+ required: !0
1307
+ },
1308
+ defaultValue: {
1309
+ type: Object
1310
+ },
1311
+ modelValue: {
1312
+ type: Object
1313
+ }
1314
+ },
1315
+ setup(l) {
1316
+ const Y = le(), { emitData: c, emitAction: i } = ie(), o = Q(), d = l;
1317
+ function t() {
1318
+ const { operator: v, equator: s } = p.value;
1319
+ switch (d.preset) {
1320
+ case "MIN_SPEND":
1321
+ case "SPECIFIC_DATE":
1322
+ case "SPECIFIC_TIMERANGE":
1323
+ case "WEEKLY":
1324
+ case "MONTHLY":
1325
+ case "BIRTHDAY":
1326
+ case "TIER":
1327
+ return `Applies to ${o.sortedTiers.filter((F, x) => v == "_equal" ? x + 1 == s : v == "_moreThanOrEqual" ? x + 1 >= s : x + 1 <= s).map((F) => F.name).join(", ")}`;
1328
+ }
1329
+ }
1330
+ function u() {
1331
+ var v, s;
1332
+ switch (d.preset) {
1333
+ case "MIN_SPEND":
1334
+ return D.constructEntry("bill.amount", "_moreThanOrEqual", 0);
1335
+ case "SPECIFIC_DATE":
1336
+ return D.constructEntry(
1337
+ "trigger.date",
1338
+ "_isOnDate",
1339
+ (/* @__PURE__ */ new Date()).toISOString()
1340
+ );
1341
+ case "SPECIFIC_TIMERANGE":
1342
+ return D.constructEntry("trigger.time", "_isBetweenTime", [
1343
+ { start: "00:00", end: "23:59" }
1344
+ ]);
1345
+ case "WEEKLY":
1346
+ return D.constructEntry(
1347
+ "trigger.date",
1348
+ "_rrule",
1349
+ "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1350
+ );
1351
+ case "MONTHLY":
1352
+ return D.constructEntry(
1353
+ "trigger.date",
1354
+ "_rrule",
1355
+ "RRULE:FREQ=MONTHLY;WKST=SU;BYMONTHDAY=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1356
+ );
1357
+ case "BIRTHDAY":
1358
+ console.log("birthday", d);
1359
+ const a = D.constructEntry(
1360
+ d.defaultValue.property,
1361
+ d.defaultValue.operator,
1362
+ d.defaultValue.equator
1363
+ );
1364
+ return console.log(a), a;
1365
+ case "TIER":
1366
+ return D.constructEntry("user.tier", "_equal", 1);
1367
+ case "TITLE":
1368
+ return D.constructEntry("user.titles", "_hasAny", [
1369
+ (s = (v = o.sortedTitles) == null ? void 0 : v[0]) == null ? void 0 : s._id
1370
+ ]);
1371
+ case "LAST_X_DAY":
1372
+ return D.constructEntry("user.stats.lastVisit", "_isRange", {
1373
+ op: "last",
1374
+ unit: "day",
1375
+ ignoreYear: !0,
1376
+ x: 0
1377
+ });
1378
+ case "CUSTOM":
1379
+ throw new Error("Not implemented");
1380
+ }
1381
+ }
1382
+ const y = L(u()), p = B(() => {
1383
+ const v = D.simplify(y.value);
1384
+ return {
1385
+ ...v,
1386
+ equator: v.equator
1387
+ };
1388
+ });
1389
+ function f(v, s) {
1390
+ const a = p.value;
1391
+ y.value = D.constructEntry(
1392
+ a.property,
1393
+ s ?? a.operator,
1394
+ v,
1395
+ y.value.name
1396
+ );
1397
+ }
1398
+ function S() {
1399
+ c(y.value), i("primary"), Y.close();
1400
+ }
1401
+ const m = B(() => {
1402
+ const v = ge.safeParse(y.value);
1403
+ return v.success ? [] : v.error.errors;
1404
+ });
1405
+ return ue(async () => {
1406
+ await o.readMembership();
1407
+ }), (v, s) => {
1408
+ var j, _, K, G, w;
1409
+ const a = k("FmStepperField"), F = k("FmDatePicker"), x = k("FmTimeRangePicker"), V = k("FmRadio"), U = k("FmSelect"), r = k("FmRadioGroup"), I = k("FmHelperText"), P = k("FmButton");
1410
+ return n(), T("div", it, [
1411
+ l.preset == "MIN_SPEND" ? (n(), g(a, {
1412
+ key: 0,
1413
+ label: "Minimum spend",
1414
+ "model-value": e(p).equator,
1415
+ "onUpdate:modelValue": s[0] || (s[0] = (E) => f(E))
1416
+ }, null, 8, ["model-value"])) : M("", !0),
1417
+ l.preset == "LAST_X_DAY" ? (n(), g(a, {
1418
+ key: 1,
1419
+ label: "",
1420
+ min: 0,
1421
+ prepent: "Day(s)",
1422
+ "model-value": e(p).equator.x,
1423
+ rules: [(E) => E >= 0 || "Value must be greater than 0"],
1424
+ "onUpdate:modelValue": s[1] || (s[1] = (E) => f({
1425
+ op: "last",
1426
+ unit: "day",
1427
+ ignoreYear: !0,
1428
+ x: E
1429
+ }))
1430
+ }, null, 8, ["model-value", "rules"])) : l.preset == "SPECIFIC_DATE" ? (n(), g(F, {
1431
+ key: 2,
1432
+ label: "Specific Date",
1433
+ "model-value": e(p).equator,
1434
+ "onUpdate:modelValue": s[2] || (s[2] = (E) => f(E))
1435
+ }, null, 8, ["model-value"])) : l.preset == "SPECIFIC_TIMERANGE" ? (n(), g(x, {
1436
+ key: 3,
1437
+ label: "Time is between",
1438
+ "disable-time-check": !0,
1439
+ "model-value": [(_ = (j = e(p).equator) == null ? void 0 : j[0]) == null ? void 0 : _.start, (G = (K = e(p).equator) == null ? void 0 : K[0]) == null ? void 0 : G.end],
1440
+ "onUpdate:modelValue": s[3] || (s[3] = (E) => f([
1441
+ {
1442
+ start: E[0],
1443
+ end: E[1]
1444
+ }
1445
+ ]))
1446
+ }, null, 8, ["model-value"])) : l.preset == "WEEKLY" ? (n(), g(ee, {
1447
+ key: 4,
1448
+ label: "Weekly",
1449
+ "fixed-frequency": !0,
1450
+ "model-value": e(p).equator,
1451
+ "onUpdate:modelValue": s[4] || (s[4] = (E) => f(E))
1452
+ }, null, 8, ["model-value"])) : l.preset == "MONTHLY" ? (n(), g(ee, {
1453
+ key: 5,
1454
+ label: "Weekly",
1455
+ "fixed-frequency": !0,
1456
+ "model-value": e(p).equator,
1457
+ "onUpdate:modelValue": s[5] || (s[5] = (E) => f(E))
1458
+ }, null, 8, ["model-value"])) : l.preset == "BIRTHDAY" ? (n(), T(h, { key: 6 }, [
1459
+ C("div", mt, [
1460
+ b(V, {
1461
+ label: "N days before birthday",
1462
+ value: "_isDay",
1463
+ "model-value": e(p).operator,
1464
+ "onUpdate:modelValue": s[6] || (s[6] = () => {
1465
+ f(
1466
+ {
1467
+ op: "after",
1468
+ x: 1,
1469
+ ignoreYear: !0
1470
+ },
1471
+ "_isDay"
1472
+ );
1473
+ })
1474
+ }, null, 8, ["model-value"]),
1475
+ C("div", dt, [
1476
+ b(V, {
1477
+ label: "Is in this",
1478
+ value: "_isRange",
1479
+ "model-value": e(p).operator,
1480
+ "onUpdate:modelValue": s[7] || (s[7] = () => {
1481
+ f(
1482
+ {
1483
+ op: "this",
1484
+ unit: "day",
1485
+ ignoreYear: !0
1486
+ },
1487
+ "_isRange"
1488
+ );
1489
+ })
1490
+ }, null, 8, ["model-value"]),
1491
+ e(p).operator == "_isRange" ? (n(), g(U, {
1492
+ key: 0,
1493
+ items: ["day", "week", "month"].map((E) => ({ label: E, value: E })),
1494
+ "model-value": e(p).equator.unit,
1495
+ "onUpdate:modelValue": s[8] || (s[8] = (E) => f(
1496
+ {
1497
+ op: "this",
1498
+ unit: E,
1499
+ ignoreYear: !0
1500
+ },
1501
+ "_isRange"
1502
+ ))
1503
+ }, null, 8, ["items", "model-value"])) : M("", !0)
1504
+ ])
1505
+ ]),
1506
+ e(p).operator == "_isDay" ? (n(), g(a, {
1507
+ key: 0,
1508
+ label: "Days before birthday",
1509
+ "show-steppers": !1,
1510
+ "model-value": e(p).equator.x,
1511
+ "onUpdate:modelValue": s[9] || (s[9] = (E) => f({
1512
+ op: "after",
1513
+ x: E,
1514
+ ignoreYear: !0
1515
+ }))
1516
+ }, null, 8, ["model-value"])) : M("", !0)
1517
+ ], 64)) : l.preset == "TIER" ? (n(), T(h, { key: 7 }, [
1518
+ b(r, {
1519
+ inline: !0,
1520
+ "model-value": e(p).operator,
1521
+ "onUpdate:modelValue": s[10] || (s[10] = (E) => f(e(p).equator, E))
1522
+ }, {
1523
+ default: q(() => [
1524
+ b(V, {
1525
+ value: "_moreThanOrEqual",
1526
+ label: "At least"
1527
+ }),
1528
+ b(V, {
1529
+ value: "_equal",
1530
+ label: "Equal"
1531
+ }),
1532
+ b(V, {
1533
+ value: "_lessThanOrEqual",
1534
+ label: "At most"
1535
+ })
1536
+ ]),
1537
+ _: 1
1538
+ }, 8, ["model-value"]),
1539
+ b(O, {
1540
+ items: (e(o).sortedTiers ?? []).map((E, oe) => ({
1541
+ label: `Tier ${oe + 1} - ${E.name}`,
1542
+ value: oe + 1
1543
+ })),
1544
+ "model-value": e(p).equator,
1545
+ "onUpdate:modelValue": s[11] || (s[11] = (E) => f(E))
1546
+ }, null, 8, ["items", "model-value"]),
1547
+ b(I, {
1548
+ text: t()
1549
+ }, null, 8, ["text"])
1550
+ ], 64)) : l.preset == "TITLE" ? (n(), g(O, {
1551
+ key: 8,
1552
+ label: "User has title",
1553
+ items: (e(o).sortedTitles ?? []).map((E) => ({
1554
+ label: E.name,
1555
+ value: E._id
1556
+ })),
1557
+ "model-value": (w = e(p).equator) == null ? void 0 : w[0],
1558
+ "onUpdate:modelValue": s[12] || (s[12] = (E) => f([E]))
1559
+ }, null, 8, ["items", "model-value"])) : M("", !0),
1560
+ b(I, {
1561
+ class: "mt-[-8px]",
1562
+ text: e(Z).helperText(e(m), ""),
1563
+ state: e(Z).helperState(e(m), "")
1564
+ }, null, 8, ["text", "state"]),
1565
+ C("div", pt, [
1566
+ b(P, {
1567
+ onClick: s[13] || (s[13] = (E) => e(Y).close()),
1568
+ label: "Cancel",
1569
+ variant: "tertiary"
1570
+ }),
1571
+ b(P, {
1572
+ onClick: s[14] || (s[14] = (E) => S()),
1573
+ disabled: e(m).length > 0,
1574
+ label: "Save"
1575
+ }, null, 8, ["disabled"])
1576
+ ])
1577
+ ]);
1578
+ };
1579
+ }
1580
+ }), ct = /* @__PURE__ */ A({
1581
+ __name: "RuleConfigurator",
1582
+ props: {
1583
+ triggerType: {
1584
+ type: String,
1585
+ required: !0
1586
+ },
1587
+ includeOnly: {
1588
+ type: String
1589
+ },
1590
+ modelValue: {
1591
+ type: Object,
1592
+ default: () => {
1593
+ }
1594
+ }
1595
+ },
1596
+ emits: ["update:model-value"],
1597
+ setup(l, { expose: Y, emit: c }) {
1598
+ const i = X(), { t: o } = me(), d = l, t = c, u = le(), y = L();
1599
+ function p(m) {
1600
+ const [v] = m.rules;
1601
+ u.open({
1602
+ title: m.name,
1603
+ closeButton: !1,
1604
+ dismissAway: !1,
1605
+ contentComponent: yt,
1606
+ contentComponentProps: {
1607
+ preset: m.type,
1608
+ defaultValue: v,
1609
+ modelValue: d.modelValue
1610
+ }
1611
+ }).onPrimary((s) => t("update:model-value", s));
1612
+ }
1613
+ function f(m) {
1614
+ u.open({
1615
+ title: o("connect.template.rule.edit_rule"),
1616
+ closeButton: !1,
1617
+ dismissAway: !1,
1618
+ contentComponent: st,
1619
+ contentComponentProps: {
1620
+ triggerType: d.triggerType,
1621
+ includeOnly: d.includeOnly,
1622
+ modelValue: m
1623
+ }
1624
+ }).onPrimary((v) => t("update:model-value", v));
1625
+ }
1626
+ function S(m) {
1627
+ if (m.type == "CUSTOM") {
1628
+ const [v] = m.rules;
1629
+ return f(
1630
+ D.constructEntry(v.property, v.operator, v.equator)
1631
+ );
1632
+ }
1633
+ return p(m);
1634
+ }
1635
+ return Y({
1636
+ showCustomDialog: f
1637
+ }), (m, v) => {
1638
+ const s = k("FmButton"), a = k("FmPill"), F = k("FmMenuItem"), x = k("FmMenu");
1639
+ return n(), g(x, {
1640
+ shift: !0,
1641
+ placement: "top-start"
1642
+ }, {
1643
+ "menu-button": q(() => [
1644
+ b(s, {
1645
+ label: e(o)("connect.template.rule.add_condition"),
1646
+ icon: "add",
1647
+ class: "text-fm-color-primary border-fm-color-primary",
1648
+ "icon-color": "primary",
1649
+ variant: "secondary"
1650
+ }, null, 8, ["label"])
1651
+ ]),
1652
+ default: q(() => [
1653
+ (n(!0), T(h, null, N(e(Oe).filter(
1654
+ (V) => !l.includeOnly || V.for.includes(l.includeOnly)
1655
+ ), (V) => (n(), g(F, {
1656
+ key: V.name,
1657
+ "model-value": V.name == e(y),
1658
+ label: V.name,
1659
+ onClick: () => {
1660
+ V != null && V.premium && !e(i).isPremium || S(V);
1661
+ },
1662
+ disabled: (V == null ? void 0 : V.premium) && !e(i).isPremium
1663
+ }, se({ _: 2 }, [
1664
+ V != null && V.premium ? {
1665
+ name: "append",
1666
+ fn: q(() => [
1667
+ b(a, { variant: "premium" })
1668
+ ]),
1669
+ key: "0"
1670
+ } : void 0
1671
+ ]), 1032, ["model-value", "label", "onClick", "disabled"]))), 128))
1672
+ ]),
1673
+ _: 1
1674
+ });
1675
+ };
1676
+ }
1677
+ }), vt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, It = /* @__PURE__ */ A({
1678
+ __name: "RuleGroup",
1679
+ props: {
1680
+ triggerType: {
1681
+ type: String,
1682
+ required: !0
1683
+ },
1684
+ includeOnly: {
1685
+ type: String
1686
+ },
1687
+ modelValue: {
1688
+ type: Object
1689
+ }
1690
+ },
1691
+ emits: ["update:model-value"],
1692
+ setup(l, { emit: Y }) {
1693
+ const c = l, i = Y, o = Ve(), { t: d } = me(), t = B(
1694
+ () => c.modelValue ?? D.scaffoldGroup()
1695
+ ), u = B(() => D.getLogic(t.value)), y = B(() => [
1696
+ { label: d("connect.template.rule.and"), value: "&&" },
1697
+ { label: d("connect.template.rule.or"), value: "||" }
1698
+ ]), p = L();
1699
+ function f(S, m) {
1700
+ try {
1701
+ const v = D.setRuleToGroup(S, m);
1702
+ D.isRuleExceed(S, m), i("update:model-value", v);
1703
+ } catch (v) {
1704
+ o.open({
1705
+ message: v.message,
1706
+ type: "error"
1707
+ });
1708
+ }
1709
+ }
1710
+ return (S, m) => {
1711
+ const v = k("FmButtonGroup"), s = k("FmCard");
1712
+ return n(), g(s, { variant: "outlined" }, {
1713
+ default: q(() => [
1714
+ b(s, { class: "border-l-4 border-fm-color-primary p-16 space-y-16" }, {
1715
+ default: q(() => [
1716
+ C("div", vt, $(e(d)("connect.template.rule.when")), 1),
1717
+ b(ct, {
1718
+ ref_key: "configuratorRef",
1719
+ ref: p,
1720
+ "include-only": l.includeOnly,
1721
+ "trigger-type": l.triggerType,
1722
+ "onUpdate:modelValue": m[0] || (m[0] = (a) => f(e(t), a))
1723
+ }, null, 8, ["include-only", "trigger-type"]),
1724
+ (n(!0), T(h, null, N(e(t).rules, (a, F) => {
1725
+ var x;
1726
+ return n(), T(h, null, [
1727
+ e(ke)(a) ? (n(), g(De, {
1728
+ "model-value": a,
1729
+ key: F,
1730
+ onEdit: (x = e(p)) == null ? void 0 : x.showCustomDialog,
1731
+ onRemove: m[1] || (m[1] = (V) => {
1732
+ i(
1733
+ "update:model-value",
1734
+ e(D).removeEntry(e(t), V.name)
1735
+ );
1736
+ })
1737
+ }, null, 8, ["model-value", "onEdit"])) : M("", !0),
1738
+ b(v, {
1739
+ class: "w-[200px]",
1740
+ disabled: Object.keys(e(t).rules).length < 2,
1741
+ items: e(y),
1742
+ "model-value": e(y).find((V) => V.value === e(u)) ?? null,
1743
+ "onUpdate:modelValue": m[2] || (m[2] = (V) => i(
1744
+ "update:model-value",
1745
+ e(D).setRuleToGroup(
1746
+ e(t),
1747
+ [],
1748
+ V.value
1749
+ )
1750
+ ))
1751
+ }, null, 8, ["disabled", "items", "model-value"])
1752
+ ], 64);
1753
+ }), 256))
1754
+ ]),
1755
+ _: 1
1756
+ })
1757
+ ]),
1758
+ _: 1
1759
+ });
1760
+ };
1761
+ }
1762
+ });
1763
+ export {
1764
+ It as _,
1765
+ ee as a
1766
+ };