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