@dialstack/sdk-react 3.6.0 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ai-agent.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("react"),t=require("react-dom"),n=require("@dialstack/sdk-react");function s(t,n){const s=e.useRef(null),[r,a]=e.useState(null);return{containerRef:e.useCallback(e=>{if(s.current&&s.current.parentNode&&(s.current.parentNode.removeChild(s.current),s.current=null,a(null)),!e)return;const r=t.create(n);try{!function(e,t){if(!e||"function"!=typeof e.setInstance)throw new Error(`<dialstack-${t}> was created but is not a registered custom element, so it would render nothing. Install @dialstack/sdk-js alongside @dialstack/sdk-react and import it once at your entry point — importing it is what registers the elements. On @dialstack/sdk-js/pure nothing registers on import: await registerComponents() before rendering. If it is installed, check that your bundler is not dropping its side effects.`)}(r,n)}catch(e){throw t.removeAppearanceTarget(r),e}try{r.setAttribute("data-dialstack-sdk-version","3.6.0")}catch(e){console.log("Error setting SDK version attribute:",e)}e.appendChild(r),s.current=r,a(r)},[t,n]),componentInstance:r}}const r=[],a="undefined"==typeof window?e.useEffect:e.useLayoutEffect;function o(e,t,n){a(()=>{if(e&&void 0!==t)try{n(e,t)}catch(e){console.error("DialStack: Error calling setter:",e)}},[e,t,n])}const i=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function d(e){if(0===e.ranges.length)return"Please contact us for our current hours.";const t=new Map;for(const n of e.ranges)t.set(n.day,`${n.start} - ${n.end}`);const n=[];for(const[e,s]of[...t.entries()].sort((e,t)=>e[0]-t[0])){const t=n[n.length-1];t&&t.hours===s&&t.days[t.days.length-1]===e-1?t.days.push(e):n.push({days:[e],hours:s})}return n.map(e=>{var t,n,s,r,a;const o=null!==(t=e.days[0])&&void 0!==t?t:0,d=null!==(n=e.days[e.days.length-1])&&void 0!==n?n:o;return`${1===e.days.length?null!==(s=i[o])&&void 0!==s?s:`Day ${o}`:`${null!==(r=i[o])&&void 0!==r?r:`Day ${o}`} to ${null!==(a=i[d])&&void 0!==a?a:`Day ${d}`}`}: ${e.hours}`}).join("\n")}exports.AIAgent=({agentId:a,mode:i="edit",initialValues:d,secret:l,hideFields:c,onSaved:u,onCreateRequested:f,onSaveRequested:h,onCheckExtensionAvailability:y,onRotateSecretRequested:g,onCreated:p,onError:m,locale:v,beforeActions:k,className:E,style:b})=>{const{dialstack:q}=n.useDialstackComponents(),{containerRef:w,componentInstance:C}=s(q,"ai-agent"),S="create"===i||f||h?"host":"sdk";return o(C,i,(e,t)=>e.setMode(t)),o(C,S,(e,t)=>e.setSubmitMode(t)),o(C,d,(e,t)=>e.setInitialValues(t)),o(C,l,(e,t)=>e.setSecret(t)),o(C,f,(e,t)=>e.setOnCreateRequested(t)),o(C,h,(e,t)=>e.setOnSaveRequested(t)),o(C,y,(e,t)=>e.setOnCheckExtensionAvailability(t)),o(C,g,(e,t)=>e.setOnRotateSecretRequested(t)),o(C,a,(e,t)=>e.setAgentId(t)),o(C,null!=c?c:r,(e,t)=>e.setHideFields(t)),o(C,v,(e,t)=>e.setLocale(t)),e.useEffect(()=>{const e=C;if(!e)return;const t=e=>{const t=e.detail;null==u||u({id:t.agentId})},n=e=>{const t=e.detail;null==p||p(t)},s=e=>{const t=e.detail;null==m||m(t.error)};return e.addEventListener("dialstack:ai-agent:saved",t),e.addEventListener("dialstack:ai-agent:created",n),e.addEventListener("dialstack:ai-agent:error",s),()=>{e.removeEventListener("dialstack:ai-agent:saved",t),e.removeEventListener("dialstack:ai-agent:created",n),e.removeEventListener("dialstack:ai-agent:error",s)}},[C,u,p,m]),e.createElement("div",{ref:w,className:E,style:b},C&&k?t.createPortal(e.createElement("div",{slot:"before-actions"},k),C):null)},exports.buildAIAgentPrefillFaq=function({locations:e,schedules:t,users:n}){const s=[],r=e[0];if(null==r?void 0:r.address){const e=r.address,t=e.formatted_address||[e.address_number,e.street,e.unit,e.city,e.state,e.postal_code].filter(Boolean).join(", ");t&&s.push({question:"What is your address?",answer:`We are located at ${t}.`})}const a=t[0];a&&s.push({question:"What are your business hours?",answer:d(a)});const o=n.map(e=>e.name).filter(e=>!!e);return o.length>0&&s.push({question:"Who are the members of your team?",answer:`Our team includes: ${o.join(", ")}.`}),s},exports.shouldApplyPrefillFaq=function({isCreate:e,prefillCount:t,faqDirty:n}){return e&&t>0&&!n};
1
+ "use strict";var e=require("react"),t=require("react-dom"),n=require("@dialstack/sdk-react");function s(t,n){const s=e.useRef(null),[r,a]=e.useState(null);return{containerRef:e.useCallback(e=>{if(s.current&&s.current.parentNode&&(s.current.parentNode.removeChild(s.current),s.current=null,a(null)),!e)return;const r=t.create(n);try{!function(e,t){if(!e||"function"!=typeof e.setInstance)throw new Error(`<dialstack-${t}> was created but is not a registered custom element, so it would render nothing. Install @dialstack/sdk-js alongside @dialstack/sdk-react and import it once at your entry point — importing it is what registers the elements. On @dialstack/sdk-js/pure nothing registers on import: await registerComponents() before rendering. If it is installed, check that your bundler is not dropping its side effects.`)}(r,n)}catch(e){throw t.removeAppearanceTarget(r),e}try{r.setAttribute("data-dialstack-sdk-version","3.7.0")}catch(e){console.log("Error setting SDK version attribute:",e)}e.appendChild(r),s.current=r,a(r)},[t,n]),componentInstance:r}}const r=[],a="undefined"==typeof window?e.useEffect:e.useLayoutEffect;function o(e,t,n){a(()=>{if(e&&void 0!==t)try{n(e,t)}catch(e){console.error("DialStack: Error calling setter:",e)}},[e,t,n])}const i=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function d(e){if(0===e.ranges.length)return"Please contact us for our current hours.";const t=new Map;for(const n of e.ranges)t.set(n.day,`${n.start} - ${n.end}`);const n=[];for(const[e,s]of[...t.entries()].sort((e,t)=>e[0]-t[0])){const t=n[n.length-1];t&&t.hours===s&&t.days[t.days.length-1]===e-1?t.days.push(e):n.push({days:[e],hours:s})}return n.map(e=>{var t,n,s,r,a;const o=null!==(t=e.days[0])&&void 0!==t?t:0,d=null!==(n=e.days[e.days.length-1])&&void 0!==n?n:o;return`${1===e.days.length?null!==(s=i[o])&&void 0!==s?s:`Day ${o}`:`${null!==(r=i[o])&&void 0!==r?r:`Day ${o}`} to ${null!==(a=i[d])&&void 0!==a?a:`Day ${d}`}`}: ${e.hours}`}).join("\n")}exports.AIAgent=({agentId:a,mode:i="edit",initialValues:d,secret:l,hideFields:c,onSaved:u,onCreateRequested:f,onSaveRequested:h,onCheckExtensionAvailability:y,onRotateSecretRequested:g,onCreated:p,onError:m,locale:v,beforeActions:k,className:E,style:b})=>{const{dialstack:q}=n.useDialstackComponents(),{containerRef:w,componentInstance:C}=s(q,"ai-agent"),S="create"===i||f||h?"host":"sdk";return o(C,i,(e,t)=>e.setMode(t)),o(C,S,(e,t)=>e.setSubmitMode(t)),o(C,d,(e,t)=>e.setInitialValues(t)),o(C,l,(e,t)=>e.setSecret(t)),o(C,f,(e,t)=>e.setOnCreateRequested(t)),o(C,h,(e,t)=>e.setOnSaveRequested(t)),o(C,y,(e,t)=>e.setOnCheckExtensionAvailability(t)),o(C,g,(e,t)=>e.setOnRotateSecretRequested(t)),o(C,a,(e,t)=>e.setAgentId(t)),o(C,null!=c?c:r,(e,t)=>e.setHideFields(t)),o(C,v,(e,t)=>e.setLocale(t)),e.useEffect(()=>{const e=C;if(!e)return;const t=e=>{const t=e.detail;null==u||u({id:t.agentId})},n=e=>{const t=e.detail;null==p||p(t)},s=e=>{const t=e.detail;null==m||m(t.error)};return e.addEventListener("dialstack:ai-agent:saved",t),e.addEventListener("dialstack:ai-agent:created",n),e.addEventListener("dialstack:ai-agent:error",s),()=>{e.removeEventListener("dialstack:ai-agent:saved",t),e.removeEventListener("dialstack:ai-agent:created",n),e.removeEventListener("dialstack:ai-agent:error",s)}},[C,u,p,m]),e.createElement("div",{ref:w,className:E,style:b},C&&k?t.createPortal(e.createElement("div",{slot:"before-actions"},k),C):null)},exports.buildAIAgentPrefillFaq=function({locations:e,schedules:t,users:n}){const s=[],r=e[0];if(null==r?void 0:r.address){const e=r.address,t=e.formatted_address||[e.address_number,e.street,e.unit,e.city,e.state,e.postal_code].filter(Boolean).join(", ");t&&s.push({question:"What is your address?",answer:`We are located at ${t}.`})}const a=t[0];a&&s.push({question:"What are your business hours?",answer:d(a)});const o=n.map(e=>e.name).filter(e=>!!e);return o.length>0&&s.push({question:"Who are the members of your team?",answer:`Our team includes: ${o.join(", ")}.`}),s},exports.shouldApplyPrefillFaq=function({isCreate:e,prefillCount:t,faqDirty:n}){return e&&t>0&&!n};
2
2
  //# sourceMappingURL=ai-agent.cjs.map
package/dist/ai-agent.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import e,{useRef as t,useState as n,useCallback as r,useEffect as s,useLayoutEffect as a}from"react";import{createPortal as o}from"react-dom";import{useDialstackComponents as i}from"@dialstack/sdk-react";function d(e,s){const a=t(null),[o,i]=n(null);return{containerRef:r(t=>{if(a.current&&a.current.parentNode&&(a.current.parentNode.removeChild(a.current),a.current=null,i(null)),!t)return;const n=e.create(s);try{!function(e,t){if(!e||"function"!=typeof e.setInstance)throw new Error(`<dialstack-${t}> was created but is not a registered custom element, so it would render nothing. Install @dialstack/sdk-js alongside @dialstack/sdk-react and import it once at your entry point — importing it is what registers the elements. On @dialstack/sdk-js/pure nothing registers on import: await registerComponents() before rendering. If it is installed, check that your bundler is not dropping its side effects.`)}(n,s)}catch(t){throw e.removeAppearanceTarget(n),t}try{n.setAttribute("data-dialstack-sdk-version","3.6.0")}catch(e){console.log("Error setting SDK version attribute:",e)}t.appendChild(n),a.current=n,i(n)},[e,s]),componentInstance:o}}const c=[],l="undefined"==typeof window?s:a;function u(e,t,n){l(()=>{if(e&&void 0!==t)try{n(e,t)}catch(e){console.error("DialStack: Error calling setter:",e)}},[e,t,n])}const f=({agentId:t,mode:n="edit",initialValues:r,secret:a,hideFields:l,onSaved:f,onCreateRequested:h,onSaveRequested:m,onCheckExtensionAvailability:y,onRotateSecretRequested:g,onCreated:p,onError:v,locale:k,beforeActions:E,className:b,style:w})=>{const{dialstack:$}=i(),{containerRef:S,componentInstance:q}=d($,"ai-agent"),C="create"===n||h||m?"host":"sdk";return u(q,n,(e,t)=>e.setMode(t)),u(q,C,(e,t)=>e.setSubmitMode(t)),u(q,r,(e,t)=>e.setInitialValues(t)),u(q,a,(e,t)=>e.setSecret(t)),u(q,h,(e,t)=>e.setOnCreateRequested(t)),u(q,m,(e,t)=>e.setOnSaveRequested(t)),u(q,y,(e,t)=>e.setOnCheckExtensionAvailability(t)),u(q,g,(e,t)=>e.setOnRotateSecretRequested(t)),u(q,t,(e,t)=>e.setAgentId(t)),u(q,null!=l?l:c,(e,t)=>e.setHideFields(t)),u(q,k,(e,t)=>e.setLocale(t)),s(()=>{const e=q;if(!e)return;const t=e=>{const t=e.detail;null==f||f({id:t.agentId})},n=e=>{const t=e.detail;null==p||p(t)},r=e=>{const t=e.detail;null==v||v(t.error)};return e.addEventListener("dialstack:ai-agent:saved",t),e.addEventListener("dialstack:ai-agent:created",n),e.addEventListener("dialstack:ai-agent:error",r),()=>{e.removeEventListener("dialstack:ai-agent:saved",t),e.removeEventListener("dialstack:ai-agent:created",n),e.removeEventListener("dialstack:ai-agent:error",r)}},[q,f,p,v]),e.createElement("div",{ref:S,className:b,style:w},q&&E?o(e.createElement("div",{slot:"before-actions"},E),q):null)},h=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function m(e){if(0===e.ranges.length)return"Please contact us for our current hours.";const t=new Map;for(const n of e.ranges)t.set(n.day,`${n.start} - ${n.end}`);const n=[];for(const[e,r]of[...t.entries()].sort((e,t)=>e[0]-t[0])){const t=n[n.length-1];t&&t.hours===r&&t.days[t.days.length-1]===e-1?t.days.push(e):n.push({days:[e],hours:r})}return n.map(e=>{var t,n,r,s,a;const o=null!==(t=e.days[0])&&void 0!==t?t:0,i=null!==(n=e.days[e.days.length-1])&&void 0!==n?n:o;return`${1===e.days.length?null!==(r=h[o])&&void 0!==r?r:`Day ${o}`:`${null!==(s=h[o])&&void 0!==s?s:`Day ${o}`} to ${null!==(a=h[i])&&void 0!==a?a:`Day ${i}`}`}: ${e.hours}`}).join("\n")}function y({locations:e,schedules:t,users:n}){const r=[],s=e[0];if(null==s?void 0:s.address){const e=s.address,t=e.formatted_address||[e.address_number,e.street,e.unit,e.city,e.state,e.postal_code].filter(Boolean).join(", ");t&&r.push({question:"What is your address?",answer:`We are located at ${t}.`})}const a=t[0];a&&r.push({question:"What are your business hours?",answer:m(a)});const o=n.map(e=>e.name).filter(e=>!!e);return o.length>0&&r.push({question:"Who are the members of your team?",answer:`Our team includes: ${o.join(", ")}.`}),r}function g({isCreate:e,prefillCount:t,faqDirty:n}){return e&&t>0&&!n}export{f as AIAgent,y as buildAIAgentPrefillFaq,g as shouldApplyPrefillFaq};
1
+ import e,{useRef as t,useState as n,useCallback as r,useEffect as s,useLayoutEffect as a}from"react";import{createPortal as o}from"react-dom";import{useDialstackComponents as i}from"@dialstack/sdk-react";function d(e,s){const a=t(null),[o,i]=n(null);return{containerRef:r(t=>{if(a.current&&a.current.parentNode&&(a.current.parentNode.removeChild(a.current),a.current=null,i(null)),!t)return;const n=e.create(s);try{!function(e,t){if(!e||"function"!=typeof e.setInstance)throw new Error(`<dialstack-${t}> was created but is not a registered custom element, so it would render nothing. Install @dialstack/sdk-js alongside @dialstack/sdk-react and import it once at your entry point — importing it is what registers the elements. On @dialstack/sdk-js/pure nothing registers on import: await registerComponents() before rendering. If it is installed, check that your bundler is not dropping its side effects.`)}(n,s)}catch(t){throw e.removeAppearanceTarget(n),t}try{n.setAttribute("data-dialstack-sdk-version","3.7.0")}catch(e){console.log("Error setting SDK version attribute:",e)}t.appendChild(n),a.current=n,i(n)},[e,s]),componentInstance:o}}const c=[],l="undefined"==typeof window?s:a;function u(e,t,n){l(()=>{if(e&&void 0!==t)try{n(e,t)}catch(e){console.error("DialStack: Error calling setter:",e)}},[e,t,n])}const f=({agentId:t,mode:n="edit",initialValues:r,secret:a,hideFields:l,onSaved:f,onCreateRequested:h,onSaveRequested:m,onCheckExtensionAvailability:y,onRotateSecretRequested:g,onCreated:p,onError:v,locale:k,beforeActions:E,className:b,style:w})=>{const{dialstack:$}=i(),{containerRef:S,componentInstance:q}=d($,"ai-agent"),C="create"===n||h||m?"host":"sdk";return u(q,n,(e,t)=>e.setMode(t)),u(q,C,(e,t)=>e.setSubmitMode(t)),u(q,r,(e,t)=>e.setInitialValues(t)),u(q,a,(e,t)=>e.setSecret(t)),u(q,h,(e,t)=>e.setOnCreateRequested(t)),u(q,m,(e,t)=>e.setOnSaveRequested(t)),u(q,y,(e,t)=>e.setOnCheckExtensionAvailability(t)),u(q,g,(e,t)=>e.setOnRotateSecretRequested(t)),u(q,t,(e,t)=>e.setAgentId(t)),u(q,null!=l?l:c,(e,t)=>e.setHideFields(t)),u(q,k,(e,t)=>e.setLocale(t)),s(()=>{const e=q;if(!e)return;const t=e=>{const t=e.detail;null==f||f({id:t.agentId})},n=e=>{const t=e.detail;null==p||p(t)},r=e=>{const t=e.detail;null==v||v(t.error)};return e.addEventListener("dialstack:ai-agent:saved",t),e.addEventListener("dialstack:ai-agent:created",n),e.addEventListener("dialstack:ai-agent:error",r),()=>{e.removeEventListener("dialstack:ai-agent:saved",t),e.removeEventListener("dialstack:ai-agent:created",n),e.removeEventListener("dialstack:ai-agent:error",r)}},[q,f,p,v]),e.createElement("div",{ref:S,className:b,style:w},q&&E?o(e.createElement("div",{slot:"before-actions"},E),q):null)},h=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function m(e){if(0===e.ranges.length)return"Please contact us for our current hours.";const t=new Map;for(const n of e.ranges)t.set(n.day,`${n.start} - ${n.end}`);const n=[];for(const[e,r]of[...t.entries()].sort((e,t)=>e[0]-t[0])){const t=n[n.length-1];t&&t.hours===r&&t.days[t.days.length-1]===e-1?t.days.push(e):n.push({days:[e],hours:r})}return n.map(e=>{var t,n,r,s,a;const o=null!==(t=e.days[0])&&void 0!==t?t:0,i=null!==(n=e.days[e.days.length-1])&&void 0!==n?n:o;return`${1===e.days.length?null!==(r=h[o])&&void 0!==r?r:`Day ${o}`:`${null!==(s=h[o])&&void 0!==s?s:`Day ${o}`} to ${null!==(a=h[i])&&void 0!==a?a:`Day ${i}`}`}: ${e.hours}`}).join("\n")}function y({locations:e,schedules:t,users:n}){const r=[],s=e[0];if(null==s?void 0:s.address){const e=s.address,t=e.formatted_address||[e.address_number,e.street,e.unit,e.city,e.state,e.postal_code].filter(Boolean).join(", ");t&&r.push({question:"What is your address?",answer:`We are located at ${t}.`})}const a=t[0];a&&r.push({question:"What are your business hours?",answer:m(a)});const o=n.map(e=>e.name).filter(e=>!!e);return o.length>0&&r.push({question:"Who are the members of your team?",answer:`Our team includes: ${o.join(", ")}.`}),r}function g({isCreate:e,prefillCount:t,faqDirty:n}){return e&&t>0&&!n}export{f as AIAgent,y as buildAIAgentPrefillFaq,g as shouldApplyPrefillFaq};
2
2
  //# sourceMappingURL=ai-agent.mjs.map
@@ -1,2 +1,2 @@
1
- "use strict";var t=require("react"),e=require("@dialstack/sdk-react");function r(e,r){const n=t.useRef(null),[s,a]=t.useState(null);return{containerRef:t.useCallback(t=>{if(n.current&&n.current.parentNode&&(n.current.parentNode.removeChild(n.current),n.current=null,a(null)),!t)return;const s=e.create(r);try{!function(t,e){if(!t||"function"!=typeof t.setInstance)throw new Error(`<dialstack-${e}> was created but is not a registered custom element, so it would render nothing. Install @dialstack/sdk-js alongside @dialstack/sdk-react and import it once at your entry point — importing it is what registers the elements. On @dialstack/sdk-js/pure nothing registers on import: await registerComponents() before rendering. If it is installed, check that your bundler is not dropping its side effects.`)}(s,r)}catch(t){throw e.removeAppearanceTarget(s),t}try{s.setAttribute("data-dialstack-sdk-version","3.6.0")}catch(t){console.log("Error setting SDK version attribute:",t)}t.appendChild(s),n.current=s,a(s)},[e,r]),componentInstance:s}}function n(e,r,n){t.useEffect(()=>{if(e&&void 0!==r)try{n(e,r)}catch(t){console.error("DialStack: Error calling setter:",t)}},[e,r,n])}exports.CallHistory=({phoneNumber:s,limit:a,className:o,style:i,locale:c,formatting:l,icons:u,layoutVariant:d,classes:p,displayOptions:m,onLoaderStart:f,onLoadError:g})=>{const{dialstack:h}=e.useDialstackComponents(),{containerRef:k,componentInstance:y}=r(h,"call-history");return n(y,s,(t,e)=>t.setPhoneNumber(e)),n(y,a,(t,e)=>t.setLimit(e)),n(y,c,(t,e)=>t.setLocale(e)),n(y,l,(t,e)=>t.setFormatting(e)),n(y,u,(t,e)=>t.setIcons(e)),n(y,d,(t,e)=>t.setLayoutVariant(e)),n(y,p,(t,e)=>t.setClasses(e)),n(y,m,(t,e)=>t.setDisplayOptions(e)),n(y,f,(t,e)=>t.setOnLoaderStart(e)),n(y,g,(t,e)=>t.setOnLoadError(e)),t.createElement("div",{ref:k,className:o,style:i})};
1
+ "use strict";var t=require("react"),e=require("@dialstack/sdk-react");function r(e,r){const n=t.useRef(null),[s,a]=t.useState(null);return{containerRef:t.useCallback(t=>{if(n.current&&n.current.parentNode&&(n.current.parentNode.removeChild(n.current),n.current=null,a(null)),!t)return;const s=e.create(r);try{!function(t,e){if(!t||"function"!=typeof t.setInstance)throw new Error(`<dialstack-${e}> was created but is not a registered custom element, so it would render nothing. Install @dialstack/sdk-js alongside @dialstack/sdk-react and import it once at your entry point — importing it is what registers the elements. On @dialstack/sdk-js/pure nothing registers on import: await registerComponents() before rendering. If it is installed, check that your bundler is not dropping its side effects.`)}(s,r)}catch(t){throw e.removeAppearanceTarget(s),t}try{s.setAttribute("data-dialstack-sdk-version","3.7.0")}catch(t){console.log("Error setting SDK version attribute:",t)}t.appendChild(s),n.current=s,a(s)},[e,r]),componentInstance:s}}function n(e,r,n){t.useEffect(()=>{if(e&&void 0!==r)try{n(e,r)}catch(t){console.error("DialStack: Error calling setter:",t)}},[e,r,n])}exports.CallHistory=({phoneNumber:s,limit:a,className:o,style:i,locale:c,formatting:l,icons:u,layoutVariant:d,classes:p,displayOptions:m,onLoaderStart:f,onLoadError:g})=>{const{dialstack:h}=e.useDialstackComponents(),{containerRef:k,componentInstance:y}=r(h,"call-history");return n(y,s,(t,e)=>t.setPhoneNumber(e)),n(y,a,(t,e)=>t.setLimit(e)),n(y,c,(t,e)=>t.setLocale(e)),n(y,l,(t,e)=>t.setFormatting(e)),n(y,u,(t,e)=>t.setIcons(e)),n(y,d,(t,e)=>t.setLayoutVariant(e)),n(y,p,(t,e)=>t.setClasses(e)),n(y,m,(t,e)=>t.setDisplayOptions(e)),n(y,f,(t,e)=>t.setOnLoaderStart(e)),n(y,g,(t,e)=>t.setOnLoadError(e)),t.createElement("div",{ref:k,className:o,style:i})};
2
2
  //# sourceMappingURL=call-history.cjs.map
@@ -1,2 +1,2 @@
1
- import t,{useRef as e,useState as r,useCallback as n,useEffect as o}from"react";import{useDialstackComponents as s}from"@dialstack/sdk-react";function a(t,o){const s=e(null),[a,i]=r(null);return{containerRef:n(e=>{if(s.current&&s.current.parentNode&&(s.current.parentNode.removeChild(s.current),s.current=null,i(null)),!e)return;const r=t.create(o);try{!function(t,e){if(!t||"function"!=typeof t.setInstance)throw new Error(`<dialstack-${e}> was created but is not a registered custom element, so it would render nothing. Install @dialstack/sdk-js alongside @dialstack/sdk-react and import it once at your entry point — importing it is what registers the elements. On @dialstack/sdk-js/pure nothing registers on import: await registerComponents() before rendering. If it is installed, check that your bundler is not dropping its side effects.`)}(r,o)}catch(e){throw t.removeAppearanceTarget(r),e}try{r.setAttribute("data-dialstack-sdk-version","3.6.0")}catch(t){console.log("Error setting SDK version attribute:",t)}e.appendChild(r),s.current=r,i(r)},[t,o]),componentInstance:a}}function i(t,e,r){o(()=>{if(t&&void 0!==e)try{r(t,e)}catch(t){console.error("DialStack: Error calling setter:",t)}},[t,e,r])}const c=({phoneNumber:e,limit:r,className:n,style:o,locale:c,formatting:l,icons:d,layoutVariant:u,classes:p,displayOptions:m,onLoaderStart:f,onLoadError:g})=>{const{dialstack:h}=s(),{containerRef:k,componentInstance:y}=a(h,"call-history");return i(y,e,(t,e)=>t.setPhoneNumber(e)),i(y,r,(t,e)=>t.setLimit(e)),i(y,c,(t,e)=>t.setLocale(e)),i(y,l,(t,e)=>t.setFormatting(e)),i(y,d,(t,e)=>t.setIcons(e)),i(y,u,(t,e)=>t.setLayoutVariant(e)),i(y,p,(t,e)=>t.setClasses(e)),i(y,m,(t,e)=>t.setDisplayOptions(e)),i(y,f,(t,e)=>t.setOnLoaderStart(e)),i(y,g,(t,e)=>t.setOnLoadError(e)),t.createElement("div",{ref:k,className:n,style:o})};export{c as CallHistory};
1
+ import t,{useRef as e,useState as r,useCallback as n,useEffect as o}from"react";import{useDialstackComponents as s}from"@dialstack/sdk-react";function a(t,o){const s=e(null),[a,i]=r(null);return{containerRef:n(e=>{if(s.current&&s.current.parentNode&&(s.current.parentNode.removeChild(s.current),s.current=null,i(null)),!e)return;const r=t.create(o);try{!function(t,e){if(!t||"function"!=typeof t.setInstance)throw new Error(`<dialstack-${e}> was created but is not a registered custom element, so it would render nothing. Install @dialstack/sdk-js alongside @dialstack/sdk-react and import it once at your entry point — importing it is what registers the elements. On @dialstack/sdk-js/pure nothing registers on import: await registerComponents() before rendering. If it is installed, check that your bundler is not dropping its side effects.`)}(r,o)}catch(e){throw t.removeAppearanceTarget(r),e}try{r.setAttribute("data-dialstack-sdk-version","3.7.0")}catch(t){console.log("Error setting SDK version attribute:",t)}e.appendChild(r),s.current=r,i(r)},[t,o]),componentInstance:a}}function i(t,e,r){o(()=>{if(t&&void 0!==e)try{r(t,e)}catch(t){console.error("DialStack: Error calling setter:",t)}},[t,e,r])}const c=({phoneNumber:e,limit:r,className:n,style:o,locale:c,formatting:l,icons:d,layoutVariant:u,classes:p,displayOptions:m,onLoaderStart:f,onLoadError:g})=>{const{dialstack:h}=s(),{containerRef:k,componentInstance:y}=a(h,"call-history");return i(y,e,(t,e)=>t.setPhoneNumber(e)),i(y,r,(t,e)=>t.setLimit(e)),i(y,c,(t,e)=>t.setLocale(e)),i(y,l,(t,e)=>t.setFormatting(e)),i(y,d,(t,e)=>t.setIcons(e)),i(y,u,(t,e)=>t.setLayoutVariant(e)),i(y,p,(t,e)=>t.setClasses(e)),i(y,m,(t,e)=>t.setDisplayOptions(e)),i(y,f,(t,e)=>t.setOnLoaderStart(e)),i(y,g,(t,e)=>t.setOnLoadError(e)),t.createElement("div",{ref:k,className:n,style:o})};export{c as CallHistory};
2
2
  //# sourceMappingURL=call-history.mjs.map
@@ -1,2 +1,2 @@
1
- "use strict";var t=require("react"),e=require("@dialstack/sdk-react");function r(e,r){const n=t.useRef(null),[s,a]=t.useState(null);return{containerRef:t.useCallback(t=>{if(n.current&&n.current.parentNode&&(n.current.parentNode.removeChild(n.current),n.current=null,a(null)),!t)return;const s=e.create(r);try{!function(t,e){if(!t||"function"!=typeof t.setInstance)throw new Error(`<dialstack-${e}> was created but is not a registered custom element, so it would render nothing. Install @dialstack/sdk-js alongside @dialstack/sdk-react and import it once at your entry point — importing it is what registers the elements. On @dialstack/sdk-js/pure nothing registers on import: await registerComponents() before rendering. If it is installed, check that your bundler is not dropping its side effects.`)}(s,r)}catch(t){throw e.removeAppearanceTarget(s),t}try{s.setAttribute("data-dialstack-sdk-version","3.6.0")}catch(t){console.log("Error setting SDK version attribute:",t)}t.appendChild(s),n.current=s,a(s)},[e,r]),componentInstance:s}}function n(e,r,n){t.useEffect(()=>{if(e&&void 0!==r)try{n(e,r)}catch(t){console.error("DialStack: Error calling setter:",t)}},[e,r,n])}exports.CallLogs=({className:s,style:a,dateRange:o,limit:i,locale:c,formatting:l,icons:d,layoutVariant:u,classes:p,displayOptions:m,customRowRenderer:g,onLoaderStart:f,onLoadError:k,onRowClick:h})=>{const{dialstack:y}=e.useDialstackComponents(),{containerRef:w,componentInstance:R}=r(y,"call-logs");return n(R,o,(t,e)=>t.setDateRange(e)),n(R,i,(t,e)=>t.setLimit(e)),n(R,c,(t,e)=>t.setLocale(e)),n(R,l,(t,e)=>t.setFormatting(e)),n(R,d,(t,e)=>t.setIcons(e)),n(R,u,(t,e)=>t.setLayoutVariant(e)),n(R,p,(t,e)=>t.setClasses(e)),n(R,m,(t,e)=>t.setDisplayOptions(e)),n(R,g,(t,e)=>t.setCustomRowRenderer(e)),n(R,f,(t,e)=>t.setOnLoaderStart(e)),n(R,k,(t,e)=>t.setOnLoadError(e)),n(R,h,(t,e)=>t.setOnRowClick(e)),t.createElement("div",{ref:w,className:s,style:a})};
1
+ "use strict";var t=require("react"),e=require("@dialstack/sdk-react");function r(e,r){const n=t.useRef(null),[s,a]=t.useState(null);return{containerRef:t.useCallback(t=>{if(n.current&&n.current.parentNode&&(n.current.parentNode.removeChild(n.current),n.current=null,a(null)),!t)return;const s=e.create(r);try{!function(t,e){if(!t||"function"!=typeof t.setInstance)throw new Error(`<dialstack-${e}> was created but is not a registered custom element, so it would render nothing. Install @dialstack/sdk-js alongside @dialstack/sdk-react and import it once at your entry point — importing it is what registers the elements. On @dialstack/sdk-js/pure nothing registers on import: await registerComponents() before rendering. If it is installed, check that your bundler is not dropping its side effects.`)}(s,r)}catch(t){throw e.removeAppearanceTarget(s),t}try{s.setAttribute("data-dialstack-sdk-version","3.7.0")}catch(t){console.log("Error setting SDK version attribute:",t)}t.appendChild(s),n.current=s,a(s)},[e,r]),componentInstance:s}}function n(e,r,n){t.useEffect(()=>{if(e&&void 0!==r)try{n(e,r)}catch(t){console.error("DialStack: Error calling setter:",t)}},[e,r,n])}exports.CallLogs=({className:s,style:a,dateRange:o,limit:i,locale:c,formatting:l,icons:d,layoutVariant:u,classes:p,displayOptions:m,customRowRenderer:g,onLoaderStart:f,onLoadError:k,onRowClick:h})=>{const{dialstack:y}=e.useDialstackComponents(),{containerRef:w,componentInstance:R}=r(y,"call-logs");return n(R,o,(t,e)=>t.setDateRange(e)),n(R,i,(t,e)=>t.setLimit(e)),n(R,c,(t,e)=>t.setLocale(e)),n(R,l,(t,e)=>t.setFormatting(e)),n(R,d,(t,e)=>t.setIcons(e)),n(R,u,(t,e)=>t.setLayoutVariant(e)),n(R,p,(t,e)=>t.setClasses(e)),n(R,m,(t,e)=>t.setDisplayOptions(e)),n(R,g,(t,e)=>t.setCustomRowRenderer(e)),n(R,f,(t,e)=>t.setOnLoaderStart(e)),n(R,k,(t,e)=>t.setOnLoadError(e)),n(R,h,(t,e)=>t.setOnRowClick(e)),t.createElement("div",{ref:w,className:s,style:a})};
2
2
  //# sourceMappingURL=call-logs.cjs.map
@@ -1,2 +1,2 @@
1
- import t,{useRef as e,useState as r,useCallback as n,useEffect as o}from"react";import{useDialstackComponents as s}from"@dialstack/sdk-react";function a(t,o){const s=e(null),[a,i]=r(null);return{containerRef:n(e=>{if(s.current&&s.current.parentNode&&(s.current.parentNode.removeChild(s.current),s.current=null,i(null)),!e)return;const r=t.create(o);try{!function(t,e){if(!t||"function"!=typeof t.setInstance)throw new Error(`<dialstack-${e}> was created but is not a registered custom element, so it would render nothing. Install @dialstack/sdk-js alongside @dialstack/sdk-react and import it once at your entry point — importing it is what registers the elements. On @dialstack/sdk-js/pure nothing registers on import: await registerComponents() before rendering. If it is installed, check that your bundler is not dropping its side effects.`)}(r,o)}catch(e){throw t.removeAppearanceTarget(r),e}try{r.setAttribute("data-dialstack-sdk-version","3.6.0")}catch(t){console.log("Error setting SDK version attribute:",t)}e.appendChild(r),s.current=r,i(r)},[t,o]),componentInstance:a}}function i(t,e,r){o(()=>{if(t&&void 0!==e)try{r(t,e)}catch(t){console.error("DialStack: Error calling setter:",t)}},[t,e,r])}const c=({className:e,style:r,dateRange:n,limit:o,locale:c,formatting:l,icons:d,layoutVariant:u,classes:m,displayOptions:p,customRowRenderer:g,onLoaderStart:f,onLoadError:k,onRowClick:h})=>{const{dialstack:y}=s(),{containerRef:w,componentInstance:R}=a(y,"call-logs");return i(R,n,(t,e)=>t.setDateRange(e)),i(R,o,(t,e)=>t.setLimit(e)),i(R,c,(t,e)=>t.setLocale(e)),i(R,l,(t,e)=>t.setFormatting(e)),i(R,d,(t,e)=>t.setIcons(e)),i(R,u,(t,e)=>t.setLayoutVariant(e)),i(R,m,(t,e)=>t.setClasses(e)),i(R,p,(t,e)=>t.setDisplayOptions(e)),i(R,g,(t,e)=>t.setCustomRowRenderer(e)),i(R,f,(t,e)=>t.setOnLoaderStart(e)),i(R,k,(t,e)=>t.setOnLoadError(e)),i(R,h,(t,e)=>t.setOnRowClick(e)),t.createElement("div",{ref:w,className:e,style:r})};export{c as CallLogs};
1
+ import t,{useRef as e,useState as r,useCallback as n,useEffect as o}from"react";import{useDialstackComponents as s}from"@dialstack/sdk-react";function a(t,o){const s=e(null),[a,i]=r(null);return{containerRef:n(e=>{if(s.current&&s.current.parentNode&&(s.current.parentNode.removeChild(s.current),s.current=null,i(null)),!e)return;const r=t.create(o);try{!function(t,e){if(!t||"function"!=typeof t.setInstance)throw new Error(`<dialstack-${e}> was created but is not a registered custom element, so it would render nothing. Install @dialstack/sdk-js alongside @dialstack/sdk-react and import it once at your entry point — importing it is what registers the elements. On @dialstack/sdk-js/pure nothing registers on import: await registerComponents() before rendering. If it is installed, check that your bundler is not dropping its side effects.`)}(r,o)}catch(e){throw t.removeAppearanceTarget(r),e}try{r.setAttribute("data-dialstack-sdk-version","3.7.0")}catch(t){console.log("Error setting SDK version attribute:",t)}e.appendChild(r),s.current=r,i(r)},[t,o]),componentInstance:a}}function i(t,e,r){o(()=>{if(t&&void 0!==e)try{r(t,e)}catch(t){console.error("DialStack: Error calling setter:",t)}},[t,e,r])}const c=({className:e,style:r,dateRange:n,limit:o,locale:c,formatting:l,icons:d,layoutVariant:u,classes:m,displayOptions:p,customRowRenderer:g,onLoaderStart:f,onLoadError:k,onRowClick:h})=>{const{dialstack:y}=s(),{containerRef:w,componentInstance:R}=a(y,"call-logs");return i(R,n,(t,e)=>t.setDateRange(e)),i(R,o,(t,e)=>t.setLimit(e)),i(R,c,(t,e)=>t.setLocale(e)),i(R,l,(t,e)=>t.setFormatting(e)),i(R,d,(t,e)=>t.setIcons(e)),i(R,u,(t,e)=>t.setLayoutVariant(e)),i(R,m,(t,e)=>t.setClasses(e)),i(R,p,(t,e)=>t.setDisplayOptions(e)),i(R,g,(t,e)=>t.setCustomRowRenderer(e)),i(R,f,(t,e)=>t.setOnLoaderStart(e)),i(R,k,(t,e)=>t.setOnLoadError(e)),i(R,h,(t,e)=>t.setOnRowClick(e)),t.createElement("div",{ref:w,className:e,style:r})};export{c as CallLogs};
2
2
  //# sourceMappingURL=call-logs.mjs.map
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("react");const t=e.createContext(null),r=()=>{const r=e.useContext(t);if(!r)throw new Error("Could not find DialStack context; You need to wrap your app in a <DialstackComponentsProvider> provider. See https://docs.dialstack.ai/sdk/react for setup instructions.");return r};exports.DialstackComponentsContext=t,exports.DialstackComponentsProvider=({dialstack:r,children:n})=>{const a={dialstack:r};return e.createElement(t.Provider,{value:a},n)},exports.useAppearance=function(t){const[r,n]=e.useState(()=>t.getAppearance());return e.useEffect(()=>{if("undefined"==typeof document)return;const e=document.createElement("div"),r=e=>{const t=e.detail;n(null==t?void 0:t.appearance)};return e.addEventListener("dialstack-appearance-update",r),t.addAppearanceTarget(e),()=>{t.removeAppearanceTarget(e),e.removeEventListener("dialstack-appearance-update",r)}},[t]),r},exports.useCreateComponent=function(t,r){const n=e.useRef(null),[a,o]=e.useState(null);return{containerRef:e.useCallback(e=>{if(n.current&&n.current.parentNode&&(n.current.parentNode.removeChild(n.current),n.current=null,o(null)),!e)return;const a=t.create(r);try{!function(e,t){if(!e||"function"!=typeof e.setInstance)throw new Error(`<dialstack-${t}> was created but is not a registered custom element, so it would render nothing. Install @dialstack/sdk-js alongside @dialstack/sdk-react and import it once at your entry point — importing it is what registers the elements. On @dialstack/sdk-js/pure nothing registers on import: await registerComponents() before rendering. If it is installed, check that your bundler is not dropping its side effects.`)}(a,r)}catch(e){throw t.removeAppearanceTarget(a),e}try{a.setAttribute("data-dialstack-sdk-version","3.6.0")}catch(e){console.log("Error setting SDK version attribute:",e)}e.appendChild(a),n.current=a,o(a)},[t,r]),componentInstance:a}},exports.useDialstack=()=>{const{dialstack:e}=r();return e},exports.useDialstackComponents=r,exports.useUpdateWithSetter=function(t,r,n){e.useEffect(()=>{if(t&&void 0!==r)try{n(t,r)}catch(e){console.error("DialStack: Error calling setter:",e)}},[t,r,n])};
1
+ "use strict";var e=require("react");const t=e.createContext(null),r=()=>{const r=e.useContext(t);if(!r)throw new Error("Could not find DialStack context; You need to wrap your app in a <DialstackComponentsProvider> provider. See https://docs.dialstack.ai/sdk/react for setup instructions.");return r};exports.DialstackComponentsContext=t,exports.DialstackComponentsProvider=({dialstack:r,children:n})=>{const a={dialstack:r};return e.createElement(t.Provider,{value:a},n)},exports.useAppearance=function(t){const[r,n]=e.useState(()=>t.getAppearance());return e.useEffect(()=>{if("undefined"==typeof document)return;const e=document.createElement("div"),r=e=>{const t=e.detail;n(null==t?void 0:t.appearance)};return e.addEventListener("dialstack-appearance-update",r),t.addAppearanceTarget(e),()=>{t.removeAppearanceTarget(e),e.removeEventListener("dialstack-appearance-update",r)}},[t]),r},exports.useCreateComponent=function(t,r){const n=e.useRef(null),[a,o]=e.useState(null);return{containerRef:e.useCallback(e=>{if(n.current&&n.current.parentNode&&(n.current.parentNode.removeChild(n.current),n.current=null,o(null)),!e)return;const a=t.create(r);try{!function(e,t){if(!e||"function"!=typeof e.setInstance)throw new Error(`<dialstack-${t}> was created but is not a registered custom element, so it would render nothing. Install @dialstack/sdk-js alongside @dialstack/sdk-react and import it once at your entry point — importing it is what registers the elements. On @dialstack/sdk-js/pure nothing registers on import: await registerComponents() before rendering. If it is installed, check that your bundler is not dropping its side effects.`)}(a,r)}catch(e){throw t.removeAppearanceTarget(a),e}try{a.setAttribute("data-dialstack-sdk-version","3.7.0")}catch(e){console.log("Error setting SDK version attribute:",e)}e.appendChild(a),n.current=a,o(a)},[t,r]),componentInstance:a}},exports.useDialstack=()=>{const{dialstack:e}=r();return e},exports.useDialstackComponents=r,exports.useUpdateWithSetter=function(t,r,n){e.useEffect(()=>{if(t&&void 0!==r)try{n(t,r)}catch(e){console.error("DialStack: Error calling setter:",e)}},[t,r,n])};
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import e,{createContext as t,useContext as r,useRef as n,useState as a,useCallback as o,useEffect as i}from"react";const c=t(null),s=({dialstack:t,children:r})=>{const n={dialstack:t};return e.createElement(c.Provider,{value:n},r)},d=()=>{const e=r(c);if(!e)throw new Error("Could not find DialStack context; You need to wrap your app in a <DialstackComponentsProvider> provider. See https://docs.dialstack.ai/sdk/react for setup instructions.");return e},l=()=>{const{dialstack:e}=d();return e};function u(e,t){const r=n(null),[i,c]=a(null);return{containerRef:o(n=>{if(r.current&&r.current.parentNode&&(r.current.parentNode.removeChild(r.current),r.current=null,c(null)),!n)return;const a=e.create(t);try{!function(e,t){if(!e||"function"!=typeof e.setInstance)throw new Error(`<dialstack-${t}> was created but is not a registered custom element, so it would render nothing. Install @dialstack/sdk-js alongside @dialstack/sdk-react and import it once at your entry point — importing it is what registers the elements. On @dialstack/sdk-js/pure nothing registers on import: await registerComponents() before rendering. If it is installed, check that your bundler is not dropping its side effects.`)}(a,t)}catch(t){throw e.removeAppearanceTarget(a),t}try{a.setAttribute("data-dialstack-sdk-version","3.6.0")}catch(e){console.log("Error setting SDK version attribute:",e)}n.appendChild(a),r.current=a,c(a)},[e,t]),componentInstance:i}}function p(e,t,r){i(()=>{if(e&&void 0!==t)try{r(e,t)}catch(e){console.error("DialStack: Error calling setter:",e)}},[e,t,r])}function f(e){const[t,r]=a(()=>e.getAppearance());return i(()=>{if("undefined"==typeof document)return;const t=document.createElement("div"),n=e=>{const t=e.detail;r(null==t?void 0:t.appearance)};return t.addEventListener("dialstack-appearance-update",n),e.addAppearanceTarget(t),()=>{e.removeAppearanceTarget(t),t.removeEventListener("dialstack-appearance-update",n)}},[e]),t}export{c as DialstackComponentsContext,s as DialstackComponentsProvider,f as useAppearance,u as useCreateComponent,l as useDialstack,d as useDialstackComponents,p as useUpdateWithSetter};
1
+ import e,{createContext as t,useContext as r,useRef as n,useState as a,useCallback as o,useEffect as i}from"react";const c=t(null),s=({dialstack:t,children:r})=>{const n={dialstack:t};return e.createElement(c.Provider,{value:n},r)},d=()=>{const e=r(c);if(!e)throw new Error("Could not find DialStack context; You need to wrap your app in a <DialstackComponentsProvider> provider. See https://docs.dialstack.ai/sdk/react for setup instructions.");return e},l=()=>{const{dialstack:e}=d();return e};function u(e,t){const r=n(null),[i,c]=a(null);return{containerRef:o(n=>{if(r.current&&r.current.parentNode&&(r.current.parentNode.removeChild(r.current),r.current=null,c(null)),!n)return;const a=e.create(t);try{!function(e,t){if(!e||"function"!=typeof e.setInstance)throw new Error(`<dialstack-${t}> was created but is not a registered custom element, so it would render nothing. Install @dialstack/sdk-js alongside @dialstack/sdk-react and import it once at your entry point — importing it is what registers the elements. On @dialstack/sdk-js/pure nothing registers on import: await registerComponents() before rendering. If it is installed, check that your bundler is not dropping its side effects.`)}(a,t)}catch(t){throw e.removeAppearanceTarget(a),t}try{a.setAttribute("data-dialstack-sdk-version","3.7.0")}catch(e){console.log("Error setting SDK version attribute:",e)}n.appendChild(a),r.current=a,c(a)},[e,t]),componentInstance:i}}function p(e,t,r){i(()=>{if(e&&void 0!==t)try{r(e,t)}catch(e){console.error("DialStack: Error calling setter:",e)}},[e,t,r])}function f(e){const[t,r]=a(()=>e.getAppearance());return i(()=>{if("undefined"==typeof document)return;const t=document.createElement("div"),n=e=>{const t=e.detail;r(null==t?void 0:t.appearance)};return t.addEventListener("dialstack-appearance-update",n),e.addAppearanceTarget(t),()=>{e.removeAppearanceTarget(t),t.removeEventListener("dialstack-appearance-update",n)}},[e]),t}export{c as DialstackComponentsContext,s as DialstackComponentsProvider,f as useAppearance,u as useCreateComponent,l as useDialstack,d as useDialstackComponents,p as useUpdateWithSetter};
2
2
  //# sourceMappingURL=index.mjs.map