@feedmepos/mf-connect 0.1.119-prod → 0.1.121-dev

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