@sitecore/byoc
Advanced tools
Comparing version 0.1.6 to 0.1.8
@@ -85,3 +85,3 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
export function RegularComponent(props) { | ||
const { componentName, className, fallback, suppressHydrationWarning, _dynamic } = props, attributes = __rest(props, ["componentName", "className", "fallback", "suppressHydrationWarning", "_dynamic"]); | ||
const { componentName, className, clientFallback, fallback, suppressHydrationWarning, _dynamic } = props, attributes = __rest(props, ["componentName", "className", "clientFallback", "fallback", "suppressHydrationWarning", "_dynamic"]); | ||
const definition = getComponent(componentName); | ||
@@ -92,6 +92,12 @@ const Component = definition === null || definition === void 0 ? void 0 : definition.component; | ||
// serialize json properties | ||
Object.keys(componentProperties).forEach((key) => { | ||
Object.keys(componentProperties).forEach((_key) => { | ||
const key = _key; | ||
const value = componentProperties[key]; | ||
if (value && typeof value == 'object' && key != 'class') { | ||
Object.assign(componentProperties, { [key]: JSON.stringify(value) }); | ||
try { | ||
Object.assign(componentProperties, { [key]: JSON.stringify(value) }); | ||
} | ||
catch (e) { | ||
delete componentProperties[key]; | ||
} | ||
} | ||
@@ -98,0 +104,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
import t from"react";import{getComponent as y,getComponentProperties as j,isWebComponent as x,registered as E}from"@sitecore/byoc";import{objectKeysToKebabCase as v,toKebabCase as C}from"@sitecore/byoc";export*from"@sitecore/byoc";var d=function(e,r){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(o[n[a]]=e[n[a]]);return o},p=null,i=null;function N(e){var r;let{componentName:o,clientFallback:n}=e,a=d(e,["componentName","clientFallback"]),m=(r=y(o))===null||r===void 0?void 0:r.component,u=t.useMemo(()=>i(()=>Promise.resolve(p),{ssr:!1,loading:()=>t.createElement(O,Object.assign({},a,{componentName:o}))}),[]);return t.createElement(u,Object.assign({},e,{fallback:m?t.createElement(m,Object.assign({},e)):n?t.createElement(i(()=>Promise.resolve(()=>n),{ssr:!1})):e.fallback}))}function k(e,r){return i=e,p=r,r}function F(e){return Object.keys(e).length==0?t.createElement(t.Fragment,null):i&&!e._dynamic?N(Object.assign({_dynamic:!0},e)):O(e)}function W(){return t.createElement(t.Fragment,null,t.createElement("byoc-registration",{components:JSON.stringify(Object.values(E)),suppressHydrationWarning:!0}),t.createElement(p,null))}function O(e){let{componentName:r,className:o,fallback:n,suppressHydrationWarning:a,_dynamic:m}=e,u=d(e,["componentName","className","fallback","suppressHydrationWarning","_dynamic"]),s=y(r),l=s==null?void 0:s.component,g=j(r,u),c=Object.assign(Object.assign({"data-external-id":r},v(g)),{suppressHydrationWarning:!0,class:o});return Object.keys(c).forEach(f=>{let b=c[f];b&&typeof b=="object"&&f!="class"&&Object.assign(c,{[f]:JSON.stringify(b)})}),!l&&n||!r?t.createElement("feaas-external",Object.assign({},c,{hydrate:"false"}),n):l&&x(l)?t.createElement("byoc-"+C(s.id),c):t.createElement(t.Fragment,null,t.createElement("feaas-external",Object.assign({},c,{hydrate:"false"}),l==null?null:t.createElement(l,Object.assign({},g))))}export{W as Bundle,F as Component,N as NextComponent,O as RegularComponent,k as enableNextClientsideComponents}; | ||
import t from"react";import{getComponent as d,getComponentProperties as E,isWebComponent as v,registered as C}from"@sitecore/byoc";import{objectKeysToKebabCase as N,toKebabCase as k}from"@sitecore/byoc";export*from"@sitecore/byoc";var g=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},f=null,m=null;function h(e){var n;let{componentName:o,clientFallback:a}=e,r=g(e,["componentName","clientFallback"]),u=(n=d(o))===null||n===void 0?void 0:n.component,p=t.useMemo(()=>m(()=>Promise.resolve(f),{ssr:!1,loading:()=>t.createElement(O,Object.assign({},r,{componentName:o}))}),[]);return t.createElement(p,Object.assign({},e,{fallback:u?t.createElement(u,Object.assign({},e)):a?t.createElement(m(()=>Promise.resolve(()=>a),{ssr:!1})):e.fallback}))}function H(e,n){return m=e,f=n,n}function S(e){return Object.keys(e).length==0?t.createElement(t.Fragment,null):m&&!e._dynamic?h(Object.assign({_dynamic:!0},e)):O(e)}function w(){return t.createElement(t.Fragment,null,t.createElement("byoc-registration",{components:JSON.stringify(Object.values(C)),suppressHydrationWarning:!0}),t.createElement(f,null))}function O(e){let{componentName:n,className:o,clientFallback:a,fallback:r,suppressHydrationWarning:u,_dynamic:p}=e,j=g(e,["componentName","className","clientFallback","fallback","suppressHydrationWarning","_dynamic"]),s=d(n),l=s==null?void 0:s.component,y=E(n,j),c=Object.assign(Object.assign({"data-external-id":n},N(y)),{suppressHydrationWarning:!0,class:o});return Object.keys(c).forEach(x=>{let i=x,b=c[i];if(b&&typeof b=="object"&&i!="class")try{Object.assign(c,{[i]:JSON.stringify(b)})}catch(_){delete c[i]}}),!l&&r||!n?t.createElement("feaas-external",Object.assign({},c,{hydrate:"false"}),r):l&&v(l)?t.createElement("byoc-"+k(s.id),c):t.createElement(t.Fragment,null,t.createElement("feaas-external",Object.assign({},c,{hydrate:"false"}),l==null?null:t.createElement(l,Object.assign({},y))))}export{w as Bundle,S as Component,h as NextComponent,O as RegularComponent,H as enableNextClientsideComponents}; | ||
//# sourceMappingURL=react.esm.js.map |
@@ -1,2 +0,2 @@ | ||
import t from"react";import{getComponent as y,getComponentProperties as j,isWebComponent as x,registered as E}from"@sitecore/byoc";import{objectKeysToKebabCase as v,toKebabCase as C}from"@sitecore/byoc";export*from"@sitecore/byoc";var d=function(e,r){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(o[n[a]]=e[n[a]]);return o},p=null,i=null;function N(e){var r;let{componentName:o,clientFallback:n}=e,a=d(e,["componentName","clientFallback"]),m=(r=y(o))===null||r===void 0?void 0:r.component,u=t.useMemo(()=>i(()=>Promise.resolve(p),{ssr:!1,loading:()=>t.createElement(O,Object.assign({},a,{componentName:o}))}),[]);return t.createElement(u,Object.assign({},e,{fallback:m?t.createElement(m,Object.assign({},e)):n?t.createElement(i(()=>Promise.resolve(()=>n),{ssr:!1})):e.fallback}))}function k(e,r){return i=e,p=r,r}function F(e){return Object.keys(e).length==0?t.createElement(t.Fragment,null):i&&!e._dynamic?N(Object.assign({_dynamic:!0},e)):O(e)}function W(){return t.createElement(t.Fragment,null,t.createElement("byoc-registration",{components:JSON.stringify(Object.values(E)),suppressHydrationWarning:!0}),t.createElement(p,null))}function O(e){let{componentName:r,className:o,fallback:n,suppressHydrationWarning:a,_dynamic:m}=e,u=d(e,["componentName","className","fallback","suppressHydrationWarning","_dynamic"]),s=y(r),l=s==null?void 0:s.component,g=j(r,u),c=Object.assign(Object.assign({"data-external-id":r},v(g)),{suppressHydrationWarning:!0,class:o});return Object.keys(c).forEach(f=>{let b=c[f];b&&typeof b=="object"&&f!="class"&&Object.assign(c,{[f]:JSON.stringify(b)})}),!l&&n||!r?t.createElement("feaas-external",Object.assign({},c,{hydrate:"false"}),n):l&&x(l)?t.createElement("byoc-"+C(s.id),c):t.createElement(t.Fragment,null,t.createElement("feaas-external",Object.assign({},c,{hydrate:"false"}),l==null?null:t.createElement(l,Object.assign({},g))))}export{W as Bundle,F as Component,N as NextComponent,O as RegularComponent,k as enableNextClientsideComponents}; | ||
import t from"react";import{getComponent as d,getComponentProperties as E,isWebComponent as v,registered as C}from"@sitecore/byoc";import{objectKeysToKebabCase as N,toKebabCase as k}from"@sitecore/byoc";export*from"@sitecore/byoc";var g=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},f=null,m=null;function h(e){var n;let{componentName:o,clientFallback:a}=e,r=g(e,["componentName","clientFallback"]),u=(n=d(o))===null||n===void 0?void 0:n.component,p=t.useMemo(()=>m(()=>Promise.resolve(f),{ssr:!1,loading:()=>t.createElement(O,Object.assign({},r,{componentName:o}))}),[]);return t.createElement(p,Object.assign({},e,{fallback:u?t.createElement(u,Object.assign({},e)):a?t.createElement(m(()=>Promise.resolve(()=>a),{ssr:!1})):e.fallback}))}function H(e,n){return m=e,f=n,n}function S(e){return Object.keys(e).length==0?t.createElement(t.Fragment,null):m&&!e._dynamic?h(Object.assign({_dynamic:!0},e)):O(e)}function w(){return t.createElement(t.Fragment,null,t.createElement("byoc-registration",{components:JSON.stringify(Object.values(C)),suppressHydrationWarning:!0}),t.createElement(f,null))}function O(e){let{componentName:n,className:o,clientFallback:a,fallback:r,suppressHydrationWarning:u,_dynamic:p}=e,j=g(e,["componentName","className","clientFallback","fallback","suppressHydrationWarning","_dynamic"]),s=d(n),l=s==null?void 0:s.component,y=E(n,j),c=Object.assign(Object.assign({"data-external-id":n},N(y)),{suppressHydrationWarning:!0,class:o});return Object.keys(c).forEach(x=>{let i=x,b=c[i];if(b&&typeof b=="object"&&i!="class")try{Object.assign(c,{[i]:JSON.stringify(b)})}catch(_){delete c[i]}}),!l&&r||!n?t.createElement("feaas-external",Object.assign({},c,{hydrate:"false"}),r):l&&v(l)?t.createElement("byoc-"+k(s.id),c):t.createElement(t.Fragment,null,t.createElement("feaas-external",Object.assign({},c,{hydrate:"false"}),l==null?null:t.createElement(l,Object.assign({},y))))}export{w as Bundle,S as Component,h as NextComponent,O as RegularComponent,H 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.6", | ||
"version": "0.1.8", | ||
"scripts": { | ||
@@ -8,0 +8,0 @@ "test": "npx vitest", |
@@ -1,2 +0,2 @@ | ||
"use strict";var _=Object.create;var b=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var W=(e,t)=>{for(var n in t)b(e,n,{get:t[n],enumerable:!0})},f=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of P(t))!F.call(e,o)&&o!==n&&b(e,o,{get:()=>t[o],enumerable:!(r=h(t,o))||r.enumerable});return e},l=(e,t,n)=>(f(e,t,"default"),n&&f(n,t,"default")),H=(e,t,n)=>(n=e!=null?_(k(e)):{},f(t||!e||!e.__esModule?b(n,"default",{value:e,enumerable:!0}):n,e)),S=e=>f(b({},"__esModule",{value:!0}),e);var c={};W(c,{Bundle:()=>R,Component:()=>K,NextComponent:()=>N,RegularComponent:()=>E,enableNextClientsideComponents:()=>w});module.exports=S(c);var a=H(require("react"),1),s=require("@sitecore/byoc"),g=require("@sitecore/byoc");l(c,require("@sitecore/byoc"),module.exports);var C=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},x=null,p=null;function N(e){var t;let{componentName:n,clientFallback:r}=e,o=C(e,["componentName","clientFallback"]),d=(t=(0,s.getComponent)(n))===null||t===void 0?void 0:t.component,y=a.default.useMemo(()=>p(()=>Promise.resolve(x),{ssr:!1,loading:()=>a.default.createElement(E,Object.assign({},o,{componentName:n}))}),[]);return a.default.createElement(y,Object.assign({},e,{fallback:d?a.default.createElement(d,Object.assign({},e)):r?a.default.createElement(p(()=>Promise.resolve(()=>r),{ssr:!1})):e.fallback}))}function w(e,t){return p=e,x=t,t}function K(e){return Object.keys(e).length==0?a.default.createElement(a.default.Fragment,null):p&&!e._dynamic?N(Object.assign({_dynamic:!0},e)):E(e)}function R(){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(x,null))}function E(e){let{componentName:t,className:n,fallback:r,suppressHydrationWarning:o,_dynamic:d}=e,y=C(e,["componentName","className","fallback","suppressHydrationWarning","_dynamic"]),u=(0,s.getComponent)(t),m=u==null?void 0:u.component,v=(0,s.getComponentProperties)(t,y),i=Object.assign(Object.assign({"data-external-id":t},(0,g.objectKeysToKebabCase)(v)),{suppressHydrationWarning:!0,class:n});return Object.keys(i).forEach(O=>{let j=i[O];j&&typeof j=="object"&&O!="class"&&Object.assign(i,{[O]:JSON.stringify(j)})}),!m&&r||!t?a.default.createElement("feaas-external",Object.assign({},i,{hydrate:"false"}),r):m&&(0,s.isWebComponent)(m)?a.default.createElement("byoc-"+(0,g.toKebabCase)(u.id),i):a.default.createElement(a.default.Fragment,null,a.default.createElement("feaas-external",Object.assign({},i,{hydrate:"false"}),m==null?null:a.default.createElement(m,Object.assign({},v))))} | ||
"use strict";var _=Object.create;var p=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var S=(e,t)=>{for(var n in t)p(e,n,{get:t[n],enumerable:!0})},f=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of P(t))!H.call(e,o)&&o!==n&&p(e,o,{get:()=>t[o],enumerable:!(r=F(t,o))||r.enumerable});return e},l=(e,t,n)=>(f(e,t,"default"),n&&f(n,t,"default")),w=(e,t,n)=>(n=e!=null?_(W(e)):{},f(t||!e||!e.__esModule?p(n,"default",{value:e,enumerable:!0}):n,e)),K=e=>f(p({},"__esModule",{value:!0}),e);var c={};S(c,{Bundle:()=>B,Component:()=>J,NextComponent:()=>N,RegularComponent:()=>x,enableNextClientsideComponents:()=>R});module.exports=K(c);var a=w(require("react"),1),s=require("@sitecore/byoc"),g=require("@sitecore/byoc");l(c,require("@sitecore/byoc"),module.exports);var C=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},j=null,y=null;function N(e){var t;let{componentName:n,clientFallback:r}=e,o=C(e,["componentName","clientFallback"]),d=(t=(0,s.getComponent)(n))===null||t===void 0?void 0:t.component,E=a.default.useMemo(()=>y(()=>Promise.resolve(j),{ssr:!1,loading:()=>a.default.createElement(x,Object.assign({},o,{componentName:n}))}),[]);return a.default.createElement(E,Object.assign({},e,{fallback:d?a.default.createElement(d,Object.assign({},e)):r?a.default.createElement(y(()=>Promise.resolve(()=>r),{ssr:!1})):e.fallback}))}function R(e,t){return y=e,j=t,t}function J(e){return Object.keys(e).length==0?a.default.createElement(a.default.Fragment,null):y&&!e._dynamic?N(Object.assign({_dynamic:!0},e)):x(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(j,null))}function x(e){let{componentName:t,className:n,clientFallback:r,fallback:o,suppressHydrationWarning:d,_dynamic:E}=e,k=C(e,["componentName","className","clientFallback","fallback","suppressHydrationWarning","_dynamic"]),u=(0,s.getComponent)(t),m=u==null?void 0:u.component,v=(0,s.getComponentProperties)(t,k),i=Object.assign(Object.assign({"data-external-id":t},(0,g.objectKeysToKebabCase)(v)),{suppressHydrationWarning:!0,class:n});return Object.keys(i).forEach(h=>{let b=h,O=i[b];if(O&&typeof O=="object"&&b!="class")try{Object.assign(i,{[b]:JSON.stringify(O)})}catch(D){delete i[b]}}),!m&&o||!t?a.default.createElement("feaas-external",Object.assign({},i,{hydrate:"false"}),o):m&&(0,s.isWebComponent)(m)?a.default.createElement("byoc-"+(0,g.toKebabCase)(u.id),i):a.default.createElement(a.default.Fragment,null,a.default.createElement("feaas-external",Object.assign({},i,{hydrate:"false"}),m==null?null:a.default.createElement(m,Object.assign({},v))))} | ||
//# sourceMappingURL=react.js.map |
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
371592
1857