@marketrix.ai/widget 3.8.508 → 3.8.510
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.
|
@@ -62,23 +62,18 @@ export declare const widgetContract: {
|
|
|
62
62
|
chip_text: import("zod").ZodString;
|
|
63
63
|
}, import("zod/v4/core").$strip>>;
|
|
64
64
|
}, import("zod/v4/core").$strip>, Record<never, never>, Record<never, never>>;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}>>;
|
|
69
|
-
application_id: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
|
|
70
|
-
marketrix_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
71
|
-
marketrix_key: import("zod").ZodOptional<import("zod").ZodString>;
|
|
65
|
+
widgetPublicSearch: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
|
|
66
|
+
marketrix_id: import("zod").ZodString;
|
|
67
|
+
marketrix_key: import("zod").ZodString;
|
|
72
68
|
limit: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>>;
|
|
73
69
|
offset: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>>;
|
|
74
70
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
75
71
|
items: import("zod").ZodArray<import("zod").ZodObject<{
|
|
76
|
-
id: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
77
|
-
created_at: import("zod").ZodOptional<import("zod").ZodCoercedDate<unknown>>;
|
|
78
|
-
updated_at: import("zod").ZodOptional<import("zod").ZodCoercedDate<unknown>>;
|
|
79
72
|
application_id: import("zod").ZodNumber;
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
status: import("zod").ZodEnum<{
|
|
74
|
+
created: "created";
|
|
75
|
+
active: "active";
|
|
76
|
+
suspended: "suspended";
|
|
82
77
|
}>;
|
|
83
78
|
settings: import("zod").ZodObject<{
|
|
84
79
|
widget_enabled: import("zod").ZodBoolean;
|
|
@@ -120,14 +115,6 @@ export declare const widgetContract: {
|
|
|
120
115
|
chip_text: import("zod").ZodString;
|
|
121
116
|
}, import("zod/v4/core").$strip>>;
|
|
122
117
|
}, import("zod/v4/core").$strip>;
|
|
123
|
-
status: import("zod").ZodEnum<{
|
|
124
|
-
created: "created";
|
|
125
|
-
active: "active";
|
|
126
|
-
suspended: "suspended";
|
|
127
|
-
}>;
|
|
128
|
-
marketrix_id: import("zod").ZodString;
|
|
129
|
-
marketrix_key: import("zod").ZodString;
|
|
130
|
-
snippet: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
131
118
|
}, import("zod/v4/core").$strip>>;
|
|
132
119
|
total: import("zod").ZodNumber;
|
|
133
120
|
limit: import("zod").ZodNumber;
|
|
@@ -90,39 +90,16 @@ export declare const GraphSectionSchema: z.ZodObject<{
|
|
|
90
90
|
screenshot: z.ZodString;
|
|
91
91
|
embedding: z.ZodNullable<z.ZodArray<z.ZodNumber>>;
|
|
92
92
|
}, z.core.$strict>;
|
|
93
|
-
export declare const
|
|
93
|
+
export declare const GraphNodeSummarySchema: z.ZodObject<{
|
|
94
94
|
id: z.ZodString;
|
|
95
95
|
title: z.ZodString;
|
|
96
96
|
url: z.ZodString;
|
|
97
97
|
summary: z.ZodString;
|
|
98
98
|
screenshot: z.ZodString;
|
|
99
|
-
sections: z.ZodArray<z.ZodObject<{
|
|
100
|
-
id: z.ZodString;
|
|
101
|
-
label: z.ZodString;
|
|
102
|
-
purpose: z.ZodString;
|
|
103
|
-
elements: z.ZodArray<z.ZodObject<{
|
|
104
|
-
label: z.ZodString;
|
|
105
|
-
text: z.ZodString;
|
|
106
|
-
bbox: z.ZodObject<{
|
|
107
|
-
x: z.ZodNumber;
|
|
108
|
-
y: z.ZodNumber;
|
|
109
|
-
w: z.ZodNumber;
|
|
110
|
-
h: z.ZodNumber;
|
|
111
|
-
}, z.core.$strict>;
|
|
112
|
-
}, z.core.$strict>>;
|
|
113
|
-
bbox: z.ZodObject<{
|
|
114
|
-
x: z.ZodNumber;
|
|
115
|
-
y: z.ZodNumber;
|
|
116
|
-
w: z.ZodNumber;
|
|
117
|
-
h: z.ZodNumber;
|
|
118
|
-
}, z.core.$strict>;
|
|
119
|
-
screenshot: z.ZodString;
|
|
120
|
-
embedding: z.ZodNullable<z.ZodArray<z.ZodNumber>>;
|
|
121
|
-
}, z.core.$strict>>;
|
|
122
99
|
sequence_ids: z.ZodArray<z.ZodNumber>;
|
|
123
100
|
embedding: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
|
|
124
101
|
}, z.core.$strict>;
|
|
125
|
-
export type GraphNodeData = z.infer<typeof
|
|
102
|
+
export type GraphNodeData = z.infer<typeof GraphNodeSummarySchema>;
|
|
126
103
|
export declare const GraphSchema: z.ZodObject<{
|
|
127
104
|
nodes: z.ZodArray<z.ZodObject<{
|
|
128
105
|
id: z.ZodString;
|
|
@@ -130,29 +107,6 @@ export declare const GraphSchema: z.ZodObject<{
|
|
|
130
107
|
url: z.ZodString;
|
|
131
108
|
summary: z.ZodString;
|
|
132
109
|
screenshot: z.ZodString;
|
|
133
|
-
sections: z.ZodArray<z.ZodObject<{
|
|
134
|
-
id: z.ZodString;
|
|
135
|
-
label: z.ZodString;
|
|
136
|
-
purpose: z.ZodString;
|
|
137
|
-
elements: z.ZodArray<z.ZodObject<{
|
|
138
|
-
label: z.ZodString;
|
|
139
|
-
text: z.ZodString;
|
|
140
|
-
bbox: z.ZodObject<{
|
|
141
|
-
x: z.ZodNumber;
|
|
142
|
-
y: z.ZodNumber;
|
|
143
|
-
w: z.ZodNumber;
|
|
144
|
-
h: z.ZodNumber;
|
|
145
|
-
}, z.core.$strict>;
|
|
146
|
-
}, z.core.$strict>>;
|
|
147
|
-
bbox: z.ZodObject<{
|
|
148
|
-
x: z.ZodNumber;
|
|
149
|
-
y: z.ZodNumber;
|
|
150
|
-
w: z.ZodNumber;
|
|
151
|
-
h: z.ZodNumber;
|
|
152
|
-
}, z.core.$strict>;
|
|
153
|
-
screenshot: z.ZodString;
|
|
154
|
-
embedding: z.ZodNullable<z.ZodArray<z.ZodNumber>>;
|
|
155
|
-
}, z.core.$strict>>;
|
|
156
110
|
sequence_ids: z.ZodArray<z.ZodNumber>;
|
|
157
111
|
embedding: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
|
|
158
112
|
}, z.core.$strict>>;
|
|
@@ -76,8 +76,8 @@ export declare const WorkspaceEntitySchema: z.ZodObject<{
|
|
|
76
76
|
}>;
|
|
77
77
|
ending_date: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
78
78
|
external_workspace_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
79
|
-
slack_webhook_configured: z.
|
|
80
|
-
notify_all_members_on_question: z.
|
|
79
|
+
slack_webhook_configured: z.ZodBoolean;
|
|
80
|
+
notify_all_members_on_question: z.ZodBoolean;
|
|
81
81
|
}, z.core.$strip>;
|
|
82
82
|
export type WorkspaceData = z.infer<typeof WorkspaceEntitySchema>;
|
|
83
83
|
export declare const ApplicationEntitySchema: z.ZodObject<{
|
|
@@ -260,6 +260,55 @@ export declare const WidgetEntitySchema: z.ZodObject<{
|
|
|
260
260
|
snippet: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
261
261
|
}, z.core.$strip>;
|
|
262
262
|
export type WidgetData = z.infer<typeof WidgetEntitySchema>;
|
|
263
|
+
export declare const WidgetPublicSchema: z.ZodObject<{
|
|
264
|
+
application_id: z.ZodNumber;
|
|
265
|
+
status: z.ZodEnum<{
|
|
266
|
+
created: "created";
|
|
267
|
+
active: "active";
|
|
268
|
+
suspended: "suspended";
|
|
269
|
+
}>;
|
|
270
|
+
settings: z.ZodObject<{
|
|
271
|
+
widget_enabled: z.ZodBoolean;
|
|
272
|
+
widget_appearance: z.ZodEnum<{
|
|
273
|
+
default: "default";
|
|
274
|
+
hidden: "hidden";
|
|
275
|
+
}>;
|
|
276
|
+
widget_position: z.ZodEnum<{
|
|
277
|
+
bottom_left: "bottom_left";
|
|
278
|
+
bottom_right: "bottom_right";
|
|
279
|
+
top_left: "top_left";
|
|
280
|
+
top_right: "top_right";
|
|
281
|
+
}>;
|
|
282
|
+
widget_header: z.ZodString;
|
|
283
|
+
widget_body: z.ZodString;
|
|
284
|
+
widget_greeting: z.ZodString;
|
|
285
|
+
widget_greeting_toast: z.ZodBoolean;
|
|
286
|
+
widget_recording: z.ZodBoolean;
|
|
287
|
+
widget_feature_tell: z.ZodBoolean;
|
|
288
|
+
widget_feature_show: z.ZodBoolean;
|
|
289
|
+
widget_feature_do: z.ZodBoolean;
|
|
290
|
+
widget_background_color: z.ZodString;
|
|
291
|
+
widget_text_color: z.ZodString;
|
|
292
|
+
widget_border_color: z.ZodString;
|
|
293
|
+
widget_accent_color: z.ZodString;
|
|
294
|
+
widget_secondary_color: z.ZodString;
|
|
295
|
+
widget_border_radius: z.ZodString;
|
|
296
|
+
widget_font_size: z.ZodString;
|
|
297
|
+
widget_width: z.ZodString;
|
|
298
|
+
widget_height: z.ZodString;
|
|
299
|
+
widget_animation_duration: z.ZodString;
|
|
300
|
+
widget_fade_duration: z.ZodString;
|
|
301
|
+
widget_chips: z.ZodArray<z.ZodObject<{
|
|
302
|
+
chip_mode: z.ZodEnum<{
|
|
303
|
+
tell: "tell";
|
|
304
|
+
show: "show";
|
|
305
|
+
do: "do";
|
|
306
|
+
}>;
|
|
307
|
+
chip_text: z.ZodString;
|
|
308
|
+
}, z.core.$strip>>;
|
|
309
|
+
}, z.core.$strip>;
|
|
310
|
+
}, z.core.$strip>;
|
|
311
|
+
export type WidgetPublicData = z.infer<typeof WidgetPublicSchema>;
|
|
263
312
|
export declare const ActivityLogTypeSchema: z.ZodEnum<{
|
|
264
313
|
update_workspace: "update_workspace";
|
|
265
314
|
update_user: "update_user";
|
|
@@ -302,8 +302,6 @@ export declare const widgetSearch: import("@orpc/contract").ContractProcedureBui
|
|
|
302
302
|
widget: "widget";
|
|
303
303
|
}>>;
|
|
304
304
|
application_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
305
|
-
marketrix_id: z.ZodOptional<z.ZodString>;
|
|
306
|
-
marketrix_key: z.ZodOptional<z.ZodString>;
|
|
307
305
|
limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
308
306
|
offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
309
307
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -368,6 +366,64 @@ export declare const widgetSearch: import("@orpc/contract").ContractProcedureBui
|
|
|
368
366
|
limit: z.ZodNumber;
|
|
369
367
|
offset: z.ZodNumber;
|
|
370
368
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
369
|
+
export declare const widgetPublicSearch: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
370
|
+
marketrix_id: z.ZodString;
|
|
371
|
+
marketrix_key: z.ZodString;
|
|
372
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
373
|
+
offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
374
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
375
|
+
items: z.ZodArray<z.ZodObject<{
|
|
376
|
+
application_id: z.ZodNumber;
|
|
377
|
+
status: z.ZodEnum<{
|
|
378
|
+
created: "created";
|
|
379
|
+
active: "active";
|
|
380
|
+
suspended: "suspended";
|
|
381
|
+
}>;
|
|
382
|
+
settings: z.ZodObject<{
|
|
383
|
+
widget_enabled: z.ZodBoolean;
|
|
384
|
+
widget_appearance: z.ZodEnum<{
|
|
385
|
+
default: "default";
|
|
386
|
+
hidden: "hidden";
|
|
387
|
+
}>;
|
|
388
|
+
widget_position: z.ZodEnum<{
|
|
389
|
+
bottom_left: "bottom_left";
|
|
390
|
+
bottom_right: "bottom_right";
|
|
391
|
+
top_left: "top_left";
|
|
392
|
+
top_right: "top_right";
|
|
393
|
+
}>;
|
|
394
|
+
widget_header: z.ZodString;
|
|
395
|
+
widget_body: z.ZodString;
|
|
396
|
+
widget_greeting: z.ZodString;
|
|
397
|
+
widget_greeting_toast: z.ZodBoolean;
|
|
398
|
+
widget_recording: z.ZodBoolean;
|
|
399
|
+
widget_feature_tell: z.ZodBoolean;
|
|
400
|
+
widget_feature_show: z.ZodBoolean;
|
|
401
|
+
widget_feature_do: z.ZodBoolean;
|
|
402
|
+
widget_background_color: z.ZodString;
|
|
403
|
+
widget_text_color: z.ZodString;
|
|
404
|
+
widget_border_color: z.ZodString;
|
|
405
|
+
widget_accent_color: z.ZodString;
|
|
406
|
+
widget_secondary_color: z.ZodString;
|
|
407
|
+
widget_border_radius: z.ZodString;
|
|
408
|
+
widget_font_size: z.ZodString;
|
|
409
|
+
widget_width: z.ZodString;
|
|
410
|
+
widget_height: z.ZodString;
|
|
411
|
+
widget_animation_duration: z.ZodString;
|
|
412
|
+
widget_fade_duration: z.ZodString;
|
|
413
|
+
widget_chips: z.ZodArray<z.ZodObject<{
|
|
414
|
+
chip_mode: z.ZodEnum<{
|
|
415
|
+
tell: "tell";
|
|
416
|
+
show: "show";
|
|
417
|
+
do: "do";
|
|
418
|
+
}>;
|
|
419
|
+
chip_text: z.ZodString;
|
|
420
|
+
}, z.core.$strip>>;
|
|
421
|
+
}, z.core.$strip>;
|
|
422
|
+
}, z.core.$strip>>;
|
|
423
|
+
total: z.ZodNumber;
|
|
424
|
+
limit: z.ZodNumber;
|
|
425
|
+
offset: z.ZodNumber;
|
|
426
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
371
427
|
export declare const widgetDefaultGet: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
372
428
|
type: z.ZodEnum<{
|
|
373
429
|
widget: "widget";
|
|
@@ -750,8 +806,6 @@ export declare const widgetRoutes: {
|
|
|
750
806
|
widget: "widget";
|
|
751
807
|
}>>;
|
|
752
808
|
application_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
753
|
-
marketrix_id: z.ZodOptional<z.ZodString>;
|
|
754
|
-
marketrix_key: z.ZodOptional<z.ZodString>;
|
|
755
809
|
limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
756
810
|
offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
757
811
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -816,6 +870,64 @@ export declare const widgetRoutes: {
|
|
|
816
870
|
limit: z.ZodNumber;
|
|
817
871
|
offset: z.ZodNumber;
|
|
818
872
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
873
|
+
widgetPublicSearch: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
874
|
+
marketrix_id: z.ZodString;
|
|
875
|
+
marketrix_key: z.ZodString;
|
|
876
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
877
|
+
offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
878
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
879
|
+
items: z.ZodArray<z.ZodObject<{
|
|
880
|
+
application_id: z.ZodNumber;
|
|
881
|
+
status: z.ZodEnum<{
|
|
882
|
+
created: "created";
|
|
883
|
+
active: "active";
|
|
884
|
+
suspended: "suspended";
|
|
885
|
+
}>;
|
|
886
|
+
settings: z.ZodObject<{
|
|
887
|
+
widget_enabled: z.ZodBoolean;
|
|
888
|
+
widget_appearance: z.ZodEnum<{
|
|
889
|
+
default: "default";
|
|
890
|
+
hidden: "hidden";
|
|
891
|
+
}>;
|
|
892
|
+
widget_position: z.ZodEnum<{
|
|
893
|
+
bottom_left: "bottom_left";
|
|
894
|
+
bottom_right: "bottom_right";
|
|
895
|
+
top_left: "top_left";
|
|
896
|
+
top_right: "top_right";
|
|
897
|
+
}>;
|
|
898
|
+
widget_header: z.ZodString;
|
|
899
|
+
widget_body: z.ZodString;
|
|
900
|
+
widget_greeting: z.ZodString;
|
|
901
|
+
widget_greeting_toast: z.ZodBoolean;
|
|
902
|
+
widget_recording: z.ZodBoolean;
|
|
903
|
+
widget_feature_tell: z.ZodBoolean;
|
|
904
|
+
widget_feature_show: z.ZodBoolean;
|
|
905
|
+
widget_feature_do: z.ZodBoolean;
|
|
906
|
+
widget_background_color: z.ZodString;
|
|
907
|
+
widget_text_color: z.ZodString;
|
|
908
|
+
widget_border_color: z.ZodString;
|
|
909
|
+
widget_accent_color: z.ZodString;
|
|
910
|
+
widget_secondary_color: z.ZodString;
|
|
911
|
+
widget_border_radius: z.ZodString;
|
|
912
|
+
widget_font_size: z.ZodString;
|
|
913
|
+
widget_width: z.ZodString;
|
|
914
|
+
widget_height: z.ZodString;
|
|
915
|
+
widget_animation_duration: z.ZodString;
|
|
916
|
+
widget_fade_duration: z.ZodString;
|
|
917
|
+
widget_chips: z.ZodArray<z.ZodObject<{
|
|
918
|
+
chip_mode: z.ZodEnum<{
|
|
919
|
+
tell: "tell";
|
|
920
|
+
show: "show";
|
|
921
|
+
do: "do";
|
|
922
|
+
}>;
|
|
923
|
+
chip_text: z.ZodString;
|
|
924
|
+
}, z.core.$strip>>;
|
|
925
|
+
}, z.core.$strip>;
|
|
926
|
+
}, z.core.$strip>>;
|
|
927
|
+
total: z.ZodNumber;
|
|
928
|
+
limit: z.ZodNumber;
|
|
929
|
+
offset: z.ZodNumber;
|
|
930
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
819
931
|
widgetDefaultGet: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
820
932
|
type: z.ZodEnum<{
|
|
821
933
|
widget: "widget";
|
package/dist/src/sdk/index.d.ts
CHANGED
|
@@ -63,23 +63,18 @@ export declare const sdk: {
|
|
|
63
63
|
chip_text: import("zod").ZodString;
|
|
64
64
|
}, import("zod/v4/core").$strip>>;
|
|
65
65
|
}, import("zod/v4/core").$strip>, Record<never, never>>;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}>>;
|
|
70
|
-
application_id: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
|
|
71
|
-
marketrix_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
72
|
-
marketrix_key: import("zod").ZodOptional<import("zod").ZodString>;
|
|
66
|
+
widgetPublicSearch: import("@orpc/contract").ContractProcedureClient<Record<never, never>, import("zod").ZodObject<{
|
|
67
|
+
marketrix_id: import("zod").ZodString;
|
|
68
|
+
marketrix_key: import("zod").ZodString;
|
|
73
69
|
limit: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>>;
|
|
74
70
|
offset: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>>;
|
|
75
71
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
76
72
|
items: import("zod").ZodArray<import("zod").ZodObject<{
|
|
77
|
-
id: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
78
|
-
created_at: import("zod").ZodOptional<import("zod").ZodCoercedDate<unknown>>;
|
|
79
|
-
updated_at: import("zod").ZodOptional<import("zod").ZodCoercedDate<unknown>>;
|
|
80
73
|
application_id: import("zod").ZodNumber;
|
|
81
|
-
|
|
82
|
-
|
|
74
|
+
status: import("zod").ZodEnum<{
|
|
75
|
+
created: "created";
|
|
76
|
+
active: "active";
|
|
77
|
+
suspended: "suspended";
|
|
83
78
|
}>;
|
|
84
79
|
settings: import("zod").ZodObject<{
|
|
85
80
|
widget_enabled: import("zod").ZodBoolean;
|
|
@@ -121,14 +116,6 @@ export declare const sdk: {
|
|
|
121
116
|
chip_text: import("zod").ZodString;
|
|
122
117
|
}, import("zod/v4/core").$strip>>;
|
|
123
118
|
}, import("zod/v4/core").$strip>;
|
|
124
|
-
status: import("zod").ZodEnum<{
|
|
125
|
-
created: "created";
|
|
126
|
-
active: "active";
|
|
127
|
-
suspended: "suspended";
|
|
128
|
-
}>;
|
|
129
|
-
marketrix_id: import("zod").ZodString;
|
|
130
|
-
marketrix_key: import("zod").ZodString;
|
|
131
|
-
snippet: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
132
119
|
}, import("zod/v4/core").$strip>>;
|
|
133
120
|
total: import("zod").ZodNumber;
|
|
134
121
|
limit: import("zod").ZodNumber;
|
|
@@ -245,6 +232,6 @@ export declare const sdk: {
|
|
|
245
232
|
};
|
|
246
233
|
export { WidgetSettingsDataSchema } from './contracts/entities';
|
|
247
234
|
export { WidgetEventSchema } from './contracts/widget';
|
|
248
|
-
export type { InstructionType,
|
|
235
|
+
export type { InstructionType, WidgetPublicData, WidgetSettingsData } from './contracts/entities';
|
|
249
236
|
export type { WidgetCommand, WidgetEvent } from './contracts/widget';
|
|
250
237
|
export type { widgetContract } from './contract';
|
package/dist/widget.mjs
CHANGED
|
@@ -62,4 +62,4 @@ return v(rc,{ref:m,position:s?"absolute":"fixed",rounded:"lg",border:!0,overflow
|
|
|
62
62
|
return b(wl,{value:g,children:/* @__PURE__ */b(tc,{ref:o,"data-marketrix-widget":!0,position:"relative",style:{...w,...c&&{width:"100%",height:"100%"}},children:/* @__PURE__ */b(ll,{value:r,children:/* @__PURE__ */v(pc,{container:r,offsetBottom:"top"===El(u).vertical?20:90,children:[y&&/* @__PURE__ */b(tc,{"data-screen-edge-glow":!0,position:"fixed",inset:"0",style:{boxShadow:`inset 0 0 22px 2px ${yl(g.widget_accent_color,.72)}, inset 0 0 46px 10px ${yl(g.widget_accent_color,.28)}`,pointerEvents:"none",zIndex:2147483001}}),
|
|
63
63
|
/* @__PURE__ */b(Rl,{label:"Widget",children:/* @__PURE__ */b(id,{})}),
|
|
64
64
|
/* @__PURE__ */b(Al,{onPositionCommit:e=>{d(e),c||De(p,e)}}),
|
|
65
|
-
/* @__PURE__ */b(fc,{error:i.error,onClearError:()=>s.setError(void 0),...dr.canReconnect()&&{onRetry:()=>{s.setError(void 0),dr.reconnectNow()}},greeting:t&&!i.error?e.widget_greeting:void 0,greetingBody:e.widget_body,onGreetingDismiss:()=>n(!1)})]})})})})},ad={mount:null},cd=null,ld=(e,t)=>{const n=e.attachShadow({mode:"closed"}),r=document.createElement("style");r.textContent=':root,:host{--background:oklch(100% 0 0);--foreground:oklch(14.5% 0 0);--card:oklch(100% 0 0);--card-foreground:oklch(14.5% 0 0);--primary:oklch(20.5% 0 0);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(97% 0 0);--secondary-foreground:oklch(20.5% 0 0);--border:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);--foreground-muted:#1f293799;--foreground-faint:#1f293766;--primary-hover:#3b82f6d9;--secondary-bg:#6b728033;--secondary-hover:#6b72804d;--font-sans:"Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--radius:.625rem;--shadow-sm:0 1px 3px 0px #0000001a, 0 1px 2px -1px #0000001a;--shadow-lg:0 1px 3px 0px #0000001a, 0 4px 6px -1px #0000001a;--duration-animation:.3s;--duration-fade:.2s}*,:before,:after{box-sizing:border-box;border:0 solid var(--border);margin:0;padding:0}:host,[data-marketrix-widget]{font-family:var(--font-sans);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;line-height:1.5}:where([data-marketrix-widget]) :where(h1,h2,h3){font-size:inherit;font-weight:inherit}:where([data-marketrix-widget]) :where(img,svg,video,canvas){vertical-align:middle;display:block}:where([data-marketrix-widget]) :where(img,video){max-width:100%;height:auto}:where([data-marketrix-widget]) :where(button,input,textarea){font:inherit;color:inherit;background:0 0;border-radius:0}:where([data-marketrix-widget]) :where(button){appearance:button}:where([data-marketrix-widget]) :where(textarea){resize:vertical}[data-marketrix-widget] [hidden]{display:none!important}[data-marketrix-widget],[data-marketrix-widget] *{pointer-events:auto;transition:color .2s ease-in-out,background-color .2s ease-in-out,border-color .2s ease-in-out,opacity .2s ease-in-out,box-shadow .2s ease-in-out,transform .2s ease-in-out}[data-resizing=true],[data-resizing=true] *{transition:none!important}@media (prefers-reduced-motion:reduce){[data-marketrix-widget]{--duration-animation:0s!important;--duration-fade:0s!important}}.mtx-button,.mtx-icon-button{cursor:pointer;justify-content:center;align-items:center;transition:all .2s ease-in-out;display:inline-flex}.mtx-button{border:1px solid #0000;gap:8px;font-weight:500}.mtx-button:focus-visible{outline:2px solid var(--ring);outline-offset:2px}.mtx-button[data-size=sm]{min-height:28px;padding:4px 8px;font-size:.75rem}.mtx-button[data-size=md]{min-height:36px;padding:8px 16px;font-size:.875rem}.mtx-button[data-variant=primary]{background:var(--primary);color:var(--primary-foreground)}.mtx-button[data-variant=primary]:hover{background:color-mix(in oklab, var(--primary) 90%, transparent)}.mtx-button[data-variant=secondary]{background:var(--secondary);color:var(--secondary-foreground)}.mtx-button[data-variant=secondary]:hover{background:color-mix(in oklab, var(--secondary) 80%, transparent)}.mtx-button[data-variant=ghost]{color:var(--foreground);border-color:var(--border);background:0 0}.mtx-button[data-variant=ghost]:hover{background:var(--border)}.mtx-button[data-variant=chip]{background:var(--secondary-bg);color:var(--foreground)}.mtx-button[data-variant=chip]:hover{background:var(--primary);color:var(--primary-foreground);border-color:var(--primary)}.mtx-button[data-variant=bare],.mtx-button[data-variant=tab]{background:0 0;border-color:#0000;min-height:0;padding:0}.mtx-button[data-variant=bare]{color:inherit}.mtx-button[data-variant=tab]{color:var(--foreground-muted);flex:1;min-width:0;height:100%;position:relative}.mtx-button[data-variant=tab]:hover{color:var(--foreground)}.mtx-button[data-variant=tab][aria-selected=true]{color:var(--primary);font-weight:600}.mtx-button[data-stacked=true]{flex-direction:column;gap:2px}.mtx-button[data-full=true]{width:100%}.mtx-icon-button{border:none;border-radius:9999px;flex-shrink:0}.mtx-icon-button[data-size=xs]{width:20px;min-width:20px;height:20px}.mtx-icon-button[data-size=sm]{width:28px;min-width:28px;height:28px}.mtx-icon-button[data-variant=primary]{background:var(--primary);color:var(--primary-foreground)}.mtx-icon-button[data-variant=primary]:hover{background:var(--primary-hover)}.mtx-icon-button[data-variant=secondary]{background:var(--secondary-bg);color:var(--foreground)}.mtx-icon-button[data-variant=secondary]:hover{background:var(--secondary-hover)}.mtx-icon-button[data-variant=ghost]{color:var(--foreground);opacity:.6;background:0 0}.mtx-icon-button[data-variant=ghost]:hover{opacity:1}.mtx-button[data-disabled=true],.mtx-icon-button[data-disabled=true]{opacity:.5;cursor:not-allowed;pointer-events:none}.mtx-icon{flex-shrink:0;display:inline-block}.mtx-avatar{flex-shrink:0}.mtx-spinner-ring{border-style:solid;border-color:#0000 currentColor currentColor;border-radius:9999px;flex-shrink:0;animation:1s linear infinite mtx-spin}.mtx-visually-hidden{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.mtx-composer:focus-within{border-color:var(--foreground-faint)}.mtx-composer-input{resize:none;width:100%;min-height:0;color:var(--foreground);background:0 0;border:none;padding-left:12px;padding-right:12px;font-size:.875rem;display:block}.mtx-composer-input::placeholder{color:var(--foreground-faint)}.mtx-composer-input:focus{outline:none}.mtx-composer-input:disabled{cursor:not-allowed;opacity:.5}.mtx-mode-chip{cursor:pointer;background:var(--secondary-bg);color:var(--foreground-muted);border:none;border-radius:9999px;align-items:center;gap:2px;padding:2px 8px;font-size:11px;font-weight:500;transition:all .2s ease-in-out;display:inline-flex}.mtx-mode-chip[data-active=true]{background:var(--primary);color:var(--primary-foreground);box-shadow:var(--shadow-sm)}.mtx-toast-viewport{flex-direction:column;gap:8px;max-width:420px;display:flex;position:fixed;left:50%;transform:translate(-50%)}.mtx-toast{animation:mtx-fade-in var(--duration-animation) ease-out}.mtx-toast[data-ending-style]{opacity:0;transition:opacity var(--duration-animation) ease-out}.mtx-dialog-backdrop{animation:mtx-dialog-overlay-in var(--duration-fade) ease-out;background:#0003;position:fixed;inset:0}.mtx-dialog-popup{border-radius:var(--radius);background:var(--card);width:100%;max-width:24rem;max-height:85vh;animation:mtx-dialog-content-in var(--duration-animation) ease-out;flex-direction:column;padding:16px;display:flex;position:fixed;top:50%;left:50%;overflow:auto;transform:translate(-50%,-50%)}.mtx-dialog-title{color:var(--foreground);margin-bottom:4px;font-size:1rem;font-weight:600}.mtx-dialog-description{color:var(--foreground-muted);margin-bottom:16px;font-size:.875rem;line-height:1.625}.mtx-fab-anchor{position:fixed}.mtx-fab-anchor[data-preview=true]{position:absolute}.mtx-fab-anchor[data-animated=true]{transition:transform var(--duration-animation) ease-in-out}.mtx-fab{width:56px;height:56px;transition:all var(--duration-animation) ease-in-out;position:relative;overflow:visible}.mtx-fab[data-open=false]:hover{transform:scale(1.1)}.mtx-fab[data-open=true]{opacity:0;pointer-events:none;transform:scale(0)}.mtx-fab-trigger{z-index:10;width:56px;min-width:56px;height:56px;position:relative}.mtx-fab-center{justify-content:center;align-items:center;width:100%;height:100%;position:relative}.mtx-fab-badge{width:48px;height:48px;transition:transform .167s cubic-bezier(.33,0,0,1),opacity .167s cubic-bezier(.33,0,0,1),background-color .167s cubic-bezier(.33,0,0,1);animation:.25s ease-out forwards mtx-launcher-entrance;position:relative;overflow:hidden}.mtx-fab-badge:hover{transition-duration:.25s;transform:scale(1.1)}.mtx-fab-badge:active{transition-duration:.134s;transition-timing-function:cubic-bezier(.45,0,.2,1);transform:scale(.85)}.mtx-fab-icon-layer{justify-content:center;align-items:center;transition-property:transform,opacity;transition-duration:.16s,80ms;transition-timing-function:linear;position:absolute;inset:0}.mtx-fab-avatar{z-index:10;object-fit:contain;width:100%;height:100%;position:relative}.mtx-fab-chevron{z-index:10;color:var(--foreground);pointer-events:none;position:relative}.mtx-fab-stop{z-index:20;text-transform:uppercase;letter-spacing:.025em;color:#fff;box-shadow:var(--shadow-lg);opacity:0;pointer-events:none;background:#111827;border:1px solid #ffffff40;border-radius:9999px;padding:4px 10px;font-size:11px;font-weight:600;transition:opacity .15s ease-in-out;position:absolute;top:50%;transform:translateY(-50%)}.mtx-fab-stop[data-side=left]{margin-left:8px;left:100%}.mtx-fab-stop[data-side=right]{margin-right:8px;right:100%}.mtx-fab:hover .mtx-fab-stop,.mtx-fab:focus-within .mtx-fab-stop{opacity:1;pointer-events:auto}.mtx-tab-underline{background:var(--primary);opacity:0;border-radius:9999px;height:2px;position:absolute;top:0;left:25%;right:25%}[aria-selected=true]>.mtx-tab-underline{opacity:1}.mtx-live-dot{width:6px;height:6px;display:inline-flex;position:relative}.mtx-live-dot-ping{opacity:.75;background:currentColor;border-radius:9999px;width:100%;height:100%;animation:1s cubic-bezier(0,0,.2,1) infinite mtx-ping;display:inline-flex;position:absolute}.mtx-live-dot-core{background:currentColor;border-radius:9999px;width:6px;height:6px;display:inline-flex;position:relative}.mtx-fab-glow{pointer-events:none;filter:blur(14px);will-change:transform, opacity;border-radius:50%;width:140%;height:140%;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.mtx-fab-ring{pointer-events:none;z-index:0;position:absolute;inset:-3px;overflow:visible}.mtx-fab-ring rect{fill:none;stroke-width:2.5px;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:40 120;animation:1.9s cubic-bezier(.4,0,.2,1) infinite mtx-fab-ring-travel}.mtx-fab-ring[data-tone=processing] rect{stroke:#31d06d;filter:drop-shadow(0 0 3px #31d06db3)}.mtx-fab-ring[data-tone=error] rect{stroke:#d0342c;filter:drop-shadow(0 0 3px #d0342cb3)}.mtx-fab-glow[data-tone=processing]{animation:2s ease-in-out infinite mtx-fab-glow-processing}.mtx-fab-glow[data-tone=error]{animation:1.5s ease-in-out infinite mtx-fab-glow-error}[data-screen-edge-glow]{animation:1.6s ease-in-out infinite mtx-screen-edge-pulse}[data-view-transition][data-direction=forward]{animation:.3s both mtx-view-slide-forward}[data-view-transition][data-direction=back]{animation:.3s both mtx-view-slide-back}@keyframes mtx-spin{to{transform:rotate(360deg)}}@keyframes mtx-ping{75%,to{opacity:0;transform:scale(2)}}@keyframes mtx-pulse{50%{opacity:.5}}@keyframes mtx-dialog-overlay-in{0%{opacity:0}to{opacity:1}}@keyframes mtx-dialog-content-in{0%{opacity:0;scale:.96}to{opacity:1;scale:1}}@keyframes mtx-fade-in{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes mtx-launcher-entrance{0%{opacity:0;transform:scale(.5)}to{opacity:1;transform:scale(1)}}@keyframes mtx-screen-edge-pulse{0%,to{opacity:.55}50%{opacity:1}}@keyframes mtx-fab-ring-travel{0%{stroke-dashoffset:0;opacity:.5}18%{stroke-dashoffset:-112px;opacity:1}35%{stroke-dashoffset:-160px;opacity:.65}60%{stroke-dashoffset:-160px;opacity:.45}82%{stroke-dashoffset:-272px;opacity:1}to{stroke-dashoffset:-320px;opacity:.6}}@keyframes mtx-fab-glow-processing{0%,to{opacity:.72;background:radial-gradient(circle,#31d06d00 38%,#31d06d61 58%,#31d06d3d 68%,#0000 78%);transform:translate(-50%,-50%)scale(1)}50%{opacity:1;background:radial-gradient(circle,#31d06d00 34%,#31d06d8c 56%,#31d06d54 68%,#0000 80%);transform:translate(-50%,-50%)scale(1.1)}}@keyframes mtx-fab-glow-error{0%,to{opacity:.65;background:radial-gradient(circle,#d0342c00 38%,#d0342c57 58%,#d0342c38 68%,#0000 78%);transform:translate(-50%,-50%)scale(1)}50%{opacity:.95;background:radial-gradient(circle,#d0342c00 34%,#d0342c80 56%,#d0342c4d 68%,#0000 80%);transform:translate(-50%,-50%)scale(1.1)}}@keyframes mtx-view-slide-forward{0%{opacity:0;transform:translate(20px)}to{opacity:1;transform:translate(0)}}@keyframes mtx-view-slide-back{0%{opacity:0;transform:translate(-20px)}to{opacity:1;transform:translate(0)}}',n.appendChild(r);const o=document.createElement("div");return o.id=t,n.appendChild(o),{shadowRoot:n,mountEl:o}},ud=e=>{const t=e??document.body,n=document.createElement("div");n.className="marketrix-widget-container",n.style.pointerEvents="auto",e&&Object.assign(n.style,{width:"100%",height:"100%",position:"relative",overflow:"visible"}),t.appendChild(n);const{shadowRoot:r,mountEl:o}=ld(n,"marketrix-widget-root");return Object.assign(o.style,{pointerEvents:"auto",width:"100%",height:"100%",position:"relative"}),{container:n,shadowRoot:r,mountEl:o}},dd=(e,n,r=!1)=>{const o=m(e);return o.render(/* @__PURE__ */b(t.StrictMode,{children:/* @__PURE__ */b(hl,{previewMode:r,children:/* @__PURE__ */b(sd,{config:n})})})),o},hd=()=>null!==ad.mount,pd=()=>ad.mount?.config??null,fd=(e,n="neutral")=>{if("undefined"==typeof window||"undefined"==typeof document)return;md();const r=document.createElement("div");r.id="marketrix-widget-notice-container",r.className="marketrix-widget-notice-container",document.body.appendChild(r);const{mountEl:o}=ld(r,"marketrix-widget-notice-root");(cd=m(o)).render(/* @__PURE__ */b(t.StrictMode,{children:/* @__PURE__ */b(pc,{container:o,children:/* @__PURE__ */b(fc,{error:"error"===n?e:void 0,onClearError:md,greeting:"error"===n?void 0:e,onGreetingDismiss:md})})}))},md=()=>{cd?.unmount(),cd=null,document.getElementById("marketrix-widget-notice-container")?.remove()},gd=null,yd=0,bd=null;function vd(e,t={}){const n=Sr(e);return n.invalidFields?(console.error(`Marketrix Widget: ${kr(n.invalidFields)}`),null):{...Cr(n.settings,t),isPreviewMode:!0}}function wd(e,t,n=!1){const{container:r,mountEl:o}=ud(t),i=dd(o,e,n);ad.mount={instance:i,config:e,container:r,host:t,previewMode:n}}var xd=(e,t)=>{if(gd)return gd;if(window.__mtx?.state)return Promise.resolve();if(hd())return console.warn("Marketrix Widget: already initialized"),Promise.resolve();const n=async function(e,t,n){let r;window.__mtx={state:"initializing"},fd("Loading widget settings...");try{(e=>{if(!e?.trim())throw new Error("API URL is required for SDK configuration");e!==Ie&&(Ie=e,Me=Ee(e))})(e.mtxApiHost??""),r=await async function(e){const{mtxId:t,mtxKey:n}=e;if(!t||!n)throw new Error("Please provide mtxId + mtxKey");let r;try{({items:r}=await Te.widgetSearch({marketrix_id:t,marketrix_key:n}))}catch(s){const t=cr(s);throw function(e,t){return Object.assign(new Error(e),{cause:t})}(["Failed to fetch","ERR_CONNECTION_REFUSED","NetworkError","Network request failed"].some(e=>t.includes(e))?`Cannot connect to API server. Please ensure the API server is running at ${e.mtxApiHost||"configured API server"}. Error: ${t}`:`Widget validation failed: ${t}`,s)}if(!r.length)throw new Error("Widget not found or invalid credentials");const o=r.find(e=>"active"===e.status);if(!o){const e=r.map(e=>e.status).join(", ");throw new Error(`Found widget(s) but none are active. Current status(es): ${e}. Please activate the widget in the dashboard.`)}if(!o.application_id)throw new Error("Widget missing application_id");const i=Sr(o.settings);if(i.invalidFields)throw new Error(kr(i.invalidFields));return{...Cr(i.settings,e),mtxId:t,mtxKey:n,mtxApp:o.application_id}}(e)}catch(o){if(n!==yd)return;return console.error("Marketrix Widget initialization failed:",o),fd(cr(o,"Failed to initialize widget"),"error"),void(window.__mtx=void 0)}n===yd&&(md(),r.widget_enabled?(Le.setConfig(r),wd(r,t),window.__mtx={state:"active"},r.widget_recording&&r.mtxApp&&(async()=>{try{const e=await Fe.getOrCreateChatId();if(n!==yd)return;const t=new hr(e,r.mtxApp);bd=t,await t.start(),n!==yd&&(t.stop(),bd===t&&(bd=null))}catch(o){n===yd&&console.error("Failed to start session recording:",o)}})()):window.__mtx=void 0)}(e,t,++yd);return gd=n,n.then(()=>{gd===n&&(gd=null)},()=>{gd===n&&(gd=null)}),n},Sd=()=>{yd++,dr.disconnect(),bd?.stop(),bd=null,mr();const e=ad.mount;ad.mount=null,e&&(e.instance.unmount(),e.container.remove()),gd=null,window.__mtx=void 0,md()},kd=async e=>{const t=ad.mount;if(!t)return;const{config:n,host:r,previewMode:o}=t,i={...n,...e};Sd(),o?wd(i,r,!0):await xd(i,r)},Cd=({settings:e,container:t})=>{const n=d(null),r=d(null),o=d(null);return a(()=>{const i=t??n.current??document.body;if(!(i&&(s=i,s instanceof HTMLElement)))return void console.error("MarketrixWidgetPreview: Invalid container");var s;const a=vd(e);if(!a)return;const{container:c,mountEl:l}=ud(i);return o.current=c,r.current=dd(l,a,!0),()=>{r.current&&(r.current.unmount(),r.current=null),o.current&&(o.current.remove(),o.current=null)}},[e,t]),t?null:/* @__PURE__ */b("div",{ref:n,style:{width:"100%",height:"100%",position:"relative"}})},Ed=async e=>{const t=e.container;if(void 0!==e.settings){const{settings:n,container:r,...o}=e,i=vd(e.settings,o);if(!i)return;Sd(),wd(i,t,!0)}else{if(void 0===e.mtxId||void 0===e.mtxKey)throw new Error("Invalid configuration: provide either settings (preview) or mtxId+mtxKey (production)");{const{container:n,...r}=e;await xd(r,t)}}};"undefined"!=typeof window&&setTimeout(()=>{try{(e=>{if("undefined"==typeof window||"undefined"==typeof document)return;if(window.__mtx?.state)return;const t=document.querySelectorAll("script[mtx-id]"),n=t[t.length-1];if(!(n&&(r=n,r instanceof HTMLScriptElement)))return;var r;const o=n.getAttribute("mtx-id"),i=n.getAttribute("mtx-key"),s=n.getAttribute("mtx-api-host");if(!o||!i||!s){if(hd())return;return console.error("[AutoInit] Missing required attributes:",{hasMtxId:!!o,hasMtxKey:!!i,hasMtxApiHost:!!s}),void fd("Please configure mtx-id, mtx-key and mtx-api-host","error")}const a={mtxId:o,mtxKey:i,mtxApiHost:s};"false"===n.getAttribute("mtx-use-screenshare")&&(a.use_screenshare=!1),e(a).catch(e=>console.error("[AutoInit] Failed to initialize widget:",e))})(xd)}catch(e){console.error("Marketrix Widget: Auto-init registration failed",e)}},0);var Id={MarketrixWidgetPreview:Cd,mountWidget:Ed,initWidget:xd,unmountWidget:Sd,updateMarketrixConfig:kd,getCurrentConfig:pd};export{Cd as MarketrixWidgetPreview,Id as default,pd as getCurrentConfig,xd as initWidget,Ed as mountWidget,Sd as unmountWidget,kd as updateMarketrixConfig};
|
|
65
|
+
/* @__PURE__ */b(fc,{error:i.error,onClearError:()=>s.setError(void 0),...dr.canReconnect()&&{onRetry:()=>{s.setError(void 0),dr.reconnectNow()}},greeting:t&&!i.error?e.widget_greeting:void 0,greetingBody:e.widget_body,onGreetingDismiss:()=>n(!1)})]})})})})},ad={mount:null},cd=null,ld=(e,t)=>{const n=e.attachShadow({mode:"closed"}),r=document.createElement("style");r.textContent=':root,:host{--background:oklch(100% 0 0);--foreground:oklch(14.5% 0 0);--card:oklch(100% 0 0);--card-foreground:oklch(14.5% 0 0);--primary:oklch(20.5% 0 0);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(97% 0 0);--secondary-foreground:oklch(20.5% 0 0);--border:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);--foreground-muted:#1f293799;--foreground-faint:#1f293766;--primary-hover:#3b82f6d9;--secondary-bg:#6b728033;--secondary-hover:#6b72804d;--font-sans:"Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--radius:.625rem;--shadow-sm:0 1px 3px 0px #0000001a, 0 1px 2px -1px #0000001a;--shadow-lg:0 1px 3px 0px #0000001a, 0 4px 6px -1px #0000001a;--duration-animation:.3s;--duration-fade:.2s}*,:before,:after{box-sizing:border-box;border:0 solid var(--border);margin:0;padding:0}:host,[data-marketrix-widget]{font-family:var(--font-sans);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;line-height:1.5}:where([data-marketrix-widget]) :where(h1,h2,h3){font-size:inherit;font-weight:inherit}:where([data-marketrix-widget]) :where(img,svg,video,canvas){vertical-align:middle;display:block}:where([data-marketrix-widget]) :where(img,video){max-width:100%;height:auto}:where([data-marketrix-widget]) :where(button,input,textarea){font:inherit;color:inherit;background:0 0;border-radius:0}:where([data-marketrix-widget]) :where(button){appearance:button}:where([data-marketrix-widget]) :where(textarea){resize:vertical}[data-marketrix-widget] [hidden]{display:none!important}[data-marketrix-widget],[data-marketrix-widget] *{pointer-events:auto;transition:color .2s ease-in-out,background-color .2s ease-in-out,border-color .2s ease-in-out,opacity .2s ease-in-out,box-shadow .2s ease-in-out,transform .2s ease-in-out}[data-resizing=true],[data-resizing=true] *{transition:none!important}@media (prefers-reduced-motion:reduce){[data-marketrix-widget]{--duration-animation:0s!important;--duration-fade:0s!important}}.mtx-button,.mtx-icon-button{cursor:pointer;justify-content:center;align-items:center;transition:all .2s ease-in-out;display:inline-flex}.mtx-button{border:1px solid #0000;gap:8px;font-weight:500}.mtx-button:focus-visible{outline:2px solid var(--ring);outline-offset:2px}.mtx-button[data-size=sm]{min-height:28px;padding:4px 8px;font-size:.75rem}.mtx-button[data-size=md]{min-height:36px;padding:8px 16px;font-size:.875rem}.mtx-button[data-variant=primary]{background:var(--primary);color:var(--primary-foreground)}.mtx-button[data-variant=primary]:hover{background:color-mix(in oklab, var(--primary) 90%, transparent)}.mtx-button[data-variant=secondary]{background:var(--secondary);color:var(--secondary-foreground)}.mtx-button[data-variant=secondary]:hover{background:color-mix(in oklab, var(--secondary) 80%, transparent)}.mtx-button[data-variant=ghost]{color:var(--foreground);border-color:var(--border);background:0 0}.mtx-button[data-variant=ghost]:hover{background:var(--border)}.mtx-button[data-variant=chip]{background:var(--secondary-bg);color:var(--foreground)}.mtx-button[data-variant=chip]:hover{background:var(--primary);color:var(--primary-foreground);border-color:var(--primary)}.mtx-button[data-variant=bare],.mtx-button[data-variant=tab]{background:0 0;border-color:#0000;min-height:0;padding:0}.mtx-button[data-variant=bare]{color:inherit}.mtx-button[data-variant=tab]{color:var(--foreground-muted);flex:1;min-width:0;height:100%;position:relative}.mtx-button[data-variant=tab]:hover{color:var(--foreground)}.mtx-button[data-variant=tab][aria-selected=true]{color:var(--primary);font-weight:600}.mtx-button[data-stacked=true]{flex-direction:column;gap:2px}.mtx-button[data-full=true]{width:100%}.mtx-icon-button{border:none;border-radius:9999px;flex-shrink:0}.mtx-icon-button[data-size=xs]{width:20px;min-width:20px;height:20px}.mtx-icon-button[data-size=sm]{width:28px;min-width:28px;height:28px}.mtx-icon-button[data-variant=primary]{background:var(--primary);color:var(--primary-foreground)}.mtx-icon-button[data-variant=primary]:hover{background:var(--primary-hover)}.mtx-icon-button[data-variant=secondary]{background:var(--secondary-bg);color:var(--foreground)}.mtx-icon-button[data-variant=secondary]:hover{background:var(--secondary-hover)}.mtx-icon-button[data-variant=ghost]{color:var(--foreground);opacity:.6;background:0 0}.mtx-icon-button[data-variant=ghost]:hover{opacity:1}.mtx-button[data-disabled=true],.mtx-icon-button[data-disabled=true]{opacity:.5;cursor:not-allowed;pointer-events:none}.mtx-icon{flex-shrink:0;display:inline-block}.mtx-avatar{flex-shrink:0}.mtx-spinner-ring{border-style:solid;border-color:#0000 currentColor currentColor;border-radius:9999px;flex-shrink:0;animation:1s linear infinite mtx-spin}.mtx-visually-hidden{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.mtx-composer:focus-within{border-color:var(--foreground-faint)}.mtx-composer-input{resize:none;width:100%;min-height:0;color:var(--foreground);background:0 0;border:none;padding-left:12px;padding-right:12px;font-size:.875rem;display:block}.mtx-composer-input::placeholder{color:var(--foreground-faint)}.mtx-composer-input:focus{outline:none}.mtx-composer-input:disabled{cursor:not-allowed;opacity:.5}.mtx-mode-chip{cursor:pointer;background:var(--secondary-bg);color:var(--foreground-muted);border:none;border-radius:9999px;align-items:center;gap:2px;padding:2px 8px;font-size:11px;font-weight:500;transition:all .2s ease-in-out;display:inline-flex}.mtx-mode-chip[data-active=true]{background:var(--primary);color:var(--primary-foreground);box-shadow:var(--shadow-sm)}.mtx-toast-viewport{flex-direction:column;gap:8px;max-width:420px;display:flex;position:fixed;left:50%;transform:translate(-50%)}.mtx-toast{animation:mtx-fade-in var(--duration-animation) ease-out}.mtx-toast[data-ending-style]{opacity:0;transition:opacity var(--duration-animation) ease-out}.mtx-dialog-backdrop{animation:mtx-dialog-overlay-in var(--duration-fade) ease-out;background:#0003;position:fixed;inset:0}.mtx-dialog-popup{border-radius:var(--radius);background:var(--card);width:100%;max-width:24rem;max-height:85vh;animation:mtx-dialog-content-in var(--duration-animation) ease-out;flex-direction:column;padding:16px;display:flex;position:fixed;top:50%;left:50%;overflow:auto;transform:translate(-50%,-50%)}.mtx-dialog-title{color:var(--foreground);margin-bottom:4px;font-size:1rem;font-weight:600}.mtx-dialog-description{color:var(--foreground-muted);margin-bottom:16px;font-size:.875rem;line-height:1.625}.mtx-fab-anchor{position:fixed}.mtx-fab-anchor[data-preview=true]{position:absolute}.mtx-fab-anchor[data-animated=true]{transition:transform var(--duration-animation) ease-in-out}.mtx-fab{width:56px;height:56px;transition:all var(--duration-animation) ease-in-out;position:relative;overflow:visible}.mtx-fab[data-open=false]:hover{transform:scale(1.1)}.mtx-fab[data-open=true]{opacity:0;pointer-events:none;transform:scale(0)}.mtx-fab-trigger{z-index:10;width:56px;min-width:56px;height:56px;position:relative}.mtx-fab-center{justify-content:center;align-items:center;width:100%;height:100%;position:relative}.mtx-fab-badge{width:48px;height:48px;transition:transform .167s cubic-bezier(.33,0,0,1),opacity .167s cubic-bezier(.33,0,0,1),background-color .167s cubic-bezier(.33,0,0,1);animation:.25s ease-out forwards mtx-launcher-entrance;position:relative;overflow:hidden}.mtx-fab-badge:hover{transition-duration:.25s;transform:scale(1.1)}.mtx-fab-badge:active{transition-duration:.134s;transition-timing-function:cubic-bezier(.45,0,.2,1);transform:scale(.85)}.mtx-fab-icon-layer{justify-content:center;align-items:center;transition-property:transform,opacity;transition-duration:.16s,80ms;transition-timing-function:linear;position:absolute;inset:0}.mtx-fab-avatar{z-index:10;object-fit:contain;width:100%;height:100%;position:relative}.mtx-fab-chevron{z-index:10;color:var(--foreground);pointer-events:none;position:relative}.mtx-fab-stop{z-index:20;text-transform:uppercase;letter-spacing:.025em;color:#fff;box-shadow:var(--shadow-lg);opacity:0;pointer-events:none;background:#111827;border:1px solid #ffffff40;border-radius:9999px;padding:4px 10px;font-size:11px;font-weight:600;transition:opacity .15s ease-in-out;position:absolute;top:50%;transform:translateY(-50%)}.mtx-fab-stop[data-side=left]{margin-left:8px;left:100%}.mtx-fab-stop[data-side=right]{margin-right:8px;right:100%}.mtx-fab:hover .mtx-fab-stop,.mtx-fab:focus-within .mtx-fab-stop{opacity:1;pointer-events:auto}.mtx-tab-underline{background:var(--primary);opacity:0;border-radius:9999px;height:2px;position:absolute;top:0;left:25%;right:25%}[aria-selected=true]>.mtx-tab-underline{opacity:1}.mtx-live-dot{width:6px;height:6px;display:inline-flex;position:relative}.mtx-live-dot-ping{opacity:.75;background:currentColor;border-radius:9999px;width:100%;height:100%;animation:1s cubic-bezier(0,0,.2,1) infinite mtx-ping;display:inline-flex;position:absolute}.mtx-live-dot-core{background:currentColor;border-radius:9999px;width:6px;height:6px;display:inline-flex;position:relative}.mtx-fab-glow{pointer-events:none;filter:blur(14px);will-change:transform, opacity;border-radius:50%;width:140%;height:140%;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.mtx-fab-ring{pointer-events:none;z-index:0;position:absolute;inset:-3px;overflow:visible}.mtx-fab-ring rect{fill:none;stroke-width:2.5px;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:40 120;animation:1.9s cubic-bezier(.4,0,.2,1) infinite mtx-fab-ring-travel}.mtx-fab-ring[data-tone=processing] rect{stroke:#31d06d;filter:drop-shadow(0 0 3px #31d06db3)}.mtx-fab-ring[data-tone=error] rect{stroke:#d0342c;filter:drop-shadow(0 0 3px #d0342cb3)}.mtx-fab-glow[data-tone=processing]{animation:2s ease-in-out infinite mtx-fab-glow-processing}.mtx-fab-glow[data-tone=error]{animation:1.5s ease-in-out infinite mtx-fab-glow-error}[data-screen-edge-glow]{animation:1.6s ease-in-out infinite mtx-screen-edge-pulse}[data-view-transition][data-direction=forward]{animation:.3s both mtx-view-slide-forward}[data-view-transition][data-direction=back]{animation:.3s both mtx-view-slide-back}@keyframes mtx-spin{to{transform:rotate(360deg)}}@keyframes mtx-ping{75%,to{opacity:0;transform:scale(2)}}@keyframes mtx-pulse{50%{opacity:.5}}@keyframes mtx-dialog-overlay-in{0%{opacity:0}to{opacity:1}}@keyframes mtx-dialog-content-in{0%{opacity:0;scale:.96}to{opacity:1;scale:1}}@keyframes mtx-fade-in{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes mtx-launcher-entrance{0%{opacity:0;transform:scale(.5)}to{opacity:1;transform:scale(1)}}@keyframes mtx-screen-edge-pulse{0%,to{opacity:.55}50%{opacity:1}}@keyframes mtx-fab-ring-travel{0%{stroke-dashoffset:0;opacity:.5}18%{stroke-dashoffset:-112px;opacity:1}35%{stroke-dashoffset:-160px;opacity:.65}60%{stroke-dashoffset:-160px;opacity:.45}82%{stroke-dashoffset:-272px;opacity:1}to{stroke-dashoffset:-320px;opacity:.6}}@keyframes mtx-fab-glow-processing{0%,to{opacity:.72;background:radial-gradient(circle,#31d06d00 38%,#31d06d61 58%,#31d06d3d 68%,#0000 78%);transform:translate(-50%,-50%)scale(1)}50%{opacity:1;background:radial-gradient(circle,#31d06d00 34%,#31d06d8c 56%,#31d06d54 68%,#0000 80%);transform:translate(-50%,-50%)scale(1.1)}}@keyframes mtx-fab-glow-error{0%,to{opacity:.65;background:radial-gradient(circle,#d0342c00 38%,#d0342c57 58%,#d0342c38 68%,#0000 78%);transform:translate(-50%,-50%)scale(1)}50%{opacity:.95;background:radial-gradient(circle,#d0342c00 34%,#d0342c80 56%,#d0342c4d 68%,#0000 80%);transform:translate(-50%,-50%)scale(1.1)}}@keyframes mtx-view-slide-forward{0%{opacity:0;transform:translate(20px)}to{opacity:1;transform:translate(0)}}@keyframes mtx-view-slide-back{0%{opacity:0;transform:translate(-20px)}to{opacity:1;transform:translate(0)}}',n.appendChild(r);const o=document.createElement("div");return o.id=t,n.appendChild(o),{shadowRoot:n,mountEl:o}},ud=e=>{const t=e??document.body,n=document.createElement("div");n.className="marketrix-widget-container",n.style.pointerEvents="auto",e&&Object.assign(n.style,{width:"100%",height:"100%",position:"relative",overflow:"visible"}),t.appendChild(n);const{shadowRoot:r,mountEl:o}=ld(n,"marketrix-widget-root");return Object.assign(o.style,{pointerEvents:"auto",width:"100%",height:"100%",position:"relative"}),{container:n,shadowRoot:r,mountEl:o}},dd=(e,n,r=!1)=>{const o=m(e);return o.render(/* @__PURE__ */b(t.StrictMode,{children:/* @__PURE__ */b(hl,{previewMode:r,children:/* @__PURE__ */b(sd,{config:n})})})),o},hd=()=>null!==ad.mount,pd=()=>ad.mount?.config??null,fd=(e,n="neutral")=>{if("undefined"==typeof window||"undefined"==typeof document)return;md();const r=document.createElement("div");r.id="marketrix-widget-notice-container",r.className="marketrix-widget-notice-container",document.body.appendChild(r);const{mountEl:o}=ld(r,"marketrix-widget-notice-root");(cd=m(o)).render(/* @__PURE__ */b(t.StrictMode,{children:/* @__PURE__ */b(pc,{container:o,children:/* @__PURE__ */b(fc,{error:"error"===n?e:void 0,onClearError:md,greeting:"error"===n?void 0:e,onGreetingDismiss:md})})}))},md=()=>{cd?.unmount(),cd=null,document.getElementById("marketrix-widget-notice-container")?.remove()},gd=null,yd=0,bd=null;function vd(e,t={}){const n=Sr(e);return n.invalidFields?(console.error(`Marketrix Widget: ${kr(n.invalidFields)}`),null):{...Cr(n.settings,t),isPreviewMode:!0}}function wd(e,t,n=!1){const{container:r,mountEl:o}=ud(t),i=dd(o,e,n);ad.mount={instance:i,config:e,container:r,host:t,previewMode:n}}var xd=(e,t)=>{if(gd)return gd;if(window.__mtx?.state)return Promise.resolve();if(hd())return console.warn("Marketrix Widget: already initialized"),Promise.resolve();const n=async function(e,t,n){let r;window.__mtx={state:"initializing"},fd("Loading widget settings...");try{(e=>{if(!e?.trim())throw new Error("API URL is required for SDK configuration");e!==Ie&&(Ie=e,Me=Ee(e))})(e.mtxApiHost??""),r=await async function(e){const{mtxId:t,mtxKey:n}=e;if(!t||!n)throw new Error("Please provide mtxId + mtxKey");let r;try{({items:r}=await Te.widgetPublicSearch({marketrix_id:t,marketrix_key:n}))}catch(s){const t=cr(s);throw function(e,t){return Object.assign(new Error(e),{cause:t})}(["Failed to fetch","ERR_CONNECTION_REFUSED","NetworkError","Network request failed"].some(e=>t.includes(e))?`Cannot connect to API server. Please ensure the API server is running at ${e.mtxApiHost||"configured API server"}. Error: ${t}`:`Widget validation failed: ${t}`,s)}if(!r.length)throw new Error("Widget not found or invalid credentials");const o=r.find(e=>"active"===e.status);if(!o){const e=r.map(e=>e.status).join(", ");throw new Error(`Found widget(s) but none are active. Current status(es): ${e}. Please activate the widget in the dashboard.`)}if(!o.application_id)throw new Error("Widget missing application_id");const i=Sr(o.settings);if(i.invalidFields)throw new Error(kr(i.invalidFields));return{...Cr(i.settings,e),mtxId:t,mtxKey:n,mtxApp:o.application_id}}(e)}catch(o){if(n!==yd)return;return console.error("Marketrix Widget initialization failed:",o),fd(cr(o,"Failed to initialize widget"),"error"),void(window.__mtx=void 0)}n===yd&&(md(),r.widget_enabled?(Le.setConfig(r),wd(r,t),window.__mtx={state:"active"},r.widget_recording&&r.mtxApp&&(async()=>{try{const e=await Fe.getOrCreateChatId();if(n!==yd)return;const t=new hr(e,r.mtxApp);bd=t,await t.start(),n!==yd&&(t.stop(),bd===t&&(bd=null))}catch(o){n===yd&&console.error("Failed to start session recording:",o)}})()):window.__mtx=void 0)}(e,t,++yd);return gd=n,n.then(()=>{gd===n&&(gd=null)},()=>{gd===n&&(gd=null)}),n},Sd=()=>{yd++,dr.disconnect(),bd?.stop(),bd=null,mr();const e=ad.mount;ad.mount=null,e&&(e.instance.unmount(),e.container.remove()),gd=null,window.__mtx=void 0,md()},kd=async e=>{const t=ad.mount;if(!t)return;const{config:n,host:r,previewMode:o}=t,i={...n,...e};Sd(),o?wd(i,r,!0):await xd(i,r)},Cd=({settings:e,container:t})=>{const n=d(null),r=d(null),o=d(null);return a(()=>{const i=t??n.current??document.body;if(!(i&&(s=i,s instanceof HTMLElement)))return void console.error("MarketrixWidgetPreview: Invalid container");var s;const a=vd(e);if(!a)return;const{container:c,mountEl:l}=ud(i);return o.current=c,r.current=dd(l,a,!0),()=>{r.current&&(r.current.unmount(),r.current=null),o.current&&(o.current.remove(),o.current=null)}},[e,t]),t?null:/* @__PURE__ */b("div",{ref:n,style:{width:"100%",height:"100%",position:"relative"}})},Ed=async e=>{const t=e.container;if(void 0!==e.settings){const{settings:n,container:r,...o}=e,i=vd(e.settings,o);if(!i)return;Sd(),wd(i,t,!0)}else{if(void 0===e.mtxId||void 0===e.mtxKey)throw new Error("Invalid configuration: provide either settings (preview) or mtxId+mtxKey (production)");{const{container:n,...r}=e;await xd(r,t)}}};"undefined"!=typeof window&&setTimeout(()=>{try{(e=>{if("undefined"==typeof window||"undefined"==typeof document)return;if(window.__mtx?.state)return;const t=document.querySelectorAll("script[mtx-id]"),n=t[t.length-1];if(!(n&&(r=n,r instanceof HTMLScriptElement)))return;var r;const o=n.getAttribute("mtx-id"),i=n.getAttribute("mtx-key"),s=n.getAttribute("mtx-api-host");if(!o||!i||!s){if(hd())return;return console.error("[AutoInit] Missing required attributes:",{hasMtxId:!!o,hasMtxKey:!!i,hasMtxApiHost:!!s}),void fd("Please configure mtx-id, mtx-key and mtx-api-host","error")}const a={mtxId:o,mtxKey:i,mtxApiHost:s};"false"===n.getAttribute("mtx-use-screenshare")&&(a.use_screenshare=!1),e(a).catch(e=>console.error("[AutoInit] Failed to initialize widget:",e))})(xd)}catch(e){console.error("Marketrix Widget: Auto-init registration failed",e)}},0);var Id={MarketrixWidgetPreview:Cd,mountWidget:Ed,initWidget:xd,unmountWidget:Sd,updateMarketrixConfig:kd,getCurrentConfig:pd};export{Cd as MarketrixWidgetPreview,Id as default,pd as getCurrentConfig,xd as initWidget,Ed as mountWidget,Sd as unmountWidget,kd as updateMarketrixConfig};
|