@flyo/nitro-astro 2.1.1 → 2.2.0

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/README.md CHANGED
@@ -126,13 +126,13 @@ Block Component Example (which are mostly located in `src/components/flyo`):
126
126
  ```astro
127
127
  ---
128
128
  import { Image } from "astro:assets";
129
- import { editableBlock } from "@flyo/nitro-astro";
129
+ import { editable } from "@flyo/nitro-astro";
130
130
  import BlockSlot from "@flyo/nitro-astro/BlockSlot.astro";
131
131
  const { block } = Astro.props;
132
132
  ---
133
133
 
134
134
  <!-- Make the block editable if necessary -->
135
- <div {...editableBlock(block)}>
135
+ <div {...editable(block)}>
136
136
  <!-- Content variable -->
137
137
  <div set:html={block.content.content.html} />
138
138
 
@@ -159,6 +159,37 @@ const { block } = Astro.props;
159
159
  </div>
160
160
  ```
161
161
 
162
+ ### Wysiwyg
163
+
164
+ The `FlyoWysiwyg` component renders ProseMirror/TipTap JSON content. It handles standard nodes automatically and allows you to provide custom components for specific node types.
165
+
166
+ ```astro
167
+ ---
168
+ import FlyoWysiwyg from "@flyo/nitro-astro/FlyoWysiwyg.astro";
169
+ import CustomImage from "./CustomImage.astro";
170
+
171
+ const { block } = Astro.props;
172
+ ---
173
+
174
+ <FlyoWysiwyg
175
+ json={block.content.json}
176
+ components={{
177
+ image: CustomImage
178
+ }}
179
+ />
180
+ ```
181
+
182
+ And here is an example of how the `CustomImage.astro` component could look like:
183
+
184
+ ```astro
185
+ ---
186
+ const { node } = Astro.props;
187
+ const { src, alt, title } = node.attrs;
188
+ ---
189
+
190
+ <img src={src} alt={alt} title={title} style="max-width: 100%; height: auto;" />
191
+ ```
192
+
162
193
  ### Entities
163
194
 
164
195
  The **Entity Details** API provides all the information about an entity and the associated model data configured in the Flyo interface. You can request detail pages either by using a slug (with an additional schema ID) or by a unique ID.
@@ -0,0 +1,32 @@
1
+ ---
2
+ import { wysiwyg } from '@flyo/nitro-js-bridge';
3
+
4
+ interface Props {
5
+ json: any;
6
+ components?: Record<string, any>;
7
+ }
8
+
9
+ const { json, components = {} } = Astro.props;
10
+
11
+ let nodes: any[] = [];
12
+
13
+ if (json) {
14
+ if (json.type === 'doc' && Array.isArray(json.content)) {
15
+ nodes = json.content;
16
+ } else if (Array.isArray(json)) {
17
+ nodes = json;
18
+ } else {
19
+ nodes = [json];
20
+ }
21
+ }
22
+ ---
23
+
24
+ {nodes.map((node: any) => {
25
+ const Component = components[node.type];
26
+ if (Component) {
27
+ return <Component node={node} />
28
+ }
29
+
30
+ const html = wysiwyg(node);
31
+ return <Fragment set:html={html} />
32
+ })}
@@ -0,0 +1,24 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import FlyoWysiwyg from './FlyoWysiwyg';
3
+ import { wysiwyg } from '@flyo/nitro-js-bridge';
4
+
5
+ describe('FlyoWysiwyg', () => {
6
+ it('should export the component', () => {
7
+ expect(FlyoWysiwyg).toBeDefined();
8
+ });
9
+
10
+ it('wysiwyg function should be available and render basic node', () => {
11
+ expect(wysiwyg).toBeDefined();
12
+
13
+ const node = {
14
+ type: 'paragraph',
15
+ content: [{ type: 'text', text: 'Hello World' }]
16
+ };
17
+
18
+ // Since we don't know the exact implementation details of the installed version,
19
+ // we just check if it returns a string containing the text.
20
+ const html = wysiwyg(node);
21
+ expect(typeof html).toBe('string');
22
+ expect(html).toContain('Hello World');
23
+ });
24
+ });
@@ -0,0 +1,2 @@
1
+ import FlyoWysiwyg from "./FlyoWysiwyg.astro";
2
+ export default FlyoWysiwyg;
@@ -1,4 +1,4 @@
1
- (function(u,h){typeof exports=="object"&&typeof module<"u"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(u=typeof globalThis<"u"?globalThis:u||self,h(u.flyoNitroIntegration={}))})(this,function(u){"use strict";const h="https://api.flyo.cloud/nitro/v1".replace(/\/+$/,"");class F{constructor(n={}){this.configuration=n}set config(n){this.configuration=n}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:h}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||_}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const n=this.configuration.apiKey;if(n)return typeof n=="function"?n:()=>n}get accessToken(){const n=this.configuration.accessToken;if(n)return typeof n=="function"?n:async()=>n}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const x=new F,w=class P{constructor(n=x){this.configuration=n,this.fetchApi=async(t,i)=>{let r={url:t,init:i};for(const a of this.middleware)a.pre&&(r=await a.pre({fetch:this.fetchApi,...r})||r);let o;try{o=await(this.configuration.fetchApi||fetch)(r.url,r.init)}catch(a){for(const l of this.middleware)l.onError&&(o=await l.onError({fetch:this.fetchApi,url:r.url,init:r.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new N(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:r.url,init:r.init,response:o.clone()})||o);return o},this.middleware=n.middleware}withMiddleware(...n){const t=this.clone();return t.middleware=t.middleware.concat(...n),t}withPreMiddleware(...n){const t=n.map(i=>({pre:i}));return this.withMiddleware(...t)}withPostMiddleware(...n){const t=n.map(i=>({post:i}));return this.withMiddleware(...t)}isJsonMime(n){return n?P.jsonRegex.test(n):!1}async request(n,t){const{url:i,init:r}=await this.createFetchParams(n,t),o=await this.fetchApi(i,r);if(o&&o.status>=200&&o.status<300)return o;throw new M(o,"Response returned an error code")}async createFetchParams(n,t){let i=this.configuration.basePath+n.path;n.query!==void 0&&Object.keys(n.query).length!==0&&(i+="?"+this.configuration.queryParamsStringify(n.query));const r=Object.assign({},this.configuration.headers,n.headers);Object.keys(r).forEach(p=>r[p]===void 0?delete r[p]:{});const o=typeof t=="function"?t:async()=>t,a={method:n.method,headers:r,body:n.body,credentials:this.configuration.credentials},l={...a,...await o({init:a,context:n})};let s;K(l.body)||l.body instanceof URLSearchParams||$(l.body)?s=l.body:this.isJsonMime(r["Content-Type"])?s=JSON.stringify(l.body):s=l.body;const c={...l,body:s};return{url:i,init:c}}clone(){const n=this.constructor,t=new n(this.configuration);return t.middleware=this.middleware.slice(),t}};w.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let g=w;function $(e){return typeof Blob<"u"&&e instanceof Blob}function K(e){return typeof FormData<"u"&&e instanceof FormData}class M extends Error{constructor(n,t){super(t),this.response=n,this.name="ResponseError"}}class N extends Error{constructor(n,t){super(t),this.cause=n,this.name="FetchError"}}class y extends Error{constructor(n,t){super(t),this.field=n,this.name="RequiredError"}}function _(e,n=""){return Object.keys(e).map(t=>b(t,e[t],n)).filter(t=>t.length>0).join("&")}function b(e,n,t=""){const i=t+(t.length?`[${e}]`:e);if(n instanceof Array){const r=n.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(i)}=`);return`${encodeURIComponent(i)}=${r}`}if(n instanceof Set){const r=Array.from(n);return b(e,r,t)}return n instanceof Date?`${encodeURIComponent(i)}=${encodeURIComponent(n.toISOString())}`:n instanceof Object?_(n,i):`${encodeURIComponent(i)}=${encodeURIComponent(String(n))}`}function v(e,n){return Object.keys(e).reduce((t,i)=>({...t,[i]:n(e[i])}),{})}class d{constructor(n,t=i=>i){this.raw=n,this.transformer=t}async value(){return this.transformer(await this.raw.json())}}function O(e){return B(e)}function B(e,n){return e==null?e:{identifier:e.identifier==null?void 0:e.identifier,content:e.content==null?void 0:e.content.map(C)}}function C(e){return D(e)}function D(e,n){return e==null?e:{items:e.items==null?void 0:e.items,content:e.content==null?void 0:e.content,config:e.config==null?void 0:e.config,identifier:e.identifier==null?void 0:e.identifier,uid:e.uid==null?void 0:e.uid,component:e.component==null?void 0:e.component,slots:e.slots==null?void 0:v(e.slots,O)}}function E(e){return G(e)}function G(e,n){return e==null?e:{slug:e.slug==null?void 0:e.slug,title:e.title==null?void 0:e.title,href:e.href==null?void 0:e.href}}function q(e){return H(e)}function H(e,n){return e==null?e:{type:e.type==null?void 0:e.type,target:e.target==null?void 0:e.target,label:e.label==null?void 0:e.label,href:e.href==null?void 0:e.href,slug:e.slug==null?void 0:e.slug,properties:e.properties==null?void 0:e.properties,children:e.children==null?void 0:e.children.map(q)}}function z(e){return V(e)}function V(e,n){return e==null?e:{items:e.items==null?void 0:e.items.map(q),uid:e.uid==null?void 0:e.uid,identifier:e.identifier==null?void 0:e.identifier,label:e.label==null?void 0:e.label}}function W(e){return J(e)}function J(e,n){return e==null?e:{domain:e.domain==null?void 0:e.domain,slug:e.slug==null?void 0:e.slug,version:e.version==null?void 0:e.version,updated_at:e.updated_at==null?void 0:e.updated_at,language:e.language==null?void 0:e.language,primary_language:e.primary_language==null?void 0:e.primary_language}}function Q(e){return X(e)}function X(e,n){return e==null?e:{nitro:e.nitro==null?void 0:W(e.nitro),pages:e.pages==null?void 0:e.pages,containers:e.containers==null?void 0:v(e.containers,z),globals:e.globals==null?void 0:e.globals}}function Y(e){return Z(e)}function Z(e,n){return e==null?e:{api:e.api==null?void 0:e.api,image:e.image==null?void 0:e.image}}function ee(e){return ne(e)}function ne(e,n){return e==null?e:{_version:e._version==null?void 0:e._version,entity_metric:e.entity_metric==null?void 0:Y(e.entity_metric),entity_unique_id:e.entity_unique_id==null?void 0:e.entity_unique_id,entity_id:e.entity_id==null?void 0:e.entity_id,entity_image:e.entity_image==null?void 0:e.entity_image,entity_slug:e.entity_slug==null?void 0:e.entity_slug,entity_teaser:e.entity_teaser==null?void 0:e.entity_teaser,entity_time_end:e.entity_time_end==null?void 0:e.entity_time_end,entity_time_start:e.entity_time_start==null?void 0:e.entity_time_start,entity_title:e.entity_title==null?void 0:e.entity_title,entity_type:e.entity_type==null?void 0:e.entity_type,entity_type_id:e.entity_type_id==null?void 0:e.entity_type_id,updated_at:e.updated_at==null?void 0:e.updated_at,routes:e.routes==null?void 0:e.routes}}function te(e){return ie(e)}function ie(e,n){return e==null?e:{shortcode:e.shortcode==null?void 0:e.shortcode,name:e.name==null?void 0:e.name}}function R(e){return oe(e)}function oe(e,n){return e==null?e:{language:e.language==null?void 0:te(e.language),slug:e.slug==null?void 0:e.slug,title:e.title==null?void 0:e.title,href:e.href==null?void 0:e.href}}function A(e){return re(e)}function re(e,n){return e==null?e:{entity:e.entity==null?void 0:ee(e.entity),model:e.model==null?void 0:e.model,language:e.language==null?void 0:e.language,jsonld:e.jsonld==null?void 0:e.jsonld,translation:e.translation==null?void 0:e.translation.map(R),breadcrumb:e.breadcrumb==null?void 0:e.breadcrumb.map(E)}}function I(e){return ae(e)}function ae(e,n){return e==null?e:{entity_unique_id:e.entity_unique_id==null?void 0:e.entity_unique_id,entity_title:e.entity_title==null?void 0:e.entity_title,entity_teaser:e.entity_teaser==null?void 0:e.entity_teaser,entity_slug:e.entity_slug==null?void 0:e.entity_slug,entity_time_start:e.entity_time_start==null?void 0:e.entity_time_start,entity_type:e.entity_type==null?void 0:e.entity_type,entity_type_id:e.entity_type_id==null?void 0:e.entity_type_id,entity_image:e.entity_image==null?void 0:e.entity_image,routes:e.routes==null?void 0:e.routes}}function le(e){return se(e)}function se(e,n){return e==null?e:{description:e.description==null?void 0:e.description,image:e.image==null?void 0:e.image,title:e.title==null?void 0:e.title}}function ue(e){return ce(e)}function ce(e,n){return e==null?e:{value:e.value==null?void 0:e.value,navigation:e.navigation==null?void 0:e.navigation,propagate:e.propagate==null?void 0:e.propagate}}function T(e){return de(e)}function de(e,n){return e==null?e:{id:e.id==null?void 0:e.id,title:e.title==null?void 0:e.title,href:e.href==null?void 0:e.href,slug:e.slug==null?void 0:e.slug,json:e.json==null?void 0:e.json.map(C),depth:e.depth==null?void 0:e.depth,is_home:e.is_home==null?void 0:e.is_home,created_at:e.created_at==null?void 0:e.created_at,updated_at:e.updated_at==null?void 0:e.updated_at,is_visible:e.is_visible==null?void 0:e.is_visible,meta_json:e.meta_json==null?void 0:le(e.meta_json),properties:e.properties==null?void 0:v(e.properties,ue),uid:e.uid==null?void 0:e.uid,type:e.type==null?void 0:e.type,target:e.target==null?void 0:e.target,container:e.container==null?void 0:e.container,breadcrumb:e.breadcrumb==null?void 0:e.breadcrumb.map(E),translation:e.translation==null?void 0:e.translation.map(R)}}function fe(e){return ge(e)}function ge(e,n){return e==null?e:{version:e.version==null?void 0:e.version,updated_at:e.updated_at==null?void 0:e.updated_at}}class he extends g{async configRaw(n,t){const i={};n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/config",method:"GET",headers:r,query:i},t);return new d(o,a=>Q(a))}async config(n={},t){return await(await this.configRaw(n,t)).value()}}class pe extends g{async entityBySlugRaw(n,t){if(n.slug==null)throw new y("slug",'Required parameter "slug" was null or undefined when calling entityBySlug().');const i={};n.typeId!=null&&(i.typeId=n.typeId),n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/entities/slug/{slug}".replace("{slug}",encodeURIComponent(String(n.slug))),method:"GET",headers:r,query:i},t);return new d(o,a=>A(a))}async entityBySlug(n,t){return await(await this.entityBySlugRaw(n,t)).value()}async entityByUniqueidRaw(n,t){if(n.uniqueid==null)throw new y("uniqueid",'Required parameter "uniqueid" was null or undefined when calling entityByUniqueid().');const i={};n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/entities/uniqueid/{uniqueid}".replace("{uniqueid}",encodeURIComponent(String(n.uniqueid))),method:"GET",headers:r,query:i},t);return new d(o,a=>A(a))}async entityByUniqueid(n,t){return await(await this.entityByUniqueidRaw(n,t)).value()}}class ye extends g{async homeRaw(n,t){const i={};n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/pages/home",method:"GET",headers:r,query:i},t);return new d(o,a=>T(a))}async home(n={},t){return await(await this.homeRaw(n,t)).value()}async pageRaw(n,t){const i={};n.slug!=null&&(i.slug=n.slug),n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/pages",method:"GET",headers:r,query:i},t);return new d(o,a=>T(a))}async page(n={},t){return await(await this.pageRaw(n,t)).value()}}class ve extends g{async searchRaw(n,t){if(n.query==null)throw new y("query",'Required parameter "query" was null or undefined when calling search().');const i={};n.query!=null&&(i.query=n.query),n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/search",method:"GET",headers:r,query:i},t);return new d(o,a=>a.map(I))}async search(n,t){return await(await this.searchRaw(n,t)).value()}}class me extends g{async sitemapRaw(n,t){const i={};n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/sitemap",method:"GET",headers:r,query:i},t);return new d(o,a=>a.map(I))}async sitemap(n={},t){return await(await this.sitemapRaw(n,t)).value()}}class we extends g{async versionRaw(n,t){const i={};n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/version",method:"GET",headers:r,query:i},t);return new d(o,a=>fe(a))}async version(n={},t){return await(await this.versionRaw(n,t)).value()}}const _e=/[\p{Lu}]/u,be=/[\p{Ll}]/u,k=/^[\p{Lu}](?![\p{Lu}])/gu,S=/([\p{Alpha}\p{N}_]|$)/u,m=/[_.\- ]+/,Ce=new RegExp("^"+m.source),j=new RegExp(m.source+S.source,"gu"),L=new RegExp("\\d+"+S.source,"gu"),Ee=(e,n,t,i)=>{let r=!1,o=!1,a=!1,l=!1;for(let s=0;s<e.length;s++){const c=e[s];l=s>2?e[s-3]==="-":!0,r&&_e.test(c)?(e=e.slice(0,s)+"-"+e.slice(s),r=!1,a=o,o=!0,s++):o&&a&&be.test(c)&&(!l||i)?(e=e.slice(0,s-1)+"-"+e.slice(s-1),a=o,o=!1,r=!0):(r=n(c)===c&&t(c)!==c,a=o,o=t(c)===c&&n(c)!==c)}return e},qe=(e,n)=>(k.lastIndex=0,e.replaceAll(k,t=>n(t))),Re=(e,n)=>(j.lastIndex=0,L.lastIndex=0,e.replaceAll(L,(t,i,r)=>["_","-"].includes(e.charAt(r+t.length))?t:n(t)).replaceAll(j,(t,i)=>n(i)));function Ae(e,n){if(!(typeof e=="string"||Array.isArray(e)))throw new TypeError("Expected the input to be `string | string[]`");if(n={pascalCase:!1,preserveConsecutiveUppercase:!1,...n},Array.isArray(e)?e=e.map(o=>o.trim()).filter(o=>o.length).join("-"):e=e.trim(),e.length===0)return"";const t=n.locale===!1?o=>o.toLowerCase():o=>o.toLocaleLowerCase(n.locale),i=n.locale===!1?o=>o.toUpperCase():o=>o.toLocaleUpperCase(n.locale);return e.length===1?m.test(e)?"":n.pascalCase?i(e):t(e):(e!==t(e)&&(e=Ee(e,t,i,n.preserveConsecutiveUppercase)),e=e.replace(Ce,""),e=n.preserveConsecutiveUppercase?qe(e,t):t(e),n.pascalCase&&(e=i(e.charAt(0))+e.slice(1)),Re(e,i))}function Ie(e,n,t){const i="virtual:flyo-components",r="\0"+i;return{name:"vite-plugin-flyo-components",async resolveId(o){if(o===i)return r},async load(o){if(o===r){const a=[];for(const[s,c]of Object.entries(n)){const p=await this.resolve("/"+e+"/"+c+".astro");p&&a.push(`export { default as ${Ae(s)} } from "${p.id}"`)}let l=null;return t&&(l=await this.resolve("/"+e+"/"+t+".astro")),l?a.push(`export { default as fallback } from "${l.id}"`):a.push('export { default as fallback } from "@flyo/nitro-astro/FallbackComponent.astro"'),a.join(";")}}}}function U(){return globalThis.flyoNitroInstance||console.error("The Flyo Typescript Configuration has not been initialized correctly"),globalThis.flyoNitroInstance}function f(){return U().config}async function Te(e){return await e.locals.config}function ke(){return new he(f())}function Se(){return new pe(f())}function je(){return new ye(f())}function Le(){return new ve(f())}function Ue(){return new me(f())}function Pe(){return new we(f())}function Fe(e){return{"data-flyo-uid":e.uid}}const xe=`
1
+ (function(s,h){typeof exports=="object"&&typeof module<"u"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(s=typeof globalThis<"u"?globalThis:s||self,h(s.flyoNitroIntegration={}))})(this,function(s){"use strict";const h="https://api.flyo.cloud/nitro/v1".replace(/\/+$/,"");class ${constructor(n={}){this.configuration=n}set config(n){this.configuration=n}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:h}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||_}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const n=this.configuration.apiKey;if(n)return typeof n=="function"?n:()=>n}get accessToken(){const n=this.configuration.accessToken;if(n)return typeof n=="function"?n:async()=>n}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const x=new $,w=class F{constructor(n=x){this.configuration=n,this.fetchApi=async(t,i)=>{let r={url:t,init:i};for(const a of this.middleware)a.pre&&(r=await a.pre({fetch:this.fetchApi,...r})||r);let o;try{o=await(this.configuration.fetchApi||fetch)(r.url,r.init)}catch(a){for(const l of this.middleware)l.onError&&(o=await l.onError({fetch:this.fetchApi,url:r.url,init:r.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new O(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:r.url,init:r.init,response:o.clone()})||o);return o},this.middleware=n.middleware}withMiddleware(...n){const t=this.clone();return t.middleware=t.middleware.concat(...n),t}withPreMiddleware(...n){const t=n.map(i=>({pre:i}));return this.withMiddleware(...t)}withPostMiddleware(...n){const t=n.map(i=>({post:i}));return this.withMiddleware(...t)}isJsonMime(n){return n?F.jsonRegex.test(n):!1}async request(n,t){const{url:i,init:r}=await this.createFetchParams(n,t),o=await this.fetchApi(i,r);if(o&&o.status>=200&&o.status<300)return o;throw new N(o,"Response returned an error code")}async createFetchParams(n,t){let i=this.configuration.basePath+n.path;n.query!==void 0&&Object.keys(n.query).length!==0&&(i+="?"+this.configuration.queryParamsStringify(n.query));const r=Object.assign({},this.configuration.headers,n.headers);Object.keys(r).forEach(p=>r[p]===void 0?delete r[p]:{});const o=typeof t=="function"?t:async()=>t,a={method:n.method,headers:r,body:n.body,credentials:this.configuration.credentials},l={...a,...await o({init:a,context:n})};let u;M(l.body)||l.body instanceof URLSearchParams||K(l.body)?u=l.body:this.isJsonMime(r["Content-Type"])?u=JSON.stringify(l.body):u=l.body;const c={...l,body:u};return{url:i,init:c}}clone(){const n=this.constructor,t=new n(this.configuration);return t.middleware=this.middleware.slice(),t}};w.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let g=w;function K(e){return typeof Blob<"u"&&e instanceof Blob}function M(e){return typeof FormData<"u"&&e instanceof FormData}class N extends Error{constructor(n,t){super(t),this.response=n,this.name="ResponseError"}}class O extends Error{constructor(n,t){super(t),this.cause=n,this.name="FetchError"}}class y extends Error{constructor(n,t){super(t),this.field=n,this.name="RequiredError"}}function _(e,n=""){return Object.keys(e).map(t=>b(t,e[t],n)).filter(t=>t.length>0).join("&")}function b(e,n,t=""){const i=t+(t.length?`[${e}]`:e);if(n instanceof Array){const r=n.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(i)}=`);return`${encodeURIComponent(i)}=${r}`}if(n instanceof Set){const r=Array.from(n);return b(e,r,t)}return n instanceof Date?`${encodeURIComponent(i)}=${encodeURIComponent(n.toISOString())}`:n instanceof Object?_(n,i):`${encodeURIComponent(i)}=${encodeURIComponent(String(n))}`}function v(e,n){const t={};for(const i of Object.keys(e))t[i]=n(e[i]);return t}class d{constructor(n,t=i=>i){this.raw=n,this.transformer=t}async value(){return this.transformer(await this.raw.json())}}function D(e){return B(e)}function B(e,n){return e==null?e:{identifier:e.identifier==null?void 0:e.identifier,content:e.content==null?void 0:e.content.map(C)}}function C(e){return G(e)}function G(e,n){return e==null?e:{items:e.items==null?void 0:e.items,content:e.content==null?void 0:e.content,config:e.config==null?void 0:e.config,identifier:e.identifier==null?void 0:e.identifier,uid:e.uid==null?void 0:e.uid,component:e.component==null?void 0:e.component,slots:e.slots==null?void 0:v(e.slots,D)}}function E(e){return H(e)}function H(e,n){return e==null?e:{slug:e.slug==null?void 0:e.slug,title:e.title==null?void 0:e.title,href:e.href==null?void 0:e.href}}function V(e){return z(e)}function z(e,n){return e==null?e:{domain:e.domain==null?void 0:e.domain,slug:e.slug==null?void 0:e.slug,version:e.version==null?void 0:e.version,updated_at:e.updated_at==null?void 0:e.updated_at,language:e.language==null?void 0:e.language,primary_language:e.primary_language==null?void 0:e.primary_language}}function q(e){return J(e)}function J(e,n){return e==null?e:{type:e.type==null?void 0:e.type,target:e.target==null?void 0:e.target,label:e.label==null?void 0:e.label,href:e.href==null?void 0:e.href,slug:e.slug==null?void 0:e.slug,properties:e.properties==null?void 0:e.properties,children:e.children==null?void 0:e.children.map(q)}}function W(e){return Q(e)}function Q(e,n){return e==null?e:{items:e.items==null?void 0:e.items.map(q),uid:e.uid==null?void 0:e.uid,identifier:e.identifier==null?void 0:e.identifier,label:e.label==null?void 0:e.label}}function X(e){return Y(e)}function Y(e,n){return e==null?e:{nitro:e.nitro==null?void 0:V(e.nitro),pages:e.pages==null?void 0:e.pages,containers:e.containers==null?void 0:v(e.containers,W),globals:e.globals==null?void 0:e.globals}}function Z(e){return ee(e)}function ee(e,n){return e==null?e:{shortcode:e.shortcode==null?void 0:e.shortcode,name:e.name==null?void 0:e.name}}function R(e){return ne(e)}function ne(e,n){return e==null?e:{language:e.language==null?void 0:Z(e.language),slug:e.slug==null?void 0:e.slug,title:e.title==null?void 0:e.title,href:e.href==null?void 0:e.href}}function te(e){return ie(e)}function ie(e,n){return e==null?e:{api:e.api==null?void 0:e.api,image:e.image==null?void 0:e.image}}function oe(e){return re(e)}function re(e,n){return e==null?e:{_version:e._version==null?void 0:e._version,entity_metric:e.entity_metric==null?void 0:te(e.entity_metric),entity_unique_id:e.entity_unique_id==null?void 0:e.entity_unique_id,entity_id:e.entity_id==null?void 0:e.entity_id,entity_image:e.entity_image==null?void 0:e.entity_image,entity_slug:e.entity_slug==null?void 0:e.entity_slug,entity_teaser:e.entity_teaser==null?void 0:e.entity_teaser,entity_time_end:e.entity_time_end==null?void 0:e.entity_time_end,entity_time_start:e.entity_time_start==null?void 0:e.entity_time_start,entity_title:e.entity_title==null?void 0:e.entity_title,entity_type:e.entity_type==null?void 0:e.entity_type,entity_type_id:e.entity_type_id==null?void 0:e.entity_type_id,updated_at:e.updated_at==null?void 0:e.updated_at,routes:e.routes==null?void 0:e.routes}}function A(e){return ae(e)}function ae(e,n){return e==null?e:{entity:e.entity==null?void 0:oe(e.entity),model:e.model==null?void 0:e.model,language:e.language==null?void 0:e.language,jsonld:e.jsonld==null?void 0:e.jsonld,translation:e.translation==null?void 0:e.translation.map(R),breadcrumb:e.breadcrumb==null?void 0:e.breadcrumb.map(E)}}function I(e){return le(e)}function le(e,n){return e==null?e:{entity_unique_id:e.entity_unique_id==null?void 0:e.entity_unique_id,entity_title:e.entity_title==null?void 0:e.entity_title,entity_teaser:e.entity_teaser==null?void 0:e.entity_teaser,entity_slug:e.entity_slug==null?void 0:e.entity_slug,entity_time_start:e.entity_time_start==null?void 0:e.entity_time_start,entity_type:e.entity_type==null?void 0:e.entity_type,entity_type_id:e.entity_type_id==null?void 0:e.entity_type_id,entity_image:e.entity_image==null?void 0:e.entity_image,routes:e.routes==null?void 0:e.routes}}function se(e){return ue(e)}function ue(e,n){return e==null?e:{description:e.description==null?void 0:e.description,image:e.image==null?void 0:e.image,title:e.title==null?void 0:e.title}}function ce(e){return de(e)}function de(e,n){return e==null?e:{value:e.value==null?void 0:e.value,navigation:e.navigation==null?void 0:e.navigation,propagate:e.propagate==null?void 0:e.propagate}}function T(e){return fe(e)}function fe(e,n){return e==null?e:{id:e.id==null?void 0:e.id,title:e.title==null?void 0:e.title,href:e.href==null?void 0:e.href,slug:e.slug==null?void 0:e.slug,json:e.json==null?void 0:e.json.map(C),depth:e.depth==null?void 0:e.depth,is_home:e.is_home==null?void 0:e.is_home,created_at:e.created_at==null?void 0:e.created_at,updated_at:e.updated_at==null?void 0:e.updated_at,is_visible:e.is_visible==null?void 0:e.is_visible,meta_json:e.meta_json==null?void 0:se(e.meta_json),properties:e.properties==null?void 0:v(e.properties,ce),uid:e.uid==null?void 0:e.uid,type:e.type==null?void 0:e.type,target:e.target==null?void 0:e.target,container:e.container==null?void 0:e.container,breadcrumb:e.breadcrumb==null?void 0:e.breadcrumb.map(E),translation:e.translation==null?void 0:e.translation.map(R)}}function ge(e){return he(e)}function he(e,n){return e==null?e:{version:e.version==null?void 0:e.version,updated_at:e.updated_at==null?void 0:e.updated_at}}class pe extends g{async configRaw(n,t){const i={};n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const a=await this.request({path:"/config",method:"GET",headers:r,query:i},t);return new d(a,l=>X(l))}async config(n={},t){return await(await this.configRaw(n,t)).value()}}class ye extends g{async entityBySlugRaw(n,t){if(n.slug==null)throw new y("slug",'Required parameter "slug" was null or undefined when calling entityBySlug().');const i={};n.typeId!=null&&(i.typeId=n.typeId),n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));let o="/entities/slug/{slug}";o=o.replace("{slug}",encodeURIComponent(String(n.slug)));const a=await this.request({path:o,method:"GET",headers:r,query:i},t);return new d(a,l=>A(l))}async entityBySlug(n,t){return await(await this.entityBySlugRaw(n,t)).value()}async entityByUniqueidRaw(n,t){if(n.uniqueid==null)throw new y("uniqueid",'Required parameter "uniqueid" was null or undefined when calling entityByUniqueid().');const i={};n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));let o="/entities/uniqueid/{uniqueid}";o=o.replace("{uniqueid}",encodeURIComponent(String(n.uniqueid)));const a=await this.request({path:o,method:"GET",headers:r,query:i},t);return new d(a,l=>A(l))}async entityByUniqueid(n,t){return await(await this.entityByUniqueidRaw(n,t)).value()}}class ve extends g{async homeRaw(n,t){const i={};n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const a=await this.request({path:"/pages/home",method:"GET",headers:r,query:i},t);return new d(a,l=>T(l))}async home(n={},t){return await(await this.homeRaw(n,t)).value()}async pageRaw(n,t){const i={};n.slug!=null&&(i.slug=n.slug),n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const a=await this.request({path:"/pages",method:"GET",headers:r,query:i},t);return new d(a,l=>T(l))}async page(n={},t){return await(await this.pageRaw(n,t)).value()}}class me extends g{async searchRaw(n,t){if(n.query==null)throw new y("query",'Required parameter "query" was null or undefined when calling search().');const i={};n.query!=null&&(i.query=n.query),n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const a=await this.request({path:"/search",method:"GET",headers:r,query:i},t);return new d(a,l=>l.map(I))}async search(n,t){return await(await this.searchRaw(n,t)).value()}}class we extends g{async sitemapRaw(n,t){const i={};n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const a=await this.request({path:"/sitemap",method:"GET",headers:r,query:i},t);return new d(a,l=>l.map(I))}async sitemap(n={},t){return await(await this.sitemapRaw(n,t)).value()}}class _e extends g{async versionRaw(n,t){const i={};n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const a=await this.request({path:"/version",method:"GET",headers:r,query:i},t);return new d(a,l=>ge(l))}async version(n={},t){return await(await this.versionRaw(n,t)).value()}}const be=/[\p{Lu}]/u,Ce=/[\p{Ll}]/u,k=/^[\p{Lu}](?![\p{Lu}])/gu,S=/([\p{Alpha}\p{N}_]|$)/u,m=/[_.\- ]+/,Ee=new RegExp("^"+m.source),j=new RegExp(m.source+S.source,"gu"),L=new RegExp("\\d+"+S.source,"gu"),qe=(e,n,t,i)=>{let r=!1,o=!1,a=!1,l=!1;for(let u=0;u<e.length;u++){const c=e[u];l=u>2?e[u-3]==="-":!0,r&&be.test(c)?(e=e.slice(0,u)+"-"+e.slice(u),r=!1,a=o,o=!0,u++):o&&a&&Ce.test(c)&&(!l||i)?(e=e.slice(0,u-1)+"-"+e.slice(u-1),a=o,o=!1,r=!0):(r=n(c)===c&&t(c)!==c,a=o,o=t(c)===c&&n(c)!==c)}return e},Re=(e,n)=>(k.lastIndex=0,e.replaceAll(k,t=>n(t))),Ae=(e,n)=>(j.lastIndex=0,L.lastIndex=0,e.replaceAll(L,(t,i,r)=>["_","-"].includes(e.charAt(r+t.length))?t:n(t)).replaceAll(j,(t,i)=>n(i)));function Ie(e,n){if(!(typeof e=="string"||Array.isArray(e)))throw new TypeError("Expected the input to be `string | string[]`");if(n={pascalCase:!1,preserveConsecutiveUppercase:!1,...n},Array.isArray(e)?e=e.map(o=>o.trim()).filter(o=>o.length).join("-"):e=e.trim(),e.length===0)return"";const t=n.locale===!1?o=>o.toLowerCase():o=>o.toLocaleLowerCase(n.locale),i=n.locale===!1?o=>o.toUpperCase():o=>o.toLocaleUpperCase(n.locale);return e.length===1?m.test(e)?"":n.pascalCase?i(e):t(e):(e!==t(e)&&(e=qe(e,t,i,n.preserveConsecutiveUppercase)),e=e.replace(Ee,""),e=n.preserveConsecutiveUppercase?Re(e,t):t(e),n.pascalCase&&(e=i(e.charAt(0))+e.slice(1)),Ae(e,i))}function Te(e,n,t){const i="virtual:flyo-components",r="\0"+i;return{name:"vite-plugin-flyo-components",async resolveId(o){if(o===i)return r},async load(o){if(o===r){const a=[];for(const[u,c]of Object.entries(n)){const p=await this.resolve("/"+e+"/"+c+".astro");p&&a.push(`export { default as ${Ie(u)} } from "${p.id}"`)}let l=null;return t&&(l=await this.resolve("/"+e+"/"+t+".astro")),l?a.push(`export { default as fallback } from "${l.id}"`):a.push('export { default as fallback } from "@flyo/nitro-astro/FallbackComponent.astro"'),a.join(";")}}}}function P(){return globalThis.flyoNitroInstance||console.error("The Flyo Typescript Configuration has not been initialized correctly"),globalThis.flyoNitroInstance}function f(){return P().config}async function ke(e){return await e.locals.config}function Se(){return new pe(f())}function je(){return new ye(f())}function Le(){return new ve(f())}function Pe(){return new me(f())}function Ue(){return new we(f())}function Fe(){return new _e(f())}function U(e){return{"data-flyo-uid":e.uid}}const $e=U,xe=`
2
2
  <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 163.4 88.5">
3
3
  <style type="text/css">
4
4
  .st8{fill:#FFFFFF;}
@@ -29,7 +29,7 @@
29
29
  </g>
30
30
  </g>
31
31
  </svg>
32
- `;function $e(e){const n={accessToken:!1,liveEdit:!1,fallbackComponent:null,componentsDir:"src/components/flyo",serverCacheHeaderTtl:1200,clientCacheHeaderTtl:900,...e};return n.liveEdit==="true"?n.liveEdit=!0:n.liveEdit==="false"&&(n.liveEdit=!1),{name:"@flyo/nitro-astro",hooks:{"astro:config:setup":({injectScript:t,updateConfig:i,injectRoute:r,addMiddleware:o,addDevToolbarApp:a})=>{if(!n.accessToken||n.accessToken.length==0)throw new Error("The Flyo Nitro Integration requires an accessToken");a({id:"flyo-nitro",name:"Flyo Nitro",icon:xe,entrypoint:"@flyo/nitro-astro/toolbar.ts"}),r({pattern:"sitemap.xml",entrypoint:"@flyo/nitro-astro/sitemap.ts"}),o({entrypoint:"@flyo/nitro-astro/middleware.ts",order:"post"}),i({image:{service:{entrypoint:"@flyo/nitro-astro/cdn.ts"}},vite:{plugins:[Ie(n.componentsDir,n.components||{},n.fallbackComponent)]}}),t("page-ssr",`
32
+ `;function Ke(e){const n={accessToken:!1,liveEdit:!1,fallbackComponent:null,componentsDir:"src/components/flyo",serverCacheHeaderTtl:1200,clientCacheHeaderTtl:900,...e};return n.liveEdit==="true"?n.liveEdit=!0:n.liveEdit==="false"&&(n.liveEdit=!1),{name:"@flyo/nitro-astro",hooks:{"astro:config:setup":({injectScript:t,updateConfig:i,injectRoute:r,addMiddleware:o,addDevToolbarApp:a})=>{if(!n.accessToken||n.accessToken.length==0)throw new Error("The Flyo Nitro Integration requires an accessToken");a({id:"flyo-nitro",name:"Flyo Nitro",icon:xe,entrypoint:"@flyo/nitro-astro/toolbar.ts"}),r({pattern:"sitemap.xml",entrypoint:"@flyo/nitro-astro/sitemap.ts"}),o({entrypoint:"@flyo/nitro-astro/middleware.ts",order:"post"}),i({image:{service:{entrypoint:"@flyo/nitro-astro/cdn.ts"}},vite:{plugins:[Te(n.componentsDir,n.components||{},n.fallbackComponent)]}}),t("page-ssr",`
33
33
  import { Configuration } from '@flyo/nitro-typescript'
34
34
 
35
35
  var defaultConfig = new Configuration({
@@ -67,4 +67,4 @@
67
67
  } else {
68
68
  wire();
69
69
  }
70
- `)}}}}u.default=$e,u.editableBlock=Fe,u.useConfig=Te,u.useConfigApi=ke,u.useConfiguration=f,u.useEntitiesApi=Se,u.useFlyoIntegration=U,u.usePagesApi=je,u.useSearchApi=Le,u.useSitemapApi=Ue,u.useVersionApi=Pe,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
70
+ `)}}}}s.default=Ke,s.editable=U,s.editableBlock=$e,s.useConfig=ke,s.useConfigApi=Se,s.useConfiguration=f,s.useEntitiesApi=je,s.useFlyoIntegration=P,s.usePagesApi=Le,s.useSearchApi=Pe,s.useSitemapApi=Ue,s.useVersionApi=Fe,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -110,7 +110,7 @@ const U = new L(), C = class E {
110
110
  let i = this.configuration.basePath + n.path;
111
111
  n.query !== void 0 && Object.keys(n.query).length !== 0 && (i += "?" + this.configuration.queryParamsStringify(n.query));
112
112
  const r = Object.assign({}, this.configuration.headers, n.headers);
113
- Object.keys(r).forEach((h) => r[h] === void 0 ? delete r[h] : {});
113
+ Object.keys(r).forEach((g) => r[g] === void 0 ? delete r[g] : {});
114
114
  const o = typeof t == "function" ? t : async () => t, a = {
115
115
  method: n.method,
116
116
  headers: r,
@@ -158,7 +158,7 @@ class K extends Error {
158
158
  super(t), this.cause = n, this.name = "FetchError";
159
159
  }
160
160
  }
161
- class g extends Error {
161
+ class h extends Error {
162
162
  constructor(n, t) {
163
163
  super(t), this.field = n, this.name = "RequiredError";
164
164
  }
@@ -179,10 +179,10 @@ function R(e, n, t = "") {
179
179
  return n instanceof Date ? `${encodeURIComponent(i)}=${encodeURIComponent(n.toISOString())}` : n instanceof Object ? q(n, i) : `${encodeURIComponent(i)}=${encodeURIComponent(String(n))}`;
180
180
  }
181
181
  function p(e, n) {
182
- return Object.keys(e).reduce(
183
- (t, i) => ({ ...t, [i]: n(e[i]) }),
184
- {}
185
- );
182
+ const t = {};
183
+ for (const i of Object.keys(e))
184
+ t[i] = n(e[i]);
185
+ return t;
186
186
  }
187
187
  class c {
188
188
  constructor(n, t = (i) => i) {
@@ -192,19 +192,19 @@ class c {
192
192
  return this.transformer(await this.raw.json());
193
193
  }
194
194
  }
195
- function M(e) {
196
- return N(e);
195
+ function N(e) {
196
+ return M(e);
197
197
  }
198
- function N(e, n) {
198
+ function M(e, n) {
199
199
  return e == null ? e : {
200
200
  identifier: e.identifier == null ? void 0 : e.identifier,
201
201
  content: e.content == null ? void 0 : e.content.map(A)
202
202
  };
203
203
  }
204
204
  function A(e) {
205
- return D(e);
205
+ return O(e);
206
206
  }
207
- function D(e, n) {
207
+ function O(e, n) {
208
208
  return e == null ? e : {
209
209
  items: e.items == null ? void 0 : e.items,
210
210
  content: e.content == null ? void 0 : e.content,
@@ -212,42 +212,44 @@ function D(e, n) {
212
212
  identifier: e.identifier == null ? void 0 : e.identifier,
213
213
  uid: e.uid == null ? void 0 : e.uid,
214
214
  component: e.component == null ? void 0 : e.component,
215
- slots: e.slots == null ? void 0 : p(e.slots, M)
215
+ slots: e.slots == null ? void 0 : p(e.slots, N)
216
216
  };
217
217
  }
218
218
  function I(e) {
219
- return O(e);
219
+ return D(e);
220
220
  }
221
- function O(e, n) {
221
+ function D(e, n) {
222
222
  return e == null ? e : {
223
223
  slug: e.slug == null ? void 0 : e.slug,
224
224
  title: e.title == null ? void 0 : e.title,
225
225
  href: e.href == null ? void 0 : e.href
226
226
  };
227
227
  }
228
- function T(e) {
229
- return B(e);
228
+ function B(e) {
229
+ return G(e);
230
230
  }
231
- function B(e, n) {
231
+ function G(e, n) {
232
232
  return e == null ? e : {
233
- type: e.type == null ? void 0 : e.type,
234
- target: e.target == null ? void 0 : e.target,
235
- label: e.label == null ? void 0 : e.label,
236
- href: e.href == null ? void 0 : e.href,
233
+ domain: e.domain == null ? void 0 : e.domain,
237
234
  slug: e.slug == null ? void 0 : e.slug,
238
- properties: e.properties == null ? void 0 : e.properties,
239
- children: e.children == null ? void 0 : e.children.map(T)
235
+ version: e.version == null ? void 0 : e.version,
236
+ updated_at: e.updated_at == null ? void 0 : e.updated_at,
237
+ language: e.language == null ? void 0 : e.language,
238
+ primary_language: e.primary_language == null ? void 0 : e.primary_language
240
239
  };
241
240
  }
242
- function G(e) {
241
+ function k(e) {
243
242
  return H(e);
244
243
  }
245
244
  function H(e, n) {
246
245
  return e == null ? e : {
247
- items: e.items == null ? void 0 : e.items.map(T),
248
- uid: e.uid == null ? void 0 : e.uid,
249
- identifier: e.identifier == null ? void 0 : e.identifier,
250
- label: e.label == null ? void 0 : e.label
246
+ type: e.type == null ? void 0 : e.type,
247
+ target: e.target == null ? void 0 : e.target,
248
+ label: e.label == null ? void 0 : e.label,
249
+ href: e.href == null ? void 0 : e.href,
250
+ slug: e.slug == null ? void 0 : e.slug,
251
+ properties: e.properties == null ? void 0 : e.properties,
252
+ children: e.children == null ? void 0 : e.children.map(k)
251
253
  };
252
254
  }
253
255
  function z(e) {
@@ -255,22 +257,20 @@ function z(e) {
255
257
  }
256
258
  function V(e, n) {
257
259
  return e == null ? e : {
258
- domain: e.domain == null ? void 0 : e.domain,
259
- slug: e.slug == null ? void 0 : e.slug,
260
- version: e.version == null ? void 0 : e.version,
261
- updated_at: e.updated_at == null ? void 0 : e.updated_at,
262
- language: e.language == null ? void 0 : e.language,
263
- primary_language: e.primary_language == null ? void 0 : e.primary_language
260
+ items: e.items == null ? void 0 : e.items.map(k),
261
+ uid: e.uid == null ? void 0 : e.uid,
262
+ identifier: e.identifier == null ? void 0 : e.identifier,
263
+ label: e.label == null ? void 0 : e.label
264
264
  };
265
265
  }
266
- function W(e) {
267
- return J(e);
266
+ function J(e) {
267
+ return W(e);
268
268
  }
269
- function J(e, n) {
269
+ function W(e, n) {
270
270
  return e == null ? e : {
271
- nitro: e.nitro == null ? void 0 : z(e.nitro),
271
+ nitro: e.nitro == null ? void 0 : B(e.nitro),
272
272
  pages: e.pages == null ? void 0 : e.pages,
273
- containers: e.containers == null ? void 0 : p(e.containers, G),
273
+ containers: e.containers == null ? void 0 : p(e.containers, z),
274
274
  globals: e.globals == null ? void 0 : e.globals
275
275
  };
276
276
  }
@@ -278,18 +278,38 @@ function Q(e) {
278
278
  return X(e);
279
279
  }
280
280
  function X(e, n) {
281
+ return e == null ? e : {
282
+ shortcode: e.shortcode == null ? void 0 : e.shortcode,
283
+ name: e.name == null ? void 0 : e.name
284
+ };
285
+ }
286
+ function T(e) {
287
+ return Y(e);
288
+ }
289
+ function Y(e, n) {
290
+ return e == null ? e : {
291
+ language: e.language == null ? void 0 : Q(e.language),
292
+ slug: e.slug == null ? void 0 : e.slug,
293
+ title: e.title == null ? void 0 : e.title,
294
+ href: e.href == null ? void 0 : e.href
295
+ };
296
+ }
297
+ function Z(e) {
298
+ return ee(e);
299
+ }
300
+ function ee(e, n) {
281
301
  return e == null ? e : {
282
302
  api: e.api == null ? void 0 : e.api,
283
303
  image: e.image == null ? void 0 : e.image
284
304
  };
285
305
  }
286
- function Y(e) {
287
- return Z(e);
306
+ function ne(e) {
307
+ return te(e);
288
308
  }
289
- function Z(e, n) {
309
+ function te(e, n) {
290
310
  return e == null ? e : {
291
311
  _version: e._version == null ? void 0 : e._version,
292
- entity_metric: e.entity_metric == null ? void 0 : Q(e.entity_metric),
312
+ entity_metric: e.entity_metric == null ? void 0 : Z(e.entity_metric),
293
313
  entity_unique_id: e.entity_unique_id == null ? void 0 : e.entity_unique_id,
294
314
  entity_id: e.entity_id == null ? void 0 : e.entity_id,
295
315
  entity_image: e.entity_image == null ? void 0 : e.entity_image,
@@ -304,36 +324,16 @@ function Z(e, n) {
304
324
  routes: e.routes == null ? void 0 : e.routes
305
325
  };
306
326
  }
307
- function ee(e) {
308
- return ne(e);
309
- }
310
- function ne(e, n) {
311
- return e == null ? e : {
312
- shortcode: e.shortcode == null ? void 0 : e.shortcode,
313
- name: e.name == null ? void 0 : e.name
314
- };
315
- }
316
- function k(e) {
317
- return te(e);
318
- }
319
- function te(e, n) {
320
- return e == null ? e : {
321
- language: e.language == null ? void 0 : ee(e.language),
322
- slug: e.slug == null ? void 0 : e.slug,
323
- title: e.title == null ? void 0 : e.title,
324
- href: e.href == null ? void 0 : e.href
325
- };
326
- }
327
327
  function v(e) {
328
328
  return ie(e);
329
329
  }
330
330
  function ie(e, n) {
331
331
  return e == null ? e : {
332
- entity: e.entity == null ? void 0 : Y(e.entity),
332
+ entity: e.entity == null ? void 0 : ne(e.entity),
333
333
  model: e.model == null ? void 0 : e.model,
334
334
  language: e.language == null ? void 0 : e.language,
335
335
  jsonld: e.jsonld == null ? void 0 : e.jsonld,
336
- translation: e.translation == null ? void 0 : e.translation.map(k),
336
+ translation: e.translation == null ? void 0 : e.translation.map(T),
337
337
  breadcrumb: e.breadcrumb == null ? void 0 : e.breadcrumb.map(I)
338
338
  };
339
339
  }
@@ -395,7 +395,7 @@ function ue(e, n) {
395
395
  target: e.target == null ? void 0 : e.target,
396
396
  container: e.container == null ? void 0 : e.container,
397
397
  breadcrumb: e.breadcrumb == null ? void 0 : e.breadcrumb.map(I),
398
- translation: e.translation == null ? void 0 : e.translation.map(k)
398
+ translation: e.translation == null ? void 0 : e.translation.map(T)
399
399
  };
400
400
  }
401
401
  function ce(e) {
@@ -417,13 +417,13 @@ class fe extends d {
417
417
  n.lang != null && (i.lang = n.lang);
418
418
  const r = {};
419
419
  this.configuration && this.configuration.apiKey && (i.token = await this.configuration.apiKey("token"));
420
- const o = await this.request({
420
+ const a = await this.request({
421
421
  path: "/config",
422
422
  method: "GET",
423
423
  headers: r,
424
424
  query: i
425
425
  }, t);
426
- return new c(o, (a) => W(a));
426
+ return new c(a, (l) => J(l));
427
427
  }
428
428
  /**
429
429
  * The config API endpoint provides comprehensive information required for configuring the layout of websites. It encompasses various essential elements, including containers with pages, an extensive list of available slugs, globals containing content pool data, and crucial details about the Nitro configuration itself. By accessing this endpoint, developers can gather all the necessary data to effectively design and structure their websites. The endpoint offers a holistic view of the website\'s layout, empowering developers to tailor the user experience and optimize the overall design.
@@ -433,14 +433,14 @@ class fe extends d {
433
433
  return await (await this.configRaw(n, t)).value();
434
434
  }
435
435
  }
436
- class he extends d {
436
+ class ge extends d {
437
437
  /**
438
438
  * The endpoint allows for the retrieval of entities based on their slug, with an optional Entity-Type-ID for more accurate results. The endpoint requires a `slug` parameter to be passed in the path, which is necessary for identifying the entity. However, since slugs are not unique across different entities, it is highly recommended to also provide the `typeId` parameter through the query to avoid incorrect or unintended results. This `typeId` serves as an Entity-Definition-Schema ID, ensuring a more precise and targeted entity retrieval by distinguishing the entities more clearly. The `slug` parameter is mandatory and should be a string (e.g., \'hello-world\'), while the `typeId` parameter is optional and should be an integer (e.g., 123), representing the Entity-Definition-Schema ID.
439
439
  * Find entity by slug and optional Entity-Type-ID
440
440
  */
441
441
  async entityBySlugRaw(n, t) {
442
442
  if (n.slug == null)
443
- throw new g(
443
+ throw new h(
444
444
  "slug",
445
445
  'Required parameter "slug" was null or undefined when calling entityBySlug().'
446
446
  );
@@ -448,13 +448,15 @@ class he extends d {
448
448
  n.typeId != null && (i.typeId = n.typeId), n.lang != null && (i.lang = n.lang);
449
449
  const r = {};
450
450
  this.configuration && this.configuration.apiKey && (i.token = await this.configuration.apiKey("token"));
451
- const o = await this.request({
452
- path: "/entities/slug/{slug}".replace("{slug}", encodeURIComponent(String(n.slug))),
451
+ let o = "/entities/slug/{slug}";
452
+ o = o.replace("{slug}", encodeURIComponent(String(n.slug)));
453
+ const a = await this.request({
454
+ path: o,
453
455
  method: "GET",
454
456
  headers: r,
455
457
  query: i
456
458
  }, t);
457
- return new c(o, (a) => v(a));
459
+ return new c(a, (l) => v(l));
458
460
  }
459
461
  /**
460
462
  * The endpoint allows for the retrieval of entities based on their slug, with an optional Entity-Type-ID for more accurate results. The endpoint requires a `slug` parameter to be passed in the path, which is necessary for identifying the entity. However, since slugs are not unique across different entities, it is highly recommended to also provide the `typeId` parameter through the query to avoid incorrect or unintended results. This `typeId` serves as an Entity-Definition-Schema ID, ensuring a more precise and targeted entity retrieval by distinguishing the entities more clearly. The `slug` parameter is mandatory and should be a string (e.g., \'hello-world\'), while the `typeId` parameter is optional and should be an integer (e.g., 123), representing the Entity-Definition-Schema ID.
@@ -469,7 +471,7 @@ class he extends d {
469
471
  */
470
472
  async entityByUniqueidRaw(n, t) {
471
473
  if (n.uniqueid == null)
472
- throw new g(
474
+ throw new h(
473
475
  "uniqueid",
474
476
  'Required parameter "uniqueid" was null or undefined when calling entityByUniqueid().'
475
477
  );
@@ -477,13 +479,15 @@ class he extends d {
477
479
  n.lang != null && (i.lang = n.lang);
478
480
  const r = {};
479
481
  this.configuration && this.configuration.apiKey && (i.token = await this.configuration.apiKey("token"));
480
- const o = await this.request({
481
- path: "/entities/uniqueid/{uniqueid}".replace("{uniqueid}", encodeURIComponent(String(n.uniqueid))),
482
+ let o = "/entities/uniqueid/{uniqueid}";
483
+ o = o.replace("{uniqueid}", encodeURIComponent(String(n.uniqueid)));
484
+ const a = await this.request({
485
+ path: o,
482
486
  method: "GET",
483
487
  headers: r,
484
488
  query: i
485
489
  }, t);
486
- return new c(o, (a) => v(a));
490
+ return new c(a, (l) => v(l));
487
491
  }
488
492
  /**
489
493
  * The endpoint provides comprehensive information about a specified entity. An entity represents a collection of information pertaining to a specific data type and is defined by a key-value pair. You can use various data types such as blogs, events, or any other relevant data. However, in order to access an entity, it must be properly configured within the nitro config.
@@ -493,7 +497,7 @@ class he extends d {
493
497
  return await (await this.entityByUniqueidRaw(n, t)).value();
494
498
  }
495
499
  }
496
- class ge extends d {
500
+ class he extends d {
497
501
  /**
498
502
  * This endpoint allows you to retrieve the designated homepage of a website. Alternatively, you can utilize the pages endpoint by specifying an empty slug parameter to achieve the same result. By using either of these methods, you can effectively access the desired homepage of the website.
499
503
  * Get Home
@@ -503,13 +507,13 @@ class ge extends d {
503
507
  n.lang != null && (i.lang = n.lang);
504
508
  const r = {};
505
509
  this.configuration && this.configuration.apiKey && (i.token = await this.configuration.apiKey("token"));
506
- const o = await this.request({
510
+ const a = await this.request({
507
511
  path: "/pages/home",
508
512
  method: "GET",
509
513
  headers: r,
510
514
  query: i
511
515
  }, t);
512
- return new c(o, (a) => m(a));
516
+ return new c(a, (l) => m(l));
513
517
  }
514
518
  /**
515
519
  * This endpoint allows you to retrieve the designated homepage of a website. Alternatively, you can utilize the pages endpoint by specifying an empty slug parameter to achieve the same result. By using either of these methods, you can effectively access the desired homepage of the website.
@@ -527,13 +531,13 @@ class ge extends d {
527
531
  n.slug != null && (i.slug = n.slug), n.lang != null && (i.lang = n.lang);
528
532
  const r = {};
529
533
  this.configuration && this.configuration.apiKey && (i.token = await this.configuration.apiKey("token"));
530
- const o = await this.request({
534
+ const a = await this.request({
531
535
  path: "/pages",
532
536
  method: "GET",
533
537
  headers: r,
534
538
  query: i
535
539
  }, t);
536
- return new c(o, (a) => m(a));
540
+ return new c(a, (l) => m(l));
537
541
  }
538
542
  /**
539
543
  * This endpoint retrieves comprehensive information from a specified page using either a slug or a path. The slug refers to a unique identifier for the page, while the path is the slug with a leading slash. By providing either the slug or the path as input, the function will gather all the relevant details associated with the page.
@@ -550,7 +554,7 @@ class pe extends d {
550
554
  */
551
555
  async searchRaw(n, t) {
552
556
  if (n.query == null)
553
- throw new g(
557
+ throw new h(
554
558
  "query",
555
559
  'Required parameter "query" was null or undefined when calling search().'
556
560
  );
@@ -558,13 +562,13 @@ class pe extends d {
558
562
  n.query != null && (i.query = n.query), n.lang != null && (i.lang = n.lang);
559
563
  const r = {};
560
564
  this.configuration && this.configuration.apiKey && (i.token = await this.configuration.apiKey("token"));
561
- const o = await this.request({
565
+ const a = await this.request({
562
566
  path: "/search",
563
567
  method: "GET",
564
568
  headers: r,
565
569
  query: i
566
570
  }, t);
567
- return new c(o, (a) => a.map(x));
571
+ return new c(a, (l) => l.map(x));
568
572
  }
569
573
  /**
570
574
  * This endpoint offers a powerful capability to search through the websites sitemap, encompassing both pages and entities. With this endpoint, users can efficiently explore and retrieve information from your sitemap by creating a paginated search experience.
@@ -584,13 +588,13 @@ class ye extends d {
584
588
  n.lang != null && (i.lang = n.lang);
585
589
  const r = {};
586
590
  this.configuration && this.configuration.apiKey && (i.token = await this.configuration.apiKey("token"));
587
- const o = await this.request({
591
+ const a = await this.request({
588
592
  path: "/sitemap",
589
593
  method: "GET",
590
594
  headers: r,
591
595
  query: i
592
596
  }, t);
593
- return new c(o, (a) => a.map(x));
597
+ return new c(a, (l) => l.map(x));
594
598
  }
595
599
  /**
596
600
  * This endpoint provides comprehensive data for generating the sitemap. It encompasses all the necessary information, including pages from containers, as well as all entities that have been mapped.
@@ -610,13 +614,13 @@ class ve extends d {
610
614
  n.lang != null && (i.lang = n.lang);
611
615
  const r = {};
612
616
  this.configuration && this.configuration.apiKey && (i.token = await this.configuration.apiKey("token"));
613
- const o = await this.request({
617
+ const a = await this.request({
614
618
  path: "/version",
615
619
  method: "GET",
616
620
  headers: r,
617
621
  query: i
618
622
  }, t);
619
- return new c(o, (a) => ce(a));
623
+ return new c(a, (l) => ce(l));
620
624
  }
621
625
  /**
622
626
  * The Version API endpoint offers a highly efficient solution for evaluating the current caching status of your application\'s caching mechanism. This functionality allows you to cache the entire application configuration and page responses indefinitely. However, utilizing this endpoint enables you to assess the validity of the cache by sending a request to determine its current status. This caching endpoint is specifically designed for optimal performance when compared to the configuration endpoint, which requires more thorough evaluation and encompasses a substantial response body.
@@ -660,11 +664,11 @@ function Re(e, n, t) {
660
664
  for (const [s, u] of Object.entries(
661
665
  n
662
666
  )) {
663
- const h = await this.resolve(
667
+ const g = await this.resolve(
664
668
  "/" + e + "/" + u + ".astro"
665
669
  );
666
- h && a.push(
667
- `export { default as ${qe(s)} } from "${h.id}"`
670
+ g && a.push(
671
+ `export { default as ${qe(s)} } from "${g.id}"`
668
672
  );
669
673
  }
670
674
  let l = null;
@@ -690,30 +694,30 @@ function f() {
690
694
  async function Te(e) {
691
695
  return await e.locals.config;
692
696
  }
693
- function ke() {
694
- return new fe(f());
695
- }
696
697
  function xe() {
697
- return new he(f());
698
+ return new fe(f());
698
699
  }
699
700
  function Se() {
700
701
  return new ge(f());
701
702
  }
702
703
  function je() {
703
- return new pe(f());
704
+ return new he(f());
704
705
  }
705
706
  function Le() {
706
- return new ye(f());
707
+ return new pe(f());
707
708
  }
708
709
  function Ue() {
710
+ return new ye(f());
711
+ }
712
+ function Pe() {
709
713
  return new ve(f());
710
714
  }
711
- function Pe(e) {
715
+ function Ie(e) {
712
716
  return {
713
717
  "data-flyo-uid": e.uid
714
718
  };
715
719
  }
716
- const Ie = `
720
+ const Fe = Ie, ke = `
717
721
  <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 163.4 88.5">
718
722
  <style type="text/css">
719
723
  .st8{fill:#FFFFFF;}
@@ -745,7 +749,7 @@ const Ie = `
745
749
  </g>
746
750
  </svg>
747
751
  `;
748
- function Fe(e) {
752
+ function $e(e) {
749
753
  const n = {
750
754
  accessToken: !1,
751
755
  liveEdit: !1,
@@ -773,7 +777,7 @@ function Fe(e) {
773
777
  id: "flyo-nitro",
774
778
  name: "Flyo Nitro",
775
779
  //icon: 'lightbulb',
776
- icon: Ie,
780
+ icon: ke,
777
781
  //icon: '<svg width="200" height="200" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"><ellipse cx="100" cy="60" rx="90" ry="50" fill="#F4A460" /><circle cx="70" cy="45" r="5" fill="white" /><circle cx="90" cy="30" r="5" fill="white" /><circle cx="110" cy="45" r="5" fill="white" /><circle cx="130" cy="30" r="5" fill="white" /><circle cx="150" cy="45" r="5" fill="white" /><path d="M30 90 Q60 75, 90 90 T150 90 Q160 80, 180 90" fill="#228B22" /><rect x="30" y="90" width="140" height="15" fill="#FF6347" /><rect x="30" y="105" width="140" height="15" fill="#FFD700" /><rect x="30" y="120" width="140" height="25" fill="#8B4513" /><ellipse cx="100" cy="160" rx="90" ry="30" fill="#F4A460" /></svg>',
778
782
  entrypoint: "@flyo/nitro-astro/toolbar.ts"
779
783
  }), r({
@@ -847,15 +851,16 @@ function Fe(e) {
847
851
  };
848
852
  }
849
853
  export {
850
- Fe as default,
851
- Pe as editableBlock,
854
+ $e as default,
855
+ Ie as editable,
856
+ Fe as editableBlock,
852
857
  Te as useConfig,
853
- ke as useConfigApi,
858
+ xe as useConfigApi,
854
859
  f as useConfiguration,
855
- xe as useEntitiesApi,
860
+ Se as useEntitiesApi,
856
861
  Ae as useFlyoIntegration,
857
- Se as usePagesApi,
858
- je as useSearchApi,
859
- Le as useSitemapApi,
860
- Ue as useVersionApi
862
+ je as usePagesApi,
863
+ Le as useSearchApi,
864
+ Ue as useSitemapApi,
865
+ Pe as useVersionApi
861
866
  };
@@ -0,0 +1,3 @@
1
+ import { default as FlyoWysiwyg } from './FlyoWysiwyg.astro';
2
+
3
+ export default FlyoWysiwyg;
@@ -0,0 +1 @@
1
+ export {};
@@ -77,5 +77,6 @@ export declare function usePagesApi(): PagesApi;
77
77
  export declare function useSearchApi(): SearchApi;
78
78
  export declare function useSitemapApi(): SitemapApi;
79
79
  export declare function useVersionApi(): VersionApi;
80
- export declare function editableBlock(block: Block): object;
80
+ export declare function editable(block: Block): object;
81
+ export declare const editableBlock: typeof editable;
81
82
  export default function flyoNitroIntegration(options: IntegrationOptions): AstroIntegration;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flyo/nitro-astro",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "description": "Connecting Flyo Headless Content Hub into your Astro project.",
5
5
  "homepage": "https://dev.flyo.cloud/nitro",
6
6
  "keywords": [
@@ -11,18 +11,21 @@
11
11
  "module": "./dist/nitro-astro.mjs",
12
12
  "scripts": {
13
13
  "dev": "vite build --watch",
14
- "build": "vite build"
14
+ "build": "vite build",
15
+ "test": "vitest run",
16
+ "test:watch": "vitest"
15
17
  },
16
18
  "dependencies": {
17
- "@flyo/nitro-typescript": "^1.1.0",
18
- "@flyo/nitro-js-bridge": "^1.1.2"
19
+ "@flyo/nitro-js-bridge": "^1.2.0",
20
+ "@flyo/nitro-typescript": "^1.1.0"
19
21
  },
20
22
  "devDependencies": {
23
+ "@types/node": "20.17.0",
21
24
  "astro": "^4.16.7",
22
25
  "typescript": "5.6.3",
23
- "@types/node": "20.17.0",
24
26
  "vite": "^5.4.10",
25
- "vite-plugin-dts": "^3.9.1"
27
+ "vite-plugin-dts": "^3.9.1",
28
+ "vitest": "^4.0.14"
26
29
  },
27
30
  "exports": {
28
31
  ".": {
@@ -65,6 +68,11 @@
65
68
  "import": "./components/MetaInfoPage.ts",
66
69
  "require": "./components/MetaInfoPage.ts"
67
70
  },
71
+ "./FlyoWysiwyg.astro": {
72
+ "types": "./components/FlyoWysiwyg.ts",
73
+ "import": "./components/FlyoWysiwyg.ts",
74
+ "require": "./components/FlyoWysiwyg.ts"
75
+ },
68
76
  "./cdn.ts": "./cdn.ts",
69
77
  "./middleware.ts": "./middleware.ts",
70
78
  "./sitemap.ts": "./sitemap.ts",