@marketrix.ai/widget 4.0.98 → 4.0.100
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/src/sdk/contract.d.ts +2 -21
- package/dist/src/sdk/contracts/entities.d.ts +42 -0
- package/dist/src/sdk/contracts/widget.d.ts +4 -7
- package/dist/src/sdk/index.d.ts +2 -21
- package/dist/src/services/ChatService.d.ts +7 -10
- package/dist/widget.mjs +2 -2
- package/package.json +1 -1
- package/dist/src/sdk/contracts/activityLog.d.ts +0 -243
|
@@ -1,22 +1,4 @@
|
|
|
1
1
|
export declare const widgetContract: {
|
|
2
|
-
activityLogCreate: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
|
|
3
|
-
type: import("zod").ZodLiteral<"widget_question">;
|
|
4
|
-
metadata: import("zod").ZodObject<{
|
|
5
|
-
question: import("zod").ZodString;
|
|
6
|
-
mode: import("zod").ZodEnum<{
|
|
7
|
-
tell: "tell";
|
|
8
|
-
show: "show";
|
|
9
|
-
do: "do";
|
|
10
|
-
}>;
|
|
11
|
-
chat_id: import("zod").ZodString;
|
|
12
|
-
timestamp: import("zod").ZodString;
|
|
13
|
-
marketrix_id: import("zod").ZodString;
|
|
14
|
-
marketrix_key: import("zod").ZodString;
|
|
15
|
-
user_id: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
16
|
-
}, import("zod/v4/core").$strict>;
|
|
17
|
-
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
18
|
-
success: import("zod").ZodLiteral<true>;
|
|
19
|
-
}, import("zod/v4/core").$strip>, Record<never, never>, Record<never, never>>;
|
|
20
2
|
chatCreate: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, import("zod").ZodString, Record<never, never>, Record<never, never>>;
|
|
21
3
|
widgetDefaultGet: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
|
|
22
4
|
type: import("zod").ZodEnum<{
|
|
@@ -162,17 +144,17 @@ export declare const widgetContract: {
|
|
|
162
144
|
events: import("zod").ZodArray<import("zod").ZodUnknown>;
|
|
163
145
|
}, import("zod/v4/core").$strip>], "type">;
|
|
164
146
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
165
|
-
|
|
147
|
+
success: import("zod").ZodLiteral<true>;
|
|
166
148
|
}, import("zod/v4/core").$strip>, Record<never, never>, Record<never, never>>;
|
|
167
149
|
widgetStream: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
|
|
168
150
|
chat_id: import("zod").ZodString;
|
|
169
151
|
tab_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
170
152
|
marketrix_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
171
153
|
marketrix_key: import("zod").ZodOptional<import("zod").ZodString>;
|
|
154
|
+
user_id: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
|
|
172
155
|
}, import("zod/v4/core").$strip>, import("@orpc/contract").Schema<AsyncIteratorObject<{
|
|
173
156
|
type: "registered";
|
|
174
157
|
chat_id: string;
|
|
175
|
-
application_id?: number | undefined;
|
|
176
158
|
} | {
|
|
177
159
|
type: "heartbeat";
|
|
178
160
|
} | {
|
|
@@ -201,7 +183,6 @@ export declare const widgetContract: {
|
|
|
201
183
|
}, unknown, void>, import("@orpc/shared").AsyncIteratorClass<{
|
|
202
184
|
type: "registered";
|
|
203
185
|
chat_id: string;
|
|
204
|
-
application_id?: number | undefined;
|
|
205
186
|
} | {
|
|
206
187
|
type: "heartbeat";
|
|
207
188
|
} | {
|
|
@@ -56,6 +56,28 @@ export declare const UserEntitySchema: z.ZodObject<{
|
|
|
56
56
|
member: "member";
|
|
57
57
|
}>>>;
|
|
58
58
|
}, z.core.$strip>;
|
|
59
|
+
export declare const UserSummarySchema: z.ZodObject<{
|
|
60
|
+
id: z.ZodNumber;
|
|
61
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
62
|
+
updated_at: z.ZodCoercedDate<unknown>;
|
|
63
|
+
is_super: z.ZodBoolean;
|
|
64
|
+
status: z.ZodEnum<{
|
|
65
|
+
created: "created";
|
|
66
|
+
active: "active";
|
|
67
|
+
suspended: "suspended";
|
|
68
|
+
}>;
|
|
69
|
+
email: z.ZodEmail;
|
|
70
|
+
first_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
71
|
+
last_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
72
|
+
auth_method: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
73
|
+
password: "password";
|
|
74
|
+
oauth: "oauth";
|
|
75
|
+
}>>>;
|
|
76
|
+
workspace_role: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
77
|
+
admin: "admin";
|
|
78
|
+
member: "member";
|
|
79
|
+
}>>>;
|
|
80
|
+
}, z.core.$strip>;
|
|
59
81
|
export type UserData = z.infer<typeof UserEntitySchema>;
|
|
60
82
|
export declare const WorkspaceEntitySchema: z.ZodObject<{
|
|
61
83
|
id: z.ZodNumber;
|
|
@@ -80,6 +102,26 @@ export declare const WorkspaceEntitySchema: z.ZodObject<{
|
|
|
80
102
|
notify_all_members_on_question: z.ZodBoolean;
|
|
81
103
|
}, z.core.$strip>;
|
|
82
104
|
export type WorkspaceData = z.infer<typeof WorkspaceEntitySchema>;
|
|
105
|
+
export declare const WorkspaceSummarySchema: z.ZodObject<{
|
|
106
|
+
id: z.ZodNumber;
|
|
107
|
+
created_at: z.ZodCoercedDate<unknown>;
|
|
108
|
+
updated_at: z.ZodCoercedDate<unknown>;
|
|
109
|
+
slug: z.ZodString;
|
|
110
|
+
name: z.ZodString;
|
|
111
|
+
status: z.ZodEnum<{
|
|
112
|
+
created: "created";
|
|
113
|
+
active: "active";
|
|
114
|
+
suspended: "suspended";
|
|
115
|
+
}>;
|
|
116
|
+
package: z.ZodEnum<{
|
|
117
|
+
free: "free";
|
|
118
|
+
startup: "startup";
|
|
119
|
+
growth: "growth";
|
|
120
|
+
enterprise: "enterprise";
|
|
121
|
+
}>;
|
|
122
|
+
ending_date: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
123
|
+
slack_webhook_configured: z.ZodBoolean;
|
|
124
|
+
}, z.core.$strip>;
|
|
83
125
|
export declare const ApplicationEntitySchema: z.ZodObject<{
|
|
84
126
|
id: z.ZodNumber;
|
|
85
127
|
created_at: z.ZodCoercedDate<unknown>;
|
|
@@ -105,7 +105,6 @@ export type WidgetUpdateData = z.infer<typeof WidgetUpdateSchema>;
|
|
|
105
105
|
export declare const WidgetEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
106
106
|
type: z.ZodLiteral<"registered">;
|
|
107
107
|
chat_id: z.ZodString;
|
|
108
|
-
application_id: z.ZodOptional<z.ZodNumber>;
|
|
109
108
|
}, z.core.$strip>, z.ZodObject<{
|
|
110
109
|
type: z.ZodLiteral<"heartbeat">;
|
|
111
110
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -576,10 +575,10 @@ export declare const widgetStream: import("@orpc/contract").ContractProcedureBui
|
|
|
576
575
|
tab_id: z.ZodOptional<z.ZodString>;
|
|
577
576
|
marketrix_id: z.ZodOptional<z.ZodString>;
|
|
578
577
|
marketrix_key: z.ZodOptional<z.ZodString>;
|
|
578
|
+
user_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
579
579
|
}, z.core.$strip>, import("@orpc/contract").Schema<AsyncIteratorObject<{
|
|
580
580
|
type: "registered";
|
|
581
581
|
chat_id: string;
|
|
582
|
-
application_id?: number | undefined;
|
|
583
582
|
} | {
|
|
584
583
|
type: "heartbeat";
|
|
585
584
|
} | {
|
|
@@ -608,7 +607,6 @@ export declare const widgetStream: import("@orpc/contract").ContractProcedureBui
|
|
|
608
607
|
}, unknown, void>, import("@orpc/shared").AsyncIteratorClass<{
|
|
609
608
|
type: "registered";
|
|
610
609
|
chat_id: string;
|
|
611
|
-
application_id?: number | undefined;
|
|
612
610
|
} | {
|
|
613
611
|
type: "heartbeat";
|
|
614
612
|
} | {
|
|
@@ -677,7 +675,7 @@ export declare const widgetMessagePost: import("@orpc/contract").ContractProcedu
|
|
|
677
675
|
events: z.ZodArray<z.ZodUnknown>;
|
|
678
676
|
}, z.core.$strip>], "type">;
|
|
679
677
|
}, z.core.$strip>, z.ZodObject<{
|
|
680
|
-
|
|
678
|
+
success: z.ZodLiteral<true>;
|
|
681
679
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
682
680
|
export declare const widgetRoutes: {
|
|
683
681
|
widgetCreate: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
@@ -1074,10 +1072,10 @@ export declare const widgetRoutes: {
|
|
|
1074
1072
|
tab_id: z.ZodOptional<z.ZodString>;
|
|
1075
1073
|
marketrix_id: z.ZodOptional<z.ZodString>;
|
|
1076
1074
|
marketrix_key: z.ZodOptional<z.ZodString>;
|
|
1075
|
+
user_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
1077
1076
|
}, z.core.$strip>, import("@orpc/contract").Schema<AsyncIteratorObject<{
|
|
1078
1077
|
type: "registered";
|
|
1079
1078
|
chat_id: string;
|
|
1080
|
-
application_id?: number | undefined;
|
|
1081
1079
|
} | {
|
|
1082
1080
|
type: "heartbeat";
|
|
1083
1081
|
} | {
|
|
@@ -1106,7 +1104,6 @@ export declare const widgetRoutes: {
|
|
|
1106
1104
|
}, unknown, void>, import("@orpc/shared").AsyncIteratorClass<{
|
|
1107
1105
|
type: "registered";
|
|
1108
1106
|
chat_id: string;
|
|
1109
|
-
application_id?: number | undefined;
|
|
1110
1107
|
} | {
|
|
1111
1108
|
type: "heartbeat";
|
|
1112
1109
|
} | {
|
|
@@ -1175,6 +1172,6 @@ export declare const widgetRoutes: {
|
|
|
1175
1172
|
events: z.ZodArray<z.ZodUnknown>;
|
|
1176
1173
|
}, z.core.$strip>], "type">;
|
|
1177
1174
|
}, z.core.$strip>, z.ZodObject<{
|
|
1178
|
-
|
|
1175
|
+
success: z.ZodLiteral<true>;
|
|
1179
1176
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
1180
1177
|
};
|
package/dist/src/sdk/index.d.ts
CHANGED
|
@@ -1,23 +1,5 @@
|
|
|
1
1
|
export declare const configureSdk: (apiUrl: string) => void;
|
|
2
2
|
export declare const sdk: {
|
|
3
|
-
activityLogCreate: import("@orpc/contract").ContractProcedureClient<Record<never, never>, import("zod").ZodObject<{
|
|
4
|
-
type: import("zod").ZodLiteral<"widget_question">;
|
|
5
|
-
metadata: import("zod").ZodObject<{
|
|
6
|
-
question: import("zod").ZodString;
|
|
7
|
-
mode: import("zod").ZodEnum<{
|
|
8
|
-
tell: "tell";
|
|
9
|
-
show: "show";
|
|
10
|
-
do: "do";
|
|
11
|
-
}>;
|
|
12
|
-
chat_id: import("zod").ZodString;
|
|
13
|
-
timestamp: import("zod").ZodString;
|
|
14
|
-
marketrix_id: import("zod").ZodString;
|
|
15
|
-
marketrix_key: import("zod").ZodString;
|
|
16
|
-
user_id: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
17
|
-
}, import("zod/v4/core").$strict>;
|
|
18
|
-
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
19
|
-
success: import("zod").ZodLiteral<true>;
|
|
20
|
-
}, import("zod/v4/core").$strip>, Record<never, never>>;
|
|
21
3
|
chatCreate: import("@orpc/contract").ContractProcedureClient<Record<never, never>, import("@orpc/contract").Schema<unknown, unknown>, import("zod").ZodString, Record<never, never>>;
|
|
22
4
|
widgetDefaultGet: import("@orpc/contract").ContractProcedureClient<Record<never, never>, import("zod").ZodObject<{
|
|
23
5
|
type: import("zod").ZodEnum<{
|
|
@@ -163,17 +145,17 @@ export declare const sdk: {
|
|
|
163
145
|
events: import("zod").ZodArray<import("zod").ZodUnknown>;
|
|
164
146
|
}, import("zod/v4/core").$strip>], "type">;
|
|
165
147
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
166
|
-
|
|
148
|
+
success: import("zod").ZodLiteral<true>;
|
|
167
149
|
}, import("zod/v4/core").$strip>, Record<never, never>>;
|
|
168
150
|
widgetStream: import("@orpc/contract").ContractProcedureClient<Record<never, never>, import("zod").ZodObject<{
|
|
169
151
|
chat_id: import("zod").ZodString;
|
|
170
152
|
tab_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
171
153
|
marketrix_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
172
154
|
marketrix_key: import("zod").ZodOptional<import("zod").ZodString>;
|
|
155
|
+
user_id: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
|
|
173
156
|
}, import("zod/v4/core").$strip>, import("@orpc/contract").Schema<AsyncIteratorObject<{
|
|
174
157
|
type: "registered";
|
|
175
158
|
chat_id: string;
|
|
176
|
-
application_id?: number | undefined;
|
|
177
159
|
} | {
|
|
178
160
|
type: "heartbeat";
|
|
179
161
|
} | {
|
|
@@ -202,7 +184,6 @@ export declare const sdk: {
|
|
|
202
184
|
}, unknown, void>, import("@orpc/shared").AsyncIteratorClass<{
|
|
203
185
|
type: "registered";
|
|
204
186
|
chat_id: string;
|
|
205
|
-
application_id?: number | undefined;
|
|
206
187
|
} | {
|
|
207
188
|
type: "heartbeat";
|
|
208
189
|
} | {
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Sends one visitor turn to the api. `chatPost` mints or reuses the chat id,
|
|
3
|
-
*
|
|
2
|
+
* Sends one visitor turn to the api. `chatPost` mints or reuses the chat id, then POSTs a
|
|
3
|
+
* `chat/${mode}` `WidgetCommand` over the stream.
|
|
4
4
|
*
|
|
5
5
|
* The reply never comes back from here — it arrives asynchronously on the SSE stream as `chat/delta`
|
|
6
6
|
* fragments and a final `chat/response`, matched by `request_id` (the caller's placeholder message id).
|
|
7
7
|
* That is why `StreamClient.ready` must resolve BEFORE the POST: registration is what gives the reply
|
|
8
8
|
* somewhere to land.
|
|
9
9
|
*
|
|
10
|
-
* The
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* it can neither delay nor fail the send, and a rejection warns and stops there — whereas a failed
|
|
14
|
-
* `send` propagates to `ChatContext`, which renders the error turn.
|
|
10
|
+
* The `widget_question` activity-log row is no longer filed from here — `StreamClient` sends `user_id`
|
|
11
|
+
* once, at `widgetStream` registration, and the api derives the row from `chat_id`'s bound application on
|
|
12
|
+
* every Tell/Show/Do command, so a per-message credential re-send is gone.
|
|
15
13
|
*/
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
export declare function chatPost(config: CredentialedConfig, message: string, mode: InstructionType, requestId: string): Promise<void>;
|
|
14
|
+
import type { InstructionType } from '../sdk';
|
|
15
|
+
export declare function chatPost(message: string, mode: InstructionType, requestId: string): Promise<void>;
|