@feedmepos/mf-connect 0.1.115-dev → 0.1.115-prod

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