@roketus/loyalty-js-sdk 5.4.20 → 5.4.23
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/cjs/api/agent/conversationsPath.d.ts +6 -0
- package/dist/cjs/api/agent/deleteConversation.d.ts +2 -0
- package/dist/cjs/api/agent/getConversation.d.ts +2 -0
- package/dist/cjs/api/agent/listConversations.d.ts +2 -0
- package/dist/cjs/api/issuer/confirmProtectedAction.d.ts +11 -0
- package/dist/cjs/api/issuer/issueConfirmationChallenge.d.ts +6 -0
- package/dist/cjs/api/issuer/listApprovers.d.ts +9 -0
- package/dist/cjs/api/issuer/resendConfirmationChallenge.d.ts +6 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/interfaces/ISDK.d.ts +17 -0
- package/dist/cjs/interfaces/agent/agentInterfaces.d.ts +88 -0
- package/dist/cjs/interfaces/agent/index.d.ts +1 -0
- package/dist/cjs/interfaces/issuer/confirmationInterfaces.d.ts +85 -0
- package/dist/cjs/interfaces/issuer/index.d.ts +1 -0
- package/dist/esm5/api/agent/conversationsPath.d.ts +6 -0
- package/dist/esm5/api/agent/deleteConversation.d.ts +2 -0
- package/dist/esm5/api/agent/getConversation.d.ts +2 -0
- package/dist/esm5/api/agent/listConversations.d.ts +2 -0
- package/dist/esm5/api/issuer/confirmProtectedAction.d.ts +11 -0
- package/dist/esm5/api/issuer/issueConfirmationChallenge.d.ts +6 -0
- package/dist/esm5/api/issuer/listApprovers.d.ts +9 -0
- package/dist/esm5/api/issuer/resendConfirmationChallenge.d.ts +6 -0
- package/dist/esm5/index.d.ts +1 -0
- package/dist/esm5/index.js +1 -1
- package/dist/esm5/interfaces/ISDK.d.ts +17 -0
- package/dist/esm5/interfaces/agent/agentInterfaces.d.ts +88 -0
- package/dist/esm5/interfaces/agent/index.d.ts +1 -0
- package/dist/esm5/interfaces/issuer/confirmationInterfaces.d.ts +85 -0
- package/dist/esm5/interfaces/issuer/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { IPaginationData } from '../requestFilterInterfaces';
|
|
2
|
+
/**
|
|
3
|
+
* Agent conversations (threads) of an agentic endpoint — `/campaign/agent/{agent}/conversations`.
|
|
4
|
+
*
|
|
5
|
+
* The routes are agent-scoped, so the agent id is a parameter of every call and the next agent
|
|
6
|
+
* (campaign, referral) needs no new SDK group. These calls go out on `issuerClient`: the service
|
|
7
|
+
* keys the tenant off the issuer JWT's `identityId`.
|
|
8
|
+
*
|
|
9
|
+
* The AG-UI streaming endpoint (`POST /campaign/agent/{agent}/agui`) is NOT part of this namespace —
|
|
10
|
+
* it is driven by an AG-UI client (CopilotKit), not by the SDK.
|
|
11
|
+
*/
|
|
12
|
+
export type TAgentMessageRole = 'user' | 'assistant' | 'tool' | 'activity';
|
|
13
|
+
export interface IAgentToolCallFunction {
|
|
14
|
+
name: string;
|
|
15
|
+
/** JSON text — the tool arguments as the model produced them (redacted by the service). */
|
|
16
|
+
arguments: string;
|
|
17
|
+
}
|
|
18
|
+
export interface IAgentToolCall {
|
|
19
|
+
id: string;
|
|
20
|
+
type: 'function';
|
|
21
|
+
function: IAgentToolCallFunction;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* AG-UI Message shape (docs.ag-ui.com/concepts/messages) as the service persists it:
|
|
25
|
+
* user / assistant (with `toolCalls`) / tool (with `toolCallId`).
|
|
26
|
+
*
|
|
27
|
+
* `role: "activity"` is the AG-UI activity message (`activityType` + structured `content`).
|
|
28
|
+
* The service does not emit it yet; the field is here so a client can consume it without an
|
|
29
|
+
* SDK release the day it does.
|
|
30
|
+
*/
|
|
31
|
+
export interface IAgentMessage {
|
|
32
|
+
id: string;
|
|
33
|
+
role: TAgentMessageRole;
|
|
34
|
+
content?: string;
|
|
35
|
+
toolCalls?: IAgentToolCall[];
|
|
36
|
+
toolCallId?: string;
|
|
37
|
+
activityType?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface IAgentConversationAttributes {
|
|
40
|
+
tenant_id: string;
|
|
41
|
+
title?: string;
|
|
42
|
+
turns?: number;
|
|
43
|
+
last_activity_at: string;
|
|
44
|
+
created_at?: string;
|
|
45
|
+
cohort_created_id?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface IAgentThreadAttributes extends IAgentConversationAttributes {
|
|
48
|
+
messages: IAgentMessage[];
|
|
49
|
+
}
|
|
50
|
+
export interface IAgentConversationDTO {
|
|
51
|
+
id: string;
|
|
52
|
+
attributes: IAgentConversationAttributes;
|
|
53
|
+
}
|
|
54
|
+
export interface IAgentThreadDTO {
|
|
55
|
+
id: string;
|
|
56
|
+
attributes: IAgentThreadAttributes;
|
|
57
|
+
}
|
|
58
|
+
export interface IConversationsPageDTO {
|
|
59
|
+
data: IAgentConversationDTO[];
|
|
60
|
+
meta: IPaginationData;
|
|
61
|
+
}
|
|
62
|
+
export interface IListConversationsParams {
|
|
63
|
+
agent: string;
|
|
64
|
+
page?: number;
|
|
65
|
+
perPage?: number;
|
|
66
|
+
}
|
|
67
|
+
export interface IConversationParams {
|
|
68
|
+
agent: string;
|
|
69
|
+
threadId: string;
|
|
70
|
+
}
|
|
71
|
+
export type TListConversations = (params: IListConversationsParams) => Promise<IConversationsPageDTO>;
|
|
72
|
+
export type TGetConversation = (params: IConversationParams) => Promise<IAgentThreadDTO>;
|
|
73
|
+
export type TDeleteConversation = (params: IConversationParams) => Promise<void>;
|
|
74
|
+
/** Raw service envelope — JSON:API-shaped, `data` is always an array. */
|
|
75
|
+
export interface IAgentConversationsResponseDTO<A = IAgentConversationAttributes> {
|
|
76
|
+
data: Array<{
|
|
77
|
+
id: string;
|
|
78
|
+
type: string;
|
|
79
|
+
attributes: A;
|
|
80
|
+
}>;
|
|
81
|
+
meta?: {
|
|
82
|
+
current_page?: number;
|
|
83
|
+
limit: number;
|
|
84
|
+
offset: number;
|
|
85
|
+
total_items: number;
|
|
86
|
+
total_pages?: number;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './agentInterfaces';
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { IHTTPClientResponse } from '@roketus/web-toolkit';
|
|
2
|
+
/**
|
|
3
|
+
* Designated-approver confirmation — the `loyalty-issuer` step-up 2FA surface.
|
|
4
|
+
*
|
|
5
|
+
* The envelope is the LoyaltyAPI JSON:API convention (`{ data: [{ id, type,
|
|
6
|
+
* attributes }] }`) and ATTRIBUTE KEYS ARE snake_case: the server emits Go-style
|
|
7
|
+
* json tags. Timestamps are unix SECONDS as numbers, not ISO strings.
|
|
8
|
+
*
|
|
9
|
+
* There is deliberately no confirm response type. The code is single-use, so a
|
|
10
|
+
* standalone confirm would spend it and leave the action to a second,
|
|
11
|
+
* unconfirmed request. Confirming and acting happen in ONE request against the
|
|
12
|
+
* action's own endpoint — see `confirmProtectedAction`.
|
|
13
|
+
*/
|
|
14
|
+
export interface IApproverAttributesDTO {
|
|
15
|
+
name: string;
|
|
16
|
+
card_number: string;
|
|
17
|
+
/** Already masked by the server. The full destination never leaves it. */
|
|
18
|
+
masked_destination: string;
|
|
19
|
+
}
|
|
20
|
+
export interface IApproverDTO {
|
|
21
|
+
id: string;
|
|
22
|
+
type: string;
|
|
23
|
+
attributes: IApproverAttributesDTO;
|
|
24
|
+
}
|
|
25
|
+
export interface IListApproversResponseDTO {
|
|
26
|
+
data: IApproverDTO[];
|
|
27
|
+
}
|
|
28
|
+
export interface IConfirmationChallengeAttributesDTO {
|
|
29
|
+
action: string;
|
|
30
|
+
approver_id: string;
|
|
31
|
+
approver_name: string;
|
|
32
|
+
masked_destination: string;
|
|
33
|
+
status: string;
|
|
34
|
+
/** unix seconds */
|
|
35
|
+
expires_at: number;
|
|
36
|
+
remaining_attempts: number;
|
|
37
|
+
/** unix seconds */
|
|
38
|
+
resend_available_at: number;
|
|
39
|
+
/** Server-decided: requester and approver are the same person. */
|
|
40
|
+
self_approval: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface IConfirmationChallengeDTO {
|
|
43
|
+
id: string;
|
|
44
|
+
type: string;
|
|
45
|
+
attributes: IConfirmationChallengeAttributesDTO;
|
|
46
|
+
}
|
|
47
|
+
export interface IConfirmationChallengeResponseDTO {
|
|
48
|
+
data: IConfirmationChallengeDTO[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* `requesterId` / `requesterName` are supplied by the CALLER, not derived from
|
|
52
|
+
* the token: the session names the issuer and never the person. The requesting
|
|
53
|
+
* admin named in the approver's SMS is therefore a claim, not proof.
|
|
54
|
+
*/
|
|
55
|
+
export interface IIssueConfirmationChallengePayload {
|
|
56
|
+
action: string;
|
|
57
|
+
approverId: string;
|
|
58
|
+
requesterId: string;
|
|
59
|
+
requesterName: string;
|
|
60
|
+
}
|
|
61
|
+
export interface IConfirmProtectedActionPayload {
|
|
62
|
+
/**
|
|
63
|
+
* The ACTION's own endpoint, which confirms and acts atomically — e.g.
|
|
64
|
+
* `/issuer/pii-export/request`.
|
|
65
|
+
*
|
|
66
|
+
* Deliberately a parameter rather than a map inside the SDK: adding a
|
|
67
|
+
* protected action is then a change in the calling app and the owning
|
|
68
|
+
* service, with no SDK release in between.
|
|
69
|
+
*/
|
|
70
|
+
path: string;
|
|
71
|
+
confirmationId: string;
|
|
72
|
+
code: string;
|
|
73
|
+
}
|
|
74
|
+
export interface IListApprovers {
|
|
75
|
+
(action: string): Promise<IHTTPClientResponse<IListApproversResponseDTO>>;
|
|
76
|
+
}
|
|
77
|
+
export interface IIssueConfirmationChallenge {
|
|
78
|
+
(payload: IIssueConfirmationChallengePayload): Promise<IHTTPClientResponse<IConfirmationChallengeResponseDTO>>;
|
|
79
|
+
}
|
|
80
|
+
export interface IResendConfirmationChallenge {
|
|
81
|
+
(confirmationId: string): Promise<IHTTPClientResponse<IConfirmationChallengeResponseDTO>>;
|
|
82
|
+
}
|
|
83
|
+
export interface IConfirmProtectedAction {
|
|
84
|
+
(payload: IConfirmProtectedActionPayload): Promise<IHTTPClientResponse<unknown>>;
|
|
85
|
+
}
|
|
@@ -3,3 +3,4 @@ export * from './ISetIssuerSettingsPayload';
|
|
|
3
3
|
export { IDispatchCustomEvent, IGetCardByPhone, ISetCardName, ECardType, ICardPromocode, IGetCardByIdResponseDTO } from './issuerInterface';
|
|
4
4
|
export { IGetCardBonus } from './IGetCardBonuses';
|
|
5
5
|
export { IGetCardSpendsResponseDTO } from './IGetCardSpends';
|
|
6
|
+
export * from './confirmationInterfaces';
|