@xosen/site-sdk 0.0.1

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/dist/index.js ADDED
@@ -0,0 +1,986 @@
1
+ import { onMounted as j, computed as p, defineComponent as g, openBlock as n, createElementBlock as a, Fragment as v, renderList as x, normalizeClass as $, toDisplayString as _, ref as T, onUnmounted as R, createElementVNode as d, createBlock as P, createCommentVNode as u, createVNode as O, renderSlot as F, normalizeStyle as I, resolveDynamicComponent as L, withCtx as q, createTextVNode as D, watch as B, mergeProps as H } from "vue";
2
+ import { useI18n as N } from "vue-i18n";
3
+ function M(c) {
4
+ function o(e) {
5
+ const t = document.documentElement;
6
+ if (e.colors)
7
+ for (const [r, i] of Object.entries(e.colors))
8
+ i && t.style.setProperty(`--x-color-${z(r)}`, i);
9
+ e.typography?.fontFamily && t.style.setProperty("--x-font-family", e.typography.fontFamily), e.typography?.headingFont && t.style.setProperty("--x-font-heading", e.typography.headingFont), e.typography?.baseFontSize && t.style.setProperty("--x-font-size", e.typography.baseFontSize), e.shape?.borderRadius && t.style.setProperty("--x-border-radius", e.shape.borderRadius), e.shape?.maxWidth && t.style.setProperty("--x-max-width", e.shape.maxWidth);
10
+ }
11
+ j(() => {
12
+ if (c) {
13
+ o(c);
14
+ return;
15
+ }
16
+ const t = window.__SITE_DATA__?.skin;
17
+ t && (t.colors || t.typography || t.shape) && o({
18
+ colors: t.colors || {},
19
+ typography: t.typography || {},
20
+ shape: t.shape || {}
21
+ });
22
+ });
23
+ }
24
+ function z(c) {
25
+ return c.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
26
+ }
27
+ function A() {
28
+ const c = window.__SITE_DATA__, o = p(() => c?.config || null), e = p(() => o.value?.navigation || []), t = p(() => o.value?.locales || []), r = p(() => o.value?.defaultLocale || "en"), i = p(() => o.value?.branding || {}), s = p(() => o.value?.footer || {}), l = p(() => o.value?.features || {});
29
+ function f(b) {
30
+ const m = l.value[b];
31
+ return typeof m == "boolean" ? m : typeof m == "object";
32
+ }
33
+ return {
34
+ config: o,
35
+ navigation: e,
36
+ locales: t,
37
+ defaultLocale: r,
38
+ branding: i,
39
+ footer: s,
40
+ features: l,
41
+ hasFeature: f
42
+ };
43
+ }
44
+ const G = /* @__PURE__ */ g({
45
+ __name: "XLocaleSwitcher",
46
+ props: {
47
+ locales: { type: Array, required: !0 }
48
+ },
49
+ setup(c, { expose: o }) {
50
+ o();
51
+ const { locale: e } = N();
52
+ function t(i) {
53
+ e.value = i, localStorage.setItem("site-locale", i);
54
+ }
55
+ const r = { locale: e, switchLocale: t };
56
+ return Object.defineProperty(r, "__isScriptSetup", { enumerable: !1, value: !0 }), r;
57
+ }
58
+ }), k = (c, o) => {
59
+ const e = c.__vccOpts || c;
60
+ for (const [t, r] of o)
61
+ e[t] = r;
62
+ return e;
63
+ }, K = { class: "x-locale-switcher" }, V = ["onClick"];
64
+ function W(c, o, e, t, r, i) {
65
+ return n(), a("div", K, [
66
+ (n(!0), a(
67
+ v,
68
+ null,
69
+ x(e.locales, (s) => (n(), a("button", {
70
+ key: s,
71
+ class: $(["x-locale-switcher__btn", { "x-locale-switcher__btn--active": t.locale === s }]),
72
+ onClick: (l) => t.switchLocale(s)
73
+ }, _(s.toUpperCase()), 11, V))),
74
+ 128
75
+ /* KEYED_FRAGMENT */
76
+ ))
77
+ ]);
78
+ }
79
+ const J = /* @__PURE__ */ k(G, [["render", W], ["__scopeId", "data-v-675f0bbd"], ["__file", "/Users/yariksav/projects/xosen/xosen-monorepo/packages/site-sdk/src/components/common/XLocaleSwitcher.vue"]]), Y = /* @__PURE__ */ g({
80
+ __name: "XSiteNav",
81
+ setup(c, { expose: o }) {
82
+ o();
83
+ const { navigation: e, branding: t, locales: r } = A(), i = T(!1), s = T(!1);
84
+ function l() {
85
+ i.value = window.scrollY > 20;
86
+ }
87
+ j(() => window.addEventListener("scroll", l)), R(() => window.removeEventListener("scroll", l));
88
+ const f = { navigation: e, branding: t, locales: r, scrolled: i, menuOpen: s, onScroll: l, XLocaleSwitcher: J };
89
+ return Object.defineProperty(f, "__isScriptSetup", { enumerable: !1, value: !0 }), f;
90
+ }
91
+ }), Z = { class: "x-nav__container" }, Q = {
92
+ href: "/",
93
+ class: "x-nav__logo"
94
+ }, ee = ["src", "alt"], te = {
95
+ key: 1,
96
+ class: "x-nav__logo-text"
97
+ }, se = ["href", "target"];
98
+ function oe(c, o, e, t, r, i) {
99
+ return n(), a(
100
+ "nav",
101
+ {
102
+ class: $(["x-nav", { "x-nav--scrolled": t.scrolled }])
103
+ },
104
+ [
105
+ d("div", Z, [
106
+ d("a", Q, [
107
+ t.branding.logo ? (n(), a("img", {
108
+ key: 0,
109
+ src: t.branding.logo,
110
+ alt: t.branding.siteName || "",
111
+ class: "x-nav__logo-img"
112
+ }, null, 8, ee)) : (n(), a(
113
+ "span",
114
+ te,
115
+ _(t.branding.siteName || ""),
116
+ 1
117
+ /* TEXT */
118
+ ))
119
+ ]),
120
+ d(
121
+ "div",
122
+ {
123
+ class: $(["x-nav__links", { "x-nav__links--open": t.menuOpen }])
124
+ },
125
+ [
126
+ (n(!0), a(
127
+ v,
128
+ null,
129
+ x(t.navigation, (s) => (n(), a("a", {
130
+ key: s.url,
131
+ href: s.url,
132
+ class: "x-nav__link",
133
+ target: s.external ? "_blank" : void 0,
134
+ onClick: o[0] || (o[0] = (l) => t.menuOpen = !1)
135
+ }, _(s.text), 9, se))),
136
+ 128
137
+ /* KEYED_FRAGMENT */
138
+ )),
139
+ t.locales.length > 1 ? (n(), P(t.XLocaleSwitcher, {
140
+ key: 0,
141
+ locales: t.locales
142
+ }, null, 8, ["locales"])) : u("v-if", !0)
143
+ ],
144
+ 2
145
+ /* CLASS */
146
+ ),
147
+ d("button", {
148
+ class: "x-nav__hamburger",
149
+ onClick: o[1] || (o[1] = (s) => t.menuOpen = !t.menuOpen)
150
+ }, [...o[2] || (o[2] = [
151
+ d(
152
+ "span",
153
+ null,
154
+ null,
155
+ -1
156
+ /* CACHED */
157
+ ),
158
+ d(
159
+ "span",
160
+ null,
161
+ null,
162
+ -1
163
+ /* CACHED */
164
+ ),
165
+ d(
166
+ "span",
167
+ null,
168
+ null,
169
+ -1
170
+ /* CACHED */
171
+ )
172
+ ])])
173
+ ])
174
+ ],
175
+ 2
176
+ /* CLASS */
177
+ );
178
+ }
179
+ const ne = /* @__PURE__ */ k(Y, [["render", oe], ["__scopeId", "data-v-07c4b748"], ["__file", "/Users/yariksav/projects/xosen/xosen-monorepo/packages/site-sdk/src/components/layout/XSiteNav.vue"]]), ae = /* @__PURE__ */ g({
180
+ __name: "XSiteFooter",
181
+ setup(c, { expose: o }) {
182
+ o();
183
+ const { footer: e, branding: t } = A(), r = p(() => e.value.copyright ? e.value.copyright : `© ${(/* @__PURE__ */ new Date()).getFullYear()} ${t.value.siteName || ""}`), i = { footerConfig: e, branding: t, copyright: r };
184
+ return Object.defineProperty(i, "__isScriptSetup", { enumerable: !1, value: !0 }), i;
185
+ }
186
+ }), re = { class: "x-footer" }, ce = { class: "x-footer__container" }, ie = {
187
+ key: 0,
188
+ class: "x-footer__links"
189
+ }, le = ["href"], _e = {
190
+ key: 1,
191
+ class: "x-footer__copyright"
192
+ };
193
+ function ue(c, o, e, t, r, i) {
194
+ return n(), a("footer", re, [
195
+ d("div", ce, [
196
+ t.footerConfig.links?.length ? (n(), a("div", ie, [
197
+ (n(!0), a(
198
+ v,
199
+ null,
200
+ x(t.footerConfig.links, (s) => (n(), a("a", {
201
+ key: s.url,
202
+ href: s.url,
203
+ class: "x-footer__link"
204
+ }, _(s.text), 9, le))),
205
+ 128
206
+ /* KEYED_FRAGMENT */
207
+ ))
208
+ ])) : u("v-if", !0),
209
+ t.copyright ? (n(), a(
210
+ "p",
211
+ _e,
212
+ _(t.copyright),
213
+ 1
214
+ /* TEXT */
215
+ )) : u("v-if", !0)
216
+ ])
217
+ ]);
218
+ }
219
+ const de = /* @__PURE__ */ k(ae, [["render", ue], ["__scopeId", "data-v-f9b38381"], ["__file", "/Users/yariksav/projects/xosen/xosen-monorepo/packages/site-sdk/src/components/layout/XSiteFooter.vue"]]), fe = /* @__PURE__ */ g({
220
+ __name: "XSiteLayout",
221
+ setup(c, { expose: o }) {
222
+ o(), M();
223
+ const e = { XSiteNav: ne, XSiteFooter: de };
224
+ return Object.defineProperty(e, "__isScriptSetup", { enumerable: !1, value: !0 }), e;
225
+ }
226
+ }), pe = { class: "x-site-layout" }, me = { class: "x-site-layout__main" };
227
+ function he(c, o, e, t, r, i) {
228
+ return n(), a("div", pe, [
229
+ O(t.XSiteNav),
230
+ d("main", me, [
231
+ F(c.$slots, "default", {}, void 0, !0)
232
+ ]),
233
+ O(t.XSiteFooter)
234
+ ]);
235
+ }
236
+ const qt = /* @__PURE__ */ k(fe, [["render", he], ["__scopeId", "data-v-41b0f2a9"], ["__file", "/Users/yariksav/projects/xosen/xosen-monorepo/packages/site-sdk/src/components/layout/XSiteLayout.vue"]]), ve = /* @__PURE__ */ g({
237
+ __name: "XHeroBlock",
238
+ props: {
239
+ data: { type: Object, required: !0 },
240
+ variant: { type: String, required: !1, default: "fullscreen" }
241
+ },
242
+ setup(c, { expose: o }) {
243
+ o();
244
+ const e = c, t = p(() => e.data.image ? { backgroundImage: `url(${e.data.image})` } : {}), r = { props: e, bgStyle: t };
245
+ return Object.defineProperty(r, "__isScriptSetup", { enumerable: !1, value: !0 }), r;
246
+ }
247
+ }), xe = {
248
+ key: 0,
249
+ class: "x-hero__overlay"
250
+ }, ye = { class: "x-hero__content" }, ge = {
251
+ key: 0,
252
+ class: "x-hero__title"
253
+ }, ke = {
254
+ key: 1,
255
+ class: "x-hero__subtitle"
256
+ }, be = {
257
+ key: 2,
258
+ class: "x-hero__buttons"
259
+ }, $e = ["href"], Se = {
260
+ key: 3,
261
+ class: "x-hero__stats"
262
+ }, we = { class: "x-hero__stat-value" }, Te = { class: "x-hero__stat-label" };
263
+ function je(c, o, e, t, r, i) {
264
+ return n(), a(
265
+ "section",
266
+ {
267
+ class: $(["x-hero", { "x-hero--fullscreen": e.variant === "fullscreen" }]),
268
+ style: I(t.bgStyle)
269
+ },
270
+ [
271
+ e.data.image && e.data.overlay !== !1 ? (n(), a("div", xe)) : u("v-if", !0),
272
+ d("div", ye, [
273
+ e.data.title ? (n(), a(
274
+ "h1",
275
+ ge,
276
+ _(e.data.title),
277
+ 1
278
+ /* TEXT */
279
+ )) : u("v-if", !0),
280
+ e.data.subtitle ? (n(), a(
281
+ "p",
282
+ ke,
283
+ _(e.data.subtitle),
284
+ 1
285
+ /* TEXT */
286
+ )) : u("v-if", !0),
287
+ e.data.buttons?.length ? (n(), a("div", be, [
288
+ (n(!0), a(
289
+ v,
290
+ null,
291
+ x(e.data.buttons, (s, l) => (n(), a("a", {
292
+ key: l,
293
+ href: s.url,
294
+ class: $(["x-btn", `x-btn--${s.variant || "primary"}`])
295
+ }, _(s.text), 11, $e))),
296
+ 128
297
+ /* KEYED_FRAGMENT */
298
+ ))
299
+ ])) : u("v-if", !0),
300
+ e.data.stats?.length ? (n(), a("div", Se, [
301
+ (n(!0), a(
302
+ v,
303
+ null,
304
+ x(e.data.stats, (s, l) => (n(), a("div", {
305
+ key: l,
306
+ class: "x-hero__stat"
307
+ }, [
308
+ d(
309
+ "span",
310
+ we,
311
+ _(s.value),
312
+ 1
313
+ /* TEXT */
314
+ ),
315
+ d(
316
+ "span",
317
+ Te,
318
+ _(s.label),
319
+ 1
320
+ /* TEXT */
321
+ )
322
+ ]))),
323
+ 128
324
+ /* KEYED_FRAGMENT */
325
+ ))
326
+ ])) : u("v-if", !0)
327
+ ])
328
+ ],
329
+ 6
330
+ /* CLASS, STYLE */
331
+ );
332
+ }
333
+ const Ce = /* @__PURE__ */ k(ve, [["render", je], ["__scopeId", "data-v-d8cfe56f"], ["__file", "/Users/yariksav/projects/xosen/xosen-monorepo/packages/site-sdk/src/components/blocks/XHeroBlock.vue"]]), Xe = /* @__PURE__ */ g({
334
+ __name: "XHtmlBlock",
335
+ props: {
336
+ data: { type: Object, required: !0 }
337
+ },
338
+ setup(c, { expose: o }) {
339
+ o();
340
+ const e = {};
341
+ return Object.defineProperty(e, "__isScriptSetup", { enumerable: !1, value: !0 }), e;
342
+ }
343
+ }), Be = { class: "x-html-block" }, Pe = ["innerHTML"];
344
+ function Oe(c, o, e, t, r, i) {
345
+ return n(), a("section", Be, [
346
+ d("div", {
347
+ class: "x-html-block__content",
348
+ innerHTML: e.data.content
349
+ }, null, 8, Pe)
350
+ ]);
351
+ }
352
+ const Ie = /* @__PURE__ */ k(Xe, [["render", Oe], ["__scopeId", "data-v-abfd69e8"], ["__file", "/Users/yariksav/projects/xosen/xosen-monorepo/packages/site-sdk/src/components/blocks/XHtmlBlock.vue"]]), Le = /* @__PURE__ */ g({
353
+ __name: "XCardsBlock",
354
+ props: {
355
+ data: { type: Object, required: !0 },
356
+ variant: { type: String, required: !1, default: "default" },
357
+ columns: { type: Number, required: !1, default: void 0 }
358
+ },
359
+ setup(c, { expose: o }) {
360
+ o();
361
+ const e = c, t = p(() => ({ "--columns": e.columns || Math.min(e.data.cards.length, 4) })), r = { color: "var(--x-color-primary, #1e73be)" }, i = {
362
+ "mdi-lightbulb": "💡",
363
+ "mdi-code-braces": "⚙️",
364
+ "mdi-headset": "🎧",
365
+ "mdi-check-circle": "✅",
366
+ "mdi-shield": "🛡️",
367
+ "mdi-chart-line": "📈",
368
+ "mdi-rocket": "🚀",
369
+ "mdi-heart": "❤️",
370
+ "mdi-star": "⭐",
371
+ "mdi-cog": "⚙️",
372
+ "mdi-email": "📧",
373
+ "mdi-phone": "📞",
374
+ "mdi-map-marker": "📍",
375
+ "mdi-clock": "🕐",
376
+ "mdi-account": "👤",
377
+ "mdi-team": "👥"
378
+ };
379
+ function s(f) {
380
+ return i[f] || f;
381
+ }
382
+ const l = { props: e, gridStyle: t, iconStyle: r, iconMap: i, iconDisplay: s };
383
+ return Object.defineProperty(l, "__isScriptSetup", { enumerable: !1, value: !0 }), l;
384
+ }
385
+ }), Ne = { class: "x-cards-block__container" }, Ae = {
386
+ key: 0,
387
+ class: "x-cards-block__title"
388
+ }, Ee = {
389
+ key: 1,
390
+ class: "x-cards-block__subtitle"
391
+ }, Ue = ["src", "alt"], Re = { class: "x-card__title" }, Fe = { class: "x-card__desc" };
392
+ function qe(c, o, e, t, r, i) {
393
+ return n(), a(
394
+ "section",
395
+ {
396
+ class: $(["x-cards-block", `x-cards-block--${e.variant}`])
397
+ },
398
+ [
399
+ d("div", Ne, [
400
+ e.data.title ? (n(), a(
401
+ "h2",
402
+ Ae,
403
+ _(e.data.title),
404
+ 1
405
+ /* TEXT */
406
+ )) : u("v-if", !0),
407
+ e.data.subtitle ? (n(), a(
408
+ "p",
409
+ Ee,
410
+ _(e.data.subtitle),
411
+ 1
412
+ /* TEXT */
413
+ )) : u("v-if", !0),
414
+ d(
415
+ "div",
416
+ {
417
+ class: "x-cards-block__grid",
418
+ style: I(t.gridStyle)
419
+ },
420
+ [
421
+ (n(!0), a(
422
+ v,
423
+ null,
424
+ x(e.data.cards, (s, l) => (n(), P(L(s.link ? "a" : "div"), {
425
+ key: l,
426
+ class: "x-card",
427
+ href: s.link
428
+ }, {
429
+ default: q(() => [
430
+ s.image && e.variant === "image-cards" ? (n(), a("img", {
431
+ key: 0,
432
+ src: s.image,
433
+ alt: s.title,
434
+ class: "x-card__image"
435
+ }, null, 8, Ue)) : u("v-if", !0),
436
+ s.icon && e.variant !== "image-cards" ? (n(), a(
437
+ "div",
438
+ {
439
+ key: 1,
440
+ class: "x-card__icon",
441
+ style: t.iconStyle
442
+ },
443
+ _(t.iconDisplay(s.icon)),
444
+ 1
445
+ /* TEXT */
446
+ )) : u("v-if", !0),
447
+ d(
448
+ "h3",
449
+ Re,
450
+ _(s.title),
451
+ 1
452
+ /* TEXT */
453
+ ),
454
+ d(
455
+ "p",
456
+ Fe,
457
+ _(s.desc),
458
+ 1
459
+ /* TEXT */
460
+ )
461
+ ]),
462
+ _: 2
463
+ /* DYNAMIC */
464
+ }, 1032, ["href"]))),
465
+ 128
466
+ /* KEYED_FRAGMENT */
467
+ ))
468
+ ],
469
+ 4
470
+ /* STYLE */
471
+ )
472
+ ])
473
+ ],
474
+ 2
475
+ /* CLASS */
476
+ );
477
+ }
478
+ const De = /* @__PURE__ */ k(Le, [["render", qe], ["__scopeId", "data-v-a1505674"], ["__file", "/Users/yariksav/projects/xosen/xosen-monorepo/packages/site-sdk/src/components/blocks/XCardsBlock.vue"]]), He = /* @__PURE__ */ g({
479
+ __name: "XImageTextBlock",
480
+ props: {
481
+ data: { type: Object, required: !0 },
482
+ reverse: { type: Boolean, required: !1, default: !1 }
483
+ },
484
+ setup(c, { expose: o }) {
485
+ o();
486
+ const e = {};
487
+ return Object.defineProperty(e, "__isScriptSetup", { enumerable: !1, value: !0 }), e;
488
+ }
489
+ }), Me = { class: "x-image-text__container" }, ze = { class: "x-image-text__text" }, Ge = {
490
+ key: 0,
491
+ class: "x-image-text__title"
492
+ }, Ke = ["innerHTML"], Ve = {
493
+ key: 2,
494
+ class: "x-image-text__checklist"
495
+ }, We = { class: "x-image-text__check-icon" }, Je = {
496
+ key: 0,
497
+ class: "x-image-text__image-wrap"
498
+ }, Ye = ["src", "alt"];
499
+ function Ze(c, o, e, t, r, i) {
500
+ return n(), a(
501
+ "section",
502
+ {
503
+ class: $(["x-image-text", { "x-image-text--reverse": e.reverse }])
504
+ },
505
+ [
506
+ d("div", Me, [
507
+ d("div", ze, [
508
+ e.data.title ? (n(), a(
509
+ "h2",
510
+ Ge,
511
+ _(e.data.title),
512
+ 1
513
+ /* TEXT */
514
+ )) : u("v-if", !0),
515
+ e.data.content ? (n(), a("div", {
516
+ key: 1,
517
+ class: "x-image-text__content",
518
+ innerHTML: e.data.content
519
+ }, null, 8, Ke)) : u("v-if", !0),
520
+ e.data.items?.length ? (n(), a("ul", Ve, [
521
+ (n(!0), a(
522
+ v,
523
+ null,
524
+ x(e.data.items, (s, l) => (n(), a("li", { key: l }, [
525
+ d(
526
+ "span",
527
+ We,
528
+ _(s.icon || "✓"),
529
+ 1
530
+ /* TEXT */
531
+ ),
532
+ D(
533
+ " " + _(s.text),
534
+ 1
535
+ /* TEXT */
536
+ )
537
+ ]))),
538
+ 128
539
+ /* KEYED_FRAGMENT */
540
+ ))
541
+ ])) : u("v-if", !0)
542
+ ]),
543
+ e.data.image ? (n(), a("div", Je, [
544
+ d("img", {
545
+ src: e.data.image,
546
+ alt: e.data.title || "",
547
+ class: "x-image-text__image"
548
+ }, null, 8, Ye)
549
+ ])) : u("v-if", !0)
550
+ ])
551
+ ],
552
+ 2
553
+ /* CLASS */
554
+ );
555
+ }
556
+ const Qe = /* @__PURE__ */ k(He, [["render", Ze], ["__scopeId", "data-v-5ca1e218"], ["__file", "/Users/yariksav/projects/xosen/xosen-monorepo/packages/site-sdk/src/components/blocks/XImageTextBlock.vue"]]);
557
+ function E(c, o) {
558
+ const e = T(null), { locale: t } = N(), r = window.__SITE_DATA__, i = r?.locale, s = r?.config?.tenantPrefix || "tenant";
559
+ function l() {
560
+ return r && r[c] && t.value === i ? (e.value = r[c], !0) : !1;
561
+ }
562
+ async function f() {
563
+ try {
564
+ const b = `${s}:${o}:${t.value}`, m = await fetch(`/api/content/${b}`);
565
+ m.ok && (e.value = await m.json());
566
+ } catch {
567
+ }
568
+ }
569
+ return j(() => {
570
+ l() || f();
571
+ }), B(t, () => {
572
+ f();
573
+ }), e;
574
+ }
575
+ function et() {
576
+ const o = window.__SITE_DATA__?.apiBase || "";
577
+ async function e(i) {
578
+ const s = await fetch(`${o}${i}`);
579
+ if (!s.ok)
580
+ throw new Error(`API error: ${s.status}`);
581
+ return s.json();
582
+ }
583
+ async function t() {
584
+ return e("/v1/billing/tariffs");
585
+ }
586
+ async function r() {
587
+ return e("/v1/billing/services");
588
+ }
589
+ return {
590
+ get: e,
591
+ getTariffs: t,
592
+ getProducts: r
593
+ };
594
+ }
595
+ const tt = /* @__PURE__ */ g({
596
+ __name: "XPricingBlock",
597
+ props: {
598
+ data: { type: Object, required: !1 },
599
+ source: { type: String, required: !1, default: "kv" },
600
+ featuredIndex: { type: Number, required: !1, default: 1 }
601
+ },
602
+ setup(c, { expose: o }) {
603
+ o();
604
+ const e = c, t = p(() => e.data?.title), r = p(() => e.data?.subtitle), i = T([]), s = T(""), l = E("tariffs", "tariffs"), f = et();
605
+ j(async () => {
606
+ if (e.source === "api")
607
+ try {
608
+ i.value = await f.getTariffs();
609
+ } catch {
610
+ }
611
+ }), B(
612
+ l,
613
+ (h) => {
614
+ h && e.source === "kv" && (i.value = h);
615
+ },
616
+ { immediate: !0 }
617
+ );
618
+ const b = p(() => {
619
+ const h = new Set(i.value.map((C) => C.tariffGroupName).filter(Boolean));
620
+ return Array.from(h);
621
+ });
622
+ B(
623
+ b,
624
+ (h) => {
625
+ h.length > 0 && !s.value && (s.value = h[0]);
626
+ },
627
+ { immediate: !0 }
628
+ );
629
+ const m = p(() => !s.value || b.value.length <= 1 ? i.value : i.value.filter((h) => h.tariffGroupName === s.value)), w = { props: e, title: t, subtitle: r, plans: i, activeGroup: s, kvTariffs: l, api: f, groups: b, activePlans: m };
630
+ return Object.defineProperty(w, "__isScriptSetup", { enumerable: !1, value: !0 }), w;
631
+ }
632
+ }), st = { class: "x-pricing" }, ot = { class: "x-pricing__container" }, nt = {
633
+ key: 0,
634
+ class: "x-pricing__title"
635
+ }, at = {
636
+ key: 1,
637
+ class: "x-pricing__subtitle"
638
+ }, rt = {
639
+ key: 2,
640
+ class: "x-pricing__tabs"
641
+ }, ct = ["onClick"], it = { class: "x-pricing__grid" }, lt = { class: "x-pricing-card__name" }, _t = {
642
+ key: 0,
643
+ class: "x-pricing-card__desc"
644
+ }, ut = { class: "x-pricing-card__price" }, dt = { class: "x-pricing-card__amount" }, ft = {
645
+ key: 0,
646
+ class: "x-pricing-card__period"
647
+ }, pt = {
648
+ key: 1,
649
+ class: "x-pricing-card__features"
650
+ }, mt = ["href"];
651
+ function ht(c, o, e, t, r, i) {
652
+ return n(), a("section", st, [
653
+ d("div", ot, [
654
+ t.title ? (n(), a(
655
+ "h2",
656
+ nt,
657
+ _(t.title),
658
+ 1
659
+ /* TEXT */
660
+ )) : u("v-if", !0),
661
+ t.subtitle ? (n(), a(
662
+ "p",
663
+ at,
664
+ _(t.subtitle),
665
+ 1
666
+ /* TEXT */
667
+ )) : u("v-if", !0),
668
+ u(" Tabs for tariff groups "),
669
+ t.groups.length > 1 ? (n(), a("div", rt, [
670
+ (n(!0), a(
671
+ v,
672
+ null,
673
+ x(t.groups, (s) => (n(), a("button", {
674
+ key: s,
675
+ class: $(["x-pricing__tab", { "x-pricing__tab--active": t.activeGroup === s }]),
676
+ onClick: (l) => t.activeGroup = s
677
+ }, _(s), 11, ct))),
678
+ 128
679
+ /* KEYED_FRAGMENT */
680
+ ))
681
+ ])) : u("v-if", !0),
682
+ d("div", it, [
683
+ (n(!0), a(
684
+ v,
685
+ null,
686
+ x(t.activePlans, (s, l) => (n(), a(
687
+ "div",
688
+ {
689
+ key: s.id || l,
690
+ class: $(["x-pricing-card", { "x-pricing-card--featured": l === e.featuredIndex }])
691
+ },
692
+ [
693
+ d(
694
+ "h3",
695
+ lt,
696
+ _(s.name),
697
+ 1
698
+ /* TEXT */
699
+ ),
700
+ s.description ? (n(), a(
701
+ "p",
702
+ _t,
703
+ _(s.description),
704
+ 1
705
+ /* TEXT */
706
+ )) : u("v-if", !0),
707
+ d("div", ut, [
708
+ d(
709
+ "span",
710
+ dt,
711
+ _(s.price),
712
+ 1
713
+ /* TEXT */
714
+ ),
715
+ s.period ? (n(), a(
716
+ "span",
717
+ ft,
718
+ "/" + _(s.period),
719
+ 1
720
+ /* TEXT */
721
+ )) : u("v-if", !0)
722
+ ]),
723
+ s.features?.length ? (n(), a("ul", pt, [
724
+ (n(!0), a(
725
+ v,
726
+ null,
727
+ x(s.features, (f, b) => (n(), a(
728
+ "li",
729
+ { key: b },
730
+ _(f),
731
+ 1
732
+ /* TEXT */
733
+ ))),
734
+ 128
735
+ /* KEYED_FRAGMENT */
736
+ ))
737
+ ])) : u("v-if", !0),
738
+ s.actionUrl ? (n(), a("a", {
739
+ key: 2,
740
+ href: s.actionUrl,
741
+ class: "x-btn x-btn--primary x-pricing-card__action"
742
+ }, _(s.actionText || "Choose"), 9, mt)) : u("v-if", !0)
743
+ ],
744
+ 2
745
+ /* CLASS */
746
+ ))),
747
+ 128
748
+ /* KEYED_FRAGMENT */
749
+ ))
750
+ ])
751
+ ])
752
+ ]);
753
+ }
754
+ const vt = /* @__PURE__ */ k(tt, [["render", ht], ["__scopeId", "data-v-bd1e5d79"], ["__file", "/Users/yariksav/projects/xosen/xosen-monorepo/packages/site-sdk/src/components/blocks/XPricingBlock.vue"]]), xt = /* @__PURE__ */ g({
755
+ __name: "XContactsBlock",
756
+ props: {
757
+ data: { type: Object, required: !1 }
758
+ },
759
+ setup(c, { expose: o }) {
760
+ o();
761
+ const e = E("contacts:offices", "contacts:offices"), t = p(() => e.value || []), r = { kvOffices: e, offices: t };
762
+ return Object.defineProperty(r, "__isScriptSetup", { enumerable: !1, value: !0 }), r;
763
+ }
764
+ }), yt = { class: "x-contacts" }, gt = { class: "x-contacts__container" }, kt = {
765
+ key: 0,
766
+ class: "x-contacts__title"
767
+ }, bt = {
768
+ key: 1,
769
+ class: "x-contacts__grid"
770
+ }, $t = { class: "x-contacts__name" }, St = {
771
+ key: 0,
772
+ class: "x-contacts__info"
773
+ }, wt = {
774
+ key: 1,
775
+ class: "x-contacts__info"
776
+ }, Tt = ["href"], jt = {
777
+ key: 2,
778
+ class: "x-contacts__info"
779
+ }, Ct = ["href"], Xt = {
780
+ key: 3,
781
+ class: "x-contacts__hours"
782
+ };
783
+ function Bt(c, o, e, t, r, i) {
784
+ return n(), a("section", yt, [
785
+ d("div", gt, [
786
+ e.data?.title ? (n(), a(
787
+ "h2",
788
+ kt,
789
+ _(e.data.title),
790
+ 1
791
+ /* TEXT */
792
+ )) : u("v-if", !0),
793
+ t.offices ? (n(), a("div", bt, [
794
+ (n(!0), a(
795
+ v,
796
+ null,
797
+ x(t.offices, (s, l) => (n(), a(
798
+ "div",
799
+ {
800
+ key: l,
801
+ class: $(["x-contacts__card", { "x-contacts__card--main": s.isMain }])
802
+ },
803
+ [
804
+ d(
805
+ "h3",
806
+ $t,
807
+ _(s.name),
808
+ 1
809
+ /* TEXT */
810
+ ),
811
+ s.address ? (n(), a(
812
+ "p",
813
+ St,
814
+ _(s.address),
815
+ 1
816
+ /* TEXT */
817
+ )) : u("v-if", !0),
818
+ s.phone ? (n(), a("p", wt, [
819
+ d("a", {
820
+ href: `tel:${s.phone}`
821
+ }, _(s.phone), 9, Tt)
822
+ ])) : u("v-if", !0),
823
+ s.email ? (n(), a("p", jt, [
824
+ d("a", {
825
+ href: `mailto:${s.email}`
826
+ }, _(s.email), 9, Ct)
827
+ ])) : u("v-if", !0),
828
+ s.hours ? (n(), a(
829
+ "p",
830
+ Xt,
831
+ _(s.hours),
832
+ 1
833
+ /* TEXT */
834
+ )) : u("v-if", !0)
835
+ ],
836
+ 2
837
+ /* CLASS */
838
+ ))),
839
+ 128
840
+ /* KEYED_FRAGMENT */
841
+ ))
842
+ ])) : u("v-if", !0)
843
+ ])
844
+ ]);
845
+ }
846
+ const Pt = /* @__PURE__ */ k(xt, [["render", Bt], ["__scopeId", "data-v-e873ba26"], ["__file", "/Users/yariksav/projects/xosen/xosen-monorepo/packages/site-sdk/src/components/blocks/XContactsBlock.vue"]]), Ot = /* @__PURE__ */ g({
847
+ __name: "XBlockRenderer",
848
+ props: {
849
+ blocks: { type: Array, required: !0 }
850
+ },
851
+ setup(c, { expose: o }) {
852
+ o();
853
+ const e = c, t = {
854
+ hero: Ce,
855
+ html: Ie,
856
+ cards: De,
857
+ "image-text": Qe,
858
+ pricing: vt,
859
+ contacts: Pt
860
+ };
861
+ function r(l) {
862
+ return t[l];
863
+ }
864
+ const i = p(() => e.blocks.filter((l) => l.settings?.visible !== !1)), s = { props: e, blockRegistry: t, getBlockComponent: r, visibleBlocks: i };
865
+ return Object.defineProperty(s, "__isScriptSetup", { enumerable: !1, value: !0 }), s;
866
+ }
867
+ }), It = { class: "x-block-renderer" };
868
+ function Lt(c, o, e, t, r, i) {
869
+ return n(), a("div", It, [
870
+ (n(!0), a(
871
+ v,
872
+ null,
873
+ x(t.visibleBlocks, (s, l) => (n(), a(
874
+ v,
875
+ { key: l },
876
+ [
877
+ t.getBlockComponent(s.type) ? (n(), P(L(t.getBlockComponent(s.type)), H({
878
+ key: 0,
879
+ data: s.data || s.props
880
+ }, { ref_for: !0 }, s.settings, {
881
+ class: s.settings?.className
882
+ }), null, 16, ["data", "class"])) : u("v-if", !0)
883
+ ],
884
+ 64
885
+ /* STABLE_FRAGMENT */
886
+ ))),
887
+ 128
888
+ /* KEYED_FRAGMENT */
889
+ ))
890
+ ]);
891
+ }
892
+ const Dt = /* @__PURE__ */ k(Ot, [["render", Lt], ["__file", "/Users/yariksav/projects/xosen/xosen-monorepo/packages/site-sdk/src/components/blocks/XBlockRenderer.vue"]]), Nt = /\.(js|css|png|jpg|jpeg|gif|svg|ico|woff2?|ttf|eot|webp|avif|map|json|txt|xml|webmanifest)$/;
893
+ function At(c, o) {
894
+ const t = new URL(c.url).searchParams.get("lang");
895
+ if (t && o.supportedLocales?.includes(t)) return t;
896
+ if (o.supportedLocales?.length) {
897
+ const r = c.headers.get("Accept-Language") || "";
898
+ for (const i of o.supportedLocales)
899
+ if (r.includes(i)) return i;
900
+ }
901
+ return o.defaultLocale;
902
+ }
903
+ function Et(c, o) {
904
+ if (!c.pathname.startsWith("/api/content/")) return null;
905
+ const e = decodeURIComponent(c.pathname.replace("/api/content/", ""));
906
+ return e ? (async () => {
907
+ const t = await o.SITE_CONTENT.get(e);
908
+ return t ? new Response(t, {
909
+ headers: {
910
+ "Content-Type": "application/json",
911
+ "Cache-Control": "public, max-age=60",
912
+ "Access-Control-Allow-Origin": "*"
913
+ }
914
+ }) : Response.json({ error: "Not found" }, { status: 404 });
915
+ })() : Promise.resolve(Response.json({ error: "Key is required" }, { status: 400 }));
916
+ }
917
+ function Ut(c, o, e) {
918
+ let t = c;
919
+ if (o.title) {
920
+ const r = e ? ` — ${e}` : "";
921
+ t = t.replace(/<title>[^<]*<\/title>/, `<title>${o.title}${r}</title>`);
922
+ }
923
+ return o.meta?.description && (t = t.replace(/(<meta\s+name="description"\s+content=")[^"]*(")/, `$1${o.meta.description}$2`)), o.meta?.ogTitle && (t = t.replace(/(<meta\s+property="og:title"\s+content=")[^"]*(")/, `$1${o.meta.ogTitle}$2`)), o.html && (t = t.replace('<div id="app"></div>', `<div id="app">${o.html}</div>`)), t;
924
+ }
925
+ function Ht(c) {
926
+ const { tenantPrefix: o, globalKeys: e = [] } = c;
927
+ return {
928
+ async fetch(t, r) {
929
+ const i = new URL(t.url), s = Et(i, r);
930
+ if (s) return s;
931
+ if (Nt.test(i.pathname))
932
+ return r.ASSETS.fetch(t);
933
+ const l = At(t, c), f = new URL("/index.html", t.url);
934
+ let m = await (await r.ASSETS.fetch(new Request(f))).text();
935
+ const w = e.map(async (S) => {
936
+ const y = await r.SITE_CONTENT.get(`${o}:${S}:${l}`);
937
+ return [S, y ? JSON.parse(y) : null];
938
+ }), h = i.pathname.match(/^\/p\/(.+)$/);
939
+ if (h) {
940
+ const S = h[1];
941
+ w.push(
942
+ (async () => {
943
+ const y = await r.SITE_CONTENT.get(`${o}:page:${S}:${l}`);
944
+ return [`page:${S}`, y ? JSON.parse(y) : null];
945
+ })()
946
+ );
947
+ }
948
+ const C = await Promise.all(w), X = {
949
+ locale: l,
950
+ config: { tenantPrefix: o }
951
+ };
952
+ for (const [S, y] of C)
953
+ y !== null && (X[S] = y);
954
+ if (h) {
955
+ const S = h[1], y = X[`page:${S}`];
956
+ y && (m = Ut(m, y, c.siteName));
957
+ }
958
+ const U = `<script>window.__SITE_DATA__ = ${JSON.stringify(X)};<\/script>`;
959
+ return m = m.replace("</head>", `${U}
960
+ </head>`), new Response(m, {
961
+ headers: {
962
+ "Content-Type": "text/html;charset=utf-8",
963
+ "Cache-Control": "public, max-age=60"
964
+ }
965
+ });
966
+ }
967
+ };
968
+ }
969
+ export {
970
+ Dt as XBlockRenderer,
971
+ De as XCardsBlock,
972
+ Pt as XContactsBlock,
973
+ Ce as XHeroBlock,
974
+ Ie as XHtmlBlock,
975
+ Qe as XImageTextBlock,
976
+ J as XLocaleSwitcher,
977
+ vt as XPricingBlock,
978
+ de as XSiteFooter,
979
+ qt as XSiteLayout,
980
+ ne as XSiteNav,
981
+ Ht as createSiteWorker,
982
+ et as useSiteApi,
983
+ A as useSiteConfig,
984
+ E as useSiteData,
985
+ M as useSkin
986
+ };