@feedmepos/mf-connect 0.1.97-prod → 0.1.98-beta.2

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