@marketrix.ai/widget 3.8.500 → 3.8.502
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.
|
@@ -144,63 +144,6 @@ export declare const widgetContract: {
|
|
|
144
144
|
workspace_id: import("zod").ZodNumber;
|
|
145
145
|
username: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
146
146
|
allowed_domains: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
147
|
-
widgets: import("zod").ZodArray<import("zod").ZodObject<{
|
|
148
|
-
id: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
149
|
-
created_at: import("zod").ZodOptional<import("zod").ZodCoercedDate<unknown>>;
|
|
150
|
-
updated_at: import("zod").ZodOptional<import("zod").ZodCoercedDate<unknown>>;
|
|
151
|
-
application_id: import("zod").ZodNumber;
|
|
152
|
-
type: import("zod").ZodEnum<{
|
|
153
|
-
widget: "widget";
|
|
154
|
-
}>;
|
|
155
|
-
settings: import("zod").ZodObject<{
|
|
156
|
-
widget_enabled: import("zod").ZodBoolean;
|
|
157
|
-
widget_appearance: import("zod").ZodEnum<{
|
|
158
|
-
default: "default";
|
|
159
|
-
hidden: "hidden";
|
|
160
|
-
}>;
|
|
161
|
-
widget_position: import("zod").ZodEnum<{
|
|
162
|
-
bottom_left: "bottom_left";
|
|
163
|
-
bottom_right: "bottom_right";
|
|
164
|
-
top_left: "top_left";
|
|
165
|
-
top_right: "top_right";
|
|
166
|
-
}>;
|
|
167
|
-
widget_header: import("zod").ZodString;
|
|
168
|
-
widget_body: import("zod").ZodString;
|
|
169
|
-
widget_greeting: import("zod").ZodString;
|
|
170
|
-
widget_greeting_toast: import("zod").ZodBoolean;
|
|
171
|
-
widget_recording: import("zod").ZodBoolean;
|
|
172
|
-
widget_feature_tell: import("zod").ZodBoolean;
|
|
173
|
-
widget_feature_show: import("zod").ZodBoolean;
|
|
174
|
-
widget_feature_do: import("zod").ZodBoolean;
|
|
175
|
-
widget_background_color: import("zod").ZodString;
|
|
176
|
-
widget_text_color: import("zod").ZodString;
|
|
177
|
-
widget_border_color: import("zod").ZodString;
|
|
178
|
-
widget_accent_color: import("zod").ZodString;
|
|
179
|
-
widget_secondary_color: import("zod").ZodString;
|
|
180
|
-
widget_border_radius: import("zod").ZodString;
|
|
181
|
-
widget_font_size: import("zod").ZodString;
|
|
182
|
-
widget_width: import("zod").ZodString;
|
|
183
|
-
widget_height: import("zod").ZodString;
|
|
184
|
-
widget_animation_duration: import("zod").ZodString;
|
|
185
|
-
widget_fade_duration: import("zod").ZodString;
|
|
186
|
-
widget_chips: import("zod").ZodArray<import("zod").ZodObject<{
|
|
187
|
-
chip_mode: import("zod").ZodEnum<{
|
|
188
|
-
tell: "tell";
|
|
189
|
-
show: "show";
|
|
190
|
-
do: "do";
|
|
191
|
-
}>;
|
|
192
|
-
chip_text: import("zod").ZodString;
|
|
193
|
-
}, import("zod/v4/core").$strip>>;
|
|
194
|
-
}, import("zod/v4/core").$strip>;
|
|
195
|
-
status: import("zod").ZodEnum<{
|
|
196
|
-
created: "created";
|
|
197
|
-
active: "active";
|
|
198
|
-
suspended: "suspended";
|
|
199
|
-
}>;
|
|
200
|
-
marketrix_id: import("zod").ZodString;
|
|
201
|
-
marketrix_key: import("zod").ZodString;
|
|
202
|
-
snippet: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
203
|
-
}, import("zod/v4/core").$strip>>;
|
|
204
147
|
}, import("zod/v4/core").$strip>, Record<never, never>, Record<never, never>>;
|
|
205
148
|
chatCreate: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, import("zod").ZodString, Record<never, never>, Record<never, never>>;
|
|
206
149
|
widgetDefaultGet: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
|
|
@@ -67,9 +67,6 @@ export declare const applicationSearch: import("@orpc/contract").ContractProcedu
|
|
|
67
67
|
app: "app";
|
|
68
68
|
website: "website";
|
|
69
69
|
}>>;
|
|
70
|
-
include: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
71
|
-
widgets: "widgets";
|
|
72
|
-
}>>>;
|
|
73
70
|
limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
74
71
|
offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
75
72
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -87,63 +84,6 @@ export declare const applicationSearch: import("@orpc/contract").ContractProcedu
|
|
|
87
84
|
workspace_id: z.ZodNumber;
|
|
88
85
|
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
89
86
|
allowed_domains: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
90
|
-
widgets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
91
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
92
|
-
created_at: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
93
|
-
updated_at: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
94
|
-
application_id: z.ZodNumber;
|
|
95
|
-
type: z.ZodEnum<{
|
|
96
|
-
widget: "widget";
|
|
97
|
-
}>;
|
|
98
|
-
settings: z.ZodObject<{
|
|
99
|
-
widget_enabled: z.ZodBoolean;
|
|
100
|
-
widget_appearance: z.ZodEnum<{
|
|
101
|
-
default: "default";
|
|
102
|
-
hidden: "hidden";
|
|
103
|
-
}>;
|
|
104
|
-
widget_position: z.ZodEnum<{
|
|
105
|
-
bottom_left: "bottom_left";
|
|
106
|
-
bottom_right: "bottom_right";
|
|
107
|
-
top_left: "top_left";
|
|
108
|
-
top_right: "top_right";
|
|
109
|
-
}>;
|
|
110
|
-
widget_header: z.ZodString;
|
|
111
|
-
widget_body: z.ZodString;
|
|
112
|
-
widget_greeting: z.ZodString;
|
|
113
|
-
widget_greeting_toast: z.ZodBoolean;
|
|
114
|
-
widget_recording: z.ZodBoolean;
|
|
115
|
-
widget_feature_tell: z.ZodBoolean;
|
|
116
|
-
widget_feature_show: z.ZodBoolean;
|
|
117
|
-
widget_feature_do: z.ZodBoolean;
|
|
118
|
-
widget_background_color: z.ZodString;
|
|
119
|
-
widget_text_color: z.ZodString;
|
|
120
|
-
widget_border_color: z.ZodString;
|
|
121
|
-
widget_accent_color: z.ZodString;
|
|
122
|
-
widget_secondary_color: z.ZodString;
|
|
123
|
-
widget_border_radius: z.ZodString;
|
|
124
|
-
widget_font_size: z.ZodString;
|
|
125
|
-
widget_width: z.ZodString;
|
|
126
|
-
widget_height: z.ZodString;
|
|
127
|
-
widget_animation_duration: z.ZodString;
|
|
128
|
-
widget_fade_duration: z.ZodString;
|
|
129
|
-
widget_chips: z.ZodArray<z.ZodObject<{
|
|
130
|
-
chip_mode: z.ZodEnum<{
|
|
131
|
-
tell: "tell";
|
|
132
|
-
show: "show";
|
|
133
|
-
do: "do";
|
|
134
|
-
}>;
|
|
135
|
-
chip_text: z.ZodString;
|
|
136
|
-
}, z.core.$strip>>;
|
|
137
|
-
}, z.core.$strip>;
|
|
138
|
-
status: z.ZodEnum<{
|
|
139
|
-
created: "created";
|
|
140
|
-
active: "active";
|
|
141
|
-
suspended: "suspended";
|
|
142
|
-
}>;
|
|
143
|
-
marketrix_id: z.ZodString;
|
|
144
|
-
marketrix_key: z.ZodString;
|
|
145
|
-
snippet: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
146
|
-
}, z.core.$strip>>>;
|
|
147
87
|
}, z.core.$strip>>;
|
|
148
88
|
total: z.ZodNumber;
|
|
149
89
|
limit: z.ZodNumber;
|
|
@@ -165,63 +105,6 @@ export declare const applicationGet: import("@orpc/contract").ContractProcedureB
|
|
|
165
105
|
workspace_id: z.ZodNumber;
|
|
166
106
|
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
167
107
|
allowed_domains: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
168
|
-
widgets: z.ZodArray<z.ZodObject<{
|
|
169
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
170
|
-
created_at: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
171
|
-
updated_at: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
172
|
-
application_id: z.ZodNumber;
|
|
173
|
-
type: z.ZodEnum<{
|
|
174
|
-
widget: "widget";
|
|
175
|
-
}>;
|
|
176
|
-
settings: z.ZodObject<{
|
|
177
|
-
widget_enabled: z.ZodBoolean;
|
|
178
|
-
widget_appearance: z.ZodEnum<{
|
|
179
|
-
default: "default";
|
|
180
|
-
hidden: "hidden";
|
|
181
|
-
}>;
|
|
182
|
-
widget_position: z.ZodEnum<{
|
|
183
|
-
bottom_left: "bottom_left";
|
|
184
|
-
bottom_right: "bottom_right";
|
|
185
|
-
top_left: "top_left";
|
|
186
|
-
top_right: "top_right";
|
|
187
|
-
}>;
|
|
188
|
-
widget_header: z.ZodString;
|
|
189
|
-
widget_body: z.ZodString;
|
|
190
|
-
widget_greeting: z.ZodString;
|
|
191
|
-
widget_greeting_toast: z.ZodBoolean;
|
|
192
|
-
widget_recording: z.ZodBoolean;
|
|
193
|
-
widget_feature_tell: z.ZodBoolean;
|
|
194
|
-
widget_feature_show: z.ZodBoolean;
|
|
195
|
-
widget_feature_do: z.ZodBoolean;
|
|
196
|
-
widget_background_color: z.ZodString;
|
|
197
|
-
widget_text_color: z.ZodString;
|
|
198
|
-
widget_border_color: z.ZodString;
|
|
199
|
-
widget_accent_color: z.ZodString;
|
|
200
|
-
widget_secondary_color: z.ZodString;
|
|
201
|
-
widget_border_radius: z.ZodString;
|
|
202
|
-
widget_font_size: z.ZodString;
|
|
203
|
-
widget_width: z.ZodString;
|
|
204
|
-
widget_height: z.ZodString;
|
|
205
|
-
widget_animation_duration: z.ZodString;
|
|
206
|
-
widget_fade_duration: z.ZodString;
|
|
207
|
-
widget_chips: z.ZodArray<z.ZodObject<{
|
|
208
|
-
chip_mode: z.ZodEnum<{
|
|
209
|
-
tell: "tell";
|
|
210
|
-
show: "show";
|
|
211
|
-
do: "do";
|
|
212
|
-
}>;
|
|
213
|
-
chip_text: z.ZodString;
|
|
214
|
-
}, z.core.$strip>>;
|
|
215
|
-
}, z.core.$strip>;
|
|
216
|
-
status: z.ZodEnum<{
|
|
217
|
-
created: "created";
|
|
218
|
-
active: "active";
|
|
219
|
-
suspended: "suspended";
|
|
220
|
-
}>;
|
|
221
|
-
marketrix_id: z.ZodString;
|
|
222
|
-
marketrix_key: z.ZodString;
|
|
223
|
-
snippet: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
224
|
-
}, z.core.$strip>>;
|
|
225
108
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
226
109
|
export declare const applicationGraphGet: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
227
110
|
application_id: z.ZodCoercedNumber<unknown>;
|
|
@@ -321,9 +204,6 @@ export declare const applicationRoutes: {
|
|
|
321
204
|
app: "app";
|
|
322
205
|
website: "website";
|
|
323
206
|
}>>;
|
|
324
|
-
include: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
325
|
-
widgets: "widgets";
|
|
326
|
-
}>>>;
|
|
327
207
|
limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
328
208
|
offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
329
209
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -341,63 +221,6 @@ export declare const applicationRoutes: {
|
|
|
341
221
|
workspace_id: z.ZodNumber;
|
|
342
222
|
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
343
223
|
allowed_domains: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
344
|
-
widgets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
345
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
346
|
-
created_at: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
347
|
-
updated_at: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
348
|
-
application_id: z.ZodNumber;
|
|
349
|
-
type: z.ZodEnum<{
|
|
350
|
-
widget: "widget";
|
|
351
|
-
}>;
|
|
352
|
-
settings: z.ZodObject<{
|
|
353
|
-
widget_enabled: z.ZodBoolean;
|
|
354
|
-
widget_appearance: z.ZodEnum<{
|
|
355
|
-
default: "default";
|
|
356
|
-
hidden: "hidden";
|
|
357
|
-
}>;
|
|
358
|
-
widget_position: z.ZodEnum<{
|
|
359
|
-
bottom_left: "bottom_left";
|
|
360
|
-
bottom_right: "bottom_right";
|
|
361
|
-
top_left: "top_left";
|
|
362
|
-
top_right: "top_right";
|
|
363
|
-
}>;
|
|
364
|
-
widget_header: z.ZodString;
|
|
365
|
-
widget_body: z.ZodString;
|
|
366
|
-
widget_greeting: z.ZodString;
|
|
367
|
-
widget_greeting_toast: z.ZodBoolean;
|
|
368
|
-
widget_recording: z.ZodBoolean;
|
|
369
|
-
widget_feature_tell: z.ZodBoolean;
|
|
370
|
-
widget_feature_show: z.ZodBoolean;
|
|
371
|
-
widget_feature_do: z.ZodBoolean;
|
|
372
|
-
widget_background_color: z.ZodString;
|
|
373
|
-
widget_text_color: z.ZodString;
|
|
374
|
-
widget_border_color: z.ZodString;
|
|
375
|
-
widget_accent_color: z.ZodString;
|
|
376
|
-
widget_secondary_color: z.ZodString;
|
|
377
|
-
widget_border_radius: z.ZodString;
|
|
378
|
-
widget_font_size: z.ZodString;
|
|
379
|
-
widget_width: z.ZodString;
|
|
380
|
-
widget_height: z.ZodString;
|
|
381
|
-
widget_animation_duration: z.ZodString;
|
|
382
|
-
widget_fade_duration: z.ZodString;
|
|
383
|
-
widget_chips: z.ZodArray<z.ZodObject<{
|
|
384
|
-
chip_mode: z.ZodEnum<{
|
|
385
|
-
tell: "tell";
|
|
386
|
-
show: "show";
|
|
387
|
-
do: "do";
|
|
388
|
-
}>;
|
|
389
|
-
chip_text: z.ZodString;
|
|
390
|
-
}, z.core.$strip>>;
|
|
391
|
-
}, z.core.$strip>;
|
|
392
|
-
status: z.ZodEnum<{
|
|
393
|
-
created: "created";
|
|
394
|
-
active: "active";
|
|
395
|
-
suspended: "suspended";
|
|
396
|
-
}>;
|
|
397
|
-
marketrix_id: z.ZodString;
|
|
398
|
-
marketrix_key: z.ZodString;
|
|
399
|
-
snippet: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
400
|
-
}, z.core.$strip>>>;
|
|
401
224
|
}, z.core.$strip>>;
|
|
402
225
|
total: z.ZodNumber;
|
|
403
226
|
limit: z.ZodNumber;
|
|
@@ -419,63 +242,6 @@ export declare const applicationRoutes: {
|
|
|
419
242
|
workspace_id: z.ZodNumber;
|
|
420
243
|
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
421
244
|
allowed_domains: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
422
|
-
widgets: z.ZodArray<z.ZodObject<{
|
|
423
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
424
|
-
created_at: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
425
|
-
updated_at: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
426
|
-
application_id: z.ZodNumber;
|
|
427
|
-
type: z.ZodEnum<{
|
|
428
|
-
widget: "widget";
|
|
429
|
-
}>;
|
|
430
|
-
settings: z.ZodObject<{
|
|
431
|
-
widget_enabled: z.ZodBoolean;
|
|
432
|
-
widget_appearance: z.ZodEnum<{
|
|
433
|
-
default: "default";
|
|
434
|
-
hidden: "hidden";
|
|
435
|
-
}>;
|
|
436
|
-
widget_position: z.ZodEnum<{
|
|
437
|
-
bottom_left: "bottom_left";
|
|
438
|
-
bottom_right: "bottom_right";
|
|
439
|
-
top_left: "top_left";
|
|
440
|
-
top_right: "top_right";
|
|
441
|
-
}>;
|
|
442
|
-
widget_header: z.ZodString;
|
|
443
|
-
widget_body: z.ZodString;
|
|
444
|
-
widget_greeting: z.ZodString;
|
|
445
|
-
widget_greeting_toast: z.ZodBoolean;
|
|
446
|
-
widget_recording: z.ZodBoolean;
|
|
447
|
-
widget_feature_tell: z.ZodBoolean;
|
|
448
|
-
widget_feature_show: z.ZodBoolean;
|
|
449
|
-
widget_feature_do: z.ZodBoolean;
|
|
450
|
-
widget_background_color: z.ZodString;
|
|
451
|
-
widget_text_color: z.ZodString;
|
|
452
|
-
widget_border_color: z.ZodString;
|
|
453
|
-
widget_accent_color: z.ZodString;
|
|
454
|
-
widget_secondary_color: z.ZodString;
|
|
455
|
-
widget_border_radius: z.ZodString;
|
|
456
|
-
widget_font_size: z.ZodString;
|
|
457
|
-
widget_width: z.ZodString;
|
|
458
|
-
widget_height: z.ZodString;
|
|
459
|
-
widget_animation_duration: z.ZodString;
|
|
460
|
-
widget_fade_duration: z.ZodString;
|
|
461
|
-
widget_chips: z.ZodArray<z.ZodObject<{
|
|
462
|
-
chip_mode: z.ZodEnum<{
|
|
463
|
-
tell: "tell";
|
|
464
|
-
show: "show";
|
|
465
|
-
do: "do";
|
|
466
|
-
}>;
|
|
467
|
-
chip_text: z.ZodString;
|
|
468
|
-
}, z.core.$strip>>;
|
|
469
|
-
}, z.core.$strip>;
|
|
470
|
-
status: z.ZodEnum<{
|
|
471
|
-
created: "created";
|
|
472
|
-
active: "active";
|
|
473
|
-
suspended: "suspended";
|
|
474
|
-
}>;
|
|
475
|
-
marketrix_id: z.ZodString;
|
|
476
|
-
marketrix_key: z.ZodString;
|
|
477
|
-
snippet: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
478
|
-
}, z.core.$strip>>;
|
|
479
245
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
480
246
|
applicationGraphGet: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
481
247
|
application_id: z.ZodCoercedNumber<unknown>;
|
|
@@ -1,77 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const ApplicationWithWidgetsSchema: z.ZodObject<{
|
|
3
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
4
|
-
created_at: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
5
|
-
updated_at: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
6
|
-
slug: z.ZodString;
|
|
7
|
-
type: z.ZodEnum<{
|
|
8
|
-
app: "app";
|
|
9
|
-
website: "website";
|
|
10
|
-
}>;
|
|
11
|
-
name: z.ZodString;
|
|
12
|
-
url: z.ZodString;
|
|
13
|
-
workspace_id: z.ZodNumber;
|
|
14
|
-
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
15
|
-
allowed_domains: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
16
|
-
widgets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
17
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
18
|
-
created_at: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
19
|
-
updated_at: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
20
|
-
application_id: z.ZodNumber;
|
|
21
|
-
type: z.ZodEnum<{
|
|
22
|
-
widget: "widget";
|
|
23
|
-
}>;
|
|
24
|
-
settings: z.ZodObject<{
|
|
25
|
-
widget_enabled: z.ZodBoolean;
|
|
26
|
-
widget_appearance: z.ZodEnum<{
|
|
27
|
-
default: "default";
|
|
28
|
-
hidden: "hidden";
|
|
29
|
-
}>;
|
|
30
|
-
widget_position: z.ZodEnum<{
|
|
31
|
-
bottom_left: "bottom_left";
|
|
32
|
-
bottom_right: "bottom_right";
|
|
33
|
-
top_left: "top_left";
|
|
34
|
-
top_right: "top_right";
|
|
35
|
-
}>;
|
|
36
|
-
widget_header: z.ZodString;
|
|
37
|
-
widget_body: z.ZodString;
|
|
38
|
-
widget_greeting: z.ZodString;
|
|
39
|
-
widget_greeting_toast: z.ZodBoolean;
|
|
40
|
-
widget_recording: z.ZodBoolean;
|
|
41
|
-
widget_feature_tell: z.ZodBoolean;
|
|
42
|
-
widget_feature_show: z.ZodBoolean;
|
|
43
|
-
widget_feature_do: z.ZodBoolean;
|
|
44
|
-
widget_background_color: z.ZodString;
|
|
45
|
-
widget_text_color: z.ZodString;
|
|
46
|
-
widget_border_color: z.ZodString;
|
|
47
|
-
widget_accent_color: z.ZodString;
|
|
48
|
-
widget_secondary_color: z.ZodString;
|
|
49
|
-
widget_border_radius: z.ZodString;
|
|
50
|
-
widget_font_size: z.ZodString;
|
|
51
|
-
widget_width: z.ZodString;
|
|
52
|
-
widget_height: z.ZodString;
|
|
53
|
-
widget_animation_duration: z.ZodString;
|
|
54
|
-
widget_fade_duration: z.ZodString;
|
|
55
|
-
widget_chips: z.ZodArray<z.ZodObject<{
|
|
56
|
-
chip_mode: z.ZodEnum<{
|
|
57
|
-
tell: "tell";
|
|
58
|
-
show: "show";
|
|
59
|
-
do: "do";
|
|
60
|
-
}>;
|
|
61
|
-
chip_text: z.ZodString;
|
|
62
|
-
}, z.core.$strip>>;
|
|
63
|
-
}, z.core.$strip>;
|
|
64
|
-
status: z.ZodEnum<{
|
|
65
|
-
created: "created";
|
|
66
|
-
active: "active";
|
|
67
|
-
suspended: "suspended";
|
|
68
|
-
}>;
|
|
69
|
-
marketrix_id: z.ZodString;
|
|
70
|
-
marketrix_key: z.ZodString;
|
|
71
|
-
snippet: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
72
|
-
}, z.core.$strip>>>;
|
|
73
|
-
}, z.core.$strip>;
|
|
74
|
-
export type ApplicationWithWidgetsData = z.infer<typeof ApplicationWithWidgetsSchema>;
|
|
75
2
|
export declare const WidgetCreateSchema: z.ZodObject<{
|
|
76
3
|
id: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
77
4
|
created_at: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
package/dist/src/sdk/index.d.ts
CHANGED
|
@@ -145,63 +145,6 @@ export declare const sdk: {
|
|
|
145
145
|
workspace_id: import("zod").ZodNumber;
|
|
146
146
|
username: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
147
147
|
allowed_domains: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
148
|
-
widgets: import("zod").ZodArray<import("zod").ZodObject<{
|
|
149
|
-
id: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
150
|
-
created_at: import("zod").ZodOptional<import("zod").ZodCoercedDate<unknown>>;
|
|
151
|
-
updated_at: import("zod").ZodOptional<import("zod").ZodCoercedDate<unknown>>;
|
|
152
|
-
application_id: import("zod").ZodNumber;
|
|
153
|
-
type: import("zod").ZodEnum<{
|
|
154
|
-
widget: "widget";
|
|
155
|
-
}>;
|
|
156
|
-
settings: import("zod").ZodObject<{
|
|
157
|
-
widget_enabled: import("zod").ZodBoolean;
|
|
158
|
-
widget_appearance: import("zod").ZodEnum<{
|
|
159
|
-
default: "default";
|
|
160
|
-
hidden: "hidden";
|
|
161
|
-
}>;
|
|
162
|
-
widget_position: import("zod").ZodEnum<{
|
|
163
|
-
bottom_left: "bottom_left";
|
|
164
|
-
bottom_right: "bottom_right";
|
|
165
|
-
top_left: "top_left";
|
|
166
|
-
top_right: "top_right";
|
|
167
|
-
}>;
|
|
168
|
-
widget_header: import("zod").ZodString;
|
|
169
|
-
widget_body: import("zod").ZodString;
|
|
170
|
-
widget_greeting: import("zod").ZodString;
|
|
171
|
-
widget_greeting_toast: import("zod").ZodBoolean;
|
|
172
|
-
widget_recording: import("zod").ZodBoolean;
|
|
173
|
-
widget_feature_tell: import("zod").ZodBoolean;
|
|
174
|
-
widget_feature_show: import("zod").ZodBoolean;
|
|
175
|
-
widget_feature_do: import("zod").ZodBoolean;
|
|
176
|
-
widget_background_color: import("zod").ZodString;
|
|
177
|
-
widget_text_color: import("zod").ZodString;
|
|
178
|
-
widget_border_color: import("zod").ZodString;
|
|
179
|
-
widget_accent_color: import("zod").ZodString;
|
|
180
|
-
widget_secondary_color: import("zod").ZodString;
|
|
181
|
-
widget_border_radius: import("zod").ZodString;
|
|
182
|
-
widget_font_size: import("zod").ZodString;
|
|
183
|
-
widget_width: import("zod").ZodString;
|
|
184
|
-
widget_height: import("zod").ZodString;
|
|
185
|
-
widget_animation_duration: import("zod").ZodString;
|
|
186
|
-
widget_fade_duration: import("zod").ZodString;
|
|
187
|
-
widget_chips: import("zod").ZodArray<import("zod").ZodObject<{
|
|
188
|
-
chip_mode: import("zod").ZodEnum<{
|
|
189
|
-
tell: "tell";
|
|
190
|
-
show: "show";
|
|
191
|
-
do: "do";
|
|
192
|
-
}>;
|
|
193
|
-
chip_text: import("zod").ZodString;
|
|
194
|
-
}, import("zod/v4/core").$strip>>;
|
|
195
|
-
}, import("zod/v4/core").$strip>;
|
|
196
|
-
status: import("zod").ZodEnum<{
|
|
197
|
-
created: "created";
|
|
198
|
-
active: "active";
|
|
199
|
-
suspended: "suspended";
|
|
200
|
-
}>;
|
|
201
|
-
marketrix_id: import("zod").ZodString;
|
|
202
|
-
marketrix_key: import("zod").ZodString;
|
|
203
|
-
snippet: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
204
|
-
}, import("zod/v4/core").$strip>>;
|
|
205
148
|
}, import("zod/v4/core").$strip>, Record<never, never>>;
|
|
206
149
|
chatCreate: import("@orpc/contract").ContractProcedureClient<Record<never, never>, import("@orpc/contract").Schema<unknown, unknown>, import("zod").ZodString, Record<never, never>>;
|
|
207
150
|
widgetDefaultGet: import("@orpc/contract").ContractProcedureClient<Record<never, never>, import("zod").ZodObject<{
|
package/dist/widget.mjs
CHANGED
|
@@ -62,4 +62,4 @@ return v(oc,{ref:m,position:s?"absolute":"fixed",rounded:"lg",border:!0,overflow
|
|
|
62
62
|
return b(xl,{value:g,children:/* @__PURE__ */b(nc,{ref:o,"data-marketrix-widget":!0,position:"relative",style:{...w,...c&&{width:"100%",height:"100%"}},children:/* @__PURE__ */b(ul,{value:r,children:/* @__PURE__ */v(fc,{container:r,offsetBottom:"top"===Il(u).vertical?20:90,children:[y&&/* @__PURE__ */b(nc,{"data-screen-edge-glow":!0,position:"fixed",inset:"0",style:{boxShadow:`inset 0 0 22px 2px ${bl(g.widget_accent_color,.72)}, inset 0 0 46px 10px ${bl(g.widget_accent_color,.28)}`,pointerEvents:"none",zIndex:2147483001}}),
|
|
63
63
|
/* @__PURE__ */b(Ol,{label:"Widget",children:/* @__PURE__ */b(sd,{})}),
|
|
64
64
|
/* @__PURE__ */b(_l,{onPositionCommit:e=>{d(e),c||De(p,e)}}),
|
|
65
|
-
/* @__PURE__ */b(mc,{error:i.error,onClearError:()=>s.setError(void 0),...hr.canReconnect()&&{onRetry:()=>{s.setError(void 0),hr.reconnectNow()}},greeting:t&&!i.error?e.widget_greeting:void 0,greetingBody:e.widget_body,onGreetingDismiss:()=>n(!1)})]})})})})},cd={mount:null},ld=null,ud=(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}},dd=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}=ud(n,"marketrix-widget-root");return Object.assign(o.style,{pointerEvents:"auto",width:"100%",height:"100%",position:"relative"}),{container:n,shadowRoot:r,mountEl:o}},hd=(e,n,r=!1)=>{const o=m(e);return o.render(/* @__PURE__ */b(t.StrictMode,{children:/* @__PURE__ */b(pl,{previewMode:r,children:/* @__PURE__ */b(ad,{config:n})})})),o},pd=()=>null!==cd.mount,fd=()=>cd.mount?.config??null,md=(e,n="neutral")=>{if("undefined"==typeof window||"undefined"==typeof document)return;gd();const r=document.createElement("div");r.id="marketrix-widget-notice-container",r.className="marketrix-widget-notice-container",document.body.appendChild(r);const{mountEl:o}=ud(r,"marketrix-widget-notice-root");(ld=m(o)).render(/* @__PURE__ */b(t.StrictMode,{children:/* @__PURE__ */b(fc,{container:o,children:/* @__PURE__ */b(mc,{error:"error"===n?e:void 0,onClearError:gd,greeting:"error"===n?void 0:e,onGreetingDismiss:gd})})}))},gd=()=>{ld?.unmount(),ld=null,document.getElementById("marketrix-widget-notice-container")?.remove()},yd=null,bd=0,vd=null;function wd(e,t={}){const n=kr(e);return n.invalidFields?(console.error(`Marketrix Widget: ${Cr(n.invalidFields)}`),null):{...Er(n.settings,t),isPreviewMode:!0}}function xd(e,t,n=!1){const{container:r,mountEl:o}=dd(t),i=hd(o,e,n);cd.mount={instance:i,config:e,container:r,host:t,previewMode:n}}var Sd=(e,t)=>{if(yd)return yd;if(window.__mtx?.state)return Promise.resolve();if(pd())return console.warn("Marketrix Widget: already initialized"),Promise.resolve();const n=async function(e,t,n){let r;window.__mtx={state:"initializing"},md("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(a){const t=cr(a);throw lr(["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}`,a)}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");try{await Te.applicationGet({application_id:o.application_id})}catch(a){throw lr(`Failed to validate application: ${cr(a)}`,a)}let i;try{i=await Te.widgetDefaultGet({type:"widget"})}catch(a){throw lr(`Failed to fetch widget settings from API: ${cr(a)}`,a)}const s=kr({...i,...o.settings});if(s.invalidFields)throw new Error(Cr(s.invalidFields));return{...Er(s.settings,e),mtxId:t,mtxKey:n,mtxApp:o.application_id}}(e)}catch(o){if(n!==bd)return;return console.error("Marketrix Widget initialization failed:",o),md(cr(o,"Failed to initialize widget"),"error"),void(window.__mtx=void 0)}n===bd&&(gd(),r.widget_enabled?(Le.setConfig(r),xd(r,t),window.__mtx={state:"active"},r.widget_recording&&r.mtxApp&&(async()=>{try{const e=await Fe.getOrCreateChatId();if(n!==bd)return;const t=new pr(e,r.mtxApp);vd=t,await t.start(),n!==bd&&(t.stop(),vd===t&&(vd=null))}catch(o){n===bd&&console.error("Failed to start session recording:",o)}})()):window.__mtx=void 0)}(e,t,++bd);return yd=n,n.then(()=>{yd===n&&(yd=null)},()=>{yd===n&&(yd=null)}),n},kd=()=>{bd++,hr.disconnect(),vd?.stop(),vd=null,gr();const e=cd.mount;cd.mount=null,e&&(e.instance.unmount(),e.container.remove()),yd=null,window.__mtx=void 0,gd()},Cd=async e=>{const t=cd.mount;if(!t)return;const{config:n,host:r,previewMode:o}=t,i={...n,...e};kd(),o?xd(i,r,!0):await Sd(i,r)},Ed=({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=wd(e);if(!a)return;const{container:c,mountEl:l}=dd(i);return o.current=c,r.current=hd(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"}})},Id=async e=>{const t=e.container;if(void 0!==e.settings){const{settings:n,container:r,...o}=e,i=wd(e.settings,o);if(!i)return;kd(),xd(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 Sd(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(pd())return;return console.error("[AutoInit] Missing required attributes:",{hasMtxId:!!o,hasMtxKey:!!i,hasMtxApiHost:!!s}),void md("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))})(Sd)}catch(e){console.error("Marketrix Widget: Auto-init registration failed",e)}},0);var Md={MarketrixWidgetPreview:Ed,mountWidget:Id,initWidget:Sd,unmountWidget:kd,updateMarketrixConfig:Cd,getCurrentConfig:fd};export{Ed as MarketrixWidgetPreview,Md as default,fd as getCurrentConfig,Sd as initWidget,Id as mountWidget,kd as unmountWidget,Cd as updateMarketrixConfig};
|
|
65
|
+
/* @__PURE__ */b(mc,{error:i.error,onClearError:()=>s.setError(void 0),...hr.canReconnect()&&{onRetry:()=>{s.setError(void 0),hr.reconnectNow()}},greeting:t&&!i.error?e.widget_greeting:void 0,greetingBody:e.widget_body,onGreetingDismiss:()=>n(!1)})]})})})})},cd={mount:null},ld=null,ud=(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}},dd=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}=ud(n,"marketrix-widget-root");return Object.assign(o.style,{pointerEvents:"auto",width:"100%",height:"100%",position:"relative"}),{container:n,shadowRoot:r,mountEl:o}},hd=(e,n,r=!1)=>{const o=m(e);return o.render(/* @__PURE__ */b(t.StrictMode,{children:/* @__PURE__ */b(pl,{previewMode:r,children:/* @__PURE__ */b(ad,{config:n})})})),o},pd=()=>null!==cd.mount,fd=()=>cd.mount?.config??null,md=(e,n="neutral")=>{if("undefined"==typeof window||"undefined"==typeof document)return;gd();const r=document.createElement("div");r.id="marketrix-widget-notice-container",r.className="marketrix-widget-notice-container",document.body.appendChild(r);const{mountEl:o}=ud(r,"marketrix-widget-notice-root");(ld=m(o)).render(/* @__PURE__ */b(t.StrictMode,{children:/* @__PURE__ */b(fc,{container:o,children:/* @__PURE__ */b(mc,{error:"error"===n?e:void 0,onClearError:gd,greeting:"error"===n?void 0:e,onGreetingDismiss:gd})})}))},gd=()=>{ld?.unmount(),ld=null,document.getElementById("marketrix-widget-notice-container")?.remove()},yd=null,bd=0,vd=null;function wd(e,t={}){const n=kr(e);return n.invalidFields?(console.error(`Marketrix Widget: ${Cr(n.invalidFields)}`),null):{...Er(n.settings,t),isPreviewMode:!0}}function xd(e,t,n=!1){const{container:r,mountEl:o}=dd(t),i=hd(o,e,n);cd.mount={instance:i,config:e,container:r,host:t,previewMode:n}}var Sd=(e,t)=>{if(yd)return yd;if(window.__mtx?.state)return Promise.resolve();if(pd())return console.warn("Marketrix Widget: already initialized"),Promise.resolve();const n=async function(e,t,n){let r;window.__mtx={state:"initializing"},md("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");const r=Te.widgetDefaultGet({type:"widget"});let o;r.catch(()=>{});try{({items:o}=await Te.widgetSearch({marketrix_id:t,marketrix_key:n}))}catch(c){const t=cr(c);throw lr(["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}`,c)}if(!o.length)throw new Error("Widget not found or invalid credentials");const i=o.find(e=>"active"===e.status);if(!i){const e=o.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(!i.application_id)throw new Error("Widget missing application_id");let s;try{s=await r}catch(c){throw lr(`Failed to fetch widget settings from API: ${cr(c)}`,c)}const a=kr({...s,...i.settings});if(a.invalidFields)throw new Error(Cr(a.invalidFields));return{...Er(a.settings,e),mtxId:t,mtxKey:n,mtxApp:i.application_id}}(e)}catch(o){if(n!==bd)return;return console.error("Marketrix Widget initialization failed:",o),md(cr(o,"Failed to initialize widget"),"error"),void(window.__mtx=void 0)}n===bd&&(gd(),r.widget_enabled?(Le.setConfig(r),xd(r,t),window.__mtx={state:"active"},r.widget_recording&&r.mtxApp&&(async()=>{try{const e=await Fe.getOrCreateChatId();if(n!==bd)return;const t=new pr(e,r.mtxApp);vd=t,await t.start(),n!==bd&&(t.stop(),vd===t&&(vd=null))}catch(o){n===bd&&console.error("Failed to start session recording:",o)}})()):window.__mtx=void 0)}(e,t,++bd);return yd=n,n.then(()=>{yd===n&&(yd=null)},()=>{yd===n&&(yd=null)}),n},kd=()=>{bd++,hr.disconnect(),vd?.stop(),vd=null,gr();const e=cd.mount;cd.mount=null,e&&(e.instance.unmount(),e.container.remove()),yd=null,window.__mtx=void 0,gd()},Cd=async e=>{const t=cd.mount;if(!t)return;const{config:n,host:r,previewMode:o}=t,i={...n,...e};kd(),o?xd(i,r,!0):await Sd(i,r)},Ed=({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=wd(e);if(!a)return;const{container:c,mountEl:l}=dd(i);return o.current=c,r.current=hd(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"}})},Id=async e=>{const t=e.container;if(void 0!==e.settings){const{settings:n,container:r,...o}=e,i=wd(e.settings,o);if(!i)return;kd(),xd(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 Sd(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(pd())return;return console.error("[AutoInit] Missing required attributes:",{hasMtxId:!!o,hasMtxKey:!!i,hasMtxApiHost:!!s}),void md("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))})(Sd)}catch(e){console.error("Marketrix Widget: Auto-init registration failed",e)}},0);var Md={MarketrixWidgetPreview:Ed,mountWidget:Id,initWidget:Sd,unmountWidget:kd,updateMarketrixConfig:Cd,getCurrentConfig:fd};export{Ed as MarketrixWidgetPreview,Md as default,fd as getCurrentConfig,Sd as initWidget,Id as mountWidget,kd as unmountWidget,Cd as updateMarketrixConfig};
|