@homekynd/hk-embed-sdk 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1,22 @@
1
- var HKEmbed=(function(o,h){"use strict";const n="http://localhost:3000";async function p(s,e){try{const t=await fetch(`${n}/api/v1/company/generate-token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({api_secret:s,id:e})}),a=await t.json();if(t.ok)return a.token;console.error("Error fetching token: please confirm your API Secret and Client ID",a)}catch(t){console.error("Fetch error:",t)}}const w={root:"/company",renders:"/renders",spaces:"/spaces"};class g{container;iframe;currentToken;created=!1;constructor(e){const{container:t}=e;if(!t)throw new Error("Container element is required");this.container=t,this.create(e)}async create(e){if(this.created)return;const{clientId:t,apiKey:a,path:d="root",width:i="100%",height:u="100%",enablePathSync:R=!0}=e,l=new URL(window.location.href),c=l.searchParams.get("ifpath")||w[d],b=n.endsWith("/")?n:n+"/",E=c.startsWith("/")?c.substring(1):c,m=new URL(E,b),f=await p(a,t);this.currentToken=f,f&&m.searchParams.set("token",f);const r=document.createElement("iframe");return r.src=m.toString(),r.style.border="0",r.style.width=isNaN(Number(i))?i:`${i}px`,r.style.height=isNaN(Number(u))?u:`${u}px`,console.log("applying user styles/sizing"),this.iframe=r,r.onload=()=>{this.currentToken&&this.sendMessage({type:"SET_TOKEN",token:this.currentToken})},this.container.innerHTML="",this.container.appendChild(r),R&&(l.searchParams.set("ifpath",c),window.history.replaceState({},"",l.toString())),this.setupMessageHandling(),this.created=!0,{sendMessage:this.sendMessage.bind(this),onMessage:this.onMessage.bind(this)}}setupMessageHandling(){window.addEventListener("message",e=>{e.data?.type==="ROUTE_CHANGE"&&this.onRouteChange(e.data.path)})}onRouteChange(e){this.inputParentRoute(e),this.inputIframeRoute(e)}inputParentRoute(e){const t=new URL(window.location.href);t.searchParams.set("ifpath",e),window.history.replaceState({},"",t.toString())}inputIframeRoute(e){if(!this.iframe)return;const t=new URL(this.iframe.src),a=n.endsWith("/")?n:n+"/",d=e.startsWith("/")?e.substring(1):e,i=new URL(d,a);t.pathname!==i.pathname&&(this.iframe.src=i.toString())}sendMessage(e){if(this.iframe?.contentWindow){const t=new URL(n).origin;this.iframe.contentWindow.postMessage(e,t)}}onMessage(e){window.addEventListener("message",t=>{e(t.data)})}}const y=s=>{const e=h.useRef(null),t=h.useRef(null);return h.useLayoutEffect(()=>(e.current&&!t.current&&(t.current=new g({...s,container:e.current})),()=>{t.current=null}),[s]),React.createElement("div",{ref:e,style:s.style})};return o.HKEmbed=g,o.HKReactEmbed=y,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),o})({},React);
1
+ var HKEmbed=(function(y,P){"use strict";const h="http://localhost:3000";async function G(u,t){try{const n=await fetch(`${h}/api/v1/company/generate-token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({api_secret:u,id:t})}),l=await n.json();if(n.ok)return l.token;console.error("Error fetching token: please confirm your API Secret and Client ID",l)}catch(n){console.error("Fetch error:",n)}}const V={root:"/company",renders:"/renders",spaces:"/spaces"};class U{container;iframe;currentToken;created=!1;constructor(t){const{container:n}=t;if(!n)throw new Error("Container element is required");this.container=n,this.create(t)}async create(t){if(this.created)return;const{clientId:n,apiKey:l,path:c="root",width:o="100%",height:m="100%",enablePathSync:R=!0}=t,v=new URL(window.location.href),b=v.searchParams.get("ifpath")||V[c],O=h.endsWith("/")?h:h+"/",p=b.startsWith("/")?b.substring(1):b,w=new URL(p,O),k=await G(l,n);this.currentToken=k,k&&w.searchParams.set("token",k);const f=document.createElement("iframe");return f.src=w.toString(),f.style.border="0",f.style.width=isNaN(Number(o))?o:`${o}px`,f.style.height=isNaN(Number(m))?m:`${m}px`,console.log("applying user styles/sizing"),this.iframe=f,f.onload=()=>{this.currentToken&&this.sendMessage({type:"SET_TOKEN",token:this.currentToken})},this.container.innerHTML="",this.container.appendChild(f),R&&(v.searchParams.set("ifpath",b),window.history.replaceState({},"",v.toString())),this.setupMessageHandling(),this.created=!0,{sendMessage:this.sendMessage.bind(this),onMessage:this.onMessage.bind(this)}}setupMessageHandling(){window.addEventListener("message",t=>{t.data?.type==="ROUTE_CHANGE"&&this.onRouteChange(t.data.path)})}onRouteChange(t){this.inputParentRoute(t),this.inputIframeRoute(t)}inputParentRoute(t){const n=new URL(window.location.href);n.searchParams.set("ifpath",t),window.history.replaceState({},"",n.toString())}inputIframeRoute(t){if(!this.iframe)return;const n=new URL(this.iframe.src),l=h.endsWith("/")?h:h+"/",c=t.startsWith("/")?t.substring(1):t,o=new URL(c,l);n.pathname!==o.pathname&&(this.iframe.src=o.toString())}sendMessage(t){if(this.iframe?.contentWindow){const n=new URL(h).origin;this.iframe.contentWindow.postMessage(t,n)}}onMessage(t){window.addEventListener("message",n=>{t(n.data)})}}var S={exports:{}},g={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var M;function q(){if(M)return g;M=1;var u=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(l,c,o){var m=null;if(o!==void 0&&(m=""+o),c.key!==void 0&&(m=""+c.key),"key"in c){o={};for(var R in c)R!=="key"&&(o[R]=c[R])}else o=c;return c=o.ref,{$$typeof:u,type:l,key:m,ref:c!==void 0?c:null,props:o}}return g.Fragment=t,g.jsx=n,g.jsxs=n,g}var T={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var L;function K(){return L||(L=1,process.env.NODE_ENV!=="production"&&(function(){function u(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ce?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case f:return"Fragment";case ee:return"Profiler";case Q:return"StrictMode";case ae:return"Suspense";case oe:return"SuspenseList";case ie:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case k:return"Portal";case te:return(e.displayName||"Context")+".Provider";case re:return(e._context.displayName||"Context")+".Consumer";case ne:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case se:return r=e.displayName||null,r!==null?r:u(e.type)||"Memo";case W:r=e._payload,e=e._init;try{return u(e(r))}catch{}}return null}function t(e){return""+e}function n(e){try{t(e);var r=!1}catch{r=!0}if(r){r=console;var a=r.error,s=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return a.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",s),t(e)}}function l(e){if(e===f)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===W)return"<...>";try{var r=u(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function c(){var e=A.A;return e===null?null:e.getOwner()}function o(){return Error("react-stack-top-frame")}function m(e){if(F.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function R(e,r){function a(){D||(D=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}a.isReactWarning=!0,Object.defineProperty(e,"key",{get:a,configurable:!0})}function v(){var e=u(this.type);return H[e]||(H[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function Y(e,r,a,s,E,d,N,x){return a=d.ref,e={$$typeof:w,type:e,key:r,props:d,_owner:E},(a!==void 0?a:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:v}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:N}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:x}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function b(e,r,a,s,E,d,N,x){var i=r.children;if(i!==void 0)if(s)if(ue(i)){for(s=0;s<i.length;s++)O(i[s]);Object.freeze&&Object.freeze(i)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else O(i);if(F.call(r,"key")){i=u(e);var _=Object.keys(r).filter(function(le){return le!=="key"});s=0<_.length?"{key: someKey, "+_.join(": ..., ")+": ...}":"{key: someKey}",z[i+s]||(_=0<_.length?"{"+_.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
+ let props = %s;
19
+ <%s {...props} />
20
+ React keys must be passed directly to JSX without using spread:
21
+ let props = %s;
22
+ <%s key={someKey} {...props} />`,s,i,_,i),z[i+s]=!0)}if(i=null,a!==void 0&&(n(a),i=""+a),m(r)&&(n(r.key),i=""+r.key),"key"in r){a={};for(var C in r)C!=="key"&&(a[C]=r[C])}else a=r;return i&&R(a,typeof e=="function"?e.displayName||e.name||"Unknown":e),Y(e,i,d,E,c(),a,N,x)}function O(e){typeof e=="object"&&e!==null&&e.$$typeof===w&&e._store&&(e._store.validated=1)}var p=P,w=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),ee=Symbol.for("react.profiler"),re=Symbol.for("react.consumer"),te=Symbol.for("react.context"),ne=Symbol.for("react.forward_ref"),ae=Symbol.for("react.suspense"),oe=Symbol.for("react.suspense_list"),se=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),ie=Symbol.for("react.activity"),ce=Symbol.for("react.client.reference"),A=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,ue=Array.isArray,j=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function(e){return e()}};var D,H={},$=p.react_stack_bottom_frame.bind(p,o)(),J=j(l(o)),z={};T.Fragment=f,T.jsx=function(e,r,a,s,E){var d=1e4>A.recentlyCreatedOwnerStacks++;return b(e,r,a,!1,s,E,d?Error("react-stack-top-frame"):$,d?j(l(e)):J)},T.jsxs=function(e,r,a,s,E){var d=1e4>A.recentlyCreatedOwnerStacks++;return b(e,r,a,!0,s,E,d?Error("react-stack-top-frame"):$,d?j(l(e)):J)}})()),T}var I;function X(){return I||(I=1,process.env.NODE_ENV==="production"?S.exports=q():S.exports=K()),S.exports}var B=X();const Z=u=>{const t=P.useRef(null),n=P.useRef(null);return P.useLayoutEffect(()=>(t.current&&!n.current&&(n.current=new U({...u,container:t.current})),()=>{n.current=null}),[u]),B.jsx("div",{ref:t,style:u.style})};return y.HKEmbed=U,y.HKReactEmbed=Z,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"}),y})({},React);
@@ -1 +1,22 @@
1
- (function(n,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],r):(n=typeof globalThis<"u"?globalThis:n||self,r(n.HKEmbed={},n.React))})(this,(function(n,r){"use strict";const s="http://localhost:3000";async function g(a,e){try{const t=await fetch(`${s}/api/v1/company/generate-token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({api_secret:a,id:e})}),o=await t.json();if(t.ok)return o.token;console.error("Error fetching token: please confirm your API Secret and Client ID",o)}catch(t){console.error("Fetch error:",t)}}const w={root:"/company",renders:"/renders",spaces:"/spaces"};class m{container;iframe;currentToken;created=!1;constructor(e){const{container:t}=e;if(!t)throw new Error("Container element is required");this.container=t,this.create(e)}async create(e){if(this.created)return;const{clientId:t,apiKey:o,path:d="root",width:c="100%",height:u="100%",enablePathSync:R=!0}=e,f=new URL(window.location.href),h=f.searchParams.get("ifpath")||w[d],b=s.endsWith("/")?s:s+"/",E=h.startsWith("/")?h.substring(1):h,p=new URL(E,b),l=await g(o,t);this.currentToken=l,l&&p.searchParams.set("token",l);const i=document.createElement("iframe");return i.src=p.toString(),i.style.border="0",i.style.width=isNaN(Number(c))?c:`${c}px`,i.style.height=isNaN(Number(u))?u:`${u}px`,console.log("applying user styles/sizing"),this.iframe=i,i.onload=()=>{this.currentToken&&this.sendMessage({type:"SET_TOKEN",token:this.currentToken})},this.container.innerHTML="",this.container.appendChild(i),R&&(f.searchParams.set("ifpath",h),window.history.replaceState({},"",f.toString())),this.setupMessageHandling(),this.created=!0,{sendMessage:this.sendMessage.bind(this),onMessage:this.onMessage.bind(this)}}setupMessageHandling(){window.addEventListener("message",e=>{e.data?.type==="ROUTE_CHANGE"&&this.onRouteChange(e.data.path)})}onRouteChange(e){this.inputParentRoute(e),this.inputIframeRoute(e)}inputParentRoute(e){const t=new URL(window.location.href);t.searchParams.set("ifpath",e),window.history.replaceState({},"",t.toString())}inputIframeRoute(e){if(!this.iframe)return;const t=new URL(this.iframe.src),o=s.endsWith("/")?s:s+"/",d=e.startsWith("/")?e.substring(1):e,c=new URL(d,o);t.pathname!==c.pathname&&(this.iframe.src=c.toString())}sendMessage(e){if(this.iframe?.contentWindow){const t=new URL(s).origin;this.iframe.contentWindow.postMessage(e,t)}}onMessage(e){window.addEventListener("message",t=>{e(t.data)})}}const y=a=>{const e=r.useRef(null),t=r.useRef(null);return r.useLayoutEffect(()=>(e.current&&!t.current&&(t.current=new m({...a,container:e.current})),()=>{t.current=null}),[a]),React.createElement("div",{ref:e,style:a.style})};n.HKEmbed=m,n.HKReactEmbed=y,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(h,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],E):(h=typeof globalThis<"u"?globalThis:h||self,E(h.HKEmbed={},h.React))})(this,(function(h,E){"use strict";const p="http://localhost:3000";async function G(u,t){try{const n=await fetch(`${p}/api/v1/company/generate-token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({api_secret:u,id:t})}),l=await n.json();if(n.ok)return l.token;console.error("Error fetching token: please confirm your API Secret and Client ID",l)}catch(n){console.error("Fetch error:",n)}}const V={root:"/company",renders:"/renders",spaces:"/spaces"};class U{container;iframe;currentToken;created=!1;constructor(t){const{container:n}=t;if(!n)throw new Error("Container element is required");this.container=n,this.create(t)}async create(t){if(this.created)return;const{clientId:n,apiKey:l,path:c="root",width:o="100%",height:m="100%",enablePathSync:b=!0}=t,k=new URL(window.location.href),T=k.searchParams.get("ifpath")||V[c],O=p.endsWith("/")?p:p+"/",_=T.startsWith("/")?T.substring(1):T,y=new URL(_,O),P=await G(l,n);this.currentToken=P,P&&y.searchParams.set("token",P);const f=document.createElement("iframe");return f.src=y.toString(),f.style.border="0",f.style.width=isNaN(Number(o))?o:`${o}px`,f.style.height=isNaN(Number(m))?m:`${m}px`,console.log("applying user styles/sizing"),this.iframe=f,f.onload=()=>{this.currentToken&&this.sendMessage({type:"SET_TOKEN",token:this.currentToken})},this.container.innerHTML="",this.container.appendChild(f),b&&(k.searchParams.set("ifpath",T),window.history.replaceState({},"",k.toString())),this.setupMessageHandling(),this.created=!0,{sendMessage:this.sendMessage.bind(this),onMessage:this.onMessage.bind(this)}}setupMessageHandling(){window.addEventListener("message",t=>{t.data?.type==="ROUTE_CHANGE"&&this.onRouteChange(t.data.path)})}onRouteChange(t){this.inputParentRoute(t),this.inputIframeRoute(t)}inputParentRoute(t){const n=new URL(window.location.href);n.searchParams.set("ifpath",t),window.history.replaceState({},"",n.toString())}inputIframeRoute(t){if(!this.iframe)return;const n=new URL(this.iframe.src),l=p.endsWith("/")?p:p+"/",c=t.startsWith("/")?t.substring(1):t,o=new URL(c,l);n.pathname!==o.pathname&&(this.iframe.src=o.toString())}sendMessage(t){if(this.iframe?.contentWindow){const n=new URL(p).origin;this.iframe.contentWindow.postMessage(t,n)}}onMessage(t){window.addEventListener("message",n=>{t(n.data)})}}var S={exports:{}},v={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var M;function q(){if(M)return v;M=1;var u=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(l,c,o){var m=null;if(o!==void 0&&(m=""+o),c.key!==void 0&&(m=""+c.key),"key"in c){o={};for(var b in c)b!=="key"&&(o[b]=c[b])}else o=c;return c=o.ref,{$$typeof:u,type:l,key:m,ref:c!==void 0?c:null,props:o}}return v.Fragment=t,v.jsx=n,v.jsxs=n,v}var w={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var L;function K(){return L||(L=1,process.env.NODE_ENV!=="production"&&(function(){function u(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ce?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case f:return"Fragment";case ee:return"Profiler";case Q:return"StrictMode";case ae:return"Suspense";case oe:return"SuspenseList";case ie:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case P:return"Portal";case te:return(e.displayName||"Context")+".Provider";case re:return(e._context.displayName||"Context")+".Consumer";case ne:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case se:return r=e.displayName||null,r!==null?r:u(e.type)||"Memo";case W:r=e._payload,e=e._init;try{return u(e(r))}catch{}}return null}function t(e){return""+e}function n(e){try{t(e);var r=!1}catch{r=!0}if(r){r=console;var a=r.error,s=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return a.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",s),t(e)}}function l(e){if(e===f)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===W)return"<...>";try{var r=u(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function c(){var e=A.A;return e===null?null:e.getOwner()}function o(){return Error("react-stack-top-frame")}function m(e){if(F.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function b(e,r){function a(){D||(D=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}a.isReactWarning=!0,Object.defineProperty(e,"key",{get:a,configurable:!0})}function k(){var e=u(this.type);return H[e]||(H[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function Y(e,r,a,s,R,d,x,N){return a=d.ref,e={$$typeof:y,type:e,key:r,props:d,_owner:R},(a!==void 0?a:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:k}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:x}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:N}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function T(e,r,a,s,R,d,x,N){var i=r.children;if(i!==void 0)if(s)if(ue(i)){for(s=0;s<i.length;s++)O(i[s]);Object.freeze&&Object.freeze(i)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else O(i);if(F.call(r,"key")){i=u(e);var g=Object.keys(r).filter(function(le){return le!=="key"});s=0<g.length?"{key: someKey, "+g.join(": ..., ")+": ...}":"{key: someKey}",z[i+s]||(g=0<g.length?"{"+g.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
+ let props = %s;
19
+ <%s {...props} />
20
+ React keys must be passed directly to JSX without using spread:
21
+ let props = %s;
22
+ <%s key={someKey} {...props} />`,s,i,g,i),z[i+s]=!0)}if(i=null,a!==void 0&&(n(a),i=""+a),m(r)&&(n(r.key),i=""+r.key),"key"in r){a={};for(var C in r)C!=="key"&&(a[C]=r[C])}else a=r;return i&&b(a,typeof e=="function"?e.displayName||e.name||"Unknown":e),Y(e,i,d,R,c(),a,x,N)}function O(e){typeof e=="object"&&e!==null&&e.$$typeof===y&&e._store&&(e._store.validated=1)}var _=E,y=Symbol.for("react.transitional.element"),P=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),ee=Symbol.for("react.profiler"),re=Symbol.for("react.consumer"),te=Symbol.for("react.context"),ne=Symbol.for("react.forward_ref"),ae=Symbol.for("react.suspense"),oe=Symbol.for("react.suspense_list"),se=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),ie=Symbol.for("react.activity"),ce=Symbol.for("react.client.reference"),A=_.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,ue=Array.isArray,j=console.createTask?console.createTask:function(){return null};_={react_stack_bottom_frame:function(e){return e()}};var D,H={},$=_.react_stack_bottom_frame.bind(_,o)(),J=j(l(o)),z={};w.Fragment=f,w.jsx=function(e,r,a,s,R){var d=1e4>A.recentlyCreatedOwnerStacks++;return T(e,r,a,!1,s,R,d?Error("react-stack-top-frame"):$,d?j(l(e)):J)},w.jsxs=function(e,r,a,s,R){var d=1e4>A.recentlyCreatedOwnerStacks++;return T(e,r,a,!0,s,R,d?Error("react-stack-top-frame"):$,d?j(l(e)):J)}})()),w}var I;function X(){return I||(I=1,process.env.NODE_ENV==="production"?S.exports=q():S.exports=K()),S.exports}var B=X();const Z=u=>{const t=E.useRef(null),n=E.useRef(null);return E.useLayoutEffect(()=>(t.current&&!n.current&&(n.current=new U({...u,container:t.current})),()=>{n.current=null}),[u]),B.jsx("div",{ref:t,style:u.style})};h.HKEmbed=U,h.HKReactEmbed=Z,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})}));
package/dist/index.cjs CHANGED
@@ -1 +1,22 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react"),n="http://localhost:3000";async function y(s,e){try{const t=await fetch(`${n}/api/v1/company/generate-token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({api_secret:s,id:e})}),a=await t.json();if(t.ok)return a.token;console.error("Error fetching token: please confirm your API Secret and Client ID",a)}catch(t){console.error("Fetch error:",t)}}const R={root:"/company",renders:"/renders",spaces:"/spaces"};class g{container;iframe;currentToken;created=!1;constructor(e){const{container:t}=e;if(!t)throw new Error("Container element is required");this.container=t,this.create(e)}async create(e){if(this.created)return;const{clientId:t,apiKey:a,path:c="root",width:i="100%",height:h="100%",enablePathSync:m=!0}=e,d=new URL(window.location.href),o=d.searchParams.get("ifpath")||R[c],p=n.endsWith("/")?n:n+"/",w=o.startsWith("/")?o.substring(1):o,f=new URL(w,p),u=await y(a,t);this.currentToken=u,u&&f.searchParams.set("token",u);const r=document.createElement("iframe");return r.src=f.toString(),r.style.border="0",r.style.width=isNaN(Number(i))?i:`${i}px`,r.style.height=isNaN(Number(h))?h:`${h}px`,console.log("applying user styles/sizing"),this.iframe=r,r.onload=()=>{this.currentToken&&this.sendMessage({type:"SET_TOKEN",token:this.currentToken})},this.container.innerHTML="",this.container.appendChild(r),m&&(d.searchParams.set("ifpath",o),window.history.replaceState({},"",d.toString())),this.setupMessageHandling(),this.created=!0,{sendMessage:this.sendMessage.bind(this),onMessage:this.onMessage.bind(this)}}setupMessageHandling(){window.addEventListener("message",e=>{e.data?.type==="ROUTE_CHANGE"&&this.onRouteChange(e.data.path)})}onRouteChange(e){this.inputParentRoute(e),this.inputIframeRoute(e)}inputParentRoute(e){const t=new URL(window.location.href);t.searchParams.set("ifpath",e),window.history.replaceState({},"",t.toString())}inputIframeRoute(e){if(!this.iframe)return;const t=new URL(this.iframe.src),a=n.endsWith("/")?n:n+"/",c=e.startsWith("/")?e.substring(1):e,i=new URL(c,a);t.pathname!==i.pathname&&(this.iframe.src=i.toString())}sendMessage(e){if(this.iframe?.contentWindow){const t=new URL(n).origin;this.iframe.contentWindow.postMessage(e,t)}}onMessage(e){window.addEventListener("message",t=>{e(t.data)})}}const b=s=>{const e=l.useRef(null),t=l.useRef(null);return l.useLayoutEffect(()=>(e.current&&!t.current&&(t.current=new g({...s,container:e.current})),()=>{t.current=null}),[s]),React.createElement("div",{ref:e,style:s.style})};exports.HKEmbed=g;exports.HKReactEmbed=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react"),E="http://localhost:3000";async function ne(u,t){try{const n=await fetch(`${E}/api/v1/company/generate-token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({api_secret:u,id:t})}),l=await n.json();if(n.ok)return l.token;console.error("Error fetching token: please confirm your API Secret and Client ID",l)}catch(n){console.error("Fetch error:",n)}}const ae={root:"/company",renders:"/renders",spaces:"/spaces"};class H{container;iframe;currentToken;created=!1;constructor(t){const{container:n}=t;if(!n)throw new Error("Container element is required");this.container=n,this.create(t)}async create(t){if(this.created)return;const{clientId:n,apiKey:l,path:c="root",width:o="100%",height:m="100%",enablePathSync:R=!0}=t,g=new URL(window.location.href),p=g.searchParams.get("ifpath")||ae[c],y=E.endsWith("/")?E:E+"/",b=p.startsWith("/")?p.substring(1):p,T=new URL(b,y),v=await ne(l,n);this.currentToken=v,v&&T.searchParams.set("token",v);const f=document.createElement("iframe");return f.src=T.toString(),f.style.border="0",f.style.width=isNaN(Number(o))?o:`${o}px`,f.style.height=isNaN(Number(m))?m:`${m}px`,console.log("applying user styles/sizing"),this.iframe=f,f.onload=()=>{this.currentToken&&this.sendMessage({type:"SET_TOKEN",token:this.currentToken})},this.container.innerHTML="",this.container.appendChild(f),R&&(g.searchParams.set("ifpath",p),window.history.replaceState({},"",g.toString())),this.setupMessageHandling(),this.created=!0,{sendMessage:this.sendMessage.bind(this),onMessage:this.onMessage.bind(this)}}setupMessageHandling(){window.addEventListener("message",t=>{t.data?.type==="ROUTE_CHANGE"&&this.onRouteChange(t.data.path)})}onRouteChange(t){this.inputParentRoute(t),this.inputIframeRoute(t)}inputParentRoute(t){const n=new URL(window.location.href);n.searchParams.set("ifpath",t),window.history.replaceState({},"",n.toString())}inputIframeRoute(t){if(!this.iframe)return;const n=new URL(this.iframe.src),l=E.endsWith("/")?E:E+"/",c=t.startsWith("/")?t.substring(1):t,o=new URL(c,l);n.pathname!==o.pathname&&(this.iframe.src=o.toString())}sendMessage(t){if(this.iframe?.contentWindow){const n=new URL(E).origin;this.iframe.contentWindow.postMessage(t,n)}}onMessage(t){window.addEventListener("message",n=>{t(n.data)})}}var P={exports:{}},w={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var F;function oe(){if(F)return w;F=1;var u=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(l,c,o){var m=null;if(o!==void 0&&(m=""+o),c.key!==void 0&&(m=""+c.key),"key"in c){o={};for(var R in c)R!=="key"&&(o[R]=c[R])}else o=c;return c=o.ref,{$$typeof:u,type:l,key:m,ref:c!==void 0?c:null,props:o}}return w.Fragment=t,w.jsx=n,w.jsxs=n,w}var k={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var D;function se(){return D||(D=1,process.env.NODE_ENV!=="production"&&(function(){function u(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ee?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case f:return"Fragment";case z:return"Profiler";case J:return"StrictMode";case K:return"Suspense";case B:return"SuspenseList";case Q:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case v:return"Portal";case V:return(e.displayName||"Context")+".Provider";case G:return(e._context.displayName||"Context")+".Consumer";case X:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Z:return r=e.displayName||null,r!==null?r:u(e.type)||"Memo";case U:r=e._payload,e=e._init;try{return u(e(r))}catch{}}return null}function t(e){return""+e}function n(e){try{t(e);var r=!1}catch{r=!0}if(r){r=console;var a=r.error,s=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return a.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",s),t(e)}}function l(e){if(e===f)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===U)return"<...>";try{var r=u(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function c(){var e=O.A;return e===null?null:e.getOwner()}function o(){return Error("react-stack-top-frame")}function m(e){if(M.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function R(e,r){function a(){L||(L=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}a.isReactWarning=!0,Object.defineProperty(e,"key",{get:a,configurable:!0})}function g(){var e=u(this.type);return I[e]||(I[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function C(e,r,a,s,h,d,j,N){return a=d.ref,e={$$typeof:T,type:e,key:r,props:d,_owner:h},(a!==void 0?a:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:g}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:j}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:N}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function p(e,r,a,s,h,d,j,N){var i=r.children;if(i!==void 0)if(s)if(re(i)){for(s=0;s<i.length;s++)y(i[s]);Object.freeze&&Object.freeze(i)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else y(i);if(M.call(r,"key")){i=u(e);var _=Object.keys(r).filter(function(te){return te!=="key"});s=0<_.length?"{key: someKey, "+_.join(": ..., ")+": ...}":"{key: someKey}",W[i+s]||(_=0<_.length?"{"+_.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
+ let props = %s;
19
+ <%s {...props} />
20
+ React keys must be passed directly to JSX without using spread:
21
+ let props = %s;
22
+ <%s key={someKey} {...props} />`,s,i,_,i),W[i+s]=!0)}if(i=null,a!==void 0&&(n(a),i=""+a),m(r)&&(n(r.key),i=""+r.key),"key"in r){a={};for(var x in r)x!=="key"&&(a[x]=r[x])}else a=r;return i&&R(a,typeof e=="function"?e.displayName||e.name||"Unknown":e),C(e,i,d,h,c(),a,j,N)}function y(e){typeof e=="object"&&e!==null&&e.$$typeof===T&&e._store&&(e._store.validated=1)}var b=S,T=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),J=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),G=Symbol.for("react.consumer"),V=Symbol.for("react.context"),X=Symbol.for("react.forward_ref"),K=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),ee=Symbol.for("react.client.reference"),O=b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=Object.prototype.hasOwnProperty,re=Array.isArray,A=console.createTask?console.createTask:function(){return null};b={react_stack_bottom_frame:function(e){return e()}};var L,I={},Y=b.react_stack_bottom_frame.bind(b,o)(),$=A(l(o)),W={};k.Fragment=f,k.jsx=function(e,r,a,s,h){var d=1e4>O.recentlyCreatedOwnerStacks++;return p(e,r,a,!1,s,h,d?Error("react-stack-top-frame"):Y,d?A(l(e)):$)},k.jsxs=function(e,r,a,s,h){var d=1e4>O.recentlyCreatedOwnerStacks++;return p(e,r,a,!0,s,h,d?Error("react-stack-top-frame"):Y,d?A(l(e)):$)}})()),k}var q;function ie(){return q||(q=1,process.env.NODE_ENV==="production"?P.exports=oe():P.exports=se()),P.exports}var ce=ie();const ue=u=>{const t=S.useRef(null),n=S.useRef(null);return S.useLayoutEffect(()=>(t.current&&!n.current&&(n.current=new H({...u,container:t.current})),()=>{n.current=null}),[u]),ce.jsx("div",{ref:t,style:u.style})};exports.HKEmbed=H;exports.HKReactEmbed=ue;
package/dist/index.js CHANGED
@@ -1,100 +1,380 @@
1
- import { useRef as f, useLayoutEffect as w } from "react";
2
- const n = "http://localhost:3000";
3
- async function y(s, e) {
1
+ import te, { useRef as W, useLayoutEffect as ne } from "react";
2
+ const E = "http://localhost:3000";
3
+ async function ae(u, t) {
4
4
  try {
5
- const t = await fetch(`${n}/api/v1/company/generate-token`, {
5
+ const n = await fetch(`${E}/api/v1/company/generate-token`, {
6
6
  method: "POST",
7
7
  headers: {
8
8
  "Content-Type": "application/json"
9
9
  },
10
- body: JSON.stringify({ api_secret: s, id: e })
11
- }), a = await t.json();
12
- if (t.ok)
13
- return a.token;
10
+ body: JSON.stringify({ api_secret: u, id: t })
11
+ }), l = await n.json();
12
+ if (n.ok)
13
+ return l.token;
14
14
  console.error(
15
15
  "Error fetching token: please confirm your API Secret and Client ID",
16
- a
16
+ l
17
17
  );
18
- } catch (t) {
19
- console.error("Fetch error:", t);
18
+ } catch (n) {
19
+ console.error("Fetch error:", n);
20
20
  }
21
21
  }
22
- const R = {
22
+ const oe = {
23
23
  root: "/company",
24
24
  renders: "/renders",
25
25
  spaces: "/spaces"
26
26
  };
27
- class b {
27
+ class se {
28
28
  container;
29
29
  iframe;
30
30
  currentToken;
31
31
  created = !1;
32
- constructor(e) {
33
- const { container: t } = e;
34
- if (!t) throw new Error("Container element is required");
35
- this.container = t, this.create(e);
32
+ constructor(t) {
33
+ const { container: n } = t;
34
+ if (!n) throw new Error("Container element is required");
35
+ this.container = n, this.create(t);
36
36
  }
37
- async create(e) {
37
+ async create(t) {
38
38
  if (this.created) return;
39
39
  const {
40
- clientId: t,
41
- apiKey: a,
40
+ clientId: n,
41
+ apiKey: l,
42
42
  path: c = "root",
43
- width: i = "100%",
44
- height: h = "100%",
45
- enablePathSync: g = !0
46
- } = e, d = new URL(window.location.href), o = d.searchParams.get("ifpath") || R[c], m = n.endsWith("/") ? n : n + "/", p = o.startsWith("/") ? o.substring(1) : o, l = new URL(p, m), u = await y(a, t);
47
- this.currentToken = u, u && l.searchParams.set("token", u);
48
- const r = document.createElement("iframe");
49
- return r.src = l.toString(), r.style.border = "0", r.style.width = isNaN(Number(i)) ? i : `${i}px`, r.style.height = isNaN(Number(h)) ? h : `${h}px`, console.log("applying user styles/sizing"), this.iframe = r, r.onload = () => {
43
+ width: o = "100%",
44
+ height: m = "100%",
45
+ enablePathSync: R = !0
46
+ } = t, T = new URL(window.location.href), p = T.searchParams.get("ifpath") || oe[c], y = E.endsWith("/") ? E : E + "/", b = p.startsWith("/") ? p.substring(1) : p, g = new URL(b, y), v = await ae(l, n);
47
+ this.currentToken = v, v && g.searchParams.set("token", v);
48
+ const f = document.createElement("iframe");
49
+ return f.src = g.toString(), f.style.border = "0", f.style.width = isNaN(Number(o)) ? o : `${o}px`, f.style.height = isNaN(Number(m)) ? m : `${m}px`, console.log("applying user styles/sizing"), this.iframe = f, f.onload = () => {
50
50
  this.currentToken && this.sendMessage({
51
51
  type: "SET_TOKEN",
52
52
  token: this.currentToken
53
53
  });
54
- }, this.container.innerHTML = "", this.container.appendChild(r), g && (d.searchParams.set("ifpath", o), window.history.replaceState({}, "", d.toString())), this.setupMessageHandling(), this.created = !0, {
54
+ }, this.container.innerHTML = "", this.container.appendChild(f), R && (T.searchParams.set("ifpath", p), window.history.replaceState({}, "", T.toString())), this.setupMessageHandling(), this.created = !0, {
55
55
  sendMessage: this.sendMessage.bind(this),
56
56
  onMessage: this.onMessage.bind(this)
57
57
  };
58
58
  }
59
59
  setupMessageHandling() {
60
- window.addEventListener("message", (e) => {
61
- e.data?.type === "ROUTE_CHANGE" && this.onRouteChange(e.data.path);
60
+ window.addEventListener("message", (t) => {
61
+ t.data?.type === "ROUTE_CHANGE" && this.onRouteChange(t.data.path);
62
62
  });
63
63
  }
64
- onRouteChange(e) {
65
- this.inputParentRoute(e), this.inputIframeRoute(e);
64
+ onRouteChange(t) {
65
+ this.inputParentRoute(t), this.inputIframeRoute(t);
66
66
  }
67
- inputParentRoute(e) {
68
- const t = new URL(window.location.href);
69
- t.searchParams.set("ifpath", e), window.history.replaceState({}, "", t.toString());
67
+ inputParentRoute(t) {
68
+ const n = new URL(window.location.href);
69
+ n.searchParams.set("ifpath", t), window.history.replaceState({}, "", n.toString());
70
70
  }
71
- inputIframeRoute(e) {
71
+ inputIframeRoute(t) {
72
72
  if (!this.iframe) return;
73
- const t = new URL(this.iframe.src), a = n.endsWith("/") ? n : n + "/", c = e.startsWith("/") ? e.substring(1) : e, i = new URL(c, a);
74
- t.pathname !== i.pathname && (this.iframe.src = i.toString());
73
+ const n = new URL(this.iframe.src), l = E.endsWith("/") ? E : E + "/", c = t.startsWith("/") ? t.substring(1) : t, o = new URL(c, l);
74
+ n.pathname !== o.pathname && (this.iframe.src = o.toString());
75
75
  }
76
- sendMessage(e) {
76
+ sendMessage(t) {
77
77
  if (this.iframe?.contentWindow) {
78
- const t = new URL(n).origin;
79
- this.iframe.contentWindow.postMessage(e, t);
78
+ const n = new URL(E).origin;
79
+ this.iframe.contentWindow.postMessage(t, n);
80
80
  }
81
81
  }
82
- onMessage(e) {
83
- window.addEventListener("message", (t) => {
84
- e(t.data);
82
+ onMessage(t) {
83
+ window.addEventListener("message", (n) => {
84
+ t(n.data);
85
85
  });
86
86
  }
87
87
  }
88
- const U = (s) => {
89
- const e = f(null), t = f(null);
90
- return w(() => (e.current && !t.current && (t.current = new b({
91
- ...s,
92
- container: e.current
88
+ var P = { exports: {} }, w = {};
89
+ /**
90
+ * @license React
91
+ * react-jsx-runtime.production.js
92
+ *
93
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
94
+ *
95
+ * This source code is licensed under the MIT license found in the
96
+ * LICENSE file in the root directory of this source tree.
97
+ */
98
+ var F;
99
+ function ie() {
100
+ if (F) return w;
101
+ F = 1;
102
+ var u = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
103
+ function n(l, c, o) {
104
+ var m = null;
105
+ if (o !== void 0 && (m = "" + o), c.key !== void 0 && (m = "" + c.key), "key" in c) {
106
+ o = {};
107
+ for (var R in c)
108
+ R !== "key" && (o[R] = c[R]);
109
+ } else o = c;
110
+ return c = o.ref, {
111
+ $$typeof: u,
112
+ type: l,
113
+ key: m,
114
+ ref: c !== void 0 ? c : null,
115
+ props: o
116
+ };
117
+ }
118
+ return w.Fragment = t, w.jsx = n, w.jsxs = n, w;
119
+ }
120
+ var k = {};
121
+ /**
122
+ * @license React
123
+ * react-jsx-runtime.development.js
124
+ *
125
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
126
+ *
127
+ * This source code is licensed under the MIT license found in the
128
+ * LICENSE file in the root directory of this source tree.
129
+ */
130
+ var D;
131
+ function ce() {
132
+ return D || (D = 1, process.env.NODE_ENV !== "production" && (function() {
133
+ function u(e) {
134
+ if (e == null) return null;
135
+ if (typeof e == "function")
136
+ return e.$$typeof === Q ? null : e.displayName || e.name || null;
137
+ if (typeof e == "string") return e;
138
+ switch (e) {
139
+ case f:
140
+ return "Fragment";
141
+ case z:
142
+ return "Profiler";
143
+ case J:
144
+ return "StrictMode";
145
+ case X:
146
+ return "Suspense";
147
+ case B:
148
+ return "SuspenseList";
149
+ case Z:
150
+ return "Activity";
151
+ }
152
+ if (typeof e == "object")
153
+ switch (typeof e.tag == "number" && console.error(
154
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
155
+ ), e.$$typeof) {
156
+ case v:
157
+ return "Portal";
158
+ case G:
159
+ return (e.displayName || "Context") + ".Provider";
160
+ case H:
161
+ return (e._context.displayName || "Context") + ".Consumer";
162
+ case V:
163
+ var r = e.render;
164
+ return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
165
+ case K:
166
+ return r = e.displayName || null, r !== null ? r : u(e.type) || "Memo";
167
+ case C:
168
+ r = e._payload, e = e._init;
169
+ try {
170
+ return u(e(r));
171
+ } catch {
172
+ }
173
+ }
174
+ return null;
175
+ }
176
+ function t(e) {
177
+ return "" + e;
178
+ }
179
+ function n(e) {
180
+ try {
181
+ t(e);
182
+ var r = !1;
183
+ } catch {
184
+ r = !0;
185
+ }
186
+ if (r) {
187
+ r = console;
188
+ var a = r.error, s = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
189
+ return a.call(
190
+ r,
191
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
192
+ s
193
+ ), t(e);
194
+ }
195
+ }
196
+ function l(e) {
197
+ if (e === f) return "<>";
198
+ if (typeof e == "object" && e !== null && e.$$typeof === C)
199
+ return "<...>";
200
+ try {
201
+ var r = u(e);
202
+ return r ? "<" + r + ">" : "<...>";
203
+ } catch {
204
+ return "<...>";
205
+ }
206
+ }
207
+ function c() {
208
+ var e = S.A;
209
+ return e === null ? null : e.getOwner();
210
+ }
211
+ function o() {
212
+ return Error("react-stack-top-frame");
213
+ }
214
+ function m(e) {
215
+ if (U.call(e, "key")) {
216
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
217
+ if (r && r.isReactWarning) return !1;
218
+ }
219
+ return e.key !== void 0;
220
+ }
221
+ function R(e, r) {
222
+ function a() {
223
+ L || (L = !0, console.error(
224
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
225
+ r
226
+ ));
227
+ }
228
+ a.isReactWarning = !0, Object.defineProperty(e, "key", {
229
+ get: a,
230
+ configurable: !0
231
+ });
232
+ }
233
+ function T() {
234
+ var e = u(this.type);
235
+ return M[e] || (M[e] = !0, console.error(
236
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
237
+ )), e = this.props.ref, e !== void 0 ? e : null;
238
+ }
239
+ function N(e, r, a, s, h, d, A, j) {
240
+ return a = d.ref, e = {
241
+ $$typeof: g,
242
+ type: e,
243
+ key: r,
244
+ props: d,
245
+ _owner: h
246
+ }, (a !== void 0 ? a : null) !== null ? Object.defineProperty(e, "ref", {
247
+ enumerable: !1,
248
+ get: T
249
+ }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
250
+ configurable: !1,
251
+ enumerable: !1,
252
+ writable: !0,
253
+ value: 0
254
+ }), Object.defineProperty(e, "_debugInfo", {
255
+ configurable: !1,
256
+ enumerable: !1,
257
+ writable: !0,
258
+ value: null
259
+ }), Object.defineProperty(e, "_debugStack", {
260
+ configurable: !1,
261
+ enumerable: !1,
262
+ writable: !0,
263
+ value: A
264
+ }), Object.defineProperty(e, "_debugTask", {
265
+ configurable: !1,
266
+ enumerable: !1,
267
+ writable: !0,
268
+ value: j
269
+ }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
270
+ }
271
+ function p(e, r, a, s, h, d, A, j) {
272
+ var i = r.children;
273
+ if (i !== void 0)
274
+ if (s)
275
+ if (ee(i)) {
276
+ for (s = 0; s < i.length; s++)
277
+ y(i[s]);
278
+ Object.freeze && Object.freeze(i);
279
+ } else
280
+ console.error(
281
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
282
+ );
283
+ else y(i);
284
+ if (U.call(r, "key")) {
285
+ i = u(e);
286
+ var _ = Object.keys(r).filter(function(re) {
287
+ return re !== "key";
288
+ });
289
+ s = 0 < _.length ? "{key: someKey, " + _.join(": ..., ") + ": ...}" : "{key: someKey}", $[i + s] || (_ = 0 < _.length ? "{" + _.join(": ..., ") + ": ...}" : "{}", console.error(
290
+ `A props object containing a "key" prop is being spread into JSX:
291
+ let props = %s;
292
+ <%s {...props} />
293
+ React keys must be passed directly to JSX without using spread:
294
+ let props = %s;
295
+ <%s key={someKey} {...props} />`,
296
+ s,
297
+ i,
298
+ _,
299
+ i
300
+ ), $[i + s] = !0);
301
+ }
302
+ if (i = null, a !== void 0 && (n(a), i = "" + a), m(r) && (n(r.key), i = "" + r.key), "key" in r) {
303
+ a = {};
304
+ for (var x in r)
305
+ x !== "key" && (a[x] = r[x]);
306
+ } else a = r;
307
+ return i && R(
308
+ a,
309
+ typeof e == "function" ? e.displayName || e.name || "Unknown" : e
310
+ ), N(
311
+ e,
312
+ i,
313
+ d,
314
+ h,
315
+ c(),
316
+ a,
317
+ A,
318
+ j
319
+ );
320
+ }
321
+ function y(e) {
322
+ typeof e == "object" && e !== null && e.$$typeof === g && e._store && (e._store.validated = 1);
323
+ }
324
+ var b = te, g = Symbol.for("react.transitional.element"), v = Symbol.for("react.portal"), f = Symbol.for("react.fragment"), J = Symbol.for("react.strict_mode"), z = Symbol.for("react.profiler"), H = Symbol.for("react.consumer"), G = Symbol.for("react.context"), V = Symbol.for("react.forward_ref"), X = Symbol.for("react.suspense"), B = Symbol.for("react.suspense_list"), K = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), Z = Symbol.for("react.activity"), Q = Symbol.for("react.client.reference"), S = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, U = Object.prototype.hasOwnProperty, ee = Array.isArray, O = console.createTask ? console.createTask : function() {
325
+ return null;
326
+ };
327
+ b = {
328
+ react_stack_bottom_frame: function(e) {
329
+ return e();
330
+ }
331
+ };
332
+ var L, M = {}, I = b.react_stack_bottom_frame.bind(
333
+ b,
334
+ o
335
+ )(), Y = O(l(o)), $ = {};
336
+ k.Fragment = f, k.jsx = function(e, r, a, s, h) {
337
+ var d = 1e4 > S.recentlyCreatedOwnerStacks++;
338
+ return p(
339
+ e,
340
+ r,
341
+ a,
342
+ !1,
343
+ s,
344
+ h,
345
+ d ? Error("react-stack-top-frame") : I,
346
+ d ? O(l(e)) : Y
347
+ );
348
+ }, k.jsxs = function(e, r, a, s, h) {
349
+ var d = 1e4 > S.recentlyCreatedOwnerStacks++;
350
+ return p(
351
+ e,
352
+ r,
353
+ a,
354
+ !0,
355
+ s,
356
+ h,
357
+ d ? Error("react-stack-top-frame") : I,
358
+ d ? O(l(e)) : Y
359
+ );
360
+ };
361
+ })()), k;
362
+ }
363
+ var q;
364
+ function ue() {
365
+ return q || (q = 1, process.env.NODE_ENV === "production" ? P.exports = ie() : P.exports = ce()), P.exports;
366
+ }
367
+ var le = ue();
368
+ const de = (u) => {
369
+ const t = W(null), n = W(null);
370
+ return ne(() => (t.current && !n.current && (n.current = new se({
371
+ ...u,
372
+ container: t.current
93
373
  })), () => {
94
- t.current = null;
95
- }), [s]), /* @__PURE__ */ React.createElement("div", { ref: e, style: s.style });
374
+ n.current = null;
375
+ }), [u]), /* @__PURE__ */ le.jsx("div", { ref: t, style: u.style });
96
376
  };
97
377
  export {
98
- b as HKEmbed,
99
- U as HKReactEmbed
378
+ se as HKEmbed,
379
+ de as HKReactEmbed
100
380
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@homekynd/hk-embed-sdk",
3
3
  "private": false,
4
- "version": "0.0.4",
4
+ "version": "0.0.5",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.js",