@feedmepos/mf-connect 0.1.38-beta.3 → 0.1.38-beta.31
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-DlzNe_iy.js → Analytic-C_nMR1Be.js} +15 -15
- package/dist/{App-S5t6byxx.js → App-s6O0r91S.js} +624 -618
- package/dist/{AuditLogs-FO7SmMm2.js → AuditLogs-BcVkpvGw.js} +14 -14
- package/dist/{Bin-D--pK-f4.js → Bin-C5g9jHoQ.js} +9 -9
- package/dist/Broadcast-JPTVWDJC.js +233 -0
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-C6MYdWnX.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CloO2B7A.js} +6 -6
- package/dist/{Card-DHL6WnwR.js → Card-Dgj6yukn.js} +143 -137
- package/dist/{Collections-DnonNjPT.js → Collections-D-aFYRCq.js} +82 -76
- package/dist/Credit-BZcRB9Wj.js +228 -0
- package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-BUzUIIUW.js → DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js} +1 -1
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DnPPICf0.js +3117 -0
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-C4zzEOCb.js → EffectSheet.vue_vue_type_style_index_0_lang-DbSiVLaJ.js} +100 -99
- package/dist/Experience-DHQPxVv3.js +229 -0
- package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +129 -0
- package/dist/{Game-Bkl0JnBq.js → Game-C1XnMgil.js} +103 -97
- package/dist/Grab-BbHccgZO.js +301 -0
- package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js → ImageInput.vue_vue_type_script_setup_true_lang-D1KQpDGg.js} +8 -8
- package/dist/{Index-BXTpF6kN.js → Index-DYZsN2H3.js} +54 -54
- package/dist/{Marketing-kk88gqDC.js → Marketing-DnsPHYpt.js} +7112 -5424
- package/dist/{Member-Cq-orpRf.js → Member-rkdV1fVo.js} +10 -10
- package/dist/{MemberList-B0K6Djc0.js → MemberList-QaB13bxO.js} +33 -33
- package/dist/{MemberTransactions-BCrJz8M9.js → MemberTransactions-Dw5qHQVW.js} +1 -1
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-BcGhTM5H.js → MessageInput.vue_vue_type_script_setup_true_lang-DGyv0LMu.js} +5789 -5515
- package/dist/{Mission-BF1Z-Veq.js → Mission-B7rAzf6O.js} +112 -106
- package/dist/{Overview-CLSBBnZz.js → Overview-Cg4Szz05.js} +21 -21
- package/dist/Point-DuKS8-0D.js +232 -0
- package/dist/{Promotion-CGwxt3l3.js → Promotion-CFtLq-LB.js} +11 -11
- package/dist/{Queue-Dihw6DCV.js → Queue-BZONVNCP.js} +13 -13
- package/dist/{Record-ChSb722p.js → Record-jNEahJNC.js} +10 -10
- package/dist/{Reward-8oKlHA-x.js → Reward-VS6C6NQO.js} +15 -15
- package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-D--YGFcF.js → RewardGroup.vue_vue_type_script_setup_true_lang-D4KMGgkv.js} +11 -11
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Cb-WJA0i.js +1763 -0
- package/dist/{Segment-BbYgbJ7w.js → Segment-DK5tqeOF.js} +274 -274
- package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-Dy_G8md1.js → SelectItems.vue_vue_type_script_setup_true_lang-AYAwO37B.js} +14 -14
- package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-BFhY3cve.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-K8js6fbo.js} +11 -11
- package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-WEiXy4o1.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-lcPHPa4K.js} +3 -3
- package/dist/{Setting-B75a5DWV.js → Setting-BtiUlWRc.js} +459 -444
- package/dist/{Store-Cb8Et93b.js → Store-DqFW5hr_.js} +472 -465
- package/dist/{StoreRewards-DEI9VJHO.js → StoreRewards-g-3WtxwG.js} +15 -15
- package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-BGBl4Zla.js → StoreTransactions.vue_vue_type_script_setup_true_lang-DNT4PWgl.js} +208 -222
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-92NnMkro.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-CXYnNSta.js} +1 -1
- package/dist/{Tier-BB4AyAZV.js → Tier-SHij9zKX.js} +230 -227
- package/dist/{Title-Cla1U1ye.js → Title-_2JVV1rW.js} +142 -139
- package/dist/{Transaction-fHFbemk-.js → Transaction-BHLb6hZN.js} +2 -2
- package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-yS5qh7za.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-DolBmHzN.js} +6 -6
- package/dist/{Voucher-CraCvVuq.js → Voucher-CJk8ZuCA.js} +14 -14
- package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-DqKT6Fep.js → VoucherEditor.vue_vue_type_script_setup_true_lang-BviU3rz6.js} +86 -86
- package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-B14K5zel.js → ZodTextField.vue_vue_type_script_setup_true_lang-R4Xcn7gl.js} +1 -1
- package/dist/app-BpcIC6Ud.js +57962 -0
- package/dist/{app-B8hYhD6p.js → app-D9ygZVP0.js} +678 -597
- package/dist/app.js +1 -1
- package/dist/{business-CwtLYoAT.js → business-CzJxdKc-.js} +11 -8
- package/dist/{campaign-BwM5SLyy.js → campaign-RKjwSpJk.js} +29 -16
- package/dist/{campaign-Bea47E3G.js → campaign-s_7F9I6R.js} +29 -25
- package/dist/{campaign.enum-v4z9v1aa.js → campaign.enum-BlGYJ6p4.js} +3 -2
- package/dist/{campaign.fn-CV5s8XUt.js → campaign.fn-aH0pz1jU.js} +95 -95
- package/dist/{collectible.enum-BGt9xa0D.js → collectible.enum-DYV8J5Mg.js} +1 -1
- package/dist/{collection.fn-DFzVxsA9.js → collection.fn-lLG_rLyd.js} +2 -2
- package/dist/dto-Cx-z2h2_.js +222 -0
- package/dist/{effect-DQtWLIrF.js → effect-DV2GiHqM.js} +1 -1
- package/dist/{email-addresses-I8wDL9bh.js → email-addresses-DTfbKDsC.js} +1 -1
- package/dist/{export-BauRZnqp.js → export-hHjutAC3.js} +4 -4
- package/dist/{helper-B2Q1CLCG.js → helper-oy_DH4P5.js} +1 -1
- package/dist/{index-CCJqmSob.js → index-8t9y1bUZ.js} +1 -1
- package/dist/{index-B20y17xe.js → index-B1C5UjP5.js} +3 -3
- package/dist/{index-DQpw4Va-.js → index-B79nkieV.js} +1452 -1452
- package/dist/{index-DGuR3NRj.js → index-BA6oC2L9.js} +3 -3
- package/dist/{index-BdizAaMz.js → index-Ba05Naif.js} +16 -16
- package/dist/{index-B1Bdn9rV.js → index-BoRTW-dI.js} +196 -16
- package/dist/{index-CgYAHnlX.js → index-CUGS4y58.js} +861 -714
- package/dist/{index-IXY9hkrD.js → index-CV_3mltA.js} +1 -1
- package/dist/{index-DtfWwcp4.js → index-ClgsfK3Y.js} +1 -1
- package/dist/{index-dK8fMQ5h.js → index-CtxtD8HE.js} +1 -1
- package/dist/{index-aguYFa7D.js → index-CycW9ri6.js} +6347 -6305
- package/dist/{index-s1IB44jY.js → index-D8JDdV2w.js} +1 -1
- package/dist/{index-Bv3aqvRF.js → index-DJlZYwDo.js} +11 -4
- package/dist/{index-yOFbPJEE.js → index-sSxaqeIi.js} +1 -1
- package/dist/{index.esm2017-VwpfHNpU.js → index.esm2017-B3-oEraK.js} +34 -34
- package/dist/{loading-BFKvxqlx.js → loading-D98ofaCB.js} +1 -1
- package/dist/{membership-Cgzqg1Vw.js → membership-CwbI7ZrE.js} +3 -3
- package/dist/{moment-BWErdI6_.js → moment-D7p2TMB-.js} +6 -1
- package/dist/{money-DIh7Uegf.js → money-D5cHxcPB.js} +1 -1
- package/dist/{number-onslf0BL.js → number-CPEEKMZZ.js} +1 -1
- package/dist/objectid-Be_atBnH.js +145 -0
- package/dist/{plugins-hfoXoiK2.js → plugins-B55BRo5q.js} +2 -2
- package/dist/{reward-CYC7hCgM.js → reward-xrTcTYjt.js} +1 -1
- package/dist/rule-builder-NTDBB2kj.js +93 -0
- package/dist/{rule-C_M3oFLI.js → rule-w89XmfIg.js} +4 -4
- package/dist/style.css +1 -1
- package/dist/{template-C6URy7QF.js → template-Bt_auQZW.js} +5 -5
- package/dist/timezone-BcBn2Kb_.js +1151 -0
- package/dist/{trigger-CZAiHFT5.js → trigger-D_6mNiva.js} +4 -4
- package/dist/usePagination-Ds-cuHop.js +223 -0
- package/dist/{user-uo2wREaB.js → user-B6YOJ_7r.js} +1 -1
- package/dist/{vue-i18n-Ba5EWUgR.js → vue-i18n-QvFKKqSt.js} +418 -418
- package/dist/{xlsx-CIJPKm4G.js → xlsx-Dr9Ctrs4.js} +1 -1
- package/package.json +6 -5
- package/dist/Broadcast-BYL3w06w.js +0 -227
- package/dist/Credit-BMeykOe-.js +0 -222
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-D6Ps8njr.js +0 -2185
- package/dist/Experience-Lu8sCso6.js +0 -223
- package/dist/FilterChip.vue_vue_type_script_setup_true_lang-d8rh38tD.js +0 -114
- package/dist/Point-BZ2Bgfw8.js +0 -226
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-GSqXPvRs.js +0 -1728
- package/dist/app-BVCw28s0.js +0 -33357
- package/dist/dto-BgJqr4qT.js +0 -214
- package/dist/objectid-vtlpVGBH.js +0 -145
- package/dist/remy-vue-client-Cpppk9h-.js +0 -1693
- package/dist/rule-builder-BOG14MYK.js +0 -89
- package/dist/usePagination-BeF5K3M7.js +0 -223
|
@@ -1,2185 +0,0 @@
|
|
|
1
|
-
import { defineComponent, ref, watch, resolveComponent, openBlock, createElementBlock, createVNode, unref, isRef, withCtx, createBlock, createCommentVNode, computed, createElementVNode, Fragment, renderList, normalizeClass, toDisplayString, toRefs, normalizeStyle, resolveDynamicComponent, createSlots } from "vue";
|
|
2
|
-
import { _ } from "./lodash-B5I3zXaY.js";
|
|
3
|
-
import { z } from "./app-B8hYhD6p.js";
|
|
4
|
-
import { Z as ZodHelper } from "./zod-Bg2FbC-D.js";
|
|
5
|
-
import { c as getCampaignSummaryObject, C as CampaignOptions } from "./campaign-BwM5SLyy.js";
|
|
6
|
-
import { c as campaignRefinement, C as CampaignDtos, a as campaignTransform } from "./dto-BgJqr4qT.js";
|
|
7
|
-
import { u as useMembershipStore } from "./membership-Cgzqg1Vw.js";
|
|
8
|
-
import { u as useBusinessStore } from "./business-CwtLYoAT.js";
|
|
9
|
-
import "./index-BdizAaMz.js";
|
|
10
|
-
import { R as RuleBuilder, a as isRuleEntry } from "./rule-builder-BOG14MYK.js";
|
|
11
|
-
import { J as JsonViewer } from "./JsonViewer-v8_C7l5N.js";
|
|
12
|
-
import { h as hooks } from "./moment-BWErdI6_.js";
|
|
13
|
-
import { f as featureVersionMapping } from "./campaign.enum-v4z9v1aa.js";
|
|
14
|
-
import { _ as _sfc_main$o } from "./ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js";
|
|
15
|
-
import { b as _sfc_main$m, a as _sfc_main$p, _ as _sfc_main$r } from "./EffectSheet.vue_vue_type_style_index_0_lang-C4zzEOCb.js";
|
|
16
|
-
import { _ as _sfc_main$q } from "./TargetLocationInput.vue_vue_type_script_setup_true_lang-92NnMkro.js";
|
|
17
|
-
import { _ as _sfc_main$t } from "./UserRuleGroup.vue_vue_type_script_setup_true_lang-yS5qh7za.js";
|
|
18
|
-
import { _ as _sfc_main$j, a as _sfc_main$k } from "./RuleGroup.vue_vue_type_script_setup_true_lang-GSqXPvRs.js";
|
|
19
|
-
import { p as prompt, c as cases, f as firebaseStorage } from "./plugins-hfoXoiK2.js";
|
|
20
|
-
import { u as useI18n } from "./vue-i18n-Ba5EWUgR.js";
|
|
21
|
-
import { T as TypeToTriggerOptions, _ as _sfc_main$u, b as _sfc_main$v } from "./trigger-CZAiHFT5.js";
|
|
22
|
-
import { _ as _sfc_main$s } from "./MessageInput.vue_vue_type_script_setup_true_lang-BcGhTM5H.js";
|
|
23
|
-
import { c as calculateNextScheduleAt, S as SummarizeRrule, R as RRule } from "./rule-C_M3oFLI.js";
|
|
24
|
-
import { _ as _sfc_main$l, a as _sfc_main$n } from "./VoucherEditor.vue_vue_type_script_setup_true_lang-DqKT6Fep.js";
|
|
25
|
-
import { T as TEMPLATES } from "./index-B1Bdn9rV.js";
|
|
26
|
-
import { t as FdoCreditLoyaltyReward, u as FdtoRandomReward, v as F_MISSION_TYPE, w as FdoThresholdCreditReward, x as FdtoThresholdReward, y as FdoMission } from "./index-CgYAHnlX.js";
|
|
27
|
-
import "./index-IXY9hkrD.js";
|
|
28
|
-
import "./index-DGuR3NRj.js";
|
|
29
|
-
import { a as F_GAME_TYPE } from "./collectible.enum-BGt9xa0D.js";
|
|
30
|
-
import { useCoreStore } from "@feedmepos/mf-common";
|
|
31
|
-
import { u as useLoading } from "./loading-BFKvxqlx.js";
|
|
32
|
-
import { i as initCollectibleConfig } from "./helper-B2Q1CLCG.js";
|
|
33
|
-
import { C as CollectionUtils } from "./collection.fn-DFzVxsA9.js";
|
|
34
|
-
import { s as sentenceCase$1 } from "./index-CsaQJMAR.js";
|
|
35
|
-
import "./index-DQpw4Va-.js";
|
|
36
|
-
import { useDialog } from "@feedmepos/ui-library";
|
|
37
|
-
import { u as useCampaignStore } from "./campaign-Bea47E3G.js";
|
|
38
|
-
import { S as SvcConfig } from "./index-aguYFa7D.js";
|
|
39
|
-
import { a as cleanPF } from "./object-qECH92oz.js";
|
|
40
|
-
const _hoisted_1$g = { class: "space-y-24" }, _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
41
|
-
__name: "TimeRuleGroup",
|
|
42
|
-
props: {
|
|
43
|
-
modelValue: {
|
|
44
|
-
type: Object,
|
|
45
|
-
default: () => {
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
emits: ["update:model-value"],
|
|
50
|
-
setup(e, { emit: d }) {
|
|
51
|
-
const { t: a } = useI18n(), s = e, u = d, i = ref(
|
|
52
|
-
!s.modelValue || !s.modelValue.rules.g_time ? "all_time" : RuleBuilder.getRules(s.modelValue.rules.g_time).length > 0 ? "custom" : "all_time"
|
|
53
|
-
);
|
|
54
|
-
watch(i, async (l, n) => {
|
|
55
|
-
var m;
|
|
56
|
-
if (n == "custom" && l == "all_time" && RuleBuilder.getRules((m = s.modelValue) == null ? void 0 : m.rules.g_time).length > 0) {
|
|
57
|
-
const g = await prompt.confirm(
|
|
58
|
-
a("connect.template.rule.time.confirm_remove"),
|
|
59
|
-
a("connect.common.confirm"),
|
|
60
|
-
a("connect.common.confirm"),
|
|
61
|
-
a("connect.common.cancel")
|
|
62
|
-
);
|
|
63
|
-
g && u(
|
|
64
|
-
"update:model-value",
|
|
65
|
-
RuleBuilder.setRuleToGroup(
|
|
66
|
-
s.modelValue ?? RuleBuilder.scaffoldGroup(),
|
|
67
|
-
RuleBuilder.scaffoldGroup("g_time")
|
|
68
|
-
)
|
|
69
|
-
), i.value = g ? l : n;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
async function o(l) {
|
|
73
|
-
var n;
|
|
74
|
-
if (l == "custom" && RuleBuilder.getRules((n = s.modelValue) == null ? void 0 : n.rules.g_time).length > 0) {
|
|
75
|
-
if (!await prompt.confirm(
|
|
76
|
-
a("connect.template.rule.time.confirm_remove"),
|
|
77
|
-
a("connect.common.confirm"),
|
|
78
|
-
a("connect.common.confirm"),
|
|
79
|
-
a("connect.common.cancel")
|
|
80
|
-
)) {
|
|
81
|
-
i.value = "all_time";
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
u(
|
|
85
|
-
"update:model-value",
|
|
86
|
-
RuleBuilder.setRuleToGroup(
|
|
87
|
-
s.modelValue ?? RuleBuilder.scaffoldGroup(),
|
|
88
|
-
RuleBuilder.scaffoldGroup("g_time")
|
|
89
|
-
)
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return (l, n) => {
|
|
94
|
-
var y;
|
|
95
|
-
const m = resolveComponent("FmRadio"), g = resolveComponent("FmRadioGroup");
|
|
96
|
-
return openBlock(), createElementBlock("div", _hoisted_1$g, [
|
|
97
|
-
createVNode(g, {
|
|
98
|
-
modelValue: unref(i),
|
|
99
|
-
"onUpdate:modelValue": [
|
|
100
|
-
n[0] || (n[0] = (v) => isRef(i) ? i.value = v : null),
|
|
101
|
-
n[1] || (n[1] = (v) => o(v))
|
|
102
|
-
]
|
|
103
|
-
}, {
|
|
104
|
-
default: withCtx(() => [
|
|
105
|
-
createVNode(m, {
|
|
106
|
-
label: unref(a)("connect.template.rule.time.all_time"),
|
|
107
|
-
value: "all_time"
|
|
108
|
-
}, null, 8, ["label"]),
|
|
109
|
-
createVNode(m, {
|
|
110
|
-
label: unref(a)("connect.template.rule.time.custom"),
|
|
111
|
-
value: "custom"
|
|
112
|
-
}, null, 8, ["label"])
|
|
113
|
-
]),
|
|
114
|
-
_: 1
|
|
115
|
-
}, 8, ["modelValue"]),
|
|
116
|
-
unref(i) == "custom" ? (openBlock(), createBlock(_sfc_main$j, {
|
|
117
|
-
key: 0,
|
|
118
|
-
class: "!mt-[0px]",
|
|
119
|
-
"include-only": "trigger",
|
|
120
|
-
"trigger-type": "SCHEDULE",
|
|
121
|
-
"model-value": ((y = e.modelValue) == null ? void 0 : y.rules.g_time) ?? unref(RuleBuilder).scaffoldGroup("g_time"),
|
|
122
|
-
"onUpdate:modelValue": n[2] || (n[2] = (v) => u(
|
|
123
|
-
"update:model-value",
|
|
124
|
-
unref(RuleBuilder).setRuleToGroup(
|
|
125
|
-
e.modelValue ?? unref(RuleBuilder).scaffoldGroup(),
|
|
126
|
-
v,
|
|
127
|
-
"&&"
|
|
128
|
-
)
|
|
129
|
-
))
|
|
130
|
-
}, null, 8, ["model-value"])) : createCommentVNode("", !0)
|
|
131
|
-
]);
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
}), _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
135
|
-
__name: "BirthdayInput",
|
|
136
|
-
props: {
|
|
137
|
-
modelValue: {
|
|
138
|
-
type: Object
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
emits: ["update:model-value"],
|
|
142
|
-
setup(e, { emit: d }) {
|
|
143
|
-
const a = e, s = d, u = computed(() => {
|
|
144
|
-
const { property: i, operator: o, equator: l } = RuleBuilder.simplify(
|
|
145
|
-
a.modelValue ?? RuleBuilder.constructEntry("user.birthday", "_isDay", {
|
|
146
|
-
op: "before",
|
|
147
|
-
x: 1
|
|
148
|
-
})
|
|
149
|
-
);
|
|
150
|
-
return {
|
|
151
|
-
property: i,
|
|
152
|
-
operator: o,
|
|
153
|
-
equator: l
|
|
154
|
-
};
|
|
155
|
-
});
|
|
156
|
-
return (i, o) => {
|
|
157
|
-
const l = resolveComponent("FmRadio"), n = resolveComponent("FmStepperField");
|
|
158
|
-
return openBlock(), createElementBlock("div", null, [
|
|
159
|
-
createVNode(l, {
|
|
160
|
-
label: "On birthday",
|
|
161
|
-
value: "_isRange-day",
|
|
162
|
-
"model-value": `${unref(u).operator}-${unref(u).equator.unit}`,
|
|
163
|
-
"onUpdate:modelValue": o[0] || (o[0] = () => {
|
|
164
|
-
s(
|
|
165
|
-
"update:model-value",
|
|
166
|
-
unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
|
|
167
|
-
op: "this",
|
|
168
|
-
unit: "day",
|
|
169
|
-
ignoreYear: !0
|
|
170
|
-
})
|
|
171
|
-
);
|
|
172
|
-
})
|
|
173
|
-
}, null, 8, ["model-value"]),
|
|
174
|
-
createVNode(l, {
|
|
175
|
-
label: "N days before birthday",
|
|
176
|
-
value: "_isDay",
|
|
177
|
-
"model-value": unref(u).operator,
|
|
178
|
-
"onUpdate:modelValue": o[1] || (o[1] = () => {
|
|
179
|
-
s(
|
|
180
|
-
"update:model-value",
|
|
181
|
-
unref(RuleBuilder).constructEntry("user.birthday", "_isDay", {
|
|
182
|
-
op: "after",
|
|
183
|
-
x: 1,
|
|
184
|
-
ignoreYear: !0
|
|
185
|
-
})
|
|
186
|
-
);
|
|
187
|
-
})
|
|
188
|
-
}, null, 8, ["model-value"]),
|
|
189
|
-
unref(u).operator == "_isDay" ? (openBlock(), createBlock(n, {
|
|
190
|
-
key: 0,
|
|
191
|
-
label: "Days before birthday",
|
|
192
|
-
"show-steppers": !1,
|
|
193
|
-
"model-value": unref(u).equator.x,
|
|
194
|
-
"onUpdate:modelValue": o[2] || (o[2] = (m) => s(
|
|
195
|
-
"update:model-value",
|
|
196
|
-
unref(RuleBuilder).constructEntry("user.birthday", "_isDay", {
|
|
197
|
-
op: "after",
|
|
198
|
-
x: m,
|
|
199
|
-
ignoreYear: !0
|
|
200
|
-
})
|
|
201
|
-
))
|
|
202
|
-
}, null, 8, ["model-value"])) : createCommentVNode("", !0),
|
|
203
|
-
createVNode(l, {
|
|
204
|
-
label: "In birthday week",
|
|
205
|
-
value: "_isRange-week",
|
|
206
|
-
"model-value": `${unref(u).operator}-${unref(u).equator.unit}`,
|
|
207
|
-
"onUpdate:modelValue": o[3] || (o[3] = () => {
|
|
208
|
-
s(
|
|
209
|
-
"update:model-value",
|
|
210
|
-
unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
|
|
211
|
-
op: "this",
|
|
212
|
-
unit: "week",
|
|
213
|
-
ignoreYear: !0
|
|
214
|
-
})
|
|
215
|
-
);
|
|
216
|
-
})
|
|
217
|
-
}, null, 8, ["model-value"]),
|
|
218
|
-
createVNode(l, {
|
|
219
|
-
label: "In birthday month",
|
|
220
|
-
value: "_isRange-month",
|
|
221
|
-
"model-value": `${unref(u).operator}-${unref(u).equator.unit}`,
|
|
222
|
-
"onUpdate:modelValue": o[4] || (o[4] = () => {
|
|
223
|
-
s(
|
|
224
|
-
"update:model-value",
|
|
225
|
-
unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
|
|
226
|
-
op: "this",
|
|
227
|
-
unit: "month",
|
|
228
|
-
ignoreYear: !0
|
|
229
|
-
})
|
|
230
|
-
);
|
|
231
|
-
})
|
|
232
|
-
}, null, 8, ["model-value"])
|
|
233
|
-
]);
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
}), _hoisted_1$f = { class: "space-y-16" }, _hoisted_2$c = { class: "grid grid-cols-3 gap-16" }, _hoisted_3$a = { class: "fm-typo-en-title-sm-800" }, _hoisted_4$7 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
237
|
-
__name: "CampaignTriggerInput",
|
|
238
|
-
props: {
|
|
239
|
-
campaignType: {
|
|
240
|
-
type: String,
|
|
241
|
-
required: !0
|
|
242
|
-
},
|
|
243
|
-
modelValue: {
|
|
244
|
-
type: String
|
|
245
|
-
},
|
|
246
|
-
disabled: {
|
|
247
|
-
type: Boolean,
|
|
248
|
-
default: !1
|
|
249
|
-
}
|
|
250
|
-
},
|
|
251
|
-
emits: ["update:model-value"],
|
|
252
|
-
setup(e, { emit: d }) {
|
|
253
|
-
const a = e, s = d, u = computed(() => a.disabled ? TypeToTriggerOptions[a.campaignType].filter(
|
|
254
|
-
(i) => i.value == a.modelValue
|
|
255
|
-
) : TypeToTriggerOptions[a.campaignType]);
|
|
256
|
-
return (i, o) => {
|
|
257
|
-
const l = resolveComponent("FmCard");
|
|
258
|
-
return openBlock(), createElementBlock("div", _hoisted_1$f, [
|
|
259
|
-
o[0] || (o[0] = 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)),
|
|
260
|
-
createElementVNode("div", _hoisted_2$c, [
|
|
261
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (n) => (openBlock(), createBlock(l, {
|
|
262
|
-
variant: "outlined",
|
|
263
|
-
disabled: a.disabled,
|
|
264
|
-
class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
|
|
265
|
-
"col-span-3": unref(u).length == 1,
|
|
266
|
-
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == n.value,
|
|
267
|
-
"hover:bg-fm-color-opacity-sm": e.modelValue != n.value
|
|
268
|
-
}]),
|
|
269
|
-
onClick: () => {
|
|
270
|
-
a.modelValue != n.value && !a.disabled && s("update:model-value", n.value);
|
|
271
|
-
},
|
|
272
|
-
key: n.name
|
|
273
|
-
}, {
|
|
274
|
-
default: withCtx(() => [
|
|
275
|
-
createElementVNode("div", _hoisted_3$a, toDisplayString(n.name), 1),
|
|
276
|
-
createElementVNode("div", _hoisted_4$7, toDisplayString(n.description), 1)
|
|
277
|
-
]),
|
|
278
|
-
_: 2
|
|
279
|
-
}, 1032, ["disabled", "class", "onClick"]))), 128))
|
|
280
|
-
])
|
|
281
|
-
]);
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
}), _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
285
|
-
__name: "DateInput",
|
|
286
|
-
props: {
|
|
287
|
-
label: {
|
|
288
|
-
type: String,
|
|
289
|
-
required: !1
|
|
290
|
-
},
|
|
291
|
-
modelValue: {
|
|
292
|
-
type: Object,
|
|
293
|
-
required: !1
|
|
294
|
-
}
|
|
295
|
-
},
|
|
296
|
-
emits: ["update:model-value"],
|
|
297
|
-
setup(e, { emit: d }) {
|
|
298
|
-
const a = d;
|
|
299
|
-
return (s, u) => {
|
|
300
|
-
const i = resolveComponent("FmButton"), o = resolveComponent("FmField"), l = resolveComponent("FmDatePicker");
|
|
301
|
-
return openBlock(), createBlock(l, {
|
|
302
|
-
label: e.label,
|
|
303
|
-
"model-value": e.modelValue || "",
|
|
304
|
-
"onUpdate:modelValue": u[1] || (u[1] = (n) => a("update:model-value", n))
|
|
305
|
-
}, {
|
|
306
|
-
"trigger-button": withCtx(({ opened: n }) => [
|
|
307
|
-
createVNode(o, {
|
|
308
|
-
class: "flex items-center",
|
|
309
|
-
"prepend-icon": "calendar_month",
|
|
310
|
-
"icon-outlined": !n
|
|
311
|
-
}, {
|
|
312
|
-
append: withCtx(() => [
|
|
313
|
-
e.modelValue ? (openBlock(), createBlock(i, {
|
|
314
|
-
key: 0,
|
|
315
|
-
variant: "tertiary",
|
|
316
|
-
icon: "clear",
|
|
317
|
-
onClick: u[0] || (u[0] = (m) => (m.stopPropagation(), a("update:model-value", null)))
|
|
318
|
-
})) : createCommentVNode("", !0)
|
|
319
|
-
]),
|
|
320
|
-
default: withCtx(() => [
|
|
321
|
-
createElementVNode("div", {
|
|
322
|
-
class: normalizeClass(["fm-typo-en-body-lg-400", { "text-fm-color-typo-secondary": !e.modelValue }])
|
|
323
|
-
}, toDisplayString(e.modelValue ? unref(hooks)(e.modelValue).format("DD MMM YYYY") : "DD MM YYYY"), 3)
|
|
324
|
-
]),
|
|
325
|
-
_: 2
|
|
326
|
-
}, 1032, ["icon-outlined"])
|
|
327
|
-
]),
|
|
328
|
-
_: 1
|
|
329
|
-
}, 8, ["label", "model-value"]);
|
|
330
|
-
};
|
|
331
|
-
}
|
|
332
|
-
}), _hoisted_1$e = { class: "flex items-center gap-8 w-full xs:flex-col" }, _hoisted_2$b = { class: "flex-1 xs:w-full" }, _hoisted_3$9 = { class: "flex-1 xs:w-full" }, _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
333
|
-
__name: "DateRangeInput",
|
|
334
|
-
props: {
|
|
335
|
-
modelValue: {
|
|
336
|
-
type: Object,
|
|
337
|
-
required: !1
|
|
338
|
-
}
|
|
339
|
-
},
|
|
340
|
-
emits: ["update:model-value"],
|
|
341
|
-
setup(e, { emit: d }) {
|
|
342
|
-
const a = d;
|
|
343
|
-
return (s, u) => {
|
|
344
|
-
var i, o;
|
|
345
|
-
return openBlock(), createElementBlock("div", _hoisted_1$e, [
|
|
346
|
-
createElementVNode("div", _hoisted_2$b, [
|
|
347
|
-
createVNode(_sfc_main$f, {
|
|
348
|
-
"model-value": ((i = e.modelValue) == null ? void 0 : i.startDate) ?? null,
|
|
349
|
-
label: "Start date",
|
|
350
|
-
"onUpdate:modelValue": u[0] || (u[0] = (l) => {
|
|
351
|
-
var n;
|
|
352
|
-
return a("update:model-value", {
|
|
353
|
-
startDate: l,
|
|
354
|
-
endDate: ((n = e.modelValue) == null ? void 0 : n.endDate) ?? null
|
|
355
|
-
});
|
|
356
|
-
})
|
|
357
|
-
}, null, 8, ["model-value"])
|
|
358
|
-
]),
|
|
359
|
-
u[2] || (u[2] = createElementVNode("div", { class: "mt-5 xs:hidden" }, "to", -1)),
|
|
360
|
-
createElementVNode("div", _hoisted_3$9, [
|
|
361
|
-
createVNode(_sfc_main$f, {
|
|
362
|
-
"model-value": ((o = e.modelValue) == null ? void 0 : o.endDate) ?? null,
|
|
363
|
-
label: "End date",
|
|
364
|
-
"onUpdate:modelValue": u[1] || (u[1] = (l) => {
|
|
365
|
-
var n;
|
|
366
|
-
return a("update:model-value", {
|
|
367
|
-
startDate: ((n = e.modelValue) == null ? void 0 : n.startDate) ?? null,
|
|
368
|
-
endDate: l
|
|
369
|
-
});
|
|
370
|
-
})
|
|
371
|
-
}, null, 8, ["model-value"])
|
|
372
|
-
])
|
|
373
|
-
]);
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
}), _hoisted_1$d = { class: "space-y-8" }, _hoisted_2$a = { class: "grid grid-cols-2 gap-16" }, _hoisted_3$8 = {
|
|
377
|
-
key: 0,
|
|
378
|
-
class: "space-y-4"
|
|
379
|
-
}, _hoisted_4$6 = { class: "fm-typo-en-body-lg-400 class flex items-center justify-between" }, _hoisted_5$3 = { class: "text-ellipsis line-clamp-1" }, _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
380
|
-
__name: "ScheduleRuleInput",
|
|
381
|
-
props: {
|
|
382
|
-
modelValue: {
|
|
383
|
-
type: Object,
|
|
384
|
-
required: !0
|
|
385
|
-
},
|
|
386
|
-
startDate: {
|
|
387
|
-
type: String
|
|
388
|
-
},
|
|
389
|
-
endDate: {
|
|
390
|
-
type: String
|
|
391
|
-
}
|
|
392
|
-
},
|
|
393
|
-
emits: ["update:model-value"],
|
|
394
|
-
setup(e, { emit: d }) {
|
|
395
|
-
const a = e, s = d;
|
|
396
|
-
function u() {
|
|
397
|
-
const y = RuleBuilder.getRules(a.modelValue);
|
|
398
|
-
return y.length == 0 ? "fixed" : y.some(
|
|
399
|
-
(v) => isRuleEntry(v) && RuleBuilder.simplify(v).operator == "_rrule"
|
|
400
|
-
) ? "repeating" : "fixed";
|
|
401
|
-
}
|
|
402
|
-
const i = ref(u()), o = ref(!1), l = computed(() => {
|
|
403
|
-
const y = RuleBuilder.getRules(a.modelValue), v = y.find(
|
|
404
|
-
(f) => isRuleEntry(f) && RuleBuilder.simplify(f).property == "trigger.date"
|
|
405
|
-
), h = y.find(
|
|
406
|
-
(f) => isRuleEntry(f) && RuleBuilder.simplify(f).property == "trigger.time"
|
|
407
|
-
);
|
|
408
|
-
return {
|
|
409
|
-
date: v ? RuleBuilder.simplify(v).equator : null,
|
|
410
|
-
time: h ? RuleBuilder.simplify(h).equator : null
|
|
411
|
-
};
|
|
412
|
-
}), n = computed(
|
|
413
|
-
() => calculateNextScheduleAt(
|
|
414
|
-
a.modelValue,
|
|
415
|
-
/* @__PURE__ */ new Date(),
|
|
416
|
-
a.startDate ? new Date(a.startDate) : void 0,
|
|
417
|
-
a.endDate ? new Date(a.endDate) : void 0
|
|
418
|
-
)
|
|
419
|
-
);
|
|
420
|
-
function m(y) {
|
|
421
|
-
const v = y.label.toLowerCase(), h = v == "fixed" ? [
|
|
422
|
-
RuleBuilder.constructEntry(
|
|
423
|
-
"trigger.date",
|
|
424
|
-
"_isOnDate",
|
|
425
|
-
(/* @__PURE__ */ new Date()).toISOString()
|
|
426
|
-
),
|
|
427
|
-
RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
|
|
428
|
-
] : [
|
|
429
|
-
RuleBuilder.constructEntry(
|
|
430
|
-
"trigger.date",
|
|
431
|
-
"_rrule",
|
|
432
|
-
"RRULE:FREQ=DAILY;INTERVAL=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0;WKST=SU"
|
|
433
|
-
),
|
|
434
|
-
RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
|
|
435
|
-
];
|
|
436
|
-
s(
|
|
437
|
-
"update:model-value",
|
|
438
|
-
RuleBuilder.setRuleToGroup(
|
|
439
|
-
RuleBuilder.scaffoldGroup("g_schedule"),
|
|
440
|
-
h
|
|
441
|
-
)
|
|
442
|
-
), i.value = v;
|
|
443
|
-
}
|
|
444
|
-
function g(y) {
|
|
445
|
-
i.value == "fixed" ? s(
|
|
446
|
-
"update:model-value",
|
|
447
|
-
RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup("g_schedule"), [
|
|
448
|
-
RuleBuilder.constructEntry(
|
|
449
|
-
"trigger.date",
|
|
450
|
-
"_isOnDate",
|
|
451
|
-
y.date
|
|
452
|
-
),
|
|
453
|
-
RuleBuilder.constructEntry(
|
|
454
|
-
"trigger.time",
|
|
455
|
-
"_isOnTime",
|
|
456
|
-
y.time
|
|
457
|
-
)
|
|
458
|
-
])
|
|
459
|
-
) : s(
|
|
460
|
-
"update:model-value",
|
|
461
|
-
RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup("g_schedule"), [
|
|
462
|
-
RuleBuilder.constructEntry(
|
|
463
|
-
"trigger.date",
|
|
464
|
-
"_rrule",
|
|
465
|
-
y.date
|
|
466
|
-
),
|
|
467
|
-
RuleBuilder.constructEntry(
|
|
468
|
-
"trigger.time",
|
|
469
|
-
"_isOnTime",
|
|
470
|
-
y.time
|
|
471
|
-
)
|
|
472
|
-
])
|
|
473
|
-
);
|
|
474
|
-
}
|
|
475
|
-
return (y, v) => {
|
|
476
|
-
const h = resolveComponent("FmButtonGroup"), f = resolveComponent("FmTimePicker"), r = resolveComponent("FmIcon"), c = resolveComponent("FmTooltip"), p = resolveComponent("FmField"), b = resolveComponent("FmCard"), x = resolveComponent("FmPopover"), k = resolveComponent("FmDatePicker"), C = resolveComponent("FmHelperText");
|
|
477
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
478
|
-
createVNode(h, {
|
|
479
|
-
items: [{ label: "Fixed" }, { label: "Repeating" }],
|
|
480
|
-
"model-value": { label: unref(cases).title(unref(i)) },
|
|
481
|
-
"onUpdate:modelValue": m,
|
|
482
|
-
class: "mb-8"
|
|
483
|
-
}, null, 8, ["model-value"]),
|
|
484
|
-
createElementVNode("div", _hoisted_1$d, [
|
|
485
|
-
createElementVNode("div", _hoisted_2$a, [
|
|
486
|
-
createVNode(f, {
|
|
487
|
-
label: "Notify time",
|
|
488
|
-
"model-value": unref(l).time,
|
|
489
|
-
"onUpdate:modelValue": v[0] || (v[0] = (B) => g({ date: unref(l).date, time: B })),
|
|
490
|
-
"helper-text": unref(l).time ? void 0 : "Time is required",
|
|
491
|
-
"helper-state": unref(l).time ? void 0 : "error"
|
|
492
|
-
}, null, 8, ["model-value", "helper-text", "helper-state"]),
|
|
493
|
-
unref(i) == "repeating" ? (openBlock(), createElementBlock("div", _hoisted_3$8, [
|
|
494
|
-
createElementVNode("div", _hoisted_4$6, [
|
|
495
|
-
v[5] || (v[5] = createElementVNode("div", null, "Notify date", -1)),
|
|
496
|
-
unref(l).date ? (openBlock(), createBlock(c, {
|
|
497
|
-
key: 0,
|
|
498
|
-
"z-index": 9999,
|
|
499
|
-
content: unref(SummarizeRrule)(unref(RRule).fromString(unref(l).date).options)
|
|
500
|
-
}, {
|
|
501
|
-
default: withCtx(() => [
|
|
502
|
-
createVNode(r, {
|
|
503
|
-
name: "info",
|
|
504
|
-
size: "sm",
|
|
505
|
-
outline: !0
|
|
506
|
-
})
|
|
507
|
-
]),
|
|
508
|
-
_: 1
|
|
509
|
-
}, 8, ["content"])) : createCommentVNode("", !0)
|
|
510
|
-
]),
|
|
511
|
-
createVNode(x, {
|
|
512
|
-
"show-popover": unref(o),
|
|
513
|
-
onPopoverChanged: v[3] || (v[3] = (B) => o.value = B)
|
|
514
|
-
}, {
|
|
515
|
-
"popover-button": withCtx(() => [
|
|
516
|
-
createVNode(p, {
|
|
517
|
-
class: "cursor-pointer",
|
|
518
|
-
"helper-text": unref(l).date ? void 0 : "Date is required",
|
|
519
|
-
"helper-state": unref(l).date ? void 0 : "error"
|
|
520
|
-
}, {
|
|
521
|
-
default: withCtx(() => [
|
|
522
|
-
createElementVNode("div", _hoisted_5$3, toDisplayString(unref(l).date ? unref(SummarizeRrule)(unref(RRule).fromString(unref(l).date).options) : "Set a repeating date"), 1)
|
|
523
|
-
]),
|
|
524
|
-
_: 1
|
|
525
|
-
}, 8, ["helper-text", "helper-state"])
|
|
526
|
-
]),
|
|
527
|
-
default: withCtx(() => [
|
|
528
|
-
createVNode(b, { class: "elevated p-8 w-[450px]" }, {
|
|
529
|
-
default: withCtx(() => [
|
|
530
|
-
createVNode(_sfc_main$k, {
|
|
531
|
-
"apply-button": !0,
|
|
532
|
-
"model-value": unref(l).date || "",
|
|
533
|
-
onCancel: v[1] || (v[1] = (B) => o.value = !1),
|
|
534
|
-
"onUpdate:modelValue": v[2] || (v[2] = (B) => (g({ date: B, time: unref(l).time }), o.value = !1))
|
|
535
|
-
}, null, 8, ["model-value"])
|
|
536
|
-
]),
|
|
537
|
-
_: 1
|
|
538
|
-
})
|
|
539
|
-
]),
|
|
540
|
-
_: 1
|
|
541
|
-
}, 8, ["show-popover"])
|
|
542
|
-
])) : (openBlock(), createBlock(k, {
|
|
543
|
-
key: 1,
|
|
544
|
-
label: "Notify date",
|
|
545
|
-
"model-value": unref(l).date || "",
|
|
546
|
-
"onUpdate:modelValue": v[4] || (v[4] = (B) => g({ date: B, time: unref(l).time })),
|
|
547
|
-
"helper-text": unref(l).date ? void 0 : "Date is required",
|
|
548
|
-
"helper-state": unref(l).date ? void 0 : "error"
|
|
549
|
-
}, null, 8, ["model-value", "helper-text", "helper-state"]))
|
|
550
|
-
]),
|
|
551
|
-
unref(l).date && unref(l).time && unref(n) ? (openBlock(), createBlock(C, {
|
|
552
|
-
key: 0,
|
|
553
|
-
text: `${unref(hooks)(unref(n)).isAfter(unref(hooks)()) ? "The next notification will be sent on " : "Last trigger is on "} ${unref(hooks)(unref(n)).format("dddd, DD MMM YYYY")} at
|
|
554
|
-
${unref(hooks)(unref(n)).format("hh:mmA")} (${unref(hooks)(unref(n)).fromNow()})`
|
|
555
|
-
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
556
|
-
])
|
|
557
|
-
], 64);
|
|
558
|
-
};
|
|
559
|
-
}
|
|
560
|
-
}), _hoisted_1$c = { class: "space-y-16" }, _hoisted_2$9 = { class: "grid grid-cols-2 gap-16" }, _hoisted_3$7 = { class: "fm-typo-en-title-sm-800" }, _hoisted_4$5 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
561
|
-
__name: "GameTypeInput",
|
|
562
|
-
props: {
|
|
563
|
-
modelValue: {
|
|
564
|
-
type: String
|
|
565
|
-
}
|
|
566
|
-
},
|
|
567
|
-
emits: ["update:model-value"],
|
|
568
|
-
setup(e, { emit: d }) {
|
|
569
|
-
const a = e, s = d, u = computed(
|
|
570
|
-
() => [
|
|
571
|
-
{
|
|
572
|
-
label: "Fortune Wheel",
|
|
573
|
-
description: "Allow customers to spin the Fortune Wheel to win various rewards.",
|
|
574
|
-
value: F_GAME_TYPE.enum.FORTUNE_WHEEL,
|
|
575
|
-
hidden: !1
|
|
576
|
-
},
|
|
577
|
-
{
|
|
578
|
-
label: "Rock paper scissor",
|
|
579
|
-
description: "Customers play a game of Rock Paper Scissors against the cashier.",
|
|
580
|
-
value: F_GAME_TYPE.enum.ROCK_PAPER_SCISSORS,
|
|
581
|
-
hidden: !0
|
|
582
|
-
}
|
|
583
|
-
].filter((i) => !i.hidden)
|
|
584
|
-
);
|
|
585
|
-
return (i, o) => {
|
|
586
|
-
const l = resolveComponent("FmCard");
|
|
587
|
-
return openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
588
|
-
o[0] || (o[0] = 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)),
|
|
589
|
-
createElementVNode("div", _hoisted_2$9, [
|
|
590
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (n) => (openBlock(), createBlock(l, {
|
|
591
|
-
variant: "outlined",
|
|
592
|
-
class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
|
|
593
|
-
"col-span-2": unref(u).length == 1,
|
|
594
|
-
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == n.value,
|
|
595
|
-
"hover:bg-fm-color-opacity-sm": e.modelValue != n.value
|
|
596
|
-
}]),
|
|
597
|
-
onClick: () => {
|
|
598
|
-
a.modelValue != n.value && s("update:model-value", n.value);
|
|
599
|
-
},
|
|
600
|
-
key: n.value
|
|
601
|
-
}, {
|
|
602
|
-
default: withCtx(() => [
|
|
603
|
-
createElementVNode("div", _hoisted_3$7, toDisplayString(n.label), 1),
|
|
604
|
-
createElementVNode("div", _hoisted_4$5, toDisplayString(n.description), 1)
|
|
605
|
-
]),
|
|
606
|
-
_: 2
|
|
607
|
-
}, 1032, ["class", "onClick"]))), 128))
|
|
608
|
-
])
|
|
609
|
-
]);
|
|
610
|
-
};
|
|
611
|
-
}
|
|
612
|
-
}), _hoisted_1$b = {
|
|
613
|
-
key: 0,
|
|
614
|
-
class: "flex flex-col gap-y-24"
|
|
615
|
-
}, _hoisted_2$8 = { class: "flex gap-8 items-center justify-start" }, _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
616
|
-
__name: "EditRewardPoolSheet",
|
|
617
|
-
emits: ["update:model-value"],
|
|
618
|
-
setup(e, { expose: d, emit: a }) {
|
|
619
|
-
const s = useMembershipStore(), { minor: u } = useLoading, i = ref(!1), o = ref(), l = ref(), n = ref(0), m = computed(() => {
|
|
620
|
-
var r;
|
|
621
|
-
return ((r = s.loyaltyRewards.items.find(
|
|
622
|
-
(c) => {
|
|
623
|
-
var p;
|
|
624
|
-
return c.value === ((p = o.value) == null ? void 0 : p.collectible);
|
|
625
|
-
}
|
|
626
|
-
)) == null ? void 0 : r.raw.type) === "CREDIT" ? FdoCreditLoyaltyReward : FdtoRandomReward;
|
|
627
|
-
}), g = computed(() => {
|
|
628
|
-
const f = m.value.safeParse(o.value);
|
|
629
|
-
return f.success ? [] : f.error.errors;
|
|
630
|
-
});
|
|
631
|
-
function y(f, r, c) {
|
|
632
|
-
f && (o.value = r, n.value = c), i.value = f;
|
|
633
|
-
}
|
|
634
|
-
const v = a;
|
|
635
|
-
async function h() {
|
|
636
|
-
const f = m.value.safeParse(o.value);
|
|
637
|
-
f.success && (await u(
|
|
638
|
-
async () => {
|
|
639
|
-
f.data.type === "VOUCHER" && l.value && (f.data.collectibleConfig.image = await firebaseStorage.update(
|
|
640
|
-
f.data.collectibleConfig.image || firebaseStorage.collectibleImagePath(void 0, l.value),
|
|
641
|
-
l.value
|
|
642
|
-
));
|
|
643
|
-
},
|
|
644
|
-
{
|
|
645
|
-
message: "Uploading reward image",
|
|
646
|
-
successMessage: "Reward image updated"
|
|
647
|
-
}
|
|
648
|
-
), v("update:model-value", f.data, n.value));
|
|
649
|
-
}
|
|
650
|
-
return d({
|
|
651
|
-
showSheet: y
|
|
652
|
-
}), (f, r) => {
|
|
653
|
-
const c = resolveComponent("FmSelect"), p = resolveComponent("FmStepperField"), b = resolveComponent("FmButton"), x = resolveComponent("FmSideSheet");
|
|
654
|
-
return openBlock(), createBlock(x, {
|
|
655
|
-
"max-width": 560,
|
|
656
|
-
modelValue: unref(i),
|
|
657
|
-
"onUpdate:modelValue": [
|
|
658
|
-
r[9] || (r[9] = (k) => isRef(i) ? i.value = k : null),
|
|
659
|
-
r[10] || (r[10] = (k) => i.value = k)
|
|
660
|
-
],
|
|
661
|
-
header: "Edit reward",
|
|
662
|
-
"dismiss-away": ""
|
|
663
|
-
}, {
|
|
664
|
-
"side-sheet-footer": withCtx(() => [
|
|
665
|
-
createElementVNode("div", _hoisted_2$8, [
|
|
666
|
-
createVNode(b, {
|
|
667
|
-
variant: "primary",
|
|
668
|
-
type: "button",
|
|
669
|
-
disabled: unref(g).length > 0,
|
|
670
|
-
label: "Confirm",
|
|
671
|
-
onClick: r[7] || (r[7] = (k) => h())
|
|
672
|
-
}, null, 8, ["disabled"]),
|
|
673
|
-
createVNode(b, {
|
|
674
|
-
variant: "secondary",
|
|
675
|
-
type: "button",
|
|
676
|
-
label: "Cancel",
|
|
677
|
-
onClick: r[8] || (r[8] = (k) => i.value = !1)
|
|
678
|
-
})
|
|
679
|
-
])
|
|
680
|
-
]),
|
|
681
|
-
default: withCtx(() => {
|
|
682
|
-
var k, C, B;
|
|
683
|
-
return [
|
|
684
|
-
unref(o) ? (openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
685
|
-
createVNode(c, {
|
|
686
|
-
label: "Reward Type",
|
|
687
|
-
items: [
|
|
688
|
-
{ label: "No Reward", value: "NO_REWARD" },
|
|
689
|
-
{ label: "Voucher", value: "VOUCHER" },
|
|
690
|
-
{ label: "Loyalty", value: "LOYALTY" }
|
|
691
|
-
],
|
|
692
|
-
"model-value": unref(o).type,
|
|
693
|
-
"onUpdate:modelValue": r[0] || (r[0] = (V) => {
|
|
694
|
-
V == "NO_REWARD" ? o.value = {
|
|
695
|
-
type: "NO_REWARD",
|
|
696
|
-
collectible: null,
|
|
697
|
-
weight: 1
|
|
698
|
-
} : V === "VOUCHER" ? o.value = {
|
|
699
|
-
collectible: null,
|
|
700
|
-
type: "VOUCHER",
|
|
701
|
-
collectibleConfig: unref(initCollectibleConfig)("VOUCHER", {
|
|
702
|
-
business: unref(useCoreStore)().currentBusiness.value._id
|
|
703
|
-
}),
|
|
704
|
-
earningOption: {
|
|
705
|
-
amount: 1,
|
|
706
|
-
type: "FIXED"
|
|
707
|
-
},
|
|
708
|
-
validityOption: {
|
|
709
|
-
validForDay: 7
|
|
710
|
-
},
|
|
711
|
-
weight: 1
|
|
712
|
-
} : o.value = {
|
|
713
|
-
collectible: unref(s).loyaltyRewards.raw[0]._id,
|
|
714
|
-
type: "LOYALTY",
|
|
715
|
-
earningOption: {
|
|
716
|
-
amount: 1,
|
|
717
|
-
type: "FIXED"
|
|
718
|
-
},
|
|
719
|
-
validityOption: {
|
|
720
|
-
validForDay: 7
|
|
721
|
-
},
|
|
722
|
-
weight: 1
|
|
723
|
-
};
|
|
724
|
-
})
|
|
725
|
-
}, null, 8, ["model-value"]),
|
|
726
|
-
unref(o).type == "LOYALTY" ? (openBlock(), createBlock(c, {
|
|
727
|
-
key: 0,
|
|
728
|
-
label: "Loyalty type",
|
|
729
|
-
rules: [unref(ZodHelper).ruleAtPath(unref(m), "collectible", [unref(o).type])],
|
|
730
|
-
items: unref(s).loyaltyRewards.items,
|
|
731
|
-
"model-value": unref(o).collectible,
|
|
732
|
-
"onUpdate:modelValue": r[1] || (r[1] = (V) => unref(o).collectible = V)
|
|
733
|
-
}, null, 8, ["rules", "items", "model-value"])) : createCommentVNode("", !0),
|
|
734
|
-
createVNode(p, {
|
|
735
|
-
label: "Weight",
|
|
736
|
-
rules: [unref(ZodHelper).ruleAtPath(unref(m), "weight", [unref(o).type])],
|
|
737
|
-
"model-value": unref(o).weight,
|
|
738
|
-
"onUpdate:modelValue": r[2] || (r[2] = (V) => o.value = {
|
|
739
|
-
...unref(o),
|
|
740
|
-
weight: V
|
|
741
|
-
})
|
|
742
|
-
}, null, 8, ["rules", "model-value"]),
|
|
743
|
-
unref(o).type === "LOYALTY" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
744
|
-
((k = unref(s).loyaltyRewards.items.find(
|
|
745
|
-
(V) => {
|
|
746
|
-
var R;
|
|
747
|
-
return V.value === ((R = unref(o)) == null ? void 0 : R.collectible);
|
|
748
|
-
}
|
|
749
|
-
)) == null ? void 0 : k.raw.type) !== "TITLE" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
750
|
-
r[11] || (r[11] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
|
|
751
|
-
createVNode(_sfc_main$l, {
|
|
752
|
-
class: "mt-[-8px]",
|
|
753
|
-
rules: [
|
|
754
|
-
unref(ZodHelper).ruleAtPath(unref(m), "earningOption", [unref(o).type])
|
|
755
|
-
],
|
|
756
|
-
"helper-state": unref(ZodHelper).helperState(unref(g), "earningOption"),
|
|
757
|
-
"error-text": unref(ZodHelper).helperText(unref(g), "earningOption"),
|
|
758
|
-
"fixed-type": !0,
|
|
759
|
-
"model-value": unref(o).earningOption,
|
|
760
|
-
"onUpdate:modelValue": r[3] || (r[3] = (V) => o.value = {
|
|
761
|
-
...unref(o),
|
|
762
|
-
earningOption: V
|
|
763
|
-
})
|
|
764
|
-
}, null, 8, ["rules", "helper-state", "error-text", "model-value"])
|
|
765
|
-
], 64)) : createCommentVNode("", !0),
|
|
766
|
-
r[12] || (r[12] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Validity option", -1)),
|
|
767
|
-
createVNode(_sfc_main$m, {
|
|
768
|
-
type: unref(o).type === "LOYALTY" ? "custom" : "range",
|
|
769
|
-
"for-credit": unref(o).type === "LOYALTY" && ((C = unref(s).loyaltyRewards.items.find(
|
|
770
|
-
(V) => {
|
|
771
|
-
var R;
|
|
772
|
-
return V.value === ((R = unref(o)) == null ? void 0 : R.collectible);
|
|
773
|
-
}
|
|
774
|
-
)) == null ? void 0 : C.raw.type) === "CREDIT",
|
|
775
|
-
class: "!gap-24",
|
|
776
|
-
rules: [unref(ZodHelper).ruleAtPath(unref(m), "validityOption", [unref(o).type])],
|
|
777
|
-
"model-value": unref(o).validityOption,
|
|
778
|
-
"onUpdate:modelValue": r[4] || (r[4] = (V) => o.value = {
|
|
779
|
-
...unref(o),
|
|
780
|
-
validityOption: V
|
|
781
|
-
})
|
|
782
|
-
}, null, 8, ["type", "for-credit", "rules", "model-value"])
|
|
783
|
-
], 64)) : createCommentVNode("", !0),
|
|
784
|
-
unref(o).type === "VOUCHER" ? (openBlock(), createBlock(_sfc_main$n, {
|
|
785
|
-
key: 2,
|
|
786
|
-
"reward-image": unref(l),
|
|
787
|
-
"model-value": ((B = unref(o)) == null ? void 0 : B.collectibleConfig) ?? void 0,
|
|
788
|
-
"onUpdate:modelValue": r[5] || (r[5] = (V) => o.value = {
|
|
789
|
-
...unref(o),
|
|
790
|
-
collectibleConfig: V
|
|
791
|
-
}),
|
|
792
|
-
"onUpdate:rewardImage": r[6] || (r[6] = (V) => l.value = V)
|
|
793
|
-
}, null, 8, ["reward-image", "model-value"])) : createCommentVNode("", !0),
|
|
794
|
-
createVNode(JsonViewer, { json: unref(g) }, null, 8, ["json"])
|
|
795
|
-
])) : createCommentVNode("", !0)
|
|
796
|
-
];
|
|
797
|
-
}),
|
|
798
|
-
_: 1
|
|
799
|
-
}, 8, ["modelValue"]);
|
|
800
|
-
};
|
|
801
|
-
}
|
|
802
|
-
});
|
|
803
|
-
function isNullOrEmpty(e) {
|
|
804
|
-
return e == null || e === "";
|
|
805
|
-
}
|
|
806
|
-
const _hoisted_1$a = { class: "space-y-16" }, _hoisted_2$7 = { class: "fm-typo-en-body-lg-400" }, _hoisted_3$6 = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
807
|
-
__name: "RewardPoolInput",
|
|
808
|
-
props: {
|
|
809
|
-
modelValue: {
|
|
810
|
-
type: Array,
|
|
811
|
-
default: () => [
|
|
812
|
-
{
|
|
813
|
-
collectible: null,
|
|
814
|
-
type: "NO_REWARD",
|
|
815
|
-
weight: 1
|
|
816
|
-
}
|
|
817
|
-
]
|
|
818
|
-
}
|
|
819
|
-
},
|
|
820
|
-
emits: ["update:model-value"],
|
|
821
|
-
setup(e, { emit: d }) {
|
|
822
|
-
const a = e, s = d, u = useMembershipStore(), i = z.array(z.lazy(() => FdtoRandomReward)).min(1, "Requires at least 1 reward"), o = computed(() => a.modelValue ?? []), l = computed(() => {
|
|
823
|
-
const f = i.safeParse(o.value);
|
|
824
|
-
return f.success ? [] : f.error.errors;
|
|
825
|
-
}), n = ref();
|
|
826
|
-
function m(f, r) {
|
|
827
|
-
var p;
|
|
828
|
-
const c = [...o.value];
|
|
829
|
-
c[r] = f, (p = n.value) == null || p.showSheet(!1), s("update:model-value", c);
|
|
830
|
-
}
|
|
831
|
-
function g(f) {
|
|
832
|
-
const r = f.type == "VOUCHER" ? f.collectibleConfig : u.collectibles.find(
|
|
833
|
-
(b) => b._id.toString() == f.collectible
|
|
834
|
-
), c = CollectionUtils.formattedType((r == null ? void 0 : r.name) || ""), p = f.weight;
|
|
835
|
-
return {
|
|
836
|
-
label: isNullOrEmpty(c) ? "NO REWARD" : c,
|
|
837
|
-
sublabel: `${p} (${(p / o.value.reduce((b, x) => b + x.weight, 0) * 100).toFixed(2)}%)`
|
|
838
|
-
};
|
|
839
|
-
}
|
|
840
|
-
function y(f) {
|
|
841
|
-
var c;
|
|
842
|
-
const r = [...o.value];
|
|
843
|
-
(c = n.value) == null || c.showSheet(!0, r[f], f);
|
|
844
|
-
}
|
|
845
|
-
function v(f) {
|
|
846
|
-
const r = [...o.value];
|
|
847
|
-
r.splice(f, 1), s("update:model-value", r);
|
|
848
|
-
}
|
|
849
|
-
function h() {
|
|
850
|
-
var f;
|
|
851
|
-
(f = n.value) == null || f.showSheet(
|
|
852
|
-
!0,
|
|
853
|
-
{
|
|
854
|
-
type: "NO_REWARD",
|
|
855
|
-
collectible: null,
|
|
856
|
-
weight: 1
|
|
857
|
-
},
|
|
858
|
-
o.value.length
|
|
859
|
-
);
|
|
860
|
-
}
|
|
861
|
-
return (f, r) => {
|
|
862
|
-
const c = resolveComponent("FmButton"), p = resolveComponent("FmCard"), b = resolveComponent("FmHelperText");
|
|
863
|
-
return openBlock(), createElementBlock("div", _hoisted_1$a, [
|
|
864
|
-
r[1] || (r[1] = 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)),
|
|
865
|
-
createVNode(c, {
|
|
866
|
-
label: "Add Reward",
|
|
867
|
-
onClick: r[0] || (r[0] = (x) => h()),
|
|
868
|
-
variant: "plain",
|
|
869
|
-
icon: "add"
|
|
870
|
-
}),
|
|
871
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(o), (x, k) => (openBlock(), createBlock(p, {
|
|
872
|
-
key: k,
|
|
873
|
-
class: "px-16 py-12 flex items-center justify-between cursor-pointer",
|
|
874
|
-
variant: "outlined",
|
|
875
|
-
onClick: (C) => y(k)
|
|
876
|
-
}, {
|
|
877
|
-
default: withCtx(() => {
|
|
878
|
-
var C;
|
|
879
|
-
return [
|
|
880
|
-
createElementVNode("div", null, [
|
|
881
|
-
createElementVNode("div", _hoisted_2$7, toDisplayString(x.type == "LOYALTY" ? (C = x == null ? void 0 : x.earningOption) == null ? void 0 : C.amount : "") + " " + toDisplayString(g(x).label), 1),
|
|
882
|
-
createElementVNode("div", _hoisted_3$6, toDisplayString(g(x).sublabel), 1)
|
|
883
|
-
]),
|
|
884
|
-
createVNode(c, {
|
|
885
|
-
icon: "delete",
|
|
886
|
-
variant: "tertiary",
|
|
887
|
-
onClick: (B) => (B.stopPropagation(), v(k))
|
|
888
|
-
}, null, 8, ["onClick"])
|
|
889
|
-
];
|
|
890
|
-
}),
|
|
891
|
-
_: 2
|
|
892
|
-
}, 1032, ["onClick"]))), 128)),
|
|
893
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(l).filter((x) => x.path.join(".") == ""), (x) => (openBlock(), createBlock(b, {
|
|
894
|
-
key: x.message,
|
|
895
|
-
text: x.message,
|
|
896
|
-
state: "error"
|
|
897
|
-
}, null, 8, ["text"]))), 128)),
|
|
898
|
-
createVNode(_sfc_main$b, {
|
|
899
|
-
ref_key: "sheetRef",
|
|
900
|
-
ref: n,
|
|
901
|
-
"onUpdate:modelValue": m
|
|
902
|
-
}, null, 512)
|
|
903
|
-
]);
|
|
904
|
-
};
|
|
905
|
-
}
|
|
906
|
-
}), _hoisted_1$9 = { class: "space-y-16" }, _hoisted_2$6 = {
|
|
907
|
-
key: 0,
|
|
908
|
-
class: "grid grid-cols-2 gap-16"
|
|
909
|
-
}, _hoisted_3$5 = { class: "fm-typo-en-title-sm-800" }, _hoisted_4$4 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
910
|
-
__name: "PromotionGameTypeInput",
|
|
911
|
-
props: {
|
|
912
|
-
modelValue: {
|
|
913
|
-
type: Object
|
|
914
|
-
}
|
|
915
|
-
},
|
|
916
|
-
emits: ["update:model-value"],
|
|
917
|
-
setup(e, { emit: d }) {
|
|
918
|
-
const a = e, s = d, u = computed(() => [
|
|
919
|
-
{
|
|
920
|
-
label: "Rock paper scissor",
|
|
921
|
-
description: "Customers play 3 rounds of Rock Paper Scissors against the cashier. If customer won 2 rounds, they will get a discount.",
|
|
922
|
-
value: F_GAME_TYPE.enum.ROCK_PAPER_SCISSORS
|
|
923
|
-
}
|
|
924
|
-
]);
|
|
925
|
-
return (i, o) => {
|
|
926
|
-
var g, y, v;
|
|
927
|
-
const l = resolveComponent("FmSwitch"), n = resolveComponent("FmCard"), m = resolveComponent("FmHelperText");
|
|
928
|
-
return openBlock(), createElementBlock("div", _hoisted_1$9, [
|
|
929
|
-
createVNode(l, {
|
|
930
|
-
label: "Enable game",
|
|
931
|
-
"model-value": !!((g = e.modelValue) != null && g.gameType),
|
|
932
|
-
"onUpdate:modelValue": o[0] || (o[0] = (h) => h ? s("update:model-value", { gameType: "ROCK_PAPER_SCISSORS" }) : s("update:model-value", null))
|
|
933
|
-
}, null, 8, ["model-value"]),
|
|
934
|
-
((y = e.modelValue) == null ? void 0 : y.gameType) == "ROCK_PAPER_SCISSORS" ? (openBlock(), createElementBlock("div", _hoisted_2$6, [
|
|
935
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (h) => {
|
|
936
|
-
var f, r;
|
|
937
|
-
return openBlock(), createBlock(n, {
|
|
938
|
-
variant: "outlined",
|
|
939
|
-
class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
|
|
940
|
-
"col-span-2": unref(u).length == 1,
|
|
941
|
-
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": ((f = e.modelValue) == null ? void 0 : f.gameType) == h.value,
|
|
942
|
-
"hover:bg-fm-color-opacity-sm": ((r = e.modelValue) == null ? void 0 : r.gameType) != h.value
|
|
943
|
-
}]),
|
|
944
|
-
onClick: () => {
|
|
945
|
-
var c;
|
|
946
|
-
((c = a.modelValue) == null ? void 0 : c.gameType) != h.value && s("update:model-value", { gameType: h.value });
|
|
947
|
-
},
|
|
948
|
-
key: h.value
|
|
949
|
-
}, {
|
|
950
|
-
default: withCtx(() => [
|
|
951
|
-
createElementVNode("div", _hoisted_3$5, toDisplayString(h.label), 1),
|
|
952
|
-
createElementVNode("div", _hoisted_4$4, toDisplayString(h.description), 1)
|
|
953
|
-
]),
|
|
954
|
-
_: 2
|
|
955
|
-
}, 1032, ["class", "onClick"]);
|
|
956
|
-
}), 128))
|
|
957
|
-
])) : createCommentVNode("", !0),
|
|
958
|
-
((v = e.modelValue) == null ? void 0 : v.gameType) == "ROCK_PAPER_SCISSORS" ? (openBlock(), createBlock(m, {
|
|
959
|
-
key: 1,
|
|
960
|
-
text: "Rock paper scissors is only available for POS >= 7.7.4 with dual screen on android devices (Sunmi D3 Pro and Sunmi T3 Pro)",
|
|
961
|
-
state: "warning"
|
|
962
|
-
})) : createCommentVNode("", !0)
|
|
963
|
-
]);
|
|
964
|
-
};
|
|
965
|
-
}
|
|
966
|
-
}), _hoisted_1$8 = { class: "space-y-16" }, _hoisted_2$5 = { class: "grid grid-cols-2 gap-16" }, _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$8 = /* @__PURE__ */ defineComponent({
|
|
967
|
-
__name: "MissionTypeInput",
|
|
968
|
-
props: {
|
|
969
|
-
modelValue: {
|
|
970
|
-
type: String
|
|
971
|
-
}
|
|
972
|
-
},
|
|
973
|
-
emits: ["update:model-value"],
|
|
974
|
-
setup(e, { emit: d }) {
|
|
975
|
-
const a = e, s = d, u = computed(() => [
|
|
976
|
-
{
|
|
977
|
-
label: "Stamp",
|
|
978
|
-
description: "Award stamps for purchases, redeemable after reaching set milestones.",
|
|
979
|
-
value: F_MISSION_TYPE.enum.STAMP
|
|
980
|
-
},
|
|
981
|
-
{
|
|
982
|
-
label: "Progress",
|
|
983
|
-
description: "Reward customers when they reach a cumulative spending goal.",
|
|
984
|
-
value: F_MISSION_TYPE.enum.PROGRESSIVE
|
|
985
|
-
}
|
|
986
|
-
]);
|
|
987
|
-
return (i, o) => {
|
|
988
|
-
const l = resolveComponent("FmCard");
|
|
989
|
-
return openBlock(), createElementBlock("div", _hoisted_1$8, [
|
|
990
|
-
o[0] || (o[0] = 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)),
|
|
991
|
-
createElementVNode("div", _hoisted_2$5, [
|
|
992
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (n) => (openBlock(), createBlock(l, {
|
|
993
|
-
variant: "outlined",
|
|
994
|
-
class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
|
|
995
|
-
"col-span-2": unref(u).length == 1,
|
|
996
|
-
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == n.value,
|
|
997
|
-
"hover:bg-fm-color-opacity-sm": e.modelValue != n.value
|
|
998
|
-
}]),
|
|
999
|
-
onClick: () => {
|
|
1000
|
-
a.modelValue != n.value && s("update:model-value", n.value);
|
|
1001
|
-
},
|
|
1002
|
-
key: n.value
|
|
1003
|
-
}, {
|
|
1004
|
-
default: withCtx(() => [
|
|
1005
|
-
createElementVNode("div", _hoisted_3$4, toDisplayString(n.label), 1),
|
|
1006
|
-
createElementVNode("div", _hoisted_4$3, toDisplayString(n.description), 1)
|
|
1007
|
-
]),
|
|
1008
|
-
_: 2
|
|
1009
|
-
}, 1032, ["class", "onClick"]))), 128))
|
|
1010
|
-
])
|
|
1011
|
-
]);
|
|
1012
|
-
};
|
|
1013
|
-
}
|
|
1014
|
-
}), _hoisted_1$7 = { class: "space-y-16" }, _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
1015
|
-
__name: "MissionEndInput",
|
|
1016
|
-
props: {
|
|
1017
|
-
modelValue: {
|
|
1018
|
-
type: [String, Number]
|
|
1019
|
-
},
|
|
1020
|
-
helperText: {
|
|
1021
|
-
type: String
|
|
1022
|
-
},
|
|
1023
|
-
helperState: {
|
|
1024
|
-
type: String
|
|
1025
|
-
}
|
|
1026
|
-
},
|
|
1027
|
-
emits: ["update:model-value"],
|
|
1028
|
-
setup(e, { emit: d }) {
|
|
1029
|
-
const a = d;
|
|
1030
|
-
return (s, u) => {
|
|
1031
|
-
const i = resolveComponent("FmStepperField");
|
|
1032
|
-
return openBlock(), createElementBlock("div", _hoisted_1$7, [
|
|
1033
|
-
u[1] || (u[1] = 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)),
|
|
1034
|
-
createVNode(i, {
|
|
1035
|
-
label: "Maximum to collect",
|
|
1036
|
-
"model-value": e.modelValue || null,
|
|
1037
|
-
"onUpdate:modelValue": u[0] || (u[0] = (o) => a("update:model-value", o)),
|
|
1038
|
-
"helper-text": e.helperText || "Set the threshold required for reward eligibility",
|
|
1039
|
-
"helper-state": e.helperState || "none"
|
|
1040
|
-
}, null, 8, ["model-value", "helper-text", "helper-state"])
|
|
1041
|
-
]);
|
|
1042
|
-
};
|
|
1043
|
-
}
|
|
1044
|
-
}), _hoisted_1$6 = { class: "flex gap-8 items-center justify-start" }, _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
1045
|
-
__name: "EditMissionPoolSheet",
|
|
1046
|
-
props: {
|
|
1047
|
-
maxThreshold: {
|
|
1048
|
-
type: Number,
|
|
1049
|
-
required: !0
|
|
1050
|
-
}
|
|
1051
|
-
},
|
|
1052
|
-
emits: ["update:model-value"],
|
|
1053
|
-
setup(e, { expose: d, emit: a }) {
|
|
1054
|
-
const s = e, u = useMembershipStore(), { minor: i } = useLoading, o = ref(!1), l = ref(), n = ref(), m = ref(0), g = computed(() => {
|
|
1055
|
-
var p;
|
|
1056
|
-
return ((p = u.loyaltyRewards.items.find(
|
|
1057
|
-
(b) => {
|
|
1058
|
-
var x;
|
|
1059
|
-
return b.value === ((x = l.value) == null ? void 0 : x.collectible);
|
|
1060
|
-
}
|
|
1061
|
-
)) == null ? void 0 : p.raw.type) === "CREDIT" ? FdoThresholdCreditReward : FdtoThresholdReward;
|
|
1062
|
-
}), y = computed(() => {
|
|
1063
|
-
const c = g.value.safeParse(l.value);
|
|
1064
|
-
return c.success ? [] : c.error.errors;
|
|
1065
|
-
});
|
|
1066
|
-
function v(c, p, b) {
|
|
1067
|
-
c && (l.value = p, m.value = b), o.value = c;
|
|
1068
|
-
}
|
|
1069
|
-
const h = a;
|
|
1070
|
-
async function f() {
|
|
1071
|
-
const c = g.value.safeParse(l.value);
|
|
1072
|
-
c.success && (await i(
|
|
1073
|
-
async () => {
|
|
1074
|
-
c.data.type === "VOUCHER" && n.value && (c.data.collectibleConfig.image = await firebaseStorage.update(
|
|
1075
|
-
c.data.collectibleConfig.image || firebaseStorage.collectibleImagePath(void 0, n.value),
|
|
1076
|
-
n.value
|
|
1077
|
-
));
|
|
1078
|
-
},
|
|
1079
|
-
{
|
|
1080
|
-
message: "Uploading reward image",
|
|
1081
|
-
successMessage: "Reward image updated"
|
|
1082
|
-
}
|
|
1083
|
-
), h("update:model-value", c.data, m.value));
|
|
1084
|
-
}
|
|
1085
|
-
const r = ref();
|
|
1086
|
-
return d({
|
|
1087
|
-
showSheet: v
|
|
1088
|
-
}), (c, p) => {
|
|
1089
|
-
const b = resolveComponent("FmStepperField"), x = resolveComponent("FmSelect"), k = resolveComponent("FmForm"), C = resolveComponent("FmButton"), B = resolveComponent("FmSideSheet");
|
|
1090
|
-
return openBlock(), createBlock(B, {
|
|
1091
|
-
"max-width": 560,
|
|
1092
|
-
modelValue: unref(o),
|
|
1093
|
-
"onUpdate:modelValue": [
|
|
1094
|
-
p[10] || (p[10] = (V) => isRef(o) ? o.value = V : null),
|
|
1095
|
-
p[11] || (p[11] = (V) => o.value = V)
|
|
1096
|
-
],
|
|
1097
|
-
header: "Edit reward",
|
|
1098
|
-
"dismiss-away": ""
|
|
1099
|
-
}, {
|
|
1100
|
-
"side-sheet-footer": withCtx(() => [
|
|
1101
|
-
createElementVNode("div", _hoisted_1$6, [
|
|
1102
|
-
createVNode(C, {
|
|
1103
|
-
variant: "primary",
|
|
1104
|
-
type: "button",
|
|
1105
|
-
label: "Confirm",
|
|
1106
|
-
disabled: unref(y).length > 0,
|
|
1107
|
-
onClick: p[8] || (p[8] = async () => {
|
|
1108
|
-
var V;
|
|
1109
|
-
return (V = unref(r)) == null ? void 0 : V.validateInputs();
|
|
1110
|
-
})
|
|
1111
|
-
}, null, 8, ["disabled"]),
|
|
1112
|
-
createVNode(C, {
|
|
1113
|
-
variant: "secondary",
|
|
1114
|
-
type: "button",
|
|
1115
|
-
label: "Cancel",
|
|
1116
|
-
onClick: p[9] || (p[9] = (V) => o.value = !1)
|
|
1117
|
-
})
|
|
1118
|
-
])
|
|
1119
|
-
]),
|
|
1120
|
-
default: withCtx(() => [
|
|
1121
|
-
createVNode(JsonViewer, { json: unref(l) }, null, 8, ["json"]),
|
|
1122
|
-
unref(l) ? (openBlock(), createBlock(k, {
|
|
1123
|
-
key: 0,
|
|
1124
|
-
class: "flex flex-col gap-y-24",
|
|
1125
|
-
ref_key: "formRef",
|
|
1126
|
-
ref: r,
|
|
1127
|
-
onValidationSuccess: p[7] || (p[7] = (V) => f())
|
|
1128
|
-
}, {
|
|
1129
|
-
default: withCtx(() => {
|
|
1130
|
-
var V, R;
|
|
1131
|
-
return [
|
|
1132
|
-
unref(l).type ? (openBlock(), createBlock(b, {
|
|
1133
|
-
key: 0,
|
|
1134
|
-
label: "Threshold",
|
|
1135
|
-
rules: [
|
|
1136
|
-
unref(ZodHelper).toRule(
|
|
1137
|
-
unref(z).number().min(1).max(
|
|
1138
|
-
s.maxThreshold,
|
|
1139
|
-
`Number cannot be more than ${s.maxThreshold}`
|
|
1140
|
-
)
|
|
1141
|
-
)
|
|
1142
|
-
],
|
|
1143
|
-
"model-value": unref(l).threshold,
|
|
1144
|
-
"onUpdate:modelValue": p[0] || (p[0] = (E) => l.value = {
|
|
1145
|
-
...unref(l),
|
|
1146
|
-
threshold: E
|
|
1147
|
-
})
|
|
1148
|
-
}, null, 8, ["rules", "model-value"])) : createCommentVNode("", !0),
|
|
1149
|
-
createVNode(x, {
|
|
1150
|
-
label: "Reward Type",
|
|
1151
|
-
items: [
|
|
1152
|
-
{ label: "Voucher", value: "VOUCHER" },
|
|
1153
|
-
{ label: "Loyalty", value: "LOYALTY" }
|
|
1154
|
-
],
|
|
1155
|
-
"model-value": unref(l).type,
|
|
1156
|
-
"onUpdate:modelValue": p[1] || (p[1] = (E) => {
|
|
1157
|
-
var S, w;
|
|
1158
|
-
E === "VOUCHER" ? l.value = {
|
|
1159
|
-
collectible: null,
|
|
1160
|
-
type: "VOUCHER",
|
|
1161
|
-
collectibleConfig: unref(initCollectibleConfig)("VOUCHER", {
|
|
1162
|
-
business: unref(useCoreStore)().currentBusiness.value._id
|
|
1163
|
-
}),
|
|
1164
|
-
earningOption: {
|
|
1165
|
-
amount: 1,
|
|
1166
|
-
type: "FIXED"
|
|
1167
|
-
},
|
|
1168
|
-
validityOption: {
|
|
1169
|
-
validForDay: 7
|
|
1170
|
-
},
|
|
1171
|
-
threshold: (S = unref(l)) == null ? void 0 : S.threshold
|
|
1172
|
-
} : l.value = {
|
|
1173
|
-
collectible: unref(u).loyaltyRewards.raw[0]._id,
|
|
1174
|
-
type: "LOYALTY",
|
|
1175
|
-
earningOption: {
|
|
1176
|
-
amount: 1,
|
|
1177
|
-
type: "FIXED"
|
|
1178
|
-
},
|
|
1179
|
-
validityOption: {
|
|
1180
|
-
validForDay: 7
|
|
1181
|
-
},
|
|
1182
|
-
threshold: (w = unref(l)) == null ? void 0 : w.threshold
|
|
1183
|
-
};
|
|
1184
|
-
})
|
|
1185
|
-
}, null, 8, ["model-value"]),
|
|
1186
|
-
unref(l).type == "LOYALTY" ? (openBlock(), createBlock(x, {
|
|
1187
|
-
key: 1,
|
|
1188
|
-
label: "Loyalty type",
|
|
1189
|
-
rules: [unref(ZodHelper).ruleAtPath(unref(g), "collectible", [unref(l).type])],
|
|
1190
|
-
items: unref(u).loyaltyRewards.items,
|
|
1191
|
-
"model-value": unref(l).collectible,
|
|
1192
|
-
"onUpdate:modelValue": p[2] || (p[2] = (E) => unref(l).collectible = E)
|
|
1193
|
-
}, null, 8, ["rules", "items", "model-value"])) : createCommentVNode("", !0),
|
|
1194
|
-
unref(l).type === "LOYALTY" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
1195
|
-
p[12] || (p[12] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
|
|
1196
|
-
createVNode(_sfc_main$l, {
|
|
1197
|
-
class: "mt-[-8px]",
|
|
1198
|
-
rules: [unref(ZodHelper).ruleAtPath(unref(g), "earningOption", [unref(l).type])],
|
|
1199
|
-
"helper-state": unref(ZodHelper).helperState(unref(y), "earningOption"),
|
|
1200
|
-
"error-text": unref(ZodHelper).helperText(unref(y), "earningOption"),
|
|
1201
|
-
"fixed-type": !0,
|
|
1202
|
-
"model-value": unref(l).earningOption,
|
|
1203
|
-
"onUpdate:modelValue": p[3] || (p[3] = (E) => l.value = {
|
|
1204
|
-
...unref(l),
|
|
1205
|
-
earningOption: E
|
|
1206
|
-
})
|
|
1207
|
-
}, null, 8, ["rules", "helper-state", "error-text", "model-value"]),
|
|
1208
|
-
createVNode(_sfc_main$m, {
|
|
1209
|
-
class: "!gap-24",
|
|
1210
|
-
type: unref(l).type === "LOYALTY" ? "custom" : "range",
|
|
1211
|
-
"for-credit": unref(l).type === "LOYALTY" && ((V = unref(u).loyaltyRewards.items.find(
|
|
1212
|
-
(E) => {
|
|
1213
|
-
var S;
|
|
1214
|
-
return E.value === ((S = unref(l)) == null ? void 0 : S.collectible);
|
|
1215
|
-
}
|
|
1216
|
-
)) == null ? void 0 : V.raw.type) === "CREDIT",
|
|
1217
|
-
rules: [unref(ZodHelper).ruleAtPath(unref(g), "validityOption", [unref(l).type])],
|
|
1218
|
-
"model-value": unref(l).validityOption,
|
|
1219
|
-
"onUpdate:modelValue": p[4] || (p[4] = (E) => l.value = {
|
|
1220
|
-
...unref(l),
|
|
1221
|
-
validityOption: E
|
|
1222
|
-
})
|
|
1223
|
-
}, null, 8, ["type", "for-credit", "rules", "model-value"])
|
|
1224
|
-
], 64)) : createCommentVNode("", !0),
|
|
1225
|
-
unref(l).type === "VOUCHER" ? (openBlock(), createBlock(_sfc_main$n, {
|
|
1226
|
-
key: 3,
|
|
1227
|
-
"reward-image": unref(n),
|
|
1228
|
-
"model-value": ((R = unref(l)) == null ? void 0 : R.collectibleConfig) ?? void 0,
|
|
1229
|
-
"onUpdate:modelValue": p[5] || (p[5] = (E) => l.value = {
|
|
1230
|
-
...unref(l),
|
|
1231
|
-
collectibleConfig: E
|
|
1232
|
-
}),
|
|
1233
|
-
"onUpdate:rewardImage": p[6] || (p[6] = (E) => n.value = E)
|
|
1234
|
-
}, null, 8, ["reward-image", "model-value"])) : createCommentVNode("", !0),
|
|
1235
|
-
createVNode(JsonViewer, { json: unref(y) }, null, 8, ["json"])
|
|
1236
|
-
];
|
|
1237
|
-
}),
|
|
1238
|
-
_: 1
|
|
1239
|
-
}, 512)) : createCommentVNode("", !0)
|
|
1240
|
-
]),
|
|
1241
|
-
_: 1
|
|
1242
|
-
}, 8, ["modelValue"]);
|
|
1243
|
-
};
|
|
1244
|
-
}
|
|
1245
|
-
}), _hoisted_1$5 = {
|
|
1246
|
-
key: 0,
|
|
1247
|
-
class: "grid grid-cols-5 text-center gap-8 justify-between items-center w-full"
|
|
1248
|
-
}, _hoisted_2$4 = { class: "flex flex-col gap-0 items-center justify-center" }, _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
1249
|
-
__name: "MissionProgress",
|
|
1250
|
-
props: {
|
|
1251
|
-
type: {
|
|
1252
|
-
type: String,
|
|
1253
|
-
required: !0
|
|
1254
|
-
},
|
|
1255
|
-
maxRange: {
|
|
1256
|
-
type: Number,
|
|
1257
|
-
required: !0
|
|
1258
|
-
},
|
|
1259
|
-
currentRange: {
|
|
1260
|
-
type: Number,
|
|
1261
|
-
default: 0
|
|
1262
|
-
},
|
|
1263
|
-
markers: {
|
|
1264
|
-
type: Array,
|
|
1265
|
-
default: () => []
|
|
1266
|
-
}
|
|
1267
|
-
},
|
|
1268
|
-
setup(e) {
|
|
1269
|
-
const d = e, { maxRange: a, currentRange: s, markers: u } = toRefs(d), i = computed(
|
|
1270
|
-
() => Math.min(s.value / a.value * 100, 100)
|
|
1271
|
-
), o = (l) => l / a.value * 100;
|
|
1272
|
-
return (l, n) => {
|
|
1273
|
-
const m = resolveComponent("FmIcon");
|
|
1274
|
-
return e.type === "STAMP" ? (openBlock(), createElementBlock("div", _hoisted_1$5, [
|
|
1275
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(Math.min(unref(a), 40), (g) => (openBlock(), createBlock(m, {
|
|
1276
|
-
class: normalizeClass(
|
|
1277
|
-
unref(s) >= g ? "text-fm-color-primary" : "text-fm-color-neutral-gray-200"
|
|
1278
|
-
),
|
|
1279
|
-
outline: unref(s) < g,
|
|
1280
|
-
key: g,
|
|
1281
|
-
name: unref(u).some((y) => y === g) ? "featured_seasonal_and_gifts" : "check_circle"
|
|
1282
|
-
}, null, 8, ["class", "outline", "name"]))), 128))
|
|
1283
|
-
])) : (openBlock(), createElementBlock("div", {
|
|
1284
|
-
key: 1,
|
|
1285
|
-
class: normalizeClass(["relative w-full h-4 rounded-lg", "bg-fm-color-system-warning-100"])
|
|
1286
|
-
}, [
|
|
1287
|
-
createElementVNode("div", {
|
|
1288
|
-
class: normalizeClass(["bg-fm-color-primary", "absolute top-0 left-0 h-full rounded-lg"]),
|
|
1289
|
-
style: normalizeStyle({ width: unref(i) + "%" })
|
|
1290
|
-
}, null, 4),
|
|
1291
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (g, y) => (openBlock(), createElementBlock("div", {
|
|
1292
|
-
key: y,
|
|
1293
|
-
class: "absolute -top-1.5 flex flex-col items-center -translate-x-1/2",
|
|
1294
|
-
style: normalizeStyle({ left: o(g) + "%" })
|
|
1295
|
-
}, [
|
|
1296
|
-
createElementVNode("div", _hoisted_2$4, [
|
|
1297
|
-
createElementVNode("div", {
|
|
1298
|
-
class: normalizeClass(["h-16 w-[2px]", "bg-fm-color-system-warning-300"])
|
|
1299
|
-
}),
|
|
1300
|
-
n[0] || (n[0] = createElementVNode("div", null, "🎁", -1))
|
|
1301
|
-
])
|
|
1302
|
-
], 4))), 128))
|
|
1303
|
-
]));
|
|
1304
|
-
};
|
|
1305
|
-
}
|
|
1306
|
-
}), isObject = (e) => e !== null && typeof e == "object";
|
|
1307
|
-
function changeKeysFactory(e) {
|
|
1308
|
-
return function d(a, s = 1, u) {
|
|
1309
|
-
if (s === 0 || !isObject(a))
|
|
1310
|
-
return a;
|
|
1311
|
-
if (Array.isArray(a))
|
|
1312
|
-
return a.map((o) => d(o, s - 1, u));
|
|
1313
|
-
const i = Object.create(Object.getPrototypeOf(a));
|
|
1314
|
-
return Object.keys(a).forEach((o) => {
|
|
1315
|
-
const l = a[o], n = e(o, u), m = d(l, s - 1, u);
|
|
1316
|
-
i[n] = m;
|
|
1317
|
-
}), i;
|
|
1318
|
-
};
|
|
1319
|
-
}
|
|
1320
|
-
const sentenceCase = changeKeysFactory(sentenceCase$1), _hoisted_1$4 = { class: "space-y-16" }, _hoisted_2$3 = { class: "fm-typo-en-body-lg-400" }, _hoisted_3$3 = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _hoisted_4$2 = { class: "flex items-center gap-4" }, _hoisted_5$2 = { class: "fm-typo-en-body-lg-600" }, _hoisted_6$2 = { class: "flex items-center gap-16" }, _hoisted_7$1 = { key: 0 }, _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
1321
|
-
__name: "MissionPoolInput",
|
|
1322
|
-
props: {
|
|
1323
|
-
modelValue: {
|
|
1324
|
-
type: Array,
|
|
1325
|
-
default: () => []
|
|
1326
|
-
},
|
|
1327
|
-
mission: {
|
|
1328
|
-
type: Object,
|
|
1329
|
-
required: !0
|
|
1330
|
-
}
|
|
1331
|
-
},
|
|
1332
|
-
emits: ["update:model-value"],
|
|
1333
|
-
setup(e, { emit: d }) {
|
|
1334
|
-
const a = e, s = d, u = useMembershipStore(), i = z.array(z.lazy(() => FdtoThresholdReward)).min(1, "Requires at least 1 reward"), o = computed(
|
|
1335
|
-
() => a.modelValue.sort((r, c) => r.threshold - c.threshold) ?? []
|
|
1336
|
-
), l = computed(() => {
|
|
1337
|
-
const r = i.safeParse(o.value);
|
|
1338
|
-
return r.success ? [] : r.error.errors;
|
|
1339
|
-
}), n = ref();
|
|
1340
|
-
function m(r, c) {
|
|
1341
|
-
var b;
|
|
1342
|
-
const p = [...o.value];
|
|
1343
|
-
p[c] = r, (b = n.value) == null || b.showSheet(!1), s("update:model-value", p);
|
|
1344
|
-
}
|
|
1345
|
-
function g(r) {
|
|
1346
|
-
const c = r.type == "VOUCHER" ? r.collectibleConfig : u.collectibles.find(
|
|
1347
|
-
(b) => b._id.toString() == r.collectible
|
|
1348
|
-
), p = CollectionUtils.formattedType((c == null ? void 0 : c.name) || "");
|
|
1349
|
-
return {
|
|
1350
|
-
label: isNullOrEmpty(p) ? "NO REWARD" : p,
|
|
1351
|
-
sublabel: `Reward at ${r.threshold} | Amount: ${r.earningOption.type == "FIXED" ? r.earningOption.amount : `${r.earningOption.amount} for every RM${r.earningOption.every} spent`} `
|
|
1352
|
-
};
|
|
1353
|
-
}
|
|
1354
|
-
function y(r) {
|
|
1355
|
-
var p;
|
|
1356
|
-
const c = [...o.value];
|
|
1357
|
-
(p = n.value) == null || p.showSheet(!0, c[r], r);
|
|
1358
|
-
}
|
|
1359
|
-
function v(r) {
|
|
1360
|
-
const c = [...o.value];
|
|
1361
|
-
c.splice(r, 1), s("update:model-value", c);
|
|
1362
|
-
}
|
|
1363
|
-
function h() {
|
|
1364
|
-
var r;
|
|
1365
|
-
(r = n.value) == null || r.showSheet(
|
|
1366
|
-
!0,
|
|
1367
|
-
{
|
|
1368
|
-
type: "LOYALTY",
|
|
1369
|
-
collectible: u.loyaltyRewards.items[0].value,
|
|
1370
|
-
threshold: null,
|
|
1371
|
-
validityOption: {
|
|
1372
|
-
validForDay: 7
|
|
1373
|
-
},
|
|
1374
|
-
earningOption: {
|
|
1375
|
-
type: "FIXED",
|
|
1376
|
-
amount: 1
|
|
1377
|
-
}
|
|
1378
|
-
},
|
|
1379
|
-
o.value.length
|
|
1380
|
-
);
|
|
1381
|
-
}
|
|
1382
|
-
function f(r) {
|
|
1383
|
-
var c, p;
|
|
1384
|
-
return r.type == "VOUCHER" ? (c = r.collectibleConfig) == null ? void 0 : c.name : sentenceCase(
|
|
1385
|
-
((p = u.loyaltyRewards.items.find(
|
|
1386
|
-
(b) => b.value == r.collectible
|
|
1387
|
-
)) == null ? void 0 : p.label) || ""
|
|
1388
|
-
);
|
|
1389
|
-
}
|
|
1390
|
-
return (r, c) => {
|
|
1391
|
-
const p = resolveComponent("FmButton"), b = resolveComponent("FmCard"), x = resolveComponent("FmHelperText");
|
|
1392
|
-
return openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
1393
|
-
c[2] || (c[2] = createElementVNode("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Configure the reward type given to your customer. ", -1)),
|
|
1394
|
-
createVNode(p, {
|
|
1395
|
-
label: "Add Reward",
|
|
1396
|
-
onClick: c[0] || (c[0] = (k) => h()),
|
|
1397
|
-
variant: "plain",
|
|
1398
|
-
icon: "add"
|
|
1399
|
-
}),
|
|
1400
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(o), (k, C) => (openBlock(), createBlock(b, {
|
|
1401
|
-
key: C,
|
|
1402
|
-
class: "px-16 py-12 flex items-center justify-between cursor-pointer",
|
|
1403
|
-
variant: "outlined",
|
|
1404
|
-
onClick: (B) => y(C)
|
|
1405
|
-
}, {
|
|
1406
|
-
default: withCtx(() => [
|
|
1407
|
-
createElementVNode("div", null, [
|
|
1408
|
-
createElementVNode("div", _hoisted_2$3, toDisplayString(g(k).label), 1),
|
|
1409
|
-
createElementVNode("div", _hoisted_3$3, toDisplayString(g(k).sublabel), 1)
|
|
1410
|
-
]),
|
|
1411
|
-
createVNode(p, {
|
|
1412
|
-
icon: "delete",
|
|
1413
|
-
variant: "tertiary",
|
|
1414
|
-
onClick: (B) => (B.stopPropagation(), v(C))
|
|
1415
|
-
}, null, 8, ["onClick"])
|
|
1416
|
-
]),
|
|
1417
|
-
_: 2
|
|
1418
|
-
}, 1032, ["onClick"]))), 128)),
|
|
1419
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(l).filter((k) => k.path.join(".") == ""), (k) => (openBlock(), createBlock(x, {
|
|
1420
|
-
key: k.message,
|
|
1421
|
-
text: k.message,
|
|
1422
|
-
state: "error"
|
|
1423
|
-
}, null, 8, ["text"]))), 128)),
|
|
1424
|
-
c[3] || (c[3] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Mission Preview", -1)),
|
|
1425
|
-
(openBlock(), createBlock(b, {
|
|
1426
|
-
key: 0,
|
|
1427
|
-
variant: "outlined",
|
|
1428
|
-
class: "p-24 space-y-16 w-fit"
|
|
1429
|
-
}, {
|
|
1430
|
-
default: withCtx(() => {
|
|
1431
|
-
var k, C;
|
|
1432
|
-
return [
|
|
1433
|
-
createElementVNode("div", _hoisted_4$2, [
|
|
1434
|
-
createElementVNode("div", null, [
|
|
1435
|
-
createElementVNode("div", _hoisted_5$2, " Collect " + toDisplayString(e.mission.end) + " stamps to get " + toDisplayString(((k = e.modelValue[e.modelValue.length - 1]) == null ? void 0 : k.earningOption.amount) > 1 ? (C = e.modelValue[e.modelValue.length - 1]) == null ? void 0 : C.earningOption.amount : "") + " " + toDisplayString(e.modelValue[e.modelValue.length - 1] ? f(e.modelValue[e.modelValue.length - 1]) : ""), 1),
|
|
1436
|
-
c[1] || (c[1] = createElementVNode("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Earn a stamp! ", -1))
|
|
1437
|
-
])
|
|
1438
|
-
]),
|
|
1439
|
-
createElementVNode("div", _hoisted_6$2, [
|
|
1440
|
-
createVNode(_sfc_main$5, {
|
|
1441
|
-
type: e.mission.type,
|
|
1442
|
-
"max-range": e.mission.end,
|
|
1443
|
-
currentRange: e.mission.end / 4,
|
|
1444
|
-
markers: e.modelValue.map((B) => B.threshold)
|
|
1445
|
-
}, null, 8, ["type", "max-range", "currentRange", "markers"]),
|
|
1446
|
-
e.mission.type == "PROGRESSIVE" ? (openBlock(), createElementBlock("div", _hoisted_7$1, " 0/" + toDisplayString(e.mission.end.toLocaleString()), 1)) : createCommentVNode("", !0)
|
|
1447
|
-
])
|
|
1448
|
-
];
|
|
1449
|
-
}),
|
|
1450
|
-
_: 1
|
|
1451
|
-
})),
|
|
1452
|
-
createVNode(_sfc_main$6, {
|
|
1453
|
-
ref_key: "sheetRef",
|
|
1454
|
-
ref: n,
|
|
1455
|
-
"onUpdate:modelValue": m,
|
|
1456
|
-
"max-threshold": e.mission.end
|
|
1457
|
-
}, null, 8, ["max-threshold"])
|
|
1458
|
-
]);
|
|
1459
|
-
};
|
|
1460
|
-
}
|
|
1461
|
-
}), _hoisted_1$3 = { class: "space-y-16" }, _hoisted_2$2 = { class: "space-y-8" }, _hoisted_3$2 = { class: "grid grid-cols-2 gap-16" }, _hoisted_4$1 = { class: "fm-typo-en-title-sm-800" }, _hoisted_5$1 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_6$1 = { class: "space-y-8" }, _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
1462
|
-
__name: "MissionInput",
|
|
1463
|
-
props: {
|
|
1464
|
-
modelValue: Object
|
|
1465
|
-
},
|
|
1466
|
-
emits: ["update:model-value"],
|
|
1467
|
-
setup(e, { emit: d }) {
|
|
1468
|
-
const a = e, s = computed(() => {
|
|
1469
|
-
const o = FdoMission.safeParse(a.modelValue);
|
|
1470
|
-
return o.success ? [] : o.error.errors;
|
|
1471
|
-
}), u = computed(() => [
|
|
1472
|
-
{
|
|
1473
|
-
label: "Stamp",
|
|
1474
|
-
description: "Award stamps for purchases, redeemable after reaching set milestones.",
|
|
1475
|
-
value: F_MISSION_TYPE.enum.STAMP
|
|
1476
|
-
},
|
|
1477
|
-
{
|
|
1478
|
-
label: "Progress",
|
|
1479
|
-
description: "Reward customers when they reach a cumulative spending goal.",
|
|
1480
|
-
value: F_MISSION_TYPE.enum.PROGRESSIVE
|
|
1481
|
-
}
|
|
1482
|
-
]), i = d;
|
|
1483
|
-
return (o, l) => {
|
|
1484
|
-
var g;
|
|
1485
|
-
const n = resolveComponent("FmCard"), m = resolveComponent("FmStepperField");
|
|
1486
|
-
return openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
1487
|
-
createElementVNode("div", _hoisted_2$2, [
|
|
1488
|
-
l[1] || (l[1] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Mission Type", -1)),
|
|
1489
|
-
l[2] || (l[2] = 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)),
|
|
1490
|
-
createElementVNode("div", _hoisted_3$2, [
|
|
1491
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (y) => {
|
|
1492
|
-
var v, h;
|
|
1493
|
-
return openBlock(), createBlock(n, {
|
|
1494
|
-
variant: "outlined",
|
|
1495
|
-
class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
|
|
1496
|
-
"col-span-2": unref(u).length == 1,
|
|
1497
|
-
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": ((v = e.modelValue) == null ? void 0 : v.type) == y.value,
|
|
1498
|
-
"hover:bg-fm-color-opacity-sm": ((h = e.modelValue) == null ? void 0 : h.type) != y.value
|
|
1499
|
-
}]),
|
|
1500
|
-
onClick: () => {
|
|
1501
|
-
var f, r;
|
|
1502
|
-
((f = e.modelValue) == null ? void 0 : f.type) != y.value && i("update:model-value", {
|
|
1503
|
-
...e.modelValue,
|
|
1504
|
-
type: y.value,
|
|
1505
|
-
end: ((r = e.modelValue) == null ? void 0 : r.end) || 1
|
|
1506
|
-
});
|
|
1507
|
-
},
|
|
1508
|
-
key: y.value
|
|
1509
|
-
}, {
|
|
1510
|
-
default: withCtx(() => [
|
|
1511
|
-
createElementVNode("div", _hoisted_4$1, toDisplayString(y.label), 1),
|
|
1512
|
-
createElementVNode("div", _hoisted_5$1, toDisplayString(y.description), 1)
|
|
1513
|
-
]),
|
|
1514
|
-
_: 2
|
|
1515
|
-
}, 1032, ["class", "onClick"]);
|
|
1516
|
-
}), 128))
|
|
1517
|
-
])
|
|
1518
|
-
]),
|
|
1519
|
-
createElementVNode("div", _hoisted_6$1, [
|
|
1520
|
-
l[3] || (l[3] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Collections required", -1)),
|
|
1521
|
-
l[4] || (l[4] = 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)),
|
|
1522
|
-
createVNode(m, {
|
|
1523
|
-
label: "Maximum to collect",
|
|
1524
|
-
"model-value": ((g = e.modelValue) == null ? void 0 : g.end) || null,
|
|
1525
|
-
"onUpdate:modelValue": l[0] || (l[0] = (y) => {
|
|
1526
|
-
var v;
|
|
1527
|
-
return i("update:model-value", {
|
|
1528
|
-
...e.modelValue,
|
|
1529
|
-
type: ((v = e.modelValue) == null ? void 0 : v.type) || "STAMP",
|
|
1530
|
-
end: y
|
|
1531
|
-
});
|
|
1532
|
-
}),
|
|
1533
|
-
"helper-text": unref(ZodHelper).helperText(unref(s), "end") || "Set the threshold required for reward eligibility",
|
|
1534
|
-
"helper-state": unref(ZodHelper).helperState(unref(s), "end") || "none"
|
|
1535
|
-
}, null, 8, ["model-value", "helper-text", "helper-state"])
|
|
1536
|
-
])
|
|
1537
|
-
]);
|
|
1538
|
-
};
|
|
1539
|
-
}
|
|
1540
|
-
}), _hoisted_1$2 = { key: 26 }, _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
1541
|
-
__name: "TemplateInput",
|
|
1542
|
-
props: {
|
|
1543
|
-
field: { type: Object, required: !0 },
|
|
1544
|
-
modelValue: {
|
|
1545
|
-
type: Object
|
|
1546
|
-
},
|
|
1547
|
-
schema: {
|
|
1548
|
-
type: Object
|
|
1549
|
-
},
|
|
1550
|
-
extras: {
|
|
1551
|
-
type: Object
|
|
1552
|
-
},
|
|
1553
|
-
helperText: {
|
|
1554
|
-
type: String
|
|
1555
|
-
},
|
|
1556
|
-
disabled: {
|
|
1557
|
-
type: Boolean,
|
|
1558
|
-
default: !1
|
|
1559
|
-
}
|
|
1560
|
-
},
|
|
1561
|
-
emits: ["update:model-value", "update:file"],
|
|
1562
|
-
setup(e, { emit: d }) {
|
|
1563
|
-
const { t: a } = useI18n(), s = e, u = d;
|
|
1564
|
-
function i(m) {
|
|
1565
|
-
switch (s.field.type) {
|
|
1566
|
-
case "timeframe":
|
|
1567
|
-
const g = m.startDate ? hooks(m.startDate).startOf("day").toISOString() : void 0, y = m.endDate ? hooks(m.endDate).endOf("day").toISOString() : void 0;
|
|
1568
|
-
u("update:model-value", {
|
|
1569
|
-
type: "timeframe",
|
|
1570
|
-
property: "__now",
|
|
1571
|
-
start: g,
|
|
1572
|
-
end: y
|
|
1573
|
-
});
|
|
1574
|
-
break;
|
|
1575
|
-
case "image": {
|
|
1576
|
-
u(
|
|
1577
|
-
"update:file",
|
|
1578
|
-
m,
|
|
1579
|
-
o.value || firebaseStorage.collectibleImagePath(void 0, m)
|
|
1580
|
-
);
|
|
1581
|
-
break;
|
|
1582
|
-
}
|
|
1583
|
-
default:
|
|
1584
|
-
u("update:model-value", m);
|
|
1585
|
-
break;
|
|
1586
|
-
}
|
|
1587
|
-
}
|
|
1588
|
-
const o = computed(() => {
|
|
1589
|
-
switch (s.field.type) {
|
|
1590
|
-
case "timeframe": {
|
|
1591
|
-
const m = s.modelValue;
|
|
1592
|
-
return {
|
|
1593
|
-
startDate: m != null && m.start ? hooks(m == null ? void 0 : m.start).format("YYYY-MM-DD") : null,
|
|
1594
|
-
endDate: m != null && m.end ? hooks(m == null ? void 0 : m.end).format("YYYY-MM-DD") : null
|
|
1595
|
-
};
|
|
1596
|
-
}
|
|
1597
|
-
default:
|
|
1598
|
-
return s.modelValue;
|
|
1599
|
-
}
|
|
1600
|
-
});
|
|
1601
|
-
function l() {
|
|
1602
|
-
if (!n.value.schema) return [];
|
|
1603
|
-
const m = n.value.schema.safeParse(s.modelValue);
|
|
1604
|
-
return m.success ? [] : m.error.errors;
|
|
1605
|
-
}
|
|
1606
|
-
const n = computed(() => ({
|
|
1607
|
-
schema: s.schema,
|
|
1608
|
-
unwrapped: s.schema ? ZodHelper.unwrap(s.schema) : void 0,
|
|
1609
|
-
rules: s.schema ? [ZodHelper.ruleAtPath(s.schema, "")] : void 0,
|
|
1610
|
-
labelMark: s.schema && ZodHelper.isRequired(s.schema) == !1 ? "optional" : void 0,
|
|
1611
|
-
zodLabel: s.schema ? ZodHelper.toInputLabel(s.schema, s.field.label) : void 0
|
|
1612
|
-
}));
|
|
1613
|
-
return (m, g) => {
|
|
1614
|
-
var c, p, b, x, k;
|
|
1615
|
-
const y = resolveComponent("FmTextField"), v = resolveComponent("FmStepperField"), h = resolveComponent("FmTextarea"), f = resolveComponent("FmHelperText"), r = resolveComponent("FmSwitch");
|
|
1616
|
-
return e.field.type === "text" ? (openBlock(), createBlock(y, {
|
|
1617
|
-
key: 0,
|
|
1618
|
-
label: unref(a)(e.field.label),
|
|
1619
|
-
"label-mark": unref(n).labelMark,
|
|
1620
|
-
rules: unref(n).rules,
|
|
1621
|
-
"model-value": unref(o),
|
|
1622
|
-
"onUpdate:modelValue": i,
|
|
1623
|
-
"helper-state": e.helperText ? "error" : void 0,
|
|
1624
|
-
"helper-text": e.helperText
|
|
1625
|
-
}, null, 8, ["label", "label-mark", "rules", "model-value", "helper-state", "helper-text"])) : e.field.type === "number" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
1626
|
-
createVNode(JsonViewer, {
|
|
1627
|
-
json: { schema: unref(n).unwrapped, props: s }
|
|
1628
|
-
}, null, 8, ["json"]),
|
|
1629
|
-
createVNode(v, {
|
|
1630
|
-
label: unref(a)(e.field.label),
|
|
1631
|
-
"label-mark": e.field.isRuleChildren ? void 0 : unref(n).labelMark,
|
|
1632
|
-
"model-value": unref(o),
|
|
1633
|
-
rules: e.field.isRuleChildren ? [] : unref(n).rules,
|
|
1634
|
-
"onUpdate:modelValue": i,
|
|
1635
|
-
"helper-state": e.field.isRuleChildren && e.helperText ? "error" : void 0,
|
|
1636
|
-
"helper-text": e.field.isRuleChildren ? e.helperText : void 0
|
|
1637
|
-
}, null, 8, ["label", "label-mark", "model-value", "rules", "helper-state", "helper-text"])
|
|
1638
|
-
], 64)) : e.field.type === "textarea" ? (openBlock(), createBlock(h, {
|
|
1639
|
-
key: 2,
|
|
1640
|
-
label: unref(a)(e.field.label),
|
|
1641
|
-
"label-mark": unref(n).labelMark,
|
|
1642
|
-
rules: unref(n).rules,
|
|
1643
|
-
"model-value": unref(o),
|
|
1644
|
-
"onUpdate:modelValue": i,
|
|
1645
|
-
"show-word-count": "",
|
|
1646
|
-
"max-length": (k = (x = (b = (p = (c = unref(n)) == null ? void 0 : c.unwrapped) == null ? void 0 : p._def) == null ? void 0 : b.checks) == null ? void 0 : x.find((C) => C.kind == "max")) == null ? void 0 : k.value
|
|
1647
|
-
}, null, 8, ["label", "label-mark", "rules", "model-value", "max-length"])) : e.field.type === "trigger" ? (openBlock(), createBlock(_sfc_main$g, {
|
|
1648
|
-
key: 3,
|
|
1649
|
-
"campaign-type": e.extras,
|
|
1650
|
-
"model-value": unref(o),
|
|
1651
|
-
disabled: e.disabled,
|
|
1652
|
-
"onUpdate:modelValue": i
|
|
1653
|
-
}, null, 8, ["campaign-type", "model-value", "disabled"])) : e.field.type === "timeframe" ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
|
|
1654
|
-
createVNode(_sfc_main$e, {
|
|
1655
|
-
"model-value": unref(o),
|
|
1656
|
-
"onUpdate:modelValue": i
|
|
1657
|
-
}, null, 8, ["model-value"]),
|
|
1658
|
-
createVNode(f, {
|
|
1659
|
-
class: "!mt-[8px]",
|
|
1660
|
-
text: unref(ZodHelper).helperText(l(), ""),
|
|
1661
|
-
state: unref(ZodHelper).helperState(l(), "")
|
|
1662
|
-
}, null, 8, ["text", "state"])
|
|
1663
|
-
], 64)) : e.field.type === "image" ? (openBlock(), createBlock(_sfc_main$o, {
|
|
1664
|
-
key: 5,
|
|
1665
|
-
thumbnail: unref(o),
|
|
1666
|
-
"aspect-ratio": "16 / 9",
|
|
1667
|
-
class: "w-1/2 xs:w-2/3",
|
|
1668
|
-
"onUpdate:file": i
|
|
1669
|
-
}, {
|
|
1670
|
-
label: withCtx(() => [
|
|
1671
|
-
(openBlock(), createBlock(resolveDynamicComponent(unref(n).zodLabel)))
|
|
1672
|
-
]),
|
|
1673
|
-
_: 1
|
|
1674
|
-
}, 8, ["thumbnail"])) : e.field.type === "switch" ? (openBlock(), createBlock(r, {
|
|
1675
|
-
key: 6,
|
|
1676
|
-
label: unref(a)(e.field.label),
|
|
1677
|
-
"label-placement": "right",
|
|
1678
|
-
sublabel: e.field.property == "campaign.notify" ? "Notify customer when customer receives the reward" : void 0,
|
|
1679
|
-
"label-mark": unref(n).labelMark,
|
|
1680
|
-
rules: unref(n).rules,
|
|
1681
|
-
"model-value": unref(o),
|
|
1682
|
-
"onUpdate:modelValue": i
|
|
1683
|
-
}, null, 8, ["label", "sublabel", "label-mark", "rules", "model-value"])) : e.field.type === "collectible_options" ? (openBlock(), createBlock(_sfc_main$p, {
|
|
1684
|
-
key: 7,
|
|
1685
|
-
"model-value": unref(o),
|
|
1686
|
-
"onUpdate:modelValue": i,
|
|
1687
|
-
"no-campaign": !1,
|
|
1688
|
-
schema: unref(n).schema,
|
|
1689
|
-
"is-mission": e.extras === "MISSION"
|
|
1690
|
-
}, null, 8, ["model-value", "schema", "is-mission"])) : e.field.type === "target_location" ? (openBlock(), createBlock(_sfc_main$q, {
|
|
1691
|
-
key: 8,
|
|
1692
|
-
"model-value": unref(o),
|
|
1693
|
-
"onUpdate:modelValue": i
|
|
1694
|
-
}, null, 8, ["model-value"])) : e.field.type == "effect" ? (openBlock(), createElementBlock(Fragment, { key: 9 }, [
|
|
1695
|
-
createVNode(_sfc_main$r, {
|
|
1696
|
-
"model-value": unref(o),
|
|
1697
|
-
"onUpdate:modelValue": i,
|
|
1698
|
-
"can-set-auto-apply": e.field.property == "campaign.effect"
|
|
1699
|
-
}, null, 8, ["model-value", "can-set-auto-apply"]),
|
|
1700
|
-
unref(o) ? createCommentVNode("", !0) : (openBlock(), createBlock(f, {
|
|
1701
|
-
key: 0,
|
|
1702
|
-
class: "!mt-[8px]",
|
|
1703
|
-
text: unref(a)("connect.campaign.common.effect_required"),
|
|
1704
|
-
state: "error"
|
|
1705
|
-
}, null, 8, ["text"]))
|
|
1706
|
-
], 64)) : e.field.type === "message" ? (openBlock(), createBlock(_sfc_main$s, {
|
|
1707
|
-
key: 10,
|
|
1708
|
-
"allow-email": !0,
|
|
1709
|
-
"allow-whatsapp": !0,
|
|
1710
|
-
"model-value": unref(o),
|
|
1711
|
-
"onUpdate:modelValue": i,
|
|
1712
|
-
"helper-text": unref(ZodHelper).helperText(l(), ""),
|
|
1713
|
-
"trigger-type": e.field.extras,
|
|
1714
|
-
"helper-state": unref(ZodHelper).helperState(l(), "")
|
|
1715
|
-
}, null, 8, ["model-value", "helper-text", "trigger-type", "helper-state"])) : e.field.type === "earning_option" ? (openBlock(), createBlock(_sfc_main$l, {
|
|
1716
|
-
key: 11,
|
|
1717
|
-
"model-value": unref(o),
|
|
1718
|
-
"onUpdate:modelValue": i,
|
|
1719
|
-
extras: e.extras,
|
|
1720
|
-
"error-text": e.helperText
|
|
1721
|
-
}, null, 8, ["model-value", "extras", "error-text"])) : e.field.type === "validity_option" ? (openBlock(), createBlock(_sfc_main$m, {
|
|
1722
|
-
key: 12,
|
|
1723
|
-
type: "custom",
|
|
1724
|
-
"model-value": unref(o),
|
|
1725
|
-
"onUpdate:modelValue": i,
|
|
1726
|
-
"helper-text": e.helperText || unref(ZodHelper).helperText(l(), "")
|
|
1727
|
-
}, null, 8, ["model-value", "helper-text"])) : e.field.type === "game_type" ? (openBlock(), createBlock(_sfc_main$c, {
|
|
1728
|
-
key: 13,
|
|
1729
|
-
"model-value": unref(o),
|
|
1730
|
-
"onUpdate:modelValue": i
|
|
1731
|
-
}, null, 8, ["model-value"])) : e.field.type === "reward_pool" ? (openBlock(), createBlock(_sfc_main$a, {
|
|
1732
|
-
key: 14,
|
|
1733
|
-
"model-value": unref(o),
|
|
1734
|
-
"onUpdate:modelValue": i
|
|
1735
|
-
}, null, 8, ["model-value"])) : e.field.type === "mission" ? (openBlock(), createBlock(_sfc_main$3, {
|
|
1736
|
-
key: 15,
|
|
1737
|
-
"model-value": unref(o),
|
|
1738
|
-
"onUpdate:modelValue": i
|
|
1739
|
-
}, null, 8, ["model-value"])) : e.field.type === "mission_type" ? (openBlock(), createBlock(_sfc_main$8, {
|
|
1740
|
-
key: 16,
|
|
1741
|
-
"model-value": unref(o),
|
|
1742
|
-
"onUpdate:modelValue": i
|
|
1743
|
-
}, null, 8, ["model-value"])) : e.field.type === "mission_end" ? (openBlock(), createBlock(_sfc_main$7, {
|
|
1744
|
-
key: 17,
|
|
1745
|
-
"model-value": unref(o),
|
|
1746
|
-
"onUpdate:modelValue": i,
|
|
1747
|
-
"helper-text": unref(ZodHelper).helperText(l(), ""),
|
|
1748
|
-
"helper-state": unref(ZodHelper).helperState(l(), "")
|
|
1749
|
-
}, null, 8, ["model-value", "helper-text", "helper-state"])) : e.field.type === "mission_pool" ? (openBlock(), createBlock(_sfc_main$4, {
|
|
1750
|
-
key: 18,
|
|
1751
|
-
"model-value": unref(o),
|
|
1752
|
-
"onUpdate:modelValue": i,
|
|
1753
|
-
mission: e.extras.mission
|
|
1754
|
-
}, null, 8, ["model-value", "mission"])) : e.field.type === "rule_schedule" ? (openBlock(), createElementBlock(Fragment, { key: 19 }, [
|
|
1755
|
-
createVNode(_sfc_main$d, {
|
|
1756
|
-
"model-value": unref(o),
|
|
1757
|
-
"onUpdate:modelValue": i,
|
|
1758
|
-
"start-date": e.extras.start,
|
|
1759
|
-
"end-date": e.extras.end
|
|
1760
|
-
}, null, 8, ["model-value", "start-date", "end-date"]),
|
|
1761
|
-
e.helperText ? (openBlock(), createBlock(f, {
|
|
1762
|
-
key: 0,
|
|
1763
|
-
class: "!mt-[8px]",
|
|
1764
|
-
text: e.helperText,
|
|
1765
|
-
state: "error"
|
|
1766
|
-
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
1767
|
-
], 64)) : e.field.type === "rule_user" ? (openBlock(), createElementBlock(Fragment, { key: 20 }, [
|
|
1768
|
-
createVNode(_sfc_main$t, {
|
|
1769
|
-
"model-value": unref(o),
|
|
1770
|
-
"onUpdate:modelValue": i
|
|
1771
|
-
}, null, 8, ["model-value"]),
|
|
1772
|
-
e.helperText ? (openBlock(), createBlock(f, {
|
|
1773
|
-
key: 0,
|
|
1774
|
-
class: "!mt-[8px]",
|
|
1775
|
-
text: e.helperText,
|
|
1776
|
-
state: "error"
|
|
1777
|
-
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
1778
|
-
], 64)) : e.field.type === "rule_time" ? (openBlock(), createElementBlock(Fragment, { key: 21 }, [
|
|
1779
|
-
e.extras == "PROMOTION" && unref(RuleBuilder).getRules(unref(o).rules.g_time).length > 0 ? (openBlock(), createBlock(f, {
|
|
1780
|
-
key: 0,
|
|
1781
|
-
state: "warning",
|
|
1782
|
-
text: `Time based rule only work for POS >= v${unref(featureVersionMapping).TIME_BASED_PROMOTION}`
|
|
1783
|
-
}, null, 8, ["text"])) : createCommentVNode("", !0),
|
|
1784
|
-
createVNode(_sfc_main$i, {
|
|
1785
|
-
"model-value": unref(o),
|
|
1786
|
-
"onUpdate:modelValue": i
|
|
1787
|
-
}, null, 8, ["model-value"]),
|
|
1788
|
-
e.helperText ? (openBlock(), createBlock(f, {
|
|
1789
|
-
key: 1,
|
|
1790
|
-
class: "!mt-[8px]",
|
|
1791
|
-
text: e.helperText,
|
|
1792
|
-
state: "error"
|
|
1793
|
-
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
1794
|
-
], 64)) : e.field.type === "rule_bill" ? (openBlock(), createElementBlock(Fragment, { key: 22 }, [
|
|
1795
|
-
createVNode(_sfc_main$u, {
|
|
1796
|
-
"model-value": unref(o),
|
|
1797
|
-
"onUpdate:modelValue": i
|
|
1798
|
-
}, null, 8, ["model-value"]),
|
|
1799
|
-
e.helperText ? (openBlock(), createBlock(f, {
|
|
1800
|
-
key: 0,
|
|
1801
|
-
class: "!mt-[8px]",
|
|
1802
|
-
text: e.helperText,
|
|
1803
|
-
state: "error"
|
|
1804
|
-
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
1805
|
-
], 64)) : e.field.type === "rule_feedback" ? (openBlock(), createElementBlock(Fragment, { key: 23 }, [
|
|
1806
|
-
createVNode(_sfc_main$v, {
|
|
1807
|
-
"model-value": unref(o),
|
|
1808
|
-
"onUpdate:modelValue": i
|
|
1809
|
-
}, null, 8, ["model-value"]),
|
|
1810
|
-
e.helperText ? (openBlock(), createBlock(f, {
|
|
1811
|
-
key: 0,
|
|
1812
|
-
class: "!mt-[8px]",
|
|
1813
|
-
text: e.helperText,
|
|
1814
|
-
state: "error"
|
|
1815
|
-
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
1816
|
-
], 64)) : e.field.type === "rule_birthday" ? (openBlock(), createElementBlock(Fragment, { key: 24 }, [
|
|
1817
|
-
createVNode(_sfc_main$h, {
|
|
1818
|
-
"model-value": unref(o),
|
|
1819
|
-
"onUpdate:modelValue": i
|
|
1820
|
-
}, null, 8, ["model-value"]),
|
|
1821
|
-
e.helperText ? (openBlock(), createBlock(f, {
|
|
1822
|
-
key: 0,
|
|
1823
|
-
class: "!mt-[8px]",
|
|
1824
|
-
text: e.helperText,
|
|
1825
|
-
state: "error"
|
|
1826
|
-
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
1827
|
-
], 64)) : e.field.type === "promotion_game_type" ? (openBlock(), createElementBlock(Fragment, { key: 25 }, [
|
|
1828
|
-
createVNode(_sfc_main$9, {
|
|
1829
|
-
"model-value": unref(o),
|
|
1830
|
-
"onUpdate:modelValue": i
|
|
1831
|
-
}, null, 8, ["model-value"]),
|
|
1832
|
-
e.helperText ? (openBlock(), createBlock(f, {
|
|
1833
|
-
key: 0,
|
|
1834
|
-
class: "!mt-[8px]",
|
|
1835
|
-
text: e.helperText,
|
|
1836
|
-
state: "error"
|
|
1837
|
-
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
1838
|
-
], 64)) : (openBlock(), createElementBlock("pre", _hoisted_1$2, toDisplayString(s.field), 1));
|
|
1839
|
-
};
|
|
1840
|
-
}
|
|
1841
|
-
}), _hoisted_1$1 = { class: "fm-typo-en-body-lg-600" }, _hoisted_2$1 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_3$1 = { class: "fm-typo-en-body-lg-600" }, _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
1842
|
-
__name: "CampaignSummary",
|
|
1843
|
-
props: {
|
|
1844
|
-
data: {
|
|
1845
|
-
type: Object,
|
|
1846
|
-
required: !0
|
|
1847
|
-
}
|
|
1848
|
-
},
|
|
1849
|
-
setup(e) {
|
|
1850
|
-
const { t: d, te: a } = useI18n();
|
|
1851
|
-
return (s, u) => {
|
|
1852
|
-
const i = resolveComponent("FmCard");
|
|
1853
|
-
return openBlock(), createBlock(i, {
|
|
1854
|
-
variant: "outlined",
|
|
1855
|
-
class: "p-16 space-y-8"
|
|
1856
|
-
}, {
|
|
1857
|
-
default: withCtx(() => [
|
|
1858
|
-
createElementVNode("div", _hoisted_1$1, toDisplayString(unref(d)("connect.campaign.common.summary")), 1),
|
|
1859
|
-
u[0] || (u[0] = createElementVNode("div", { class: "h-[1px] bg-fm-color-neutral-gray-100 w-full" }, null, -1)),
|
|
1860
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(getCampaignSummaryObject)(e.data), (o, l) => (openBlock(), createElementBlock("div", {
|
|
1861
|
-
class: "space-y-4",
|
|
1862
|
-
key: l
|
|
1863
|
-
}, [
|
|
1864
|
-
o ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
1865
|
-
createElementVNode("div", _hoisted_2$1, toDisplayString(unref(d)(`${l}`)), 1),
|
|
1866
|
-
createElementVNode("div", _hoisted_3$1, toDisplayString(unref(a)(`${o}`) ? unref(d)(`${o}`) : o), 1)
|
|
1867
|
-
], 64)) : createCommentVNode("", !0)
|
|
1868
|
-
]))), 128))
|
|
1869
|
-
]),
|
|
1870
|
-
_: 1
|
|
1871
|
-
});
|
|
1872
|
-
};
|
|
1873
|
-
}
|
|
1874
|
-
}), _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 = {
|
|
1875
|
-
key: 0,
|
|
1876
|
-
class: "max-w-6xl mx-auto"
|
|
1877
|
-
}, _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-[-8px]" }, _hoisted_8 = { class: "w-full flex items-center justify-end gap-8 pb-24" }, _hoisted_9 = { class: "max-w-6xl mx-auto rounded-md p-4 w-full" }, _hoisted_10 = { class: "animate-pulse flex space-x-4 pt-16" }, _hoisted_11 = { class: "grid grid-cols-3 w-full gap-40" }, _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1878
|
-
__name: "EditCampaignSheet",
|
|
1879
|
-
emits: ["submit:model-value"],
|
|
1880
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
1881
|
-
const Dialog = useDialog(), sheetVisible = ref(!1), { t } = useI18n(), currentStep = ref(1), data = ref(), schema = ref(z.any()), template = ref(
|
|
1882
|
-
TEMPLATES.VOUCHER
|
|
1883
|
-
), { minor } = useLoading, isLoading = ref(!1), sheetTitle = ref("Create Campaign");
|
|
1884
|
-
async function showSheet(visible, type, campaign, selectedTemplate) {
|
|
1885
|
-
var e, d;
|
|
1886
|
-
if (sheetVisible.value = visible, visible == !0) {
|
|
1887
|
-
try {
|
|
1888
|
-
isLoading.value = visible, await useMembershipStore().readRewards(), await useBusinessStore().readLocations(), await useMembershipStore().readSegments(), await useMembershipStore().readMembership();
|
|
1889
|
-
} catch {
|
|
1890
|
-
} finally {
|
|
1891
|
-
await new Promise((a) => setTimeout(a, 120)), isLoading.value = !1;
|
|
1892
|
-
}
|
|
1893
|
-
template.value = selectedTemplate ?? TEMPLATES[type], schema.value = CampaignDtos[type], type === "VOUCHER" && (await useCampaignStore().read(), schema.value = schema.value.superRefine((a, s) => {
|
|
1894
|
-
a.campaign.type === "VOUCHER" && a.campaign.code && useCampaignStore().campaigns.voucher.some(
|
|
1895
|
-
(u) => u.code === a.campaign.code && u._id.toString() !== a.campaign._id.toString()
|
|
1896
|
-
) && s.addIssue({
|
|
1897
|
-
code: "custom",
|
|
1898
|
-
message: "Code already exists, please use another code",
|
|
1899
|
-
path: ["campaign", "code"]
|
|
1900
|
-
});
|
|
1901
|
-
})), data.value = campaign != null ? { ...campaign, templateId: (e = campaign.template) == null ? void 0 : e._id } : _.cloneDeep({
|
|
1902
|
-
...(d = template.value) == null ? void 0 : d.defaultValue
|
|
1903
|
-
}), "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`;
|
|
1904
|
-
}
|
|
1905
|
-
}
|
|
1906
|
-
async function hideSheet() {
|
|
1907
|
-
Dialog.open({
|
|
1908
|
-
title: t("connect.campaign.common.unsaved_changes"),
|
|
1909
|
-
message: t("connect.campaign.common.unsaved_changes"),
|
|
1910
|
-
primaryActions: {
|
|
1911
|
-
text: t("connect.campaign.common.unsaved_changes_confirm"),
|
|
1912
|
-
close: !0
|
|
1913
|
-
},
|
|
1914
|
-
secondaryActions: {
|
|
1915
|
-
text: t("connect.campaign.common.unsaved_changes_cancel"),
|
|
1916
|
-
close: !1
|
|
1917
|
-
}
|
|
1918
|
-
}).onPrimary(() => {
|
|
1919
|
-
sheetVisible.value = !1;
|
|
1920
|
-
}).onSecondary(() => {
|
|
1921
|
-
Dialog.close();
|
|
1922
|
-
});
|
|
1923
|
-
}
|
|
1924
|
-
const emits = __emit, errors = computed(() => {
|
|
1925
|
-
const e = schema.value.superRefine(campaignRefinement).safeParse(data.value);
|
|
1926
|
-
return e.success ? [] : e.error.errors;
|
|
1927
|
-
});
|
|
1928
|
-
function stepErrors(e = currentStep.value - 1) {
|
|
1929
|
-
const d = template.value.steps[e].groups.flatMap(
|
|
1930
|
-
(a) => a.fields.map((s) => s.property)
|
|
1931
|
-
);
|
|
1932
|
-
return errors.value.filter(
|
|
1933
|
-
(a) => d.some((s) => a.path.join(".").includes(s))
|
|
1934
|
-
);
|
|
1935
|
-
}
|
|
1936
|
-
__expose({ showSheet });
|
|
1937
|
-
function showSummaryDialog() {
|
|
1938
|
-
Dialog.open({
|
|
1939
|
-
title: "",
|
|
1940
|
-
dialogComponent: _sfc_main$1,
|
|
1941
|
-
dialogComponentProps: {
|
|
1942
|
-
data: data.value
|
|
1943
|
-
}
|
|
1944
|
-
});
|
|
1945
|
-
}
|
|
1946
|
-
function onUpdateProperty(e, d) {
|
|
1947
|
-
var a, s, u, i, o, l, n, m;
|
|
1948
|
-
if (_.set(data.value, e, d), e == "campaign.event.type") {
|
|
1949
|
-
const y = ((i = (u = (s = (a = template.value) == null ? void 0 : a.defaultValue) == null ? void 0 : s.campaign) == null ? void 0 : u.event) == null ? void 0 : i.rule) ? _.cloneDeep({
|
|
1950
|
-
...(m = (n = (l = (o = template.value) == null ? void 0 : o.defaultValue) == null ? void 0 : l.campaign) == null ? void 0 : n.event) == null ? void 0 : m.rule
|
|
1951
|
-
}) : RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup(), [
|
|
1952
|
-
RuleBuilder.scaffoldGroup("g_schedule"),
|
|
1953
|
-
RuleBuilder.scaffoldGroup("g_time"),
|
|
1954
|
-
RuleBuilder.scaffoldGroup("g_user"),
|
|
1955
|
-
RuleBuilder.scaffoldGroup("g_bill")
|
|
1956
|
-
]), v = RuleBuilder.setRuleToGroup(
|
|
1957
|
-
RuleBuilder.scaffoldGroup("g_schedule"),
|
|
1958
|
-
[
|
|
1959
|
-
RuleBuilder.constructEntry(
|
|
1960
|
-
"trigger.date",
|
|
1961
|
-
"_rrule",
|
|
1962
|
-
"RRULE:FREQ=DAILY;INTERVAL=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0;WKST=SU"
|
|
1963
|
-
),
|
|
1964
|
-
RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
|
|
1965
|
-
],
|
|
1966
|
-
"&&"
|
|
1967
|
-
);
|
|
1968
|
-
if (d != "SCHEDULE") {
|
|
1969
|
-
_.set(data.value, "campaign.event.rule", y);
|
|
1970
|
-
return;
|
|
1971
|
-
}
|
|
1972
|
-
_.set(
|
|
1973
|
-
data.value,
|
|
1974
|
-
"campaign.event.rule",
|
|
1975
|
-
RuleBuilder.setRuleToGroup(y, v)
|
|
1976
|
-
);
|
|
1977
|
-
}
|
|
1978
|
-
e == "campaign.notify" && d == !1 && _.set(data.value, "campaign.notifyMessage", void 0);
|
|
1979
|
-
}
|
|
1980
|
-
async function onUpdateFile(e, d) {
|
|
1981
|
-
return e ? await minor(async () => firebaseStorage.update(d, e), {
|
|
1982
|
-
message: `${e ? "Uploading" : "Removing"} file`,
|
|
1983
|
-
successMessage: `File ${e ? "uploaded" : "removed"} successfully`
|
|
1984
|
-
}) : "";
|
|
1985
|
-
}
|
|
1986
|
-
function isDisable(e) {
|
|
1987
|
-
var d, a;
|
|
1988
|
-
switch (e == null ? void 0 : e.property) {
|
|
1989
|
-
case "campaign.event.type":
|
|
1990
|
-
return ((a = (d = data.value) == null ? void 0 : d.campaign) == null ? void 0 : a._id) || !1;
|
|
1991
|
-
default:
|
|
1992
|
-
return !1;
|
|
1993
|
-
}
|
|
1994
|
-
}
|
|
1995
|
-
function onSubmit() {
|
|
1996
|
-
const e = schema.value.superRefine(campaignRefinement).transform(campaignTransform).safeParse(data.value);
|
|
1997
|
-
e.success && (emits("submit:model-value", cleanPF(JSON.parse(JSON.stringify(e.data)))), sheetVisible.value = !1);
|
|
1998
|
-
}
|
|
1999
|
-
return (e, d) => {
|
|
2000
|
-
const a = resolveComponent("FmButton"), s = resolveComponent("FmStep"), u = resolveComponent("FmStepper"), i = resolveComponent("FmCard"), o = resolveComponent("FmTopSheet");
|
|
2001
|
-
return openBlock(), createBlock(o, {
|
|
2002
|
-
"fullscreen-size": "lg",
|
|
2003
|
-
modelValue: unref(sheetVisible),
|
|
2004
|
-
"onUpdate:modelValue": [
|
|
2005
|
-
d[7] || (d[7] = (l) => isRef(sheetVisible) ? sheetVisible.value = l : null),
|
|
2006
|
-
d[8] || (d[8] = (l) => sheetVisible.value = l)
|
|
2007
|
-
]
|
|
2008
|
-
}, createSlots({
|
|
2009
|
-
"top-sheet-header": withCtx(() => [
|
|
2010
|
-
createElementVNode("div", _hoisted_1, [
|
|
2011
|
-
createElementVNode("div", null, toDisplayString(unref(sheetTitle)), 1),
|
|
2012
|
-
createElementVNode("div", _hoisted_2, [
|
|
2013
|
-
createVNode(a, {
|
|
2014
|
-
onClick: d[0] || (d[0] = (l) => hideSheet()),
|
|
2015
|
-
label: unref(t)("connect.campaign.common.cancel"),
|
|
2016
|
-
variant: "tertiary"
|
|
2017
|
-
}, null, 8, ["label"]),
|
|
2018
|
-
createVNode(a, {
|
|
2019
|
-
onClick: onSubmit,
|
|
2020
|
-
label: unref(t)("connect.campaign.common.save"),
|
|
2021
|
-
disabled: unref(errors).length > 0
|
|
2022
|
-
}, null, 8, ["label", "disabled"])
|
|
2023
|
-
])
|
|
2024
|
-
])
|
|
2025
|
-
]),
|
|
2026
|
-
_: 2
|
|
2027
|
-
}, [
|
|
2028
|
-
unref(isLoading) ? {
|
|
2029
|
-
name: "default",
|
|
2030
|
-
fn: withCtx(() => [
|
|
2031
|
-
createElementVNode("div", _hoisted_9, [
|
|
2032
|
-
createElementVNode("div", _hoisted_10, [
|
|
2033
|
-
createElementVNode("div", _hoisted_11, [
|
|
2034
|
-
d[9] || (d[9] = createElementVNode("div", { class: "col-span-2 space-y-80 xs:col-span-3 xs:px-16 xs:pt-16" }, [
|
|
2035
|
-
createElementVNode("div", { class: "flex-1 space-y-6 py-1" }, [
|
|
2036
|
-
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100 rounded" }),
|
|
2037
|
-
createElementVNode("div", { class: "h-[80px] bg-fm-color-neutral-gray-100 rounded" }),
|
|
2038
|
-
createElementVNode("div", { class: "space-y-3" }, [
|
|
2039
|
-
createElementVNode("div", { class: "grid grid-cols-2 gap-4" }, [
|
|
2040
|
-
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" }),
|
|
2041
|
-
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
|
|
2042
|
-
]),
|
|
2043
|
-
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
|
|
2044
|
-
]),
|
|
2045
|
-
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100 rounded" }),
|
|
2046
|
-
createElementVNode("div", { class: "h-[80px] bg-fm-color-neutral-gray-100 rounded" }),
|
|
2047
|
-
createElementVNode("div", { class: "space-y-3" }, [
|
|
2048
|
-
createElementVNode("div", { class: "grid grid-cols-2 gap-4" }, [
|
|
2049
|
-
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" }),
|
|
2050
|
-
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
|
|
2051
|
-
]),
|
|
2052
|
-
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
|
|
2053
|
-
])
|
|
2054
|
-
])
|
|
2055
|
-
], -1)),
|
|
2056
|
-
createVNode(i, { class: "h-[150px] bg-fm-color-neutral-gray-100" })
|
|
2057
|
-
])
|
|
2058
|
-
])
|
|
2059
|
-
])
|
|
2060
|
-
]),
|
|
2061
|
-
key: "1"
|
|
2062
|
-
} : {
|
|
2063
|
-
name: "default",
|
|
2064
|
-
fn: withCtx(() => [
|
|
2065
|
-
unref(data) ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
2066
|
-
createVNode(u, {
|
|
2067
|
-
modelValue: unref(currentStep),
|
|
2068
|
-
"onUpdate:modelValue": d[1] || (d[1] = (l) => isRef(currentStep) ? currentStep.value = l : null),
|
|
2069
|
-
orientation: "horizontal",
|
|
2070
|
-
class: "xs:hidden mx-[-24px] mt-16 mb-24 flex-1"
|
|
2071
|
-
}, {
|
|
2072
|
-
default: withCtx(() => [
|
|
2073
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps, (l, n) => (openBlock(), createBlock(s, {
|
|
2074
|
-
key: l.name,
|
|
2075
|
-
title: unref(t)(l.name),
|
|
2076
|
-
value: n + 1,
|
|
2077
|
-
error: () => stepErrors(n).length > 0,
|
|
2078
|
-
complete: () => n + 1 <= unref(currentStep)
|
|
2079
|
-
}, null, 8, ["title", "value", "error", "complete"]))), 128))
|
|
2080
|
-
]),
|
|
2081
|
-
_: 1
|
|
2082
|
-
}, 8, ["modelValue"]),
|
|
2083
|
-
createElementVNode("div", _hoisted_4, [
|
|
2084
|
-
createVNode(a, {
|
|
2085
|
-
icon: "close",
|
|
2086
|
-
variant: "tertiary",
|
|
2087
|
-
onClick: d[2] || (d[2] = (l) => sheetVisible.value = !1)
|
|
2088
|
-
}),
|
|
2089
|
-
createVNode(u, {
|
|
2090
|
-
modelValue: unref(currentStep),
|
|
2091
|
-
"onUpdate:modelValue": d[3] || (d[3] = (l) => isRef(currentStep) ? currentStep.value = l : null),
|
|
2092
|
-
orientation: "horizontal",
|
|
2093
|
-
class: "flex-1"
|
|
2094
|
-
}, {
|
|
2095
|
-
default: withCtx(() => [
|
|
2096
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps, (l, n) => (openBlock(), createBlock(s, {
|
|
2097
|
-
key: l.name,
|
|
2098
|
-
title: unref(sheetTitle),
|
|
2099
|
-
description: unref(t)(l.name),
|
|
2100
|
-
value: n + 1,
|
|
2101
|
-
error: () => stepErrors(n).length > 0,
|
|
2102
|
-
complete: () => n + 1 <= unref(currentStep) && stepErrors(unref(currentStep) - 1).length == 0
|
|
2103
|
-
}, null, 8, ["title", "description", "value", "error", "complete"]))), 128))
|
|
2104
|
-
]),
|
|
2105
|
-
_: 1
|
|
2106
|
-
}, 8, ["modelValue"]),
|
|
2107
|
-
createVNode(a, {
|
|
2108
|
-
icon: "info",
|
|
2109
|
-
variant: "tertiary",
|
|
2110
|
-
onClick: d[4] || (d[4] = () => showSummaryDialog())
|
|
2111
|
-
})
|
|
2112
|
-
]),
|
|
2113
|
-
createElementVNode("div", _hoisted_5, [
|
|
2114
|
-
createElementVNode("div", _hoisted_6, [
|
|
2115
|
-
createVNode(JsonViewer, {
|
|
2116
|
-
json: {
|
|
2117
|
-
data: unref(data),
|
|
2118
|
-
errors: unref(errors).map(
|
|
2119
|
-
(l) => `${l.path.join(".")} - ${l.message}`
|
|
2120
|
-
),
|
|
2121
|
-
stepErrors: stepErrors().map(
|
|
2122
|
-
(l) => `${l.path.join(".")} - ${l.message}`
|
|
2123
|
-
),
|
|
2124
|
-
schema: unref(schema)
|
|
2125
|
-
}
|
|
2126
|
-
}, null, 8, ["json"]),
|
|
2127
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps[unref(currentStep) - 1].groups.filter(
|
|
2128
|
-
(l) => l.fields.length && (!l.condition || unref(_).get(unref(data), l.condition.property) == l.condition.value == (l.condition.not != !0))
|
|
2129
|
-
), (l, n) => (openBlock(), createElementBlock("div", {
|
|
2130
|
-
key: n,
|
|
2131
|
-
class: "space-y-24"
|
|
2132
|
-
}, [
|
|
2133
|
-
createElementVNode("div", _hoisted_7, toDisplayString(l.name ? unref(t)(l.name) : ""), 1),
|
|
2134
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(l.fields, (m, g) => (openBlock(), createElementBlock("div", { key: g }, [
|
|
2135
|
-
(openBlock(), createBlock(_sfc_main$2, {
|
|
2136
|
-
key: g,
|
|
2137
|
-
field: m,
|
|
2138
|
-
modelValue: unref(_).get(unref(data), m.property),
|
|
2139
|
-
disabled: isDisable(m),
|
|
2140
|
-
"onUpdate:modelValue": (y) => onUpdateProperty(m.property, y),
|
|
2141
|
-
"onUpdate:file": async (y, v) => {
|
|
2142
|
-
const h = await onUpdateFile(y, v);
|
|
2143
|
-
onUpdateProperty(m.property, h || "");
|
|
2144
|
-
},
|
|
2145
|
-
schema: unref(ZodHelper).typeAtPath(
|
|
2146
|
-
unref(schema),
|
|
2147
|
-
m.property,
|
|
2148
|
-
unref(data).campaign.type != "MISSION" ? [unref(data).campaign.type] : ["STAMP", "MISSION"]
|
|
2149
|
-
),
|
|
2150
|
-
"helper-state": unref(ZodHelper).helperState(unref(errors), m.property),
|
|
2151
|
-
"helper-text": unref(ZodHelper).helperText(unref(errors), m.property),
|
|
2152
|
-
extras: m.extras != null ? m.extras == "" ? unref(data) : unref(_).get(unref(data), m.extras) : void 0
|
|
2153
|
-
}, null, 8, ["field", "modelValue", "disabled", "onUpdate:modelValue", "onUpdate:file", "schema", "helper-state", "helper-text", "extras"]))
|
|
2154
|
-
]))), 128))
|
|
2155
|
-
]))), 128)),
|
|
2156
|
-
createElementVNode("div", _hoisted_8, [
|
|
2157
|
-
createVNode(a, {
|
|
2158
|
-
label: "Back",
|
|
2159
|
-
variant: "tertiary",
|
|
2160
|
-
disabled: unref(currentStep) == 1,
|
|
2161
|
-
onClick: d[5] || (d[5] = (l) => currentStep.value--)
|
|
2162
|
-
}, null, 8, ["disabled"]),
|
|
2163
|
-
createVNode(a, {
|
|
2164
|
-
disabled: unref(currentStep) - 1 < unref(template).steps.length - 1 ? stepErrors().length > 0 : unref(errors).length > 0,
|
|
2165
|
-
label: unref(currentStep) - 1 < unref(template).steps.length - 1 ? "Next" : "Submit",
|
|
2166
|
-
onClick: d[6] || (d[6] = (l) => unref(currentStep) - 1 < unref(template).steps.length - 1 ? currentStep.value++ : onSubmit())
|
|
2167
|
-
}, null, 8, ["disabled", "label"])
|
|
2168
|
-
])
|
|
2169
|
-
]),
|
|
2170
|
-
createVNode(_sfc_main$1, {
|
|
2171
|
-
data: unref(data),
|
|
2172
|
-
class: "xs:hidden"
|
|
2173
|
-
}, null, 8, ["data"])
|
|
2174
|
-
])
|
|
2175
|
-
])) : createCommentVNode("", !0)
|
|
2176
|
-
]),
|
|
2177
|
-
key: "0"
|
|
2178
|
-
}
|
|
2179
|
-
]), 1032, ["modelValue"]);
|
|
2180
|
-
};
|
|
2181
|
-
}
|
|
2182
|
-
});
|
|
2183
|
-
export {
|
|
2184
|
-
_sfc_main as _
|
|
2185
|
-
};
|