@feedmepos/mf-connect 0.1.115-dev → 0.1.115-prod
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -66
- package/dist/{App-43mZfFAr.js → App-CvtSY8ZO.js} +618 -652
- package/dist/{Bin-CA7v180Y.js → Bin-B3gS9QVZ.js} +8 -8
- package/dist/{Broadcast-qmdifF2Y.js → Broadcast-DAeb-HaN.js} +21 -22
- package/dist/{CampaignAnalytic-xnrDxqaH.js → CampaignAnalytic-BfTaHVem.js} +7 -7
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-zjk-QdtX.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-zsei4OfG.js} +9 -9
- package/dist/{Card-D8icsk7L.js → Card-JFeVIwFs.js} +24 -25
- package/dist/{Collections--THcD-E_.js → Collections-xcDpEhIm.js} +185 -197
- package/dist/{Credit-JrbtVMBp.js → Credit-C9HJZjDS.js} +20 -21
- package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-DrwKtnE5.js → DateRangeChip.vue_vue_type_script_setup_true_lang-DSqVY91w.js} +1 -1
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-D_jXVE2I.js +3494 -0
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-hVgqWdD0.js → EffectSheet.vue_vue_type_style_index_0_lang-C3J0rCTt.js} +32 -32
- package/dist/{Experience-CFeRqBoj.js → Experience-DszS8gto.js} +31 -32
- package/dist/{FileSaver.min-CCXIBm58.js → FileSaver.min-CFVQKaC-.js} +1 -1
- package/dist/{Game-CPxq6Ex3.js → Game-DhgeN7E2.js} +18 -19
- package/dist/{GiftCardSetup-D0esVZDp.js → GiftCardSetup-CWm6IhrS.js} +75 -75
- package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-CJ1-vL-K.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-BuKADvmK.js} +7 -7
- package/dist/{Goals-DaKI6uXt.js → Goals-DtRVierH.js} +4 -4
- package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-BOnL0GxM.js → ImageInput.vue_vue_type_script_setup_true_lang-DlEFyu6h.js} +1 -1
- package/dist/{Index-2kENoaZm.js → Index-DFRcu_qE.js} +10 -10
- package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-BtWnJKU_.js → LocationPicker.vue_vue_type_script_setup_true_lang-B3Br4Xvi.js} +1 -1
- package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CX_Sspu5.js → LottieAnimation.vue_vue_type_script_setup_true_lang-CjNJj3qj.js} +1 -1
- package/dist/{LoyaltyDashboard-CB93Fz8u.js → LoyaltyDashboard-BWHKDPzk.js} +15 -15
- package/dist/{MainLayout.vue_vue_type_script_setup_true_lang-Du8fw5v_.js → MainLayout-BmpNNAiE.js} +4 -5
- package/dist/Marketing-BKK45Eve.js +236 -0
- package/dist/{remy-icon-BhUGu2NI.js → MarketingMaterialEdit-x3c_N7Gs.js} +1031 -2
- package/dist/{Member-B--nYyr0.js → Member-xEzrBW_p.js} +7 -7
- package/dist/{MemberDetailSheet.vue_vue_type_script_setup_true_lang-BBlzO7Db.js → MemberDetailSheet.vue_vue_type_script_setup_true_lang-DRoC-I0t.js} +50 -43
- package/dist/{MemberImportHistory-D52Y4RTC.js → MemberImportHistory-CEQpBBF8.js} +7 -7
- package/dist/{MemberList-13Owa1fj.js → MemberList-CCvzkHv8.js} +105 -103
- package/dist/{MemberTransactions-CpXEWNbq.js → MemberTransactions-Bmh39J2W.js} +1 -1
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-DlELjFM0.js → MessageInput.vue_vue_type_script_setup_true_lang-D3Pmk80l.js} +14 -14
- package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-C_y0rM8c.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-DIBKAwHP.js} +1 -1
- package/dist/{Mission-Ci-UzXSu.js → Mission-CpUo2Bgw.js} +21 -22
- package/dist/{Overview-CKxSfAGF.js → Overview-CwQqQ1Tn.js} +144 -145
- package/dist/{Overview-CXen9Ram.js → Overview-DcDZmDXA.js} +22 -23
- package/dist/{Point-CR3YOaag.js → Point-CUNQsQIx.js} +21 -22
- package/dist/{Promotion-tw3J4ul-.js → Promotion-Cqdim7aW.js} +131 -137
- package/dist/{Queue-BZGA5ZXt.js → Queue-CNBVh1UG.js} +45 -46
- package/dist/{Record-BTevVXnT.js → Record-BYwz4l4o.js} +9 -9
- package/dist/{Review-BU7c8ZF0.js → Review-CqLcZFj8.js} +2 -2
- package/dist/ReviewFacebookCallback-DbSCILNN.js +238 -0
- package/dist/{ReviewGoogleCallback-xpdPHSdg.js → ReviewGoogleCallback-Dg8R7QlO.js} +5 -5
- package/dist/{Reward-jlA_7cxz.js → Reward-M8GZ8eHq.js} +29 -29
- package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-D3z_n42G.js → RewardGroup.vue_vue_type_script_setup_true_lang-BkM9-Sx-.js} +15 -16
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CnaL93TF.js +1883 -0
- package/dist/{Segment-C1Bwm--Q.js → Segment-CrMi6xrp.js} +305 -304
- package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-B6apgWTM.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-DKH5_9db.js} +30 -31
- package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-B7m2F9UV.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-CyeAQ-hg.js} +4 -4
- package/dist/Setting-BnFRI0Se.js +2037 -0
- package/dist/{SettingAdvertisements-4XEAJzlL.js → SettingAdvertisements-Dh7v4c1D.js} +12 -12
- package/dist/Settings-BvT8_tkQ.js +179 -0
- package/dist/{Store-C56dXtc4.js → Store-CV-BmK5b.js} +30 -31
- package/dist/{StoreRewards-DQ1Q6WS6.js → StoreRewards-DPhSLvSZ.js} +15 -15
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CDu1QySl.js +1264 -0
- package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-Dqz6jTlH.js +142 -0
- package/dist/{Tier-D4CPZqw7.js → Tier-ChvYps23.js} +687 -2576
- package/dist/{Title-DCbwhUic.js → Title-v-Ivswr1.js} +92 -94
- package/dist/{Transaction-C5LrasXr.js → Transaction-CRqE1Ix0.js} +2 -2
- package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-Cl9b4mrK.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-B0Uh9iuj.js} +26 -26
- package/dist/{Voucher-rrVbNZKR.js → Voucher-Bg8FOuzD.js} +19 -19
- package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-BIq227nz.js → VoucherEditor.vue_vue_type_script_setup_true_lang-HKxivQMF.js} +16 -16
- package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-C39_95SZ.js → ZodTextField.vue_vue_type_script_setup_true_lang-8d290Dcp.js} +2 -2
- package/dist/{app-CgimGODl.js → app-DdNKsn2Q.js} +7107 -8874
- package/dist/app.js +3 -4
- package/dist/{base.export-D2P6HFvo.js → base.export-R97FrSQL.js} +2 -2
- package/dist/{business-Bu5TqSA0.js → business-Ce8vq3wQ.js} +1 -1
- package/dist/{campaign-zJxttSIk.js → campaign-BTllt2LH.js} +25 -31
- package/dist/{campaign-BFIXSgdJ.js → campaign-C19If7bW.js} +94 -121
- package/dist/{campaign.enum-Dx-Zo68Q.js → campaign.enum-9CCbalR4.js} +2 -3
- package/dist/{campaign.fn-gvjlcEfe.js → campaign.fn-B4g03h0A.js} +78 -78
- package/dist/{collectible.enum-Liy2wH3s.js → collectible.enum-MvqF7mSg.js} +1 -1
- package/dist/{collection.fn-DOm0HsSh.js → collection.fn-CR0bD33S.js} +2 -2
- package/dist/{currency-BpbQvbm8.js → currency-DmlguGIM.js} +1 -1
- package/dist/{effect-D-GtNB3n.js → effect-Dx3zfl28.js} +1 -1
- package/dist/{email-addresses-BKMoAtMi.js → email-addresses-De5PGOY4.js} +2 -2
- package/dist/{feature-flag-BJ_eyKsq.js → feature-flag-CD9V1V0h.js} +74 -74
- package/dist/google-C3S8u0mT.js +4 -0
- package/dist/{helper-CkfjBgMM.js → helper-CEiv7SaO.js} +1 -1
- package/dist/{index-zTvr2GR4.js → index-649OZ_e1.js} +2 -2
- package/dist/{index-feCrYhi6.js → index-B8meeQoD.js} +1 -1
- package/dist/{index-CIej31pF.js → index-B8yWVB8P.js} +3 -4
- package/dist/{index-BKsxIwbi.js → index-BAXKd9Gg.js} +198 -198
- package/dist/{index-BAtUrtqM.js → index-BDPnyro2.js} +6 -19
- package/dist/{index-DUAZOMVJ.js → index-BR9h5DTI.js} +1 -1
- package/dist/{index-DwU3fsLW.js → index-BVdYxi3l.js} +15 -29
- package/dist/{index-D0JK99Ko.js → index-BW6eb3n6.js} +252 -611
- package/dist/{index-LygS9WsG.js → index-BYI9ttxy.js} +10767 -8028
- package/dist/{index-BdEXUNoG.js → index-BquSqx6K.js} +4 -4
- package/dist/{index-BpTIulTX.js → index-CBJy9bxB.js} +1 -1
- package/dist/{index-B6kU3PkV.js → index-CPODug8b.js} +2613 -2700
- package/dist/{index-CfQuYqXn.js → index-CWUrODxL.js} +1 -1
- package/dist/{index-DKxN1mMS.js → index-CqOCJTeR.js} +232 -390
- package/dist/{index-CuREApMc.js → index-D4d3l0gw.js} +7 -8
- package/dist/{index-Bhl5IRXy.js → index-DT3S00_Y.js} +10 -11
- package/dist/{index-DqGs6RJG.js → index-IZRfmmde.js} +581 -683
- package/dist/{index-CQ8XFbBk.js → index-__UT3_Ey.js} +2 -2
- package/dist/{index-CCEXSPxk.js → index-xct3mnu8.js} +7 -7
- package/dist/{index.esm2017-DZi9IQPS.js → index.esm2017-AVbZ9btd.js} +177 -177
- package/dist/{loading-Brid2wnu.js → loading-BvHm1m3K.js} +1 -1
- package/dist/{lodash-C1epw3Kv.js → lodash-Dvrceo7x.js} +1 -1
- package/dist/{member-import-DAIxTIiu.js → member-import-c9avpiSS.js} +5 -6
- package/dist/{membership-BZmljFhF.js → membership-D-pZS634.js} +3 -3
- package/dist/{money-cLcyGcSZ.js → money-D4skwMkD.js} +1 -1
- package/dist/{number-C2jPLJr2.js → number-DJ6ncfT6.js} +1 -1
- package/dist/objectid-DEMM_jdR.js +145 -0
- package/dist/{onboarding-oRfy_g05.js → onboarding-t7R1d3h-.js} +25 -25
- package/dist/{onboardingSetup-BLD6m8HY.js → onboardingSetup-lTaJc0oT.js} +2 -2
- package/dist/{plugins-CUsr9vB0.js → plugins-DQNOWwRC.js} +3 -3
- package/dist/{reward-UOT03odb.js → reward-BK150pjm.js} +1 -1
- package/dist/{rule-BgJnPjkI.js → rule-COcdAnUu.js} +492 -572
- package/dist/rule-builder-Deufb6h_.js +102 -0
- package/dist/style.css +1 -1
- package/dist/template-DeebIqJ_.js +236 -0
- package/dist/{timezone-BXA4wq7Y.js → timezone-BP6UC4KL.js} +1 -1
- package/dist/{transaction.fn-CQ4fpRt3.js → transaction.fn-BY0hzon0.js} +2 -2
- package/dist/{trigger-DXJCGT0q.js → trigger-DVBjVPbN.js} +8 -8
- package/dist/useMarketingMaterialActions-DpQCQHFI.js +96 -0
- package/dist/{usePagination-Pp4okWr8.js → usePagination-QT552XyF.js} +1 -1
- package/dist/{user-B3gXcAIy.js → user-CmAxNc7T.js} +1 -1
- package/dist/vue-i18n-Cze706-f.js +2365 -0
- package/dist/{xlsx-CCaDUTgW.js → xlsx-DAczoc8y.js} +224 -224
- package/dist/{zod-CPwjOxvW.js → zod-Aj-GuVQL.js} +1 -1
- package/package.json +2 -6
- package/dist/AuditLogs-BPpdm96t.js +0 -2016
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DgdAlHU7.js +0 -4442
- package/dist/Grab-BWzdN_cd.js +0 -301
- package/dist/MainLayout-DwnjGXh6.js +0 -4
- package/dist/Marketing-DCco__2F.js +0 -273
- package/dist/MarketingMaterialEdit-BbgFtrYP.js +0 -1037
- package/dist/ReviewFacebookCallback-BnMF6Arh.js +0 -225
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CsHxqH9h.js +0 -1923
- package/dist/Setting-CDM4RhLW.js +0 -574
- package/dist/Settings-D-0tvZRr.js +0 -286
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-LLD91Rz6.js +0 -1319
- package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-Bvy4NJMd.js +0 -7007
- package/dist/WhatsappAccount-oJDo5zTr.js +0 -159
- package/dist/WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-aCQCYFYq.js +0 -39
- package/dist/WhatsappBot-Cl64wG_F.js +0 -876
- package/dist/WhatsappBotLogs-D3uT4EiB.js +0 -372
- package/dist/WhatsappBotSettings-Cs1lLxh-.js +0 -705
- package/dist/WhatsappLayout-C639d2HP.js +0 -21
- package/dist/WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-DpPxWp2x.js +0 -253
- package/dist/browser-BSAOEeIM.js +0 -1478
- package/dist/duplicateCampaign-CvsvjRE9.js +0 -51
- package/dist/feature-flag-Bo-k5sIG.js +0 -50
- package/dist/google-BQK68wbe.js +0 -5
- package/dist/index-C-iwb2Ln.js +0 -109
- package/dist/index-C_H8jFYf.js +0 -2743
- package/dist/index-DQ8JJhxs.js +0 -74
- package/dist/objectid-C-wocWKI.js +0 -145
- package/dist/template-BZyFhr73.js +0 -188
- package/dist/useMarketingMaterialActions-B-Wib5ga.js +0 -125
- package/dist/vue-i18n-DWGiC_vs.js +0 -2365
|
@@ -1,4442 +0,0 @@
|
|
|
1
|
-
import { defineComponent, ref, watch, resolveComponent, openBlock, createElementBlock, createElementVNode, createVNode, unref, createCommentVNode, computed, onMounted, toDisplayString, createBlock, withCtx, Fragment, renderList, withModifiers, isRef, createTextVNode, normalizeClass, watchEffect, resolveDynamicComponent, toRefs, normalizeStyle, onBeforeUnmount, createSlots } from "vue";
|
|
2
|
-
import { _ } from "./lodash-C1epw3Kv.js";
|
|
3
|
-
import { h as axios, c as core, S as SvcConfig } from "./index-CCEXSPxk.js";
|
|
4
|
-
import { z, S as S6, f as Zh } from "./app-CgimGODl.js";
|
|
5
|
-
import { Z as ZodHelper } from "./zod-CPwjOxvW.js";
|
|
6
|
-
import { z as z$1 } from "./index-C_H8jFYf.js";
|
|
7
|
-
import { e as FdoGroup, F as F_RUNNABLE_CAMPAIGN_TYPE, f as FdtoRunnableCampaign, g as FdoCreditLoyaltyReward, h as FdtoRandomReward, i as F_MISSION_TYPE, j as FdoThresholdCreditReward, k as FdtoThresholdReward, l as FdoMission } from "./index-DKxN1mMS.js";
|
|
8
|
-
import { F as FdoObjectId } from "./index-LygS9WsG.js";
|
|
9
|
-
import { F as FdtoCollectibleConfig } from "./index-B6kU3PkV.js";
|
|
10
|
-
import { a as isRuleGroup, R as RuleBuilder, s as stripRruleDtstartExceptSchedule, i as isRuleEntry, T as TEMPLATES } from "./index-D0JK99Ko.js";
|
|
11
|
-
import { A as APP_INBOX_BODY_LIMIT, g as FdoBroadcastUrl, h as F_PUSH_DESTINATION, t as toDelivery, i as toLegacyMessage } from "./index-BKsxIwbi.js";
|
|
12
|
-
import { e as CHANNEL_DISPLAY_ORDER, i as isPaidChannel, f as isChannelComplete, h as setMode, j as addChannel, k as hasDraft, l as setPrimaryChannel, r as removeChannel, m as moveChannel, n as setChannelContent, o as getCampaignSummaryObject, p as normaliseBroadcastDelivery } from "./campaign-BFIXSgdJ.js";
|
|
13
|
-
import { u as useMembershipStore } from "./membership-BZmljFhF.js";
|
|
14
|
-
import { u as useBusinessStore } from "./business-Bu5TqSA0.js";
|
|
15
|
-
import { J as JsonViewer } from "./JsonViewer-v8_C7l5N.js";
|
|
16
|
-
import { h as hooks } from "./moment-D7p2TMB-.js";
|
|
17
|
-
import { f as featureVersionMapping } from "./campaign.enum-Dx-Zo68Q.js";
|
|
18
|
-
import { _ as _sfc_main$C } from "./ImageInput.vue_vue_type_script_setup_true_lang-BOnL0GxM.js";
|
|
19
|
-
import { _ as _sfc_main$A, a as _sfc_main$D, b as _sfc_main$F } from "./EffectSheet.vue_vue_type_style_index_0_lang-hVgqWdD0.js";
|
|
20
|
-
import { _ as _sfc_main$E } from "./TargetLocationInput.vue_vue_type_script_setup_true_lang-Bvy4NJMd.js";
|
|
21
|
-
import { p as prompt, f as firebaseStorage } from "./plugins-CUsr9vB0.js";
|
|
22
|
-
import { _ as _export_sfc } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
23
|
-
import { _ as _sfc_main$G } from "./UserRuleGroup.vue_vue_type_script_setup_true_lang-Cl9b4mrK.js";
|
|
24
|
-
import { a as _sfc_main$u, _ as _sfc_main$y } from "./RuleGroup.vue_vue_type_script_setup_true_lang-CsHxqH9h.js";
|
|
25
|
-
import { u as useI18n } from "./vue-i18n-DWGiC_vs.js";
|
|
26
|
-
import { T as TypeToTriggerOptions, _ as _sfc_main$H, b as _sfc_main$I } from "./trigger-DXJCGT0q.js";
|
|
27
|
-
import { D as DEFAULT_MESSAGE_VARIABLES, a as _sfc_main$v, g as getSmsMessageMetrics, _ as _sfc_main$w, b as _sfc_main$x } from "./MessageInput.vue_vue_type_script_setup_true_lang-DlELjFM0.js";
|
|
28
|
-
import { useDialog } from "@feedmepos/ui-library";
|
|
29
|
-
import { useCoreStore } from "@feedmepos/mf-common";
|
|
30
|
-
import { c as campaignApi } from "./index-zTvr2GR4.js";
|
|
31
|
-
import { m as membershipApi } from "./index-BAtUrtqM.js";
|
|
32
|
-
import { u as useChannelFlag } from "./feature-flag-BJ_eyKsq.js";
|
|
33
|
-
import { m as moment } from "./index-DUAZOMVJ.js";
|
|
34
|
-
import { c as calculateNextScheduleAt, R as RRule, S as SummarizeRrule, g as getRruleAnchorDate } from "./rule-BgJnPjkI.js";
|
|
35
|
-
import { C as CountryTimezone } from "./timezone-BXA4wq7Y.js";
|
|
36
|
-
import { _ as _sfc_main$z, a as _sfc_main$B } from "./VoucherEditor.vue_vue_type_script_setup_true_lang-BIq227nz.js";
|
|
37
|
-
import "./index-DqGs6RJG.js";
|
|
38
|
-
import "./index-CuREApMc.js";
|
|
39
|
-
import "./index-C-iwb2Ln.js";
|
|
40
|
-
import "./index-CIej31pF.js";
|
|
41
|
-
import { a as F_GAME_TYPE } from "./collectible.enum-Liy2wH3s.js";
|
|
42
|
-
import { u as useLoading } from "./loading-Brid2wnu.js";
|
|
43
|
-
import { i as initCollectibleConfig } from "./helper-CkfjBgMM.js";
|
|
44
|
-
import { C as CollectionUtils } from "./collection.fn-DOm0HsSh.js";
|
|
45
|
-
import { s as sentenceCase$1 } from "./index-CuvNtC_M.js";
|
|
46
|
-
import { u as useCampaignStore } from "./campaign-zJxttSIk.js";
|
|
47
|
-
import { a as cleanPF } from "./object-BYyQ0PZp.js";
|
|
48
|
-
const publicClient = axios.create({ withCredentials: !1, timeout: 5e3 });
|
|
49
|
-
async function getNativeApp(e) {
|
|
50
|
-
z.string().length(24).parse(e);
|
|
51
|
-
const o = await publicClient.get(
|
|
52
|
-
`https://api.feedmedev.vip/metadata/${encodeURIComponent(e)}/native-app`
|
|
53
|
-
);
|
|
54
|
-
return z.object({
|
|
55
|
-
businessId: z.literal(e),
|
|
56
|
-
native: z.boolean(),
|
|
57
|
-
platforms: z.array(z.string())
|
|
58
|
-
}).parse(o.data).native;
|
|
59
|
-
}
|
|
60
|
-
function campaignRefinement(e, r) {
|
|
61
|
-
var i, u;
|
|
62
|
-
if (console.log(e, r), !e) return;
|
|
63
|
-
const o = e.campaign;
|
|
64
|
-
if (!o) return;
|
|
65
|
-
const m = o.event.rule;
|
|
66
|
-
if (!m || !isRuleGroup(m)) {
|
|
67
|
-
r.addIssue({
|
|
68
|
-
code: "custom",
|
|
69
|
-
path: ["campaign", "event", "rule"],
|
|
70
|
-
params: {
|
|
71
|
-
i18n: "connectZodCustom:campaign.rule_required",
|
|
72
|
-
type: o.event.type
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
switch (o.type) {
|
|
78
|
-
case "MISSION": {
|
|
79
|
-
o.earningOption.amount > o.mission.end && r.addIssue({
|
|
80
|
-
code: "custom",
|
|
81
|
-
path: ["campaign", "earningOption"],
|
|
82
|
-
params: {
|
|
83
|
-
i18n: "connectZodCustom:campaign.earning_amount_exceed",
|
|
84
|
-
max: o.mission.end
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
case "CREDIT": {
|
|
90
|
-
const l = (i = o.config) == null ? void 0 : i.validityOption;
|
|
91
|
-
(!l || ["validForDay", "validBefore"].every((a) => l[a] == null)) && r.addIssue({
|
|
92
|
-
code: "custom",
|
|
93
|
-
path: ["campaign", "config", "validityOption"],
|
|
94
|
-
params: {
|
|
95
|
-
i18n: "connectZodCustom:campaign.credit_validity_required"
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
switch (o.event.type) {
|
|
101
|
-
case "BILL_COMPLETED":
|
|
102
|
-
o.type === "MISSION" && o.rewards.length && (o.rewards.forEach((l, n) => {
|
|
103
|
-
(l.threshold < 0 || l.threshold > o.mission.end) && r.addIssue({
|
|
104
|
-
code: "custom",
|
|
105
|
-
path: ["campaign", "rewards", n, "threshold"],
|
|
106
|
-
params: {
|
|
107
|
-
i18n: "connectZodCustom:campaign.reward_threshold_range"
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
}), (u = o.config) != null && u.validityOption.followFirstReceive || r.addIssue({
|
|
111
|
-
code: "custom",
|
|
112
|
-
path: ["campaign", "config", "validityOption"],
|
|
113
|
-
params: {
|
|
114
|
-
i18n: "connectZodCustom:campaign.mission_first_receive"
|
|
115
|
-
}
|
|
116
|
-
}));
|
|
117
|
-
break;
|
|
118
|
-
case "SCHEDULE": {
|
|
119
|
-
if (!m.rules.g_schedule) {
|
|
120
|
-
r.addIssue({
|
|
121
|
-
code: "custom",
|
|
122
|
-
path: ["campaign", "event", "rule"],
|
|
123
|
-
params: {
|
|
124
|
-
i18n: "connectZodCustom:campaign.schedule_period_required"
|
|
125
|
-
},
|
|
126
|
-
fatal: !0
|
|
127
|
-
});
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
const l = RuleBuilder.getRules(
|
|
131
|
-
m.rules.g_schedule
|
|
132
|
-
), n = [
|
|
133
|
-
{
|
|
134
|
-
property: "trigger.date",
|
|
135
|
-
operator: ["_isOnDate", "_rrule"]
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
property: "trigger.time",
|
|
139
|
-
operator: ["_isOnTime"]
|
|
140
|
-
}
|
|
141
|
-
];
|
|
142
|
-
n.length == l.length && n.every((s) => l.some((v) => {
|
|
143
|
-
const f = RuleBuilder.simplify(v);
|
|
144
|
-
return f.property === s.property && s.operator.includes(f.operator);
|
|
145
|
-
})) || r.addIssue({
|
|
146
|
-
code: "custom",
|
|
147
|
-
path: ["campaign", "event", "rule"],
|
|
148
|
-
params: {
|
|
149
|
-
i18n: "connectZodCustom:campaign.active_period_invalid"
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
default: {
|
|
155
|
-
"earningOption" in o && o.earningOption.type != "FIXED" && r.addIssue({
|
|
156
|
-
code: "custom",
|
|
157
|
-
path: ["campaign", "earningOption"],
|
|
158
|
-
params: {
|
|
159
|
-
i18n: "connectZodCustom:campaign.fixed_earning_required"
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
break;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
function campaignTransform(e) {
|
|
167
|
-
var o;
|
|
168
|
-
if (e.campaign.type === "VOUCHER" && "configs" in e) {
|
|
169
|
-
const m = e.configs;
|
|
170
|
-
m.extras.targetLocation = e.campaign.targetLocation;
|
|
171
|
-
const i = Math.max(
|
|
172
|
-
e.campaign.earningOption.amount,
|
|
173
|
-
m.options.maxUse ?? 1
|
|
174
|
-
);
|
|
175
|
-
e.campaign.earningOption.amount = i, m.options.maxUse = i, e.campaign.earningOption = {
|
|
176
|
-
type: "FIXED",
|
|
177
|
-
amount: 1
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
if (e.campaign.type == "MISSION" && "configs" in e) {
|
|
181
|
-
const m = e.configs;
|
|
182
|
-
m.options.validityOption = (o = e.campaign.config) == null ? void 0 : o.validityOption;
|
|
183
|
-
}
|
|
184
|
-
const r = e.campaign.event;
|
|
185
|
-
return r.type != "BILL_COMPLETED" && r.rule && isRuleGroup(r.rule) && (r.rule = RuleBuilder.removeEntry(r.rule, "g_bill"), e.campaign.event = r), r.rule && isRuleGroup(r.rule) && (r.rule = stripRruleDtstartExceptSchedule(r.rule), e.campaign.event = r), e;
|
|
186
|
-
}
|
|
187
|
-
function GenerateCampaignReq(e) {
|
|
188
|
-
const r = FdtoRunnableCampaign.optionsMap.get(e).extend({
|
|
189
|
-
_id: FdoObjectId.optional(),
|
|
190
|
-
collectible: z$1.string().nullish()
|
|
191
|
-
});
|
|
192
|
-
switch (e) {
|
|
193
|
-
case "VOUCHER":
|
|
194
|
-
return z$1.object({
|
|
195
|
-
campaign: r,
|
|
196
|
-
templateId: FdoObjectId,
|
|
197
|
-
configs: FdtoCollectibleConfig,
|
|
198
|
-
updateCollections: z$1.boolean().optional(),
|
|
199
|
-
code: z$1.string().optional()
|
|
200
|
-
});
|
|
201
|
-
case "PROMOTION":
|
|
202
|
-
return z$1.object({
|
|
203
|
-
campaign: r,
|
|
204
|
-
templateId: FdoObjectId
|
|
205
|
-
});
|
|
206
|
-
case "POINT":
|
|
207
|
-
return z$1.object({
|
|
208
|
-
campaign: r,
|
|
209
|
-
templateId: FdoObjectId
|
|
210
|
-
});
|
|
211
|
-
case "CREDIT":
|
|
212
|
-
return z$1.object({
|
|
213
|
-
campaign: r,
|
|
214
|
-
templateId: FdoObjectId
|
|
215
|
-
});
|
|
216
|
-
case "BROADCAST":
|
|
217
|
-
return z$1.object({
|
|
218
|
-
campaign: r.refine((o) => !!o.delivery || !!o.message, {
|
|
219
|
-
path: ["delivery"],
|
|
220
|
-
message: "A broadcast requires a message or delivery configuration."
|
|
221
|
-
}),
|
|
222
|
-
templateId: FdoObjectId
|
|
223
|
-
});
|
|
224
|
-
case "COIN":
|
|
225
|
-
return z$1.object({
|
|
226
|
-
campaign: r,
|
|
227
|
-
templateId: FdoObjectId
|
|
228
|
-
});
|
|
229
|
-
case "REWARD_POOL":
|
|
230
|
-
return z$1.object({
|
|
231
|
-
campaign: r,
|
|
232
|
-
templateId: FdoObjectId,
|
|
233
|
-
updateCollections: z$1.boolean().optional()
|
|
234
|
-
});
|
|
235
|
-
case "GAME":
|
|
236
|
-
return z$1.object({
|
|
237
|
-
campaign: r,
|
|
238
|
-
configs: FdtoCollectibleConfig,
|
|
239
|
-
templateId: FdoObjectId,
|
|
240
|
-
updateCollections: z$1.boolean().optional()
|
|
241
|
-
});
|
|
242
|
-
case "MISSION":
|
|
243
|
-
return z$1.object({
|
|
244
|
-
campaign: r,
|
|
245
|
-
configs: FdtoCollectibleConfig,
|
|
246
|
-
templateId: FdoObjectId,
|
|
247
|
-
updateCollections: z$1.boolean().optional()
|
|
248
|
-
});
|
|
249
|
-
case "GRAB":
|
|
250
|
-
return z$1.object({
|
|
251
|
-
campaign: r,
|
|
252
|
-
templateId: FdoObjectId
|
|
253
|
-
});
|
|
254
|
-
default:
|
|
255
|
-
throw new Error("Not implemented");
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
FdoGroup.extend({
|
|
259
|
-
_id: FdoObjectId.optional(),
|
|
260
|
-
name: z$1.string().min(1).max(300),
|
|
261
|
-
business: FdoObjectId.optional(),
|
|
262
|
-
campaigns: z$1.array(FdoObjectId).optional()
|
|
263
|
-
});
|
|
264
|
-
const CampaignDtos = {
|
|
265
|
-
[F_RUNNABLE_CAMPAIGN_TYPE.enum.VOUCHER]: GenerateCampaignReq("VOUCHER"),
|
|
266
|
-
[F_RUNNABLE_CAMPAIGN_TYPE.enum.PROMOTION]: GenerateCampaignReq("PROMOTION"),
|
|
267
|
-
[F_RUNNABLE_CAMPAIGN_TYPE.enum.POINT]: GenerateCampaignReq("POINT"),
|
|
268
|
-
[F_RUNNABLE_CAMPAIGN_TYPE.enum.CREDIT]: GenerateCampaignReq("CREDIT"),
|
|
269
|
-
[F_RUNNABLE_CAMPAIGN_TYPE.enum.BROADCAST]: GenerateCampaignReq("BROADCAST"),
|
|
270
|
-
[F_RUNNABLE_CAMPAIGN_TYPE.enum.COIN]: GenerateCampaignReq("COIN"),
|
|
271
|
-
[F_RUNNABLE_CAMPAIGN_TYPE.enum.REWARD_POOL]: GenerateCampaignReq("REWARD_POOL"),
|
|
272
|
-
[F_RUNNABLE_CAMPAIGN_TYPE.enum.GAME]: GenerateCampaignReq("GAME"),
|
|
273
|
-
[F_RUNNABLE_CAMPAIGN_TYPE.enum.MISSION]: GenerateCampaignReq("MISSION"),
|
|
274
|
-
[F_RUNNABLE_CAMPAIGN_TYPE.enum.GRAB]: GenerateCampaignReq("GRAB")
|
|
275
|
-
};
|
|
276
|
-
function summarizeGrabDiscount(e) {
|
|
277
|
-
if (!e)
|
|
278
|
-
return null;
|
|
279
|
-
const r = core.Config.getCountry().currency.symbol;
|
|
280
|
-
function o(l) {
|
|
281
|
-
switch (l.scope.type) {
|
|
282
|
-
case "order":
|
|
283
|
-
return "Bill discount";
|
|
284
|
-
case "items":
|
|
285
|
-
return l.type.startsWith("bundle") ? m(l.type) : "Item discount";
|
|
286
|
-
case "categories":
|
|
287
|
-
return "Category discount";
|
|
288
|
-
default:
|
|
289
|
-
return "Discount";
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
function m(l) {
|
|
293
|
-
switch (l) {
|
|
294
|
-
case "bundleSameFixPrice":
|
|
295
|
-
return "Bundle (same item) - Fixed price";
|
|
296
|
-
case "bundleDiffFixPrice":
|
|
297
|
-
return "Bundle (different items) - Fixed price";
|
|
298
|
-
case "bundleSameNet":
|
|
299
|
-
return "Bundle (same item) - Amount off";
|
|
300
|
-
case "bundleDiffNet":
|
|
301
|
-
return "Bundle (different items) - Amount off";
|
|
302
|
-
case "bundleSamePercentage":
|
|
303
|
-
return "Bundle (same item) - Percentage off";
|
|
304
|
-
case "bundleDiffPercentage":
|
|
305
|
-
return "Bundle (different items) - Percentage off";
|
|
306
|
-
default:
|
|
307
|
-
return "Bundle discount";
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
function i(l) {
|
|
311
|
-
switch (l.type) {
|
|
312
|
-
case "percentage":
|
|
313
|
-
case "bundleSamePercentage":
|
|
314
|
-
case "bundleDiffPercentage":
|
|
315
|
-
return `${l.value}% discount`;
|
|
316
|
-
case "net":
|
|
317
|
-
case "bundleSameNet":
|
|
318
|
-
case "bundleDiffNet":
|
|
319
|
-
return `${r}${l.value} discount`;
|
|
320
|
-
case "bundleSameFixPrice":
|
|
321
|
-
case "bundleDiffFixPrice":
|
|
322
|
-
return `${r}${l.value} fixed price`;
|
|
323
|
-
case "delivery":
|
|
324
|
-
return "Delivery fee discount";
|
|
325
|
-
case "freeItem":
|
|
326
|
-
return "Free item";
|
|
327
|
-
default:
|
|
328
|
-
return `${r}${l.value} discount`;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
function u(l) {
|
|
332
|
-
return l.cap && l.cap > 0 ? `capped at ${r}${l.cap}` : null;
|
|
333
|
-
}
|
|
334
|
-
return {
|
|
335
|
-
type: o(e),
|
|
336
|
-
adjustment: i(e),
|
|
337
|
-
cap: u(e)
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
const _hoisted_1$r = {
|
|
341
|
-
key: 0,
|
|
342
|
-
class: "bg-fm-color-neutral-gray-50 border border-fm-color-neutral-gray-200 rounded-8 p-16 space-y-16"
|
|
343
|
-
}, _hoisted_2$n = { class: "flex items-center justify-between" }, _hoisted_3$k = { class: "flex items-center gap-8" }, _hoisted_4$j = { class: "bg-white border border-fm-color-neutral-gray-200 rounded-8 p-16" }, _hoisted_5$g = { class: "flex justify-end gap-8 pt-8 border-t border-fm-color-neutral-gray-200" }, _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
344
|
-
__name: "GrabItemSelectionInline",
|
|
345
|
-
props: {
|
|
346
|
-
visible: { type: Boolean },
|
|
347
|
-
initialValue: {},
|
|
348
|
-
filterItems: { type: Function }
|
|
349
|
-
},
|
|
350
|
-
emits: ["confirm", "cancel"],
|
|
351
|
-
setup(e, { emit: r }) {
|
|
352
|
-
const o = e, m = r, i = ref();
|
|
353
|
-
watch(
|
|
354
|
-
() => o.visible,
|
|
355
|
-
(a) => {
|
|
356
|
-
var s, v;
|
|
357
|
-
!a && i.value && ((v = (s = i.value).setSelectedItems) == null || v.call(s, o.initialValue || []));
|
|
358
|
-
}
|
|
359
|
-
);
|
|
360
|
-
function u() {
|
|
361
|
-
var a;
|
|
362
|
-
(a = i.value) == null || a.onConfirm();
|
|
363
|
-
}
|
|
364
|
-
function l() {
|
|
365
|
-
m("cancel");
|
|
366
|
-
}
|
|
367
|
-
function n(a) {
|
|
368
|
-
m("confirm", a);
|
|
369
|
-
}
|
|
370
|
-
return (a, s) => {
|
|
371
|
-
const v = resolveComponent("FmIcon"), f = resolveComponent("FmButton");
|
|
372
|
-
return e.visible ? (openBlock(), createElementBlock("div", _hoisted_1$r, [
|
|
373
|
-
createElementVNode("div", _hoisted_2$n, [
|
|
374
|
-
createElementVNode("div", _hoisted_3$k, [
|
|
375
|
-
createVNode(v, {
|
|
376
|
-
name: "restaurant",
|
|
377
|
-
size: "md"
|
|
378
|
-
}),
|
|
379
|
-
s[0] || (s[0] = createElementVNode("h3", { class: "fm-typo-en-body-lg-600" }, "Select Items", -1))
|
|
380
|
-
]),
|
|
381
|
-
createVNode(f, {
|
|
382
|
-
icon: "close",
|
|
383
|
-
variant: "tertiary",
|
|
384
|
-
onClick: l
|
|
385
|
-
})
|
|
386
|
-
]),
|
|
387
|
-
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)),
|
|
388
|
-
createElementVNode("div", _hoisted_4$j, [
|
|
389
|
-
createVNode(unref(S6), {
|
|
390
|
-
ref_key: "selectItemRef",
|
|
391
|
-
ref: i,
|
|
392
|
-
"initial-value": e.initialValue,
|
|
393
|
-
"filter-items": e.filterItems,
|
|
394
|
-
"on-complete": n,
|
|
395
|
-
"max-height": 300
|
|
396
|
-
}, null, 8, ["initial-value", "filter-items"])
|
|
397
|
-
]),
|
|
398
|
-
createElementVNode("div", _hoisted_5$g, [
|
|
399
|
-
createVNode(f, {
|
|
400
|
-
variant: "secondary",
|
|
401
|
-
label: "Cancel",
|
|
402
|
-
onClick: l
|
|
403
|
-
}),
|
|
404
|
-
createVNode(f, {
|
|
405
|
-
variant: "primary",
|
|
406
|
-
label: "Confirm Selection",
|
|
407
|
-
onClick: u
|
|
408
|
-
})
|
|
409
|
-
])
|
|
410
|
-
])) : createCommentVNode("", !0);
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
|
-
}), _hoisted_1$q = {
|
|
414
|
-
key: 0,
|
|
415
|
-
class: "bg-fm-color-neutral-gray-50 border border-fm-color-neutral-gray-200 rounded-8 p-16 space-y-16"
|
|
416
|
-
}, _hoisted_2$m = { class: "flex items-center justify-between" }, _hoisted_3$j = { class: "flex items-center gap-8" }, _hoisted_4$i = { class: "flex gap-16 items-center flex-wrap" }, _hoisted_5$f = { class: "flex gap-8 items-center" }, _hoisted_6$b = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, _hoisted_7$a = { class: "bg-white border border-fm-color-neutral-gray-200 rounded-8 max-h-[300px] overflow-y-auto" }, _hoisted_8$9 = { class: "flex items-center gap-12" }, _hoisted_9$9 = { class: "fm-typo-en-body-md-600" }, _hoisted_10$8 = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, _hoisted_11$6 = {
|
|
417
|
-
key: 1,
|
|
418
|
-
class: "p-24 text-center"
|
|
419
|
-
}, _hoisted_12$5 = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _hoisted_13$5 = { class: "flex justify-end gap-8 pt-8 border-t border-fm-color-neutral-gray-200" }, _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
420
|
-
__name: "GrabCategorySelectionInline",
|
|
421
|
-
props: {
|
|
422
|
-
visible: { type: Boolean },
|
|
423
|
-
initialValue: {}
|
|
424
|
-
},
|
|
425
|
-
emits: ["confirm", "cancel"],
|
|
426
|
-
setup(e, { emit: r }) {
|
|
427
|
-
const o = e, m = r, i = Zh(), u = ref({}), l = ref(""), n = computed(() => {
|
|
428
|
-
const d = i.menu.value;
|
|
429
|
-
return d ? d.modules.category.map((p) => ({
|
|
430
|
-
id: p._id,
|
|
431
|
-
name: p.name
|
|
432
|
-
})) : [];
|
|
433
|
-
}), a = computed(() => {
|
|
434
|
-
if (!l.value) return n.value;
|
|
435
|
-
const d = l.value.toLowerCase();
|
|
436
|
-
return n.value.filter(
|
|
437
|
-
(p) => p.name.toLowerCase().includes(d)
|
|
438
|
-
);
|
|
439
|
-
}), s = computed(() => Object.values(u.value).filter(Boolean).length);
|
|
440
|
-
function v() {
|
|
441
|
-
u.value = n.value.reduce(
|
|
442
|
-
(d, p) => (d[p.id] = o.initialValue.includes(p.id), d),
|
|
443
|
-
{}
|
|
444
|
-
);
|
|
445
|
-
}
|
|
446
|
-
watch([() => o.visible, () => o.initialValue], () => {
|
|
447
|
-
o.visible && v();
|
|
448
|
-
}), onMounted(async () => {
|
|
449
|
-
await i.store.getMenu(), v();
|
|
450
|
-
});
|
|
451
|
-
function f(d) {
|
|
452
|
-
u.value[d] = !u.value[d];
|
|
453
|
-
}
|
|
454
|
-
function c() {
|
|
455
|
-
const d = s.value === a.value.length;
|
|
456
|
-
a.value.forEach((p) => {
|
|
457
|
-
u.value[p.id] = !d;
|
|
458
|
-
});
|
|
459
|
-
}
|
|
460
|
-
function k() {
|
|
461
|
-
Object.keys(u.value).forEach((d) => {
|
|
462
|
-
u.value[d] = !1;
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
|
-
function x() {
|
|
466
|
-
const d = Object.entries(u.value).filter(([, p]) => p).map(([p]) => p);
|
|
467
|
-
m("confirm", d);
|
|
468
|
-
}
|
|
469
|
-
function h() {
|
|
470
|
-
m("cancel");
|
|
471
|
-
}
|
|
472
|
-
const g = computed(() => a.value.length > 0 && a.value.every(
|
|
473
|
-
(d) => u.value[d.id]
|
|
474
|
-
));
|
|
475
|
-
return (d, p) => {
|
|
476
|
-
const C = resolveComponent("FmIcon"), V = resolveComponent("FmButton"), N = resolveComponent("FmTextField"), R = resolveComponent("FmCheckbox"), E = resolveComponent("FmListItem"), D = resolveComponent("FmList");
|
|
477
|
-
return e.visible ? (openBlock(), createElementBlock("div", _hoisted_1$q, [
|
|
478
|
-
createElementVNode("div", _hoisted_2$m, [
|
|
479
|
-
createElementVNode("div", _hoisted_3$j, [
|
|
480
|
-
createVNode(C, {
|
|
481
|
-
name: "category",
|
|
482
|
-
size: "md"
|
|
483
|
-
}),
|
|
484
|
-
p[2] || (p[2] = createElementVNode("h3", { class: "fm-typo-en-body-lg-600" }, "Select Categories", -1))
|
|
485
|
-
]),
|
|
486
|
-
createVNode(V, {
|
|
487
|
-
icon: "close",
|
|
488
|
-
variant: "tertiary",
|
|
489
|
-
onClick: h
|
|
490
|
-
})
|
|
491
|
-
]),
|
|
492
|
-
p[3] || (p[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)),
|
|
493
|
-
createElementVNode("div", _hoisted_4$i, [
|
|
494
|
-
createElementVNode("div", _hoisted_5$f, [
|
|
495
|
-
createVNode(V, {
|
|
496
|
-
icon: "select_all",
|
|
497
|
-
variant: "tertiary",
|
|
498
|
-
size: "small",
|
|
499
|
-
label: `${g.value ? "Deselect" : "Select"} All`,
|
|
500
|
-
onClick: c
|
|
501
|
-
}, null, 8, ["label"]),
|
|
502
|
-
createVNode(V, {
|
|
503
|
-
icon: "sync",
|
|
504
|
-
variant: "tertiary",
|
|
505
|
-
size: "small",
|
|
506
|
-
label: "Clear",
|
|
507
|
-
onClick: k
|
|
508
|
-
}),
|
|
509
|
-
createElementVNode("span", _hoisted_6$b, toDisplayString(s.value) + " selected ", 1)
|
|
510
|
-
]),
|
|
511
|
-
createVNode(N, {
|
|
512
|
-
modelValue: l.value,
|
|
513
|
-
"onUpdate:modelValue": p[0] || (p[0] = (w) => l.value = w),
|
|
514
|
-
placeholder: "Search categories",
|
|
515
|
-
"leading-icon": { name: "search", color: "" },
|
|
516
|
-
class: "flex-1 min-w-[200px]"
|
|
517
|
-
}, null, 8, ["modelValue"])
|
|
518
|
-
]),
|
|
519
|
-
createElementVNode("div", _hoisted_7$a, [
|
|
520
|
-
a.value.length > 0 ? (openBlock(), createBlock(D, { key: 0 }, {
|
|
521
|
-
default: withCtx(() => [
|
|
522
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(a.value, (w) => (openBlock(), createBlock(E, {
|
|
523
|
-
key: w.id,
|
|
524
|
-
clickable: !0,
|
|
525
|
-
onClick: (A) => f(w.id)
|
|
526
|
-
}, {
|
|
527
|
-
leading: withCtx(() => [
|
|
528
|
-
createVNode(R, {
|
|
529
|
-
"model-value": u.value[w.id] || !1,
|
|
530
|
-
value: w.id,
|
|
531
|
-
"onUpdate:modelValue": (A) => f(w.id),
|
|
532
|
-
onClick: p[1] || (p[1] = withModifiers(() => {
|
|
533
|
-
}, ["stop"]))
|
|
534
|
-
}, null, 8, ["model-value", "value", "onUpdate:modelValue"])
|
|
535
|
-
]),
|
|
536
|
-
default: withCtx(() => [
|
|
537
|
-
createElementVNode("div", _hoisted_8$9, [
|
|
538
|
-
createVNode(C, {
|
|
539
|
-
name: "category",
|
|
540
|
-
size: "sm",
|
|
541
|
-
class: "text-fm-color-typo-secondary"
|
|
542
|
-
}),
|
|
543
|
-
createElementVNode("div", null, [
|
|
544
|
-
createElementVNode("div", _hoisted_9$9, toDisplayString(w.name), 1),
|
|
545
|
-
createElementVNode("div", _hoisted_10$8, " ID: " + toDisplayString(w.id), 1)
|
|
546
|
-
])
|
|
547
|
-
])
|
|
548
|
-
]),
|
|
549
|
-
_: 2
|
|
550
|
-
}, 1032, ["onClick"]))), 128))
|
|
551
|
-
]),
|
|
552
|
-
_: 1
|
|
553
|
-
})) : (openBlock(), createElementBlock("div", _hoisted_11$6, [
|
|
554
|
-
createElementVNode("div", _hoisted_12$5, toDisplayString(l.value ? "No categories found matching your search." : "No categories available."), 1)
|
|
555
|
-
]))
|
|
556
|
-
]),
|
|
557
|
-
createElementVNode("div", _hoisted_13$5, [
|
|
558
|
-
createVNode(V, {
|
|
559
|
-
variant: "secondary",
|
|
560
|
-
label: "Cancel",
|
|
561
|
-
onClick: h
|
|
562
|
-
}),
|
|
563
|
-
createVNode(V, {
|
|
564
|
-
variant: "primary",
|
|
565
|
-
label: `Confirm Selection (${s.value})`,
|
|
566
|
-
disabled: s.value === 0,
|
|
567
|
-
onClick: x
|
|
568
|
-
}, null, 8, ["label", "disabled"])
|
|
569
|
-
])
|
|
570
|
-
])) : createCommentVNode("", !0);
|
|
571
|
-
};
|
|
572
|
-
}
|
|
573
|
-
}), _hoisted_1$p = { class: "space-y-8" }, _hoisted_2$l = {
|
|
574
|
-
key: 1,
|
|
575
|
-
class: "border-1 rounded-md flex gap-16 items-center justify-between px-16 py-12"
|
|
576
|
-
}, _hoisted_3$i = { class: "fm-typo-en-body-lg-400" }, _hoisted_4$h = { class: "text-fm-color-typo-secondary" }, _hoisted_5$e = { key: 0 }, _hoisted_6$a = { class: "space-y-24" }, _hoisted_7$9 = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary mt-4" }, _hoisted_8$8 = { key: 0 }, _hoisted_9$8 = { class: "fm-typo-en-body-md-600 mb-8 block" }, _hoisted_10$7 = { key: 1 }, _hoisted_11$5 = { key: 2 }, _hoisted_12$4 = { key: 0 }, _hoisted_13$4 = { class: "space-y-8" }, _hoisted_14$4 = { class: "flex items-center justify-between p-12 border border-fm-color-neutral-gray-200 fm-corner-radius-md" }, _hoisted_15$3 = { class: "flex items-center gap-8" }, _hoisted_16$2 = { class: "fm-typo-en-body-md-400" }, _hoisted_17$2 = { key: 3 }, _hoisted_18$2 = { key: 0 }, _hoisted_19$2 = { class: "space-y-8" }, _hoisted_20$2 = { class: "flex items-center justify-between p-12 border border-fm-color-neutral-gray-200 fm-corner-radius-md" }, _hoisted_21$1 = { class: "flex items-center gap-8" }, _hoisted_22$1 = { class: "fm-typo-en-body-md-400" }, _hoisted_23$1 = {
|
|
577
|
-
key: 0,
|
|
578
|
-
class: "mt-16 p-12 bg-fm-color-feedback-error-light rounded-8 border border-fm-color-feedback-error-main"
|
|
579
|
-
}, _hoisted_24$1 = { class: "flex items-center gap-8 mb-8 text-fm-color-system-error-300" }, _hoisted_25$1 = { class: "space-y-4" }, _hoisted_26$1 = { class: "flex gap-16" }, _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
580
|
-
__name: "GrabEffectSheet",
|
|
581
|
-
props: {
|
|
582
|
-
modelValue: { type: Object }
|
|
583
|
-
},
|
|
584
|
-
emits: ["update:model-value"],
|
|
585
|
-
setup(e, { emit: r }) {
|
|
586
|
-
const o = e, m = r, i = Zh(), u = ref(!1), l = ref(!1), n = ref(!1), a = ref({
|
|
587
|
-
type: "net",
|
|
588
|
-
value: 0,
|
|
589
|
-
scope: {
|
|
590
|
-
type: "order"
|
|
591
|
-
}
|
|
592
|
-
});
|
|
593
|
-
watch(
|
|
594
|
-
() => o.modelValue,
|
|
595
|
-
(b) => {
|
|
596
|
-
b && (a.value = { ...b });
|
|
597
|
-
},
|
|
598
|
-
{ immediate: !0 }
|
|
599
|
-
), onMounted(async () => {
|
|
600
|
-
await i.store.getMenu();
|
|
601
|
-
});
|
|
602
|
-
const s = computed(() => {
|
|
603
|
-
var b;
|
|
604
|
-
return !(!a.value.type || !((b = a.value.scope) != null && b.type) || c(a.value.type) && (!a.value.value || a.value.value <= 0) || (a.value.scope.type === "items" || a.value.scope.type === "category") && (!a.value.scope.objectIDs || a.value.scope.objectIDs.length === 0));
|
|
605
|
-
});
|
|
606
|
-
async function v(b) {
|
|
607
|
-
b.stopPropagation(), await prompt.remove("Are you sure you want to remove this discount?") && m("update:model-value", null);
|
|
608
|
-
}
|
|
609
|
-
function f() {
|
|
610
|
-
var b;
|
|
611
|
-
return C(((b = a.value.scope) == null ? void 0 : b.type) || "order");
|
|
612
|
-
}
|
|
613
|
-
function c(b) {
|
|
614
|
-
return b && !["freeItem", "delivery"].includes(b);
|
|
615
|
-
}
|
|
616
|
-
function k(b) {
|
|
617
|
-
return b && ["percentage", "bundleSamePercentage", "bundleDiffPercentage"].includes(
|
|
618
|
-
b
|
|
619
|
-
);
|
|
620
|
-
}
|
|
621
|
-
function x(b) {
|
|
622
|
-
return b != null && b.includes("Percentage") ? "Discount percentage" : b != null && b.includes("FixPrice") ? "Bundle fixed price" : b === "percentage" ? "Discount percentage" : "Discount amount";
|
|
623
|
-
}
|
|
624
|
-
function h(b) {
|
|
625
|
-
return b != null && b.includes("Percentage") || b === "percentage" ? "10" : "5.00";
|
|
626
|
-
}
|
|
627
|
-
function g(b) {
|
|
628
|
-
return b != null && b.includes("Percentage") || b === "percentage" ? "%" : "$";
|
|
629
|
-
}
|
|
630
|
-
function d(b, B) {
|
|
631
|
-
a.value = {
|
|
632
|
-
...a.value,
|
|
633
|
-
[b]: B
|
|
634
|
-
};
|
|
635
|
-
}
|
|
636
|
-
function p(b, B) {
|
|
637
|
-
var O;
|
|
638
|
-
const T = {
|
|
639
|
-
...a.value.scope,
|
|
640
|
-
[b]: B
|
|
641
|
-
};
|
|
642
|
-
if (a.value = {
|
|
643
|
-
...a.value,
|
|
644
|
-
scope: T
|
|
645
|
-
}, b === "type") {
|
|
646
|
-
const P = C(B);
|
|
647
|
-
P.some(
|
|
648
|
-
(j) => j.value === a.value.type
|
|
649
|
-
) || (a.value = {
|
|
650
|
-
...a.value,
|
|
651
|
-
type: ((O = P[0]) == null ? void 0 : O.value) || "net",
|
|
652
|
-
// Reset value and cap when changing to incompatible type
|
|
653
|
-
value: 0,
|
|
654
|
-
cap: void 0
|
|
655
|
-
});
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
function C(b) {
|
|
659
|
-
switch (b) {
|
|
660
|
-
case "order":
|
|
661
|
-
return [
|
|
662
|
-
{ label: "Amount off", value: "net" },
|
|
663
|
-
{ label: "Percentage off", value: "percentage" },
|
|
664
|
-
{ label: "Delivery fee off", value: "delivery" }
|
|
665
|
-
];
|
|
666
|
-
case "category":
|
|
667
|
-
return [
|
|
668
|
-
{ label: "Amount off", value: "net" },
|
|
669
|
-
{ label: "Percentage off", value: "percentage" }
|
|
670
|
-
];
|
|
671
|
-
case "items":
|
|
672
|
-
return [
|
|
673
|
-
{ label: "Amount off", value: "net" },
|
|
674
|
-
{ label: "Percentage off", value: "percentage" },
|
|
675
|
-
{ label: "Free item", value: "freeItem" },
|
|
676
|
-
{
|
|
677
|
-
label: "Bundle (same item) - Fixed price",
|
|
678
|
-
value: "bundleSameFixPrice"
|
|
679
|
-
},
|
|
680
|
-
{ label: "Bundle (same item) - Amount off", value: "bundleSameNet" },
|
|
681
|
-
{
|
|
682
|
-
label: "Bundle (same item) - Percentage off",
|
|
683
|
-
value: "bundleSamePercentage"
|
|
684
|
-
},
|
|
685
|
-
{
|
|
686
|
-
label: "Bundle (different items) - Fixed price",
|
|
687
|
-
value: "bundleDiffFixPrice"
|
|
688
|
-
},
|
|
689
|
-
{
|
|
690
|
-
label: "Bundle (different items) - Amount off",
|
|
691
|
-
value: "bundleDiffNet"
|
|
692
|
-
},
|
|
693
|
-
{
|
|
694
|
-
label: "Bundle (different items) - Percentage off",
|
|
695
|
-
value: "bundleDiffPercentage"
|
|
696
|
-
}
|
|
697
|
-
];
|
|
698
|
-
default:
|
|
699
|
-
return [
|
|
700
|
-
{ label: "Amount off", value: "net" },
|
|
701
|
-
{ label: "Percentage off", value: "percentage" }
|
|
702
|
-
];
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
function V(b) {
|
|
706
|
-
switch (b) {
|
|
707
|
-
case "order":
|
|
708
|
-
return "Applies to entire order. Available: Amount off, Percentage off, Delivery fee discount.";
|
|
709
|
-
case "category":
|
|
710
|
-
return "Applies to specific item categories. Available: Amount off, Percentage off, Free item.";
|
|
711
|
-
case "items":
|
|
712
|
-
return "Applies to specific items. Available: Basic discounts, Bundle offers (same/different items).";
|
|
713
|
-
default:
|
|
714
|
-
return "Select how you want to apply the discount.";
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
function N() {
|
|
718
|
-
var b;
|
|
719
|
-
return ((b = a.value.scope) == null ? void 0 : b.type) === "items";
|
|
720
|
-
}
|
|
721
|
-
function R() {
|
|
722
|
-
var b;
|
|
723
|
-
return ((b = a.value.scope) == null ? void 0 : b.type) === "category";
|
|
724
|
-
}
|
|
725
|
-
function E() {
|
|
726
|
-
var T;
|
|
727
|
-
const b = (T = a.value.scope) == null ? void 0 : T.objectIDs;
|
|
728
|
-
if (!b || b.length === 0)
|
|
729
|
-
return "No items selected";
|
|
730
|
-
const B = i.menu.value;
|
|
731
|
-
return B && b.length <= 3 ? b.map((P) => {
|
|
732
|
-
const U = B.modules.item.find((j) => j._id === P);
|
|
733
|
-
return U ? (U.name2 || U.name).trim() : `Item ${P}`;
|
|
734
|
-
}).join(", ") : b.length === 1 ? "1 item selected" : `${b.length} items selected`;
|
|
735
|
-
}
|
|
736
|
-
function D() {
|
|
737
|
-
var T;
|
|
738
|
-
const b = (T = a.value.scope) == null ? void 0 : T.objectIDs;
|
|
739
|
-
if (!b || b.length === 0)
|
|
740
|
-
return "No categories selected";
|
|
741
|
-
const B = i.menu.value;
|
|
742
|
-
return B && b.length <= 3 ? b.map((P) => {
|
|
743
|
-
const U = B.modules.category.find((j) => j._id === P);
|
|
744
|
-
return U ? U.name : `Category ${P}`;
|
|
745
|
-
}).join(", ") : b.length === 1 ? "1 category selected" : `${b.length} categories selected`;
|
|
746
|
-
}
|
|
747
|
-
function w() {
|
|
748
|
-
l.value = !0;
|
|
749
|
-
}
|
|
750
|
-
function A() {
|
|
751
|
-
n.value = !0;
|
|
752
|
-
}
|
|
753
|
-
function H(b) {
|
|
754
|
-
p("objectIDs", b), l.value = !1;
|
|
755
|
-
}
|
|
756
|
-
function I(b) {
|
|
757
|
-
p("objectIDs", b), n.value = !1;
|
|
758
|
-
}
|
|
759
|
-
function X() {
|
|
760
|
-
l.value = !1;
|
|
761
|
-
}
|
|
762
|
-
function K() {
|
|
763
|
-
n.value = !1;
|
|
764
|
-
}
|
|
765
|
-
const Z = computed(() => {
|
|
766
|
-
var B, T, O;
|
|
767
|
-
const b = [];
|
|
768
|
-
return a.value.type || b.push("Discount type is required"), (B = a.value.scope) != null && B.type || b.push("Scope type is required"), c(a.value.type) && (!a.value.value || a.value.value <= 0) && b.push("Discount amount must be greater than 0"), ((T = a.value.scope) == null ? void 0 : T.type) === "items" && (!a.value.scope.objectIDs || a.value.scope.objectIDs.length === 0) && b.push("Please select at least one item"), ((O = a.value.scope) == null ? void 0 : O.type) === "category" && (!a.value.scope.objectIDs || a.value.scope.objectIDs.length === 0) && b.push("Please select at least one category"), b;
|
|
769
|
-
});
|
|
770
|
-
function J() {
|
|
771
|
-
m("update:model-value", a.value), u.value = !1;
|
|
772
|
-
}
|
|
773
|
-
const W = [
|
|
774
|
-
{ label: "Bill discount", value: "order" },
|
|
775
|
-
{ label: "Item discount", value: "items" },
|
|
776
|
-
{ label: "Category discount", value: "category" }
|
|
777
|
-
];
|
|
778
|
-
return (b, B) => {
|
|
779
|
-
const T = resolveComponent("FmButton"), O = resolveComponent("FmSelect"), P = resolveComponent("FmStepperField"), U = resolveComponent("FmIcon"), j = resolveComponent("FmSideSheet");
|
|
780
|
-
return openBlock(), createBlock(j, {
|
|
781
|
-
"max-width": 550,
|
|
782
|
-
header: "Apply discount",
|
|
783
|
-
modelValue: unref(u),
|
|
784
|
-
"onUpdate:modelValue": [
|
|
785
|
-
B[5] || (B[5] = (L) => isRef(u) ? u.value = L : null),
|
|
786
|
-
B[6] || (B[6] = (L) => u.value = L)
|
|
787
|
-
]
|
|
788
|
-
}, {
|
|
789
|
-
"side-sheet-button": withCtx(() => {
|
|
790
|
-
var L, G, Y, q;
|
|
791
|
-
return [
|
|
792
|
-
createElementVNode("div", _hoisted_1$p, [
|
|
793
|
-
B[7] || (B[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)),
|
|
794
|
-
e.modelValue ? (openBlock(), createElementBlock("div", _hoisted_2$l, [
|
|
795
|
-
createElementVNode("div", _hoisted_3$i, [
|
|
796
|
-
createElementVNode("div", null, toDisplayString((L = unref(summarizeGrabDiscount)(e.modelValue)) == null ? void 0 : L.type), 1),
|
|
797
|
-
createElementVNode("div", _hoisted_4$h, [
|
|
798
|
-
createTextVNode(toDisplayString((G = unref(summarizeGrabDiscount)(e.modelValue)) == null ? void 0 : G.adjustment) + " ", 1),
|
|
799
|
-
(Y = unref(summarizeGrabDiscount)(e.modelValue)) != null && Y.cap ? (openBlock(), createElementBlock("span", _hoisted_5$e, toDisplayString((q = unref(summarizeGrabDiscount)(e.modelValue)) == null ? void 0 : q.cap), 1)) : createCommentVNode("", !0)
|
|
800
|
-
])
|
|
801
|
-
]),
|
|
802
|
-
createVNode(T, {
|
|
803
|
-
icon: "delete",
|
|
804
|
-
"icon-color": "neutral-gray-400",
|
|
805
|
-
variant: "tertiary",
|
|
806
|
-
onClick: v
|
|
807
|
-
})
|
|
808
|
-
])) : (openBlock(), createBlock(T, {
|
|
809
|
-
key: 0,
|
|
810
|
-
label: "Apply Grab discount",
|
|
811
|
-
icon: "add",
|
|
812
|
-
"icon-color": "primary",
|
|
813
|
-
variant: "secondary",
|
|
814
|
-
class: "border-fm-color-primary text-fm-color-primary"
|
|
815
|
-
}))
|
|
816
|
-
])
|
|
817
|
-
];
|
|
818
|
-
}),
|
|
819
|
-
"side-sheet-footer": withCtx(() => [
|
|
820
|
-
createElementVNode("div", _hoisted_26$1, [
|
|
821
|
-
createVNode(T, {
|
|
822
|
-
variant: "secondary",
|
|
823
|
-
label: "Cancel",
|
|
824
|
-
class: "flex-1",
|
|
825
|
-
onClick: B[4] || (B[4] = (L) => u.value = !1)
|
|
826
|
-
}),
|
|
827
|
-
createVNode(T, {
|
|
828
|
-
variant: "primary",
|
|
829
|
-
label: unref(s) ? "Confirm" : "Complete Required Fields",
|
|
830
|
-
class: "flex-1",
|
|
831
|
-
disabled: !unref(s),
|
|
832
|
-
onClick: J
|
|
833
|
-
}, null, 8, ["label", "disabled"])
|
|
834
|
-
])
|
|
835
|
-
]),
|
|
836
|
-
default: withCtx(() => {
|
|
837
|
-
var L, G, Y, q;
|
|
838
|
-
return [
|
|
839
|
-
createElementVNode("div", _hoisted_6$a, [
|
|
840
|
-
createElementVNode("div", null, [
|
|
841
|
-
B[8] || (B[8] = createElementVNode("label", { class: "fm-typo-en-body-md-600 mb-8 block" }, "Campaign type", -1)),
|
|
842
|
-
createVNode(O, {
|
|
843
|
-
"model-value": ((L = unref(a).scope) == null ? void 0 : L.type) || "order",
|
|
844
|
-
"onUpdate:modelValue": B[0] || (B[0] = (y) => p("type", y)),
|
|
845
|
-
placeholder: "Select campaign type",
|
|
846
|
-
items: W
|
|
847
|
-
}, null, 8, ["model-value"]),
|
|
848
|
-
createElementVNode("div", _hoisted_7$9, toDisplayString(V((G = unref(a).scope) == null ? void 0 : G.type)), 1)
|
|
849
|
-
]),
|
|
850
|
-
createElementVNode("div", null, [
|
|
851
|
-
B[9] || (B[9] = createElementVNode("label", { class: "fm-typo-en-body-md-600 mb-8 block" }, "Discount type", -1)),
|
|
852
|
-
createVNode(O, {
|
|
853
|
-
"model-value": unref(a).type,
|
|
854
|
-
"onUpdate:modelValue": B[1] || (B[1] = (y) => d("type", y)),
|
|
855
|
-
placeholder: "Select discount type",
|
|
856
|
-
items: f()
|
|
857
|
-
}, null, 8, ["model-value", "items"])
|
|
858
|
-
]),
|
|
859
|
-
c(unref(a).type) ? (openBlock(), createElementBlock("div", _hoisted_8$8, [
|
|
860
|
-
createElementVNode("label", _hoisted_9$8, toDisplayString(x(unref(a).type)), 1),
|
|
861
|
-
createVNode(P, {
|
|
862
|
-
modelValue: unref(a).value,
|
|
863
|
-
"onUpdate:modelValue": B[2] || (B[2] = (y) => unref(a).value = y),
|
|
864
|
-
placeholder: h(unref(a).type),
|
|
865
|
-
suffix: g(unref(a).type),
|
|
866
|
-
type: "number"
|
|
867
|
-
}, null, 8, ["modelValue", "placeholder", "suffix"])
|
|
868
|
-
])) : createCommentVNode("", !0),
|
|
869
|
-
k(unref(a).type) ? (openBlock(), createElementBlock("div", _hoisted_10$7, [
|
|
870
|
-
B[10] || (B[10] = createElementVNode("label", { class: "fm-typo-en-body-md-600 mb-8 block" }, "Discount cap (optional)", -1)),
|
|
871
|
-
createVNode(P, {
|
|
872
|
-
modelValue: unref(a).cap,
|
|
873
|
-
"onUpdate:modelValue": B[3] || (B[3] = (y) => unref(a).cap = y),
|
|
874
|
-
placeholder: "Maximum discount amount",
|
|
875
|
-
type: "number"
|
|
876
|
-
}, null, 8, ["modelValue"])
|
|
877
|
-
])) : createCommentVNode("", !0),
|
|
878
|
-
N() ? (openBlock(), createElementBlock("div", _hoisted_11$5, [
|
|
879
|
-
unref(l) ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_12$4, [
|
|
880
|
-
B[12] || (B[12] = createElementVNode("label", { class: "fm-typo-en-body-md-600 mb-8 block" }, "Select Items", -1)),
|
|
881
|
-
createElementVNode("div", _hoisted_13$4, [
|
|
882
|
-
createElementVNode("div", _hoisted_14$4, [
|
|
883
|
-
createElementVNode("div", _hoisted_15$3, [
|
|
884
|
-
createVNode(U, {
|
|
885
|
-
name: "restaurant",
|
|
886
|
-
size: "md"
|
|
887
|
-
}),
|
|
888
|
-
createElementVNode("span", _hoisted_16$2, toDisplayString(E()), 1)
|
|
889
|
-
]),
|
|
890
|
-
createVNode(T, {
|
|
891
|
-
variant: "secondary",
|
|
892
|
-
label: "Select Items",
|
|
893
|
-
icon: "chevron_right",
|
|
894
|
-
onClick: w
|
|
895
|
-
})
|
|
896
|
-
]),
|
|
897
|
-
B[11] || (B[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))
|
|
898
|
-
])
|
|
899
|
-
])),
|
|
900
|
-
createVNode(_sfc_main$t, {
|
|
901
|
-
visible: unref(l),
|
|
902
|
-
"initial-value": ((Y = unref(a).scope) == null ? void 0 : Y.objectIDs) || [],
|
|
903
|
-
onConfirm: H,
|
|
904
|
-
onCancel: X
|
|
905
|
-
}, null, 8, ["visible", "initial-value"])
|
|
906
|
-
])) : createCommentVNode("", !0),
|
|
907
|
-
R() ? (openBlock(), createElementBlock("div", _hoisted_17$2, [
|
|
908
|
-
unref(n) ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_18$2, [
|
|
909
|
-
B[14] || (B[14] = createElementVNode("label", { class: "fm-typo-en-body-md-600 mb-8 block" }, "Select Categories", -1)),
|
|
910
|
-
createElementVNode("div", _hoisted_19$2, [
|
|
911
|
-
createElementVNode("div", _hoisted_20$2, [
|
|
912
|
-
createElementVNode("div", _hoisted_21$1, [
|
|
913
|
-
createVNode(U, {
|
|
914
|
-
name: "category",
|
|
915
|
-
size: "md"
|
|
916
|
-
}),
|
|
917
|
-
createElementVNode("span", _hoisted_22$1, toDisplayString(D()), 1)
|
|
918
|
-
]),
|
|
919
|
-
createVNode(T, {
|
|
920
|
-
variant: "secondary",
|
|
921
|
-
label: "Select Categories",
|
|
922
|
-
icon: "chevron_right",
|
|
923
|
-
onClick: A
|
|
924
|
-
})
|
|
925
|
-
]),
|
|
926
|
-
B[13] || (B[13] = createElementVNode("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Choose which categories this discount applies to. ", -1))
|
|
927
|
-
])
|
|
928
|
-
])),
|
|
929
|
-
createVNode(_sfc_main$s, {
|
|
930
|
-
visible: unref(n),
|
|
931
|
-
"initial-value": ((q = unref(a).scope) == null ? void 0 : q.objectIDs) || [],
|
|
932
|
-
onConfirm: I,
|
|
933
|
-
onCancel: K
|
|
934
|
-
}, null, 8, ["visible", "initial-value"])
|
|
935
|
-
])) : createCommentVNode("", !0)
|
|
936
|
-
]),
|
|
937
|
-
unref(Z).length > 0 ? (openBlock(), createElementBlock("div", _hoisted_23$1, [
|
|
938
|
-
createElementVNode("div", _hoisted_24$1, [
|
|
939
|
-
createVNode(U, { name: "warning" }),
|
|
940
|
-
B[15] || (B[15] = createElementVNode("span", { class: "fm-typo-en-body-sm-600" }, "Please fix the following issues:", -1))
|
|
941
|
-
]),
|
|
942
|
-
createElementVNode("ul", _hoisted_25$1, [
|
|
943
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(Z), (y) => (openBlock(), createElementBlock("li", {
|
|
944
|
-
key: y,
|
|
945
|
-
class: "fm-typo-en-body-sm-400 text-fm-color-feedback-error-main flex items-start gap-8"
|
|
946
|
-
}, [
|
|
947
|
-
B[16] || (B[16] = createElementVNode("span", { class: "w-4 h-4 bg-fm-color-feedback-error-main rounded-full mt-6 flex-shrink-0" }, null, -1)),
|
|
948
|
-
createTextVNode(" " + toDisplayString(y), 1)
|
|
949
|
-
]))), 128))
|
|
950
|
-
])
|
|
951
|
-
])) : createCommentVNode("", !0)
|
|
952
|
-
];
|
|
953
|
-
}),
|
|
954
|
-
_: 1
|
|
955
|
-
}, 8, ["modelValue"]);
|
|
956
|
-
};
|
|
957
|
-
}
|
|
958
|
-
}), GrabEffectSheet = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-cf604dd7"]]), _hoisted_1$o = { class: "space-y-24" }, _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
959
|
-
__name: "TimeRuleGroup",
|
|
960
|
-
props: {
|
|
961
|
-
modelValue: {
|
|
962
|
-
type: Object,
|
|
963
|
-
default: () => {
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
},
|
|
967
|
-
emits: ["update:model-value"],
|
|
968
|
-
setup(e, { emit: r }) {
|
|
969
|
-
const { t: o } = useI18n(), m = e, i = r, u = ref(
|
|
970
|
-
!m.modelValue || !m.modelValue.rules.g_time ? "all_time" : RuleBuilder.getRules(m.modelValue.rules.g_time).length > 0 ? "custom" : "all_time"
|
|
971
|
-
);
|
|
972
|
-
watch(u, async (n, a) => {
|
|
973
|
-
var s;
|
|
974
|
-
if (a == "custom" && n == "all_time" && RuleBuilder.getRules((s = m.modelValue) == null ? void 0 : s.rules.g_time).length > 0) {
|
|
975
|
-
const v = await prompt.confirm(
|
|
976
|
-
o("connect.template.rule.time.confirm_remove"),
|
|
977
|
-
o("connect.common.confirm"),
|
|
978
|
-
o("connect.common.confirm"),
|
|
979
|
-
o("connect.common.cancel")
|
|
980
|
-
);
|
|
981
|
-
v && i(
|
|
982
|
-
"update:model-value",
|
|
983
|
-
RuleBuilder.setRuleToGroup(
|
|
984
|
-
m.modelValue ?? RuleBuilder.scaffoldGroup(),
|
|
985
|
-
RuleBuilder.scaffoldGroup("g_time")
|
|
986
|
-
)
|
|
987
|
-
), u.value = v ? n : a;
|
|
988
|
-
}
|
|
989
|
-
});
|
|
990
|
-
async function l(n) {
|
|
991
|
-
var a;
|
|
992
|
-
if (n == "custom" && RuleBuilder.getRules((a = m.modelValue) == null ? void 0 : a.rules.g_time).length > 0) {
|
|
993
|
-
if (!await prompt.confirm(
|
|
994
|
-
o("connect.template.rule.time.confirm_remove"),
|
|
995
|
-
o("connect.common.confirm"),
|
|
996
|
-
o("connect.common.confirm"),
|
|
997
|
-
o("connect.common.cancel")
|
|
998
|
-
)) {
|
|
999
|
-
u.value = "all_time";
|
|
1000
|
-
return;
|
|
1001
|
-
}
|
|
1002
|
-
i(
|
|
1003
|
-
"update:model-value",
|
|
1004
|
-
RuleBuilder.setRuleToGroup(
|
|
1005
|
-
m.modelValue ?? RuleBuilder.scaffoldGroup(),
|
|
1006
|
-
RuleBuilder.scaffoldGroup("g_time")
|
|
1007
|
-
)
|
|
1008
|
-
);
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
return (n, a) => {
|
|
1012
|
-
var f;
|
|
1013
|
-
const s = resolveComponent("FmRadio"), v = resolveComponent("FmRadioGroup");
|
|
1014
|
-
return openBlock(), createElementBlock("div", _hoisted_1$o, [
|
|
1015
|
-
createVNode(v, {
|
|
1016
|
-
modelValue: unref(u),
|
|
1017
|
-
"onUpdate:modelValue": [
|
|
1018
|
-
a[0] || (a[0] = (c) => isRef(u) ? u.value = c : null),
|
|
1019
|
-
a[1] || (a[1] = (c) => l(c))
|
|
1020
|
-
]
|
|
1021
|
-
}, {
|
|
1022
|
-
default: withCtx(() => [
|
|
1023
|
-
createVNode(s, {
|
|
1024
|
-
label: unref(o)("connect.template.rule.time.all_time"),
|
|
1025
|
-
value: "all_time"
|
|
1026
|
-
}, null, 8, ["label"]),
|
|
1027
|
-
createVNode(s, {
|
|
1028
|
-
label: unref(o)("connect.template.rule.time.custom"),
|
|
1029
|
-
value: "custom"
|
|
1030
|
-
}, null, 8, ["label"])
|
|
1031
|
-
]),
|
|
1032
|
-
_: 1
|
|
1033
|
-
}, 8, ["modelValue"]),
|
|
1034
|
-
unref(u) == "custom" ? (openBlock(), createBlock(_sfc_main$u, {
|
|
1035
|
-
key: 0,
|
|
1036
|
-
class: "!mt-[0px]",
|
|
1037
|
-
"include-only": "trigger",
|
|
1038
|
-
"trigger-type": "SCHEDULE",
|
|
1039
|
-
"model-value": ((f = e.modelValue) == null ? void 0 : f.rules.g_time) ?? unref(RuleBuilder).scaffoldGroup("g_time"),
|
|
1040
|
-
"onUpdate:modelValue": a[2] || (a[2] = (c) => i(
|
|
1041
|
-
"update:model-value",
|
|
1042
|
-
unref(RuleBuilder).setRuleToGroup(
|
|
1043
|
-
e.modelValue ?? unref(RuleBuilder).scaffoldGroup(),
|
|
1044
|
-
c,
|
|
1045
|
-
"&&"
|
|
1046
|
-
)
|
|
1047
|
-
))
|
|
1048
|
-
}, null, 8, ["model-value"])) : createCommentVNode("", !0)
|
|
1049
|
-
]);
|
|
1050
|
-
};
|
|
1051
|
-
}
|
|
1052
|
-
}), _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
1053
|
-
__name: "BirthdayInput",
|
|
1054
|
-
props: {
|
|
1055
|
-
modelValue: {
|
|
1056
|
-
type: Object
|
|
1057
|
-
}
|
|
1058
|
-
},
|
|
1059
|
-
emits: ["update:model-value"],
|
|
1060
|
-
setup(e, { emit: r }) {
|
|
1061
|
-
const { t: o } = useI18n(), m = e, i = r, u = computed(() => {
|
|
1062
|
-
const { property: l, operator: n, equator: a } = RuleBuilder.simplify(
|
|
1063
|
-
m.modelValue ?? RuleBuilder.constructEntry("user.birthday", "_isDay", {
|
|
1064
|
-
op: "before",
|
|
1065
|
-
x: 1
|
|
1066
|
-
})
|
|
1067
|
-
);
|
|
1068
|
-
return {
|
|
1069
|
-
property: l,
|
|
1070
|
-
operator: n,
|
|
1071
|
-
equator: a
|
|
1072
|
-
};
|
|
1073
|
-
});
|
|
1074
|
-
return (l, n) => {
|
|
1075
|
-
const a = resolveComponent("FmRadio"), s = resolveComponent("FmStepperField");
|
|
1076
|
-
return openBlock(), createElementBlock("div", null, [
|
|
1077
|
-
createVNode(a, {
|
|
1078
|
-
label: unref(o)("connect.template.rule.birthday.on_birthday"),
|
|
1079
|
-
value: "_isRange-day",
|
|
1080
|
-
"model-value": `${unref(u).operator}-${unref(u).equator.unit}`,
|
|
1081
|
-
"onUpdate:modelValue": n[0] || (n[0] = () => {
|
|
1082
|
-
i(
|
|
1083
|
-
"update:model-value",
|
|
1084
|
-
unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
|
|
1085
|
-
op: "this",
|
|
1086
|
-
unit: "day",
|
|
1087
|
-
ignoreYear: !0
|
|
1088
|
-
})
|
|
1089
|
-
);
|
|
1090
|
-
})
|
|
1091
|
-
}, null, 8, ["label", "model-value"]),
|
|
1092
|
-
createVNode(a, {
|
|
1093
|
-
label: unref(o)("connect.template.rule.birthday.days_before"),
|
|
1094
|
-
value: "_isDay",
|
|
1095
|
-
"model-value": unref(u).operator,
|
|
1096
|
-
"onUpdate:modelValue": n[1] || (n[1] = () => {
|
|
1097
|
-
i(
|
|
1098
|
-
"update:model-value",
|
|
1099
|
-
unref(RuleBuilder).constructEntry("user.birthday", "_isDay", {
|
|
1100
|
-
op: "after",
|
|
1101
|
-
x: 1,
|
|
1102
|
-
ignoreYear: !0
|
|
1103
|
-
})
|
|
1104
|
-
);
|
|
1105
|
-
})
|
|
1106
|
-
}, null, 8, ["label", "model-value"]),
|
|
1107
|
-
unref(u).operator == "_isDay" ? (openBlock(), createBlock(s, {
|
|
1108
|
-
key: 0,
|
|
1109
|
-
label: unref(o)("connect.template.rule.birthday.days_before_label"),
|
|
1110
|
-
"show-steppers": !1,
|
|
1111
|
-
"model-value": unref(u).equator.x,
|
|
1112
|
-
"onUpdate:modelValue": n[2] || (n[2] = (v) => i(
|
|
1113
|
-
"update:model-value",
|
|
1114
|
-
unref(RuleBuilder).constructEntry("user.birthday", "_isDay", {
|
|
1115
|
-
op: "after",
|
|
1116
|
-
x: v,
|
|
1117
|
-
ignoreYear: !0
|
|
1118
|
-
})
|
|
1119
|
-
))
|
|
1120
|
-
}, null, 8, ["label", "model-value"])) : createCommentVNode("", !0),
|
|
1121
|
-
createVNode(a, {
|
|
1122
|
-
label: unref(o)("connect.template.rule.birthday.in_birthday_week"),
|
|
1123
|
-
value: "_isRange-week",
|
|
1124
|
-
"model-value": `${unref(u).operator}-${unref(u).equator.unit}`,
|
|
1125
|
-
"onUpdate:modelValue": n[3] || (n[3] = () => {
|
|
1126
|
-
i(
|
|
1127
|
-
"update:model-value",
|
|
1128
|
-
unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
|
|
1129
|
-
op: "this",
|
|
1130
|
-
unit: "week",
|
|
1131
|
-
ignoreYear: !0
|
|
1132
|
-
})
|
|
1133
|
-
);
|
|
1134
|
-
})
|
|
1135
|
-
}, null, 8, ["label", "model-value"]),
|
|
1136
|
-
createVNode(a, {
|
|
1137
|
-
label: unref(o)("connect.template.rule.birthday.in_birthday_month"),
|
|
1138
|
-
value: "_isRange-month",
|
|
1139
|
-
"model-value": `${unref(u).operator}-${unref(u).equator.unit}`,
|
|
1140
|
-
"onUpdate:modelValue": n[4] || (n[4] = () => {
|
|
1141
|
-
i(
|
|
1142
|
-
"update:model-value",
|
|
1143
|
-
unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
|
|
1144
|
-
op: "this",
|
|
1145
|
-
unit: "month",
|
|
1146
|
-
ignoreYear: !0
|
|
1147
|
-
})
|
|
1148
|
-
);
|
|
1149
|
-
})
|
|
1150
|
-
}, null, 8, ["label", "model-value"])
|
|
1151
|
-
]);
|
|
1152
|
-
};
|
|
1153
|
-
}
|
|
1154
|
-
}), _hoisted_1$n = { class: "space-y-16" }, _hoisted_2$k = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_3$h = { class: "grid grid-cols-3 gap-16" }, _hoisted_4$g = { class: "fm-typo-en-title-sm-800" }, _hoisted_5$d = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
1155
|
-
__name: "CampaignTriggerInput",
|
|
1156
|
-
props: {
|
|
1157
|
-
campaignType: {
|
|
1158
|
-
type: String,
|
|
1159
|
-
required: !0
|
|
1160
|
-
},
|
|
1161
|
-
modelValue: {
|
|
1162
|
-
type: String
|
|
1163
|
-
},
|
|
1164
|
-
disabled: {
|
|
1165
|
-
type: Boolean,
|
|
1166
|
-
default: !1
|
|
1167
|
-
}
|
|
1168
|
-
},
|
|
1169
|
-
emits: ["update:model-value"],
|
|
1170
|
-
setup(e, { emit: r }) {
|
|
1171
|
-
const { t: o } = useI18n(), m = e, i = r, u = computed(() => m.disabled ? TypeToTriggerOptions[m.campaignType].filter(
|
|
1172
|
-
(l) => l.value == m.modelValue
|
|
1173
|
-
) : TypeToTriggerOptions[m.campaignType]);
|
|
1174
|
-
return (l, n) => {
|
|
1175
|
-
const a = resolveComponent("FmCard");
|
|
1176
|
-
return openBlock(), createElementBlock("div", _hoisted_1$n, [
|
|
1177
|
-
createElementVNode("div", _hoisted_2$k, toDisplayString(unref(o)("connect.campaign.trigger.description")), 1),
|
|
1178
|
-
createElementVNode("div", _hoisted_3$h, [
|
|
1179
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (s) => (openBlock(), createBlock(a, {
|
|
1180
|
-
variant: "outlined",
|
|
1181
|
-
disabled: m.disabled,
|
|
1182
|
-
class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
|
|
1183
|
-
"col-span-3": unref(u).length == 1,
|
|
1184
|
-
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == s.value,
|
|
1185
|
-
"hover:bg-fm-color-opacity-sm": e.modelValue != s.value
|
|
1186
|
-
}]),
|
|
1187
|
-
onClick: () => {
|
|
1188
|
-
m.modelValue != s.value && !m.disabled && i("update:model-value", s.value);
|
|
1189
|
-
},
|
|
1190
|
-
key: s.name
|
|
1191
|
-
}, {
|
|
1192
|
-
default: withCtx(() => [
|
|
1193
|
-
createElementVNode("div", _hoisted_4$g, toDisplayString(s.name), 1),
|
|
1194
|
-
createElementVNode("div", _hoisted_5$d, toDisplayString(s.description), 1)
|
|
1195
|
-
]),
|
|
1196
|
-
_: 2
|
|
1197
|
-
}, 1032, ["disabled", "class", "onClick"]))), 128))
|
|
1198
|
-
])
|
|
1199
|
-
]);
|
|
1200
|
-
};
|
|
1201
|
-
}
|
|
1202
|
-
}), _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
1203
|
-
__name: "DateInput",
|
|
1204
|
-
props: {
|
|
1205
|
-
label: {
|
|
1206
|
-
type: String,
|
|
1207
|
-
required: !1
|
|
1208
|
-
},
|
|
1209
|
-
modelValue: {
|
|
1210
|
-
type: Object,
|
|
1211
|
-
required: !1
|
|
1212
|
-
}
|
|
1213
|
-
},
|
|
1214
|
-
emits: ["update:model-value"],
|
|
1215
|
-
setup(e, { emit: r }) {
|
|
1216
|
-
const o = r;
|
|
1217
|
-
return (m, i) => {
|
|
1218
|
-
const u = resolveComponent("FmButton"), l = resolveComponent("FmField"), n = resolveComponent("FmDatePicker");
|
|
1219
|
-
return openBlock(), createBlock(n, {
|
|
1220
|
-
label: e.label,
|
|
1221
|
-
"model-value": e.modelValue || "",
|
|
1222
|
-
"onUpdate:modelValue": i[1] || (i[1] = (a) => o("update:model-value", a))
|
|
1223
|
-
}, {
|
|
1224
|
-
"trigger-button": withCtx(({ opened: a }) => [
|
|
1225
|
-
createVNode(l, {
|
|
1226
|
-
class: "flex items-center",
|
|
1227
|
-
"prepend-icon": "calendar_month",
|
|
1228
|
-
"icon-outlined": !a
|
|
1229
|
-
}, {
|
|
1230
|
-
append: withCtx(() => [
|
|
1231
|
-
e.modelValue ? (openBlock(), createBlock(u, {
|
|
1232
|
-
key: 0,
|
|
1233
|
-
variant: "tertiary",
|
|
1234
|
-
icon: "clear",
|
|
1235
|
-
onClick: i[0] || (i[0] = (s) => (s.stopPropagation(), o("update:model-value", null)))
|
|
1236
|
-
})) : createCommentVNode("", !0)
|
|
1237
|
-
]),
|
|
1238
|
-
default: withCtx(() => [
|
|
1239
|
-
createElementVNode("div", {
|
|
1240
|
-
class: normalizeClass(["fm-typo-en-body-lg-400", { "text-fm-color-typo-secondary": !e.modelValue }])
|
|
1241
|
-
}, toDisplayString(e.modelValue ? unref(hooks)(e.modelValue).format("DD MMM YYYY") : "DD MM YYYY"), 3)
|
|
1242
|
-
]),
|
|
1243
|
-
_: 1
|
|
1244
|
-
}, 8, ["icon-outlined"])
|
|
1245
|
-
]),
|
|
1246
|
-
_: 1
|
|
1247
|
-
}, 8, ["label", "model-value"]);
|
|
1248
|
-
};
|
|
1249
|
-
}
|
|
1250
|
-
}), _hoisted_1$m = { class: "flex items-center gap-8 w-full xs:flex-col" }, _hoisted_2$j = { class: "flex-1 xs:w-full" }, _hoisted_3$g = { class: "mt-5 xs:hidden" }, _hoisted_4$f = { class: "flex-1 xs:w-full" }, _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
1251
|
-
__name: "DateRangeInput",
|
|
1252
|
-
props: {
|
|
1253
|
-
modelValue: {
|
|
1254
|
-
type: Object,
|
|
1255
|
-
required: !1
|
|
1256
|
-
}
|
|
1257
|
-
},
|
|
1258
|
-
emits: ["update:model-value"],
|
|
1259
|
-
setup(e, { emit: r }) {
|
|
1260
|
-
const { t: o } = useI18n(), m = r;
|
|
1261
|
-
return (i, u) => {
|
|
1262
|
-
var l, n;
|
|
1263
|
-
return openBlock(), createElementBlock("div", _hoisted_1$m, [
|
|
1264
|
-
createElementVNode("div", _hoisted_2$j, [
|
|
1265
|
-
createVNode(_sfc_main$n, {
|
|
1266
|
-
"model-value": ((l = e.modelValue) == null ? void 0 : l.startDate) ?? null,
|
|
1267
|
-
label: unref(o)("connect.common.startDate"),
|
|
1268
|
-
"onUpdate:modelValue": u[0] || (u[0] = (a) => {
|
|
1269
|
-
var s;
|
|
1270
|
-
return m("update:model-value", {
|
|
1271
|
-
startDate: a,
|
|
1272
|
-
endDate: ((s = e.modelValue) == null ? void 0 : s.endDate) ?? null
|
|
1273
|
-
});
|
|
1274
|
-
})
|
|
1275
|
-
}, null, 8, ["model-value", "label"])
|
|
1276
|
-
]),
|
|
1277
|
-
createElementVNode("div", _hoisted_3$g, toDisplayString(unref(o)("connect.common.to")), 1),
|
|
1278
|
-
createElementVNode("div", _hoisted_4$f, [
|
|
1279
|
-
createVNode(_sfc_main$n, {
|
|
1280
|
-
"model-value": ((n = e.modelValue) == null ? void 0 : n.endDate) ?? null,
|
|
1281
|
-
label: unref(o)("connect.common.endDate"),
|
|
1282
|
-
"onUpdate:modelValue": u[1] || (u[1] = (a) => {
|
|
1283
|
-
var s;
|
|
1284
|
-
return m("update:model-value", {
|
|
1285
|
-
startDate: ((s = e.modelValue) == null ? void 0 : s.startDate) ?? null,
|
|
1286
|
-
endDate: a
|
|
1287
|
-
});
|
|
1288
|
-
})
|
|
1289
|
-
}, null, 8, ["model-value", "label"])
|
|
1290
|
-
])
|
|
1291
|
-
]);
|
|
1292
|
-
};
|
|
1293
|
-
}
|
|
1294
|
-
}), _hoisted_1$l = { class: "flex flex-col gap-16" }, _hoisted_2$i = { class: "mb-[6px] flex items-baseline justify-between" }, _hoisted_3$f = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, _hoisted_4$e = { class: "mb-[6px] flex items-baseline justify-between" }, _hoisted_5$c = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, _hoisted_6$9 = { class: "flex items-center justify-between gap-8" }, _hoisted_7$8 = { class: "fm-typo-en-body-lg-400" }, _hoisted_8$7 = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _hoisted_9$7 = { class: "flex flex-col gap-8" }, _hoisted_10$6 = { class: "flex items-baseline justify-between" }, _hoisted_11$4 = { class: "fm-typo-en-body-lg-400" }, _hoisted_12$3 = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, _hoisted_13$3 = { class: "min-w-[160px] flex-1" }, _hoisted_14$3 = { class: "min-w-[180px] flex-1" }, TITLE_LIMIT$1 = 40, PREVIEW_LIMIT = 120, MAX_BUTTONS = 2, TITLE_WARN_AT$1 = 34, PREVIEW_WARN_AT = 110, _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
1295
|
-
__name: "AppInboxInput",
|
|
1296
|
-
props: {
|
|
1297
|
-
modelValue: {
|
|
1298
|
-
type: Object,
|
|
1299
|
-
required: !0
|
|
1300
|
-
},
|
|
1301
|
-
variables: {
|
|
1302
|
-
type: Array,
|
|
1303
|
-
default: () => [...DEFAULT_MESSAGE_VARIABLES]
|
|
1304
|
-
},
|
|
1305
|
-
/** False until the form is submitted; broadcasts validate on submit. */
|
|
1306
|
-
showValidation: {
|
|
1307
|
-
type: Boolean,
|
|
1308
|
-
default: !0
|
|
1309
|
-
}
|
|
1310
|
-
},
|
|
1311
|
-
emits: ["update:model-value"],
|
|
1312
|
-
setup(e, { emit: r }) {
|
|
1313
|
-
const { t: o } = useI18n(), m = e, i = r;
|
|
1314
|
-
function u(k) {
|
|
1315
|
-
i("update:model-value", { ...m.modelValue, ...k });
|
|
1316
|
-
}
|
|
1317
|
-
function l(k, x) {
|
|
1318
|
-
return k >= x ? "text-fm-color-system-warning-400" : "text-fm-color-typo-secondary";
|
|
1319
|
-
}
|
|
1320
|
-
const n = computed(() => m.modelValue.buttons ?? []), a = computed(() => {
|
|
1321
|
-
var k;
|
|
1322
|
-
return ((k = m.modelValue.content) == null ? void 0 : k.length) ?? 0;
|
|
1323
|
-
});
|
|
1324
|
-
function s(k, x) {
|
|
1325
|
-
u({
|
|
1326
|
-
buttons: n.value.map(
|
|
1327
|
-
(h, g) => g === k ? { ...h, ...x } : h
|
|
1328
|
-
)
|
|
1329
|
-
});
|
|
1330
|
-
}
|
|
1331
|
-
function v() {
|
|
1332
|
-
n.value.length >= MAX_BUTTONS || u({ buttons: [...n.value, { label: "", url: "" }] });
|
|
1333
|
-
}
|
|
1334
|
-
function f(k) {
|
|
1335
|
-
var g;
|
|
1336
|
-
if (!m.showValidation) return { label: void 0, url: void 0 };
|
|
1337
|
-
const x = (g = k.url) == null ? void 0 : g.trim();
|
|
1338
|
-
let h;
|
|
1339
|
-
return x ? FdoBroadcastUrl.safeParse(x).success || (h = o("connect.campaign.push.linkUrlInvalid")) : h = o("connect.campaign.appInbox.buttonUrlRequired"), {
|
|
1340
|
-
label: k.label.trim() ? void 0 : o("connect.campaign.appInbox.buttonLabelRequired"),
|
|
1341
|
-
url: h
|
|
1342
|
-
};
|
|
1343
|
-
}
|
|
1344
|
-
function c(k) {
|
|
1345
|
-
u({ buttons: n.value.filter((x, h) => h !== k) });
|
|
1346
|
-
}
|
|
1347
|
-
return (k, x) => {
|
|
1348
|
-
const h = resolveComponent("FmTextField"), g = resolveComponent("FmButton");
|
|
1349
|
-
return openBlock(), createElementBlock("div", _hoisted_1$l, [
|
|
1350
|
-
createElementVNode("div", null, [
|
|
1351
|
-
createElementVNode("div", _hoisted_2$i, [
|
|
1352
|
-
createElementVNode("span", _hoisted_3$f, toDisplayString(unref(o)("connect.campaign.appInbox.title")), 1),
|
|
1353
|
-
createElementVNode("span", {
|
|
1354
|
-
class: normalizeClass(["fm-typo-en-body-sm-400", l(e.modelValue.title.length, TITLE_WARN_AT$1)])
|
|
1355
|
-
}, toDisplayString(e.modelValue.title.length) + " / " + toDisplayString(TITLE_LIMIT$1), 3)
|
|
1356
|
-
]),
|
|
1357
|
-
createVNode(h, {
|
|
1358
|
-
"model-value": e.modelValue.title,
|
|
1359
|
-
"max-length": TITLE_LIMIT$1,
|
|
1360
|
-
placeholder: unref(o)("connect.campaign.appInbox.titlePlaceholder"),
|
|
1361
|
-
"onUpdate:modelValue": x[0] || (x[0] = (d) => u({ title: d }))
|
|
1362
|
-
}, null, 8, ["model-value", "placeholder"])
|
|
1363
|
-
]),
|
|
1364
|
-
createElementVNode("div", null, [
|
|
1365
|
-
createElementVNode("div", _hoisted_4$e, [
|
|
1366
|
-
createElementVNode("span", _hoisted_5$c, toDisplayString(unref(o)("connect.campaign.appInbox.previewText")), 1),
|
|
1367
|
-
createElementVNode("span", {
|
|
1368
|
-
class: normalizeClass(["fm-typo-en-body-sm-400", l(e.modelValue.previewText.length, PREVIEW_WARN_AT)])
|
|
1369
|
-
}, toDisplayString(e.modelValue.previewText.length) + " / " + toDisplayString(PREVIEW_LIMIT), 3)
|
|
1370
|
-
]),
|
|
1371
|
-
createVNode(h, {
|
|
1372
|
-
"model-value": e.modelValue.previewText,
|
|
1373
|
-
"max-length": PREVIEW_LIMIT,
|
|
1374
|
-
placeholder: unref(o)("connect.campaign.appInbox.previewTextPlaceholder"),
|
|
1375
|
-
"onUpdate:modelValue": x[1] || (x[1] = (d) => u({ previewText: d }))
|
|
1376
|
-
}, null, 8, ["model-value", "placeholder"])
|
|
1377
|
-
]),
|
|
1378
|
-
createElementVNode("div", _hoisted_6$9, [
|
|
1379
|
-
createElementVNode("div", null, [
|
|
1380
|
-
createElementVNode("div", _hoisted_7$8, toDisplayString(unref(o)("connect.campaign.appInbox.bodyMessage")), 1),
|
|
1381
|
-
createElementVNode("div", _hoisted_8$7, toDisplayString(unref(o)("connect.campaign.appInbox.bodyMessageDescription")), 1),
|
|
1382
|
-
createElementVNode("div", {
|
|
1383
|
-
class: normalizeClass([
|
|
1384
|
-
"mt-[2px] fm-typo-en-body-sm-400",
|
|
1385
|
-
unref(a) > unref(APP_INBOX_BODY_LIMIT) ? "text-fm-color-system-error-400" : "text-fm-color-typo-secondary"
|
|
1386
|
-
])
|
|
1387
|
-
}, toDisplayString(unref(a)) + " / " + toDisplayString(unref(APP_INBOX_BODY_LIMIT)), 3)
|
|
1388
|
-
]),
|
|
1389
|
-
createVNode(_sfc_main$v, {
|
|
1390
|
-
html: e.modelValue.content,
|
|
1391
|
-
variables: e.variables,
|
|
1392
|
-
"media-limit": 1,
|
|
1393
|
-
"button-label": unref(o)("connect.campaign.appInbox.editBodyMessage"),
|
|
1394
|
-
"onUpdate:html": x[2] || (x[2] = (d) => u({ content: d.html }))
|
|
1395
|
-
}, null, 8, ["html", "variables", "button-label"])
|
|
1396
|
-
]),
|
|
1397
|
-
createElementVNode("div", _hoisted_9$7, [
|
|
1398
|
-
createElementVNode("div", _hoisted_10$6, [
|
|
1399
|
-
createElementVNode("span", _hoisted_11$4, toDisplayString(unref(o)("connect.campaign.appInbox.buttons")), 1),
|
|
1400
|
-
createElementVNode("span", _hoisted_12$3, toDisplayString(unref(n).length) + " / " + toDisplayString(MAX_BUTTONS), 1)
|
|
1401
|
-
]),
|
|
1402
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(n), (d, p) => (openBlock(), createElementBlock("div", {
|
|
1403
|
-
key: p,
|
|
1404
|
-
class: "flex flex-wrap items-start gap-8"
|
|
1405
|
-
}, [
|
|
1406
|
-
createElementVNode("div", _hoisted_13$3, [
|
|
1407
|
-
createVNode(h, {
|
|
1408
|
-
"model-value": d.label,
|
|
1409
|
-
"max-length": 20,
|
|
1410
|
-
placeholder: unref(o)("connect.campaign.appInbox.buttonLabel"),
|
|
1411
|
-
"helper-state": f(d).label ? "error" : "none",
|
|
1412
|
-
"helper-text": f(d).label,
|
|
1413
|
-
"onUpdate:modelValue": (C) => s(p, { label: C })
|
|
1414
|
-
}, null, 8, ["model-value", "placeholder", "helper-state", "helper-text", "onUpdate:modelValue"])
|
|
1415
|
-
]),
|
|
1416
|
-
createElementVNode("div", _hoisted_14$3, [
|
|
1417
|
-
createVNode(h, {
|
|
1418
|
-
"model-value": d.url ?? "",
|
|
1419
|
-
inputmode: "url",
|
|
1420
|
-
placeholder: unref(o)("connect.campaign.push.linkUrlPlaceholder"),
|
|
1421
|
-
"helper-state": f(d).url ? "error" : "none",
|
|
1422
|
-
"helper-text": f(d).url,
|
|
1423
|
-
"onUpdate:modelValue": (C) => s(p, { url: C.trim() })
|
|
1424
|
-
}, null, 8, ["model-value", "placeholder", "helper-state", "helper-text", "onUpdate:modelValue"])
|
|
1425
|
-
]),
|
|
1426
|
-
createVNode(g, {
|
|
1427
|
-
icon: "delete",
|
|
1428
|
-
"icon-color": "neutral-gray-400",
|
|
1429
|
-
variant: "tertiary",
|
|
1430
|
-
onClick: (C) => c(p)
|
|
1431
|
-
}, null, 8, ["onClick"])
|
|
1432
|
-
]))), 128)),
|
|
1433
|
-
unref(n).length < MAX_BUTTONS ? (openBlock(), createBlock(g, {
|
|
1434
|
-
key: 0,
|
|
1435
|
-
variant: "tertiary",
|
|
1436
|
-
icon: "add",
|
|
1437
|
-
label: unref(o)("connect.campaign.appInbox.addButton"),
|
|
1438
|
-
onClick: v
|
|
1439
|
-
}, null, 8, ["label"])) : createCommentVNode("", !0)
|
|
1440
|
-
])
|
|
1441
|
-
]);
|
|
1442
|
-
};
|
|
1443
|
-
}
|
|
1444
|
-
}), _hoisted_1$k = { class: "flex flex-col gap-16" }, _hoisted_2$h = { class: "mb-[6px] flex items-baseline justify-between" }, _hoisted_3$e = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, _hoisted_4$d = { class: "mb-[6px] flex items-baseline justify-between" }, _hoisted_5$b = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, _hoisted_6$8 = { class: "mb-[6px] fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, _hoisted_7$7 = {
|
|
1445
|
-
key: 0,
|
|
1446
|
-
class: "mt-4 fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
1447
|
-
}, _hoisted_8$6 = {
|
|
1448
|
-
key: 1,
|
|
1449
|
-
class: "mt-12"
|
|
1450
|
-
}, _hoisted_9$6 = { class: "mb-[6px] fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, TITLE_LIMIT = 40, BODY_LIMIT = 120, TITLE_WARN_AT = 34, BODY_WARN_AT = 110, _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
1451
|
-
__name: "PushInput",
|
|
1452
|
-
props: {
|
|
1453
|
-
modelValue: {
|
|
1454
|
-
type: Object,
|
|
1455
|
-
required: !0
|
|
1456
|
-
},
|
|
1457
|
-
/** False until the form is submitted; broadcasts validate on submit. */
|
|
1458
|
-
showValidation: {
|
|
1459
|
-
type: Boolean,
|
|
1460
|
-
default: !0
|
|
1461
|
-
}
|
|
1462
|
-
},
|
|
1463
|
-
emits: ["update:model-value"],
|
|
1464
|
-
setup(e, { emit: r }) {
|
|
1465
|
-
const { t: o } = useI18n(), m = e, i = r, u = F_PUSH_DESTINATION.options, l = computed(() => m.modelValue.destination === "EXTERNAL"), n = computed(() => {
|
|
1466
|
-
var c;
|
|
1467
|
-
if (!m.showValidation || !l.value) return;
|
|
1468
|
-
const f = (c = m.modelValue.url) == null ? void 0 : c.trim();
|
|
1469
|
-
return f ? FdoBroadcastUrl.safeParse(f).success ? void 0 : o("connect.campaign.push.linkUrlInvalid") : o("connect.campaign.push.linkUrlRequired");
|
|
1470
|
-
});
|
|
1471
|
-
function a(f) {
|
|
1472
|
-
i("update:model-value", { ...m.modelValue, ...f });
|
|
1473
|
-
}
|
|
1474
|
-
function s(f) {
|
|
1475
|
-
a(f === "EXTERNAL" ? { destination: f } : { destination: f, url: null });
|
|
1476
|
-
}
|
|
1477
|
-
function v(f, c) {
|
|
1478
|
-
return f >= c ? "text-fm-color-system-warning-400" : "text-fm-color-typo-secondary";
|
|
1479
|
-
}
|
|
1480
|
-
return (f, c) => {
|
|
1481
|
-
const k = resolveComponent("FmTextField"), x = resolveComponent("FmTextarea"), h = resolveComponent("FmSelect");
|
|
1482
|
-
return openBlock(), createElementBlock("div", _hoisted_1$k, [
|
|
1483
|
-
createElementVNode("div", null, [
|
|
1484
|
-
createElementVNode("div", _hoisted_2$h, [
|
|
1485
|
-
createElementVNode("span", _hoisted_3$e, toDisplayString(unref(o)("connect.campaign.push.title")), 1),
|
|
1486
|
-
createElementVNode("span", {
|
|
1487
|
-
class: normalizeClass(["fm-typo-en-body-sm-400", v(e.modelValue.title.length, TITLE_WARN_AT)])
|
|
1488
|
-
}, toDisplayString(e.modelValue.title.length) + " / " + toDisplayString(TITLE_LIMIT), 3)
|
|
1489
|
-
]),
|
|
1490
|
-
createVNode(k, {
|
|
1491
|
-
"model-value": e.modelValue.title,
|
|
1492
|
-
"max-length": TITLE_LIMIT,
|
|
1493
|
-
placeholder: unref(o)("connect.campaign.push.titlePlaceholder"),
|
|
1494
|
-
"onUpdate:modelValue": c[0] || (c[0] = (g) => a({ title: g }))
|
|
1495
|
-
}, null, 8, ["model-value", "placeholder"])
|
|
1496
|
-
]),
|
|
1497
|
-
createElementVNode("div", null, [
|
|
1498
|
-
createElementVNode("div", _hoisted_4$d, [
|
|
1499
|
-
createElementVNode("span", _hoisted_5$b, toDisplayString(unref(o)("connect.campaign.push.body")), 1),
|
|
1500
|
-
createElementVNode("span", {
|
|
1501
|
-
class: normalizeClass(["fm-typo-en-body-sm-400", v(e.modelValue.body.length, BODY_WARN_AT)])
|
|
1502
|
-
}, toDisplayString(e.modelValue.body.length) + " / " + toDisplayString(BODY_LIMIT), 3)
|
|
1503
|
-
]),
|
|
1504
|
-
createVNode(x, {
|
|
1505
|
-
"model-value": e.modelValue.body,
|
|
1506
|
-
"max-length": BODY_LIMIT,
|
|
1507
|
-
placeholder: unref(o)("connect.campaign.push.bodyPlaceholder"),
|
|
1508
|
-
"onUpdate:modelValue": c[1] || (c[1] = (g) => a({ body: g }))
|
|
1509
|
-
}, null, 8, ["model-value", "placeholder"])
|
|
1510
|
-
]),
|
|
1511
|
-
createElementVNode("div", null, [
|
|
1512
|
-
createElementVNode("div", _hoisted_6$8, toDisplayString(unref(o)("connect.campaign.push.link")), 1),
|
|
1513
|
-
createVNode(h, {
|
|
1514
|
-
"model-value": e.modelValue.destination ?? "NONE",
|
|
1515
|
-
items: unref(u).map((g) => ({
|
|
1516
|
-
label: unref(o)(`connect.campaign.appInbox.destination.${g}`),
|
|
1517
|
-
value: g
|
|
1518
|
-
})),
|
|
1519
|
-
"onUpdate:modelValue": c[2] || (c[2] = (g) => s(g))
|
|
1520
|
-
}, null, 8, ["model-value", "items"]),
|
|
1521
|
-
unref(l) ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_7$7, toDisplayString(unref(o)("connect.campaign.push.linkHelper")), 1)),
|
|
1522
|
-
unref(l) ? (openBlock(), createElementBlock("div", _hoisted_8$6, [
|
|
1523
|
-
createElementVNode("div", _hoisted_9$6, toDisplayString(unref(o)("connect.campaign.push.linkUrl")), 1),
|
|
1524
|
-
createVNode(k, {
|
|
1525
|
-
"model-value": e.modelValue.url ?? "",
|
|
1526
|
-
inputmode: "url",
|
|
1527
|
-
placeholder: unref(o)("connect.campaign.push.linkUrlPlaceholder"),
|
|
1528
|
-
"helper-state": unref(n) ? "error" : "none",
|
|
1529
|
-
"helper-text": unref(n),
|
|
1530
|
-
"onUpdate:modelValue": c[3] || (c[3] = (g) => a({ url: g.trim() || null }))
|
|
1531
|
-
}, null, 8, ["model-value", "placeholder", "helper-state", "helper-text"])
|
|
1532
|
-
])) : createCommentVNode("", !0)
|
|
1533
|
-
])
|
|
1534
|
-
]);
|
|
1535
|
-
};
|
|
1536
|
-
}
|
|
1537
|
-
}), _hoisted_1$j = { class: "flex items-stretch overflow-x-auto pb-4" }, _hoisted_2$g = {
|
|
1538
|
-
key: 0,
|
|
1539
|
-
class: "flex flex-none items-center px-8 fm-typo-en-body-lg-600 text-fm-color-neutral-gray-300",
|
|
1540
|
-
"aria-hidden": "true"
|
|
1541
|
-
}, _hoisted_3$d = ["aria-current", "onClick"], _hoisted_4$c = { class: "flex items-center gap-[6px]" }, _hoisted_5$a = ["title"], _hoisted_6$7 = { class: "mt-[3px] block text-[11px] leading-[1.3] text-fm-color-typo-secondary" }, _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
1542
|
-
__name: "ChannelContentTabs",
|
|
1543
|
-
props: {
|
|
1544
|
-
tabs: {},
|
|
1545
|
-
modelValue: {}
|
|
1546
|
-
},
|
|
1547
|
-
emits: ["update:model-value"],
|
|
1548
|
-
setup(e) {
|
|
1549
|
-
const { t: r } = useI18n();
|
|
1550
|
-
return (o, m) => (openBlock(), createElementBlock("div", _hoisted_1$j, [
|
|
1551
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(e.tabs, (i) => (openBlock(), createElementBlock("div", {
|
|
1552
|
-
key: i.key,
|
|
1553
|
-
class: "flex flex-none items-center"
|
|
1554
|
-
}, [
|
|
1555
|
-
i.connector ? (openBlock(), createElementBlock("span", _hoisted_2$g, toDisplayString(i.connector), 1)) : createCommentVNode("", !0),
|
|
1556
|
-
createElementVNode("button", {
|
|
1557
|
-
type: "button",
|
|
1558
|
-
class: normalizeClass([
|
|
1559
|
-
"min-w-[132px] flex-none rounded-[10px] border px-[14px] py-[10px] text-left transition-colors",
|
|
1560
|
-
e.modelValue === i.key ? "border-fm-color-primary bg-fm-color-system-warning-100" : "border-fm-color-neutral-gray-100 bg-fm-color-neutral-white hover:border-fm-color-neutral-gray-200"
|
|
1561
|
-
]),
|
|
1562
|
-
"aria-current": e.modelValue === i.key ? "true" : void 0,
|
|
1563
|
-
onClick: (u) => o.$emit("update:model-value", i.key)
|
|
1564
|
-
}, [
|
|
1565
|
-
createElementVNode("span", _hoisted_4$c, [
|
|
1566
|
-
i.step ? (openBlock(), createElementBlock("span", {
|
|
1567
|
-
key: 0,
|
|
1568
|
-
class: normalizeClass([
|
|
1569
|
-
"flex h-[18px] w-[18px] flex-none items-center justify-center rounded-full text-[10.5px] font-semibold leading-[18px]",
|
|
1570
|
-
e.modelValue === i.key ? "bg-fm-color-primary text-fm-color-typo-white" : "bg-fm-color-neutral-gray-100 text-fm-color-typo-secondary"
|
|
1571
|
-
])
|
|
1572
|
-
}, toDisplayString(i.step), 3)) : createCommentVNode("", !0),
|
|
1573
|
-
createElementVNode("span", {
|
|
1574
|
-
class: normalizeClass([
|
|
1575
|
-
"truncate text-[12.5px] font-semibold leading-[1.3]",
|
|
1576
|
-
e.modelValue === i.key ? "text-fm-color-primary" : "text-fm-color-typo-primary"
|
|
1577
|
-
])
|
|
1578
|
-
}, toDisplayString(i.label), 3),
|
|
1579
|
-
i.complete ? createCommentVNode("", !0) : (openBlock(), createElementBlock("span", {
|
|
1580
|
-
key: 1,
|
|
1581
|
-
class: "h-[7px] w-[7px] flex-none rounded-full bg-fm-color-system-error-400",
|
|
1582
|
-
title: unref(r)("connect.campaign.broadcast.messageMissing")
|
|
1583
|
-
}, null, 8, _hoisted_5$a))
|
|
1584
|
-
]),
|
|
1585
|
-
createElementVNode("span", _hoisted_6$7, toDisplayString(i.sub), 1)
|
|
1586
|
-
], 10, _hoisted_3$d)
|
|
1587
|
-
]))), 128))
|
|
1588
|
-
]));
|
|
1589
|
-
}
|
|
1590
|
-
}), _hoisted_1$i = {
|
|
1591
|
-
key: 0,
|
|
1592
|
-
class: "flex w-[264px] shrink-0 flex-col gap-8"
|
|
1593
|
-
}, _hoisted_2$f = { class: "fm-typo-en-body-md-600" }, _hoisted_3$c = { class: "flex justify-center py-8" }, _hoisted_4$b = {
|
|
1594
|
-
key: 0,
|
|
1595
|
-
class: "px-12 pb-16 pt-16"
|
|
1596
|
-
}, _hoisted_5$9 = { class: "mb-12 text-center text-[11px] text-[rgba(255,255,255,0.6)]" }, _hoisted_6$6 = { class: "rounded-[14px] border border-[rgba(255,255,255,0.12)] bg-[rgba(255,255,255,0.14)] p-12 backdrop-blur" }, _hoisted_7$6 = { class: "fm-typo-en-body-md-600 text-fm-color-typo-white line-clamp-2" }, _hoisted_8$5 = { class: "mt-[2px] fm-typo-en-body-sm-400 text-[rgba(255,255,255,0.72)] line-clamp-3" }, _hoisted_9$5 = {
|
|
1597
|
-
key: 1,
|
|
1598
|
-
class: "px-12 pb-16"
|
|
1599
|
-
}, _hoisted_10$5 = { class: "fm-typo-en-body-md-600 mb-8" }, _hoisted_11$3 = { class: "rounded-[12px] border border-fm-color-neutral-gray-100 p-12" }, _hoisted_12$2 = { class: "fm-typo-en-body-md-600 line-clamp-2" }, _hoisted_13$2 = { class: "mt-[2px] fm-typo-en-body-sm-400 text-fm-color-typo-secondary line-clamp-3" }, _hoisted_14$2 = ["src"], _hoisted_15$2 = ["srcdoc", "title"], _hoisted_16$1 = {
|
|
1600
|
-
key: 2,
|
|
1601
|
-
class: "mt-12 flex flex-col gap-[6px]"
|
|
1602
|
-
}, _hoisted_17$1 = {
|
|
1603
|
-
key: 2,
|
|
1604
|
-
class: "px-12 pb-16"
|
|
1605
|
-
}, _hoisted_18$1 = { class: "fm-typo-en-body-md-600 mb-8" }, _hoisted_19$1 = { class: "whitespace-pre-wrap break-words rounded-[12px] bg-fm-color-neutral-gray-100 p-12 fm-typo-en-body-sm-400" }, _hoisted_20$1 = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
1606
|
-
__name: "ChannelPreview",
|
|
1607
|
-
props: {
|
|
1608
|
-
target: {},
|
|
1609
|
-
content: {},
|
|
1610
|
-
senderPrefix: {}
|
|
1611
|
-
},
|
|
1612
|
-
setup(e) {
|
|
1613
|
-
const { t: r } = useI18n(), o = e, m = computed(
|
|
1614
|
-
() => o.target === "PUSH" ? o.content : void 0
|
|
1615
|
-
), i = computed(
|
|
1616
|
-
() => o.target === "APP_INBOX" ? o.content : void 0
|
|
1617
|
-
), u = computed(
|
|
1618
|
-
() => o.target === "SMS" || o.target === "WHATSAPP" ? o.content : void 0
|
|
1619
|
-
), l = computed(() => {
|
|
1620
|
-
var f, c;
|
|
1621
|
-
const v = (c = (f = u.value) == null ? void 0 : f.content) == null ? void 0 : c.trim();
|
|
1622
|
-
return v ? o.senderPrefix ? `${o.senderPrefix}${v}` : v : r("connect.campaign.broadcast.preview.emptyText");
|
|
1623
|
-
}), n = computed(() => {
|
|
1624
|
-
var f;
|
|
1625
|
-
const v = ((f = i.value) == null ? void 0 : f.content) ?? "";
|
|
1626
|
-
return v.trim() ? `<!doctype html><meta charset="utf-8"><base target="_blank"><style>
|
|
1627
|
-
html,body{margin:0;font:400 12px/1.5 Inter,system-ui,sans-serif;color:#1C1C1E;word-break:break-word}
|
|
1628
|
-
img{max-width:100%;height:auto}
|
|
1629
|
-
</style>${v}` : "";
|
|
1630
|
-
}), a = computed(() => {
|
|
1631
|
-
const v = /* @__PURE__ */ new Date(), f = v.toLocaleDateString(void 0, {
|
|
1632
|
-
weekday: "short",
|
|
1633
|
-
day: "2-digit",
|
|
1634
|
-
month: "short"
|
|
1635
|
-
}), c = v.toLocaleTimeString(void 0, {
|
|
1636
|
-
hour: "2-digit",
|
|
1637
|
-
minute: "2-digit"
|
|
1638
|
-
});
|
|
1639
|
-
return `${f} · ${c}`;
|
|
1640
|
-
}), s = computed(() => o.target === "PUSH" ? r("connect.campaign.broadcast.preview.note.push") : o.target === "APP_INBOX" ? r("connect.campaign.broadcast.preview.note.inbox") : r("connect.campaign.broadcast.preview.note.text"));
|
|
1641
|
-
return (v, f) => {
|
|
1642
|
-
var c, k, x, h, g, d, p, C, V, N, R;
|
|
1643
|
-
return e.target !== "EMAIL" ? (openBlock(), createElementBlock("div", _hoisted_1$i, [
|
|
1644
|
-
createElementVNode("div", _hoisted_2$f, toDisplayString(unref(r)("connect.campaign.broadcast.preview.title")), 1),
|
|
1645
|
-
createElementVNode("div", {
|
|
1646
|
-
class: normalizeClass([
|
|
1647
|
-
"overflow-hidden rounded-[22px] border border-fm-color-neutral-gray-100",
|
|
1648
|
-
e.target === "PUSH" ? "bg-fm-color-neutral-black" : "bg-fm-color-neutral-white"
|
|
1649
|
-
])
|
|
1650
|
-
}, [
|
|
1651
|
-
createElementVNode("div", _hoisted_3$c, [
|
|
1652
|
-
createElementVNode("div", {
|
|
1653
|
-
class: normalizeClass([
|
|
1654
|
-
"h-4 w-40 rounded-full",
|
|
1655
|
-
e.target === "PUSH" ? "bg-fm-color-neutral-gray-400" : "bg-fm-color-neutral-gray-100"
|
|
1656
|
-
])
|
|
1657
|
-
}, null, 2)
|
|
1658
|
-
]),
|
|
1659
|
-
e.target === "PUSH" ? (openBlock(), createElementBlock("div", _hoisted_4$b, [
|
|
1660
|
-
createElementVNode("div", _hoisted_5$9, toDisplayString(unref(a)), 1),
|
|
1661
|
-
createElementVNode("div", _hoisted_6$6, [
|
|
1662
|
-
createElementVNode("div", _hoisted_7$6, toDisplayString(((k = (c = unref(m)) == null ? void 0 : c.title) == null ? void 0 : k.trim()) || unref(r)("connect.campaign.broadcast.preview.emptyTitle")), 1),
|
|
1663
|
-
createElementVNode("div", _hoisted_8$5, toDisplayString(((h = (x = unref(m)) == null ? void 0 : x.body) == null ? void 0 : h.trim()) || unref(r)("connect.campaign.broadcast.preview.emptyBody")), 1)
|
|
1664
|
-
])
|
|
1665
|
-
])) : e.target === "APP_INBOX" ? (openBlock(), createElementBlock("div", _hoisted_9$5, [
|
|
1666
|
-
createElementVNode("div", _hoisted_10$5, toDisplayString(unref(r)("connect.campaign.broadcast.preview.inboxHeading")), 1),
|
|
1667
|
-
createElementVNode("div", _hoisted_11$3, [
|
|
1668
|
-
createElementVNode("div", _hoisted_12$2, toDisplayString(((d = (g = unref(i)) == null ? void 0 : g.title) == null ? void 0 : d.trim()) || unref(r)("connect.campaign.broadcast.preview.emptyTitle")), 1),
|
|
1669
|
-
createElementVNode("div", _hoisted_13$2, toDisplayString(((C = (p = unref(i)) == null ? void 0 : p.previewText) == null ? void 0 : C.trim()) || unref(r)("connect.campaign.broadcast.preview.emptyBody")), 1),
|
|
1670
|
-
(V = unref(i)) != null && V.imageUrl ? (openBlock(), createElementBlock("img", {
|
|
1671
|
-
key: 0,
|
|
1672
|
-
src: unref(i).imageUrl,
|
|
1673
|
-
alt: "",
|
|
1674
|
-
class: "mt-8 w-full rounded-[8px]"
|
|
1675
|
-
}, null, 8, _hoisted_14$2)) : createCommentVNode("", !0),
|
|
1676
|
-
unref(n) ? (openBlock(), createElementBlock("iframe", {
|
|
1677
|
-
key: 1,
|
|
1678
|
-
srcdoc: unref(n),
|
|
1679
|
-
sandbox: "",
|
|
1680
|
-
referrerpolicy: "no-referrer",
|
|
1681
|
-
class: "mt-8 h-[120px] w-full border-0",
|
|
1682
|
-
title: unref(r)("connect.campaign.broadcast.preview.bodyFrameTitle")
|
|
1683
|
-
}, null, 8, _hoisted_15$2)) : createCommentVNode("", !0),
|
|
1684
|
-
(R = (N = unref(i)) == null ? void 0 : N.buttons) != null && R.length ? (openBlock(), createElementBlock("div", _hoisted_16$1, [
|
|
1685
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(i).buttons, (E, D) => (openBlock(), createElementBlock("div", {
|
|
1686
|
-
key: D,
|
|
1687
|
-
class: "rounded-[8px] bg-fm-color-primary px-12 py-8 text-center fm-typo-en-body-sm-400 text-fm-color-typo-white"
|
|
1688
|
-
}, toDisplayString(E.label || unref(r)("connect.campaign.appInbox.buttonLabel")), 1))), 128))
|
|
1689
|
-
])) : createCommentVNode("", !0)
|
|
1690
|
-
])
|
|
1691
|
-
])) : (openBlock(), createElementBlock("div", _hoisted_17$1, [
|
|
1692
|
-
createElementVNode("div", _hoisted_18$1, toDisplayString(unref(r)(`connect.campaign.broadcast.channel.${e.target}`)), 1),
|
|
1693
|
-
createElementVNode("div", _hoisted_19$1, toDisplayString(unref(l)), 1)
|
|
1694
|
-
]))
|
|
1695
|
-
], 2),
|
|
1696
|
-
createElementVNode("div", _hoisted_20$1, toDisplayString(unref(s)), 1)
|
|
1697
|
-
])) : createCommentVNode("", !0);
|
|
1698
|
-
};
|
|
1699
|
-
}
|
|
1700
|
-
}), _hoisted_1$h = { class: "flex flex-col gap-12 pt-8" }, _hoisted_2$e = { class: "flex flex-wrap items-baseline justify-between gap-16" }, _hoisted_3$b = { class: "fm-typo-en-body-lg-600" }, _hoisted_4$a = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, _hoisted_5$8 = { class: "h-24 w-24 flex-none rounded-full bg-fm-color-neutral-gray-100 text-center fm-typo-en-body-sm-400 leading-[24px]" }, _hoisted_6$5 = { class: "min-w-0 flex-1" }, _hoisted_7$5 = { class: "flex flex-wrap items-center gap-[10px]" }, _hoisted_8$4 = { class: "fm-typo-en-body-md-600" }, _hoisted_9$4 = {
|
|
1701
|
-
key: 0,
|
|
1702
|
-
class: "inline-flex items-center gap-[5px] fm-typo-en-body-sm-400 text-fm-color-system-error-400"
|
|
1703
|
-
}, _hoisted_10$4 = { class: "ml-auto flex flex-none items-center gap-[2px] border-l border-fm-color-neutral-gray-100 pl-4" }, _hoisted_11$2 = ["title"], _hoisted_12$1 = ["title"], _hoisted_13$1 = ["title"], _hoisted_14$1 = {
|
|
1704
|
-
type: "button",
|
|
1705
|
-
class: "w-full rounded-[8px] border-2 border-dashed border-fm-color-neutral-gray-200 p-[20px] fm-typo-en-body-lg-600 text-fm-color-typo-secondary transition-colors hover:border-fm-color-primary hover:text-fm-color-primary"
|
|
1706
|
-
}, _hoisted_15$1 = {
|
|
1707
|
-
key: 1,
|
|
1708
|
-
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
1709
|
-
}, _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
1710
|
-
__name: "FallbackChannelList",
|
|
1711
|
-
props: {
|
|
1712
|
-
rows: {},
|
|
1713
|
-
addable: {}
|
|
1714
|
-
},
|
|
1715
|
-
emits: ["move", "remove", "add"],
|
|
1716
|
-
setup(e) {
|
|
1717
|
-
const { t: r } = useI18n(), o = e, m = computed(() => o.addable.length > 0);
|
|
1718
|
-
return (i, u) => {
|
|
1719
|
-
const l = resolveComponent("FmButton"), n = resolveComponent("FmMenuItem"), a = resolveComponent("FmMenu");
|
|
1720
|
-
return openBlock(), createElementBlock("div", _hoisted_1$h, [
|
|
1721
|
-
createElementVNode("div", _hoisted_2$e, [
|
|
1722
|
-
createElementVNode("span", _hoisted_3$b, toDisplayString(unref(r)("connect.campaign.broadcast.fallbackChannels")), 1),
|
|
1723
|
-
createElementVNode("span", _hoisted_4$a, toDisplayString(unref(r)("connect.campaign.broadcast.fallbackChannelsHint")), 1)
|
|
1724
|
-
]),
|
|
1725
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(e.rows, (s, v) => (openBlock(), createElementBlock("div", {
|
|
1726
|
-
key: s.channel,
|
|
1727
|
-
class: "flex flex-wrap items-center gap-12 rounded-[8px] border border-fm-color-neutral-gray-100 px-16 py-[14px]"
|
|
1728
|
-
}, [
|
|
1729
|
-
createElementVNode("span", _hoisted_5$8, toDisplayString(s.position), 1),
|
|
1730
|
-
createElementVNode("span", _hoisted_6$5, [
|
|
1731
|
-
createElementVNode("span", _hoisted_7$5, [
|
|
1732
|
-
createElementVNode("span", _hoisted_8$4, toDisplayString(s.label), 1),
|
|
1733
|
-
s.complete ? createCommentVNode("", !0) : (openBlock(), createElementBlock("span", _hoisted_9$4, [
|
|
1734
|
-
u[0] || (u[0] = createElementVNode("span", { class: "h-[6px] w-[6px] rounded-full bg-fm-color-system-error-400" }, null, -1)),
|
|
1735
|
-
createTextVNode(" " + toDisplayString(unref(r)("connect.campaign.broadcast.messageMissing")), 1)
|
|
1736
|
-
]))
|
|
1737
|
-
])
|
|
1738
|
-
]),
|
|
1739
|
-
createElementVNode("span", _hoisted_10$4, [
|
|
1740
|
-
createElementVNode("span", {
|
|
1741
|
-
title: unref(r)("connect.campaign.broadcast.moveUp"),
|
|
1742
|
-
class: "flex"
|
|
1743
|
-
}, [
|
|
1744
|
-
createVNode(l, {
|
|
1745
|
-
icon: "arrow_upward",
|
|
1746
|
-
"icon-color": "neutral-gray-400",
|
|
1747
|
-
variant: "tertiary",
|
|
1748
|
-
disabled: v === 0,
|
|
1749
|
-
onClick: (f) => i.$emit("move", s.channel, -1)
|
|
1750
|
-
}, null, 8, ["disabled", "onClick"])
|
|
1751
|
-
], 8, _hoisted_11$2),
|
|
1752
|
-
createElementVNode("span", {
|
|
1753
|
-
title: unref(r)("connect.campaign.broadcast.moveDown"),
|
|
1754
|
-
class: "flex"
|
|
1755
|
-
}, [
|
|
1756
|
-
createVNode(l, {
|
|
1757
|
-
icon: "arrow_downward",
|
|
1758
|
-
"icon-color": "neutral-gray-400",
|
|
1759
|
-
variant: "tertiary",
|
|
1760
|
-
disabled: v === e.rows.length - 1,
|
|
1761
|
-
onClick: (f) => i.$emit("move", s.channel, 1)
|
|
1762
|
-
}, null, 8, ["disabled", "onClick"])
|
|
1763
|
-
], 8, _hoisted_12$1),
|
|
1764
|
-
createElementVNode("span", {
|
|
1765
|
-
title: unref(r)("connect.campaign.broadcast.removeChannel"),
|
|
1766
|
-
class: "flex"
|
|
1767
|
-
}, [
|
|
1768
|
-
createVNode(l, {
|
|
1769
|
-
icon: "delete",
|
|
1770
|
-
"icon-color": "neutral-gray-400",
|
|
1771
|
-
variant: "tertiary",
|
|
1772
|
-
onClick: (f) => i.$emit("remove", s.channel)
|
|
1773
|
-
}, null, 8, ["onClick"])
|
|
1774
|
-
], 8, _hoisted_13$1)
|
|
1775
|
-
])
|
|
1776
|
-
]))), 128)),
|
|
1777
|
-
unref(m) ? (openBlock(), createBlock(a, {
|
|
1778
|
-
key: 0,
|
|
1779
|
-
placement: "bottom-start"
|
|
1780
|
-
}, {
|
|
1781
|
-
"menu-button": withCtx(() => [
|
|
1782
|
-
createElementVNode("button", _hoisted_14$1, " + " + toDisplayString(unref(r)("connect.campaign.broadcast.addFallbackChannel")), 1)
|
|
1783
|
-
]),
|
|
1784
|
-
default: withCtx(() => [
|
|
1785
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(e.addable, (s) => (openBlock(), createBlock(n, {
|
|
1786
|
-
key: s.channel,
|
|
1787
|
-
label: s.label,
|
|
1788
|
-
onClick: (v) => i.$emit("add", s.channel)
|
|
1789
|
-
}, null, 8, ["label", "onClick"]))), 128))
|
|
1790
|
-
]),
|
|
1791
|
-
_: 1
|
|
1792
|
-
})) : (openBlock(), createElementBlock("div", _hoisted_15$1, toDisplayString(unref(r)("connect.campaign.broadcast.allChannelsAdded")), 1))
|
|
1793
|
-
]);
|
|
1794
|
-
};
|
|
1795
|
-
}
|
|
1796
|
-
});
|
|
1797
|
-
var define_appEndpoint_default = { authUrl: "https://portal-v2-dev.feedmeapi.com/", slackWebhookUrl: "https://hooks.slack.com/services/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", appUrl: "feedmedev.vip", crmUrl: "crm.feedmedev.cc", paymentPortalUrl: "https://portal.feedmedev.cc/payment/payout-account", licensePortalUrl: "https://license.feedmedev.cc/", marketingV1Portal: "https://marketing-v1.feedmedev.cc", voucherAppUrl: "https://voucher.feedmedev.cc/" };
|
|
1798
|
-
const _hoisted_1$g = { class: "flex flex-col gap-[28px]" }, _hoisted_2$d = { class: "flex flex-col gap-[14px]" }, _hoisted_3$a = { class: "fm-typo-en-body-lg-600" }, _hoisted_4$9 = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _hoisted_5$7 = { class: "grid gap-12 md:grid-cols-2 lg:grid-cols-2" }, _hoisted_6$4 = { class: "flex items-start justify-between gap-12" }, _hoisted_7$4 = { class: "fm-typo-en-title-sm-800" }, _hoisted_8$3 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_9$3 = {
|
|
1799
|
-
key: 0,
|
|
1800
|
-
class: "flex items-start gap-8 fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
1801
|
-
}, _hoisted_10$3 = { class: "flex flex-col gap-12" }, _hoisted_11$1 = { class: "fm-typo-en-body-lg-600" }, _hoisted_12 = { class: "grid items-stretch gap-12 sm:grid-cols-2 md:grid-cols-4 lg:grid-cols-4" }, _hoisted_13 = { class: "flex items-start justify-between gap-12" }, _hoisted_14 = {
|
|
1802
|
-
key: 1,
|
|
1803
|
-
class: "h-[8px] w-[8px] rounded-full bg-fm-color-neutral-white"
|
|
1804
|
-
}, _hoisted_15 = {
|
|
1805
|
-
key: 0,
|
|
1806
|
-
class: "mt-[3px] fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
1807
|
-
}, _hoisted_16 = {
|
|
1808
|
-
key: 1,
|
|
1809
|
-
class: "mt-[6px] inline-flex rounded-[6px] bg-fm-color-system-warning-100 px-8 py-[3px] fm-typo-en-body-sm-400 text-fm-color-system-warning-400"
|
|
1810
|
-
}, _hoisted_17 = {
|
|
1811
|
-
key: 2,
|
|
1812
|
-
class: "mt-[6px] inline-flex rounded-[6px] bg-fm-color-neutral-gray-100 px-8 py-[3px] fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
1813
|
-
}, _hoisted_18 = {
|
|
1814
|
-
key: 0,
|
|
1815
|
-
class: "fm-typo-en-body-sm-400 text-fm-color-system-warning-400"
|
|
1816
|
-
}, _hoisted_19 = {
|
|
1817
|
-
key: 1,
|
|
1818
|
-
class: "fm-typo-en-body-sm-400 text-fm-color-system-error-400"
|
|
1819
|
-
}, _hoisted_20 = { class: "flex flex-col gap-[14px]" }, _hoisted_21 = { class: "fm-typo-en-body-lg-600" }, _hoisted_22 = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _hoisted_23 = {
|
|
1820
|
-
key: 1,
|
|
1821
|
-
class: "rounded-[8px] border border-dashed border-fm-color-neutral-gray-200 p-24 text-center fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
1822
|
-
}, _hoisted_24 = {
|
|
1823
|
-
key: 3,
|
|
1824
|
-
class: "flex flex-wrap items-start gap-24"
|
|
1825
|
-
}, _hoisted_25 = { class: "min-w-0 flex-1 basis-[340px]" }, _hoisted_26 = {
|
|
1826
|
-
key: 1,
|
|
1827
|
-
class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
1828
|
-
}, _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
1829
|
-
__name: "BroadcastDeliveryInput",
|
|
1830
|
-
props: {
|
|
1831
|
-
pushAvailability: {
|
|
1832
|
-
type: String,
|
|
1833
|
-
default: "checking"
|
|
1834
|
-
},
|
|
1835
|
-
/** Either the new delivery shape or a legacy single-channel message. */
|
|
1836
|
-
modelValue: {
|
|
1837
|
-
type: Object,
|
|
1838
|
-
default: void 0
|
|
1839
|
-
},
|
|
1840
|
-
triggerType: {
|
|
1841
|
-
type: String,
|
|
1842
|
-
default: () => "SCHEDULE"
|
|
1843
|
-
},
|
|
1844
|
-
variables: {
|
|
1845
|
-
type: Object,
|
|
1846
|
-
default: () => [...DEFAULT_MESSAGE_VARIABLES]
|
|
1847
|
-
},
|
|
1848
|
-
helperText: { type: String },
|
|
1849
|
-
/**
|
|
1850
|
-
* False until the merchant tries to proceed. Broadcasts validate on submit,
|
|
1851
|
-
* so incomplete-channel markers stay hidden while the form is being filled.
|
|
1852
|
-
*/
|
|
1853
|
-
showValidation: { type: Boolean, default: !0 },
|
|
1854
|
-
helperState: { type: String },
|
|
1855
|
-
placeholder: { type: String }
|
|
1856
|
-
},
|
|
1857
|
-
emits: ["retry-push", "update:model-value"],
|
|
1858
|
-
setup(e, { emit: r }) {
|
|
1859
|
-
const { t: o } = useI18n(), m = useDialog(), i = computed(() => {
|
|
1860
|
-
let y = "unavailable";
|
|
1861
|
-
return a.pushAvailability === "checking" ? y = "checking" : a.pushAvailability === "non-native" && (y = "requiresNativeApp"), o("connect.campaign.broadcast.pushAvailability." + y);
|
|
1862
|
-
});
|
|
1863
|
-
function u() {
|
|
1864
|
-
m.open({
|
|
1865
|
-
title: o("connect.campaign.broadcast.pushAvailability.contactSales"),
|
|
1866
|
-
message: o("connect.campaign.broadcast.pushAvailability.dialogMessage"),
|
|
1867
|
-
primaryActions: {
|
|
1868
|
-
text: o("connect.campaign.broadcast.pushAvailability.close"),
|
|
1869
|
-
close: !0
|
|
1870
|
-
}
|
|
1871
|
-
});
|
|
1872
|
-
}
|
|
1873
|
-
const l = useCoreStore(), n = useMembershipStore(), a = e, s = r, v = ref(!1), f = ref("SMS"), c = computed(() => {
|
|
1874
|
-
const y = a.modelValue;
|
|
1875
|
-
return y && "channels" in y ? y : toDelivery({ message: y });
|
|
1876
|
-
});
|
|
1877
|
-
function k(y) {
|
|
1878
|
-
s("update:model-value", y);
|
|
1879
|
-
}
|
|
1880
|
-
function x(y) {
|
|
1881
|
-
return o(`connect.campaign.broadcast.channel.${y}`);
|
|
1882
|
-
}
|
|
1883
|
-
const h = {
|
|
1884
|
-
SMS: "chat",
|
|
1885
|
-
WHATSAPP: "chat",
|
|
1886
|
-
EMAIL: "mail",
|
|
1887
|
-
APP_INBOX: "inbox",
|
|
1888
|
-
PUSH: "notifications"
|
|
1889
|
-
};
|
|
1890
|
-
function g(y) {
|
|
1891
|
-
return h[y];
|
|
1892
|
-
}
|
|
1893
|
-
const d = computed(() => c.value.mode === "fallback"), p = computed(
|
|
1894
|
-
() => a.variables.filter(
|
|
1895
|
-
(y) => a.triggerType == "SCHEDULE" ? !y.startsWith("transaction.") : !0
|
|
1896
|
-
)
|
|
1897
|
-
), C = useChannelFlag();
|
|
1898
|
-
function V(y) {
|
|
1899
|
-
return C(y) === "off" ? !1 : y === "PUSH" ? a.pushAvailability === "native" : y === "WHATSAPP" ? v.value : !0;
|
|
1900
|
-
}
|
|
1901
|
-
const N = ["fallback", "all"];
|
|
1902
|
-
function R(y) {
|
|
1903
|
-
y !== c.value.mode && k(setMode(c.value, y));
|
|
1904
|
-
}
|
|
1905
|
-
const E = ref(null);
|
|
1906
|
-
function D(y) {
|
|
1907
|
-
var F;
|
|
1908
|
-
const $ = (F = E.value) == null ? void 0 : F[y];
|
|
1909
|
-
return $ ? new Intl.NumberFormat(void 0, {
|
|
1910
|
-
style: "currency",
|
|
1911
|
-
currency: $.currency,
|
|
1912
|
-
minimumFractionDigits: $.precision,
|
|
1913
|
-
maximumFractionDigits: $.precision
|
|
1914
|
-
}).format($.amount / 10 ** $.precision) : null;
|
|
1915
|
-
}
|
|
1916
|
-
const w = computed(
|
|
1917
|
-
() => (
|
|
1918
|
-
// A flagged-off channel stays visible while selected, so it can be removed.
|
|
1919
|
-
CHANNEL_DISPLAY_ORDER.filter(
|
|
1920
|
-
(y) => C(y) === "on" || c.value.channels.includes(y)
|
|
1921
|
-
).map((y) => {
|
|
1922
|
-
const $ = c.value.channels.includes(y), F = D(y);
|
|
1923
|
-
let M = o("connect.campaign.broadcast.freeChannel");
|
|
1924
|
-
return isPaidChannel(y) && (M = F ? o("connect.campaign.broadcast.perMessage", { price: F }) : null), {
|
|
1925
|
-
channel: y,
|
|
1926
|
-
label: x(y),
|
|
1927
|
-
selected: $,
|
|
1928
|
-
available: V(y),
|
|
1929
|
-
rateNote: M,
|
|
1930
|
-
// In fallback mode the grid is a radio for the primary channel, so only
|
|
1931
|
-
// the primary reads as checked; a fallback is tagged instead.
|
|
1932
|
-
checked: d.value ? c.value.channels[0] === y : $,
|
|
1933
|
-
usedAsFallback: d.value && c.value.channels.indexOf(y) > 0
|
|
1934
|
-
};
|
|
1935
|
-
})
|
|
1936
|
-
)
|
|
1937
|
-
);
|
|
1938
|
-
async function A(y) {
|
|
1939
|
-
if (d.value) {
|
|
1940
|
-
await H(y);
|
|
1941
|
-
return;
|
|
1942
|
-
}
|
|
1943
|
-
if (c.value.channels.includes(y)) {
|
|
1944
|
-
await I(y);
|
|
1945
|
-
return;
|
|
1946
|
-
}
|
|
1947
|
-
V(y) && k(addChannel(c.value, y, p.value));
|
|
1948
|
-
}
|
|
1949
|
-
async function H(y) {
|
|
1950
|
-
if (!V(y)) return;
|
|
1951
|
-
const $ = c.value.channels[0];
|
|
1952
|
-
$ !== y && ($ && hasDraft(c.value, $) && !await prompt.remove(
|
|
1953
|
-
o("connect.campaign.broadcast.replaceChannelConfirm", {
|
|
1954
|
-
channel: x($),
|
|
1955
|
-
next: x(y)
|
|
1956
|
-
})
|
|
1957
|
-
) || V(y) && (k(setPrimaryChannel(c.value, y, p.value)), f.value = y));
|
|
1958
|
-
}
|
|
1959
|
-
async function I(y) {
|
|
1960
|
-
if (hasDraft(c.value, y) && !await prompt.remove(
|
|
1961
|
-
o("connect.campaign.broadcast.removeChannelConfirm", {
|
|
1962
|
-
channel: x(y)
|
|
1963
|
-
})
|
|
1964
|
-
))
|
|
1965
|
-
return;
|
|
1966
|
-
const $ = removeChannel(c.value, y);
|
|
1967
|
-
k($), f.value === y && (f.value = $.channels[0] ?? "SMS");
|
|
1968
|
-
}
|
|
1969
|
-
function X(y, $) {
|
|
1970
|
-
k(moveChannel(c.value, y, $));
|
|
1971
|
-
}
|
|
1972
|
-
function K(y) {
|
|
1973
|
-
V(y) && k(addChannel(c.value, y, p.value));
|
|
1974
|
-
}
|
|
1975
|
-
const Z = computed(
|
|
1976
|
-
() => c.value.channels.slice(1).map((y, $) => ({
|
|
1977
|
-
channel: y,
|
|
1978
|
-
label: x(y),
|
|
1979
|
-
position: $ + 2,
|
|
1980
|
-
complete: !a.showValidation || isChannelComplete(c.value, y)
|
|
1981
|
-
}))
|
|
1982
|
-
), J = computed(
|
|
1983
|
-
() => CHANNEL_DISPLAY_ORDER.filter(
|
|
1984
|
-
(y) => !c.value.channels.includes(y) && V(y)
|
|
1985
|
-
).map((y) => ({
|
|
1986
|
-
channel: y,
|
|
1987
|
-
label: x(y)
|
|
1988
|
-
}))
|
|
1989
|
-
), W = computed(
|
|
1990
|
-
() => c.value.channels.map((y, $) => {
|
|
1991
|
-
let F = o("connect.campaign.broadcast.tab.sendsToEligible");
|
|
1992
|
-
d.value && (F = o(
|
|
1993
|
-
$ === 0 ? "connect.campaign.broadcast.tab.firstAttempt" : "connect.campaign.broadcast.tab.ifNotReached"
|
|
1994
|
-
));
|
|
1995
|
-
let M;
|
|
1996
|
-
return $ > 0 && (M = d.value ? "→" : "+"), {
|
|
1997
|
-
key: y,
|
|
1998
|
-
label: x(y),
|
|
1999
|
-
sub: F,
|
|
2000
|
-
complete: !a.showValidation || isChannelComplete(c.value, y),
|
|
2001
|
-
step: d.value ? $ + 1 : void 0,
|
|
2002
|
-
connector: M
|
|
2003
|
-
};
|
|
2004
|
-
})
|
|
2005
|
-
);
|
|
2006
|
-
watchEffect(() => {
|
|
2007
|
-
const y = W.value.map(($) => $.key);
|
|
2008
|
-
y.length && !y.includes(f.value) && (f.value = y[0]);
|
|
2009
|
-
});
|
|
2010
|
-
const b = computed(() => f.value), B = computed(() => {
|
|
2011
|
-
const y = b.value;
|
|
2012
|
-
if (!(y === "APP_INBOX" || y === "PUSH"))
|
|
2013
|
-
return c.value.content[y];
|
|
2014
|
-
}), T = computed(
|
|
2015
|
-
() => c.value.content.APP_INBOX
|
|
2016
|
-
), O = computed(
|
|
2017
|
-
() => c.value.content.PUSH
|
|
2018
|
-
);
|
|
2019
|
-
function P(y) {
|
|
2020
|
-
k(setChannelContent(c.value, "APP_INBOX", y));
|
|
2021
|
-
}
|
|
2022
|
-
function U(y) {
|
|
2023
|
-
V("PUSH") && k(setChannelContent(c.value, "PUSH", y));
|
|
2024
|
-
}
|
|
2025
|
-
function j(y, $) {
|
|
2026
|
-
y === "APP_INBOX" || y === "PUSH" || k(setChannelContent(c.value, y, { ...$, channel: y }));
|
|
2027
|
-
}
|
|
2028
|
-
const L = computed(
|
|
2029
|
-
() => c.value.channels.filter(isPaidChannel)
|
|
2030
|
-
), G = computed(() => {
|
|
2031
|
-
var $, F, M;
|
|
2032
|
-
const y = (($ = n.membership) == null ? void 0 : $.brand) || ((M = (F = l.currentBusiness) == null ? void 0 : F.value) == null ? void 0 : M.name) || "";
|
|
2033
|
-
return getSmsMessageMetrics({ brandName: y, content: "" }).prefix;
|
|
2034
|
-
}), Y = `${define_appEndpoint_default.licensePortalUrl}settings?businessId=${SvcConfig.businessId}`;
|
|
2035
|
-
async function q() {
|
|
2036
|
-
try {
|
|
2037
|
-
const y = await membershipApi.getWhatsappNumbers();
|
|
2038
|
-
v.value = y.some(
|
|
2039
|
-
($) => {
|
|
2040
|
-
var F;
|
|
2041
|
-
return (F = $ == null ? void 0 : $.default) == null ? void 0 : F.includes("Marketing");
|
|
2042
|
-
}
|
|
2043
|
-
);
|
|
2044
|
-
} catch (y) {
|
|
2045
|
-
console.error("Failed to fetch WhatsApp numbers:", y);
|
|
2046
|
-
}
|
|
2047
|
-
}
|
|
2048
|
-
return onMounted(async () => {
|
|
2049
|
-
const y = c.value.channels[0];
|
|
2050
|
-
y && (f.value = y), campaignApi.readBroadcastCreditSummary().then(($) => E.value = $.prices).catch(() => E.value = null), await q();
|
|
2051
|
-
}), (y, $) => {
|
|
2052
|
-
const F = resolveComponent("FmIcon"), M = resolveComponent("FmCard"), Q = resolveComponent("FmButton");
|
|
2053
|
-
return openBlock(), createElementBlock("div", _hoisted_1$g, [
|
|
2054
|
-
createElementVNode("div", _hoisted_2$d, [
|
|
2055
|
-
createElementVNode("div", null, [
|
|
2056
|
-
createElementVNode("div", _hoisted_3$a, toDisplayString(unref(o)("connect.campaign.broadcast.delivery")), 1),
|
|
2057
|
-
createElementVNode("div", _hoisted_4$9, toDisplayString(unref(o)("connect.campaign.broadcast.deliveryDescription")), 1)
|
|
2058
|
-
]),
|
|
2059
|
-
createElementVNode("div", _hoisted_5$7, [
|
|
2060
|
-
(openBlock(), createElementBlock(Fragment, null, renderList(N, (S) => createVNode(M, {
|
|
2061
|
-
key: S,
|
|
2062
|
-
variant: "outlined",
|
|
2063
|
-
class: normalizeClass(["h-full cursor-pointer select-none p-16 space-y-8", {
|
|
2064
|
-
"border-fm-color-primary bg-fm-color-system-warning-100": unref(c).mode === S,
|
|
2065
|
-
"hover:bg-fm-color-opacity-sm": unref(c).mode !== S
|
|
2066
|
-
}]),
|
|
2067
|
-
onClick: (ee) => R(S)
|
|
2068
|
-
}, {
|
|
2069
|
-
default: withCtx(() => [
|
|
2070
|
-
createElementVNode("div", _hoisted_6$4, [
|
|
2071
|
-
createElementVNode("div", _hoisted_7$4, toDisplayString(unref(o)(`connect.campaign.broadcast.mode.${S}.label`)), 1),
|
|
2072
|
-
unref(c).mode === S ? (openBlock(), createBlock(F, {
|
|
2073
|
-
key: 0,
|
|
2074
|
-
name: "check_circle",
|
|
2075
|
-
size: "md",
|
|
2076
|
-
class: "shrink-0 text-fm-color-primary"
|
|
2077
|
-
})) : createCommentVNode("", !0)
|
|
2078
|
-
]),
|
|
2079
|
-
createElementVNode("div", _hoisted_8$3, toDisplayString(unref(o)(`connect.campaign.broadcast.mode.${S}.description`)), 1)
|
|
2080
|
-
]),
|
|
2081
|
-
_: 2
|
|
2082
|
-
}, 1032, ["class", "onClick"])), 64))
|
|
2083
|
-
]),
|
|
2084
|
-
unref(c).channels.length < 2 ? (openBlock(), createElementBlock("div", _hoisted_9$3, [
|
|
2085
|
-
createVNode(F, {
|
|
2086
|
-
name: "info",
|
|
2087
|
-
size: "sm",
|
|
2088
|
-
class: "mt-[2px]"
|
|
2089
|
-
}),
|
|
2090
|
-
createElementVNode("span", null, toDisplayString(unref(o)("connect.campaign.broadcast.singleChannelNote")), 1)
|
|
2091
|
-
])) : createCommentVNode("", !0)
|
|
2092
|
-
]),
|
|
2093
|
-
createElementVNode("div", _hoisted_10$3, [
|
|
2094
|
-
createElementVNode("div", _hoisted_11$1, toDisplayString(unref(d) ? unref(o)("connect.campaign.broadcast.primaryChannel") : unref(o)("connect.campaign.broadcast.channels")), 1),
|
|
2095
|
-
createElementVNode("div", _hoisted_12, [
|
|
2096
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(w), (S) => (openBlock(), createBlock(M, {
|
|
2097
|
-
key: S.channel,
|
|
2098
|
-
variant: "outlined",
|
|
2099
|
-
class: normalizeClass(["flex h-full flex-col gap-12 p-16", [
|
|
2100
|
-
S.checked ? "!border-fm-color-primary bg-fm-color-system-warning-100" : "",
|
|
2101
|
-
S.available ? "cursor-pointer" : "cursor-not-allowed bg-fm-color-neutral-gray-100"
|
|
2102
|
-
]]),
|
|
2103
|
-
"aria-disabled": S.channel === "PUSH" ? void 0 : !S.available,
|
|
2104
|
-
onClick: (ee) => A(S.channel)
|
|
2105
|
-
}, {
|
|
2106
|
-
default: withCtx(() => [
|
|
2107
|
-
createElementVNode("div", _hoisted_13, [
|
|
2108
|
-
createElementVNode("span", {
|
|
2109
|
-
class: normalizeClass([
|
|
2110
|
-
"flex h-[34px] w-[34px] flex-none items-center justify-center rounded-[8px]",
|
|
2111
|
-
S.available ? "bg-fm-color-primary-oats text-fm-color-primary" : "bg-fm-color-neutral-gray-200 text-fm-color-neutral-gray-400"
|
|
2112
|
-
])
|
|
2113
|
-
}, [
|
|
2114
|
-
createVNode(F, {
|
|
2115
|
-
name: g(S.channel),
|
|
2116
|
-
size: "md"
|
|
2117
|
-
}, null, 8, ["name"])
|
|
2118
|
-
], 2),
|
|
2119
|
-
S.available ? (openBlock(), createElementBlock("span", {
|
|
2120
|
-
key: 0,
|
|
2121
|
-
class: normalizeClass(["flex h-[22px] w-[22px] flex-none items-center justify-center border-2 transition-colors", [
|
|
2122
|
-
unref(d) ? "rounded-full" : "rounded-[4px]",
|
|
2123
|
-
S.checked ? "border-fm-color-primary bg-fm-color-primary text-fm-color-typo-white" : "border-fm-color-neutral-gray-300 bg-fm-color-neutral-white"
|
|
2124
|
-
]])
|
|
2125
|
-
}, [
|
|
2126
|
-
S.checked && !unref(d) ? (openBlock(), createBlock(F, {
|
|
2127
|
-
key: 0,
|
|
2128
|
-
name: "check",
|
|
2129
|
-
size: "sm"
|
|
2130
|
-
})) : S.checked ? (openBlock(), createElementBlock("span", _hoisted_14)) : createCommentVNode("", !0)
|
|
2131
|
-
], 2)) : createCommentVNode("", !0)
|
|
2132
|
-
]),
|
|
2133
|
-
createElementVNode("div", null, [
|
|
2134
|
-
createElementVNode("div", {
|
|
2135
|
-
class: normalizeClass(["fm-typo-en-body-md-600", S.available ? "" : "text-fm-color-typo-disabled"])
|
|
2136
|
-
}, toDisplayString(S.label), 3),
|
|
2137
|
-
S.available && S.rateNote ? (openBlock(), createElementBlock("div", _hoisted_15, toDisplayString(S.rateNote), 1)) : createCommentVNode("", !0),
|
|
2138
|
-
S.available ? S.usedAsFallback ? (openBlock(), createElementBlock("div", _hoisted_17, toDisplayString(unref(o)("connect.campaign.broadcast.usedAsFallback")), 1)) : createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_16, toDisplayString(S.channel === "PUSH" ? unref(i) : unref(o)("connect.campaign.broadcast.notSetUp")), 1))
|
|
2139
|
-
]),
|
|
2140
|
-
S.channel === "WHATSAPP" && !S.available ? (openBlock(), createElementBlock("a", {
|
|
2141
|
-
key: 0,
|
|
2142
|
-
href: Y,
|
|
2143
|
-
target: "_blank",
|
|
2144
|
-
class: "mt-auto fm-typo-en-body-sm-400 text-fm-color-secondary-blueberry underline",
|
|
2145
|
-
onClick: $[0] || ($[0] = withModifiers(() => {
|
|
2146
|
-
}, ["stop"]))
|
|
2147
|
-
}, toDisplayString(unref(o)("connect.campaign.messageInput.manageWhatsappChannel")), 1)) : createCommentVNode("", !0),
|
|
2148
|
-
S.channel === "PUSH" && !S.available ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
2149
|
-
e.pushAvailability === "non-native" ? (openBlock(), createBlock(Q, {
|
|
2150
|
-
key: 0,
|
|
2151
|
-
label: unref(o)("connect.campaign.broadcast.pushAvailability.contactSales"),
|
|
2152
|
-
onClick: withModifiers(u, ["stop"])
|
|
2153
|
-
}, null, 8, ["label"])) : createCommentVNode("", !0),
|
|
2154
|
-
e.pushAvailability === "failed" ? (openBlock(), createBlock(Q, {
|
|
2155
|
-
key: 1,
|
|
2156
|
-
label: unref(o)("connect.campaign.broadcast.pushAvailability.retry"),
|
|
2157
|
-
onClick: $[1] || ($[1] = withModifiers((ee) => s("retry-push"), ["stop"]))
|
|
2158
|
-
}, null, 8, ["label"])) : createCommentVNode("", !0),
|
|
2159
|
-
S.selected ? (openBlock(), createBlock(Q, {
|
|
2160
|
-
key: 2,
|
|
2161
|
-
label: unref(o)("connect.campaign.broadcast.pushAvailability.removePush"),
|
|
2162
|
-
onClick: $[2] || ($[2] = withModifiers((ee) => I("PUSH"), ["stop"]))
|
|
2163
|
-
}, null, 8, ["label"])) : createCommentVNode("", !0)
|
|
2164
|
-
], 64)) : createCommentVNode("", !0)
|
|
2165
|
-
]),
|
|
2166
|
-
_: 2
|
|
2167
|
-
}, 1032, ["class", "aria-disabled", "onClick"]))), 128))
|
|
2168
|
-
]),
|
|
2169
|
-
unref(c).channels.includes("PUSH") && !V("PUSH") ? (openBlock(), createElementBlock("div", _hoisted_18, toDisplayString(unref(o)("connect.campaign.broadcast.pushAvailability.removeBeforeSave")), 1)) : createCommentVNode("", !0),
|
|
2170
|
-
e.showValidation && !unref(c).channels.length ? (openBlock(), createElementBlock("div", _hoisted_19, toDisplayString(unref(o)("connect.campaign.broadcast.selectChannelRequired")), 1)) : createCommentVNode("", !0),
|
|
2171
|
-
unref(d) && unref(c).channels.length ? (openBlock(), createBlock(_sfc_main$h, {
|
|
2172
|
-
key: 2,
|
|
2173
|
-
rows: unref(Z),
|
|
2174
|
-
addable: unref(J),
|
|
2175
|
-
onMove: X,
|
|
2176
|
-
onRemove: I,
|
|
2177
|
-
onAdd: K
|
|
2178
|
-
}, null, 8, ["rows", "addable"])) : createCommentVNode("", !0)
|
|
2179
|
-
]),
|
|
2180
|
-
createElementVNode("div", _hoisted_20, [
|
|
2181
|
-
createElementVNode("div", null, [
|
|
2182
|
-
createElementVNode("div", _hoisted_21, toDisplayString(unref(o)("connect.campaign.broadcast.content")), 1),
|
|
2183
|
-
createElementVNode("div", _hoisted_22, toDisplayString(unref(o)("connect.campaign.broadcast.contentDescription")), 1)
|
|
2184
|
-
]),
|
|
2185
|
-
unref(L).length ? (openBlock(), createBlock(_sfc_main$w, {
|
|
2186
|
-
key: 0,
|
|
2187
|
-
channels: unref(L)
|
|
2188
|
-
}, null, 8, ["channels"])) : createCommentVNode("", !0),
|
|
2189
|
-
unref(c).channels.length ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_23, toDisplayString(unref(o)("connect.campaign.broadcast.noChannelContent")), 1)),
|
|
2190
|
-
unref(c).channels.length ? (openBlock(), createBlock(_sfc_main$j, {
|
|
2191
|
-
key: 2,
|
|
2192
|
-
modelValue: unref(f),
|
|
2193
|
-
"onUpdate:modelValue": $[3] || ($[3] = (S) => isRef(f) ? f.value = S : null),
|
|
2194
|
-
tabs: unref(W)
|
|
2195
|
-
}, null, 8, ["modelValue", "tabs"])) : createCommentVNode("", !0),
|
|
2196
|
-
unref(c).channels.includes(unref(f)) ? (openBlock(), createElementBlock("div", _hoisted_24, [
|
|
2197
|
-
createElementVNode("div", _hoisted_25, [
|
|
2198
|
-
unref(f) === "PUSH" && unref(O) && V("PUSH") ? (openBlock(), createBlock(_sfc_main$k, {
|
|
2199
|
-
key: 0,
|
|
2200
|
-
"model-value": unref(O),
|
|
2201
|
-
"show-validation": e.showValidation,
|
|
2202
|
-
"onUpdate:modelValue": U
|
|
2203
|
-
}, null, 8, ["model-value", "show-validation"])) : unref(f) === "PUSH" ? (openBlock(), createElementBlock("div", _hoisted_26, toDisplayString(unref(i)), 1)) : unref(f) === "APP_INBOX" && unref(T) ? (openBlock(), createBlock(_sfc_main$l, {
|
|
2204
|
-
key: 2,
|
|
2205
|
-
"model-value": unref(T),
|
|
2206
|
-
variables: unref(p),
|
|
2207
|
-
"show-validation": e.showValidation,
|
|
2208
|
-
"onUpdate:modelValue": P
|
|
2209
|
-
}, null, 8, ["model-value", "variables", "show-validation"])) : unref(f) !== "APP_INBOX" ? (openBlock(), createBlock(_sfc_main$x, {
|
|
2210
|
-
key: unref(f),
|
|
2211
|
-
"model-value": unref(B),
|
|
2212
|
-
"allow-email": !1,
|
|
2213
|
-
"allow-whatsapp": !1,
|
|
2214
|
-
"hide-credit-card": !0,
|
|
2215
|
-
"trigger-type": e.triggerType,
|
|
2216
|
-
variables: unref(p),
|
|
2217
|
-
placeholder: e.placeholder,
|
|
2218
|
-
"onUpdate:modelValue": $[4] || ($[4] = (S) => j(unref(b), S))
|
|
2219
|
-
}, null, 8, ["model-value", "trigger-type", "variables", "placeholder"])) : createCommentVNode("", !0)
|
|
2220
|
-
]),
|
|
2221
|
-
createVNode(_sfc_main$i, {
|
|
2222
|
-
target: unref(f),
|
|
2223
|
-
content: unref(c).content[unref(b)],
|
|
2224
|
-
"sender-prefix": unref(G)
|
|
2225
|
-
}, null, 8, ["target", "content", "sender-prefix"])
|
|
2226
|
-
])) : createCommentVNode("", !0)
|
|
2227
|
-
])
|
|
2228
|
-
]);
|
|
2229
|
-
};
|
|
2230
|
-
}
|
|
2231
|
-
}), _hoisted_1$f = { class: "space-y-8" }, _hoisted_2$c = { class: "grid grid-cols-2 gap-16" }, _hoisted_3$9 = {
|
|
2232
|
-
key: 0,
|
|
2233
|
-
class: "space-y-4"
|
|
2234
|
-
}, _hoisted_4$8 = { class: "fm-typo-en-body-lg-400 class flex items-center justify-between" }, _hoisted_5$6 = { class: "text-ellipsis line-clamp-1" }, _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
2235
|
-
__name: "ScheduleRuleInput",
|
|
2236
|
-
props: {
|
|
2237
|
-
modelValue: {
|
|
2238
|
-
type: Object,
|
|
2239
|
-
required: !0
|
|
2240
|
-
},
|
|
2241
|
-
startDate: {
|
|
2242
|
-
type: String
|
|
2243
|
-
},
|
|
2244
|
-
endDate: {
|
|
2245
|
-
type: String
|
|
2246
|
-
}
|
|
2247
|
-
},
|
|
2248
|
-
emits: ["update:model-value"],
|
|
2249
|
-
setup(e, { emit: r }) {
|
|
2250
|
-
const { t: o } = useI18n(), m = e, i = r, u = useCoreStore(), l = computed(
|
|
2251
|
-
() => CountryTimezone[u.currentCountry.value || "MY"]
|
|
2252
|
-
);
|
|
2253
|
-
function n() {
|
|
2254
|
-
const d = RuleBuilder.getRules(m.modelValue);
|
|
2255
|
-
return d.length == 0 ? "fixed" : d.some(
|
|
2256
|
-
(p) => isRuleEntry(p) && RuleBuilder.simplify(p).operator == "_rrule"
|
|
2257
|
-
) ? "repeating" : "fixed";
|
|
2258
|
-
}
|
|
2259
|
-
const a = ref(n()), s = ref(!1), v = ref(!1), f = computed(() => [
|
|
2260
|
-
{ label: o("connect.template.rule.schedule.fixed"), value: "fixed" },
|
|
2261
|
-
{ label: o("connect.template.rule.schedule.repeating"), value: "repeating" }
|
|
2262
|
-
]), c = computed(() => {
|
|
2263
|
-
const d = RuleBuilder.getRules(m.modelValue), p = d.find(
|
|
2264
|
-
(V) => isRuleEntry(V) && RuleBuilder.simplify(V).property == "trigger.date"
|
|
2265
|
-
), C = d.find(
|
|
2266
|
-
(V) => isRuleEntry(V) && RuleBuilder.simplify(V).property == "trigger.time"
|
|
2267
|
-
);
|
|
2268
|
-
return {
|
|
2269
|
-
date: p ? RuleBuilder.simplify(p).equator : null,
|
|
2270
|
-
time: C ? RuleBuilder.simplify(C).equator : null
|
|
2271
|
-
};
|
|
2272
|
-
}), k = computed(
|
|
2273
|
-
() => calculateNextScheduleAt(
|
|
2274
|
-
m.modelValue,
|
|
2275
|
-
/* @__PURE__ */ new Date(),
|
|
2276
|
-
m.startDate ? new Date(m.startDate) : /* @__PURE__ */ new Date(),
|
|
2277
|
-
m.endDate ? new Date(m.endDate) : void 0
|
|
2278
|
-
)
|
|
2279
|
-
);
|
|
2280
|
-
function x(d, p) {
|
|
2281
|
-
i(
|
|
2282
|
-
"update:model-value",
|
|
2283
|
-
RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup("g_schedule"), [
|
|
2284
|
-
RuleBuilder.constructEntry("trigger.date", "_rrule", d),
|
|
2285
|
-
RuleBuilder.constructEntry("trigger.time", "_isOnTime", p ?? "00:00")
|
|
2286
|
-
])
|
|
2287
|
-
);
|
|
2288
|
-
}
|
|
2289
|
-
watch(
|
|
2290
|
-
() => m.startDate,
|
|
2291
|
-
(d, p) => {
|
|
2292
|
-
if (!d || d === p || a.value !== "repeating" || !c.value.date) return;
|
|
2293
|
-
const C = RRule.fromString(c.value.date), V = new RRule({
|
|
2294
|
-
...C.origOptions,
|
|
2295
|
-
dtstart: new Date(d)
|
|
2296
|
-
}).toString();
|
|
2297
|
-
V !== c.value.date && (x(V, c.value.time), v.value = !0);
|
|
2298
|
-
}
|
|
2299
|
-
);
|
|
2300
|
-
function h(d) {
|
|
2301
|
-
const p = d.value, C = getRruleAnchorDate({
|
|
2302
|
-
startDate: m.startDate ? new Date(m.startDate) : void 0
|
|
2303
|
-
}), V = p == "fixed" ? [
|
|
2304
|
-
RuleBuilder.constructEntry(
|
|
2305
|
-
"trigger.date",
|
|
2306
|
-
"_isOnDate",
|
|
2307
|
-
(/* @__PURE__ */ new Date()).toISOString()
|
|
2308
|
-
),
|
|
2309
|
-
RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
|
|
2310
|
-
] : [
|
|
2311
|
-
RuleBuilder.constructEntry(
|
|
2312
|
-
"trigger.date",
|
|
2313
|
-
"_rrule",
|
|
2314
|
-
new RRule({
|
|
2315
|
-
dtstart: C,
|
|
2316
|
-
freq: RRule.DAILY,
|
|
2317
|
-
interval: 1,
|
|
2318
|
-
byhour: 0,
|
|
2319
|
-
byminute: 0,
|
|
2320
|
-
bysecond: 0,
|
|
2321
|
-
wkst: RRule.SU
|
|
2322
|
-
}).toString()
|
|
2323
|
-
),
|
|
2324
|
-
RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
|
|
2325
|
-
];
|
|
2326
|
-
i(
|
|
2327
|
-
"update:model-value",
|
|
2328
|
-
RuleBuilder.setRuleToGroup(
|
|
2329
|
-
RuleBuilder.scaffoldGroup("g_schedule"),
|
|
2330
|
-
V
|
|
2331
|
-
)
|
|
2332
|
-
), a.value = p, v.value = !1;
|
|
2333
|
-
}
|
|
2334
|
-
function g(d) {
|
|
2335
|
-
a.value == "fixed" ? i(
|
|
2336
|
-
"update:model-value",
|
|
2337
|
-
RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup("g_schedule"), [
|
|
2338
|
-
RuleBuilder.constructEntry(
|
|
2339
|
-
"trigger.date",
|
|
2340
|
-
"_isOnDate",
|
|
2341
|
-
d.date
|
|
2342
|
-
),
|
|
2343
|
-
RuleBuilder.constructEntry(
|
|
2344
|
-
"trigger.time",
|
|
2345
|
-
"_isOnTime",
|
|
2346
|
-
d.time
|
|
2347
|
-
)
|
|
2348
|
-
])
|
|
2349
|
-
) : x(d.date, d.time), v.value = !1;
|
|
2350
|
-
}
|
|
2351
|
-
return (d, p) => {
|
|
2352
|
-
const C = resolveComponent("FmButtonGroup"), V = resolveComponent("FmTimePicker"), N = resolveComponent("FmIcon"), R = resolveComponent("FmTooltip"), E = resolveComponent("FmField"), D = resolveComponent("FmCard"), w = resolveComponent("FmPopover"), A = resolveComponent("FmDatePicker"), H = resolveComponent("FmHelperText");
|
|
2353
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
2354
|
-
createVNode(C, {
|
|
2355
|
-
items: unref(f),
|
|
2356
|
-
"model-value": unref(f).find((I) => I.value === unref(a)) ?? null,
|
|
2357
|
-
"onUpdate:modelValue": h,
|
|
2358
|
-
class: "mb-8"
|
|
2359
|
-
}, null, 8, ["items", "model-value"]),
|
|
2360
|
-
createElementVNode("div", _hoisted_1$f, [
|
|
2361
|
-
createElementVNode("div", _hoisted_2$c, [
|
|
2362
|
-
createVNode(V, {
|
|
2363
|
-
label: unref(o)("connect.template.rule.schedule.notify_time"),
|
|
2364
|
-
"model-value": unref(c).time,
|
|
2365
|
-
"onUpdate:modelValue": p[0] || (p[0] = (I) => g({ date: unref(c).date, time: I })),
|
|
2366
|
-
"helper-text": unref(c).time ? void 0 : unref(o)("connect.template.rule.schedule.time_required"),
|
|
2367
|
-
"helper-state": unref(c).time ? void 0 : "error"
|
|
2368
|
-
}, null, 8, ["label", "model-value", "helper-text", "helper-state"]),
|
|
2369
|
-
unref(a) == "repeating" ? (openBlock(), createElementBlock("div", _hoisted_3$9, [
|
|
2370
|
-
createElementVNode("div", _hoisted_4$8, [
|
|
2371
|
-
createElementVNode("div", null, toDisplayString(unref(o)("connect.template.rule.schedule.notify_date")), 1),
|
|
2372
|
-
unref(c).date ? (openBlock(), createBlock(R, {
|
|
2373
|
-
key: 0,
|
|
2374
|
-
"z-index": 9999,
|
|
2375
|
-
content: unref(SummarizeRrule)(unref(RRule).fromString(unref(c).date).options)
|
|
2376
|
-
}, {
|
|
2377
|
-
default: withCtx(() => [
|
|
2378
|
-
createVNode(N, {
|
|
2379
|
-
name: "info",
|
|
2380
|
-
size: "sm",
|
|
2381
|
-
outline: !0
|
|
2382
|
-
})
|
|
2383
|
-
]),
|
|
2384
|
-
_: 1
|
|
2385
|
-
}, 8, ["content"])) : createCommentVNode("", !0)
|
|
2386
|
-
]),
|
|
2387
|
-
createVNode(w, {
|
|
2388
|
-
"show-popover": unref(s),
|
|
2389
|
-
onPopoverChanged: p[3] || (p[3] = (I) => s.value = I)
|
|
2390
|
-
}, {
|
|
2391
|
-
"popover-button": withCtx(() => [
|
|
2392
|
-
createVNode(E, {
|
|
2393
|
-
class: "cursor-pointer",
|
|
2394
|
-
"helper-text": unref(c).date ? void 0 : unref(o)("connect.template.rule.schedule.date_required"),
|
|
2395
|
-
"helper-state": unref(c).date ? void 0 : "error"
|
|
2396
|
-
}, {
|
|
2397
|
-
default: withCtx(() => [
|
|
2398
|
-
createElementVNode("div", _hoisted_5$6, toDisplayString(unref(c).date ? unref(SummarizeRrule)(unref(RRule).fromString(unref(c).date).options) : unref(o)("connect.template.rule.schedule.set_repeating_date")), 1)
|
|
2399
|
-
]),
|
|
2400
|
-
_: 1
|
|
2401
|
-
}, 8, ["helper-text", "helper-state"])
|
|
2402
|
-
]),
|
|
2403
|
-
default: withCtx(() => [
|
|
2404
|
-
createVNode(D, { class: "elevated p-8 w-[450px]" }, {
|
|
2405
|
-
default: withCtx(() => [
|
|
2406
|
-
createVNode(_sfc_main$y, {
|
|
2407
|
-
"apply-button": !0,
|
|
2408
|
-
"model-value": unref(c).date || "",
|
|
2409
|
-
"start-date": e.startDate ? new Date(e.startDate) : /* @__PURE__ */ new Date(),
|
|
2410
|
-
onCancel: p[1] || (p[1] = (I) => s.value = !1),
|
|
2411
|
-
"onUpdate:modelValue": p[2] || (p[2] = (I) => (g({ date: I, time: unref(c).time }), s.value = !1))
|
|
2412
|
-
}, null, 8, ["model-value", "start-date"])
|
|
2413
|
-
]),
|
|
2414
|
-
_: 1
|
|
2415
|
-
})
|
|
2416
|
-
]),
|
|
2417
|
-
_: 1
|
|
2418
|
-
}, 8, ["show-popover"])
|
|
2419
|
-
])) : (openBlock(), createBlock(A, {
|
|
2420
|
-
key: 1,
|
|
2421
|
-
label: unref(o)("connect.template.rule.schedule.notify_date"),
|
|
2422
|
-
"model-value": unref(c).date || "",
|
|
2423
|
-
"onUpdate:modelValue": p[4] || (p[4] = (I) => g({ date: I, time: unref(c).time })),
|
|
2424
|
-
"helper-text": unref(c).date ? void 0 : unref(o)("connect.template.rule.schedule.date_required"),
|
|
2425
|
-
"helper-state": unref(c).date ? void 0 : "error"
|
|
2426
|
-
}, null, 8, ["label", "model-value", "helper-text", "helper-state"]))
|
|
2427
|
-
]),
|
|
2428
|
-
unref(c).date && unref(c).time && unref(k) ? (openBlock(), createBlock(H, {
|
|
2429
|
-
key: 0,
|
|
2430
|
-
text: `${unref(moment)(unref(k)).isAfter(unref(moment)()) ? unref(o)("connect.template.rule.schedule.next_notification") : unref(o)("connect.template.rule.schedule.last_trigger_on")} ${unref(moment)(unref(k)).format("dddd, DD MMM YYYY")} at
|
|
2431
|
-
${unref(moment)(unref(k)).format("hh:mmA")}(UTC${unref(moment).tz(unref(l)).format("Z")}) (${unref(moment)(unref(k)).fromNow()})`
|
|
2432
|
-
}, null, 8, ["text"])) : createCommentVNode("", !0),
|
|
2433
|
-
unref(v) ? (openBlock(), createBlock(H, {
|
|
2434
|
-
key: 1,
|
|
2435
|
-
text: "Repeating schedule was updated to stay anchored to the campaign start date.",
|
|
2436
|
-
state: "warning"
|
|
2437
|
-
})) : createCommentVNode("", !0)
|
|
2438
|
-
])
|
|
2439
|
-
], 64);
|
|
2440
|
-
};
|
|
2441
|
-
}
|
|
2442
|
-
}), _hoisted_1$e = { class: "space-y-16" }, _hoisted_2$b = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_3$8 = { class: "grid grid-cols-2 gap-16" }, _hoisted_4$7 = { class: "fm-typo-en-title-sm-800" }, _hoisted_5$5 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
2443
|
-
__name: "GameTypeInput",
|
|
2444
|
-
props: {
|
|
2445
|
-
modelValue: {
|
|
2446
|
-
type: String
|
|
2447
|
-
}
|
|
2448
|
-
},
|
|
2449
|
-
emits: ["update:model-value"],
|
|
2450
|
-
setup(e, { emit: r }) {
|
|
2451
|
-
const { t: o } = useI18n(), m = e, i = r, u = computed(
|
|
2452
|
-
() => [
|
|
2453
|
-
{
|
|
2454
|
-
label: o("connect.campaign.gameType.option.FORTUNE_WHEEL.label"),
|
|
2455
|
-
description: o("connect.campaign.gameType.option.FORTUNE_WHEEL.description"),
|
|
2456
|
-
value: F_GAME_TYPE.enum.FORTUNE_WHEEL,
|
|
2457
|
-
hidden: !1
|
|
2458
|
-
},
|
|
2459
|
-
{
|
|
2460
|
-
label: o("connect.campaign.gameType.option.ROCK_PAPER_SCISSORS.label"),
|
|
2461
|
-
description: o("connect.campaign.gameType.option.ROCK_PAPER_SCISSORS.description"),
|
|
2462
|
-
value: F_GAME_TYPE.enum.ROCK_PAPER_SCISSORS,
|
|
2463
|
-
hidden: !0
|
|
2464
|
-
}
|
|
2465
|
-
].filter((l) => !l.hidden)
|
|
2466
|
-
);
|
|
2467
|
-
return (l, n) => {
|
|
2468
|
-
const a = resolveComponent("FmCard");
|
|
2469
|
-
return openBlock(), createElementBlock("div", _hoisted_1$e, [
|
|
2470
|
-
createElementVNode("div", _hoisted_2$b, toDisplayString(unref(o)("connect.template.select_game")), 1),
|
|
2471
|
-
createElementVNode("div", _hoisted_3$8, [
|
|
2472
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (s) => (openBlock(), createBlock(a, {
|
|
2473
|
-
variant: "outlined",
|
|
2474
|
-
class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
|
|
2475
|
-
"col-span-2": unref(u).length == 1,
|
|
2476
|
-
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == s.value,
|
|
2477
|
-
"hover:bg-fm-color-opacity-sm": e.modelValue != s.value
|
|
2478
|
-
}]),
|
|
2479
|
-
onClick: () => {
|
|
2480
|
-
m.modelValue != s.value && i("update:model-value", s.value);
|
|
2481
|
-
},
|
|
2482
|
-
key: s.value
|
|
2483
|
-
}, {
|
|
2484
|
-
default: withCtx(() => [
|
|
2485
|
-
createElementVNode("div", _hoisted_4$7, toDisplayString(s.label), 1),
|
|
2486
|
-
createElementVNode("div", _hoisted_5$5, toDisplayString(s.description), 1)
|
|
2487
|
-
]),
|
|
2488
|
-
_: 2
|
|
2489
|
-
}, 1032, ["class", "onClick"]))), 128))
|
|
2490
|
-
])
|
|
2491
|
-
]);
|
|
2492
|
-
};
|
|
2493
|
-
}
|
|
2494
|
-
}), _hoisted_1$d = {
|
|
2495
|
-
key: 0,
|
|
2496
|
-
class: "flex flex-col gap-y-24"
|
|
2497
|
-
}, _hoisted_2$a = { class: "flex gap-8 items-center justify-start" }, _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
2498
|
-
__name: "EditRewardPoolSheet",
|
|
2499
|
-
emits: ["update:model-value"],
|
|
2500
|
-
setup(e, { expose: r, emit: o }) {
|
|
2501
|
-
const m = useMembershipStore(), { minor: i } = useLoading, u = ref(!1), l = ref(), n = ref(), a = ref(0), s = computed(() => {
|
|
2502
|
-
var h;
|
|
2503
|
-
return ((h = m.loyaltyRewards.items.find(
|
|
2504
|
-
(g) => {
|
|
2505
|
-
var d;
|
|
2506
|
-
return g.value === ((d = l.value) == null ? void 0 : d.collectible);
|
|
2507
|
-
}
|
|
2508
|
-
)) == null ? void 0 : h.raw.type) === "CREDIT" ? FdoCreditLoyaltyReward : FdtoRandomReward;
|
|
2509
|
-
}), v = computed(() => {
|
|
2510
|
-
const x = s.value.safeParse(l.value);
|
|
2511
|
-
return x.success ? [] : x.error.errors;
|
|
2512
|
-
});
|
|
2513
|
-
function f(x, h, g) {
|
|
2514
|
-
x && (l.value = h, a.value = g), u.value = x;
|
|
2515
|
-
}
|
|
2516
|
-
const c = o;
|
|
2517
|
-
async function k() {
|
|
2518
|
-
const x = s.value.safeParse(l.value);
|
|
2519
|
-
x.success && (await i(
|
|
2520
|
-
async () => {
|
|
2521
|
-
x.data.type === "VOUCHER" && n.value && (x.data.collectibleConfig.image = await firebaseStorage.update(
|
|
2522
|
-
x.data.collectibleConfig.image || firebaseStorage.collectibleImagePath(void 0, n.value),
|
|
2523
|
-
n.value
|
|
2524
|
-
));
|
|
2525
|
-
},
|
|
2526
|
-
{
|
|
2527
|
-
message: "Uploading reward image",
|
|
2528
|
-
successMessage: "Reward image updated"
|
|
2529
|
-
}
|
|
2530
|
-
), c("update:model-value", x.data, a.value));
|
|
2531
|
-
}
|
|
2532
|
-
return r({
|
|
2533
|
-
showSheet: f
|
|
2534
|
-
}), (x, h) => {
|
|
2535
|
-
const g = resolveComponent("FmSelect"), d = resolveComponent("FmStepperField"), p = resolveComponent("FmButton"), C = resolveComponent("FmSideSheet");
|
|
2536
|
-
return openBlock(), createBlock(C, {
|
|
2537
|
-
"max-width": 560,
|
|
2538
|
-
modelValue: unref(u),
|
|
2539
|
-
"onUpdate:modelValue": [
|
|
2540
|
-
h[9] || (h[9] = (V) => isRef(u) ? u.value = V : null),
|
|
2541
|
-
h[10] || (h[10] = (V) => u.value = V)
|
|
2542
|
-
],
|
|
2543
|
-
header: "Edit reward",
|
|
2544
|
-
"dismiss-away": ""
|
|
2545
|
-
}, {
|
|
2546
|
-
"side-sheet-footer": withCtx(() => [
|
|
2547
|
-
createElementVNode("div", _hoisted_2$a, [
|
|
2548
|
-
createVNode(p, {
|
|
2549
|
-
variant: "primary",
|
|
2550
|
-
type: "button",
|
|
2551
|
-
disabled: unref(v).length > 0,
|
|
2552
|
-
label: "Confirm",
|
|
2553
|
-
onClick: h[7] || (h[7] = (V) => k())
|
|
2554
|
-
}, null, 8, ["disabled"]),
|
|
2555
|
-
createVNode(p, {
|
|
2556
|
-
variant: "secondary",
|
|
2557
|
-
type: "button",
|
|
2558
|
-
label: "Cancel",
|
|
2559
|
-
onClick: h[8] || (h[8] = (V) => u.value = !1)
|
|
2560
|
-
})
|
|
2561
|
-
])
|
|
2562
|
-
]),
|
|
2563
|
-
default: withCtx(() => {
|
|
2564
|
-
var V, N, R;
|
|
2565
|
-
return [
|
|
2566
|
-
unref(l) ? (openBlock(), createElementBlock("div", _hoisted_1$d, [
|
|
2567
|
-
createVNode(g, {
|
|
2568
|
-
label: "Reward Type",
|
|
2569
|
-
items: [
|
|
2570
|
-
{ label: "No Reward", value: "NO_REWARD" },
|
|
2571
|
-
{ label: "Voucher", value: "VOUCHER" },
|
|
2572
|
-
{ label: "Loyalty", value: "LOYALTY" }
|
|
2573
|
-
],
|
|
2574
|
-
"model-value": unref(l).type,
|
|
2575
|
-
"onUpdate:modelValue": h[0] || (h[0] = (E) => {
|
|
2576
|
-
E == "NO_REWARD" ? l.value = {
|
|
2577
|
-
type: "NO_REWARD",
|
|
2578
|
-
collectible: null,
|
|
2579
|
-
weight: 1
|
|
2580
|
-
} : E === "VOUCHER" ? l.value = {
|
|
2581
|
-
collectible: null,
|
|
2582
|
-
type: "VOUCHER",
|
|
2583
|
-
collectibleConfig: unref(initCollectibleConfig)("VOUCHER", {
|
|
2584
|
-
business: unref(useCoreStore)().currentBusiness.value._id
|
|
2585
|
-
}),
|
|
2586
|
-
earningOption: {
|
|
2587
|
-
amount: 1,
|
|
2588
|
-
type: "FIXED"
|
|
2589
|
-
},
|
|
2590
|
-
validityOption: {
|
|
2591
|
-
validForDay: 7
|
|
2592
|
-
},
|
|
2593
|
-
weight: 1
|
|
2594
|
-
} : l.value = {
|
|
2595
|
-
collectible: unref(m).loyaltyRewards.raw[0]._id,
|
|
2596
|
-
type: "LOYALTY",
|
|
2597
|
-
earningOption: {
|
|
2598
|
-
amount: 1,
|
|
2599
|
-
type: "FIXED"
|
|
2600
|
-
},
|
|
2601
|
-
validityOption: {
|
|
2602
|
-
validForDay: 7
|
|
2603
|
-
},
|
|
2604
|
-
weight: 1
|
|
2605
|
-
};
|
|
2606
|
-
})
|
|
2607
|
-
}, null, 8, ["model-value"]),
|
|
2608
|
-
unref(l).type == "LOYALTY" ? (openBlock(), createBlock(g, {
|
|
2609
|
-
key: 0,
|
|
2610
|
-
label: "Loyalty type",
|
|
2611
|
-
rules: [unref(ZodHelper).ruleAtPath(unref(s), "collectible", [unref(l).type])],
|
|
2612
|
-
items: unref(m).loyaltyRewards.items,
|
|
2613
|
-
"model-value": unref(l).collectible,
|
|
2614
|
-
"onUpdate:modelValue": h[1] || (h[1] = (E) => unref(l).collectible = E)
|
|
2615
|
-
}, null, 8, ["rules", "items", "model-value"])) : createCommentVNode("", !0),
|
|
2616
|
-
createVNode(d, {
|
|
2617
|
-
label: "Weight",
|
|
2618
|
-
rules: [unref(ZodHelper).ruleAtPath(unref(s), "weight", [unref(l).type])],
|
|
2619
|
-
"model-value": unref(l).weight,
|
|
2620
|
-
"onUpdate:modelValue": h[2] || (h[2] = (E) => l.value = {
|
|
2621
|
-
...unref(l),
|
|
2622
|
-
weight: E
|
|
2623
|
-
})
|
|
2624
|
-
}, null, 8, ["rules", "model-value"]),
|
|
2625
|
-
unref(l).type === "LOYALTY" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
2626
|
-
((V = unref(m).loyaltyRewards.items.find(
|
|
2627
|
-
(E) => {
|
|
2628
|
-
var D;
|
|
2629
|
-
return E.value === ((D = unref(l)) == null ? void 0 : D.collectible);
|
|
2630
|
-
}
|
|
2631
|
-
)) == null ? void 0 : V.raw.type) !== "TITLE" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2632
|
-
h[11] || (h[11] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
|
|
2633
|
-
createVNode(_sfc_main$z, {
|
|
2634
|
-
class: "mt-[-8px]",
|
|
2635
|
-
rules: [
|
|
2636
|
-
unref(ZodHelper).ruleAtPath(unref(s), "earningOption", [unref(l).type])
|
|
2637
|
-
],
|
|
2638
|
-
"helper-state": unref(ZodHelper).helperState(unref(v), "earningOption"),
|
|
2639
|
-
"error-text": unref(ZodHelper).helperText(unref(v), "earningOption"),
|
|
2640
|
-
"fixed-type": !0,
|
|
2641
|
-
"model-value": unref(l).earningOption,
|
|
2642
|
-
"onUpdate:modelValue": h[3] || (h[3] = (E) => l.value = {
|
|
2643
|
-
...unref(l),
|
|
2644
|
-
earningOption: E
|
|
2645
|
-
})
|
|
2646
|
-
}, null, 8, ["rules", "helper-state", "error-text", "model-value"])
|
|
2647
|
-
], 64)) : createCommentVNode("", !0),
|
|
2648
|
-
h[12] || (h[12] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Validity option", -1)),
|
|
2649
|
-
createVNode(_sfc_main$A, {
|
|
2650
|
-
type: unref(l).type === "LOYALTY" ? "custom" : "range",
|
|
2651
|
-
"for-credit": unref(l).type === "LOYALTY" && ((N = unref(m).loyaltyRewards.items.find(
|
|
2652
|
-
(E) => {
|
|
2653
|
-
var D;
|
|
2654
|
-
return E.value === ((D = unref(l)) == null ? void 0 : D.collectible);
|
|
2655
|
-
}
|
|
2656
|
-
)) == null ? void 0 : N.raw.type) === "CREDIT",
|
|
2657
|
-
class: "!gap-24",
|
|
2658
|
-
rules: [unref(ZodHelper).ruleAtPath(unref(s), "validityOption", [unref(l).type])],
|
|
2659
|
-
"model-value": unref(l).validityOption,
|
|
2660
|
-
"onUpdate:modelValue": h[4] || (h[4] = (E) => l.value = {
|
|
2661
|
-
...unref(l),
|
|
2662
|
-
validityOption: E
|
|
2663
|
-
})
|
|
2664
|
-
}, null, 8, ["type", "for-credit", "rules", "model-value"])
|
|
2665
|
-
], 64)) : createCommentVNode("", !0),
|
|
2666
|
-
unref(l).type === "VOUCHER" ? (openBlock(), createBlock(_sfc_main$B, {
|
|
2667
|
-
key: 2,
|
|
2668
|
-
"reward-image": unref(n),
|
|
2669
|
-
"model-value": ((R = unref(l)) == null ? void 0 : R.collectibleConfig) ?? void 0,
|
|
2670
|
-
"onUpdate:modelValue": h[5] || (h[5] = (E) => l.value = {
|
|
2671
|
-
...unref(l),
|
|
2672
|
-
collectibleConfig: E
|
|
2673
|
-
}),
|
|
2674
|
-
"onUpdate:rewardImage": h[6] || (h[6] = (E) => n.value = E)
|
|
2675
|
-
}, null, 8, ["reward-image", "model-value"])) : createCommentVNode("", !0),
|
|
2676
|
-
createVNode(JsonViewer, { json: unref(v) }, null, 8, ["json"])
|
|
2677
|
-
])) : createCommentVNode("", !0)
|
|
2678
|
-
];
|
|
2679
|
-
}),
|
|
2680
|
-
_: 1
|
|
2681
|
-
}, 8, ["modelValue"]);
|
|
2682
|
-
};
|
|
2683
|
-
}
|
|
2684
|
-
});
|
|
2685
|
-
function isNullOrEmpty(e) {
|
|
2686
|
-
return e == null || e === "";
|
|
2687
|
-
}
|
|
2688
|
-
const _hoisted_1$c = { class: "space-y-16" }, _hoisted_2$9 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_3$7 = { class: "fm-typo-en-body-lg-400" }, _hoisted_4$6 = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
2689
|
-
__name: "RewardPoolInput",
|
|
2690
|
-
props: {
|
|
2691
|
-
modelValue: {
|
|
2692
|
-
type: Array,
|
|
2693
|
-
default: () => [
|
|
2694
|
-
{
|
|
2695
|
-
collectible: null,
|
|
2696
|
-
type: "NO_REWARD",
|
|
2697
|
-
weight: 1
|
|
2698
|
-
}
|
|
2699
|
-
]
|
|
2700
|
-
}
|
|
2701
|
-
},
|
|
2702
|
-
emits: ["update:model-value"],
|
|
2703
|
-
setup(e, { emit: r }) {
|
|
2704
|
-
const o = e, m = r, i = useMembershipStore(), { t: u } = useI18n(), l = z.array(z.lazy(() => FdtoRandomReward)).min(1, "Requires at least 1 reward"), n = computed(() => o.modelValue ?? []), a = computed(() => {
|
|
2705
|
-
const h = l.safeParse(n.value);
|
|
2706
|
-
return h.success ? [] : h.error.errors;
|
|
2707
|
-
}), s = ref();
|
|
2708
|
-
function v(h, g) {
|
|
2709
|
-
var p;
|
|
2710
|
-
const d = [...n.value];
|
|
2711
|
-
d[g] = h, (p = s.value) == null || p.showSheet(!1), m("update:model-value", d);
|
|
2712
|
-
}
|
|
2713
|
-
function f(h) {
|
|
2714
|
-
const g = h.type == "VOUCHER" ? h.collectibleConfig : i.collectibles.find(
|
|
2715
|
-
(C) => C._id.toString() == h.collectible
|
|
2716
|
-
), d = CollectionUtils.formattedType((g == null ? void 0 : g.name) || ""), p = h.weight;
|
|
2717
|
-
return {
|
|
2718
|
-
label: isNullOrEmpty(d) ? "NO REWARD" : d,
|
|
2719
|
-
sublabel: `${p} (${(p / n.value.reduce((C, V) => C + V.weight, 0) * 100).toFixed(2)}%)`
|
|
2720
|
-
};
|
|
2721
|
-
}
|
|
2722
|
-
function c(h) {
|
|
2723
|
-
var d;
|
|
2724
|
-
const g = [...n.value];
|
|
2725
|
-
(d = s.value) == null || d.showSheet(!0, g[h], h);
|
|
2726
|
-
}
|
|
2727
|
-
function k(h) {
|
|
2728
|
-
const g = [...n.value];
|
|
2729
|
-
g.splice(h, 1), m("update:model-value", g);
|
|
2730
|
-
}
|
|
2731
|
-
function x() {
|
|
2732
|
-
var h;
|
|
2733
|
-
(h = s.value) == null || h.showSheet(
|
|
2734
|
-
!0,
|
|
2735
|
-
{
|
|
2736
|
-
type: "NO_REWARD",
|
|
2737
|
-
collectible: null,
|
|
2738
|
-
weight: 1
|
|
2739
|
-
},
|
|
2740
|
-
n.value.length
|
|
2741
|
-
);
|
|
2742
|
-
}
|
|
2743
|
-
return (h, g) => {
|
|
2744
|
-
const d = resolveComponent("FmButton"), p = resolveComponent("FmCard"), C = resolveComponent("FmHelperText");
|
|
2745
|
-
return openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
2746
|
-
createElementVNode("div", _hoisted_2$9, toDisplayString(unref(u)("connect.template.configure_reward_type")), 1),
|
|
2747
|
-
createVNode(d, {
|
|
2748
|
-
label: unref(u)("connect.campaign.rewardPool.addReward"),
|
|
2749
|
-
onClick: g[0] || (g[0] = (V) => x()),
|
|
2750
|
-
variant: "plain",
|
|
2751
|
-
icon: "add"
|
|
2752
|
-
}, null, 8, ["label"]),
|
|
2753
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(n), (V, N) => (openBlock(), createBlock(p, {
|
|
2754
|
-
key: N,
|
|
2755
|
-
class: "px-16 py-12 flex items-center justify-between cursor-pointer",
|
|
2756
|
-
variant: "outlined",
|
|
2757
|
-
onClick: (R) => c(N)
|
|
2758
|
-
}, {
|
|
2759
|
-
default: withCtx(() => {
|
|
2760
|
-
var R;
|
|
2761
|
-
return [
|
|
2762
|
-
createElementVNode("div", null, [
|
|
2763
|
-
createElementVNode("div", _hoisted_3$7, toDisplayString(V.type == "LOYALTY" ? (R = V == null ? void 0 : V.earningOption) == null ? void 0 : R.amount : "") + " " + toDisplayString(f(V).label), 1),
|
|
2764
|
-
createElementVNode("div", _hoisted_4$6, toDisplayString(f(V).sublabel), 1)
|
|
2765
|
-
]),
|
|
2766
|
-
createVNode(d, {
|
|
2767
|
-
icon: "delete",
|
|
2768
|
-
variant: "tertiary",
|
|
2769
|
-
onClick: (E) => (E.stopPropagation(), k(N))
|
|
2770
|
-
}, null, 8, ["onClick"])
|
|
2771
|
-
];
|
|
2772
|
-
}),
|
|
2773
|
-
_: 2
|
|
2774
|
-
}, 1032, ["onClick"]))), 128)),
|
|
2775
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(a).filter((V) => V.path.join(".") == ""), (V) => (openBlock(), createBlock(C, {
|
|
2776
|
-
key: V.message,
|
|
2777
|
-
text: V.message,
|
|
2778
|
-
state: "error"
|
|
2779
|
-
}, null, 8, ["text"]))), 128)),
|
|
2780
|
-
createVNode(_sfc_main$d, {
|
|
2781
|
-
ref_key: "sheetRef",
|
|
2782
|
-
ref: s,
|
|
2783
|
-
"onUpdate:modelValue": v
|
|
2784
|
-
}, null, 512)
|
|
2785
|
-
]);
|
|
2786
|
-
};
|
|
2787
|
-
}
|
|
2788
|
-
}), _hoisted_1$b = { class: "space-y-16" }, _hoisted_2$8 = {
|
|
2789
|
-
key: 0,
|
|
2790
|
-
class: "grid grid-cols-2 gap-16"
|
|
2791
|
-
}, _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({
|
|
2792
|
-
__name: "PromotionGameTypeInput",
|
|
2793
|
-
props: {
|
|
2794
|
-
modelValue: {
|
|
2795
|
-
type: Object
|
|
2796
|
-
}
|
|
2797
|
-
},
|
|
2798
|
-
emits: ["update:model-value"],
|
|
2799
|
-
setup(e, { emit: r }) {
|
|
2800
|
-
const { t: o } = useI18n(), m = e, i = r, u = computed(() => [
|
|
2801
|
-
{
|
|
2802
|
-
label: o("connect.template.promotion_game.rock_paper_scissors.label"),
|
|
2803
|
-
description: o("connect.template.promotion_game.rock_paper_scissors.description"),
|
|
2804
|
-
value: F_GAME_TYPE.enum.ROCK_PAPER_SCISSORS
|
|
2805
|
-
}
|
|
2806
|
-
]);
|
|
2807
|
-
return (l, n) => {
|
|
2808
|
-
var f, c, k;
|
|
2809
|
-
const a = resolveComponent("FmSwitch"), s = resolveComponent("FmCard"), v = resolveComponent("FmHelperText");
|
|
2810
|
-
return openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
2811
|
-
createVNode(a, {
|
|
2812
|
-
label: unref(o)("connect.template.promotion_game.enable"),
|
|
2813
|
-
"model-value": !!((f = e.modelValue) != null && f.gameType),
|
|
2814
|
-
"onUpdate:modelValue": n[0] || (n[0] = (x) => x ? i("update:model-value", { gameType: "ROCK_PAPER_SCISSORS" }) : i("update:model-value", null))
|
|
2815
|
-
}, null, 8, ["label", "model-value"]),
|
|
2816
|
-
((c = e.modelValue) == null ? void 0 : c.gameType) == "ROCK_PAPER_SCISSORS" ? (openBlock(), createElementBlock("div", _hoisted_2$8, [
|
|
2817
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (x) => {
|
|
2818
|
-
var h, g;
|
|
2819
|
-
return openBlock(), createBlock(s, {
|
|
2820
|
-
variant: "outlined",
|
|
2821
|
-
class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
|
|
2822
|
-
"col-span-2": unref(u).length == 1,
|
|
2823
|
-
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": ((h = e.modelValue) == null ? void 0 : h.gameType) == x.value,
|
|
2824
|
-
"hover:bg-fm-color-opacity-sm": ((g = e.modelValue) == null ? void 0 : g.gameType) != x.value
|
|
2825
|
-
}]),
|
|
2826
|
-
onClick: () => {
|
|
2827
|
-
var d;
|
|
2828
|
-
((d = m.modelValue) == null ? void 0 : d.gameType) != x.value && i("update:model-value", { gameType: x.value });
|
|
2829
|
-
},
|
|
2830
|
-
key: x.value
|
|
2831
|
-
}, {
|
|
2832
|
-
default: withCtx(() => [
|
|
2833
|
-
createElementVNode("div", _hoisted_3$6, toDisplayString(x.label), 1),
|
|
2834
|
-
createElementVNode("div", _hoisted_4$5, toDisplayString(x.description), 1)
|
|
2835
|
-
]),
|
|
2836
|
-
_: 2
|
|
2837
|
-
}, 1032, ["class", "onClick"]);
|
|
2838
|
-
}), 128))
|
|
2839
|
-
])) : createCommentVNode("", !0),
|
|
2840
|
-
((k = e.modelValue) == null ? void 0 : k.gameType) == "ROCK_PAPER_SCISSORS" ? (openBlock(), createBlock(v, {
|
|
2841
|
-
key: 1,
|
|
2842
|
-
text: unref(o)("connect.template.promotion_game.rock_paper_scissors.warning"),
|
|
2843
|
-
state: "warning"
|
|
2844
|
-
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
2845
|
-
]);
|
|
2846
|
-
};
|
|
2847
|
-
}
|
|
2848
|
-
}), _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$4 = { class: "fm-typo-en-body-lg-600" }, _hoisted_6$3 = { class: "flex items-center space-x-3" }, _hoisted_7$3 = {
|
|
2849
|
-
key: 0,
|
|
2850
|
-
class: "ml-6 space-y-2"
|
|
2851
|
-
}, _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
2852
|
-
__name: "GrabConditionsInput",
|
|
2853
|
-
props: {
|
|
2854
|
-
modelValue: {
|
|
2855
|
-
type: Object
|
|
2856
|
-
},
|
|
2857
|
-
schema: {
|
|
2858
|
-
type: Object,
|
|
2859
|
-
default: () => z.any()
|
|
2860
|
-
}
|
|
2861
|
-
},
|
|
2862
|
-
emits: ["update:model-value"],
|
|
2863
|
-
setup(e, { emit: r }) {
|
|
2864
|
-
const { t: o } = useI18n(), m = e, i = r, u = ref(m.modelValue ?? {}), l = ref(
|
|
2865
|
-
(() => {
|
|
2866
|
-
const f = {};
|
|
2867
|
-
return u.value.workingHour && Object.keys(u.value.workingHour).forEach((c) => {
|
|
2868
|
-
const k = u.value.workingHour[c];
|
|
2869
|
-
k && "periods" in k && Array.isArray(k.periods) ? f[c] = k.periods : Array.isArray(k) && (f[c] = k);
|
|
2870
|
-
}), f;
|
|
2871
|
-
})()
|
|
2872
|
-
), n = [
|
|
2873
|
-
{ key: "mon", label: "Monday" },
|
|
2874
|
-
{ key: "tue", label: "Tuesday" },
|
|
2875
|
-
{ key: "wed", label: "Wednesday" },
|
|
2876
|
-
{ key: "thu", label: "Thursday" },
|
|
2877
|
-
{ key: "fri", label: "Friday" },
|
|
2878
|
-
{ key: "sat", label: "Saturday" },
|
|
2879
|
-
{ key: "sun", label: "Sunday" }
|
|
2880
|
-
], a = (f) => {
|
|
2881
|
-
l.value[f] || (l.value[f] = []), l.value[f].push({
|
|
2882
|
-
startTime: "00:00",
|
|
2883
|
-
endTime: "23:59"
|
|
2884
|
-
}), v();
|
|
2885
|
-
}, s = (f, c) => {
|
|
2886
|
-
l.value[f] && l.value[f].length > c && (l.value[f].splice(c, 1), l.value[f].length === 0 && delete l.value[f], v());
|
|
2887
|
-
}, v = () => {
|
|
2888
|
-
const f = Object.keys(l.value).reduce(
|
|
2889
|
-
(c, k) => (l.value[k] && l.value[k].length > 0 && (c[k] = {
|
|
2890
|
-
periods: l.value[k]
|
|
2891
|
-
}), c),
|
|
2892
|
-
{}
|
|
2893
|
-
);
|
|
2894
|
-
u.value.workingHour = Object.keys(f).length > 0 ? f : void 0;
|
|
2895
|
-
};
|
|
2896
|
-
return watch(u, () => i("update:model-value", u.value), { deep: !0 }), watch(l, v, { deep: !0 }), (f, c) => {
|
|
2897
|
-
const k = resolveComponent("FmSelect"), x = resolveComponent("FmStepperField"), h = resolveComponent("FmCheckbox"), g = resolveComponent("FmTimePicker"), d = resolveComponent("FmButton");
|
|
2898
|
-
return openBlock(), createElementBlock("div", _hoisted_1$a, [
|
|
2899
|
-
createElementVNode("div", _hoisted_2$7, [
|
|
2900
|
-
createVNode(k, {
|
|
2901
|
-
label: unref(o)("connect.template.eaterType"),
|
|
2902
|
-
modelValue: unref(u).eaterType,
|
|
2903
|
-
"onUpdate:modelValue": c[0] || (c[0] = (p) => unref(u).eaterType = p),
|
|
2904
|
-
items: [
|
|
2905
|
-
{ label: unref(o)("connect.template.allEaters"), value: "all" },
|
|
2906
|
-
{ label: unref(o)("connect.template.newEatersOnly"), value: "new" },
|
|
2907
|
-
{
|
|
2908
|
-
label: unref(o)("connect.template.existingEatersOnly"),
|
|
2909
|
-
value: "existing"
|
|
2910
|
-
}
|
|
2911
|
-
],
|
|
2912
|
-
rules: [unref(ZodHelper).ruleAtPath(e.schema, "eaterType")]
|
|
2913
|
-
}, null, 8, ["label", "modelValue", "items", "rules"]),
|
|
2914
|
-
createVNode(x, {
|
|
2915
|
-
modelValue: unref(u).minBasketAmount,
|
|
2916
|
-
"onUpdate:modelValue": c[1] || (c[1] = (p) => unref(u).minBasketAmount = p),
|
|
2917
|
-
"show-steppers": !1,
|
|
2918
|
-
rules: [unref(ZodHelper).ruleAtPath(e.schema, "minBasketAmount")]
|
|
2919
|
-
}, {
|
|
2920
|
-
label: withCtx(() => [
|
|
2921
|
-
(openBlock(), createBlock(resolveDynamicComponent(
|
|
2922
|
-
unref(ZodHelper).toInputLabel(
|
|
2923
|
-
unref(ZodHelper).typeAtPath(e.schema, "minBasketAmount"),
|
|
2924
|
-
unref(o)("connect.template.minBasketAmount")
|
|
2925
|
-
)
|
|
2926
|
-
)))
|
|
2927
|
-
]),
|
|
2928
|
-
_: 1
|
|
2929
|
-
}, 8, ["modelValue", "rules"]),
|
|
2930
|
-
createVNode(x, {
|
|
2931
|
-
modelValue: unref(u).bundleQuantity,
|
|
2932
|
-
"onUpdate:modelValue": c[2] || (c[2] = (p) => unref(u).bundleQuantity = p),
|
|
2933
|
-
"show-steppers": !1,
|
|
2934
|
-
rules: [unref(ZodHelper).ruleAtPath(e.schema, "bundleQuantity")]
|
|
2935
|
-
}, {
|
|
2936
|
-
label: withCtx(() => [
|
|
2937
|
-
(openBlock(), createBlock(resolveDynamicComponent(
|
|
2938
|
-
unref(ZodHelper).toInputLabel(
|
|
2939
|
-
unref(ZodHelper).typeAtPath(e.schema, "bundleQuantity"),
|
|
2940
|
-
unref(o)("connect.template.bundleQuantity")
|
|
2941
|
-
)
|
|
2942
|
-
)))
|
|
2943
|
-
]),
|
|
2944
|
-
_: 1
|
|
2945
|
-
}, 8, ["modelValue", "rules"])
|
|
2946
|
-
]),
|
|
2947
|
-
createElementVNode("div", _hoisted_3$5, [
|
|
2948
|
-
createElementVNode("div", _hoisted_4$4, [
|
|
2949
|
-
createElementVNode("div", _hoisted_5$4, toDisplayString(unref(o)("connect.template.operationHours")), 1),
|
|
2950
|
-
(openBlock(), createElementBlock(Fragment, null, renderList(n, (p) => createElementVNode("div", {
|
|
2951
|
-
key: p.key,
|
|
2952
|
-
class: "space-y-2"
|
|
2953
|
-
}, [
|
|
2954
|
-
createElementVNode("div", _hoisted_6$3, [
|
|
2955
|
-
createVNode(h, {
|
|
2956
|
-
label: p.label,
|
|
2957
|
-
"model-value": !!(unref(l)[p.key] && unref(l)[p.key].length > 0),
|
|
2958
|
-
"onUpdate:modelValue": (C) => {
|
|
2959
|
-
C ? a(p.key) : (unref(l)[p.key] = [], delete unref(l)[p.key], v());
|
|
2960
|
-
}
|
|
2961
|
-
}, null, 8, ["label", "model-value", "onUpdate:modelValue"])
|
|
2962
|
-
]),
|
|
2963
|
-
unref(l)[p.key] && unref(l)[p.key].length > 0 ? (openBlock(), createElementBlock("div", _hoisted_7$3, [
|
|
2964
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(l)[p.key] || [], (C, V) => (openBlock(), createElementBlock("div", {
|
|
2965
|
-
key: V,
|
|
2966
|
-
class: "flex items-center space-x-2 w-100"
|
|
2967
|
-
}, [
|
|
2968
|
-
createVNode(g, {
|
|
2969
|
-
"model-value": C.startTime || "",
|
|
2970
|
-
"onUpdate:modelValue": (N) => {
|
|
2971
|
-
unref(l)[p.key] && unref(l)[p.key][V] && (unref(l)[p.key][V].startTime = N || "", v());
|
|
2972
|
-
}
|
|
2973
|
-
}, null, 8, ["model-value", "onUpdate:modelValue"]),
|
|
2974
|
-
c[3] || (c[3] = createElementVNode("span", null, "to", -1)),
|
|
2975
|
-
createVNode(g, {
|
|
2976
|
-
"model-value": C.endTime || "",
|
|
2977
|
-
"onUpdate:modelValue": (N) => {
|
|
2978
|
-
unref(l)[p.key] && unref(l)[p.key][V] && (unref(l)[p.key][V].endTime = N || "", v());
|
|
2979
|
-
}
|
|
2980
|
-
}, null, 8, ["model-value", "onUpdate:modelValue"]),
|
|
2981
|
-
createVNode(d, {
|
|
2982
|
-
variant: "tertiary",
|
|
2983
|
-
size: "sm",
|
|
2984
|
-
onClick: (N) => s(p.key, V),
|
|
2985
|
-
icon: "close"
|
|
2986
|
-
}, null, 8, ["onClick"]),
|
|
2987
|
-
V === 0 ? (openBlock(), createBlock(d, {
|
|
2988
|
-
key: 0,
|
|
2989
|
-
onClick: (N) => a(p.key),
|
|
2990
|
-
icon: "add",
|
|
2991
|
-
variant: "plain"
|
|
2992
|
-
}, null, 8, ["onClick"])) : createCommentVNode("", !0)
|
|
2993
|
-
]))), 128))
|
|
2994
|
-
])) : createCommentVNode("", !0)
|
|
2995
|
-
])), 64))
|
|
2996
|
-
])
|
|
2997
|
-
])
|
|
2998
|
-
]);
|
|
2999
|
-
};
|
|
3000
|
-
}
|
|
3001
|
-
}), GrabConditionsInput = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-7f17ebe8"]]), _hoisted_1$9 = { class: "space-y-8" }, _hoisted_2$6 = { class: "grid gap-16 grid-cols-2" }, _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
3002
|
-
__name: "GrabQuotaInput",
|
|
3003
|
-
props: {
|
|
3004
|
-
modelValue: {
|
|
3005
|
-
type: Object
|
|
3006
|
-
},
|
|
3007
|
-
schema: {
|
|
3008
|
-
type: Object,
|
|
3009
|
-
default: () => z.any()
|
|
3010
|
-
}
|
|
3011
|
-
},
|
|
3012
|
-
emits: ["update:model-value"],
|
|
3013
|
-
setup(e, { emit: r }) {
|
|
3014
|
-
const { t: o } = useI18n(), m = e, i = r, u = ref(m.modelValue ?? {});
|
|
3015
|
-
return watch(u, () => i("update:model-value", u.value)), (l, n) => {
|
|
3016
|
-
const a = resolveComponent("FmStepperField");
|
|
3017
|
-
return openBlock(), createElementBlock("div", _hoisted_1$9, [
|
|
3018
|
-
createElementVNode("div", _hoisted_2$6, [
|
|
3019
|
-
createVNode(a, {
|
|
3020
|
-
modelValue: unref(u).totalCount,
|
|
3021
|
-
"onUpdate:modelValue": n[0] || (n[0] = (s) => unref(u).totalCount = s),
|
|
3022
|
-
"show-steppers": !1,
|
|
3023
|
-
rules: [unref(ZodHelper).ruleAtPath(e.schema, "totalCount")]
|
|
3024
|
-
}, {
|
|
3025
|
-
label: withCtx(() => [
|
|
3026
|
-
(openBlock(), createBlock(resolveDynamicComponent(
|
|
3027
|
-
unref(ZodHelper).toInputLabel(
|
|
3028
|
-
unref(ZodHelper).typeAtPath(e.schema, "totalCount"),
|
|
3029
|
-
unref(o)("connect.template.totalCount")
|
|
3030
|
-
)
|
|
3031
|
-
)))
|
|
3032
|
-
]),
|
|
3033
|
-
_: 1
|
|
3034
|
-
}, 8, ["modelValue", "rules"]),
|
|
3035
|
-
createVNode(a, {
|
|
3036
|
-
modelValue: unref(u).totalCountPerUser,
|
|
3037
|
-
"onUpdate:modelValue": n[1] || (n[1] = (s) => unref(u).totalCountPerUser = s),
|
|
3038
|
-
"show-steppers": !1,
|
|
3039
|
-
rules: [unref(ZodHelper).ruleAtPath(e.schema, "totalCountPerUser")]
|
|
3040
|
-
}, {
|
|
3041
|
-
label: withCtx(() => [
|
|
3042
|
-
(openBlock(), createBlock(resolveDynamicComponent(
|
|
3043
|
-
unref(ZodHelper).toInputLabel(
|
|
3044
|
-
unref(ZodHelper).typeAtPath(e.schema, "totalCountPerUser"),
|
|
3045
|
-
unref(o)("connect.template.totalCountPerUser")
|
|
3046
|
-
)
|
|
3047
|
-
)))
|
|
3048
|
-
]),
|
|
3049
|
-
_: 1
|
|
3050
|
-
}, 8, ["modelValue", "rules"])
|
|
3051
|
-
])
|
|
3052
|
-
]);
|
|
3053
|
-
};
|
|
3054
|
-
}
|
|
3055
|
-
}), _hoisted_1$8 = { class: "space-y-16" }, _hoisted_2$5 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_3$4 = { class: "grid grid-cols-2 gap-16" }, _hoisted_4$3 = { class: "fm-typo-en-title-sm-800" }, _hoisted_5$3 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
3056
|
-
__name: "MissionTypeInput",
|
|
3057
|
-
props: {
|
|
3058
|
-
modelValue: {
|
|
3059
|
-
type: String
|
|
3060
|
-
}
|
|
3061
|
-
},
|
|
3062
|
-
emits: ["update:model-value"],
|
|
3063
|
-
setup(e, { emit: r }) {
|
|
3064
|
-
const { t: o } = useI18n(), m = e, i = r, u = computed(() => [
|
|
3065
|
-
{
|
|
3066
|
-
label: o("connect.campaign.mission.typeOption.STAMP.label"),
|
|
3067
|
-
description: o("connect.campaign.mission.typeOption.STAMP.description"),
|
|
3068
|
-
value: F_MISSION_TYPE.enum.STAMP
|
|
3069
|
-
},
|
|
3070
|
-
{
|
|
3071
|
-
label: o("connect.campaign.mission.typeOption.PROGRESSIVE.label"),
|
|
3072
|
-
description: o("connect.campaign.mission.typeOption.PROGRESSIVE.description"),
|
|
3073
|
-
value: F_MISSION_TYPE.enum.PROGRESSIVE
|
|
3074
|
-
}
|
|
3075
|
-
]);
|
|
3076
|
-
return (l, n) => {
|
|
3077
|
-
const a = resolveComponent("FmCard");
|
|
3078
|
-
return openBlock(), createElementBlock("div", _hoisted_1$8, [
|
|
3079
|
-
createElementVNode("div", _hoisted_2$5, toDisplayString(unref(o)("connect.template.select_game")), 1),
|
|
3080
|
-
createElementVNode("div", _hoisted_3$4, [
|
|
3081
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (s) => (openBlock(), createBlock(a, {
|
|
3082
|
-
variant: "outlined",
|
|
3083
|
-
class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
|
|
3084
|
-
"col-span-2": unref(u).length == 1,
|
|
3085
|
-
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == s.value,
|
|
3086
|
-
"hover:bg-fm-color-opacity-sm": e.modelValue != s.value
|
|
3087
|
-
}]),
|
|
3088
|
-
onClick: () => {
|
|
3089
|
-
m.modelValue != s.value && i("update:model-value", s.value);
|
|
3090
|
-
},
|
|
3091
|
-
key: s.value
|
|
3092
|
-
}, {
|
|
3093
|
-
default: withCtx(() => [
|
|
3094
|
-
createElementVNode("div", _hoisted_4$3, toDisplayString(s.label), 1),
|
|
3095
|
-
createElementVNode("div", _hoisted_5$3, toDisplayString(s.description), 1)
|
|
3096
|
-
]),
|
|
3097
|
-
_: 2
|
|
3098
|
-
}, 1032, ["class", "onClick"]))), 128))
|
|
3099
|
-
])
|
|
3100
|
-
]);
|
|
3101
|
-
};
|
|
3102
|
-
}
|
|
3103
|
-
}), _hoisted_1$7 = { class: "space-y-16" }, _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
3104
|
-
__name: "MissionEndInput",
|
|
3105
|
-
props: {
|
|
3106
|
-
modelValue: {
|
|
3107
|
-
type: [String, Number]
|
|
3108
|
-
},
|
|
3109
|
-
helperText: {
|
|
3110
|
-
type: String
|
|
3111
|
-
},
|
|
3112
|
-
helperState: {
|
|
3113
|
-
type: String
|
|
3114
|
-
}
|
|
3115
|
-
},
|
|
3116
|
-
emits: ["update:model-value"],
|
|
3117
|
-
setup(e, { emit: r }) {
|
|
3118
|
-
const o = r;
|
|
3119
|
-
return (m, i) => {
|
|
3120
|
-
const u = resolveComponent("FmStepperField");
|
|
3121
|
-
return openBlock(), createElementBlock("div", _hoisted_1$7, [
|
|
3122
|
-
i[1] || (i[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)),
|
|
3123
|
-
createVNode(u, {
|
|
3124
|
-
label: "Maximum to collect",
|
|
3125
|
-
"model-value": e.modelValue || null,
|
|
3126
|
-
"onUpdate:modelValue": i[0] || (i[0] = (l) => o("update:model-value", l)),
|
|
3127
|
-
"helper-text": e.helperText || "Set the threshold required for reward eligibility",
|
|
3128
|
-
"helper-state": e.helperState || "none"
|
|
3129
|
-
}, null, 8, ["model-value", "helper-text", "helper-state"])
|
|
3130
|
-
]);
|
|
3131
|
-
};
|
|
3132
|
-
}
|
|
3133
|
-
}), _hoisted_1$6 = { class: "flex gap-8 items-center justify-start" }, _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
3134
|
-
__name: "EditMissionPoolSheet",
|
|
3135
|
-
props: {
|
|
3136
|
-
maxThreshold: {
|
|
3137
|
-
type: Number,
|
|
3138
|
-
required: !0
|
|
3139
|
-
}
|
|
3140
|
-
},
|
|
3141
|
-
emits: ["update:model-value"],
|
|
3142
|
-
setup(e, { expose: r, emit: o }) {
|
|
3143
|
-
const m = e, i = useMembershipStore(), { minor: u } = useLoading, l = ref(!1), n = ref(), a = ref(), s = ref(0), v = computed(() => {
|
|
3144
|
-
var d;
|
|
3145
|
-
return ((d = i.loyaltyRewards.items.find(
|
|
3146
|
-
(p) => {
|
|
3147
|
-
var C;
|
|
3148
|
-
return p.value === ((C = n.value) == null ? void 0 : C.collectible);
|
|
3149
|
-
}
|
|
3150
|
-
)) == null ? void 0 : d.raw.type) === "CREDIT" ? FdoThresholdCreditReward : FdtoThresholdReward;
|
|
3151
|
-
}), f = computed(() => {
|
|
3152
|
-
const g = v.value.safeParse(n.value);
|
|
3153
|
-
return g.success ? [] : g.error.errors;
|
|
3154
|
-
});
|
|
3155
|
-
function c(g, d, p) {
|
|
3156
|
-
g && (n.value = d, s.value = p), l.value = g;
|
|
3157
|
-
}
|
|
3158
|
-
const k = o;
|
|
3159
|
-
async function x() {
|
|
3160
|
-
const g = v.value.safeParse(n.value);
|
|
3161
|
-
g.success && (await u(
|
|
3162
|
-
async () => {
|
|
3163
|
-
g.data.type === "VOUCHER" && a.value && (g.data.collectibleConfig.image = await firebaseStorage.update(
|
|
3164
|
-
g.data.collectibleConfig.image || firebaseStorage.collectibleImagePath(void 0, a.value),
|
|
3165
|
-
a.value
|
|
3166
|
-
));
|
|
3167
|
-
},
|
|
3168
|
-
{
|
|
3169
|
-
message: "Uploading reward image",
|
|
3170
|
-
successMessage: "Reward image updated"
|
|
3171
|
-
}
|
|
3172
|
-
), k("update:model-value", g.data, s.value));
|
|
3173
|
-
}
|
|
3174
|
-
const h = ref();
|
|
3175
|
-
return r({
|
|
3176
|
-
showSheet: c
|
|
3177
|
-
}), (g, d) => {
|
|
3178
|
-
const p = resolveComponent("FmStepperField"), C = resolveComponent("FmSelect"), V = resolveComponent("FmForm"), N = resolveComponent("FmButton"), R = resolveComponent("FmSideSheet");
|
|
3179
|
-
return openBlock(), createBlock(R, {
|
|
3180
|
-
"max-width": 560,
|
|
3181
|
-
modelValue: unref(l),
|
|
3182
|
-
"onUpdate:modelValue": [
|
|
3183
|
-
d[10] || (d[10] = (E) => isRef(l) ? l.value = E : null),
|
|
3184
|
-
d[11] || (d[11] = (E) => l.value = E)
|
|
3185
|
-
],
|
|
3186
|
-
header: "Edit reward",
|
|
3187
|
-
"dismiss-away": ""
|
|
3188
|
-
}, {
|
|
3189
|
-
"side-sheet-footer": withCtx(() => [
|
|
3190
|
-
createElementVNode("div", _hoisted_1$6, [
|
|
3191
|
-
createVNode(N, {
|
|
3192
|
-
variant: "primary",
|
|
3193
|
-
type: "button",
|
|
3194
|
-
label: "Confirm",
|
|
3195
|
-
disabled: unref(f).length > 0,
|
|
3196
|
-
onClick: d[8] || (d[8] = async () => {
|
|
3197
|
-
var E;
|
|
3198
|
-
return (E = unref(h)) == null ? void 0 : E.validateInputs();
|
|
3199
|
-
})
|
|
3200
|
-
}, null, 8, ["disabled"]),
|
|
3201
|
-
createVNode(N, {
|
|
3202
|
-
variant: "secondary",
|
|
3203
|
-
type: "button",
|
|
3204
|
-
label: "Cancel",
|
|
3205
|
-
onClick: d[9] || (d[9] = (E) => l.value = !1)
|
|
3206
|
-
})
|
|
3207
|
-
])
|
|
3208
|
-
]),
|
|
3209
|
-
default: withCtx(() => [
|
|
3210
|
-
createVNode(JsonViewer, { json: unref(n) }, null, 8, ["json"]),
|
|
3211
|
-
unref(n) ? (openBlock(), createBlock(V, {
|
|
3212
|
-
key: 0,
|
|
3213
|
-
class: "flex flex-col gap-y-24",
|
|
3214
|
-
ref_key: "formRef",
|
|
3215
|
-
ref: h,
|
|
3216
|
-
onValidationSuccess: d[7] || (d[7] = (E) => x())
|
|
3217
|
-
}, {
|
|
3218
|
-
default: withCtx(() => {
|
|
3219
|
-
var E, D;
|
|
3220
|
-
return [
|
|
3221
|
-
unref(n).type ? (openBlock(), createBlock(p, {
|
|
3222
|
-
key: 0,
|
|
3223
|
-
label: "Threshold",
|
|
3224
|
-
rules: [
|
|
3225
|
-
unref(ZodHelper).toRule(
|
|
3226
|
-
unref(z).number().min(1).max(
|
|
3227
|
-
m.maxThreshold,
|
|
3228
|
-
`Number cannot be more than ${m.maxThreshold}`
|
|
3229
|
-
)
|
|
3230
|
-
)
|
|
3231
|
-
],
|
|
3232
|
-
"model-value": unref(n).threshold,
|
|
3233
|
-
"onUpdate:modelValue": d[0] || (d[0] = (w) => n.value = {
|
|
3234
|
-
...unref(n),
|
|
3235
|
-
threshold: w
|
|
3236
|
-
})
|
|
3237
|
-
}, null, 8, ["rules", "model-value"])) : createCommentVNode("", !0),
|
|
3238
|
-
createVNode(C, {
|
|
3239
|
-
label: "Reward Type",
|
|
3240
|
-
items: [
|
|
3241
|
-
{ label: "Voucher", value: "VOUCHER" },
|
|
3242
|
-
{ label: "Loyalty", value: "LOYALTY" }
|
|
3243
|
-
],
|
|
3244
|
-
"model-value": unref(n).type,
|
|
3245
|
-
"onUpdate:modelValue": d[1] || (d[1] = (w) => {
|
|
3246
|
-
var A, H;
|
|
3247
|
-
w === "VOUCHER" ? n.value = {
|
|
3248
|
-
collectible: null,
|
|
3249
|
-
type: "VOUCHER",
|
|
3250
|
-
collectibleConfig: unref(initCollectibleConfig)("VOUCHER", {
|
|
3251
|
-
business: unref(useCoreStore)().currentBusiness.value._id
|
|
3252
|
-
}),
|
|
3253
|
-
earningOption: {
|
|
3254
|
-
amount: 1,
|
|
3255
|
-
type: "FIXED"
|
|
3256
|
-
},
|
|
3257
|
-
validityOption: {
|
|
3258
|
-
validForDay: 7
|
|
3259
|
-
},
|
|
3260
|
-
threshold: (A = unref(n)) == null ? void 0 : A.threshold
|
|
3261
|
-
} : n.value = {
|
|
3262
|
-
collectible: unref(i).loyaltyRewards.raw[0]._id,
|
|
3263
|
-
type: "LOYALTY",
|
|
3264
|
-
earningOption: {
|
|
3265
|
-
amount: 1,
|
|
3266
|
-
type: "FIXED"
|
|
3267
|
-
},
|
|
3268
|
-
validityOption: {
|
|
3269
|
-
validForDay: 7
|
|
3270
|
-
},
|
|
3271
|
-
threshold: (H = unref(n)) == null ? void 0 : H.threshold
|
|
3272
|
-
};
|
|
3273
|
-
})
|
|
3274
|
-
}, null, 8, ["model-value"]),
|
|
3275
|
-
unref(n).type == "LOYALTY" ? (openBlock(), createBlock(C, {
|
|
3276
|
-
key: 1,
|
|
3277
|
-
label: "Loyalty type",
|
|
3278
|
-
rules: [unref(ZodHelper).ruleAtPath(unref(v), "collectible", [unref(n).type])],
|
|
3279
|
-
items: unref(i).loyaltyRewards.items,
|
|
3280
|
-
"model-value": unref(n).collectible,
|
|
3281
|
-
"onUpdate:modelValue": d[2] || (d[2] = (w) => unref(n).collectible = w)
|
|
3282
|
-
}, null, 8, ["rules", "items", "model-value"])) : createCommentVNode("", !0),
|
|
3283
|
-
unref(n).type === "LOYALTY" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
3284
|
-
d[12] || (d[12] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
|
|
3285
|
-
createVNode(_sfc_main$z, {
|
|
3286
|
-
class: "mt-[-8px]",
|
|
3287
|
-
rules: [unref(ZodHelper).ruleAtPath(unref(v), "earningOption", [unref(n).type])],
|
|
3288
|
-
"helper-state": unref(ZodHelper).helperState(unref(f), "earningOption"),
|
|
3289
|
-
"error-text": unref(ZodHelper).helperText(unref(f), "earningOption"),
|
|
3290
|
-
"fixed-type": !0,
|
|
3291
|
-
"model-value": unref(n).earningOption,
|
|
3292
|
-
"onUpdate:modelValue": d[3] || (d[3] = (w) => n.value = {
|
|
3293
|
-
...unref(n),
|
|
3294
|
-
earningOption: w
|
|
3295
|
-
})
|
|
3296
|
-
}, null, 8, ["rules", "helper-state", "error-text", "model-value"]),
|
|
3297
|
-
createVNode(_sfc_main$A, {
|
|
3298
|
-
class: "!gap-24",
|
|
3299
|
-
type: unref(n).type === "LOYALTY" ? "custom" : "range",
|
|
3300
|
-
"for-credit": unref(n).type === "LOYALTY" && ((E = unref(i).loyaltyRewards.items.find(
|
|
3301
|
-
(w) => {
|
|
3302
|
-
var A;
|
|
3303
|
-
return w.value === ((A = unref(n)) == null ? void 0 : A.collectible);
|
|
3304
|
-
}
|
|
3305
|
-
)) == null ? void 0 : E.raw.type) === "CREDIT",
|
|
3306
|
-
rules: [unref(ZodHelper).ruleAtPath(unref(v), "validityOption", [unref(n).type])],
|
|
3307
|
-
"model-value": unref(n).validityOption,
|
|
3308
|
-
"onUpdate:modelValue": d[4] || (d[4] = (w) => n.value = {
|
|
3309
|
-
...unref(n),
|
|
3310
|
-
validityOption: w
|
|
3311
|
-
})
|
|
3312
|
-
}, null, 8, ["type", "for-credit", "rules", "model-value"])
|
|
3313
|
-
], 64)) : createCommentVNode("", !0),
|
|
3314
|
-
unref(n).type === "VOUCHER" ? (openBlock(), createBlock(_sfc_main$B, {
|
|
3315
|
-
key: 3,
|
|
3316
|
-
"reward-image": unref(a),
|
|
3317
|
-
"model-value": ((D = unref(n)) == null ? void 0 : D.collectibleConfig) ?? void 0,
|
|
3318
|
-
"onUpdate:modelValue": d[5] || (d[5] = (w) => n.value = {
|
|
3319
|
-
...unref(n),
|
|
3320
|
-
collectibleConfig: w
|
|
3321
|
-
}),
|
|
3322
|
-
"onUpdate:rewardImage": d[6] || (d[6] = (w) => a.value = w)
|
|
3323
|
-
}, null, 8, ["reward-image", "model-value"])) : createCommentVNode("", !0),
|
|
3324
|
-
createVNode(JsonViewer, { json: unref(f) }, null, 8, ["json"])
|
|
3325
|
-
];
|
|
3326
|
-
}),
|
|
3327
|
-
_: 1
|
|
3328
|
-
}, 512)) : createCommentVNode("", !0)
|
|
3329
|
-
]),
|
|
3330
|
-
_: 1
|
|
3331
|
-
}, 8, ["modelValue"]);
|
|
3332
|
-
};
|
|
3333
|
-
}
|
|
3334
|
-
}), _hoisted_1$5 = {
|
|
3335
|
-
key: 0,
|
|
3336
|
-
class: "grid grid-cols-5 text-center gap-8 justify-between items-center w-full"
|
|
3337
|
-
}, _hoisted_2$4 = { class: "flex flex-col gap-0 items-center justify-center" }, _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
3338
|
-
__name: "MissionProgress",
|
|
3339
|
-
props: {
|
|
3340
|
-
type: {
|
|
3341
|
-
type: String,
|
|
3342
|
-
required: !0
|
|
3343
|
-
},
|
|
3344
|
-
maxRange: {
|
|
3345
|
-
type: Number,
|
|
3346
|
-
required: !0
|
|
3347
|
-
},
|
|
3348
|
-
currentRange: {
|
|
3349
|
-
type: Number,
|
|
3350
|
-
default: 0
|
|
3351
|
-
},
|
|
3352
|
-
markers: {
|
|
3353
|
-
type: Array,
|
|
3354
|
-
default: () => []
|
|
3355
|
-
}
|
|
3356
|
-
},
|
|
3357
|
-
setup(e) {
|
|
3358
|
-
const r = e, { maxRange: o, currentRange: m, markers: i } = toRefs(r), u = computed(
|
|
3359
|
-
() => Math.min(m.value / o.value * 100, 100)
|
|
3360
|
-
), l = (n) => n / o.value * 100;
|
|
3361
|
-
return (n, a) => {
|
|
3362
|
-
const s = resolveComponent("FmIcon");
|
|
3363
|
-
return e.type === "STAMP" ? (openBlock(), createElementBlock("div", _hoisted_1$5, [
|
|
3364
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(Math.min(unref(o), 40), (v) => (openBlock(), createBlock(s, {
|
|
3365
|
-
class: normalizeClass(
|
|
3366
|
-
unref(m) >= v ? "text-fm-color-primary" : "text-fm-color-neutral-gray-200"
|
|
3367
|
-
),
|
|
3368
|
-
outline: unref(m) < v,
|
|
3369
|
-
key: v,
|
|
3370
|
-
name: unref(i).some((f) => f === v) ? "featured_seasonal_and_gifts" : "check_circle"
|
|
3371
|
-
}, null, 8, ["class", "outline", "name"]))), 128))
|
|
3372
|
-
])) : (openBlock(), createElementBlock("div", {
|
|
3373
|
-
key: 1,
|
|
3374
|
-
class: normalizeClass(["relative w-full h-4 rounded-lg", "bg-fm-color-system-warning-100"])
|
|
3375
|
-
}, [
|
|
3376
|
-
createElementVNode("div", {
|
|
3377
|
-
class: normalizeClass(["bg-fm-color-primary", "absolute top-0 left-0 h-full rounded-lg"]),
|
|
3378
|
-
style: normalizeStyle({ width: unref(u) + "%" })
|
|
3379
|
-
}, null, 4),
|
|
3380
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(i), (v, f) => (openBlock(), createElementBlock("div", {
|
|
3381
|
-
key: f,
|
|
3382
|
-
class: "absolute -top-1.5 flex flex-col items-center -translate-x-1/2",
|
|
3383
|
-
style: normalizeStyle({ left: l(v) + "%" })
|
|
3384
|
-
}, [
|
|
3385
|
-
createElementVNode("div", _hoisted_2$4, [
|
|
3386
|
-
createElementVNode("div", {
|
|
3387
|
-
class: normalizeClass(["h-16 w-[2px]", "bg-fm-color-system-warning-300"])
|
|
3388
|
-
}),
|
|
3389
|
-
a[0] || (a[0] = createElementVNode("div", null, "🎁", -1))
|
|
3390
|
-
])
|
|
3391
|
-
], 4))), 128))
|
|
3392
|
-
]));
|
|
3393
|
-
};
|
|
3394
|
-
}
|
|
3395
|
-
}), isObject = (e) => e !== null && typeof e == "object";
|
|
3396
|
-
function changeKeysFactory(e) {
|
|
3397
|
-
return function r(o, m = 1, i) {
|
|
3398
|
-
if (m === 0 || !isObject(o))
|
|
3399
|
-
return o;
|
|
3400
|
-
if (Array.isArray(o))
|
|
3401
|
-
return o.map((l) => r(l, m - 1, i));
|
|
3402
|
-
const u = Object.create(Object.getPrototypeOf(o));
|
|
3403
|
-
return Object.keys(o).forEach((l) => {
|
|
3404
|
-
const n = o[l], a = e(l, i), s = r(n, m - 1, i);
|
|
3405
|
-
u[a] = s;
|
|
3406
|
-
}), u;
|
|
3407
|
-
};
|
|
3408
|
-
}
|
|
3409
|
-
const sentenceCase = changeKeysFactory(sentenceCase$1), _hoisted_1$4 = { class: "space-y-16" }, _hoisted_2$3 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_3$3 = { class: "fm-typo-en-body-lg-400" }, _hoisted_4$2 = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _hoisted_5$2 = { class: "fm-typo-en-title-sm-800" }, _hoisted_6$2 = { class: "flex items-center gap-4" }, _hoisted_7$2 = { class: "fm-typo-en-body-lg-600" }, _hoisted_8$2 = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, _hoisted_9$2 = { class: "flex items-center gap-16" }, _hoisted_10$2 = { key: 0 }, _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
3410
|
-
__name: "MissionPoolInput",
|
|
3411
|
-
props: {
|
|
3412
|
-
modelValue: {
|
|
3413
|
-
type: Array,
|
|
3414
|
-
default: () => []
|
|
3415
|
-
},
|
|
3416
|
-
mission: {
|
|
3417
|
-
type: Object,
|
|
3418
|
-
required: !0
|
|
3419
|
-
}
|
|
3420
|
-
},
|
|
3421
|
-
emits: ["update:model-value"],
|
|
3422
|
-
setup(e, { emit: r }) {
|
|
3423
|
-
const { t: o } = useI18n(), m = e, i = r, u = useMembershipStore(), l = z.array(z.lazy(() => FdtoThresholdReward)).min(1, "Requires at least 1 reward"), n = computed(
|
|
3424
|
-
() => m.modelValue.sort((g, d) => g.threshold - d.threshold) ?? []
|
|
3425
|
-
), a = computed(() => {
|
|
3426
|
-
const g = l.safeParse(n.value);
|
|
3427
|
-
return g.success ? [] : g.error.errors;
|
|
3428
|
-
}), s = ref();
|
|
3429
|
-
function v(g, d) {
|
|
3430
|
-
var C;
|
|
3431
|
-
const p = [...n.value];
|
|
3432
|
-
p[d] = g, (C = s.value) == null || C.showSheet(!1), i("update:model-value", p);
|
|
3433
|
-
}
|
|
3434
|
-
function f(g) {
|
|
3435
|
-
const d = g.type == "VOUCHER" ? g.collectibleConfig : u.collectibles.find(
|
|
3436
|
-
(V) => V._id.toString() == g.collectible
|
|
3437
|
-
), p = CollectionUtils.formattedType((d == null ? void 0 : d.name) || ""), C = g.earningOption.type == "FIXED" ? o("connect.template.mission_pool.reward_sublabel_fixed", {
|
|
3438
|
-
threshold: g.threshold,
|
|
3439
|
-
amount: g.earningOption.amount
|
|
3440
|
-
}) : o("connect.template.mission_pool.reward_sublabel_per_spend", {
|
|
3441
|
-
threshold: g.threshold,
|
|
3442
|
-
amount: g.earningOption.amount,
|
|
3443
|
-
every: g.earningOption.every
|
|
3444
|
-
});
|
|
3445
|
-
return {
|
|
3446
|
-
label: isNullOrEmpty(p) ? o("connect.template.mission_pool.no_reward") : p,
|
|
3447
|
-
sublabel: C
|
|
3448
|
-
};
|
|
3449
|
-
}
|
|
3450
|
-
function c(g) {
|
|
3451
|
-
var p;
|
|
3452
|
-
const d = [...n.value];
|
|
3453
|
-
(p = s.value) == null || p.showSheet(!0, d[g], g);
|
|
3454
|
-
}
|
|
3455
|
-
function k(g) {
|
|
3456
|
-
const d = [...n.value];
|
|
3457
|
-
d.splice(g, 1), i("update:model-value", d);
|
|
3458
|
-
}
|
|
3459
|
-
function x() {
|
|
3460
|
-
var g;
|
|
3461
|
-
(g = s.value) == null || g.showSheet(
|
|
3462
|
-
!0,
|
|
3463
|
-
{
|
|
3464
|
-
type: "LOYALTY",
|
|
3465
|
-
collectible: u.loyaltyRewards.items[0].value,
|
|
3466
|
-
threshold: null,
|
|
3467
|
-
validityOption: {
|
|
3468
|
-
validForDay: 7
|
|
3469
|
-
},
|
|
3470
|
-
earningOption: {
|
|
3471
|
-
type: "FIXED",
|
|
3472
|
-
amount: 1
|
|
3473
|
-
}
|
|
3474
|
-
},
|
|
3475
|
-
n.value.length
|
|
3476
|
-
);
|
|
3477
|
-
}
|
|
3478
|
-
function h(g) {
|
|
3479
|
-
var d, p;
|
|
3480
|
-
return g.type == "VOUCHER" ? (d = g.collectibleConfig) == null ? void 0 : d.name : sentenceCase(
|
|
3481
|
-
((p = u.loyaltyRewards.items.find(
|
|
3482
|
-
(C) => C.value == g.collectible
|
|
3483
|
-
)) == null ? void 0 : p.label) || ""
|
|
3484
|
-
);
|
|
3485
|
-
}
|
|
3486
|
-
return (g, d) => {
|
|
3487
|
-
const p = resolveComponent("FmButton"), C = resolveComponent("FmCard"), V = resolveComponent("FmHelperText");
|
|
3488
|
-
return openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
3489
|
-
createElementVNode("div", _hoisted_2$3, toDisplayString(unref(o)("connect.template.configure_reward_customer")), 1),
|
|
3490
|
-
createVNode(p, {
|
|
3491
|
-
label: unref(o)("connect.template.mission_pool.add_reward"),
|
|
3492
|
-
onClick: d[0] || (d[0] = (N) => x()),
|
|
3493
|
-
variant: "plain",
|
|
3494
|
-
icon: "add"
|
|
3495
|
-
}, null, 8, ["label"]),
|
|
3496
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(n), (N, R) => (openBlock(), createBlock(C, {
|
|
3497
|
-
key: R,
|
|
3498
|
-
class: "px-16 py-12 flex items-center justify-between cursor-pointer",
|
|
3499
|
-
variant: "outlined",
|
|
3500
|
-
onClick: (E) => c(R)
|
|
3501
|
-
}, {
|
|
3502
|
-
default: withCtx(() => [
|
|
3503
|
-
createElementVNode("div", null, [
|
|
3504
|
-
createElementVNode("div", _hoisted_3$3, toDisplayString(f(N).label), 1),
|
|
3505
|
-
createElementVNode("div", _hoisted_4$2, toDisplayString(f(N).sublabel), 1)
|
|
3506
|
-
]),
|
|
3507
|
-
createVNode(p, {
|
|
3508
|
-
icon: "delete",
|
|
3509
|
-
variant: "tertiary",
|
|
3510
|
-
onClick: (E) => (E.stopPropagation(), k(R))
|
|
3511
|
-
}, null, 8, ["onClick"])
|
|
3512
|
-
]),
|
|
3513
|
-
_: 2
|
|
3514
|
-
}, 1032, ["onClick"]))), 128)),
|
|
3515
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(a).filter((N) => N.path.join(".") == ""), (N) => (openBlock(), createBlock(V, {
|
|
3516
|
-
key: N.message,
|
|
3517
|
-
text: N.message,
|
|
3518
|
-
state: "error"
|
|
3519
|
-
}, null, 8, ["text"]))), 128)),
|
|
3520
|
-
createElementVNode("div", _hoisted_5$2, toDisplayString(unref(o)("connect.template.mission_pool.preview")), 1),
|
|
3521
|
-
(openBlock(), createBlock(C, {
|
|
3522
|
-
key: 0,
|
|
3523
|
-
variant: "outlined",
|
|
3524
|
-
class: "p-24 space-y-16 w-fit"
|
|
3525
|
-
}, {
|
|
3526
|
-
default: withCtx(() => {
|
|
3527
|
-
var N, R;
|
|
3528
|
-
return [
|
|
3529
|
-
createElementVNode("div", _hoisted_6$2, [
|
|
3530
|
-
createElementVNode("div", null, [
|
|
3531
|
-
createElementVNode("div", _hoisted_7$2, toDisplayString(unref(o)("connect.template.mission_pool.collect_stamps", { end: e.mission.end })) + " " + toDisplayString(((N = e.modelValue[e.modelValue.length - 1]) == null ? void 0 : N.earningOption.amount) > 1 ? (R = e.modelValue[e.modelValue.length - 1]) == null ? void 0 : R.earningOption.amount : "") + " " + toDisplayString(e.modelValue[e.modelValue.length - 1] ? h(e.modelValue[e.modelValue.length - 1]) : ""), 1),
|
|
3532
|
-
createElementVNode("div", _hoisted_8$2, toDisplayString(unref(o)("connect.template.mission_pool.earn_stamp")), 1)
|
|
3533
|
-
])
|
|
3534
|
-
]),
|
|
3535
|
-
createElementVNode("div", _hoisted_9$2, [
|
|
3536
|
-
createVNode(_sfc_main$5, {
|
|
3537
|
-
type: e.mission.type,
|
|
3538
|
-
"max-range": e.mission.end,
|
|
3539
|
-
currentRange: e.mission.end / 4,
|
|
3540
|
-
markers: e.modelValue.map((E) => E.threshold)
|
|
3541
|
-
}, null, 8, ["type", "max-range", "currentRange", "markers"]),
|
|
3542
|
-
e.mission.type == "PROGRESSIVE" ? (openBlock(), createElementBlock("div", _hoisted_10$2, " 0/" + toDisplayString(e.mission.end.toLocaleString()), 1)) : createCommentVNode("", !0)
|
|
3543
|
-
])
|
|
3544
|
-
];
|
|
3545
|
-
}),
|
|
3546
|
-
_: 1
|
|
3547
|
-
})),
|
|
3548
|
-
createVNode(_sfc_main$6, {
|
|
3549
|
-
ref_key: "sheetRef",
|
|
3550
|
-
ref: s,
|
|
3551
|
-
"onUpdate:modelValue": v,
|
|
3552
|
-
"max-threshold": e.mission.end
|
|
3553
|
-
}, null, 8, ["max-threshold"])
|
|
3554
|
-
]);
|
|
3555
|
-
};
|
|
3556
|
-
}
|
|
3557
|
-
}), _hoisted_1$3 = { class: "space-y-16" }, _hoisted_2$2 = { class: "space-y-8" }, _hoisted_3$2 = { class: "fm-typo-en-title-sm-800" }, _hoisted_4$1 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_5$1 = { class: "grid grid-cols-2 gap-16" }, _hoisted_6$1 = { class: "fm-typo-en-title-sm-800" }, _hoisted_7$1 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_8$1 = { class: "space-y-8" }, _hoisted_9$1 = { class: "fm-typo-en-title-sm-800" }, _hoisted_10$1 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
3558
|
-
__name: "MissionInput",
|
|
3559
|
-
props: {
|
|
3560
|
-
modelValue: Object
|
|
3561
|
-
},
|
|
3562
|
-
emits: ["update:model-value"],
|
|
3563
|
-
setup(e, { emit: r }) {
|
|
3564
|
-
const { t: o } = useI18n(), m = e, i = computed(() => {
|
|
3565
|
-
const n = FdoMission.safeParse(m.modelValue);
|
|
3566
|
-
return n.success ? [] : n.error.errors;
|
|
3567
|
-
}), u = computed(() => [
|
|
3568
|
-
{
|
|
3569
|
-
label: o("connect.campaign.mission.typeOption.STAMP.label"),
|
|
3570
|
-
description: o("connect.campaign.mission.typeOption.STAMP.description"),
|
|
3571
|
-
value: F_MISSION_TYPE.enum.STAMP
|
|
3572
|
-
},
|
|
3573
|
-
{
|
|
3574
|
-
label: o("connect.campaign.mission.typeOption.PROGRESSIVE.label"),
|
|
3575
|
-
description: o("connect.campaign.mission.typeOption.PROGRESSIVE.description"),
|
|
3576
|
-
value: F_MISSION_TYPE.enum.PROGRESSIVE
|
|
3577
|
-
}
|
|
3578
|
-
]), l = r;
|
|
3579
|
-
return (n, a) => {
|
|
3580
|
-
var f;
|
|
3581
|
-
const s = resolveComponent("FmCard"), v = resolveComponent("FmStepperField");
|
|
3582
|
-
return openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
3583
|
-
createElementVNode("div", _hoisted_2$2, [
|
|
3584
|
-
createElementVNode("div", _hoisted_3$2, toDisplayString(unref(o)("connect.campaign.mission.missionType")), 1),
|
|
3585
|
-
createElementVNode("div", _hoisted_4$1, toDisplayString(unref(o)("connect.template.select_game")), 1),
|
|
3586
|
-
createElementVNode("div", _hoisted_5$1, [
|
|
3587
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (c) => {
|
|
3588
|
-
var k, x;
|
|
3589
|
-
return openBlock(), createBlock(s, {
|
|
3590
|
-
variant: "outlined",
|
|
3591
|
-
class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
|
|
3592
|
-
"col-span-2": unref(u).length == 1,
|
|
3593
|
-
"border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": ((k = e.modelValue) == null ? void 0 : k.type) == c.value,
|
|
3594
|
-
"hover:bg-fm-color-opacity-sm": ((x = e.modelValue) == null ? void 0 : x.type) != c.value
|
|
3595
|
-
}]),
|
|
3596
|
-
onClick: () => {
|
|
3597
|
-
var h, g;
|
|
3598
|
-
((h = e.modelValue) == null ? void 0 : h.type) != c.value && l("update:model-value", {
|
|
3599
|
-
...e.modelValue,
|
|
3600
|
-
type: c.value,
|
|
3601
|
-
end: ((g = e.modelValue) == null ? void 0 : g.end) || 1
|
|
3602
|
-
});
|
|
3603
|
-
},
|
|
3604
|
-
key: c.value
|
|
3605
|
-
}, {
|
|
3606
|
-
default: withCtx(() => [
|
|
3607
|
-
createElementVNode("div", _hoisted_6$1, toDisplayString(c.label), 1),
|
|
3608
|
-
createElementVNode("div", _hoisted_7$1, toDisplayString(c.description), 1)
|
|
3609
|
-
]),
|
|
3610
|
-
_: 2
|
|
3611
|
-
}, 1032, ["class", "onClick"]);
|
|
3612
|
-
}), 128))
|
|
3613
|
-
])
|
|
3614
|
-
]),
|
|
3615
|
-
createElementVNode("div", _hoisted_8$1, [
|
|
3616
|
-
createElementVNode("div", _hoisted_9$1, toDisplayString(unref(o)("connect.campaign.mission.collectionsRequired")), 1),
|
|
3617
|
-
createElementVNode("div", _hoisted_10$1, toDisplayString(unref(o)("connect.campaign.mission.collectionsRequiredDescription")), 1),
|
|
3618
|
-
createVNode(v, {
|
|
3619
|
-
label: unref(o)("connect.campaign.mission.maximumToCollect"),
|
|
3620
|
-
"model-value": ((f = e.modelValue) == null ? void 0 : f.end) || null,
|
|
3621
|
-
"onUpdate:modelValue": a[0] || (a[0] = (c) => {
|
|
3622
|
-
var k;
|
|
3623
|
-
return l("update:model-value", {
|
|
3624
|
-
...e.modelValue,
|
|
3625
|
-
type: ((k = e.modelValue) == null ? void 0 : k.type) || "STAMP",
|
|
3626
|
-
end: c
|
|
3627
|
-
});
|
|
3628
|
-
}),
|
|
3629
|
-
"helper-text": unref(ZodHelper).helperText(unref(i), "end") || unref(o)("connect.campaign.mission.thresholdHelperText"),
|
|
3630
|
-
"helper-state": unref(ZodHelper).helperState(unref(i), "end") || "none"
|
|
3631
|
-
}, null, 8, ["label", "model-value", "helper-text", "helper-state"])
|
|
3632
|
-
])
|
|
3633
|
-
]);
|
|
3634
|
-
};
|
|
3635
|
-
}
|
|
3636
|
-
});
|
|
3637
|
-
function useLocaleText() {
|
|
3638
|
-
const { locale: e, t: r } = useI18n();
|
|
3639
|
-
function o(m, i) {
|
|
3640
|
-
return m ? m[e.value] ?? m["en-US"] ?? r(i) : r(i);
|
|
3641
|
-
}
|
|
3642
|
-
return { getLocaleText: o };
|
|
3643
|
-
}
|
|
3644
|
-
const _hoisted_1$2 = { key: 29 }, _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
3645
|
-
__name: "TemplateInput",
|
|
3646
|
-
props: {
|
|
3647
|
-
pushAvailability: {
|
|
3648
|
-
type: String,
|
|
3649
|
-
default: "checking"
|
|
3650
|
-
},
|
|
3651
|
-
field: { type: Object, required: !0 },
|
|
3652
|
-
modelValue: {
|
|
3653
|
-
type: Object
|
|
3654
|
-
},
|
|
3655
|
-
schema: {
|
|
3656
|
-
type: Object
|
|
3657
|
-
},
|
|
3658
|
-
extras: {
|
|
3659
|
-
type: Object
|
|
3660
|
-
},
|
|
3661
|
-
helperText: {
|
|
3662
|
-
type: String
|
|
3663
|
-
},
|
|
3664
|
-
disabled: {
|
|
3665
|
-
type: Boolean,
|
|
3666
|
-
default: !1
|
|
3667
|
-
},
|
|
3668
|
-
campaignType: {
|
|
3669
|
-
type: String,
|
|
3670
|
-
default: void 0
|
|
3671
|
-
},
|
|
3672
|
-
/** False until the form has been submitted, for fields that validate late. */
|
|
3673
|
-
showValidation: {
|
|
3674
|
-
type: Boolean,
|
|
3675
|
-
default: !0
|
|
3676
|
-
}
|
|
3677
|
-
},
|
|
3678
|
-
emits: ["retry-push", "update:model-value", "update:file"],
|
|
3679
|
-
setup(e, { emit: r }) {
|
|
3680
|
-
const { t: o } = useI18n(), { getLocaleText: m } = useLocaleText(), i = e, u = r;
|
|
3681
|
-
function l(v) {
|
|
3682
|
-
switch (i.field.type) {
|
|
3683
|
-
case "timeframe":
|
|
3684
|
-
const f = v.startDate ? hooks(v.startDate).startOf("day").toISOString() : void 0, c = v.endDate ? hooks(v.endDate).endOf("day").toISOString() : void 0;
|
|
3685
|
-
u("update:model-value", {
|
|
3686
|
-
type: "timeframe",
|
|
3687
|
-
property: "__now",
|
|
3688
|
-
start: f,
|
|
3689
|
-
end: c
|
|
3690
|
-
});
|
|
3691
|
-
break;
|
|
3692
|
-
case "image": {
|
|
3693
|
-
u(
|
|
3694
|
-
"update:file",
|
|
3695
|
-
v,
|
|
3696
|
-
n.value || firebaseStorage.collectibleImagePath(void 0, v)
|
|
3697
|
-
);
|
|
3698
|
-
break;
|
|
3699
|
-
}
|
|
3700
|
-
default:
|
|
3701
|
-
u("update:model-value", v);
|
|
3702
|
-
break;
|
|
3703
|
-
}
|
|
3704
|
-
}
|
|
3705
|
-
const n = computed(() => {
|
|
3706
|
-
switch (i.field.type) {
|
|
3707
|
-
case "timeframe": {
|
|
3708
|
-
const v = i.modelValue;
|
|
3709
|
-
return {
|
|
3710
|
-
startDate: v != null && v.start ? hooks(v == null ? void 0 : v.start).format("YYYY-MM-DD") : null,
|
|
3711
|
-
endDate: v != null && v.end ? hooks(v == null ? void 0 : v.end).format("YYYY-MM-DD") : null
|
|
3712
|
-
};
|
|
3713
|
-
}
|
|
3714
|
-
default:
|
|
3715
|
-
return i.modelValue;
|
|
3716
|
-
}
|
|
3717
|
-
});
|
|
3718
|
-
function a() {
|
|
3719
|
-
if (!s.value.schema) return [];
|
|
3720
|
-
const v = s.value.schema.safeParse(i.modelValue);
|
|
3721
|
-
return v.success ? [] : v.error.errors;
|
|
3722
|
-
}
|
|
3723
|
-
const s = computed(() => ({
|
|
3724
|
-
schema: i.schema,
|
|
3725
|
-
unwrapped: i.schema ? ZodHelper.unwrap(i.schema) : void 0,
|
|
3726
|
-
rules: i.schema ? [ZodHelper.ruleAtPath(i.schema, "")] : void 0,
|
|
3727
|
-
labelMark: i.schema && ZodHelper.isRequired(i.schema) == !1 ? "optional" : void 0,
|
|
3728
|
-
zodLabel: i.schema ? ZodHelper.toInputLabel(
|
|
3729
|
-
i.schema,
|
|
3730
|
-
m(i.field.label_locale, i.field.label ?? "")
|
|
3731
|
-
) : void 0
|
|
3732
|
-
}));
|
|
3733
|
-
return (v, f) => {
|
|
3734
|
-
var d, p, C, V, N;
|
|
3735
|
-
const c = resolveComponent("FmTextField"), k = resolveComponent("FmStepperField"), x = resolveComponent("FmTextarea"), h = resolveComponent("FmHelperText"), g = resolveComponent("FmSwitch");
|
|
3736
|
-
return e.field.type === "text" ? (openBlock(), createBlock(c, {
|
|
3737
|
-
key: 0,
|
|
3738
|
-
label: unref(m)(e.field.label_locale, e.field.label ?? ""),
|
|
3739
|
-
"label-mark": unref(s).labelMark,
|
|
3740
|
-
rules: unref(s).rules,
|
|
3741
|
-
"model-value": unref(n),
|
|
3742
|
-
"onUpdate:modelValue": l,
|
|
3743
|
-
"helper-state": e.helperText ? "error" : void 0,
|
|
3744
|
-
"helper-text": e.helperText
|
|
3745
|
-
}, null, 8, ["label", "label-mark", "rules", "model-value", "helper-state", "helper-text"])) : e.field.type === "number" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
3746
|
-
createVNode(JsonViewer, {
|
|
3747
|
-
json: { schema: unref(s).unwrapped, props: i }
|
|
3748
|
-
}, null, 8, ["json"]),
|
|
3749
|
-
createVNode(k, {
|
|
3750
|
-
label: unref(m)(e.field.label_locale, e.field.label ?? ""),
|
|
3751
|
-
"label-mark": e.field.isRuleChildren ? void 0 : unref(s).labelMark,
|
|
3752
|
-
"model-value": unref(n),
|
|
3753
|
-
rules: e.field.isRuleChildren ? [] : unref(s).rules,
|
|
3754
|
-
"onUpdate:modelValue": l,
|
|
3755
|
-
"helper-state": e.field.isRuleChildren && e.helperText ? "error" : void 0,
|
|
3756
|
-
"helper-text": e.field.isRuleChildren ? e.helperText : void 0
|
|
3757
|
-
}, null, 8, ["label", "label-mark", "model-value", "rules", "helper-state", "helper-text"])
|
|
3758
|
-
], 64)) : e.field.type === "textarea" ? (openBlock(), createBlock(x, {
|
|
3759
|
-
key: 2,
|
|
3760
|
-
label: unref(m)(e.field.label_locale, e.field.label ?? ""),
|
|
3761
|
-
"label-mark": unref(s).labelMark,
|
|
3762
|
-
rules: unref(s).rules,
|
|
3763
|
-
"model-value": unref(n),
|
|
3764
|
-
"onUpdate:modelValue": l,
|
|
3765
|
-
"show-word-count": "",
|
|
3766
|
-
"max-length": (N = (V = (C = (p = (d = unref(s)) == null ? void 0 : d.unwrapped) == null ? void 0 : p._def) == null ? void 0 : C.checks) == null ? void 0 : V.find((R) => R.kind == "max")) == null ? void 0 : N.value
|
|
3767
|
-
}, null, 8, ["label", "label-mark", "rules", "model-value", "max-length"])) : e.field.type === "trigger" ? (openBlock(), createBlock(_sfc_main$o, {
|
|
3768
|
-
key: 3,
|
|
3769
|
-
"campaign-type": e.extras,
|
|
3770
|
-
"model-value": unref(n),
|
|
3771
|
-
disabled: e.disabled,
|
|
3772
|
-
"onUpdate:modelValue": l
|
|
3773
|
-
}, null, 8, ["campaign-type", "model-value", "disabled"])) : e.field.type === "timeframe" ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
|
|
3774
|
-
createVNode(_sfc_main$m, {
|
|
3775
|
-
"model-value": unref(n),
|
|
3776
|
-
"onUpdate:modelValue": l
|
|
3777
|
-
}, null, 8, ["model-value"]),
|
|
3778
|
-
createVNode(h, {
|
|
3779
|
-
class: "!mt-[8px]",
|
|
3780
|
-
text: unref(ZodHelper).helperText(a(), ""),
|
|
3781
|
-
state: unref(ZodHelper).helperState(a(), "")
|
|
3782
|
-
}, null, 8, ["text", "state"])
|
|
3783
|
-
], 64)) : e.field.type === "image" ? (openBlock(), createBlock(_sfc_main$C, {
|
|
3784
|
-
key: 5,
|
|
3785
|
-
thumbnail: unref(n),
|
|
3786
|
-
"aspect-ratio": "16 / 9",
|
|
3787
|
-
class: "w-1/2 xs:w-2/3",
|
|
3788
|
-
"onUpdate:file": l
|
|
3789
|
-
}, {
|
|
3790
|
-
label: withCtx(() => [
|
|
3791
|
-
(openBlock(), createBlock(resolveDynamicComponent(unref(s).zodLabel)))
|
|
3792
|
-
]),
|
|
3793
|
-
_: 1
|
|
3794
|
-
}, 8, ["thumbnail"])) : e.field.type === "switch" ? (openBlock(), createBlock(g, {
|
|
3795
|
-
key: 6,
|
|
3796
|
-
label: unref(m)(e.field.label_locale, e.field.label ?? ""),
|
|
3797
|
-
"label-placement": "right",
|
|
3798
|
-
sublabel: e.field.property == "campaign.notify" ? "Notify customer when customer receives the reward" : void 0,
|
|
3799
|
-
"label-mark": unref(s).labelMark,
|
|
3800
|
-
rules: unref(s).rules,
|
|
3801
|
-
"model-value": unref(n),
|
|
3802
|
-
"onUpdate:modelValue": l
|
|
3803
|
-
}, null, 8, ["label", "sublabel", "label-mark", "rules", "model-value"])) : e.field.type === "collectible_options" ? (openBlock(), createBlock(_sfc_main$D, {
|
|
3804
|
-
key: 7,
|
|
3805
|
-
"model-value": unref(n),
|
|
3806
|
-
"onUpdate:modelValue": l,
|
|
3807
|
-
"no-campaign": !1,
|
|
3808
|
-
schema: unref(s).schema,
|
|
3809
|
-
"is-mission": e.extras === "MISSION"
|
|
3810
|
-
}, null, 8, ["model-value", "schema", "is-mission"])) : e.field.type === "grab_conditions" ? (openBlock(), createBlock(GrabConditionsInput, {
|
|
3811
|
-
key: 8,
|
|
3812
|
-
"model-value": unref(n),
|
|
3813
|
-
"onUpdate:modelValue": l,
|
|
3814
|
-
schema: unref(s).schema
|
|
3815
|
-
}, null, 8, ["model-value", "schema"])) : e.field.type === "grab_quota" ? (openBlock(), createBlock(_sfc_main$9, {
|
|
3816
|
-
key: 9,
|
|
3817
|
-
"model-value": unref(n),
|
|
3818
|
-
"onUpdate:modelValue": l,
|
|
3819
|
-
schema: unref(s).schema
|
|
3820
|
-
}, null, 8, ["model-value", "schema"])) : e.field.type === "target_location" ? (openBlock(), createBlock(_sfc_main$E, {
|
|
3821
|
-
key: 10,
|
|
3822
|
-
"model-value": unref(n),
|
|
3823
|
-
"onUpdate:modelValue": l
|
|
3824
|
-
}, null, 8, ["model-value"])) : e.field.type == "effect" ? (openBlock(), createElementBlock(Fragment, { key: 11 }, [
|
|
3825
|
-
createVNode(_sfc_main$F, {
|
|
3826
|
-
"model-value": unref(n),
|
|
3827
|
-
"onUpdate:modelValue": l,
|
|
3828
|
-
"can-set-auto-apply": e.field.property == "campaign.effect"
|
|
3829
|
-
}, null, 8, ["model-value", "can-set-auto-apply"]),
|
|
3830
|
-
unref(n) ? createCommentVNode("", !0) : (openBlock(), createBlock(h, {
|
|
3831
|
-
key: 0,
|
|
3832
|
-
class: "!mt-[8px]",
|
|
3833
|
-
text: unref(o)("connect.campaign.common.effect_required"),
|
|
3834
|
-
state: "error"
|
|
3835
|
-
}, null, 8, ["text"]))
|
|
3836
|
-
], 64)) : e.field.type == "grab_effect" ? (openBlock(), createElementBlock(Fragment, { key: 12 }, [
|
|
3837
|
-
createVNode(GrabEffectSheet, {
|
|
3838
|
-
"model-value": unref(n),
|
|
3839
|
-
"onUpdate:modelValue": l
|
|
3840
|
-
}, null, 8, ["model-value"]),
|
|
3841
|
-
unref(n) ? createCommentVNode("", !0) : (openBlock(), createBlock(h, {
|
|
3842
|
-
key: 0,
|
|
3843
|
-
class: "!mt-[8px]",
|
|
3844
|
-
text: unref(o)("connect.campaign.common.effect_required"),
|
|
3845
|
-
state: "error"
|
|
3846
|
-
}, null, 8, ["text"]))
|
|
3847
|
-
], 64)) : e.field.type === "message" ? (openBlock(), createElementBlock(Fragment, { key: 13 }, [
|
|
3848
|
-
e.field.property === "campaign.message" ? (openBlock(), createBlock(_sfc_main$g, {
|
|
3849
|
-
key: 0,
|
|
3850
|
-
"push-availability": e.pushAvailability,
|
|
3851
|
-
onRetryPush: f[0] || (f[0] = (R) => u("retry-push")),
|
|
3852
|
-
"show-validation": e.showValidation,
|
|
3853
|
-
"model-value": unref(n),
|
|
3854
|
-
"onUpdate:modelValue": l,
|
|
3855
|
-
"helper-text": unref(ZodHelper).helperText(a(), ""),
|
|
3856
|
-
"trigger-type": e.field.extras,
|
|
3857
|
-
"helper-state": unref(ZodHelper).helperState(a(), "")
|
|
3858
|
-
}, null, 8, ["push-availability", "show-validation", "model-value", "helper-text", "trigger-type", "helper-state"])) : (openBlock(), createBlock(_sfc_main$x, {
|
|
3859
|
-
key: 1,
|
|
3860
|
-
"allow-email": !0,
|
|
3861
|
-
"allow-whatsapp": !0,
|
|
3862
|
-
"model-value": unref(n),
|
|
3863
|
-
"onUpdate:modelValue": l,
|
|
3864
|
-
"helper-text": unref(ZodHelper).helperText(a(), ""),
|
|
3865
|
-
"trigger-type": e.field.extras,
|
|
3866
|
-
"helper-state": unref(ZodHelper).helperState(a(), "")
|
|
3867
|
-
}, null, 8, ["model-value", "helper-text", "trigger-type", "helper-state"]))
|
|
3868
|
-
], 64)) : e.field.type === "earning_option" ? (openBlock(), createBlock(_sfc_main$z, {
|
|
3869
|
-
key: 14,
|
|
3870
|
-
"model-value": unref(n),
|
|
3871
|
-
"onUpdate:modelValue": l,
|
|
3872
|
-
extras: e.extras,
|
|
3873
|
-
"error-text": e.helperText
|
|
3874
|
-
}, null, 8, ["model-value", "extras", "error-text"])) : e.field.type === "validity_option" ? (openBlock(), createBlock(_sfc_main$A, {
|
|
3875
|
-
key: 15,
|
|
3876
|
-
type: "custom",
|
|
3877
|
-
"model-value": unref(n),
|
|
3878
|
-
"onUpdate:modelValue": l,
|
|
3879
|
-
"helper-text": e.helperText || unref(ZodHelper).helperText(a(), ""),
|
|
3880
|
-
"for-credit": i.campaignType === "CREDIT"
|
|
3881
|
-
}, null, 8, ["model-value", "helper-text", "for-credit"])) : e.field.type === "game_type" ? (openBlock(), createBlock(_sfc_main$e, {
|
|
3882
|
-
key: 16,
|
|
3883
|
-
"model-value": unref(n),
|
|
3884
|
-
"onUpdate:modelValue": l
|
|
3885
|
-
}, null, 8, ["model-value"])) : e.field.type === "reward_pool" ? (openBlock(), createBlock(_sfc_main$c, {
|
|
3886
|
-
key: 17,
|
|
3887
|
-
"model-value": unref(n),
|
|
3888
|
-
"onUpdate:modelValue": l
|
|
3889
|
-
}, null, 8, ["model-value"])) : e.field.type === "mission" ? (openBlock(), createBlock(_sfc_main$3, {
|
|
3890
|
-
key: 18,
|
|
3891
|
-
"model-value": unref(n),
|
|
3892
|
-
"onUpdate:modelValue": l
|
|
3893
|
-
}, null, 8, ["model-value"])) : e.field.type === "mission_type" ? (openBlock(), createBlock(_sfc_main$8, {
|
|
3894
|
-
key: 19,
|
|
3895
|
-
"model-value": unref(n),
|
|
3896
|
-
"onUpdate:modelValue": l
|
|
3897
|
-
}, null, 8, ["model-value"])) : e.field.type === "mission_end" ? (openBlock(), createBlock(_sfc_main$7, {
|
|
3898
|
-
key: 20,
|
|
3899
|
-
"model-value": unref(n),
|
|
3900
|
-
"onUpdate:modelValue": l,
|
|
3901
|
-
"helper-text": unref(ZodHelper).helperText(a(), ""),
|
|
3902
|
-
"helper-state": unref(ZodHelper).helperState(a(), "")
|
|
3903
|
-
}, null, 8, ["model-value", "helper-text", "helper-state"])) : e.field.type === "mission_pool" ? (openBlock(), createBlock(_sfc_main$4, {
|
|
3904
|
-
key: 21,
|
|
3905
|
-
"model-value": unref(n),
|
|
3906
|
-
"onUpdate:modelValue": l,
|
|
3907
|
-
mission: e.extras.mission
|
|
3908
|
-
}, null, 8, ["model-value", "mission"])) : e.field.type === "rule_schedule" ? (openBlock(), createElementBlock(Fragment, { key: 22 }, [
|
|
3909
|
-
createVNode(_sfc_main$f, {
|
|
3910
|
-
"model-value": unref(n),
|
|
3911
|
-
"onUpdate:modelValue": l,
|
|
3912
|
-
"start-date": e.extras.start,
|
|
3913
|
-
"end-date": e.extras.end
|
|
3914
|
-
}, null, 8, ["model-value", "start-date", "end-date"]),
|
|
3915
|
-
e.helperText ? (openBlock(), createBlock(h, {
|
|
3916
|
-
key: 0,
|
|
3917
|
-
class: "!mt-[8px]",
|
|
3918
|
-
text: e.helperText,
|
|
3919
|
-
state: "error"
|
|
3920
|
-
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
3921
|
-
], 64)) : e.field.type === "rule_user" ? (openBlock(), createElementBlock(Fragment, { key: 23 }, [
|
|
3922
|
-
createVNode(_sfc_main$G, {
|
|
3923
|
-
"model-value": unref(n),
|
|
3924
|
-
"onUpdate:modelValue": l
|
|
3925
|
-
}, null, 8, ["model-value"]),
|
|
3926
|
-
e.helperText ? (openBlock(), createBlock(h, {
|
|
3927
|
-
key: 0,
|
|
3928
|
-
class: "!mt-[8px]",
|
|
3929
|
-
text: e.helperText,
|
|
3930
|
-
state: "error"
|
|
3931
|
-
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
3932
|
-
], 64)) : e.field.type === "rule_time" ? (openBlock(), createElementBlock(Fragment, { key: 24 }, [
|
|
3933
|
-
e.extras == "PROMOTION" && unref(RuleBuilder).getRules(unref(n).rules.g_time).length > 0 ? (openBlock(), createBlock(h, {
|
|
3934
|
-
key: 0,
|
|
3935
|
-
state: "warning",
|
|
3936
|
-
text: `Time based rule only work for POS >= v${unref(featureVersionMapping).TIME_BASED_PROMOTION}`
|
|
3937
|
-
}, null, 8, ["text"])) : createCommentVNode("", !0),
|
|
3938
|
-
createVNode(_sfc_main$q, {
|
|
3939
|
-
"model-value": unref(n),
|
|
3940
|
-
"onUpdate:modelValue": l
|
|
3941
|
-
}, null, 8, ["model-value"]),
|
|
3942
|
-
e.helperText ? (openBlock(), createBlock(h, {
|
|
3943
|
-
key: 1,
|
|
3944
|
-
class: "!mt-[8px]",
|
|
3945
|
-
text: e.helperText,
|
|
3946
|
-
state: "error"
|
|
3947
|
-
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
3948
|
-
], 64)) : e.field.type === "rule_bill" ? (openBlock(), createElementBlock(Fragment, { key: 25 }, [
|
|
3949
|
-
createVNode(_sfc_main$H, {
|
|
3950
|
-
"model-value": unref(n),
|
|
3951
|
-
"onUpdate:modelValue": l
|
|
3952
|
-
}, null, 8, ["model-value"]),
|
|
3953
|
-
e.helperText ? (openBlock(), createBlock(h, {
|
|
3954
|
-
key: 0,
|
|
3955
|
-
class: "!mt-[8px]",
|
|
3956
|
-
text: e.helperText,
|
|
3957
|
-
state: "error"
|
|
3958
|
-
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
3959
|
-
], 64)) : e.field.type === "rule_feedback" ? (openBlock(), createElementBlock(Fragment, { key: 26 }, [
|
|
3960
|
-
createVNode(_sfc_main$I, {
|
|
3961
|
-
"model-value": unref(n),
|
|
3962
|
-
"onUpdate:modelValue": l
|
|
3963
|
-
}, null, 8, ["model-value"]),
|
|
3964
|
-
e.helperText ? (openBlock(), createBlock(h, {
|
|
3965
|
-
key: 0,
|
|
3966
|
-
class: "!mt-[8px]",
|
|
3967
|
-
text: e.helperText,
|
|
3968
|
-
state: "error"
|
|
3969
|
-
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
3970
|
-
], 64)) : e.field.type === "rule_birthday" ? (openBlock(), createElementBlock(Fragment, { key: 27 }, [
|
|
3971
|
-
createVNode(_sfc_main$p, {
|
|
3972
|
-
"model-value": unref(n),
|
|
3973
|
-
"onUpdate:modelValue": l
|
|
3974
|
-
}, null, 8, ["model-value"]),
|
|
3975
|
-
e.helperText ? (openBlock(), createBlock(h, {
|
|
3976
|
-
key: 0,
|
|
3977
|
-
class: "!mt-[8px]",
|
|
3978
|
-
text: e.helperText,
|
|
3979
|
-
state: "error"
|
|
3980
|
-
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
3981
|
-
], 64)) : e.field.type === "promotion_game_type" ? (openBlock(), createElementBlock(Fragment, { key: 28 }, [
|
|
3982
|
-
createVNode(_sfc_main$b, {
|
|
3983
|
-
"model-value": unref(n),
|
|
3984
|
-
"onUpdate:modelValue": l
|
|
3985
|
-
}, null, 8, ["model-value"]),
|
|
3986
|
-
e.helperText ? (openBlock(), createBlock(h, {
|
|
3987
|
-
key: 0,
|
|
3988
|
-
class: "!mt-[8px]",
|
|
3989
|
-
text: e.helperText,
|
|
3990
|
-
state: "error"
|
|
3991
|
-
}, null, 8, ["text"])) : createCommentVNode("", !0)
|
|
3992
|
-
], 64)) : (openBlock(), createElementBlock("pre", _hoisted_1$2, toDisplayString(i.field), 1));
|
|
3993
|
-
};
|
|
3994
|
-
}
|
|
3995
|
-
}), _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({
|
|
3996
|
-
__name: "CampaignSummary",
|
|
3997
|
-
props: {
|
|
3998
|
-
data: {
|
|
3999
|
-
type: Object,
|
|
4000
|
-
required: !0
|
|
4001
|
-
}
|
|
4002
|
-
},
|
|
4003
|
-
setup(e) {
|
|
4004
|
-
const { t: r, te: o } = useI18n();
|
|
4005
|
-
function m(i) {
|
|
4006
|
-
return o(i) || o(i, "en-US");
|
|
4007
|
-
}
|
|
4008
|
-
return (i, u) => {
|
|
4009
|
-
const l = resolveComponent("FmCard");
|
|
4010
|
-
return openBlock(), createBlock(l, {
|
|
4011
|
-
variant: "outlined",
|
|
4012
|
-
class: "p-16 space-y-8"
|
|
4013
|
-
}, {
|
|
4014
|
-
default: withCtx(() => [
|
|
4015
|
-
createElementVNode("div", _hoisted_1$1, toDisplayString(unref(r)("connect.campaign.common.summary")), 1),
|
|
4016
|
-
u[0] || (u[0] = createElementVNode("div", { class: "h-[1px] bg-fm-color-neutral-gray-100 w-full" }, null, -1)),
|
|
4017
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(getCampaignSummaryObject)(e.data), (n, a) => (openBlock(), createElementBlock("div", {
|
|
4018
|
-
class: "space-y-4",
|
|
4019
|
-
key: a
|
|
4020
|
-
}, [
|
|
4021
|
-
n ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
4022
|
-
createElementVNode("div", _hoisted_2$1, toDisplayString(unref(r)(`${a}`)), 1),
|
|
4023
|
-
createElementVNode("div", _hoisted_3$1, toDisplayString(m(`${n}`) ? unref(r)(`${n}`) : n), 1)
|
|
4024
|
-
], 64)) : createCommentVNode("", !0)
|
|
4025
|
-
]))), 128))
|
|
4026
|
-
]),
|
|
4027
|
-
_: 1
|
|
4028
|
-
});
|
|
4029
|
-
};
|
|
4030
|
-
}
|
|
4031
|
-
}), _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 = {
|
|
4032
|
-
key: 0,
|
|
4033
|
-
class: "max-w-6xl mx-auto"
|
|
4034
|
-
}, _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({
|
|
4035
|
-
__name: "EditCampaignSheet",
|
|
4036
|
-
emits: ["submit:model-value"],
|
|
4037
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
4038
|
-
const Dialog = useDialog(), sheetVisible = ref(!1), { t } = useI18n(), { getLocaleText } = useLocaleText(), currentStep = ref(1), data = ref(), schema = ref(z.any()), template = ref(
|
|
4039
|
-
TEMPLATES.VOUCHER
|
|
4040
|
-
), { minor } = useLoading, isLoading = ref(!1), sheetTitle = ref("Create Campaign"), campaignType = ref("VOUCHER"), pushAvailability = ref("checking");
|
|
4041
|
-
let availabilityRequest = 0;
|
|
4042
|
-
async function checkPushAvailability() {
|
|
4043
|
-
const e = ++availabilityRequest, r = SvcConfig.getBusinessId();
|
|
4044
|
-
pushAvailability.value = "checking";
|
|
4045
|
-
try {
|
|
4046
|
-
if (!r) throw new Error("Business ID is unavailable");
|
|
4047
|
-
const m = await getNativeApp(r);
|
|
4048
|
-
o() && (pushAvailability.value = m ? "native" : "non-native");
|
|
4049
|
-
} catch {
|
|
4050
|
-
o() && (pushAvailability.value = "failed");
|
|
4051
|
-
}
|
|
4052
|
-
function o() {
|
|
4053
|
-
return e === availabilityRequest && sheetVisible.value && campaignType.value === "BROADCAST" && SvcConfig.getBusinessId() === r;
|
|
4054
|
-
}
|
|
4055
|
-
}
|
|
4056
|
-
watch(
|
|
4057
|
-
sheetVisible,
|
|
4058
|
-
(e) => {
|
|
4059
|
-
e || ++availabilityRequest;
|
|
4060
|
-
},
|
|
4061
|
-
{ flush: "sync" }
|
|
4062
|
-
), onBeforeUnmount(() => {
|
|
4063
|
-
++availabilityRequest;
|
|
4064
|
-
});
|
|
4065
|
-
const pushBlocked = computed(
|
|
4066
|
-
() => {
|
|
4067
|
-
var e;
|
|
4068
|
-
return campaignType.value === "BROADCAST" && toDelivery(((e = data.value) == null ? void 0 : e.campaign) ?? {}).channels.includes("PUSH") && pushAvailability.value !== "native";
|
|
4069
|
-
}
|
|
4070
|
-
);
|
|
4071
|
-
async function showSheet(visible, type, campaign, selectedTemplate) {
|
|
4072
|
-
var e, r, o;
|
|
4073
|
-
if (sheetVisible.value = visible, campaignType.value = type, ++availabilityRequest, !!visible) {
|
|
4074
|
-
type === "BROADCAST" && checkPushAvailability();
|
|
4075
|
-
try {
|
|
4076
|
-
isLoading.value = visible, await useMembershipStore().readRewards(), await useBusinessStore().readLocations(), await useMembershipStore().readSegments(), await useMembershipStore().readMembership();
|
|
4077
|
-
} catch {
|
|
4078
|
-
} finally {
|
|
4079
|
-
await new Promise((m) => setTimeout(m, 120)), isLoading.value = !1;
|
|
4080
|
-
}
|
|
4081
|
-
template.value = selectedTemplate ?? TEMPLATES[type], schema.value = CampaignDtos[type], type === "VOUCHER" && (await useCampaignStore().read(), schema.value = schema.value.superRefine((m, i) => {
|
|
4082
|
-
var u;
|
|
4083
|
-
if (m.campaign.type === "VOUCHER" && m.campaign.code) {
|
|
4084
|
-
const l = (u = m.campaign._id) == null ? void 0 : u.toString();
|
|
4085
|
-
useCampaignStore().campaigns.voucher.some(
|
|
4086
|
-
(n) => n.code === m.campaign.code && n._id.toString() !== l
|
|
4087
|
-
) && i.addIssue({
|
|
4088
|
-
code: "custom",
|
|
4089
|
-
message: "Code already exists, please use another code",
|
|
4090
|
-
path: ["campaign", "code"]
|
|
4091
|
-
});
|
|
4092
|
-
}
|
|
4093
|
-
})), data.value = campaign != null ? { ...campaign, templateId: (e = campaign.template) == null ? void 0 : e._id } : _.cloneDeep({
|
|
4094
|
-
...(r = template.value) == null ? void 0 : r.defaultValue
|
|
4095
|
-
}), "configs" in data.value && typeof data.value.configs == "string" && (data.value.configs = eval(data.value.configs)), data.value = cleanPF(data.value), type === "BROADCAST" && normaliseBroadcastDelivery(data.value.campaign), 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, submitAttempted.value = !1, sheetTitle.value = (o = campaign == null ? void 0 : campaign.campaign) != null && o._id ? t("connect.campaign.common.edit_campaign_title", {
|
|
4096
|
-
typeName: t(`connect.campaign.common.typeName.${type}`)
|
|
4097
|
-
}) : t("connect.campaign.common.create_campaign_title", {
|
|
4098
|
-
typeName: t(`connect.campaign.common.typeName.${type}`)
|
|
4099
|
-
});
|
|
4100
|
-
}
|
|
4101
|
-
}
|
|
4102
|
-
async function hideSheet() {
|
|
4103
|
-
Dialog.open({
|
|
4104
|
-
title: t("connect.campaign.common.unsaved_changes"),
|
|
4105
|
-
message: t("connect.campaign.common.unsaved_changes"),
|
|
4106
|
-
primaryActions: {
|
|
4107
|
-
text: t("connect.campaign.common.unsaved_changes_confirm"),
|
|
4108
|
-
close: !0
|
|
4109
|
-
},
|
|
4110
|
-
secondaryActions: {
|
|
4111
|
-
text: t("connect.campaign.common.unsaved_changes_cancel"),
|
|
4112
|
-
close: !1
|
|
4113
|
-
}
|
|
4114
|
-
}).onPrimary(() => {
|
|
4115
|
-
sheetVisible.value = !1;
|
|
4116
|
-
}).onSecondary(() => {
|
|
4117
|
-
Dialog.close();
|
|
4118
|
-
});
|
|
4119
|
-
}
|
|
4120
|
-
const emits = __emit, errors = computed(() => {
|
|
4121
|
-
const e = schema.value.superRefine(campaignRefinement).safeParse(data.value), r = e.success ? [] : [...e.error.errors];
|
|
4122
|
-
return pushBlocked.value && r.push({
|
|
4123
|
-
code: "custom",
|
|
4124
|
-
path: ["campaign", "delivery", "channels"],
|
|
4125
|
-
message: t(
|
|
4126
|
-
"connect.campaign.broadcast.pushAvailability.removeBeforeSave"
|
|
4127
|
-
)
|
|
4128
|
-
}), r;
|
|
4129
|
-
});
|
|
4130
|
-
function stepErrors(e = currentStep.value - 1) {
|
|
4131
|
-
const r = template.value.steps[e].groups.flatMap(
|
|
4132
|
-
(o) => o.fields.map((m) => schemaPathForField(m.property))
|
|
4133
|
-
);
|
|
4134
|
-
return errors.value.filter(
|
|
4135
|
-
(o) => r.some((m) => o.path.join(".").includes(m))
|
|
4136
|
-
);
|
|
4137
|
-
}
|
|
4138
|
-
const validateOnSubmit = computed(() => campaignType.value === "BROADCAST"), submitAttempted = ref(!1), showValidation = computed(
|
|
4139
|
-
() => !validateOnSubmit.value || submitAttempted.value
|
|
4140
|
-
), visibleErrors = computed(
|
|
4141
|
-
() => showValidation.value ? errors.value : []
|
|
4142
|
-
);
|
|
4143
|
-
function hasVisibleStepErrors(e) {
|
|
4144
|
-
return showValidation.value && stepErrors(e).length > 0;
|
|
4145
|
-
}
|
|
4146
|
-
function isNextDisabled() {
|
|
4147
|
-
return validateOnSubmit.value ? !1 : currentStep.value - 1 < template.value.steps.length - 1 ? stepErrors().length > 0 : errors.value.length > 0;
|
|
4148
|
-
}
|
|
4149
|
-
function onNext() {
|
|
4150
|
-
if (stepErrors().length > 0) {
|
|
4151
|
-
submitAttempted.value = !0;
|
|
4152
|
-
return;
|
|
4153
|
-
}
|
|
4154
|
-
submitAttempted.value = !1, currentStep.value++;
|
|
4155
|
-
}
|
|
4156
|
-
__expose({ showSheet });
|
|
4157
|
-
function showSummaryDialog() {
|
|
4158
|
-
Dialog.open({
|
|
4159
|
-
title: "",
|
|
4160
|
-
dialogComponent: _sfc_main$1,
|
|
4161
|
-
dialogComponentProps: {
|
|
4162
|
-
data: data.value
|
|
4163
|
-
}
|
|
4164
|
-
});
|
|
4165
|
-
}
|
|
4166
|
-
const broadcastDelivery = computed(
|
|
4167
|
-
() => {
|
|
4168
|
-
var e;
|
|
4169
|
-
return (e = data.value) != null && e.campaign ? toDelivery(data.value.campaign) : void 0;
|
|
4170
|
-
}
|
|
4171
|
-
);
|
|
4172
|
-
function valueForField(e) {
|
|
4173
|
-
return e === "campaign.message" ? broadcastDelivery.value : _.get(data.value, e);
|
|
4174
|
-
}
|
|
4175
|
-
function schemaPathForField(e) {
|
|
4176
|
-
return e === "campaign.message" ? "campaign.delivery" : e;
|
|
4177
|
-
}
|
|
4178
|
-
function onUpdateProperty(e, r) {
|
|
4179
|
-
var o, m, i, u, l, n, a, s;
|
|
4180
|
-
if (e === "campaign.message" && r && "channels" in r) {
|
|
4181
|
-
_.set(data.value, "campaign.delivery", r);
|
|
4182
|
-
const v = toLegacyMessage(r);
|
|
4183
|
-
v ? _.set(data.value, "campaign.message", v) : delete data.value.campaign.message;
|
|
4184
|
-
return;
|
|
4185
|
-
}
|
|
4186
|
-
if (_.set(data.value, e, r), e == "campaign.event.type") {
|
|
4187
|
-
const f = ((u = (i = (m = (o = template.value) == null ? void 0 : o.defaultValue) == null ? void 0 : m.campaign) == null ? void 0 : i.event) == null ? void 0 : u.rule) ? _.cloneDeep({
|
|
4188
|
-
...(s = (a = (n = (l = template.value) == null ? void 0 : l.defaultValue) == null ? void 0 : n.campaign) == null ? void 0 : a.event) == null ? void 0 : s.rule
|
|
4189
|
-
}) : RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup(), [
|
|
4190
|
-
RuleBuilder.scaffoldGroup("g_schedule"),
|
|
4191
|
-
RuleBuilder.scaffoldGroup("g_time"),
|
|
4192
|
-
RuleBuilder.scaffoldGroup("g_user"),
|
|
4193
|
-
RuleBuilder.scaffoldGroup("g_bill")
|
|
4194
|
-
]), c = RuleBuilder.setRuleToGroup(
|
|
4195
|
-
RuleBuilder.scaffoldGroup("g_schedule"),
|
|
4196
|
-
[
|
|
4197
|
-
RuleBuilder.constructEntry(
|
|
4198
|
-
"trigger.date",
|
|
4199
|
-
"_rrule",
|
|
4200
|
-
"RRULE:FREQ=DAILY;INTERVAL=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0;WKST=SU"
|
|
4201
|
-
),
|
|
4202
|
-
RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
|
|
4203
|
-
],
|
|
4204
|
-
"&&"
|
|
4205
|
-
);
|
|
4206
|
-
if (r != "SCHEDULE") {
|
|
4207
|
-
_.set(data.value, "campaign.event.rule", f);
|
|
4208
|
-
return;
|
|
4209
|
-
}
|
|
4210
|
-
_.set(
|
|
4211
|
-
data.value,
|
|
4212
|
-
"campaign.event.rule",
|
|
4213
|
-
RuleBuilder.setRuleToGroup(f, c)
|
|
4214
|
-
);
|
|
4215
|
-
}
|
|
4216
|
-
e == "campaign.notify" && r == !1 && _.set(data.value, "campaign.notifyMessage", void 0);
|
|
4217
|
-
}
|
|
4218
|
-
async function onUpdateFile(e, r) {
|
|
4219
|
-
return e ? await minor(async () => firebaseStorage.update(r, e), {
|
|
4220
|
-
message: `${e ? "Uploading" : "Removing"} file`,
|
|
4221
|
-
successMessage: `File ${e ? "uploaded" : "removed"} successfully`
|
|
4222
|
-
}) : "";
|
|
4223
|
-
}
|
|
4224
|
-
function isDisable(e) {
|
|
4225
|
-
var r, o;
|
|
4226
|
-
switch (e == null ? void 0 : e.property) {
|
|
4227
|
-
case "campaign.event.type":
|
|
4228
|
-
return ((o = (r = data.value) == null ? void 0 : r.campaign) == null ? void 0 : o._id) || !1;
|
|
4229
|
-
default:
|
|
4230
|
-
return !1;
|
|
4231
|
-
}
|
|
4232
|
-
}
|
|
4233
|
-
async function onSubmit() {
|
|
4234
|
-
if (submitAttempted.value = !0, pushBlocked.value) return;
|
|
4235
|
-
const e = schema.value.superRefine(campaignRefinement).transform(campaignTransform).safeParse(data.value);
|
|
4236
|
-
if (!e.success)
|
|
4237
|
-
return;
|
|
4238
|
-
const r = await emits(
|
|
4239
|
-
"submit:model-value",
|
|
4240
|
-
cleanPF(JSON.parse(JSON.stringify(e.data)))
|
|
4241
|
-
);
|
|
4242
|
-
(r || r === void 0) && (sheetVisible.value = !1);
|
|
4243
|
-
}
|
|
4244
|
-
return (e, r) => {
|
|
4245
|
-
const o = resolveComponent("FmButton"), m = resolveComponent("FmStep"), i = resolveComponent("FmStepper"), u = resolveComponent("FmCard"), l = resolveComponent("FmTopSheet");
|
|
4246
|
-
return openBlock(), createBlock(l, {
|
|
4247
|
-
"fullscreen-size": "lg",
|
|
4248
|
-
modelValue: unref(sheetVisible),
|
|
4249
|
-
"onUpdate:modelValue": [
|
|
4250
|
-
r[7] || (r[7] = (n) => isRef(sheetVisible) ? sheetVisible.value = n : null),
|
|
4251
|
-
r[8] || (r[8] = (n) => sheetVisible.value = n)
|
|
4252
|
-
]
|
|
4253
|
-
}, createSlots({
|
|
4254
|
-
"top-sheet-header": withCtx(() => [
|
|
4255
|
-
createElementVNode("div", _hoisted_1, [
|
|
4256
|
-
createElementVNode("div", null, toDisplayString(unref(sheetTitle)), 1),
|
|
4257
|
-
createElementVNode("div", _hoisted_2, [
|
|
4258
|
-
createVNode(o, {
|
|
4259
|
-
onClick: r[0] || (r[0] = (n) => hideSheet()),
|
|
4260
|
-
label: unref(t)("connect.campaign.common.cancel"),
|
|
4261
|
-
variant: "tertiary"
|
|
4262
|
-
}, null, 8, ["label"]),
|
|
4263
|
-
createVNode(o, {
|
|
4264
|
-
onClick: onSubmit,
|
|
4265
|
-
label: unref(t)("connect.campaign.common.save"),
|
|
4266
|
-
disabled: !unref(validateOnSubmit) && unref(errors).length > 0
|
|
4267
|
-
}, null, 8, ["label", "disabled"])
|
|
4268
|
-
])
|
|
4269
|
-
])
|
|
4270
|
-
]),
|
|
4271
|
-
_: 2
|
|
4272
|
-
}, [
|
|
4273
|
-
unref(isLoading) ? {
|
|
4274
|
-
name: "default",
|
|
4275
|
-
fn: withCtx(() => [
|
|
4276
|
-
createElementVNode("div", _hoisted_9, [
|
|
4277
|
-
createElementVNode("div", _hoisted_10, [
|
|
4278
|
-
createElementVNode("div", _hoisted_11, [
|
|
4279
|
-
r[9] || (r[9] = createElementVNode("div", { class: "col-span-2 space-y-80 xs:col-span-3 xs:px-16 xs:pt-16" }, [
|
|
4280
|
-
createElementVNode("div", { class: "flex-1 space-y-6 py-1" }, [
|
|
4281
|
-
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100 rounded" }),
|
|
4282
|
-
createElementVNode("div", { class: "h-[80px] bg-fm-color-neutral-gray-100 rounded" }),
|
|
4283
|
-
createElementVNode("div", { class: "space-y-3" }, [
|
|
4284
|
-
createElementVNode("div", { class: "grid grid-cols-2 gap-4" }, [
|
|
4285
|
-
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" }),
|
|
4286
|
-
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
|
|
4287
|
-
]),
|
|
4288
|
-
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
|
|
4289
|
-
]),
|
|
4290
|
-
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100 rounded" }),
|
|
4291
|
-
createElementVNode("div", { class: "h-[80px] bg-fm-color-neutral-gray-100 rounded" }),
|
|
4292
|
-
createElementVNode("div", { class: "space-y-3" }, [
|
|
4293
|
-
createElementVNode("div", { class: "grid grid-cols-2 gap-4" }, [
|
|
4294
|
-
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" }),
|
|
4295
|
-
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
|
|
4296
|
-
]),
|
|
4297
|
-
createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
|
|
4298
|
-
])
|
|
4299
|
-
])
|
|
4300
|
-
], -1)),
|
|
4301
|
-
createVNode(u, { class: "h-[150px] bg-fm-color-neutral-gray-100" })
|
|
4302
|
-
])
|
|
4303
|
-
])
|
|
4304
|
-
])
|
|
4305
|
-
]),
|
|
4306
|
-
key: "1"
|
|
4307
|
-
} : {
|
|
4308
|
-
name: "default",
|
|
4309
|
-
fn: withCtx(() => [
|
|
4310
|
-
unref(data) ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
4311
|
-
createVNode(i, {
|
|
4312
|
-
modelValue: unref(currentStep),
|
|
4313
|
-
"onUpdate:modelValue": r[1] || (r[1] = (n) => isRef(currentStep) ? currentStep.value = n : null),
|
|
4314
|
-
orientation: "horizontal",
|
|
4315
|
-
class: "xs:hidden mx-[-24px] mt-16 mb-24 flex-1"
|
|
4316
|
-
}, {
|
|
4317
|
-
default: withCtx(() => [
|
|
4318
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps, (n, a) => (openBlock(), createBlock(m, {
|
|
4319
|
-
key: n.name,
|
|
4320
|
-
title: unref(getLocaleText)(n.name_locale, n.name),
|
|
4321
|
-
value: a + 1,
|
|
4322
|
-
error: () => hasVisibleStepErrors(a),
|
|
4323
|
-
complete: () => a + 1 <= unref(currentStep)
|
|
4324
|
-
}, null, 8, ["title", "value", "error", "complete"]))), 128))
|
|
4325
|
-
]),
|
|
4326
|
-
_: 1
|
|
4327
|
-
}, 8, ["modelValue"]),
|
|
4328
|
-
createElementVNode("div", _hoisted_4, [
|
|
4329
|
-
createVNode(o, {
|
|
4330
|
-
icon: "close",
|
|
4331
|
-
variant: "tertiary",
|
|
4332
|
-
onClick: r[2] || (r[2] = (n) => sheetVisible.value = !1)
|
|
4333
|
-
}),
|
|
4334
|
-
createVNode(i, {
|
|
4335
|
-
modelValue: unref(currentStep),
|
|
4336
|
-
"onUpdate:modelValue": r[3] || (r[3] = (n) => isRef(currentStep) ? currentStep.value = n : null),
|
|
4337
|
-
orientation: "horizontal",
|
|
4338
|
-
class: "flex-1"
|
|
4339
|
-
}, {
|
|
4340
|
-
default: withCtx(() => [
|
|
4341
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps, (n, a) => (openBlock(), createBlock(m, {
|
|
4342
|
-
key: n.name,
|
|
4343
|
-
title: unref(sheetTitle),
|
|
4344
|
-
description: unref(getLocaleText)(n.name_locale, n.name),
|
|
4345
|
-
value: a + 1,
|
|
4346
|
-
error: () => hasVisibleStepErrors(a),
|
|
4347
|
-
complete: () => a + 1 <= unref(currentStep) && stepErrors(unref(currentStep) - 1).length == 0
|
|
4348
|
-
}, null, 8, ["title", "description", "value", "error", "complete"]))), 128))
|
|
4349
|
-
]),
|
|
4350
|
-
_: 1
|
|
4351
|
-
}, 8, ["modelValue"]),
|
|
4352
|
-
createVNode(o, {
|
|
4353
|
-
icon: "info",
|
|
4354
|
-
variant: "tertiary",
|
|
4355
|
-
onClick: r[4] || (r[4] = () => showSummaryDialog())
|
|
4356
|
-
})
|
|
4357
|
-
]),
|
|
4358
|
-
createElementVNode("div", _hoisted_5, [
|
|
4359
|
-
createElementVNode("div", _hoisted_6, [
|
|
4360
|
-
createVNode(JsonViewer, {
|
|
4361
|
-
json: {
|
|
4362
|
-
data: unref(data),
|
|
4363
|
-
errors: unref(errors).map(
|
|
4364
|
-
(n) => `${n.path.join(".")} - ${n.message}`
|
|
4365
|
-
),
|
|
4366
|
-
stepErrors: stepErrors().map(
|
|
4367
|
-
(n) => `${n.path.join(".")} - ${n.message}`
|
|
4368
|
-
),
|
|
4369
|
-
schema: unref(schema)
|
|
4370
|
-
}
|
|
4371
|
-
}, null, 8, ["json"]),
|
|
4372
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps[unref(currentStep) - 1].groups.filter(
|
|
4373
|
-
(n) => n.fields.length && (!n.condition || (Array.isArray(n.condition) ? n.condition.every((a) => unref(_).get(unref(data), a.property) == a.value == (a.not != !0)) : unref(_).get(unref(data), n.condition.property) == n.condition.value == (n.condition.not != !0)))
|
|
4374
|
-
), (n, a) => (openBlock(), createElementBlock("div", {
|
|
4375
|
-
key: a,
|
|
4376
|
-
class: "space-y-24"
|
|
4377
|
-
}, [
|
|
4378
|
-
createElementVNode("div", _hoisted_7, toDisplayString(unref(getLocaleText)(n.name_locale, n.name ?? "")), 1),
|
|
4379
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(n.fields, (s, v) => (openBlock(), createElementBlock("div", { key: v }, [
|
|
4380
|
-
(openBlock(), createBlock(_sfc_main$2, {
|
|
4381
|
-
key: v,
|
|
4382
|
-
field: s,
|
|
4383
|
-
modelValue: valueForField(s.property),
|
|
4384
|
-
disabled: isDisable(s),
|
|
4385
|
-
"campaign-type": unref(campaignType),
|
|
4386
|
-
"show-validation": unref(showValidation),
|
|
4387
|
-
"push-availability": unref(pushAvailability),
|
|
4388
|
-
onRetryPush: checkPushAvailability,
|
|
4389
|
-
"onUpdate:modelValue": (f) => onUpdateProperty(s.property, f),
|
|
4390
|
-
"onUpdate:file": async (f, c) => {
|
|
4391
|
-
const k = await onUpdateFile(f, c);
|
|
4392
|
-
onUpdateProperty(s.property, k || "");
|
|
4393
|
-
},
|
|
4394
|
-
schema: unref(ZodHelper).typeAtPath(
|
|
4395
|
-
unref(schema),
|
|
4396
|
-
schemaPathForField(s.property),
|
|
4397
|
-
unref(data).campaign.type != "MISSION" ? [unref(data).campaign.type] : ["STAMP", "MISSION"]
|
|
4398
|
-
),
|
|
4399
|
-
"helper-state": unref(ZodHelper).helperState(
|
|
4400
|
-
unref(visibleErrors),
|
|
4401
|
-
schemaPathForField(s.property)
|
|
4402
|
-
),
|
|
4403
|
-
"helper-text": unref(ZodHelper).helperText(
|
|
4404
|
-
unref(visibleErrors),
|
|
4405
|
-
schemaPathForField(s.property)
|
|
4406
|
-
),
|
|
4407
|
-
extras: s.extras != null ? s.extras == "" ? unref(data) : unref(_).get(unref(data), s.extras) : void 0
|
|
4408
|
-
}, null, 8, ["field", "modelValue", "disabled", "campaign-type", "show-validation", "push-availability", "onUpdate:modelValue", "onUpdate:file", "schema", "helper-state", "helper-text", "extras"]))
|
|
4409
|
-
]))), 128))
|
|
4410
|
-
]))), 128)),
|
|
4411
|
-
createElementVNode("div", _hoisted_8, [
|
|
4412
|
-
createVNode(o, {
|
|
4413
|
-
label: unref(t)("connect.common.back"),
|
|
4414
|
-
variant: "tertiary",
|
|
4415
|
-
disabled: unref(currentStep) == 1,
|
|
4416
|
-
onClick: r[5] || (r[5] = (n) => currentStep.value--)
|
|
4417
|
-
}, null, 8, ["label", "disabled"]),
|
|
4418
|
-
createVNode(o, {
|
|
4419
|
-
disabled: isNextDisabled(),
|
|
4420
|
-
label: unref(currentStep) - 1 < unref(template).steps.length - 1 ? unref(t)("connect.common.next") : unref(t)("connect.common.submit"),
|
|
4421
|
-
onClick: r[6] || (r[6] = (n) => unref(currentStep) - 1 < unref(template).steps.length - 1 ? onNext() : onSubmit())
|
|
4422
|
-
}, null, 8, ["disabled", "label"])
|
|
4423
|
-
])
|
|
4424
|
-
]),
|
|
4425
|
-
createVNode(_sfc_main$1, {
|
|
4426
|
-
data: unref(data),
|
|
4427
|
-
class: "xs:hidden"
|
|
4428
|
-
}, null, 8, ["data"])
|
|
4429
|
-
])
|
|
4430
|
-
])) : createCommentVNode("", !0)
|
|
4431
|
-
]),
|
|
4432
|
-
key: "0"
|
|
4433
|
-
}
|
|
4434
|
-
]), 1032, ["modelValue"]);
|
|
4435
|
-
};
|
|
4436
|
-
}
|
|
4437
|
-
});
|
|
4438
|
-
export {
|
|
4439
|
-
_sfc_main as _,
|
|
4440
|
-
summarizeGrabDiscount as s,
|
|
4441
|
-
useLocaleText as u
|
|
4442
|
-
};
|