@feedmepos/mf-connect 0.1.87-prod → 0.1.89-prod

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/dist/{Analytic-B9s-dPCT.js → Analytic-Caz3AQQ2.js} +11 -11
  2. package/dist/{App-Bu9NaLJ4.js → App-D_q4nHiY.js} +7 -7
  3. package/dist/{Bin-BUUuvk8j.js → Bin-DURa0qe2.js} +8 -8
  4. package/dist/{Broadcast-VvFRuN2K.js → Broadcast-ByDjXqap.js} +8 -8
  5. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CgA2btmM.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BD8mWUzO.js} +7 -7
  6. package/dist/{Card--OD7WD_W.js → Card-BSSzVrbz.js} +19 -19
  7. package/dist/{Collections-DemrIeUs.js → Collections-CTwUl8W3.js} +8 -8
  8. package/dist/{Credit-PFNGAhPj.js → Credit-TgZBmYsM.js} +8 -8
  9. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-DyuJDS7x.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-DZV3JtDl.js} +33 -33
  10. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-BLjGHozS.js → EffectSheet.vue_vue_type_style_index_0_lang-BwOs5NHt.js} +6 -6
  11. package/dist/{Experience-BCVsnWYw.js → Experience-DUCO6do6.js} +8 -8
  12. package/dist/{FileSaver.min-BMBGjHQ2.js → FileSaver.min-BaCfYtPG.js} +1 -1
  13. package/dist/FmTableSelection.vue_vue_type_script_setup_true_lang-DzcUc0_w.js +52 -0
  14. package/dist/{Game-B3Gxv2v-.js → Game-DcwQSCjZ.js} +9 -9
  15. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-CyMgFI2D.js → ImageInput.vue_vue_type_script_setup_true_lang-BSMwEFqp.js} +1 -1
  16. package/dist/{Index-R4XrhBHJ.js → Index-Bp2CKHw3.js} +10 -10
  17. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-DjpZnU4y.js → LottieAnimation.vue_vue_type_script_setup_true_lang-WWVHvcOU.js} +1 -1
  18. package/dist/{MainLayout-Cd8eCkPV.js → MainLayout-Q_0POZ4I.js} +1 -1
  19. package/dist/{Marketing-BzBEJgtQ.js → Marketing-D52IYXPR.js} +6 -6
  20. package/dist/{Member-CTFEe38e.js → Member-sxjxhLwQ.js} +12 -12
  21. package/dist/{MemberList-oL4hRjbk.js → MemberList-vLNFHNRw.js} +27 -27
  22. package/dist/{MemberTransactions-CUzzrl_F.js → MemberTransactions-BeHeN0Rk.js} +1 -1
  23. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-D3X7vfMo.js → MessageInput.vue_vue_type_script_setup_true_lang-B6cF0EC3.js} +9 -9
  24. package/dist/{Mission-C93sLLDp.js → Mission-CnJCjBhe.js} +9 -9
  25. package/dist/{Overview-CANS2hu-.js → Overview-B3jRs_Cg.js} +19 -19
  26. package/dist/{Point-D3Qk09Kr.js → Point-BldY5wb0.js} +8 -8
  27. package/dist/{Promotion-Dtd_dDh4.js → Promotion-CsGhqlY0.js} +9 -9
  28. package/dist/{Queue-bAOANEOe.js → Queue-CLa2pSXF.js} +11 -11
  29. package/dist/{Record-7Nsigxg9.js → Record-JbbAM6lI.js} +9 -9
  30. package/dist/{Reward-BCCSo5Ao.js → Reward-wgiBCIV3.js} +16 -16
  31. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-sVQ2XtOZ.js → RewardGroup.vue_vue_type_script_setup_true_lang-DiNlpy7_.js} +12 -12
  32. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-B3Ylb1vx.js +1889 -0
  33. package/dist/{Segment-BTtsXpEm.js → Segment-BQiZ51Wi.js} +25 -25
  34. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-Etmkc-3s.js → SelectItems.vue_vue_type_script_setup_true_lang-DbXFTjAN.js} +2 -2
  35. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-Dc2_TQiF.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-Be_kiAB6.js} +13 -13
  36. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-DS1MWUOc.js +226 -0
  37. package/dist/Setting-De1lCG6N.js +1989 -0
  38. package/dist/{SettingAdvertisements-D9Lhamel.js → SettingAdvertisements-OdDM05s7.js} +12 -12
  39. package/dist/{Store-VZ8appMT.js → Store-D1Q0wOXk.js} +289 -285
  40. package/dist/{StoreRewards-egMoq16P.js → StoreRewards-2Gdv7uu4.js} +15 -15
  41. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-Bh33_foI.js → StoreTransactions.vue_vue_type_script_setup_true_lang-NtxHf8HF.js} +20 -20
  42. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-BKzZIJkt.js +140 -0
  43. package/dist/{Tier-IQfhLdUW.js → Tier-DOnYGgah.js} +22 -22
  44. package/dist/{Title-DAhwskG_.js → Title-F4XJw6oN.js} +21 -21
  45. package/dist/{Transaction-DoYHMx8C.js → Transaction-Ws7kBZUE.js} +2 -2
  46. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-B6SAfZCS.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-BZb0EXgi.js} +6 -6
  47. package/dist/{Voucher-CjUzxTj9.js → Voucher-DX8MKz00.js} +12 -12
  48. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-DjwuuQOy.js → VoucherEditor.vue_vue_type_script_setup_true_lang-tUNn1vRE.js} +12 -12
  49. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-905euk7D.js → ZodTextField.vue_vue_type_script_setup_true_lang-BvgIZlIh.js} +2 -2
  50. package/dist/{app-BQKaKSTN.js → app-C-nC9SMv.js} +368 -83
  51. package/dist/app.js +1 -1
  52. package/dist/{business-D-Y0xqsG.js → business-CrQ_qouH.js} +1 -1
  53. package/dist/{campaign-C4FU4mF-.js → campaign-CBRSag11.js} +8 -8
  54. package/dist/{campaign-BO_GMK22.js → campaign-shm1Nb7g.js} +1 -1
  55. package/dist/{campaign.enum-ME5t80SA.js → campaign.enum-C-p5_XEd.js} +1 -1
  56. package/dist/{campaign.fn-CpSdTR_Z.js → campaign.fn-BGzZfg1o.js} +185 -185
  57. package/dist/{collectible.enum-BJNC4deW.js → collectible.enum-DxOoBouZ.js} +1 -1
  58. package/dist/{collection.fn-BclOhIak.js → collection.fn-BKmv2KVW.js} +2 -2
  59. package/dist/{dto-CeKAIN4F.js → dto-BRQj35uX.js} +4 -4
  60. package/dist/{effect-C5coTG7j.js → effect-Bbc7QO26.js} +1 -1
  61. package/dist/{email-addresses-DdpDo4U3.js → email-addresses-CdmKczY8.js} +2 -2
  62. package/dist/{export-Cd7RMmWF.js → export-xWupGZRl.js} +3 -3
  63. package/dist/{helper-8QHPhfxd.js → helper-C_t7u0sc.js} +1 -1
  64. package/dist/{index-D8LAuyy5.js → index-BHwWZLKa.js} +2 -2
  65. package/dist/{index-B2UGAU9v.js → index-BaGjDOR2.js} +1 -1
  66. package/dist/{index-DlwlvbrO.js → index-BxosLsfW.js} +1 -1
  67. package/dist/{index-e5r6FpSJ.js → index-C6PeL89d.js} +3 -3
  68. package/dist/{index-CAP90xO7.js → index-CLvFXL_E.js} +4 -4
  69. package/dist/{index-CdgAq0Pz.js → index-ClEGMTrv.js} +1 -1
  70. package/dist/{index-M5KI7NIT.js → index-DAhj82tf.js} +1 -1
  71. package/dist/{index-D_b2gjAX.js → index-DDQaEXt7.js} +1 -1
  72. package/dist/{index-BJne3mAB.js → index-DW7nPyed.js} +6 -6
  73. package/dist/{index-Rb7s8Lqk.js → index-DaCQrz9t.js} +3 -3
  74. package/dist/{index-Ch_6nXW4.js → index-REoHVOcy.js} +1 -1
  75. package/dist/{index-BJuTIPNg.js → index-RsNRLaWL.js} +1 -1
  76. package/dist/{index-Csxi8Zcu.js → index-lZq2A3X2.js} +3 -3
  77. package/dist/{index.esm2017-D6CILdWW.js → index.esm2017-DIVK9KD2.js} +1 -1
  78. package/dist/{loading-tl9p27VA.js → loading-xptL2Ny2.js} +1 -1
  79. package/dist/{lodash-fxLQlj7m.js → lodash-88xjswCi.js} +1 -1
  80. package/dist/{membership-CBpNdC9y.js → membership-eoLCZt_p.js} +3 -3
  81. package/dist/{money-CNRljtC1.js → money-DcsDa1nm.js} +1 -1
  82. package/dist/{number-DmTfN_5Y.js → number-BkGWCSrD.js} +1 -1
  83. package/dist/{objectid-BuanIDxD.js → objectid-gUqB9tj7.js} +6 -6
  84. package/dist/{plugins-DvsCeess.js → plugins-DoTCd9nY.js} +3 -3
  85. package/dist/{reward-CW22wI3L.js → reward-Culc3-Rv.js} +1 -1
  86. package/dist/{rule-C_3XR2Zd.js → rule-DUDjRs8M.js} +3 -3
  87. package/dist/{rule-builder-DrwCpDKV.js → rule-builder-CkZtoez-.js} +1 -1
  88. package/dist/{template-CBaQ8LLp.js → template-CxhdtuLf.js} +7 -7
  89. package/dist/{timezone-DSEM5B5J.js → timezone-CdsdekR2.js} +2 -2
  90. package/dist/{trigger-3QCLi7tq.js → trigger-CFXIiuLd.js} +5 -5
  91. package/dist/usePagination-BSeGmTq6.js +177 -0
  92. package/dist/{user-CY_UexCt.js → user-C7hrMSvV.js} +1 -1
  93. package/dist/{vue-i18n-DGcpLn5c.js → vue-i18n-BdGyU2Nr.js} +111 -111
  94. package/dist/{xlsx-rSwsIehi.js → xlsx-BN2KFkI2.js} +1 -1
  95. package/dist/{zod-BD5VYWIO.js → zod-DvUTBth7.js} +1 -1
  96. package/package.json +1 -1
  97. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-C2ZrTL5p.js +0 -1767
  98. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-DPDq-Juz.js +0 -147
  99. package/dist/Setting-D5YbEHxm.js +0 -1982
  100. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-qWbACUbe.js +0 -139
  101. package/dist/usePagination-CZ7RnfzE.js +0 -223
@@ -1,1767 +0,0 @@
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 { a as ce, C as ve, b as be, c as fe, d as ge } from "./index-Csxi8Zcu.js";
3
- import { R as D, a as ke } from "./rule-builder-DrwCpDKV.js";
4
- import { useDialog as le, useDialogChild as ie, useSnackbar as Ve } from "@feedmepos/ui-library";
5
- import { u as me } from "./vue-i18n-DGcpLn5c.js";
6
- import { a as Ee, R, S as Te, C as H, W as Se, T as re, O as ne } from "./rule-C_3XR2Zd.js";
7
- import { p as Fe } from "./plugins-DvsCeess.js";
8
- import { h as J } from "./moment-D7p2TMB-.js";
9
- import { z as Ue } from "./app-BQKaKSTN.js";
10
- import { u as Q } from "./membership-CBpNdC9y.js";
11
- import { u as X } from "./business-D-Y0xqsG.js";
12
- import "./index-Rb7s8Lqk.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-BD5VYWIO.js";
16
- import { _ as xe } from "./SelectItems.vue_vue_type_script_setup_true_lang-Etmkc-3s.js";
17
- import "./index-CAP90xO7.js";
18
- import "./index-BJne3mAB.js";
19
- import "./index-CdgAq0Pz.js";
20
- import "./index-e5r6FpSJ.js";
21
- 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({
22
- __name: "RuleEntry",
23
- props: {
24
- modelValue: {
25
- type: Object,
26
- required: !0
27
- }
28
- },
29
- emits: ["edit", "remove"],
30
- setup(l, { emit: Y }) {
31
- const c = l, i = B(() => {
32
- const [u, y] = Object.entries(c.modelValue.conditions)[0];
33
- return {
34
- negated: c.modelValue.negated == !0,
35
- property: c.modelValue.property,
36
- operator: u,
37
- equator: y
38
- };
39
- }), o = Y, d = B(
40
- () => Ee(
41
- i.value.property,
42
- i.value.operator,
43
- i.value.equator,
44
- i.value.negated
45
- )
46
- );
47
- async function t(u) {
48
- u.stopPropagation(), await Fe.remove("Are you sure you want to remove this rule?") && o("remove", c.modelValue);
49
- }
50
- return (u, y) => {
51
- var m;
52
- const p = k("FmChip"), f = k("FmTooltip"), S = k("FmIcon");
53
- return n(), T("div", Re, [
54
- C("div", Ye, [
55
- b(p, {
56
- label: (m = e(ce).find((v) => v.property === c.modelValue.property)) == null ? void 0 : m.name,
57
- class: "!text-fm-color-typo-info !bg-fm-color-system-info-100"
58
- }, null, 8, ["label"]),
59
- y[1] || (y[1] = C("div", { class: "h-[26px] border-l-2 rounded-md border-fm-color-neutral-gray-100" }, null, -1)),
60
- C("div", {
61
- onClick: y[0] || (y[0] = (v) => o("edit", c.modelValue)),
62
- class: "inline-flex rounded-md items-center gap-4 justify-center h-[30px] px-8 py-4 text-fm-color-typo-primary !bg-transparent border-dashed border-2 fm-typo-en-body-md-600 cursor-pointer"
63
- }, [
64
- te($(e(d)[0]) + " ", 1),
65
- b(f, {
66
- "z-index": 1e3,
67
- content: e(d)[1]
68
- }, {
69
- default: q(() => [
70
- C("div", Ce, $(e(d)[1]), 1)
71
- ]),
72
- _: 1
73
- }, 8, ["content"])
74
- ])
75
- ]),
76
- b(S, {
77
- name: "close",
78
- size: "md",
79
- class: "cursor-pointer hover:bg-neutral-300 rounded-lg",
80
- onClick: t
81
- })
82
- ]);
83
- };
84
- }
85
- });
86
- Ue.enum([
87
- "MIN_SPEND",
88
- "SPECIFIC_DATE",
89
- "SPECIFIC_TIMERANGE",
90
- "WEEKLY",
91
- "MONTHLY",
92
- "BIRTHDAY",
93
- "TIER",
94
- "TITLE",
95
- "LAST_X_DAY",
96
- "CUSTOM"
97
- ]);
98
- const Oe = [
99
- {
100
- type: "MIN_SPEND",
101
- name: "Minimum spend",
102
- for: ["bill"],
103
- rules: []
104
- },
105
- {
106
- type: "SPECIFIC_DATE",
107
- name: "Specific date",
108
- for: ["trigger"],
109
- rules: []
110
- },
111
- {
112
- type: "SPECIFIC_TIMERANGE",
113
- name: "Specific time range",
114
- for: ["trigger"],
115
- rules: []
116
- },
117
- {
118
- type: "WEEKLY",
119
- name: "Weekly",
120
- for: ["trigger"],
121
- rules: [
122
- {
123
- property: "trigger.date",
124
- operator: "_rrule",
125
- equator: "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
126
- }
127
- ]
128
- },
129
- {
130
- type: "MONTHLY",
131
- name: "Monthly",
132
- for: ["trigger"],
133
- rules: [
134
- {
135
- property: "trigger.date",
136
- operator: "_rrule",
137
- equator: "RRULE:FREQ=MONTHLY;WKST=SU;BYMONTHDAY=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
138
- }
139
- ]
140
- },
141
- {
142
- type: "BIRTHDAY",
143
- name: "Birthday",
144
- for: ["user"],
145
- rules: [
146
- {
147
- property: "user.birthday",
148
- operator: "_isRange",
149
- equator: {
150
- op: "this",
151
- unit: "day",
152
- ignoreYear: !0
153
- }
154
- }
155
- ]
156
- },
157
- {
158
- type: "BIRTHDAY",
159
- name: "Birthday Week",
160
- for: ["user"],
161
- rules: [
162
- {
163
- property: "user.birthday",
164
- operator: "_isRange",
165
- equator: {
166
- op: "this",
167
- unit: "week",
168
- ignoreYear: !0
169
- }
170
- }
171
- ]
172
- },
173
- {
174
- type: "BIRTHDAY",
175
- name: "Birthday Month",
176
- for: ["user"],
177
- rules: [
178
- {
179
- property: "user.birthday",
180
- operator: "_isRange",
181
- equator: {
182
- op: "this",
183
- unit: "month",
184
- ignoreYear: !0
185
- }
186
- }
187
- ]
188
- },
189
- {
190
- type: "BIRTHDAY",
191
- name: "N day before birthday",
192
- for: ["user"],
193
- rules: [
194
- {
195
- property: "user.birthday",
196
- operator: "_isDay",
197
- equator: {
198
- op: "before",
199
- x: 1,
200
- ignoreYear: !0
201
- }
202
- }
203
- ]
204
- },
205
- {
206
- type: "TIER",
207
- name: "Specific tier",
208
- for: ["user"],
209
- rules: [
210
- {
211
- property: "user.tier",
212
- operator: "_equal",
213
- equator: 1
214
- }
215
- ]
216
- },
217
- {
218
- type: "TITLE",
219
- name: "Specific title",
220
- for: ["user"],
221
- rules: [
222
- {
223
- property: "user.titles",
224
- operator: "_hasAny",
225
- equator: []
226
- }
227
- ]
228
- },
229
- {
230
- type: "LAST_X_DAY",
231
- name: "Last visit in X days",
232
- for: ["user"],
233
- rules: [
234
- {
235
- property: "user.stats.lastVisit",
236
- operator: "_isRange",
237
- equator: {
238
- op: "last",
239
- unit: "day",
240
- ignoreYear: !0,
241
- x: 0
242
- }
243
- }
244
- ],
245
- premium: !0
246
- },
247
- {
248
- type: "CUSTOM",
249
- name: "Weekday special",
250
- for: ["trigger"],
251
- rules: [
252
- {
253
- property: "trigger.date",
254
- operator: "_rrule",
255
- equator: "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=MO,TU,WE,TH,FR;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
256
- }
257
- ]
258
- },
259
- {
260
- type: "CUSTOM",
261
- name: "Weekend special",
262
- for: ["trigger"],
263
- rules: [
264
- {
265
- property: "trigger.date",
266
- operator: "_rrule",
267
- equator: "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU,SA;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
268
- }
269
- ]
270
- },
271
- {
272
- type: "CUSTOM",
273
- name: "Happy hour",
274
- for: ["trigger"],
275
- rules: [
276
- {
277
- property: "trigger.time",
278
- operator: "_isBetweenTime",
279
- equator: [
280
- {
281
- start: "21:00",
282
- end: "23:59"
283
- }
284
- ]
285
- }
286
- ]
287
- },
288
- {
289
- type: "CUSTOM",
290
- name: "Mother's day special",
291
- for: ["trigger"],
292
- rules: [
293
- {
294
- property: "trigger.date",
295
- operator: "_rrule",
296
- equator: "RRULE:FREQ=YEARLY;WKST=SU;BYDAY=+2SU;BYMONTH=5;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
297
- }
298
- ]
299
- },
300
- {
301
- type: "CUSTOM",
302
- name: "Father's day special",
303
- for: ["trigger"],
304
- rules: [
305
- {
306
- property: "trigger.date",
307
- operator: "_rrule",
308
- equator: "RRULE:FREQ=YEARLY;WKST=SU;BYDAY=+3SU;BYMONTH=6;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
309
- }
310
- ]
311
- },
312
- {
313
- type: "CUSTOM",
314
- name: "Christmas",
315
- for: ["trigger"],
316
- rules: [
317
- {
318
- property: "trigger.date",
319
- operator: "_rrule",
320
- equator: "RRULE:FREQ=YEARLY;WKST=SU;BYMONTH=12;BYMONTHDAY=25;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
321
- }
322
- ]
323
- },
324
- {
325
- type: "CUSTOM",
326
- name: "Feedback rating",
327
- for: ["feedback"],
328
- rules: [
329
- {
330
- property: "feedback.rating",
331
- operator: "_lessThanOrEqual",
332
- equator: 5
333
- }
334
- ]
335
- },
336
- {
337
- type: "CUSTOM",
338
- name: "Custom",
339
- for: ["trigger", "user", "bill", "feedback"],
340
- rules: [
341
- {
342
- property: "trigger.date",
343
- operator: "_isOnDate",
344
- equator: J().format("YYYY-MM-DD")
345
- }
346
- ]
347
- }
348
- ], we = { class: "flex flex-nowrap gap-x-4 items-center" }, he = /* @__PURE__ */ A({
349
- __name: "IsDayInput",
350
- props: {
351
- modelValue: {
352
- type: Object
353
- }
354
- },
355
- emits: ["update:model-value"],
356
- setup(l, { emit: Y }) {
357
- const c = l, i = Y;
358
- z(() => {
359
- c.modelValue || i("update:model-value", {
360
- op: "before",
361
- x: 1
362
- });
363
- });
364
- function o(d) {
365
- const t = de(
366
- c.modelValue ?? {
367
- op: "before",
368
- x: 1
369
- }
370
- );
371
- i("update:model-value", {
372
- ...t,
373
- ...d
374
- });
375
- }
376
- return (d, t) => {
377
- var y, p, f;
378
- const u = k("FmStepperField");
379
- return n(), T("div", we, [
380
- b(u, {
381
- class: "w-1/3",
382
- "model-value": ((y = l.modelValue) == null ? void 0 : y.x) ?? null,
383
- max: 365,
384
- "show-steppers": !1,
385
- "append-text": "days",
386
- "onUpdate:modelValue": t[0] || (t[0] = (S) => o({ x: S }))
387
- }, null, 8, ["model-value"]),
388
- b(O, {
389
- "model-value": ((p = l.modelValue) == null ? void 0 : p.op) ?? void 0,
390
- items: [
391
- { label: "before", value: "before" },
392
- { label: "after", value: "after" }
393
- ],
394
- "onUpdate:modelValue": t[1] || (t[1] = (S) => o({ op: S }))
395
- }, null, 8, ["model-value"]),
396
- b(O, {
397
- "model-value": ((f = l.modelValue) == null ? void 0 : f.ignoreYear) ?? !1,
398
- items: [
399
- { label: "same year", value: !1 },
400
- { label: "ignore year", value: !0 }
401
- ],
402
- required: !0,
403
- "onUpdate:modelValue": t[2] || (t[2] = (S) => o({ ignoreYear: S == !0 }))
404
- }, null, 8, ["model-value"])
405
- ]);
406
- };
407
- }
408
- }), qe = { class: "grid grid-cols-4 gap-x-4 items-center" }, Ie = /* @__PURE__ */ A({
409
- __name: "IsRangeInput",
410
- props: {
411
- modelValue: {
412
- type: Object,
413
- default: () => ({
414
- op: "this",
415
- unit: "day",
416
- ignoreYear: !0
417
- })
418
- }
419
- },
420
- emits: ["update:model-value"],
421
- setup(l, { emit: Y }) {
422
- const c = l, i = Y;
423
- z(() => {
424
- c.modelValue || i("update:model-value", {
425
- op: "this",
426
- unit: "day",
427
- ignoreYear: !0
428
- });
429
- });
430
- const o = [
431
- { label: "day", value: "day" },
432
- { label: "week", value: "week" },
433
- { label: "month", value: "month" },
434
- { label: "quarter", value: "quarter" },
435
- { label: "year", value: "year" }
436
- ], d = [
437
- {
438
- label: "this",
439
- value: "this"
440
- },
441
- {
442
- label: "last",
443
- value: "last"
444
- },
445
- {
446
- label: "next",
447
- value: "next"
448
- }
449
- ];
450
- return (t, u) => {
451
- var p, f, S, m, v;
452
- const y = k("FmStepperField");
453
- return n(), T("div", qe, [
454
- b(O, {
455
- "model-value": (p = l.modelValue) == null ? void 0 : p.op,
456
- label: "",
457
- items: d,
458
- required: !0,
459
- "onUpdate:modelValue": u[0] || (u[0] = (s) => i("update:model-value", { op: s, unit: "day", ignoreYear: !1 }))
460
- }, null, 8, ["model-value"]),
461
- ((f = l.modelValue) == null ? void 0 : f.op) != "this" ? (n(), g(y, {
462
- key: 0,
463
- "model-value": ((S = l.modelValue) == null ? void 0 : S.x) || 0,
464
- max: 365,
465
- "show-steppers": !1,
466
- "onUpdate:modelValue": u[1] || (u[1] = (s) => i("update:model-value", {
467
- op: l.modelValue.op,
468
- unit: l.modelValue.unit,
469
- ignoreYear: l.modelValue.ignoreYear == !0,
470
- x: s
471
- }))
472
- }, null, 8, ["model-value"])) : M("", !0),
473
- b(O, {
474
- "model-value": (m = l.modelValue) == null ? void 0 : m.unit,
475
- label: "",
476
- items: o,
477
- required: !0,
478
- "onUpdate:modelValue": u[2] || (u[2] = (s) => i("update:model-value", { ...c.modelValue, unit: s }))
479
- }, null, 8, ["model-value"]),
480
- b(O, {
481
- label: "",
482
- "model-value": (v = l.modelValue) == null ? void 0 : v.ignoreYear,
483
- items: [
484
- { label: "same", value: !1 },
485
- { label: "ignore", value: !0 }
486
- ],
487
- required: !0,
488
- "onUpdate:modelValue": u[3] || (u[3] = (s) => i("update:model-value", {
489
- ...c.modelValue,
490
- ignoreYear: s == !0
491
- }))
492
- }, null, 8, ["model-value"])
493
- ]);
494
- };
495
- }
496
- }), Be = { class: "space-y-8" }, Me = { class: "text-fm-color-primary rounded-md border-dashed border-2 p-8" }, Ae = {
497
- key: 0,
498
- class: "flex items-center gap-8"
499
- }, Ne = { class: "flex gap-4" }, Pe = {
500
- key: 0,
501
- class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
502
- }, $e = ["onClick"], Le = {
503
- key: 1,
504
- class: "flex items-center gap-8"
505
- }, He = { class: "flex gap-4 xs:gap-[2px]" }, We = { class: "grid grid-cols-6 gap-8" }, _e = {
506
- key: 0,
507
- class: "grid grid-cols-7 overflow-hidden rounded-md border-1"
508
- }, je = ["onClick"], Ke = {
509
- key: 1,
510
- class: "grid grid-cols-2 items-center gap-8"
511
- }, Ge = { class: "flex gap-4" }, Qe = {
512
- key: 4,
513
- class: "flex items-center justify-end gap-8"
514
- }, ee = /* @__PURE__ */ A({
515
- __name: "RruleInput",
516
- props: {
517
- modelValue: {
518
- type: String
519
- },
520
- startDate: {
521
- type: Object
522
- },
523
- applyButton: {
524
- type: Boolean
525
- },
526
- fixedFrequency: {
527
- type: Boolean
528
- }
529
- },
530
- emits: ["update:model-value", "cancel"],
531
- setup(l, { emit: Y }) {
532
- const c = l, i = Y, o = L(
533
- c.modelValue ? R.fromString(c.modelValue) : new R({
534
- dtstart: c.startDate,
535
- freq: R.DAILY,
536
- wkst: R.SU,
537
- interval: 1,
538
- byhour: 0,
539
- byminute: 0,
540
- bysecond: 0
541
- })
542
- );
543
- function d(t) {
544
- var u;
545
- if ("freq" in t)
546
- switch (t.freq) {
547
- case R.WEEKLY:
548
- o.value = new R({
549
- dtstart: c.startDate,
550
- freq: t.freq,
551
- interval: 1,
552
- byhour: 0,
553
- byminute: 0,
554
- bysecond: 0,
555
- wkst: R.SU,
556
- byweekday: [R.MO]
557
- });
558
- break;
559
- case R.MONTHLY:
560
- o.value = new R({
561
- dtstart: c.startDate,
562
- freq: t.freq,
563
- interval: 1,
564
- byhour: 0,
565
- byminute: 0,
566
- bysecond: 0,
567
- bymonthday: [(/* @__PURE__ */ new Date()).getDate()],
568
- wkst: R.SU
569
- });
570
- break;
571
- case R.YEARLY:
572
- o.value = new R({
573
- dtstart: c.startDate,
574
- freq: t.freq,
575
- interval: 1,
576
- byhour: 0,
577
- byminute: 0,
578
- bysecond: 0,
579
- wkst: R.SU,
580
- bymonth: [(/* @__PURE__ */ new Date()).getMonth() + 1],
581
- bymonthday: [(/* @__PURE__ */ new Date()).getDate()]
582
- });
583
- break;
584
- default:
585
- o.value = new R({
586
- dtstart: c.startDate,
587
- freq: t.freq,
588
- interval: 1,
589
- byhour: 0,
590
- byminute: 0,
591
- bysecond: 0,
592
- wkst: R.SU
593
- });
594
- }
595
- t.interval && t.interval > 0 && (o.value = new R({
596
- ...o.value.origOptions,
597
- dtstart: c.startDate,
598
- interval: t.interval
599
- })), "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({
600
- ...o.value.origOptions,
601
- dtstart: c.startDate,
602
- bymonthday: [],
603
- byweekday: t.byweekday
604
- })), "bysetpos" in t && t.bysetpos != null && (o.value = new R({
605
- ...o.value.origOptions,
606
- dtstart: c.startDate,
607
- bymonthday: [],
608
- bysetpos: t.bysetpos,
609
- byweekday: ((u = o.value.options.byweekday) == null ? void 0 : u.length) > 0 ? o.value.options.byweekday : [6]
610
- })), "bymonthday" in t && t.bymonthday && Array.isArray(t.bymonthday) && t.bymonthday.length > 0 && (o.value = new R({
611
- ...o.value.origOptions,
612
- dtstart: c.startDate,
613
- bysetpos: [],
614
- byweekday: [],
615
- bymonthday: t.bymonthday
616
- })), "bymonth" in t && t.bymonth && Array.isArray(t.bymonth) && t.bymonth.length > 0 && (o.value = new R({
617
- ...o.value.origOptions,
618
- dtstart: c.startDate,
619
- bysetpos: [],
620
- bymonth: t.bymonth
621
- })), "bynweekday" in t && t.bynweekday && (o.value = new R({
622
- ...o.value.origOptions,
623
- dtstart: c.startDate,
624
- bysetpos: [],
625
- byweekday: new Se(
626
- t.bynweekday[0][0],
627
- t.bynweekday[0][1]
628
- )
629
- })), c.applyButton || i("update:model-value", o.value.toString());
630
- }
631
- return z(() => {
632
- c.modelValue || i(
633
- "update:model-value",
634
- new R({
635
- dtstart: c.startDate,
636
- freq: R.DAILY,
637
- wkst: R.SU,
638
- interval: 1,
639
- byhour: 0,
640
- byminute: 0,
641
- bysecond: 0
642
- }).toString()
643
- );
644
- }), (t, u) => {
645
- var m, v, s;
646
- const y = k("FmStepperField"), p = k("FmChip"), f = k("FmButtonGroup"), S = k("FmButton");
647
- return n(), T("div", Be, [
648
- C("div", Me, $(e(Te)(e(o).options)), 1),
649
- l.fixedFrequency ? M("", !0) : (n(), T("div", Ae, [
650
- u[8] || (u[8] = C("div", null, "Repeat every", -1)),
651
- b(y, {
652
- class: "w-[100px]",
653
- "model-value": e(o).options.interval,
654
- "onUpdate:modelValue": u[0] || (u[0] = (a) => d({ interval: a > 0 ? a : e(o).options.interval })),
655
- min: 1
656
- }, null, 8, ["model-value"]),
657
- b(O, {
658
- class: "w-min",
659
- items: e(H).frequencies,
660
- "model-value": e(o).origOptions.freq,
661
- "onUpdate:modelValue": u[1] || (u[1] = (a) => d({ freq: a }))
662
- }, null, 8, ["items", "model-value"])
663
- ])),
664
- e(o).options.freq === e(R).WEEKLY ? (n(), T(h, { key: 1 }, [
665
- u[9] || (u[9] = C("div", null, "Repeat on", -1)),
666
- C("div", Ne, [
667
- (n(!0), T(h, null, N(e(H).weekdays, (a) => {
668
- var F;
669
- return n(), g(p, {
670
- 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"}`]),
671
- label: a.label[0],
672
- key: a.value,
673
- compact: !0,
674
- onClick: () => {
675
- var x, V;
676
- d({
677
- 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]
678
- });
679
- }
680
- }, null, 8, ["class", "label", "onClick"]);
681
- }), 128))
682
- ])
683
- ], 64)) : M("", !0),
684
- e(o).options.freq == e(R).MONTHLY ? (n(), T(h, { key: 2 }, [
685
- b(f, {
686
- "model-value": e(o).options.bymonthday.length ? { label: "Each" } : { label: "On the" },
687
- items: [
688
- {
689
- label: "Each"
690
- },
691
- {
692
- label: "On the"
693
- }
694
- ],
695
- "onUpdate:modelValue": u[2] || (u[2] = (a) => {
696
- a.label == "Each" ? d({ bymonthday: [1] }) : d({ bysetpos: 1 });
697
- })
698
- }, null, 8, ["model-value"]),
699
- e(o).options.bymonthday.length > 0 ? (n(), T("div", Pe, [
700
- (n(!0), T(h, null, N(e(H).dates, (a) => (n(), T("div", {
701
- key: a.value,
702
- 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" : ""}`]),
703
- onClick: (F) => d({
704
- bymonthday: e(o).options.bymonthday.includes(a.value) ? e(o).options.bymonthday.filter((x) => x !== a.value) : [...e(o).options.bymonthday, a.value]
705
- })
706
- }, $(a.value), 11, $e))), 128))
707
- ])) : (n(), T("div", Le, [
708
- b(O, {
709
- items: e(H).ordinals,
710
- "model-value": (m = e(o).options.bysetpos) == null ? void 0 : m[0],
711
- "onUpdate:modelValue": u[3] || (u[3] = (a) => d({ bysetpos: a }))
712
- }, null, 8, ["items", "model-value"]),
713
- C("div", He, [
714
- (n(!0), T(h, null, N(e(H).weekdays, (a) => {
715
- var F;
716
- return n(), g(p, {
717
- 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"}`]),
718
- label: a.label[0],
719
- key: a.value,
720
- compact: !0,
721
- onClick: () => {
722
- d({
723
- byweekday: [a.value]
724
- });
725
- }
726
- }, null, 8, ["class", "label", "onClick"]);
727
- }), 128))
728
- ])
729
- ]))
730
- ], 64)) : M("", !0),
731
- e(o).options.freq == e(R).YEARLY ? (n(), T(h, { key: 3 }, [
732
- u[10] || (u[10] = C("div", null, "Month", -1)),
733
- C("div", We, [
734
- (n(!0), T(h, null, N(e(H).months, (a) => {
735
- var F, x;
736
- return n(), g(p, {
737
- key: a.value,
738
- class: W(["cursor-pointer", {
739
- "bg-fm-color-primary text-white": (F = e(o).options.bymonth) == null ? void 0 : F.includes(
740
- a.value
741
- ),
742
- "bg-fm-color-gray-200 text-fm-color-gray-800": !((x = e(o).options.bymonth) != null && x.includes(a.value))
743
- }]),
744
- label: a.shortName,
745
- compact: !0,
746
- onClick: (V) => d({
747
- bymonth: (e(o).options.bymonth ?? []).includes(a.value) ? (e(o).options.bymonth ?? []).filter((U) => U !== a.value) : [...e(o).options.bymonth ?? [], a.value]
748
- })
749
- }, null, 8, ["class", "label", "onClick"]);
750
- }), 128))
751
- ]),
752
- b(f, {
753
- "model-value": e(o).options.bymonthday.length ? { label: "Each" } : { label: "On the" },
754
- items: [
755
- {
756
- label: "Each"
757
- },
758
- {
759
- label: "On the"
760
- }
761
- ],
762
- "onUpdate:modelValue": u[4] || (u[4] = (a) => {
763
- a.label == "Each" ? d({
764
- bymonthday: [1],
765
- bymonth: e(o).options.bymonth ?? [1]
766
- }) : d({
767
- byweekday: [e(R).SU.nth(1)],
768
- bymonth: e(o).options.bymonth ?? [1]
769
- });
770
- })
771
- }, null, 8, ["model-value"]),
772
- e(o).options.bymonthday.length > 0 ? (n(), T("div", _e, [
773
- (n(!0), T(h, null, N(Array(31).fill(null).map((a, F) => F + 1), (a) => (n(), T("div", {
774
- key: a,
775
- 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" : ""}`]),
776
- onClick: (F) => d({
777
- bymonthday: e(o).options.bymonthday.includes(a) ? e(o).options.bymonthday.filter((x) => x !== a) : [...e(o).options.bymonthday, a]
778
- })
779
- }, $(a), 11, je))), 128))
780
- ])) : (n(), T("div", Ke, [
781
- b(O, {
782
- items: e(H).ordinals,
783
- "model-value": (s = (v = e(o).options.bynweekday) == null ? void 0 : v[0]) == null ? void 0 : s[1],
784
- "onUpdate:modelValue": u[5] || (u[5] = (a) => {
785
- var F, x;
786
- return d({
787
- bynweekday: [[((x = (F = e(o).options.bynweekday) == null ? void 0 : F[0]) == null ? void 0 : x[0]) ?? 1, a]]
788
- });
789
- })
790
- }, null, 8, ["items", "model-value"]),
791
- C("div", Ge, [
792
- (n(!0), T(h, null, N(e(H).weekdays, (a) => {
793
- var F, x;
794
- return n(), g(p, {
795
- 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"}`]),
796
- label: a.label[0],
797
- key: a.value,
798
- compact: !0,
799
- onClick: () => {
800
- var V, U;
801
- d({
802
- bynweekday: [
803
- [a.value, ((U = (V = e(o).options.bynweekday) == null ? void 0 : V[0]) == null ? void 0 : U[1]) ?? 1]
804
- ]
805
- });
806
- }
807
- }, null, 8, ["class", "label", "onClick"]);
808
- }), 128))
809
- ])
810
- ]))
811
- ], 64)) : M("", !0),
812
- l.applyButton ? (n(), T("div", Qe, [
813
- b(S, {
814
- label: "Cancel",
815
- variant: "tertiary",
816
- onClick: u[6] || (u[6] = (a) => i("cancel"))
817
- }),
818
- b(S, {
819
- label: "Apply",
820
- onClick: u[7] || (u[7] = (a) => i("update:model-value", e(o).toString()))
821
- })
822
- ])) : M("", !0)
823
- ]);
824
- };
825
- }
826
- }), ze = { class: "grid grid-cols-4 gap-8 w-full flex-wrap py-16" }, Xe = /* @__PURE__ */ A({
827
- __name: "IsInMonthInput",
828
- props: {
829
- modelValue: {
830
- type: Object,
831
- required: !0
832
- }
833
- },
834
- emits: ["update:model-value"],
835
- setup(l, { emit: Y }) {
836
- const c = l, i = Y, o = J.months().map((d, t) => ({
837
- name: d,
838
- shortName: J().month(t).format("MMM"),
839
- value: t
840
- }));
841
- return z(() => {
842
- c.modelValue || i("update:model-value", []);
843
- }), (d, t) => {
844
- const u = k("FmChip");
845
- return n(), T("div", ze, [
846
- (n(!0), T(h, null, N(e(o), (y) => {
847
- var p, f;
848
- return n(), g(u, {
849
- class: W(["cursor-pointer", {
850
- "bg-fm-color-primary text-white": (p = l.modelValue) == null ? void 0 : p.includes(y.value),
851
- "bg-fm-color-gray-200 text-fm-color-gray-800": !((f = l.modelValue) != null && f.includes(
852
- y.value
853
- ))
854
- }]),
855
- label: y.name,
856
- key: y.value,
857
- compact: !0,
858
- onClick: (S) => i(
859
- "update:model-value",
860
- l.modelValue.includes(y.value) ? l.modelValue.filter((m) => m !== y.value) : [...l.modelValue, y.value]
861
- )
862
- }, null, 8, ["class", "label", "onClick"]);
863
- }), 128))
864
- ]);
865
- };
866
- }
867
- }), Ze = { class: "" }, Je = { class: "flex justify-end gap-8 w-full" }, et = /* @__PURE__ */ A({
868
- __name: "MenuDialog",
869
- props: {
870
- modelValue: { type: Boolean },
871
- initialValue: {},
872
- filterItems: { type: Function }
873
- },
874
- emits: ["update:model-value", "confirm"],
875
- setup(l, { emit: Y }) {
876
- const c = l, i = L(), o = L(!1), d = Y;
877
- function t() {
878
- var y;
879
- (y = i.value) == null || y.onConfirm(), d("update:model-value", !1);
880
- }
881
- function u() {
882
- d("update:model-value", !1);
883
- }
884
- return pe(
885
- () => c.modelValue,
886
- (y) => {
887
- o.value = y;
888
- }
889
- ), z(() => {
890
- o.value = c.modelValue;
891
- }), (y, p) => {
892
- const f = k("FmButton"), S = k("FmDialog");
893
- return n(), g(S, {
894
- "content-scrollable": !1,
895
- contentClass: "pt-0",
896
- modelValue: o.value,
897
- "onUpdate:modelValue": p[0] || (p[0] = (m) => o.value = m),
898
- title: "Select Items",
899
- "close-button": !1
900
- }, {
901
- "dialog-header": q(() => [...p[1] || (p[1] = [
902
- C("div", null, "Select Item", -1)
903
- ])]),
904
- "dialog-footer": q(() => [
905
- C("div", Je, [
906
- b(f, {
907
- variant: "tertiary",
908
- onClick: u,
909
- label: "Cancel"
910
- }),
911
- b(f, {
912
- variant: "primary",
913
- onClick: t,
914
- label: "Confirm"
915
- })
916
- ])
917
- ]),
918
- default: q(() => [
919
- C("div", Ze, [
920
- b(xe, {
921
- ref_key: "selectItemRef",
922
- ref: i,
923
- "initial-value": l.initialValue,
924
- "filter-items": l.filterItems,
925
- "on-complete": (m) => {
926
- d("confirm", m), u();
927
- }
928
- }, null, 8, ["initial-value", "filter-items", "on-complete"])
929
- ])
930
- ]),
931
- _: 1
932
- }, 8, ["modelValue"]);
933
- };
934
- }
935
- }), tt = { id: "select-menu" }, lt = /* @__PURE__ */ A({
936
- __name: "SelectMenu",
937
- props: {
938
- modelValue: {}
939
- },
940
- emits: ["update:model-value"],
941
- setup(l, { emit: Y }) {
942
- const c = l, i = L(!1), o = B(() => {
943
- var u;
944
- return ((u = c.modelValue) == null ? void 0 : u.length) || 0;
945
- }), d = Y;
946
- function t(u) {
947
- d("update:model-value", u);
948
- }
949
- return (u, y) => {
950
- const p = k("FmField");
951
- return n(), T("div", tt, [
952
- b(p, {
953
- class: "text-fm-color-typo-tertiary",
954
- onClick: y[0] || (y[0] = (f) => i.value = !0)
955
- }, {
956
- default: q(() => [
957
- te($(o.value) + " item(s) selected ", 1)
958
- ]),
959
- _: 1
960
- }),
961
- b(et, {
962
- modelValue: i.value,
963
- "onUpdate:modelValue": [
964
- y[1] || (y[1] = (f) => i.value = f),
965
- y[2] || (y[2] = (f) => i.value = f)
966
- ],
967
- "initial-value": l.modelValue,
968
- onConfirm: t
969
- }, null, 8, ["modelValue", "initial-value"])
970
- ]);
971
- };
972
- }
973
- }), ot = {
974
- key: 19,
975
- class: "fm-typo-en-body-lg-600"
976
- }, at = /* @__PURE__ */ A({
977
- __name: "RuleEquator",
978
- props: {
979
- type: {
980
- type: String,
981
- required: !0
982
- },
983
- operator: {
984
- type: String,
985
- required: !0
986
- },
987
- modelValue: {
988
- type: Object
989
- }
990
- },
991
- emits: ["update:model-value"],
992
- setup(l, { emit: Y }) {
993
- const c = l, i = Y, o = B(() => {
994
- const d = ve[c.operator].safeParse(c.modelValue);
995
- return d.success ? [] : d.error.errors;
996
- });
997
- return (d, t) => {
998
- var s, a, F, x, V, U;
999
- const u = k("FmTextField"), y = k("FmStepperField"), p = k("FmSimpleDatePicker"), f = k("FmSimpleDateRangePicker"), S = k("FmTimeRangePicker"), m = k("FmTimePicker"), v = k("FmHelperText");
1000
- return n(), T("div", {
1001
- class: W({ "pb-4": e(o).length })
1002
- }, [
1003
- l.type === "text" ? (n(), g(u, {
1004
- key: 0,
1005
- "model-value": l.modelValue,
1006
- "onUpdate:modelValue": t[0] || (t[0] = (r) => i("update:model-value", r))
1007
- }, null, 8, ["model-value"])) : l.type === "number" ? (n(), g(y, {
1008
- key: 1,
1009
- "model-value": l.modelValue,
1010
- "onUpdate:modelValue": t[1] || (t[1] = (r) => i("update:model-value", r))
1011
- }, null, 8, ["model-value"])) : l.operator == "_isDay" ? (n(), g(ae(he), {
1012
- key: 2,
1013
- "model-value": l.modelValue,
1014
- "onUpdate:modelValue": t[2] || (t[2] = (r) => i("update:model-value", r))
1015
- }, null, 8, ["model-value"])) : l.operator == "_isRange" ? (n(), g(ae(Ie), {
1016
- key: 3,
1017
- "model-value": l.modelValue,
1018
- "onUpdate:modelValue": t[3] || (t[3] = (r) => i("update:model-value", r))
1019
- }, null, 8, ["model-value"])) : l.operator == "_isOnDate" ? (n(), g(p, {
1020
- key: 4,
1021
- "model-value": l.modelValue,
1022
- "onUpdate:modelValue": t[4] || (t[4] = (r) => i("update:model-value", r))
1023
- }, null, 8, ["model-value"])) : l.operator == "_isBetween" ? (n(), g(f, {
1024
- key: 5,
1025
- "model-value": {
1026
- startDate: (s = l.modelValue) == null ? void 0 : s.start,
1027
- endDate: (a = l.modelValue) == null ? void 0 : a.end
1028
- },
1029
- "onUpdate:modelValue": t[5] || (t[5] = (r) => {
1030
- i("update:model-value", {
1031
- start: r.startDate,
1032
- end: r.endDate
1033
- });
1034
- })
1035
- }, null, 8, ["model-value"])) : l.operator == "_isInMonth" ? (n(), g(Xe, {
1036
- key: 6,
1037
- "model-value": l.modelValue,
1038
- "onUpdate:modelValue": t[6] || (t[6] = (r) => i("update:model-value", r))
1039
- }, null, 8, ["model-value"])) : l.operator == "_rrule" ? (n(), g(ee, {
1040
- key: 7,
1041
- "model-value": l.modelValue,
1042
- "onUpdate:modelValue": t[7] || (t[7] = (r) => i("update:model-value", r))
1043
- }, null, 8, ["model-value"])) : l.operator == "_isBetweenTime" ? (n(), g(S, {
1044
- key: 8,
1045
- "disable-time-check": !0,
1046
- "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],
1047
- "onUpdate:modelValue": t[8] || (t[8] = (r) => i("update:model-value", [
1048
- {
1049
- start: r[0],
1050
- end: r[1]
1051
- }
1052
- ]))
1053
- }, null, 8, ["model-value"])) : l.operator == "_isOnTime" ? (n(), g(m, {
1054
- key: 9,
1055
- "model-value": l.modelValue,
1056
- "onUpdate:modelValue": t[9] || (t[9] = (r) => i("update:model-value", r))
1057
- }, null, 8, ["model-value"])) : l.type == "tier" ? (n(), g(O, {
1058
- key: 10,
1059
- items: (e(Q)().sortedTiers ?? []).map((r, I) => ({
1060
- label: `Tier ${I + 1} - ${r.name}`,
1061
- value: I + 1
1062
- })),
1063
- "model-value": l.modelValue,
1064
- "onUpdate:modelValue": t[10] || (t[10] = (r) => i("update:model-value", r))
1065
- }, null, 8, ["items", "model-value"])) : l.type == "boolean" ? (n(), g(O, {
1066
- key: 11,
1067
- multiselect: !0,
1068
- items: [
1069
- { label: "true", value: !0 },
1070
- { label: "false", value: !1 }
1071
- ],
1072
- "model-value": l.modelValue ?? [],
1073
- "onUpdate:modelValue": t[11] || (t[11] = (r) => i("update:model-value", r))
1074
- }, null, 8, ["model-value"])) : l.type == "exist" ? (n(), g(O, {
1075
- key: 12,
1076
- items: [
1077
- { label: "true", value: "true" },
1078
- { label: "false", value: "false" }
1079
- ],
1080
- "model-value": l.modelValue ?? [],
1081
- "onUpdate:modelValue": t[12] || (t[12] = (r) => i("update:model-value", r))
1082
- }, null, 8, ["model-value"])) : l.type == "gender" ? (n(), g(O, {
1083
- key: 13,
1084
- multiselect: !0,
1085
- items: [
1086
- { label: "Male", value: "MALE" },
1087
- { label: "Female", value: "FEMALE" }
1088
- ],
1089
- "model-value": l.modelValue ?? [],
1090
- "onUpdate:modelValue": t[13] || (t[13] = (r) => i("update:model-value", r))
1091
- }, null, 8, ["model-value"])) : l.type == "collectible" ? (n(), g(O, {
1092
- key: 14,
1093
- multiselect: !0,
1094
- items: [],
1095
- "model-value": l.modelValue ?? [],
1096
- "onUpdate:modelValue": t[14] || (t[14] = (r) => i("update:model-value", r))
1097
- }, null, 8, ["model-value"])) : l.type == "segment" ? (n(), g(O, {
1098
- key: 15,
1099
- multiselect: !0,
1100
- items: e(Q)().segmentOptions,
1101
- "model-value": l.modelValue ?? [],
1102
- "onUpdate:modelValue": t[15] || (t[15] = (r) => i("update:model-value", r)),
1103
- label: "Select segment(s) to match"
1104
- }, null, 8, ["items", "model-value"])) : l.type == "title" ? (n(), g(O, {
1105
- key: 16,
1106
- multiselect: !0,
1107
- items: (e(Q)().sortedTitles ?? []).map((r) => ({
1108
- label: r.name,
1109
- value: r._id
1110
- })),
1111
- "model-value": l.modelValue ?? [],
1112
- "onUpdate:modelValue": t[16] || (t[16] = (r) => i("update:model-value", r))
1113
- }, null, 8, ["items", "model-value"])) : l.type == "product" ? (n(), g(lt, {
1114
- key: 17,
1115
- "model-value": l.modelValue,
1116
- "onUpdate:modelValue": t[17] || (t[17] = (r) => i("update:model-value", r))
1117
- }, null, 8, ["model-value"])) : l.type == "location" ? (n(), g(O, {
1118
- key: 18,
1119
- multiselect: !0,
1120
- items: e(X)().locations.map((r) => ({
1121
- label: r.name,
1122
- value: r._id
1123
- })),
1124
- "model-value": l.modelValue ?? [],
1125
- "onUpdate:modelValue": t[18] || (t[18] = (r) => i("update:model-value", r))
1126
- }, null, 8, ["items", "model-value"])) : (n(), T("div", ot, "Rule: " + $(l.type) + " Not implemented", 1)),
1127
- b(v, {
1128
- class: "items-end",
1129
- state: e(Z).helperState(e(o), ""),
1130
- text: e(Z).helperText(e(o), "")
1131
- }, null, 8, ["state", "text"])
1132
- ], 2);
1133
- };
1134
- }
1135
- }), 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({
1136
- __name: "CustomRuleDialog",
1137
- props: {
1138
- triggerType: {
1139
- type: String,
1140
- required: !0
1141
- },
1142
- includeOnly: {
1143
- type: String
1144
- },
1145
- modelValue: {
1146
- type: Object,
1147
- default: () => {
1148
- }
1149
- }
1150
- },
1151
- setup(l) {
1152
- const Y = le(), c = Q(), { emitData: i, emitAction: o } = ie(), d = l, t = B(
1153
- () => be(d.triggerType, d.includeOnly)
1154
- ), u = (U) => re[t.value.find((r) => r.property === U).type], y = B(() => {
1155
- if (!m.value) return [];
1156
- const U = t.value.find(
1157
- (r) => r.property === m.value.property
1158
- );
1159
- return U ? re[U.type].filter((r) => {
1160
- var I, P;
1161
- return !((P = (I = ne[r]) == null ? void 0 : I.exclude) != null && P.includes(m.value.property));
1162
- }).map((r) => ({
1163
- label: ne[r].name,
1164
- value: r
1165
- })) : [];
1166
- }), p = fe, f = B(() => {
1167
- const U = p.safeParse(m.value);
1168
- return U.success ? [] : U.error.errors;
1169
- }), S = L(!1), m = L(
1170
- de(d.modelValue) ?? D.constructEntry(
1171
- t.value[0].property,
1172
- u(t.value[0].property)[0],
1173
- null
1174
- )
1175
- ), v = B(() => {
1176
- var _;
1177
- const { property: U, negated: r, conditions: I } = m.value, P = Object.keys(I || {})[0], j = Object.values(I || {})[0];
1178
- return {
1179
- property: U,
1180
- negated: r == !0,
1181
- type: (_ = t.value.find((K) => K.property === U)) == null ? void 0 : _.type,
1182
- operator: P,
1183
- equator: j
1184
- };
1185
- });
1186
- function s(U) {
1187
- m.value = D.constructEntry(
1188
- U,
1189
- u(U)[0],
1190
- null
1191
- );
1192
- }
1193
- function a(U) {
1194
- m.value = { ...m.value, negated: U == !0 };
1195
- }
1196
- function F(U) {
1197
- m.value = {
1198
- ...m.value,
1199
- conditions: { [U]: null }
1200
- };
1201
- }
1202
- function x(U) {
1203
- m.value.conditions = {
1204
- [v.value.operator]: U
1205
- };
1206
- }
1207
- function V() {
1208
- i(m.value), o("primary"), Y.close();
1209
- }
1210
- return ue(async () => {
1211
- await c.readMembership();
1212
- }), (U, r) => {
1213
- const I = k("FmIcon"), P = k("FmField"), j = k("FmPill"), _ = k("FmMenuItem"), K = k("FmMenu"), G = k("FmButton");
1214
- return n(), T("div", rt, [
1215
- r[5] || (r[5] = C("div", { class: "fm-typo-en-body-lg-400" }, "Property", -1)),
1216
- b(K, {
1217
- shift: !0,
1218
- placement: "bottom-start",
1219
- modelValue: e(S),
1220
- "onUpdate:modelValue": r[0] || (r[0] = (w) => ye(S) ? S.value = w : null),
1221
- onMenuChanged: r[1] || (r[1] = (w) => S.value = w),
1222
- "max-height": 300
1223
- }, {
1224
- "menu-button": q(() => [
1225
- b(P, null, {
1226
- append: q(() => [
1227
- b(I, {
1228
- name: e(S) ? "expand_less" : "expand_more"
1229
- }, null, 8, ["name"])
1230
- ]),
1231
- default: q(() => {
1232
- var w;
1233
- return [
1234
- te($((w = e(t).find((E) => E.property == e(m).property)) == null ? void 0 : w.name) + " ", 1)
1235
- ];
1236
- }),
1237
- _: 1
1238
- })
1239
- ]),
1240
- default: q(() => [
1241
- (n(!0), T(h, null, N(e(t), (w) => (n(), g(_, {
1242
- key: w.property,
1243
- "model-value": e(m).property == w.property,
1244
- label: w.name,
1245
- disabled: w.premium && !e(X)().isPremium,
1246
- onClick: (E) => w.premium && !e(X)().isPremium ? null : s(w.property)
1247
- }, se({ _: 2 }, [
1248
- w.premium ? {
1249
- name: "append",
1250
- fn: q(() => [
1251
- b(j, { variant: "premium" })
1252
- ]),
1253
- key: "0"
1254
- } : void 0
1255
- ]), 1032, ["model-value", "label", "disabled", "onClick"]))), 128))
1256
- ]),
1257
- _: 1
1258
- }, 8, ["modelValue"]),
1259
- r[6] || (r[6] = C("div", { class: "fm-typo-en-body-lg-400" }, "Check to perform", -1)),
1260
- C("div", nt, [
1261
- b(O, {
1262
- class: "w-1/4",
1263
- items: [
1264
- { label: "is", value: !1 },
1265
- { label: "is not", value: !0 }
1266
- ],
1267
- "model-value": e(m).negated ?? !1,
1268
- "onUpdate:modelValue": a
1269
- }, null, 8, ["model-value"]),
1270
- b(O, {
1271
- class: "flex-1",
1272
- items: e(y),
1273
- "model-value": e(v).operator,
1274
- "onUpdate:modelValue": F
1275
- }, null, 8, ["items", "model-value"])
1276
- ]),
1277
- C("div", null, [
1278
- r[4] || (r[4] = C("div", { class: "fm-typo-en-body-lg-400" }, "Criteria", -1)),
1279
- e(v).type ? (n(), g(at, {
1280
- key: 0,
1281
- type: e(v).type,
1282
- operator: e(v).operator,
1283
- "model-value": e(v).equator,
1284
- "onUpdate:modelValue": x
1285
- }, null, 8, ["type", "operator", "model-value"])) : M("", !0)
1286
- ]),
1287
- C("div", ut, [
1288
- b(G, {
1289
- onClick: r[2] || (r[2] = (w) => e(Y).close()),
1290
- label: "Cancel",
1291
- variant: "tertiary"
1292
- }),
1293
- b(G, {
1294
- onClick: r[3] || (r[3] = (w) => V()),
1295
- disabled: e(f).length > 0,
1296
- label: "Save"
1297
- }, null, 8, ["disabled"])
1298
- ])
1299
- ]);
1300
- };
1301
- }
1302
- }), 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({
1303
- __name: "PresetRuleDialog",
1304
- props: {
1305
- preset: {
1306
- type: String,
1307
- required: !0
1308
- },
1309
- defaultValue: {
1310
- type: Object
1311
- },
1312
- modelValue: {
1313
- type: Object
1314
- }
1315
- },
1316
- setup(l) {
1317
- const Y = le(), { emitData: c, emitAction: i } = ie(), o = Q(), d = l;
1318
- function t() {
1319
- const { operator: v, equator: s } = p.value;
1320
- switch (d.preset) {
1321
- case "MIN_SPEND":
1322
- case "SPECIFIC_DATE":
1323
- case "SPECIFIC_TIMERANGE":
1324
- case "WEEKLY":
1325
- case "MONTHLY":
1326
- case "BIRTHDAY":
1327
- case "TIER":
1328
- 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(", ")}`;
1329
- }
1330
- }
1331
- function u() {
1332
- var v, s;
1333
- switch (d.preset) {
1334
- case "MIN_SPEND":
1335
- return D.constructEntry("bill.amount", "_moreThanOrEqual", 0);
1336
- case "SPECIFIC_DATE":
1337
- return D.constructEntry(
1338
- "trigger.date",
1339
- "_isOnDate",
1340
- (/* @__PURE__ */ new Date()).toISOString()
1341
- );
1342
- case "SPECIFIC_TIMERANGE":
1343
- return D.constructEntry("trigger.time", "_isBetweenTime", [
1344
- { start: "00:00", end: "23:59" }
1345
- ]);
1346
- case "WEEKLY":
1347
- return D.constructEntry(
1348
- "trigger.date",
1349
- "_rrule",
1350
- "RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=SU;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1351
- );
1352
- case "MONTHLY":
1353
- return D.constructEntry(
1354
- "trigger.date",
1355
- "_rrule",
1356
- "RRULE:FREQ=MONTHLY;WKST=SU;BYMONTHDAY=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0"
1357
- );
1358
- case "BIRTHDAY":
1359
- console.log("birthday", d);
1360
- const a = D.constructEntry(
1361
- d.defaultValue.property,
1362
- d.defaultValue.operator,
1363
- d.defaultValue.equator
1364
- );
1365
- return console.log(a), a;
1366
- case "TIER":
1367
- return D.constructEntry("user.tier", "_equal", 1);
1368
- case "TITLE":
1369
- return D.constructEntry("user.titles", "_hasAny", [
1370
- (s = (v = o.sortedTitles) == null ? void 0 : v[0]) == null ? void 0 : s._id
1371
- ]);
1372
- case "LAST_X_DAY":
1373
- return D.constructEntry("user.stats.lastVisit", "_isRange", {
1374
- op: "last",
1375
- unit: "day",
1376
- ignoreYear: !0,
1377
- x: 0
1378
- });
1379
- case "CUSTOM":
1380
- throw new Error("Not implemented");
1381
- }
1382
- }
1383
- const y = L(u()), p = B(() => {
1384
- const v = D.simplify(y.value);
1385
- return {
1386
- ...v,
1387
- equator: v.equator
1388
- };
1389
- });
1390
- function f(v, s) {
1391
- const a = p.value;
1392
- y.value = D.constructEntry(
1393
- a.property,
1394
- s ?? a.operator,
1395
- v,
1396
- y.value.name
1397
- );
1398
- }
1399
- function S() {
1400
- c(y.value), i("primary"), Y.close();
1401
- }
1402
- const m = B(() => {
1403
- const v = ge.safeParse(y.value);
1404
- return v.success ? [] : v.error.errors;
1405
- });
1406
- return ue(async () => {
1407
- await o.readMembership();
1408
- }), (v, s) => {
1409
- var j, _, K, G, w;
1410
- 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");
1411
- return n(), T("div", it, [
1412
- l.preset == "MIN_SPEND" ? (n(), g(a, {
1413
- key: 0,
1414
- label: "Minimum spend",
1415
- "model-value": e(p).equator,
1416
- "onUpdate:modelValue": s[0] || (s[0] = (E) => f(E))
1417
- }, null, 8, ["model-value"])) : M("", !0),
1418
- l.preset == "LAST_X_DAY" ? (n(), g(a, {
1419
- key: 1,
1420
- label: "",
1421
- min: 0,
1422
- prepent: "Day(s)",
1423
- "model-value": e(p).equator.x,
1424
- rules: [(E) => E >= 0 || "Value must be greater than 0"],
1425
- "onUpdate:modelValue": s[1] || (s[1] = (E) => f({
1426
- op: "last",
1427
- unit: "day",
1428
- ignoreYear: !0,
1429
- x: E
1430
- }))
1431
- }, null, 8, ["model-value", "rules"])) : l.preset == "SPECIFIC_DATE" ? (n(), g(F, {
1432
- key: 2,
1433
- label: "Specific Date",
1434
- "model-value": e(p).equator,
1435
- "onUpdate:modelValue": s[2] || (s[2] = (E) => f(E))
1436
- }, null, 8, ["model-value"])) : l.preset == "SPECIFIC_TIMERANGE" ? (n(), g(x, {
1437
- key: 3,
1438
- label: "Time is between",
1439
- "disable-time-check": !0,
1440
- "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],
1441
- "onUpdate:modelValue": s[3] || (s[3] = (E) => f([
1442
- {
1443
- start: E[0],
1444
- end: E[1]
1445
- }
1446
- ]))
1447
- }, null, 8, ["model-value"])) : l.preset == "WEEKLY" ? (n(), g(ee, {
1448
- key: 4,
1449
- label: "Weekly",
1450
- "fixed-frequency": !0,
1451
- "model-value": e(p).equator,
1452
- "onUpdate:modelValue": s[4] || (s[4] = (E) => f(E))
1453
- }, null, 8, ["model-value"])) : l.preset == "MONTHLY" ? (n(), g(ee, {
1454
- key: 5,
1455
- label: "Weekly",
1456
- "fixed-frequency": !0,
1457
- "model-value": e(p).equator,
1458
- "onUpdate:modelValue": s[5] || (s[5] = (E) => f(E))
1459
- }, null, 8, ["model-value"])) : l.preset == "BIRTHDAY" ? (n(), T(h, { key: 6 }, [
1460
- C("div", mt, [
1461
- b(V, {
1462
- label: "N days before birthday",
1463
- value: "_isDay",
1464
- "model-value": e(p).operator,
1465
- "onUpdate:modelValue": s[6] || (s[6] = () => {
1466
- f(
1467
- {
1468
- op: "after",
1469
- x: 1,
1470
- ignoreYear: !0
1471
- },
1472
- "_isDay"
1473
- );
1474
- })
1475
- }, null, 8, ["model-value"]),
1476
- C("div", dt, [
1477
- b(V, {
1478
- label: "Is in this",
1479
- value: "_isRange",
1480
- "model-value": e(p).operator,
1481
- "onUpdate:modelValue": s[7] || (s[7] = () => {
1482
- f(
1483
- {
1484
- op: "this",
1485
- unit: "day",
1486
- ignoreYear: !0
1487
- },
1488
- "_isRange"
1489
- );
1490
- })
1491
- }, null, 8, ["model-value"]),
1492
- e(p).operator == "_isRange" ? (n(), g(U, {
1493
- key: 0,
1494
- items: ["day", "week", "month"].map((E) => ({ label: E, value: E })),
1495
- "model-value": e(p).equator.unit,
1496
- "onUpdate:modelValue": s[8] || (s[8] = (E) => f(
1497
- {
1498
- op: "this",
1499
- unit: E,
1500
- ignoreYear: !0
1501
- },
1502
- "_isRange"
1503
- ))
1504
- }, null, 8, ["items", "model-value"])) : M("", !0)
1505
- ])
1506
- ]),
1507
- e(p).operator == "_isDay" ? (n(), g(a, {
1508
- key: 0,
1509
- label: "Days before birthday",
1510
- "show-steppers": !1,
1511
- "model-value": e(p).equator.x,
1512
- "onUpdate:modelValue": s[9] || (s[9] = (E) => f({
1513
- op: "after",
1514
- x: E,
1515
- ignoreYear: !0
1516
- }))
1517
- }, null, 8, ["model-value"])) : M("", !0)
1518
- ], 64)) : l.preset == "TIER" ? (n(), T(h, { key: 7 }, [
1519
- b(r, {
1520
- inline: !0,
1521
- "model-value": e(p).operator,
1522
- "onUpdate:modelValue": s[10] || (s[10] = (E) => f(e(p).equator, E))
1523
- }, {
1524
- default: q(() => [
1525
- b(V, {
1526
- value: "_moreThanOrEqual",
1527
- label: "At least"
1528
- }),
1529
- b(V, {
1530
- value: "_equal",
1531
- label: "Equal"
1532
- }),
1533
- b(V, {
1534
- value: "_lessThanOrEqual",
1535
- label: "At most"
1536
- })
1537
- ]),
1538
- _: 1
1539
- }, 8, ["model-value"]),
1540
- b(O, {
1541
- items: (e(o).sortedTiers ?? []).map((E, oe) => ({
1542
- label: `Tier ${oe + 1} - ${E.name}`,
1543
- value: oe + 1
1544
- })),
1545
- "model-value": e(p).equator,
1546
- "onUpdate:modelValue": s[11] || (s[11] = (E) => f(E))
1547
- }, null, 8, ["items", "model-value"]),
1548
- b(I, {
1549
- text: t()
1550
- }, null, 8, ["text"])
1551
- ], 64)) : l.preset == "TITLE" ? (n(), g(O, {
1552
- key: 8,
1553
- label: "User has title",
1554
- items: (e(o).sortedTitles ?? []).map((E) => ({
1555
- label: E.name,
1556
- value: E._id
1557
- })),
1558
- "model-value": (w = e(p).equator) == null ? void 0 : w[0],
1559
- "onUpdate:modelValue": s[12] || (s[12] = (E) => f([E]))
1560
- }, null, 8, ["items", "model-value"])) : M("", !0),
1561
- b(I, {
1562
- class: "mt-[-8px]",
1563
- text: e(Z).helperText(e(m), ""),
1564
- state: e(Z).helperState(e(m), "")
1565
- }, null, 8, ["text", "state"]),
1566
- C("div", pt, [
1567
- b(P, {
1568
- onClick: s[13] || (s[13] = (E) => e(Y).close()),
1569
- label: "Cancel",
1570
- variant: "tertiary"
1571
- }),
1572
- b(P, {
1573
- onClick: s[14] || (s[14] = (E) => S()),
1574
- disabled: e(m).length > 0,
1575
- label: "Save"
1576
- }, null, 8, ["disabled"])
1577
- ])
1578
- ]);
1579
- };
1580
- }
1581
- }), ct = /* @__PURE__ */ A({
1582
- __name: "RuleConfigurator",
1583
- props: {
1584
- triggerType: {
1585
- type: String,
1586
- required: !0
1587
- },
1588
- includeOnly: {
1589
- type: String
1590
- },
1591
- modelValue: {
1592
- type: Object,
1593
- default: () => {
1594
- }
1595
- }
1596
- },
1597
- emits: ["update:model-value"],
1598
- setup(l, { expose: Y, emit: c }) {
1599
- const i = X(), { t: o } = me(), d = l, t = c, u = le(), y = L();
1600
- function p(m) {
1601
- const [v] = m.rules;
1602
- u.open({
1603
- title: m.name,
1604
- closeButton: !1,
1605
- dismissAway: !1,
1606
- contentComponent: yt,
1607
- contentComponentProps: {
1608
- preset: m.type,
1609
- defaultValue: v,
1610
- modelValue: d.modelValue
1611
- }
1612
- }).onPrimary((s) => t("update:model-value", s));
1613
- }
1614
- function f(m) {
1615
- u.open({
1616
- title: o("connect.template.rule.edit_rule"),
1617
- closeButton: !1,
1618
- dismissAway: !1,
1619
- contentComponent: st,
1620
- contentComponentProps: {
1621
- triggerType: d.triggerType,
1622
- includeOnly: d.includeOnly,
1623
- modelValue: m
1624
- }
1625
- }).onPrimary((v) => t("update:model-value", v));
1626
- }
1627
- function S(m) {
1628
- if (m.type == "CUSTOM") {
1629
- const [v] = m.rules;
1630
- return f(
1631
- D.constructEntry(v.property, v.operator, v.equator)
1632
- );
1633
- }
1634
- return p(m);
1635
- }
1636
- return Y({
1637
- showCustomDialog: f
1638
- }), (m, v) => {
1639
- const s = k("FmButton"), a = k("FmPill"), F = k("FmMenuItem"), x = k("FmMenu");
1640
- return n(), g(x, {
1641
- shift: !0,
1642
- placement: "top-start"
1643
- }, {
1644
- "menu-button": q(() => [
1645
- b(s, {
1646
- label: e(o)("connect.template.rule.add_condition"),
1647
- icon: "add",
1648
- class: "text-fm-color-primary border-fm-color-primary",
1649
- "icon-color": "primary",
1650
- variant: "secondary"
1651
- }, null, 8, ["label"])
1652
- ]),
1653
- default: q(() => [
1654
- (n(!0), T(h, null, N(e(Oe).filter(
1655
- (V) => !l.includeOnly || V.for.includes(l.includeOnly)
1656
- ), (V) => (n(), g(F, {
1657
- key: V.name,
1658
- "model-value": V.name == e(y),
1659
- label: V.name,
1660
- onClick: () => {
1661
- V != null && V.premium && !e(i).isPremium || S(V);
1662
- },
1663
- disabled: (V == null ? void 0 : V.premium) && !e(i).isPremium
1664
- }, se({ _: 2 }, [
1665
- V != null && V.premium ? {
1666
- name: "append",
1667
- fn: q(() => [
1668
- b(a, { variant: "premium" })
1669
- ]),
1670
- key: "0"
1671
- } : void 0
1672
- ]), 1032, ["model-value", "label", "onClick", "disabled"]))), 128))
1673
- ]),
1674
- _: 1
1675
- });
1676
- };
1677
- }
1678
- }), vt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Bt = /* @__PURE__ */ A({
1679
- __name: "RuleGroup",
1680
- props: {
1681
- triggerType: {
1682
- type: String,
1683
- required: !0
1684
- },
1685
- includeOnly: {
1686
- type: String
1687
- },
1688
- modelValue: {
1689
- type: Object
1690
- }
1691
- },
1692
- emits: ["update:model-value"],
1693
- setup(l, { emit: Y }) {
1694
- const c = l, i = Y, o = Ve(), { t: d } = me(), t = B(
1695
- () => c.modelValue ?? D.scaffoldGroup()
1696
- ), u = B(() => D.getLogic(t.value)), y = B(() => [
1697
- { label: d("connect.template.rule.and"), value: "&&" },
1698
- { label: d("connect.template.rule.or"), value: "||" }
1699
- ]), p = L();
1700
- function f(S, m) {
1701
- try {
1702
- const v = D.setRuleToGroup(S, m);
1703
- D.isRuleExceed(S, m), i("update:model-value", v);
1704
- } catch (v) {
1705
- o.open({
1706
- message: v.message,
1707
- type: "error"
1708
- });
1709
- }
1710
- }
1711
- return (S, m) => {
1712
- const v = k("FmButtonGroup"), s = k("FmCard");
1713
- return n(), g(s, { variant: "outlined" }, {
1714
- default: q(() => [
1715
- b(s, { class: "border-l-4 border-fm-color-primary p-16 space-y-16" }, {
1716
- default: q(() => [
1717
- C("div", vt, $(e(d)("connect.template.rule.when")), 1),
1718
- b(ct, {
1719
- ref_key: "configuratorRef",
1720
- ref: p,
1721
- "include-only": l.includeOnly,
1722
- "trigger-type": l.triggerType,
1723
- "onUpdate:modelValue": m[0] || (m[0] = (a) => f(e(t), a))
1724
- }, null, 8, ["include-only", "trigger-type"]),
1725
- (n(!0), T(h, null, N(e(t).rules, (a, F) => {
1726
- var x;
1727
- return n(), T(h, null, [
1728
- e(ke)(a) ? (n(), g(De, {
1729
- "model-value": a,
1730
- key: F,
1731
- onEdit: (x = e(p)) == null ? void 0 : x.showCustomDialog,
1732
- onRemove: m[1] || (m[1] = (V) => {
1733
- i(
1734
- "update:model-value",
1735
- e(D).removeEntry(e(t), V.name)
1736
- );
1737
- })
1738
- }, null, 8, ["model-value", "onEdit"])) : M("", !0),
1739
- b(v, {
1740
- class: "w-[200px]",
1741
- disabled: Object.keys(e(t).rules).length < 2,
1742
- items: e(y),
1743
- "model-value": e(y).find((V) => V.value === e(u)) ?? null,
1744
- "onUpdate:modelValue": m[2] || (m[2] = (V) => i(
1745
- "update:model-value",
1746
- e(D).setRuleToGroup(
1747
- e(t),
1748
- [],
1749
- V.value
1750
- )
1751
- ))
1752
- }, null, 8, ["disabled", "items", "model-value"])
1753
- ], 64);
1754
- }), 256))
1755
- ]),
1756
- _: 1
1757
- })
1758
- ]),
1759
- _: 1
1760
- });
1761
- };
1762
- }
1763
- });
1764
- export {
1765
- Bt as _,
1766
- ee as a
1767
- };