@paymanai/payman-typescript-ask-sdk 4.0.16 → 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.d.mts
CHANGED
|
@@ -409,6 +409,7 @@ type UseChatV2Return = {
|
|
|
409
409
|
cancelUserAction: (userActionId: string) => Promise<void>;
|
|
410
410
|
/** Ask the agent to re-send a prompt (e.g. resend a verification code). */
|
|
411
411
|
resendUserAction: (userActionId: string) => Promise<void>;
|
|
412
|
+
expireUserAction: (userActionId: string) => Promise<void>;
|
|
412
413
|
/** Dismiss a one-way notification from local state. */
|
|
413
414
|
dismissNotification: (id: string) => void;
|
|
414
415
|
};
|
|
@@ -636,7 +637,8 @@ declare function cancelUserAction(config: ChatConfig, userActionId: string): Pro
|
|
|
636
637
|
* Resend a user action (e.g. request a new OTP)
|
|
637
638
|
*/
|
|
638
639
|
declare function resendUserAction(config: ChatConfig, userActionId: string): Promise<UserActionResponse>;
|
|
640
|
+
declare function expireUserAction(config: ChatConfig, userActionId: string): Promise<UserActionResponse>;
|
|
639
641
|
|
|
640
642
|
declare function migrateActiveStream(oldUserId: string, newUserId: string): void;
|
|
641
643
|
|
|
642
|
-
export { type APIConfig, type ActiveUserAction, type AgentStage, type AnalysisMode, type ChatCallbacks, type ChatConfig, type ChunkDisplay, type FieldWidget, type JsonSchemaField, type JsonSchemaOption, type MessageDisplay, type MessageFeedbackState, type MessageRole, type RequestedSchema, type SendMessageOptions, type SessionParams, type StreamEvent, type StreamOptions, type StreamProgress, type StreamingStep, type UseChatV2Return, type UseVoiceReturn, type UserActionKind, type UserActionRequest, UserActionStaleError, type UserActionState, type UserActionStatus, type UserActionSubAction, type UserNotification, type V2EventProcessorState, type VerificationType, type VoiceCallbacks, type VoiceConfig, type VoicePermissions, type VoiceResult, type VoiceState, buildContent, cancelUserAction, classifyField, classifyUserActionKind, coerceValue, createInitialV2State, defaultValueFor, generateId, getOptions, isNestedOrUnsupported, isRequired, migrateActiveStream, processStreamEventV2, renderableFields, resendUserAction, streamWorkflowEvents, submitUserAction, useChatV2, useVoice, validateField, validateForm };
|
|
644
|
+
export { type APIConfig, type ActiveUserAction, type AgentStage, type AnalysisMode, type ChatCallbacks, type ChatConfig, type ChunkDisplay, type FieldWidget, type JsonSchemaField, type JsonSchemaOption, type MessageDisplay, type MessageFeedbackState, type MessageRole, type RequestedSchema, type SendMessageOptions, type SessionParams, type StreamEvent, type StreamOptions, type StreamProgress, type StreamingStep, type UseChatV2Return, type UseVoiceReturn, type UserActionKind, type UserActionRequest, UserActionStaleError, type UserActionState, type UserActionStatus, type UserActionSubAction, type UserNotification, type V2EventProcessorState, type VerificationType, type VoiceCallbacks, type VoiceConfig, type VoicePermissions, type VoiceResult, type VoiceState, buildContent, cancelUserAction, classifyField, classifyUserActionKind, coerceValue, createInitialV2State, defaultValueFor, expireUserAction, generateId, getOptions, isNestedOrUnsupported, isRequired, migrateActiveStream, processStreamEventV2, renderableFields, resendUserAction, streamWorkflowEvents, submitUserAction, useChatV2, useVoice, validateField, validateForm };
|
package/dist/index.d.ts
CHANGED
|
@@ -409,6 +409,7 @@ type UseChatV2Return = {
|
|
|
409
409
|
cancelUserAction: (userActionId: string) => Promise<void>;
|
|
410
410
|
/** Ask the agent to re-send a prompt (e.g. resend a verification code). */
|
|
411
411
|
resendUserAction: (userActionId: string) => Promise<void>;
|
|
412
|
+
expireUserAction: (userActionId: string) => Promise<void>;
|
|
412
413
|
/** Dismiss a one-way notification from local state. */
|
|
413
414
|
dismissNotification: (id: string) => void;
|
|
414
415
|
};
|
|
@@ -636,7 +637,8 @@ declare function cancelUserAction(config: ChatConfig, userActionId: string): Pro
|
|
|
636
637
|
* Resend a user action (e.g. request a new OTP)
|
|
637
638
|
*/
|
|
638
639
|
declare function resendUserAction(config: ChatConfig, userActionId: string): Promise<UserActionResponse>;
|
|
640
|
+
declare function expireUserAction(config: ChatConfig, userActionId: string): Promise<UserActionResponse>;
|
|
639
641
|
|
|
640
642
|
declare function migrateActiveStream(oldUserId: string, newUserId: string): void;
|
|
641
643
|
|
|
642
|
-
export { type APIConfig, type ActiveUserAction, type AgentStage, type AnalysisMode, type ChatCallbacks, type ChatConfig, type ChunkDisplay, type FieldWidget, type JsonSchemaField, type JsonSchemaOption, type MessageDisplay, type MessageFeedbackState, type MessageRole, type RequestedSchema, type SendMessageOptions, type SessionParams, type StreamEvent, type StreamOptions, type StreamProgress, type StreamingStep, type UseChatV2Return, type UseVoiceReturn, type UserActionKind, type UserActionRequest, UserActionStaleError, type UserActionState, type UserActionStatus, type UserActionSubAction, type UserNotification, type V2EventProcessorState, type VerificationType, type VoiceCallbacks, type VoiceConfig, type VoicePermissions, type VoiceResult, type VoiceState, buildContent, cancelUserAction, classifyField, classifyUserActionKind, coerceValue, createInitialV2State, defaultValueFor, generateId, getOptions, isNestedOrUnsupported, isRequired, migrateActiveStream, processStreamEventV2, renderableFields, resendUserAction, streamWorkflowEvents, submitUserAction, useChatV2, useVoice, validateField, validateForm };
|
|
644
|
+
export { type APIConfig, type ActiveUserAction, type AgentStage, type AnalysisMode, type ChatCallbacks, type ChatConfig, type ChunkDisplay, type FieldWidget, type JsonSchemaField, type JsonSchemaOption, type MessageDisplay, type MessageFeedbackState, type MessageRole, type RequestedSchema, type SendMessageOptions, type SessionParams, type StreamEvent, type StreamOptions, type StreamProgress, type StreamingStep, type UseChatV2Return, type UseVoiceReturn, type UserActionKind, type UserActionRequest, UserActionStaleError, type UserActionState, type UserActionStatus, type UserActionSubAction, type UserNotification, type V2EventProcessorState, type VerificationType, type VoiceCallbacks, type VoiceConfig, type VoicePermissions, type VoiceResult, type VoiceState, buildContent, cancelUserAction, classifyField, classifyUserActionKind, coerceValue, createInitialV2State, defaultValueFor, expireUserAction, generateId, getOptions, isNestedOrUnsupported, isRequired, migrateActiveStream, processStreamEventV2, renderableFields, resendUserAction, streamWorkflowEvents, submitUserAction, useChatV2, useVoice, validateField, validateForm };
|
package/dist/index.js
CHANGED
|
@@ -1090,6 +1090,9 @@ async function cancelUserAction(config, userActionId) {
|
|
|
1090
1090
|
async function resendUserAction(config, userActionId) {
|
|
1091
1091
|
return sendUserActionRequest(config, userActionId, "resend");
|
|
1092
1092
|
}
|
|
1093
|
+
async function expireUserAction(config, userActionId) {
|
|
1094
|
+
return sendUserActionRequest(config, userActionId, "expired");
|
|
1095
|
+
}
|
|
1093
1096
|
|
|
1094
1097
|
// src/hooks/useChatV2.ts
|
|
1095
1098
|
var EMPTY_USER_ACTION_STATE = { prompts: [], notifications: [] };
|
|
@@ -1383,6 +1386,19 @@ function useChatV2(config, callbacks = {}) {
|
|
|
1383
1386
|
},
|
|
1384
1387
|
[setPromptStatus]
|
|
1385
1388
|
);
|
|
1389
|
+
const expireUserAction2 = react.useCallback(
|
|
1390
|
+
async (userActionId) => {
|
|
1391
|
+
setPromptStatus(userActionId, "expired");
|
|
1392
|
+
try {
|
|
1393
|
+
await expireUserAction(configRef.current, userActionId);
|
|
1394
|
+
} catch (error) {
|
|
1395
|
+
if (error instanceof UserActionStaleError) return;
|
|
1396
|
+
callbacksRef.current.onError?.(error);
|
|
1397
|
+
throw error;
|
|
1398
|
+
}
|
|
1399
|
+
},
|
|
1400
|
+
[setPromptStatus]
|
|
1401
|
+
);
|
|
1386
1402
|
const dismissNotification = react.useCallback((id) => {
|
|
1387
1403
|
setUserActionState((prev) => ({
|
|
1388
1404
|
...prev,
|
|
@@ -1462,6 +1478,7 @@ function useChatV2(config, callbacks = {}) {
|
|
|
1462
1478
|
submitUserAction: submitUserAction2,
|
|
1463
1479
|
cancelUserAction: cancelUserAction2,
|
|
1464
1480
|
resendUserAction: resendUserAction2,
|
|
1481
|
+
expireUserAction: expireUserAction2,
|
|
1465
1482
|
dismissNotification
|
|
1466
1483
|
};
|
|
1467
1484
|
}
|
|
@@ -1812,6 +1829,7 @@ exports.classifyUserActionKind = classifyUserActionKind;
|
|
|
1812
1829
|
exports.coerceValue = coerceValue;
|
|
1813
1830
|
exports.createInitialV2State = createInitialV2State;
|
|
1814
1831
|
exports.defaultValueFor = defaultValueFor;
|
|
1832
|
+
exports.expireUserAction = expireUserAction;
|
|
1815
1833
|
exports.generateId = generateId;
|
|
1816
1834
|
exports.getOptions = getOptions;
|
|
1817
1835
|
exports.isNestedOrUnsupported = isNestedOrUnsupported;
|