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