@konnectio/core
Version:
Konnectio Core Frontend Integration.
666 lines (665 loc) • 22.2 kB
JavaScript
import { d as $, h as v, b as u, e as r, Y as ve, a as H, f as I, w as k, E as Q, K as R, G as Z, T as _, i as w, n as m, q as B, M as me, r as c, o as Y, ae as he, af as ge, D as x, c as U, Q as be, g as f, A as we, t as b, y as Se, J as ke, ad as Ce, u as $e, x as W, s as Be } from "./mitt-BJqPn_wb.js";
import { q as Ve, I as Pe, _ as O, J as ee, x as ne, T as oe, f as Te, Q as He } from "./SelectField.vue_vue_type_style_index_0_lang-BcUXwydD.js";
function Ie(e) {
if (Array.isArray(e)) {
for (var o = 0, l = Array(e.length); o < e.length; o++)
l[o] = e[o];
return l;
} else
return Array.from(e);
}
var j = !1;
if (typeof window < "u") {
var te = {
get passive() {
j = !0;
}
};
window.addEventListener("testPassive", null, te), window.removeEventListener("testPassive", null, te);
}
var q = typeof window < "u" && window.navigator && window.navigator.platform && (/iP(ad|hone|od)/.test(window.navigator.platform) || window.navigator.platform === "MacIntel" && window.navigator.maxTouchPoints > 1), C = [], D = !1, ae = -1, P = void 0, S = void 0, T = void 0, ie = function(o) {
return C.some(function(l) {
return !!(l.options.allowTouchMove && l.options.allowTouchMove(o));
});
}, E = function(o) {
var l = o || window.event;
return ie(l.target) || l.touches.length > 1 ? !0 : (l.preventDefault && l.preventDefault(), !1);
}, Ae = function(o) {
if (T === void 0) {
var l = !!o && o.reserveScrollBarGap === !0, n = window.innerWidth - document.documentElement.clientWidth;
if (l && n > 0) {
var a = parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"), 10);
T = document.body.style.paddingRight, document.body.style.paddingRight = a + n + "px";
}
}
P === void 0 && (P = document.body.style.overflow, document.body.style.overflow = "hidden");
}, Ne = function() {
T !== void 0 && (document.body.style.paddingRight = T, T = void 0), P !== void 0 && (document.body.style.overflow = P, P = void 0);
}, qe = function() {
return window.requestAnimationFrame(function() {
if (S === void 0) {
S = {
position: document.body.style.position,
top: document.body.style.top,
left: document.body.style.left
};
var o = window, l = o.scrollY, n = o.scrollX, a = o.innerHeight;
document.body.style.position = "fixed", document.body.style.top = -l, document.body.style.left = -n, setTimeout(function() {
return window.requestAnimationFrame(function() {
var i = a - window.innerHeight;
i && l >= a && (document.body.style.top = -(l + i));
});
}, 300);
}
});
}, De = function() {
if (S !== void 0) {
var o = -parseInt(document.body.style.top, 10), l = -parseInt(document.body.style.left, 10);
document.body.style.position = S.position, document.body.style.top = S.top, document.body.style.left = S.left, window.scrollTo(l, o), S = void 0;
}
}, Ee = function(o) {
return o ? o.scrollHeight - o.scrollTop <= o.clientHeight : !1;
}, Oe = function(o, l) {
var n = o.targetTouches[0].clientY - ae;
return ie(o.target) ? !1 : l && l.scrollTop === 0 && n > 0 || Ee(l) && n < 0 ? E(o) : (o.stopPropagation(), !0);
}, ze = function(o, l) {
if (!o) {
console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");
return;
}
if (!C.some(function(a) {
return a.targetElement === o;
})) {
var n = {
targetElement: o,
options: l || {}
};
C = [].concat(Ie(C), [n]), q ? qe() : Ae(l), q && (o.ontouchstart = function(a) {
a.targetTouches.length === 1 && (ae = a.targetTouches[0].clientY);
}, o.ontouchmove = function(a) {
a.targetTouches.length === 1 && Oe(a, o);
}, D || (document.addEventListener("touchmove", E, j ? { passive: !1 } : void 0), D = !0));
}
}, Me = function(o) {
if (!o) {
console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");
return;
}
C = C.filter(function(l) {
return l.targetElement !== o;
}), q && (o.ontouchstart = null, o.ontouchmove = null, D && C.length === 0 && (document.removeEventListener("touchmove", E, j ? { passive: !1 } : void 0), D = !1)), q ? De() : Ne();
}, K = $({
name: "SidePanelCloseButton",
emits: ["close"]
});
const Le = /* @__PURE__ */ r(
"span",
{ class: "vsp-close__x" },
null,
-1
/* HOISTED */
), Fe = [
Le
];
function Ge(e, o, l, n, a, i) {
return u(), v("div", {
class: "vsp-close",
onClick: o[0] || (o[0] = (t) => e.$emit("close"))
}, [...Fe]);
}
K.render = Ge;
K.__file = "src/components/SidePanelCloseButton.vue";
var X = $({
name: "VueSidePanel",
components: {
SidePanelCloseButton: K
},
props: {
idName: {
type: String,
default: "vsp-container"
},
hideCloseBtn: {
type: Boolean,
default: !1
},
noClose: {
type: Boolean,
default: !1
},
side: {
type: String,
validator: (e) => ["top", "right", "bottom", "left"].includes(e),
default: "right"
},
rerender: {
type: Boolean,
default: !1
},
zIndex: {
type: [Number, String],
default: "auto"
},
width: {
type: String,
default: "auto"
},
height: {
type: String,
default: "auto"
},
lockScroll: {
type: Boolean,
default: !1
},
lockScrollHtml: {
type: Boolean,
default: !0
},
modelValue: {
type: Boolean,
default: !1,
required: !0
},
overlayColor: {
type: String,
default: "black"
},
overlayOpacity: {
type: Number,
default: 0.5
},
overlayDuration: {
type: Number,
default: 500
},
panelColor: {
type: String,
default: "white"
},
panelDuration: {
type: Number,
default: 300
},
transitionName: {
type: String,
default: void 0
},
headerClass: {
type: String,
default: ""
},
bodyClass: {
type: String,
default: ""
},
footerClass: {
type: String,
default: ""
}
},
emits: ["update:modelValue", "closed", "opened"],
setup(e, { emit: o, attrs: l }) {
let n;
const a = c(null), i = c(null), t = c(null), s = c(null), d = c(null), p = c(0), h = c(0), A = c(0), z = c(0), M = c(0), L = c(), J = c(!1), V = async () => {
window?.innerHeight > 0 && (M.value = window.innerHeight), p.value = t.value ? t.value.clientHeight : 0, A.value = s.value ? s.value.clientHeight : 0, h.value = d.value ? d.value.scrollHeight : 0, z.value = a.value ? a.value.clientHeight : 0;
}, de = () => o("update:modelValue", !1), F = (y, g) => {
if (g) {
setTimeout(() => {
ze(y, { reserveScrollBarGap: !0 }), e.lockScrollHtml && (document.documentElement.style.overflow = "hidden");
}, 0);
return;
}
Me(y), e.lockScrollHtml && document.documentElement.style.removeProperty("overflow");
}, re = () => Math.max(...Array.from(document.querySelectorAll("body *"), (y) => parseFloat(window.getComputedStyle(y).zIndex)).filter((y) => !Number.isNaN(y)), 0);
Y(() => {
L.value = e.zIndex === "auto" ? re() : e.zIndex;
}), he(() => {
document.getElementById(e.idName) || (n = document.createElement("div"), n.setAttribute("id", e.idName), document.body.appendChild(n));
}), ge(() => {
const { modelValue: y, lockScroll: g } = e;
g && a.value && y && F(a.value, !1), n && document.body.removeChild(n), window.removeEventListener("resize", V);
}), x(() => [s.value, t.value, e.height, e.width, e.side, e.modelValue], () => {
be(() => V());
}), x(() => [e.modelValue, a.value], (y, g) => {
const fe = g ? g[0] : !1, [G, N] = y, pe = G, ye = fe && !G;
if (N) {
if (pe && (J.value = !!document.body.style.overflow), G) {
e.lockScroll && F(N, !0), V(), window.addEventListener("resize", V);
return;
}
!e.lockScroll || !ye || J.value || (setTimeout(() => {
N && F(N, !1);
}, e.panelDuration), window.removeEventListener("resize", V));
}
}, { immediate: !0 });
const se = U(() => {
if (!z.value)
return;
const y = h.value + A.value + p.value;
let g = z.value - A.value - p.value;
return ["top", "bottom"].includes(e.side) && e.height === "auto" && (g = M.value >= y ? h.value : M.value - A.value - p.value), g;
}), ue = U(() => ({
zIndex: L.value,
animationDuration: `${e.overlayDuration}ms`,
"--overlay-opacity": e.overlayOpacity,
opacity: e.modelValue ? e.overlayOpacity : 0,
backgroundColor: e.overlayColor,
pointerEvents: e.modelValue ? "all" : "none"
})), ce = U(() => ({
width: ["left", "right"].includes(e.side) ? e.width : void 0,
maxWidth: "100%",
...["top", "bottom"].includes(e.side) ? {
// minHeight: props.height,
height: e.height,
maxHeight: "100%"
} : {},
zIndex: L.value,
backgroundColor: e.panelColor,
animationDuration: `${e.panelDuration}ms`,
...Object.assign({}, l.style)
}));
return {
body: d,
panel: a,
overlay: i,
overlayStyles: ue,
header: s,
footer: t,
closePanel: de,
panelStyles: ce,
bodyHeight: se
};
}
});
function Re(e, o, l, n, a, i) {
const t = ve("SidePanelCloseButton");
return u(), H(me, {
to: `#${e.idName}`
}, [
r(
"div",
{
class: m(["vsp-wrapper", [e.modelValue && "vsp-wrapper--active"]])
},
[
I(_, {
name: "overlay",
persisted: ""
}, {
default: k(() => [
Q(r(
"div",
{
ref: "overlay",
class: "vsp-overlay",
style: R(e.overlayStyles),
onClick: o[0] || (o[0] = () => e.noClose ? void 0 : e.closePanel())
},
null,
4
/* STYLE */
), [
[Z, e.modelValue]
])
]),
_: 1
/* STABLE */
}),
I(_, {
name: e.transitionName || `slide-${e.side}`,
onAfterEnter: o[1] || (o[1] = (s) => e.$emit("opened")),
onAfterLeave: o[2] || (o[2] = (s) => e.$emit("closed"))
}, {
default: k(() => [
!e.rerender || e.modelValue ? Q((u(), v(
"div",
{
key: 0,
ref: "panel",
class: m(["vsp", [`vsp--${e.side}-side`, e.$attrs.class]]),
style: R(e.panelStyles)
},
[
e.$slots.header ? (u(), v(
"div",
{
key: 0,
ref: "header",
class: m([e.headerClass, "vsp__header"])
},
[
B(e.$slots, "header", { close: e.closePanel })
],
2
/* CLASS */
)) : w("v-if", !0),
r(
"div",
{
ref: "body",
class: m([e.bodyClass, "vsp__body"]),
style: R({ height: `${e.bodyHeight}px` })
},
[
B(e.$slots, "default", { close: e.closePanel }),
e.hideCloseBtn ? w("v-if", !0) : (u(), H(t, {
key: 0,
onClose: e.closePanel
}, null, 8, ["onClose"]))
],
6
/* CLASS, STYLE */
),
e.$slots.footer ? (u(), v(
"div",
{
key: 1,
ref: "footer",
class: m([e.footerClass, "vsp__footer"])
},
[
B(e.$slots, "footer")
],
2
/* CLASS */
)) : w("v-if", !0)
],
6
/* CLASS, STYLE */
)), [
[Z, e.rerender ? !0 : e.modelValue]
]) : w("v-if", !0)
]),
_: 3
/* FORWARDED */
}, 8, ["name"])
],
2
/* CLASS */
)
], 8, ["to"]);
}
X.render = Re;
X.__file = "src/components/SidePanel.vue";
const Ue = { id: "konnectio-side-panel-header" }, We = { id: "konnectio-side-panel-title" }, Ye = {
key: 0,
id: "konnectio-side-panel-subtitle"
}, je = ["innerHTML"], Ke = /* @__PURE__ */ $({
__name: "Base",
props: {
modelValue: { type: Boolean },
title: {},
subtitle: {},
idName: {},
description: {},
side: { default: "right" },
lockScroll: { type: Boolean, default: !0 },
hideCloseButton: { type: Boolean, default: !0 },
width: { default: "840px" }
},
emits: ["update:modelValue", "opened", "closed"],
setup(e, { emit: o }) {
const l = o;
function n() {
l("closed");
}
function a() {
l("opened");
}
return (i, t) => (u(), H(f(X), {
modelValue: i.modelValue,
"lock-scroll": i.lockScroll,
"hide-close-btn": i.hideCloseButton,
width: i.width,
"onUpdate:modelValue": t[1] || (t[1] = (s) => i.$emit("update:modelValue", s)),
onClosed: n,
onOpened: a
}, we({
header: k(() => [
r("div", Ue, [
r("h2", We, [
r("span", null, b(f(Ve)(i.title)), 1),
r("button", {
id: "konnectio-side-panel-close",
onClick: t[0] || (t[0] = (s) => i.$emit("update:modelValue", !1))
}, [
I(Pe, {
icon: "times",
type: "fas",
color: "header"
})
])
]),
i.subtitle ? (u(), v("h4", Ye, [
r("span", null, b(i.subtitle), 1)
])) : w("", !0)
])
]),
default: k(() => [
i.description ? (u(), v("div", {
key: 0,
class: "konnectio-side-panel-description",
innerHTML: i.description
}, null, 8, je)) : w("", !0),
B(i.$slots, "default", {}, void 0, !0)
]),
_: 2
}, [
i.$slots.footer ? {
name: "footer",
fn: k(() => [
B(i.$slots, "footer", {}, void 0, !0)
]),
key: "0"
} : void 0
]), 1032, ["modelValue", "lock-scroll", "hide-close-btn", "width"]));
}
}), ro = /* @__PURE__ */ O(Ke, [["__scopeId", "data-v-5fa2ba15"]]), Xe = { class: "konnectio-phone-input" }, Je = /* @__PURE__ */ $({
__name: "PhoneField",
props: {
modelValue: {},
label: {},
id: {},
placeholder: {},
icon: { default: "phone-office" },
iconColor: {},
iconType: { default: "fal" },
required: { type: Boolean, default: !1 },
readonly: { type: Boolean, default: !1 }
},
emits: ["update:modelValue"],
setup(e, { emit: o }) {
const l = o, n = e, a = n.id || ee(), i = c("+45"), t = c("");
function s() {
l("update:modelValue", `${i.value} ${t.value}`);
}
return Y(() => {
if (n.modelValue) {
const d = n.modelValue.split(" ");
i.value = d[0], t.value = d[1];
}
}), (d, p) => (u(), H(ne, {
label: d.label,
id: f(a),
type: "phone",
required: d.required,
readonly: d.readonly
}, {
default: k(() => [
r("div", Xe, [
I(oe, {
modelValue: i.value,
"onUpdate:modelValue": p[0] || (p[0] = (h) => i.value = h),
type: "text",
id: f(ee)(),
name: "phone-code",
autocomplete: "tel-country-code",
icon: d.icon,
"icon-color": d.iconColor,
"icon-type": d.iconType,
placeholder: "+XX",
required: d.required,
readonly: d.readonly,
onInput: p[1] || (p[1] = (h) => s())
}, null, 8, ["modelValue", "id", "icon", "icon-color", "icon-type", "required", "readonly"]),
I(oe, {
modelValue: t.value,
"onUpdate:modelValue": p[2] || (p[2] = (h) => t.value = h),
type: "number",
name: "phone",
autocomplete: "tel-national",
inputmode: "numeric",
id: f(a),
placeholder: d.placeholder,
required: d.required,
readonly: d.readonly,
onInput: p[3] || (p[3] = (h) => s())
}, null, 8, ["modelValue", "id", "placeholder", "required", "readonly"])
])
]),
_: 1
}, 8, ["label", "id", "required", "readonly"]));
}
}), so = /* @__PURE__ */ O(Je, [["__scopeId", "data-v-3e373d03"]]), Qe = ["required", "type", "name", "readonly", "disabled", "value", "checked"], Ze = ["data-test"], _e = { key: 0 }, xe = {
key: 1,
class: /* @__PURE__ */ m(["konnectio-click-box-label", "inline"])
}, eo = /* @__PURE__ */ $({
__name: "Checkbox",
props: {
modelValue: { type: [String, Boolean, Number] },
numeric: { type: Boolean, default: !1 },
checked: { type: Boolean, default: !1 },
label: {},
price: {},
name: {},
readonly: { type: Boolean, default: !1 },
type: { default: "checkbox" },
required: { type: Boolean, default: !1 },
val: {}
},
emits: ["update:modelValue"],
setup(e, { emit: o }) {
const l = e, n = o, a = Se();
function i() {
l.readonly !== !0 && n(
"update:modelValue",
l.type === "radio" ? l.val : l.numeric ? l.modelValue ? 0 : 1 : !l.modelValue
);
}
return (t, s) => (u(), H(ne, {
required: t.required,
type: t.type,
readonly: t.readonly
}, {
default: k(() => [
r("label", {
class: m([
"konnectio-click-box-container",
{ "is-readonly": t.readonly },
{ "has-label": t.label || f(a).default },
t.type === "radio" ? "radio" : "checkbox",
{ active: t.type === "radio" ? t.val === t.modelValue : !!t.modelValue }
])
}, [
r("input", ke(t.$attrs, {
required: !!t.required,
type: t.type,
name: t.name,
class: "hidden",
readonly: !!t.readonly,
disabled: !!t.readonly,
value: t.type === "radio" ? t.val : t.modelValue,
checked: t.type === "radio" ? t.val === t.modelValue : !!t.modelValue,
onChange: s[0] || (s[0] = (d) => i())
}), null, 16, Qe),
r("div", {
class: m([
"konnectio-click-box",
{ checked: t.type === "radio" ? t.val === t.modelValue : !!t.modelValue }
]),
tabindex: "0",
"data-test": t.name,
onKeyup: s[1] || (s[1] = Ce((d) => i(), ["enter"]))
}, null, 42, Ze),
t.label ? (u(), v("div", {
key: 0,
class: m(["konnectio-click-box-label", "text-hover", { "with-price": t.price }])
}, [
r("span", null, b(t.label), 1),
t.price ? (u(), v("span", _e, b(t.price), 1)) : w("", !0)
], 2)) : f(a).default ? (u(), v("div", xe, [
B(t.$slots, "default", {}, void 0, !0)
])) : w("", !0)
], 2)
]),
_: 3
}, 8, ["required", "type", "readonly"]));
}
}), uo = /* @__PURE__ */ O(eo, [["__scopeId", "data-v-6e9623bf"]]), oo = {
href: "https://policies.google.com/privacy",
target: "_blank"
}, to = {
href: "https://policies.google.com/terms",
target: "_blank"
}, lo = /* @__PURE__ */ $({
__name: "GoogleNotice",
setup(e) {
const { t: o } = $e();
return (l, n) => (u(), v("span", null, [
W(b(f(o)("googleNotice")) + " ", 1),
r("a", oo, b(f(o)("googlePrivacyPolicy")), 1),
W(" " + b(f(o)("googleAnd")) + " ", 1),
r("a", to, b(f(o)("googleTOS")), 1),
W(" " + b(f(o)("googleApply")) + ". ", 1)
]));
}
});
function le(e) {
const o = e;
o.__i18n = o.__i18n || [], o.__i18n.push({
locale: "",
resource: {
da: {
googleNotice: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Denne side er beskyttet af reCAPTCHA og Google's" } },
googlePrivacyPolicy: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Privatlivspolitik" } },
googleAnd: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "og" } },
googleTOS: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Servicevilkår" } },
googleApply: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "er gældende" } }
},
en: {
googleNotice: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "This site is protected by reCAPTCHA and the Google" } },
googlePrivacyPolicy: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Privacy Policy" } },
googleAnd: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "and" } },
googleTOS: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Terms of Service" } },
googleApply: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "apply" } }
}
}
});
}
typeof le == "function" && le(lo);
const no = /* @__PURE__ */ $({
__name: "CheckoutWindow",
setup(e) {
const { paymentGatewayId: o } = Be(Te());
return Y(() => {
const l = document.createElement("script"), n = document.createElement("script");
l.setAttribute("src", "https://checkout.dibspayment.eu/v1/checkout.js?v=1"), n.setAttribute("src", "https://checkout.reepay.com/checkout.js"), document.head.appendChild(l), document.head.appendChild(n);
}), (l, n) => (u(), v("div", null, [
r("div", {
id: "konnectio-payment-checkout-wrapper",
class: m({ reePay: f(o) === f(He).ReePay })
}, n[0] || (n[0] = [
r("div", { id: "konnectio-payment-checkout" }, null, -1)
]), 2)
]));
}
}), co = /* @__PURE__ */ O(no, [["__scopeId", "data-v-853041a4"]]);
export {
ro as B,
co as C,
so as P,
lo as _,
uo as a
};
//# sourceMappingURL=CheckoutWindow-BE4Pox7h.js.map