@sitecore/byoc
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -1,2 +0,2 @@ | ||
var T=(e={})=>Object.keys(e).reduce((t,o)=>Object.assign(t,{[d(o)]:e[o]}),{}),L=(e={})=>Object.keys(e).reduce((t,o)=>Object.assign(t,{[f(o)]:e[o]}),{});function d(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return f(e).replace(t,function(o){return"-"+o.toLowerCase()})}function f(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,o)=>o===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function v(e,t={}){let o=e.properties||{};return{type:"object",...e,properties:Object.keys(o).reduce((n,r)=>Object.assign(n,{[r]:{...o[r],default:t.hasOwnProperty(r)?t[r]:o[r].default,title:o[r].title||d(r).split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(" ")}}),{})}}var y=(e,t)=>{let o={...e};return Object.keys(t).filter(r=>/(integer|number)/.test(t[r].type)).forEach(r=>{var i;!((i=o[r])===null||i===void 0)&&i["ui:widget"]||(o[r]={...o[r],"ui:widget":"updown"})}),o};function C(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch{return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch{return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function A(e,t){return Object.keys(t).reduce((o,n)=>{let r=t[n],i=f(n),s=e?.properties[i],c=s?.type,a=C(r,c);return a!=null&&!n.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(n)?{...o,[i]:a}:o},{})}function w(e,t){return{...P(e),...A(e,t)}}function P(e){return Object.keys(e.properties).reduce((t,o)=>{var n,r;return((n=e.properties[o])===null||n===void 0?void 0:n.default)!=null?{...t,[o]:(r=e.properties[o])===null||r===void 0?void 0:r.default}:t},{})}function B(e,t,o){let{thumbnail:n="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:r,id:i=e.name,group:s=null,ui:c,isHidden:a=!1,uiSchema:u,schema:g,...l}=e,j=g||l||{},E=u||c||{},p=v({description:"External component",...j,type:"object"},o),_=y(E,p.properties||{});return{component:t,name:r,schema:p,uiSchema:_,thumbnail:n,group:s,isHidden:a,id:i,title:p?.title||l?.title||r}}var x,m=typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{},D=m.BYOCWebComponent||(m.BYOCWebComponent=typeof HTMLElement<"u"?HTMLElement:typeof windowJSDOM<"u"?windowJSDOM.HTMLElement:class{setAttribute(){}}),b=m.BYOCComponents||(m.BYOCComponents={});function J(e,t,o={}){if(!t?.name)throw new Error("Could not register external component. Please make sure you provide a name in the options"+JSON.stringify(t));let n=B(t,e,o);b[n.id]=n,K(e)&&h.register("byoc-"+d(t.name),void 0,e),O()}function K(e){return e&&"prototype"in e&&"setAttribute"in e.prototype}function I(e,t={}){var o;let n=(o=S(e))===null||o===void 0?void 0:o.schema;return n?w(n,t):t}function N(e){let t=S(e);return Object.keys(t?.schema.properties||{}).filter(o=>{var n,r;return((r=(n=t?.uiSchema)===null||n===void 0?void 0:n[o])===null||r===void 0?void 0:r["ui:widget"])!="hidden"})}function S(e){if(typeof e!="string"){if(e&&"schema"in e)return e;throw new Error(`Component name should be a string, got ${typeof e}`)}let[t,o]=e.split("?");var n=b[t];if(o){let r=b[e];if(!r&&!n)return null;r&&(n={...n,...r,component:r.component||n?.component}),o.split(/\&/g).forEach(i=>{var s,c,a;let[u,g]=i.split("="),l=((s=n.schema.properties)===null||s===void 0?void 0:s[u])||{type:"string"};n={...n,schema:{...n.schema,properties:{...n.schema.properties,[u]:{...l,default:C(decodeURIComponent(g),l.type)}}},uiSchema:{...n.uiSchema,[u]:{...n.uiSchema[u],"ui:widget":(a=(c=n.uiSchema[u])===null||c===void 0?void 0:c["ui:widget"])!==null&&a!==void 0?a:"hidden"}}}})}return n}function O(){clearTimeout(x),x=setTimeout(()=>{var e;typeof window<"u"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(b)}),"*"))},30)}O();var h=class extends D{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{J(null,t)})}catch{}}static register(t,o,n=this){o==null&&(o=typeof window<"u"?window:void 0),o&&!o.customElements.get(t)&&o.customElements.define(t,n)}};h.register("byoc-registration");export{h as BYOCRegistration,D as WebComponent,S as getComponent,N as getComponentConfigurablePropertyNames,I as getComponentProperties,P as getSchemaDefaults,w as getSchemaProperties,K as isWebComponent,B as normalizeOptions,L as objectKeysToCamelCase,T as objectKeysToKebabCase,A as parseSchemaProperties,C as parseValue,J as registerComponent,b as registered,O as setRegistrationCallback,f as toCamelCase,d as toKebabCase,v as transformSchema,y as transformUiSchema}; | ||
var T=(e={})=>Object.keys(e).reduce((t,o)=>Object.assign(t,{[m(o)]:e[o]}),{}),L=(e={})=>Object.keys(e).reduce((t,o)=>Object.assign(t,{[f(o)]:e[o]}),{});function m(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return f(e).replace(t,function(o){return"-"+o.toLowerCase()})}function f(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,o)=>o===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function v(e,t={}){let o=e.properties||{};return{type:"object",...e,properties:Object.keys(o).reduce((n,r)=>Object.assign(n,{[r]:{...o[r],default:t.hasOwnProperty(r)?t[r]:o[r].default,title:o[r].title||m(r).split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(" ")}}),{})}}var y=(e,t)=>{let o={...e};return Object.keys(t).filter(r=>/(integer|number)/.test(t[r].type)).forEach(r=>{var i;!((i=o[r])===null||i===void 0)&&i["ui:widget"]||(o[r]={...o[r],"ui:widget":"updown"})}),o};function C(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch{return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch{return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function A(e,t){return Object.keys(t).reduce((o,n)=>{let r=t[n],i=f(n),s=e?.properties[i],c=s?.type,a=C(r,c);return a!=null&&!n.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(n)?{...o,[i]:a}:o},{})}function w(e,t){return{...B(e),...A(e,t)}}function B(e){return Object.keys(e.properties).reduce((t,o)=>{var n,r;return((n=e.properties[o])===null||n===void 0?void 0:n.default)!=null?{...t,[o]:(r=e.properties[o])===null||r===void 0?void 0:r.default}:t},{})}function P(e,t,o){let{thumbnail:n="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:r,id:i=e.name,group:s=null,ui:c,isHidden:a=!1,uiSchema:u,schema:g,...l}=e,j=g||l||{},E=u||c||{},d=v({description:"External component",...j,type:"object"},o),_=y(E,d.properties||{});return{component:t,name:r,schema:d,uiSchema:_,thumbnail:n,group:s,isHidden:a,id:i,title:d?.title||l?.title||r}}var x,p=typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{},D=p.BYOCWebComponent||(p.BYOCWebComponent=typeof HTMLElement<"u"?HTMLElement:typeof windowJSDOM<"u"?windowJSDOM.HTMLElement:class{setAttribute(){}}),b=p.BYOCComponentsFrozen?{}:p.BYOCComponents||(p.BYOCComponents={}),z=()=>{p.BYOCComponentsFrozen=!0};function J(e,t,o={}){if(!t?.name)throw new Error("Could not register external component. Please make sure you provide a name in the options"+JSON.stringify(t));let n=P(t,e,o);b[n.id]=n,K(e)&&h.register("byoc-"+m(t.name),void 0,e),S()}function K(e){return e&&"prototype"in e&&"setAttribute"in e.prototype}function H(e,t={}){var o;let n=(o=O(e))===null||o===void 0?void 0:o.schema;return n?w(n,t):t}function F(e){let t=O(e);return Object.keys(t?.schema.properties||{}).filter(o=>{var n,r;return((r=(n=t?.uiSchema)===null||n===void 0?void 0:n[o])===null||r===void 0?void 0:r["ui:widget"])!="hidden"})}function O(e){if(typeof e!="string"){if(e&&"schema"in e)return e;throw new Error(`Component name should be a string, got ${typeof e}`)}let[t,o]=e.split("?");var n=b[t];if(o){let r=b[e];if(!r&&!n)return null;r&&(n={...n,...r,component:r.component||n?.component}),o.split(/\&/g).forEach(i=>{var s,c,a;let[u,g]=i.split("="),l=((s=n.schema.properties)===null||s===void 0?void 0:s[u])||{type:"string"};n={...n,schema:{...n.schema,properties:{...n.schema.properties,[u]:{...l,default:C(decodeURIComponent(g),l.type)}}},uiSchema:{...n.uiSchema,[u]:{...n.uiSchema[u],"ui:widget":(a=(c=n.uiSchema[u])===null||c===void 0?void 0:c["ui:widget"])!==null&&a!==void 0?a:"hidden"}}}})}return n}function S(){clearTimeout(x),x=setTimeout(()=>{var e;typeof window<"u"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(b)}),"*"))},30)}S();var h=class extends D{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{J(null,t)})}catch{}}static register(t,o,n=this){o==null&&(o=typeof window<"u"?window:void 0),o&&!o.customElements.get(t)&&o.customElements.define(t,n)}};h.register("byoc-registration");export{h as BYOCRegistration,D as WebComponent,O as getComponent,F as getComponentConfigurablePropertyNames,H as getComponentProperties,B as getSchemaDefaults,w as getSchemaProperties,K as isWebComponent,P as normalizeOptions,L as objectKeysToCamelCase,T as objectKeysToKebabCase,A as parseSchemaProperties,C as parseValue,z as preventGlobalVariableReuse,J as registerComponent,b as registered,S as setRegistrationCallback,f as toCamelCase,m as toKebabCase,v as transformSchema,y as transformUiSchema}; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -1,2 +0,2 @@ | ||
import a from"react";var v=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[d(n)]:e[n]}),{}),R=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[g(n)]:e[n]}),{});function d(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return g(e).replace(t,function(n){return"-"+n.toLowerCase()})}function g(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,n)=>n===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function j(e,t={}){let n=e.properties||{};return{type:"object",...e,properties:Object.keys(n).reduce((r,o)=>Object.assign(r,{[o]:{...n[o],default:t.hasOwnProperty(o)?t[o]:n[o].default,title:n[o].title||d(o).split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(" ")}}),{})}}var _=(e,t)=>{let n={...e};return Object.keys(t).filter(o=>/(integer|number)/.test(t[o].type)).forEach(o=>{var i;!((i=n[o])===null||i===void 0)&&i["ui:widget"]||(n[o]={...n[o],"ui:widget":"updown"})}),n};function x(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch{return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch{return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function B(e,t){return Object.keys(t).reduce((n,r)=>{let o=t[r],i=g(r),s=e?.properties[i],c=s?.type,l=x(o,c);return l!=null&&!r.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(r)?{...n,[i]:l}:n},{})}function N(e,t){return{...J(e),...B(e,t)}}function J(e){return Object.keys(e.properties).reduce((t,n)=>{var r,o;return((r=e.properties[n])===null||r===void 0?void 0:r.default)!=null?{...t,[n]:(o=e.properties[n])===null||o===void 0?void 0:o.default}:t},{})}function k(e,t,n){let{thumbnail:r="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:o,id:i=e.name,group:s=null,ui:c,isHidden:l=!1,uiSchema:u,schema:y,...p}=e,D=y||p||{},H=u||c||{},f=j({description:"External component",...D,type:"object"},n),T=_(H,f.properties||{});return{component:t,name:o,schema:f,uiSchema:T,thumbnail:r,group:s,isHidden:l,id:i,title:f?.title||p?.title||o}}var P,h=typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{},M=h.BYOCWebComponent||(h.BYOCWebComponent=typeof HTMLElement<"u"?HTMLElement:typeof windowJSDOM<"u"?windowJSDOM.HTMLElement:class{setAttribute(){}}),m=h.BYOCComponents||(h.BYOCComponents={});function L(e,t,n={}){if(!t?.name)throw new Error("Could not register external component. Please make sure you provide a name in the options"+JSON.stringify(t));let r=k(t,e,n);m[r.id]=r,w(e)&&C.register("byoc-"+d(t.name),void 0,e),A()}function w(e){return e&&"prototype"in e&&"setAttribute"in e.prototype}function W(e,t={}){var n;let r=(n=b(e))===null||n===void 0?void 0:n.schema;return r?N(r,t):t}function q(e){let t=b(e);return Object.keys(t?.schema.properties||{}).filter(n=>{var r,o;return((o=(r=t?.uiSchema)===null||r===void 0?void 0:r[n])===null||o===void 0?void 0:o["ui:widget"])!="hidden"})}function b(e){if(typeof e!="string"){if(e&&"schema"in e)return e;throw new Error(`Component name should be a string, got ${typeof e}`)}let[t,n]=e.split("?");var r=m[t];if(n){let o=m[e];if(!o&&!r)return null;o&&(r={...r,...o,component:o.component||r?.component}),n.split(/\&/g).forEach(i=>{var s,c,l;let[u,y]=i.split("="),p=((s=r.schema.properties)===null||s===void 0?void 0:s[u])||{type:"string"};r={...r,schema:{...r.schema,properties:{...r.schema.properties,[u]:{...p,default:x(decodeURIComponent(y),p.type)}}},uiSchema:{...r.uiSchema,[u]:{...r.uiSchema[u],"ui:widget":(l=(c=r.uiSchema[u])===null||c===void 0?void 0:c["ui:widget"])!==null&&l!==void 0?l:"hidden"}}}})}return r}function A(){clearTimeout(P),P=setTimeout(()=>{var e;typeof window<"u"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(m)}),"*"))},30)}A();var C=class extends M{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{L(null,t)})}catch{}}static register(t,n,r=this){n==null&&(n=typeof window<"u"?window:void 0),n&&!n.customElements.get(t)&&n.customElements.define(t,r)}};C.register("byoc-registration");var O=new Map,S=null,E=null;function U(e){var t;let{componentName:n,...r}=e,o=(t=b(n))===null||t===void 0?void 0:t.component;if(!O.get(n)){let s=E(()=>Promise.resolve(S),{ssr:!1,loading:()=>a.createElement(K,{...r,componentName:n})});O.set(n,s)}let i=O.get(n);return a.createElement(i,{...e,fallback:o?a.createElement(o,{...e}):null})}function oe(e,t){return E=e,S=t,t}function ie(e){if(Object.keys(e).length!=0)return E?U(e):K(e)}function se(){return a.createElement(a.Fragment,null,a.createElement("byoc-registration",{components:JSON.stringify(Object.values(m)),suppressHydrationWarning:!0}),a.createElement(S,null))}function K(e){let{componentName:t,fallback:n,...r}=e,o=b(t),i=o?.component;if(!i&&n||!t)return a.createElement("feaas-external",{"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},n);let s=W(t,r);delete s.suppressHydrationWarning;var c=null;return i&&w(i)?a.createElement("byoc-"+d(o.id),{...v(s),suppressHydrationWarning:!0}):a.createElement(a.Fragment,null,a.createElement("feaas-external",{...v(s),"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},i==null?null:a.createElement(i,{...s})))}export{C as BYOCRegistration,se as Bundle,ie as Component,U as NextComponent,K as RegularComponent,M as WebComponent,oe as enableNextClientsideComponents,b as getComponent,q as getComponentConfigurablePropertyNames,W as getComponentProperties,J as getSchemaDefaults,N as getSchemaProperties,w as isWebComponent,k as normalizeOptions,R as objectKeysToCamelCase,v as objectKeysToKebabCase,B as parseSchemaProperties,x as parseValue,L as registerComponent,m as registered,A as setRegistrationCallback,g as toCamelCase,d as toKebabCase,j as transformSchema,_ as transformUiSchema}; | ||
import a from"react";var v=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[d(n)]:e[n]}),{}),U=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[C(n)]:e[n]}),{});function d(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return C(e).replace(t,function(n){return"-"+n.toLowerCase()})}function C(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,n)=>n===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function j(e,t={}){let n=e.properties||{};return{type:"object",...e,properties:Object.keys(n).reduce((r,o)=>Object.assign(r,{[o]:{...n[o],default:t.hasOwnProperty(o)?t[o]:n[o].default,title:n[o].title||d(o).split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(" ")}}),{})}}var _=(e,t)=>{let n={...e};return Object.keys(t).filter(o=>/(integer|number)/.test(t[o].type)).forEach(o=>{var i;!((i=n[o])===null||i===void 0)&&i["ui:widget"]||(n[o]={...n[o],"ui:widget":"updown"})}),n};function x(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch{return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch{return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function J(e,t){return Object.keys(t).reduce((n,r)=>{let o=t[r],i=C(r),s=e?.properties[i],c=s?.type,l=x(o,c);return l!=null&&!r.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(r)?{...n,[i]:l}:n},{})}function N(e,t){return{...k(e),...J(e,t)}}function k(e){return Object.keys(e.properties).reduce((t,n)=>{var r,o;return((r=e.properties[n])===null||r===void 0?void 0:r.default)!=null?{...t,[n]:(o=e.properties[n])===null||o===void 0?void 0:o.default}:t},{})}function M(e,t,n){let{thumbnail:r="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:o,id:i=e.name,group:s=null,ui:c,isHidden:l=!1,uiSchema:u,schema:y,...p}=e,D=y||p||{},H=u||c||{},b=j({description:"External component",...D,type:"object"},n),T=_(H,b.properties||{});return{component:t,name:o,schema:b,uiSchema:T,thumbnail:r,group:s,isHidden:l,id:i,title:b?.title||p?.title||o}}var P,m=typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{},R=m.BYOCWebComponent||(m.BYOCWebComponent=typeof HTMLElement<"u"?HTMLElement:typeof windowJSDOM<"u"?windowJSDOM.HTMLElement:class{setAttribute(){}}),f=m.BYOCComponentsFrozen?{}:m.BYOCComponents||(m.BYOCComponents={}),W=()=>{m.BYOCComponentsFrozen=!0};function F(e,t,n={}){if(!t?.name)throw new Error("Could not register external component. Please make sure you provide a name in the options"+JSON.stringify(t));let r=M(t,e,n);f[r.id]=r,w(e)&&h.register("byoc-"+d(t.name),void 0,e),B()}function w(e){return e&&"prototype"in e&&"setAttribute"in e.prototype}function A(e,t={}){var n;let r=(n=g(e))===null||n===void 0?void 0:n.schema;return r?N(r,t):t}function q(e){let t=g(e);return Object.keys(t?.schema.properties||{}).filter(n=>{var r,o;return((o=(r=t?.uiSchema)===null||r===void 0?void 0:r[n])===null||o===void 0?void 0:o["ui:widget"])!="hidden"})}function g(e){if(typeof e!="string"){if(e&&"schema"in e)return e;throw new Error(`Component name should be a string, got ${typeof e}`)}let[t,n]=e.split("?");var r=f[t];if(n){let o=f[e];if(!o&&!r)return null;o&&(r={...r,...o,component:o.component||r?.component}),n.split(/\&/g).forEach(i=>{var s,c,l;let[u,y]=i.split("="),p=((s=r.schema.properties)===null||s===void 0?void 0:s[u])||{type:"string"};r={...r,schema:{...r.schema,properties:{...r.schema.properties,[u]:{...p,default:x(decodeURIComponent(y),p.type)}}},uiSchema:{...r.uiSchema,[u]:{...r.uiSchema[u],"ui:widget":(l=(c=r.uiSchema[u])===null||c===void 0?void 0:c["ui:widget"])!==null&&l!==void 0?l:"hidden"}}}})}return r}function B(){clearTimeout(P),P=setTimeout(()=>{var e;typeof window<"u"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(f)}),"*"))},30)}B();var h=class extends R{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{F(null,t)})}catch{}}static register(t,n,r=this){n==null&&(n=typeof window<"u"?window:void 0),n&&!n.customElements.get(t)&&n.customElements.define(t,r)}};h.register("byoc-registration");var O=new Map,S=null,E=null;function L(e){var t;let{componentName:n,...r}=e,o=(t=g(n))===null||t===void 0?void 0:t.component;if(!O.get(n)){let s=E(()=>Promise.resolve(S),{ssr:!1,loading:()=>a.createElement(K,{...r,componentName:n})});O.set(n,s)}let i=O.get(n);return a.createElement(i,{...e,fallback:o?a.createElement(o,{...e}):null})}function ie(e,t){return E=e,S=t,t}function se(e){if(Object.keys(e).length!=0)return E?L(e):K(e)}function ae(){return W(),a.createElement(a.Fragment,null,a.createElement("byoc-registration",{components:JSON.stringify(Object.values(f)),suppressHydrationWarning:!0}),a.createElement(S,null))}function K(e){let{componentName:t,fallback:n,...r}=e,o=g(t),i=o?.component;if(!i&&n||!t)return a.createElement("feaas-external",{"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},n);let s=A(t,r);delete s.suppressHydrationWarning;var c=null;return i&&w(i)?a.createElement("byoc-"+d(o.id),{...v(s),suppressHydrationWarning:!0}):a.createElement(a.Fragment,null,a.createElement("feaas-external",{...v(s),"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},i==null?null:a.createElement(i,{...s})))}export{h as BYOCRegistration,ae as Bundle,se as Component,L as NextComponent,K as RegularComponent,R as WebComponent,ie as enableNextClientsideComponents,g as getComponent,q as getComponentConfigurablePropertyNames,A as getComponentProperties,k as getSchemaDefaults,N as getSchemaProperties,w as isWebComponent,M as normalizeOptions,U as objectKeysToCamelCase,v as objectKeysToKebabCase,J as parseSchemaProperties,x as parseValue,W as preventGlobalVariableReuse,F as registerComponent,f as registered,B as setRegistrationCallback,C as toCamelCase,d as toKebabCase,j as transformSchema,_ as transformUiSchema}; | ||
//# sourceMappingURL=react.esm.js.map |
@@ -1,2 +0,2 @@ | ||
var T=(e={})=>Object.keys(e).reduce((t,o)=>Object.assign(t,{[d(o)]:e[o]}),{}),L=(e={})=>Object.keys(e).reduce((t,o)=>Object.assign(t,{[f(o)]:e[o]}),{});function d(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return f(e).replace(t,function(o){return"-"+o.toLowerCase()})}function f(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,o)=>o===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function v(e,t={}){let o=e.properties||{};return{type:"object",...e,properties:Object.keys(o).reduce((n,r)=>Object.assign(n,{[r]:{...o[r],default:t.hasOwnProperty(r)?t[r]:o[r].default,title:o[r].title||d(r).split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(" ")}}),{})}}var y=(e,t)=>{let o={...e};return Object.keys(t).filter(r=>/(integer|number)/.test(t[r].type)).forEach(r=>{var i;!((i=o[r])===null||i===void 0)&&i["ui:widget"]||(o[r]={...o[r],"ui:widget":"updown"})}),o};function C(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch{return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch{return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function A(e,t){return Object.keys(t).reduce((o,n)=>{let r=t[n],i=f(n),s=e?.properties[i],c=s?.type,a=C(r,c);return a!=null&&!n.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(n)?{...o,[i]:a}:o},{})}function w(e,t){return{...P(e),...A(e,t)}}function P(e){return Object.keys(e.properties).reduce((t,o)=>{var n,r;return((n=e.properties[o])===null||n===void 0?void 0:n.default)!=null?{...t,[o]:(r=e.properties[o])===null||r===void 0?void 0:r.default}:t},{})}function B(e,t,o){let{thumbnail:n="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:r,id:i=e.name,group:s=null,ui:c,isHidden:a=!1,uiSchema:u,schema:g,...l}=e,j=g||l||{},E=u||c||{},p=v({description:"External component",...j,type:"object"},o),_=y(E,p.properties||{});return{component:t,name:r,schema:p,uiSchema:_,thumbnail:n,group:s,isHidden:a,id:i,title:p?.title||l?.title||r}}var x,m=typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{},D=m.BYOCWebComponent||(m.BYOCWebComponent=typeof HTMLElement<"u"?HTMLElement:typeof windowJSDOM<"u"?windowJSDOM.HTMLElement:class{setAttribute(){}}),b=m.BYOCComponents||(m.BYOCComponents={});function J(e,t,o={}){if(!t?.name)throw new Error("Could not register external component. Please make sure you provide a name in the options"+JSON.stringify(t));let n=B(t,e,o);b[n.id]=n,K(e)&&h.register("byoc-"+d(t.name),void 0,e),O()}function K(e){return e&&"prototype"in e&&"setAttribute"in e.prototype}function I(e,t={}){var o;let n=(o=S(e))===null||o===void 0?void 0:o.schema;return n?w(n,t):t}function N(e){let t=S(e);return Object.keys(t?.schema.properties||{}).filter(o=>{var n,r;return((r=(n=t?.uiSchema)===null||n===void 0?void 0:n[o])===null||r===void 0?void 0:r["ui:widget"])!="hidden"})}function S(e){if(typeof e!="string"){if(e&&"schema"in e)return e;throw new Error(`Component name should be a string, got ${typeof e}`)}let[t,o]=e.split("?");var n=b[t];if(o){let r=b[e];if(!r&&!n)return null;r&&(n={...n,...r,component:r.component||n?.component}),o.split(/\&/g).forEach(i=>{var s,c,a;let[u,g]=i.split("="),l=((s=n.schema.properties)===null||s===void 0?void 0:s[u])||{type:"string"};n={...n,schema:{...n.schema,properties:{...n.schema.properties,[u]:{...l,default:C(decodeURIComponent(g),l.type)}}},uiSchema:{...n.uiSchema,[u]:{...n.uiSchema[u],"ui:widget":(a=(c=n.uiSchema[u])===null||c===void 0?void 0:c["ui:widget"])!==null&&a!==void 0?a:"hidden"}}}})}return n}function O(){clearTimeout(x),x=setTimeout(()=>{var e;typeof window<"u"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(b)}),"*"))},30)}O();var h=class extends D{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{J(null,t)})}catch{}}static register(t,o,n=this){o==null&&(o=typeof window<"u"?window:void 0),o&&!o.customElements.get(t)&&o.customElements.define(t,n)}};h.register("byoc-registration");export{h as BYOCRegistration,D as WebComponent,S as getComponent,N as getComponentConfigurablePropertyNames,I as getComponentProperties,P as getSchemaDefaults,w as getSchemaProperties,K as isWebComponent,B as normalizeOptions,L as objectKeysToCamelCase,T as objectKeysToKebabCase,A as parseSchemaProperties,C as parseValue,J as registerComponent,b as registered,O as setRegistrationCallback,f as toCamelCase,d as toKebabCase,v as transformSchema,y as transformUiSchema}; | ||
var T=(e={})=>Object.keys(e).reduce((t,o)=>Object.assign(t,{[m(o)]:e[o]}),{}),L=(e={})=>Object.keys(e).reduce((t,o)=>Object.assign(t,{[f(o)]:e[o]}),{});function m(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return f(e).replace(t,function(o){return"-"+o.toLowerCase()})}function f(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,o)=>o===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function v(e,t={}){let o=e.properties||{};return{type:"object",...e,properties:Object.keys(o).reduce((n,r)=>Object.assign(n,{[r]:{...o[r],default:t.hasOwnProperty(r)?t[r]:o[r].default,title:o[r].title||m(r).split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(" ")}}),{})}}var y=(e,t)=>{let o={...e};return Object.keys(t).filter(r=>/(integer|number)/.test(t[r].type)).forEach(r=>{var i;!((i=o[r])===null||i===void 0)&&i["ui:widget"]||(o[r]={...o[r],"ui:widget":"updown"})}),o};function C(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch{return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch{return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function A(e,t){return Object.keys(t).reduce((o,n)=>{let r=t[n],i=f(n),s=e?.properties[i],c=s?.type,a=C(r,c);return a!=null&&!n.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(n)?{...o,[i]:a}:o},{})}function w(e,t){return{...B(e),...A(e,t)}}function B(e){return Object.keys(e.properties).reduce((t,o)=>{var n,r;return((n=e.properties[o])===null||n===void 0?void 0:n.default)!=null?{...t,[o]:(r=e.properties[o])===null||r===void 0?void 0:r.default}:t},{})}function P(e,t,o){let{thumbnail:n="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:r,id:i=e.name,group:s=null,ui:c,isHidden:a=!1,uiSchema:u,schema:g,...l}=e,j=g||l||{},E=u||c||{},d=v({description:"External component",...j,type:"object"},o),_=y(E,d.properties||{});return{component:t,name:r,schema:d,uiSchema:_,thumbnail:n,group:s,isHidden:a,id:i,title:d?.title||l?.title||r}}var x,p=typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{},D=p.BYOCWebComponent||(p.BYOCWebComponent=typeof HTMLElement<"u"?HTMLElement:typeof windowJSDOM<"u"?windowJSDOM.HTMLElement:class{setAttribute(){}}),b=p.BYOCComponentsFrozen?{}:p.BYOCComponents||(p.BYOCComponents={}),z=()=>{p.BYOCComponentsFrozen=!0};function J(e,t,o={}){if(!t?.name)throw new Error("Could not register external component. Please make sure you provide a name in the options"+JSON.stringify(t));let n=P(t,e,o);b[n.id]=n,K(e)&&h.register("byoc-"+m(t.name),void 0,e),S()}function K(e){return e&&"prototype"in e&&"setAttribute"in e.prototype}function H(e,t={}){var o;let n=(o=O(e))===null||o===void 0?void 0:o.schema;return n?w(n,t):t}function F(e){let t=O(e);return Object.keys(t?.schema.properties||{}).filter(o=>{var n,r;return((r=(n=t?.uiSchema)===null||n===void 0?void 0:n[o])===null||r===void 0?void 0:r["ui:widget"])!="hidden"})}function O(e){if(typeof e!="string"){if(e&&"schema"in e)return e;throw new Error(`Component name should be a string, got ${typeof e}`)}let[t,o]=e.split("?");var n=b[t];if(o){let r=b[e];if(!r&&!n)return null;r&&(n={...n,...r,component:r.component||n?.component}),o.split(/\&/g).forEach(i=>{var s,c,a;let[u,g]=i.split("="),l=((s=n.schema.properties)===null||s===void 0?void 0:s[u])||{type:"string"};n={...n,schema:{...n.schema,properties:{...n.schema.properties,[u]:{...l,default:C(decodeURIComponent(g),l.type)}}},uiSchema:{...n.uiSchema,[u]:{...n.uiSchema[u],"ui:widget":(a=(c=n.uiSchema[u])===null||c===void 0?void 0:c["ui:widget"])!==null&&a!==void 0?a:"hidden"}}}})}return n}function S(){clearTimeout(x),x=setTimeout(()=>{var e;typeof window<"u"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(b)}),"*"))},30)}S();var h=class extends D{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{J(null,t)})}catch{}}static register(t,o,n=this){o==null&&(o=typeof window<"u"?window:void 0),o&&!o.customElements.get(t)&&o.customElements.define(t,n)}};h.register("byoc-registration");export{h as BYOCRegistration,D as WebComponent,O as getComponent,F as getComponentConfigurablePropertyNames,H as getComponentProperties,B as getSchemaDefaults,w as getSchemaProperties,K as isWebComponent,P as normalizeOptions,L as objectKeysToCamelCase,T as objectKeysToKebabCase,A as parseSchemaProperties,C as parseValue,z as preventGlobalVariableReuse,J as registerComponent,b as registered,S as setRegistrationCallback,f as toCamelCase,m as toKebabCase,v as transformSchema,y as transformUiSchema}; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -1,2 +0,2 @@ | ||
import a from"react";var v=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[d(n)]:e[n]}),{}),R=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[g(n)]:e[n]}),{});function d(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return g(e).replace(t,function(n){return"-"+n.toLowerCase()})}function g(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,n)=>n===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function j(e,t={}){let n=e.properties||{};return{type:"object",...e,properties:Object.keys(n).reduce((r,o)=>Object.assign(r,{[o]:{...n[o],default:t.hasOwnProperty(o)?t[o]:n[o].default,title:n[o].title||d(o).split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(" ")}}),{})}}var _=(e,t)=>{let n={...e};return Object.keys(t).filter(o=>/(integer|number)/.test(t[o].type)).forEach(o=>{var i;!((i=n[o])===null||i===void 0)&&i["ui:widget"]||(n[o]={...n[o],"ui:widget":"updown"})}),n};function x(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch{return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch{return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function B(e,t){return Object.keys(t).reduce((n,r)=>{let o=t[r],i=g(r),s=e?.properties[i],c=s?.type,l=x(o,c);return l!=null&&!r.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(r)?{...n,[i]:l}:n},{})}function N(e,t){return{...J(e),...B(e,t)}}function J(e){return Object.keys(e.properties).reduce((t,n)=>{var r,o;return((r=e.properties[n])===null||r===void 0?void 0:r.default)!=null?{...t,[n]:(o=e.properties[n])===null||o===void 0?void 0:o.default}:t},{})}function k(e,t,n){let{thumbnail:r="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:o,id:i=e.name,group:s=null,ui:c,isHidden:l=!1,uiSchema:u,schema:y,...p}=e,D=y||p||{},H=u||c||{},f=j({description:"External component",...D,type:"object"},n),T=_(H,f.properties||{});return{component:t,name:o,schema:f,uiSchema:T,thumbnail:r,group:s,isHidden:l,id:i,title:f?.title||p?.title||o}}var P,h=typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{},M=h.BYOCWebComponent||(h.BYOCWebComponent=typeof HTMLElement<"u"?HTMLElement:typeof windowJSDOM<"u"?windowJSDOM.HTMLElement:class{setAttribute(){}}),m=h.BYOCComponents||(h.BYOCComponents={});function L(e,t,n={}){if(!t?.name)throw new Error("Could not register external component. Please make sure you provide a name in the options"+JSON.stringify(t));let r=k(t,e,n);m[r.id]=r,w(e)&&C.register("byoc-"+d(t.name),void 0,e),A()}function w(e){return e&&"prototype"in e&&"setAttribute"in e.prototype}function W(e,t={}){var n;let r=(n=b(e))===null||n===void 0?void 0:n.schema;return r?N(r,t):t}function q(e){let t=b(e);return Object.keys(t?.schema.properties||{}).filter(n=>{var r,o;return((o=(r=t?.uiSchema)===null||r===void 0?void 0:r[n])===null||o===void 0?void 0:o["ui:widget"])!="hidden"})}function b(e){if(typeof e!="string"){if(e&&"schema"in e)return e;throw new Error(`Component name should be a string, got ${typeof e}`)}let[t,n]=e.split("?");var r=m[t];if(n){let o=m[e];if(!o&&!r)return null;o&&(r={...r,...o,component:o.component||r?.component}),n.split(/\&/g).forEach(i=>{var s,c,l;let[u,y]=i.split("="),p=((s=r.schema.properties)===null||s===void 0?void 0:s[u])||{type:"string"};r={...r,schema:{...r.schema,properties:{...r.schema.properties,[u]:{...p,default:x(decodeURIComponent(y),p.type)}}},uiSchema:{...r.uiSchema,[u]:{...r.uiSchema[u],"ui:widget":(l=(c=r.uiSchema[u])===null||c===void 0?void 0:c["ui:widget"])!==null&&l!==void 0?l:"hidden"}}}})}return r}function A(){clearTimeout(P),P=setTimeout(()=>{var e;typeof window<"u"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(m)}),"*"))},30)}A();var C=class extends M{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{L(null,t)})}catch{}}static register(t,n,r=this){n==null&&(n=typeof window<"u"?window:void 0),n&&!n.customElements.get(t)&&n.customElements.define(t,r)}};C.register("byoc-registration");var O=new Map,S=null,E=null;function U(e){var t;let{componentName:n,...r}=e,o=(t=b(n))===null||t===void 0?void 0:t.component;if(!O.get(n)){let s=E(()=>Promise.resolve(S),{ssr:!1,loading:()=>a.createElement(K,{...r,componentName:n})});O.set(n,s)}let i=O.get(n);return a.createElement(i,{...e,fallback:o?a.createElement(o,{...e}):null})}function oe(e,t){return E=e,S=t,t}function ie(e){if(Object.keys(e).length!=0)return E?U(e):K(e)}function se(){return a.createElement(a.Fragment,null,a.createElement("byoc-registration",{components:JSON.stringify(Object.values(m)),suppressHydrationWarning:!0}),a.createElement(S,null))}function K(e){let{componentName:t,fallback:n,...r}=e,o=b(t),i=o?.component;if(!i&&n||!t)return a.createElement("feaas-external",{"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},n);let s=W(t,r);delete s.suppressHydrationWarning;var c=null;return i&&w(i)?a.createElement("byoc-"+d(o.id),{...v(s),suppressHydrationWarning:!0}):a.createElement(a.Fragment,null,a.createElement("feaas-external",{...v(s),"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},i==null?null:a.createElement(i,{...s})))}export{C as BYOCRegistration,se as Bundle,ie as Component,U as NextComponent,K as RegularComponent,M as WebComponent,oe as enableNextClientsideComponents,b as getComponent,q as getComponentConfigurablePropertyNames,W as getComponentProperties,J as getSchemaDefaults,N as getSchemaProperties,w as isWebComponent,k as normalizeOptions,R as objectKeysToCamelCase,v as objectKeysToKebabCase,B as parseSchemaProperties,x as parseValue,L as registerComponent,m as registered,A as setRegistrationCallback,g as toCamelCase,d as toKebabCase,j as transformSchema,_ as transformUiSchema}; | ||
import a from"react";var v=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[d(n)]:e[n]}),{}),U=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[C(n)]:e[n]}),{});function d(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return C(e).replace(t,function(n){return"-"+n.toLowerCase()})}function C(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,n)=>n===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function j(e,t={}){let n=e.properties||{};return{type:"object",...e,properties:Object.keys(n).reduce((r,o)=>Object.assign(r,{[o]:{...n[o],default:t.hasOwnProperty(o)?t[o]:n[o].default,title:n[o].title||d(o).split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(" ")}}),{})}}var _=(e,t)=>{let n={...e};return Object.keys(t).filter(o=>/(integer|number)/.test(t[o].type)).forEach(o=>{var i;!((i=n[o])===null||i===void 0)&&i["ui:widget"]||(n[o]={...n[o],"ui:widget":"updown"})}),n};function x(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch{return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch{return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function J(e,t){return Object.keys(t).reduce((n,r)=>{let o=t[r],i=C(r),s=e?.properties[i],c=s?.type,l=x(o,c);return l!=null&&!r.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(r)?{...n,[i]:l}:n},{})}function N(e,t){return{...k(e),...J(e,t)}}function k(e){return Object.keys(e.properties).reduce((t,n)=>{var r,o;return((r=e.properties[n])===null||r===void 0?void 0:r.default)!=null?{...t,[n]:(o=e.properties[n])===null||o===void 0?void 0:o.default}:t},{})}function M(e,t,n){let{thumbnail:r="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:o,id:i=e.name,group:s=null,ui:c,isHidden:l=!1,uiSchema:u,schema:y,...p}=e,D=y||p||{},H=u||c||{},b=j({description:"External component",...D,type:"object"},n),T=_(H,b.properties||{});return{component:t,name:o,schema:b,uiSchema:T,thumbnail:r,group:s,isHidden:l,id:i,title:b?.title||p?.title||o}}var P,m=typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{},R=m.BYOCWebComponent||(m.BYOCWebComponent=typeof HTMLElement<"u"?HTMLElement:typeof windowJSDOM<"u"?windowJSDOM.HTMLElement:class{setAttribute(){}}),f=m.BYOCComponentsFrozen?{}:m.BYOCComponents||(m.BYOCComponents={}),W=()=>{m.BYOCComponentsFrozen=!0};function F(e,t,n={}){if(!t?.name)throw new Error("Could not register external component. Please make sure you provide a name in the options"+JSON.stringify(t));let r=M(t,e,n);f[r.id]=r,w(e)&&h.register("byoc-"+d(t.name),void 0,e),B()}function w(e){return e&&"prototype"in e&&"setAttribute"in e.prototype}function A(e,t={}){var n;let r=(n=g(e))===null||n===void 0?void 0:n.schema;return r?N(r,t):t}function q(e){let t=g(e);return Object.keys(t?.schema.properties||{}).filter(n=>{var r,o;return((o=(r=t?.uiSchema)===null||r===void 0?void 0:r[n])===null||o===void 0?void 0:o["ui:widget"])!="hidden"})}function g(e){if(typeof e!="string"){if(e&&"schema"in e)return e;throw new Error(`Component name should be a string, got ${typeof e}`)}let[t,n]=e.split("?");var r=f[t];if(n){let o=f[e];if(!o&&!r)return null;o&&(r={...r,...o,component:o.component||r?.component}),n.split(/\&/g).forEach(i=>{var s,c,l;let[u,y]=i.split("="),p=((s=r.schema.properties)===null||s===void 0?void 0:s[u])||{type:"string"};r={...r,schema:{...r.schema,properties:{...r.schema.properties,[u]:{...p,default:x(decodeURIComponent(y),p.type)}}},uiSchema:{...r.uiSchema,[u]:{...r.uiSchema[u],"ui:widget":(l=(c=r.uiSchema[u])===null||c===void 0?void 0:c["ui:widget"])!==null&&l!==void 0?l:"hidden"}}}})}return r}function B(){clearTimeout(P),P=setTimeout(()=>{var e;typeof window<"u"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(f)}),"*"))},30)}B();var h=class extends R{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{F(null,t)})}catch{}}static register(t,n,r=this){n==null&&(n=typeof window<"u"?window:void 0),n&&!n.customElements.get(t)&&n.customElements.define(t,r)}};h.register("byoc-registration");var O=new Map,S=null,E=null;function L(e){var t;let{componentName:n,...r}=e,o=(t=g(n))===null||t===void 0?void 0:t.component;if(!O.get(n)){let s=E(()=>Promise.resolve(S),{ssr:!1,loading:()=>a.createElement(K,{...r,componentName:n})});O.set(n,s)}let i=O.get(n);return a.createElement(i,{...e,fallback:o?a.createElement(o,{...e}):null})}function ie(e,t){return E=e,S=t,t}function se(e){if(Object.keys(e).length!=0)return E?L(e):K(e)}function ae(){return W(),a.createElement(a.Fragment,null,a.createElement("byoc-registration",{components:JSON.stringify(Object.values(f)),suppressHydrationWarning:!0}),a.createElement(S,null))}function K(e){let{componentName:t,fallback:n,...r}=e,o=g(t),i=o?.component;if(!i&&n||!t)return a.createElement("feaas-external",{"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},n);let s=A(t,r);delete s.suppressHydrationWarning;var c=null;return i&&w(i)?a.createElement("byoc-"+d(o.id),{...v(s),suppressHydrationWarning:!0}):a.createElement(a.Fragment,null,a.createElement("feaas-external",{...v(s),"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},i==null?null:a.createElement(i,{...s})))}export{h as BYOCRegistration,ae as Bundle,se as Component,L as NextComponent,K as RegularComponent,R as WebComponent,ie as enableNextClientsideComponents,g as getComponent,q as getComponentConfigurablePropertyNames,A as getComponentProperties,k as getSchemaDefaults,N as getSchemaProperties,w as isWebComponent,M as normalizeOptions,U as objectKeysToCamelCase,v as objectKeysToKebabCase,J as parseSchemaProperties,x as parseValue,W as preventGlobalVariableReuse,F as registerComponent,f as registered,B as setRegistrationCallback,C as toCamelCase,d as toKebabCase,j as transformSchema,_ as transformUiSchema}; | ||
//# sourceMappingURL=react.esm.js.map |
@@ -5,3 +5,3 @@ { | ||
"description": "Bring-Your-Own-Components runtime to register and retrieve react components", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"scripts": { | ||
@@ -8,0 +8,0 @@ "test": "npx vitest", |
@@ -1,2 +0,2 @@ | ||
"use strict";var I=Object.create;var C=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var V=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var G=(e,t)=>{for(var n in t)C(e,n,{get:t[n],enumerable:!0})},D=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of z(t))!q.call(e,o)&&o!==n&&C(e,o,{get:()=>t[o],enumerable:!(r=Y(t,o))||r.enumerable});return e};var X=(e,t,n)=>(n=e!=null?I(V(e)):{},D(t||!e||!e.__esModule?C(n,"default",{value:e,enumerable:!0}):n,e)),Z=e=>D(C({},"__esModule",{value:!0}),e);var re={};G(re,{BYOCRegistration:()=>h,Bundle:()=>ne,Component:()=>te,NextComponent:()=>L,RegularComponent:()=>K,WebComponent:()=>k,enableNextClientsideComponents:()=>ee,getComponent:()=>f,getComponentConfigurablePropertyNames:()=>Q,getComponentProperties:()=>_,getSchemaDefaults:()=>T,getSchemaProperties:()=>j,isWebComponent:()=>w,normalizeOptions:()=>J,objectKeysToCamelCase:()=>$,objectKeysToKebabCase:()=>y,parseSchemaProperties:()=>H,parseValue:()=>v,registerComponent:()=>M,registered:()=>m,setRegistrationCallback:()=>N,toCamelCase:()=>g,toKebabCase:()=>u,transformSchema:()=>S,transformUiSchema:()=>E});module.exports=Z(re);var a=X(require("react"),1);var y=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[u(n)]:e[n]}),{}),$=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[g(n)]:e[n]}),{});function u(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return g(e).replace(t,function(n){return"-"+n.toLowerCase()})}function g(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,n)=>n===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function S(e,t={}){let n=e.properties||{};return{type:"object",...e,properties:Object.keys(n).reduce((r,o)=>Object.assign(r,{[o]:{...n[o],default:t.hasOwnProperty(o)?t[o]:n[o].default,title:n[o].title||u(o).split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(" ")}}),{})}}var E=(e,t)=>{let n={...e};return Object.keys(t).filter(o=>/(integer|number)/.test(t[o].type)).forEach(o=>{var i;!((i=n[o])===null||i===void 0)&&i["ui:widget"]||(n[o]={...n[o],"ui:widget":"updown"})}),n};function v(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch{return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch{return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function H(e,t){return Object.keys(t).reduce((n,r)=>{let o=t[r],i=g(r),s=e?.properties[i],c=s?.type,l=v(o,c);return l!=null&&!r.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(r)?{...n,[i]:l}:n},{})}function j(e,t){return{...T(e),...H(e,t)}}function T(e){return Object.keys(e.properties).reduce((t,n)=>{var r,o;return((r=e.properties[n])===null||r===void 0?void 0:r.default)!=null?{...t,[n]:(o=e.properties[n])===null||o===void 0?void 0:o.default}:t},{})}function J(e,t,n){let{thumbnail:r="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:o,id:i=e.name,group:s=null,ui:c,isHidden:l=!1,uiSchema:p,schema:O,...d}=e,U=O||d||{},R=p||c||{},b=S({description:"External component",...U,type:"object"},n),F=E(R,b.properties||{});return{component:t,name:o,schema:b,uiSchema:F,thumbnail:r,group:s,isHidden:l,id:i,title:b?.title||d?.title||o}}var B,x=typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{},k=x.BYOCWebComponent||(x.BYOCWebComponent=typeof HTMLElement<"u"?HTMLElement:typeof windowJSDOM<"u"?windowJSDOM.HTMLElement:class{setAttribute(){}}),m=x.BYOCComponents||(x.BYOCComponents={});function M(e,t,n={}){if(!t?.name)throw new Error("Could not register external component. Please make sure you provide a name in the options"+JSON.stringify(t));let r=J(t,e,n);m[r.id]=r,w(e)&&h.register("byoc-"+u(t.name),void 0,e),N()}function w(e){return e&&"prototype"in e&&"setAttribute"in e.prototype}function _(e,t={}){var n;let r=(n=f(e))===null||n===void 0?void 0:n.schema;return r?j(r,t):t}function Q(e){let t=f(e);return Object.keys(t?.schema.properties||{}).filter(n=>{var r,o;return((o=(r=t?.uiSchema)===null||r===void 0?void 0:r[n])===null||o===void 0?void 0:o["ui:widget"])!="hidden"})}function f(e){if(typeof e!="string"){if(e&&"schema"in e)return e;throw new Error(`Component name should be a string, got ${typeof e}`)}let[t,n]=e.split("?");var r=m[t];if(n){let o=m[e];if(!o&&!r)return null;o&&(r={...r,...o,component:o.component||r?.component}),n.split(/\&/g).forEach(i=>{var s,c,l;let[p,O]=i.split("="),d=((s=r.schema.properties)===null||s===void 0?void 0:s[p])||{type:"string"};r={...r,schema:{...r.schema,properties:{...r.schema.properties,[p]:{...d,default:v(decodeURIComponent(O),d.type)}}},uiSchema:{...r.uiSchema,[p]:{...r.uiSchema[p],"ui:widget":(l=(c=r.uiSchema[p])===null||c===void 0?void 0:c["ui:widget"])!==null&&l!==void 0?l:"hidden"}}}})}return r}function N(){clearTimeout(B),B=setTimeout(()=>{var e;typeof window<"u"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(m)}),"*"))},30)}N();var h=class extends k{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{M(null,t)})}catch{}}static register(t,n,r=this){n==null&&(n=typeof window<"u"?window:void 0),n&&!n.customElements.get(t)&&n.customElements.define(t,r)}};h.register("byoc-registration");var P=new Map,W=null,A=null;function L(e){var t;let{componentName:n,...r}=e,o=(t=f(n))===null||t===void 0?void 0:t.component;if(!P.get(n)){let s=A(()=>Promise.resolve(W),{ssr:!1,loading:()=>a.default.createElement(K,{...r,componentName:n})});P.set(n,s)}let i=P.get(n);return a.default.createElement(i,{...e,fallback:o?a.default.createElement(o,{...e}):null})}function ee(e,t){return A=e,W=t,t}function te(e){if(Object.keys(e).length!=0)return A?L(e):K(e)}function ne(){return a.default.createElement(a.default.Fragment,null,a.default.createElement("byoc-registration",{components:JSON.stringify(Object.values(m)),suppressHydrationWarning:!0}),a.default.createElement(W,null))}function K(e){let{componentName:t,fallback:n,...r}=e,o=f(t),i=o?.component;if(!i&&n||!t)return a.default.createElement("feaas-external",{"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},n);let s=_(t,r);delete s.suppressHydrationWarning;var c=null;return i&&w(i)?a.default.createElement("byoc-"+u(o.id),{...y(s),suppressHydrationWarning:!0}):a.default.createElement(a.default.Fragment,null,a.default.createElement("feaas-external",{...y(s),"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},i==null?null:a.default.createElement(i,{...s})))} | ||
"use strict";var z=Object.create;var y=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var X=(e,t)=>{for(var n in t)y(e,n,{get:t[n],enumerable:!0})},D=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of G(t))!q.call(e,o)&&o!==n&&y(e,o,{get:()=>t[o],enumerable:!(r=V(t,o))||r.enumerable});return e};var Z=(e,t,n)=>(n=e!=null?z(I(e)):{},D(t||!e||!e.__esModule?y(n,"default",{value:e,enumerable:!0}):n,e)),$=e=>D(y({},"__esModule",{value:!0}),e);var oe={};X(oe,{BYOCRegistration:()=>h,Bundle:()=>re,Component:()=>ne,NextComponent:()=>F,RegularComponent:()=>K,WebComponent:()=>M,enableNextClientsideComponents:()=>te,getComponent:()=>b,getComponentConfigurablePropertyNames:()=>ee,getComponentProperties:()=>N,getSchemaDefaults:()=>T,getSchemaProperties:()=>j,isWebComponent:()=>w,normalizeOptions:()=>k,objectKeysToCamelCase:()=>Q,objectKeysToKebabCase:()=>v,parseSchemaProperties:()=>H,parseValue:()=>x,preventGlobalVariableReuse:()=>_,registerComponent:()=>R,registered:()=>m,setRegistrationCallback:()=>P,toCamelCase:()=>C,toKebabCase:()=>u,transformSchema:()=>S,transformUiSchema:()=>E});module.exports=$(oe);var a=Z(require("react"),1);var v=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[u(n)]:e[n]}),{}),Q=(e={})=>Object.keys(e).reduce((t,n)=>Object.assign(t,{[C(n)]:e[n]}),{});function u(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return C(e).replace(t,function(n){return"-"+n.toLowerCase()})}function C(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,n)=>n===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function S(e,t={}){let n=e.properties||{};return{type:"object",...e,properties:Object.keys(n).reduce((r,o)=>Object.assign(r,{[o]:{...n[o],default:t.hasOwnProperty(o)?t[o]:n[o].default,title:n[o].title||u(o).split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()).join(" ")}}),{})}}var E=(e,t)=>{let n={...e};return Object.keys(t).filter(o=>/(integer|number)/.test(t[o].type)).forEach(o=>{var i;!((i=n[o])===null||i===void 0)&&i["ui:widget"]||(n[o]={...n[o],"ui:widget":"updown"})}),n};function x(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch{return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch{return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function H(e,t){return Object.keys(t).reduce((n,r)=>{let o=t[r],i=C(r),s=e?.properties[i],c=s?.type,l=x(o,c);return l!=null&&!r.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(r)?{...n,[i]:l}:n},{})}function j(e,t){return{...T(e),...H(e,t)}}function T(e){return Object.keys(e.properties).reduce((t,n)=>{var r,o;return((r=e.properties[n])===null||r===void 0?void 0:r.default)!=null?{...t,[n]:(o=e.properties[n])===null||o===void 0?void 0:o.default}:t},{})}function k(e,t,n){let{thumbnail:r="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:o,id:i=e.name,group:s=null,ui:c,isHidden:l=!1,uiSchema:p,schema:O,...d}=e,L=O||d||{},U=p||c||{},g=S({description:"External component",...L,type:"object"},n),Y=E(U,g.properties||{});return{component:t,name:o,schema:g,uiSchema:Y,thumbnail:r,group:s,isHidden:l,id:i,title:g?.title||d?.title||o}}var J,f=typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{},M=f.BYOCWebComponent||(f.BYOCWebComponent=typeof HTMLElement<"u"?HTMLElement:typeof windowJSDOM<"u"?windowJSDOM.HTMLElement:class{setAttribute(){}}),m=f.BYOCComponentsFrozen?{}:f.BYOCComponents||(f.BYOCComponents={}),_=()=>{f.BYOCComponentsFrozen=!0};function R(e,t,n={}){if(!t?.name)throw new Error("Could not register external component. Please make sure you provide a name in the options"+JSON.stringify(t));let r=k(t,e,n);m[r.id]=r,w(e)&&h.register("byoc-"+u(t.name),void 0,e),P()}function w(e){return e&&"prototype"in e&&"setAttribute"in e.prototype}function N(e,t={}){var n;let r=(n=b(e))===null||n===void 0?void 0:n.schema;return r?j(r,t):t}function ee(e){let t=b(e);return Object.keys(t?.schema.properties||{}).filter(n=>{var r,o;return((o=(r=t?.uiSchema)===null||r===void 0?void 0:r[n])===null||o===void 0?void 0:o["ui:widget"])!="hidden"})}function b(e){if(typeof e!="string"){if(e&&"schema"in e)return e;throw new Error(`Component name should be a string, got ${typeof e}`)}let[t,n]=e.split("?");var r=m[t];if(n){let o=m[e];if(!o&&!r)return null;o&&(r={...r,...o,component:o.component||r?.component}),n.split(/\&/g).forEach(i=>{var s,c,l;let[p,O]=i.split("="),d=((s=r.schema.properties)===null||s===void 0?void 0:s[p])||{type:"string"};r={...r,schema:{...r.schema,properties:{...r.schema.properties,[p]:{...d,default:x(decodeURIComponent(O),d.type)}}},uiSchema:{...r.uiSchema,[p]:{...r.uiSchema[p],"ui:widget":(l=(c=r.uiSchema[p])===null||c===void 0?void 0:c["ui:widget"])!==null&&l!==void 0?l:"hidden"}}}})}return r}function P(){clearTimeout(J),J=setTimeout(()=>{var e;typeof window<"u"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(m)}),"*"))},30)}P();var h=class extends M{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{R(null,t)})}catch{}}static register(t,n,r=this){n==null&&(n=typeof window<"u"?window:void 0),n&&!n.customElements.get(t)&&n.customElements.define(t,r)}};h.register("byoc-registration");var W=new Map,A=null,B=null;function F(e){var t;let{componentName:n,...r}=e,o=(t=b(n))===null||t===void 0?void 0:t.component;if(!W.get(n)){let s=B(()=>Promise.resolve(A),{ssr:!1,loading:()=>a.default.createElement(K,{...r,componentName:n})});W.set(n,s)}let i=W.get(n);return a.default.createElement(i,{...e,fallback:o?a.default.createElement(o,{...e}):null})}function te(e,t){return B=e,A=t,t}function ne(e){if(Object.keys(e).length!=0)return B?F(e):K(e)}function re(){return _(),a.default.createElement(a.default.Fragment,null,a.default.createElement("byoc-registration",{components:JSON.stringify(Object.values(m)),suppressHydrationWarning:!0}),a.default.createElement(A,null))}function K(e){let{componentName:t,fallback:n,...r}=e,o=b(t),i=o?.component;if(!i&&n||!t)return a.default.createElement("feaas-external",{"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},n);let s=N(t,r);delete s.suppressHydrationWarning;var c=null;return i&&w(i)?a.default.createElement("byoc-"+u(o.id),{...v(s),suppressHydrationWarning:!0}):a.default.createElement(a.default.Fragment,null,a.default.createElement("feaas-external",{...v(s),"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},i==null?null:a.default.createElement(i,{...s})))} | ||
//# sourceMappingURL=react.js.map |
@@ -177,3 +177,6 @@ import { | ||
// Store registered components in a global variable BYOCComponents | ||
export const registered: Record<string, ExternalComponent> = (globalScope.BYOCComponents ||= {}) | ||
export const registered: Record<string, ExternalComponent> = (globalScope.BYOCComponentsFrozen ? {} : (globalScope.BYOCComponents ||= {})) | ||
// Once this method is called, BYOCComponents variable will not be available for reuse. This prevents Next.js to pollute | ||
// server componetn list with clientside components | ||
export const preventGlobalVariableReuse = () => {globalScope.BYOCComponentsFrozen = true} | ||
@@ -385,4 +388,5 @@ /** | ||
BYOCComponents: RegisteredComponents | ||
BYOCComponentsFrozen: boolean | ||
BYOCWebComponent: typeof HTMLElement | ||
} | ||
} |
@@ -101,2 +101,3 @@ /// <reference types="@types/react" /> | ||
export declare const registered: Record<string, ExternalComponent>; | ||
export declare const preventGlobalVariableReuse: () => void; | ||
/** | ||
@@ -200,2 +201,3 @@ * Register React component to be renderable as Sitecore component (in Components and Pages). Properties are defined as | ||
BYOCComponents: RegisteredComponents; | ||
BYOCComponentsFrozen: boolean; | ||
BYOCWebComponent: typeof HTMLElement; | ||
@@ -202,0 +204,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
534947
1455