@konnectio/core
Version:
Konnectio Core Frontend Integration.
163 lines (162 loc) • 6.43 kB
JavaScript
import { d as x, h as v, b as s, e as t, f as a, c as T, u as $, s as k, a as m, w as p, S as B, g as e, j as I, i as D, t as i, z as b, k as N, _ as U, l as F, m as H, p as R } from "./mitt-CWSmi8M-.js";
import { _ as A, y as C, f as j, I as h, p as z, s as O, C as W } from "./SelectField.vue_vue_type_style_index_0_lang-Cev1TH7y.js";
import { u as q } from "./giftCard-C5SFtGL4.js";
import { _ as J } from "./_.vue_vue_type_style_index_0_lang-CW619CRS.js";
import { A as K } from "./ActionField-BsmMIhW6.js";
import { E as g } from "./Field.vue_vue_type_style_index_0_scoped_6ef33e68_lang-NEWgHGKm.js";
import { F as y } from "./Field-Dw5FVydD.js";
import { E as Q } from "./ErrorMessage-rPcq7mbu.js";
import { G as Y } from "./style-DJF9fHLt.js";
const Z = { class: "gift-card-validation-skeleton" }, tt = { class: "gift-card-validation-skeleton-form" }, et = { class: "gift-card-validation-skeleton-text" }, at = { class: "gift-card-validation-skeleton-input" }, nt = /* @__PURE__ */ x({
__name: "GiftCardValidationSkeleton",
setup(u) {
return (d, l) => (s(), v("div", Z, [
t("div", tt, [
t("div", et, [
a(g, { height: "20px" }),
a(g, { height: "15px" }),
a(g, { height: "15px" })
]),
t("div", at, [
a(y),
a(y, { "no-label": "" })
])
])
]));
}
}), ot = /* @__PURE__ */ A(nt, [["__scopeId", "data-v-b1601b74"]]), it = ["innerHTML"], st = {
key: 0,
id: "konnectio-gift-card-validation-resume",
class: "konnectio-panel"
}, lt = /* @__PURE__ */ x({
name: "GiftCardValidationLayout",
__name: "GiftCardValidation",
props: {
accessToken: {},
styling: {}
},
setup(u) {
const d = u, l = T(() => ({
panelMaxWidth: "800px",
...d.styling
})), { t: o } = $(), {
voucher: f,
isValid: G,
amount: E,
expirationDate: S,
productName: w,
isLoading: c
} = k(C()), { currency: L, hasError: M } = k(j()), { fetchMetadata: X } = q(), { apply: _ } = C();
return (P, n) => (s(), m(W, { styling: l.value }, {
default: p(() => [
(s(), m(B, null, {
default: p(() => [
a(J, {
"access-token": P.accessToken,
callback: e(X)
}, {
default: p(() => [
e(M) ? (s(), m(Q, {
key: 1,
title: "Unable to render Gift card validation module",
description: "Gift card functionality hasn't been setup for this account. Please contact Octopus PMS for support."
})) : (s(), v("form", {
key: 0,
id: "konnectio-gift-card-validation-module",
onSubmit: n[3] || (n[3] = I((r) => e(_)(), ["prevent"]))
}, [
t("h4", null, [
t("span", null, i(e(o)("giftCardValidation.title")), 1)
]),
t("p", {
innerHTML: e(o)("giftCardValidation.description")
}, null, 8, it),
a(K, {
modelValue: e(f),
"onUpdate:modelValue": n[0] || (n[0] = (r) => b(f) ? f.value = r : null),
icon: "gift-card",
label: e(o)("booking.reservation.giftCardCode"),
buttonLabel: e(o)("giftCardValidation.submitButton"),
placeholder: "XXXXXXXX",
"is-loading": e(c),
"onUpdate:isLoading": n[1] || (n[1] = (r) => b(c) ? c.value = r : null),
onAction: n[2] || (n[2] = (r) => e(_)())
}, null, 8, ["modelValue", "label", "buttonLabel", "is-loading"]),
!e(c) && e(G) ? (s(), v("table", st, [
t("thead", null, [
t("tr", null, [
t("th", null, [
t("span", null, i(e(o)("giftCardValidation.giftCard")), 1),
a(h, {
icon: "gift-card",
type: "fas",
color: "header"
})
]),
t("th", null, [
t("span", null, i(e(o)("giftCardValidation.balance")), 1),
a(h, {
icon: "money-bill",
type: "fas",
color: "header"
})
]),
t("th", null, [
t("span", null, i(e(o)("giftCardValidation.expirationDate")), 1),
a(h, {
icon: "timer",
type: "fas",
color: "header"
})
])
])
]),
t("tbody", null, [
t("tr", null, [
t("td", null, [
t("span", null, i(e(w)), 1)
]),
t("td", null, [
t("span", null, i(e(z)(e(E), e(L))), 1)
]),
t("td", null, [
t("span", null, i(e(O)(e(S))), 1)
])
])
])
])) : D("", !0)
], 32))
]),
_: 1
}, 8, ["access-token", "callback"])
]),
fallback: p(() => [
a(ot)
]),
_: 1
}))
]),
_: 1
}, 8, ["styling"]));
}
}), V = /* @__PURE__ */ A(lt, [["__scopeId", "data-v-ca768ef6"]]), rt = N(), dt = U, ct = dt();
class pt extends HTMLElement {
vueApp;
constructor() {
super();
}
disconnectedCallback() {
this.vueApp.unmount();
}
connectedCallback() {
const d = F(V, this.attributes);
this.vueApp = H(V, d), this.vueApp.provide("emitter", ct), this.vueApp.use(rt), this.vueApp.use(R), this.vueApp.use(Y);
const l = document.createElement("div");
this.vueApp.mount(l), this.appendChild(l.children[0]);
}
}
window.customElements.define("konnectio-gift-card-validation", pt);
export {
pt as default
};
//# sourceMappingURL=gift-card-validation.js.map