@feedmepos/mf-connect 0.1.38-beta.21 → 0.1.38-beta.23
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-CEd_WApy.js → Analytic-xMxbAEul.js} +13 -13
- package/dist/{App-ulCtuU5o.js → App-DkBJoQa2.js} +303 -307
- package/dist/{AuditLogs-BM1Np61K.js → AuditLogs-CkpffM8N.js} +9 -9
- package/dist/{Bin-icbjnKXw.js → Bin-D3JHC66F.js} +8 -8
- package/dist/{Broadcast-COQ3E8vI.js → Broadcast-eCxNA0EG.js} +9 -9
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BbXEYOFK.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BMrLc0hX.js} +6 -6
- package/dist/{Card-Cwh3GXi0.js → Card-CaOvpWvL.js} +16 -16
- package/dist/{Collections-EuOjzpkL.js → Collections-CxScAHZl.js} +6 -6
- package/dist/{Credit-BY2Fpdhh.js → Credit-BnPpMq8q.js} +9 -9
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-BEnaGmCW.js +3109 -0
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-BLw3-hI1.js → EffectSheet.vue_vue_type_style_index_0_lang-DJhtUAk_.js} +6 -6
- package/dist/{Experience-rAH7zk71.js → Experience-nMxubr1P.js} +9 -9
- package/dist/{Game-DlI0yNF0.js → Game-C8pHAp1o.js} +10 -10
- package/dist/Grab-DjTma0rb.js +282 -0
- package/dist/{Index-DemXFS3d.js → Index-COHMtBIi.js} +10 -10
- package/dist/{Marketing-shNBO9Rc.js → Marketing-C3R9Rw4y.js} +7112 -5424
- package/dist/{Member-C19ZgpaL.js → Member-gjwH9kPr.js} +10 -10
- package/dist/{MemberList-B2tNB4yg.js → MemberList-Bg_zsGbz.js} +25 -25
- package/dist/{MemberTransactions-BN3qaTVY.js → MemberTransactions-7aZsIeZL.js} +1 -1
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-BY3j1h72.js → MessageInput.vue_vue_type_script_setup_true_lang-DtPV3l4w.js} +2285 -2219
- package/dist/{Mission-j1KI0-hJ.js → Mission-DqAahrB0.js} +10 -10
- package/dist/{Overview-BN2Vdu8Q.js → Overview-_b_4mLBe.js} +18 -18
- package/dist/{Point-8zy7QcTk.js → Point-CsMZA2do.js} +9 -9
- package/dist/{Promotion-mcUcylXB.js → Promotion-j4_gUzqi.js} +10 -10
- package/dist/{Queue-BsNv4P8u.js → Queue-MOdvEl5u.js} +10 -10
- package/dist/{Record-VA6Bdlnz.js → Record-BQIQBdc6.js} +8 -8
- package/dist/{Reward-CVyO3Ga1.js → Reward-DABAfCmo.js} +15 -15
- package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-BR9_a9bJ.js → RewardGroup.vue_vue_type_script_setup_true_lang-D-BK8GZ4.js} +11 -11
- package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-Dhs2whAH.js → RuleGroup.vue_vue_type_script_setup_true_lang-ClwtUvs9.js} +13 -13
- package/dist/{Segment-BMgcdIIS.js → Segment-DSpcce-q.js} +22 -22
- package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-CKRpWcn_.js → SelectItems.vue_vue_type_script_setup_true_lang-CZu-7I-8.js} +2 -2
- package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-DZCNcdVW.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-D5Oc0pqy.js} +11 -11
- package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-BESF672g.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-7NWmWQjo.js} +3 -3
- package/dist/{Setting-BMKKkZTD.js → Setting-DTFpHJd7.js} +11 -11
- package/dist/{Store-DdxMDtfL.js → Store-mAraPykq.js} +19 -19
- package/dist/{StoreRewards-CRyeHEMF.js → StoreRewards-C1Cw1Nij.js} +13 -13
- package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-DS6-9WP9.js → StoreTransactions.vue_vue_type_script_setup_true_lang-C_igl8vi.js} +20 -20
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-BTKpclKX.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-D3c0qO9i.js} +1 -1
- package/dist/{Tier-D5Xmp5vV.js → Tier-B7AUECOs.js} +20 -20
- package/dist/{Title-CsK2crqD.js → Title-DWw4-4cE.js} +19 -19
- package/dist/{Transaction-Dvfc9x4f.js → Transaction-ClZvbeDP.js} +2 -2
- package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-CqCxWltm.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-Cen_yXF7.js} +6 -6
- package/dist/{Voucher-CPN7TMho.js → Voucher-BBYDF1GX.js} +13 -13
- package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-DMye9MS3.js → VoucherEditor.vue_vue_type_script_setup_true_lang-Vscwqd3r.js} +10 -10
- package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-CnaQAEKo.js → ZodTextField.vue_vue_type_script_setup_true_lang-C2yUE0Cq.js} +1 -1
- package/dist/{app-DRBevJsF.js → app-9boJd9tw.js} +1 -1
- package/dist/{app-DteFjR9L.js → app-DLdolyB3.js} +740 -676
- package/dist/app.js +1 -1
- package/dist/{business-BqV9jK-p.js → business-D900a5Tb.js} +1 -1
- package/dist/{campaign-CsWoG6e_.js → campaign-DXo7F7aH.js} +29 -25
- package/dist/{campaign-BHDq-yx-.js → campaign-D_F3xj3O.js} +27 -14
- package/dist/{campaign.enum-Dfa96W5V.js → campaign.enum-CG0IjpL0.js} +3 -2
- package/dist/{campaign.fn-pLrwyHA_.js → campaign.fn-B6f4zAed.js} +37 -37
- package/dist/{collectible.enum-BYTYWPsR.js → collectible.enum-0jg7mZtz.js} +1 -1
- package/dist/{collection.fn-CYLIQJig.js → collection.fn-BDcZoQfR.js} +2 -2
- package/dist/{dto-DBfDbpyb.js → dto-Diu2Xl3e.js} +51 -39
- package/dist/{effect-D9pD5RCk.js → effect-DvIk5Cg6.js} +1 -1
- package/dist/{email-addresses-BApvdLkQ.js → email-addresses-DQf3ZdZP.js} +1 -1
- package/dist/{export--EfmCiw0.js → export-WSVAzeqR.js} +3 -3
- package/dist/{helper-BHiK3pLT.js → helper-CzsKE573.js} +1 -1
- package/dist/{index-CD2bkLo_.js → index-1-H1oqKb.js} +1 -1
- package/dist/{index-B9_Tn8si.js → index-B6Kbxgky.js} +1 -1
- package/dist/{index-DXM3o6kl.js → index-B6KkRHaV.js} +1 -1
- package/dist/{index-DYgdunxw.js → index-Bej-AJUB.js} +3 -3
- package/dist/{index-C1Vrltkc.js → index-CErvxcDp.js} +1 -1
- package/dist/{index-Bqc7PV3K.js → index-D-VZHYyP.js} +1 -1
- package/dist/{index-CVxruvVB.js → index-D1fzmeG6.js} +3 -3
- package/dist/{index-Pd9RCQxn.js → index-D3wppWii.js} +1 -1
- package/dist/{index-COiVJ9pA.js → index-DMg2pJLu.js} +1 -1
- package/dist/{index-qd_dvZcw.js → index-DPyNXHg6.js} +16 -16
- package/dist/{index-Cc80pBYX.js → index-DWN3abQr.js} +573 -573
- package/dist/{index-CDLBLuYq.js → index-DlwPVNEv.js} +845 -708
- package/dist/{index-2dknXEFJ.js → index-__X1c_dR.js} +184 -15
- package/dist/{index-BSQXDDQY.js → index-uJ-YdKV1.js} +3 -3
- package/dist/{index.esm2017-DAWS_ALH.js → index.esm2017-shNT9EQF.js} +1 -1
- package/dist/{loading-BVUeda4s.js → loading-CBKMbqM5.js} +1 -1
- package/dist/{membership-BL_43RJR.js → membership-DQa8yaY2.js} +3 -3
- package/dist/{money-Cd8hLiNc.js → money-IYgOL6F1.js} +1 -1
- package/dist/{number-DVb8PSrj.js → number-DXdhRp2S.js} +1 -1
- package/dist/{objectid-D33s3gxp.js → objectid-DABStWGB.js} +5 -5
- package/dist/{plugins-BKtBkC9Q.js → plugins-DXwZ_v63.js} +2 -2
- package/dist/{reward-f41dJcaL.js → reward-DYiYZcJC.js} +1 -1
- package/dist/{rule-Cbux1-fC.js → rule-Beum_Zy5.js} +3 -3
- package/dist/{rule-builder-BrZeF45Z.js → rule-builder-BLNgIsjE.js} +12 -10
- package/dist/style.css +1 -1
- package/dist/{template-tqhgmIdT.js → template-C5PTDFfm.js} +4 -4
- package/dist/{timezone-DaTVH4y0.js → timezone-PLVeOMdC.js} +1 -1
- package/dist/{trigger-C34RfwrT.js → trigger-B0u2ZuY-.js} +4 -4
- package/dist/{user-DgKhDLYr.js → user-BlM3HCwC.js} +1 -1
- package/dist/{vue-i18n-xo56wiwi.js → vue-i18n-CwrnHMwQ.js} +246 -246
- package/dist/{xlsx-D8ZZRjtf.js → xlsx-BAbyCaI0.js} +1 -1
- package/package.json +1 -1
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-BbsLgUMQ.js +0 -2188
- package/dist/remy-vue-client-Cpppk9h-.js +0 -1693
|
@@ -0,0 +1,3109 @@
|
|
|
1
|
+
import { defineComponent, ref, watch, resolveComponent, openBlock, createElementBlock, createElementVNode, createVNode, createCommentVNode, computed, onMounted, toDisplayString, createBlock, withCtx, Fragment, renderList, withModifiers, unref, isRef, createTextVNode, normalizeClass, resolveDynamicComponent, toRefs, normalizeStyle, createSlots } from "vue";
|
|
2
|
+
import { _ } from "./lodash-B5I3zXaY.js";
|
|
3
|
+
import { z } from "./app-DLdolyB3.js";
|
|
4
|
+
import { Z as ZodHelper } from "./zod-Bg2FbC-D.js";
|
|
5
|
+
import { c as getCampaignSummaryObject, C as CampaignOptions } from "./campaign-D_F3xj3O.js";
|
|
6
|
+
import { c as campaignRefinement, C as CampaignDtos, a as campaignTransform } from "./dto-Diu2Xl3e.js";
|
|
7
|
+
import { u as useMembershipStore } from "./membership-DQa8yaY2.js";
|
|
8
|
+
import { u as useBusinessStore } from "./business-D900a5Tb.js";
|
|
9
|
+
import "./index-DPyNXHg6.js";
|
|
10
|
+
import { R as RuleBuilder, a as isRuleEntry } from "./rule-builder-BLNgIsjE.js";
|
|
11
|
+
import { J as JsonViewer } from "./JsonViewer-v8_C7l5N.js";
|
|
12
|
+
import { h as hooks } from "./moment-D7p2TMB-.js";
|
|
13
|
+
import { f as featureVersionMapping } from "./campaign.enum-CG0IjpL0.js";
|
|
14
|
+
import { _ as _sfc_main$u } from "./ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js";
|
|
15
|
+
import { b as _sfc_main$s, a as _sfc_main$v, _ as _sfc_main$x } from "./EffectSheet.vue_vue_type_style_index_0_lang-DJhtUAk_.js";
|
|
16
|
+
import { _ as _sfc_main$w } from "./TargetLocationInput.vue_vue_type_script_setup_true_lang-D3c0qO9i.js";
|
|
17
|
+
import { c as core, S as SvcConfig } from "./index-uJ-YdKV1.js";
|
|
18
|
+
import { p as prompt, c as cases, f as firebaseStorage } from "./plugins-DXwZ_v63.js";
|
|
19
|
+
import { J as Jc } from "./app-9boJd9tw.js";
|
|
20
|
+
import { _ as _sfc_main$o } from "./SelectItems.vue_vue_type_script_setup_true_lang-CZu-7I-8.js";
|
|
21
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
22
|
+
import { _ as _sfc_main$z } from "./UserRuleGroup.vue_vue_type_script_setup_true_lang-Cen_yXF7.js";
|
|
23
|
+
import { _ as _sfc_main$p, a as _sfc_main$q } from "./RuleGroup.vue_vue_type_script_setup_true_lang-ClwtUvs9.js";
|
|
24
|
+
import { u as useI18n } from "./vue-i18n-CwrnHMwQ.js";
|
|
25
|
+
import { T as TypeToTriggerOptions, _ as _sfc_main$A, b as _sfc_main$B } from "./trigger-B0u2ZuY-.js";
|
|
26
|
+
import { _ as _sfc_main$y } from "./MessageInput.vue_vue_type_script_setup_true_lang-DtPV3l4w.js";
|
|
27
|
+
import { C as CountryTimezone, m as moment } from "./timezone-PLVeOMdC.js";
|
|
28
|
+
import { c as calculateNextScheduleAt, S as SummarizeRrule, R as RRule } from "./rule-Beum_Zy5.js";
|
|
29
|
+
import { useCoreStore } from "@feedmepos/mf-common";
|
|
30
|
+
import { _ as _sfc_main$r, a as _sfc_main$t } from "./VoucherEditor.vue_vue_type_script_setup_true_lang-Vscwqd3r.js";
|
|
31
|
+
import { T as TEMPLATES } from "./index-__X1c_dR.js";
|
|
32
|
+
import { v as FdoCreditLoyaltyReward, w as FdtoRandomReward, x as F_MISSION_TYPE, y as FdoThresholdCreditReward, z as FdtoThresholdReward, A as FdoMission } from "./index-DlwPVNEv.js";
|
|
33
|
+
import "./index-CErvxcDp.js";
|
|
34
|
+
import "./index-Bej-AJUB.js";
|
|
35
|
+
import { a as F_GAME_TYPE } from "./collectible.enum-0jg7mZtz.js";
|
|
36
|
+
import { u as useLoading } from "./loading-CBKMbqM5.js";
|
|
37
|
+
import { i as initCollectibleConfig } from "./helper-CzsKE573.js";
|
|
38
|
+
import { C as CollectionUtils } from "./collection.fn-BDcZoQfR.js";
|
|
39
|
+
import { s as sentenceCase$1 } from "./index-CsaQJMAR.js";
|
|
40
|
+
import "./index-DWN3abQr.js";
|
|
41
|
+
import { useDialog } from "@feedmepos/ui-library";
|
|
42
|
+
import { u as useCampaignStore } from "./campaign-DXo7F7aH.js";
|
|
43
|
+
import { a as cleanPF } from "./object-qECH92oz.js";
|
|
44
|
+
function summarizeGrabDiscount(e) {
|
|
45
|
+
if (!e)
|
|
46
|
+
return null;
|
|
47
|
+
const d = core.Config.getCountry().currency.symbol;
|
|
48
|
+
function r(o) {
|
|
49
|
+
switch (o.scope.type) {
|
|
50
|
+
case "order":
|
|
51
|
+
return "Bill discount";
|
|
52
|
+
case "items":
|
|
53
|
+
return o.type.startsWith("bundle") ? i(o.type) : "Item discount";
|
|
54
|
+
case "categories":
|
|
55
|
+
return "Category discount";
|
|
56
|
+
default:
|
|
57
|
+
return "Discount";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function i(o) {
|
|
61
|
+
switch (o) {
|
|
62
|
+
case "bundleSameFixPrice":
|
|
63
|
+
return "Bundle (same item) - Fixed price";
|
|
64
|
+
case "bundleDiffFixPrice":
|
|
65
|
+
return "Bundle (different items) - Fixed price";
|
|
66
|
+
case "bundleSameNet":
|
|
67
|
+
return "Bundle (same item) - Amount off";
|
|
68
|
+
case "bundleDiffNet":
|
|
69
|
+
return "Bundle (different items) - Amount off";
|
|
70
|
+
case "bundleSamePercentage":
|
|
71
|
+
return "Bundle (same item) - Percentage off";
|
|
72
|
+
case "bundleDiffPercentage":
|
|
73
|
+
return "Bundle (different items) - Percentage off";
|
|
74
|
+
default:
|
|
75
|
+
return "Bundle discount";
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function u(o) {
|
|
79
|
+
switch (o.type) {
|
|
80
|
+
case "percentage":
|
|
81
|
+
case "bundleSamePercentage":
|
|
82
|
+
case "bundleDiffPercentage":
|
|
83
|
+
return `${o.value}% discount`;
|
|
84
|
+
case "net":
|
|
85
|
+
case "bundleSameNet":
|
|
86
|
+
case "bundleDiffNet":
|
|
87
|
+
return `${d}${o.value} discount`;
|
|
88
|
+
case "bundleSameFixPrice":
|
|
89
|
+
case "bundleDiffFixPrice":
|
|
90
|
+
return `${d}${o.value} fixed price`;
|
|
91
|
+
case "delivery":
|
|
92
|
+
return "Delivery fee discount";
|
|
93
|
+
case "freeItem":
|
|
94
|
+
return "Free item";
|
|
95
|
+
default:
|
|
96
|
+
return `${d}${o.value} discount`;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function a(o) {
|
|
100
|
+
return o.cap && o.cap > 0 ? `capped at ${d}${o.cap}` : null;
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
type: r(e),
|
|
104
|
+
adjustment: u(e),
|
|
105
|
+
cap: a(e)
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
const _hoisted_1$l = {
|
|
109
|
+
key: 0,
|
|
110
|
+
class: "bg-fm-color-neutral-gray-50 border border-fm-color-neutral-gray-200 rounded-8 p-16 space-y-16"
|
|
111
|
+
}, _hoisted_2$h = { class: "flex items-center justify-between" }, _hoisted_3$e = { class: "flex items-center gap-8" }, _hoisted_4$b = { class: "bg-white border border-fm-color-neutral-gray-200 rounded-8 p-16" }, _hoisted_5$7 = { class: "flex justify-end gap-8 pt-8 border-t border-fm-color-neutral-gray-200" }, _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
112
|
+
__name: "GrabItemSelectionInline",
|
|
113
|
+
props: {
|
|
114
|
+
visible: { type: Boolean },
|
|
115
|
+
initialValue: {},
|
|
116
|
+
filterItems: { type: Function }
|
|
117
|
+
},
|
|
118
|
+
emits: ["confirm", "cancel"],
|
|
119
|
+
setup(e, { emit: d }) {
|
|
120
|
+
const r = e, i = d, u = ref();
|
|
121
|
+
watch(
|
|
122
|
+
() => r.visible,
|
|
123
|
+
(l) => {
|
|
124
|
+
var s, h;
|
|
125
|
+
!l && u.value && ((h = (s = u.value).setSelectedItems) == null || h.call(s, r.initialValue || []));
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
function a() {
|
|
129
|
+
var l;
|
|
130
|
+
(l = u.value) == null || l.onConfirm();
|
|
131
|
+
}
|
|
132
|
+
function o() {
|
|
133
|
+
i("cancel");
|
|
134
|
+
}
|
|
135
|
+
function n(l) {
|
|
136
|
+
i("confirm", l);
|
|
137
|
+
}
|
|
138
|
+
return (l, s) => {
|
|
139
|
+
const h = resolveComponent("FmIcon"), g = resolveComponent("FmButton");
|
|
140
|
+
return l.visible ? (openBlock(), createElementBlock("div", _hoisted_1$l, [
|
|
141
|
+
createElementVNode("div", _hoisted_2$h, [
|
|
142
|
+
createElementVNode("div", _hoisted_3$e, [
|
|
143
|
+
createVNode(h, {
|
|
144
|
+
name: "restaurant",
|
|
145
|
+
size: "md"
|
|
146
|
+
}),
|
|
147
|
+
s[0] || (s[0] = createElementVNode("h3", { class: "fm-typo-en-body-lg-600" }, "Select Items", -1))
|
|
148
|
+
]),
|
|
149
|
+
createVNode(g, {
|
|
150
|
+
icon: "close",
|
|
151
|
+
variant: "tertiary",
|
|
152
|
+
onClick: o
|
|
153
|
+
})
|
|
154
|
+
]),
|
|
155
|
+
s[1] || (s[1] = createElementVNode("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Choose which items this discount applies to. For bundle discounts, select multiple items that can be bundled together. ", -1)),
|
|
156
|
+
createElementVNode("div", _hoisted_4$b, [
|
|
157
|
+
createVNode(_sfc_main$o, {
|
|
158
|
+
ref_key: "selectItemRef",
|
|
159
|
+
ref: u,
|
|
160
|
+
"initial-value": l.initialValue,
|
|
161
|
+
"filter-items": l.filterItems,
|
|
162
|
+
"on-complete": n,
|
|
163
|
+
"max-height": 300
|
|
164
|
+
}, null, 8, ["initial-value", "filter-items"])
|
|
165
|
+
]),
|
|
166
|
+
createElementVNode("div", _hoisted_5$7, [
|
|
167
|
+
createVNode(g, {
|
|
168
|
+
variant: "secondary",
|
|
169
|
+
label: "Cancel",
|
|
170
|
+
onClick: o
|
|
171
|
+
}),
|
|
172
|
+
createVNode(g, {
|
|
173
|
+
variant: "primary",
|
|
174
|
+
label: "Confirm Selection",
|
|
175
|
+
onClick: a
|
|
176
|
+
})
|
|
177
|
+
])
|
|
178
|
+
])) : createCommentVNode("", !0);
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}), _hoisted_1$k = {
|
|
182
|
+
key: 0,
|
|
183
|
+
class: "bg-fm-color-neutral-gray-50 border border-fm-color-neutral-gray-200 rounded-8 p-16 space-y-16"
|
|
184
|
+
}, _hoisted_2$g = { class: "flex items-center justify-between" }, _hoisted_3$d = { class: "flex items-center gap-8" }, _hoisted_4$a = { class: "flex gap-16 items-center flex-wrap" }, _hoisted_5$6 = { class: "flex gap-8 items-center" }, _hoisted_6$5 = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, _hoisted_7$4 = { class: "bg-white border border-fm-color-neutral-gray-200 rounded-8 max-h-[300px] overflow-y-auto" }, _hoisted_8$2 = { class: "flex items-center gap-12" }, _hoisted_9$2 = { class: "fm-typo-en-body-md-600" }, _hoisted_10$2 = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, _hoisted_11$2 = {
|
|
185
|
+
key: 1,
|
|
186
|
+
class: "p-24 text-center"
|
|
187
|
+
}, _hoisted_12$1 = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _hoisted_13$1 = { class: "flex justify-end gap-8 pt-8 border-t border-fm-color-neutral-gray-200" }, _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
188
|
+
__name: "GrabCategorySelectionInline",
|
|
189
|
+
props: {
|
|
190
|
+
visible: { type: Boolean },
|
|
191
|
+
initialValue: {}
|
|
192
|
+
},
|
|
193
|
+
emits: ["confirm", "cancel"],
|
|
194
|
+
setup(e, { emit: d }) {
|
|
195
|
+
const r = e, i = d, u = Jc(), a = ref({}), o = ref(""), n = computed(() => {
|
|
196
|
+
const m = u.menu.value;
|
|
197
|
+
return m ? m.modules.category.map((f) => ({
|
|
198
|
+
id: f._id,
|
|
199
|
+
name: f.name
|
|
200
|
+
})) : [];
|
|
201
|
+
}), l = computed(() => {
|
|
202
|
+
if (!o.value) return n.value;
|
|
203
|
+
const m = o.value.toLowerCase();
|
|
204
|
+
return n.value.filter(
|
|
205
|
+
(f) => f.name.toLowerCase().includes(m)
|
|
206
|
+
);
|
|
207
|
+
}), s = computed(() => Object.values(a.value).filter(Boolean).length);
|
|
208
|
+
function h() {
|
|
209
|
+
a.value = n.value.reduce(
|
|
210
|
+
(m, f) => (m[f.id] = r.initialValue.includes(f.id), m),
|
|
211
|
+
{}
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
watch([() => r.visible, () => r.initialValue], () => {
|
|
215
|
+
r.visible && h();
|
|
216
|
+
}), onMounted(async () => {
|
|
217
|
+
await u.store.getMenu(), h();
|
|
218
|
+
});
|
|
219
|
+
function g(m) {
|
|
220
|
+
a.value[m] = !a.value[m];
|
|
221
|
+
}
|
|
222
|
+
function b() {
|
|
223
|
+
const m = s.value === l.value.length;
|
|
224
|
+
l.value.forEach((f) => {
|
|
225
|
+
a.value[f.id] = !m;
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
function k() {
|
|
229
|
+
Object.keys(a.value).forEach((m) => {
|
|
230
|
+
a.value[m] = !1;
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
function p() {
|
|
234
|
+
const m = Object.entries(a.value).filter(([, f]) => f).map(([f]) => f);
|
|
235
|
+
i("confirm", m);
|
|
236
|
+
}
|
|
237
|
+
function c() {
|
|
238
|
+
i("cancel");
|
|
239
|
+
}
|
|
240
|
+
const y = computed(() => l.value.length > 0 && l.value.every(
|
|
241
|
+
(m) => a.value[m.id]
|
|
242
|
+
));
|
|
243
|
+
return (m, f) => {
|
|
244
|
+
const B = resolveComponent("FmIcon"), C = resolveComponent("FmButton"), E = resolveComponent("FmTextField"), $ = resolveComponent("FmCheckbox"), x = resolveComponent("FmListItem"), S = resolveComponent("FmList");
|
|
245
|
+
return m.visible ? (openBlock(), createElementBlock("div", _hoisted_1$k, [
|
|
246
|
+
createElementVNode("div", _hoisted_2$g, [
|
|
247
|
+
createElementVNode("div", _hoisted_3$d, [
|
|
248
|
+
createVNode(B, {
|
|
249
|
+
name: "category",
|
|
250
|
+
size: "md"
|
|
251
|
+
}),
|
|
252
|
+
f[2] || (f[2] = createElementVNode("h3", { class: "fm-typo-en-body-lg-600" }, "Select Categories", -1))
|
|
253
|
+
]),
|
|
254
|
+
createVNode(C, {
|
|
255
|
+
icon: "close",
|
|
256
|
+
variant: "tertiary",
|
|
257
|
+
onClick: c
|
|
258
|
+
})
|
|
259
|
+
]),
|
|
260
|
+
f[3] || (f[3] = createElementVNode("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Choose which categories this discount applies to. The discount will be available for all items within the selected categories. ", -1)),
|
|
261
|
+
createElementVNode("div", _hoisted_4$a, [
|
|
262
|
+
createElementVNode("div", _hoisted_5$6, [
|
|
263
|
+
createVNode(C, {
|
|
264
|
+
icon: "select_all",
|
|
265
|
+
variant: "tertiary",
|
|
266
|
+
size: "small",
|
|
267
|
+
label: `${y.value ? "Deselect" : "Select"} All`,
|
|
268
|
+
onClick: b
|
|
269
|
+
}, null, 8, ["label"]),
|
|
270
|
+
createVNode(C, {
|
|
271
|
+
icon: "sync",
|
|
272
|
+
variant: "tertiary",
|
|
273
|
+
size: "small",
|
|
274
|
+
label: "Clear",
|
|
275
|
+
onClick: k
|
|
276
|
+
}),
|
|
277
|
+
createElementVNode("span", _hoisted_6$5, toDisplayString(s.value) + " selected ", 1)
|
|
278
|
+
]),
|
|
279
|
+
createVNode(E, {
|
|
280
|
+
modelValue: o.value,
|
|
281
|
+
"onUpdate:modelValue": f[0] || (f[0] = (N) => o.value = N),
|
|
282
|
+
placeholder: "Search categories",
|
|
283
|
+
"leading-icon": { name: "search", color: "" },
|
|
284
|
+
class: "flex-1 min-w-[200px]"
|
|
285
|
+
}, null, 8, ["modelValue"])
|
|
286
|
+
]),
|
|
287
|
+
createElementVNode("div", _hoisted_7$4, [
|
|
288
|
+
l.value.length > 0 ? (openBlock(), createBlock(S, { key: 0 }, {
|
|
289
|
+
default: withCtx(() => [
|
|
290
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(l.value, (N) => (openBlock(), createBlock(x, {
|
|
291
|
+
key: N.id,
|
|
292
|
+
clickable: !0,
|
|
293
|
+
onClick: (I) => g(N.id)
|
|
294
|
+
}, {
|
|
295
|
+
leading: withCtx(() => [
|
|
296
|
+
createVNode($, {
|
|
297
|
+
"model-value": a.value[N.id] || !1,
|
|
298
|
+
value: N.id,
|
|
299
|
+
"onUpdate:modelValue": (I) => g(N.id),
|
|
300
|
+
onClick: f[1] || (f[1] = withModifiers(() => {
|
|
301
|
+
}, ["stop"]))
|
|
302
|
+
}, null, 8, ["model-value", "value", "onUpdate:modelValue"])
|
|
303
|
+
]),
|
|
304
|
+
default: withCtx(() => [
|
|
305
|
+
createElementVNode("div", _hoisted_8$2, [
|
|
306
|
+
createVNode(B, {
|
|
307
|
+
name: "category",
|
|
308
|
+
size: "sm",
|
|
309
|
+
class: "text-fm-color-typo-secondary"
|
|
310
|
+
}),
|
|
311
|
+
createElementVNode("div", null, [
|
|
312
|
+
createElementVNode("div", _hoisted_9$2, toDisplayString(N.name), 1),
|
|
313
|
+
createElementVNode("div", _hoisted_10$2, " ID: " + toDisplayString(N.id), 1)
|
|
314
|
+
])
|
|
315
|
+
])
|
|
316
|
+
]),
|
|
317
|
+
_: 2
|
|
318
|
+
}, 1032, ["onClick"]))), 128))
|
|
319
|
+
]),
|
|
320
|
+
_: 1
|
|
321
|
+
})) : (openBlock(), createElementBlock("div", _hoisted_11$2, [
|
|
322
|
+
createElementVNode("div", _hoisted_12$1, toDisplayString(o.value ? "No categories found matching your search." : "No categories available."), 1)
|
|
323
|
+
]))
|
|
324
|
+
]),
|
|
325
|
+
createElementVNode("div", _hoisted_13$1, [
|
|
326
|
+
createVNode(C, {
|
|
327
|
+
variant: "secondary",
|
|
328
|
+
label: "Cancel",
|
|
329
|
+
onClick: c
|
|
330
|
+
}),
|
|
331
|
+
createVNode(C, {
|
|
332
|
+
variant: "primary",
|
|
333
|
+
label: `Confirm Selection (${s.value})`,
|
|
334
|
+
disabled: s.value === 0,
|
|
335
|
+
onClick: p
|
|
336
|
+
}, null, 8, ["label", "disabled"])
|
|
337
|
+
])
|
|
338
|
+
])) : createCommentVNode("", !0);
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
}), _hoisted_1$j = { class: "space-y-8" }, _hoisted_2$f = {
|
|
342
|
+
key: 1,
|
|
343
|
+
class: "border-1 rounded-md flex gap-16 items-center justify-between px-16 py-12"
|
|
344
|
+
}, _hoisted_3$c = { class: "fm-typo-en-body-lg-400" }, _hoisted_4$9 = { class: "text-fm-color-typo-secondary" }, _hoisted_5$5 = { key: 0 }, _hoisted_6$4 = { class: "space-y-24" }, _hoisted_7$3 = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary mt-4" }, _hoisted_8$1 = { key: 0 }, _hoisted_9$1 = { class: "fm-typo-en-body-md-600 mb-8 block" }, _hoisted_10$1 = { key: 1 }, _hoisted_11$1 = { key: 2 }, _hoisted_12 = { key: 0 }, _hoisted_13 = { class: "space-y-8" }, _hoisted_14 = { class: "flex items-center justify-between p-12 border border-fm-color-neutral-gray-200 fm-corner-radius-md" }, _hoisted_15 = { class: "flex items-center gap-8" }, _hoisted_16 = { class: "fm-typo-en-body-md-400" }, _hoisted_17 = { key: 3 }, _hoisted_18 = { key: 0 }, _hoisted_19 = { class: "space-y-8" }, _hoisted_20 = { class: "flex items-center justify-between p-12 border border-fm-color-neutral-gray-200 fm-corner-radius-md" }, _hoisted_21 = { class: "flex items-center gap-8" }, _hoisted_22 = { class: "fm-typo-en-body-md-400" }, _hoisted_23 = {
|
|
345
|
+
key: 0,
|
|
346
|
+
class: "mt-16 p-12 bg-fm-color-feedback-error-light rounded-8 border border-fm-color-feedback-error-main"
|
|
347
|
+
}, _hoisted_24 = { class: "flex items-center gap-8 mb-8" }, _hoisted_25 = { class: "space-y-4" }, _hoisted_26 = { class: "flex gap-16" }, _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
348
|
+
__name: "GrabEffectSheet",
|
|
349
|
+
props: {
|
|
350
|
+
modelValue: { type: Object }
|
|
351
|
+
},
|
|
352
|
+
emits: ["update:model-value"],
|
|
353
|
+
setup(e, { emit: d }) {
|
|
354
|
+
const r = e, i = d, u = Jc(), a = ref(!1), o = ref(!1), n = ref(!1), l = ref({
|
|
355
|
+
type: "net",
|
|
356
|
+
value: 0,
|
|
357
|
+
scope: {
|
|
358
|
+
type: "order"
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
watch(
|
|
362
|
+
() => r.modelValue,
|
|
363
|
+
(v) => {
|
|
364
|
+
v && (l.value = { ...v });
|
|
365
|
+
},
|
|
366
|
+
{ immediate: !0 }
|
|
367
|
+
), onMounted(async () => {
|
|
368
|
+
await u.store.getMenu();
|
|
369
|
+
});
|
|
370
|
+
const s = computed(() => {
|
|
371
|
+
var v;
|
|
372
|
+
return !(!l.value.type || !((v = l.value.scope) != null && v.type) || b(l.value.type) && (!l.value.value || l.value.value <= 0) || (l.value.scope.type === "items" || l.value.scope.type === "category") && (!l.value.scope.objectIDs || l.value.scope.objectIDs.length === 0));
|
|
373
|
+
});
|
|
374
|
+
async function h(v) {
|
|
375
|
+
v.stopPropagation(), await prompt.remove("Are you sure you want to remove this discount?") && i("update:model-value", null);
|
|
376
|
+
}
|
|
377
|
+
function g() {
|
|
378
|
+
var v;
|
|
379
|
+
return B(((v = l.value.scope) == null ? void 0 : v.type) || "order");
|
|
380
|
+
}
|
|
381
|
+
function b(v) {
|
|
382
|
+
return v && !["freeItem", "delivery"].includes(v);
|
|
383
|
+
}
|
|
384
|
+
function k(v) {
|
|
385
|
+
return v && ["percentage", "bundleSamePercentage", "bundleDiffPercentage"].includes(
|
|
386
|
+
v
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
function p(v) {
|
|
390
|
+
return v != null && v.includes("Percentage") ? "Discount percentage" : v != null && v.includes("FixPrice") ? "Bundle fixed price" : v === "percentage" ? "Discount percentage" : "Discount amount";
|
|
391
|
+
}
|
|
392
|
+
function c(v) {
|
|
393
|
+
return v != null && v.includes("Percentage") || v === "percentage" ? "10" : "5.00";
|
|
394
|
+
}
|
|
395
|
+
function y(v) {
|
|
396
|
+
return v != null && v.includes("Percentage") || v === "percentage" ? "%" : "$";
|
|
397
|
+
}
|
|
398
|
+
function m(v, V) {
|
|
399
|
+
l.value = {
|
|
400
|
+
...l.value,
|
|
401
|
+
[v]: V
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
function f(v, V) {
|
|
405
|
+
var T;
|
|
406
|
+
const w = {
|
|
407
|
+
...l.value.scope,
|
|
408
|
+
[v]: V
|
|
409
|
+
};
|
|
410
|
+
if (l.value = {
|
|
411
|
+
...l.value,
|
|
412
|
+
scope: w
|
|
413
|
+
}, v === "type") {
|
|
414
|
+
const F = B(V);
|
|
415
|
+
F.some(
|
|
416
|
+
(P) => P.value === l.value.type
|
|
417
|
+
) || (l.value = {
|
|
418
|
+
...l.value,
|
|
419
|
+
type: ((T = F[0]) == null ? void 0 : T.value) || "net",
|
|
420
|
+
// Reset value and cap when changing to incompatible type
|
|
421
|
+
value: 0,
|
|
422
|
+
cap: void 0
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
function B(v) {
|
|
427
|
+
switch (v) {
|
|
428
|
+
case "order":
|
|
429
|
+
return [
|
|
430
|
+
{ label: "Amount off", value: "net" },
|
|
431
|
+
{ label: "Percentage off", value: "percentage" },
|
|
432
|
+
{ label: "Delivery fee off", value: "delivery" }
|
|
433
|
+
];
|
|
434
|
+
case "category":
|
|
435
|
+
return [
|
|
436
|
+
{ label: "Amount off", value: "net" },
|
|
437
|
+
{ label: "Percentage off", value: "percentage" }
|
|
438
|
+
];
|
|
439
|
+
case "items":
|
|
440
|
+
return [
|
|
441
|
+
{ label: "Amount off", value: "net" },
|
|
442
|
+
{ label: "Percentage off", value: "percentage" },
|
|
443
|
+
{ label: "Free item", value: "freeItem" },
|
|
444
|
+
{
|
|
445
|
+
label: "Bundle (same item) - Fixed price",
|
|
446
|
+
value: "bundleSameFixPrice"
|
|
447
|
+
},
|
|
448
|
+
{ label: "Bundle (same item) - Amount off", value: "bundleSameNet" },
|
|
449
|
+
{
|
|
450
|
+
label: "Bundle (same item) - Percentage off",
|
|
451
|
+
value: "bundleSamePercentage"
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
label: "Bundle (different items) - Fixed price",
|
|
455
|
+
value: "bundleDiffFixPrice"
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
label: "Bundle (different items) - Amount off",
|
|
459
|
+
value: "bundleDiffNet"
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
label: "Bundle (different items) - Percentage off",
|
|
463
|
+
value: "bundleDiffPercentage"
|
|
464
|
+
}
|
|
465
|
+
];
|
|
466
|
+
default:
|
|
467
|
+
return [
|
|
468
|
+
{ label: "Amount off", value: "net" },
|
|
469
|
+
{ label: "Percentage off", value: "percentage" }
|
|
470
|
+
];
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
function C(v) {
|
|
474
|
+
switch (v) {
|
|
475
|
+
case "order":
|
|
476
|
+
return "Applies to entire order. Available: Amount off, Percentage off, Delivery fee discount.";
|
|
477
|
+
case "category":
|
|
478
|
+
return "Applies to specific item categories. Available: Amount off, Percentage off, Free item.";
|
|
479
|
+
case "items":
|
|
480
|
+
return "Applies to specific items. Available: Basic discounts, Bundle offers (same/different items).";
|
|
481
|
+
default:
|
|
482
|
+
return "Select how you want to apply the discount.";
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
function E() {
|
|
486
|
+
var v;
|
|
487
|
+
return ((v = l.value.scope) == null ? void 0 : v.type) === "items";
|
|
488
|
+
}
|
|
489
|
+
function $() {
|
|
490
|
+
var v;
|
|
491
|
+
return ((v = l.value.scope) == null ? void 0 : v.type) === "category";
|
|
492
|
+
}
|
|
493
|
+
function x() {
|
|
494
|
+
var w;
|
|
495
|
+
const v = (w = l.value.scope) == null ? void 0 : w.objectIDs;
|
|
496
|
+
if (!v || v.length === 0)
|
|
497
|
+
return "No items selected";
|
|
498
|
+
const V = u.menu.value;
|
|
499
|
+
return V && v.length <= 3 ? v.map((F) => {
|
|
500
|
+
const R = V.modules.item.find((P) => P._id === F);
|
|
501
|
+
return R ? (R.name2 || R.name).trim() : `Item ${F}`;
|
|
502
|
+
}).join(", ") : v.length === 1 ? "1 item selected" : `${v.length} items selected`;
|
|
503
|
+
}
|
|
504
|
+
function S() {
|
|
505
|
+
var w;
|
|
506
|
+
const v = (w = l.value.scope) == null ? void 0 : w.objectIDs;
|
|
507
|
+
if (!v || v.length === 0)
|
|
508
|
+
return "No categories selected";
|
|
509
|
+
const V = u.menu.value;
|
|
510
|
+
return V && v.length <= 3 ? v.map((F) => {
|
|
511
|
+
const R = V.modules.category.find((P) => P._id === F);
|
|
512
|
+
return R ? R.name : `Category ${F}`;
|
|
513
|
+
}).join(", ") : v.length === 1 ? "1 category selected" : `${v.length} categories selected`;
|
|
514
|
+
}
|
|
515
|
+
function N() {
|
|
516
|
+
o.value = !0;
|
|
517
|
+
}
|
|
518
|
+
function I() {
|
|
519
|
+
n.value = !0;
|
|
520
|
+
}
|
|
521
|
+
function M(v) {
|
|
522
|
+
f("objectIDs", v), o.value = !1;
|
|
523
|
+
}
|
|
524
|
+
function j(v) {
|
|
525
|
+
f("objectIDs", v), n.value = !1;
|
|
526
|
+
}
|
|
527
|
+
function Y() {
|
|
528
|
+
o.value = !1;
|
|
529
|
+
}
|
|
530
|
+
function G() {
|
|
531
|
+
n.value = !1;
|
|
532
|
+
}
|
|
533
|
+
const H = computed(() => {
|
|
534
|
+
var V, w, T;
|
|
535
|
+
const v = [];
|
|
536
|
+
return l.value.type || v.push("Discount type is required"), (V = l.value.scope) != null && V.type || v.push("Scope type is required"), b(l.value.type) && (!l.value.value || l.value.value <= 0) && v.push("Discount value must be greater than 0"), ((w = l.value.scope) == null ? void 0 : w.type) === "items" && (!l.value.scope.objectIDs || l.value.scope.objectIDs.length === 0) && v.push("Please select at least one item"), ((T = l.value.scope) == null ? void 0 : T.type) === "category" && (!l.value.scope.objectIDs || l.value.scope.objectIDs.length === 0) && v.push("Please select at least one category"), v;
|
|
537
|
+
});
|
|
538
|
+
function Z() {
|
|
539
|
+
i("update:model-value", l.value), a.value = !1;
|
|
540
|
+
}
|
|
541
|
+
const q = [
|
|
542
|
+
{ label: "Bill discount", value: "order" },
|
|
543
|
+
{ label: "Item discount", value: "items" },
|
|
544
|
+
{ label: "Category discount", value: "category" }
|
|
545
|
+
];
|
|
546
|
+
return (v, V) => {
|
|
547
|
+
const w = resolveComponent("FmButton"), T = resolveComponent("FmSelect"), F = resolveComponent("FmStepperField"), R = resolveComponent("FmIcon"), P = resolveComponent("FmSideSheet");
|
|
548
|
+
return openBlock(), createBlock(P, {
|
|
549
|
+
"max-width": 550,
|
|
550
|
+
header: "Apply discount",
|
|
551
|
+
modelValue: unref(a),
|
|
552
|
+
"onUpdate:modelValue": [
|
|
553
|
+
V[5] || (V[5] = (D) => isRef(a) ? a.value = D : null),
|
|
554
|
+
V[6] || (V[6] = (D) => a.value = D)
|
|
555
|
+
]
|
|
556
|
+
}, {
|
|
557
|
+
"side-sheet-button": withCtx(() => {
|
|
558
|
+
var D, U, A, L;
|
|
559
|
+
return [
|
|
560
|
+
createElementVNode("div", _hoisted_1$j, [
|
|
561
|
+
V[7] || (V[7] = createElementVNode("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Configure the Grab campaign discount you want to offer your customers. ", -1)),
|
|
562
|
+
e.modelValue ? (openBlock(), createElementBlock("div", _hoisted_2$f, [
|
|
563
|
+
createElementVNode("div", _hoisted_3$c, [
|
|
564
|
+
createElementVNode("div", null, toDisplayString((D = unref(summarizeGrabDiscount)(e.modelValue)) == null ? void 0 : D.type), 1),
|
|
565
|
+
createElementVNode("div", _hoisted_4$9, [
|
|
566
|
+
createTextVNode(toDisplayString((U = unref(summarizeGrabDiscount)(e.modelValue)) == null ? void 0 : U.adjustment) + " ", 1),
|
|
567
|
+
(A = unref(summarizeGrabDiscount)(e.modelValue)) != null && A.cap ? (openBlock(), createElementBlock("span", _hoisted_5$5, toDisplayString((L = unref(summarizeGrabDiscount)(e.modelValue)) == null ? void 0 : L.cap), 1)) : createCommentVNode("", !0)
|
|
568
|
+
])
|
|
569
|
+
]),
|
|
570
|
+
createVNode(w, {
|
|
571
|
+
icon: "delete",
|
|
572
|
+
"icon-color": "neutral-gray-400",
|
|
573
|
+
variant: "tertiary",
|
|
574
|
+
onClick: h
|
|
575
|
+
})
|
|
576
|
+
])) : (openBlock(), createBlock(w, {
|
|
577
|
+
key: 0,
|
|
578
|
+
label: "Apply Grab discount",
|
|
579
|
+
icon: "add",
|
|
580
|
+
"icon-color": "primary",
|
|
581
|
+
variant: "secondary",
|
|
582
|
+
class: "border-fm-color-primary text-fm-color-primary"
|
|
583
|
+
}))
|
|
584
|
+
])
|
|
585
|
+
];
|
|
586
|
+
}),
|
|
587
|
+
"side-sheet-footer": withCtx(() => [
|
|
588
|
+
createElementVNode("div", _hoisted_26, [
|
|
589
|
+
createVNode(w, {
|
|
590
|
+
variant: "secondary",
|
|
591
|
+
label: "Cancel",
|
|
592
|
+
class: "flex-1",
|
|
593
|
+
onClick: V[4] || (V[4] = (D) => a.value = !1)
|
|
594
|
+
}),
|
|
595
|
+
createVNode(w, {
|
|
596
|
+
variant: "primary",
|
|
597
|
+
label: unref(s) ? "Confirm Discount" : "Complete Required Fields",
|
|
598
|
+
class: "flex-1",
|
|
599
|
+
disabled: !unref(s),
|
|
600
|
+
onClick: Z
|
|
601
|
+
}, null, 8, ["label", "disabled"])
|
|
602
|
+
])
|
|
603
|
+
]),
|
|
604
|
+
default: withCtx(() => {
|
|
605
|
+
var D, U, A, L;
|
|
606
|
+
return [
|
|
607
|
+
createElementVNode("div", _hoisted_6$4, [
|
|
608
|
+
createElementVNode("div", null, [
|
|
609
|
+
V[8] || (V[8] = createElementVNode("label", { class: "fm-typo-en-body-md-600 mb-8 block" }, "Campaign type", -1)),
|
|
610
|
+
createVNode(T, {
|
|
611
|
+
"model-value": ((D = unref(l).scope) == null ? void 0 : D.type) || "order",
|
|
612
|
+
"onUpdate:modelValue": V[0] || (V[0] = (O) => f("type", O)),
|
|
613
|
+
placeholder: "Select campaign type",
|
|
614
|
+
items: q
|
|
615
|
+
}, null, 8, ["model-value"]),
|
|
616
|
+
createElementVNode("div", _hoisted_7$3, toDisplayString(C((U = unref(l).scope) == null ? void 0 : U.type)), 1)
|
|
617
|
+
]),
|
|
618
|
+
createElementVNode("div", null, [
|
|
619
|
+
V[9] || (V[9] = createElementVNode("label", { class: "fm-typo-en-body-md-600 mb-8 block" }, "Discount type", -1)),
|
|
620
|
+
createVNode(T, {
|
|
621
|
+
"model-value": unref(l).type,
|
|
622
|
+
"onUpdate:modelValue": V[1] || (V[1] = (O) => m("type", O)),
|
|
623
|
+
placeholder: "Select discount type",
|
|
624
|
+
items: g()
|
|
625
|
+
}, null, 8, ["model-value", "items"])
|
|
626
|
+
]),
|
|
627
|
+
b(unref(l).type) ? (openBlock(), createElementBlock("div", _hoisted_8$1, [
|
|
628
|
+
createElementVNode("label", _hoisted_9$1, toDisplayString(p(unref(l).type)), 1),
|
|
629
|
+
createVNode(F, {
|
|
630
|
+
modelValue: unref(l).value,
|
|
631
|
+
"onUpdate:modelValue": V[2] || (V[2] = (O) => unref(l).value = O),
|
|
632
|
+
placeholder: c(unref(l).type),
|
|
633
|
+
suffix: y(unref(l).type),
|
|
634
|
+
type: "number"
|
|
635
|
+
}, null, 8, ["modelValue", "placeholder", "suffix"])
|
|
636
|
+
])) : createCommentVNode("", !0),
|
|
637
|
+
k(unref(l).type) ? (openBlock(), createElementBlock("div", _hoisted_10$1, [
|
|
638
|
+
V[10] || (V[10] = createElementVNode("label", { class: "fm-typo-en-body-md-600 mb-8 block" }, "Discount cap (optional)", -1)),
|
|
639
|
+
createVNode(F, {
|
|
640
|
+
modelValue: unref(l).cap,
|
|
641
|
+
"onUpdate:modelValue": V[3] || (V[3] = (O) => unref(l).cap = O),
|
|
642
|
+
placeholder: "Maximum discount amount",
|
|
643
|
+
type: "number"
|
|
644
|
+
}, null, 8, ["modelValue"])
|
|
645
|
+
])) : createCommentVNode("", !0),
|
|
646
|
+
E() ? (openBlock(), createElementBlock("div", _hoisted_11$1, [
|
|
647
|
+
unref(o) ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_12, [
|
|
648
|
+
V[12] || (V[12] = createElementVNode("label", { class: "fm-typo-en-body-md-600 mb-8 block" }, "Select Items", -1)),
|
|
649
|
+
createElementVNode("div", _hoisted_13, [
|
|
650
|
+
createElementVNode("div", _hoisted_14, [
|
|
651
|
+
createElementVNode("div", _hoisted_15, [
|
|
652
|
+
createVNode(R, {
|
|
653
|
+
name: "restaurant",
|
|
654
|
+
size: "md"
|
|
655
|
+
}),
|
|
656
|
+
createElementVNode("span", _hoisted_16, toDisplayString(x()), 1)
|
|
657
|
+
]),
|
|
658
|
+
createVNode(w, {
|
|
659
|
+
variant: "secondary",
|
|
660
|
+
label: "Select Items",
|
|
661
|
+
icon: "chevron_right",
|
|
662
|
+
onClick: N
|
|
663
|
+
})
|
|
664
|
+
]),
|
|
665
|
+
V[11] || (V[11] = createElementVNode("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Choose which items this discount applies to. Bundle discounts require multiple items. ", -1))
|
|
666
|
+
])
|
|
667
|
+
])),
|
|
668
|
+
createVNode(_sfc_main$n, {
|
|
669
|
+
visible: unref(o),
|
|
670
|
+
"initial-value": ((A = unref(l).scope) == null ? void 0 : A.objectIDs) || [],
|
|
671
|
+
onConfirm: M,
|
|
672
|
+
onCancel: Y
|
|
673
|
+
}, null, 8, ["visible", "initial-value"])
|
|
674
|
+
])) : createCommentVNode("", !0),
|
|
675
|
+
$() ? (openBlock(), createElementBlock("div", _hoisted_17, [
|
|
676
|
+
unref(n) ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_18, [
|
|
677
|
+
V[14] || (V[14] = createElementVNode("label", { class: "fm-typo-en-body-md-600 mb-8 block" }, "Select Categories", -1)),
|
|
678
|
+
createElementVNode("div", _hoisted_19, [
|
|
679
|
+
createElementVNode("div", _hoisted_20, [
|
|
680
|
+
createElementVNode("div", _hoisted_21, [
|
|
681
|
+
createVNode(R, {
|
|
682
|
+
name: "category",
|
|
683
|
+
size: "md"
|
|
684
|
+
}),
|
|
685
|
+
createElementVNode("span", _hoisted_22, toDisplayString(S()), 1)
|
|
686
|
+
]),
|
|
687
|
+
createVNode(w, {
|
|
688
|
+
variant: "secondary",
|
|
689
|
+
label: "Select Categories",
|
|
690
|
+
icon: "chevron_right",
|
|
691
|
+
onClick: I
|
|
692
|
+
})
|
|
693
|
+
]),
|
|
694
|
+
V[13] || (V[13] = createElementVNode("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Choose which categories this discount applies to. ", -1))
|
|
695
|
+
])
|
|
696
|
+
])),
|
|
697
|
+
createVNode(_sfc_main$m, {
|
|
698
|
+
visible: unref(n),
|
|
699
|
+
"initial-value": ((L = unref(l).scope) == null ? void 0 : L.objectIDs) || [],
|
|
700
|
+
onConfirm: j,
|
|
701
|
+
onCancel: G
|
|
702
|
+
}, null, 8, ["visible", "initial-value"])
|
|
703
|
+
])) : createCommentVNode("", !0)
|
|
704
|
+
]),
|
|
705
|
+
unref(H).length > 0 ? (openBlock(), createElementBlock("div", _hoisted_23, [
|
|
706
|
+
createElementVNode("div", _hoisted_24, [
|
|
707
|
+
createVNode(R, {
|
|
708
|
+
name: "warning",
|
|
709
|
+
size: "sm",
|
|
710
|
+
class: "text-fm-color-feedback-error-main"
|
|
711
|
+
}),
|
|
712
|
+
V[15] || (V[15] = createElementVNode("span", { class: "fm-typo-en-body-sm-600 text-fm-color-feedback-error-main" }, "Please fix the following issues:", -1))
|
|
713
|
+
]),
|
|
714
|
+
createElementVNode("ul", _hoisted_25, [
|
|
715
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(H), (O) => (openBlock(), createElementBlock("li", {
|
|
716
|
+
key: O,
|
|
717
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-feedback-error-main flex items-start gap-8"
|
|
718
|
+
}, [
|
|
719
|
+
V[16] || (V[16] = createElementVNode("span", { class: "w-4 h-4 bg-fm-color-feedback-error-main rounded-full mt-6 flex-shrink-0" }, null, -1)),
|
|
720
|
+
createTextVNode(" " + toDisplayString(O), 1)
|
|
721
|
+
]))), 128))
|
|
722
|
+
])
|
|
723
|
+
])) : createCommentVNode("", !0)
|
|
724
|
+
];
|
|
725
|
+
}),
|
|
726
|
+
_: 1
|
|
727
|
+
}, 8, ["modelValue"]);
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
}), GrabEffectSheet = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-fecbf4df"]]), _hoisted_1$i = { class: "space-y-24" }, _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
731
|
+
__name: "TimeRuleGroup",
|
|
732
|
+
props: {
|
|
733
|
+
modelValue: {
|
|
734
|
+
type: Object,
|
|
735
|
+
default: () => {
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
},
|
|
739
|
+
emits: ["update:model-value"],
|
|
740
|
+
setup(e, { emit: d }) {
|
|
741
|
+
const { t: r } = useI18n(), i = e, u = d, a = ref(
|
|
742
|
+
!i.modelValue || !i.modelValue.rules.g_time ? "all_time" : RuleBuilder.getRules(i.modelValue.rules.g_time).length > 0 ? "custom" : "all_time"
|
|
743
|
+
);
|
|
744
|
+
watch(a, async (n, l) => {
|
|
745
|
+
var s;
|
|
746
|
+
if (l == "custom" && n == "all_time" && RuleBuilder.getRules((s = i.modelValue) == null ? void 0 : s.rules.g_time).length > 0) {
|
|
747
|
+
const h = await prompt.confirm(
|
|
748
|
+
r("connect.template.rule.time.confirm_remove"),
|
|
749
|
+
r("connect.common.confirm"),
|
|
750
|
+
r("connect.common.confirm"),
|
|
751
|
+
r("connect.common.cancel")
|
|
752
|
+
);
|
|
753
|
+
h && u(
|
|
754
|
+
"update:model-value",
|
|
755
|
+
RuleBuilder.setRuleToGroup(
|
|
756
|
+
i.modelValue ?? RuleBuilder.scaffoldGroup(),
|
|
757
|
+
RuleBuilder.scaffoldGroup("g_time")
|
|
758
|
+
)
|
|
759
|
+
), a.value = h ? n : l;
|
|
760
|
+
}
|
|
761
|
+
});
|
|
762
|
+
async function o(n) {
|
|
763
|
+
var l;
|
|
764
|
+
if (n == "custom" && RuleBuilder.getRules((l = i.modelValue) == null ? void 0 : l.rules.g_time).length > 0) {
|
|
765
|
+
if (!await prompt.confirm(
|
|
766
|
+
r("connect.template.rule.time.confirm_remove"),
|
|
767
|
+
r("connect.common.confirm"),
|
|
768
|
+
r("connect.common.confirm"),
|
|
769
|
+
r("connect.common.cancel")
|
|
770
|
+
)) {
|
|
771
|
+
a.value = "all_time";
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
u(
|
|
775
|
+
"update:model-value",
|
|
776
|
+
RuleBuilder.setRuleToGroup(
|
|
777
|
+
i.modelValue ?? RuleBuilder.scaffoldGroup(),
|
|
778
|
+
RuleBuilder.scaffoldGroup("g_time")
|
|
779
|
+
)
|
|
780
|
+
);
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
return (n, l) => {
|
|
784
|
+
var g;
|
|
785
|
+
const s = resolveComponent("FmRadio"), h = resolveComponent("FmRadioGroup");
|
|
786
|
+
return openBlock(), createElementBlock("div", _hoisted_1$i, [
|
|
787
|
+
createVNode(h, {
|
|
788
|
+
modelValue: unref(a),
|
|
789
|
+
"onUpdate:modelValue": [
|
|
790
|
+
l[0] || (l[0] = (b) => isRef(a) ? a.value = b : null),
|
|
791
|
+
l[1] || (l[1] = (b) => o(b))
|
|
792
|
+
]
|
|
793
|
+
}, {
|
|
794
|
+
default: withCtx(() => [
|
|
795
|
+
createVNode(s, {
|
|
796
|
+
label: unref(r)("connect.template.rule.time.all_time"),
|
|
797
|
+
value: "all_time"
|
|
798
|
+
}, null, 8, ["label"]),
|
|
799
|
+
createVNode(s, {
|
|
800
|
+
label: unref(r)("connect.template.rule.time.custom"),
|
|
801
|
+
value: "custom"
|
|
802
|
+
}, null, 8, ["label"])
|
|
803
|
+
]),
|
|
804
|
+
_: 1
|
|
805
|
+
}, 8, ["modelValue"]),
|
|
806
|
+
unref(a) == "custom" ? (openBlock(), createBlock(_sfc_main$p, {
|
|
807
|
+
key: 0,
|
|
808
|
+
class: "!mt-[0px]",
|
|
809
|
+
"include-only": "trigger",
|
|
810
|
+
"trigger-type": "SCHEDULE",
|
|
811
|
+
"model-value": ((g = e.modelValue) == null ? void 0 : g.rules.g_time) ?? unref(RuleBuilder).scaffoldGroup("g_time"),
|
|
812
|
+
"onUpdate:modelValue": l[2] || (l[2] = (b) => u(
|
|
813
|
+
"update:model-value",
|
|
814
|
+
unref(RuleBuilder).setRuleToGroup(
|
|
815
|
+
e.modelValue ?? unref(RuleBuilder).scaffoldGroup(),
|
|
816
|
+
b,
|
|
817
|
+
"&&"
|
|
818
|
+
)
|
|
819
|
+
))
|
|
820
|
+
}, null, 8, ["model-value"])) : createCommentVNode("", !0)
|
|
821
|
+
]);
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
}), _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
825
|
+
__name: "BirthdayInput",
|
|
826
|
+
props: {
|
|
827
|
+
modelValue: {
|
|
828
|
+
type: Object
|
|
829
|
+
}
|
|
830
|
+
},
|
|
831
|
+
emits: ["update:model-value"],
|
|
832
|
+
setup(e, { emit: d }) {
|
|
833
|
+
const r = e, i = d, u = computed(() => {
|
|
834
|
+
const { property: a, operator: o, equator: n } = RuleBuilder.simplify(
|
|
835
|
+
r.modelValue ?? RuleBuilder.constructEntry("user.birthday", "_isDay", {
|
|
836
|
+
op: "before",
|
|
837
|
+
x: 1
|
|
838
|
+
})
|
|
839
|
+
);
|
|
840
|
+
return {
|
|
841
|
+
property: a,
|
|
842
|
+
operator: o,
|
|
843
|
+
equator: n
|
|
844
|
+
};
|
|
845
|
+
});
|
|
846
|
+
return (a, o) => {
|
|
847
|
+
const n = resolveComponent("FmRadio"), l = resolveComponent("FmStepperField");
|
|
848
|
+
return openBlock(), createElementBlock("div", null, [
|
|
849
|
+
createVNode(n, {
|
|
850
|
+
label: "On birthday",
|
|
851
|
+
value: "_isRange-day",
|
|
852
|
+
"model-value": `${unref(u).operator}-${unref(u).equator.unit}`,
|
|
853
|
+
"onUpdate:modelValue": o[0] || (o[0] = () => {
|
|
854
|
+
i(
|
|
855
|
+
"update:model-value",
|
|
856
|
+
unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
|
|
857
|
+
op: "this",
|
|
858
|
+
unit: "day",
|
|
859
|
+
ignoreYear: !0
|
|
860
|
+
})
|
|
861
|
+
);
|
|
862
|
+
})
|
|
863
|
+
}, null, 8, ["model-value"]),
|
|
864
|
+
createVNode(n, {
|
|
865
|
+
label: "N days before birthday",
|
|
866
|
+
value: "_isDay",
|
|
867
|
+
"model-value": unref(u).operator,
|
|
868
|
+
"onUpdate:modelValue": o[1] || (o[1] = () => {
|
|
869
|
+
i(
|
|
870
|
+
"update:model-value",
|
|
871
|
+
unref(RuleBuilder).constructEntry("user.birthday", "_isDay", {
|
|
872
|
+
op: "after",
|
|
873
|
+
x: 1,
|
|
874
|
+
ignoreYear: !0
|
|
875
|
+
})
|
|
876
|
+
);
|
|
877
|
+
})
|
|
878
|
+
}, null, 8, ["model-value"]),
|
|
879
|
+
unref(u).operator == "_isDay" ? (openBlock(), createBlock(l, {
|
|
880
|
+
key: 0,
|
|
881
|
+
label: "Days before birthday",
|
|
882
|
+
"show-steppers": !1,
|
|
883
|
+
"model-value": unref(u).equator.x,
|
|
884
|
+
"onUpdate:modelValue": o[2] || (o[2] = (s) => i(
|
|
885
|
+
"update:model-value",
|
|
886
|
+
unref(RuleBuilder).constructEntry("user.birthday", "_isDay", {
|
|
887
|
+
op: "after",
|
|
888
|
+
x: s,
|
|
889
|
+
ignoreYear: !0
|
|
890
|
+
})
|
|
891
|
+
))
|
|
892
|
+
}, null, 8, ["model-value"])) : createCommentVNode("", !0),
|
|
893
|
+
createVNode(n, {
|
|
894
|
+
label: "In birthday week",
|
|
895
|
+
value: "_isRange-week",
|
|
896
|
+
"model-value": `${unref(u).operator}-${unref(u).equator.unit}`,
|
|
897
|
+
"onUpdate:modelValue": o[3] || (o[3] = () => {
|
|
898
|
+
i(
|
|
899
|
+
"update:model-value",
|
|
900
|
+
unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
|
|
901
|
+
op: "this",
|
|
902
|
+
unit: "week",
|
|
903
|
+
ignoreYear: !0
|
|
904
|
+
})
|
|
905
|
+
);
|
|
906
|
+
})
|
|
907
|
+
}, null, 8, ["model-value"]),
|
|
908
|
+
createVNode(n, {
|
|
909
|
+
label: "In birthday month",
|
|
910
|
+
value: "_isRange-month",
|
|
911
|
+
"model-value": `${unref(u).operator}-${unref(u).equator.unit}`,
|
|
912
|
+
"onUpdate:modelValue": o[4] || (o[4] = () => {
|
|
913
|
+
i(
|
|
914
|
+
"update:model-value",
|
|
915
|
+
unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
|
|
916
|
+
op: "this",
|
|
917
|
+
unit: "month",
|
|
918
|
+
ignoreYear: !0
|
|
919
|
+
})
|
|
920
|
+
);
|
|
921
|
+
})
|
|
922
|
+
}, null, 8, ["model-value"])
|
|
923
|
+
]);
|
|
924
|
+
};
|
|
925
|
+
}
|
|
926
|
+
}), _hoisted_1$h = { class: "space-y-16" }, _hoisted_2$e = { class: "grid grid-cols-3 gap-16" }, _hoisted_3$b = { class: "fm-typo-en-title-sm-800" }, _hoisted_4$8 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
927
|
+
__name: "CampaignTriggerInput",
|
|
928
|
+
props: {
|
|
929
|
+
campaignType: {
|
|
930
|
+
type: String,
|
|
931
|
+
required: !0
|
|
932
|
+
},
|
|
933
|
+
modelValue: {
|
|
934
|
+
type: String
|
|
935
|
+
},
|
|
936
|
+
disabled: {
|
|
937
|
+
type: Boolean,
|
|
938
|
+
default: !1
|
|
939
|
+
}
|
|
940
|
+
},
|
|
941
|
+
emits: ["update:model-value"],
|
|
942
|
+
setup(e, { emit: d }) {
|
|
943
|
+
const r = e, i = d, u = computed(() => r.disabled ? TypeToTriggerOptions[r.campaignType].filter(
|
|
944
|
+
(a) => a.value == r.modelValue
|
|
945
|
+
) : TypeToTriggerOptions[r.campaignType]);
|
|
946
|
+
return (a, o) => {
|
|
947
|
+
const n = resolveComponent("FmCard");
|
|
948
|
+
return openBlock(), createElementBlock("div", _hoisted_1$h, [
|
|
949
|
+
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)),
|
|
950
|
+
createElementVNode("div", _hoisted_2$e, [
|
|
951
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (l) => (openBlock(), createBlock(n, {
|
|
952
|
+
variant: "outlined",
|
|
953
|
+
disabled: r.disabled,
|
|
954
|
+
class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
|
|
955
|
+
"col-span-3": unref(u).length == 1,
|
|
956
|
+
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == l.value,
|
|
957
|
+
"hover:bg-fm-color-opacity-sm": e.modelValue != l.value
|
|
958
|
+
}]),
|
|
959
|
+
onClick: () => {
|
|
960
|
+
r.modelValue != l.value && !r.disabled && i("update:model-value", l.value);
|
|
961
|
+
},
|
|
962
|
+
key: l.name
|
|
963
|
+
}, {
|
|
964
|
+
default: withCtx(() => [
|
|
965
|
+
createElementVNode("div", _hoisted_3$b, toDisplayString(l.name), 1),
|
|
966
|
+
createElementVNode("div", _hoisted_4$8, toDisplayString(l.description), 1)
|
|
967
|
+
]),
|
|
968
|
+
_: 2
|
|
969
|
+
}, 1032, ["disabled", "class", "onClick"]))), 128))
|
|
970
|
+
])
|
|
971
|
+
]);
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
}), _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
975
|
+
__name: "DateInput",
|
|
976
|
+
props: {
|
|
977
|
+
label: {
|
|
978
|
+
type: String,
|
|
979
|
+
required: !1
|
|
980
|
+
},
|
|
981
|
+
modelValue: {
|
|
982
|
+
type: Object,
|
|
983
|
+
required: !1
|
|
984
|
+
}
|
|
985
|
+
},
|
|
986
|
+
emits: ["update:model-value"],
|
|
987
|
+
setup(e, { emit: d }) {
|
|
988
|
+
const r = d;
|
|
989
|
+
return (i, u) => {
|
|
990
|
+
const a = resolveComponent("FmButton"), o = resolveComponent("FmField"), n = resolveComponent("FmDatePicker");
|
|
991
|
+
return openBlock(), createBlock(n, {
|
|
992
|
+
label: e.label,
|
|
993
|
+
"model-value": e.modelValue || "",
|
|
994
|
+
"onUpdate:modelValue": u[1] || (u[1] = (l) => r("update:model-value", l))
|
|
995
|
+
}, {
|
|
996
|
+
"trigger-button": withCtx(({ opened: l }) => [
|
|
997
|
+
createVNode(o, {
|
|
998
|
+
class: "flex items-center",
|
|
999
|
+
"prepend-icon": "calendar_month",
|
|
1000
|
+
"icon-outlined": !l
|
|
1001
|
+
}, {
|
|
1002
|
+
append: withCtx(() => [
|
|
1003
|
+
e.modelValue ? (openBlock(), createBlock(a, {
|
|
1004
|
+
key: 0,
|
|
1005
|
+
variant: "tertiary",
|
|
1006
|
+
icon: "clear",
|
|
1007
|
+
onClick: u[0] || (u[0] = (s) => (s.stopPropagation(), r("update:model-value", null)))
|
|
1008
|
+
})) : createCommentVNode("", !0)
|
|
1009
|
+
]),
|
|
1010
|
+
default: withCtx(() => [
|
|
1011
|
+
createElementVNode("div", {
|
|
1012
|
+
class: normalizeClass(["fm-typo-en-body-lg-400", { "text-fm-color-typo-secondary": !e.modelValue }])
|
|
1013
|
+
}, toDisplayString(e.modelValue ? unref(hooks)(e.modelValue).format("DD MMM YYYY") : "DD MM YYYY"), 3)
|
|
1014
|
+
]),
|
|
1015
|
+
_: 2
|
|
1016
|
+
}, 1032, ["icon-outlined"])
|
|
1017
|
+
]),
|
|
1018
|
+
_: 1
|
|
1019
|
+
}, 8, ["label", "model-value"]);
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
}), _hoisted_1$g = { class: "flex items-center gap-8 w-full xs:flex-col" }, _hoisted_2$d = { class: "flex-1 xs:w-full" }, _hoisted_3$a = { class: "flex-1 xs:w-full" }, _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
1023
|
+
__name: "DateRangeInput",
|
|
1024
|
+
props: {
|
|
1025
|
+
modelValue: {
|
|
1026
|
+
type: Object,
|
|
1027
|
+
required: !1
|
|
1028
|
+
}
|
|
1029
|
+
},
|
|
1030
|
+
emits: ["update:model-value"],
|
|
1031
|
+
setup(e, { emit: d }) {
|
|
1032
|
+
const r = d;
|
|
1033
|
+
return (i, u) => {
|
|
1034
|
+
var a, o;
|
|
1035
|
+
return openBlock(), createElementBlock("div", _hoisted_1$g, [
|
|
1036
|
+
createElementVNode("div", _hoisted_2$d, [
|
|
1037
|
+
createVNode(_sfc_main$h, {
|
|
1038
|
+
"model-value": ((a = e.modelValue) == null ? void 0 : a.startDate) ?? null,
|
|
1039
|
+
label: "Start date",
|
|
1040
|
+
"onUpdate:modelValue": u[0] || (u[0] = (n) => {
|
|
1041
|
+
var l;
|
|
1042
|
+
return r("update:model-value", {
|
|
1043
|
+
startDate: n,
|
|
1044
|
+
endDate: ((l = e.modelValue) == null ? void 0 : l.endDate) ?? null
|
|
1045
|
+
});
|
|
1046
|
+
})
|
|
1047
|
+
}, null, 8, ["model-value"])
|
|
1048
|
+
]),
|
|
1049
|
+
u[2] || (u[2] = createElementVNode("div", { class: "mt-5 xs:hidden" }, "to", -1)),
|
|
1050
|
+
createElementVNode("div", _hoisted_3$a, [
|
|
1051
|
+
createVNode(_sfc_main$h, {
|
|
1052
|
+
"model-value": ((o = e.modelValue) == null ? void 0 : o.endDate) ?? null,
|
|
1053
|
+
label: "End date",
|
|
1054
|
+
"onUpdate:modelValue": u[1] || (u[1] = (n) => {
|
|
1055
|
+
var l;
|
|
1056
|
+
return r("update:model-value", {
|
|
1057
|
+
startDate: ((l = e.modelValue) == null ? void 0 : l.startDate) ?? null,
|
|
1058
|
+
endDate: n
|
|
1059
|
+
});
|
|
1060
|
+
})
|
|
1061
|
+
}, null, 8, ["model-value"])
|
|
1062
|
+
])
|
|
1063
|
+
]);
|
|
1064
|
+
};
|
|
1065
|
+
}
|
|
1066
|
+
}), _hoisted_1$f = { class: "space-y-8" }, _hoisted_2$c = { class: "grid grid-cols-2 gap-16" }, _hoisted_3$9 = {
|
|
1067
|
+
key: 0,
|
|
1068
|
+
class: "space-y-4"
|
|
1069
|
+
}, _hoisted_4$7 = { class: "fm-typo-en-body-lg-400 class flex items-center justify-between" }, _hoisted_5$4 = { class: "text-ellipsis line-clamp-1" }, _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
1070
|
+
__name: "ScheduleRuleInput",
|
|
1071
|
+
props: {
|
|
1072
|
+
modelValue: {
|
|
1073
|
+
type: Object,
|
|
1074
|
+
required: !0
|
|
1075
|
+
},
|
|
1076
|
+
startDate: {
|
|
1077
|
+
type: String
|
|
1078
|
+
},
|
|
1079
|
+
endDate: {
|
|
1080
|
+
type: String
|
|
1081
|
+
}
|
|
1082
|
+
},
|
|
1083
|
+
emits: ["update:model-value"],
|
|
1084
|
+
setup(e, { emit: d }) {
|
|
1085
|
+
const r = e, i = d, u = useCoreStore(), a = computed(
|
|
1086
|
+
() => CountryTimezone[u.currentCountry.value || "MY"]
|
|
1087
|
+
);
|
|
1088
|
+
function o() {
|
|
1089
|
+
const k = RuleBuilder.getRules(r.modelValue);
|
|
1090
|
+
return k.length == 0 ? "fixed" : k.some(
|
|
1091
|
+
(p) => isRuleEntry(p) && RuleBuilder.simplify(p).operator == "_rrule"
|
|
1092
|
+
) ? "repeating" : "fixed";
|
|
1093
|
+
}
|
|
1094
|
+
const n = ref(o()), l = ref(!1), s = computed(() => {
|
|
1095
|
+
const k = RuleBuilder.getRules(r.modelValue), p = k.find(
|
|
1096
|
+
(y) => isRuleEntry(y) && RuleBuilder.simplify(y).property == "trigger.date"
|
|
1097
|
+
), c = k.find(
|
|
1098
|
+
(y) => isRuleEntry(y) && RuleBuilder.simplify(y).property == "trigger.time"
|
|
1099
|
+
);
|
|
1100
|
+
return {
|
|
1101
|
+
date: p ? RuleBuilder.simplify(p).equator : null,
|
|
1102
|
+
time: c ? RuleBuilder.simplify(c).equator : null
|
|
1103
|
+
};
|
|
1104
|
+
}), h = computed(
|
|
1105
|
+
() => calculateNextScheduleAt(
|
|
1106
|
+
r.modelValue,
|
|
1107
|
+
/* @__PURE__ */ new Date(),
|
|
1108
|
+
r.startDate ? new Date(r.startDate) : void 0,
|
|
1109
|
+
r.endDate ? new Date(r.endDate) : void 0
|
|
1110
|
+
)
|
|
1111
|
+
);
|
|
1112
|
+
function g(k) {
|
|
1113
|
+
const p = k.label.toLowerCase(), c = p == "fixed" ? [
|
|
1114
|
+
RuleBuilder.constructEntry(
|
|
1115
|
+
"trigger.date",
|
|
1116
|
+
"_isOnDate",
|
|
1117
|
+
(/* @__PURE__ */ new Date()).toISOString()
|
|
1118
|
+
),
|
|
1119
|
+
RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
|
|
1120
|
+
] : [
|
|
1121
|
+
RuleBuilder.constructEntry(
|
|
1122
|
+
"trigger.date",
|
|
1123
|
+
"_rrule",
|
|
1124
|
+
"RRULE:FREQ=DAILY;INTERVAL=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0;WKST=SU"
|
|
1125
|
+
),
|
|
1126
|
+
RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
|
|
1127
|
+
];
|
|
1128
|
+
i(
|
|
1129
|
+
"update:model-value",
|
|
1130
|
+
RuleBuilder.setRuleToGroup(
|
|
1131
|
+
RuleBuilder.scaffoldGroup("g_schedule"),
|
|
1132
|
+
c
|
|
1133
|
+
)
|
|
1134
|
+
), n.value = p;
|
|
1135
|
+
}
|
|
1136
|
+
function b(k) {
|
|
1137
|
+
n.value == "fixed" ? i(
|
|
1138
|
+
"update:model-value",
|
|
1139
|
+
RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup("g_schedule"), [
|
|
1140
|
+
RuleBuilder.constructEntry(
|
|
1141
|
+
"trigger.date",
|
|
1142
|
+
"_isOnDate",
|
|
1143
|
+
k.date
|
|
1144
|
+
),
|
|
1145
|
+
RuleBuilder.constructEntry(
|
|
1146
|
+
"trigger.time",
|
|
1147
|
+
"_isOnTime",
|
|
1148
|
+
k.time
|
|
1149
|
+
)
|
|
1150
|
+
])
|
|
1151
|
+
) : i(
|
|
1152
|
+
"update:model-value",
|
|
1153
|
+
RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup("g_schedule"), [
|
|
1154
|
+
RuleBuilder.constructEntry(
|
|
1155
|
+
"trigger.date",
|
|
1156
|
+
"_rrule",
|
|
1157
|
+
k.date
|
|
1158
|
+
),
|
|
1159
|
+
RuleBuilder.constructEntry(
|
|
1160
|
+
"trigger.time",
|
|
1161
|
+
"_isOnTime",
|
|
1162
|
+
k.time
|
|
1163
|
+
)
|
|
1164
|
+
])
|
|
1165
|
+
);
|
|
1166
|
+
}
|
|
1167
|
+
return (k, p) => {
|
|
1168
|
+
const c = resolveComponent("FmButtonGroup"), y = resolveComponent("FmTimePicker"), m = resolveComponent("FmIcon"), f = resolveComponent("FmTooltip"), B = resolveComponent("FmField"), C = resolveComponent("FmCard"), E = resolveComponent("FmPopover"), $ = resolveComponent("FmDatePicker"), x = resolveComponent("FmHelperText");
|
|
1169
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
1170
|
+
createVNode(c, {
|
|
1171
|
+
items: [{ label: "Fixed" }, { label: "Repeating" }],
|
|
1172
|
+
"model-value": { label: unref(cases).title(unref(n)) },
|
|
1173
|
+
"onUpdate:modelValue": g,
|
|
1174
|
+
class: "mb-8"
|
|
1175
|
+
}, null, 8, ["model-value"]),
|
|
1176
|
+
createElementVNode("div", _hoisted_1$f, [
|
|
1177
|
+
createElementVNode("div", _hoisted_2$c, [
|
|
1178
|
+
createVNode(y, {
|
|
1179
|
+
label: "Notify time",
|
|
1180
|
+
"model-value": unref(s).time,
|
|
1181
|
+
"onUpdate:modelValue": p[0] || (p[0] = (S) => b({ date: unref(s).date, time: S })),
|
|
1182
|
+
"helper-text": unref(s).time ? void 0 : "Time is required",
|
|
1183
|
+
"helper-state": unref(s).time ? void 0 : "error"
|
|
1184
|
+
}, null, 8, ["model-value", "helper-text", "helper-state"]),
|
|
1185
|
+
unref(n) == "repeating" ? (openBlock(), createElementBlock("div", _hoisted_3$9, [
|
|
1186
|
+
createElementVNode("div", _hoisted_4$7, [
|
|
1187
|
+
p[5] || (p[5] = createElementVNode("div", null, "Notify date", -1)),
|
|
1188
|
+
unref(s).date ? (openBlock(), createBlock(f, {
|
|
1189
|
+
key: 0,
|
|
1190
|
+
"z-index": 9999,
|
|
1191
|
+
content: unref(SummarizeRrule)(unref(RRule).fromString(unref(s).date).options)
|
|
1192
|
+
}, {
|
|
1193
|
+
default: withCtx(() => [
|
|
1194
|
+
createVNode(m, {
|
|
1195
|
+
name: "info",
|
|
1196
|
+
size: "sm",
|
|
1197
|
+
outline: !0
|
|
1198
|
+
})
|
|
1199
|
+
]),
|
|
1200
|
+
_: 1
|
|
1201
|
+
}, 8, ["content"])) : createCommentVNode("", !0)
|
|
1202
|
+
]),
|
|
1203
|
+
createVNode(E, {
|
|
1204
|
+
"show-popover": unref(l),
|
|
1205
|
+
onPopoverChanged: p[3] || (p[3] = (S) => l.value = S)
|
|
1206
|
+
}, {
|
|
1207
|
+
"popover-button": withCtx(() => [
|
|
1208
|
+
createVNode(B, {
|
|
1209
|
+
class: "cursor-pointer",
|
|
1210
|
+
"helper-text": unref(s).date ? void 0 : "Date is required",
|
|
1211
|
+
"helper-state": unref(s).date ? void 0 : "error"
|
|
1212
|
+
}, {
|
|
1213
|
+
default: withCtx(() => [
|
|
1214
|
+
createElementVNode("div", _hoisted_5$4, toDisplayString(unref(s).date ? unref(SummarizeRrule)(unref(RRule).fromString(unref(s).date).options) : "Set a repeating date"), 1)
|
|
1215
|
+
]),
|
|
1216
|
+
_: 1
|
|
1217
|
+
}, 8, ["helper-text", "helper-state"])
|
|
1218
|
+
]),
|
|
1219
|
+
default: withCtx(() => [
|
|
1220
|
+
createVNode(C, { class: "elevated p-8 w-[450px]" }, {
|
|
1221
|
+
default: withCtx(() => [
|
|
1222
|
+
createVNode(_sfc_main$q, {
|
|
1223
|
+
"apply-button": !0,
|
|
1224
|
+
"model-value": unref(s).date || "",
|
|
1225
|
+
onCancel: p[1] || (p[1] = (S) => l.value = !1),
|
|
1226
|
+
"onUpdate:modelValue": p[2] || (p[2] = (S) => (b({ date: S, time: unref(s).time }), l.value = !1))
|
|
1227
|
+
}, null, 8, ["model-value"])
|
|
1228
|
+
]),
|
|
1229
|
+
_: 1
|
|
1230
|
+
})
|
|
1231
|
+
]),
|
|
1232
|
+
_: 1
|
|
1233
|
+
}, 8, ["show-popover"])
|
|
1234
|
+
])) : (openBlock(), createBlock($, {
|
|
1235
|
+
key: 1,
|
|
1236
|
+
label: "Notify date",
|
|
1237
|
+
"model-value": unref(s).date || "",
|
|
1238
|
+
"onUpdate:modelValue": p[4] || (p[4] = (S) => b({ date: S, time: unref(s).time })),
|
|
1239
|
+
"helper-text": unref(s).date ? void 0 : "Date is required",
|
|
1240
|
+
"helper-state": unref(s).date ? void 0 : "error"
|
|
1241
|
+
}, null, 8, ["model-value", "helper-text", "helper-state"]))
|
|
1242
|
+
]),
|
|
1243
|
+
unref(s).date && unref(s).time && unref(h) ? (openBlock(), createBlock(x, {
|
|
1244
|
+
key: 0,
|
|
1245
|
+
text: `${unref(moment)(unref(h)).isAfter(unref(moment)()) ? "The next notification will be sent on " : "Last trigger is on "} ${unref(moment)(unref(h)).format("dddd, DD MMM YYYY")} at
|
|
1246
|
+
${unref(moment)(unref(h)).format("hh:mmA")}(UTC${unref(moment).tz(unref(a)).format("Z")}) (${unref(moment)(unref(h)).fromNow()})`
|
|
1247
|
+
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
1248
|
+
])
|
|
1249
|
+
], 64);
|
|
1250
|
+
};
|
|
1251
|
+
}
|
|
1252
|
+
}), _hoisted_1$e = { class: "space-y-16" }, _hoisted_2$b = { class: "grid grid-cols-2 gap-16" }, _hoisted_3$8 = { class: "fm-typo-en-title-sm-800" }, _hoisted_4$6 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
1253
|
+
__name: "GameTypeInput",
|
|
1254
|
+
props: {
|
|
1255
|
+
modelValue: {
|
|
1256
|
+
type: String
|
|
1257
|
+
}
|
|
1258
|
+
},
|
|
1259
|
+
emits: ["update:model-value"],
|
|
1260
|
+
setup(e, { emit: d }) {
|
|
1261
|
+
const r = e, i = d, u = computed(
|
|
1262
|
+
() => [
|
|
1263
|
+
{
|
|
1264
|
+
label: "Fortune Wheel",
|
|
1265
|
+
description: "Allow customers to spin the Fortune Wheel to win various rewards.",
|
|
1266
|
+
value: F_GAME_TYPE.enum.FORTUNE_WHEEL,
|
|
1267
|
+
hidden: !1
|
|
1268
|
+
},
|
|
1269
|
+
{
|
|
1270
|
+
label: "Rock paper scissor",
|
|
1271
|
+
description: "Customers play a game of Rock Paper Scissors against the cashier.",
|
|
1272
|
+
value: F_GAME_TYPE.enum.ROCK_PAPER_SCISSORS,
|
|
1273
|
+
hidden: !0
|
|
1274
|
+
}
|
|
1275
|
+
].filter((a) => !a.hidden)
|
|
1276
|
+
);
|
|
1277
|
+
return (a, o) => {
|
|
1278
|
+
const n = resolveComponent("FmCard");
|
|
1279
|
+
return openBlock(), createElementBlock("div", _hoisted_1$e, [
|
|
1280
|
+
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)),
|
|
1281
|
+
createElementVNode("div", _hoisted_2$b, [
|
|
1282
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (l) => (openBlock(), createBlock(n, {
|
|
1283
|
+
variant: "outlined",
|
|
1284
|
+
class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
|
|
1285
|
+
"col-span-2": unref(u).length == 1,
|
|
1286
|
+
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == l.value,
|
|
1287
|
+
"hover:bg-fm-color-opacity-sm": e.modelValue != l.value
|
|
1288
|
+
}]),
|
|
1289
|
+
onClick: () => {
|
|
1290
|
+
r.modelValue != l.value && i("update:model-value", l.value);
|
|
1291
|
+
},
|
|
1292
|
+
key: l.value
|
|
1293
|
+
}, {
|
|
1294
|
+
default: withCtx(() => [
|
|
1295
|
+
createElementVNode("div", _hoisted_3$8, toDisplayString(l.label), 1),
|
|
1296
|
+
createElementVNode("div", _hoisted_4$6, toDisplayString(l.description), 1)
|
|
1297
|
+
]),
|
|
1298
|
+
_: 2
|
|
1299
|
+
}, 1032, ["class", "onClick"]))), 128))
|
|
1300
|
+
])
|
|
1301
|
+
]);
|
|
1302
|
+
};
|
|
1303
|
+
}
|
|
1304
|
+
}), _hoisted_1$d = {
|
|
1305
|
+
key: 0,
|
|
1306
|
+
class: "flex flex-col gap-y-24"
|
|
1307
|
+
}, _hoisted_2$a = { class: "flex gap-8 items-center justify-start" }, _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
1308
|
+
__name: "EditRewardPoolSheet",
|
|
1309
|
+
emits: ["update:model-value"],
|
|
1310
|
+
setup(e, { expose: d, emit: r }) {
|
|
1311
|
+
const i = useMembershipStore(), { minor: u } = useLoading, a = ref(!1), o = ref(), n = ref(), l = ref(0), s = computed(() => {
|
|
1312
|
+
var c;
|
|
1313
|
+
return ((c = i.loyaltyRewards.items.find(
|
|
1314
|
+
(y) => {
|
|
1315
|
+
var m;
|
|
1316
|
+
return y.value === ((m = o.value) == null ? void 0 : m.collectible);
|
|
1317
|
+
}
|
|
1318
|
+
)) == null ? void 0 : c.raw.type) === "CREDIT" ? FdoCreditLoyaltyReward : FdtoRandomReward;
|
|
1319
|
+
}), h = computed(() => {
|
|
1320
|
+
const p = s.value.safeParse(o.value);
|
|
1321
|
+
return p.success ? [] : p.error.errors;
|
|
1322
|
+
});
|
|
1323
|
+
function g(p, c, y) {
|
|
1324
|
+
p && (o.value = c, l.value = y), a.value = p;
|
|
1325
|
+
}
|
|
1326
|
+
const b = r;
|
|
1327
|
+
async function k() {
|
|
1328
|
+
const p = s.value.safeParse(o.value);
|
|
1329
|
+
p.success && (await u(
|
|
1330
|
+
async () => {
|
|
1331
|
+
p.data.type === "VOUCHER" && n.value && (p.data.collectibleConfig.image = await firebaseStorage.update(
|
|
1332
|
+
p.data.collectibleConfig.image || firebaseStorage.collectibleImagePath(void 0, n.value),
|
|
1333
|
+
n.value
|
|
1334
|
+
));
|
|
1335
|
+
},
|
|
1336
|
+
{
|
|
1337
|
+
message: "Uploading reward image",
|
|
1338
|
+
successMessage: "Reward image updated"
|
|
1339
|
+
}
|
|
1340
|
+
), b("update:model-value", p.data, l.value));
|
|
1341
|
+
}
|
|
1342
|
+
return d({
|
|
1343
|
+
showSheet: g
|
|
1344
|
+
}), (p, c) => {
|
|
1345
|
+
const y = resolveComponent("FmSelect"), m = resolveComponent("FmStepperField"), f = resolveComponent("FmButton"), B = resolveComponent("FmSideSheet");
|
|
1346
|
+
return openBlock(), createBlock(B, {
|
|
1347
|
+
"max-width": 560,
|
|
1348
|
+
modelValue: unref(a),
|
|
1349
|
+
"onUpdate:modelValue": [
|
|
1350
|
+
c[9] || (c[9] = (C) => isRef(a) ? a.value = C : null),
|
|
1351
|
+
c[10] || (c[10] = (C) => a.value = C)
|
|
1352
|
+
],
|
|
1353
|
+
header: "Edit reward",
|
|
1354
|
+
"dismiss-away": ""
|
|
1355
|
+
}, {
|
|
1356
|
+
"side-sheet-footer": withCtx(() => [
|
|
1357
|
+
createElementVNode("div", _hoisted_2$a, [
|
|
1358
|
+
createVNode(f, {
|
|
1359
|
+
variant: "primary",
|
|
1360
|
+
type: "button",
|
|
1361
|
+
disabled: unref(h).length > 0,
|
|
1362
|
+
label: "Confirm",
|
|
1363
|
+
onClick: c[7] || (c[7] = (C) => k())
|
|
1364
|
+
}, null, 8, ["disabled"]),
|
|
1365
|
+
createVNode(f, {
|
|
1366
|
+
variant: "secondary",
|
|
1367
|
+
type: "button",
|
|
1368
|
+
label: "Cancel",
|
|
1369
|
+
onClick: c[8] || (c[8] = (C) => a.value = !1)
|
|
1370
|
+
})
|
|
1371
|
+
])
|
|
1372
|
+
]),
|
|
1373
|
+
default: withCtx(() => {
|
|
1374
|
+
var C, E, $;
|
|
1375
|
+
return [
|
|
1376
|
+
unref(o) ? (openBlock(), createElementBlock("div", _hoisted_1$d, [
|
|
1377
|
+
createVNode(y, {
|
|
1378
|
+
label: "Reward Type",
|
|
1379
|
+
items: [
|
|
1380
|
+
{ label: "No Reward", value: "NO_REWARD" },
|
|
1381
|
+
{ label: "Voucher", value: "VOUCHER" },
|
|
1382
|
+
{ label: "Loyalty", value: "LOYALTY" }
|
|
1383
|
+
],
|
|
1384
|
+
"model-value": unref(o).type,
|
|
1385
|
+
"onUpdate:modelValue": c[0] || (c[0] = (x) => {
|
|
1386
|
+
x == "NO_REWARD" ? o.value = {
|
|
1387
|
+
type: "NO_REWARD",
|
|
1388
|
+
collectible: null,
|
|
1389
|
+
weight: 1
|
|
1390
|
+
} : x === "VOUCHER" ? o.value = {
|
|
1391
|
+
collectible: null,
|
|
1392
|
+
type: "VOUCHER",
|
|
1393
|
+
collectibleConfig: unref(initCollectibleConfig)("VOUCHER", {
|
|
1394
|
+
business: unref(useCoreStore)().currentBusiness.value._id
|
|
1395
|
+
}),
|
|
1396
|
+
earningOption: {
|
|
1397
|
+
amount: 1,
|
|
1398
|
+
type: "FIXED"
|
|
1399
|
+
},
|
|
1400
|
+
validityOption: {
|
|
1401
|
+
validForDay: 7
|
|
1402
|
+
},
|
|
1403
|
+
weight: 1
|
|
1404
|
+
} : o.value = {
|
|
1405
|
+
collectible: unref(i).loyaltyRewards.raw[0]._id,
|
|
1406
|
+
type: "LOYALTY",
|
|
1407
|
+
earningOption: {
|
|
1408
|
+
amount: 1,
|
|
1409
|
+
type: "FIXED"
|
|
1410
|
+
},
|
|
1411
|
+
validityOption: {
|
|
1412
|
+
validForDay: 7
|
|
1413
|
+
},
|
|
1414
|
+
weight: 1
|
|
1415
|
+
};
|
|
1416
|
+
})
|
|
1417
|
+
}, null, 8, ["model-value"]),
|
|
1418
|
+
unref(o).type == "LOYALTY" ? (openBlock(), createBlock(y, {
|
|
1419
|
+
key: 0,
|
|
1420
|
+
label: "Loyalty type",
|
|
1421
|
+
rules: [unref(ZodHelper).ruleAtPath(unref(s), "collectible", [unref(o).type])],
|
|
1422
|
+
items: unref(i).loyaltyRewards.items,
|
|
1423
|
+
"model-value": unref(o).collectible,
|
|
1424
|
+
"onUpdate:modelValue": c[1] || (c[1] = (x) => unref(o).collectible = x)
|
|
1425
|
+
}, null, 8, ["rules", "items", "model-value"])) : createCommentVNode("", !0),
|
|
1426
|
+
createVNode(m, {
|
|
1427
|
+
label: "Weight",
|
|
1428
|
+
rules: [unref(ZodHelper).ruleAtPath(unref(s), "weight", [unref(o).type])],
|
|
1429
|
+
"model-value": unref(o).weight,
|
|
1430
|
+
"onUpdate:modelValue": c[2] || (c[2] = (x) => o.value = {
|
|
1431
|
+
...unref(o),
|
|
1432
|
+
weight: x
|
|
1433
|
+
})
|
|
1434
|
+
}, null, 8, ["rules", "model-value"]),
|
|
1435
|
+
unref(o).type === "LOYALTY" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
1436
|
+
((C = unref(i).loyaltyRewards.items.find(
|
|
1437
|
+
(x) => {
|
|
1438
|
+
var S;
|
|
1439
|
+
return x.value === ((S = unref(o)) == null ? void 0 : S.collectible);
|
|
1440
|
+
}
|
|
1441
|
+
)) == null ? void 0 : C.raw.type) !== "TITLE" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
1442
|
+
c[11] || (c[11] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
|
|
1443
|
+
createVNode(_sfc_main$r, {
|
|
1444
|
+
class: "mt-[-8px]",
|
|
1445
|
+
rules: [
|
|
1446
|
+
unref(ZodHelper).ruleAtPath(unref(s), "earningOption", [unref(o).type])
|
|
1447
|
+
],
|
|
1448
|
+
"helper-state": unref(ZodHelper).helperState(unref(h), "earningOption"),
|
|
1449
|
+
"error-text": unref(ZodHelper).helperText(unref(h), "earningOption"),
|
|
1450
|
+
"fixed-type": !0,
|
|
1451
|
+
"model-value": unref(o).earningOption,
|
|
1452
|
+
"onUpdate:modelValue": c[3] || (c[3] = (x) => o.value = {
|
|
1453
|
+
...unref(o),
|
|
1454
|
+
earningOption: x
|
|
1455
|
+
})
|
|
1456
|
+
}, null, 8, ["rules", "helper-state", "error-text", "model-value"])
|
|
1457
|
+
], 64)) : createCommentVNode("", !0),
|
|
1458
|
+
c[12] || (c[12] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Validity option", -1)),
|
|
1459
|
+
createVNode(_sfc_main$s, {
|
|
1460
|
+
type: unref(o).type === "LOYALTY" ? "custom" : "range",
|
|
1461
|
+
"for-credit": unref(o).type === "LOYALTY" && ((E = unref(i).loyaltyRewards.items.find(
|
|
1462
|
+
(x) => {
|
|
1463
|
+
var S;
|
|
1464
|
+
return x.value === ((S = unref(o)) == null ? void 0 : S.collectible);
|
|
1465
|
+
}
|
|
1466
|
+
)) == null ? void 0 : E.raw.type) === "CREDIT",
|
|
1467
|
+
class: "!gap-24",
|
|
1468
|
+
rules: [unref(ZodHelper).ruleAtPath(unref(s), "validityOption", [unref(o).type])],
|
|
1469
|
+
"model-value": unref(o).validityOption,
|
|
1470
|
+
"onUpdate:modelValue": c[4] || (c[4] = (x) => o.value = {
|
|
1471
|
+
...unref(o),
|
|
1472
|
+
validityOption: x
|
|
1473
|
+
})
|
|
1474
|
+
}, null, 8, ["type", "for-credit", "rules", "model-value"])
|
|
1475
|
+
], 64)) : createCommentVNode("", !0),
|
|
1476
|
+
unref(o).type === "VOUCHER" ? (openBlock(), createBlock(_sfc_main$t, {
|
|
1477
|
+
key: 2,
|
|
1478
|
+
"reward-image": unref(n),
|
|
1479
|
+
"model-value": (($ = unref(o)) == null ? void 0 : $.collectibleConfig) ?? void 0,
|
|
1480
|
+
"onUpdate:modelValue": c[5] || (c[5] = (x) => o.value = {
|
|
1481
|
+
...unref(o),
|
|
1482
|
+
collectibleConfig: x
|
|
1483
|
+
}),
|
|
1484
|
+
"onUpdate:rewardImage": c[6] || (c[6] = (x) => n.value = x)
|
|
1485
|
+
}, null, 8, ["reward-image", "model-value"])) : createCommentVNode("", !0),
|
|
1486
|
+
createVNode(JsonViewer, { json: unref(h) }, null, 8, ["json"])
|
|
1487
|
+
])) : createCommentVNode("", !0)
|
|
1488
|
+
];
|
|
1489
|
+
}),
|
|
1490
|
+
_: 1
|
|
1491
|
+
}, 8, ["modelValue"]);
|
|
1492
|
+
};
|
|
1493
|
+
}
|
|
1494
|
+
});
|
|
1495
|
+
function isNullOrEmpty(e) {
|
|
1496
|
+
return e == null || e === "";
|
|
1497
|
+
}
|
|
1498
|
+
const _hoisted_1$c = { class: "space-y-16" }, _hoisted_2$9 = { class: "fm-typo-en-body-lg-400" }, _hoisted_3$7 = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
1499
|
+
__name: "RewardPoolInput",
|
|
1500
|
+
props: {
|
|
1501
|
+
modelValue: {
|
|
1502
|
+
type: Array,
|
|
1503
|
+
default: () => [
|
|
1504
|
+
{
|
|
1505
|
+
collectible: null,
|
|
1506
|
+
type: "NO_REWARD",
|
|
1507
|
+
weight: 1
|
|
1508
|
+
}
|
|
1509
|
+
]
|
|
1510
|
+
}
|
|
1511
|
+
},
|
|
1512
|
+
emits: ["update:model-value"],
|
|
1513
|
+
setup(e, { emit: d }) {
|
|
1514
|
+
const r = e, i = d, u = useMembershipStore(), a = z.array(z.lazy(() => FdtoRandomReward)).min(1, "Requires at least 1 reward"), o = computed(() => r.modelValue ?? []), n = computed(() => {
|
|
1515
|
+
const p = a.safeParse(o.value);
|
|
1516
|
+
return p.success ? [] : p.error.errors;
|
|
1517
|
+
}), l = ref();
|
|
1518
|
+
function s(p, c) {
|
|
1519
|
+
var m;
|
|
1520
|
+
const y = [...o.value];
|
|
1521
|
+
y[c] = p, (m = l.value) == null || m.showSheet(!1), i("update:model-value", y);
|
|
1522
|
+
}
|
|
1523
|
+
function h(p) {
|
|
1524
|
+
const c = p.type == "VOUCHER" ? p.collectibleConfig : u.collectibles.find(
|
|
1525
|
+
(f) => f._id.toString() == p.collectible
|
|
1526
|
+
), y = CollectionUtils.formattedType((c == null ? void 0 : c.name) || ""), m = p.weight;
|
|
1527
|
+
return {
|
|
1528
|
+
label: isNullOrEmpty(y) ? "NO REWARD" : y,
|
|
1529
|
+
sublabel: `${m} (${(m / o.value.reduce((f, B) => f + B.weight, 0) * 100).toFixed(2)}%)`
|
|
1530
|
+
};
|
|
1531
|
+
}
|
|
1532
|
+
function g(p) {
|
|
1533
|
+
var y;
|
|
1534
|
+
const c = [...o.value];
|
|
1535
|
+
(y = l.value) == null || y.showSheet(!0, c[p], p);
|
|
1536
|
+
}
|
|
1537
|
+
function b(p) {
|
|
1538
|
+
const c = [...o.value];
|
|
1539
|
+
c.splice(p, 1), i("update:model-value", c);
|
|
1540
|
+
}
|
|
1541
|
+
function k() {
|
|
1542
|
+
var p;
|
|
1543
|
+
(p = l.value) == null || p.showSheet(
|
|
1544
|
+
!0,
|
|
1545
|
+
{
|
|
1546
|
+
type: "NO_REWARD",
|
|
1547
|
+
collectible: null,
|
|
1548
|
+
weight: 1
|
|
1549
|
+
},
|
|
1550
|
+
o.value.length
|
|
1551
|
+
);
|
|
1552
|
+
}
|
|
1553
|
+
return (p, c) => {
|
|
1554
|
+
const y = resolveComponent("FmButton"), m = resolveComponent("FmCard"), f = resolveComponent("FmHelperText");
|
|
1555
|
+
return openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
1556
|
+
c[1] || (c[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)),
|
|
1557
|
+
createVNode(y, {
|
|
1558
|
+
label: "Add Reward",
|
|
1559
|
+
onClick: c[0] || (c[0] = (B) => k()),
|
|
1560
|
+
variant: "plain",
|
|
1561
|
+
icon: "add"
|
|
1562
|
+
}),
|
|
1563
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(o), (B, C) => (openBlock(), createBlock(m, {
|
|
1564
|
+
key: C,
|
|
1565
|
+
class: "px-16 py-12 flex items-center justify-between cursor-pointer",
|
|
1566
|
+
variant: "outlined",
|
|
1567
|
+
onClick: (E) => g(C)
|
|
1568
|
+
}, {
|
|
1569
|
+
default: withCtx(() => {
|
|
1570
|
+
var E;
|
|
1571
|
+
return [
|
|
1572
|
+
createElementVNode("div", null, [
|
|
1573
|
+
createElementVNode("div", _hoisted_2$9, toDisplayString(B.type == "LOYALTY" ? (E = B == null ? void 0 : B.earningOption) == null ? void 0 : E.amount : "") + " " + toDisplayString(h(B).label), 1),
|
|
1574
|
+
createElementVNode("div", _hoisted_3$7, toDisplayString(h(B).sublabel), 1)
|
|
1575
|
+
]),
|
|
1576
|
+
createVNode(y, {
|
|
1577
|
+
icon: "delete",
|
|
1578
|
+
variant: "tertiary",
|
|
1579
|
+
onClick: ($) => ($.stopPropagation(), b(C))
|
|
1580
|
+
}, null, 8, ["onClick"])
|
|
1581
|
+
];
|
|
1582
|
+
}),
|
|
1583
|
+
_: 2
|
|
1584
|
+
}, 1032, ["onClick"]))), 128)),
|
|
1585
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(n).filter((B) => B.path.join(".") == ""), (B) => (openBlock(), createBlock(f, {
|
|
1586
|
+
key: B.message,
|
|
1587
|
+
text: B.message,
|
|
1588
|
+
state: "error"
|
|
1589
|
+
}, null, 8, ["text"]))), 128)),
|
|
1590
|
+
createVNode(_sfc_main$d, {
|
|
1591
|
+
ref_key: "sheetRef",
|
|
1592
|
+
ref: l,
|
|
1593
|
+
"onUpdate:modelValue": s
|
|
1594
|
+
}, null, 512)
|
|
1595
|
+
]);
|
|
1596
|
+
};
|
|
1597
|
+
}
|
|
1598
|
+
}), _hoisted_1$b = { class: "space-y-16" }, _hoisted_2$8 = {
|
|
1599
|
+
key: 0,
|
|
1600
|
+
class: "grid grid-cols-2 gap-16"
|
|
1601
|
+
}, _hoisted_3$6 = { class: "fm-typo-en-title-sm-800" }, _hoisted_4$5 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
1602
|
+
__name: "PromotionGameTypeInput",
|
|
1603
|
+
props: {
|
|
1604
|
+
modelValue: {
|
|
1605
|
+
type: Object
|
|
1606
|
+
}
|
|
1607
|
+
},
|
|
1608
|
+
emits: ["update:model-value"],
|
|
1609
|
+
setup(e, { emit: d }) {
|
|
1610
|
+
const r = e, i = d, u = computed(() => [
|
|
1611
|
+
{
|
|
1612
|
+
label: "Rock paper scissor",
|
|
1613
|
+
description: "Customers play 3 rounds of Rock Paper Scissors against the cashier. If customer won 2 rounds, they will get a discount.",
|
|
1614
|
+
value: F_GAME_TYPE.enum.ROCK_PAPER_SCISSORS
|
|
1615
|
+
}
|
|
1616
|
+
]);
|
|
1617
|
+
return (a, o) => {
|
|
1618
|
+
var h, g, b;
|
|
1619
|
+
const n = resolveComponent("FmSwitch"), l = resolveComponent("FmCard"), s = resolveComponent("FmHelperText");
|
|
1620
|
+
return openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
1621
|
+
createVNode(n, {
|
|
1622
|
+
label: "Enable game",
|
|
1623
|
+
"model-value": !!((h = e.modelValue) != null && h.gameType),
|
|
1624
|
+
"onUpdate:modelValue": o[0] || (o[0] = (k) => k ? i("update:model-value", { gameType: "ROCK_PAPER_SCISSORS" }) : i("update:model-value", null))
|
|
1625
|
+
}, null, 8, ["model-value"]),
|
|
1626
|
+
((g = e.modelValue) == null ? void 0 : g.gameType) == "ROCK_PAPER_SCISSORS" ? (openBlock(), createElementBlock("div", _hoisted_2$8, [
|
|
1627
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (k) => {
|
|
1628
|
+
var p, c;
|
|
1629
|
+
return openBlock(), createBlock(l, {
|
|
1630
|
+
variant: "outlined",
|
|
1631
|
+
class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
|
|
1632
|
+
"col-span-2": unref(u).length == 1,
|
|
1633
|
+
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": ((p = e.modelValue) == null ? void 0 : p.gameType) == k.value,
|
|
1634
|
+
"hover:bg-fm-color-opacity-sm": ((c = e.modelValue) == null ? void 0 : c.gameType) != k.value
|
|
1635
|
+
}]),
|
|
1636
|
+
onClick: () => {
|
|
1637
|
+
var y;
|
|
1638
|
+
((y = r.modelValue) == null ? void 0 : y.gameType) != k.value && i("update:model-value", { gameType: k.value });
|
|
1639
|
+
},
|
|
1640
|
+
key: k.value
|
|
1641
|
+
}, {
|
|
1642
|
+
default: withCtx(() => [
|
|
1643
|
+
createElementVNode("div", _hoisted_3$6, toDisplayString(k.label), 1),
|
|
1644
|
+
createElementVNode("div", _hoisted_4$5, toDisplayString(k.description), 1)
|
|
1645
|
+
]),
|
|
1646
|
+
_: 2
|
|
1647
|
+
}, 1032, ["class", "onClick"]);
|
|
1648
|
+
}), 128))
|
|
1649
|
+
])) : createCommentVNode("", !0),
|
|
1650
|
+
((b = e.modelValue) == null ? void 0 : b.gameType) == "ROCK_PAPER_SCISSORS" ? (openBlock(), createBlock(s, {
|
|
1651
|
+
key: 1,
|
|
1652
|
+
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)",
|
|
1653
|
+
state: "warning"
|
|
1654
|
+
})) : createCommentVNode("", !0)
|
|
1655
|
+
]);
|
|
1656
|
+
};
|
|
1657
|
+
}
|
|
1658
|
+
}), _hoisted_1$a = { class: "space-y-8" }, _hoisted_2$7 = { class: "grid gap-16 grid-cols-2" }, _hoisted_3$5 = { class: "space-y-6" }, _hoisted_4$4 = { class: "space-y-8" }, _hoisted_5$3 = { class: "fm-typo-en-body-lg-600" }, _hoisted_6$3 = { class: "flex items-center space-x-3" }, _hoisted_7$2 = {
|
|
1659
|
+
key: 0,
|
|
1660
|
+
class: "ml-6 space-y-2"
|
|
1661
|
+
}, _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
1662
|
+
__name: "GrabConditionsInput",
|
|
1663
|
+
props: {
|
|
1664
|
+
modelValue: {
|
|
1665
|
+
type: Object
|
|
1666
|
+
},
|
|
1667
|
+
schema: {
|
|
1668
|
+
type: Object,
|
|
1669
|
+
default: () => z.any()
|
|
1670
|
+
}
|
|
1671
|
+
},
|
|
1672
|
+
emits: ["update:model-value"],
|
|
1673
|
+
setup(e, { emit: d }) {
|
|
1674
|
+
const { t: r } = useI18n(), i = e, u = d, a = ref(i.modelValue ?? {}), o = ref(
|
|
1675
|
+
(() => {
|
|
1676
|
+
const g = {};
|
|
1677
|
+
return a.value.workingHour && Object.keys(a.value.workingHour).forEach((b) => {
|
|
1678
|
+
const k = a.value.workingHour[b];
|
|
1679
|
+
k && "period" in k && Array.isArray(k.period) ? g[b] = k.period : Array.isArray(k) && (g[b] = k);
|
|
1680
|
+
}), g;
|
|
1681
|
+
})()
|
|
1682
|
+
), n = [
|
|
1683
|
+
{ key: "mon", label: "Monday" },
|
|
1684
|
+
{ key: "tue", label: "Tuesday" },
|
|
1685
|
+
{ key: "wed", label: "Wednesday" },
|
|
1686
|
+
{ key: "thu", label: "Thursday" },
|
|
1687
|
+
{ key: "fri", label: "Friday" },
|
|
1688
|
+
{ key: "sat", label: "Saturday" },
|
|
1689
|
+
{ key: "sun", label: "Sunday" }
|
|
1690
|
+
], l = (g) => {
|
|
1691
|
+
o.value[g] || (o.value[g] = []), o.value[g].push({
|
|
1692
|
+
openTime: "00:00",
|
|
1693
|
+
closeTime: "23:59"
|
|
1694
|
+
}), h();
|
|
1695
|
+
}, s = (g, b) => {
|
|
1696
|
+
o.value[g] && o.value[g].length > b && (o.value[g].splice(b, 1), o.value[g].length === 0 && delete o.value[g], h());
|
|
1697
|
+
}, h = () => {
|
|
1698
|
+
const g = Object.keys(o.value).reduce(
|
|
1699
|
+
(b, k) => (o.value[k] && o.value[k].length > 0 && (b[k] = {
|
|
1700
|
+
period: o.value[k]
|
|
1701
|
+
}), b),
|
|
1702
|
+
{}
|
|
1703
|
+
);
|
|
1704
|
+
a.value.workingHour = Object.keys(g).length > 0 ? g : void 0;
|
|
1705
|
+
};
|
|
1706
|
+
return watch(a, () => u("update:model-value", a.value), { deep: !0 }), watch(o, h, { deep: !0 }), (g, b) => {
|
|
1707
|
+
const k = resolveComponent("FmSelect"), p = resolveComponent("FmStepperField"), c = resolveComponent("FmCheckbox"), y = resolveComponent("FmTimePicker"), m = resolveComponent("FmButton");
|
|
1708
|
+
return openBlock(), createElementBlock("div", _hoisted_1$a, [
|
|
1709
|
+
createElementVNode("div", _hoisted_2$7, [
|
|
1710
|
+
createVNode(k, {
|
|
1711
|
+
label: unref(r)("connect.template.eaterType"),
|
|
1712
|
+
modelValue: unref(a).eaterType,
|
|
1713
|
+
"onUpdate:modelValue": b[0] || (b[0] = (f) => unref(a).eaterType = f),
|
|
1714
|
+
items: [
|
|
1715
|
+
{ label: unref(r)("connect.template.allEaters"), value: "all" },
|
|
1716
|
+
{ label: unref(r)("connect.template.newEatersOnly"), value: "new" },
|
|
1717
|
+
{
|
|
1718
|
+
label: unref(r)("connect.template.existingEatersOnly"),
|
|
1719
|
+
value: "existing"
|
|
1720
|
+
}
|
|
1721
|
+
],
|
|
1722
|
+
rules: [unref(ZodHelper).ruleAtPath(e.schema, "eaterType")]
|
|
1723
|
+
}, null, 8, ["label", "modelValue", "items", "rules"]),
|
|
1724
|
+
createVNode(p, {
|
|
1725
|
+
modelValue: unref(a).minBasketAmount,
|
|
1726
|
+
"onUpdate:modelValue": b[1] || (b[1] = (f) => unref(a).minBasketAmount = f),
|
|
1727
|
+
"show-steppers": !1,
|
|
1728
|
+
rules: [unref(ZodHelper).ruleAtPath(e.schema, "minBasketAmount")]
|
|
1729
|
+
}, {
|
|
1730
|
+
label: withCtx(() => [
|
|
1731
|
+
(openBlock(), createBlock(resolveDynamicComponent(
|
|
1732
|
+
unref(ZodHelper).toInputLabel(
|
|
1733
|
+
unref(ZodHelper).typeAtPath(e.schema, "minBasketAmount"),
|
|
1734
|
+
unref(r)("connect.template.minBasketAmount")
|
|
1735
|
+
)
|
|
1736
|
+
)))
|
|
1737
|
+
]),
|
|
1738
|
+
_: 1
|
|
1739
|
+
}, 8, ["modelValue", "rules"]),
|
|
1740
|
+
createVNode(p, {
|
|
1741
|
+
modelValue: unref(a).bundleQuantity,
|
|
1742
|
+
"onUpdate:modelValue": b[2] || (b[2] = (f) => unref(a).bundleQuantity = f),
|
|
1743
|
+
"show-steppers": !1,
|
|
1744
|
+
rules: [unref(ZodHelper).ruleAtPath(e.schema, "bundleQuantity")]
|
|
1745
|
+
}, {
|
|
1746
|
+
label: withCtx(() => [
|
|
1747
|
+
(openBlock(), createBlock(resolveDynamicComponent(
|
|
1748
|
+
unref(ZodHelper).toInputLabel(
|
|
1749
|
+
unref(ZodHelper).typeAtPath(e.schema, "bundleQuantity"),
|
|
1750
|
+
unref(r)("connect.template.bundleQuantity")
|
|
1751
|
+
)
|
|
1752
|
+
)))
|
|
1753
|
+
]),
|
|
1754
|
+
_: 1
|
|
1755
|
+
}, 8, ["modelValue", "rules"])
|
|
1756
|
+
]),
|
|
1757
|
+
createElementVNode("div", _hoisted_3$5, [
|
|
1758
|
+
createElementVNode("div", _hoisted_4$4, [
|
|
1759
|
+
createElementVNode("div", _hoisted_5$3, toDisplayString(unref(r)("connect.template.operationHours")), 1),
|
|
1760
|
+
(openBlock(), createElementBlock(Fragment, null, renderList(n, (f) => createElementVNode("div", {
|
|
1761
|
+
key: f.key,
|
|
1762
|
+
class: "space-y-2"
|
|
1763
|
+
}, [
|
|
1764
|
+
createElementVNode("div", _hoisted_6$3, [
|
|
1765
|
+
createVNode(c, {
|
|
1766
|
+
label: f.label,
|
|
1767
|
+
"model-value": !!(unref(o)[f.key] && unref(o)[f.key].length > 0),
|
|
1768
|
+
"onUpdate:modelValue": (B) => {
|
|
1769
|
+
B ? l(f.key) : (unref(o)[f.key] = [], delete unref(o)[f.key], h());
|
|
1770
|
+
}
|
|
1771
|
+
}, null, 8, ["label", "model-value", "onUpdate:modelValue"])
|
|
1772
|
+
]),
|
|
1773
|
+
unref(o)[f.key] && unref(o)[f.key].length > 0 ? (openBlock(), createElementBlock("div", _hoisted_7$2, [
|
|
1774
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(o)[f.key] || [], (B, C) => (openBlock(), createElementBlock("div", {
|
|
1775
|
+
key: C,
|
|
1776
|
+
class: "flex items-center space-x-2 w-100"
|
|
1777
|
+
}, [
|
|
1778
|
+
createVNode(y, {
|
|
1779
|
+
"model-value": B.openTime || "",
|
|
1780
|
+
"onUpdate:modelValue": (E) => {
|
|
1781
|
+
unref(o)[f.key] && unref(o)[f.key][C] && (unref(o)[f.key][C].openTime = E || "", h());
|
|
1782
|
+
}
|
|
1783
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"]),
|
|
1784
|
+
b[3] || (b[3] = createElementVNode("span", null, "to", -1)),
|
|
1785
|
+
createVNode(y, {
|
|
1786
|
+
"model-value": B.closeTime || "",
|
|
1787
|
+
"onUpdate:modelValue": (E) => {
|
|
1788
|
+
unref(o)[f.key] && unref(o)[f.key][C] && (unref(o)[f.key][C].closeTime = E || "", h());
|
|
1789
|
+
}
|
|
1790
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"]),
|
|
1791
|
+
createVNode(m, {
|
|
1792
|
+
variant: "tertiary",
|
|
1793
|
+
size: "sm",
|
|
1794
|
+
onClick: (E) => s(f.key, C),
|
|
1795
|
+
icon: "close"
|
|
1796
|
+
}, null, 8, ["onClick"]),
|
|
1797
|
+
C === 0 ? (openBlock(), createBlock(m, {
|
|
1798
|
+
key: 0,
|
|
1799
|
+
onClick: (E) => l(f.key),
|
|
1800
|
+
icon: "add",
|
|
1801
|
+
variant: "plain"
|
|
1802
|
+
}, null, 8, ["onClick"])) : createCommentVNode("", !0)
|
|
1803
|
+
]))), 128))
|
|
1804
|
+
])) : createCommentVNode("", !0)
|
|
1805
|
+
])), 64))
|
|
1806
|
+
])
|
|
1807
|
+
])
|
|
1808
|
+
]);
|
|
1809
|
+
};
|
|
1810
|
+
}
|
|
1811
|
+
}), GrabConditionsInput = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-a50a959c"]]), _hoisted_1$9 = { class: "space-y-8" }, _hoisted_2$6 = { class: "grid gap-16 grid-cols-2" }, _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
1812
|
+
__name: "GrabQuotaInput",
|
|
1813
|
+
props: {
|
|
1814
|
+
modelValue: {
|
|
1815
|
+
type: Object
|
|
1816
|
+
},
|
|
1817
|
+
schema: {
|
|
1818
|
+
type: Object,
|
|
1819
|
+
default: () => z.any()
|
|
1820
|
+
}
|
|
1821
|
+
},
|
|
1822
|
+
emits: ["update:model-value"],
|
|
1823
|
+
setup(e, { emit: d }) {
|
|
1824
|
+
const { t: r } = useI18n(), i = e, u = d, a = ref(i.modelValue ?? {});
|
|
1825
|
+
return watch(a, () => u("update:model-value", a.value)), (o, n) => {
|
|
1826
|
+
const l = resolveComponent("FmStepperField");
|
|
1827
|
+
return openBlock(), createElementBlock("div", _hoisted_1$9, [
|
|
1828
|
+
createElementVNode("div", _hoisted_2$6, [
|
|
1829
|
+
createVNode(l, {
|
|
1830
|
+
modelValue: unref(a).totalCount,
|
|
1831
|
+
"onUpdate:modelValue": n[0] || (n[0] = (s) => unref(a).totalCount = s),
|
|
1832
|
+
"show-steppers": !1,
|
|
1833
|
+
rules: [unref(ZodHelper).ruleAtPath(e.schema, "totalCount")]
|
|
1834
|
+
}, {
|
|
1835
|
+
label: withCtx(() => [
|
|
1836
|
+
(openBlock(), createBlock(resolveDynamicComponent(
|
|
1837
|
+
unref(ZodHelper).toInputLabel(
|
|
1838
|
+
unref(ZodHelper).typeAtPath(e.schema, "totalCount"),
|
|
1839
|
+
unref(r)("connect.template.totalCount")
|
|
1840
|
+
)
|
|
1841
|
+
)))
|
|
1842
|
+
]),
|
|
1843
|
+
_: 1
|
|
1844
|
+
}, 8, ["modelValue", "rules"]),
|
|
1845
|
+
createVNode(l, {
|
|
1846
|
+
modelValue: unref(a).totalCountPerUser,
|
|
1847
|
+
"onUpdate:modelValue": n[1] || (n[1] = (s) => unref(a).totalCountPerUser = s),
|
|
1848
|
+
"show-steppers": !1,
|
|
1849
|
+
rules: [unref(ZodHelper).ruleAtPath(e.schema, "totalCountPerUser")]
|
|
1850
|
+
}, {
|
|
1851
|
+
label: withCtx(() => [
|
|
1852
|
+
(openBlock(), createBlock(resolveDynamicComponent(
|
|
1853
|
+
unref(ZodHelper).toInputLabel(
|
|
1854
|
+
unref(ZodHelper).typeAtPath(e.schema, "totalCountPerUser"),
|
|
1855
|
+
unref(r)("connect.template.totalCountPerUser")
|
|
1856
|
+
)
|
|
1857
|
+
)))
|
|
1858
|
+
]),
|
|
1859
|
+
_: 1
|
|
1860
|
+
}, 8, ["modelValue", "rules"])
|
|
1861
|
+
])
|
|
1862
|
+
]);
|
|
1863
|
+
};
|
|
1864
|
+
}
|
|
1865
|
+
}), _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({
|
|
1866
|
+
__name: "MissionTypeInput",
|
|
1867
|
+
props: {
|
|
1868
|
+
modelValue: {
|
|
1869
|
+
type: String
|
|
1870
|
+
}
|
|
1871
|
+
},
|
|
1872
|
+
emits: ["update:model-value"],
|
|
1873
|
+
setup(e, { emit: d }) {
|
|
1874
|
+
const r = e, i = d, u = computed(() => [
|
|
1875
|
+
{
|
|
1876
|
+
label: "Stamp",
|
|
1877
|
+
description: "Award stamps for purchases, redeemable after reaching set milestones.",
|
|
1878
|
+
value: F_MISSION_TYPE.enum.STAMP
|
|
1879
|
+
},
|
|
1880
|
+
{
|
|
1881
|
+
label: "Progress",
|
|
1882
|
+
description: "Reward customers when they reach a cumulative spending goal.",
|
|
1883
|
+
value: F_MISSION_TYPE.enum.PROGRESSIVE
|
|
1884
|
+
}
|
|
1885
|
+
]);
|
|
1886
|
+
return (a, o) => {
|
|
1887
|
+
const n = resolveComponent("FmCard");
|
|
1888
|
+
return openBlock(), createElementBlock("div", _hoisted_1$8, [
|
|
1889
|
+
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)),
|
|
1890
|
+
createElementVNode("div", _hoisted_2$5, [
|
|
1891
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (l) => (openBlock(), createBlock(n, {
|
|
1892
|
+
variant: "outlined",
|
|
1893
|
+
class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
|
|
1894
|
+
"col-span-2": unref(u).length == 1,
|
|
1895
|
+
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == l.value,
|
|
1896
|
+
"hover:bg-fm-color-opacity-sm": e.modelValue != l.value
|
|
1897
|
+
}]),
|
|
1898
|
+
onClick: () => {
|
|
1899
|
+
r.modelValue != l.value && i("update:model-value", l.value);
|
|
1900
|
+
},
|
|
1901
|
+
key: l.value
|
|
1902
|
+
}, {
|
|
1903
|
+
default: withCtx(() => [
|
|
1904
|
+
createElementVNode("div", _hoisted_3$4, toDisplayString(l.label), 1),
|
|
1905
|
+
createElementVNode("div", _hoisted_4$3, toDisplayString(l.description), 1)
|
|
1906
|
+
]),
|
|
1907
|
+
_: 2
|
|
1908
|
+
}, 1032, ["class", "onClick"]))), 128))
|
|
1909
|
+
])
|
|
1910
|
+
]);
|
|
1911
|
+
};
|
|
1912
|
+
}
|
|
1913
|
+
}), _hoisted_1$7 = { class: "space-y-16" }, _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
1914
|
+
__name: "MissionEndInput",
|
|
1915
|
+
props: {
|
|
1916
|
+
modelValue: {
|
|
1917
|
+
type: [String, Number]
|
|
1918
|
+
},
|
|
1919
|
+
helperText: {
|
|
1920
|
+
type: String
|
|
1921
|
+
},
|
|
1922
|
+
helperState: {
|
|
1923
|
+
type: String
|
|
1924
|
+
}
|
|
1925
|
+
},
|
|
1926
|
+
emits: ["update:model-value"],
|
|
1927
|
+
setup(e, { emit: d }) {
|
|
1928
|
+
const r = d;
|
|
1929
|
+
return (i, u) => {
|
|
1930
|
+
const a = resolveComponent("FmStepperField");
|
|
1931
|
+
return openBlock(), createElementBlock("div", _hoisted_1$7, [
|
|
1932
|
+
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)),
|
|
1933
|
+
createVNode(a, {
|
|
1934
|
+
label: "Maximum to collect",
|
|
1935
|
+
"model-value": e.modelValue || null,
|
|
1936
|
+
"onUpdate:modelValue": u[0] || (u[0] = (o) => r("update:model-value", o)),
|
|
1937
|
+
"helper-text": e.helperText || "Set the threshold required for reward eligibility",
|
|
1938
|
+
"helper-state": e.helperState || "none"
|
|
1939
|
+
}, null, 8, ["model-value", "helper-text", "helper-state"])
|
|
1940
|
+
]);
|
|
1941
|
+
};
|
|
1942
|
+
}
|
|
1943
|
+
}), _hoisted_1$6 = { class: "flex gap-8 items-center justify-start" }, _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
1944
|
+
__name: "EditMissionPoolSheet",
|
|
1945
|
+
props: {
|
|
1946
|
+
maxThreshold: {
|
|
1947
|
+
type: Number,
|
|
1948
|
+
required: !0
|
|
1949
|
+
}
|
|
1950
|
+
},
|
|
1951
|
+
emits: ["update:model-value"],
|
|
1952
|
+
setup(e, { expose: d, emit: r }) {
|
|
1953
|
+
const i = e, u = useMembershipStore(), { minor: a } = useLoading, o = ref(!1), n = ref(), l = ref(), s = ref(0), h = computed(() => {
|
|
1954
|
+
var m;
|
|
1955
|
+
return ((m = u.loyaltyRewards.items.find(
|
|
1956
|
+
(f) => {
|
|
1957
|
+
var B;
|
|
1958
|
+
return f.value === ((B = n.value) == null ? void 0 : B.collectible);
|
|
1959
|
+
}
|
|
1960
|
+
)) == null ? void 0 : m.raw.type) === "CREDIT" ? FdoThresholdCreditReward : FdtoThresholdReward;
|
|
1961
|
+
}), g = computed(() => {
|
|
1962
|
+
const y = h.value.safeParse(n.value);
|
|
1963
|
+
return y.success ? [] : y.error.errors;
|
|
1964
|
+
});
|
|
1965
|
+
function b(y, m, f) {
|
|
1966
|
+
y && (n.value = m, s.value = f), o.value = y;
|
|
1967
|
+
}
|
|
1968
|
+
const k = r;
|
|
1969
|
+
async function p() {
|
|
1970
|
+
const y = h.value.safeParse(n.value);
|
|
1971
|
+
y.success && (await a(
|
|
1972
|
+
async () => {
|
|
1973
|
+
y.data.type === "VOUCHER" && l.value && (y.data.collectibleConfig.image = await firebaseStorage.update(
|
|
1974
|
+
y.data.collectibleConfig.image || firebaseStorage.collectibleImagePath(void 0, l.value),
|
|
1975
|
+
l.value
|
|
1976
|
+
));
|
|
1977
|
+
},
|
|
1978
|
+
{
|
|
1979
|
+
message: "Uploading reward image",
|
|
1980
|
+
successMessage: "Reward image updated"
|
|
1981
|
+
}
|
|
1982
|
+
), k("update:model-value", y.data, s.value));
|
|
1983
|
+
}
|
|
1984
|
+
const c = ref();
|
|
1985
|
+
return d({
|
|
1986
|
+
showSheet: b
|
|
1987
|
+
}), (y, m) => {
|
|
1988
|
+
const f = resolveComponent("FmStepperField"), B = resolveComponent("FmSelect"), C = resolveComponent("FmForm"), E = resolveComponent("FmButton"), $ = resolveComponent("FmSideSheet");
|
|
1989
|
+
return openBlock(), createBlock($, {
|
|
1990
|
+
"max-width": 560,
|
|
1991
|
+
modelValue: unref(o),
|
|
1992
|
+
"onUpdate:modelValue": [
|
|
1993
|
+
m[10] || (m[10] = (x) => isRef(o) ? o.value = x : null),
|
|
1994
|
+
m[11] || (m[11] = (x) => o.value = x)
|
|
1995
|
+
],
|
|
1996
|
+
header: "Edit reward",
|
|
1997
|
+
"dismiss-away": ""
|
|
1998
|
+
}, {
|
|
1999
|
+
"side-sheet-footer": withCtx(() => [
|
|
2000
|
+
createElementVNode("div", _hoisted_1$6, [
|
|
2001
|
+
createVNode(E, {
|
|
2002
|
+
variant: "primary",
|
|
2003
|
+
type: "button",
|
|
2004
|
+
label: "Confirm",
|
|
2005
|
+
disabled: unref(g).length > 0,
|
|
2006
|
+
onClick: m[8] || (m[8] = async () => {
|
|
2007
|
+
var x;
|
|
2008
|
+
return (x = unref(c)) == null ? void 0 : x.validateInputs();
|
|
2009
|
+
})
|
|
2010
|
+
}, null, 8, ["disabled"]),
|
|
2011
|
+
createVNode(E, {
|
|
2012
|
+
variant: "secondary",
|
|
2013
|
+
type: "button",
|
|
2014
|
+
label: "Cancel",
|
|
2015
|
+
onClick: m[9] || (m[9] = (x) => o.value = !1)
|
|
2016
|
+
})
|
|
2017
|
+
])
|
|
2018
|
+
]),
|
|
2019
|
+
default: withCtx(() => [
|
|
2020
|
+
createVNode(JsonViewer, { json: unref(n) }, null, 8, ["json"]),
|
|
2021
|
+
unref(n) ? (openBlock(), createBlock(C, {
|
|
2022
|
+
key: 0,
|
|
2023
|
+
class: "flex flex-col gap-y-24",
|
|
2024
|
+
ref_key: "formRef",
|
|
2025
|
+
ref: c,
|
|
2026
|
+
onValidationSuccess: m[7] || (m[7] = (x) => p())
|
|
2027
|
+
}, {
|
|
2028
|
+
default: withCtx(() => {
|
|
2029
|
+
var x, S;
|
|
2030
|
+
return [
|
|
2031
|
+
unref(n).type ? (openBlock(), createBlock(f, {
|
|
2032
|
+
key: 0,
|
|
2033
|
+
label: "Threshold",
|
|
2034
|
+
rules: [
|
|
2035
|
+
unref(ZodHelper).toRule(
|
|
2036
|
+
unref(z).number().min(1).max(
|
|
2037
|
+
i.maxThreshold,
|
|
2038
|
+
`Number cannot be more than ${i.maxThreshold}`
|
|
2039
|
+
)
|
|
2040
|
+
)
|
|
2041
|
+
],
|
|
2042
|
+
"model-value": unref(n).threshold,
|
|
2043
|
+
"onUpdate:modelValue": m[0] || (m[0] = (N) => n.value = {
|
|
2044
|
+
...unref(n),
|
|
2045
|
+
threshold: N
|
|
2046
|
+
})
|
|
2047
|
+
}, null, 8, ["rules", "model-value"])) : createCommentVNode("", !0),
|
|
2048
|
+
createVNode(B, {
|
|
2049
|
+
label: "Reward Type",
|
|
2050
|
+
items: [
|
|
2051
|
+
{ label: "Voucher", value: "VOUCHER" },
|
|
2052
|
+
{ label: "Loyalty", value: "LOYALTY" }
|
|
2053
|
+
],
|
|
2054
|
+
"model-value": unref(n).type,
|
|
2055
|
+
"onUpdate:modelValue": m[1] || (m[1] = (N) => {
|
|
2056
|
+
var I, M;
|
|
2057
|
+
N === "VOUCHER" ? n.value = {
|
|
2058
|
+
collectible: null,
|
|
2059
|
+
type: "VOUCHER",
|
|
2060
|
+
collectibleConfig: unref(initCollectibleConfig)("VOUCHER", {
|
|
2061
|
+
business: unref(useCoreStore)().currentBusiness.value._id
|
|
2062
|
+
}),
|
|
2063
|
+
earningOption: {
|
|
2064
|
+
amount: 1,
|
|
2065
|
+
type: "FIXED"
|
|
2066
|
+
},
|
|
2067
|
+
validityOption: {
|
|
2068
|
+
validForDay: 7
|
|
2069
|
+
},
|
|
2070
|
+
threshold: (I = unref(n)) == null ? void 0 : I.threshold
|
|
2071
|
+
} : n.value = {
|
|
2072
|
+
collectible: unref(u).loyaltyRewards.raw[0]._id,
|
|
2073
|
+
type: "LOYALTY",
|
|
2074
|
+
earningOption: {
|
|
2075
|
+
amount: 1,
|
|
2076
|
+
type: "FIXED"
|
|
2077
|
+
},
|
|
2078
|
+
validityOption: {
|
|
2079
|
+
validForDay: 7
|
|
2080
|
+
},
|
|
2081
|
+
threshold: (M = unref(n)) == null ? void 0 : M.threshold
|
|
2082
|
+
};
|
|
2083
|
+
})
|
|
2084
|
+
}, null, 8, ["model-value"]),
|
|
2085
|
+
unref(n).type == "LOYALTY" ? (openBlock(), createBlock(B, {
|
|
2086
|
+
key: 1,
|
|
2087
|
+
label: "Loyalty type",
|
|
2088
|
+
rules: [unref(ZodHelper).ruleAtPath(unref(h), "collectible", [unref(n).type])],
|
|
2089
|
+
items: unref(u).loyaltyRewards.items,
|
|
2090
|
+
"model-value": unref(n).collectible,
|
|
2091
|
+
"onUpdate:modelValue": m[2] || (m[2] = (N) => unref(n).collectible = N)
|
|
2092
|
+
}, null, 8, ["rules", "items", "model-value"])) : createCommentVNode("", !0),
|
|
2093
|
+
unref(n).type === "LOYALTY" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
2094
|
+
m[12] || (m[12] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
|
|
2095
|
+
createVNode(_sfc_main$r, {
|
|
2096
|
+
class: "mt-[-8px]",
|
|
2097
|
+
rules: [unref(ZodHelper).ruleAtPath(unref(h), "earningOption", [unref(n).type])],
|
|
2098
|
+
"helper-state": unref(ZodHelper).helperState(unref(g), "earningOption"),
|
|
2099
|
+
"error-text": unref(ZodHelper).helperText(unref(g), "earningOption"),
|
|
2100
|
+
"fixed-type": !0,
|
|
2101
|
+
"model-value": unref(n).earningOption,
|
|
2102
|
+
"onUpdate:modelValue": m[3] || (m[3] = (N) => n.value = {
|
|
2103
|
+
...unref(n),
|
|
2104
|
+
earningOption: N
|
|
2105
|
+
})
|
|
2106
|
+
}, null, 8, ["rules", "helper-state", "error-text", "model-value"]),
|
|
2107
|
+
createVNode(_sfc_main$s, {
|
|
2108
|
+
class: "!gap-24",
|
|
2109
|
+
type: unref(n).type === "LOYALTY" ? "custom" : "range",
|
|
2110
|
+
"for-credit": unref(n).type === "LOYALTY" && ((x = unref(u).loyaltyRewards.items.find(
|
|
2111
|
+
(N) => {
|
|
2112
|
+
var I;
|
|
2113
|
+
return N.value === ((I = unref(n)) == null ? void 0 : I.collectible);
|
|
2114
|
+
}
|
|
2115
|
+
)) == null ? void 0 : x.raw.type) === "CREDIT",
|
|
2116
|
+
rules: [unref(ZodHelper).ruleAtPath(unref(h), "validityOption", [unref(n).type])],
|
|
2117
|
+
"model-value": unref(n).validityOption,
|
|
2118
|
+
"onUpdate:modelValue": m[4] || (m[4] = (N) => n.value = {
|
|
2119
|
+
...unref(n),
|
|
2120
|
+
validityOption: N
|
|
2121
|
+
})
|
|
2122
|
+
}, null, 8, ["type", "for-credit", "rules", "model-value"])
|
|
2123
|
+
], 64)) : createCommentVNode("", !0),
|
|
2124
|
+
unref(n).type === "VOUCHER" ? (openBlock(), createBlock(_sfc_main$t, {
|
|
2125
|
+
key: 3,
|
|
2126
|
+
"reward-image": unref(l),
|
|
2127
|
+
"model-value": ((S = unref(n)) == null ? void 0 : S.collectibleConfig) ?? void 0,
|
|
2128
|
+
"onUpdate:modelValue": m[5] || (m[5] = (N) => n.value = {
|
|
2129
|
+
...unref(n),
|
|
2130
|
+
collectibleConfig: N
|
|
2131
|
+
}),
|
|
2132
|
+
"onUpdate:rewardImage": m[6] || (m[6] = (N) => l.value = N)
|
|
2133
|
+
}, null, 8, ["reward-image", "model-value"])) : createCommentVNode("", !0),
|
|
2134
|
+
createVNode(JsonViewer, { json: unref(g) }, null, 8, ["json"])
|
|
2135
|
+
];
|
|
2136
|
+
}),
|
|
2137
|
+
_: 1
|
|
2138
|
+
}, 512)) : createCommentVNode("", !0)
|
|
2139
|
+
]),
|
|
2140
|
+
_: 1
|
|
2141
|
+
}, 8, ["modelValue"]);
|
|
2142
|
+
};
|
|
2143
|
+
}
|
|
2144
|
+
}), _hoisted_1$5 = {
|
|
2145
|
+
key: 0,
|
|
2146
|
+
class: "grid grid-cols-5 text-center gap-8 justify-between items-center w-full"
|
|
2147
|
+
}, _hoisted_2$4 = { class: "flex flex-col gap-0 items-center justify-center" }, _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
2148
|
+
__name: "MissionProgress",
|
|
2149
|
+
props: {
|
|
2150
|
+
type: {
|
|
2151
|
+
type: String,
|
|
2152
|
+
required: !0
|
|
2153
|
+
},
|
|
2154
|
+
maxRange: {
|
|
2155
|
+
type: Number,
|
|
2156
|
+
required: !0
|
|
2157
|
+
},
|
|
2158
|
+
currentRange: {
|
|
2159
|
+
type: Number,
|
|
2160
|
+
default: 0
|
|
2161
|
+
},
|
|
2162
|
+
markers: {
|
|
2163
|
+
type: Array,
|
|
2164
|
+
default: () => []
|
|
2165
|
+
}
|
|
2166
|
+
},
|
|
2167
|
+
setup(e) {
|
|
2168
|
+
const d = e, { maxRange: r, currentRange: i, markers: u } = toRefs(d), a = computed(
|
|
2169
|
+
() => Math.min(i.value / r.value * 100, 100)
|
|
2170
|
+
), o = (n) => n / r.value * 100;
|
|
2171
|
+
return (n, l) => {
|
|
2172
|
+
const s = resolveComponent("FmIcon");
|
|
2173
|
+
return e.type === "STAMP" ? (openBlock(), createElementBlock("div", _hoisted_1$5, [
|
|
2174
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(Math.min(unref(r), 40), (h) => (openBlock(), createBlock(s, {
|
|
2175
|
+
class: normalizeClass(
|
|
2176
|
+
unref(i) >= h ? "text-fm-color-primary" : "text-fm-color-neutral-gray-200"
|
|
2177
|
+
),
|
|
2178
|
+
outline: unref(i) < h,
|
|
2179
|
+
key: h,
|
|
2180
|
+
name: unref(u).some((g) => g === h) ? "featured_seasonal_and_gifts" : "check_circle"
|
|
2181
|
+
}, null, 8, ["class", "outline", "name"]))), 128))
|
|
2182
|
+
])) : (openBlock(), createElementBlock("div", {
|
|
2183
|
+
key: 1,
|
|
2184
|
+
class: normalizeClass(["relative w-full h-4 rounded-lg", "bg-fm-color-system-warning-100"])
|
|
2185
|
+
}, [
|
|
2186
|
+
createElementVNode("div", {
|
|
2187
|
+
class: normalizeClass(["bg-fm-color-primary", "absolute top-0 left-0 h-full rounded-lg"]),
|
|
2188
|
+
style: normalizeStyle({ width: unref(a) + "%" })
|
|
2189
|
+
}, null, 4),
|
|
2190
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (h, g) => (openBlock(), createElementBlock("div", {
|
|
2191
|
+
key: g,
|
|
2192
|
+
class: "absolute -top-1.5 flex flex-col items-center -translate-x-1/2",
|
|
2193
|
+
style: normalizeStyle({ left: o(h) + "%" })
|
|
2194
|
+
}, [
|
|
2195
|
+
createElementVNode("div", _hoisted_2$4, [
|
|
2196
|
+
createElementVNode("div", {
|
|
2197
|
+
class: normalizeClass(["h-16 w-[2px]", "bg-fm-color-system-warning-300"])
|
|
2198
|
+
}),
|
|
2199
|
+
l[0] || (l[0] = createElementVNode("div", null, "🎁", -1))
|
|
2200
|
+
])
|
|
2201
|
+
], 4))), 128))
|
|
2202
|
+
]));
|
|
2203
|
+
};
|
|
2204
|
+
}
|
|
2205
|
+
}), isObject = (e) => e !== null && typeof e == "object";
|
|
2206
|
+
function changeKeysFactory(e) {
|
|
2207
|
+
return function d(r, i = 1, u) {
|
|
2208
|
+
if (i === 0 || !isObject(r))
|
|
2209
|
+
return r;
|
|
2210
|
+
if (Array.isArray(r))
|
|
2211
|
+
return r.map((o) => d(o, i - 1, u));
|
|
2212
|
+
const a = Object.create(Object.getPrototypeOf(r));
|
|
2213
|
+
return Object.keys(r).forEach((o) => {
|
|
2214
|
+
const n = r[o], l = e(o, u), s = d(n, i - 1, u);
|
|
2215
|
+
a[l] = s;
|
|
2216
|
+
}), a;
|
|
2217
|
+
};
|
|
2218
|
+
}
|
|
2219
|
+
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({
|
|
2220
|
+
__name: "MissionPoolInput",
|
|
2221
|
+
props: {
|
|
2222
|
+
modelValue: {
|
|
2223
|
+
type: Array,
|
|
2224
|
+
default: () => []
|
|
2225
|
+
},
|
|
2226
|
+
mission: {
|
|
2227
|
+
type: Object,
|
|
2228
|
+
required: !0
|
|
2229
|
+
}
|
|
2230
|
+
},
|
|
2231
|
+
emits: ["update:model-value"],
|
|
2232
|
+
setup(e, { emit: d }) {
|
|
2233
|
+
const r = e, i = d, u = useMembershipStore(), a = z.array(z.lazy(() => FdtoThresholdReward)).min(1, "Requires at least 1 reward"), o = computed(
|
|
2234
|
+
() => r.modelValue.sort((c, y) => c.threshold - y.threshold) ?? []
|
|
2235
|
+
), n = computed(() => {
|
|
2236
|
+
const c = a.safeParse(o.value);
|
|
2237
|
+
return c.success ? [] : c.error.errors;
|
|
2238
|
+
}), l = ref();
|
|
2239
|
+
function s(c, y) {
|
|
2240
|
+
var f;
|
|
2241
|
+
const m = [...o.value];
|
|
2242
|
+
m[y] = c, (f = l.value) == null || f.showSheet(!1), i("update:model-value", m);
|
|
2243
|
+
}
|
|
2244
|
+
function h(c) {
|
|
2245
|
+
const y = c.type == "VOUCHER" ? c.collectibleConfig : u.collectibles.find(
|
|
2246
|
+
(f) => f._id.toString() == c.collectible
|
|
2247
|
+
), m = CollectionUtils.formattedType((y == null ? void 0 : y.name) || "");
|
|
2248
|
+
return {
|
|
2249
|
+
label: isNullOrEmpty(m) ? "NO REWARD" : m,
|
|
2250
|
+
sublabel: `Reward at ${c.threshold} | Amount: ${c.earningOption.type == "FIXED" ? c.earningOption.amount : `${c.earningOption.amount} for every RM${c.earningOption.every} spent`} `
|
|
2251
|
+
};
|
|
2252
|
+
}
|
|
2253
|
+
function g(c) {
|
|
2254
|
+
var m;
|
|
2255
|
+
const y = [...o.value];
|
|
2256
|
+
(m = l.value) == null || m.showSheet(!0, y[c], c);
|
|
2257
|
+
}
|
|
2258
|
+
function b(c) {
|
|
2259
|
+
const y = [...o.value];
|
|
2260
|
+
y.splice(c, 1), i("update:model-value", y);
|
|
2261
|
+
}
|
|
2262
|
+
function k() {
|
|
2263
|
+
var c;
|
|
2264
|
+
(c = l.value) == null || c.showSheet(
|
|
2265
|
+
!0,
|
|
2266
|
+
{
|
|
2267
|
+
type: "LOYALTY",
|
|
2268
|
+
collectible: u.loyaltyRewards.items[0].value,
|
|
2269
|
+
threshold: null,
|
|
2270
|
+
validityOption: {
|
|
2271
|
+
validForDay: 7
|
|
2272
|
+
},
|
|
2273
|
+
earningOption: {
|
|
2274
|
+
type: "FIXED",
|
|
2275
|
+
amount: 1
|
|
2276
|
+
}
|
|
2277
|
+
},
|
|
2278
|
+
o.value.length
|
|
2279
|
+
);
|
|
2280
|
+
}
|
|
2281
|
+
function p(c) {
|
|
2282
|
+
var y, m;
|
|
2283
|
+
return c.type == "VOUCHER" ? (y = c.collectibleConfig) == null ? void 0 : y.name : sentenceCase(
|
|
2284
|
+
((m = u.loyaltyRewards.items.find(
|
|
2285
|
+
(f) => f.value == c.collectible
|
|
2286
|
+
)) == null ? void 0 : m.label) || ""
|
|
2287
|
+
);
|
|
2288
|
+
}
|
|
2289
|
+
return (c, y) => {
|
|
2290
|
+
const m = resolveComponent("FmButton"), f = resolveComponent("FmCard"), B = resolveComponent("FmHelperText");
|
|
2291
|
+
return openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
2292
|
+
y[2] || (y[2] = createElementVNode("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Configure the reward type given to your customer. ", -1)),
|
|
2293
|
+
createVNode(m, {
|
|
2294
|
+
label: "Add Reward",
|
|
2295
|
+
onClick: y[0] || (y[0] = (C) => k()),
|
|
2296
|
+
variant: "plain",
|
|
2297
|
+
icon: "add"
|
|
2298
|
+
}),
|
|
2299
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(o), (C, E) => (openBlock(), createBlock(f, {
|
|
2300
|
+
key: E,
|
|
2301
|
+
class: "px-16 py-12 flex items-center justify-between cursor-pointer",
|
|
2302
|
+
variant: "outlined",
|
|
2303
|
+
onClick: ($) => g(E)
|
|
2304
|
+
}, {
|
|
2305
|
+
default: withCtx(() => [
|
|
2306
|
+
createElementVNode("div", null, [
|
|
2307
|
+
createElementVNode("div", _hoisted_2$3, toDisplayString(h(C).label), 1),
|
|
2308
|
+
createElementVNode("div", _hoisted_3$3, toDisplayString(h(C).sublabel), 1)
|
|
2309
|
+
]),
|
|
2310
|
+
createVNode(m, {
|
|
2311
|
+
icon: "delete",
|
|
2312
|
+
variant: "tertiary",
|
|
2313
|
+
onClick: ($) => ($.stopPropagation(), b(E))
|
|
2314
|
+
}, null, 8, ["onClick"])
|
|
2315
|
+
]),
|
|
2316
|
+
_: 2
|
|
2317
|
+
}, 1032, ["onClick"]))), 128)),
|
|
2318
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(n).filter((C) => C.path.join(".") == ""), (C) => (openBlock(), createBlock(B, {
|
|
2319
|
+
key: C.message,
|
|
2320
|
+
text: C.message,
|
|
2321
|
+
state: "error"
|
|
2322
|
+
}, null, 8, ["text"]))), 128)),
|
|
2323
|
+
y[3] || (y[3] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Mission Preview", -1)),
|
|
2324
|
+
(openBlock(), createBlock(f, {
|
|
2325
|
+
key: 0,
|
|
2326
|
+
variant: "outlined",
|
|
2327
|
+
class: "p-24 space-y-16 w-fit"
|
|
2328
|
+
}, {
|
|
2329
|
+
default: withCtx(() => {
|
|
2330
|
+
var C, E;
|
|
2331
|
+
return [
|
|
2332
|
+
createElementVNode("div", _hoisted_4$2, [
|
|
2333
|
+
createElementVNode("div", null, [
|
|
2334
|
+
createElementVNode("div", _hoisted_5$2, " Collect " + toDisplayString(e.mission.end) + " stamps to get " + toDisplayString(((C = e.modelValue[e.modelValue.length - 1]) == null ? void 0 : C.earningOption.amount) > 1 ? (E = e.modelValue[e.modelValue.length - 1]) == null ? void 0 : E.earningOption.amount : "") + " " + toDisplayString(e.modelValue[e.modelValue.length - 1] ? p(e.modelValue[e.modelValue.length - 1]) : ""), 1),
|
|
2335
|
+
y[1] || (y[1] = createElementVNode("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Earn a stamp! ", -1))
|
|
2336
|
+
])
|
|
2337
|
+
]),
|
|
2338
|
+
createElementVNode("div", _hoisted_6$2, [
|
|
2339
|
+
createVNode(_sfc_main$5, {
|
|
2340
|
+
type: e.mission.type,
|
|
2341
|
+
"max-range": e.mission.end,
|
|
2342
|
+
currentRange: e.mission.end / 4,
|
|
2343
|
+
markers: e.modelValue.map(($) => $.threshold)
|
|
2344
|
+
}, null, 8, ["type", "max-range", "currentRange", "markers"]),
|
|
2345
|
+
e.mission.type == "PROGRESSIVE" ? (openBlock(), createElementBlock("div", _hoisted_7$1, " 0/" + toDisplayString(e.mission.end.toLocaleString()), 1)) : createCommentVNode("", !0)
|
|
2346
|
+
])
|
|
2347
|
+
];
|
|
2348
|
+
}),
|
|
2349
|
+
_: 1
|
|
2350
|
+
})),
|
|
2351
|
+
createVNode(_sfc_main$6, {
|
|
2352
|
+
ref_key: "sheetRef",
|
|
2353
|
+
ref: l,
|
|
2354
|
+
"onUpdate:modelValue": s,
|
|
2355
|
+
"max-threshold": e.mission.end
|
|
2356
|
+
}, null, 8, ["max-threshold"])
|
|
2357
|
+
]);
|
|
2358
|
+
};
|
|
2359
|
+
}
|
|
2360
|
+
}), _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({
|
|
2361
|
+
__name: "MissionInput",
|
|
2362
|
+
props: {
|
|
2363
|
+
modelValue: Object
|
|
2364
|
+
},
|
|
2365
|
+
emits: ["update:model-value"],
|
|
2366
|
+
setup(e, { emit: d }) {
|
|
2367
|
+
const r = e, i = computed(() => {
|
|
2368
|
+
const o = FdoMission.safeParse(r.modelValue);
|
|
2369
|
+
return o.success ? [] : o.error.errors;
|
|
2370
|
+
}), u = computed(() => [
|
|
2371
|
+
{
|
|
2372
|
+
label: "Stamp",
|
|
2373
|
+
description: "Award stamps for purchases, redeemable after reaching set milestones.",
|
|
2374
|
+
value: F_MISSION_TYPE.enum.STAMP
|
|
2375
|
+
},
|
|
2376
|
+
{
|
|
2377
|
+
label: "Progress",
|
|
2378
|
+
description: "Reward customers when they reach a cumulative spending goal.",
|
|
2379
|
+
value: F_MISSION_TYPE.enum.PROGRESSIVE
|
|
2380
|
+
}
|
|
2381
|
+
]), a = d;
|
|
2382
|
+
return (o, n) => {
|
|
2383
|
+
var h;
|
|
2384
|
+
const l = resolveComponent("FmCard"), s = resolveComponent("FmStepperField");
|
|
2385
|
+
return openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
2386
|
+
createElementVNode("div", _hoisted_2$2, [
|
|
2387
|
+
n[1] || (n[1] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Mission Type", -1)),
|
|
2388
|
+
n[2] || (n[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)),
|
|
2389
|
+
createElementVNode("div", _hoisted_3$2, [
|
|
2390
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (g) => {
|
|
2391
|
+
var b, k;
|
|
2392
|
+
return openBlock(), createBlock(l, {
|
|
2393
|
+
variant: "outlined",
|
|
2394
|
+
class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
|
|
2395
|
+
"col-span-2": unref(u).length == 1,
|
|
2396
|
+
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": ((b = e.modelValue) == null ? void 0 : b.type) == g.value,
|
|
2397
|
+
"hover:bg-fm-color-opacity-sm": ((k = e.modelValue) == null ? void 0 : k.type) != g.value
|
|
2398
|
+
}]),
|
|
2399
|
+
onClick: () => {
|
|
2400
|
+
var p, c;
|
|
2401
|
+
((p = e.modelValue) == null ? void 0 : p.type) != g.value && a("update:model-value", {
|
|
2402
|
+
...e.modelValue,
|
|
2403
|
+
type: g.value,
|
|
2404
|
+
end: ((c = e.modelValue) == null ? void 0 : c.end) || 1
|
|
2405
|
+
});
|
|
2406
|
+
},
|
|
2407
|
+
key: g.value
|
|
2408
|
+
}, {
|
|
2409
|
+
default: withCtx(() => [
|
|
2410
|
+
createElementVNode("div", _hoisted_4$1, toDisplayString(g.label), 1),
|
|
2411
|
+
createElementVNode("div", _hoisted_5$1, toDisplayString(g.description), 1)
|
|
2412
|
+
]),
|
|
2413
|
+
_: 2
|
|
2414
|
+
}, 1032, ["class", "onClick"]);
|
|
2415
|
+
}), 128))
|
|
2416
|
+
])
|
|
2417
|
+
]),
|
|
2418
|
+
createElementVNode("div", _hoisted_6$1, [
|
|
2419
|
+
n[3] || (n[3] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Collections required", -1)),
|
|
2420
|
+
n[4] || (n[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)),
|
|
2421
|
+
createVNode(s, {
|
|
2422
|
+
label: "Maximum to collect",
|
|
2423
|
+
"model-value": ((h = e.modelValue) == null ? void 0 : h.end) || null,
|
|
2424
|
+
"onUpdate:modelValue": n[0] || (n[0] = (g) => {
|
|
2425
|
+
var b;
|
|
2426
|
+
return a("update:model-value", {
|
|
2427
|
+
...e.modelValue,
|
|
2428
|
+
type: ((b = e.modelValue) == null ? void 0 : b.type) || "STAMP",
|
|
2429
|
+
end: g
|
|
2430
|
+
});
|
|
2431
|
+
}),
|
|
2432
|
+
"helper-text": unref(ZodHelper).helperText(unref(i), "end") || "Set the threshold required for reward eligibility",
|
|
2433
|
+
"helper-state": unref(ZodHelper).helperState(unref(i), "end") || "none"
|
|
2434
|
+
}, null, 8, ["model-value", "helper-text", "helper-state"])
|
|
2435
|
+
])
|
|
2436
|
+
]);
|
|
2437
|
+
};
|
|
2438
|
+
}
|
|
2439
|
+
}), _hoisted_1$2 = { key: 29 }, _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
2440
|
+
__name: "TemplateInput",
|
|
2441
|
+
props: {
|
|
2442
|
+
field: { type: Object, required: !0 },
|
|
2443
|
+
modelValue: {
|
|
2444
|
+
type: Object
|
|
2445
|
+
},
|
|
2446
|
+
schema: {
|
|
2447
|
+
type: Object
|
|
2448
|
+
},
|
|
2449
|
+
extras: {
|
|
2450
|
+
type: Object
|
|
2451
|
+
},
|
|
2452
|
+
helperText: {
|
|
2453
|
+
type: String
|
|
2454
|
+
},
|
|
2455
|
+
disabled: {
|
|
2456
|
+
type: Boolean,
|
|
2457
|
+
default: !1
|
|
2458
|
+
}
|
|
2459
|
+
},
|
|
2460
|
+
emits: ["update:model-value", "update:file"],
|
|
2461
|
+
setup(e, { emit: d }) {
|
|
2462
|
+
const { t: r } = useI18n(), i = e, u = d;
|
|
2463
|
+
function a(s) {
|
|
2464
|
+
switch (i.field.type) {
|
|
2465
|
+
case "timeframe":
|
|
2466
|
+
const h = s.startDate ? hooks(s.startDate).startOf("day").toISOString() : void 0, g = s.endDate ? hooks(s.endDate).endOf("day").toISOString() : void 0;
|
|
2467
|
+
u("update:model-value", {
|
|
2468
|
+
type: "timeframe",
|
|
2469
|
+
property: "__now",
|
|
2470
|
+
start: h,
|
|
2471
|
+
end: g
|
|
2472
|
+
});
|
|
2473
|
+
break;
|
|
2474
|
+
case "image": {
|
|
2475
|
+
u(
|
|
2476
|
+
"update:file",
|
|
2477
|
+
s,
|
|
2478
|
+
o.value || firebaseStorage.collectibleImagePath(void 0, s)
|
|
2479
|
+
);
|
|
2480
|
+
break;
|
|
2481
|
+
}
|
|
2482
|
+
default:
|
|
2483
|
+
u("update:model-value", s);
|
|
2484
|
+
break;
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2487
|
+
const o = computed(() => {
|
|
2488
|
+
switch (i.field.type) {
|
|
2489
|
+
case "timeframe": {
|
|
2490
|
+
const s = i.modelValue;
|
|
2491
|
+
return {
|
|
2492
|
+
startDate: s != null && s.start ? hooks(s == null ? void 0 : s.start).format("YYYY-MM-DD") : null,
|
|
2493
|
+
endDate: s != null && s.end ? hooks(s == null ? void 0 : s.end).format("YYYY-MM-DD") : null
|
|
2494
|
+
};
|
|
2495
|
+
}
|
|
2496
|
+
default:
|
|
2497
|
+
return i.modelValue;
|
|
2498
|
+
}
|
|
2499
|
+
});
|
|
2500
|
+
function n() {
|
|
2501
|
+
if (!l.value.schema) return [];
|
|
2502
|
+
const s = l.value.schema.safeParse(i.modelValue);
|
|
2503
|
+
return s.success ? [] : s.error.errors;
|
|
2504
|
+
}
|
|
2505
|
+
const l = computed(() => ({
|
|
2506
|
+
schema: i.schema,
|
|
2507
|
+
unwrapped: i.schema ? ZodHelper.unwrap(i.schema) : void 0,
|
|
2508
|
+
rules: i.schema ? [ZodHelper.ruleAtPath(i.schema, "")] : void 0,
|
|
2509
|
+
labelMark: i.schema && ZodHelper.isRequired(i.schema) == !1 ? "optional" : void 0,
|
|
2510
|
+
zodLabel: i.schema ? ZodHelper.toInputLabel(i.schema, i.field.label) : void 0
|
|
2511
|
+
}));
|
|
2512
|
+
return (s, h) => {
|
|
2513
|
+
var y, m, f, B, C;
|
|
2514
|
+
const g = resolveComponent("FmTextField"), b = resolveComponent("FmStepperField"), k = resolveComponent("FmTextarea"), p = resolveComponent("FmHelperText"), c = resolveComponent("FmSwitch");
|
|
2515
|
+
return e.field.type === "text" ? (openBlock(), createBlock(g, {
|
|
2516
|
+
key: 0,
|
|
2517
|
+
label: unref(r)(e.field.label),
|
|
2518
|
+
"label-mark": unref(l).labelMark,
|
|
2519
|
+
rules: unref(l).rules,
|
|
2520
|
+
"model-value": unref(o),
|
|
2521
|
+
"onUpdate:modelValue": a,
|
|
2522
|
+
"helper-state": e.helperText ? "error" : void 0,
|
|
2523
|
+
"helper-text": e.helperText
|
|
2524
|
+
}, null, 8, ["label", "label-mark", "rules", "model-value", "helper-state", "helper-text"])) : e.field.type === "number" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
2525
|
+
createVNode(JsonViewer, {
|
|
2526
|
+
json: { schema: unref(l).unwrapped, props: i }
|
|
2527
|
+
}, null, 8, ["json"]),
|
|
2528
|
+
createVNode(b, {
|
|
2529
|
+
label: unref(r)(e.field.label),
|
|
2530
|
+
"label-mark": e.field.isRuleChildren ? void 0 : unref(l).labelMark,
|
|
2531
|
+
"model-value": unref(o),
|
|
2532
|
+
rules: e.field.isRuleChildren ? [] : unref(l).rules,
|
|
2533
|
+
"onUpdate:modelValue": a,
|
|
2534
|
+
"helper-state": e.field.isRuleChildren && e.helperText ? "error" : void 0,
|
|
2535
|
+
"helper-text": e.field.isRuleChildren ? e.helperText : void 0
|
|
2536
|
+
}, null, 8, ["label", "label-mark", "model-value", "rules", "helper-state", "helper-text"])
|
|
2537
|
+
], 64)) : e.field.type === "textarea" ? (openBlock(), createBlock(k, {
|
|
2538
|
+
key: 2,
|
|
2539
|
+
label: unref(r)(e.field.label),
|
|
2540
|
+
"label-mark": unref(l).labelMark,
|
|
2541
|
+
rules: unref(l).rules,
|
|
2542
|
+
"model-value": unref(o),
|
|
2543
|
+
"onUpdate:modelValue": a,
|
|
2544
|
+
"show-word-count": "",
|
|
2545
|
+
"max-length": (C = (B = (f = (m = (y = unref(l)) == null ? void 0 : y.unwrapped) == null ? void 0 : m._def) == null ? void 0 : f.checks) == null ? void 0 : B.find((E) => E.kind == "max")) == null ? void 0 : C.value
|
|
2546
|
+
}, null, 8, ["label", "label-mark", "rules", "model-value", "max-length"])) : e.field.type === "trigger" ? (openBlock(), createBlock(_sfc_main$i, {
|
|
2547
|
+
key: 3,
|
|
2548
|
+
"campaign-type": e.extras,
|
|
2549
|
+
"model-value": unref(o),
|
|
2550
|
+
disabled: e.disabled,
|
|
2551
|
+
"onUpdate:modelValue": a
|
|
2552
|
+
}, null, 8, ["campaign-type", "model-value", "disabled"])) : e.field.type === "timeframe" ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
|
|
2553
|
+
createVNode(_sfc_main$g, {
|
|
2554
|
+
"model-value": unref(o),
|
|
2555
|
+
"onUpdate:modelValue": a
|
|
2556
|
+
}, null, 8, ["model-value"]),
|
|
2557
|
+
createVNode(p, {
|
|
2558
|
+
class: "!mt-[8px]",
|
|
2559
|
+
text: unref(ZodHelper).helperText(n(), ""),
|
|
2560
|
+
state: unref(ZodHelper).helperState(n(), "")
|
|
2561
|
+
}, null, 8, ["text", "state"])
|
|
2562
|
+
], 64)) : e.field.type === "image" ? (openBlock(), createBlock(_sfc_main$u, {
|
|
2563
|
+
key: 5,
|
|
2564
|
+
thumbnail: unref(o),
|
|
2565
|
+
"aspect-ratio": "16 / 9",
|
|
2566
|
+
class: "w-1/2 xs:w-2/3",
|
|
2567
|
+
"onUpdate:file": a
|
|
2568
|
+
}, {
|
|
2569
|
+
label: withCtx(() => [
|
|
2570
|
+
(openBlock(), createBlock(resolveDynamicComponent(unref(l).zodLabel)))
|
|
2571
|
+
]),
|
|
2572
|
+
_: 1
|
|
2573
|
+
}, 8, ["thumbnail"])) : e.field.type === "switch" ? (openBlock(), createBlock(c, {
|
|
2574
|
+
key: 6,
|
|
2575
|
+
label: unref(r)(e.field.label),
|
|
2576
|
+
"label-placement": "right",
|
|
2577
|
+
sublabel: e.field.property == "campaign.notify" ? "Notify customer when customer receives the reward" : void 0,
|
|
2578
|
+
"label-mark": unref(l).labelMark,
|
|
2579
|
+
rules: unref(l).rules,
|
|
2580
|
+
"model-value": unref(o),
|
|
2581
|
+
"onUpdate:modelValue": a
|
|
2582
|
+
}, null, 8, ["label", "sublabel", "label-mark", "rules", "model-value"])) : e.field.type === "collectible_options" ? (openBlock(), createBlock(_sfc_main$v, {
|
|
2583
|
+
key: 7,
|
|
2584
|
+
"model-value": unref(o),
|
|
2585
|
+
"onUpdate:modelValue": a,
|
|
2586
|
+
"no-campaign": !1,
|
|
2587
|
+
schema: unref(l).schema,
|
|
2588
|
+
"is-mission": e.extras === "MISSION"
|
|
2589
|
+
}, null, 8, ["model-value", "schema", "is-mission"])) : e.field.type === "grab_conditions" ? (openBlock(), createBlock(GrabConditionsInput, {
|
|
2590
|
+
key: 8,
|
|
2591
|
+
"model-value": unref(o),
|
|
2592
|
+
"onUpdate:modelValue": a,
|
|
2593
|
+
schema: unref(l).schema
|
|
2594
|
+
}, null, 8, ["model-value", "schema"])) : e.field.type === "grab_quota" ? (openBlock(), createBlock(_sfc_main$9, {
|
|
2595
|
+
key: 9,
|
|
2596
|
+
"model-value": unref(o),
|
|
2597
|
+
"onUpdate:modelValue": a,
|
|
2598
|
+
schema: unref(l).schema
|
|
2599
|
+
}, null, 8, ["model-value", "schema"])) : e.field.type === "target_location" ? (openBlock(), createBlock(_sfc_main$w, {
|
|
2600
|
+
key: 10,
|
|
2601
|
+
"model-value": unref(o),
|
|
2602
|
+
"onUpdate:modelValue": a
|
|
2603
|
+
}, null, 8, ["model-value"])) : e.field.type == "effect" ? (openBlock(), createElementBlock(Fragment, { key: 11 }, [
|
|
2604
|
+
createVNode(_sfc_main$x, {
|
|
2605
|
+
"model-value": unref(o),
|
|
2606
|
+
"onUpdate:modelValue": a,
|
|
2607
|
+
"can-set-auto-apply": e.field.property == "campaign.effect"
|
|
2608
|
+
}, null, 8, ["model-value", "can-set-auto-apply"]),
|
|
2609
|
+
unref(o) ? createCommentVNode("", !0) : (openBlock(), createBlock(p, {
|
|
2610
|
+
key: 0,
|
|
2611
|
+
class: "!mt-[8px]",
|
|
2612
|
+
text: unref(r)("connect.campaign.common.effect_required"),
|
|
2613
|
+
state: "error"
|
|
2614
|
+
}, null, 8, ["text"]))
|
|
2615
|
+
], 64)) : e.field.type == "grab_effect" ? (openBlock(), createElementBlock(Fragment, { key: 12 }, [
|
|
2616
|
+
createVNode(GrabEffectSheet, {
|
|
2617
|
+
"model-value": unref(o),
|
|
2618
|
+
"onUpdate:modelValue": a
|
|
2619
|
+
}, null, 8, ["model-value"]),
|
|
2620
|
+
unref(o) ? createCommentVNode("", !0) : (openBlock(), createBlock(p, {
|
|
2621
|
+
key: 0,
|
|
2622
|
+
class: "!mt-[8px]",
|
|
2623
|
+
text: unref(r)("connect.campaign.common.effect_required"),
|
|
2624
|
+
state: "error"
|
|
2625
|
+
}, null, 8, ["text"]))
|
|
2626
|
+
], 64)) : e.field.type === "message" ? (openBlock(), createBlock(_sfc_main$y, {
|
|
2627
|
+
key: 13,
|
|
2628
|
+
"allow-email": !0,
|
|
2629
|
+
"allow-whatsapp": !0,
|
|
2630
|
+
"model-value": unref(o),
|
|
2631
|
+
"onUpdate:modelValue": a,
|
|
2632
|
+
"helper-text": unref(ZodHelper).helperText(n(), ""),
|
|
2633
|
+
"trigger-type": e.field.extras,
|
|
2634
|
+
"helper-state": unref(ZodHelper).helperState(n(), "")
|
|
2635
|
+
}, null, 8, ["model-value", "helper-text", "trigger-type", "helper-state"])) : e.field.type === "earning_option" ? (openBlock(), createBlock(_sfc_main$r, {
|
|
2636
|
+
key: 14,
|
|
2637
|
+
"model-value": unref(o),
|
|
2638
|
+
"onUpdate:modelValue": a,
|
|
2639
|
+
extras: e.extras,
|
|
2640
|
+
"error-text": e.helperText
|
|
2641
|
+
}, null, 8, ["model-value", "extras", "error-text"])) : e.field.type === "validity_option" ? (openBlock(), createBlock(_sfc_main$s, {
|
|
2642
|
+
key: 15,
|
|
2643
|
+
type: "custom",
|
|
2644
|
+
"model-value": unref(o),
|
|
2645
|
+
"onUpdate:modelValue": a,
|
|
2646
|
+
"helper-text": e.helperText || unref(ZodHelper).helperText(n(), "")
|
|
2647
|
+
}, null, 8, ["model-value", "helper-text"])) : e.field.type === "game_type" ? (openBlock(), createBlock(_sfc_main$e, {
|
|
2648
|
+
key: 16,
|
|
2649
|
+
"model-value": unref(o),
|
|
2650
|
+
"onUpdate:modelValue": a
|
|
2651
|
+
}, null, 8, ["model-value"])) : e.field.type === "reward_pool" ? (openBlock(), createBlock(_sfc_main$c, {
|
|
2652
|
+
key: 17,
|
|
2653
|
+
"model-value": unref(o),
|
|
2654
|
+
"onUpdate:modelValue": a
|
|
2655
|
+
}, null, 8, ["model-value"])) : e.field.type === "mission" ? (openBlock(), createBlock(_sfc_main$3, {
|
|
2656
|
+
key: 18,
|
|
2657
|
+
"model-value": unref(o),
|
|
2658
|
+
"onUpdate:modelValue": a
|
|
2659
|
+
}, null, 8, ["model-value"])) : e.field.type === "mission_type" ? (openBlock(), createBlock(_sfc_main$8, {
|
|
2660
|
+
key: 19,
|
|
2661
|
+
"model-value": unref(o),
|
|
2662
|
+
"onUpdate:modelValue": a
|
|
2663
|
+
}, null, 8, ["model-value"])) : e.field.type === "mission_end" ? (openBlock(), createBlock(_sfc_main$7, {
|
|
2664
|
+
key: 20,
|
|
2665
|
+
"model-value": unref(o),
|
|
2666
|
+
"onUpdate:modelValue": a,
|
|
2667
|
+
"helper-text": unref(ZodHelper).helperText(n(), ""),
|
|
2668
|
+
"helper-state": unref(ZodHelper).helperState(n(), "")
|
|
2669
|
+
}, null, 8, ["model-value", "helper-text", "helper-state"])) : e.field.type === "mission_pool" ? (openBlock(), createBlock(_sfc_main$4, {
|
|
2670
|
+
key: 21,
|
|
2671
|
+
"model-value": unref(o),
|
|
2672
|
+
"onUpdate:modelValue": a,
|
|
2673
|
+
mission: e.extras.mission
|
|
2674
|
+
}, null, 8, ["model-value", "mission"])) : e.field.type === "rule_schedule" ? (openBlock(), createElementBlock(Fragment, { key: 22 }, [
|
|
2675
|
+
createVNode(_sfc_main$f, {
|
|
2676
|
+
"model-value": unref(o),
|
|
2677
|
+
"onUpdate:modelValue": a,
|
|
2678
|
+
"start-date": e.extras.start,
|
|
2679
|
+
"end-date": e.extras.end
|
|
2680
|
+
}, null, 8, ["model-value", "start-date", "end-date"]),
|
|
2681
|
+
e.helperText ? (openBlock(), createBlock(p, {
|
|
2682
|
+
key: 0,
|
|
2683
|
+
class: "!mt-[8px]",
|
|
2684
|
+
text: e.helperText,
|
|
2685
|
+
state: "error"
|
|
2686
|
+
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
2687
|
+
], 64)) : e.field.type === "rule_user" ? (openBlock(), createElementBlock(Fragment, { key: 23 }, [
|
|
2688
|
+
createVNode(_sfc_main$z, {
|
|
2689
|
+
"model-value": unref(o),
|
|
2690
|
+
"onUpdate:modelValue": a
|
|
2691
|
+
}, null, 8, ["model-value"]),
|
|
2692
|
+
e.helperText ? (openBlock(), createBlock(p, {
|
|
2693
|
+
key: 0,
|
|
2694
|
+
class: "!mt-[8px]",
|
|
2695
|
+
text: e.helperText,
|
|
2696
|
+
state: "error"
|
|
2697
|
+
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
2698
|
+
], 64)) : e.field.type === "rule_time" ? (openBlock(), createElementBlock(Fragment, { key: 24 }, [
|
|
2699
|
+
e.extras == "PROMOTION" && unref(RuleBuilder).getRules(unref(o).rules.g_time).length > 0 ? (openBlock(), createBlock(p, {
|
|
2700
|
+
key: 0,
|
|
2701
|
+
state: "warning",
|
|
2702
|
+
text: `Time based rule only work for POS >= v${unref(featureVersionMapping).TIME_BASED_PROMOTION}`
|
|
2703
|
+
}, null, 8, ["text"])) : createCommentVNode("", !0),
|
|
2704
|
+
createVNode(_sfc_main$k, {
|
|
2705
|
+
"model-value": unref(o),
|
|
2706
|
+
"onUpdate:modelValue": a
|
|
2707
|
+
}, null, 8, ["model-value"]),
|
|
2708
|
+
e.helperText ? (openBlock(), createBlock(p, {
|
|
2709
|
+
key: 1,
|
|
2710
|
+
class: "!mt-[8px]",
|
|
2711
|
+
text: e.helperText,
|
|
2712
|
+
state: "error"
|
|
2713
|
+
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
2714
|
+
], 64)) : e.field.type === "rule_bill" ? (openBlock(), createElementBlock(Fragment, { key: 25 }, [
|
|
2715
|
+
createVNode(_sfc_main$A, {
|
|
2716
|
+
"model-value": unref(o),
|
|
2717
|
+
"onUpdate:modelValue": a
|
|
2718
|
+
}, null, 8, ["model-value"]),
|
|
2719
|
+
e.helperText ? (openBlock(), createBlock(p, {
|
|
2720
|
+
key: 0,
|
|
2721
|
+
class: "!mt-[8px]",
|
|
2722
|
+
text: e.helperText,
|
|
2723
|
+
state: "error"
|
|
2724
|
+
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
2725
|
+
], 64)) : e.field.type === "rule_feedback" ? (openBlock(), createElementBlock(Fragment, { key: 26 }, [
|
|
2726
|
+
createVNode(_sfc_main$B, {
|
|
2727
|
+
"model-value": unref(o),
|
|
2728
|
+
"onUpdate:modelValue": a
|
|
2729
|
+
}, null, 8, ["model-value"]),
|
|
2730
|
+
e.helperText ? (openBlock(), createBlock(p, {
|
|
2731
|
+
key: 0,
|
|
2732
|
+
class: "!mt-[8px]",
|
|
2733
|
+
text: e.helperText,
|
|
2734
|
+
state: "error"
|
|
2735
|
+
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
2736
|
+
], 64)) : e.field.type === "rule_birthday" ? (openBlock(), createElementBlock(Fragment, { key: 27 }, [
|
|
2737
|
+
createVNode(_sfc_main$j, {
|
|
2738
|
+
"model-value": unref(o),
|
|
2739
|
+
"onUpdate:modelValue": a
|
|
2740
|
+
}, null, 8, ["model-value"]),
|
|
2741
|
+
e.helperText ? (openBlock(), createBlock(p, {
|
|
2742
|
+
key: 0,
|
|
2743
|
+
class: "!mt-[8px]",
|
|
2744
|
+
text: e.helperText,
|
|
2745
|
+
state: "error"
|
|
2746
|
+
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
2747
|
+
], 64)) : e.field.type === "promotion_game_type" ? (openBlock(), createElementBlock(Fragment, { key: 28 }, [
|
|
2748
|
+
createVNode(_sfc_main$b, {
|
|
2749
|
+
"model-value": unref(o),
|
|
2750
|
+
"onUpdate:modelValue": a
|
|
2751
|
+
}, null, 8, ["model-value"]),
|
|
2752
|
+
e.helperText ? (openBlock(), createBlock(p, {
|
|
2753
|
+
key: 0,
|
|
2754
|
+
class: "!mt-[8px]",
|
|
2755
|
+
text: e.helperText,
|
|
2756
|
+
state: "error"
|
|
2757
|
+
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
2758
|
+
], 64)) : (openBlock(), createElementBlock("pre", _hoisted_1$2, toDisplayString(i.field), 1));
|
|
2759
|
+
};
|
|
2760
|
+
}
|
|
2761
|
+
}), _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({
|
|
2762
|
+
__name: "CampaignSummary",
|
|
2763
|
+
props: {
|
|
2764
|
+
data: {
|
|
2765
|
+
type: Object,
|
|
2766
|
+
required: !0
|
|
2767
|
+
}
|
|
2768
|
+
},
|
|
2769
|
+
setup(e) {
|
|
2770
|
+
const { t: d, te: r } = useI18n();
|
|
2771
|
+
return (i, u) => {
|
|
2772
|
+
const a = resolveComponent("FmCard");
|
|
2773
|
+
return openBlock(), createBlock(a, {
|
|
2774
|
+
variant: "outlined",
|
|
2775
|
+
class: "p-16 space-y-8"
|
|
2776
|
+
}, {
|
|
2777
|
+
default: withCtx(() => [
|
|
2778
|
+
createElementVNode("div", _hoisted_1$1, toDisplayString(unref(d)("connect.campaign.common.summary")), 1),
|
|
2779
|
+
u[0] || (u[0] = createElementVNode("div", { class: "h-[1px] bg-fm-color-neutral-gray-100 w-full" }, null, -1)),
|
|
2780
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(getCampaignSummaryObject)(e.data), (o, n) => (openBlock(), createElementBlock("div", {
|
|
2781
|
+
class: "space-y-4",
|
|
2782
|
+
key: n
|
|
2783
|
+
}, [
|
|
2784
|
+
o ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2785
|
+
createElementVNode("div", _hoisted_2$1, toDisplayString(unref(d)(`${n}`)), 1),
|
|
2786
|
+
createElementVNode("div", _hoisted_3$1, toDisplayString(unref(r)(`${o}`) ? unref(d)(`${o}`) : o), 1)
|
|
2787
|
+
], 64)) : createCommentVNode("", !0)
|
|
2788
|
+
]))), 128))
|
|
2789
|
+
]),
|
|
2790
|
+
_: 1
|
|
2791
|
+
});
|
|
2792
|
+
};
|
|
2793
|
+
}
|
|
2794
|
+
}), _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 = {
|
|
2795
|
+
key: 0,
|
|
2796
|
+
class: "max-w-6xl mx-auto"
|
|
2797
|
+
}, _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({
|
|
2798
|
+
__name: "EditCampaignSheet",
|
|
2799
|
+
emits: ["submit:model-value"],
|
|
2800
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
2801
|
+
const Dialog = useDialog(), sheetVisible = ref(!1), { t } = useI18n(), currentStep = ref(1), data = ref(), schema = ref(z.any()), template = ref(
|
|
2802
|
+
TEMPLATES.VOUCHER
|
|
2803
|
+
), { minor } = useLoading, isLoading = ref(!1), sheetTitle = ref("Create Campaign");
|
|
2804
|
+
async function showSheet(visible, type, campaign, selectedTemplate) {
|
|
2805
|
+
var e, d;
|
|
2806
|
+
if (sheetVisible.value = visible, visible == !0) {
|
|
2807
|
+
try {
|
|
2808
|
+
isLoading.value = visible, await useMembershipStore().readRewards(), await useBusinessStore().readLocations(), await useMembershipStore().readSegments(), await useMembershipStore().readMembership();
|
|
2809
|
+
} catch {
|
|
2810
|
+
} finally {
|
|
2811
|
+
await new Promise((r) => setTimeout(r, 120)), isLoading.value = !1;
|
|
2812
|
+
}
|
|
2813
|
+
console.log(
|
|
2814
|
+
TEMPLATES[type],
|
|
2815
|
+
"base template"
|
|
2816
|
+
), template.value = selectedTemplate ?? TEMPLATES[type], schema.value = CampaignDtos[type], type === "VOUCHER" && (await useCampaignStore().read(), schema.value = schema.value.superRefine((r, i) => {
|
|
2817
|
+
r.campaign.type === "VOUCHER" && r.campaign.code && useCampaignStore().campaigns.voucher.some(
|
|
2818
|
+
(u) => u.code === r.campaign.code && u._id.toString() !== r.campaign._id.toString()
|
|
2819
|
+
) && i.addIssue({
|
|
2820
|
+
code: "custom",
|
|
2821
|
+
message: "Code already exists, please use another code",
|
|
2822
|
+
path: ["campaign", "code"]
|
|
2823
|
+
});
|
|
2824
|
+
})), data.value = campaign != null ? { ...campaign, templateId: (e = campaign.template) == null ? void 0 : e._id } : _.cloneDeep({
|
|
2825
|
+
...(d = template.value) == null ? void 0 : d.defaultValue
|
|
2826
|
+
}), "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`;
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2829
|
+
async function hideSheet() {
|
|
2830
|
+
Dialog.open({
|
|
2831
|
+
title: t("connect.campaign.common.unsaved_changes"),
|
|
2832
|
+
message: t("connect.campaign.common.unsaved_changes"),
|
|
2833
|
+
primaryActions: {
|
|
2834
|
+
text: t("connect.campaign.common.unsaved_changes_confirm"),
|
|
2835
|
+
close: !0
|
|
2836
|
+
},
|
|
2837
|
+
secondaryActions: {
|
|
2838
|
+
text: t("connect.campaign.common.unsaved_changes_cancel"),
|
|
2839
|
+
close: !1
|
|
2840
|
+
}
|
|
2841
|
+
}).onPrimary(() => {
|
|
2842
|
+
sheetVisible.value = !1;
|
|
2843
|
+
}).onSecondary(() => {
|
|
2844
|
+
Dialog.close();
|
|
2845
|
+
});
|
|
2846
|
+
}
|
|
2847
|
+
const emits = __emit, errors = computed(() => {
|
|
2848
|
+
const e = schema.value.superRefine(campaignRefinement).safeParse(data.value);
|
|
2849
|
+
return e.success ? [] : e.error.errors;
|
|
2850
|
+
});
|
|
2851
|
+
function stepErrors(e = currentStep.value - 1) {
|
|
2852
|
+
const d = template.value.steps[e].groups.flatMap(
|
|
2853
|
+
(r) => r.fields.map((i) => i.property)
|
|
2854
|
+
);
|
|
2855
|
+
return errors.value.filter(
|
|
2856
|
+
(r) => d.some((i) => r.path.join(".").includes(i))
|
|
2857
|
+
);
|
|
2858
|
+
}
|
|
2859
|
+
__expose({ showSheet });
|
|
2860
|
+
function showSummaryDialog() {
|
|
2861
|
+
Dialog.open({
|
|
2862
|
+
title: "",
|
|
2863
|
+
dialogComponent: _sfc_main$1,
|
|
2864
|
+
dialogComponentProps: {
|
|
2865
|
+
data: data.value
|
|
2866
|
+
}
|
|
2867
|
+
});
|
|
2868
|
+
}
|
|
2869
|
+
function onUpdateProperty(e, d) {
|
|
2870
|
+
var r, i, u, a, o, n, l, s;
|
|
2871
|
+
if (_.set(data.value, e, d), e == "campaign.event.type") {
|
|
2872
|
+
const g = ((a = (u = (i = (r = template.value) == null ? void 0 : r.defaultValue) == null ? void 0 : i.campaign) == null ? void 0 : u.event) == null ? void 0 : a.rule) ? _.cloneDeep({
|
|
2873
|
+
...(s = (l = (n = (o = template.value) == null ? void 0 : o.defaultValue) == null ? void 0 : n.campaign) == null ? void 0 : l.event) == null ? void 0 : s.rule
|
|
2874
|
+
}) : RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup(), [
|
|
2875
|
+
RuleBuilder.scaffoldGroup("g_schedule"),
|
|
2876
|
+
RuleBuilder.scaffoldGroup("g_time"),
|
|
2877
|
+
RuleBuilder.scaffoldGroup("g_user"),
|
|
2878
|
+
RuleBuilder.scaffoldGroup("g_bill")
|
|
2879
|
+
]), b = RuleBuilder.setRuleToGroup(
|
|
2880
|
+
RuleBuilder.scaffoldGroup("g_schedule"),
|
|
2881
|
+
[
|
|
2882
|
+
RuleBuilder.constructEntry(
|
|
2883
|
+
"trigger.date",
|
|
2884
|
+
"_rrule",
|
|
2885
|
+
"RRULE:FREQ=DAILY;INTERVAL=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0;WKST=SU"
|
|
2886
|
+
),
|
|
2887
|
+
RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
|
|
2888
|
+
],
|
|
2889
|
+
"&&"
|
|
2890
|
+
);
|
|
2891
|
+
if (d != "SCHEDULE") {
|
|
2892
|
+
_.set(data.value, "campaign.event.rule", g);
|
|
2893
|
+
return;
|
|
2894
|
+
}
|
|
2895
|
+
_.set(
|
|
2896
|
+
data.value,
|
|
2897
|
+
"campaign.event.rule",
|
|
2898
|
+
RuleBuilder.setRuleToGroup(g, b)
|
|
2899
|
+
);
|
|
2900
|
+
}
|
|
2901
|
+
e == "campaign.notify" && d == !1 && _.set(data.value, "campaign.notifyMessage", void 0);
|
|
2902
|
+
}
|
|
2903
|
+
async function onUpdateFile(e, d) {
|
|
2904
|
+
return e ? await minor(async () => firebaseStorage.update(d, e), {
|
|
2905
|
+
message: `${e ? "Uploading" : "Removing"} file`,
|
|
2906
|
+
successMessage: `File ${e ? "uploaded" : "removed"} successfully`
|
|
2907
|
+
}) : "";
|
|
2908
|
+
}
|
|
2909
|
+
function isDisable(e) {
|
|
2910
|
+
var d, r;
|
|
2911
|
+
switch (e == null ? void 0 : e.property) {
|
|
2912
|
+
case "campaign.event.type":
|
|
2913
|
+
return ((r = (d = data.value) == null ? void 0 : d.campaign) == null ? void 0 : r._id) || !1;
|
|
2914
|
+
default:
|
|
2915
|
+
return !1;
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
function onSubmit() {
|
|
2919
|
+
const e = schema.value.superRefine(campaignRefinement).transform(campaignTransform).safeParse(data.value);
|
|
2920
|
+
e.success && (emits("submit:model-value", cleanPF(JSON.parse(JSON.stringify(e.data)))), sheetVisible.value = !1);
|
|
2921
|
+
}
|
|
2922
|
+
return (e, d) => {
|
|
2923
|
+
const r = resolveComponent("FmButton"), i = resolveComponent("FmStep"), u = resolveComponent("FmStepper"), a = resolveComponent("FmCard"), o = resolveComponent("FmTopSheet");
|
|
2924
|
+
return openBlock(), createBlock(o, {
|
|
2925
|
+
"fullscreen-size": "lg",
|
|
2926
|
+
modelValue: unref(sheetVisible),
|
|
2927
|
+
"onUpdate:modelValue": [
|
|
2928
|
+
d[7] || (d[7] = (n) => isRef(sheetVisible) ? sheetVisible.value = n : null),
|
|
2929
|
+
d[8] || (d[8] = (n) => sheetVisible.value = n)
|
|
2930
|
+
]
|
|
2931
|
+
}, createSlots({
|
|
2932
|
+
"top-sheet-header": withCtx(() => [
|
|
2933
|
+
createElementVNode("div", _hoisted_1, [
|
|
2934
|
+
createElementVNode("div", null, toDisplayString(unref(sheetTitle)), 1),
|
|
2935
|
+
createElementVNode("div", _hoisted_2, [
|
|
2936
|
+
createVNode(r, {
|
|
2937
|
+
onClick: d[0] || (d[0] = (n) => hideSheet()),
|
|
2938
|
+
label: unref(t)("connect.campaign.common.cancel"),
|
|
2939
|
+
variant: "tertiary"
|
|
2940
|
+
}, null, 8, ["label"]),
|
|
2941
|
+
createVNode(r, {
|
|
2942
|
+
onClick: onSubmit,
|
|
2943
|
+
label: unref(t)("connect.campaign.common.save"),
|
|
2944
|
+
disabled: unref(errors).length > 0
|
|
2945
|
+
}, null, 8, ["label", "disabled"])
|
|
2946
|
+
])
|
|
2947
|
+
])
|
|
2948
|
+
]),
|
|
2949
|
+
_: 2
|
|
2950
|
+
}, [
|
|
2951
|
+
unref(isLoading) ? {
|
|
2952
|
+
name: "default",
|
|
2953
|
+
fn: withCtx(() => [
|
|
2954
|
+
createElementVNode("div", _hoisted_9, [
|
|
2955
|
+
createElementVNode("div", _hoisted_10, [
|
|
2956
|
+
createElementVNode("div", _hoisted_11, [
|
|
2957
|
+
d[9] || (d[9] = createElementVNode("div", { class: "col-span-2 space-y-80 xs:col-span-3 xs:px-16 xs:pt-16" }, [
|
|
2958
|
+
createElementVNode("div", { class: "flex-1 space-y-6 py-1" }, [
|
|
2959
|
+
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100 rounded" }),
|
|
2960
|
+
createElementVNode("div", { class: "h-[80px] bg-fm-color-neutral-gray-100 rounded" }),
|
|
2961
|
+
createElementVNode("div", { class: "space-y-3" }, [
|
|
2962
|
+
createElementVNode("div", { class: "grid grid-cols-2 gap-4" }, [
|
|
2963
|
+
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" }),
|
|
2964
|
+
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
|
|
2965
|
+
]),
|
|
2966
|
+
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
|
|
2967
|
+
]),
|
|
2968
|
+
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100 rounded" }),
|
|
2969
|
+
createElementVNode("div", { class: "h-[80px] bg-fm-color-neutral-gray-100 rounded" }),
|
|
2970
|
+
createElementVNode("div", { class: "space-y-3" }, [
|
|
2971
|
+
createElementVNode("div", { class: "grid grid-cols-2 gap-4" }, [
|
|
2972
|
+
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" }),
|
|
2973
|
+
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
|
|
2974
|
+
]),
|
|
2975
|
+
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
|
|
2976
|
+
])
|
|
2977
|
+
])
|
|
2978
|
+
], -1)),
|
|
2979
|
+
createVNode(a, { class: "h-[150px] bg-fm-color-neutral-gray-100" })
|
|
2980
|
+
])
|
|
2981
|
+
])
|
|
2982
|
+
])
|
|
2983
|
+
]),
|
|
2984
|
+
key: "1"
|
|
2985
|
+
} : {
|
|
2986
|
+
name: "default",
|
|
2987
|
+
fn: withCtx(() => [
|
|
2988
|
+
unref(data) ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
2989
|
+
createVNode(u, {
|
|
2990
|
+
modelValue: unref(currentStep),
|
|
2991
|
+
"onUpdate:modelValue": d[1] || (d[1] = (n) => isRef(currentStep) ? currentStep.value = n : null),
|
|
2992
|
+
orientation: "horizontal",
|
|
2993
|
+
class: "xs:hidden mx-[-24px] mt-16 mb-24 flex-1"
|
|
2994
|
+
}, {
|
|
2995
|
+
default: withCtx(() => [
|
|
2996
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps, (n, l) => (openBlock(), createBlock(i, {
|
|
2997
|
+
key: n.name,
|
|
2998
|
+
title: unref(t)(n.name),
|
|
2999
|
+
value: l + 1,
|
|
3000
|
+
error: () => stepErrors(l).length > 0,
|
|
3001
|
+
complete: () => l + 1 <= unref(currentStep)
|
|
3002
|
+
}, null, 8, ["title", "value", "error", "complete"]))), 128))
|
|
3003
|
+
]),
|
|
3004
|
+
_: 1
|
|
3005
|
+
}, 8, ["modelValue"]),
|
|
3006
|
+
createElementVNode("div", _hoisted_4, [
|
|
3007
|
+
createVNode(r, {
|
|
3008
|
+
icon: "close",
|
|
3009
|
+
variant: "tertiary",
|
|
3010
|
+
onClick: d[2] || (d[2] = (n) => sheetVisible.value = !1)
|
|
3011
|
+
}),
|
|
3012
|
+
createVNode(u, {
|
|
3013
|
+
modelValue: unref(currentStep),
|
|
3014
|
+
"onUpdate:modelValue": d[3] || (d[3] = (n) => isRef(currentStep) ? currentStep.value = n : null),
|
|
3015
|
+
orientation: "horizontal",
|
|
3016
|
+
class: "flex-1"
|
|
3017
|
+
}, {
|
|
3018
|
+
default: withCtx(() => [
|
|
3019
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps, (n, l) => (openBlock(), createBlock(i, {
|
|
3020
|
+
key: n.name,
|
|
3021
|
+
title: unref(sheetTitle),
|
|
3022
|
+
description: unref(t)(n.name),
|
|
3023
|
+
value: l + 1,
|
|
3024
|
+
error: () => stepErrors(l).length > 0,
|
|
3025
|
+
complete: () => l + 1 <= unref(currentStep) && stepErrors(unref(currentStep) - 1).length == 0
|
|
3026
|
+
}, null, 8, ["title", "description", "value", "error", "complete"]))), 128))
|
|
3027
|
+
]),
|
|
3028
|
+
_: 1
|
|
3029
|
+
}, 8, ["modelValue"]),
|
|
3030
|
+
createVNode(r, {
|
|
3031
|
+
icon: "info",
|
|
3032
|
+
variant: "tertiary",
|
|
3033
|
+
onClick: d[4] || (d[4] = () => showSummaryDialog())
|
|
3034
|
+
})
|
|
3035
|
+
]),
|
|
3036
|
+
createElementVNode("div", _hoisted_5, [
|
|
3037
|
+
createElementVNode("div", _hoisted_6, [
|
|
3038
|
+
createVNode(JsonViewer, {
|
|
3039
|
+
json: {
|
|
3040
|
+
data: unref(data),
|
|
3041
|
+
errors: unref(errors).map(
|
|
3042
|
+
(n) => `${n.path.join(".")} - ${n.message}`
|
|
3043
|
+
),
|
|
3044
|
+
stepErrors: stepErrors().map(
|
|
3045
|
+
(n) => `${n.path.join(".")} - ${n.message}`
|
|
3046
|
+
),
|
|
3047
|
+
schema: unref(schema)
|
|
3048
|
+
}
|
|
3049
|
+
}, null, 8, ["json"]),
|
|
3050
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps[unref(currentStep) - 1].groups.filter(
|
|
3051
|
+
(n) => n.fields.length && (!n.condition || unref(_).get(unref(data), n.condition.property) == n.condition.value == (n.condition.not != !0))
|
|
3052
|
+
), (n, l) => (openBlock(), createElementBlock("div", {
|
|
3053
|
+
key: l,
|
|
3054
|
+
class: "space-y-24"
|
|
3055
|
+
}, [
|
|
3056
|
+
createElementVNode("div", _hoisted_7, toDisplayString(n.name ? unref(t)(n.name) : ""), 1),
|
|
3057
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(n.fields, (s, h) => (openBlock(), createElementBlock("div", { key: h }, [
|
|
3058
|
+
(openBlock(), createBlock(_sfc_main$2, {
|
|
3059
|
+
key: h,
|
|
3060
|
+
field: s,
|
|
3061
|
+
modelValue: unref(_).get(unref(data), s.property),
|
|
3062
|
+
disabled: isDisable(s),
|
|
3063
|
+
"onUpdate:modelValue": (g) => onUpdateProperty(s.property, g),
|
|
3064
|
+
"onUpdate:file": async (g, b) => {
|
|
3065
|
+
const k = await onUpdateFile(g, b);
|
|
3066
|
+
onUpdateProperty(s.property, k || "");
|
|
3067
|
+
},
|
|
3068
|
+
schema: unref(ZodHelper).typeAtPath(
|
|
3069
|
+
unref(schema),
|
|
3070
|
+
s.property,
|
|
3071
|
+
unref(data).campaign.type != "MISSION" ? [unref(data).campaign.type] : ["STAMP", "MISSION"]
|
|
3072
|
+
),
|
|
3073
|
+
"helper-state": unref(ZodHelper).helperState(unref(errors), s.property),
|
|
3074
|
+
"helper-text": unref(ZodHelper).helperText(unref(errors), s.property),
|
|
3075
|
+
extras: s.extras != null ? s.extras == "" ? unref(data) : unref(_).get(unref(data), s.extras) : void 0
|
|
3076
|
+
}, null, 8, ["field", "modelValue", "disabled", "onUpdate:modelValue", "onUpdate:file", "schema", "helper-state", "helper-text", "extras"]))
|
|
3077
|
+
]))), 128))
|
|
3078
|
+
]))), 128)),
|
|
3079
|
+
createElementVNode("div", _hoisted_8, [
|
|
3080
|
+
createVNode(r, {
|
|
3081
|
+
label: "Back",
|
|
3082
|
+
variant: "tertiary",
|
|
3083
|
+
disabled: unref(currentStep) == 1,
|
|
3084
|
+
onClick: d[5] || (d[5] = (n) => currentStep.value--)
|
|
3085
|
+
}, null, 8, ["disabled"]),
|
|
3086
|
+
createVNode(r, {
|
|
3087
|
+
disabled: unref(currentStep) - 1 < unref(template).steps.length - 1 ? stepErrors().length > 0 : unref(errors).length > 0,
|
|
3088
|
+
label: unref(currentStep) - 1 < unref(template).steps.length - 1 ? "Next" : "Submit",
|
|
3089
|
+
onClick: d[6] || (d[6] = (n) => unref(currentStep) - 1 < unref(template).steps.length - 1 ? currentStep.value++ : onSubmit())
|
|
3090
|
+
}, null, 8, ["disabled", "label"])
|
|
3091
|
+
])
|
|
3092
|
+
]),
|
|
3093
|
+
createVNode(_sfc_main$1, {
|
|
3094
|
+
data: unref(data),
|
|
3095
|
+
class: "xs:hidden"
|
|
3096
|
+
}, null, 8, ["data"])
|
|
3097
|
+
])
|
|
3098
|
+
])) : createCommentVNode("", !0)
|
|
3099
|
+
]),
|
|
3100
|
+
key: "0"
|
|
3101
|
+
}
|
|
3102
|
+
]), 1032, ["modelValue"]);
|
|
3103
|
+
};
|
|
3104
|
+
}
|
|
3105
|
+
});
|
|
3106
|
+
export {
|
|
3107
|
+
_sfc_main as _,
|
|
3108
|
+
summarizeGrabDiscount as s
|
|
3109
|
+
};
|