@sitecore/byoc
Advanced tools
Comparing version 0.1.11-alpha.2 to 0.1.11-alpha.3
@@ -198,2 +198,3 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
// Register schemas passed as <byoc-registration components=... /> | ||
// It extends the web component in case it already was registered by different name | ||
export class BYOCRegistration extends WebComponent { | ||
@@ -213,3 +214,4 @@ connectedCallback() { | ||
if (win && !win.customElements.get(tagName)) { | ||
win.customElements.define(tagName, component); | ||
win.customElements.define(tagName, class extends component { | ||
}); | ||
} | ||
@@ -216,0 +218,0 @@ } |
@@ -101,2 +101,5 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
} | ||
if (key == 'sdk') { | ||
delete componentProperties[key]; | ||
} | ||
}); | ||
@@ -103,0 +106,0 @@ if ((!Component && fallback) || !componentName) |
@@ -1,2 +0,2 @@ | ||
var M=(e={})=>Object.keys(e).reduce((t,r)=>Object.assign(t,{[d(r)]:e[r]}),{}),U=(e={})=>Object.keys(e).reduce((t,r)=>Object.assign(t,{[b(r)]:e[r]}),{});function d(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return b(e).replace(t,function(r){return"-"+r.toLowerCase()})}function b(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,r)=>r===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function h(e,t={}){let r=e.properties||{};return Object.assign(Object.assign({type:"object"},e),{properties:Object.keys(r).reduce((n,o)=>Object.assign(n,{[o]:Object.assign(Object.assign({},r[o]),{default:t.hasOwnProperty(o)?t[o]:r[o].default,title:r[o].title||d(o).split("-").map(s=>s.charAt(0).toUpperCase()+s.slice(1).toLowerCase()).join(" ")})}),{})})}var j=(e,t)=>{let r=Object.assign({},e);return Object.keys(t).filter(o=>/(integer|number)/.test(t[o].type)).forEach(o=>{var s;!((s=r[o])===null||s===void 0)&&s["ui:widget"]||(r[o]=Object.assign(Object.assign({},r[o]),{"ui:widget":"updown"}))}),r};function O(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch(r){return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch(r){return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function P(e,t){return Object.keys(t).reduce((r,n)=>{let o=t[n],s=b(n),i=e==null?void 0:e.properties[s],c=i==null?void 0:i.type,a=O(o,c);return a!=null&&!n.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(n)?Object.assign(Object.assign({},r),{[s]:a}):r},{})}function v(e,t){return Object.assign(Object.assign({},A(e)),P(e,t))}function A(e){return Object.keys(e.properties).reduce((t,r)=>{var n,o;return((n=e.properties[r])===null||n===void 0?void 0:n.default)!=null?Object.assign(Object.assign({},t),{[r]:(o=e.properties[r])===null||o===void 0?void 0:o.default}):t},{})}var D=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};function J(e,t,r){let{thumbnail:n="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:o,id:s=e.name,group:i=null,ui:c,isHidden:a=!1,uiSchema:u,schema:g}=e,l=D(e,["thumbnail","name","id","group","ui","isHidden","uiSchema","schema"]),S=g||l||{},E=u||c||{},p=h(Object.assign(Object.assign({description:"External component"},S),{type:"object"}),r),_=j(E,p.properties||{});return{component:t,name:o,schema:p,uiSchema:_,thumbnail:n,group:i,isHidden:a,id:s,title:(p==null?void 0:p.title)||(l==null?void 0:l.title)||o}}var y,K=typeof HTMLElement!="undefined"?HTMLElement:typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{setAttribute(){}},f=typeof window!="undefined"?window.BYOCComponents||(window.BYOCComponents={}):{};function T(e,t,r={}){if(!(t!=null&&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=J(t,e,r);f[n.id]=n,L(e)&&m.register("byoc-"+d(t.name),void 0,e),x()}function L(e){return e&&"prototype"in e&&"setAttribute"in e.prototype}function W(e,t={}){var r;let n=(r=w(e))===null||r===void 0?void 0:r.schema,o=Object.assign(Object.assign({},C),t);return n?v(n,o):o}function z(e){let t=w(e);return Object.keys((t==null?void 0:t.schema.properties)||{}).filter(r=>{var n,o;return((o=(n=t==null?void 0:t.uiSchema)===null||n===void 0?void 0:n[r])===null||o===void 0?void 0:o["ui:widget"])!="hidden"})}function w(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,r]=e.split("?");var n=f[t];if(r){let o=f[e];if(!o&&!n)return null;o&&(n=Object.assign(Object.assign(Object.assign({},n),o),{component:o.component||(n==null?void 0:n.component)})),r.split(/\&/g).forEach(s=>{var i,c,a;let[u,g]=s.split("="),l=((i=n.schema.properties)===null||i===void 0?void 0:i[u])||{type:"string"};n=Object.assign(Object.assign({},n),{schema:Object.assign(Object.assign({},n.schema),{properties:Object.assign(Object.assign({},n.schema.properties),{[u]:Object.assign(Object.assign({},l),{default:O(decodeURIComponent(g),l.type)})})}),uiSchema:Object.assign(Object.assign({},n.uiSchema),{[u]:Object.assign(Object.assign({},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 x(){clearTimeout(y),y=setTimeout(()=>{var e;typeof window!="undefined"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(f)}),"*"))},30)}x();var m=class extends K{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{T(null,t)})}catch(t){}}static register(t,r,n=this){r==null&&(r=typeof window!="undefined"?window:void 0),r&&!r.customElements.get(t)&&r.customElements.define(t,n)}},C={};function R(e){C=e}m.register("byoc-registration");export{m as BYOCRegistration,K as WebComponent,C as contextProperties,w as getComponent,z as getComponentConfigurablePropertyNames,W as getComponentProperties,A as getSchemaDefaults,v as getSchemaProperties,L as isWebComponent,J as normalizeOptions,U as objectKeysToCamelCase,M as objectKeysToKebabCase,P as parseSchemaProperties,O as parseValue,T as registerComponent,f as registered,R as setContextProperties,x as setRegistrationCallback,b as toCamelCase,d as toKebabCase,h as transformSchema,j as transformUiSchema}; | ||
var M=(e={})=>Object.keys(e).reduce((t,r)=>Object.assign(t,{[d(r)]:e[r]}),{}),U=(e={})=>Object.keys(e).reduce((t,r)=>Object.assign(t,{[b(r)]:e[r]}),{});function d(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return b(e).replace(t,function(r){return"-"+r.toLowerCase()})}function b(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,r)=>r===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function h(e,t={}){let r=e.properties||{};return Object.assign(Object.assign({type:"object"},e),{properties:Object.keys(r).reduce((n,o)=>Object.assign(n,{[o]:Object.assign(Object.assign({},r[o]),{default:t.hasOwnProperty(o)?t[o]:r[o].default,title:r[o].title||d(o).split("-").map(s=>s.charAt(0).toUpperCase()+s.slice(1).toLowerCase()).join(" ")})}),{})})}var j=(e,t)=>{let r=Object.assign({},e);return Object.keys(t).filter(o=>/(integer|number)/.test(t[o].type)).forEach(o=>{var s;!((s=r[o])===null||s===void 0)&&s["ui:widget"]||(r[o]=Object.assign(Object.assign({},r[o]),{"ui:widget":"updown"}))}),r};function O(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch(r){return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch(r){return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function P(e,t){return Object.keys(t).reduce((r,n)=>{let o=t[n],s=b(n),i=e==null?void 0:e.properties[s],c=i==null?void 0:i.type,a=O(o,c);return a!=null&&!n.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(n)?Object.assign(Object.assign({},r),{[s]:a}):r},{})}function v(e,t){return Object.assign(Object.assign({},A(e)),P(e,t))}function A(e){return Object.keys(e.properties).reduce((t,r)=>{var n,o;return((n=e.properties[r])===null||n===void 0?void 0:n.default)!=null?Object.assign(Object.assign({},t),{[r]:(o=e.properties[r])===null||o===void 0?void 0:o.default}):t},{})}var D=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};function J(e,t,r){let{thumbnail:n="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:o,id:s=e.name,group:i=null,ui:c,isHidden:a=!1,uiSchema:u,schema:g}=e,l=D(e,["thumbnail","name","id","group","ui","isHidden","uiSchema","schema"]),S=g||l||{},E=u||c||{},p=h(Object.assign(Object.assign({description:"External component"},S),{type:"object"}),r),_=j(E,p.properties||{});return{component:t,name:o,schema:p,uiSchema:_,thumbnail:n,group:i,isHidden:a,id:s,title:(p==null?void 0:p.title)||(l==null?void 0:l.title)||o}}var y,K=typeof HTMLElement!="undefined"?HTMLElement:typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{setAttribute(){}},f=typeof window!="undefined"?window.BYOCComponents||(window.BYOCComponents={}):{};function T(e,t,r={}){if(!(t!=null&&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=J(t,e,r);f[n.id]=n,L(e)&&m.register("byoc-"+d(t.name),void 0,e),x()}function L(e){return e&&"prototype"in e&&"setAttribute"in e.prototype}function W(e,t={}){var r;let n=(r=w(e))===null||r===void 0?void 0:r.schema,o=Object.assign(Object.assign({},C),t);return n?v(n,o):o}function z(e){let t=w(e);return Object.keys((t==null?void 0:t.schema.properties)||{}).filter(r=>{var n,o;return((o=(n=t==null?void 0:t.uiSchema)===null||n===void 0?void 0:n[r])===null||o===void 0?void 0:o["ui:widget"])!="hidden"})}function w(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,r]=e.split("?");var n=f[t];if(r){let o=f[e];if(!o&&!n)return null;o&&(n=Object.assign(Object.assign(Object.assign({},n),o),{component:o.component||(n==null?void 0:n.component)})),r.split(/\&/g).forEach(s=>{var i,c,a;let[u,g]=s.split("="),l=((i=n.schema.properties)===null||i===void 0?void 0:i[u])||{type:"string"};n=Object.assign(Object.assign({},n),{schema:Object.assign(Object.assign({},n.schema),{properties:Object.assign(Object.assign({},n.schema.properties),{[u]:Object.assign(Object.assign({},l),{default:O(decodeURIComponent(g),l.type)})})}),uiSchema:Object.assign(Object.assign({},n.uiSchema),{[u]:Object.assign(Object.assign({},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 x(){clearTimeout(y),y=setTimeout(()=>{var e;typeof window!="undefined"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(f)}),"*"))},30)}x();var m=class extends K{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{T(null,t)})}catch(t){}}static register(t,r,n=this){r==null&&(r=typeof window!="undefined"?window:void 0),r&&!r.customElements.get(t)&&r.customElements.define(t,class extends n{})}},C={};function R(e){C=e}m.register("byoc-registration");export{m as BYOCRegistration,K as WebComponent,C as contextProperties,w as getComponent,z as getComponentConfigurablePropertyNames,W as getComponentProperties,A as getSchemaDefaults,v as getSchemaProperties,L as isWebComponent,J as normalizeOptions,U as objectKeysToCamelCase,M as objectKeysToKebabCase,P as parseSchemaProperties,O as parseValue,T as registerComponent,f as registered,R as setContextProperties,x as setRegistrationCallback,b as toCamelCase,d as toKebabCase,h as transformSchema,j as transformUiSchema}; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -1,2 +0,2 @@ | ||
import t from"react";import{getComponent as j,getComponentProperties as E,isWebComponent as C,registered as N}from"@sitecore/byoc";import{objectKeysToKebabCase as h,toKebabCase as _}from"@sitecore/byoc";export*from"@sitecore/byoc";var O=function(e,n){var o={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(o[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(e);r<a.length;r++)n.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(o[a[r]]=e[a[r]]);return o},g=null,b=null;function w(e){var n;let{componentName:o,clientFallback:a}=e,r=O(e,["componentName","clientFallback"]),f=(n=j(o))===null||n===void 0?void 0:n.component,y=t.useMemo(()=>b(()=>Promise.resolve(g),{ssr:!1,loading:()=>t.createElement(v,Object.assign({},r,{componentName:o}))}),[]);return t.createElement(y,Object.assign({},e,{fallback:f?t.createElement(f,Object.assign({},e)):a?t.createElement(b(()=>Promise.resolve(()=>a),{ssr:!1})):e.fallback}))}function W(e,n){return b=e,g=n,n}function H(e){return Object.keys(e).length==0?t.createElement(t.Fragment,null):b&&!e._dynamic?w(Object.assign({_dynamic:!0},e)):v(e)}function S(){return t.createElement(t.Fragment,null,t.createElement("byoc-registration",{components:JSON.stringify(Object.values(N)),suppressHydrationWarning:!0}),t.createElement(g,null))}function v(e){let{componentName:n,className:o,clientFallback:a,fallback:r,suppressHydrationWarning:f,_dynamic:y}=e,x=O(e,["componentName","className","clientFallback","fallback","suppressHydrationWarning","_dynamic"]),m=j(n),s=m==null?void 0:m.component,d=E(n,x),c=Object.assign(Object.assign({"data-external-id":n},h(d)),{suppressHydrationWarning:!0,class:o});if(Object.keys(c).forEach(l=>{let i=c[l];if(i&&typeof i=="object"&&l!="class"&&l!="children")try{Object.assign(c,{[l]:JSON.stringify(i)})}catch(u){delete c[l]}}),!s&&r||!n)return t.createElement("feaas-external",Object.assign({},c,{hydrate:"false"}),r);if(s&&C(s)){let l="byoc-"+_(m.id);return t.createElement(l,Object.assign(Object.assign({},c),{ref:i=>{var u;i&&typeof window!="undefined"&&((u=window.customElements)===null||u===void 0||u.whenDefined(l).then(()=>{var p;(p=i.sitecoreContextCallback)===null||p===void 0||p.call(i,d)}))}}))}return t.createElement(t.Fragment,null,t.createElement("feaas-external",Object.assign({},c,{hydrate:"false"}),s==null?null:t.createElement(s,Object.assign({},d))))}export{S as Bundle,H as Component,w as NextComponent,v as RegularComponent,W as enableNextClientsideComponents}; | ||
import t from"react";import{getComponent as j,getComponentProperties as E,isWebComponent as C,registered as N}from"@sitecore/byoc";import{objectKeysToKebabCase as h,toKebabCase as _}from"@sitecore/byoc";export*from"@sitecore/byoc";var y=function(e,n){var l={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(l[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(e);r<a.length;r++)n.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(l[a[r]]=e[a[r]]);return l},g=null,f=null;function w(e){var n;let{componentName:l,clientFallback:a}=e,r=y(e,["componentName","clientFallback"]),b=(n=j(l))===null||n===void 0?void 0:n.component,O=t.useMemo(()=>f(()=>Promise.resolve(g),{ssr:!1,loading:()=>t.createElement(v,Object.assign({},r,{componentName:l}))}),[]);return t.createElement(O,Object.assign({},e,{fallback:b?t.createElement(b,Object.assign({},e)):a?t.createElement(f(()=>Promise.resolve(()=>a),{ssr:!1})):e.fallback}))}function W(e,n){return f=e,g=n,n}function H(e){return Object.keys(e).length==0?t.createElement(t.Fragment,null):f&&!e._dynamic?w(Object.assign({_dynamic:!0},e)):v(e)}function S(){return t.createElement(t.Fragment,null,t.createElement("byoc-registration",{components:JSON.stringify(Object.values(N)),suppressHydrationWarning:!0}),t.createElement(g,null))}function v(e){let{componentName:n,className:l,clientFallback:a,fallback:r,suppressHydrationWarning:b,_dynamic:O}=e,x=y(e,["componentName","className","clientFallback","fallback","suppressHydrationWarning","_dynamic"]),m=j(n),s=m==null?void 0:m.component,d=E(n,x),c=Object.assign(Object.assign({"data-external-id":n},h(d)),{suppressHydrationWarning:!0,class:l});if(Object.keys(c).forEach(o=>{let i=c[o];if(i&&typeof i=="object"&&o!="class"&&o!="children")try{Object.assign(c,{[o]:JSON.stringify(i)})}catch(u){delete c[o]}o=="sdk"&&delete c[o]}),!s&&r||!n)return t.createElement("feaas-external",Object.assign({},c,{hydrate:"false"}),r);if(s&&C(s)){let o="byoc-"+_(m.id);return t.createElement(o,Object.assign(Object.assign({},c),{ref:i=>{var u;i&&typeof window!="undefined"&&((u=window.customElements)===null||u===void 0||u.whenDefined(o).then(()=>{var p;(p=i.sitecoreContextCallback)===null||p===void 0||p.call(i,d)}))}}))}return t.createElement(t.Fragment,null,t.createElement("feaas-external",Object.assign({},c,{hydrate:"false"}),s==null?null:t.createElement(s,Object.assign({},d))))}export{S as Bundle,H as Component,w as NextComponent,v as RegularComponent,W as enableNextClientsideComponents}; | ||
//# sourceMappingURL=react.esm.js.map |
@@ -1,2 +0,2 @@ | ||
var M=(e={})=>Object.keys(e).reduce((t,r)=>Object.assign(t,{[d(r)]:e[r]}),{}),U=(e={})=>Object.keys(e).reduce((t,r)=>Object.assign(t,{[b(r)]:e[r]}),{});function d(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return b(e).replace(t,function(r){return"-"+r.toLowerCase()})}function b(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,r)=>r===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function h(e,t={}){let r=e.properties||{};return Object.assign(Object.assign({type:"object"},e),{properties:Object.keys(r).reduce((n,o)=>Object.assign(n,{[o]:Object.assign(Object.assign({},r[o]),{default:t.hasOwnProperty(o)?t[o]:r[o].default,title:r[o].title||d(o).split("-").map(s=>s.charAt(0).toUpperCase()+s.slice(1).toLowerCase()).join(" ")})}),{})})}var j=(e,t)=>{let r=Object.assign({},e);return Object.keys(t).filter(o=>/(integer|number)/.test(t[o].type)).forEach(o=>{var s;!((s=r[o])===null||s===void 0)&&s["ui:widget"]||(r[o]=Object.assign(Object.assign({},r[o]),{"ui:widget":"updown"}))}),r};function O(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch(r){return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch(r){return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function P(e,t){return Object.keys(t).reduce((r,n)=>{let o=t[n],s=b(n),i=e==null?void 0:e.properties[s],c=i==null?void 0:i.type,a=O(o,c);return a!=null&&!n.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(n)?Object.assign(Object.assign({},r),{[s]:a}):r},{})}function v(e,t){return Object.assign(Object.assign({},A(e)),P(e,t))}function A(e){return Object.keys(e.properties).reduce((t,r)=>{var n,o;return((n=e.properties[r])===null||n===void 0?void 0:n.default)!=null?Object.assign(Object.assign({},t),{[r]:(o=e.properties[r])===null||o===void 0?void 0:o.default}):t},{})}var D=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};function J(e,t,r){let{thumbnail:n="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:o,id:s=e.name,group:i=null,ui:c,isHidden:a=!1,uiSchema:u,schema:g}=e,l=D(e,["thumbnail","name","id","group","ui","isHidden","uiSchema","schema"]),S=g||l||{},E=u||c||{},p=h(Object.assign(Object.assign({description:"External component"},S),{type:"object"}),r),_=j(E,p.properties||{});return{component:t,name:o,schema:p,uiSchema:_,thumbnail:n,group:i,isHidden:a,id:s,title:(p==null?void 0:p.title)||(l==null?void 0:l.title)||o}}var y,K=typeof HTMLElement!="undefined"?HTMLElement:typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{setAttribute(){}},f=typeof window!="undefined"?window.BYOCComponents||(window.BYOCComponents={}):{};function T(e,t,r={}){if(!(t!=null&&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=J(t,e,r);f[n.id]=n,L(e)&&m.register("byoc-"+d(t.name),void 0,e),x()}function L(e){return e&&"prototype"in e&&"setAttribute"in e.prototype}function W(e,t={}){var r;let n=(r=w(e))===null||r===void 0?void 0:r.schema,o=Object.assign(Object.assign({},C),t);return n?v(n,o):o}function z(e){let t=w(e);return Object.keys((t==null?void 0:t.schema.properties)||{}).filter(r=>{var n,o;return((o=(n=t==null?void 0:t.uiSchema)===null||n===void 0?void 0:n[r])===null||o===void 0?void 0:o["ui:widget"])!="hidden"})}function w(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,r]=e.split("?");var n=f[t];if(r){let o=f[e];if(!o&&!n)return null;o&&(n=Object.assign(Object.assign(Object.assign({},n),o),{component:o.component||(n==null?void 0:n.component)})),r.split(/\&/g).forEach(s=>{var i,c,a;let[u,g]=s.split("="),l=((i=n.schema.properties)===null||i===void 0?void 0:i[u])||{type:"string"};n=Object.assign(Object.assign({},n),{schema:Object.assign(Object.assign({},n.schema),{properties:Object.assign(Object.assign({},n.schema.properties),{[u]:Object.assign(Object.assign({},l),{default:O(decodeURIComponent(g),l.type)})})}),uiSchema:Object.assign(Object.assign({},n.uiSchema),{[u]:Object.assign(Object.assign({},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 x(){clearTimeout(y),y=setTimeout(()=>{var e;typeof window!="undefined"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(f)}),"*"))},30)}x();var m=class extends K{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{T(null,t)})}catch(t){}}static register(t,r,n=this){r==null&&(r=typeof window!="undefined"?window:void 0),r&&!r.customElements.get(t)&&r.customElements.define(t,n)}},C={};function R(e){C=e}m.register("byoc-registration");export{m as BYOCRegistration,K as WebComponent,C as contextProperties,w as getComponent,z as getComponentConfigurablePropertyNames,W as getComponentProperties,A as getSchemaDefaults,v as getSchemaProperties,L as isWebComponent,J as normalizeOptions,U as objectKeysToCamelCase,M as objectKeysToKebabCase,P as parseSchemaProperties,O as parseValue,T as registerComponent,f as registered,R as setContextProperties,x as setRegistrationCallback,b as toCamelCase,d as toKebabCase,h as transformSchema,j as transformUiSchema}; | ||
var M=(e={})=>Object.keys(e).reduce((t,r)=>Object.assign(t,{[d(r)]:e[r]}),{}),U=(e={})=>Object.keys(e).reduce((t,r)=>Object.assign(t,{[b(r)]:e[r]}),{});function d(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return b(e).replace(t,function(r){return"-"+r.toLowerCase()})}function b(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,r)=>r===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function h(e,t={}){let r=e.properties||{};return Object.assign(Object.assign({type:"object"},e),{properties:Object.keys(r).reduce((n,o)=>Object.assign(n,{[o]:Object.assign(Object.assign({},r[o]),{default:t.hasOwnProperty(o)?t[o]:r[o].default,title:r[o].title||d(o).split("-").map(s=>s.charAt(0).toUpperCase()+s.slice(1).toLowerCase()).join(" ")})}),{})})}var j=(e,t)=>{let r=Object.assign({},e);return Object.keys(t).filter(o=>/(integer|number)/.test(t[o].type)).forEach(o=>{var s;!((s=r[o])===null||s===void 0)&&s["ui:widget"]||(r[o]=Object.assign(Object.assign({},r[o]),{"ui:widget":"updown"}))}),r};function O(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch(r){return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch(r){return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function P(e,t){return Object.keys(t).reduce((r,n)=>{let o=t[n],s=b(n),i=e==null?void 0:e.properties[s],c=i==null?void 0:i.type,a=O(o,c);return a!=null&&!n.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(n)?Object.assign(Object.assign({},r),{[s]:a}):r},{})}function v(e,t){return Object.assign(Object.assign({},A(e)),P(e,t))}function A(e){return Object.keys(e.properties).reduce((t,r)=>{var n,o;return((n=e.properties[r])===null||n===void 0?void 0:n.default)!=null?Object.assign(Object.assign({},t),{[r]:(o=e.properties[r])===null||o===void 0?void 0:o.default}):t},{})}var D=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};function J(e,t,r){let{thumbnail:n="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:o,id:s=e.name,group:i=null,ui:c,isHidden:a=!1,uiSchema:u,schema:g}=e,l=D(e,["thumbnail","name","id","group","ui","isHidden","uiSchema","schema"]),S=g||l||{},E=u||c||{},p=h(Object.assign(Object.assign({description:"External component"},S),{type:"object"}),r),_=j(E,p.properties||{});return{component:t,name:o,schema:p,uiSchema:_,thumbnail:n,group:i,isHidden:a,id:s,title:(p==null?void 0:p.title)||(l==null?void 0:l.title)||o}}var y,K=typeof HTMLElement!="undefined"?HTMLElement:typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{setAttribute(){}},f=typeof window!="undefined"?window.BYOCComponents||(window.BYOCComponents={}):{};function T(e,t,r={}){if(!(t!=null&&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=J(t,e,r);f[n.id]=n,L(e)&&m.register("byoc-"+d(t.name),void 0,e),x()}function L(e){return e&&"prototype"in e&&"setAttribute"in e.prototype}function W(e,t={}){var r;let n=(r=w(e))===null||r===void 0?void 0:r.schema,o=Object.assign(Object.assign({},C),t);return n?v(n,o):o}function z(e){let t=w(e);return Object.keys((t==null?void 0:t.schema.properties)||{}).filter(r=>{var n,o;return((o=(n=t==null?void 0:t.uiSchema)===null||n===void 0?void 0:n[r])===null||o===void 0?void 0:o["ui:widget"])!="hidden"})}function w(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,r]=e.split("?");var n=f[t];if(r){let o=f[e];if(!o&&!n)return null;o&&(n=Object.assign(Object.assign(Object.assign({},n),o),{component:o.component||(n==null?void 0:n.component)})),r.split(/\&/g).forEach(s=>{var i,c,a;let[u,g]=s.split("="),l=((i=n.schema.properties)===null||i===void 0?void 0:i[u])||{type:"string"};n=Object.assign(Object.assign({},n),{schema:Object.assign(Object.assign({},n.schema),{properties:Object.assign(Object.assign({},n.schema.properties),{[u]:Object.assign(Object.assign({},l),{default:O(decodeURIComponent(g),l.type)})})}),uiSchema:Object.assign(Object.assign({},n.uiSchema),{[u]:Object.assign(Object.assign({},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 x(){clearTimeout(y),y=setTimeout(()=>{var e;typeof window!="undefined"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(f)}),"*"))},30)}x();var m=class extends K{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(t=>{T(null,t)})}catch(t){}}static register(t,r,n=this){r==null&&(r=typeof window!="undefined"?window:void 0),r&&!r.customElements.get(t)&&r.customElements.define(t,class extends n{})}},C={};function R(e){C=e}m.register("byoc-registration");export{m as BYOCRegistration,K as WebComponent,C as contextProperties,w as getComponent,z as getComponentConfigurablePropertyNames,W as getComponentProperties,A as getSchemaDefaults,v as getSchemaProperties,L as isWebComponent,J as normalizeOptions,U as objectKeysToCamelCase,M as objectKeysToKebabCase,P as parseSchemaProperties,O as parseValue,T as registerComponent,f as registered,R as setContextProperties,x as setRegistrationCallback,b as toCamelCase,d as toKebabCase,h as transformSchema,j as transformUiSchema}; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -1,2 +0,2 @@ | ||
import t from"react";import{getComponent as j,getComponentProperties as E,isWebComponent as C,registered as N}from"@sitecore/byoc";import{objectKeysToKebabCase as h,toKebabCase as _}from"@sitecore/byoc";export*from"@sitecore/byoc";var O=function(e,n){var o={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(o[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(e);r<a.length;r++)n.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(o[a[r]]=e[a[r]]);return o},g=null,b=null;function w(e){var n;let{componentName:o,clientFallback:a}=e,r=O(e,["componentName","clientFallback"]),f=(n=j(o))===null||n===void 0?void 0:n.component,y=t.useMemo(()=>b(()=>Promise.resolve(g),{ssr:!1,loading:()=>t.createElement(v,Object.assign({},r,{componentName:o}))}),[]);return t.createElement(y,Object.assign({},e,{fallback:f?t.createElement(f,Object.assign({},e)):a?t.createElement(b(()=>Promise.resolve(()=>a),{ssr:!1})):e.fallback}))}function W(e,n){return b=e,g=n,n}function H(e){return Object.keys(e).length==0?t.createElement(t.Fragment,null):b&&!e._dynamic?w(Object.assign({_dynamic:!0},e)):v(e)}function S(){return t.createElement(t.Fragment,null,t.createElement("byoc-registration",{components:JSON.stringify(Object.values(N)),suppressHydrationWarning:!0}),t.createElement(g,null))}function v(e){let{componentName:n,className:o,clientFallback:a,fallback:r,suppressHydrationWarning:f,_dynamic:y}=e,x=O(e,["componentName","className","clientFallback","fallback","suppressHydrationWarning","_dynamic"]),m=j(n),s=m==null?void 0:m.component,d=E(n,x),c=Object.assign(Object.assign({"data-external-id":n},h(d)),{suppressHydrationWarning:!0,class:o});if(Object.keys(c).forEach(l=>{let i=c[l];if(i&&typeof i=="object"&&l!="class"&&l!="children")try{Object.assign(c,{[l]:JSON.stringify(i)})}catch(u){delete c[l]}}),!s&&r||!n)return t.createElement("feaas-external",Object.assign({},c,{hydrate:"false"}),r);if(s&&C(s)){let l="byoc-"+_(m.id);return t.createElement(l,Object.assign(Object.assign({},c),{ref:i=>{var u;i&&typeof window!="undefined"&&((u=window.customElements)===null||u===void 0||u.whenDefined(l).then(()=>{var p;(p=i.sitecoreContextCallback)===null||p===void 0||p.call(i,d)}))}}))}return t.createElement(t.Fragment,null,t.createElement("feaas-external",Object.assign({},c,{hydrate:"false"}),s==null?null:t.createElement(s,Object.assign({},d))))}export{S as Bundle,H as Component,w as NextComponent,v as RegularComponent,W as enableNextClientsideComponents}; | ||
import t from"react";import{getComponent as j,getComponentProperties as E,isWebComponent as C,registered as N}from"@sitecore/byoc";import{objectKeysToKebabCase as h,toKebabCase as _}from"@sitecore/byoc";export*from"@sitecore/byoc";var y=function(e,n){var l={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(l[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(e);r<a.length;r++)n.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(l[a[r]]=e[a[r]]);return l},g=null,f=null;function w(e){var n;let{componentName:l,clientFallback:a}=e,r=y(e,["componentName","clientFallback"]),b=(n=j(l))===null||n===void 0?void 0:n.component,O=t.useMemo(()=>f(()=>Promise.resolve(g),{ssr:!1,loading:()=>t.createElement(v,Object.assign({},r,{componentName:l}))}),[]);return t.createElement(O,Object.assign({},e,{fallback:b?t.createElement(b,Object.assign({},e)):a?t.createElement(f(()=>Promise.resolve(()=>a),{ssr:!1})):e.fallback}))}function W(e,n){return f=e,g=n,n}function H(e){return Object.keys(e).length==0?t.createElement(t.Fragment,null):f&&!e._dynamic?w(Object.assign({_dynamic:!0},e)):v(e)}function S(){return t.createElement(t.Fragment,null,t.createElement("byoc-registration",{components:JSON.stringify(Object.values(N)),suppressHydrationWarning:!0}),t.createElement(g,null))}function v(e){let{componentName:n,className:l,clientFallback:a,fallback:r,suppressHydrationWarning:b,_dynamic:O}=e,x=y(e,["componentName","className","clientFallback","fallback","suppressHydrationWarning","_dynamic"]),m=j(n),s=m==null?void 0:m.component,d=E(n,x),c=Object.assign(Object.assign({"data-external-id":n},h(d)),{suppressHydrationWarning:!0,class:l});if(Object.keys(c).forEach(o=>{let i=c[o];if(i&&typeof i=="object"&&o!="class"&&o!="children")try{Object.assign(c,{[o]:JSON.stringify(i)})}catch(u){delete c[o]}o=="sdk"&&delete c[o]}),!s&&r||!n)return t.createElement("feaas-external",Object.assign({},c,{hydrate:"false"}),r);if(s&&C(s)){let o="byoc-"+_(m.id);return t.createElement(o,Object.assign(Object.assign({},c),{ref:i=>{var u;i&&typeof window!="undefined"&&((u=window.customElements)===null||u===void 0||u.whenDefined(o).then(()=>{var p;(p=i.sitecoreContextCallback)===null||p===void 0||p.call(i,d)}))}}))}return t.createElement(t.Fragment,null,t.createElement("feaas-external",Object.assign({},c,{hydrate:"false"}),s==null?null:t.createElement(s,Object.assign({},d))))}export{S as Bundle,H as Component,w as NextComponent,v as RegularComponent,W as enableNextClientsideComponents}; | ||
//# sourceMappingURL=react.esm.js.map |
@@ -5,3 +5,3 @@ { | ||
"description": "Bring-Your-Own-Components runtime to register and retrieve react components", | ||
"version": "0.1.11-alpha.2", | ||
"version": "0.1.11-alpha.3", | ||
"scripts": { | ||
@@ -8,0 +8,0 @@ "test": "npx vitest", |
@@ -1,2 +0,2 @@ | ||
"use strict";var F=Object.create;var g=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var S=(e,t)=>{for(var n in t)g(e,n,{get:t[n],enumerable:!0})},p=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of P(t))!H.call(e,o)&&o!==n&&g(e,o,{get:()=>t[o],enumerable:!(r=k(t,o))||r.enumerable});return e},c=(e,t,n)=>(p(e,t,"default"),n&&p(n,t,"default")),K=(e,t,n)=>(n=e!=null?F(W(e)):{},p(t||!e||!e.__esModule?g(n,"default",{value:e,enumerable:!0}):n,e)),R=e=>p(g({},"__esModule",{value:!0}),e);var l={};S(l,{Bundle:()=>B,Component:()=>J,NextComponent:()=>_,RegularComponent:()=>C,enableNextClientsideComponents:()=>D});module.exports=R(l);var a=K(require("react"),1),i=require("@sitecore/byoc"),O=require("@sitecore/byoc");c(l,require("@sitecore/byoc"),module.exports);var h=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n},E=null,y=null;function _(e){var t;let{componentName:n,clientFallback:r}=e,o=h(e,["componentName","clientFallback"]),j=(t=(0,i.getComponent)(n))===null||t===void 0?void 0:t.component,N=a.default.useMemo(()=>y(()=>Promise.resolve(E),{ssr:!1,loading:()=>a.default.createElement(C,Object.assign({},o,{componentName:n}))}),[]);return a.default.createElement(N,Object.assign({},e,{fallback:j?a.default.createElement(j,Object.assign({},e)):r?a.default.createElement(y(()=>Promise.resolve(()=>r),{ssr:!1})):e.fallback}))}function D(e,t){return y=e,E=t,t}function J(e){return Object.keys(e).length==0?a.default.createElement(a.default.Fragment,null):y&&!e._dynamic?_(Object.assign({_dynamic:!0},e)):C(e)}function B(){return a.default.createElement(a.default.Fragment,null,a.default.createElement("byoc-registration",{components:JSON.stringify(Object.values(i.registered)),suppressHydrationWarning:!0}),a.default.createElement(E,null))}function C(e){let{componentName:t,className:n,clientFallback:r,fallback:o,suppressHydrationWarning:j,_dynamic:N}=e,w=h(e,["componentName","className","clientFallback","fallback","suppressHydrationWarning","_dynamic"]),f=(0,i.getComponent)(t),b=f==null?void 0:f.component,v=(0,i.getComponentProperties)(t,w),m=Object.assign(Object.assign({"data-external-id":t},(0,O.objectKeysToKebabCase)(v)),{suppressHydrationWarning:!0,class:n});if(Object.keys(m).forEach(s=>{let u=m[s];if(u&&typeof u=="object"&&s!="class"&&s!="children")try{Object.assign(m,{[s]:JSON.stringify(u)})}catch(d){delete m[s]}}),!b&&o||!t)return a.default.createElement("feaas-external",Object.assign({},m,{hydrate:"false"}),o);if(b&&(0,i.isWebComponent)(b)){let s="byoc-"+(0,O.toKebabCase)(f.id);return a.default.createElement(s,Object.assign(Object.assign({},m),{ref:u=>{var d;u&&typeof window!="undefined"&&((d=window.customElements)===null||d===void 0||d.whenDefined(s).then(()=>{var x;(x=u.sitecoreContextCallback)===null||x===void 0||x.call(u,v)}))}}))}return a.default.createElement(a.default.Fragment,null,a.default.createElement("feaas-external",Object.assign({},m,{hydrate:"false"}),b==null?null:a.default.createElement(b,Object.assign({},v))))} | ||
"use strict";var F=Object.create;var g=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var S=(e,t)=>{for(var n in t)g(e,n,{get:t[n],enumerable:!0})},p=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of k(t))!H.call(e,o)&&o!==n&&g(e,o,{get:()=>t[o],enumerable:!(r=P(t,o))||r.enumerable});return e},c=(e,t,n)=>(p(e,t,"default"),n&&p(n,t,"default")),K=(e,t,n)=>(n=e!=null?F(W(e)):{},p(t||!e||!e.__esModule?g(n,"default",{value:e,enumerable:!0}):n,e)),R=e=>p(g({},"__esModule",{value:!0}),e);var l={};S(l,{Bundle:()=>B,Component:()=>J,NextComponent:()=>_,RegularComponent:()=>C,enableNextClientsideComponents:()=>D});module.exports=R(l);var a=K(require("react"),1),s=require("@sitecore/byoc"),y=require("@sitecore/byoc");c(l,require("@sitecore/byoc"),module.exports);var h=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n},E=null,O=null;function _(e){var t;let{componentName:n,clientFallback:r}=e,o=h(e,["componentName","clientFallback"]),j=(t=(0,s.getComponent)(n))===null||t===void 0?void 0:t.component,N=a.default.useMemo(()=>O(()=>Promise.resolve(E),{ssr:!1,loading:()=>a.default.createElement(C,Object.assign({},o,{componentName:n}))}),[]);return a.default.createElement(N,Object.assign({},e,{fallback:j?a.default.createElement(j,Object.assign({},e)):r?a.default.createElement(O(()=>Promise.resolve(()=>r),{ssr:!1})):e.fallback}))}function D(e,t){return O=e,E=t,t}function J(e){return Object.keys(e).length==0?a.default.createElement(a.default.Fragment,null):O&&!e._dynamic?_(Object.assign({_dynamic:!0},e)):C(e)}function B(){return a.default.createElement(a.default.Fragment,null,a.default.createElement("byoc-registration",{components:JSON.stringify(Object.values(s.registered)),suppressHydrationWarning:!0}),a.default.createElement(E,null))}function C(e){let{componentName:t,className:n,clientFallback:r,fallback:o,suppressHydrationWarning:j,_dynamic:N}=e,w=h(e,["componentName","className","clientFallback","fallback","suppressHydrationWarning","_dynamic"]),b=(0,s.getComponent)(t),f=b==null?void 0:b.component,v=(0,s.getComponentProperties)(t,w),m=Object.assign(Object.assign({"data-external-id":t},(0,y.objectKeysToKebabCase)(v)),{suppressHydrationWarning:!0,class:n});if(Object.keys(m).forEach(i=>{let u=m[i];if(u&&typeof u=="object"&&i!="class"&&i!="children")try{Object.assign(m,{[i]:JSON.stringify(u)})}catch(d){delete m[i]}i=="sdk"&&delete m[i]}),!f&&o||!t)return a.default.createElement("feaas-external",Object.assign({},m,{hydrate:"false"}),o);if(f&&(0,s.isWebComponent)(f)){let i="byoc-"+(0,y.toKebabCase)(b.id);return a.default.createElement(i,Object.assign(Object.assign({},m),{ref:u=>{var d;u&&typeof window!="undefined"&&((d=window.customElements)===null||d===void 0||d.whenDefined(i).then(()=>{var x;(x=u.sitecoreContextCallback)===null||x===void 0||x.call(u,v)}))}}))}return a.default.createElement(a.default.Fragment,null,a.default.createElement("feaas-external",Object.assign({},m,{hydrate:"false"}),f==null?null:a.default.createElement(f,Object.assign({},v))))} | ||
//# sourceMappingURL=react.js.map |
@@ -357,2 +357,3 @@ import { | ||
// Register schemas passed as <byoc-registration components=... /> | ||
// It extends the web component in case it already was registered by different name | ||
export class BYOCRegistration extends WebComponent { | ||
@@ -369,3 +370,3 @@ connectedCallback() { | ||
if (win && !win.customElements.get(tagName)) { | ||
win.customElements.define(tagName, component) | ||
win.customElements.define(tagName, class extends component {}) | ||
} | ||
@@ -372,0 +373,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
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
380812
1890