@zealicsolutions/web-ui 1.0.140-beta.224 → 1.0.140-beta.226
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/cjs/contexts/WebpageContext/WebpageContext.d.ts +13 -0
- package/dist/cjs/contexts/WebpageContext/WebpageContextProvider.d.ts +7 -1
- package/dist/cjs/contexts/WebpageContext/useWebpageContext.d.ts +7 -1
- package/dist/cjs/index.js +87 -87
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/molecules/BasicTextField/BasicTextField.d.ts +11 -0
- package/dist/cjs/molecules/Select/Select.d.ts +11 -0
- package/dist/esm/contexts/WebpageContext/WebpageContext.d.ts +13 -0
- package/dist/esm/contexts/WebpageContext/WebpageContext.js.map +1 -1
- package/dist/esm/contexts/WebpageContext/WebpageContextProvider.d.ts +7 -1
- package/dist/esm/contexts/WebpageContext/WebpageContextProvider.js +1 -1
- package/dist/esm/contexts/WebpageContext/WebpageContextProvider.js.map +1 -1
- package/dist/esm/contexts/WebpageContext/useWebpageContext.d.ts +7 -1
- package/dist/esm/contexts/WebpageContext/useWebpageContext.js +1 -1
- package/dist/esm/contexts/WebpageContext/useWebpageContext.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/molecules/BasicTextField/BasicTextField.d.ts +11 -0
- package/dist/esm/molecules/BasicTextField/BasicTextField.js +1 -1
- package/dist/esm/molecules/BasicTextField/BasicTextField.js.map +1 -1
- package/dist/esm/molecules/Button/hooks/useButtonAction.js +1 -1
- package/dist/esm/molecules/Button/hooks/useButtonAction.js.map +1 -1
- package/dist/esm/molecules/Select/Select.d.ts +11 -0
- package/dist/esm/molecules/Select/Select.js +1 -1
- package/dist/esm/molecules/Select/Select.js.map +1 -1
- package/package.json +1 -1
|
@@ -50,5 +50,16 @@ export type BasicTextFieldProps = MuiTextFieldProps & {
|
|
|
50
50
|
hideLabel?: boolean;
|
|
51
51
|
/** MUI input variant - 'outlined', 'filled', or 'standard' */
|
|
52
52
|
variant?: 'outlined' | 'filled' | 'standard';
|
|
53
|
+
/**
|
|
54
|
+
* When true, the resolved data value will be published to the Webpage Context
|
|
55
|
+
* for use by Cortex AI and other page-level consumers.
|
|
56
|
+
*/
|
|
57
|
+
publishToWebpageContext?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* The key under which to store the value in Webpage Context's dynamicContext.
|
|
60
|
+
* Required when publishToWebpageContext is true.
|
|
61
|
+
* Examples: "studyId", "subjectId", "protocolId", "visitId"
|
|
62
|
+
*/
|
|
63
|
+
webpageContextKey?: string;
|
|
53
64
|
};
|
|
54
65
|
export declare const BasicTextField: React.FC<BasicTextFieldProps>;
|
|
@@ -53,5 +53,16 @@ export interface SelectMoleculeProps {
|
|
|
53
53
|
hideLabel?: boolean;
|
|
54
54
|
variant?: 'outlined' | 'filled' | 'standard';
|
|
55
55
|
native?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* When true, the resolved data value will be published to the Webpage Context
|
|
58
|
+
* for use by Cortex AI and other page-level consumers.
|
|
59
|
+
*/
|
|
60
|
+
publishToWebpageContext?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* The key under which to store the value in Webpage Context's dynamicContext.
|
|
63
|
+
* Required when publishToWebpageContext is true.
|
|
64
|
+
* Examples: "studyId", "subjectId", "protocolId", "visitId"
|
|
65
|
+
*/
|
|
66
|
+
webpageContextKey?: string;
|
|
56
67
|
}
|
|
57
68
|
export declare const SelectMolecule: React.FC<SelectMoleculeProps>;
|
|
@@ -92,5 +92,18 @@ export type WebpageContextType = {
|
|
|
92
92
|
* The host application can decide what payload to support here.
|
|
93
93
|
*/
|
|
94
94
|
openAIChat?: (options?: OpenAIChatOptions) => void | Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Dynamic context data published by molecules on the page.
|
|
97
|
+
* Molecules configured with `publishToWebpageContext` will add their resolved
|
|
98
|
+
* values here using `webpageContextKey` as the key.
|
|
99
|
+
* Any consumer (e.g., Cortex AI, analytics) can read this context.
|
|
100
|
+
*/
|
|
101
|
+
dynamicContext?: Record<string, unknown>;
|
|
102
|
+
/**
|
|
103
|
+
* Callback for molecules to publish their resolved values to the webpage context.
|
|
104
|
+
* @param key - The context key (e.g., "studyId", "subjectId")
|
|
105
|
+
* @param value - The resolved value to store
|
|
106
|
+
*/
|
|
107
|
+
setDynamicContextValue?: (key: string, value: unknown) => void;
|
|
95
108
|
};
|
|
96
109
|
export declare const WebpageContext: React.Context<WebpageContextType | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebpageContext.js","sources":["../../../../../src/contexts/WebpageContext/WebpageContext.ts"],"sourcesContent":[null],"names":["WebpageContext","createContext","undefined"],"mappings":"
|
|
1
|
+
{"version":3,"file":"WebpageContext.js","sources":["../../../../../src/contexts/WebpageContext/WebpageContext.ts"],"sourcesContent":[null],"names":["WebpageContext","createContext","undefined"],"mappings":"4CAmHaA,EAAiBC,OAA8CC"}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { FC, ReactNode } from 'react';
|
|
2
2
|
import { type WebpageContextType } from './WebpageContext';
|
|
3
|
-
export interface WebpageContextProviderProps extends WebpageContextType {
|
|
3
|
+
export interface WebpageContextProviderProps extends Omit<WebpageContextType, 'dynamicContext' | 'setDynamicContextValue'> {
|
|
4
4
|
children: ReactNode;
|
|
5
|
+
/**
|
|
6
|
+
* Callback invoked when molecules publish context values.
|
|
7
|
+
* Used to notify parent components (e.g., CortexProvider) of dynamic context changes.
|
|
8
|
+
* @param context - The full dynamicContext object with all published values
|
|
9
|
+
*/
|
|
10
|
+
onDynamicContextChange?: (context: Record<string, unknown>) => void;
|
|
5
11
|
}
|
|
6
12
|
export declare const WebpageContextProvider: FC<WebpageContextProviderProps>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e}from"../../node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.esm.js";import{useMemo as
|
|
1
|
+
import{jsx as e}from"../../node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.esm.js";import{useState as t,useRef as o,useEffect as n,useCallback as r,useMemo as a}from"react";import{WebpageContext as i}from"./WebpageContext.js";const c=({children:c,webpageId:m,webpageName:p,withAISupport:s,cortexAgentId:x,cortexConfig:d,rwoContext:g,isAIAvailable:u,openAIChat:C,onDynamicContextChange:l})=>{const[A,I]=t({}),b=o(l);b.current=l,n(()=>{b.current&&Object.keys(A).length>0&&b.current(A)},[A]);const h=r((e,t)=>{I(o=>o[e]===t?o:{...o,[e]:t})},[]),w=a(()=>({webpageId:m,webpageName:p,withAISupport:s,cortexAgentId:x,cortexConfig:d,rwoContext:g,isAIAvailable:u,openAIChat:C,dynamicContext:A,setDynamicContextValue:h}),[m,p,s,x,d,g,u,C,A,h]);return e(i.Provider,{value:w,children:c})};export{c as WebpageContextProvider};
|
|
2
2
|
//# sourceMappingURL=WebpageContextProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebpageContextProvider.js","sources":["../../../../../src/contexts/WebpageContext/WebpageContextProvider.tsx"],"sourcesContent":[null],"names":["WebpageContextProvider","children","webpageId","webpageName","withAISupport","cortexAgentId","cortexConfig","rwoContext","isAIAvailable","openAIChat","value","useMemo","_jsx","WebpageContext","Provider"],"mappings":"
|
|
1
|
+
{"version":3,"file":"WebpageContextProvider.js","sources":["../../../../../src/contexts/WebpageContext/WebpageContextProvider.tsx"],"sourcesContent":[null],"names":["WebpageContextProvider","children","webpageId","webpageName","withAISupport","cortexAgentId","cortexConfig","rwoContext","isAIAvailable","openAIChat","onDynamicContextChange","dynamicContext","setDynamicContext","useState","onDynamicContextChangeRef","useRef","current","useEffect","Object","keys","length","setDynamicContextValue","useCallback","key","newValue","prev","value","useMemo","_jsx","WebpageContext","Provider"],"mappings":"yPAea,MAAAA,EAA0D,EACrEC,WACAC,YACAC,cACAC,gBACAC,gBACAC,eACAC,aACAC,gBACAC,aACAC,6BAGA,MAAOC,EAAgBC,GAAqBC,EAAkC,CAAE,GAG1EC,EAA4BC,EAAOL,GACzCI,EAA0BE,QAAUN,EAGpCO,EAAU,KACJH,EAA0BE,SAAWE,OAAOC,KAAKR,GAAgBS,OAAS,GAC5EN,EAA0BE,QAAQL,IAEnC,CAACA,IAGJ,MAAMU,EAAyBC,EAAY,CAACC,EAAaC,KACvDZ,EAAmBa,GAEbA,EAAKF,KAASC,EAAiBC,EAC5B,IAAKA,EAAMF,CAACA,GAAMC,KAE1B,IAEGE,EAAQC,EACZ,KAAO,CACLzB,YACAC,cACAC,gBACAC,gBACAC,eACAC,aACAC,gBACAC,aACAE,iBACAU,2BAEF,CACEnB,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAE,EACAU,IAIJ,OAAOO,EAACC,EAAeC,SAAQ,CAACJ,MAAOA,EAAKzB,SAAGA"}
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { WebpageContextType } from './WebpageContext';
|
|
2
|
+
export declare const useWebpageContext: () => WebpageContextType;
|
|
3
|
+
/**
|
|
4
|
+
* Safe version of useWebpageContext that returns undefined if not within a provider.
|
|
5
|
+
* Use this in molecules that may render outside of a webpage context (e.g., Storybook).
|
|
6
|
+
*/
|
|
7
|
+
export declare const useWebpageContextSafe: () => WebpageContextType | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useContext as e}from"react";import{WebpageContext as t}from"./WebpageContext.js";const r=()=>{const r=e(t);if(!r)throw new Error("useWebpageContext must be used within a WebpageContextProvider");return r};export{r as useWebpageContext};
|
|
1
|
+
import{useContext as e}from"react";import{WebpageContext as t}from"./WebpageContext.js";const r=()=>{const r=e(t);if(!r)throw new Error("useWebpageContext must be used within a WebpageContextProvider");return r},o=()=>e(t);export{r as useWebpageContext,o as useWebpageContextSafe};
|
|
2
2
|
//# sourceMappingURL=useWebpageContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWebpageContext.js","sources":["../../../../../src/contexts/WebpageContext/useWebpageContext.ts"],"sourcesContent":[null],"names":["useWebpageContext","ctx","useContext","WebpageContext","Error"],"mappings":"wFAIO,MAAMA,EAAoB,KAC/B,MAAMC,EAAMC,EAAWC,GAEvB,IAAKF,EACH,MAAM,IAAIG,MAAM,kEAGlB,OAAOH"}
|
|
1
|
+
{"version":3,"file":"useWebpageContext.js","sources":["../../../../../src/contexts/WebpageContext/useWebpageContext.ts"],"sourcesContent":[null],"names":["useWebpageContext","ctx","useContext","WebpageContext","Error","useWebpageContextSafe"],"mappings":"wFAIO,MAAMA,EAAoB,KAC/B,MAAMC,EAAMC,EAAWC,GAEvB,IAAKF,EACH,MAAM,IAAIG,MAAM,kEAGlB,OAAOH,GAOII,EAAwB,IAC5BH,EAAWC"}
|