@uniformdev/mesh-sdk 19.35.2 → 19.36.0

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.
@@ -0,0 +1,993 @@
1
+ import { ApiClient, ClientOptions, ExceptProject } from '@uniformdev/context/api';
2
+ import { DataSource, RootComponentInstance, ComponentInstance, ComponentDefinition, ComponentDefinitionParameter, DataType as DataType$1, DataResourceVariables } from '@uniformdev/canvas';
3
+ import { ProjectMapNode } from '@uniformdev/project-map';
4
+ import { DataType } from '@uniformdev/canvas/.';
5
+ import { Emitter } from 'mitt';
6
+
7
+ /**
8
+ * This file was auto-generated by openapi-typescript.
9
+ * Do not make direct changes to the file.
10
+ */
11
+ interface paths$1 {
12
+ "/api/v1/integration-definitions": {
13
+ /** Gets a list of Mesh apps that are available for a Uniform team */
14
+ get: {
15
+ parameters: {
16
+ query: {
17
+ teamId: string;
18
+ includePublic?: boolean | null;
19
+ teamSpecificType?: boolean | null;
20
+ };
21
+ };
22
+ responses: {
23
+ /** 200 response */
24
+ 200: {
25
+ content: {
26
+ "application/json": {
27
+ results: {
28
+ type: string;
29
+ displayName: string;
30
+ logoIconUrl?: string;
31
+ badgeIconUrl?: string;
32
+ /** @enum {string} */
33
+ category?: "analytics" | "cdn" | "classic" | "commerce" | "content" | "comingSoon" | "data" | "deprecated" | "email" | "framework" | "search" | "starters" | "uniform" | "unknown";
34
+ public?: boolean;
35
+ baseLocationUrl?: string;
36
+ locations: {
37
+ install?: {
38
+ description?: string[];
39
+ informationUrl?: string;
40
+ canvasPackageUrl?: string;
41
+ };
42
+ settings?: {
43
+ url: string;
44
+ locations?: {
45
+ [key: string]: {
46
+ url: string;
47
+ };
48
+ };
49
+ };
50
+ canvas?: {
51
+ parameterTypes: {
52
+ type: string;
53
+ displayName: string;
54
+ configureUrl?: string;
55
+ editorUrl: string;
56
+ configurationLocations?: {
57
+ [key: string]: {
58
+ url: string;
59
+ };
60
+ };
61
+ editorLocations?: {
62
+ [key: string]: {
63
+ url: string;
64
+ };
65
+ };
66
+ renderableInPropertyPanel?: boolean;
67
+ }[];
68
+ };
69
+ dataConnectors?: {
70
+ type: string;
71
+ displayName: string;
72
+ dataSourceEditorUrl?: string;
73
+ dataSourceEditorLocations?: {
74
+ [key: string]: {
75
+ url: string;
76
+ };
77
+ };
78
+ dataArchetypes?: {
79
+ [key: string]: {
80
+ displayName: string;
81
+ typeEditorUrl?: string;
82
+ typeEditorLocations?: {
83
+ [key: string]: {
84
+ url: string;
85
+ };
86
+ };
87
+ dataEditorUrl?: string;
88
+ dataEditorUrlLocations?: {
89
+ [key: string]: {
90
+ url: string;
91
+ };
92
+ };
93
+ };
94
+ };
95
+ badgeIconUrl?: string;
96
+ }[];
97
+ };
98
+ }[];
99
+ };
100
+ };
101
+ };
102
+ 400: external$1["swagger.yml"]["components"]["responses"]["BadRequestError"];
103
+ 401: external$1["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
104
+ 403: external$1["swagger.yml"]["components"]["responses"]["ForbiddenError"];
105
+ 429: external$1["swagger.yml"]["components"]["responses"]["RateLimitError"];
106
+ 500: external$1["swagger.yml"]["components"]["responses"]["InternalServerError"];
107
+ };
108
+ };
109
+ /** Creates or updates a Mesh app definition on a team */
110
+ put: {
111
+ responses: {
112
+ /** Update success */
113
+ 200: {
114
+ content: {
115
+ "application/json": {
116
+ type: string;
117
+ displayName: string;
118
+ logoIconUrl?: string;
119
+ badgeIconUrl?: string;
120
+ /** @enum {string} */
121
+ category?: "analytics" | "cdn" | "classic" | "commerce" | "content" | "comingSoon" | "data" | "deprecated" | "email" | "framework" | "search" | "starters" | "uniform" | "unknown";
122
+ public?: boolean;
123
+ baseLocationUrl?: string;
124
+ locations: {
125
+ install?: {
126
+ description?: string[];
127
+ informationUrl?: string;
128
+ canvasPackageUrl?: string;
129
+ };
130
+ settings?: {
131
+ url: string;
132
+ locations?: {
133
+ [key: string]: {
134
+ url: string;
135
+ };
136
+ };
137
+ };
138
+ canvas?: {
139
+ parameterTypes: {
140
+ type: string;
141
+ displayName: string;
142
+ configureUrl?: string;
143
+ editorUrl: string;
144
+ configurationLocations?: {
145
+ [key: string]: {
146
+ url: string;
147
+ };
148
+ };
149
+ editorLocations?: {
150
+ [key: string]: {
151
+ url: string;
152
+ };
153
+ };
154
+ renderableInPropertyPanel?: boolean;
155
+ }[];
156
+ };
157
+ dataConnectors?: {
158
+ type: string;
159
+ displayName: string;
160
+ dataSourceEditorUrl?: string;
161
+ dataSourceEditorLocations?: {
162
+ [key: string]: {
163
+ url: string;
164
+ };
165
+ };
166
+ dataArchetypes?: {
167
+ [key: string]: {
168
+ displayName: string;
169
+ typeEditorUrl?: string;
170
+ typeEditorLocations?: {
171
+ [key: string]: {
172
+ url: string;
173
+ };
174
+ };
175
+ dataEditorUrl?: string;
176
+ dataEditorUrlLocations?: {
177
+ [key: string]: {
178
+ url: string;
179
+ };
180
+ };
181
+ };
182
+ };
183
+ badgeIconUrl?: string;
184
+ }[];
185
+ };
186
+ };
187
+ };
188
+ };
189
+ 400: external$1["swagger.yml"]["components"]["responses"]["BadRequestError"];
190
+ 401: external$1["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
191
+ 403: external$1["swagger.yml"]["components"]["responses"]["ForbiddenError"];
192
+ 429: external$1["swagger.yml"]["components"]["responses"]["RateLimitError"];
193
+ 500: external$1["swagger.yml"]["components"]["responses"]["InternalServerError"];
194
+ };
195
+ requestBody: {
196
+ content: {
197
+ "application/json": {
198
+ /**
199
+ * Format: uuid
200
+ * @description The team ID
201
+ */
202
+ teamId: string;
203
+ data: {
204
+ type: string;
205
+ displayName: string;
206
+ logoIconUrl?: string;
207
+ badgeIconUrl?: string;
208
+ /** @enum {string} */
209
+ category?: "analytics" | "cdn" | "classic" | "commerce" | "content" | "comingSoon" | "data" | "deprecated" | "email" | "framework" | "search" | "starters" | "uniform" | "unknown";
210
+ baseLocationUrl?: string;
211
+ locations: {
212
+ install?: {
213
+ description?: string[];
214
+ informationUrl?: string;
215
+ canvasPackageUrl?: string;
216
+ };
217
+ settings?: {
218
+ url: string;
219
+ locations?: {
220
+ [key: string]: {
221
+ url: string;
222
+ };
223
+ };
224
+ };
225
+ canvas?: {
226
+ parameterTypes: {
227
+ type: string;
228
+ displayName: string;
229
+ configureUrl?: string;
230
+ editorUrl: string;
231
+ configurationLocations?: {
232
+ [key: string]: {
233
+ url: string;
234
+ };
235
+ };
236
+ editorLocations?: {
237
+ [key: string]: {
238
+ url: string;
239
+ };
240
+ };
241
+ renderableInPropertyPanel?: boolean;
242
+ }[];
243
+ };
244
+ dataConnectors?: {
245
+ type: string;
246
+ displayName: string;
247
+ dataSourceEditorUrl?: string;
248
+ dataSourceEditorLocations?: {
249
+ [key: string]: {
250
+ url: string;
251
+ };
252
+ };
253
+ dataArchetypes?: {
254
+ [key: string]: {
255
+ displayName: string;
256
+ typeEditorUrl?: string;
257
+ typeEditorLocations?: {
258
+ [key: string]: {
259
+ url: string;
260
+ };
261
+ };
262
+ dataEditorUrl?: string;
263
+ dataEditorUrlLocations?: {
264
+ [key: string]: {
265
+ url: string;
266
+ };
267
+ };
268
+ };
269
+ };
270
+ badgeIconUrl?: string;
271
+ }[];
272
+ };
273
+ };
274
+ };
275
+ };
276
+ };
277
+ };
278
+ /** Removes a Mesh app definition from a team. Note that public integrations may not be deleted without contacting Uniform. */
279
+ delete: {
280
+ responses: {
281
+ /** Delete successful */
282
+ 204: never;
283
+ 400: external$1["swagger.yml"]["components"]["responses"]["BadRequestError"];
284
+ 401: external$1["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
285
+ 403: external$1["swagger.yml"]["components"]["responses"]["ForbiddenError"];
286
+ /** Integration to delete was not found */
287
+ 404: unknown;
288
+ 429: external$1["swagger.yml"]["components"]["responses"]["RateLimitError"];
289
+ 500: external$1["swagger.yml"]["components"]["responses"]["InternalServerError"];
290
+ };
291
+ requestBody: {
292
+ content: {
293
+ "application/json": {
294
+ /**
295
+ * Format: uuid
296
+ * @description The team ID
297
+ */
298
+ teamId: string;
299
+ /** @description The integration type to remove */
300
+ type: string;
301
+ };
302
+ };
303
+ };
304
+ };
305
+ /** Handles preflight requests. This endpoint allows CORS. */
306
+ options: {
307
+ responses: {
308
+ /** ok */
309
+ 204: never;
310
+ };
311
+ };
312
+ };
313
+ }
314
+ interface external$1 {
315
+ "swagger.yml": {
316
+ paths: {};
317
+ components: {
318
+ schemas: {
319
+ Error: {
320
+ /** @description Error message(s) that occurred while processing the request */
321
+ errorMessage?: string[] | string;
322
+ };
323
+ };
324
+ responses: {
325
+ /** Request input validation failed */
326
+ BadRequestError: {
327
+ content: {
328
+ "application/json": external$1["swagger.yml"]["components"]["schemas"]["Error"];
329
+ };
330
+ };
331
+ /** API key or token was not valid */
332
+ UnauthorizedError: {
333
+ content: {
334
+ "application/json": external$1["swagger.yml"]["components"]["schemas"]["Error"];
335
+ };
336
+ };
337
+ /** Permission was denied */
338
+ ForbiddenError: {
339
+ content: {
340
+ "application/json": external$1["swagger.yml"]["components"]["schemas"]["Error"];
341
+ };
342
+ };
343
+ /** Resource not found */
344
+ NotFoundError: {
345
+ content: {
346
+ "application/json": external$1["swagger.yml"]["components"]["schemas"]["Error"];
347
+ };
348
+ };
349
+ /** Too many requests in allowed time period */
350
+ RateLimitError: unknown;
351
+ /** Execution error occurred */
352
+ InternalServerError: unknown;
353
+ };
354
+ };
355
+ operations: {};
356
+ };
357
+ }
358
+
359
+ /**
360
+ * This file was auto-generated by openapi-typescript.
361
+ * Do not make direct changes to the file.
362
+ */
363
+ interface paths {
364
+ "/api/v1/integration-installations": {
365
+ /** Gets a list of installed integrations for a Uniform Project */
366
+ get: {
367
+ parameters: {
368
+ query: {
369
+ projectId: string;
370
+ type?: string;
371
+ exactType?: boolean | null;
372
+ teamSpecificType?: boolean | null;
373
+ };
374
+ };
375
+ responses: {
376
+ /** 200 response */
377
+ 200: {
378
+ content: {
379
+ "application/json": {
380
+ results: {
381
+ type: string;
382
+ data?: {
383
+ [key: string]: unknown;
384
+ };
385
+ }[];
386
+ };
387
+ };
388
+ };
389
+ 400: external["swagger.yml"]["components"]["responses"]["BadRequestError"];
390
+ 401: external["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
391
+ 403: external["swagger.yml"]["components"]["responses"]["ForbiddenError"];
392
+ 429: external["swagger.yml"]["components"]["responses"]["RateLimitError"];
393
+ 500: external["swagger.yml"]["components"]["responses"]["InternalServerError"];
394
+ };
395
+ };
396
+ /** Installs or updates an integration on a Uniform Project. If data is not provided, it will remain unmodified from any existing value. */
397
+ put: {
398
+ responses: {
399
+ /** Install or update success */
400
+ 204: never;
401
+ 400: external["swagger.yml"]["components"]["responses"]["BadRequestError"];
402
+ 401: external["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
403
+ 403: external["swagger.yml"]["components"]["responses"]["ForbiddenError"];
404
+ 429: external["swagger.yml"]["components"]["responses"]["RateLimitError"];
405
+ 500: external["swagger.yml"]["components"]["responses"]["InternalServerError"];
406
+ };
407
+ requestBody: {
408
+ content: {
409
+ "application/json": {
410
+ /**
411
+ * Format: uuid
412
+ * @description The project ID
413
+ */
414
+ projectId: string;
415
+ /** @description Whether to match the passed type exactly or to treat the type as a prefix */
416
+ exactType?: boolean | null;
417
+ type: string;
418
+ data?: {
419
+ [key: string]: unknown;
420
+ };
421
+ };
422
+ };
423
+ };
424
+ };
425
+ /** Removes an integration from a project. */
426
+ delete: {
427
+ responses: {
428
+ /** Delete successful */
429
+ 204: never;
430
+ 400: external["swagger.yml"]["components"]["responses"]["BadRequestError"];
431
+ 401: external["swagger.yml"]["components"]["responses"]["UnauthorizedError"];
432
+ 403: external["swagger.yml"]["components"]["responses"]["ForbiddenError"];
433
+ /** Integration to delete was not found */
434
+ 404: unknown;
435
+ 429: external["swagger.yml"]["components"]["responses"]["RateLimitError"];
436
+ 500: external["swagger.yml"]["components"]["responses"]["InternalServerError"];
437
+ };
438
+ requestBody: {
439
+ content: {
440
+ "application/json": {
441
+ /**
442
+ * Format: uuid
443
+ * @description The project ID
444
+ */
445
+ projectId: string;
446
+ /** @description The integration type to remove */
447
+ type: string;
448
+ /** @description Whether to match the passed type exactly or to treat the type as a prefix */
449
+ exactType?: boolean | null;
450
+ };
451
+ };
452
+ };
453
+ };
454
+ /** Handles preflight requests. This endpoint allows CORS. */
455
+ options: {
456
+ responses: {
457
+ /** ok */
458
+ 204: never;
459
+ };
460
+ };
461
+ };
462
+ }
463
+ interface external {
464
+ "swagger.yml": {
465
+ paths: {};
466
+ components: {
467
+ schemas: {
468
+ Error: {
469
+ /** @description Error message(s) that occurred while processing the request */
470
+ errorMessage?: string[] | string;
471
+ };
472
+ };
473
+ responses: {
474
+ /** Request input validation failed */
475
+ BadRequestError: {
476
+ content: {
477
+ "application/json": external["swagger.yml"]["components"]["schemas"]["Error"];
478
+ };
479
+ };
480
+ /** API key or token was not valid */
481
+ UnauthorizedError: {
482
+ content: {
483
+ "application/json": external["swagger.yml"]["components"]["schemas"]["Error"];
484
+ };
485
+ };
486
+ /** Permission was denied */
487
+ ForbiddenError: {
488
+ content: {
489
+ "application/json": external["swagger.yml"]["components"]["schemas"]["Error"];
490
+ };
491
+ };
492
+ /** Resource not found */
493
+ NotFoundError: {
494
+ content: {
495
+ "application/json": external["swagger.yml"]["components"]["schemas"]["Error"];
496
+ };
497
+ };
498
+ /** Too many requests in allowed time period */
499
+ RateLimitError: unknown;
500
+ /** Execution error occurred */
501
+ InternalServerError: unknown;
502
+ };
503
+ };
504
+ operations: {};
505
+ };
506
+ }
507
+
508
+ type IntegrationDefinitionsApi = paths$1['/api/v1/integration-definitions'];
509
+ type IntegrationInstallationsApi = paths['/api/v1/integration-installations'];
510
+ /** Query parameter options for GET /api/v1/integration-definitions */
511
+ type IntegrationDefinitionGetParameters = IntegrationDefinitionsApi['get']['parameters']['query'];
512
+ /** The GET response from /api/v1/integration-definitions */
513
+ type IntegrationDefinitionGetResponse = IntegrationDefinitionsApi['get']['responses']['200']['content']['application/json'];
514
+ /** The PUT body for /api/v1/integration-definitions */
515
+ type IntegrationDefinitionPutParameters = IntegrationDefinitionsApi['put']['requestBody']['content']['application/json'];
516
+ /** The PUT response body for /api/v1/integration-definitions (has team-specific integration type) */
517
+ type IntegrationDefinitionPutResponse = IntegrationDefinitionsApi['put']['responses']['200']['content']['application/json'];
518
+ /** The DELETE body for /api/v1/integration-definitions */
519
+ type IntegrationDefinitionDeleteParameters = IntegrationDefinitionsApi['delete']['requestBody']['content']['application/json'];
520
+ /** Query parameter options for GET /api/v1/integration-installations */
521
+ type IntegrationInstallationGetParameters = IntegrationInstallationsApi['get']['parameters']['query'];
522
+ /** The GET response from /api/v1/integration-installations */
523
+ type IntegrationInstallationGetResponse = IntegrationInstallationsApi['get']['responses']['200']['content']['application/json'];
524
+ /** The PUT body for /api/v1/integration-installations */
525
+ type IntegrationInstallationPutParameters = IntegrationInstallationsApi['put']['requestBody']['content']['application/json'];
526
+ /** The DELETE body for /api/v1/integration-installations */
527
+ type IntegrationInstallationDeleteParameters = IntegrationInstallationsApi['delete']['requestBody']['content']['application/json'];
528
+
529
+ type DefClientOptions = Omit<ClientOptions, 'apiKey' | 'projectId'> & {
530
+ teamId: string;
531
+ };
532
+ /** API Client to manage the registration of custom Mesh applications */
533
+ declare class IntegrationDefinitionClient extends ApiClient<DefClientOptions> {
534
+ #private;
535
+ constructor(options: DefClientOptions);
536
+ /** Fetches all mesh apps for a team (and optionally also those shared across teams) */
537
+ get(options?: Omit<IntegrationDefinitionGetParameters, 'teamId'>): Promise<IntegrationDefinitionGetResponse>;
538
+ /** Creates or updates a mesh app definition on a team */
539
+ upsert(body: Omit<IntegrationDefinitionPutParameters, 'teamId'>): Promise<{
540
+ type: string;
541
+ displayName: string;
542
+ logoIconUrl?: string | undefined;
543
+ badgeIconUrl?: string | undefined;
544
+ category?: "analytics" | "cdn" | "classic" | "commerce" | "content" | "comingSoon" | "data" | "deprecated" | "email" | "framework" | "search" | "starters" | "uniform" | "unknown" | undefined;
545
+ public?: boolean | undefined;
546
+ baseLocationUrl?: string | undefined;
547
+ locations: {
548
+ install?: {
549
+ description?: string[] | undefined;
550
+ informationUrl?: string | undefined;
551
+ canvasPackageUrl?: string | undefined;
552
+ } | undefined;
553
+ settings?: {
554
+ url: string;
555
+ locations?: {
556
+ [key: string]: {
557
+ url: string;
558
+ };
559
+ } | undefined;
560
+ } | undefined;
561
+ canvas?: {
562
+ parameterTypes: {
563
+ type: string;
564
+ displayName: string;
565
+ configureUrl?: string | undefined;
566
+ editorUrl: string;
567
+ configurationLocations?: {
568
+ [key: string]: {
569
+ url: string;
570
+ };
571
+ } | undefined;
572
+ editorLocations?: {
573
+ [key: string]: {
574
+ url: string;
575
+ };
576
+ } | undefined;
577
+ renderableInPropertyPanel?: boolean | undefined;
578
+ }[];
579
+ } | undefined;
580
+ dataConnectors?: {
581
+ type: string;
582
+ displayName: string;
583
+ dataSourceEditorUrl?: string | undefined;
584
+ dataSourceEditorLocations?: {
585
+ [key: string]: {
586
+ url: string;
587
+ };
588
+ } | undefined;
589
+ dataArchetypes?: {
590
+ [key: string]: {
591
+ displayName: string;
592
+ typeEditorUrl?: string | undefined;
593
+ typeEditorLocations?: {
594
+ [key: string]: {
595
+ url: string;
596
+ };
597
+ } | undefined;
598
+ dataEditorUrl?: string | undefined;
599
+ dataEditorUrlLocations?: {
600
+ [key: string]: {
601
+ url: string;
602
+ };
603
+ } | undefined;
604
+ };
605
+ } | undefined;
606
+ badgeIconUrl?: string | undefined;
607
+ }[] | undefined;
608
+ };
609
+ }>;
610
+ /** Deletes a mesh app from a team */
611
+ remove(body: Omit<IntegrationDefinitionDeleteParameters, 'teamId'>): Promise<void>;
612
+ }
613
+
614
+ /** API Client to manage the registration of custom Mesh applications */
615
+ declare class IntegrationInstallationClient extends ApiClient {
616
+ #private;
617
+ constructor(options: Omit<ClientOptions, 'apiKey'>);
618
+ /** Fetches all IntegrationInstallations for a project */
619
+ get(options?: ExceptProject<Omit<IntegrationInstallationGetParameters, 'type'>>): Promise<IntegrationInstallationGetResponse>;
620
+ /** Fetches all IntegrationInstallations for a project */
621
+ getOne(options?: ExceptProject<IntegrationInstallationGetParameters & {
622
+ type: string;
623
+ }>): Promise<IntegrationInstallationGetResponse['results'][0] | undefined>;
624
+ /** Updates or creates (based on id) a IntegrationInstallation */
625
+ upsert(body: ExceptProject<IntegrationInstallationPutParameters>): Promise<void>;
626
+ /** Deletes a IntegrationInstallation */
627
+ remove(body: ExceptProject<IntegrationInstallationDeleteParameters>): Promise<void>;
628
+ }
629
+
630
+ type DataSourceLocationValue = Pick<DataSource, 'baseUrl' | 'custom' | 'headers' | 'parameters' | 'variables'>;
631
+ type DataSourceLocationMetadata<TIntegrationConfiguration = unknown> = {
632
+ /** Settings defined at the integration level (arbitrary type used on settings location) */
633
+ settings: TIntegrationConfiguration;
634
+ /** The Uniform project ID */
635
+ projectId: string;
636
+ };
637
+ type DataSourceLocation = MeshLocationCore<DataSourceLocationValue, DataSourceLocationMetadata, DataSourceLocationValue, 'dataSource'>;
638
+
639
+ type ParamTypeLocationMetadata<TParamConfiguration = unknown, TIntegrationConfiguration = unknown> = {
640
+ rootNode: Omit<RootComponentInstance, 'slots' | '_data'>;
641
+ parameterConfiguration: TParamConfiguration;
642
+ component: Omit<ComponentInstance, 'slots'>;
643
+ componentDefinitions: Record<string, ComponentDefinition | undefined>;
644
+ parameterDefinition: ComponentDefinitionParameter;
645
+ /** Settings defined at the integration level (arbitrary type used on settings location) */
646
+ settings: TIntegrationConfiguration;
647
+ /** The Uniform project ID */
648
+ projectId: string;
649
+ /** Current dynamic inputs that are configured on the composition (if any). */
650
+ dynamicInputs: DynamicInputs;
651
+ };
652
+ type ParamTypeLocation<TParamValue = unknown, TParamConfiguration = unknown, TParamSetValue = TParamValue, TIntegrationConfiguration = unknown> = MeshLocationCore<TParamValue | undefined, ParamTypeLocationMetadata<TParamConfiguration, TIntegrationConfiguration>, TParamSetValue, 'paramType'>;
653
+
654
+ type SettingsLocationMetadata = {
655
+ projectId: string;
656
+ };
657
+ type SettingsLocation<TSettingsType> = MeshLocationCore<TSettingsType, SettingsLocationMetadata, TSettingsType, 'settings'>;
658
+
659
+ /**
660
+ * Defines methods used for interacting with a Mesh location
661
+ * To receive useful typings, check the `type` property of the location to narrow the typing.
662
+ */
663
+ type MeshLocation<TValue = unknown, TSetValue = TValue> = ParamTypeLocation<TValue, unknown, TSetValue> | ParamTypeConfigLocation<TValue> | SettingsLocation<TValue> | DataSourceLocation | DataTypeLocation | DataResourceLocation;
664
+ interface MeshContextData {
665
+ locationKey: string;
666
+ locationType: MeshLocationTypes;
667
+ isReadOnly: boolean;
668
+ locationValue: any;
669
+ locationMetadata: any;
670
+ uniformApiVersion: string;
671
+ dialogContext?: DialogContext;
672
+ }
673
+ interface DialogContext {
674
+ dialogId: string;
675
+ dialogLocation?: string;
676
+ contentHeight?: CSSHeight;
677
+ }
678
+ interface DialogResponseHandlers {
679
+ [dialogId: string]: DialogResponseHandler;
680
+ }
681
+ interface DialogResponseHandler {
682
+ resolve: (value: Pick<DialogResponseData, 'value' | 'dialogId'>) => void;
683
+ reject: (reason?: unknown) => void;
684
+ }
685
+ interface DialogResponseData {
686
+ value?: unknown;
687
+ dialogId: string;
688
+ error?: string;
689
+ }
690
+ type DialogType = 'location' | 'confirm';
691
+ type OpenDialogResult = {
692
+ /** Unique ID of this dialog which can be used to close it */
693
+ dialogId: string;
694
+ /**
695
+ * For custom location based dialogs, this is the name of the location from the Mesh app manifest.
696
+ * e.g. if you define a dialog location in the manifestunder locations.settings.locations.fooFooFoo,
697
+ * this would be 'fooFooFoo'
698
+ */
699
+ dialogLocation?: string;
700
+ };
701
+ interface DialogOptions<TDialogParams = DialogParams> {
702
+ /**
703
+ * By default, dialogs will be closed when they set a value.
704
+ * You can disable this behavior by setting the `disableCloseDialogOnSetValue`
705
+ * property to true.
706
+ * You'll still be able to close a dialog via the `closeDialog` method
707
+ * that is returned from the `openLocationDialog` method.
708
+ */
709
+ disableCloseDialogOnSetValue?: boolean;
710
+ /**
711
+ * Options for setting the max width of the dialog.
712
+ */
713
+ maxWidth?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | 'full';
714
+ /**
715
+ * Parameters to pass to the dialog, which will be available in the dialog via
716
+ * the `metadata` object for the dialog location, e.g. `metadata.dialogParams`.
717
+ * Parameters should be simple (serializable) types, not functions or DOM
718
+ * elements or similar non-serializable objects.
719
+ */
720
+ params?: TDialogParams;
721
+ /**
722
+ * Allows you to specify the height of the dialog content upon open. Note: the
723
+ * dialog itself will always be full height to match the Uniform dashboard UI.
724
+ * However, the content container within the dialog is, by default, auto-sized to
725
+ * the calculated height of the rendered content of the dialog.
726
+ * Setting the `contentHeight` option disables auto-sizing and allows you to specify
727
+ * your own height for the dialog content.
728
+ * `contentHeight` option can be specific lengths, e.g. 100vh, 500px, etc... as
729
+ * well as other standard CSS height options.
730
+ */
731
+ contentHeight?: CSSHeight;
732
+ }
733
+ type DialogParamValue = string | number | boolean | null | DialogParamValue[] | {
734
+ [key: string]: DialogParamValue;
735
+ };
736
+ type DialogParams = {
737
+ [paramName: string]: DialogParamValue;
738
+ };
739
+ type CSSHeight = '-moz-initial' | 'inherit' | 'initial' | 'revert' | 'unset' | '-moz-max-content' | '-moz-min-content' | '-webkit-fit-content' | 'auto' | 'fit-content' | 'max-content' | 'min-content' | `${number}${'px' | 'em' | 'rem' | 'vh'}`;
740
+ type ValidationResult = {
741
+ isValid: false;
742
+ validationMessage: string;
743
+ } | {
744
+ isValid: true;
745
+ };
746
+ type OpenDialogMessage = {
747
+ dialogType: DialogType;
748
+ dialogData: unknown;
749
+ options?: DialogOptions;
750
+ };
751
+ type CloseDialogMessage = {
752
+ dialogId: string | undefined;
753
+ dialogType: DialogType;
754
+ dialogData?: unknown;
755
+ };
756
+ type GetDataResourceMessage = Pick<DataType, 'path' | 'headers' | 'parameters' | 'body' | 'method'>;
757
+
758
+ type MeshSDKEventInterface = Awaited<ReturnType<typeof connectToParent>>['parent'] & {
759
+ initialize: () => Promise<MeshContextData>;
760
+ };
761
+ /**
762
+ * Imports the iframe communications library and provides an interface for interacting with
763
+ * the parent window via said communications library.
764
+ */
765
+ declare function connectToParent({ dialogResponseHandlers, onMetadataUpdated, }: {
766
+ dialogResponseHandlers: DialogResponseHandlers;
767
+ onMetadataUpdated: (metadata: unknown) => void;
768
+ }): Promise<{
769
+ initData: MeshContextData;
770
+ parent: {
771
+ resize: ({ height }: {
772
+ height: CSSHeight;
773
+ }) => Promise<void>;
774
+ setValue: (value: SetValueMessage) => Promise<void>;
775
+ openDialog: (message: OpenDialogMessage) => Promise<Pick<DialogResponseData, "value" | "dialogId"> | undefined>;
776
+ closeDialog: (message: CloseDialogMessage) => Promise<void>;
777
+ getDataResource: <TExpectedResult>(message: GetDataResourceMessage) => Promise<TExpectedResult>;
778
+ };
779
+ }>;
780
+
781
+ type SetLocationFunction<TSetValue> = (value: TSetValue, options?: SetValueOptions) => Promise<void> | void;
782
+ /** Core shared generic for a mesh location context */
783
+ interface MeshLocationCore<TValue = unknown, TMetadata = unknown, TSetValue = TValue, TType extends MeshLocationTypes = MeshLocationTypes> {
784
+ /** The current location type (where in the Uniform app the mesh app is rendering) */
785
+ type: TType;
786
+ /** If true, any editable fields on the current location should be disabled as the user does not have permission or otherwise cannot change them. */
787
+ isReadOnly: boolean;
788
+ /** The current value of the location. Some locations have fixed types (i.e. dataType), and others have user-selected types (i.e. paramType) */
789
+ value: TValue;
790
+ /**
791
+ * Sets the current value of the location.
792
+ * All locations other than 'settings' update into a parent form state and should be updated live as changes occur in the Mesh app.
793
+ * The 'settings' location writes to the database each time its value is set, and it should be treated as a form with a submit button.
794
+ */
795
+ setValue: SetLocationFunction<TSetValue>;
796
+ /**
797
+ * Gets the current location metadata, context data which is provided from the Uniform app to assist in rendering the Mesh UI
798
+ * Each location has a specific type of metadata that it is provided, which is typed automatically when the location is known.
799
+ */
800
+ metadata: TMetadata;
801
+ /**
802
+ * Context of a location when it is rendering inside a dialog in the Uniform app.
803
+ * This is set when:
804
+ * - You pop out the app using sdk.openCurrentLocationDialog() so the location is rendered in a dialog for more screen space
805
+ * - The current location is a named dialog that was opened from the location using sdk.openLocationDialog()
806
+ *
807
+ * This is undefined when the current location is not a dialog.
808
+ */
809
+ dialogContext?: DialogContext & {
810
+ /** Parameters passed to the dialog when it was opened */
811
+ params: unknown;
812
+ /**
813
+ * Returns a result to the dialog opener.
814
+ */
815
+ returnDialogValue: (value: unknown) => Promise<void>;
816
+ };
817
+ }
818
+ /**
819
+ * Known location types that can be passed to a mesh location
820
+ */
821
+ type MeshLocationTypes = 'paramType' | 'paramTypeConfig' | 'settings' | 'dataSource' | 'dataType' | 'dataResource';
822
+ type SetValueOptions = ValidationResult;
823
+ type SetValueMessage = {
824
+ uniformMeshLocationValue: unknown;
825
+ options?: SetValueOptions;
826
+ };
827
+ type GetDataResourceLocation = {
828
+ getDataResource: Awaited<ReturnType<typeof connectToParent>>['parent']['getDataResource'];
829
+ };
830
+ /**
831
+ * Dynamic inputs come from project map and represent path or query based dynamic values
832
+ * These can be connected to from within a Mesh location by setting a data resource variable to contain ex:
833
+ * ${inputName} expression(s).
834
+ *
835
+ * Dynamic inputs only work at runtime when using the route endpoint to fetch data.
836
+ */
837
+ type DynamicInput = {
838
+ value: string;
839
+ defaultValue: string;
840
+ source: ProjectMapNode;
841
+ type: 'query' | 'path';
842
+ };
843
+ /** Record of dynamic inputs keyed by the input name */
844
+ type DynamicInputs = Record<string, DynamicInput>;
845
+
846
+ type DataTypeLocationValue = Pick<DataType$1, 'body' | 'method' | 'path' | 'custom' | 'headers' | 'parameters' | 'variables'>;
847
+ type DataConnectorInfo = {
848
+ type: string;
849
+ displayName: string;
850
+ };
851
+ type DataTypeLocationMetadata<TIntegrationConfiguration = unknown> = {
852
+ /** Settings defined at the integration level (arbitrary type used on settings location) */
853
+ settings: TIntegrationConfiguration;
854
+ /** The Uniform project ID */
855
+ projectId: string;
856
+ /**
857
+ * The current data type's data source. NOTE: param and header values are not available in this context.
858
+ */
859
+ dataSource: DataSource;
860
+ /** The data connector type of the current data type's data source */
861
+ dataConnector: DataConnectorInfo;
862
+ /** The data type's archetype value. */
863
+ archetype: string;
864
+ };
865
+ type DataTypeLocation = MeshLocationCore<DataTypeLocationValue, DataTypeLocationMetadata, DataTypeLocationValue, 'dataType'> & GetDataResourceLocation;
866
+
867
+ type DataResourceLocationMetadata<TIntegrationConfiguration = unknown> = {
868
+ /** Settings defined at the integration level (arbitrary type used on settings location) */
869
+ settings: TIntegrationConfiguration;
870
+ /** The current data resource's data type */
871
+ dataType: DataType$1;
872
+ /** The data type's archetype value. */
873
+ archetype: string;
874
+ /**
875
+ * The current data resource's data source. NOTE: param and header values are not available in this context.
876
+ */
877
+ dataSource: DataSource;
878
+ /** The data connector type of the current data resource's data source */
879
+ dataConnector: DataConnectorInfo;
880
+ /** The Uniform project ID */
881
+ projectId: string;
882
+ /** Current dynamic inputs that are configured on the composition (if any). */
883
+ dynamicInputs: DynamicInputs;
884
+ };
885
+ type DataResourceLocation = MeshLocationCore<DataResourceVariables, DataResourceLocationMetadata, DataResourceVariables, 'dataResource'> & GetDataResourceLocation;
886
+
887
+ type ParamTypeConfigLocationMetadata<TIntegrationConfiguration = unknown> = {
888
+ /** Settings defined at the integration level (arbitrary type used on settings location) */
889
+ settings: TIntegrationConfiguration;
890
+ /** The Uniform project ID */
891
+ projectId: string;
892
+ componentDefinition: ComponentDefinition;
893
+ };
894
+ type ParamTypeConfigLocation<TParamValue = unknown, TIntegrationConfiguration = unknown> = MeshLocationCore<TParamValue | undefined, ParamTypeConfigLocationMetadata<TIntegrationConfiguration>, TParamValue, 'paramTypeConfig'>;
895
+
896
+ interface SdkWindow {
897
+ /** The current window object. */
898
+ instance: Window;
899
+ /** The numerical height of the current window. */
900
+ height: number;
901
+ /** The MutationObserver object used to detect content height changes.
902
+ * Note: this property is only defined if `enableAutoResizing` is true. */
903
+ observer?: MutationObserver;
904
+ /** Enables auto-resizing of the window (iframe) based on the size of the content. */
905
+ enableAutoResizing: () => void;
906
+ /** Disables auto-resizing of the window (iframe) based on the size of the content. */
907
+ disableAutoResizing: () => void;
908
+ /** `height` argument can be specific lengths, e.g. 100vh, 300px, etc...
909
+ * as well as other standard CSS height options */
910
+ updateHeight: (height: CSSHeight) => void;
911
+ }
912
+
913
+ type OpenLocationDialogOptions<TDialogParams> = {
914
+ /**
915
+ * Name of the location key in the Mesh App definition (stored on uniform.app) to open in a dialog.
916
+ * For example if the current location is integration settings, this would be an object key on:
917
+ * locations.settings.locations.<thisKey>
918
+ * and the URL to the dialog would be in
919
+ * locations.settings.locations.<thisKey>.url.
920
+ */
921
+ locationKey: string;
922
+ options?: DialogOptions<TDialogParams>;
923
+ };
924
+ type OpenConfirmationDialogOptions = {
925
+ titleText: string;
926
+ bodyText: string;
927
+ options?: Omit<DialogOptions<void>, 'disableCloseDialogOnSetValue' | 'params'>;
928
+ };
929
+ type OpenConfirmationDialogResult = {
930
+ value: 'confirm' | 'cancel';
931
+ closeDialog: () => Promise<void>;
932
+ };
933
+ type CloseLocationDialogOptions = {
934
+ /** Id of the dialog to close. If no dialog with the given id exists, nothing will happen. */
935
+ dialogId: string;
936
+ };
937
+ interface LocationDialogResponse<TDialogValue> {
938
+ /** Generated id for the dialog. */
939
+ dialogId: string;
940
+ /** The value set by the dialog. */
941
+ value: TDialogValue;
942
+ /** Allows for closing the dialog manually.
943
+ * Typically used when `closeDialogOnSetValue` is false. */
944
+ closeDialog: () => Promise<void>;
945
+ }
946
+ /** Events that can be emitted from the Mesh SDK */
947
+ type UniformMeshSDKEvents = {
948
+ /** Fired when the location value has changed */
949
+ onValueChanged: {
950
+ newValue: unknown;
951
+ };
952
+ /** Fired when the location metadata value has been updated */
953
+ onMetadataChanged: {
954
+ newValue: unknown;
955
+ };
956
+ };
957
+ interface UniformMeshSDK {
958
+ events: Emitter<UniformMeshSDKEvents>;
959
+ /** Gets the current location that the Mesh App is being displayed on. */
960
+ getCurrentLocation: <TValue = unknown, TSetValue = unknown>() => MeshLocation<TValue, TSetValue>;
961
+ /** The current `window` object being used for the SDK */
962
+ currentWindow: SdkWindow | undefined;
963
+ /** The version of the Mesh framework being used */
964
+ version: string;
965
+ /** Opens a dialog in the Uniform app with the URL set to a specific named dialog registered for the current location in the Mesh app manifest */
966
+ openLocationDialog: <TExpectedDialogResult = unknown, TDialogParams = void>(options: OpenLocationDialogOptions<TDialogParams>) => Promise<LocationDialogResponse<TExpectedDialogResult> | undefined>;
967
+ /** Explicitly close a location dialog. Called within the dialog. */
968
+ closeLocationDialog: (options: CloseLocationDialogOptions) => Promise<void>;
969
+ /** Opens a confirmation dialog to get a confirm/cancel question answered. Does not require any registration with the Mesh app manifest. */
970
+ openConfirmationDialog(options: OpenConfirmationDialogOptions): Promise<OpenConfirmationDialogResult | undefined>;
971
+ /** Opens the current location within a dialog, enabling to to break out of the layout it was loaded in. */
972
+ openCurrentLocationDialog<TLocationType extends MeshLocation['type'], TLocationSetValue = unknown, TDialogParams = void>(options?: {
973
+ options?: DialogOptions<TDialogParams>;
974
+ }): Promise<LocationDialogResponse<Parameters<Extract<MeshLocation<TLocationSetValue, TLocationSetValue>, {
975
+ type: TLocationType;
976
+ }>['setValue']>[0]> | undefined>;
977
+ /** Explicitly close a location dialog. Called when rendering current location in the dialog. */
978
+ closeCurrentLocationDialog(): Promise<void>;
979
+ }
980
+ declare global {
981
+ interface Window {
982
+ UniformMeshSDK: UniformMeshSDK | undefined;
983
+ }
984
+ }
985
+ /**
986
+ * Initializes the Uniform Mesh SDK. Intended to be called (and awaited) prior to any
987
+ * attempted interaction with the Uniform Mesh SDK.
988
+ */
989
+ declare function initializeUniformMeshSDK({ autoResizingDisabled, }?: {
990
+ autoResizingDisabled?: boolean;
991
+ }): Promise<UniformMeshSDK | undefined>;
992
+
993
+ export { CSSHeight, CloseDialogMessage, CloseLocationDialogOptions, DataConnectorInfo, DataResourceLocation, DataResourceLocationMetadata, DataSourceLocation, DataSourceLocationMetadata, DataSourceLocationValue, DataTypeLocation, DataTypeLocationMetadata, DataTypeLocationValue, DialogContext, DialogOptions, DialogParamValue, DialogParams, DialogResponseData, DialogResponseHandler, DialogResponseHandlers, DialogType, DynamicInput, DynamicInputs, GetDataResourceLocation, GetDataResourceMessage, IntegrationDefinitionClient, IntegrationDefinitionDeleteParameters, IntegrationDefinitionGetParameters, IntegrationDefinitionGetResponse, IntegrationDefinitionPutParameters, IntegrationDefinitionPutResponse, IntegrationInstallationClient, IntegrationInstallationDeleteParameters, IntegrationInstallationGetParameters, IntegrationInstallationGetResponse, IntegrationInstallationPutParameters, LocationDialogResponse, MeshContextData, MeshLocation, MeshLocationCore, MeshLocationTypes, MeshSDKEventInterface, OpenConfirmationDialogOptions, OpenConfirmationDialogResult, OpenDialogMessage, OpenDialogResult, OpenLocationDialogOptions, ParamTypeConfigLocation, ParamTypeConfigLocationMetadata, ParamTypeLocation, ParamTypeLocationMetadata, SdkWindow, SetLocationFunction, SetValueMessage, SetValueOptions, SettingsLocation, SettingsLocationMetadata, UniformMeshSDK, UniformMeshSDKEvents, ValidationResult, initializeUniformMeshSDK };
package/dist/index.esm.js CHANGED
@@ -521,6 +521,7 @@ function getByteSize(val) {
521
521
  }
522
522
 
523
523
  // src/sdkWindow.ts
524
+ import imagesLoaded from "imagesloaded";
524
525
  var oldHeight;
525
526
  var createSdkWindow = ({
526
527
  onHeightChange,
@@ -548,6 +549,34 @@ var createSdkWindow = ({
548
549
  updateHeight();
549
550
  };
550
551
  const observer = autoResizingDisabled ? void 0 : new MutationObserver(heightCallback);
552
+ const observedImages = /* @__PURE__ */ new WeakSet();
553
+ const imagesLoadedInstance = autoResizingDisabled ? void 0 : imagesLoaded(document.body, () => {
554
+ heightCallback();
555
+ });
556
+ imagesLoadedInstance == null ? void 0 : imagesLoadedInstance.on("progress", () => {
557
+ heightCallback();
558
+ });
559
+ const newImagesObserver = autoResizingDisabled ? void 0 : new MutationObserver((mutations) => {
560
+ let newImagesAdded = false;
561
+ for (const mutation of mutations) {
562
+ for (const newNode of mutation.addedNodes) {
563
+ if (newNode && newNode.nodeName !== "IMG") {
564
+ continue;
565
+ }
566
+ if (observedImages.has(newNode)) {
567
+ continue;
568
+ }
569
+ observedImages.add(newNode);
570
+ imagesLoadedInstance == null ? void 0 : imagesLoadedInstance.addImage(newNode);
571
+ newImagesAdded = true;
572
+ }
573
+ }
574
+ if (newImagesAdded) {
575
+ window.requestAnimationFrame(() => {
576
+ imagesLoadedInstance == null ? void 0 : imagesLoadedInstance.check();
577
+ });
578
+ }
579
+ });
551
580
  const sdkWindow = {
552
581
  instance: windowInstance,
553
582
  height: windowInstance.document.documentElement.getBoundingClientRect().height,
@@ -560,10 +589,15 @@ var createSdkWindow = ({
560
589
  characterData: true
561
590
  });
562
591
  windowInstance.addEventListener("resize", heightCallback);
592
+ newImagesObserver == null ? void 0 : newImagesObserver.observe(document.body, {
593
+ childList: true,
594
+ subtree: true
595
+ });
563
596
  },
564
597
  disableAutoResizing: () => {
565
598
  observer == null ? void 0 : observer.disconnect();
566
599
  windowInstance.removeEventListener("resize", heightCallback);
600
+ newImagesObserver == null ? void 0 : newImagesObserver.disconnect();
567
601
  },
568
602
  updateHeight
569
603
  };
package/dist/index.js CHANGED
@@ -558,6 +558,7 @@ function getByteSize(val) {
558
558
  }
559
559
 
560
560
  // src/sdkWindow.ts
561
+ var import_imagesloaded = __toESM(require("imagesloaded"));
561
562
  var oldHeight;
562
563
  var createSdkWindow = ({
563
564
  onHeightChange,
@@ -585,6 +586,34 @@ var createSdkWindow = ({
585
586
  updateHeight();
586
587
  };
587
588
  const observer = autoResizingDisabled ? void 0 : new MutationObserver(heightCallback);
589
+ const observedImages = /* @__PURE__ */ new WeakSet();
590
+ const imagesLoadedInstance = autoResizingDisabled ? void 0 : (0, import_imagesloaded.default)(document.body, () => {
591
+ heightCallback();
592
+ });
593
+ imagesLoadedInstance == null ? void 0 : imagesLoadedInstance.on("progress", () => {
594
+ heightCallback();
595
+ });
596
+ const newImagesObserver = autoResizingDisabled ? void 0 : new MutationObserver((mutations) => {
597
+ let newImagesAdded = false;
598
+ for (const mutation of mutations) {
599
+ for (const newNode of mutation.addedNodes) {
600
+ if (newNode && newNode.nodeName !== "IMG") {
601
+ continue;
602
+ }
603
+ if (observedImages.has(newNode)) {
604
+ continue;
605
+ }
606
+ observedImages.add(newNode);
607
+ imagesLoadedInstance == null ? void 0 : imagesLoadedInstance.addImage(newNode);
608
+ newImagesAdded = true;
609
+ }
610
+ }
611
+ if (newImagesAdded) {
612
+ window.requestAnimationFrame(() => {
613
+ imagesLoadedInstance == null ? void 0 : imagesLoadedInstance.check();
614
+ });
615
+ }
616
+ });
588
617
  const sdkWindow = {
589
618
  instance: windowInstance,
590
619
  height: windowInstance.document.documentElement.getBoundingClientRect().height,
@@ -597,10 +626,15 @@ var createSdkWindow = ({
597
626
  characterData: true
598
627
  });
599
628
  windowInstance.addEventListener("resize", heightCallback);
629
+ newImagesObserver == null ? void 0 : newImagesObserver.observe(document.body, {
630
+ childList: true,
631
+ subtree: true
632
+ });
600
633
  },
601
634
  disableAutoResizing: () => {
602
635
  observer == null ? void 0 : observer.disconnect();
603
636
  windowInstance.removeEventListener("resize", heightCallback);
637
+ newImagesObserver == null ? void 0 : newImagesObserver.disconnect();
604
638
  },
605
639
  updateHeight
606
640
  };
package/dist/index.mjs CHANGED
@@ -521,6 +521,7 @@ function getByteSize(val) {
521
521
  }
522
522
 
523
523
  // src/sdkWindow.ts
524
+ import imagesLoaded from "imagesloaded";
524
525
  var oldHeight;
525
526
  var createSdkWindow = ({
526
527
  onHeightChange,
@@ -548,6 +549,34 @@ var createSdkWindow = ({
548
549
  updateHeight();
549
550
  };
550
551
  const observer = autoResizingDisabled ? void 0 : new MutationObserver(heightCallback);
552
+ const observedImages = /* @__PURE__ */ new WeakSet();
553
+ const imagesLoadedInstance = autoResizingDisabled ? void 0 : imagesLoaded(document.body, () => {
554
+ heightCallback();
555
+ });
556
+ imagesLoadedInstance == null ? void 0 : imagesLoadedInstance.on("progress", () => {
557
+ heightCallback();
558
+ });
559
+ const newImagesObserver = autoResizingDisabled ? void 0 : new MutationObserver((mutations) => {
560
+ let newImagesAdded = false;
561
+ for (const mutation of mutations) {
562
+ for (const newNode of mutation.addedNodes) {
563
+ if (newNode && newNode.nodeName !== "IMG") {
564
+ continue;
565
+ }
566
+ if (observedImages.has(newNode)) {
567
+ continue;
568
+ }
569
+ observedImages.add(newNode);
570
+ imagesLoadedInstance == null ? void 0 : imagesLoadedInstance.addImage(newNode);
571
+ newImagesAdded = true;
572
+ }
573
+ }
574
+ if (newImagesAdded) {
575
+ window.requestAnimationFrame(() => {
576
+ imagesLoadedInstance == null ? void 0 : imagesLoadedInstance.check();
577
+ });
578
+ }
579
+ });
551
580
  const sdkWindow = {
552
581
  instance: windowInstance,
553
582
  height: windowInstance.document.documentElement.getBoundingClientRect().height,
@@ -560,10 +589,15 @@ var createSdkWindow = ({
560
589
  characterData: true
561
590
  });
562
591
  windowInstance.addEventListener("resize", heightCallback);
592
+ newImagesObserver == null ? void 0 : newImagesObserver.observe(document.body, {
593
+ childList: true,
594
+ subtree: true
595
+ });
563
596
  },
564
597
  disableAutoResizing: () => {
565
598
  observer == null ? void 0 : observer.disconnect();
566
599
  windowInstance.removeEventListener("resize", heightCallback);
600
+ newImagesObserver == null ? void 0 : newImagesObserver.disconnect();
567
601
  },
568
602
  updateHeight
569
603
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/mesh-sdk",
3
- "version": "19.35.2",
3
+ "version": "19.36.0",
4
4
  "description": "Uniform Mesh Framework SDK",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -32,10 +32,14 @@
32
32
  "access": "public"
33
33
  },
34
34
  "dependencies": {
35
- "@uniformdev/canvas": "19.35.2",
36
- "@uniformdev/context": "19.35.2",
37
- "@uniformdev/project-map": "19.35.2",
35
+ "@uniformdev/canvas": "19.36.0",
36
+ "@uniformdev/context": "19.36.0",
37
+ "@uniformdev/project-map": "19.36.0",
38
+ "imagesloaded": "^5.0.0",
38
39
  "mitt": "^3.0.0"
39
40
  },
40
- "gitHead": "64d3270175087c87cfaa29a283aa4a7b0a98fd2c"
41
+ "devDependencies": {
42
+ "@types/imagesloaded": "^4.1.2"
43
+ },
44
+ "gitHead": "3ae246a7f0f39adeaf04ecba4c7e48c478c019ad"
41
45
  }