@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.native.js
CHANGED
|
@@ -1111,6 +1111,9 @@ async function cancelUserAction(config, userActionId) {
|
|
|
1111
1111
|
async function resendUserAction(config, userActionId) {
|
|
1112
1112
|
return sendUserActionRequest(config, userActionId, "resend");
|
|
1113
1113
|
}
|
|
1114
|
+
async function expireUserAction(config, userActionId) {
|
|
1115
|
+
return sendUserActionRequest(config, userActionId, "expired");
|
|
1116
|
+
}
|
|
1114
1117
|
|
|
1115
1118
|
// src/hooks/useChatV2.ts
|
|
1116
1119
|
var EMPTY_USER_ACTION_STATE = { prompts: [], notifications: [] };
|
|
@@ -1404,6 +1407,19 @@ function useChatV2(config, callbacks = {}) {
|
|
|
1404
1407
|
},
|
|
1405
1408
|
[setPromptStatus]
|
|
1406
1409
|
);
|
|
1410
|
+
const expireUserAction2 = react.useCallback(
|
|
1411
|
+
async (userActionId) => {
|
|
1412
|
+
setPromptStatus(userActionId, "expired");
|
|
1413
|
+
try {
|
|
1414
|
+
await expireUserAction(configRef.current, userActionId);
|
|
1415
|
+
} catch (error) {
|
|
1416
|
+
if (error instanceof UserActionStaleError) return;
|
|
1417
|
+
callbacksRef.current.onError?.(error);
|
|
1418
|
+
throw error;
|
|
1419
|
+
}
|
|
1420
|
+
},
|
|
1421
|
+
[setPromptStatus]
|
|
1422
|
+
);
|
|
1407
1423
|
const dismissNotification = react.useCallback((id) => {
|
|
1408
1424
|
setUserActionState((prev) => ({
|
|
1409
1425
|
...prev,
|
|
@@ -1483,6 +1499,7 @@ function useChatV2(config, callbacks = {}) {
|
|
|
1483
1499
|
submitUserAction: submitUserAction2,
|
|
1484
1500
|
cancelUserAction: cancelUserAction2,
|
|
1485
1501
|
resendUserAction: resendUserAction2,
|
|
1502
|
+
expireUserAction: expireUserAction2,
|
|
1486
1503
|
dismissNotification
|
|
1487
1504
|
};
|
|
1488
1505
|
}
|
|
@@ -1733,6 +1750,7 @@ exports.classifyUserActionKind = classifyUserActionKind;
|
|
|
1733
1750
|
exports.coerceValue = coerceValue;
|
|
1734
1751
|
exports.createInitialV2State = createInitialV2State;
|
|
1735
1752
|
exports.defaultValueFor = defaultValueFor;
|
|
1753
|
+
exports.expireUserAction = expireUserAction;
|
|
1736
1754
|
exports.generateId = generateId;
|
|
1737
1755
|
exports.getOptions = getOptions;
|
|
1738
1756
|
exports.isNestedOrUnsupported = isNestedOrUnsupported;
|