@feedmepos/mf-connect 0.0.5-beta.15 → 0.0.5-beta.17
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-CGHIeKS8.js → Analytic-BNVoiIgX.js} +8 -8
- package/dist/{Broadcast-BIn2UI_d.js → Broadcast-YcBeWNyG.js} +8 -8
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CpcT2N60.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-hU84fjOW.js} +8 -8
- package/dist/{Card-BfajDUMm.js → Card-NWMikvM5.js} +16 -16
- package/dist/{Collections-IMieUn1q.js → Collections-BVaK65s5.js} +7 -7
- package/dist/{Credit-T_ipXVBr.js → Credit-BWu2UJMV.js} +8 -8
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-rqkjTflZ.js +2427 -0
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-raqTcelX.js → EffectSheet.vue_vue_type_style_index_0_lang-sHiow7Fn.js} +5 -5
- package/dist/{Experience-DoIVrVNW.js → Experience-DKhWtfO1.js} +8 -8
- package/dist/{Game-BVxg7XRA.js → Game-d-HHsEot.js} +8 -8
- package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-CfhIj6eM.js → ImageInput.vue_vue_type_script_setup_true_lang-9ZS2uIos.js} +1 -1
- package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang--4_NI70b.js → LottieAnimation.vue_vue_type_script_setup_true_lang-ChkmXJY6.js} +1 -1
- package/dist/{MainLayout-CUOIYNMM.js → MainLayout-hTwLRSY-.js} +2 -2
- package/dist/{Marketing-DOXAo8yi.js → Marketing-B9sZR__k.js} +5 -5
- package/dist/{Member-Bh2j_V8l.js → Member-Cf2u3kg6.js} +2 -2
- package/dist/{MemberList-0wuenMZD.js → MemberList-DNjPV3Br.js} +13 -13
- package/dist/{MemberTransactions-BeDeSHwi.js → MemberTransactions-CJIANWEf.js} +2 -2
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CnFvA2p6.js → MessageInput.vue_vue_type_script_setup_true_lang-FZpdhkL0.js} +4 -4
- package/dist/Mission-DKGce5sL.js +249 -0
- package/dist/{Point-BIqApqyO.js → Point-DDOzWhsj.js} +8 -8
- package/dist/{Promotion-BtmiSRCS.js → Promotion-Ox7XzTUh.js} +9 -9
- package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-DiNNMHHq.js → RuleGroup.vue_vue_type_script_setup_true_lang-Do7M2I1h.js} +12 -12
- package/dist/{Segment-Ae2E5eyF.js → Segment-BcyGMgCd.js} +10 -10
- package/dist/{Setting-DKC3l9Sn.js → Setting-ALwB73wx.js} +33 -33
- package/dist/{Store-CZIzotz8.js → Store-DcpyNBud.js} +12 -12
- package/dist/{StoreRewards-DSd7D9i2.js → StoreRewards-oJWW1pi7.js} +10 -10
- package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-BtC0uaXR.js → StoreTransactions.vue_vue_type_script_setup_true_lang-0fWzS5Gd.js} +5 -5
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-CWEWQb6h.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-C6du6rif.js} +1 -1
- package/dist/{Tier-asHhMWDk.js → Tier-C0dU9txv.js} +17 -17
- package/dist/{Title-C4cPaACC.js → Title-BVTY3bh6.js} +15 -15
- package/dist/{Transaction-CnQyJQKu.js → Transaction-D4BQ0lVi.js} +1 -1
- package/dist/{Voucher-BcmCZ1NZ.js → Voucher-0rkH8esk.js} +10 -10
- package/dist/{app-DioDfJad.js → app-CtmguPwb.js} +2288 -2282
- package/dist/app.js +1 -1
- package/dist/{campaign-Lj4cOLnb.js → campaign-C9N-KI5I.js} +29 -23
- package/dist/{collection.fn-gIe2ShKL.js → collection.fn-DLKGQzHt.js} +2 -2
- package/dist/{dto-YpdXoxFj.js → dto-C7VtH6eF.js} +440 -405
- package/dist/{effect-BVAErmrB.js → effect-S4X3BCQi.js} +1 -1
- package/dist/{helper-CsMjz95Z.js → helper-DJtb_7ts.js} +20 -8
- package/dist/{index-C_sJVcbJ.js → index-BL_8Bm5q.js} +2 -2
- package/dist/{index-D3m4Sw0g.js → index-CEH9kuR9.js} +257 -24
- package/dist/{index-CbHlXZaI.js → index-CIp4USrg.js} +1 -1
- package/dist/{index-BknsVOuw.js → index-ChqchtOY.js} +205 -159
- package/dist/{index-CHHMHhVH.js → index-D1Qqug-P.js} +2 -2
- package/dist/{index-Dqw5ghws.js → index-DMEHP7xA.js} +1 -1
- package/dist/{index-DuGpQxPM.js → index-DNKFmLz6.js} +3 -3
- package/dist/{index-gtBwz7wz.js → index-DOIUUi-s.js} +1 -1
- package/dist/{index-BwA7-PLv.js → index-DVBKZVuj.js} +1 -1
- package/dist/{index-D9f2xgaL.js → index-DVIDJEKJ.js} +188 -182
- package/dist/{loading-DBNDXy5J.js → loading-Cr1-8xqQ.js} +2 -2
- package/dist/{lodash-CF6x9HLq.js → lodash-CQKhQrO4.js} +1 -1
- package/dist/membership-DaIWUq2-.js +219 -0
- package/dist/{money-BDflVox1.js → money-BsL6avPU.js} +1 -1
- package/dist/{number-DH6RIKvn.js → number-CaYFZVbQ.js} +1 -1
- package/dist/{plugins-Bt83yiVD.js → plugins-CAKHdkri.js} +4 -4
- package/dist/{rule-BA85R5Fm.js → rule-DezWvtjB.js} +2 -2
- package/dist/{rule-builder-C4mDdiaZ.js → rule-builder-E9z4XLBt.js} +1 -1
- package/dist/{template-BNU-kEpX.js → template-BePXlDqt.js} +6 -6
- package/dist/{usePagination-BXdy4LGe.js → usePagination-4xQpcDTb.js} +1 -1
- package/dist/{xlsx-DBbgsojO.js → xlsx-v4ZAaFgn.js} +1 -1
- package/package.json +1 -1
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-OiQn8ZmG.js +0 -1978
- package/dist/membership-6qDj8L5S.js +0 -210
|
@@ -0,0 +1,2427 @@
|
|
|
1
|
+
import { defineComponent, computed, openBlock, createBlock, unref, ref, watch, resolveComponent, createElementBlock, createElementVNode, Fragment, renderList, createVNode, isRef, createCommentVNode, withCtx, normalizeClass, toDisplayString, createTextVNode, resolveDynamicComponent, toRefs, normalizeStyle, createSlots } from "vue";
|
|
2
|
+
import { _ } from "./lodash-CQKhQrO4.js";
|
|
3
|
+
import { c as core, J as JsonViewer, z, a as useBusinessStore, S as SvcConfig } from "./app-CtmguPwb.js";
|
|
4
|
+
import { Z as ZodHelper } from "./zod-W_PvIofQ.js";
|
|
5
|
+
import { c as campaignRefinement, d as getCampaignSummaryObject, e as CampaignDtos, C as CampaignOptions, f as campaignTransform } from "./dto-C7VtH6eF.js";
|
|
6
|
+
import { u as useMembershipStore, C as CollectibleOptions } from "./membership-DaIWUq2-.js";
|
|
7
|
+
import { a as FdoEarningOption, b as F_GAME_TYPE, F as FdtoCollectibleConfig } from "./index-DVIDJEKJ.js";
|
|
8
|
+
import { i as isRuleGroup, R as RuleBuilder, a as isRuleEntry } from "./rule-builder-E9z4XLBt.js";
|
|
9
|
+
import { h as hooks } from "./moment-BWErdI6_.js";
|
|
10
|
+
import { b as F_CAMPAIGN_TRIGGER_TYPE, C as CAMPAIGN_TRIGGER, c as FdtoRandomReward, d as F_MISSION_TYPE, e as FdtoThresholdReward, f as featureVersionMapping } from "./index-ChqchtOY.js";
|
|
11
|
+
import { _ as _sfc_main$r } from "./ImageInput.vue_vue_type_script_setup_true_lang-9ZS2uIos.js";
|
|
12
|
+
import { _ as _sfc_main$s, a as _sfc_main$t, b as _sfc_main$v } from "./EffectSheet.vue_vue_type_style_index_0_lang-sHiow7Fn.js";
|
|
13
|
+
import { _ as _sfc_main$u } from "./TargetLocationInput.vue_vue_type_script_setup_true_lang-C6du6rif.js";
|
|
14
|
+
import { _ as _sfc_main$o, a as _sfc_main$p } from "./RuleGroup.vue_vue_type_script_setup_true_lang-Do7M2I1h.js";
|
|
15
|
+
import { p as prompt, f as firebaseStorage } from "./plugins-CAKHdkri.js";
|
|
16
|
+
import { _ as _sfc_main$n, T as TEMPLATES } from "./index-CEH9kuR9.js";
|
|
17
|
+
import { _ as _sfc_main$w } from "./MessageInput.vue_vue_type_script_setup_true_lang-FZpdhkL0.js";
|
|
18
|
+
import { c as cases, u as useLoading } from "./loading-Cr1-8xqQ.js";
|
|
19
|
+
import { c as calculateNextScheduleAt, S as SummarizeRrule, R as RRule } from "./rule-DezWvtjB.js";
|
|
20
|
+
import "./index-BL_8Bm5q.js";
|
|
21
|
+
import "./index-DNKFmLz6.js";
|
|
22
|
+
import "./index-D1Qqug-P.js";
|
|
23
|
+
import "./index-DVBKZVuj.js";
|
|
24
|
+
import { useCoreStore } from "@feedmepos/mf-common";
|
|
25
|
+
import { _ as _sfc_main$q } from "./ZodTextField.vue_vue_type_script_setup_true_lang-CWt4tVdk.js";
|
|
26
|
+
import { i as initCollectibleConfig } from "./helper-DJtb_7ts.js";
|
|
27
|
+
import { C as CollectionUtils } from "./collection.fn-DLKGQzHt.js";
|
|
28
|
+
import { useDialog } from "@feedmepos/ui-library";
|
|
29
|
+
import { a as cleanPF } from "./object-qECH92oz.js";
|
|
30
|
+
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
31
|
+
__name: "SegmentConfigurator",
|
|
32
|
+
props: {
|
|
33
|
+
modelValue: {
|
|
34
|
+
type: Object,
|
|
35
|
+
required: !0
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
emits: ["update:model-value"],
|
|
39
|
+
setup(t, { emit: i }) {
|
|
40
|
+
const a = t, r = computed(() => {
|
|
41
|
+
var e;
|
|
42
|
+
const [s] = isRuleGroup(a.modelValue) ? Object.values(((e = a.modelValue) == null ? void 0 : e.rules) ?? {}) : [null];
|
|
43
|
+
return (s ?? RuleBuilder.constructEntry("user.segment", "_hasAny", [])).conditions._hasAny;
|
|
44
|
+
}), n = i;
|
|
45
|
+
return (s, o) => (openBlock(), createBlock(_sfc_main$n, {
|
|
46
|
+
multiselect: !0,
|
|
47
|
+
items: unref(useMembershipStore)().segmentOptions,
|
|
48
|
+
"model-value": unref(r),
|
|
49
|
+
"onUpdate:modelValue": o[0] || (o[0] = (e) => n(
|
|
50
|
+
"update:model-value",
|
|
51
|
+
unref(RuleBuilder).setRuleToGroup(
|
|
52
|
+
unref(RuleBuilder).scaffoldGroup("g_segment"),
|
|
53
|
+
unref(RuleBuilder).constructEntry("user.segment", "_hasAny", e)
|
|
54
|
+
)
|
|
55
|
+
)),
|
|
56
|
+
label: "Select segment(s) to match"
|
|
57
|
+
}, null, 8, ["items", "model-value"]));
|
|
58
|
+
}
|
|
59
|
+
}), _hoisted_1$h = { class: "space-y-16" }, _hoisted_2$f = { key: 0 }, _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
60
|
+
__name: "UserRuleGroup",
|
|
61
|
+
props: {
|
|
62
|
+
modelValue: {
|
|
63
|
+
type: Object,
|
|
64
|
+
default: () => {
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
emits: ["update:model-value"],
|
|
69
|
+
setup(t, { emit: i }) {
|
|
70
|
+
const a = t, r = i, n = ref(
|
|
71
|
+
a.modelValue ? RuleBuilder.getRules(a.modelValue.rules.g_user).length > 0 ? "custom" : RuleBuilder.getRules(a.modelValue.rules.g_segment).length > 0 ? "segment" : "all_users" : "all_users"
|
|
72
|
+
), s = [
|
|
73
|
+
{
|
|
74
|
+
value: "all_users",
|
|
75
|
+
label: "All audience"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
value: "segment",
|
|
79
|
+
label: "Member segment"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
value: "custom",
|
|
83
|
+
label: "Custom audience"
|
|
84
|
+
}
|
|
85
|
+
];
|
|
86
|
+
return watch(n, async (o, e) => {
|
|
87
|
+
var l;
|
|
88
|
+
if (e != "all_users" && e != o && RuleBuilder.getRules(
|
|
89
|
+
(l = a.modelValue) == null ? void 0 : l.rules[e == "custom" ? "g_user" : "g_segment"]
|
|
90
|
+
).length > 0) {
|
|
91
|
+
const p = await prompt.confirm(
|
|
92
|
+
"Are you sure you want to change the audience type? This will remove all the rules you have set."
|
|
93
|
+
);
|
|
94
|
+
p && r(
|
|
95
|
+
"update:model-value",
|
|
96
|
+
RuleBuilder.setRuleToGroup(
|
|
97
|
+
a.modelValue ?? RuleBuilder.scaffoldGroup(),
|
|
98
|
+
RuleBuilder.scaffoldGroup(e == "custom" ? "g_user" : "g_segment")
|
|
99
|
+
)
|
|
100
|
+
), n.value = p ? o : e;
|
|
101
|
+
}
|
|
102
|
+
}), (o, e) => {
|
|
103
|
+
var p, y;
|
|
104
|
+
const l = resolveComponent("FmRadio");
|
|
105
|
+
return openBlock(), createElementBlock("div", _hoisted_1$h, [
|
|
106
|
+
createElementVNode("div", null, [
|
|
107
|
+
(openBlock(), createElementBlock(Fragment, null, renderList(s, (f) => createVNode(l, {
|
|
108
|
+
key: f.value,
|
|
109
|
+
value: f.value,
|
|
110
|
+
label: f.label,
|
|
111
|
+
modelValue: unref(n),
|
|
112
|
+
"onUpdate:modelValue": e[0] || (e[0] = (g) => isRef(n) ? n.value = g : null)
|
|
113
|
+
}, null, 8, ["value", "label", "modelValue"])), 64))
|
|
114
|
+
]),
|
|
115
|
+
unref(n) == "segment" ? (openBlock(), createElementBlock("div", _hoisted_2$f, [
|
|
116
|
+
createVNode(_sfc_main$m, {
|
|
117
|
+
modelValue: ((p = t.modelValue) == null ? void 0 : p.rules.g_segment) ?? unref(RuleBuilder).scaffoldGroup("g_segment"),
|
|
118
|
+
"onUpdate:modelValue": e[1] || (e[1] = (f) => r(
|
|
119
|
+
"update:model-value",
|
|
120
|
+
unref(RuleBuilder).setRuleToGroup(
|
|
121
|
+
t.modelValue ?? unref(RuleBuilder).scaffoldGroup(),
|
|
122
|
+
f,
|
|
123
|
+
"&&"
|
|
124
|
+
)
|
|
125
|
+
))
|
|
126
|
+
}, null, 8, ["modelValue"])
|
|
127
|
+
])) : createCommentVNode("", !0),
|
|
128
|
+
unref(n) == "custom" ? (openBlock(), createBlock(_sfc_main$o, {
|
|
129
|
+
key: 1,
|
|
130
|
+
"include-only": "user",
|
|
131
|
+
"trigger-type": "MEMBERSHIP_JOINED",
|
|
132
|
+
"model-value": ((y = t.modelValue) == null ? void 0 : y.rules.g_user) ?? unref(RuleBuilder).scaffoldGroup("g_user"),
|
|
133
|
+
"onUpdate:modelValue": e[2] || (e[2] = (f) => r(
|
|
134
|
+
"update:model-value",
|
|
135
|
+
unref(RuleBuilder).setRuleToGroup(
|
|
136
|
+
t.modelValue ?? unref(RuleBuilder).scaffoldGroup(),
|
|
137
|
+
f,
|
|
138
|
+
"&&"
|
|
139
|
+
)
|
|
140
|
+
))
|
|
141
|
+
}, null, 8, ["model-value"])) : createCommentVNode("", !0)
|
|
142
|
+
]);
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
}), _hoisted_1$g = { class: "space-y-24" }, _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
146
|
+
__name: "TimeRuleGroup",
|
|
147
|
+
props: {
|
|
148
|
+
modelValue: {
|
|
149
|
+
type: Object,
|
|
150
|
+
default: () => {
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
emits: ["update:model-value"],
|
|
155
|
+
setup(t, { emit: i }) {
|
|
156
|
+
const a = t, r = i, n = ref(
|
|
157
|
+
!a.modelValue || !a.modelValue.rules.g_time ? "all_time" : RuleBuilder.getRules(a.modelValue.rules.g_time).length > 0 ? "custom" : "all_time"
|
|
158
|
+
);
|
|
159
|
+
watch(n, async (o, e) => {
|
|
160
|
+
var l;
|
|
161
|
+
if (e == "custom" && o == "all_time" && RuleBuilder.getRules((l = a.modelValue) == null ? void 0 : l.rules.g_time).length > 0) {
|
|
162
|
+
const p = await prompt.confirm(
|
|
163
|
+
"Are you sure you want to turn off custom conditons? This will remove all the rules you have set."
|
|
164
|
+
);
|
|
165
|
+
p && r(
|
|
166
|
+
"update:model-value",
|
|
167
|
+
RuleBuilder.setRuleToGroup(
|
|
168
|
+
a.modelValue ?? RuleBuilder.scaffoldGroup(),
|
|
169
|
+
RuleBuilder.scaffoldGroup("g_time")
|
|
170
|
+
)
|
|
171
|
+
), n.value = p ? o : e;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
async function s(o) {
|
|
175
|
+
var e;
|
|
176
|
+
if (o == "custom" && RuleBuilder.getRules((e = a.modelValue) == null ? void 0 : e.rules.g_time).length > 0) {
|
|
177
|
+
if (!await prompt.confirm(
|
|
178
|
+
"Are you sure you want to turn off custom conditons? This will remove all the rules you have set."
|
|
179
|
+
)) {
|
|
180
|
+
n.value = "all_time";
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
r(
|
|
184
|
+
"update:model-value",
|
|
185
|
+
RuleBuilder.setRuleToGroup(
|
|
186
|
+
a.modelValue ?? RuleBuilder.scaffoldGroup(),
|
|
187
|
+
RuleBuilder.scaffoldGroup("g_time")
|
|
188
|
+
)
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return (o, e) => {
|
|
193
|
+
var y;
|
|
194
|
+
const l = resolveComponent("FmRadio"), p = resolveComponent("FmRadioGroup");
|
|
195
|
+
return openBlock(), createElementBlock("div", _hoisted_1$g, [
|
|
196
|
+
createVNode(p, {
|
|
197
|
+
modelValue: unref(n),
|
|
198
|
+
"onUpdate:modelValue": [
|
|
199
|
+
e[0] || (e[0] = (f) => isRef(n) ? n.value = f : null),
|
|
200
|
+
e[1] || (e[1] = (f) => s(f))
|
|
201
|
+
]
|
|
202
|
+
}, {
|
|
203
|
+
default: withCtx(() => [
|
|
204
|
+
createVNode(l, {
|
|
205
|
+
label: "All time",
|
|
206
|
+
value: "all_time"
|
|
207
|
+
}),
|
|
208
|
+
createVNode(l, {
|
|
209
|
+
label: "Custom date/time",
|
|
210
|
+
value: "custom"
|
|
211
|
+
})
|
|
212
|
+
]),
|
|
213
|
+
_: 1
|
|
214
|
+
}, 8, ["modelValue"]),
|
|
215
|
+
unref(n) == "custom" ? (openBlock(), createBlock(_sfc_main$o, {
|
|
216
|
+
key: 0,
|
|
217
|
+
class: "!mt-[0px]",
|
|
218
|
+
"include-only": "trigger",
|
|
219
|
+
"trigger-type": "SCHEDULE",
|
|
220
|
+
"model-value": ((y = t.modelValue) == null ? void 0 : y.rules.g_time) ?? unref(RuleBuilder).scaffoldGroup("g_time"),
|
|
221
|
+
"onUpdate:modelValue": e[2] || (e[2] = (f) => r(
|
|
222
|
+
"update:model-value",
|
|
223
|
+
unref(RuleBuilder).setRuleToGroup(
|
|
224
|
+
t.modelValue ?? unref(RuleBuilder).scaffoldGroup(),
|
|
225
|
+
f,
|
|
226
|
+
"&&"
|
|
227
|
+
)
|
|
228
|
+
))
|
|
229
|
+
}, null, 8, ["model-value"])) : createCommentVNode("", !0)
|
|
230
|
+
]);
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
}), _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
234
|
+
__name: "BillRuleGroup",
|
|
235
|
+
props: {
|
|
236
|
+
modelValue: {
|
|
237
|
+
type: Object,
|
|
238
|
+
default: () => {
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
emits: ["update:model-value"],
|
|
243
|
+
setup(t, { emit: i }) {
|
|
244
|
+
const a = i;
|
|
245
|
+
return (r, n) => {
|
|
246
|
+
var s;
|
|
247
|
+
return openBlock(), createBlock(_sfc_main$o, {
|
|
248
|
+
"include-only": "bill",
|
|
249
|
+
"trigger-type": "BILL_COMPLETED",
|
|
250
|
+
"model-value": ((s = t.modelValue) == null ? void 0 : s.rules.g_bill) ?? unref(RuleBuilder).scaffoldGroup("g_bill"),
|
|
251
|
+
"onUpdate:modelValue": n[0] || (n[0] = (o) => a(
|
|
252
|
+
"update:model-value",
|
|
253
|
+
unref(RuleBuilder).setRuleToGroup(
|
|
254
|
+
t.modelValue ?? unref(RuleBuilder).scaffoldGroup(),
|
|
255
|
+
o,
|
|
256
|
+
"&&"
|
|
257
|
+
)
|
|
258
|
+
))
|
|
259
|
+
}, null, 8, ["model-value"]);
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
}), _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
263
|
+
__name: "BirthdayInput",
|
|
264
|
+
props: {
|
|
265
|
+
modelValue: {
|
|
266
|
+
type: Object
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
emits: ["update:model-value"],
|
|
270
|
+
setup(t, { emit: i }) {
|
|
271
|
+
const a = t, r = i, n = computed(() => {
|
|
272
|
+
const { property: s, operator: o, equator: e } = RuleBuilder.simplify(
|
|
273
|
+
a.modelValue ?? RuleBuilder.constructEntry("user.birthday", "_isDay", {
|
|
274
|
+
op: "before",
|
|
275
|
+
x: 1
|
|
276
|
+
})
|
|
277
|
+
);
|
|
278
|
+
return {
|
|
279
|
+
property: s,
|
|
280
|
+
operator: o,
|
|
281
|
+
equator: e
|
|
282
|
+
};
|
|
283
|
+
});
|
|
284
|
+
return (s, o) => {
|
|
285
|
+
const e = resolveComponent("FmRadio"), l = resolveComponent("FmStepperField");
|
|
286
|
+
return openBlock(), createElementBlock("div", null, [
|
|
287
|
+
createVNode(e, {
|
|
288
|
+
label: "On birthday",
|
|
289
|
+
value: "_isRange-day",
|
|
290
|
+
"model-value": `${unref(n).operator}-${unref(n).equator.unit}`,
|
|
291
|
+
"onUpdate:modelValue": o[0] || (o[0] = () => {
|
|
292
|
+
r(
|
|
293
|
+
"update:model-value",
|
|
294
|
+
unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
|
|
295
|
+
op: "this",
|
|
296
|
+
unit: "day",
|
|
297
|
+
ignoreYear: !0
|
|
298
|
+
})
|
|
299
|
+
);
|
|
300
|
+
})
|
|
301
|
+
}, null, 8, ["model-value"]),
|
|
302
|
+
createVNode(e, {
|
|
303
|
+
label: "N days before birthday",
|
|
304
|
+
value: "_isDay",
|
|
305
|
+
"model-value": unref(n).operator,
|
|
306
|
+
"onUpdate:modelValue": o[1] || (o[1] = () => {
|
|
307
|
+
r(
|
|
308
|
+
"update:model-value",
|
|
309
|
+
unref(RuleBuilder).constructEntry("user.birthday", "_isDay", {
|
|
310
|
+
op: "after",
|
|
311
|
+
x: 1,
|
|
312
|
+
ignoreYear: !0
|
|
313
|
+
})
|
|
314
|
+
);
|
|
315
|
+
})
|
|
316
|
+
}, null, 8, ["model-value"]),
|
|
317
|
+
unref(n).operator == "_isDay" ? (openBlock(), createBlock(l, {
|
|
318
|
+
key: 0,
|
|
319
|
+
label: "Days before birthday",
|
|
320
|
+
"show-steppers": !1,
|
|
321
|
+
"model-value": unref(n).equator.x,
|
|
322
|
+
"onUpdate:modelValue": o[2] || (o[2] = (p) => r(
|
|
323
|
+
"update:model-value",
|
|
324
|
+
unref(RuleBuilder).constructEntry("user.birthday", "_isDay", {
|
|
325
|
+
op: "after",
|
|
326
|
+
x: p,
|
|
327
|
+
ignoreYear: !0
|
|
328
|
+
})
|
|
329
|
+
))
|
|
330
|
+
}, null, 8, ["model-value"])) : createCommentVNode("", !0),
|
|
331
|
+
createVNode(e, {
|
|
332
|
+
label: "In birthday week",
|
|
333
|
+
value: "_isRange-week",
|
|
334
|
+
"model-value": `${unref(n).operator}-${unref(n).equator.unit}`,
|
|
335
|
+
"onUpdate:modelValue": o[3] || (o[3] = () => {
|
|
336
|
+
r(
|
|
337
|
+
"update:model-value",
|
|
338
|
+
unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
|
|
339
|
+
op: "this",
|
|
340
|
+
unit: "week",
|
|
341
|
+
ignoreYear: !0
|
|
342
|
+
})
|
|
343
|
+
);
|
|
344
|
+
})
|
|
345
|
+
}, null, 8, ["model-value"]),
|
|
346
|
+
createVNode(e, {
|
|
347
|
+
label: "In birthday month",
|
|
348
|
+
value: "_isRange-month",
|
|
349
|
+
"model-value": `${unref(n).operator}-${unref(n).equator.unit}`,
|
|
350
|
+
"onUpdate:modelValue": o[4] || (o[4] = () => {
|
|
351
|
+
r(
|
|
352
|
+
"update:model-value",
|
|
353
|
+
unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
|
|
354
|
+
op: "this",
|
|
355
|
+
unit: "month",
|
|
356
|
+
ignoreYear: !0
|
|
357
|
+
})
|
|
358
|
+
);
|
|
359
|
+
})
|
|
360
|
+
}, null, 8, ["model-value"])
|
|
361
|
+
]);
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
}), _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
365
|
+
__name: "FeedbackRuleGroup",
|
|
366
|
+
props: {
|
|
367
|
+
modelValue: {
|
|
368
|
+
type: Object,
|
|
369
|
+
default: () => {
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
emits: ["update:model-value"],
|
|
374
|
+
setup(t, { emit: i }) {
|
|
375
|
+
const a = i;
|
|
376
|
+
return (r, n) => {
|
|
377
|
+
var s;
|
|
378
|
+
return openBlock(), createBlock(_sfc_main$o, {
|
|
379
|
+
"include-only": "feedback",
|
|
380
|
+
"trigger-type": "FEEDBACK",
|
|
381
|
+
"model-value": ((s = t.modelValue) == null ? void 0 : s.rules.g_feedback) ?? unref(RuleBuilder).scaffoldGroup("g_feedback"),
|
|
382
|
+
"onUpdate:modelValue": n[0] || (n[0] = (o) => a(
|
|
383
|
+
"update:model-value",
|
|
384
|
+
unref(RuleBuilder).setRuleToGroup(
|
|
385
|
+
t.modelValue ?? unref(RuleBuilder).scaffoldGroup(),
|
|
386
|
+
o,
|
|
387
|
+
"&&"
|
|
388
|
+
)
|
|
389
|
+
))
|
|
390
|
+
}, null, 8, ["model-value"]);
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
}), TriggerOptions = {
|
|
394
|
+
[F_CAMPAIGN_TRIGGER_TYPE.enum.BILL_COMPLETED]: {
|
|
395
|
+
name: "Bill complete",
|
|
396
|
+
description: "Reward customers upon the completion of their bill.",
|
|
397
|
+
value: F_CAMPAIGN_TRIGGER_TYPE.enum.BILL_COMPLETED,
|
|
398
|
+
hidden: !1
|
|
399
|
+
},
|
|
400
|
+
[F_CAMPAIGN_TRIGGER_TYPE.enum.FEEDBACK]: {
|
|
401
|
+
name: "Feedback",
|
|
402
|
+
description: "Reward customers for providing feedback.",
|
|
403
|
+
value: F_CAMPAIGN_TRIGGER_TYPE.enum.FEEDBACK,
|
|
404
|
+
hidden: !1
|
|
405
|
+
},
|
|
406
|
+
[F_CAMPAIGN_TRIGGER_TYPE.enum.GAME_COMPLETED]: {
|
|
407
|
+
name: "Game complete",
|
|
408
|
+
description: "Reward customers upon the completion of a game.",
|
|
409
|
+
value: F_CAMPAIGN_TRIGGER_TYPE.enum.GAME_COMPLETED,
|
|
410
|
+
hidden: !1
|
|
411
|
+
},
|
|
412
|
+
[F_CAMPAIGN_TRIGGER_TYPE.enum.MAKING_ORDER]: {
|
|
413
|
+
name: "Making order",
|
|
414
|
+
description: "Reward customers upon the creation of their order.",
|
|
415
|
+
value: F_CAMPAIGN_TRIGGER_TYPE.enum.MAKING_ORDER,
|
|
416
|
+
hidden: !1
|
|
417
|
+
},
|
|
418
|
+
[F_CAMPAIGN_TRIGGER_TYPE.enum.MEMBERSHIP_JOINED]: {
|
|
419
|
+
name: "Member joined ",
|
|
420
|
+
description: "Trigger rewards when customers join your membership program.",
|
|
421
|
+
value: F_CAMPAIGN_TRIGGER_TYPE.enum.MEMBERSHIP_JOINED,
|
|
422
|
+
hidden: !1
|
|
423
|
+
},
|
|
424
|
+
[F_CAMPAIGN_TRIGGER_TYPE.enum.SCHEDULE]: {
|
|
425
|
+
name: "Schedule",
|
|
426
|
+
description: "Set rewards to be triggered at specific times or dates.",
|
|
427
|
+
value: F_CAMPAIGN_TRIGGER_TYPE.enum.SCHEDULE,
|
|
428
|
+
hidden: !1
|
|
429
|
+
},
|
|
430
|
+
[F_CAMPAIGN_TRIGGER_TYPE.enum.SIMPLE_CLAIM]: {
|
|
431
|
+
name: "Simple claim",
|
|
432
|
+
description: "Activate rewards when customers claim an offer",
|
|
433
|
+
value: F_CAMPAIGN_TRIGGER_TYPE.enum.SIMPLE_CLAIM,
|
|
434
|
+
hidden: !1
|
|
435
|
+
},
|
|
436
|
+
[F_CAMPAIGN_TRIGGER_TYPE.enum.TIER_UPGRADED]: {
|
|
437
|
+
name: "Tier upgrade",
|
|
438
|
+
description: "Activate rewards when their membership tier gets upgraded.",
|
|
439
|
+
value: F_CAMPAIGN_TRIGGER_TYPE.enum.TIER_UPGRADED,
|
|
440
|
+
hidden: !1
|
|
441
|
+
},
|
|
442
|
+
[F_CAMPAIGN_TRIGGER_TYPE.enum.ISSUE_REWARD]: {
|
|
443
|
+
name: "Issue reward",
|
|
444
|
+
description: "Triggers whenever customer receives a reward in any kind.",
|
|
445
|
+
value: F_CAMPAIGN_TRIGGER_TYPE.enum.ISSUE_REWARD,
|
|
446
|
+
hidden: !0
|
|
447
|
+
}
|
|
448
|
+
}, TypeToTriggerOptions = Object.fromEntries(
|
|
449
|
+
[
|
|
450
|
+
"VOUCHER",
|
|
451
|
+
"PROMOTION",
|
|
452
|
+
"POINT",
|
|
453
|
+
"CREDIT",
|
|
454
|
+
"MEMBERSHIP",
|
|
455
|
+
"BROADCAST",
|
|
456
|
+
"COIN",
|
|
457
|
+
"REWARD_POOL",
|
|
458
|
+
"GAME",
|
|
459
|
+
"MISSION"
|
|
460
|
+
].map((t) => {
|
|
461
|
+
const i = CAMPAIGN_TRIGGER[t];
|
|
462
|
+
return [
|
|
463
|
+
t,
|
|
464
|
+
(i == null ? void 0 : i.map((a) => TriggerOptions[a]).filter((a) => !a.hidden)) ?? []
|
|
465
|
+
];
|
|
466
|
+
})
|
|
467
|
+
), _hoisted_1$f = { class: "space-y-16" }, _hoisted_2$e = /* @__PURE__ */ createElementVNode("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Define the conditions that must be met to activate a reward. ", -1), _hoisted_3$c = { class: "grid grid-cols-3 gap-16" }, _hoisted_4$b = { class: "fm-typo-en-title-sm-800" }, _hoisted_5$7 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
468
|
+
__name: "CampaignTriggerInput",
|
|
469
|
+
props: {
|
|
470
|
+
campaignType: {
|
|
471
|
+
type: String,
|
|
472
|
+
required: !0
|
|
473
|
+
},
|
|
474
|
+
modelValue: {
|
|
475
|
+
type: String
|
|
476
|
+
},
|
|
477
|
+
disabled: {
|
|
478
|
+
type: Boolean,
|
|
479
|
+
default: !1
|
|
480
|
+
}
|
|
481
|
+
},
|
|
482
|
+
emits: ["update:model-value"],
|
|
483
|
+
setup(t, { emit: i }) {
|
|
484
|
+
const a = t, r = i, n = computed(() => a.disabled ? TypeToTriggerOptions[a.campaignType].filter(
|
|
485
|
+
(s) => s.value == a.modelValue
|
|
486
|
+
) : TypeToTriggerOptions[a.campaignType]);
|
|
487
|
+
return (s, o) => {
|
|
488
|
+
const e = resolveComponent("FmCard");
|
|
489
|
+
return openBlock(), createElementBlock("div", _hoisted_1$f, [
|
|
490
|
+
_hoisted_2$e,
|
|
491
|
+
createElementVNode("div", _hoisted_3$c, [
|
|
492
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(n), (l) => (openBlock(), createBlock(e, {
|
|
493
|
+
variant: "outlined",
|
|
494
|
+
disabled: a.disabled,
|
|
495
|
+
class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
|
|
496
|
+
"col-span-3": unref(n).length == 1,
|
|
497
|
+
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": t.modelValue == l.value,
|
|
498
|
+
"hover:bg-fm-color-opacity-sm": t.modelValue != l.value
|
|
499
|
+
}]),
|
|
500
|
+
onClick: () => {
|
|
501
|
+
a.modelValue != l.value && !a.disabled && r("update:model-value", l.value);
|
|
502
|
+
},
|
|
503
|
+
key: l.name
|
|
504
|
+
}, {
|
|
505
|
+
default: withCtx(() => [
|
|
506
|
+
createElementVNode("div", _hoisted_4$b, toDisplayString(l.name), 1),
|
|
507
|
+
createElementVNode("div", _hoisted_5$7, toDisplayString(l.description), 1)
|
|
508
|
+
]),
|
|
509
|
+
_: 2
|
|
510
|
+
}, 1032, ["disabled", "class", "onClick"]))), 128))
|
|
511
|
+
])
|
|
512
|
+
]);
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
}), _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
516
|
+
__name: "DateInput",
|
|
517
|
+
props: {
|
|
518
|
+
label: {
|
|
519
|
+
type: String,
|
|
520
|
+
required: !1
|
|
521
|
+
},
|
|
522
|
+
modelValue: {
|
|
523
|
+
type: Object,
|
|
524
|
+
required: !1
|
|
525
|
+
}
|
|
526
|
+
},
|
|
527
|
+
emits: ["update:model-value"],
|
|
528
|
+
setup(t, { emit: i }) {
|
|
529
|
+
const a = i;
|
|
530
|
+
return (r, n) => {
|
|
531
|
+
const s = resolveComponent("FmButton"), o = resolveComponent("FmField"), e = resolveComponent("FmSimpleDatePicker");
|
|
532
|
+
return openBlock(), createBlock(e, {
|
|
533
|
+
label: t.label,
|
|
534
|
+
"model-value": t.modelValue || "",
|
|
535
|
+
"onUpdate:modelValue": n[1] || (n[1] = (l) => a("update:model-value", l))
|
|
536
|
+
}, {
|
|
537
|
+
"trigger-button": withCtx(({ opened: l }) => [
|
|
538
|
+
createVNode(o, {
|
|
539
|
+
class: "flex items-center",
|
|
540
|
+
"prepend-icon": "calendar_month",
|
|
541
|
+
"icon-outlined": !l
|
|
542
|
+
}, {
|
|
543
|
+
append: withCtx(() => [
|
|
544
|
+
t.modelValue ? (openBlock(), createBlock(s, {
|
|
545
|
+
key: 0,
|
|
546
|
+
variant: "tertiary",
|
|
547
|
+
icon: "clear",
|
|
548
|
+
onClick: n[0] || (n[0] = (p) => (p.stopPropagation(), a("update:model-value", null)))
|
|
549
|
+
})) : createCommentVNode("", !0)
|
|
550
|
+
]),
|
|
551
|
+
default: withCtx(() => [
|
|
552
|
+
createElementVNode("div", {
|
|
553
|
+
class: normalizeClass(["fm-typo-en-body-lg-400", { "text-fm-color-typo-secondary": !t.modelValue }])
|
|
554
|
+
}, toDisplayString(t.modelValue ? unref(hooks)(t.modelValue).format("DD MMM YYYY") : "DD MM YYYY"), 3)
|
|
555
|
+
]),
|
|
556
|
+
_: 2
|
|
557
|
+
}, 1032, ["icon-outlined"])
|
|
558
|
+
]),
|
|
559
|
+
_: 1
|
|
560
|
+
}, 8, ["label", "model-value"]);
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
}), _hoisted_1$e = { class: "flex items-center gap-8 w-full" }, _hoisted_2$d = { class: "flex-1" }, _hoisted_3$b = /* @__PURE__ */ createElementVNode("div", { class: "mt-5" }, "to", -1), _hoisted_4$a = { class: "flex-1" }, _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
564
|
+
__name: "DateRangeInput",
|
|
565
|
+
props: {
|
|
566
|
+
modelValue: {
|
|
567
|
+
type: Object,
|
|
568
|
+
required: !1
|
|
569
|
+
}
|
|
570
|
+
},
|
|
571
|
+
emits: ["update:model-value"],
|
|
572
|
+
setup(t, { emit: i }) {
|
|
573
|
+
const a = i;
|
|
574
|
+
return (r, n) => {
|
|
575
|
+
var s, o;
|
|
576
|
+
return openBlock(), createElementBlock("div", _hoisted_1$e, [
|
|
577
|
+
createElementVNode("div", _hoisted_2$d, [
|
|
578
|
+
createVNode(_sfc_main$f, {
|
|
579
|
+
"model-value": ((s = t.modelValue) == null ? void 0 : s.startDate) ?? null,
|
|
580
|
+
label: "Start date",
|
|
581
|
+
"onUpdate:modelValue": n[0] || (n[0] = (e) => {
|
|
582
|
+
var l;
|
|
583
|
+
return a("update:model-value", {
|
|
584
|
+
startDate: e,
|
|
585
|
+
endDate: ((l = t.modelValue) == null ? void 0 : l.endDate) ?? null
|
|
586
|
+
});
|
|
587
|
+
})
|
|
588
|
+
}, null, 8, ["model-value"])
|
|
589
|
+
]),
|
|
590
|
+
_hoisted_3$b,
|
|
591
|
+
createElementVNode("div", _hoisted_4$a, [
|
|
592
|
+
createVNode(_sfc_main$f, {
|
|
593
|
+
"model-value": ((o = t.modelValue) == null ? void 0 : o.endDate) ?? null,
|
|
594
|
+
label: "End date",
|
|
595
|
+
"onUpdate:modelValue": n[1] || (n[1] = (e) => {
|
|
596
|
+
var l;
|
|
597
|
+
return a("update:model-value", {
|
|
598
|
+
startDate: ((l = t.modelValue) == null ? void 0 : l.startDate) ?? null,
|
|
599
|
+
endDate: e
|
|
600
|
+
});
|
|
601
|
+
})
|
|
602
|
+
}, null, 8, ["model-value"])
|
|
603
|
+
])
|
|
604
|
+
]);
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
}), _hoisted_1$d = { class: "space-y-8" }, _hoisted_2$c = { class: "grid grid-cols-2 gap-16" }, _hoisted_3$a = {
|
|
608
|
+
key: 0,
|
|
609
|
+
class: "space-y-4"
|
|
610
|
+
}, _hoisted_4$9 = { class: "fm-typo-en-body-lg-400 class flex items-center justify-between" }, _hoisted_5$6 = /* @__PURE__ */ createElementVNode("div", null, "Notify date", -1), _hoisted_6$3 = { class: "text-ellipsis line-clamp-1" }, _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
611
|
+
__name: "ScheduleRuleInput",
|
|
612
|
+
props: {
|
|
613
|
+
modelValue: {
|
|
614
|
+
type: Object,
|
|
615
|
+
required: !0
|
|
616
|
+
},
|
|
617
|
+
startDate: {
|
|
618
|
+
type: String
|
|
619
|
+
},
|
|
620
|
+
endDate: {
|
|
621
|
+
type: String
|
|
622
|
+
}
|
|
623
|
+
},
|
|
624
|
+
emits: ["update:model-value"],
|
|
625
|
+
setup(t, { emit: i }) {
|
|
626
|
+
const a = t, r = i;
|
|
627
|
+
function n() {
|
|
628
|
+
const f = RuleBuilder.getRules(a.modelValue);
|
|
629
|
+
return f.length == 0 ? "fixed" : f.some(
|
|
630
|
+
(g) => isRuleEntry(g) && RuleBuilder.simplify(g).operator == "_rrule"
|
|
631
|
+
) ? "repeating" : "fixed";
|
|
632
|
+
}
|
|
633
|
+
const s = ref(n()), o = ref(!1), e = computed(() => {
|
|
634
|
+
const f = RuleBuilder.getRules(a.modelValue), g = f.find(
|
|
635
|
+
(u) => isRuleEntry(u) && RuleBuilder.simplify(u).property == "trigger.date"
|
|
636
|
+
), v = f.find(
|
|
637
|
+
(u) => isRuleEntry(u) && RuleBuilder.simplify(u).property == "trigger.time"
|
|
638
|
+
);
|
|
639
|
+
return {
|
|
640
|
+
date: g ? RuleBuilder.simplify(g).equator : null,
|
|
641
|
+
time: v ? RuleBuilder.simplify(v).equator : null
|
|
642
|
+
};
|
|
643
|
+
}), l = computed(
|
|
644
|
+
() => calculateNextScheduleAt(
|
|
645
|
+
a.modelValue,
|
|
646
|
+
/* @__PURE__ */ new Date(),
|
|
647
|
+
a.startDate ? new Date(a.startDate) : void 0,
|
|
648
|
+
a.endDate ? new Date(a.endDate) : void 0
|
|
649
|
+
)
|
|
650
|
+
);
|
|
651
|
+
function p(f) {
|
|
652
|
+
const g = f.label.toLowerCase(), v = g == "fixed" ? [
|
|
653
|
+
RuleBuilder.constructEntry(
|
|
654
|
+
"trigger.date",
|
|
655
|
+
"_isOnDate",
|
|
656
|
+
(/* @__PURE__ */ new Date()).toISOString()
|
|
657
|
+
),
|
|
658
|
+
RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
|
|
659
|
+
] : [
|
|
660
|
+
RuleBuilder.constructEntry(
|
|
661
|
+
"trigger.date",
|
|
662
|
+
"_rrule",
|
|
663
|
+
"RRULE:FREQ=DAILY;INTERVAL=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0;WKST=SU"
|
|
664
|
+
),
|
|
665
|
+
RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
|
|
666
|
+
];
|
|
667
|
+
r(
|
|
668
|
+
"update:model-value",
|
|
669
|
+
RuleBuilder.setRuleToGroup(
|
|
670
|
+
RuleBuilder.scaffoldGroup("g_schedule"),
|
|
671
|
+
v
|
|
672
|
+
)
|
|
673
|
+
), s.value = g;
|
|
674
|
+
}
|
|
675
|
+
function y(f) {
|
|
676
|
+
s.value == "fixed" ? r(
|
|
677
|
+
"update:model-value",
|
|
678
|
+
RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup("g_schedule"), [
|
|
679
|
+
RuleBuilder.constructEntry(
|
|
680
|
+
"trigger.date",
|
|
681
|
+
"_isOnDate",
|
|
682
|
+
f.date
|
|
683
|
+
),
|
|
684
|
+
RuleBuilder.constructEntry(
|
|
685
|
+
"trigger.time",
|
|
686
|
+
"_isOnTime",
|
|
687
|
+
f.time
|
|
688
|
+
)
|
|
689
|
+
])
|
|
690
|
+
) : r(
|
|
691
|
+
"update:model-value",
|
|
692
|
+
RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup("g_schedule"), [
|
|
693
|
+
RuleBuilder.constructEntry(
|
|
694
|
+
"trigger.date",
|
|
695
|
+
"_rrule",
|
|
696
|
+
f.date
|
|
697
|
+
),
|
|
698
|
+
RuleBuilder.constructEntry(
|
|
699
|
+
"trigger.time",
|
|
700
|
+
"_isOnTime",
|
|
701
|
+
f.time
|
|
702
|
+
)
|
|
703
|
+
])
|
|
704
|
+
);
|
|
705
|
+
}
|
|
706
|
+
return (f, g) => {
|
|
707
|
+
const v = resolveComponent("FmButtonGroup"), u = resolveComponent("FmTimePicker"), d = resolveComponent("FmIcon"), m = resolveComponent("FmTooltip"), c = resolveComponent("FmField"), k = resolveComponent("FmCard"), V = resolveComponent("FmPopover"), E = resolveComponent("FmDatePicker"), b = resolveComponent("FmHelperText");
|
|
708
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
709
|
+
createVNode(v, {
|
|
710
|
+
items: [{ label: "Fixed" }, { label: "Repeating" }],
|
|
711
|
+
"model-value": { label: unref(cases).title(unref(s)) },
|
|
712
|
+
"onUpdate:modelValue": p,
|
|
713
|
+
class: "mb-8"
|
|
714
|
+
}, null, 8, ["model-value"]),
|
|
715
|
+
createElementVNode("div", _hoisted_1$d, [
|
|
716
|
+
createElementVNode("div", _hoisted_2$c, [
|
|
717
|
+
createVNode(u, {
|
|
718
|
+
label: "Notify time",
|
|
719
|
+
"model-value": unref(e).time,
|
|
720
|
+
"onUpdate:modelValue": g[0] || (g[0] = (h) => y({ date: unref(e).date, time: h })),
|
|
721
|
+
"helper-text": unref(e).time ? void 0 : "Time is required",
|
|
722
|
+
"helper-state": unref(e).time ? void 0 : "error"
|
|
723
|
+
}, null, 8, ["model-value", "helper-text", "helper-state"]),
|
|
724
|
+
unref(s) == "repeating" ? (openBlock(), createElementBlock("div", _hoisted_3$a, [
|
|
725
|
+
createElementVNode("div", _hoisted_4$9, [
|
|
726
|
+
_hoisted_5$6,
|
|
727
|
+
unref(e).date ? (openBlock(), createBlock(m, {
|
|
728
|
+
key: 0,
|
|
729
|
+
"z-index": 9999,
|
|
730
|
+
content: unref(SummarizeRrule)(unref(RRule).fromString(unref(e).date).options)
|
|
731
|
+
}, {
|
|
732
|
+
default: withCtx(() => [
|
|
733
|
+
createVNode(d, {
|
|
734
|
+
name: "info",
|
|
735
|
+
size: "sm",
|
|
736
|
+
outline: !0
|
|
737
|
+
})
|
|
738
|
+
]),
|
|
739
|
+
_: 1
|
|
740
|
+
}, 8, ["content"])) : createCommentVNode("", !0)
|
|
741
|
+
]),
|
|
742
|
+
createVNode(V, {
|
|
743
|
+
"show-popover": unref(o),
|
|
744
|
+
onPopoverChanged: g[3] || (g[3] = (h) => o.value = h)
|
|
745
|
+
}, {
|
|
746
|
+
"popover-button": withCtx(() => [
|
|
747
|
+
createVNode(c, {
|
|
748
|
+
class: "cursor-pointer",
|
|
749
|
+
"helper-text": unref(e).date ? void 0 : "Date is required",
|
|
750
|
+
"helper-state": unref(e).date ? void 0 : "error"
|
|
751
|
+
}, {
|
|
752
|
+
default: withCtx(() => [
|
|
753
|
+
createElementVNode("div", _hoisted_6$3, toDisplayString(unref(e).date ? unref(SummarizeRrule)(unref(RRule).fromString(unref(e).date).options) : "Set a repeating date"), 1)
|
|
754
|
+
]),
|
|
755
|
+
_: 1
|
|
756
|
+
}, 8, ["helper-text", "helper-state"])
|
|
757
|
+
]),
|
|
758
|
+
default: withCtx(() => [
|
|
759
|
+
createVNode(k, { class: "elevated p-8 w-[450px]" }, {
|
|
760
|
+
default: withCtx(() => [
|
|
761
|
+
createVNode(_sfc_main$p, {
|
|
762
|
+
"apply-button": !0,
|
|
763
|
+
"model-value": unref(e).date || "",
|
|
764
|
+
onCancel: g[1] || (g[1] = (h) => o.value = !1),
|
|
765
|
+
"onUpdate:modelValue": g[2] || (g[2] = (h) => (y({ date: h, time: unref(e).time }), o.value = !1))
|
|
766
|
+
}, null, 8, ["model-value"])
|
|
767
|
+
]),
|
|
768
|
+
_: 1
|
|
769
|
+
})
|
|
770
|
+
]),
|
|
771
|
+
_: 1
|
|
772
|
+
}, 8, ["show-popover"])
|
|
773
|
+
])) : (openBlock(), createBlock(E, {
|
|
774
|
+
key: 1,
|
|
775
|
+
label: "Notify date",
|
|
776
|
+
"model-value": unref(e).date || "",
|
|
777
|
+
"onUpdate:modelValue": g[4] || (g[4] = (h) => y({ date: h, time: unref(e).time })),
|
|
778
|
+
"helper-text": unref(e).date ? void 0 : "Date is required",
|
|
779
|
+
"helper-state": unref(e).date ? void 0 : "error"
|
|
780
|
+
}, null, 8, ["model-value", "helper-text", "helper-state"]))
|
|
781
|
+
]),
|
|
782
|
+
unref(e).date && unref(e).time && unref(l) ? (openBlock(), createBlock(b, {
|
|
783
|
+
key: 0,
|
|
784
|
+
text: `${unref(hooks)(unref(l)).isAfter(unref(hooks)()) ? "The next notification will be sent on " : "Last trigger is on "} ${unref(hooks)(unref(l)).format("dddd, DD MMM YYYY")} at
|
|
785
|
+
${unref(hooks)(unref(l)).format("hh:mmA")} (${unref(hooks)(unref(l)).fromNow()})`
|
|
786
|
+
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
787
|
+
])
|
|
788
|
+
], 64);
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
}), _hoisted_1$c = { class: "space-y-24" }, _hoisted_2$b = { class: "grid grid-cols-2 gap-16" }, _hoisted_3$9 = { class: "fm-typo-en-title-sm-800" }, _hoisted_4$8 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_5$5 = { class: "flex items-center gap-16" }, _hoisted_6$2 = {
|
|
792
|
+
key: 0,
|
|
793
|
+
class: "mr-32"
|
|
794
|
+
}, _hoisted_7$2 = /* @__PURE__ */ createElementVNode("div", null, "to every", -1), _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
795
|
+
__name: "EarningOptionInput",
|
|
796
|
+
props: {
|
|
797
|
+
modelValue: {
|
|
798
|
+
type: Object
|
|
799
|
+
},
|
|
800
|
+
extras: {
|
|
801
|
+
type: Object
|
|
802
|
+
},
|
|
803
|
+
fixedType: {
|
|
804
|
+
type: Boolean
|
|
805
|
+
},
|
|
806
|
+
errorText: {
|
|
807
|
+
type: String
|
|
808
|
+
}
|
|
809
|
+
},
|
|
810
|
+
emits: ["update:model-value"],
|
|
811
|
+
setup(t, { emit: i }) {
|
|
812
|
+
const a = t, r = i, n = [
|
|
813
|
+
{
|
|
814
|
+
label: "Based on spending",
|
|
815
|
+
sublabel: "Customers earn rewards based on how much they spend.",
|
|
816
|
+
value: "PROPORTIONAL"
|
|
817
|
+
},
|
|
818
|
+
{
|
|
819
|
+
label: "Fixed amount",
|
|
820
|
+
sublabel: "Customers earn a set amount of rewards for specific actions.",
|
|
821
|
+
value: "FIXED"
|
|
822
|
+
}
|
|
823
|
+
].filter((e) => {
|
|
824
|
+
var l;
|
|
825
|
+
return a.fixedType || ((l = a.extras) == null ? void 0 : l.event.type) != "BILL_COMPLETED" ? e.value == "FIXED" : !0;
|
|
826
|
+
}), s = computed(() => {
|
|
827
|
+
const e = FdoEarningOption.safeParse(a.modelValue);
|
|
828
|
+
return e.success ? [] : e.error.errors;
|
|
829
|
+
});
|
|
830
|
+
function o(e) {
|
|
831
|
+
var l;
|
|
832
|
+
e != ((l = a.modelValue) == null ? void 0 : l.type) && r(
|
|
833
|
+
"update:model-value",
|
|
834
|
+
e === "FIXED" ? {
|
|
835
|
+
type: "FIXED",
|
|
836
|
+
amount: 1
|
|
837
|
+
} : {
|
|
838
|
+
type: "PROPORTIONAL",
|
|
839
|
+
amount: 1,
|
|
840
|
+
every: 1
|
|
841
|
+
}
|
|
842
|
+
);
|
|
843
|
+
}
|
|
844
|
+
return (e, l) => {
|
|
845
|
+
var g, v, u;
|
|
846
|
+
const p = resolveComponent("FmCard"), y = resolveComponent("FmStepperField"), f = resolveComponent("FmHelperText");
|
|
847
|
+
return openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
848
|
+
createElementVNode("div", _hoisted_2$b, [
|
|
849
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(n), (d) => {
|
|
850
|
+
var m, c;
|
|
851
|
+
return openBlock(), createBlock(p, {
|
|
852
|
+
variant: "outlined",
|
|
853
|
+
class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-2", {
|
|
854
|
+
"col-span-2": unref(n).length == 1,
|
|
855
|
+
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": ((m = t.modelValue) == null ? void 0 : m.type) === d.value,
|
|
856
|
+
"hover:bg-fm-color-opacity-sm": ((c = t.modelValue) == null ? void 0 : c.type) != d.value
|
|
857
|
+
}]),
|
|
858
|
+
onClick: (k) => o(d.value),
|
|
859
|
+
key: d.value
|
|
860
|
+
}, {
|
|
861
|
+
default: withCtx(() => [
|
|
862
|
+
createElementVNode("div", _hoisted_3$9, toDisplayString(d.label), 1),
|
|
863
|
+
createElementVNode("div", _hoisted_4$8, toDisplayString(d.sublabel), 1)
|
|
864
|
+
]),
|
|
865
|
+
_: 2
|
|
866
|
+
}, 1032, ["class", "onClick"]);
|
|
867
|
+
}), 128))
|
|
868
|
+
]),
|
|
869
|
+
createElementVNode("div", _hoisted_5$5, [
|
|
870
|
+
createVNode(y, {
|
|
871
|
+
label: "Receive amount",
|
|
872
|
+
class: "flex-1",
|
|
873
|
+
"model-value": ((g = t.modelValue) == null ? void 0 : g.amount) ?? null,
|
|
874
|
+
"onUpdate:modelValue": l[0] || (l[0] = (d) => r("update:model-value", {
|
|
875
|
+
...t.modelValue ?? { type: "FIXED" },
|
|
876
|
+
amount: d
|
|
877
|
+
}))
|
|
878
|
+
}, {
|
|
879
|
+
append: withCtx(() => {
|
|
880
|
+
var d, m;
|
|
881
|
+
return [
|
|
882
|
+
t.extras && ((m = unref(CollectibleOptions)[(d = t.extras) == null ? void 0 : d.type]) != null && m.name) ? (openBlock(), createElementBlock("div", _hoisted_6$2, toDisplayString(unref(CollectibleOptions)[t.extras.type].name.toLowerCase()) + "(s) ", 1)) : createCommentVNode("", !0)
|
|
883
|
+
];
|
|
884
|
+
}),
|
|
885
|
+
_: 1
|
|
886
|
+
}, 8, ["model-value"]),
|
|
887
|
+
((v = t.modelValue) == null ? void 0 : v.type) === "PROPORTIONAL" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
888
|
+
_hoisted_7$2,
|
|
889
|
+
createVNode(y, {
|
|
890
|
+
label: `Amount spend (${unref(core.Config).getCountry().currency.symbol})`,
|
|
891
|
+
class: "flex-1",
|
|
892
|
+
"model-value": ((u = t.modelValue) == null ? void 0 : u.every) ?? null,
|
|
893
|
+
"onUpdate:modelValue": l[1] || (l[1] = (d) => r("update:model-value", { ...t.modelValue, every: d }))
|
|
894
|
+
}, {
|
|
895
|
+
prepend: withCtx(() => [
|
|
896
|
+
createTextVNode(toDisplayString(unref(core.Config).getCountry().currency.symbol), 1)
|
|
897
|
+
]),
|
|
898
|
+
_: 1
|
|
899
|
+
}, 8, ["label", "model-value"])
|
|
900
|
+
], 64)) : createCommentVNode("", !0)
|
|
901
|
+
]),
|
|
902
|
+
t.errorText || unref(s).length > 0 ? (openBlock(), createBlock(f, {
|
|
903
|
+
key: 0,
|
|
904
|
+
class: "!mt-4",
|
|
905
|
+
text: t.errorText || unref(ZodHelper).helperText(unref(s), ""),
|
|
906
|
+
state: "error"
|
|
907
|
+
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
908
|
+
]);
|
|
909
|
+
};
|
|
910
|
+
}
|
|
911
|
+
}), _hoisted_1$b = { class: "space-y-16" }, _hoisted_2$a = /* @__PURE__ */ createElementVNode("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Select a game where you want your customer to play. ", -1), _hoisted_3$8 = { class: "grid grid-cols-2 gap-16" }, _hoisted_4$7 = { class: "fm-typo-en-title-sm-800" }, _hoisted_5$4 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
912
|
+
__name: "GameTypeInput",
|
|
913
|
+
props: {
|
|
914
|
+
modelValue: {
|
|
915
|
+
type: String
|
|
916
|
+
}
|
|
917
|
+
},
|
|
918
|
+
emits: ["update:model-value"],
|
|
919
|
+
setup(t, { emit: i }) {
|
|
920
|
+
const a = t, r = i, n = computed(
|
|
921
|
+
() => [
|
|
922
|
+
{
|
|
923
|
+
label: "Fortune Wheel",
|
|
924
|
+
description: "Allow customers to spin the Fortune Wheel to win various rewards.",
|
|
925
|
+
value: F_GAME_TYPE.enum.FORTUNE_WHEEL,
|
|
926
|
+
hidden: !1
|
|
927
|
+
},
|
|
928
|
+
{
|
|
929
|
+
label: "Rock paper scissor",
|
|
930
|
+
description: "Customers play a game of Rock Paper Scissors against the cashier.",
|
|
931
|
+
value: F_GAME_TYPE.enum.ROCK_PAPER_SCISSORS,
|
|
932
|
+
hidden: !0
|
|
933
|
+
}
|
|
934
|
+
].filter((s) => !s.hidden)
|
|
935
|
+
);
|
|
936
|
+
return (s, o) => {
|
|
937
|
+
const e = resolveComponent("FmCard");
|
|
938
|
+
return openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
939
|
+
_hoisted_2$a,
|
|
940
|
+
createElementVNode("div", _hoisted_3$8, [
|
|
941
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(n), (l) => (openBlock(), createBlock(e, {
|
|
942
|
+
variant: "outlined",
|
|
943
|
+
class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
|
|
944
|
+
"col-span-2": unref(n).length == 1,
|
|
945
|
+
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": t.modelValue == l.value,
|
|
946
|
+
"hover:bg-fm-color-opacity-sm": t.modelValue != l.value
|
|
947
|
+
}]),
|
|
948
|
+
onClick: () => {
|
|
949
|
+
a.modelValue != l.value && r("update:model-value", l.value);
|
|
950
|
+
},
|
|
951
|
+
key: l.value
|
|
952
|
+
}, {
|
|
953
|
+
default: withCtx(() => [
|
|
954
|
+
createElementVNode("div", _hoisted_4$7, toDisplayString(l.label), 1),
|
|
955
|
+
createElementVNode("div", _hoisted_5$4, toDisplayString(l.description), 1)
|
|
956
|
+
]),
|
|
957
|
+
_: 2
|
|
958
|
+
}, 1032, ["class", "onClick"]))), 128))
|
|
959
|
+
])
|
|
960
|
+
]);
|
|
961
|
+
};
|
|
962
|
+
}
|
|
963
|
+
}), _hoisted_1$a = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary flex items-center justify-between" }, _hoisted_2$9 = /* @__PURE__ */ createElementVNode("div", null, "Voucher description should not exceed 200 characters.", -1), _hoisted_3$7 = /* @__PURE__ */ createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Discount", -1), _hoisted_4$6 = /* @__PURE__ */ createElementVNode("div", { class: "fm-typo-en-title-sm-800 !mb-[-8px]" }, "Usage configuration", -1), _hoisted_5$3 = /* @__PURE__ */ createElementVNode("div", { class: "fm-typo-en-title-sm-800 !mb-[-8px]" }, "Availability", -1), _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
964
|
+
__name: "VoucherEditor",
|
|
965
|
+
props: {
|
|
966
|
+
modelValue: {
|
|
967
|
+
type: Object
|
|
968
|
+
},
|
|
969
|
+
rewardImage: {
|
|
970
|
+
type: Object
|
|
971
|
+
}
|
|
972
|
+
},
|
|
973
|
+
emits: ["update:model-value", "update:reward-image"],
|
|
974
|
+
setup(t, { emit: i }) {
|
|
975
|
+
const r = ref(
|
|
976
|
+
t.modelValue ?? initCollectibleConfig("VOUCHER", {
|
|
977
|
+
business: useCoreStore().currentBusiness.value._id,
|
|
978
|
+
name: ""
|
|
979
|
+
})
|
|
980
|
+
), n = FdtoCollectibleConfig, s = i;
|
|
981
|
+
return (o, e) => {
|
|
982
|
+
var f, g, v;
|
|
983
|
+
const l = resolveComponent("FmTextarea"), p = resolveComponent("FmHelperText"), y = resolveComponent("FmSwitch");
|
|
984
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
985
|
+
createVNode(_sfc_main$q, {
|
|
986
|
+
modelValue: unref(r).name,
|
|
987
|
+
"onUpdate:modelValue": e[0] || (e[0] = (u) => unref(r).name = u),
|
|
988
|
+
label: "Voucher name",
|
|
989
|
+
schema: unref(ZodHelper).typeAtPath(unref(n), "name", [unref(r).type])
|
|
990
|
+
}, null, 8, ["modelValue", "schema"]),
|
|
991
|
+
createVNode(l, {
|
|
992
|
+
class: "!mb-[-16px]",
|
|
993
|
+
modelValue: unref(r).description,
|
|
994
|
+
"onUpdate:modelValue": e[1] || (e[1] = (u) => unref(r).description = u),
|
|
995
|
+
rules: [unref(ZodHelper).ruleAtPath(unref(n), "description", [unref(r).type])]
|
|
996
|
+
}, {
|
|
997
|
+
label: withCtx(() => [
|
|
998
|
+
(openBlock(), createBlock(resolveDynamicComponent(
|
|
999
|
+
unref(ZodHelper).toInputLabel(
|
|
1000
|
+
unref(ZodHelper).typeAtPath(unref(n), "description", [unref(r).type]),
|
|
1001
|
+
"Voucher description"
|
|
1002
|
+
)
|
|
1003
|
+
)))
|
|
1004
|
+
]),
|
|
1005
|
+
_: 1
|
|
1006
|
+
}, 8, ["modelValue", "rules"]),
|
|
1007
|
+
createElementVNode("div", _hoisted_1$a, [
|
|
1008
|
+
_hoisted_2$9,
|
|
1009
|
+
createElementVNode("div", null, toDisplayString(((f = unref(r).description) == null ? void 0 : f.length) ?? 0) + "/200", 1)
|
|
1010
|
+
]),
|
|
1011
|
+
createVNode(_sfc_main$r, {
|
|
1012
|
+
class: "w-1/2 xs:w-2/3",
|
|
1013
|
+
"aspect-ratio": "16/9",
|
|
1014
|
+
file: t.rewardImage ?? void 0,
|
|
1015
|
+
thumbnail: unref(r).image ?? void 0,
|
|
1016
|
+
"onUpdate:file": e[2] || (e[2] = async (u) => {
|
|
1017
|
+
s("update:reward-image", u), u || (unref(r).image = null);
|
|
1018
|
+
})
|
|
1019
|
+
}, {
|
|
1020
|
+
label: withCtx(() => [
|
|
1021
|
+
(openBlock(), createBlock(resolveDynamicComponent(
|
|
1022
|
+
unref(ZodHelper).toInputLabel(
|
|
1023
|
+
unref(ZodHelper).typeAtPath(unref(n), "image", [unref(r).type]),
|
|
1024
|
+
"Voucher image"
|
|
1025
|
+
)
|
|
1026
|
+
)))
|
|
1027
|
+
]),
|
|
1028
|
+
_: 1
|
|
1029
|
+
}, 8, ["file", "thumbnail"]),
|
|
1030
|
+
_hoisted_3$7,
|
|
1031
|
+
createVNode(_sfc_main$s, {
|
|
1032
|
+
"model-value": unref(r).extras.effect,
|
|
1033
|
+
"onUpdate:modelValue": e[3] || (e[3] = (u) => unref(r).extras.effect = u)
|
|
1034
|
+
}, null, 8, ["model-value"]),
|
|
1035
|
+
unref(r).extras.effect == null ? (openBlock(), createBlock(p, {
|
|
1036
|
+
key: 0,
|
|
1037
|
+
class: "!mt-8",
|
|
1038
|
+
text: "Effect is required",
|
|
1039
|
+
state: "error"
|
|
1040
|
+
})) : createCommentVNode("", !0),
|
|
1041
|
+
_hoisted_4$6,
|
|
1042
|
+
createVNode(_sfc_main$t, {
|
|
1043
|
+
"model-value": unref(r).options,
|
|
1044
|
+
"no-campaign": unref(r).noCampaign,
|
|
1045
|
+
"onUpdate:modelValue": e[4] || (e[4] = (u) => unref(r).options = u),
|
|
1046
|
+
schema: unref(ZodHelper).typeAtPath(unref(n), "options", ["VOUCHER"])
|
|
1047
|
+
}, null, 8, ["model-value", "no-campaign", "schema"]),
|
|
1048
|
+
_hoisted_5$3,
|
|
1049
|
+
unref(r).type === "VOUCHER" ? (openBlock(), createBlock(_sfc_main$u, {
|
|
1050
|
+
key: 1,
|
|
1051
|
+
"model-value": ((v = (g = unref(r).extras) == null ? void 0 : g.targetLocation) == null ? void 0 : v.map(String)) ?? null,
|
|
1052
|
+
type: "select",
|
|
1053
|
+
"onUpdate:modelValue": e[5] || (e[5] = (u) => {
|
|
1054
|
+
unref(r).extras.targetLocation = u;
|
|
1055
|
+
}),
|
|
1056
|
+
rules: [unref(ZodHelper).ruleAtPath(unref(n), "extras.targetLocation")]
|
|
1057
|
+
}, null, 8, ["model-value", "rules"])) : createCommentVNode("", !0),
|
|
1058
|
+
createVNode(y, {
|
|
1059
|
+
modelValue: unref(r).internal,
|
|
1060
|
+
"onUpdate:modelValue": e[6] || (e[6] = (u) => unref(r).internal = u),
|
|
1061
|
+
"label-placement": "right",
|
|
1062
|
+
label: "Internal only",
|
|
1063
|
+
sublabel: "Voucher will not be shown to customer"
|
|
1064
|
+
}, null, 8, ["modelValue"])
|
|
1065
|
+
], 64);
|
|
1066
|
+
};
|
|
1067
|
+
}
|
|
1068
|
+
}), _hoisted_1$9 = {
|
|
1069
|
+
key: 0,
|
|
1070
|
+
class: "flex flex-col gap-y-24"
|
|
1071
|
+
}, _hoisted_2$8 = /* @__PURE__ */ createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1), _hoisted_3$6 = /* @__PURE__ */ createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Validity option", -1), _hoisted_4$5 = { class: "flex gap-8 items-center justify-start" }, _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
1072
|
+
__name: "EditRewardPoolSheet",
|
|
1073
|
+
emits: ["update:model-value"],
|
|
1074
|
+
setup(t, { expose: i, emit: a }) {
|
|
1075
|
+
const r = useMembershipStore(), { minor: n } = useLoading, s = ref(!1), o = ref(), e = ref(), l = ref(0), p = FdtoRandomReward, y = computed(() => {
|
|
1076
|
+
const u = p.safeParse(o.value);
|
|
1077
|
+
return u.success ? [] : u.error.errors;
|
|
1078
|
+
});
|
|
1079
|
+
function f(u, d, m) {
|
|
1080
|
+
u && (o.value = d, l.value = m), s.value = u;
|
|
1081
|
+
}
|
|
1082
|
+
const g = a;
|
|
1083
|
+
async function v() {
|
|
1084
|
+
const u = p.safeParse(o.value);
|
|
1085
|
+
u.success && (await n(
|
|
1086
|
+
async () => {
|
|
1087
|
+
u.data.type === "VOUCHER" && e.value && (u.data.collectibleConfig.image = await firebaseStorage.update(
|
|
1088
|
+
u.data.collectibleConfig.image || firebaseStorage.collectibleImagePath(void 0, e.value),
|
|
1089
|
+
e.value
|
|
1090
|
+
));
|
|
1091
|
+
},
|
|
1092
|
+
{
|
|
1093
|
+
message: "Uploading reward image",
|
|
1094
|
+
successMessage: "Reward image updated"
|
|
1095
|
+
}
|
|
1096
|
+
), g("update:model-value", u.data, l.value));
|
|
1097
|
+
}
|
|
1098
|
+
return i({
|
|
1099
|
+
showSheet: f
|
|
1100
|
+
}), (u, d) => {
|
|
1101
|
+
const m = resolveComponent("FmSelect"), c = resolveComponent("FmStepperField"), k = resolveComponent("FmButton"), V = resolveComponent("FmSideSheet");
|
|
1102
|
+
return openBlock(), createBlock(V, {
|
|
1103
|
+
"max-width": 560,
|
|
1104
|
+
modelValue: unref(s),
|
|
1105
|
+
"onUpdate:modelValue": [
|
|
1106
|
+
d[9] || (d[9] = (E) => isRef(s) ? s.value = E : null),
|
|
1107
|
+
d[10] || (d[10] = (E) => s.value = E)
|
|
1108
|
+
],
|
|
1109
|
+
header: "Edit reward",
|
|
1110
|
+
"dismiss-away": ""
|
|
1111
|
+
}, {
|
|
1112
|
+
"side-sheet-footer": withCtx(() => [
|
|
1113
|
+
createElementVNode("div", _hoisted_4$5, [
|
|
1114
|
+
createVNode(k, {
|
|
1115
|
+
variant: "primary",
|
|
1116
|
+
type: "button",
|
|
1117
|
+
disabled: unref(y).length > 0,
|
|
1118
|
+
label: "Confirm",
|
|
1119
|
+
onClick: d[7] || (d[7] = (E) => v())
|
|
1120
|
+
}, null, 8, ["disabled"]),
|
|
1121
|
+
createVNode(k, {
|
|
1122
|
+
variant: "secondary",
|
|
1123
|
+
type: "button",
|
|
1124
|
+
label: "Cancel",
|
|
1125
|
+
onClick: d[8] || (d[8] = (E) => s.value = !1)
|
|
1126
|
+
})
|
|
1127
|
+
])
|
|
1128
|
+
]),
|
|
1129
|
+
default: withCtx(() => {
|
|
1130
|
+
var E, b;
|
|
1131
|
+
return [
|
|
1132
|
+
unref(o) ? (openBlock(), createElementBlock("div", _hoisted_1$9, [
|
|
1133
|
+
createVNode(m, {
|
|
1134
|
+
label: "Reward Type",
|
|
1135
|
+
items: [
|
|
1136
|
+
{ label: "No Reward", value: "NO_REWARD" },
|
|
1137
|
+
{ label: "Voucher", value: "VOUCHER" },
|
|
1138
|
+
{ label: "Loyalty", value: "LOYALTY" }
|
|
1139
|
+
],
|
|
1140
|
+
"model-value": unref(o).type,
|
|
1141
|
+
"onUpdate:modelValue": d[0] || (d[0] = (h) => {
|
|
1142
|
+
h == "NO_REWARD" ? o.value = {
|
|
1143
|
+
type: "NO_REWARD",
|
|
1144
|
+
collectible: null,
|
|
1145
|
+
weight: 1
|
|
1146
|
+
} : h === "VOUCHER" ? o.value = {
|
|
1147
|
+
collectible: null,
|
|
1148
|
+
type: "VOUCHER",
|
|
1149
|
+
collectibleConfig: unref(initCollectibleConfig)("VOUCHER", {
|
|
1150
|
+
business: unref(useCoreStore)().currentBusiness.value._id
|
|
1151
|
+
}),
|
|
1152
|
+
earningOption: {
|
|
1153
|
+
amount: 1,
|
|
1154
|
+
type: "FIXED"
|
|
1155
|
+
},
|
|
1156
|
+
validityOption: {
|
|
1157
|
+
validForDay: 7
|
|
1158
|
+
},
|
|
1159
|
+
weight: 1
|
|
1160
|
+
} : o.value = {
|
|
1161
|
+
collectible: unref(r).loyaltyRewards.raw[0]._id,
|
|
1162
|
+
type: "LOYALTY",
|
|
1163
|
+
earningOption: {
|
|
1164
|
+
amount: 1,
|
|
1165
|
+
type: "FIXED"
|
|
1166
|
+
},
|
|
1167
|
+
validityOption: {
|
|
1168
|
+
validForDay: 7
|
|
1169
|
+
},
|
|
1170
|
+
weight: 1
|
|
1171
|
+
};
|
|
1172
|
+
})
|
|
1173
|
+
}, null, 8, ["model-value"]),
|
|
1174
|
+
unref(o).type == "LOYALTY" ? (openBlock(), createBlock(m, {
|
|
1175
|
+
key: 0,
|
|
1176
|
+
label: "Loyalty type",
|
|
1177
|
+
rules: [unref(ZodHelper).ruleAtPath(unref(p), "collectible", [unref(o).type])],
|
|
1178
|
+
items: unref(r).loyaltyRewards.items,
|
|
1179
|
+
"model-value": unref(o).collectible,
|
|
1180
|
+
"onUpdate:modelValue": d[1] || (d[1] = (h) => unref(o).collectible = h)
|
|
1181
|
+
}, null, 8, ["rules", "items", "model-value"])) : createCommentVNode("", !0),
|
|
1182
|
+
createVNode(c, {
|
|
1183
|
+
label: "Weight",
|
|
1184
|
+
rules: [unref(ZodHelper).ruleAtPath(unref(p), "weight", [unref(o).type])],
|
|
1185
|
+
"model-value": unref(o).weight,
|
|
1186
|
+
"onUpdate:modelValue": d[2] || (d[2] = (h) => o.value = {
|
|
1187
|
+
...unref(o),
|
|
1188
|
+
weight: h
|
|
1189
|
+
})
|
|
1190
|
+
}, null, 8, ["rules", "model-value"]),
|
|
1191
|
+
unref(o).type === "LOYALTY" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
1192
|
+
((E = unref(r).loyaltyRewards.items.find(
|
|
1193
|
+
(h) => {
|
|
1194
|
+
var B;
|
|
1195
|
+
return h.value === ((B = unref(o)) == null ? void 0 : B.collectible);
|
|
1196
|
+
}
|
|
1197
|
+
)) == null ? void 0 : E.raw.type) !== "TITLE" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
1198
|
+
_hoisted_2$8,
|
|
1199
|
+
createVNode(_sfc_main$c, {
|
|
1200
|
+
class: "mt-[-8px]",
|
|
1201
|
+
rules: [
|
|
1202
|
+
unref(ZodHelper).ruleAtPath(unref(p), "earningOption", [unref(o).type])
|
|
1203
|
+
],
|
|
1204
|
+
"helper-state": unref(ZodHelper).helperState(unref(y), "earningOption"),
|
|
1205
|
+
"error-text": unref(ZodHelper).helperText(unref(y), "earningOption"),
|
|
1206
|
+
"fixed-type": !0,
|
|
1207
|
+
"model-value": unref(o).earningOption,
|
|
1208
|
+
"onUpdate:modelValue": d[3] || (d[3] = (h) => o.value = {
|
|
1209
|
+
...unref(o),
|
|
1210
|
+
earningOption: h
|
|
1211
|
+
})
|
|
1212
|
+
}, null, 8, ["rules", "helper-state", "error-text", "model-value"])
|
|
1213
|
+
], 64)) : createCommentVNode("", !0),
|
|
1214
|
+
_hoisted_3$6,
|
|
1215
|
+
createVNode(_sfc_main$v, {
|
|
1216
|
+
class: "!gap-24",
|
|
1217
|
+
rules: [unref(ZodHelper).ruleAtPath(unref(p), "validityOption", [unref(o).type])],
|
|
1218
|
+
"model-value": unref(o).validityOption,
|
|
1219
|
+
"onUpdate:modelValue": d[4] || (d[4] = (h) => o.value = {
|
|
1220
|
+
...unref(o),
|
|
1221
|
+
validityOption: h
|
|
1222
|
+
})
|
|
1223
|
+
}, null, 8, ["rules", "model-value"])
|
|
1224
|
+
], 64)) : createCommentVNode("", !0),
|
|
1225
|
+
unref(o).type === "VOUCHER" ? (openBlock(), createBlock(_sfc_main$a, {
|
|
1226
|
+
key: 2,
|
|
1227
|
+
"reward-image": unref(e),
|
|
1228
|
+
"model-value": ((b = unref(o)) == null ? void 0 : b.collectibleConfig) ?? void 0,
|
|
1229
|
+
"onUpdate:modelValue": d[5] || (d[5] = (h) => o.value = {
|
|
1230
|
+
...unref(o),
|
|
1231
|
+
collectibleConfig: h
|
|
1232
|
+
}),
|
|
1233
|
+
"onUpdate:rewardImage": d[6] || (d[6] = (h) => e.value = h)
|
|
1234
|
+
}, null, 8, ["reward-image", "model-value"])) : createCommentVNode("", !0),
|
|
1235
|
+
createVNode(JsonViewer, { json: unref(y) }, null, 8, ["json"])
|
|
1236
|
+
])) : createCommentVNode("", !0)
|
|
1237
|
+
];
|
|
1238
|
+
}),
|
|
1239
|
+
_: 1
|
|
1240
|
+
}, 8, ["modelValue"]);
|
|
1241
|
+
};
|
|
1242
|
+
}
|
|
1243
|
+
});
|
|
1244
|
+
function isNullOrEmpty(t) {
|
|
1245
|
+
return t == null || t === "";
|
|
1246
|
+
}
|
|
1247
|
+
const _hoisted_1$8 = { class: "space-y-16" }, _hoisted_2$7 = /* @__PURE__ */ createElementVNode("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Configure the reward type and weightage given to your customer. ", -1), _hoisted_3$5 = { class: "fm-typo-en-body-lg-400" }, _hoisted_4$4 = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
1248
|
+
__name: "RewardPoolInput",
|
|
1249
|
+
props: {
|
|
1250
|
+
modelValue: {
|
|
1251
|
+
type: Array,
|
|
1252
|
+
default: () => [
|
|
1253
|
+
{
|
|
1254
|
+
collectible: null,
|
|
1255
|
+
type: "NO_REWARD",
|
|
1256
|
+
weight: 1
|
|
1257
|
+
}
|
|
1258
|
+
]
|
|
1259
|
+
}
|
|
1260
|
+
},
|
|
1261
|
+
emits: ["update:model-value"],
|
|
1262
|
+
setup(t, { emit: i }) {
|
|
1263
|
+
const a = t, r = i, n = useMembershipStore(), s = z.array(z.lazy(() => FdtoRandomReward)).min(1, "Requires at least 1 reward"), o = computed(() => a.modelValue ?? []), e = computed(() => {
|
|
1264
|
+
const u = s.safeParse(o.value);
|
|
1265
|
+
return u.success ? [] : u.error.errors;
|
|
1266
|
+
}), l = ref();
|
|
1267
|
+
function p(u, d) {
|
|
1268
|
+
var c;
|
|
1269
|
+
const m = [...o.value];
|
|
1270
|
+
m[d] = u, (c = l.value) == null || c.showSheet(!1), r("update:model-value", m);
|
|
1271
|
+
}
|
|
1272
|
+
function y(u) {
|
|
1273
|
+
const d = u.type == "VOUCHER" ? u.collectibleConfig : n.collectibles.find(
|
|
1274
|
+
(k) => k._id.toString() == u.collectible
|
|
1275
|
+
), m = CollectionUtils.formattedType((d == null ? void 0 : d.name) || ""), c = u.weight;
|
|
1276
|
+
return {
|
|
1277
|
+
label: isNullOrEmpty(m) ? "NO REWARD" : m,
|
|
1278
|
+
sublabel: `${c} (${(c / o.value.reduce((k, V) => k + V.weight, 0) * 100).toFixed(2)}%)`
|
|
1279
|
+
};
|
|
1280
|
+
}
|
|
1281
|
+
function f(u) {
|
|
1282
|
+
var m;
|
|
1283
|
+
const d = [...o.value];
|
|
1284
|
+
(m = l.value) == null || m.showSheet(!0, d[u], u);
|
|
1285
|
+
}
|
|
1286
|
+
function g(u) {
|
|
1287
|
+
const d = [...o.value];
|
|
1288
|
+
d.splice(u, 1), r("update:model-value", d);
|
|
1289
|
+
}
|
|
1290
|
+
function v() {
|
|
1291
|
+
var u;
|
|
1292
|
+
(u = l.value) == null || u.showSheet(
|
|
1293
|
+
!0,
|
|
1294
|
+
{
|
|
1295
|
+
type: "NO_REWARD",
|
|
1296
|
+
collectible: null,
|
|
1297
|
+
weight: 1
|
|
1298
|
+
},
|
|
1299
|
+
o.value.length
|
|
1300
|
+
);
|
|
1301
|
+
}
|
|
1302
|
+
return (u, d) => {
|
|
1303
|
+
const m = resolveComponent("FmButton"), c = resolveComponent("FmCard"), k = resolveComponent("FmHelperText");
|
|
1304
|
+
return openBlock(), createElementBlock("div", _hoisted_1$8, [
|
|
1305
|
+
_hoisted_2$7,
|
|
1306
|
+
createVNode(m, {
|
|
1307
|
+
label: "Add Reward",
|
|
1308
|
+
onClick: d[0] || (d[0] = (V) => v()),
|
|
1309
|
+
variant: "plain",
|
|
1310
|
+
icon: "add"
|
|
1311
|
+
}),
|
|
1312
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(o), (V, E) => (openBlock(), createBlock(c, {
|
|
1313
|
+
key: E,
|
|
1314
|
+
class: "px-16 py-12 flex items-center justify-between cursor-pointer",
|
|
1315
|
+
variant: "outlined",
|
|
1316
|
+
onClick: (b) => f(E)
|
|
1317
|
+
}, {
|
|
1318
|
+
default: withCtx(() => [
|
|
1319
|
+
createElementVNode("div", null, [
|
|
1320
|
+
createElementVNode("div", _hoisted_3$5, toDisplayString(y(V).label), 1),
|
|
1321
|
+
createElementVNode("div", _hoisted_4$4, toDisplayString(y(V).sublabel), 1)
|
|
1322
|
+
]),
|
|
1323
|
+
createVNode(m, {
|
|
1324
|
+
icon: "delete",
|
|
1325
|
+
variant: "tertiary",
|
|
1326
|
+
onClick: (b) => (b.stopPropagation(), g(E))
|
|
1327
|
+
}, null, 8, ["onClick"])
|
|
1328
|
+
]),
|
|
1329
|
+
_: 2
|
|
1330
|
+
}, 1032, ["onClick"]))), 128)),
|
|
1331
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(e).filter((V) => V.path.join(".") == ""), (V) => (openBlock(), createBlock(k, {
|
|
1332
|
+
key: V.message,
|
|
1333
|
+
text: V.message,
|
|
1334
|
+
state: "error"
|
|
1335
|
+
}, null, 8, ["text"]))), 128)),
|
|
1336
|
+
createVNode(_sfc_main$9, {
|
|
1337
|
+
ref_key: "sheetRef",
|
|
1338
|
+
ref: l,
|
|
1339
|
+
"onUpdate:modelValue": p
|
|
1340
|
+
}, null, 512)
|
|
1341
|
+
]);
|
|
1342
|
+
};
|
|
1343
|
+
}
|
|
1344
|
+
}), _hoisted_1$7 = { class: "space-y-16" }, _hoisted_2$6 = {
|
|
1345
|
+
key: 0,
|
|
1346
|
+
class: "grid grid-cols-2 gap-16"
|
|
1347
|
+
}, _hoisted_3$4 = { class: "fm-typo-en-title-sm-800" }, _hoisted_4$3 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
1348
|
+
__name: "PromotionGameTypeInput",
|
|
1349
|
+
props: {
|
|
1350
|
+
modelValue: {
|
|
1351
|
+
type: Object
|
|
1352
|
+
}
|
|
1353
|
+
},
|
|
1354
|
+
emits: ["update:model-value"],
|
|
1355
|
+
setup(t, { emit: i }) {
|
|
1356
|
+
const a = t, r = i, n = computed(() => [
|
|
1357
|
+
{
|
|
1358
|
+
label: "Rock paper scissor",
|
|
1359
|
+
description: "Customers play 3 rounds of Rock Paper Scissors against the cashier. If customer won 2 rounds, they will get a discount.",
|
|
1360
|
+
value: F_GAME_TYPE.enum.ROCK_PAPER_SCISSORS
|
|
1361
|
+
}
|
|
1362
|
+
]);
|
|
1363
|
+
return (s, o) => {
|
|
1364
|
+
var y, f, g;
|
|
1365
|
+
const e = resolveComponent("FmSwitch"), l = resolveComponent("FmCard"), p = resolveComponent("FmHelperText");
|
|
1366
|
+
return openBlock(), createElementBlock("div", _hoisted_1$7, [
|
|
1367
|
+
createVNode(e, {
|
|
1368
|
+
label: "Enable game",
|
|
1369
|
+
"model-value": !!((y = t.modelValue) != null && y.gameType),
|
|
1370
|
+
"onUpdate:modelValue": o[0] || (o[0] = (v) => v ? r("update:model-value", { gameType: "ROCK_PAPER_SCISSORS" }) : r("update:model-value", null))
|
|
1371
|
+
}, null, 8, ["model-value"]),
|
|
1372
|
+
((f = t.modelValue) == null ? void 0 : f.gameType) == "ROCK_PAPER_SCISSORS" ? (openBlock(), createElementBlock("div", _hoisted_2$6, [
|
|
1373
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(n), (v) => {
|
|
1374
|
+
var u, d;
|
|
1375
|
+
return openBlock(), createBlock(l, {
|
|
1376
|
+
variant: "outlined",
|
|
1377
|
+
class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
|
|
1378
|
+
"col-span-2": unref(n).length == 1,
|
|
1379
|
+
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": ((u = t.modelValue) == null ? void 0 : u.gameType) == v.value,
|
|
1380
|
+
"hover:bg-fm-color-opacity-sm": ((d = t.modelValue) == null ? void 0 : d.gameType) != v.value
|
|
1381
|
+
}]),
|
|
1382
|
+
onClick: () => {
|
|
1383
|
+
var m;
|
|
1384
|
+
((m = a.modelValue) == null ? void 0 : m.gameType) != v.value && r("update:model-value", { gameType: v.value });
|
|
1385
|
+
},
|
|
1386
|
+
key: v.value
|
|
1387
|
+
}, {
|
|
1388
|
+
default: withCtx(() => [
|
|
1389
|
+
createElementVNode("div", _hoisted_3$4, toDisplayString(v.label), 1),
|
|
1390
|
+
createElementVNode("div", _hoisted_4$3, toDisplayString(v.description), 1)
|
|
1391
|
+
]),
|
|
1392
|
+
_: 2
|
|
1393
|
+
}, 1032, ["class", "onClick"]);
|
|
1394
|
+
}), 128))
|
|
1395
|
+
])) : createCommentVNode("", !0),
|
|
1396
|
+
((g = t.modelValue) == null ? void 0 : g.gameType) == "ROCK_PAPER_SCISSORS" ? (openBlock(), createBlock(p, {
|
|
1397
|
+
key: 1,
|
|
1398
|
+
text: "Rock paper scissors is only available for POS >= 7.7.1 with dual screen on android devices (Sunmi D3 Pro and Sunmi T3 Pro)",
|
|
1399
|
+
state: "warning"
|
|
1400
|
+
})) : createCommentVNode("", !0)
|
|
1401
|
+
]);
|
|
1402
|
+
};
|
|
1403
|
+
}
|
|
1404
|
+
}), _hoisted_1$6 = { class: "space-y-16" }, _hoisted_2$5 = /* @__PURE__ */ createElementVNode("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Select a game where you want your customer to play. ", -1), _hoisted_3$3 = { class: "grid grid-cols-2 gap-16" }, _hoisted_4$2 = { class: "fm-typo-en-title-sm-800" }, _hoisted_5$2 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
1405
|
+
__name: "MissionTypeInput",
|
|
1406
|
+
props: {
|
|
1407
|
+
modelValue: {
|
|
1408
|
+
type: String
|
|
1409
|
+
}
|
|
1410
|
+
},
|
|
1411
|
+
emits: ["update:model-value"],
|
|
1412
|
+
setup(t, { emit: i }) {
|
|
1413
|
+
const a = t, r = i, n = computed(() => [
|
|
1414
|
+
{
|
|
1415
|
+
label: "Stamp",
|
|
1416
|
+
description: "Award stamps for purchases, redeemable after reaching set milestones.",
|
|
1417
|
+
value: F_MISSION_TYPE.enum.STAMP
|
|
1418
|
+
},
|
|
1419
|
+
{
|
|
1420
|
+
label: "Progress",
|
|
1421
|
+
description: "Reward customers when they reach a cumulative spending goal.",
|
|
1422
|
+
value: F_MISSION_TYPE.enum.PROGRESSIVE
|
|
1423
|
+
}
|
|
1424
|
+
]);
|
|
1425
|
+
return (s, o) => {
|
|
1426
|
+
const e = resolveComponent("FmCard");
|
|
1427
|
+
return openBlock(), createElementBlock("div", _hoisted_1$6, [
|
|
1428
|
+
_hoisted_2$5,
|
|
1429
|
+
createElementVNode("div", _hoisted_3$3, [
|
|
1430
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(n), (l) => (openBlock(), createBlock(e, {
|
|
1431
|
+
variant: "outlined",
|
|
1432
|
+
class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
|
|
1433
|
+
"col-span-2": unref(n).length == 1,
|
|
1434
|
+
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": t.modelValue == l.value,
|
|
1435
|
+
"hover:bg-fm-color-opacity-sm": t.modelValue != l.value
|
|
1436
|
+
}]),
|
|
1437
|
+
onClick: () => {
|
|
1438
|
+
a.modelValue != l.value && r("update:model-value", l.value);
|
|
1439
|
+
},
|
|
1440
|
+
key: l.value
|
|
1441
|
+
}, {
|
|
1442
|
+
default: withCtx(() => [
|
|
1443
|
+
createElementVNode("div", _hoisted_4$2, toDisplayString(l.label), 1),
|
|
1444
|
+
createElementVNode("div", _hoisted_5$2, toDisplayString(l.description), 1)
|
|
1445
|
+
]),
|
|
1446
|
+
_: 2
|
|
1447
|
+
}, 1032, ["class", "onClick"]))), 128))
|
|
1448
|
+
])
|
|
1449
|
+
]);
|
|
1450
|
+
};
|
|
1451
|
+
}
|
|
1452
|
+
}), _hoisted_1$5 = { class: "space-y-16" }, _hoisted_2$4 = /* @__PURE__ */ createElementVNode("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Input the total number of stamps needed to complete the mission ", -1), _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
1453
|
+
__name: "MissionEndInput",
|
|
1454
|
+
props: {
|
|
1455
|
+
modelValue: {
|
|
1456
|
+
type: [String, Number]
|
|
1457
|
+
}
|
|
1458
|
+
},
|
|
1459
|
+
emits: ["update:model-value"],
|
|
1460
|
+
setup(t, { emit: i }) {
|
|
1461
|
+
const a = i;
|
|
1462
|
+
return (r, n) => {
|
|
1463
|
+
const s = resolveComponent("FmStepperField");
|
|
1464
|
+
return openBlock(), createElementBlock("div", _hoisted_1$5, [
|
|
1465
|
+
_hoisted_2$4,
|
|
1466
|
+
createVNode(s, {
|
|
1467
|
+
label: "Maximum to collect",
|
|
1468
|
+
"model-value": t.modelValue || null,
|
|
1469
|
+
"onUpdate:modelValue": n[0] || (n[0] = (o) => a("update:model-value", o)),
|
|
1470
|
+
"helper-text": "Set the threshold required for reward eligibility"
|
|
1471
|
+
}, null, 8, ["model-value"])
|
|
1472
|
+
]);
|
|
1473
|
+
};
|
|
1474
|
+
}
|
|
1475
|
+
}), _hoisted_1$4 = /* @__PURE__ */ createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1), _hoisted_2$3 = { class: "flex gap-8 items-center justify-start" }, _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
1476
|
+
__name: "EditMissionPoolSheet",
|
|
1477
|
+
props: {
|
|
1478
|
+
maxThreshold: {
|
|
1479
|
+
type: Number,
|
|
1480
|
+
required: !0
|
|
1481
|
+
}
|
|
1482
|
+
},
|
|
1483
|
+
emits: ["update:model-value"],
|
|
1484
|
+
setup(t, { expose: i, emit: a }) {
|
|
1485
|
+
const r = t, n = useMembershipStore(), { minor: s } = useLoading, o = ref(!1), e = ref(), l = ref(), p = ref(0), y = FdtoThresholdReward, f = computed(() => {
|
|
1486
|
+
const m = y.safeParse(e.value);
|
|
1487
|
+
return m.success ? [] : m.error.errors;
|
|
1488
|
+
});
|
|
1489
|
+
function g(m, c, k) {
|
|
1490
|
+
m && (e.value = c, p.value = k), o.value = m;
|
|
1491
|
+
}
|
|
1492
|
+
const v = a;
|
|
1493
|
+
async function u() {
|
|
1494
|
+
console.log(e.value);
|
|
1495
|
+
const m = y.safeParse(e.value);
|
|
1496
|
+
m.success && (await s(
|
|
1497
|
+
async () => {
|
|
1498
|
+
m.data.type === "VOUCHER" && l.value && (m.data.collectibleConfig.image = await firebaseStorage.update(
|
|
1499
|
+
m.data.collectibleConfig.image || firebaseStorage.collectibleImagePath(void 0, l.value),
|
|
1500
|
+
l.value
|
|
1501
|
+
));
|
|
1502
|
+
},
|
|
1503
|
+
{
|
|
1504
|
+
message: "Uploading reward image",
|
|
1505
|
+
successMessage: "Reward image updated"
|
|
1506
|
+
}
|
|
1507
|
+
), v("update:model-value", m.data, p.value));
|
|
1508
|
+
}
|
|
1509
|
+
const d = ref();
|
|
1510
|
+
return i({
|
|
1511
|
+
showSheet: g
|
|
1512
|
+
}), (m, c) => {
|
|
1513
|
+
const k = resolveComponent("FmStepperField"), V = resolveComponent("FmSelect"), E = resolveComponent("FmForm"), b = resolveComponent("FmButton"), h = resolveComponent("FmSideSheet");
|
|
1514
|
+
return openBlock(), createBlock(h, {
|
|
1515
|
+
"max-width": 560,
|
|
1516
|
+
modelValue: unref(o),
|
|
1517
|
+
"onUpdate:modelValue": [
|
|
1518
|
+
c[10] || (c[10] = (B) => isRef(o) ? o.value = B : null),
|
|
1519
|
+
c[11] || (c[11] = (B) => o.value = B)
|
|
1520
|
+
],
|
|
1521
|
+
header: "Edit reward",
|
|
1522
|
+
"dismiss-away": ""
|
|
1523
|
+
}, {
|
|
1524
|
+
"side-sheet-footer": withCtx(() => [
|
|
1525
|
+
createElementVNode("div", _hoisted_2$3, [
|
|
1526
|
+
createVNode(b, {
|
|
1527
|
+
variant: "primary",
|
|
1528
|
+
type: "button",
|
|
1529
|
+
label: "Confirm",
|
|
1530
|
+
onClick: c[8] || (c[8] = async () => {
|
|
1531
|
+
var B;
|
|
1532
|
+
return (B = unref(d)) == null ? void 0 : B.validateInputs();
|
|
1533
|
+
})
|
|
1534
|
+
}),
|
|
1535
|
+
createVNode(b, {
|
|
1536
|
+
variant: "secondary",
|
|
1537
|
+
type: "button",
|
|
1538
|
+
label: "Cancel",
|
|
1539
|
+
onClick: c[9] || (c[9] = (B) => o.value = !1)
|
|
1540
|
+
})
|
|
1541
|
+
])
|
|
1542
|
+
]),
|
|
1543
|
+
default: withCtx(() => [
|
|
1544
|
+
unref(e) ? (openBlock(), createBlock(E, {
|
|
1545
|
+
key: 0,
|
|
1546
|
+
class: "flex flex-col gap-y-24",
|
|
1547
|
+
ref_key: "formRef",
|
|
1548
|
+
ref: d,
|
|
1549
|
+
onValidationSuccess: c[7] || (c[7] = (B) => u())
|
|
1550
|
+
}, {
|
|
1551
|
+
default: withCtx(() => {
|
|
1552
|
+
var B;
|
|
1553
|
+
return [
|
|
1554
|
+
unref(e).type ? (openBlock(), createBlock(k, {
|
|
1555
|
+
key: 0,
|
|
1556
|
+
label: "Threshold",
|
|
1557
|
+
rules: [
|
|
1558
|
+
unref(ZodHelper).toRule(
|
|
1559
|
+
unref(z).number().min(1).max(
|
|
1560
|
+
r.maxThreshold,
|
|
1561
|
+
`Number cannot be more than ${r.maxThreshold}`
|
|
1562
|
+
)
|
|
1563
|
+
)
|
|
1564
|
+
],
|
|
1565
|
+
"model-value": unref(e).threshold,
|
|
1566
|
+
"onUpdate:modelValue": c[0] || (c[0] = (C) => e.value = {
|
|
1567
|
+
...unref(e),
|
|
1568
|
+
threshold: C
|
|
1569
|
+
})
|
|
1570
|
+
}, null, 8, ["rules", "model-value"])) : createCommentVNode("", !0),
|
|
1571
|
+
createVNode(V, {
|
|
1572
|
+
label: "Reward Type",
|
|
1573
|
+
items: [
|
|
1574
|
+
{ label: "Voucher", value: "VOUCHER" },
|
|
1575
|
+
{ label: "Loyalty", value: "LOYALTY" }
|
|
1576
|
+
],
|
|
1577
|
+
"model-value": unref(e).type,
|
|
1578
|
+
"onUpdate:modelValue": c[1] || (c[1] = (C) => {
|
|
1579
|
+
C === "VOUCHER" ? e.value = {
|
|
1580
|
+
collectible: null,
|
|
1581
|
+
type: "VOUCHER",
|
|
1582
|
+
collectibleConfig: unref(initCollectibleConfig)("VOUCHER", {
|
|
1583
|
+
business: unref(useCoreStore)().currentBusiness.value._id
|
|
1584
|
+
}),
|
|
1585
|
+
earningOption: {
|
|
1586
|
+
amount: 1,
|
|
1587
|
+
type: "FIXED"
|
|
1588
|
+
},
|
|
1589
|
+
validityOption: {
|
|
1590
|
+
validForDay: 7
|
|
1591
|
+
},
|
|
1592
|
+
threshold: null
|
|
1593
|
+
} : e.value = {
|
|
1594
|
+
collectible: unref(n).loyaltyRewards.raw[0]._id,
|
|
1595
|
+
type: "LOYALTY",
|
|
1596
|
+
earningOption: {
|
|
1597
|
+
amount: 1,
|
|
1598
|
+
type: "FIXED"
|
|
1599
|
+
},
|
|
1600
|
+
validityOption: {
|
|
1601
|
+
validForDay: 7
|
|
1602
|
+
},
|
|
1603
|
+
threshold: null
|
|
1604
|
+
};
|
|
1605
|
+
})
|
|
1606
|
+
}, null, 8, ["model-value"]),
|
|
1607
|
+
unref(e).type == "LOYALTY" ? (openBlock(), createBlock(V, {
|
|
1608
|
+
key: 1,
|
|
1609
|
+
label: "Loyalty type",
|
|
1610
|
+
rules: [unref(ZodHelper).ruleAtPath(unref(y), "collectible", [unref(e).type])],
|
|
1611
|
+
items: unref(n).loyaltyRewards.items,
|
|
1612
|
+
"model-value": unref(e).collectible,
|
|
1613
|
+
"onUpdate:modelValue": c[2] || (c[2] = (C) => unref(e).collectible = C)
|
|
1614
|
+
}, null, 8, ["rules", "items", "model-value"])) : createCommentVNode("", !0),
|
|
1615
|
+
unref(e).type === "LOYALTY" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
1616
|
+
_hoisted_1$4,
|
|
1617
|
+
createVNode(_sfc_main$c, {
|
|
1618
|
+
class: "mt-[-8px]",
|
|
1619
|
+
rules: [unref(ZodHelper).ruleAtPath(unref(y), "earningOption", [unref(e).type])],
|
|
1620
|
+
"helper-state": unref(ZodHelper).helperState(unref(f), "earningOption"),
|
|
1621
|
+
"error-text": unref(ZodHelper).helperText(unref(f), "earningOption"),
|
|
1622
|
+
"fixed-type": !0,
|
|
1623
|
+
"model-value": unref(e).earningOption,
|
|
1624
|
+
"onUpdate:modelValue": c[3] || (c[3] = (C) => e.value = {
|
|
1625
|
+
...unref(e),
|
|
1626
|
+
earningOption: C
|
|
1627
|
+
})
|
|
1628
|
+
}, null, 8, ["rules", "helper-state", "error-text", "model-value"]),
|
|
1629
|
+
createVNode(_sfc_main$v, {
|
|
1630
|
+
class: "!gap-24",
|
|
1631
|
+
rules: [unref(ZodHelper).ruleAtPath(unref(y), "validityOption", [unref(e).type])],
|
|
1632
|
+
"model-value": unref(e).validityOption,
|
|
1633
|
+
"onUpdate:modelValue": c[4] || (c[4] = (C) => e.value = {
|
|
1634
|
+
...unref(e),
|
|
1635
|
+
validityOption: C
|
|
1636
|
+
})
|
|
1637
|
+
}, null, 8, ["rules", "model-value"])
|
|
1638
|
+
], 64)) : createCommentVNode("", !0),
|
|
1639
|
+
unref(e).type === "VOUCHER" ? (openBlock(), createBlock(_sfc_main$a, {
|
|
1640
|
+
key: 3,
|
|
1641
|
+
"reward-image": unref(l),
|
|
1642
|
+
"model-value": ((B = unref(e)) == null ? void 0 : B.collectibleConfig) ?? void 0,
|
|
1643
|
+
"onUpdate:modelValue": c[5] || (c[5] = (C) => e.value = {
|
|
1644
|
+
...unref(e),
|
|
1645
|
+
collectibleConfig: C
|
|
1646
|
+
}),
|
|
1647
|
+
"onUpdate:rewardImage": c[6] || (c[6] = (C) => l.value = C)
|
|
1648
|
+
}, null, 8, ["reward-image", "model-value"])) : createCommentVNode("", !0),
|
|
1649
|
+
createVNode(JsonViewer, { json: unref(f) }, null, 8, ["json"])
|
|
1650
|
+
];
|
|
1651
|
+
}),
|
|
1652
|
+
_: 1
|
|
1653
|
+
}, 512)) : createCommentVNode("", !0)
|
|
1654
|
+
]),
|
|
1655
|
+
_: 1
|
|
1656
|
+
}, 8, ["modelValue"]);
|
|
1657
|
+
};
|
|
1658
|
+
}
|
|
1659
|
+
}), _hoisted_1$3 = { class: "relative w-full h-4 bg-fm-color-system-warning-100 rounded-lg" }, _hoisted_2$2 = /* @__PURE__ */ createElementVNode("div", { class: "flex flex-col gap-0 items-center justify-center" }, [
|
|
1660
|
+
/* @__PURE__ */ createElementVNode("div", { class: "h-16 w-[2px] bg-fm-color-system-warning-300" }),
|
|
1661
|
+
/* @__PURE__ */ createElementVNode("div", null, "🎁")
|
|
1662
|
+
], -1), _hoisted_3$2 = [
|
|
1663
|
+
_hoisted_2$2
|
|
1664
|
+
], _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
1665
|
+
__name: "MissionProgress",
|
|
1666
|
+
props: {
|
|
1667
|
+
maxRange: {
|
|
1668
|
+
type: Number,
|
|
1669
|
+
required: !0
|
|
1670
|
+
},
|
|
1671
|
+
currentRange: {
|
|
1672
|
+
type: Number,
|
|
1673
|
+
default: 0
|
|
1674
|
+
},
|
|
1675
|
+
markers: {
|
|
1676
|
+
type: Array,
|
|
1677
|
+
default: () => []
|
|
1678
|
+
}
|
|
1679
|
+
},
|
|
1680
|
+
setup(t) {
|
|
1681
|
+
const i = t, { maxRange: a, currentRange: r, markers: n } = toRefs(i), s = computed(
|
|
1682
|
+
() => Math.min(r.value / a.value * 100, 100)
|
|
1683
|
+
), o = (e) => e / a.value * 100;
|
|
1684
|
+
return (e, l) => (openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
1685
|
+
createElementVNode("div", {
|
|
1686
|
+
class: "absolute top-0 left-0 h-full bg-fm-color-primary rounded-lg",
|
|
1687
|
+
style: normalizeStyle({ width: unref(s) + "%" })
|
|
1688
|
+
}, null, 4),
|
|
1689
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(n), (p, y) => (openBlock(), createElementBlock("div", {
|
|
1690
|
+
key: y,
|
|
1691
|
+
class: "absolute -top-1.5 flex flex-col items-center -translate-x-1/2",
|
|
1692
|
+
style: normalizeStyle({ left: o(p) + "%" })
|
|
1693
|
+
}, _hoisted_3$2, 4))), 128))
|
|
1694
|
+
]));
|
|
1695
|
+
}
|
|
1696
|
+
}), _hoisted_1$2 = { class: "space-y-16" }, _hoisted_2$1 = /* @__PURE__ */ createElementVNode("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Configure the reward type given to your customer. ", -1), _hoisted_3$1 = { class: "fm-typo-en-body-lg-400" }, _hoisted_4$1 = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _hoisted_5$1 = /* @__PURE__ */ createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Mission Preview", -1), _hoisted_6$1 = { class: "flex items-center gap-4" }, _hoisted_7$1 = { class: "fm-typo-en-body-lg-600" }, _hoisted_8$1 = /* @__PURE__ */ createElementVNode("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Earn a stamp when you { condition here } ", -1), _hoisted_9$1 = {
|
|
1697
|
+
key: 0,
|
|
1698
|
+
class: "grid grid-cols-5 text-center gap-8 justify-between items-center"
|
|
1699
|
+
}, _hoisted_10$1 = {
|
|
1700
|
+
key: 1,
|
|
1701
|
+
class: "flex items-center gap-16"
|
|
1702
|
+
}, _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
1703
|
+
__name: "MissionPoolInput",
|
|
1704
|
+
props: {
|
|
1705
|
+
modelValue: {
|
|
1706
|
+
type: Array,
|
|
1707
|
+
default: () => []
|
|
1708
|
+
},
|
|
1709
|
+
mission: {
|
|
1710
|
+
type: Object,
|
|
1711
|
+
required: !0
|
|
1712
|
+
}
|
|
1713
|
+
},
|
|
1714
|
+
emits: ["update:model-value"],
|
|
1715
|
+
setup(t, { emit: i }) {
|
|
1716
|
+
const a = t, r = i, n = useMembershipStore(), s = z.array(z.lazy(() => FdtoThresholdReward)).min(1, "Requires at least 1 reward"), o = computed(() => a.modelValue ?? []), e = computed(() => {
|
|
1717
|
+
const u = s.safeParse(o.value);
|
|
1718
|
+
return u.success ? [] : u.error.errors;
|
|
1719
|
+
}), l = ref();
|
|
1720
|
+
function p(u, d) {
|
|
1721
|
+
var c;
|
|
1722
|
+
const m = [...o.value];
|
|
1723
|
+
m[d] = u, (c = l.value) == null || c.showSheet(!1), r("update:model-value", m);
|
|
1724
|
+
}
|
|
1725
|
+
function y(u) {
|
|
1726
|
+
const d = u.type == "VOUCHER" ? u.collectibleConfig : n.collectibles.find(
|
|
1727
|
+
(c) => c._id.toString() == u.collectible
|
|
1728
|
+
), m = CollectionUtils.formattedType((d == null ? void 0 : d.name) || "");
|
|
1729
|
+
return {
|
|
1730
|
+
label: isNullOrEmpty(m) ? "NO REWARD" : m,
|
|
1731
|
+
sublabel: "hihihiha"
|
|
1732
|
+
};
|
|
1733
|
+
}
|
|
1734
|
+
function f(u) {
|
|
1735
|
+
var m;
|
|
1736
|
+
const d = [...o.value];
|
|
1737
|
+
(m = l.value) == null || m.showSheet(!0, d[u], u);
|
|
1738
|
+
}
|
|
1739
|
+
function g(u) {
|
|
1740
|
+
const d = [...o.value];
|
|
1741
|
+
d.splice(u, 1), r("update:model-value", d);
|
|
1742
|
+
}
|
|
1743
|
+
function v() {
|
|
1744
|
+
var u;
|
|
1745
|
+
(u = l.value) == null || u.showSheet(
|
|
1746
|
+
!0,
|
|
1747
|
+
{
|
|
1748
|
+
type: "LOYALTY",
|
|
1749
|
+
collectible: n.loyaltyRewards.items[0].value,
|
|
1750
|
+
threshold: null,
|
|
1751
|
+
validityOption: {
|
|
1752
|
+
validForDay: 7
|
|
1753
|
+
},
|
|
1754
|
+
earningOption: {
|
|
1755
|
+
type: "FIXED",
|
|
1756
|
+
amount: 1
|
|
1757
|
+
}
|
|
1758
|
+
},
|
|
1759
|
+
o.value.length
|
|
1760
|
+
);
|
|
1761
|
+
}
|
|
1762
|
+
return (u, d) => {
|
|
1763
|
+
const m = resolveComponent("FmButton"), c = resolveComponent("FmCard"), k = resolveComponent("FmHelperText"), V = resolveComponent("FmAvatar"), E = resolveComponent("FmIcon");
|
|
1764
|
+
return openBlock(), createElementBlock("div", _hoisted_1$2, [
|
|
1765
|
+
_hoisted_2$1,
|
|
1766
|
+
createVNode(m, {
|
|
1767
|
+
label: "Add Reward",
|
|
1768
|
+
onClick: d[0] || (d[0] = (b) => v()),
|
|
1769
|
+
variant: "plain",
|
|
1770
|
+
icon: "add"
|
|
1771
|
+
}),
|
|
1772
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(o), (b, h) => (openBlock(), createBlock(c, {
|
|
1773
|
+
key: h,
|
|
1774
|
+
class: "px-16 py-12 flex items-center justify-between cursor-pointer",
|
|
1775
|
+
variant: "outlined",
|
|
1776
|
+
onClick: (B) => f(h)
|
|
1777
|
+
}, {
|
|
1778
|
+
default: withCtx(() => [
|
|
1779
|
+
createElementVNode("div", null, [
|
|
1780
|
+
createElementVNode("div", _hoisted_3$1, toDisplayString(y(b).label), 1),
|
|
1781
|
+
createElementVNode("div", _hoisted_4$1, toDisplayString(y(b).sublabel), 1)
|
|
1782
|
+
]),
|
|
1783
|
+
createVNode(m, {
|
|
1784
|
+
icon: "delete",
|
|
1785
|
+
variant: "tertiary",
|
|
1786
|
+
onClick: (B) => (B.stopPropagation(), g(h))
|
|
1787
|
+
}, null, 8, ["onClick"])
|
|
1788
|
+
]),
|
|
1789
|
+
_: 2
|
|
1790
|
+
}, 1032, ["onClick"]))), 128)),
|
|
1791
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(e).filter((b) => b.path.join(".") == ""), (b) => (openBlock(), createBlock(k, {
|
|
1792
|
+
key: b.message,
|
|
1793
|
+
text: b.message,
|
|
1794
|
+
state: "error"
|
|
1795
|
+
}, null, 8, ["text"]))), 128)),
|
|
1796
|
+
_hoisted_5$1,
|
|
1797
|
+
createVNode(c, {
|
|
1798
|
+
variant: "outlined",
|
|
1799
|
+
class: "p-24 space-y-16 w-fit"
|
|
1800
|
+
}, {
|
|
1801
|
+
default: withCtx(() => [
|
|
1802
|
+
createElementVNode("div", _hoisted_6$1, [
|
|
1803
|
+
createElementVNode("div", null, [
|
|
1804
|
+
createElementVNode("div", _hoisted_7$1, " Collect " + toDisplayString(t.mission.end) + " rewards to get { rewards here } ", 1),
|
|
1805
|
+
_hoisted_8$1
|
|
1806
|
+
]),
|
|
1807
|
+
createVNode(V, {
|
|
1808
|
+
name: "GG",
|
|
1809
|
+
size: "xl"
|
|
1810
|
+
})
|
|
1811
|
+
]),
|
|
1812
|
+
t.mission.type === "STAMP" ? (openBlock(), createElementBlock("div", _hoisted_9$1, [
|
|
1813
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(t.mission.end, (b) => (openBlock(), createBlock(E, {
|
|
1814
|
+
outline: "",
|
|
1815
|
+
key: b,
|
|
1816
|
+
name: t.modelValue.some((h) => h.threshold === b) ? "featured_seasonal_and_gifts" : "check_circle"
|
|
1817
|
+
}, null, 8, ["name"]))), 128))
|
|
1818
|
+
])) : createCommentVNode("", !0),
|
|
1819
|
+
t.mission.type === "PROGRESSIVE" ? (openBlock(), createElementBlock("div", _hoisted_10$1, [
|
|
1820
|
+
createVNode(_sfc_main$3, {
|
|
1821
|
+
"max-range": t.mission.end,
|
|
1822
|
+
currentRange: 0,
|
|
1823
|
+
markers: [400, 1e3]
|
|
1824
|
+
}, null, 8, ["max-range"]),
|
|
1825
|
+
createElementVNode("div", null, "0/" + toDisplayString(t.mission.end.toLocaleString()), 1)
|
|
1826
|
+
])) : createCommentVNode("", !0)
|
|
1827
|
+
]),
|
|
1828
|
+
_: 1
|
|
1829
|
+
}),
|
|
1830
|
+
createVNode(_sfc_main$4, {
|
|
1831
|
+
ref_key: "sheetRef",
|
|
1832
|
+
ref: l,
|
|
1833
|
+
"onUpdate:modelValue": p,
|
|
1834
|
+
"max-threshold": t.mission.end
|
|
1835
|
+
}, null, 8, ["max-threshold"])
|
|
1836
|
+
]);
|
|
1837
|
+
};
|
|
1838
|
+
}
|
|
1839
|
+
}), _hoisted_1$1 = { key: 25 }, _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
1840
|
+
__name: "TemplateInput",
|
|
1841
|
+
props: {
|
|
1842
|
+
field: { type: Object, required: !0 },
|
|
1843
|
+
modelValue: {
|
|
1844
|
+
type: Object
|
|
1845
|
+
},
|
|
1846
|
+
schema: {
|
|
1847
|
+
type: Object
|
|
1848
|
+
},
|
|
1849
|
+
extras: {
|
|
1850
|
+
type: Object
|
|
1851
|
+
},
|
|
1852
|
+
helperText: {
|
|
1853
|
+
type: String
|
|
1854
|
+
},
|
|
1855
|
+
disabled: {
|
|
1856
|
+
type: Boolean,
|
|
1857
|
+
default: !1
|
|
1858
|
+
}
|
|
1859
|
+
},
|
|
1860
|
+
emits: ["update:model-value", "update:file"],
|
|
1861
|
+
setup(t, { emit: i }) {
|
|
1862
|
+
const a = t, r = i;
|
|
1863
|
+
function n(l) {
|
|
1864
|
+
switch (a.field.type) {
|
|
1865
|
+
case "timeframe":
|
|
1866
|
+
const p = l.startDate ? hooks(l.startDate).startOf("day").toISOString() : void 0, y = l.endDate ? hooks(l.endDate).endOf("day").toISOString() : void 0;
|
|
1867
|
+
r("update:model-value", {
|
|
1868
|
+
type: "timeframe",
|
|
1869
|
+
property: "__now",
|
|
1870
|
+
start: p,
|
|
1871
|
+
end: y
|
|
1872
|
+
});
|
|
1873
|
+
break;
|
|
1874
|
+
case "image": {
|
|
1875
|
+
r(
|
|
1876
|
+
"update:file",
|
|
1877
|
+
l,
|
|
1878
|
+
s.value || firebaseStorage.collectibleImagePath(void 0, l)
|
|
1879
|
+
);
|
|
1880
|
+
break;
|
|
1881
|
+
}
|
|
1882
|
+
default:
|
|
1883
|
+
r("update:model-value", l);
|
|
1884
|
+
break;
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
const s = computed(() => {
|
|
1888
|
+
switch (a.field.type) {
|
|
1889
|
+
case "timeframe": {
|
|
1890
|
+
const l = a.modelValue;
|
|
1891
|
+
return {
|
|
1892
|
+
startDate: l != null && l.start ? hooks(l == null ? void 0 : l.start).format("YYYY-MM-DD") : null,
|
|
1893
|
+
endDate: l != null && l.end ? hooks(l == null ? void 0 : l.end).format("YYYY-MM-DD") : null
|
|
1894
|
+
};
|
|
1895
|
+
}
|
|
1896
|
+
default:
|
|
1897
|
+
return a.modelValue;
|
|
1898
|
+
}
|
|
1899
|
+
});
|
|
1900
|
+
function o() {
|
|
1901
|
+
if (!e.value.schema) return [];
|
|
1902
|
+
const l = e.value.schema.safeParse(a.modelValue);
|
|
1903
|
+
return l.success ? [] : l.error.errors;
|
|
1904
|
+
}
|
|
1905
|
+
const e = computed(() => ({
|
|
1906
|
+
schema: a.schema,
|
|
1907
|
+
unwrapped: a.schema ? ZodHelper.unwrap(a.schema) : void 0,
|
|
1908
|
+
rules: a.schema ? [ZodHelper.ruleAtPath(a.schema, "")] : void 0,
|
|
1909
|
+
labelMark: a.schema && ZodHelper.isRequired(a.schema) == !1 ? "optional" : void 0,
|
|
1910
|
+
zodLabel: a.schema ? ZodHelper.toInputLabel(a.schema, a.field.label) : void 0
|
|
1911
|
+
}));
|
|
1912
|
+
return (l, p) => {
|
|
1913
|
+
var d, m, c, k, V;
|
|
1914
|
+
const y = resolveComponent("FmTextField"), f = resolveComponent("FmStepperField"), g = resolveComponent("FmTextarea"), v = resolveComponent("FmHelperText"), u = resolveComponent("FmSwitch");
|
|
1915
|
+
return t.field.type === "text" ? (openBlock(), createBlock(y, {
|
|
1916
|
+
key: 0,
|
|
1917
|
+
label: t.field.label,
|
|
1918
|
+
"label-mark": unref(e).labelMark,
|
|
1919
|
+
rules: unref(e).rules,
|
|
1920
|
+
"model-value": unref(s),
|
|
1921
|
+
"onUpdate:modelValue": n
|
|
1922
|
+
}, null, 8, ["label", "label-mark", "rules", "model-value"])) : t.field.type === "number" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
1923
|
+
createVNode(JsonViewer, {
|
|
1924
|
+
json: { schema: unref(e).unwrapped, props: a }
|
|
1925
|
+
}, null, 8, ["json"]),
|
|
1926
|
+
createVNode(f, {
|
|
1927
|
+
label: t.field.label,
|
|
1928
|
+
"label-mark": t.field.isRuleChildren ? void 0 : unref(e).labelMark,
|
|
1929
|
+
"model-value": unref(s),
|
|
1930
|
+
rules: t.field.isRuleChildren ? [] : unref(e).rules,
|
|
1931
|
+
"onUpdate:modelValue": n,
|
|
1932
|
+
"helper-state": t.field.isRuleChildren && t.helperText ? "error" : void 0,
|
|
1933
|
+
"helper-text": t.field.isRuleChildren ? t.helperText : void 0
|
|
1934
|
+
}, null, 8, ["label", "label-mark", "model-value", "rules", "helper-state", "helper-text"])
|
|
1935
|
+
], 64)) : t.field.type === "textarea" ? (openBlock(), createBlock(g, {
|
|
1936
|
+
key: 2,
|
|
1937
|
+
label: t.field.label,
|
|
1938
|
+
"label-mark": unref(e).labelMark,
|
|
1939
|
+
rules: unref(e).rules,
|
|
1940
|
+
"model-value": unref(s),
|
|
1941
|
+
"onUpdate:modelValue": n,
|
|
1942
|
+
"show-word-count": "",
|
|
1943
|
+
"max-length": (V = (k = (c = (m = (d = unref(e)) == null ? void 0 : d.unwrapped) == null ? void 0 : m._def) == null ? void 0 : c.checks) == null ? void 0 : k.find((E) => E.kind == "max")) == null ? void 0 : V.value
|
|
1944
|
+
}, null, 8, ["label", "label-mark", "rules", "model-value", "max-length"])) : t.field.type === "trigger" ? (openBlock(), createBlock(_sfc_main$g, {
|
|
1945
|
+
key: 3,
|
|
1946
|
+
"campaign-type": t.extras,
|
|
1947
|
+
"model-value": unref(s),
|
|
1948
|
+
disabled: t.disabled,
|
|
1949
|
+
"onUpdate:modelValue": n
|
|
1950
|
+
}, null, 8, ["campaign-type", "model-value", "disabled"])) : t.field.type === "timeframe" ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
|
|
1951
|
+
createVNode(_sfc_main$e, {
|
|
1952
|
+
"model-value": unref(s),
|
|
1953
|
+
"onUpdate:modelValue": n
|
|
1954
|
+
}, null, 8, ["model-value"]),
|
|
1955
|
+
createVNode(v, {
|
|
1956
|
+
class: "!mt-[8px]",
|
|
1957
|
+
text: unref(ZodHelper).helperText(o(), ""),
|
|
1958
|
+
state: unref(ZodHelper).helperState(o(), "")
|
|
1959
|
+
}, null, 8, ["text", "state"])
|
|
1960
|
+
], 64)) : t.field.type === "image" ? (openBlock(), createBlock(_sfc_main$r, {
|
|
1961
|
+
key: 5,
|
|
1962
|
+
thumbnail: unref(s),
|
|
1963
|
+
"aspect-ratio": "16 / 9",
|
|
1964
|
+
class: "w-1/2 xs:w-2/3",
|
|
1965
|
+
"onUpdate:file": n
|
|
1966
|
+
}, {
|
|
1967
|
+
label: withCtx(() => [
|
|
1968
|
+
(openBlock(), createBlock(resolveDynamicComponent(unref(e).zodLabel)))
|
|
1969
|
+
]),
|
|
1970
|
+
_: 1
|
|
1971
|
+
}, 8, ["thumbnail"])) : t.field.type === "switch" ? (openBlock(), createBlock(u, {
|
|
1972
|
+
key: 6,
|
|
1973
|
+
label: t.field.label,
|
|
1974
|
+
"label-placement": "right",
|
|
1975
|
+
sublabel: t.field.property == "campaign.notify" ? "Notify customer when customer receives the reward" : void 0,
|
|
1976
|
+
"label-mark": unref(e).labelMark,
|
|
1977
|
+
rules: unref(e).rules,
|
|
1978
|
+
"model-value": unref(s),
|
|
1979
|
+
"onUpdate:modelValue": n
|
|
1980
|
+
}, null, 8, ["label", "sublabel", "label-mark", "rules", "model-value"])) : t.field.type === "collectible_options" ? (openBlock(), createBlock(_sfc_main$t, {
|
|
1981
|
+
key: 7,
|
|
1982
|
+
"model-value": unref(s),
|
|
1983
|
+
"onUpdate:modelValue": n,
|
|
1984
|
+
"no-campaign": !1,
|
|
1985
|
+
schema: unref(e).schema
|
|
1986
|
+
}, null, 8, ["model-value", "schema"])) : t.field.type === "target_location" ? (openBlock(), createBlock(_sfc_main$u, {
|
|
1987
|
+
key: 8,
|
|
1988
|
+
"model-value": unref(s),
|
|
1989
|
+
"onUpdate:modelValue": n
|
|
1990
|
+
}, null, 8, ["model-value"])) : t.field.type == "effect" ? (openBlock(), createElementBlock(Fragment, { key: 9 }, [
|
|
1991
|
+
createVNode(_sfc_main$s, {
|
|
1992
|
+
"model-value": unref(s),
|
|
1993
|
+
"onUpdate:modelValue": n,
|
|
1994
|
+
"can-set-auto-apply": t.field.property == "campaign.effect"
|
|
1995
|
+
}, null, 8, ["model-value", "can-set-auto-apply"]),
|
|
1996
|
+
unref(s) ? createCommentVNode("", !0) : (openBlock(), createBlock(v, {
|
|
1997
|
+
key: 0,
|
|
1998
|
+
class: "!mt-[8px]",
|
|
1999
|
+
text: "Effect is required",
|
|
2000
|
+
state: "error"
|
|
2001
|
+
}))
|
|
2002
|
+
], 64)) : t.field.type === "message" ? (openBlock(), createBlock(_sfc_main$w, {
|
|
2003
|
+
key: 10,
|
|
2004
|
+
"allow-email": !0,
|
|
2005
|
+
"model-value": unref(s),
|
|
2006
|
+
"onUpdate:modelValue": n,
|
|
2007
|
+
"helper-text": unref(ZodHelper).helperText(o(), ""),
|
|
2008
|
+
"trigger-type": t.field.extras,
|
|
2009
|
+
"helper-state": unref(ZodHelper).helperState(o(), "")
|
|
2010
|
+
}, null, 8, ["model-value", "helper-text", "trigger-type", "helper-state"])) : t.field.type === "earning_option" ? (openBlock(), createBlock(_sfc_main$c, {
|
|
2011
|
+
key: 11,
|
|
2012
|
+
"model-value": unref(s),
|
|
2013
|
+
"onUpdate:modelValue": n,
|
|
2014
|
+
extras: t.extras
|
|
2015
|
+
}, null, 8, ["model-value", "extras"])) : t.field.type === "validity_option" ? (openBlock(), createBlock(_sfc_main$v, {
|
|
2016
|
+
key: 12,
|
|
2017
|
+
type: "custom",
|
|
2018
|
+
"model-value": unref(s),
|
|
2019
|
+
"onUpdate:modelValue": n,
|
|
2020
|
+
"helper-text": unref(ZodHelper).helperText(o(), ""),
|
|
2021
|
+
"helper-state": unref(ZodHelper).helperState(o(), "")
|
|
2022
|
+
}, null, 8, ["model-value", "helper-text", "helper-state"])) : t.field.type === "game_type" ? (openBlock(), createBlock(_sfc_main$b, {
|
|
2023
|
+
key: 13,
|
|
2024
|
+
"model-value": unref(s),
|
|
2025
|
+
"onUpdate:modelValue": n
|
|
2026
|
+
}, null, 8, ["model-value"])) : t.field.type === "reward_pool" ? (openBlock(), createBlock(_sfc_main$8, {
|
|
2027
|
+
key: 14,
|
|
2028
|
+
"model-value": unref(s),
|
|
2029
|
+
"onUpdate:modelValue": n
|
|
2030
|
+
}, null, 8, ["model-value"])) : t.field.type === "mission_type" ? (openBlock(), createBlock(_sfc_main$6, {
|
|
2031
|
+
key: 15,
|
|
2032
|
+
"model-value": unref(s),
|
|
2033
|
+
"onUpdate:modelValue": n
|
|
2034
|
+
}, null, 8, ["model-value"])) : t.field.type === "mission_end" ? (openBlock(), createBlock(_sfc_main$5, {
|
|
2035
|
+
key: 16,
|
|
2036
|
+
"model-value": unref(s),
|
|
2037
|
+
"onUpdate:modelValue": n
|
|
2038
|
+
}, null, 8, ["model-value"])) : t.field.type === "mission_pool" ? (openBlock(), createBlock(_sfc_main$2, {
|
|
2039
|
+
key: 17,
|
|
2040
|
+
"model-value": unref(s),
|
|
2041
|
+
"onUpdate:modelValue": n,
|
|
2042
|
+
mission: t.extras
|
|
2043
|
+
}, null, 8, ["model-value", "mission"])) : t.field.type === "rule_schedule" ? (openBlock(), createElementBlock(Fragment, { key: 18 }, [
|
|
2044
|
+
createVNode(_sfc_main$d, {
|
|
2045
|
+
"model-value": unref(s),
|
|
2046
|
+
"onUpdate:modelValue": n,
|
|
2047
|
+
"start-date": t.extras.start,
|
|
2048
|
+
"end-date": t.extras.end
|
|
2049
|
+
}, null, 8, ["model-value", "start-date", "end-date"]),
|
|
2050
|
+
t.helperText ? (openBlock(), createBlock(v, {
|
|
2051
|
+
key: 0,
|
|
2052
|
+
class: "!mt-[8px]",
|
|
2053
|
+
text: t.helperText,
|
|
2054
|
+
state: "error"
|
|
2055
|
+
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
2056
|
+
], 64)) : t.field.type === "rule_user" ? (openBlock(), createElementBlock(Fragment, { key: 19 }, [
|
|
2057
|
+
createVNode(_sfc_main$l, {
|
|
2058
|
+
"model-value": unref(s),
|
|
2059
|
+
"onUpdate:modelValue": n
|
|
2060
|
+
}, null, 8, ["model-value"]),
|
|
2061
|
+
t.helperText ? (openBlock(), createBlock(v, {
|
|
2062
|
+
key: 0,
|
|
2063
|
+
class: "!mt-[8px]",
|
|
2064
|
+
text: t.helperText,
|
|
2065
|
+
state: "error"
|
|
2066
|
+
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
2067
|
+
], 64)) : t.field.type === "rule_time" ? (openBlock(), createElementBlock(Fragment, { key: 20 }, [
|
|
2068
|
+
t.extras == "PROMOTION" && unref(RuleBuilder).getRules(unref(s).rules.g_time).length > 0 ? (openBlock(), createBlock(v, {
|
|
2069
|
+
key: 0,
|
|
2070
|
+
state: "warning",
|
|
2071
|
+
text: `Time based rule only work for POS >= v${unref(featureVersionMapping).TIME_BASED_PROMOTION}`
|
|
2072
|
+
}, null, 8, ["text"])) : createCommentVNode("", !0),
|
|
2073
|
+
createVNode(_sfc_main$k, {
|
|
2074
|
+
"model-value": unref(s),
|
|
2075
|
+
"onUpdate:modelValue": n
|
|
2076
|
+
}, null, 8, ["model-value"]),
|
|
2077
|
+
t.helperText ? (openBlock(), createBlock(v, {
|
|
2078
|
+
key: 1,
|
|
2079
|
+
class: "!mt-[8px]",
|
|
2080
|
+
text: t.helperText,
|
|
2081
|
+
state: "error"
|
|
2082
|
+
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
2083
|
+
], 64)) : t.field.type === "rule_bill" ? (openBlock(), createElementBlock(Fragment, { key: 21 }, [
|
|
2084
|
+
createVNode(_sfc_main$j, {
|
|
2085
|
+
"model-value": unref(s),
|
|
2086
|
+
"onUpdate:modelValue": n
|
|
2087
|
+
}, null, 8, ["model-value"]),
|
|
2088
|
+
t.helperText ? (openBlock(), createBlock(v, {
|
|
2089
|
+
key: 0,
|
|
2090
|
+
class: "!mt-[8px]",
|
|
2091
|
+
text: t.helperText,
|
|
2092
|
+
state: "error"
|
|
2093
|
+
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
2094
|
+
], 64)) : t.field.type === "rule_feedback" ? (openBlock(), createElementBlock(Fragment, { key: 22 }, [
|
|
2095
|
+
createVNode(_sfc_main$h, {
|
|
2096
|
+
"model-value": unref(s),
|
|
2097
|
+
"onUpdate:modelValue": n
|
|
2098
|
+
}, null, 8, ["model-value"]),
|
|
2099
|
+
t.helperText ? (openBlock(), createBlock(v, {
|
|
2100
|
+
key: 0,
|
|
2101
|
+
class: "!mt-[8px]",
|
|
2102
|
+
text: t.helperText,
|
|
2103
|
+
state: "error"
|
|
2104
|
+
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
2105
|
+
], 64)) : t.field.type === "rule_birthday" ? (openBlock(), createElementBlock(Fragment, { key: 23 }, [
|
|
2106
|
+
createVNode(_sfc_main$i, {
|
|
2107
|
+
"model-value": unref(s),
|
|
2108
|
+
"onUpdate:modelValue": n
|
|
2109
|
+
}, null, 8, ["model-value"]),
|
|
2110
|
+
t.helperText ? (openBlock(), createBlock(v, {
|
|
2111
|
+
key: 0,
|
|
2112
|
+
class: "!mt-[8px]",
|
|
2113
|
+
text: t.helperText,
|
|
2114
|
+
state: "error"
|
|
2115
|
+
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
2116
|
+
], 64)) : t.field.type === "promotion_game_type" ? (openBlock(), createElementBlock(Fragment, { key: 24 }, [
|
|
2117
|
+
createVNode(_sfc_main$7, {
|
|
2118
|
+
"model-value": unref(s),
|
|
2119
|
+
"onUpdate:modelValue": n
|
|
2120
|
+
}, null, 8, ["model-value"]),
|
|
2121
|
+
t.helperText ? (openBlock(), createBlock(v, {
|
|
2122
|
+
key: 0,
|
|
2123
|
+
class: "!mt-[8px]",
|
|
2124
|
+
text: t.helperText,
|
|
2125
|
+
state: "error"
|
|
2126
|
+
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
2127
|
+
], 64)) : (openBlock(), createElementBlock("pre", _hoisted_1$1, toDisplayString(a.field), 1));
|
|
2128
|
+
};
|
|
2129
|
+
}
|
|
2130
|
+
}), _hoisted_1 = { class: "xs:hidden px-24 pb-[14px] pt-[22px] flex items-center justify-between w-full border-b" }, _hoisted_2 = { class: "flex items-center gap-8" }, _hoisted_3 = {
|
|
2131
|
+
key: 0,
|
|
2132
|
+
class: "max-w-6xl mx-auto"
|
|
2133
|
+
}, _hoisted_4 = { class: "hidden xs:flex gap-8 items-center w-full px-16 py-8 border-b border-fm-color-neutral-gray-100" }, _hoisted_5 = { class: "grid grid-cols-3 gap-40" }, _hoisted_6 = { class: "col-span-2 space-y-40 xs:col-span-3 xs:px-16 xs:pt-16" }, _hoisted_7 = { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, _hoisted_8 = { class: "w-full flex items-center justify-end gap-8 pb-24" }, _hoisted_9 = /* @__PURE__ */ createElementVNode("div", { class: "fm-typo-en-body-lg-600" }, "Campaign summary", -1), _hoisted_10 = /* @__PURE__ */ createElementVNode("div", { class: "border-b border-fm-color-neutral-gray-100 w-full" }, null, -1), _hoisted_11 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_12 = { class: "fm-typo-en-body-lg-600" }, _hoisted_13 = { class: "max-w-6xl mx-auto rounded-md p-4 w-full" }, _hoisted_14 = { class: "animate-pulse flex space-x-4 pt-16" }, _hoisted_15 = { class: "grid grid-cols-3 w-full gap-40" }, _hoisted_16 = /* @__PURE__ */ createElementVNode("div", { class: "col-span-2 space-y-80 xs:col-span-3 xs:px-16 xs:pt-16" }, [
|
|
2134
|
+
/* @__PURE__ */ createElementVNode("div", { class: "flex-1 space-y-6 py-1" }, [
|
|
2135
|
+
/* @__PURE__ */ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100 rounded" }),
|
|
2136
|
+
/* @__PURE__ */ createElementVNode("div", { class: "h-[80px] bg-fm-color-neutral-gray-100 rounded" }),
|
|
2137
|
+
/* @__PURE__ */ createElementVNode("div", { class: "space-y-3" }, [
|
|
2138
|
+
/* @__PURE__ */ createElementVNode("div", { class: "grid grid-cols-2 gap-4" }, [
|
|
2139
|
+
/* @__PURE__ */ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" }),
|
|
2140
|
+
/* @__PURE__ */ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
|
|
2141
|
+
]),
|
|
2142
|
+
/* @__PURE__ */ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
|
|
2143
|
+
]),
|
|
2144
|
+
/* @__PURE__ */ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100 rounded" }),
|
|
2145
|
+
/* @__PURE__ */ createElementVNode("div", { class: "h-[80px] bg-fm-color-neutral-gray-100 rounded" }),
|
|
2146
|
+
/* @__PURE__ */ createElementVNode("div", { class: "space-y-3" }, [
|
|
2147
|
+
/* @__PURE__ */ createElementVNode("div", { class: "grid grid-cols-2 gap-4" }, [
|
|
2148
|
+
/* @__PURE__ */ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" }),
|
|
2149
|
+
/* @__PURE__ */ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
|
|
2150
|
+
]),
|
|
2151
|
+
/* @__PURE__ */ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
|
|
2152
|
+
])
|
|
2153
|
+
])
|
|
2154
|
+
], -1), _sfc_main = /* @__PURE__ */ defineComponent({
|
|
2155
|
+
__name: "EditCampaignSheet",
|
|
2156
|
+
emits: ["submit:model-value"],
|
|
2157
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
2158
|
+
const Dialog = useDialog(), sheetVisible = ref(!1), currentStep = ref(1), data = ref(), schema = ref(z.any()), template = ref(
|
|
2159
|
+
TEMPLATES.VOUCHER
|
|
2160
|
+
), { minor } = useLoading, isLoading = ref(!1), sheetTitle = ref("Create Campaign");
|
|
2161
|
+
async function showSheet(visible, type, campaign, selectedTemplate) {
|
|
2162
|
+
var t, i;
|
|
2163
|
+
if (sheetVisible.value = visible, visible == !0) {
|
|
2164
|
+
try {
|
|
2165
|
+
isLoading.value = visible, await useMembershipStore().readRewards(), await useBusinessStore().readLocations(), await useMembershipStore().readSegments(), await useMembershipStore().readMembership();
|
|
2166
|
+
} catch {
|
|
2167
|
+
} finally {
|
|
2168
|
+
await new Promise((a) => setTimeout(a, 120)), isLoading.value = !1;
|
|
2169
|
+
}
|
|
2170
|
+
template.value = selectedTemplate ?? TEMPLATES[type], schema.value = CampaignDtos[type], data.value = campaign != null ? { ...campaign, templateId: (t = campaign.template) == null ? void 0 : t._id } : _.cloneDeep({
|
|
2171
|
+
...(i = template.value) == null ? void 0 : i.defaultValue
|
|
2172
|
+
}), "configs" in data.value && typeof data.value.configs == "string" && (data.value.configs = eval(data.value.configs)), data.value = cleanPF(data.value), data.value.templateId = SvcConfig.getBusinessId(), data.value.campaign.business = SvcConfig.getBusinessId(), data.value.campaign.templateId = SvcConfig.getBusinessId(), "configs" in data.value && (data.value.configs.business = SvcConfig.getBusinessId()), currentStep.value = 1, sheetTitle.value = campaign ? `Edit ${CampaignOptions[type].name} Campaign` : `Create ${CampaignOptions[type].name} Campaign`;
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
async function hideSheet() {
|
|
2176
|
+
Dialog.open({
|
|
2177
|
+
title: "Unsaved Changes",
|
|
2178
|
+
message: "Are you sure you want to discard this changes?",
|
|
2179
|
+
primaryActions: { text: "Discard", close: !0 },
|
|
2180
|
+
secondaryActions: { text: "Cancel", close: !1 }
|
|
2181
|
+
}).onPrimary(() => {
|
|
2182
|
+
sheetVisible.value = !1;
|
|
2183
|
+
}).onSecondary(() => {
|
|
2184
|
+
Dialog.close();
|
|
2185
|
+
});
|
|
2186
|
+
}
|
|
2187
|
+
const emits = __emit, errors = computed(() => {
|
|
2188
|
+
const t = schema.value.superRefine(campaignRefinement).safeParse(data.value);
|
|
2189
|
+
return t.success ? [] : t.error.errors;
|
|
2190
|
+
});
|
|
2191
|
+
function stepErrors(t = currentStep.value - 1) {
|
|
2192
|
+
const i = template.value.steps[t].groups.flatMap(
|
|
2193
|
+
(a) => a.fields.map((r) => r.property)
|
|
2194
|
+
);
|
|
2195
|
+
return errors.value.filter((a) => i.includes(a.path.join(".")));
|
|
2196
|
+
}
|
|
2197
|
+
__expose({ showSheet });
|
|
2198
|
+
function onUpdateProperty(t, i) {
|
|
2199
|
+
if (_.set(data.value, t, i), t == "campaign.event.type") {
|
|
2200
|
+
const a = RuleBuilder.setRuleToGroup(
|
|
2201
|
+
RuleBuilder.scaffoldGroup(),
|
|
2202
|
+
[
|
|
2203
|
+
RuleBuilder.scaffoldGroup("g_schedule"),
|
|
2204
|
+
RuleBuilder.scaffoldGroup("g_time"),
|
|
2205
|
+
RuleBuilder.scaffoldGroup("g_user"),
|
|
2206
|
+
RuleBuilder.scaffoldGroup("g_bill")
|
|
2207
|
+
]
|
|
2208
|
+
), r = RuleBuilder.setRuleToGroup(
|
|
2209
|
+
RuleBuilder.scaffoldGroup("g_schedule"),
|
|
2210
|
+
[
|
|
2211
|
+
RuleBuilder.constructEntry(
|
|
2212
|
+
"trigger.date",
|
|
2213
|
+
"_rrule",
|
|
2214
|
+
"RRULE:FREQ=DAILY;INTERVAL=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0;WKST=SU"
|
|
2215
|
+
),
|
|
2216
|
+
RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
|
|
2217
|
+
],
|
|
2218
|
+
"&&"
|
|
2219
|
+
);
|
|
2220
|
+
if (i != "SCHEDULE") {
|
|
2221
|
+
_.set(data.value, "campaign.event.rule", a);
|
|
2222
|
+
return;
|
|
2223
|
+
}
|
|
2224
|
+
_.set(
|
|
2225
|
+
data.value,
|
|
2226
|
+
"campaign.event.rule",
|
|
2227
|
+
RuleBuilder.setRuleToGroup(a, r)
|
|
2228
|
+
);
|
|
2229
|
+
}
|
|
2230
|
+
t == "campaign.notify" && i == !1 && _.set(data.value, "campaign.notifyMessage", void 0);
|
|
2231
|
+
}
|
|
2232
|
+
async function onUpdateFile(t, i) {
|
|
2233
|
+
return t ? await minor(async () => firebaseStorage.update(i, t), {
|
|
2234
|
+
message: `${t ? "Uploading" : "Removing"} file`,
|
|
2235
|
+
successMessage: `File ${t ? "uploaded" : "removed"} successfully`
|
|
2236
|
+
}) : "";
|
|
2237
|
+
}
|
|
2238
|
+
function isDisable(t) {
|
|
2239
|
+
var i, a;
|
|
2240
|
+
switch (t == null ? void 0 : t.property) {
|
|
2241
|
+
case "campaign.event.type":
|
|
2242
|
+
return ((a = (i = data.value) == null ? void 0 : i.campaign) == null ? void 0 : a._id) || !1;
|
|
2243
|
+
default:
|
|
2244
|
+
return !1;
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2247
|
+
function onSubmit() {
|
|
2248
|
+
const t = schema.value.superRefine(campaignRefinement).transform(campaignTransform).safeParse(data.value);
|
|
2249
|
+
t.success && (emits("submit:model-value", cleanPF(JSON.parse(JSON.stringify(t.data)))), sheetVisible.value = !1);
|
|
2250
|
+
}
|
|
2251
|
+
return (t, i) => {
|
|
2252
|
+
const a = resolveComponent("FmButton"), r = resolveComponent("FmStep"), n = resolveComponent("FmStepper"), s = resolveComponent("FmCard"), o = resolveComponent("FmTopSheet");
|
|
2253
|
+
return openBlock(), createBlock(o, {
|
|
2254
|
+
"fullscreen-size": "lg",
|
|
2255
|
+
modelValue: unref(sheetVisible),
|
|
2256
|
+
"onUpdate:modelValue": [
|
|
2257
|
+
i[6] || (i[6] = (e) => isRef(sheetVisible) ? sheetVisible.value = e : null),
|
|
2258
|
+
i[7] || (i[7] = (e) => sheetVisible.value = e)
|
|
2259
|
+
]
|
|
2260
|
+
}, createSlots({
|
|
2261
|
+
"top-sheet-header": withCtx(() => [
|
|
2262
|
+
createElementVNode("div", _hoisted_1, [
|
|
2263
|
+
createElementVNode("div", null, toDisplayString(unref(sheetTitle)), 1),
|
|
2264
|
+
createElementVNode("div", _hoisted_2, [
|
|
2265
|
+
createVNode(a, {
|
|
2266
|
+
onClick: i[0] || (i[0] = (e) => hideSheet()),
|
|
2267
|
+
label: "Cancel",
|
|
2268
|
+
variant: "tertiary"
|
|
2269
|
+
}),
|
|
2270
|
+
createVNode(a, {
|
|
2271
|
+
onClick: onSubmit,
|
|
2272
|
+
label: "Save",
|
|
2273
|
+
disabled: unref(errors).length > 0
|
|
2274
|
+
}, null, 8, ["disabled"])
|
|
2275
|
+
])
|
|
2276
|
+
])
|
|
2277
|
+
]),
|
|
2278
|
+
_: 2
|
|
2279
|
+
}, [
|
|
2280
|
+
unref(isLoading) ? {
|
|
2281
|
+
name: "default",
|
|
2282
|
+
fn: withCtx(() => [
|
|
2283
|
+
createElementVNode("div", _hoisted_13, [
|
|
2284
|
+
createElementVNode("div", _hoisted_14, [
|
|
2285
|
+
createElementVNode("div", _hoisted_15, [
|
|
2286
|
+
_hoisted_16,
|
|
2287
|
+
createVNode(s, { class: "h-[150px] bg-fm-color-neutral-gray-100" })
|
|
2288
|
+
])
|
|
2289
|
+
])
|
|
2290
|
+
])
|
|
2291
|
+
]),
|
|
2292
|
+
key: "1"
|
|
2293
|
+
} : {
|
|
2294
|
+
name: "default",
|
|
2295
|
+
fn: withCtx(() => [
|
|
2296
|
+
unref(data) ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
2297
|
+
createVNode(n, {
|
|
2298
|
+
modelValue: unref(currentStep),
|
|
2299
|
+
"onUpdate:modelValue": i[1] || (i[1] = (e) => isRef(currentStep) ? currentStep.value = e : null),
|
|
2300
|
+
orientation: "horizontal",
|
|
2301
|
+
class: "xs:hidden mx-[-24px] mt-16 mb-24 flex-1"
|
|
2302
|
+
}, {
|
|
2303
|
+
default: withCtx(() => [
|
|
2304
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps, (e, l) => (openBlock(), createBlock(r, {
|
|
2305
|
+
key: e.name,
|
|
2306
|
+
title: e.name,
|
|
2307
|
+
value: l + 1,
|
|
2308
|
+
error: () => stepErrors(l).length > 0,
|
|
2309
|
+
complete: () => l + 1 <= unref(currentStep) && stepErrors(unref(currentStep) - 1).length == 0
|
|
2310
|
+
}, null, 8, ["title", "value", "error", "complete"]))), 128))
|
|
2311
|
+
]),
|
|
2312
|
+
_: 1
|
|
2313
|
+
}, 8, ["modelValue"]),
|
|
2314
|
+
createElementVNode("div", _hoisted_4, [
|
|
2315
|
+
createVNode(a, {
|
|
2316
|
+
icon: "close",
|
|
2317
|
+
variant: "tertiary",
|
|
2318
|
+
onClick: i[2] || (i[2] = (e) => sheetVisible.value = !1)
|
|
2319
|
+
}),
|
|
2320
|
+
createVNode(n, {
|
|
2321
|
+
modelValue: unref(currentStep),
|
|
2322
|
+
"onUpdate:modelValue": i[3] || (i[3] = (e) => isRef(currentStep) ? currentStep.value = e : null),
|
|
2323
|
+
orientation: "horizontal",
|
|
2324
|
+
class: "flex-1"
|
|
2325
|
+
}, {
|
|
2326
|
+
default: withCtx(() => [
|
|
2327
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps, (e, l) => (openBlock(), createBlock(r, {
|
|
2328
|
+
key: e.name,
|
|
2329
|
+
title: unref(data).campaign._id ? "Create campaign" : "Edit campaign",
|
|
2330
|
+
description: e.name,
|
|
2331
|
+
value: l + 1,
|
|
2332
|
+
error: () => stepErrors(l).length > 0,
|
|
2333
|
+
complete: () => l + 1 <= unref(currentStep) && stepErrors(unref(currentStep) - 1).length == 0
|
|
2334
|
+
}, null, 8, ["title", "description", "value", "error", "complete"]))), 128))
|
|
2335
|
+
]),
|
|
2336
|
+
_: 1
|
|
2337
|
+
}, 8, ["modelValue"]),
|
|
2338
|
+
createVNode(a, {
|
|
2339
|
+
icon: "info",
|
|
2340
|
+
variant: "tertiary"
|
|
2341
|
+
})
|
|
2342
|
+
]),
|
|
2343
|
+
createElementVNode("div", _hoisted_5, [
|
|
2344
|
+
createElementVNode("div", _hoisted_6, [
|
|
2345
|
+
createVNode(JsonViewer, {
|
|
2346
|
+
json: {
|
|
2347
|
+
data: unref(data),
|
|
2348
|
+
errors: unref(errors).map(
|
|
2349
|
+
(e) => `${e.path.join(".")} - ${e.message}`
|
|
2350
|
+
),
|
|
2351
|
+
stepErrors: stepErrors().map(
|
|
2352
|
+
(e) => `${e.path.join(".")} - ${e.message}`
|
|
2353
|
+
),
|
|
2354
|
+
schema: unref(schema)
|
|
2355
|
+
}
|
|
2356
|
+
}, null, 8, ["json"]),
|
|
2357
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps[unref(currentStep) - 1].groups.filter(
|
|
2358
|
+
(e) => e.fields.length && (!e.condition || unref(_).get(unref(data), e.condition.property) == e.condition.value == (e.condition.not != !0))
|
|
2359
|
+
), (e, l) => (openBlock(), createElementBlock("div", {
|
|
2360
|
+
key: l,
|
|
2361
|
+
class: "space-y-24"
|
|
2362
|
+
}, [
|
|
2363
|
+
createElementVNode("div", _hoisted_7, toDisplayString(e.name), 1),
|
|
2364
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(e.fields, (p, y) => (openBlock(), createElementBlock("div", { key: y }, [
|
|
2365
|
+
(openBlock(), createBlock(_sfc_main$1, {
|
|
2366
|
+
key: y,
|
|
2367
|
+
field: p,
|
|
2368
|
+
modelValue: unref(_).get(unref(data), p.property),
|
|
2369
|
+
disabled: isDisable(p),
|
|
2370
|
+
"onUpdate:modelValue": (f) => onUpdateProperty(p.property, f),
|
|
2371
|
+
"onUpdate:file": async (f, g) => {
|
|
2372
|
+
const v = await onUpdateFile(f, g);
|
|
2373
|
+
onUpdateProperty(p.property, v || "");
|
|
2374
|
+
},
|
|
2375
|
+
schema: unref(ZodHelper).typeAtPath(unref(schema), p.property, [
|
|
2376
|
+
unref(data).campaign.type
|
|
2377
|
+
]),
|
|
2378
|
+
"helper-text": unref(ZodHelper).helperText(unref(errors), p.property),
|
|
2379
|
+
extras: p.extras ? unref(_).get(unref(data), p.extras) : void 0
|
|
2380
|
+
}, null, 8, ["field", "modelValue", "disabled", "onUpdate:modelValue", "onUpdate:file", "schema", "helper-text", "extras"]))
|
|
2381
|
+
]))), 128))
|
|
2382
|
+
]))), 128)),
|
|
2383
|
+
createElementVNode("div", _hoisted_8, [
|
|
2384
|
+
createVNode(a, {
|
|
2385
|
+
label: "Back",
|
|
2386
|
+
variant: "tertiary",
|
|
2387
|
+
disabled: unref(currentStep) == 1,
|
|
2388
|
+
onClick: i[4] || (i[4] = (e) => currentStep.value--)
|
|
2389
|
+
}, null, 8, ["disabled"]),
|
|
2390
|
+
createVNode(a, {
|
|
2391
|
+
disabled: stepErrors().length > 0,
|
|
2392
|
+
label: unref(currentStep) - 1 < unref(template).steps.length - 1 ? "Next" : "Submit",
|
|
2393
|
+
onClick: i[5] || (i[5] = (e) => unref(currentStep) - 1 < unref(template).steps.length - 1 ? currentStep.value++ : onSubmit())
|
|
2394
|
+
}, null, 8, ["disabled", "label"])
|
|
2395
|
+
])
|
|
2396
|
+
]),
|
|
2397
|
+
createVNode(s, {
|
|
2398
|
+
variant: "outlined",
|
|
2399
|
+
class: "p-16 space-y-8 xs:hidden"
|
|
2400
|
+
}, {
|
|
2401
|
+
default: withCtx(() => [
|
|
2402
|
+
_hoisted_9,
|
|
2403
|
+
_hoisted_10,
|
|
2404
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(getCampaignSummaryObject)(unref(data)), (e, l) => (openBlock(), createElementBlock("div", {
|
|
2405
|
+
class: "space-y-4",
|
|
2406
|
+
key: l
|
|
2407
|
+
}, [
|
|
2408
|
+
e ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2409
|
+
createElementVNode("div", _hoisted_11, toDisplayString(l), 1),
|
|
2410
|
+
createElementVNode("div", _hoisted_12, toDisplayString(e), 1)
|
|
2411
|
+
], 64)) : createCommentVNode("", !0)
|
|
2412
|
+
]))), 128))
|
|
2413
|
+
]),
|
|
2414
|
+
_: 1
|
|
2415
|
+
})
|
|
2416
|
+
])
|
|
2417
|
+
])) : createCommentVNode("", !0)
|
|
2418
|
+
]),
|
|
2419
|
+
key: "0"
|
|
2420
|
+
}
|
|
2421
|
+
]), 1032, ["modelValue"]);
|
|
2422
|
+
};
|
|
2423
|
+
}
|
|
2424
|
+
});
|
|
2425
|
+
export {
|
|
2426
|
+
_sfc_main as _
|
|
2427
|
+
};
|