@dialstack/sdk-react 3.6.0 → 3.8.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 +1 -1
- package/dist/ai-agent.cjs.map +1 -1
- package/dist/ai-agent.d.cts +4 -4
- package/dist/ai-agent.d.ts +4 -4
- package/dist/ai-agent.mjs +1 -1
- package/dist/ai-agent.mjs.map +1 -1
- package/dist/call-history.cjs +1 -1
- package/dist/call-history.cjs.map +1 -1
- package/dist/call-history.mjs +1 -1
- package/dist/call-history.mjs.map +1 -1
- package/dist/call-logs.cjs +1 -1
- package/dist/call-logs.cjs.map +1 -1
- package/dist/call-logs.d.cts +11 -1
- package/dist/call-logs.d.ts +11 -1
- package/dist/call-logs.mjs +1 -1
- package/dist/call-logs.mjs.map +1 -1
- package/dist/dial-plan.cjs +1 -1
- package/dist/dial-plan.cjs.map +1 -1
- package/dist/dial-plan.mjs +1 -1
- package/dist/dial-plan.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -2
- package/dist/index.d.ts +17 -2
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/onboarding.cjs +1 -1
- package/dist/onboarding.cjs.map +1 -1
- package/dist/onboarding.mjs +1 -1
- package/dist/onboarding.mjs.map +1 -1
- package/dist/phone-number-ordering.cjs +1 -1
- package/dist/phone-number-ordering.cjs.map +1 -1
- package/dist/phone-number-ordering.d.cts +11 -5
- package/dist/phone-number-ordering.d.ts +11 -5
- package/dist/phone-number-ordering.mjs +1 -1
- package/dist/phone-number-ordering.mjs.map +1 -1
- package/dist/phone-numbers.cjs +1 -1
- package/dist/phone-numbers.cjs.map +1 -1
- package/dist/phone-numbers.mjs +1 -1
- package/dist/phone-numbers.mjs.map +1 -1
- package/dist/softphone.cjs +1 -1
- package/dist/softphone.cjs.map +1 -1
- package/dist/softphone.d.cts +100 -2
- package/dist/softphone.d.ts +100 -2
- package/dist/softphone.mjs +1 -1
- package/dist/softphone.mjs.map +1 -1
- package/dist/voicemails.cjs +1 -1
- package/dist/voicemails.cjs.map +1 -1
- package/dist/voicemails.mjs +1 -1
- package/dist/voicemails.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react");const t=e.createContext(null),
|
|
1
|
+
"use strict";var e=require("react");const t=e.createContext(null),n=()=>{const n=e.useContext(t);if(!n)throw new Error("Could not find DialStack context; You need to wrap your app in a <DialstackComponentsProvider> provider. See https://docs.dialstack.ai/sdks/setup for setup instructions.");return n};exports.DialstackComponentsContext=t,exports.DialstackComponentsProvider=({dialstack:n,children:r})=>{var a;null===(a=null==n?void 0:n.registerClientPackage)||void 0===a||a.call(n,"sdk-react","3.8.0");const o={dialstack:n};return e.createElement(t.Provider,{value:o},r)},exports.useAppearance=function(t){const[n,r]=e.useState(()=>t.getAppearance());return e.useEffect(()=>{if("undefined"==typeof document)return;const e=document.createElement("div"),n=e=>{const t=e.detail;r(null==t?void 0:t.appearance)};return e.addEventListener("dialstack-appearance-update",n),t.addAppearanceTarget(e),()=>{t.removeAppearanceTarget(e),e.removeEventListener("dialstack-appearance-update",n)}},[t]),n},exports.useCreateComponent=function(t,n,r){const a=e.useRef(null),o=e.useRef(r);e.useLayoutEffect(()=>{o.current=r});const[s,i]=e.useState(null);return{containerRef:e.useCallback(e=>{var r;if(a.current&&a.current.parentNode&&(a.current.parentNode.removeChild(a.current),a.current=null,i(null)),!e)return;const s=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.`)}(s,n)}catch(e){throw t.removeAppearanceTarget(s),e}null===(r=o.current)||void 0===r||r.call(o,s),e.appendChild(s),a.current=s,i(s)},[t,n]),componentInstance:s}},exports.useDialstack=()=>{const{dialstack:e}=n();return e},exports.useDialstackComponents=n,exports.useReportComponent=function(n){var r,a,o;null===(o=null===(a=null===(r=e.useContext(t))||void 0===r?void 0:r.dialstack)||void 0===a?void 0:a.registerClientComponent)||void 0===o||o.call(a,"sdk-react",n)},exports.useUpdateWithSetter=function(t,n,r){e.useEffect(()=>{if(t&&void 0!==n)try{r(t,n)}catch(e){console.error("DialStack: Error calling setter:",e)}},[t,n,r])};
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/react/
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/react/version.ts","../src/react/DialstackComponentsProvider.tsx","../src/react/useAppearance.ts","../src/react/useCreateComponent.tsx","../src/react/useUpdateWithSetter.ts"],"sourcesContent":[null,null,null,null,null],"names":["DialstackComponentsContext","createContext","useDialstackComponents","context","useContext","Error","DialstackComponentsProvider","dialstack","children","_a","registerClientPackage","call","value","React","createElement","Provider","appearance","setAppearance","useState","getAppearance","useEffect","document","target","handler","event","detail","addEventListener","addAppearanceTarget","removeAppearanceTarget","removeEventListener","tagName","beforeAttach","componentRef","useRef","beforeAttachRef","useLayoutEffect","current","componentInstance","setComponentInstance","containerRef","useCallback","container","parentNode","removeChild","component","create","element","setInstance","assertUpgraded","err","appendChild","useDialstack","name","_c","_b","registerClientComponent","onUpdated","undefined","error","console"],"mappings":"oCAEO,MCkBDA,EAA6BC,EAAAA,cAAsD,MA6D5EC,EAAyBA,KACpC,MAAMC,EAAUC,EAAAA,WAAWJ,GAC3B,IAAKG,EACH,MAAM,IAAIE,MACR,6KAIJ,OAAOF,4EAnC8EG,EACrFC,YACAC,qBAOgC,QAAhCC,EAAAF,aAAS,EAATA,EAAWG,6BAAqB,IAAAD,GAAAA,E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ACtBZ,EAAaI,QAAUQ,EACvBN,EAAqBM,IAEvB,CAACrC,EAAWuB,IAKZO,oBAEJ,uBF9B4Bc,KAC1B,MAAM5C,UAAEA,GAAcL,IACtB,OAAOK,+DAUH,SAA6B6C,aACyC,QAA1EC,EAAiD,QAAjDC,EAAsC,QAAtC7C,EAAAL,EAAAA,WAAWJ,UAA2B,IAAAS,OAAA,EAAAA,EAAEF,iBAAS,IAAA+C,OAAA,EAAAA,EAAEC,mCAAuBF,GAAAA,EAAA1C,KAAA2C,EAAG,YAAaF,EAC5F,uCGzEER,EACAhC,EACA4C,GAEApC,EAAAA,UAAU,KACR,GAAKwB,QAAuBa,IAAV7C,EAElB,IACE4C,EAAUZ,EAAWhC,EACvB,CAAE,MAAO8C,GACPC,QAAQD,MAAM,mCAAoCA,EACpD,GACC,CAACd,EAAWhC,EAAO4C,GACxB"}
|
package/dist/index.d.cts
CHANGED
|
@@ -60,6 +60,14 @@ declare const useDialstackComponents: () => DialstackComponentsContextValue;
|
|
|
60
60
|
* @throws {Error} If used outside of DialstackComponentsProvider
|
|
61
61
|
*/
|
|
62
62
|
declare const useDialstack: () => DialStackInstance;
|
|
63
|
+
/**
|
|
64
|
+
* Report a React-only component (one that is not a web component, which
|
|
65
|
+
* reports itself) in the `DialStack-Client` header. No-op outside a provider.
|
|
66
|
+
* Runs during render, like the provider's own registration, so requests from
|
|
67
|
+
* the component's children's mount effects already carry it.
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
70
|
+
declare function useReportComponent(name: string): void;
|
|
63
71
|
|
|
64
72
|
/**
|
|
65
73
|
* React hook for creating and managing Web Components
|
|
@@ -91,7 +99,14 @@ interface UseCreateComponentResult<T extends ComponentTagName> {
|
|
|
91
99
|
* // TypeScript knows about setUserId, setOnVoicemailPlay, etc.
|
|
92
100
|
* ```
|
|
93
101
|
*/
|
|
94
|
-
declare function useCreateComponent<T extends ComponentTagName>(dialstack: DialStackInstance, tagName: T
|
|
102
|
+
declare function useCreateComponent<T extends ComponentTagName>(dialstack: DialStackInstance, tagName: T,
|
|
103
|
+
/**
|
|
104
|
+
* Applies props to the element before it is attached. Attaching is what
|
|
105
|
+
* starts its first load, and the prop effects only run after that, so a
|
|
106
|
+
* setting that shapes the first request belongs here or it costs a second
|
|
107
|
+
* one. Read at creation time; it does not re-run.
|
|
108
|
+
*/
|
|
109
|
+
beforeAttach?: (component: ComponentElement[T]) => void): UseCreateComponentResult<T>;
|
|
95
110
|
|
|
96
111
|
/**
|
|
97
112
|
* React hook for synchronizing React props to Web Component setter methods
|
|
@@ -144,5 +159,5 @@ declare function useUpdateWithSetter<T extends HTMLElement, V>(component: T | nu
|
|
|
144
159
|
*/
|
|
145
160
|
declare function useAppearance(dialstack: DialStackInstance): AppearanceOptions | undefined;
|
|
146
161
|
|
|
147
|
-
export { DialstackComponentsContext, DialstackComponentsProvider, useAppearance, useCreateComponent, useDialstack, useDialstackComponents, useUpdateWithSetter };
|
|
162
|
+
export { DialstackComponentsContext, DialstackComponentsProvider, useAppearance, useCreateComponent, useDialstack, useDialstackComponents, useReportComponent, useUpdateWithSetter };
|
|
148
163
|
export type { DialstackComponentsProviderProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -60,6 +60,14 @@ declare const useDialstackComponents: () => DialstackComponentsContextValue;
|
|
|
60
60
|
* @throws {Error} If used outside of DialstackComponentsProvider
|
|
61
61
|
*/
|
|
62
62
|
declare const useDialstack: () => DialStackInstance;
|
|
63
|
+
/**
|
|
64
|
+
* Report a React-only component (one that is not a web component, which
|
|
65
|
+
* reports itself) in the `DialStack-Client` header. No-op outside a provider.
|
|
66
|
+
* Runs during render, like the provider's own registration, so requests from
|
|
67
|
+
* the component's children's mount effects already carry it.
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
70
|
+
declare function useReportComponent(name: string): void;
|
|
63
71
|
|
|
64
72
|
/**
|
|
65
73
|
* React hook for creating and managing Web Components
|
|
@@ -91,7 +99,14 @@ interface UseCreateComponentResult<T extends ComponentTagName> {
|
|
|
91
99
|
* // TypeScript knows about setUserId, setOnVoicemailPlay, etc.
|
|
92
100
|
* ```
|
|
93
101
|
*/
|
|
94
|
-
declare function useCreateComponent<T extends ComponentTagName>(dialstack: DialStackInstance, tagName: T
|
|
102
|
+
declare function useCreateComponent<T extends ComponentTagName>(dialstack: DialStackInstance, tagName: T,
|
|
103
|
+
/**
|
|
104
|
+
* Applies props to the element before it is attached. Attaching is what
|
|
105
|
+
* starts its first load, and the prop effects only run after that, so a
|
|
106
|
+
* setting that shapes the first request belongs here or it costs a second
|
|
107
|
+
* one. Read at creation time; it does not re-run.
|
|
108
|
+
*/
|
|
109
|
+
beforeAttach?: (component: ComponentElement[T]) => void): UseCreateComponentResult<T>;
|
|
95
110
|
|
|
96
111
|
/**
|
|
97
112
|
* React hook for synchronizing React props to Web Component setter methods
|
|
@@ -144,5 +159,5 @@ declare function useUpdateWithSetter<T extends HTMLElement, V>(component: T | nu
|
|
|
144
159
|
*/
|
|
145
160
|
declare function useAppearance(dialstack: DialStackInstance): AppearanceOptions | undefined;
|
|
146
161
|
|
|
147
|
-
export { DialstackComponentsContext, DialstackComponentsProvider, useAppearance, useCreateComponent, useDialstack, useDialstackComponents, useUpdateWithSetter };
|
|
162
|
+
export { DialstackComponentsContext, DialstackComponentsProvider, useAppearance, useCreateComponent, useDialstack, useDialstackComponents, useReportComponent, useUpdateWithSetter };
|
|
148
163
|
export type { DialstackComponentsProviderProps };
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e,{createContext as t,useContext as
|
|
1
|
+
import e,{createContext as t,useContext as n,useRef as r,useLayoutEffect as a,useState as o,useCallback as i,useEffect as c}from"react";const s=t(null),l=({dialstack:t,children:n})=>{var r;null===(r=null==t?void 0:t.registerClientPackage)||void 0===r||r.call(t,"sdk-react","3.8.0");const a={dialstack:t};return e.createElement(s.Provider,{value:a},n)},d=()=>{const e=n(s);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/sdks/setup for setup instructions.");return e},u=()=>{const{dialstack:e}=d();return e};function p(e){var t,r,a;null===(a=null===(r=null===(t=n(s))||void 0===t?void 0:t.dialstack)||void 0===r?void 0:r.registerClientComponent)||void 0===a||a.call(r,"sdk-react",e)}function v(e,t,n){const c=r(null),s=r(n);a(()=>{s.current=n});const[l,d]=o(null);return{containerRef:i(n=>{var r;if(c.current&&c.current.parentNode&&(c.current.parentNode.removeChild(c.current),c.current=null,d(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}null===(r=s.current)||void 0===r||r.call(s,a),n.appendChild(a),c.current=a,d(a)},[e,t]),componentInstance:l}}function f(e,t,n){c(()=>{if(e&&void 0!==t)try{n(e,t)}catch(e){console.error("DialStack: Error calling setter:",e)}},[e,t,n])}function k(e){const[t,n]=o(()=>e.getAppearance());return c(()=>{if("undefined"==typeof document)return;const t=document.createElement("div"),r=e=>{const t=e.detail;n(null==t?void 0:t.appearance)};return t.addEventListener("dialstack-appearance-update",r),e.addAppearanceTarget(t),()=>{e.removeAppearanceTarget(t),t.removeEventListener("dialstack-appearance-update",r)}},[e]),t}export{s as DialstackComponentsContext,l as DialstackComponentsProvider,k as useAppearance,v as useCreateComponent,u as useDialstack,d as useDialstackComponents,p as useReportComponent,f as useUpdateWithSetter};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/react/
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/react/version.ts","../src/react/DialstackComponentsProvider.tsx","../src/react/useCreateComponent.tsx","../src/react/useUpdateWithSetter.ts","../src/react/useAppearance.ts"],"sourcesContent":[null,null,null,null,null],"names":["DialstackComponentsContext","createContext","DialstackComponentsProvider","dialstack","children","_a","registerClientPackage","call","value","React","createElement","Provider","useDialstackComponents","context","useContext","Error","useDialstack","useReportComponent","name","_c","_b","registerClientComponent","useCreateComponent","tagName","beforeAttach","componentRef","useRef","beforeAttachRef","useLayoutEffect","current","componentInstance","setComponentInstance","useState","containerRef","useCallback","container","parentNode","removeChild","component","create","element","setInstance","assertUpgraded","err","removeAppearanceTarget","appendChild","useUpdateWithSetter","onUpdated","useEffect","undefined","error","console","useAppearance","appearance","setAppearance","getAppearance","document","target","handler","event","detail","addEventListener","addAppearanceTarget","removeEventListener"],"mappings":"wIAEO,MCkBDA,EAA6BC,EAAsD,MAkC5EC,EAA0EA,EACrFC,YACAC,qBAOgC,QAAhCC,EAAAF,aAAS,EAATA,EAAWG,6BAAqB,IAAAD,GAAAA,EAAAE,KAAAJ,EAAG,YD7DN,SC+D7B,MAAMK,EAAyC,CAC7CL,aAGF,OACEM,EAAAC,cAACV,EAA2BW,SAAQ,CAACH,MAAOA,GACzCJ,IAUMQ,EAAyBA,KACpC,MAAMC,EAAUC,EAAWd,GAC3B,IAAKa,EACH,MAAM,IAAIE,MACR,6KAIJ,OAAOF,GAQIG,EAAeA,KAC1B,MAAMb,UAAEA,GAAcS,IACtB,OAAOT,GAUH,SAAUc,EAAmBC,aACyC,QAA1EC,EAAiD,QAAjDC,EAAsC,QAAtCf,EAAAS,EAAWd,UAA2B,IAAAK,OAAA,EAAAA,EAAEF,iBAAS,IAAAiB,OAAA,EAAAA,EAAEC,mCAAuBF,GAAAA,EAAAZ,KAAAa,EAAG,YAAaF,EAC5F,CC7CM,SAAUI,EACdnB,EACAoB,EAOAC,GAEA,MAAMC,EAAeC,EAAmC,MAIlDC,EAAkBD,EAAOF,GAC/BI,EAAgB,KACdD,EAAgBE,QAA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