@feedmepos/mf-connect 0.1.38-beta.65 → 0.1.38-beta.67

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 (104) hide show
  1. package/dist/{Analytic-Dy93vaC8.js → Analytic-Z0CNve1I.js} +14 -14
  2. package/dist/{App-DWWHB3FE.js → App-BInOJkji.js} +7 -7
  3. package/dist/{AuditLogs-B0681Vq_.js → AuditLogs-OXnCFGto.js} +9 -9
  4. package/dist/{Bin-CLyVz6Xs.js → Bin-jalwGRVF.js} +8 -8
  5. package/dist/{Broadcast-DUfHTTho.js → Broadcast-CfIIVtjA.js} +10 -10
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-ClCgYpPZ.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DAlzdfnf.js} +6 -6
  7. package/dist/{Card-YeZCMAFz.js → Card-BaLPtDc7.js} +17 -17
  8. package/dist/{Collections-CbQ0ZrBD.js → Collections-CbEt5YfY.js} +7 -7
  9. package/dist/{Credit-BfX2gPMH.js → Credit-B3nkNYJO.js} +10 -10
  10. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-BmdWQX7L.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-Jpk1c7R4.js} +732 -719
  11. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-CsyRTYOp.js → EffectSheet.vue_vue_type_style_index_0_lang-Dwguq6Ju.js} +6 -6
  12. package/dist/{Experience-C6HvSIKM.js → Experience-GUNkFbK5.js} +10 -10
  13. package/dist/{FileSaver.min-D9U2KO97.js → FileSaver.min-CxLLo4Gq.js} +1 -1
  14. package/dist/{Game-6kqoy_VO.js → Game-ekGfatWy.js} +11 -11
  15. package/dist/{GenerateMaterial-BpyU0WOE.js → GenerateMaterial-CP4SqL02.js} +6 -6
  16. package/dist/{Grab-DCEwzoLj.js → Grab-Dm_VwsHT.js} +9 -9
  17. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-Cw_Sb8qt.js → ImageInput.vue_vue_type_script_setup_true_lang-D9sltqKJ.js} +1 -1
  18. package/dist/{Index-CwRC0jZQ.js → Index-DcDxmuGf.js} +10 -10
  19. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-DBnJdrxS.js → LottieAnimation.vue_vue_type_script_setup_true_lang-CvT-x5P7.js} +1 -1
  20. package/dist/{MainLayout-DOWVqAgU.js → MainLayout-DRJIFGUj.js} +1 -1
  21. package/dist/{Marketing-dI6fgCHM.js → Marketing-RGuJ6wTU.js} +4 -4
  22. package/dist/{MarketingMaterialEdit-bAIvGD_N.js → MarketingMaterialEdit-DOpTPT8c.js} +4 -4
  23. package/dist/{Member-BHCD5ppC.js → Member-CnUdunCK.js} +11 -11
  24. package/dist/{MemberList-M4agY-f_.js → MemberList-DcoapXrj.js} +25 -25
  25. package/dist/{MemberTransactions-C8O9-ApW.js → MemberTransactions-DVEyj_BH.js} +1 -1
  26. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-BrTV_TtG.js → MessageInput.vue_vue_type_script_setup_true_lang-DD8fjiYq.js} +8 -8
  27. package/dist/{Mission-DoZspZ8Q.js → Mission-C5hiBm6d.js} +11 -11
  28. package/dist/{Overview-CU5rU0LF.js → Overview-VEpAvwHF.js} +18 -18
  29. package/dist/{Point-Bk7-bOqX.js → Point-DBfY-AIA.js} +10 -10
  30. package/dist/{Promotion-6f2l-3EM.js → Promotion-CXIh8X8A.js} +11 -11
  31. package/dist/{Queue-z1Fkp84L.js → Queue-DfTHZQur.js} +10 -10
  32. package/dist/{Record-D8NXiiM8.js → Record-BFIwpX5M.js} +9 -9
  33. package/dist/{Reward-BMCmae_H.js → Reward-Bk3B_U5u.js} +16 -16
  34. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-CrrtPPzI.js → RewardGroup.vue_vue_type_script_setup_true_lang-BLT99RL3.js} +11 -11
  35. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-BSs9KfDL.js +1790 -0
  36. package/dist/{Segment-D3kcLFIR.js → Segment-SAbgAgmg.js} +24 -24
  37. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-B9DUXeaq.js → SelectItems.vue_vue_type_script_setup_true_lang-CN2vp33Z.js} +2 -2
  38. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-MuzzR9cp.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-CVo8P3yO.js} +12 -12
  39. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-JA94mgVZ.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-BOJ5N870.js} +4 -4
  40. package/dist/{Setting-B_OmVU-T.js → Setting-BPGXsVUh.js} +13 -13
  41. package/dist/{SettingAdvertisements-D4ubVKEd.js → SettingAdvertisements-CXIxcfdo.js} +11 -11
  42. package/dist/{Store-5y8JwRFF.js → Store-rzaJ0b57.js} +260 -230
  43. package/dist/{StoreRewards-CgEvv86V.js → StoreRewards-Qw2jAWDX.js} +14 -14
  44. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-DMIzMyr7.js → StoreTransactions.vue_vue_type_script_setup_true_lang-DNY7fjf4.js} +19 -19
  45. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-CDn56QLU.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BEQXHnwE.js} +1 -1
  46. package/dist/{Tier-D2Ytm0AK.js → Tier-CF3mR69g.js} +23 -23
  47. package/dist/{Title-qqPzXB4E.js → Title-6mLNCf2M.js} +20 -20
  48. package/dist/{Transaction-BoaKQ9ZI.js → Transaction-DD4lU08r.js} +2 -2
  49. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-7JiB17Sg.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-CTtmtWNK.js} +6 -6
  50. package/dist/{Voucher-DoBesT8K.js → Voucher-GBNHUuKs.js} +14 -14
  51. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-E8xIoI_3.js → VoucherEditor.vue_vue_type_script_setup_true_lang-Oa1vv2sm.js} +12 -12
  52. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-Bioh6J-1.js → ZodTextField.vue_vue_type_script_setup_true_lang-CtMNlcrv.js} +2 -2
  53. package/dist/{app-CSLdkqXm.js → app-CwHsKEJk.js} +48 -48
  54. package/dist/app.js +1 -1
  55. package/dist/{business-TqnRv4gQ.js → business-D9-tunJz.js} +1 -1
  56. package/dist/{campaign-BQAhqmVJ.js → campaign-BQK3Skkn.js} +8 -8
  57. package/dist/{campaign-7V-NfugE.js → campaign-DHcAZIZa.js} +2 -2
  58. package/dist/{campaign.enum-y4C00NEu.js → campaign.enum-BeEZC2en.js} +1 -1
  59. package/dist/{campaign.fn-QFtrEGna.js → campaign.fn-C0bzA3Vq.js} +3 -3
  60. package/dist/{collectible.enum-CqacBXyt.js → collectible.enum-CTHQ01z1.js} +1 -1
  61. package/dist/{collection.fn-ChGu6wpj.js → collection.fn-B100McoV.js} +2 -2
  62. package/dist/{dto-D1WeMdh1.js → dto-CsmKFrNj.js} +4 -4
  63. package/dist/{duplicateCampaign-DuEP6K7x.js → duplicateCampaign-tK8YvPzx.js} +2 -2
  64. package/dist/{effect-jf2S9uri.js → effect-Dieg9O9U.js} +1 -1
  65. package/dist/{email-addresses-vv_TW_Rh.js → email-addresses-C6cSCQgO.js} +2 -2
  66. package/dist/{export-2Ex_F1sM.js → export-CRXJTlC3.js} +2 -2
  67. package/dist/{helper-BKRDRlP9.js → helper-CMQfVciZ.js} +1 -1
  68. package/dist/{index-BaPGnrPh.js → index-9JPd7kM_.js} +1 -1
  69. package/dist/{index-BH6uqb3V.js → index-B2t-w_7c.js} +1 -1
  70. package/dist/{index-DqPeYTIZ.js → index-B5I7nudl.js} +1 -1
  71. package/dist/index-BTKdiJsR.js +28897 -0
  72. package/dist/{index-DdKItXpy.js → index-BVz3JbdL.js} +3 -3
  73. package/dist/index-BX4TuJtG.js +30289 -0
  74. package/dist/{index-DybupUr1.js → index-Bm_FM2om.js} +6 -6
  75. package/dist/{index-oUxF8f_f.js → index-CFUWIILa.js} +1 -1
  76. package/dist/{index-CfvO6tfW.js → index-CPVpptAq.js} +1 -1
  77. package/dist/{index-CTlaBS9i.js → index-Cf_YGKEb.js} +1 -1
  78. package/dist/{index-B7KLhv7n.js → index-Dlq09JaT.js} +4 -4
  79. package/dist/{index-D5hUhhAG.js → index-FuYU2IEu.js} +402 -402
  80. package/dist/{index-DuI0kYr0.js → index-LG3borCM.js} +1 -1
  81. package/dist/{index.esm2017-DaSPiakY.js → index.esm2017-DmNbvFNT.js} +1 -1
  82. package/dist/{loading-Dak_xOqe.js → loading-CjKiZfGm.js} +2 -2
  83. package/dist/{lodash-BBxPTL17.js → lodash-mGgd0gGv.js} +1 -1
  84. package/dist/{membership-BUmz2QAw.js → membership-P6d6LfFR.js} +3 -3
  85. package/dist/{money-OOrViJKi.js → money-Dw3puEjG.js} +1 -1
  86. package/dist/{number-Da6RfYTR.js → number-CQRszgdt.js} +1 -1
  87. package/dist/objectid-BC7O4hT6.js +145 -0
  88. package/dist/{plugins-BzC-7O6K.js → plugins-BbIlyyO-.js} +3 -3
  89. package/dist/{reward-Bx3PUiRG.js → reward-DMUo6X_c.js} +1 -1
  90. package/dist/{rule-DSjGk0Yi.js → rule-CnwJzx-q.js} +505 -487
  91. package/dist/{rule-builder-BYjp7jnn.js → rule-builder-BIPt_qDm.js} +1 -1
  92. package/dist/{template-C4gMwoW2.js → template-BTKzQdc-.js} +6 -6
  93. package/dist/{timezone-qku6lW8o.js → timezone-DdK9Yb_l.js} +5 -2
  94. package/dist/{trigger-BSU651eg.js → trigger-ChHDDRNd.js} +5 -5
  95. package/dist/{usePagination-DMwVVN9F.js → usePagination-BMZGcRyW.js} +1 -1
  96. package/dist/{user-D5gaOk0G.js → user-BqEsxv2Q.js} +1 -1
  97. package/dist/{vue-i18n-aTr_rKkD.js → vue-i18n-BFwWEe1C.js} +112 -112
  98. package/dist/{xlsx-h3ynu2wu.js → xlsx-DXHTpb6Q.js} +1 -1
  99. package/dist/{zod-D_nuOmBw.js → zod-BPOjMnMz.js} +1 -1
  100. package/package.json +4 -4
  101. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-BrusnrDg.js +0 -1766
  102. package/dist/index-BwxtaEmx.js +0 -30933
  103. package/dist/index-DFUkCPEX.js +0 -32456
  104. package/dist/objectid-BMgJN9vF.js +0 -145
@@ -0,0 +1,1790 @@
1
+ import { defineComponent as A, computed as I, resolveComponent as k, openBlock as u, createElementBlock as T, createElementVNode as Y, createVNode as v, unref as e, createTextVNode as te, toDisplayString as $, withCtx as w, onMounted as z, createBlock as g, createCommentVNode as M, ref as L, watch as ue, Fragment as q, renderList as N, normalizeClass as W, resolveDynamicComponent as ae, onBeforeMount as se, isRef as ye, createSlots as ie } from "vue";
2
+ import { m as ce, C as ve, n as fe, a as be, o as ge } from "./index-FuYU2IEu.js";
3
+ import { R as C, a as ke } from "./rule-builder-BIPt_qDm.js";
4
+ import { useDialog as le, useDialogChild as me, useSnackbar as Ve } from "@feedmepos/ui-library";
5
+ import { u as de } from "./vue-i18n-BFwWEe1C.js";
6
+ import { a as Ee, R as h, S as Se, C as H, g as Te, W as Fe, T as re, O as ne } from "./rule-CnwJzx-q.js";
7
+ import { p as Re } from "./plugins-BbIlyyO-.js";
8
+ import { h as J } from "./moment-D7p2TMB-.js";
9
+ import { z as Ue } from "./app-CwHsKEJk.js";
10
+ import { u as Q } from "./membership-P6d6LfFR.js";
11
+ import { u as X } from "./business-D9-tunJz.js";
12
+ import "./index-BX4TuJtG.js";
13
+ import { _ as O } from "./CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js";
14
+ import { c as pe } from "./object-qECH92oz.js";
15
+ import { Z } from "./zod-BPOjMnMz.js";
16
+ import { _ as xe } from "./SelectItems.vue_vue_type_script_setup_true_lang-CN2vp33Z.js";
17
+ import "./index-Bm_FM2om.js";
18
+ import "./index-Dlq09JaT.js";
19
+ import "./index-BVz3JbdL.js";
20
+ const Ye = { class: "flex items-center justify-between" }, Ce = { class: "flex items-center gap-8 xs:flex-wrap" }, Oe = { 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: U }) {
30
+ const V = l, m = I(() => {
31
+ const [r, n] = Object.entries(V.modelValue.conditions)[0];
32
+ return {
33
+ negated: V.modelValue.negated == !0,
34
+ property: V.modelValue.property,
35
+ operator: r,
36
+ equator: n
37
+ };
38
+ }), f = U, t = I(
39
+ () => Ee(
40
+ m.value.property,
41
+ m.value.operator,
42
+ m.value.equator,
43
+ m.value.negated
44
+ )
45
+ );
46
+ async function o(r) {
47
+ r.stopPropagation(), await Re.remove("Are you sure you want to remove this rule?") && f("remove", V.modelValue);
48
+ }
49
+ return (r, n) => {
50
+ var d;
51
+ const p = k("FmChip"), b = k("FmTooltip"), F = k("FmIcon");
52
+ return u(), T("div", Ye, [
53
+ Y("div", Ce, [
54
+ v(p, {
55
+ label: (d = e(ce).find((c) => c.property === V.modelValue.property)) == null ? void 0 : d.name,
56
+ class: "!text-fm-color-typo-info !bg-fm-color-system-info-100"
57
+ }, null, 8, ["label"]),
58
+ n[1] || (n[1] = Y("div", { class: "h-[26px] border-l-2 rounded-md border-fm-color-neutral-gray-100" }, null, -1)),
59
+ Y("div", {
60
+ onClick: n[0] || (n[0] = (c) => f("edit", V.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(t)[0]) + " ", 1),
64
+ v(b, {
65
+ "z-index": 1e3,
66
+ content: e(t)[1]
67
+ }, {
68
+ default: w(() => [
69
+ Y("div", Oe, $(e(t)[1]), 1)
70
+ ]),
71
+ _: 1
72
+ }, 8, ["content"])
73
+ ])
74
+ ]),
75
+ v(F, {
76
+ name: "close",
77
+ size: "md",
78
+ class: "cursor-pointer hover:bg-neutral-300 rounded-lg",
79
+ onClick: o
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 he = [
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
+ ], qe = { class: "flex flex-nowrap gap-x-4 items-center" }, we = /* @__PURE__ */ A({
348
+ __name: "IsDayInput",
349
+ props: {
350
+ modelValue: {
351
+ type: Object
352
+ }
353
+ },
354
+ emits: ["update:model-value"],
355
+ setup(l, { emit: U }) {
356
+ const V = l, m = U;
357
+ z(() => {
358
+ V.modelValue || m("update:model-value", {
359
+ op: "before",
360
+ x: 1
361
+ });
362
+ });
363
+ function f(t) {
364
+ const o = pe(
365
+ V.modelValue ?? {
366
+ op: "before",
367
+ x: 1
368
+ }
369
+ );
370
+ m("update:model-value", {
371
+ ...o,
372
+ ...t
373
+ });
374
+ }
375
+ return (t, o) => {
376
+ var n, p, b;
377
+ const r = k("FmStepperField");
378
+ return u(), T("div", qe, [
379
+ v(r, {
380
+ class: "w-1/3",
381
+ "model-value": ((n = l.modelValue) == null ? void 0 : n.x) ?? null,
382
+ max: 365,
383
+ "show-steppers": !1,
384
+ "append-text": "days",
385
+ "onUpdate:modelValue": o[0] || (o[0] = (F) => f({ x: F }))
386
+ }, null, 8, ["model-value"]),
387
+ v(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": o[1] || (o[1] = (F) => f({ op: F }))
394
+ }, null, 8, ["model-value"]),
395
+ v(O, {
396
+ "model-value": ((b = l.modelValue) == null ? void 0 : b.ignoreYear) ?? !1,
397
+ items: [
398
+ { label: "same year", value: !1 },
399
+ { label: "ignore year", value: !0 }
400
+ ],
401
+ required: !0,
402
+ "onUpdate:modelValue": o[2] || (o[2] = (F) => f({ ignoreYear: F == !0 }))
403
+ }, null, 8, ["model-value"])
404
+ ]);
405
+ };
406
+ }
407
+ }), Be = { 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: U }) {
421
+ const V = l, m = U;
422
+ z(() => {
423
+ V.modelValue || m("update:model-value", {
424
+ op: "this",
425
+ unit: "day",
426
+ ignoreYear: !0
427
+ });
428
+ });
429
+ const f = [
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
+ ], t = [
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 (o, r) => {
450
+ var p, b, F, d, c;
451
+ const n = k("FmStepperField");
452
+ return u(), T("div", Be, [
453
+ v(O, {
454
+ "model-value": (p = l.modelValue) == null ? void 0 : p.op,
455
+ label: "",
456
+ items: t,
457
+ required: !0,
458
+ "onUpdate:modelValue": r[0] || (r[0] = (i) => m("update:model-value", { op: i, unit: "day", ignoreYear: !1 }))
459
+ }, null, 8, ["model-value"]),
460
+ ((b = l.modelValue) == null ? void 0 : b.op) != "this" ? (u(), g(n, {
461
+ key: 0,
462
+ "model-value": ((F = l.modelValue) == null ? void 0 : F.x) || 0,
463
+ max: 365,
464
+ "show-steppers": !1,
465
+ "onUpdate:modelValue": r[1] || (r[1] = (i) => m("update:model-value", {
466
+ op: l.modelValue.op,
467
+ unit: l.modelValue.unit,
468
+ ignoreYear: l.modelValue.ignoreYear == !0,
469
+ x: i
470
+ }))
471
+ }, null, 8, ["model-value"])) : M("", !0),
472
+ v(O, {
473
+ "model-value": (d = l.modelValue) == null ? void 0 : d.unit,
474
+ label: "",
475
+ items: f,
476
+ required: !0,
477
+ "onUpdate:modelValue": r[2] || (r[2] = (i) => m("update:model-value", { ...V.modelValue, unit: i }))
478
+ }, null, 8, ["model-value"]),
479
+ v(O, {
480
+ label: "",
481
+ "model-value": (c = l.modelValue) == null ? void 0 : c.ignoreYear,
482
+ items: [
483
+ { label: "same", value: !1 },
484
+ { label: "ignore", value: !0 }
485
+ ],
486
+ required: !0,
487
+ "onUpdate:modelValue": r[3] || (r[3] = (i) => m("update:model-value", {
488
+ ...V.modelValue,
489
+ ignoreYear: i == !0
490
+ }))
491
+ }, null, 8, ["model-value"])
492
+ ]);
493
+ };
494
+ }
495
+ }), Me = { class: "space-y-8" }, Ae = { class: "text-fm-color-primary rounded-md border-dashed border-2 p-8" }, Ne = {
496
+ key: 0,
497
+ class: "flex items-center gap-8"
498
+ }, Pe = { class: "flex gap-4" }, $e = {
499
+ key: 0,
500
+ class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
501
+ }, Le = ["onClick"], He = {
502
+ key: 1,
503
+ class: "flex items-center gap-8"
504
+ }, We = { class: "flex gap-4 xs:gap-[2px]" }, _e = { class: "grid grid-cols-6 gap-8" }, je = {
505
+ key: 0,
506
+ class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
507
+ }, Ke = ["onClick"], Ge = {
508
+ key: 1,
509
+ class: "grid grid-cols-2 items-center gap-8"
510
+ }, Qe = { class: "flex gap-4" }, ze = {
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: U }) {
531
+ const V = l, m = U;
532
+ function f(r, n) {
533
+ return new h({
534
+ ...r,
535
+ dtstart: Te({
536
+ startDate: V.startDate,
537
+ modelValue: n
538
+ })
539
+ });
540
+ }
541
+ const t = L(
542
+ V.modelValue ? h.fromString(V.modelValue) : f({
543
+ dtstart: V.startDate,
544
+ freq: h.DAILY,
545
+ wkst: h.SU,
546
+ interval: 1,
547
+ byhour: 0,
548
+ byminute: 0,
549
+ bysecond: 0
550
+ })
551
+ );
552
+ function o(r) {
553
+ var n;
554
+ if ("freq" in r)
555
+ switch (r.freq) {
556
+ case h.WEEKLY:
557
+ t.value = f(
558
+ {
559
+ freq: r.freq,
560
+ interval: 1,
561
+ byhour: 0,
562
+ byminute: 0,
563
+ bysecond: 0,
564
+ wkst: h.SU,
565
+ byweekday: [h.MO]
566
+ },
567
+ t.value
568
+ );
569
+ break;
570
+ case h.MONTHLY:
571
+ t.value = f(
572
+ {
573
+ freq: r.freq,
574
+ interval: 1,
575
+ byhour: 0,
576
+ byminute: 0,
577
+ bysecond: 0,
578
+ bymonthday: [(/* @__PURE__ */ new Date()).getDate()],
579
+ wkst: h.SU
580
+ },
581
+ t.value
582
+ );
583
+ break;
584
+ case h.YEARLY:
585
+ t.value = f(
586
+ {
587
+ freq: r.freq,
588
+ interval: 1,
589
+ byhour: 0,
590
+ byminute: 0,
591
+ bysecond: 0,
592
+ wkst: h.SU,
593
+ bymonth: [(/* @__PURE__ */ new Date()).getMonth() + 1],
594
+ bymonthday: [(/* @__PURE__ */ new Date()).getDate()]
595
+ },
596
+ t.value
597
+ );
598
+ break;
599
+ default:
600
+ t.value = f(
601
+ {
602
+ freq: r.freq,
603
+ interval: 1,
604
+ byhour: 0,
605
+ byminute: 0,
606
+ bysecond: 0,
607
+ wkst: h.SU
608
+ },
609
+ t.value
610
+ );
611
+ }
612
+ r.interval && r.interval > 0 && (t.value = f(
613
+ {
614
+ ...t.value.origOptions,
615
+ interval: r.interval
616
+ },
617
+ t.value
618
+ )), "byweekday" in r && r.byweekday && Array.isArray(r.byweekday) && r.byweekday.length > 0 && (t.value.options.bymonthday.length > 0 && t.value.options.freq == h.MONTHLY && (t.value.options.bymonthday = []), t.value = f(
619
+ {
620
+ ...t.value.origOptions,
621
+ bymonthday: [],
622
+ byweekday: r.byweekday
623
+ },
624
+ t.value
625
+ )), "bysetpos" in r && r.bysetpos != null && (t.value = f(
626
+ {
627
+ ...t.value.origOptions,
628
+ bymonthday: [],
629
+ bysetpos: r.bysetpos,
630
+ byweekday: ((n = t.value.options.byweekday) == null ? void 0 : n.length) > 0 ? t.value.options.byweekday : [6]
631
+ },
632
+ t.value
633
+ )), "bymonthday" in r && r.bymonthday && Array.isArray(r.bymonthday) && r.bymonthday.length > 0 && (t.value = f(
634
+ {
635
+ ...t.value.origOptions,
636
+ bysetpos: [],
637
+ byweekday: [],
638
+ bymonthday: r.bymonthday
639
+ },
640
+ t.value
641
+ )), "bymonth" in r && r.bymonth && Array.isArray(r.bymonth) && r.bymonth.length > 0 && (t.value = f(
642
+ {
643
+ ...t.value.origOptions,
644
+ bysetpos: [],
645
+ bymonth: r.bymonth
646
+ },
647
+ t.value
648
+ )), "bynweekday" in r && r.bynweekday && (t.value = f(
649
+ {
650
+ ...t.value.origOptions,
651
+ bysetpos: [],
652
+ byweekday: new Fe(
653
+ r.bynweekday[0][0],
654
+ r.bynweekday[0][1]
655
+ )
656
+ },
657
+ t.value
658
+ )), V.applyButton || m("update:model-value", t.value.toString());
659
+ }
660
+ return ue(
661
+ () => V.modelValue,
662
+ (r) => {
663
+ !r || r === t.value.toString() || (t.value = h.fromString(r));
664
+ }
665
+ ), z(() => {
666
+ V.modelValue || m("update:model-value", t.value.toString());
667
+ }), (r, n) => {
668
+ var c, i, x;
669
+ const p = k("FmStepperField"), b = k("FmChip"), F = k("FmButtonGroup"), d = k("FmButton");
670
+ return u(), T("div", Me, [
671
+ Y("div", Ae, $(e(Se)(e(t).options)), 1),
672
+ l.fixedFrequency ? M("", !0) : (u(), T("div", Ne, [
673
+ n[8] || (n[8] = Y("div", null, "Repeat every", -1)),
674
+ v(p, {
675
+ class: "w-[100px]",
676
+ "model-value": e(t).options.interval,
677
+ "onUpdate:modelValue": n[0] || (n[0] = (s) => o({ interval: s > 0 ? s : e(t).options.interval })),
678
+ min: 1
679
+ }, null, 8, ["model-value"]),
680
+ v(O, {
681
+ class: "w-min",
682
+ items: e(H).frequencies,
683
+ "model-value": e(t).origOptions.freq,
684
+ "onUpdate:modelValue": n[1] || (n[1] = (s) => o({ freq: s }))
685
+ }, null, 8, ["items", "model-value"])
686
+ ])),
687
+ e(t).options.freq === e(h).WEEKLY ? (u(), T(q, { key: 1 }, [
688
+ n[9] || (n[9] = Y("div", null, "Repeat on", -1)),
689
+ Y("div", Pe, [
690
+ (u(!0), T(q, null, N(e(H).weekdays, (s) => {
691
+ var S;
692
+ return u(), g(b, {
693
+ class: W(["cursor-pointer", `${(S = e(t).options.byweekday) != null && S.includes(s.value) ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
694
+ label: s.label[0],
695
+ key: s.value,
696
+ compact: !0,
697
+ onClick: () => {
698
+ var y, R;
699
+ o({
700
+ byweekday: (y = e(t).options.byweekday) != null && y.includes(s.value) ? ((R = e(t).options.byweekday) == null ? void 0 : R.filter((a) => a !== s.value)) || [] : [...e(t).options.byweekday || [], s.value]
701
+ });
702
+ }
703
+ }, null, 8, ["class", "label", "onClick"]);
704
+ }), 128))
705
+ ])
706
+ ], 64)) : M("", !0),
707
+ e(t).options.freq == e(h).MONTHLY ? (u(), T(q, { key: 2 }, [
708
+ v(F, {
709
+ "model-value": e(t).options.bymonthday.length ? { label: "Each" } : { label: "On the" },
710
+ items: [
711
+ {
712
+ label: "Each"
713
+ },
714
+ {
715
+ label: "On the"
716
+ }
717
+ ],
718
+ "onUpdate:modelValue": n[2] || (n[2] = (s) => {
719
+ s.label == "Each" ? o({ bymonthday: [1] }) : o({ bysetpos: 1 });
720
+ })
721
+ }, null, 8, ["model-value"]),
722
+ e(t).options.bymonthday.length > 0 ? (u(), T("div", $e, [
723
+ (u(!0), T(q, null, N(e(H).dates, (s) => (u(), T("div", {
724
+ key: s.value,
725
+ class: W(["cursor-pointer text-center outline-1 outline-fm-color-neutral-gray-100 outline", `${e(t).options.bymonthday.includes(s.value) ? "bg-fm-color-primary text-fm-color-typo-white outline-transparent" : "bg-transparent text-fm-color-typo-primary"} ${s.value == 31 ? "border-r" : ""}`]),
726
+ onClick: (S) => o({
727
+ bymonthday: e(t).options.bymonthday.includes(s.value) ? e(t).options.bymonthday.filter((y) => y !== s.value) : [...e(t).options.bymonthday, s.value]
728
+ })
729
+ }, $(s.value), 11, Le))), 128))
730
+ ])) : (u(), T("div", He, [
731
+ v(O, {
732
+ items: e(H).ordinals,
733
+ "model-value": (c = e(t).options.bysetpos) == null ? void 0 : c[0],
734
+ "onUpdate:modelValue": n[3] || (n[3] = (s) => o({ bysetpos: s }))
735
+ }, null, 8, ["items", "model-value"]),
736
+ Y("div", We, [
737
+ (u(!0), T(q, null, N(e(H).weekdays, (s) => {
738
+ var S;
739
+ return u(), g(b, {
740
+ class: W(["cursor-pointer", `${(S = e(t).options.byweekday) != null && S.includes(s.value) ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
741
+ label: s.label[0],
742
+ key: s.value,
743
+ compact: !0,
744
+ onClick: () => {
745
+ o({
746
+ byweekday: [s.value]
747
+ });
748
+ }
749
+ }, null, 8, ["class", "label", "onClick"]);
750
+ }), 128))
751
+ ])
752
+ ]))
753
+ ], 64)) : M("", !0),
754
+ e(t).options.freq == e(h).YEARLY ? (u(), T(q, { key: 3 }, [
755
+ n[10] || (n[10] = Y("div", null, "Month", -1)),
756
+ Y("div", _e, [
757
+ (u(!0), T(q, null, N(e(H).months, (s) => {
758
+ var S, y;
759
+ return u(), g(b, {
760
+ key: s.value,
761
+ class: W(["cursor-pointer", {
762
+ "bg-fm-color-primary text-white": (S = e(t).options.bymonth) == null ? void 0 : S.includes(
763
+ s.value
764
+ ),
765
+ "bg-fm-color-gray-200 text-fm-color-gray-800": !((y = e(t).options.bymonth) != null && y.includes(s.value))
766
+ }]),
767
+ label: s.shortName,
768
+ compact: !0,
769
+ onClick: (R) => o({
770
+ bymonth: (e(t).options.bymonth ?? []).includes(s.value) ? (e(t).options.bymonth ?? []).filter((a) => a !== s.value) : [...e(t).options.bymonth ?? [], s.value]
771
+ })
772
+ }, null, 8, ["class", "label", "onClick"]);
773
+ }), 128))
774
+ ]),
775
+ v(F, {
776
+ "model-value": e(t).options.bymonthday.length ? { label: "Each" } : { label: "On the" },
777
+ items: [
778
+ {
779
+ label: "Each"
780
+ },
781
+ {
782
+ label: "On the"
783
+ }
784
+ ],
785
+ "onUpdate:modelValue": n[4] || (n[4] = (s) => {
786
+ s.label == "Each" ? o({
787
+ bymonthday: [1],
788
+ bymonth: e(t).options.bymonth ?? [1]
789
+ }) : o({
790
+ byweekday: [e(h).SU.nth(1)],
791
+ bymonth: e(t).options.bymonth ?? [1]
792
+ });
793
+ })
794
+ }, null, 8, ["model-value"]),
795
+ e(t).options.bymonthday.length > 0 ? (u(), T("div", je, [
796
+ (u(!0), T(q, null, N(Array(31).fill(null).map((s, S) => S + 1), (s) => (u(), T("div", {
797
+ key: s,
798
+ class: W(["cursor-pointer text-center outline-1 outline-fm-color-neutral-gray-100 outline", `${e(t).options.bymonthday.includes(s) ? "bg-fm-color-primary text-fm-color-typo-white outline-transparent" : "bg-transparent text-fm-color-typo-primary"} ${s == 31 ? "border-r" : ""}`]),
799
+ onClick: (S) => o({
800
+ bymonthday: e(t).options.bymonthday.includes(s) ? e(t).options.bymonthday.filter((y) => y !== s) : [...e(t).options.bymonthday, s]
801
+ })
802
+ }, $(s), 11, Ke))), 128))
803
+ ])) : (u(), T("div", Ge, [
804
+ v(O, {
805
+ items: e(H).ordinals,
806
+ "model-value": (x = (i = e(t).options.bynweekday) == null ? void 0 : i[0]) == null ? void 0 : x[1],
807
+ "onUpdate:modelValue": n[5] || (n[5] = (s) => {
808
+ var S, y;
809
+ return o({
810
+ bynweekday: [[((y = (S = e(t).options.bynweekday) == null ? void 0 : S[0]) == null ? void 0 : y[0]) ?? 1, s]]
811
+ });
812
+ })
813
+ }, null, 8, ["items", "model-value"]),
814
+ Y("div", Qe, [
815
+ (u(!0), T(q, null, N(e(H).weekdays, (s) => {
816
+ var S, y;
817
+ return u(), g(b, {
818
+ class: W(["cursor-pointer", `${((y = (S = e(t).options.bynweekday) == null ? void 0 : S[0]) == null ? void 0 : y[0]) === s.value ? "bg-fm-color-primary text-white" : "bg-fm-color-neutral-gray-200 text-black"}`]),
819
+ label: s.label[0],
820
+ key: s.value,
821
+ compact: !0,
822
+ onClick: () => {
823
+ var R, a;
824
+ o({
825
+ bynweekday: [
826
+ [s.value, ((a = (R = e(t).options.bynweekday) == null ? void 0 : R[0]) == null ? void 0 : a[1]) ?? 1]
827
+ ]
828
+ });
829
+ }
830
+ }, null, 8, ["class", "label", "onClick"]);
831
+ }), 128))
832
+ ])
833
+ ]))
834
+ ], 64)) : M("", !0),
835
+ l.applyButton ? (u(), T("div", ze, [
836
+ v(d, {
837
+ label: "Cancel",
838
+ variant: "tertiary",
839
+ onClick: n[6] || (n[6] = (s) => m("cancel"))
840
+ }),
841
+ v(d, {
842
+ label: "Apply",
843
+ onClick: n[7] || (n[7] = (s) => m("update:model-value", e(t).toString()))
844
+ })
845
+ ])) : M("", !0)
846
+ ]);
847
+ };
848
+ }
849
+ }), Xe = { class: "grid grid-cols-4 gap-8 w-full flex-wrap py-16" }, Ze = /* @__PURE__ */ A({
850
+ __name: "IsInMonthInput",
851
+ props: {
852
+ modelValue: {
853
+ type: Object,
854
+ required: !0
855
+ }
856
+ },
857
+ emits: ["update:model-value"],
858
+ setup(l, { emit: U }) {
859
+ const V = l, m = U, f = J.months().map((t, o) => ({
860
+ name: t,
861
+ shortName: J().month(o).format("MMM"),
862
+ value: o
863
+ }));
864
+ return z(() => {
865
+ V.modelValue || m("update:model-value", []);
866
+ }), (t, o) => {
867
+ const r = k("FmChip");
868
+ return u(), T("div", Xe, [
869
+ (u(!0), T(q, null, N(e(f), (n) => {
870
+ var p, b;
871
+ return u(), g(r, {
872
+ class: W(["cursor-pointer", {
873
+ "bg-fm-color-primary text-white": (p = l.modelValue) == null ? void 0 : p.includes(n.value),
874
+ "bg-fm-color-gray-200 text-fm-color-gray-800": !((b = l.modelValue) != null && b.includes(
875
+ n.value
876
+ ))
877
+ }]),
878
+ label: n.name,
879
+ key: n.value,
880
+ compact: !0,
881
+ onClick: (F) => m(
882
+ "update:model-value",
883
+ l.modelValue.includes(n.value) ? l.modelValue.filter((d) => d !== n.value) : [...l.modelValue, n.value]
884
+ )
885
+ }, null, 8, ["class", "label", "onClick"]);
886
+ }), 128))
887
+ ]);
888
+ };
889
+ }
890
+ }), Je = { class: "" }, et = { class: "flex justify-end gap-8 w-full" }, tt = /* @__PURE__ */ A({
891
+ __name: "MenuDialog",
892
+ props: {
893
+ modelValue: { type: Boolean },
894
+ initialValue: {},
895
+ filterItems: { type: Function }
896
+ },
897
+ emits: ["update:model-value", "confirm"],
898
+ setup(l, { emit: U }) {
899
+ const V = l, m = L(), f = L(!1), t = U;
900
+ function o() {
901
+ var n;
902
+ (n = m.value) == null || n.onConfirm(), t("update:model-value", !1);
903
+ }
904
+ function r() {
905
+ t("update:model-value", !1);
906
+ }
907
+ return ue(
908
+ () => V.modelValue,
909
+ (n) => {
910
+ f.value = n;
911
+ }
912
+ ), z(() => {
913
+ f.value = V.modelValue;
914
+ }), (n, p) => {
915
+ const b = k("FmButton"), F = k("FmDialog");
916
+ return u(), g(F, {
917
+ "content-scrollable": !1,
918
+ contentClass: "pt-0",
919
+ modelValue: f.value,
920
+ "onUpdate:modelValue": p[0] || (p[0] = (d) => f.value = d),
921
+ title: "Select Items",
922
+ "close-button": !1
923
+ }, {
924
+ "dialog-header": w(() => [...p[1] || (p[1] = [
925
+ Y("div", null, "Select Item", -1)
926
+ ])]),
927
+ "dialog-footer": w(() => [
928
+ Y("div", et, [
929
+ v(b, {
930
+ variant: "tertiary",
931
+ onClick: r,
932
+ label: "Cancel"
933
+ }),
934
+ v(b, {
935
+ variant: "primary",
936
+ onClick: o,
937
+ label: "Confirm"
938
+ })
939
+ ])
940
+ ]),
941
+ default: w(() => [
942
+ Y("div", Je, [
943
+ v(xe, {
944
+ ref_key: "selectItemRef",
945
+ ref: m,
946
+ "initial-value": l.initialValue,
947
+ "filter-items": l.filterItems,
948
+ "on-complete": (d) => {
949
+ t("confirm", d), r();
950
+ }
951
+ }, null, 8, ["initial-value", "filter-items", "on-complete"])
952
+ ])
953
+ ]),
954
+ _: 1
955
+ }, 8, ["modelValue"]);
956
+ };
957
+ }
958
+ }), lt = { id: "select-menu" }, ot = /* @__PURE__ */ A({
959
+ __name: "SelectMenu",
960
+ props: {
961
+ modelValue: {}
962
+ },
963
+ emits: ["update:model-value"],
964
+ setup(l, { emit: U }) {
965
+ const V = l, m = L(!1), f = I(() => {
966
+ var r;
967
+ return ((r = V.modelValue) == null ? void 0 : r.length) || 0;
968
+ }), t = U;
969
+ function o(r) {
970
+ t("update:model-value", r);
971
+ }
972
+ return (r, n) => {
973
+ const p = k("FmField");
974
+ return u(), T("div", lt, [
975
+ v(p, {
976
+ class: "text-fm-color-typo-tertiary",
977
+ onClick: n[0] || (n[0] = (b) => m.value = !0)
978
+ }, {
979
+ default: w(() => [
980
+ te($(f.value) + " item(s) selected ", 1)
981
+ ]),
982
+ _: 1
983
+ }),
984
+ v(tt, {
985
+ modelValue: m.value,
986
+ "onUpdate:modelValue": [
987
+ n[1] || (n[1] = (b) => m.value = b),
988
+ n[2] || (n[2] = (b) => m.value = b)
989
+ ],
990
+ "initial-value": l.modelValue,
991
+ onConfirm: o
992
+ }, null, 8, ["modelValue", "initial-value"])
993
+ ]);
994
+ };
995
+ }
996
+ }), at = {
997
+ key: 19,
998
+ class: "fm-typo-en-body-lg-600"
999
+ }, rt = /* @__PURE__ */ A({
1000
+ __name: "RuleEquator",
1001
+ props: {
1002
+ type: {
1003
+ type: String,
1004
+ required: !0
1005
+ },
1006
+ operator: {
1007
+ type: String,
1008
+ required: !0
1009
+ },
1010
+ modelValue: {
1011
+ type: Object
1012
+ }
1013
+ },
1014
+ emits: ["update:model-value"],
1015
+ setup(l, { emit: U }) {
1016
+ const V = l, m = U, f = I(() => {
1017
+ const t = ve[V.operator].safeParse(V.modelValue);
1018
+ return t.success ? [] : t.error.errors;
1019
+ });
1020
+ return (t, o) => {
1021
+ var i, x, s, S, y, R;
1022
+ const r = k("FmTextField"), n = k("FmStepperField"), p = k("FmSimpleDatePicker"), b = k("FmSimpleDateRangePicker"), F = k("FmTimeRangePicker"), d = k("FmTimePicker"), c = k("FmHelperText");
1023
+ return u(), T("div", {
1024
+ class: W({ "pb-4": e(f).length })
1025
+ }, [
1026
+ l.type === "text" ? (u(), g(r, {
1027
+ key: 0,
1028
+ "model-value": l.modelValue,
1029
+ "onUpdate:modelValue": o[0] || (o[0] = (a) => m("update:model-value", a))
1030
+ }, null, 8, ["model-value"])) : l.type === "number" ? (u(), g(n, {
1031
+ key: 1,
1032
+ "model-value": l.modelValue,
1033
+ "onUpdate:modelValue": o[1] || (o[1] = (a) => m("update:model-value", a))
1034
+ }, null, 8, ["model-value"])) : l.operator == "_isDay" ? (u(), g(ae(we), {
1035
+ key: 2,
1036
+ "model-value": l.modelValue,
1037
+ "onUpdate:modelValue": o[2] || (o[2] = (a) => m("update:model-value", a))
1038
+ }, null, 8, ["model-value"])) : l.operator == "_isRange" ? (u(), g(ae(Ie), {
1039
+ key: 3,
1040
+ "model-value": l.modelValue,
1041
+ "onUpdate:modelValue": o[3] || (o[3] = (a) => m("update:model-value", a))
1042
+ }, null, 8, ["model-value"])) : l.operator == "_isOnDate" ? (u(), g(p, {
1043
+ key: 4,
1044
+ "model-value": l.modelValue,
1045
+ "onUpdate:modelValue": o[4] || (o[4] = (a) => m("update:model-value", a))
1046
+ }, null, 8, ["model-value"])) : l.operator == "_isBetween" ? (u(), g(b, {
1047
+ key: 5,
1048
+ "model-value": {
1049
+ startDate: (i = l.modelValue) == null ? void 0 : i.start,
1050
+ endDate: (x = l.modelValue) == null ? void 0 : x.end
1051
+ },
1052
+ "onUpdate:modelValue": o[5] || (o[5] = (a) => {
1053
+ m("update:model-value", {
1054
+ start: a.startDate,
1055
+ end: a.endDate
1056
+ });
1057
+ })
1058
+ }, null, 8, ["model-value"])) : l.operator == "_isInMonth" ? (u(), g(Ze, {
1059
+ key: 6,
1060
+ "model-value": l.modelValue,
1061
+ "onUpdate:modelValue": o[6] || (o[6] = (a) => m("update:model-value", a))
1062
+ }, null, 8, ["model-value"])) : l.operator == "_rrule" ? (u(), g(ee, {
1063
+ key: 7,
1064
+ "model-value": l.modelValue,
1065
+ "onUpdate:modelValue": o[7] || (o[7] = (a) => m("update:model-value", a))
1066
+ }, null, 8, ["model-value"])) : l.operator == "_isBetweenTime" ? (u(), g(F, {
1067
+ key: 8,
1068
+ "disable-time-check": !0,
1069
+ "model-value": [(S = (s = l.modelValue) == null ? void 0 : s[0]) == null ? void 0 : S.start, (R = (y = l.modelValue) == null ? void 0 : y[0]) == null ? void 0 : R.end],
1070
+ "onUpdate:modelValue": o[8] || (o[8] = (a) => m("update:model-value", [
1071
+ {
1072
+ start: a[0],
1073
+ end: a[1]
1074
+ }
1075
+ ]))
1076
+ }, null, 8, ["model-value"])) : l.operator == "_isOnTime" ? (u(), g(d, {
1077
+ key: 9,
1078
+ "model-value": l.modelValue,
1079
+ "onUpdate:modelValue": o[9] || (o[9] = (a) => m("update:model-value", a))
1080
+ }, null, 8, ["model-value"])) : l.type == "tier" ? (u(), g(O, {
1081
+ key: 10,
1082
+ items: (e(Q)().sortedTiers ?? []).map((a, B) => ({
1083
+ label: `Tier ${B + 1} - ${a.name}`,
1084
+ value: B + 1
1085
+ })),
1086
+ "model-value": l.modelValue,
1087
+ "onUpdate:modelValue": o[10] || (o[10] = (a) => m("update:model-value", a))
1088
+ }, null, 8, ["items", "model-value"])) : l.type == "boolean" ? (u(), g(O, {
1089
+ key: 11,
1090
+ multiselect: !0,
1091
+ items: [
1092
+ { label: "true", value: !0 },
1093
+ { label: "false", value: !1 }
1094
+ ],
1095
+ "model-value": l.modelValue ?? [],
1096
+ "onUpdate:modelValue": o[11] || (o[11] = (a) => m("update:model-value", a))
1097
+ }, null, 8, ["model-value"])) : l.type == "exist" ? (u(), g(O, {
1098
+ key: 12,
1099
+ items: [
1100
+ { label: "true", value: "true" },
1101
+ { label: "false", value: "false" }
1102
+ ],
1103
+ "model-value": l.modelValue ?? [],
1104
+ "onUpdate:modelValue": o[12] || (o[12] = (a) => m("update:model-value", a))
1105
+ }, null, 8, ["model-value"])) : l.type == "gender" ? (u(), g(O, {
1106
+ key: 13,
1107
+ multiselect: !0,
1108
+ items: [
1109
+ { label: "Male", value: "MALE" },
1110
+ { label: "Female", value: "FEMALE" }
1111
+ ],
1112
+ "model-value": l.modelValue ?? [],
1113
+ "onUpdate:modelValue": o[13] || (o[13] = (a) => m("update:model-value", a))
1114
+ }, null, 8, ["model-value"])) : l.type == "collectible" ? (u(), g(O, {
1115
+ key: 14,
1116
+ multiselect: !0,
1117
+ items: [],
1118
+ "model-value": l.modelValue ?? [],
1119
+ "onUpdate:modelValue": o[14] || (o[14] = (a) => m("update:model-value", a))
1120
+ }, null, 8, ["model-value"])) : l.type == "segment" ? (u(), g(O, {
1121
+ key: 15,
1122
+ multiselect: !0,
1123
+ items: e(Q)().segmentOptions,
1124
+ "model-value": l.modelValue ?? [],
1125
+ "onUpdate:modelValue": o[15] || (o[15] = (a) => m("update:model-value", a)),
1126
+ label: "Select segment(s) to match"
1127
+ }, null, 8, ["items", "model-value"])) : l.type == "title" ? (u(), g(O, {
1128
+ key: 16,
1129
+ multiselect: !0,
1130
+ items: (e(Q)().sortedTitles ?? []).map((a) => ({
1131
+ label: a.name,
1132
+ value: a._id
1133
+ })),
1134
+ "model-value": l.modelValue ?? [],
1135
+ "onUpdate:modelValue": o[16] || (o[16] = (a) => m("update:model-value", a))
1136
+ }, null, 8, ["items", "model-value"])) : l.type == "product" ? (u(), g(ot, {
1137
+ key: 17,
1138
+ "model-value": l.modelValue,
1139
+ "onUpdate:modelValue": o[17] || (o[17] = (a) => m("update:model-value", a))
1140
+ }, null, 8, ["model-value"])) : l.type == "location" ? (u(), g(O, {
1141
+ key: 18,
1142
+ multiselect: !0,
1143
+ items: e(X)().locations.map((a) => ({
1144
+ label: a.name,
1145
+ value: a._id
1146
+ })),
1147
+ "model-value": l.modelValue ?? [],
1148
+ "onUpdate:modelValue": o[18] || (o[18] = (a) => m("update:model-value", a))
1149
+ }, null, 8, ["items", "model-value"])) : (u(), T("div", at, "Rule: " + $(l.type) + " Not implemented", 1)),
1150
+ v(c, {
1151
+ class: "items-end",
1152
+ state: e(Z).helperState(e(f), ""),
1153
+ text: e(Z).helperText(e(f), "")
1154
+ }, null, 8, ["state", "text"])
1155
+ ], 2);
1156
+ };
1157
+ }
1158
+ }), nt = { class: "space-y-4" }, ut = { class: "flex items-center gap-8" }, st = { class: "flex items-center justify-end gap-8 pt-16 w-full" }, it = /* @__PURE__ */ A({
1159
+ __name: "CustomRuleDialog",
1160
+ props: {
1161
+ triggerType: {
1162
+ type: String,
1163
+ required: !0
1164
+ },
1165
+ includeOnly: {
1166
+ type: String
1167
+ },
1168
+ modelValue: {
1169
+ type: Object,
1170
+ default: () => {
1171
+ }
1172
+ }
1173
+ },
1174
+ setup(l) {
1175
+ const U = le(), V = Q(), { emitData: m, emitAction: f } = me(), t = l, o = I(
1176
+ () => fe(t.triggerType, t.includeOnly)
1177
+ ), r = (R) => re[o.value.find((a) => a.property === R).type], n = I(() => {
1178
+ if (!d.value) return [];
1179
+ const R = o.value.find(
1180
+ (a) => a.property === d.value.property
1181
+ );
1182
+ return R ? re[R.type].filter((a) => {
1183
+ var B, P;
1184
+ return !((P = (B = ne[a]) == null ? void 0 : B.exclude) != null && P.includes(d.value.property));
1185
+ }).map((a) => ({
1186
+ label: ne[a].name,
1187
+ value: a
1188
+ })) : [];
1189
+ }), p = be, b = I(() => {
1190
+ const R = p.safeParse(d.value);
1191
+ return R.success ? [] : R.error.errors;
1192
+ }), F = L(!1), d = L(
1193
+ pe(t.modelValue) ?? C.constructEntry(
1194
+ o.value[0].property,
1195
+ r(o.value[0].property)[0],
1196
+ null
1197
+ )
1198
+ ), c = I(() => {
1199
+ var _;
1200
+ const { property: R, negated: a, conditions: B } = d.value, P = Object.keys(B || {})[0], j = Object.values(B || {})[0];
1201
+ return {
1202
+ property: R,
1203
+ negated: a == !0,
1204
+ type: (_ = o.value.find((K) => K.property === R)) == null ? void 0 : _.type,
1205
+ operator: P,
1206
+ equator: j
1207
+ };
1208
+ });
1209
+ function i(R) {
1210
+ d.value = C.constructEntry(
1211
+ R,
1212
+ r(R)[0],
1213
+ null
1214
+ );
1215
+ }
1216
+ function x(R) {
1217
+ d.value = { ...d.value, negated: R == !0 };
1218
+ }
1219
+ function s(R) {
1220
+ d.value = {
1221
+ ...d.value,
1222
+ conditions: { [R]: null }
1223
+ };
1224
+ }
1225
+ function S(R) {
1226
+ d.value.conditions = {
1227
+ [c.value.operator]: R
1228
+ };
1229
+ }
1230
+ function y() {
1231
+ m(d.value), f("primary"), U.close();
1232
+ }
1233
+ return se(async () => {
1234
+ await V.readMembership();
1235
+ }), (R, a) => {
1236
+ const B = k("FmIcon"), P = k("FmField"), j = k("FmPill"), _ = k("FmMenuItem"), K = k("FmMenu"), G = k("FmButton");
1237
+ return u(), T("div", nt, [
1238
+ a[5] || (a[5] = Y("div", { class: "fm-typo-en-body-lg-400" }, "Property", -1)),
1239
+ v(K, {
1240
+ shift: !0,
1241
+ placement: "bottom-start",
1242
+ modelValue: e(F),
1243
+ "onUpdate:modelValue": a[0] || (a[0] = (D) => ye(F) ? F.value = D : null),
1244
+ onMenuChanged: a[1] || (a[1] = (D) => F.value = D),
1245
+ "max-height": 300
1246
+ }, {
1247
+ "menu-button": w(() => [
1248
+ v(P, null, {
1249
+ append: w(() => [
1250
+ v(B, {
1251
+ name: e(F) ? "expand_less" : "expand_more"
1252
+ }, null, 8, ["name"])
1253
+ ]),
1254
+ default: w(() => {
1255
+ var D;
1256
+ return [
1257
+ te($((D = e(o).find((E) => E.property == e(d).property)) == null ? void 0 : D.name) + " ", 1)
1258
+ ];
1259
+ }),
1260
+ _: 1
1261
+ })
1262
+ ]),
1263
+ default: w(() => [
1264
+ (u(!0), T(q, null, N(e(o), (D) => (u(), g(_, {
1265
+ key: D.property,
1266
+ "model-value": e(d).property == D.property,
1267
+ label: D.name,
1268
+ disabled: D.premium && !e(X)().isPremium,
1269
+ onClick: (E) => D.premium && !e(X)().isPremium ? null : i(D.property)
1270
+ }, ie({ _: 2 }, [
1271
+ D.premium ? {
1272
+ name: "append",
1273
+ fn: w(() => [
1274
+ v(j, { variant: "premium" })
1275
+ ]),
1276
+ key: "0"
1277
+ } : void 0
1278
+ ]), 1032, ["model-value", "label", "disabled", "onClick"]))), 128))
1279
+ ]),
1280
+ _: 1
1281
+ }, 8, ["modelValue"]),
1282
+ a[6] || (a[6] = Y("div", { class: "fm-typo-en-body-lg-400" }, "Check to perform", -1)),
1283
+ Y("div", ut, [
1284
+ v(O, {
1285
+ class: "w-1/4",
1286
+ items: [
1287
+ { label: "is", value: !1 },
1288
+ { label: "is not", value: !0 }
1289
+ ],
1290
+ "model-value": e(d).negated ?? !1,
1291
+ "onUpdate:modelValue": x
1292
+ }, null, 8, ["model-value"]),
1293
+ v(O, {
1294
+ class: "flex-1",
1295
+ items: e(n),
1296
+ "model-value": e(c).operator,
1297
+ "onUpdate:modelValue": s
1298
+ }, null, 8, ["items", "model-value"])
1299
+ ]),
1300
+ Y("div", null, [
1301
+ a[4] || (a[4] = Y("div", { class: "fm-typo-en-body-lg-400" }, "Criteria", -1)),
1302
+ e(c).type ? (u(), g(rt, {
1303
+ key: 0,
1304
+ type: e(c).type,
1305
+ operator: e(c).operator,
1306
+ "model-value": e(c).equator,
1307
+ "onUpdate:modelValue": S
1308
+ }, null, 8, ["type", "operator", "model-value"])) : M("", !0)
1309
+ ]),
1310
+ Y("div", st, [
1311
+ v(G, {
1312
+ onClick: a[2] || (a[2] = (D) => e(U).close()),
1313
+ label: "Cancel",
1314
+ variant: "tertiary"
1315
+ }),
1316
+ v(G, {
1317
+ onClick: a[3] || (a[3] = (D) => y()),
1318
+ disabled: e(b).length > 0,
1319
+ label: "Save"
1320
+ }, null, 8, ["disabled"])
1321
+ ])
1322
+ ]);
1323
+ };
1324
+ }
1325
+ }), mt = { class: "flex flex-col gap-8" }, dt = { class: "grid grid-cols-2 items-center" }, pt = { class: "flex items-center gap-8" }, yt = { class: "pt-16 flex items-center self-end gap-8" }, ct = /* @__PURE__ */ A({
1326
+ __name: "PresetRuleDialog",
1327
+ props: {
1328
+ preset: {
1329
+ type: String,
1330
+ required: !0
1331
+ },
1332
+ defaultValue: {
1333
+ type: Object
1334
+ },
1335
+ modelValue: {
1336
+ type: Object
1337
+ }
1338
+ },
1339
+ setup(l) {
1340
+ const U = le(), { emitData: V, emitAction: m } = me(), f = Q(), t = l;
1341
+ function o() {
1342
+ const { operator: c, equator: i } = p.value;
1343
+ switch (t.preset) {
1344
+ case "MIN_SPEND":
1345
+ case "SPECIFIC_DATE":
1346
+ case "SPECIFIC_TIMERANGE":
1347
+ case "WEEKLY":
1348
+ case "MONTHLY":
1349
+ case "BIRTHDAY":
1350
+ case "TIER":
1351
+ return `Applies to ${f.sortedTiers.filter((s, S) => c == "_equal" ? S + 1 == i : c == "_moreThanOrEqual" ? S + 1 >= i : S + 1 <= i).map((s) => s.name).join(", ")}`;
1352
+ }
1353
+ }
1354
+ function r() {
1355
+ var c, i;
1356
+ switch (t.preset) {
1357
+ case "MIN_SPEND":
1358
+ return C.constructEntry("bill.amount", "_moreThanOrEqual", 0);
1359
+ case "SPECIFIC_DATE":
1360
+ return C.constructEntry(
1361
+ "trigger.date",
1362
+ "_isOnDate",
1363
+ (/* @__PURE__ */ new Date()).toISOString()
1364
+ );
1365
+ case "SPECIFIC_TIMERANGE":
1366
+ return C.constructEntry("trigger.time", "_isBetweenTime", [
1367
+ { start: "00:00", end: "23:59" }
1368
+ ]);
1369
+ case "WEEKLY":
1370
+ return C.constructEntry(
1371
+ "trigger.date",
1372
+ "_rrule",
1373
+ "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1374
+ );
1375
+ case "MONTHLY":
1376
+ return C.constructEntry(
1377
+ "trigger.date",
1378
+ "_rrule",
1379
+ "RRULE:FREQ=MONTHLY;WKST=SU;BYMONTHDAY=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1380
+ );
1381
+ case "BIRTHDAY":
1382
+ console.log("birthday", t);
1383
+ const x = C.constructEntry(
1384
+ t.defaultValue.property,
1385
+ t.defaultValue.operator,
1386
+ t.defaultValue.equator
1387
+ );
1388
+ return console.log(x), x;
1389
+ case "TIER":
1390
+ return C.constructEntry("user.tier", "_equal", 1);
1391
+ case "TITLE":
1392
+ return C.constructEntry("user.titles", "_hasAny", [
1393
+ (i = (c = f.sortedTitles) == null ? void 0 : c[0]) == null ? void 0 : i._id
1394
+ ]);
1395
+ case "LAST_X_DAY":
1396
+ return C.constructEntry("user.stats.lastVisit", "_isRange", {
1397
+ op: "last",
1398
+ unit: "day",
1399
+ ignoreYear: !0,
1400
+ x: 0
1401
+ });
1402
+ case "CUSTOM":
1403
+ throw new Error("Not implemented");
1404
+ }
1405
+ }
1406
+ const n = L(r()), p = I(() => {
1407
+ const c = C.simplify(n.value);
1408
+ return {
1409
+ ...c,
1410
+ equator: c.equator
1411
+ };
1412
+ });
1413
+ function b(c, i) {
1414
+ const x = p.value;
1415
+ n.value = C.constructEntry(
1416
+ x.property,
1417
+ i ?? x.operator,
1418
+ c,
1419
+ n.value.name
1420
+ );
1421
+ }
1422
+ function F() {
1423
+ V(n.value), m("primary"), U.close();
1424
+ }
1425
+ const d = I(() => {
1426
+ const c = ge.safeParse(n.value);
1427
+ return c.success ? [] : c.error.errors;
1428
+ });
1429
+ return se(async () => {
1430
+ await f.readMembership();
1431
+ }), (c, i) => {
1432
+ var j, _, K, G, D;
1433
+ const x = k("FmStepperField"), s = k("FmDatePicker"), S = k("FmTimeRangePicker"), y = k("FmRadio"), R = k("FmSelect"), a = k("FmRadioGroup"), B = k("FmHelperText"), P = k("FmButton");
1434
+ return u(), T("div", mt, [
1435
+ l.preset == "MIN_SPEND" ? (u(), g(x, {
1436
+ key: 0,
1437
+ label: "Minimum spend",
1438
+ "model-value": e(p).equator,
1439
+ "onUpdate:modelValue": i[0] || (i[0] = (E) => b(E))
1440
+ }, null, 8, ["model-value"])) : M("", !0),
1441
+ l.preset == "LAST_X_DAY" ? (u(), g(x, {
1442
+ key: 1,
1443
+ label: "",
1444
+ min: 0,
1445
+ prepent: "Day(s)",
1446
+ "model-value": e(p).equator.x,
1447
+ rules: [(E) => E >= 0 || "Value must be greater than 0"],
1448
+ "onUpdate:modelValue": i[1] || (i[1] = (E) => b({
1449
+ op: "last",
1450
+ unit: "day",
1451
+ ignoreYear: !0,
1452
+ x: E
1453
+ }))
1454
+ }, null, 8, ["model-value", "rules"])) : l.preset == "SPECIFIC_DATE" ? (u(), g(s, {
1455
+ key: 2,
1456
+ label: "Specific Date",
1457
+ "model-value": e(p).equator,
1458
+ "onUpdate:modelValue": i[2] || (i[2] = (E) => b(E))
1459
+ }, null, 8, ["model-value"])) : l.preset == "SPECIFIC_TIMERANGE" ? (u(), g(S, {
1460
+ key: 3,
1461
+ label: "Time is between",
1462
+ "disable-time-check": !0,
1463
+ "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],
1464
+ "onUpdate:modelValue": i[3] || (i[3] = (E) => b([
1465
+ {
1466
+ start: E[0],
1467
+ end: E[1]
1468
+ }
1469
+ ]))
1470
+ }, null, 8, ["model-value"])) : l.preset == "WEEKLY" ? (u(), g(ee, {
1471
+ key: 4,
1472
+ label: "Weekly",
1473
+ "fixed-frequency": !0,
1474
+ "model-value": e(p).equator,
1475
+ "onUpdate:modelValue": i[4] || (i[4] = (E) => b(E))
1476
+ }, null, 8, ["model-value"])) : l.preset == "MONTHLY" ? (u(), g(ee, {
1477
+ key: 5,
1478
+ label: "Weekly",
1479
+ "fixed-frequency": !0,
1480
+ "model-value": e(p).equator,
1481
+ "onUpdate:modelValue": i[5] || (i[5] = (E) => b(E))
1482
+ }, null, 8, ["model-value"])) : l.preset == "BIRTHDAY" ? (u(), T(q, { key: 6 }, [
1483
+ Y("div", dt, [
1484
+ v(y, {
1485
+ label: "N days before birthday",
1486
+ value: "_isDay",
1487
+ "model-value": e(p).operator,
1488
+ "onUpdate:modelValue": i[6] || (i[6] = () => {
1489
+ b(
1490
+ {
1491
+ op: "after",
1492
+ x: 1,
1493
+ ignoreYear: !0
1494
+ },
1495
+ "_isDay"
1496
+ );
1497
+ })
1498
+ }, null, 8, ["model-value"]),
1499
+ Y("div", pt, [
1500
+ v(y, {
1501
+ label: "Is in this",
1502
+ value: "_isRange",
1503
+ "model-value": e(p).operator,
1504
+ "onUpdate:modelValue": i[7] || (i[7] = () => {
1505
+ b(
1506
+ {
1507
+ op: "this",
1508
+ unit: "day",
1509
+ ignoreYear: !0
1510
+ },
1511
+ "_isRange"
1512
+ );
1513
+ })
1514
+ }, null, 8, ["model-value"]),
1515
+ e(p).operator == "_isRange" ? (u(), g(R, {
1516
+ key: 0,
1517
+ items: ["day", "week", "month"].map((E) => ({ label: E, value: E })),
1518
+ "model-value": e(p).equator.unit,
1519
+ "onUpdate:modelValue": i[8] || (i[8] = (E) => b(
1520
+ {
1521
+ op: "this",
1522
+ unit: E,
1523
+ ignoreYear: !0
1524
+ },
1525
+ "_isRange"
1526
+ ))
1527
+ }, null, 8, ["items", "model-value"])) : M("", !0)
1528
+ ])
1529
+ ]),
1530
+ e(p).operator == "_isDay" ? (u(), g(x, {
1531
+ key: 0,
1532
+ label: "Days before birthday",
1533
+ "show-steppers": !1,
1534
+ "model-value": e(p).equator.x,
1535
+ "onUpdate:modelValue": i[9] || (i[9] = (E) => b({
1536
+ op: "after",
1537
+ x: E,
1538
+ ignoreYear: !0
1539
+ }))
1540
+ }, null, 8, ["model-value"])) : M("", !0)
1541
+ ], 64)) : l.preset == "TIER" ? (u(), T(q, { key: 7 }, [
1542
+ v(a, {
1543
+ inline: !0,
1544
+ "model-value": e(p).operator,
1545
+ "onUpdate:modelValue": i[10] || (i[10] = (E) => b(e(p).equator, E))
1546
+ }, {
1547
+ default: w(() => [
1548
+ v(y, {
1549
+ value: "_moreThanOrEqual",
1550
+ label: "At least"
1551
+ }),
1552
+ v(y, {
1553
+ value: "_equal",
1554
+ label: "Equal"
1555
+ }),
1556
+ v(y, {
1557
+ value: "_lessThanOrEqual",
1558
+ label: "At most"
1559
+ })
1560
+ ]),
1561
+ _: 1
1562
+ }, 8, ["model-value"]),
1563
+ v(O, {
1564
+ items: (e(f).sortedTiers ?? []).map((E, oe) => ({
1565
+ label: `Tier ${oe + 1} - ${E.name}`,
1566
+ value: oe + 1
1567
+ })),
1568
+ "model-value": e(p).equator,
1569
+ "onUpdate:modelValue": i[11] || (i[11] = (E) => b(E))
1570
+ }, null, 8, ["items", "model-value"]),
1571
+ v(B, {
1572
+ text: o()
1573
+ }, null, 8, ["text"])
1574
+ ], 64)) : l.preset == "TITLE" ? (u(), g(O, {
1575
+ key: 8,
1576
+ label: "User has title",
1577
+ items: (e(f).sortedTitles ?? []).map((E) => ({
1578
+ label: E.name,
1579
+ value: E._id
1580
+ })),
1581
+ "model-value": (D = e(p).equator) == null ? void 0 : D[0],
1582
+ "onUpdate:modelValue": i[12] || (i[12] = (E) => b([E]))
1583
+ }, null, 8, ["items", "model-value"])) : M("", !0),
1584
+ v(B, {
1585
+ class: "mt-[-8px]",
1586
+ text: e(Z).helperText(e(d), ""),
1587
+ state: e(Z).helperState(e(d), "")
1588
+ }, null, 8, ["text", "state"]),
1589
+ Y("div", yt, [
1590
+ v(P, {
1591
+ onClick: i[13] || (i[13] = (E) => e(U).close()),
1592
+ label: "Cancel",
1593
+ variant: "tertiary"
1594
+ }),
1595
+ v(P, {
1596
+ onClick: i[14] || (i[14] = (E) => F()),
1597
+ disabled: e(d).length > 0,
1598
+ label: "Save"
1599
+ }, null, 8, ["disabled"])
1600
+ ])
1601
+ ]);
1602
+ };
1603
+ }
1604
+ }), vt = /* @__PURE__ */ A({
1605
+ __name: "RuleConfigurator",
1606
+ props: {
1607
+ triggerType: {
1608
+ type: String,
1609
+ required: !0
1610
+ },
1611
+ includeOnly: {
1612
+ type: String
1613
+ },
1614
+ modelValue: {
1615
+ type: Object,
1616
+ default: () => {
1617
+ }
1618
+ }
1619
+ },
1620
+ emits: ["update:model-value"],
1621
+ setup(l, { expose: U, emit: V }) {
1622
+ const m = X(), { t: f } = de(), t = l, o = V, r = le(), n = L();
1623
+ function p(d) {
1624
+ const [c] = d.rules;
1625
+ r.open({
1626
+ title: d.name,
1627
+ closeButton: !1,
1628
+ dismissAway: !1,
1629
+ contentComponent: ct,
1630
+ contentComponentProps: {
1631
+ preset: d.type,
1632
+ defaultValue: c,
1633
+ modelValue: t.modelValue
1634
+ }
1635
+ }).onPrimary((i) => o("update:model-value", i));
1636
+ }
1637
+ function b(d) {
1638
+ r.open({
1639
+ title: f("connect.template.rule.edit_rule"),
1640
+ closeButton: !1,
1641
+ dismissAway: !1,
1642
+ contentComponent: it,
1643
+ contentComponentProps: {
1644
+ triggerType: t.triggerType,
1645
+ includeOnly: t.includeOnly,
1646
+ modelValue: d
1647
+ }
1648
+ }).onPrimary((c) => o("update:model-value", c));
1649
+ }
1650
+ function F(d) {
1651
+ if (d.type == "CUSTOM") {
1652
+ const [c] = d.rules;
1653
+ return b(
1654
+ C.constructEntry(c.property, c.operator, c.equator)
1655
+ );
1656
+ }
1657
+ return p(d);
1658
+ }
1659
+ return U({
1660
+ showCustomDialog: b
1661
+ }), (d, c) => {
1662
+ const i = k("FmButton"), x = k("FmPill"), s = k("FmMenuItem"), S = k("FmMenu");
1663
+ return u(), g(S, {
1664
+ shift: !0,
1665
+ placement: "top-start"
1666
+ }, {
1667
+ "menu-button": w(() => [
1668
+ v(i, {
1669
+ label: e(f)("connect.template.rule.add_condition"),
1670
+ icon: "add",
1671
+ class: "text-fm-color-primary border-fm-color-primary",
1672
+ "icon-color": "primary",
1673
+ variant: "secondary"
1674
+ }, null, 8, ["label"])
1675
+ ]),
1676
+ default: w(() => [
1677
+ (u(!0), T(q, null, N(e(he).filter(
1678
+ (y) => !l.includeOnly || y.for.includes(l.includeOnly)
1679
+ ), (y) => (u(), g(s, {
1680
+ key: y.name,
1681
+ "model-value": y.name == e(n),
1682
+ label: y.name,
1683
+ onClick: () => {
1684
+ y != null && y.premium && !e(m).isPremium || F(y);
1685
+ },
1686
+ disabled: (y == null ? void 0 : y.premium) && !e(m).isPremium
1687
+ }, ie({ _: 2 }, [
1688
+ y != null && y.premium ? {
1689
+ name: "append",
1690
+ fn: w(() => [
1691
+ v(x, { variant: "premium" })
1692
+ ]),
1693
+ key: "0"
1694
+ } : void 0
1695
+ ]), 1032, ["model-value", "label", "onClick", "disabled"]))), 128))
1696
+ ]),
1697
+ _: 1
1698
+ });
1699
+ };
1700
+ }
1701
+ }), ft = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, It = /* @__PURE__ */ A({
1702
+ __name: "RuleGroup",
1703
+ props: {
1704
+ triggerType: {
1705
+ type: String,
1706
+ required: !0
1707
+ },
1708
+ includeOnly: {
1709
+ type: String
1710
+ },
1711
+ modelValue: {
1712
+ type: Object
1713
+ }
1714
+ },
1715
+ emits: ["update:model-value"],
1716
+ setup(l, { emit: U }) {
1717
+ const V = l, m = U, f = Ve(), { t } = de(), o = I(
1718
+ () => V.modelValue ?? C.scaffoldGroup()
1719
+ ), r = I(() => C.getLogic(o.value)), n = I(() => [
1720
+ { label: t("connect.template.rule.and"), value: "&&" },
1721
+ { label: t("connect.template.rule.or"), value: "||" }
1722
+ ]), p = L();
1723
+ function b(F, d) {
1724
+ try {
1725
+ const c = C.setRuleToGroup(F, d);
1726
+ C.isRuleExceed(F, d), m("update:model-value", c);
1727
+ } catch (c) {
1728
+ f.open({
1729
+ message: c.message,
1730
+ type: "error"
1731
+ });
1732
+ }
1733
+ }
1734
+ return (F, d) => {
1735
+ const c = k("FmButtonGroup"), i = k("FmCard");
1736
+ return u(), g(i, { variant: "outlined" }, {
1737
+ default: w(() => [
1738
+ v(i, { class: "border-l-4 border-fm-color-primary p-16 space-y-16" }, {
1739
+ default: w(() => [
1740
+ Y("div", ft, $(e(t)("connect.template.rule.when")), 1),
1741
+ v(vt, {
1742
+ ref_key: "configuratorRef",
1743
+ ref: p,
1744
+ "include-only": l.includeOnly,
1745
+ "trigger-type": l.triggerType,
1746
+ "onUpdate:modelValue": d[0] || (d[0] = (x) => b(e(o), x))
1747
+ }, null, 8, ["include-only", "trigger-type"]),
1748
+ (u(!0), T(q, null, N(e(o).rules, (x, s) => {
1749
+ var S;
1750
+ return u(), T(q, null, [
1751
+ e(ke)(x) ? (u(), g(De, {
1752
+ "model-value": x,
1753
+ key: s,
1754
+ onEdit: (S = e(p)) == null ? void 0 : S.showCustomDialog,
1755
+ onRemove: d[1] || (d[1] = (y) => {
1756
+ m(
1757
+ "update:model-value",
1758
+ e(C).removeEntry(e(o), y.name)
1759
+ );
1760
+ })
1761
+ }, null, 8, ["model-value", "onEdit"])) : M("", !0),
1762
+ v(c, {
1763
+ class: "w-[200px]",
1764
+ disabled: Object.keys(e(o).rules).length < 2,
1765
+ items: e(n),
1766
+ "model-value": e(n).find((y) => y.value === e(r)) ?? null,
1767
+ "onUpdate:modelValue": d[2] || (d[2] = (y) => m(
1768
+ "update:model-value",
1769
+ e(C).setRuleToGroup(
1770
+ e(o),
1771
+ [],
1772
+ y.value
1773
+ )
1774
+ ))
1775
+ }, null, 8, ["disabled", "items", "model-value"])
1776
+ ], 64);
1777
+ }), 256))
1778
+ ]),
1779
+ _: 1
1780
+ })
1781
+ ]),
1782
+ _: 1
1783
+ });
1784
+ };
1785
+ }
1786
+ });
1787
+ export {
1788
+ It as _,
1789
+ ee as a
1790
+ };