@osdk/widget.client-react 3.5.1-main-20260406220320 → 3.6.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/CHANGELOG.md CHANGED
@@ -1,13 +1,22 @@
1
1
  # @osdk/widget.client-react
2
2
 
3
- ## 3.5.1-main-20260406220320
3
+ ## 3.6.0
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - Updated dependencies [f8b9f12]
7
8
  - Updated dependencies [bcf359f]
9
+ - Updated dependencies [0b349bd]
10
+ - Updated dependencies [12f9b36]
11
+ - Updated dependencies [cbc8e9c]
12
+ - Updated dependencies [9171453]
13
+ - Updated dependencies [e8d14a0]
8
14
  - Updated dependencies [51ccca8]
9
- - @osdk/client@2.8.1-main-20260406220320
10
- - @osdk/widget.client@3.5.1-main-20260406220320
15
+ - Updated dependencies [fb85818]
16
+ - Updated dependencies [ec06b26]
17
+ - Updated dependencies [2394ca7]
18
+ - @osdk/client@2.9.0
19
+ - @osdk/widget.client@3.6.0
11
20
 
12
21
  ## 3.5.0
13
22
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/context.ts","../../src/ErrorBoundary.tsx","../../src/utils/extendParametersWithObjectSets.ts","../../src/utils/initializeParameters.ts","../../src/utils/transformEmitEventPayload.ts","../../src/client.tsx"],"names":["FoundryHostEventTarget","useContext","React2","hydrateObjectSetFromRid","createAndFetchTempObjectSetRid","useMemo","createFoundryWidgetClient","React","useRef","useCallback","useEffect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BO,IAAM,oBAAA,6CAA0C,aAAc,CAAA;AAAA,EACnE,WAAW,MAAM;AAAA,GAAC;AAAA,EAClB,eAAA,EAAiB,IAAIA,oCAAuB,EAAA;AAAA,EAC5C,sBAAsB,EAAC;AAAA,EACvB,UAAY,EAAA;AAAA,IACV,KAAO,EAAA,aAAA;AAAA,IACP,QAAQ;AAAC;AAEb,CAAC,CAAA;AAKM,SAAS,uBAA0B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AA,GACF,EAAG,EAAE,CAAA;AACL,EAAA,uBAAoBH,yBAAAA,CAAM,aAAc,CAAA,oBAAA,CAAqB,QAAU,EAAA;AAAA,IACrE,KAAO,EAAA;AAAA,MACL,SAAA;AAAA,MACA,iBAAiB,MAAO,CAAA,eAAA;AAAA,MACxB,oBAAA;AAAA,MACA,UAAY,EAAA;AAAA,QACV,MAAA,EAAQ,kBAAmB,CAAA,KAAA,IAAS,EAAC;AAAA,QACrC,OAAO,kBAAmB,CAAA;AAAA;AAC5B;AAAA;AAEF,qBACcA,yBAAAA,CAAM,cAAc,aAAe,EAAA,IAAA,EAAM,QAAQ,CAAC,CAAA;AACpE","file":"index.cjs","sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software=\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FoundryHostEventTarget } from \"@osdk/widget.client\";\nimport React, { useContext } from \"react\";\n\n/**\n * Emits a widget event with parameter updates to the host Foundry UI.\n *\n * For object set parameters, pass `ObjectSet<T>` directly.\n * If the same event is emitted multiple times in quick succession and involves Object Set parameters, only the last call will be sent.\n * Errors (e.g., network failures when serializing ObjectSet parameters) are not surfaced to the caller.\n */\n\nexport const FoundryWidgetContext = /*#__PURE__*/React.createContext({\n emitEvent: () => {},\n hostEventTarget: new FoundryHostEventTarget(),\n asyncParameterValues: {},\n parameters: {\n state: \"not-started\",\n values: {}\n }\n});\n\n/**\n * @returns The current FoundryWidgetClientContext, in the context of your specific parameter configuration\n */\nexport function useFoundryWidgetContext() {\n return useContext(FoundryWidgetContext);\n}\n(function (_useFoundryWidgetContext) {\n function withTypes() {\n return () => {\n return useFoundryWidgetContext();\n };\n }\n _useFoundryWidgetContext.withTypes = withTypes;\n})(useFoundryWidgetContext || (useFoundryWidgetContext = {}));","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\n/**\n * Error boundary to catch and display errors in widget code.\n */\nexport class ErrorBoundary extends React.Component {\n state = {\n error: null\n };\n static getDerivedStateFromError(error) {\n return {\n error\n };\n }\n render() {\n if (this.state.error) {\n const errorDetails = this.state.error instanceof Error ? this.state.error.stack : \"See browser console for more details.\";\n return /*#__PURE__*/React.createElement(\"section\", {\n style: {\n padding: \"16px\"\n }\n }, /*#__PURE__*/React.createElement(\"h3\", {\n style: {\n margin: \"0 0 12px 0\",\n color: \"#c00\"\n }\n }, \"An uncaught error occurred\"), process.env.NODE_ENV !== \"production\" && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"p\", {\n style: {\n margin: \"0 0 8px 0\"\n }\n }, \"This error was caught by the widget framework's fallback error boundary.\"), /*#__PURE__*/React.createElement(\"ul\", {\n style: {\n margin: \"0 0 16px 0\"\n }\n }, /*#__PURE__*/React.createElement(\"li\", null, \"Ensure errors are properly handled in your code with try-catch blocks and promise rejection handling.\"), /*#__PURE__*/React.createElement(\"li\", null, \"Add your own error boundary to replace this fallback with a custom error message or recovery options for your users.\"), /*#__PURE__*/React.createElement(\"li\", null, \"See:\", \" \", /*#__PURE__*/React.createElement(\"code\", null, \"https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary\")))), /*#__PURE__*/React.createElement(\"pre\", {\n style: {\n backgroundColor: \"#f5f5f5\",\n padding: \"12px\",\n overflow: \"auto\",\n fontSize: \"12px\",\n margin: 0\n }\n }, errorDetails));\n }\n return this.props.children;\n }\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { hydrateObjectSetFromRid } from \"@osdk/client/internal\";\n/**\n * Patches parameter values with hydrated object sets for object set parameters.\n *\n * The cache is used to avoid redundant hydration of the same object set RID, which\n * can cause unnecessary re-renders in React components consuming the parameters.\n */\nexport function extendParametersWithObjectSets(osdkClient, config, parameters, cache) {\n const extendedParameters = {\n ...parameters\n };\n for (const parameterId of Object.keys(extendedParameters)) {\n const param = config.parameters[parameterId];\n if (param.type === \"objectSet\" && extendedParameters[parameterId].type === \"objectSet\") {\n const parameterValue = extendedParameters[parameterId].value.value;\n if (parameterValue != null) {\n if (typeof parameterValue === \"object\" && \"objectSetRid\" in parameterValue && typeof parameterValue.objectSetRid === \"string\") {\n const objectSetRid = parameterValue.objectSetRid;\n const objectSet = getOrHydrateObjectSet(osdkClient, cache, parameterId, objectSetRid, param.allowedType);\n parameterValue.objectSet = objectSet;\n } else {\n throw new Error(`Invalid object set parameter value for parameter \"${parameterId}\"`);\n }\n } else {\n cache.delete(parameterId);\n }\n }\n }\n return extendedParameters;\n}\nfunction getOrHydrateObjectSet(osdkClient, cache, paramKey, objectSetRid, definition) {\n if (osdkClient == null) {\n throw new Error(\"Not provided an OSDK client\");\n }\n const cached = cache.get(paramKey);\n if (cached?.objectSetRid === objectSetRid) {\n return cached.objectSet;\n }\n const objectSet = hydrateObjectSetFromRid(osdkClient, definition, objectSetRid);\n cache.set(paramKey, {\n objectSetRid,\n objectSet\n });\n return objectSet;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Utility function to initialize a map of parameter values to either a loading or not-started loading state\n */\nexport function initializeParameters(config, initialLoadingState) {\n return Object.fromEntries(Object.entries(config.parameters).map(([key, parameterConfig]) => [key, {\n type: parameterConfig.type,\n value: {\n type: initialLoadingState\n }\n }]));\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createAndFetchTempObjectSetRid } from \"@osdk/client/internal\";\nexport function transformEmitEventPayload(config, eventId, payload, osdkClient) {\n for (const paramId of Object.keys(payload.parameterUpdates)) {\n const paramConfig = config.parameters[paramId];\n if (paramConfig?.type === \"objectSet\") {\n return {\n type: \"async\",\n payload: transformEmitEventPayloadAsync(config, eventId, payload, osdkClient)\n };\n }\n }\n\n // No object set parameters, pass through synchronously\n return {\n type: \"passThrough\",\n payload: {\n parameterUpdates: payload.parameterUpdates\n }\n };\n}\n\n/**\n * Transforms an augmented emit event payload by creating temporary object sets\n * from ObjectSet instances.\n *\n * Multiple ObjectSet parameters are transformed in parallel for better performance.\n */\nexport async function transformEmitEventPayloadAsync(config, eventId, payload, osdkClient) {\n const event = config.events[eventId];\n if (event == null) {\n throw new Error(`Event with ID \"${eventId.toString()}\" not found in widget config`);\n }\n const entries = Object.entries(payload.parameterUpdates);\n const transformedEntries = await Promise.all(entries.map(async ([paramId, paramValue]) => {\n const paramConfig = config.parameters[paramId];\n if (paramConfig?.type === \"objectSet\") {\n if (osdkClient == null) {\n throw new Error(`Cannot emit event \"${eventId.toString()}\" with ObjectSet parameter \"${paramId}\" without an osdk client`);\n }\n const objectSetRid = await createAndFetchTempObjectSetRid(osdkClient, paramValue);\n return [paramId, {\n objectSetRid\n }];\n }\n return [paramId, paramValue];\n }));\n return {\n parameterUpdates: Object.fromEntries(transformedEntries)\n };\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createFoundryWidgetClient } from \"@osdk/widget.client\";\nimport React, { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { FoundryWidgetContext } from \"./context.js\";\nimport { ErrorBoundary } from \"./ErrorBoundary.js\";\nimport { extendParametersWithObjectSets } from \"./utils/extendParametersWithObjectSets.js\";\nimport { initializeParameters } from \"./utils/initializeParameters.js\";\nimport { transformEmitEventPayload } from \"./utils/transformEmitEventPayload.js\";\n/**\n * Handles subscribing to messages from the host Foundry UI and updating the widget's parameter values accordingly via React context\n */\nexport const FoundryWidget = ({\n children,\n config,\n initialValues,\n client: osdkClient\n}) => {\n const client = useMemo(() => createFoundryWidgetClient(), []);\n const [asyncParameterValues, setAsyncParameterValues] = React.useState(initialValues ?? initializeParameters(config, \"not-started\"));\n const [allParameterValues, setAllParameterValues] = React.useState({\n type: \"not-started\"\n });\n const objectSetCache = useRef(new Map());\n const emitEventCallIds = useRef(new Map());\n const emitEvent = useCallback((eventId, payload) => {\n const transformResult = transformEmitEventPayload(config, eventId, payload, osdkClient);\n if (transformResult.type === \"passThrough\") {\n client.emitEvent(eventId, transformResult.payload);\n return;\n }\n async function handleAsyncEmitEvent() {\n const eventKey = String(eventId);\n const thisCallId = (emitEventCallIds.current.get(eventKey) ?? 0) + 1;\n emitEventCallIds.current.set(eventKey, thisCallId);\n const transformedPayload = await transformResult.payload;\n if (thisCallId !== emitEventCallIds.current.get(eventKey)) {\n return;\n }\n client.emitEvent(eventId, transformedPayload);\n }\n void handleAsyncEmitEvent();\n }, [osdkClient, config, client]);\n useEffect(() => {\n client.subscribe();\n client.hostEventTarget.addEventListener(\"host.update-parameters\", payload => {\n const processedParameters = extendParametersWithObjectSets(osdkClient, config, payload.detail.parameters, objectSetCache.current);\n setAsyncParameterValues(currentParameters => ({\n ...currentParameters,\n ...processedParameters\n }));\n setAllParameterValues(currentParameters => {\n let aggregatedLoadedState = \"loaded\";\n let firstError;\n const newParameterValues = {};\n for (const key in processedParameters) {\n const value = processedParameters[key].value;\n // If any fails, consider the whole thing failed\n if (value.type === \"failed\") {\n aggregatedLoadedState = \"failed\";\n firstError = firstError ?? value.error;\n newParameterValues[key] = value.value;\n continue;\n }\n // If any is loading, consider all of it loading unless we have failed somewhere\n if (value.type === \"loading\" && aggregatedLoadedState !== \"failed\") {\n aggregatedLoadedState = \"loading\";\n continue;\n }\n // If any is reloading, consider it loading unless something is failed or loading for the first time\n if (value.type === \"reloading\" && aggregatedLoadedState !== \"failed\" && aggregatedLoadedState !== \"loading\") {\n aggregatedLoadedState = \"reloading\";\n newParameterValues[key] = value.value;\n continue;\n }\n if (value.type === \"not-started\" && aggregatedLoadedState !== \"failed\" && aggregatedLoadedState !== \"loading\" && aggregatedLoadedState !== \"reloading\") {\n aggregatedLoadedState = \"not-started\";\n }\n if (value.type === \"loaded\") {\n newParameterValues[key] = value.value;\n }\n }\n const currentParameterValue = currentParameters.type !== \"not-started\" && currentParameters.type !== \"loading\" ? currentParameters.value : {};\n if (aggregatedLoadedState !== \"not-started\" && aggregatedLoadedState !== \"loading\") {\n const updatedValue = {\n ...currentParameterValue,\n ...newParameterValues\n };\n return aggregatedLoadedState === \"failed\" ? {\n type: aggregatedLoadedState,\n value: updatedValue,\n error: firstError ?? new Error(\"Failed to load parameters\")\n } : {\n type: aggregatedLoadedState,\n value: updatedValue\n };\n } else {\n return {\n type: aggregatedLoadedState\n };\n }\n });\n });\n client.ready();\n const resizeObserver = new ResizeObserver(entries => {\n if (entries.length !== 1) {\n // eslint-disable-next-line no-console\n console.error(\"Expected exactly one resize observer entry but received:\", entries);\n return;\n }\n const entry = entries[0];\n if (entry.borderBoxSize.length !== 1) {\n // eslint-disable-next-line no-console\n console.error(\"Expected exactly one border box size but received:\", entry.borderBoxSize);\n return;\n }\n const {\n inlineSize: width,\n blockSize: height\n } = entry.borderBoxSize[0];\n client.resize({\n width,\n height\n });\n });\n resizeObserver.observe(document.body, {\n box: \"border-box\"\n });\n return () => {\n client.unsubscribe();\n resizeObserver.disconnect();\n };\n }, []);\n return /*#__PURE__*/React.createElement(FoundryWidgetContext.Provider, {\n value: {\n emitEvent,\n hostEventTarget: client.hostEventTarget,\n asyncParameterValues,\n parameters: {\n values: allParameterValues.value ?? {},\n state: allParameterValues.type\n }\n // Unfortunately the context is statically defined so we can't use the generic type, hence the cast\n }\n }, /*#__PURE__*/React.createElement(ErrorBoundary, null, children));\n};"]}
1
+ {"version":3,"sources":["../../src/context.ts","../../src/ErrorBoundary.tsx","../../src/utils/extendParametersWithObjectSets.ts","../../src/utils/initializeParameters.ts","../../src/utils/transformEmitEventPayload.ts","../../src/client.tsx"],"names":["FoundryHostEventTarget","useContext","React2","hydrateObjectSetFromRid","createAndFetchTemp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AA,EAAG;AAEpC,QAAA,OAAA,CAAQ,KAAA,CAAM,oDAAA,EAAsD,KAAA,CAAM,aAAa,CAAA;AACvF,QAAA;AAAA,MACF;AACA,MAAA,MAAM;AAAA,QACJ,UAAA,EAAY,KAAA;AAAA,QACZ,SAAA,EAAW;AAAA,OACb,GAAI,KAAA,CAAM,aAAA,CAAc,CAAC,CAAA;AACzB,MAAA,MAAA,CAAO,MAAA,CAAO;AAAA,QACZ,KAAA;AAAA,QACA;AAAA,OACD,CAAA;AAAA,IACH,CAAC,CAAA;AACD,IAAA,cAAA,CAAe,OAAA,CAAQ,SAAS,IAAA,EAAM;AAAA,MACpC,GAAA,EAAK;AAAA,KACN,CAAA;AACD,IAAA,OAAO,MAAM;AACX,MAAA,MAAA,CAAO,WAAA,EAAY;AACnB,MAAA,cAAA,CAAe,UAAA,EAAW;AAAA,IAC5B,CAAA;AAAA,EACF,CAAA,EAAG,EAAE,CAAA;AACL,EAAA,uBAAoBH,yBAAAA,CAAM,aAAA,CAAc,oBAAA,CAAqB,QAAA,EAAU;AAAA,IACrE,KAAA,EAAO;AAAA,MACL,SAAA;AAAA,MACA,iBAAiB,MAAA,CAAO,eAAA;AAAA,MACxB,oBAAA;AAAA,MACA,UAAA,EAAY;AAAA,QACV,MAAA,EAAQ,kBAAA,CAAmB,KAAA,IAAS,EAAC;AAAA,QACrC,OAAO,kBAAA,CAAmB;AAAA;AAC5B;AAAA;AAEF,qBACcA,yBAAAA,CAAM,cAAc,aAAA,EAAe,IAAA,EAAM,QAAQ,CAAC,CAAA;AACpE","file":"index.cjs","sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software=\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FoundryHostEventTarget } from \"@osdk/widget.client\";\nimport React, { useContext } from \"react\";\n\n/**\n * Emits a widget event with parameter updates to the host Foundry UI.\n *\n * For object set parameters, pass `ObjectSet<T>` directly.\n * If the same event is emitted multiple times in quick succession and involves Object Set parameters, only the last call will be sent.\n * Errors (e.g., network failures when serializing ObjectSet parameters) are not surfaced to the caller.\n */\n\nexport const FoundryWidgetContext = /*#__PURE__*/React.createContext({\n emitEvent: () => {},\n hostEventTarget: new FoundryHostEventTarget(),\n asyncParameterValues: {},\n parameters: {\n state: \"not-started\",\n values: {}\n }\n});\n\n/**\n * @returns The current FoundryWidgetClientContext, in the context of your specific parameter configuration\n */\nexport function useFoundryWidgetContext() {\n return useContext(FoundryWidgetContext);\n}\n(function (_useFoundryWidgetContext) {\n function withTypes() {\n return () => {\n return useFoundryWidgetContext();\n };\n }\n _useFoundryWidgetContext.withTypes = withTypes;\n})(useFoundryWidgetContext || (useFoundryWidgetContext = {}));","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\n/**\n * Error boundary to catch and display errors in widget code.\n */\nexport class ErrorBoundary extends React.Component {\n state = {\n error: null\n };\n static getDerivedStateFromError(error) {\n return {\n error\n };\n }\n render() {\n if (this.state.error) {\n const errorDetails = this.state.error instanceof Error ? this.state.error.stack : \"See browser console for more details.\";\n return /*#__PURE__*/React.createElement(\"section\", {\n style: {\n padding: \"16px\"\n }\n }, /*#__PURE__*/React.createElement(\"h3\", {\n style: {\n margin: \"0 0 12px 0\",\n color: \"#c00\"\n }\n }, \"An uncaught error occurred\"), process.env.NODE_ENV !== \"production\" && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"p\", {\n style: {\n margin: \"0 0 8px 0\"\n }\n }, \"This error was caught by the widget framework's fallback error boundary.\"), /*#__PURE__*/React.createElement(\"ul\", {\n style: {\n margin: \"0 0 16px 0\"\n }\n }, /*#__PURE__*/React.createElement(\"li\", null, \"Ensure errors are properly handled in your code with try-catch blocks and promise rejection handling.\"), /*#__PURE__*/React.createElement(\"li\", null, \"Add your own error boundary to replace this fallback with a custom error message or recovery options for your users.\"), /*#__PURE__*/React.createElement(\"li\", null, \"See:\", \" \", /*#__PURE__*/React.createElement(\"code\", null, \"https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary\")))), /*#__PURE__*/React.createElement(\"pre\", {\n style: {\n backgroundColor: \"#f5f5f5\",\n padding: \"12px\",\n overflow: \"auto\",\n fontSize: \"12px\",\n margin: 0\n }\n }, errorDetails));\n }\n return this.props.children;\n }\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { hydrateObjectSetFromRid } from \"@osdk/client/internal\";\n/**\n * Patches parameter values with hydrated object sets for object set parameters.\n *\n * The cache is used to avoid redundant hydration of the same object set RID, which\n * can cause unnecessary re-renders in React components consuming the parameters.\n */\nexport function extendParametersWithObjectSets(osdkClient, config, parameters, cache) {\n const extendedParameters = {\n ...parameters\n };\n for (const parameterId of Object.keys(extendedParameters)) {\n const param = config.parameters[parameterId];\n if (param.type === \"objectSet\" && extendedParameters[parameterId].type === \"objectSet\") {\n const parameterValue = extendedParameters[parameterId].value.value;\n if (parameterValue != null) {\n if (typeof parameterValue === \"object\" && \"objectSetRid\" in parameterValue && typeof parameterValue.objectSetRid === \"string\") {\n const objectSetRid = parameterValue.objectSetRid;\n const objectSet = getOrHydrateObjectSet(osdkClient, cache, parameterId, objectSetRid, param.allowedType);\n parameterValue.objectSet = objectSet;\n } else {\n throw new Error(`Invalid object set parameter value for parameter \"${parameterId}\"`);\n }\n } else {\n cache.delete(parameterId);\n }\n }\n }\n return extendedParameters;\n}\nfunction getOrHydrateObjectSet(osdkClient, cache, paramKey, objectSetRid, definition) {\n if (osdkClient == null) {\n throw new Error(\"Not provided an OSDK client\");\n }\n const cached = cache.get(paramKey);\n if (cached?.objectSetRid === objectSetRid) {\n return cached.objectSet;\n }\n const objectSet = hydrateObjectSetFromRid(osdkClient, definition, objectSetRid);\n cache.set(paramKey, {\n objectSetRid,\n objectSet\n });\n return objectSet;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Utility function to initialize a map of parameter values to either a loading or not-started loading state\n */\nexport function initializeParameters(config, initialLoadingState) {\n return Object.fromEntries(Object.entries(config.parameters).map(([key, parameterConfig]) => [key, {\n type: parameterConfig.type,\n value: {\n type: initialLoadingState\n }\n }]));\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createAndFetchTempObjectSetRid } from \"@osdk/client/internal\";\nexport function transformEmitEventPayload(config, eventId, payload, osdkClient) {\n for (const paramId of Object.keys(payload.parameterUpdates)) {\n const paramConfig = config.parameters[paramId];\n if (paramConfig?.type === \"objectSet\") {\n return {\n type: \"async\",\n payload: transformEmitEventPayloadAsync(config, eventId, payload, osdkClient)\n };\n }\n }\n\n // No object set parameters, pass through synchronously\n return {\n type: \"passThrough\",\n payload: {\n parameterUpdates: payload.parameterUpdates\n }\n };\n}\n\n/**\n * Transforms an augmented emit event payload by creating temporary object sets\n * from ObjectSet instances.\n *\n * Multiple ObjectSet parameters are transformed in parallel for better performance.\n */\nexport async function transformEmitEventPayloadAsync(config, eventId, payload, osdkClient) {\n const event = config.events[eventId];\n if (event == null) {\n throw new Error(`Event with ID \"${eventId.toString()}\" not found in widget config`);\n }\n const entries = Object.entries(payload.parameterUpdates);\n const transformedEntries = await Promise.all(entries.map(async ([paramId, paramValue]) => {\n const paramConfig = config.parameters[paramId];\n if (paramConfig?.type === \"objectSet\") {\n if (osdkClient == null) {\n throw new Error(`Cannot emit event \"${eventId.toString()}\" with ObjectSet parameter \"${paramId}\" without an osdk client`);\n }\n const objectSetRid = await createAndFetchTempObjectSetRid(osdkClient, paramValue);\n return [paramId, {\n objectSetRid\n }];\n }\n return [paramId, paramValue];\n }));\n return {\n parameterUpdates: Object.fromEntries(transformedEntries)\n };\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createFoundryWidgetClient } from \"@osdk/widget.client\";\nimport React, { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { FoundryWidgetContext } from \"./context.js\";\nimport { ErrorBoundary } from \"./ErrorBoundary.js\";\nimport { extendParametersWithObjectSets } from \"./utils/extendParametersWithObjectSets.js\";\nimport { initializeParameters } from \"./utils/initializeParameters.js\";\nimport { transformEmitEventPayload } from \"./utils/transformEmitEventPayload.js\";\n/**\n * Handles subscribing to messages from the host Foundry UI and updating the widget's parameter values accordingly via React context\n */\nexport const FoundryWidget = ({\n children,\n config,\n initialValues,\n client: osdkClient\n}) => {\n const client = useMemo(() => createFoundryWidgetClient(), []);\n const [asyncParameterValues, setAsyncParameterValues] = React.useState(initialValues ?? initializeParameters(config, \"not-started\"));\n const [allParameterValues, setAllParameterValues] = React.useState({\n type: \"not-started\"\n });\n const objectSetCache = useRef(new Map());\n const emitEventCallIds = useRef(new Map());\n const emitEvent = useCallback((eventId, payload) => {\n const transformResult = transformEmitEventPayload(config, eventId, payload, osdkClient);\n if (transformResult.type === \"passThrough\") {\n client.emitEvent(eventId, transformResult.payload);\n return;\n }\n async function handleAsyncEmitEvent() {\n const eventKey = String(eventId);\n const thisCallId = (emitEventCallIds.current.get(eventKey) ?? 0) + 1;\n emitEventCallIds.current.set(eventKey, thisCallId);\n const transformedPayload = await transformResult.payload;\n if (thisCallId !== emitEventCallIds.current.get(eventKey)) {\n return;\n }\n client.emitEvent(eventId, transformedPayload);\n }\n void handleAsyncEmitEvent();\n }, [osdkClient, config, client]);\n useEffect(() => {\n client.subscribe();\n client.hostEventTarget.addEventListener(\"host.update-parameters\", payload => {\n const processedParameters = extendParametersWithObjectSets(osdkClient, config, payload.detail.parameters, objectSetCache.current);\n setAsyncParameterValues(currentParameters => ({\n ...currentParameters,\n ...processedParameters\n }));\n setAllParameterValues(currentParameters => {\n let aggregatedLoadedState = \"loaded\";\n let firstError;\n const newParameterValues = {};\n for (const key in processedParameters) {\n const value = processedParameters[key].value;\n // If any fails, consider the whole thing failed\n if (value.type === \"failed\") {\n aggregatedLoadedState = \"failed\";\n firstError = firstError ?? value.error;\n newParameterValues[key] = value.value;\n continue;\n }\n // If any is loading, consider all of it loading unless we have failed somewhere\n if (value.type === \"loading\" && aggregatedLoadedState !== \"failed\") {\n aggregatedLoadedState = \"loading\";\n continue;\n }\n // If any is reloading, consider it loading unless something is failed or loading for the first time\n if (value.type === \"reloading\" && aggregatedLoadedState !== \"failed\" && aggregatedLoadedState !== \"loading\") {\n aggregatedLoadedState = \"reloading\";\n newParameterValues[key] = value.value;\n continue;\n }\n if (value.type === \"not-started\" && aggregatedLoadedState !== \"failed\" && aggregatedLoadedState !== \"loading\" && aggregatedLoadedState !== \"reloading\") {\n aggregatedLoadedState = \"not-started\";\n }\n if (value.type === \"loaded\") {\n newParameterValues[key] = value.value;\n }\n }\n const currentParameterValue = currentParameters.type !== \"not-started\" && currentParameters.type !== \"loading\" ? currentParameters.value : {};\n if (aggregatedLoadedState !== \"not-started\" && aggregatedLoadedState !== \"loading\") {\n const updatedValue = {\n ...currentParameterValue,\n ...newParameterValues\n };\n return aggregatedLoadedState === \"failed\" ? {\n type: aggregatedLoadedState,\n value: updatedValue,\n error: firstError ?? new Error(\"Failed to load parameters\")\n } : {\n type: aggregatedLoadedState,\n value: updatedValue\n };\n } else {\n return {\n type: aggregatedLoadedState\n };\n }\n });\n });\n client.ready();\n const resizeObserver = new ResizeObserver(entries => {\n if (entries.length !== 1) {\n // eslint-disable-next-line no-console\n console.error(\"Expected exactly one resize observer entry but received:\", entries);\n return;\n }\n const entry = entries[0];\n if (entry.borderBoxSize.length !== 1) {\n // eslint-disable-next-line no-console\n console.error(\"Expected exactly one border box size but received:\", entry.borderBoxSize);\n return;\n }\n const {\n inlineSize: width,\n blockSize: height\n } = entry.borderBoxSize[0];\n client.resize({\n width,\n height\n });\n });\n resizeObserver.observe(document.body, {\n box: \"border-box\"\n });\n return () => {\n client.unsubscribe();\n resizeObserver.disconnect();\n };\n }, []);\n return /*#__PURE__*/React.createElement(FoundryWidgetContext.Provider, {\n value: {\n emitEvent,\n hostEventTarget: client.hostEventTarget,\n asyncParameterValues,\n parameters: {\n values: allParameterValues.value ?? {},\n state: allParameterValues.type\n }\n // Unfortunately the context is statically defined so we can't use the generic type, hence the cast\n }\n }, /*#__PURE__*/React.createElement(ErrorBoundary, null, children));\n};"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osdk/widget.client-react",
3
- "version": "3.5.1-main-20260406220320",
3
+ "version": "3.6.0",
4
4
  "description": "Wrapper around @osdk/widget.client",
5
5
  "access": "public",
6
6
  "license": "Apache-2.0",
@@ -33,8 +33,8 @@
33
33
  "@types/react-dom": "^18 || ^19",
34
34
  "react": "^18 || ^19",
35
35
  "react-dom": "^18 || ^19",
36
- "@osdk/client": "~2.8.1-main-20260406220320",
37
- "@osdk/widget.client": "~3.5.1-main-20260406220320"
36
+ "@osdk/client": "~2.9.0",
37
+ "@osdk/widget.client": "~3.6.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/react": "^18.3.24",
@@ -43,11 +43,11 @@
43
43
  "react-dom": "18.3.1",
44
44
  "ts-expect": "^1.3.0",
45
45
  "typescript": "~5.5.4",
46
- "@osdk/client": "~2.8.1-main-20260406220320",
47
- "@osdk/monorepo.tsconfig": "~0.7.0",
48
46
  "@osdk/monorepo.api-extractor": "~0.7.0",
49
- "@osdk/widget.api": "~3.5.1-main-20260406220320",
50
- "@osdk/widget.client": "~3.5.1-main-20260406220320"
47
+ "@osdk/widget.api": "~3.6.0",
48
+ "@osdk/client": "~2.9.0",
49
+ "@osdk/monorepo.tsconfig": "~0.7.0",
50
+ "@osdk/widget.client": "~3.6.0"
51
51
  },
52
52
  "publishConfig": {
53
53
  "access": "public"