@paymanai/payman-typescript-ask-sdk 4.0.15 → 4.0.19
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/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -1
- package/dist/index.mjs.map +1 -1
- package/dist/index.native.js +18 -0
- package/dist/index.native.js.map +1 -1
- package/package.json +6 -2
package/dist/index.mjs
CHANGED
|
@@ -1088,6 +1088,9 @@ async function cancelUserAction(config, userActionId) {
|
|
|
1088
1088
|
async function resendUserAction(config, userActionId) {
|
|
1089
1089
|
return sendUserActionRequest(config, userActionId, "resend");
|
|
1090
1090
|
}
|
|
1091
|
+
async function expireUserAction(config, userActionId) {
|
|
1092
|
+
return sendUserActionRequest(config, userActionId, "expired");
|
|
1093
|
+
}
|
|
1091
1094
|
|
|
1092
1095
|
// src/hooks/useChatV2.ts
|
|
1093
1096
|
var EMPTY_USER_ACTION_STATE = { prompts: [], notifications: [] };
|
|
@@ -1381,6 +1384,19 @@ function useChatV2(config, callbacks = {}) {
|
|
|
1381
1384
|
},
|
|
1382
1385
|
[setPromptStatus]
|
|
1383
1386
|
);
|
|
1387
|
+
const expireUserAction2 = useCallback(
|
|
1388
|
+
async (userActionId) => {
|
|
1389
|
+
setPromptStatus(userActionId, "expired");
|
|
1390
|
+
try {
|
|
1391
|
+
await expireUserAction(configRef.current, userActionId);
|
|
1392
|
+
} catch (error) {
|
|
1393
|
+
if (error instanceof UserActionStaleError) return;
|
|
1394
|
+
callbacksRef.current.onError?.(error);
|
|
1395
|
+
throw error;
|
|
1396
|
+
}
|
|
1397
|
+
},
|
|
1398
|
+
[setPromptStatus]
|
|
1399
|
+
);
|
|
1384
1400
|
const dismissNotification = useCallback((id) => {
|
|
1385
1401
|
setUserActionState((prev) => ({
|
|
1386
1402
|
...prev,
|
|
@@ -1460,6 +1476,7 @@ function useChatV2(config, callbacks = {}) {
|
|
|
1460
1476
|
submitUserAction: submitUserAction2,
|
|
1461
1477
|
cancelUserAction: cancelUserAction2,
|
|
1462
1478
|
resendUserAction: resendUserAction2,
|
|
1479
|
+
expireUserAction: expireUserAction2,
|
|
1463
1480
|
dismissNotification
|
|
1464
1481
|
};
|
|
1465
1482
|
}
|
|
@@ -1802,6 +1819,6 @@ function migrateActiveStream(oldUserId, newUserId) {
|
|
|
1802
1819
|
activeStreamStore.rename(oldUserId, newUserId);
|
|
1803
1820
|
}
|
|
1804
1821
|
|
|
1805
|
-
export { UserActionStaleError, buildContent, cancelUserAction, classifyField, classifyUserActionKind, coerceValue, createInitialV2State, defaultValueFor, generateId, getOptions, isNestedOrUnsupported, isRequired, migrateActiveStream, processStreamEventV2, renderableFields, resendUserAction, streamWorkflowEvents, submitUserAction, useChatV2, useVoice, validateField, validateForm };
|
|
1822
|
+
export { UserActionStaleError, buildContent, cancelUserAction, classifyField, classifyUserActionKind, coerceValue, createInitialV2State, defaultValueFor, expireUserAction, generateId, getOptions, isNestedOrUnsupported, isRequired, migrateActiveStream, processStreamEventV2, renderableFields, resendUserAction, streamWorkflowEvents, submitUserAction, useChatV2, useVoice, validateField, validateForm };
|
|
1806
1823
|
//# sourceMappingURL=index.mjs.map
|
|
1807
1824
|
//# sourceMappingURL=index.mjs.map
|