@craterapp/vue-sdk
Version:
Embedded Invoicing & Bill Pay for platforms.
115 lines (114 loc) • 3.37 kB
JavaScript
import { c as m, t as p, r as f, a as w, u as q, d as g, b as x } from "./index-IlzZ4Xqv.js";
import { defineComponent as S, ref as h, computed as k, watch as A, openBlock as B, createElementBlock as C, Fragment as N, withDirectives as v, createVNode as d, unref as t, withCtx as V, createElementVNode as o, createTextVNode as y, vShow as $ } from "vue";
const U = { class: "text-sm mt-1 text-gray-600" }, D = { class: "text-sm mt-1 text-gray-600" }, j = /* @__PURE__ */ S({
inheritAttrs: !1,
__name: "UrlType",
props: {
modelValue: {
type: String,
default: null
},
requirements: {
type: Array,
default: () => []
},
field: {
type: Object,
required: !0
},
placeholder: {
type: String,
default: ""
},
validationScope: {
type: String,
required: !0
},
step: {
type: Object,
required: !0
}
},
setup(r) {
const u = r, a = h(!1), b = {
value: {
required: m.withMessage(
p("validation.required"),
f((n) => a.value == !1)
)
},
alternateValue: {
required: m.withMessage(
p("validation.required"),
f((n) => a.value == !0)
)
}
}, l = w(
b,
k(() => u.field),
{ $scope: u.validationScope }
);
return A(a, () => {
u.field.value = null, u.field.alternateValue = null;
}), q(), (n, e) => {
const s = g, c = x;
return B(), C(N, null, [
v(d(c, {
label: r.field.label,
required: "",
error: t(l).value.$error && t(l).value.$errors[0].$message,
"data-cy": "website-url"
}, {
default: V(() => [
d(s, {
modelValue: r.field.value,
"onUpdate:modelValue": e[0] || (e[0] = (i) => r.field.value = i),
invalid: t(l).value.$error
}, null, 8, ["modelValue", "invalid"]),
o("p", U, [
y(" No website? "),
o("a", {
href: "#",
class: "text-primary-500",
"data-cy": "add-product-description",
onClick: e[1] || (e[1] = (i) => a.value = !0)
}, " Add a product description instead ")
])
]),
_: 1
}, 8, ["label", "error"]), [
[$, !t(a)]
]),
v(d(c, {
label: "Product Description",
required: "",
"data-cy": "product-description",
error: t(l).alternateValue.$error && t(l).alternateValue.$errors[0].$message
}, {
default: V(() => [
d(s, {
modelValue: r.field.alternateValue,
"onUpdate:modelValue": e[2] || (e[2] = (i) => r.field.alternateValue = i),
invalid: t(l).alternateValue.$error
}, null, 8, ["modelValue", "invalid"]),
o("p", D, [
y(" Have a website? "),
o("a", {
href: "#",
class: "text-primary-500",
"data-cy": "add-website-url",
onClick: e[3] || (e[3] = (i) => a.value = !1)
}, " Add a website URL ")
])
]),
_: 1
}, 8, ["error"]), [
[$, t(a)]
])
], 64);
};
}
});
export {
j as default
};