@memori.ai/memori-react 8.40.1 → 8.40.3
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 +24 -0
- package/dist/components/MemoriWidget/MemoriWidget.js +34 -181
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/helpers/nats/useNatsSession.js +9 -1
- package/dist/helpers/nats/useNatsSession.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +31 -180
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/helpers/nats/useNatsSession.js +9 -1
- package/esm/helpers/nats/useNatsSession.js.map +1 -1
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/package.json +1 -1
- package/src/components/MemoriWidget/MemoriWidget.tsx +37 -246
- package/src/helpers/nats/useNatsSession.ts +21 -1
- package/src/version.ts +1 -1
|
@@ -70,6 +70,26 @@ function readNumber(
|
|
|
70
70
|
return typeof value === 'number' ? value : undefined;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Unwraps the `currentState` of a `dialog_text_entered_response`.
|
|
75
|
+
*
|
|
76
|
+
* The async (NATS) response wraps the dialog state one level deeper than the
|
|
77
|
+
* synchronous HTTP response: `currentState` is a `ResponseSpec` that *contains*
|
|
78
|
+
* the actual `DialogState` under a nested `currentState` key. We unwrap it so
|
|
79
|
+
* downstream consumers always receive the `DialogState` directly, while still
|
|
80
|
+
* accepting the already-flat shape for backward compatibility.
|
|
81
|
+
*/
|
|
82
|
+
function unwrapDialogState(value: unknown): unknown {
|
|
83
|
+
if (
|
|
84
|
+
value &&
|
|
85
|
+
typeof value === 'object' &&
|
|
86
|
+
'currentState' in (value as Record<string, unknown>)
|
|
87
|
+
) {
|
|
88
|
+
return (value as Record<string, unknown>).currentState;
|
|
89
|
+
}
|
|
90
|
+
return value;
|
|
91
|
+
}
|
|
92
|
+
|
|
73
93
|
/**
|
|
74
94
|
* Normalizes raw NATS payloads (snake_case or camelCase) into typed events.
|
|
75
95
|
*/
|
|
@@ -102,7 +122,7 @@ export function normalizeNatsEvent(raw: Record<string, unknown>): NatsSessionEve
|
|
|
102
122
|
typeof raw.resultCode === 'number' ? raw.resultCode : undefined,
|
|
103
123
|
resultMessage:
|
|
104
124
|
typeof raw.resultMessage === 'string' ? raw.resultMessage : undefined,
|
|
105
|
-
currentState: raw.currentState,
|
|
125
|
+
currentState: unwrapDialogState(raw.currentState),
|
|
106
126
|
correlationID,
|
|
107
127
|
};
|
|
108
128
|
}
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// This file is auto-generated. Do not edit manually.
|
|
2
|
-
export const version = '8.40.
|
|
2
|
+
export const version = '8.40.3';
|