@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 P, u as T, s as k, a as m, w as u, S as $, g as e, j as B, i as I, t as i, z as b, k as D, _ as N, l as U, m as F, p as H } from "./mitt-CvmiLPAX.js";
import { _ as A, y as C, f as R, I as h, p as j, s as z, C as O } from "./SelectField.vue_vue_type_style_index_0_lang-C60Scz2U.js";
import { u as W } from "./giftCard-Cd_UzFiq.js";
import { _ as q } from "./_.vue_vue_type_style_index_0_lang-CgwYyRP7.js";
import { A as J } from "./ActionField-BS0Mh1bE.js";
import { E as g } from "./Field.vue_vue_type_style_index_0_scoped_6ef33e68_lang-CRft4dYF.js";
import { F as y } from "./Field-C2VGW-Eu.js";
import { E as K } from "./ErrorMessage-CgdJmMED.js";
import { G as Q } from "./style-CmiPhqCb.js";
const Y = { class: "gift-card-validation-skeleton" }, Z = { class: "gift-card-validation-skeleton-form" }, tt = { class: "gift-card-validation-skeleton-text" }, et = { class: "gift-card-validation-skeleton-input" }, at = /* @__PURE__ */ x({
__name: "GiftCardValidationSkeleton",
setup(d) {
return (c, l) => (s(), v("div", Y, [
t("div", Z, [
t("div", tt, [
a(g, { height: "20px" }),
a(g, { height: "15px" }),
a(g, { height: "15px" })
]),
t("div", et, [
a(y),
a(y, { "no-label": "" })
])
])
]));
}
}), nt = /* @__PURE__ */ A(at, [["__scopeId", "data-v-b1601b74"]]), ot = ["innerHTML"], it = {
key: 0,
id: "konnectio-gift-card-validation-resume",
class: "konnectio-panel"
}, st = /* @__PURE__ */ x({
name: "GiftCardValidationLayout",
__name: "GiftCardValidation",
props: {
accessToken: {},
styling: {}
},
setup(d) {
const c = d, l = P(() => ({
panelMaxWidth: "800px",
...c.styling
})), { t: o } = T(), {
voucher: f,
isValid: G,
amount: E,
expirationDate: S,
productName: w,
isLoading: p
} = k(C()), { currency: L, hasError: M } = k(R()), { fetchMetadata: X } = W(), { apply: _ } = C();
return (pt, n) => (s(), m(O, { styling: l.value }, {
default: u(() => [
(s(), m($, null, {
default: u(() => [
a(q, {
"access-token": d.accessToken,
callback: e(X)
}, {
default: u(() => [
e(M) ? (s(), m(K, {
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] = B((r) => e(_)(), ["prevent"]))
}, [
t("h4", null, [
t("span", null, i(e(o)("giftCardValidation.title")), 1)
]),
t("p", {
innerHTML: e(o)("giftCardValidation.description")
}, null, 8, ot),
a(J, {
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(p),
"onUpdate:isLoading": n[1] || (n[1] = (r) => b(p) ? p.value = r : null),
onAction: n[2] || (n[2] = (r) => e(_)())
}, null, 8, ["modelValue", "label", "buttonLabel", "is-loading"]),
!e(p) && e(G) ? (s(), v("table", it, [
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(j)(e(E), e(L))), 1)
]),
t("td", null, [
t("span", null, i(e(z)(e(S))), 1)
])
])
])
])) : I("", !0)
], 32))
]),
_: 1
}, 8, ["access-token", "callback"])
]),
fallback: u(() => [
a(nt)
]),
_: 1
}))
]),
_: 1
}, 8, ["styling"]));
}
}), V = /* @__PURE__ */ A(st, [["__scopeId", "data-v-ca768ef6"]]), lt = D(), rt = N, dt = rt();
class ct extends HTMLElement {
vueApp;
constructor() {
super();
}
disconnectedCallback() {
this.vueApp.unmount();
}
connectedCallback() {
const c = U(V, this.attributes);
this.vueApp = F(V, c), this.vueApp.provide("emitter", dt), this.vueApp.use(lt), this.vueApp.use(H), this.vueApp.use(Q);
const l = document.createElement("div");
this.vueApp.mount(l), this.appendChild(l.children[0]);
}
}
window.customElements.define("konnectio-gift-card-validation", ct);
export {
ct as default
};
//# sourceMappingURL=gift-card-validation.js.map