@claspo/editor 1.0.0 → 1.0.2

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.
Files changed (3) hide show
  1. package/README.md +11 -1
  2. package/package.json +11 -3
  3. package/src/types.d.ts +1439 -0
package/src/types.d.ts ADDED
@@ -0,0 +1,1439 @@
1
+ import { ClBaseComponentI as CommonBaseComponentI, ClDocumentI as CommonDocumentI, ClDocumentSharedI as CommonDocumentSharedI } from '@claspo/common/document/Document.interface';
2
+ import { PrizePoolModelI, PrizePoolOptionI } from '@claspo/common/PrizePool.interface';
3
+ import LayoutFactory from '@claspo/document-connector/layouts/LayoutFactory';
4
+ import { Observable } from 'rxjs';
5
+ declare enum BaseListSortOption {
6
+ ID = "ID",
7
+ CREATED_DATE = "CREATED_DATE",
8
+ UPDATED_DATE = "UPDATED_DATE",
9
+ NAME = "NAME",
10
+ BREAKDOWN_DATE = "BREAKDOWN_DATE",
11
+ CONTACTS_COUNT = "CONTACTS_COUNT",
12
+ ACTIVITY_DATE = "ACTIVITY_DATE",
13
+ SENT_DATE = "SENT_DATE",
14
+ EMAIL_RATING = "EMAIL_RATING",
15
+ DOMAIN = "DOMAIN",
16
+ EMAIL = "EMAIL",
17
+ ROLE = "ROLE",
18
+ REQUESTS = "REQUESTS",
19
+ START_DATE = "START_DATE",
20
+ END_DATE = "END_DATE",
21
+ STATUS = "STATUS",
22
+ UPDATE = "UPDATE",
23
+ MESSAGES = "MESSAGES",
24
+ REPORTS = "CALLOUTS",
25
+ WORKFLOWS = "WORKFLOWS",
26
+ USAGE_COUNT = "USAGE_COUNT",
27
+ TAG = "TAG"
28
+ }
29
+ declare enum BaseListOrderOption {
30
+ ASC = "ASC",
31
+ DESC = "DESC"
32
+ }
33
+ export interface MessageLanguageLocalisationI {
34
+ native: string;
35
+ en: string;
36
+ ru: string;
37
+ uk: string;
38
+ [key: string]: string;
39
+ }
40
+ export interface ClDocumentI extends CommonDocumentI {
41
+ views: ClBaseComponentI[];
42
+ shared: ClDocumentSharedI;
43
+ }
44
+ export interface ClBaseComponentI extends CommonBaseComponentI {
45
+ type: ClComponentType;
46
+ children?: ClBaseComponentI[];
47
+ focusParentOnClick?: boolean;
48
+ preventDraggable?: boolean;
49
+ recursiveRemove?: boolean;
50
+ canStack?: boolean;
51
+ }
52
+ declare enum ClComponentType {
53
+ VIEW = "VIEW",
54
+ CONTAINER = "CONTAINER",
55
+ TEXT = "TEXT",
56
+ INPUT = "INPUT",
57
+ BUTTON = "BUTTON",
58
+ IMAGE = "IMAGE",
59
+ CONSENT = "CONSENT",
60
+ COUNTDOWN_TIMER = "COUNTDOWN_TIMER",
61
+ PROMO_CODE = "PROMO_CODE",
62
+ MULTIPLE_INPUT = "MULTIPLE_INPUT",
63
+ VIDEO = "VIDEO",
64
+ SLIDER = "SLIDER",
65
+ SLIDE = "SLIDE",
66
+ SOCIAL = "SOCIAL",
67
+ COLUMNS = "COLUMNS",
68
+ COLUMN = "COLUMN",
69
+ PRIZE_BASED_GAMING = "PRIZE_BASED_GAMING"
70
+ }
71
+ export declare enum ClDocumentActionType {
72
+ SHOW_WIDGET = "SHOW_WIDGET",
73
+ OPEN_LINK = "OPEN_LINK",
74
+ SUBSCRIBE_CONTACT = "SUBSCRIBE_CONTACT",
75
+ REQUEST = "REQUEST",
76
+ CLOSE_WIDGET = "CLOSE_WIDGET",
77
+ GO_TO_VIEW = "GO_TO_VIEW",
78
+ GO_TO_PREVIOUS_VIEW = "GO_TO_PREVIOUS_VIEW",
79
+ GO_TO_NEXT_VIEW = "GO_TO_NEXT_VIEW",
80
+ CLICK = "CLICK"
81
+ }
82
+ export interface ClDocumentSharedI extends CommonDocumentSharedI {
83
+ }
84
+ export declare enum ClPreviewEnvironment {
85
+ DESKTOP = "DESKTOP",
86
+ MOBILE = "MOBILE"
87
+ }
88
+ declare enum ClComponentSyncState {
89
+ SAME_TYPE_ENV = "SAME_TYPE_ENV",
90
+ SAME_TYPE_CROSS_ENV = "SAME_TYPE_CROSS_ENV",
91
+ SAME_TYPE_IN_PARENT_CROSS_ENV = "SAME_TYPE_IN_PARENT_CROSS_ENV",
92
+ SAME_TYPE_CROSS_ENV_WHILE_VALUES_MATCH = "SAME_TYPE_CROSS_ENV_WHILE_VALUES_MATCH",
93
+ ONLY_THIS_CROSS_ENV_WHILE_VALUES_MATCH = "ONLY_THIS_CROSS_ENV_WHILE_VALUES_MATCH"
94
+ }
95
+ export interface ClComponentSyncStateI {
96
+ [id: string]: ClComponentSyncMapI[];
97
+ }
98
+ export interface ClComponentSyncMapI {
99
+ componentId: string;
100
+ viewEntryType: ClComponentType;
101
+ element: string;
102
+ control: ClPropertyPaneManifestModelName;
103
+ syncControlPropertyName: string;
104
+ syncState: ClComponentSyncState | null;
105
+ env?: ClPreviewEnvironment;
106
+ }
107
+ declare enum ClPropertyPaneManifestModelName {
108
+ SIZE = "SIZE",
109
+ INDENTATION = "INDENTATION",
110
+ ALIGNMENT = "ALIGNMENT",
111
+ BACKGROUND = "BACKGROUND",
112
+ BACKDROP_FILTER = "BACKDROP_FILTER",
113
+ BACKGROUND_MARKER_SELECTED = "BACKGROUND_MARKER_SELECTED",
114
+ BORDERS = "BORDERS",
115
+ BOX_SHADOW = "BOX_SHADOW",
116
+ BORDER_RADIUS = "BORDER_RADIUS",
117
+ TEXT_PARAMS = "TEXT_PARAMS",
118
+ TEXT_INPUT = "TEXT_INPUT",
119
+ SWITCH = "SWITCH",
120
+ SWITCH_WITH_INPUT = "SWITCH_WITH_INPUT",
121
+ INPUT_VALIDATION = "INPUT_VALIDATION",
122
+ INPUT_LABEL = "INPUT_LABEL",
123
+ TEXT_COLOR = "TEXT_COLOR",
124
+ SELECT = "SELECT",
125
+ RADIO_BUTTONS = "RADIO_BUTTONS",
126
+ IMAGE_SOURCES = "IMAGE_SOURCES",
127
+ COUNTRY_PHONE_SELECT = "COUNTRY_PHONE_SELECT",
128
+ HOVER_ANIMATION = "HOVER_ANIMATION",
129
+ ACTIONS = "ACTIONS",
130
+ NPS_ACTIONS = "NPS_ACTIONS",
131
+ DATEPICKER = "DATEPICKER",
132
+ DATEPICKER_COUNTDOWN_TIMER = "DATEPICKER_COUNTDOWN_TIMER",
133
+ DISPLAY = "DISPLAY",
134
+ COMPONENT_OPTIONS = "COMPONENT_OPTIONS",
135
+ COLOR_SELECT = "COLOR_SELECT",
136
+ FLOATING_COMPONENT_POSITION = "FLOATING_COMPONENT_POSITION",
137
+ LOOP_ANIMATION = "LOOP_ANIMATION",
138
+ VIDEO_URL = "VIDEO_URL",
139
+ VIDEO_CUSTOM_COVER = "VIDEO_CUSTOM_COVER",
140
+ WIDGET_LAYOUT_SELECT = "WIDGET_LAYOUT_SELECT",
141
+ MULTIPLE_INPUT_SIZE = "MULTIPLE_INPUT_SIZE",
142
+ DATE_FORMAT = "DATE_FORMAT",
143
+ ICON = "ICON",
144
+ PROMOCODE_ICON = "PROMOCODE_ICON",
145
+ ICON_SELECT = "ICON_SELECT",
146
+ TEXT_VISIBILITY = "TEXT_VISIBILITY",
147
+ SLIDER_SETTINGS = "SLIDER_SETTINGS",
148
+ SLIDER_MANAGE_SLIDES = "SLIDER_MANAGE_SLIDES",
149
+ SLIDER_MODES = "SLIDER_MODES",
150
+ SLIDER_NAVIGATION_BUTTONS = "SLIDER_NAVIGATION_BUTTONS",
151
+ SLIDER_INDICATION = "SLIDER_INDICATION",
152
+ SLIDER_SLIDESHOW_ANIMATION = "SLIDER_SLIDESHOW_ANIMATION",
153
+ INTEGRATION_FIELD_MAPPING = "INTEGRATION_FIELD_MAPPING",
154
+ SUPPORTED_LANGUAGES = "SUPPORTED_LANGUAGES",
155
+ LIST_POSITION = "LIST_POSITION",
156
+ SOCIAL_ICON_SIZE = "SOCIAL_ICON_SIZE",
157
+ SOCIAL_TYPE_AND_ICON_SELECT = "SOCIAL_TYPE_AND_ICON_SELECT",
158
+ COLUMNS = "COLUMNS",
159
+ INSERT_BLOCK = "INSERT_BLOCK",
160
+ NUMBER_INPUT = "NUMBER_INPUT",
161
+ PRIZE_SETTINGS = "PRIZE_SETTINGS",
162
+ ROOT_COMPONENT_SELECT = "ROOT_COMPONENT_SELECT",
163
+ FEEDBACK_TYPE = "FEEDBACK_TYPE",
164
+ FEEDBACK_ICONS_SELECT = "FEEDBACK_ICONS_SELECT",
165
+ FEEDBACK_ACTIONS = "FEEDBACK_ACTIONS",
166
+ FLOATING_BOX_POSITION = "FLOATING_BOX_POSITION"
167
+ }
168
+ declare enum PlacementInsertType {
169
+ BEFORE_BEGIN = "BEFORE_BEGIN",
170
+ AFTER_BEGIN = "AFTER_BEGIN",
171
+ BEFORE_END = "BEFORE_END",
172
+ AFTER_END = "AFTER_END",
173
+ REPLACE = "REPLACE"
174
+ }
175
+ export interface EsAdditionalFieldI {
176
+ id: number;
177
+ name: string;
178
+ type: EsAdditionalFieldType;
179
+ personalisationKey: string;
180
+ readOnly: boolean;
181
+ mandatory: boolean;
182
+ sequenceIndex: number;
183
+ defaultValue?: string;
184
+ options?: EsAdditionalFieldOptionI[];
185
+ propertyValues?: EsAdditionalFieldPropertyValue[];
186
+ }
187
+ export interface EsAdditionalFieldOptionI {
188
+ id: number;
189
+ value: string;
190
+ index: number;
191
+ inUse: boolean;
192
+ useInRegistration: boolean;
193
+ propertyTypeId: number;
194
+ customFieldId: number;
195
+ description: string;
196
+ }
197
+ export interface EsAdditionalFieldPropertyValue {
198
+ id: number;
199
+ value: number;
200
+ propertyTypeId: number;
201
+ customFieldId: number;
202
+ }
203
+ declare enum EsAdditionalFieldType {
204
+ TEXT_BOX = "TEXT_BOX",
205
+ TEXT_AREA = "TEXT_AREA",
206
+ NUMBER = "NUMBER",
207
+ DECIMAL = "DECIMAL",
208
+ DROP_DOWN_LIST = "DROP_DOWN_LIST",
209
+ CHECK_BOX_LIST = "CHECK_BOX_LIST",
210
+ DATE = "DATE",
211
+ DATE_TIME = "DATE_TIME"
212
+ }
213
+ export interface EsAdditionalFieldsListI {
214
+ id: number;
215
+ name: string;
216
+ personalisationKey: string;
217
+ fields: EsAdditionalFieldI[];
218
+ }
219
+ export declare enum ContactMappingOptionType {
220
+ TEXT = "text",
221
+ SELECT = "select",
222
+ CHECKBOX = "checkbox",
223
+ TEXT_AREA = "textarea",
224
+ NUMBER = "number",
225
+ DATE = "date",
226
+ DATE_TIME = "datetime",
227
+ BOOL = "bool",
228
+ DECIMAL = "decimal",
229
+ UNKNOWN = "unknown"
230
+ }
231
+ export interface ContactMappingOptionLimitsI {
232
+ MAX_VALUE?: number;
233
+ MIN_VALUE?: number;
234
+ ANNUAL?: boolean;
235
+ }
236
+ export interface IntegrationMappingI {
237
+ fields: IntegrationMappingFieldI[];
238
+ }
239
+ export interface IntegrationMappingFieldI {
240
+ source: string;
241
+ target: string;
242
+ type?: ContactMappingOptionType | "SUBSCRIPTION_CATEGORY" | null;
243
+ format?: string;
244
+ values_mapping?: IntegrationMappingFieldValuesMappingI;
245
+ }
246
+ export interface IntegrationMappingFieldValuesMappingI {
247
+ [index: string]: string;
248
+ }
249
+ export interface IntegratedConfigI {
250
+ doubleOptIn: boolean;
251
+ contactCollectingType: EsFormIntegrationContactCollectingType;
252
+ actions: EsFormIntegrationActionsI;
253
+ errors?: EsFormVariantIntegrationErrorI[];
254
+ }
255
+ export interface UpdateIntegrationParamsI {
256
+ name: string;
257
+ integrationUuid: string;
258
+ fullyConfigured: boolean;
259
+ mapping: IntegrationMappingI;
260
+ config: IntegratedConfigI;
261
+ }
262
+ export interface FormsListItemI {
263
+ id: number;
264
+ name: string;
265
+ publishStatus: FormPublishStatus;
266
+ testingStatus: FormTestingStatus;
267
+ fullyConfigured: boolean;
268
+ createdDate: string;
269
+ updatedDate: string;
270
+ draft: boolean;
271
+ variantIds: number[];
272
+ abTestId: number | null;
273
+ config: EsFormVariantI;
274
+ restrictions?: EsFormRestrictionI;
275
+ deleted?: boolean;
276
+ }
277
+ export declare enum FormPublishStatus {
278
+ FOR_ALL = "FOR_ALL",
279
+ PAUSED = "PAUSED",// teaser disabled. Any other status means that teaser is enabled and status works as usual
280
+ DEBUG = "DEBUG"
281
+ }
282
+ declare enum FormTestingStatus {
283
+ TESTING = "TESTING",
284
+ OFF = "OFF"
285
+ }
286
+ export interface EsFormRestrictionI {
287
+ BRANDED?: EsFormBrandingI;
288
+ }
289
+ export interface EsFormBrandingI {
290
+ reason?: string;
291
+ }
292
+ export interface EsFormVariantI {
293
+ formId: number;
294
+ id: number;
295
+ config: EsFormVariantConfigI;
296
+ appearances: EsFormVariantAppearanceI[];
297
+ linkedToVariantId: number;
298
+ type: EsWidgetType;
299
+ revision?: string;
300
+ publishedRevision?: string;
301
+ }
302
+ export interface EsFormVariantConfigI {
303
+ type: EsWidgetLayoutType;
304
+ placements?: EsFormVariantPlacementI[];
305
+ prizePoolIds?: string[];
306
+ }
307
+ export interface EsFormFieldIntegrationI {
308
+ }
309
+ export declare enum EsWidgetLayoutType {
310
+ BUILT_IN = "BUILT_IN",
311
+ DETACHED = "DETACHED",
312
+ FLOATING_BOX = "FLOATING_BOX",
313
+ FLOATING_BAR = "FLOATING_BAR",
314
+ LAUNCHER = "LAUNCHER",
315
+ CONTENT_LOCKER = "CONTENT_LOCKER",
316
+ SLIDE_UP = "SLIDE_UP",
317
+ POP_UP = "POP_UP",
318
+ BOTTOM_BAR = "BOTTOM_BAR"
319
+ }
320
+ export declare enum EsWidgetType {
321
+ SUBSCRIPTION_FORM = "SUBSCRIPTION_FORM",
322
+ INFORMER = "INFORMER",
323
+ REQUEST_FORM = "REQUEST_FORM",
324
+ LAUNCHER = "LAUNCHER",
325
+ AGE_VERIFY = "AGE_VERIFY",
326
+ TEASER = "TEASER"
327
+ }
328
+ export interface EsFormVariantPlacementI {
329
+ selector: string | null;
330
+ insertType: PlacementInsertType | null;
331
+ }
332
+ declare enum EsFormFieldType {
333
+ CHECKBOX_LIST = "CHECKBOX_LIST",
334
+ DROPDOWN = "DROPDOWN",
335
+ RADIO_GROUP = "RADIO_GROUP",
336
+ GIFT_BOX = "GIFT_BOX",
337
+ SCRATCH_CARD = "SCRATCH_CARD",
338
+ WHEEL_OF_FORTUNE = "WHEEL_OF_FORTUNE"
339
+ }
340
+ export interface EsFormFieldIntegrationI {
341
+ id: string;
342
+ label: string;
343
+ options: EsFormFieldIntegrationOptionI[];
344
+ type?: EsFormFieldType;
345
+ }
346
+ export interface EsFormFieldIntegrationOptionI {
347
+ id: string;
348
+ label: string;
349
+ exportId: string;
350
+ }
351
+ export interface EsFormVariantAppearanceI {
352
+ id: number | string;
353
+ language: string | null;
354
+ origin: boolean | null;
355
+ }
356
+ declare enum EsFormIntegrationType {
357
+ WEBHOOK = "webhook",
358
+ EMBEDDED = "embedded"
359
+ }
360
+ export interface EsFormVariantIntegrationV2I {
361
+ integrationType: EsFormIntegrationType;
362
+ params: EsFormIntegrationParamsI;
363
+ hideForSubscribers: boolean;
364
+ checkThisWidgetOnly?: boolean;
365
+ revenueCalculation?: boolean;
366
+ subscriptionNotificationEmails?: string[];
367
+ consumers?: string[];
368
+ }
369
+ export interface EsFormIntegrationParamsI {
370
+ webhookUrl: string;
371
+ uuid: string;
372
+ consumers?: string[];
373
+ }
374
+ export interface EsFormVariantIntegrationErrorI {
375
+ code: EsFormVariantIntegrationErrorCode;
376
+ description: string;
377
+ }
378
+ declare enum EsFormVariantIntegrationErrorCode {
379
+ NO_PLACEMENT = "NO_PLACEMENT",
380
+ DELETED_SEGMENT = "DELETED_SEGMENT",
381
+ DELETED_WELCOME_MESSAGE = "DELETED_WELCOME_MESSAGE",
382
+ DELETED_WELCOME_EVENT_TYPE = "DELETED_WELCOME_EVENT_TYPE",
383
+ DELETED_DOUBLE_OPT_IN_MESSAGE = "DELETED_DOUBLE_OPT_IN_MESSAGE",
384
+ WRONG_CATEGORY_FOR_DOUBLE_OPT_IN_MESSAGE = "WRONG_CATEGORY_FOR_DOUBLE_OPT_IN_MESSAGE"
385
+ }
386
+ declare enum EsFormIntegrationContactCollectingType {
387
+ NEW_ONLY = "NEW_ONLY",
388
+ ALL = "ALL",
389
+ DATA_FOR_EXISTING = "DATA_FOR_EXISTING"
390
+ }
391
+ export interface EsFormIntegrationActionsI {
392
+ addToSegments: EsFormIntegrationActionI<EsFormIntegrationAddToSegmentsI>;
393
+ sendOptInMessage?: EsFormIntegrationActionI<EsFormIntegrationSendOptInMessageI>;
394
+ [key: string]: EsFormIntegrationActionI<EsFormIntegrationActionEventTypeI | EsFormIntegrationAddToSegmentsI | EsFormIntegrationSendOptInMessageI>;
395
+ }
396
+ export interface EsFormIntegrationActionMappingI {
397
+ [key: string]: string;
398
+ }
399
+ export interface EsFormIntegrationActionEventTypeI {
400
+ eventTypeId: number;
401
+ mappings: EsFormIntegrationActionMappingI;
402
+ }
403
+ export interface EsFormIntegrationActionI<T = any> {
404
+ name: EsFormIntegrationActionName;
405
+ params: T;
406
+ }
407
+ declare enum EsFormIntegrationActionName {
408
+ SEND_OPT_IN_MESSAGE = "sendOptInMessage",
409
+ ADD_TO_SEGMENTS = "addToSegments",
410
+ SEND_EVENT = "sendEvent"
411
+ }
412
+ export interface EsFormIntegrationSendOptInMessageI {
413
+ messageId: number | null;
414
+ redirectAfterClick: string | null;
415
+ welcomeEventTypeId: number | null;
416
+ welcomeMessageId: number | null;
417
+ runWelcomeSeriesToNewOnly: boolean;
418
+ }
419
+ export interface EsFormIntegrationAddToSegmentsI {
420
+ segmentsIds: number[];
421
+ newOnly: boolean;
422
+ }
423
+ export interface EsFormAppearanceI {
424
+ id: number | string;
425
+ origin: boolean;
426
+ language: string | null;
427
+ translations: string;
428
+ /** stringified JSON {id: object} where id is node's id */
429
+ document: string;
430
+ sync: string;
431
+ consents?: object;
432
+ revision?: string;
433
+ publishedRevision?: string;
434
+ }
435
+ export interface FormLanguageI {
436
+ languageCode: string;
437
+ name: string;
438
+ localisation: MessageLanguageLocalisationI;
439
+ }
440
+ export interface FormVariantI {
441
+ formId: number;
442
+ id: number;
443
+ config: FormVariantConfigI;
444
+ appearances: EsFormVariantAppearanceI[];
445
+ linkedToVariantId: number | null;
446
+ type: EsWidgetType;
447
+ revision: string | null;
448
+ publishedRevision: string | null;
449
+ }
450
+ export interface FormVariantConfigI {
451
+ type: EsWidgetLayoutType;
452
+ placements: EsFormVariantPlacementI[];
453
+ prizePoolIds?: string[];
454
+ }
455
+ export interface BaseListDtoI<T> {
456
+ totalCount: number;
457
+ items: T[];
458
+ }
459
+ export interface UserInfoDtoI {
460
+ userId: number;
461
+ userName: string;
462
+ organisationId: number;
463
+ projectId: number;
464
+ language: string;
465
+ permissions: PermissionOptionI;
466
+ featureFlags: FeatureFlagOptionI;
467
+ }
468
+ export interface PermissionOptionI {
469
+ [key: string]: string[];
470
+ }
471
+ export interface FeatureFlagOptionI {
472
+ [key: string]: string;
473
+ }
474
+ export interface ComponentTranslateMapI {
475
+ [propPath: string]: string;
476
+ }
477
+ export interface LanguageTranslateState {
478
+ [id: string]: ComponentTranslateMapI;
479
+ }
480
+ export interface TranslateRequestI {
481
+ json: TranslateRequestJsonI;
482
+ sourceLanguage: string;
483
+ targetLanguage: string;
484
+ }
485
+ export interface TranslateRequestJsonI {
486
+ widgetTranslations: LanguageTranslateState;
487
+ teaserTranslations?: LanguageTranslateState;
488
+ }
489
+ export interface CreateWidgetRevisionRequestI {
490
+ changesSaved: boolean;
491
+ payload: WidgetRevisionPayloadI;
492
+ }
493
+ export interface WidgetRevisionPayloadI {
494
+ type: EsWidgetType;
495
+ presentation: WidgetRevisionPresentationI;
496
+ integration: UpdateIntegrationParamsI | null;
497
+ linkedTo: number | null;
498
+ appearances: WidgetRevisionAppearanceI[];
499
+ prizePoolIds?: string[];
500
+ publishStatus?: FormPublishStatus;
501
+ templateId?: number;
502
+ linkedToRevision?: string | null;
503
+ }
504
+ export interface WidgetRevisionPresentationI {
505
+ type: EsWidgetLayoutType;
506
+ fields: EsFormFieldIntegrationI[];
507
+ }
508
+ export interface WidgetRevisionAppearanceI {
509
+ id: number | string;
510
+ origin: boolean;
511
+ lang: string | null;
512
+ translations: {
513
+ [id: string]: {
514
+ [propPath: string]: string;
515
+ };
516
+ };
517
+ document: ClDocumentI;
518
+ sync: ClComponentSyncStateI;
519
+ consents?: object;
520
+ }
521
+ export interface CreateWidgetRevisionResponseI {
522
+ uuid: string;
523
+ }
524
+ export interface WidgetRevisionI {
525
+ uuid: string;
526
+ createdDate: string;
527
+ widgetId: number;
528
+ userId: number;
529
+ published: boolean;
530
+ changesSaved: boolean;
531
+ payload: WidgetRevisionPayloadI;
532
+ }
533
+ export interface WidgetProjectConfigI {
534
+ id: WidgetProjectConfigId;
535
+ value: string;
536
+ }
537
+ declare enum WidgetProjectConfigId {
538
+ ANNOYANCE_SAFEGUARD = "ANNOYANCE_SAFEGUARD",
539
+ COUNTRY_CODES_PRIORITY = "COUNTRY_CODES_PRIORITY",
540
+ CABINET_AB_TESTS = "CABINET_AB_TESTS"
541
+ }
542
+ export interface BaseFormsListRequestParamsI {
543
+ layoutTypes?: EsWidgetLayoutType[];
544
+ order?: BaseListOrderOption;
545
+ search?: string;
546
+ offset?: number;
547
+ limit?: number;
548
+ sort?: BaseListSortOption;
549
+ types?: EsWidgetType[];
550
+ projectId?: number;
551
+ filters?: FormListRequestFilter;
552
+ publishStatus?: FormPublishStatus;
553
+ publishDateFrom?: string;
554
+ publishDateTo?: string;
555
+ withDeleted?: boolean;
556
+ analyticsDateFrom?: string;
557
+ analyticsDateTo?: string;
558
+ }
559
+ declare enum FormListRequestFilter {
560
+ UNLINKED = "UNLINKED",
561
+ READY_FOR_AB_TEST = "READY_FOR_AB_TEST"
562
+ }
563
+ export interface CreateFormParamsI {
564
+ name: string;
565
+ variant: CreateFormParamsVariantI;
566
+ publishStatus?: FormPublishStatus;
567
+ }
568
+ export interface CreateFormParamsVariantI {
569
+ description: string;
570
+ type: EsWidgetType;
571
+ config: EsFormVariantConfigI;
572
+ integration: EsFormVariantIntegrationV2I | null;
573
+ appearances: EsFormAppearanceI[];
574
+ draft: boolean;
575
+ linkedToVariantId?: number;
576
+ }
577
+ export declare enum TypeOfFilesFromCommonDir {
578
+ FORMS = "FORMS",
579
+ CLOSE_ICON = "CLOSE_ICON",
580
+ PROMOCODE_ICON = "PROMOCODE_ICON",
581
+ GIFT_BOX_ICON = "GIFT_BOX_ICON",
582
+ SCRATCH_CARD_ICON = "SCRATCH_CARD_ICON",
583
+ FEEDBACK_ICON = "FEEDBACK_ICON"
584
+ }
585
+ export interface ImageLibraryRequestParamsI {
586
+ search: string;
587
+ useCache: boolean;
588
+ page: number;
589
+ limit: number;
590
+ type: ImageLibraryType;
591
+ }
592
+ declare enum ImageLibraryType {
593
+ IMAGE = "IMAGE",
594
+ ICON = "ICON"
595
+ }
596
+ export interface ImageLibraryResponseDtoI {
597
+ data: ImageLibraryItemI[];
598
+ fromCache: boolean;
599
+ source: string | null;
600
+ total: number;
601
+ }
602
+ export interface ImageLibraryItemI {
603
+ url: string;
604
+ smallUrl: string;
605
+ }
606
+ export interface UserImagesRequestParamsI {
607
+ page: number;
608
+ limit: number;
609
+ type?: string;
610
+ }
611
+ export interface UserImagesResponseDtoI {
612
+ items: UserImageItemI[];
613
+ total: number;
614
+ }
615
+ export interface UserImageItemI {
616
+ url: string;
617
+ }
618
+ /**
619
+ * Global ClaspoEditor interface exposed on window object.
620
+ * Use `window.ClaspoEditor` to access the editor API.
621
+ *
622
+ * @example
623
+ * ```typescript
624
+ * // Initialize editor
625
+ * window.ClaspoEditor.init(config, () => {
626
+ * console.log('Editor loaded');
627
+ * }, () => {
628
+ * console.error('Editor failed to load');
629
+ * });
630
+ *
631
+ * // Save changes
632
+ * window.ClaspoEditor.save({ publishChanges: true });
633
+ *
634
+ * // Destroy editor
635
+ * window.ClaspoEditor.destroy();
636
+ * ```
637
+ */
638
+ export interface EditorI {
639
+ /**
640
+ * Initialize the Claspo Editor.
641
+ * @param config - Editor configuration object
642
+ * @param onLoaded - Callback fired when editor is fully loaded
643
+ * @param onError - Callback fired if editor fails to load
644
+ */
645
+ init: (config: EditorConfigI, onLoaded?: () => void, onError?: () => void) => void;
646
+ /**
647
+ * Destroy the editor instance and cleanup resources.
648
+ * Must be called before re-initializing the editor.
649
+ */
650
+ destroy: () => void;
651
+ /**
652
+ * Save current editor state.
653
+ * @param params - Save options
654
+ * @param params.publishChanges - Whether to publish changes immediately
655
+ */
656
+ save: (params?: {
657
+ publishChanges?: boolean;
658
+ }) => void;
659
+ /**
660
+ * Cancel editing and discard unsaved changes.
661
+ */
662
+ cancel: () => void;
663
+ /**
664
+ * Get all available component manifests.
665
+ * @returns Array of component manifest objects
666
+ */
667
+ getComponentManifests: () => any[];
668
+ /**
669
+ * Get current document validation errors.
670
+ * @returns Array of document error objects
671
+ */
672
+ getDocumentErrors: () => any[];
673
+ }
674
+ /**
675
+ * Main configuration object for initializing the Claspo Editor.
676
+ *
677
+ * @see https://github.com/Claspo/claspo-plugin-starter-poc/blob/main/quickstart/public/editor.html
678
+ *
679
+ */
680
+ export interface EditorConfigI {
681
+ /**
682
+ * HTML element or CSS selector where the editor is embedded. Editors takes full width and full height of the element. It’s important to set a size of the element before editor initialization. Editor calculates actual element size and based on that it will calculate the size of it’s blocks.
683
+ * @remarks Required
684
+ */
685
+ containerElement: HTMLElement;
686
+ /**
687
+ * Default country code for phone input components.
688
+ * @see Code at https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
689
+ * Default: `"US"`
690
+ */
691
+ countryCode: string;
692
+ /**
693
+ * Theme configuration for the editor UI.
694
+ * @defaultValue Claspo default theme
695
+ */
696
+ theme: EditorThemeI;
697
+ /**
698
+ * Custom notification handlers for editor messages
699
+ * @default console.log will be used
700
+ * */
701
+ notificationHandlers: EditorConfigNotificationHandlersI;
702
+ /**
703
+ * Callback fired when Close button is clicked.
704
+ * Use this to handle editor closure and cleanup.
705
+ */
706
+ closeEditorCallback: (payload: CloseEditorCallbackPayloadI) => void;
707
+ /**
708
+ * Base URL for static resources (images, fonts, etc.).
709
+ * Must include trailing slash.
710
+ * @example `"https://cdn.claspo.io/static/"`
711
+ */
712
+ staticResourcesUrl: string;
713
+ /**
714
+ * Base URL for the host application.
715
+ * @example `"https://app.claspo.io/"`
716
+ */
717
+ hostUrl: string;
718
+ /** Configuration for the left panel component selector */
719
+ availableComponentsPanel: AvailableComponentsPanelConfigI;
720
+ /** Callback to transform revision payload before saving */
721
+ getRevisionPayloadCallback: (payload: GetRevisionPayloadCallbackPayloadI) => CreateWidgetRevisionRequestI;
722
+ /** HTTP API configuration for all editor operations */
723
+ api: EditorApiConfigI;
724
+ /**
725
+ * Callback fired on initial data loading errors.
726
+ * If not provided, default error UI will be shown.
727
+ */
728
+ initialLoadErrorCallback?: (payload: InitialLoadErrorCallbackPayloadI) => void;
729
+ /**
730
+ * Logo configuration displayed in top-left corner.
731
+ * @example `{ imageUrl: 'https://example.com/logo.png', link: 'https://example.com' }`
732
+ */
733
+ logo?: EditorLogoI;
734
+ /**
735
+ * Enable contact fields mapping functionality.
736
+ * @defaultValue `false`
737
+ */
738
+ useContactFields?: boolean;
739
+ /**
740
+ * Override translations by language.
741
+ * @example `'WIDGET_TYPE_FLOATING_BOX': {
742
+ * 'en': 'Floating Box',
743
+ * 'ru': 'Плавающее окно',
744
+ * 'uk': 'Плаваюче вікно',
745
+ * }`
746
+ */
747
+ localePatch?: any;
748
+ /** Default language code for the editor UI
749
+ * @see https://www.w3schools.com/tags/ref_language_codes.asp
750
+ * @
751
+ * */
752
+ defaultLanguage?: string;
753
+ /** Show property pane settings in tabs layout or on single columns (tabs are hidden)*/
754
+ showPropertyPaneSettingsInTabs?: boolean;
755
+ /**
756
+ * Default async pattern for API calls.
757
+ * `"PROMISE"` by default
758
+ */
759
+ defaultAsyncPattern?: AsyncPatternType;
760
+ /** Authentication token for editor API access */
761
+ authToken?: string;
762
+ /** Teaser feature configuration */
763
+ teaserFeatureConfig?: TeaserFeatureConfigI;
764
+ /** Google Fonts API key for font loading */
765
+ googleFontsApiKey?: string;
766
+ /** Callback fired when preview opens via header button */
767
+ previewOpenedCallback?: () => void;
768
+ /** Callback fired when preview closes from header button */
769
+ previewClosedCallback?: () => void;
770
+ /** Disable built-in image editor */
771
+ disableImageEditor?: boolean;
772
+ /** Disable language selection dropdown at the navbar */
773
+ disableLanguageSelect?: boolean;
774
+ /** Prevent users from removing uploaded files */
775
+ disableAbilityToRemoveUploadedFiles?: boolean;
776
+ }
777
+ /**
778
+ * Configuration for the left panel component selector.
779
+ * Defines which components are available for users to add to widgets.
780
+ */
781
+ export interface AvailableComponentsPanelConfigI {
782
+ /** Groups of available components */
783
+ groups: AvailableComponentsGroupI[];
784
+ /** Show "Request component" button at the bottom */
785
+ showRequestComponentButton?: boolean;
786
+ }
787
+ /**
788
+ * Group of components in the available components panel.
789
+ */
790
+ export interface AvailableComponentsGroupI {
791
+ /** Display label for the group */
792
+ label: string;
793
+ /** Components in this group */
794
+ components: AvailableComponentI[];
795
+ }
796
+ /**
797
+ * Configuration for a single available component.
798
+ */
799
+ export interface AvailableComponentI {
800
+ /** Component class name (e.g., "SysButtonComponent") */
801
+ componentName: string;
802
+ /** Custom SVG icon URL */
803
+ customIcon?: string;
804
+ /** Custom display label */
805
+ customLabel?: string;
806
+ /** Display icon at full width */
807
+ fullWidthIcon?: boolean;
808
+ /** Override default component model properties */
809
+ modelOverrides?: any;
810
+ /** Components that will be added together with this one */
811
+ dependentComponentNames?: string[];
812
+ }
813
+ /**
814
+ * Configuration for external links shown in the editor.
815
+ */
816
+ export interface EditorLinksConfigI {
817
+ /** Link parameters template */
818
+ linkParameters?: string;
819
+ /** "Read more" link for click tracking documentation */
820
+ readMoreAboutClickTrackingLink?: string;
821
+ /** "Read more" link for Open URL action documentation */
822
+ readMoreAboutOpenUrlLink?: string;
823
+ /** "Read more" link for iOS custom data documentation */
824
+ readMoreAboutCustomDataIosLink?: string;
825
+ /** "Read more" link for Android custom data documentation */
826
+ readMoreAboutCustomDataAndroidLink?: string;
827
+ /** Additional external links */
828
+ externalLinks?: any;
829
+ /** Event types configuration */
830
+ eventsTypes?: any;
831
+ /** Default domain for links */
832
+ domain?: string;
833
+ }
834
+ /**
835
+ * Custom notification handlers for editor messages.
836
+ * Implement these methods to integrate with your notification system.
837
+ *
838
+ * @example
839
+ * ```typescript
840
+ * const notificationHandlers: EditorConfigNotificationHandlersI = {
841
+ * success: (msg) => toast.success(msg),
842
+ * error: (msg) => toast.error(msg),
843
+ * warning: (msg) => toast.warning(msg),
844
+ * info: (msg) => toast.info(msg),
845
+ * hide: () => toast.dismiss()
846
+ * };
847
+ * ```
848
+ */
849
+ export interface EditorConfigNotificationHandlersI {
850
+ /** Show success notification */
851
+ success: (message: string) => void;
852
+ /** Show info notification */
853
+ info: (message: string) => void;
854
+ /** Show warning notification */
855
+ warning: (message: string) => void;
856
+ /** Show error notification */
857
+ error: (message: string) => void;
858
+ /** Hide all notifications */
859
+ hide: () => void;
860
+ }
861
+ /**
862
+ * Configuration for click action behavior in the editor.
863
+ */
864
+ export interface ActionOptionsI {
865
+ /** List of available click actions for components */
866
+ availableClickActions?: ClDocumentActionType[];
867
+ /** Show "Open link in new tab" switch. @defaultValue `true` */
868
+ isDisplayingOpenLinkNewTabSwitch?: boolean;
869
+ /** Show custom data input fields */
870
+ isDisplayingCustomData?: boolean;
871
+ /** Allow deep link configuration */
872
+ isAllowDeepLink?: boolean;
873
+ }
874
+ /**
875
+ * Configuration for columns component behavior.
876
+ */
877
+ export interface ColumnsOptionsI {
878
+ /** Allow hiding individual columns on mobile view */
879
+ allowHideColumnOnMobile?: boolean;
880
+ }
881
+ /**
882
+ * Configuration for teaser (minimized widget) feature.
883
+ */
884
+ export interface TeaserFeatureConfigI {
885
+ /** Enable teaser functionality */
886
+ enabled: boolean;
887
+ /** Default document model for new teasers */
888
+ defaultDocumentModel: ClDocumentI;
889
+ /** Layouts where teaser is available */
890
+ enabledForLayouts?: EsWidgetLayoutType[];
891
+ /** Component panel configuration for teaser editor */
892
+ availableComponentsPanel?: AvailableComponentsPanelConfigI;
893
+ }
894
+ /**
895
+ * Payload passed to {@link EditorConfigI.closeEditorCallback}.
896
+ */
897
+ export interface CloseEditorCallbackPayloadI {
898
+ /** Current widget variant data */
899
+ variant: FormVariantI;
900
+ }
901
+ /**
902
+ * Payload passed to {@link EditorConfigI.getRevisionPayloadCallback}.
903
+ */
904
+ export interface GetRevisionPayloadCallbackPayloadI {
905
+ /** Current widget variant */
906
+ variant: FormVariantI;
907
+ /** All widget appearances (desktop, mobile, etc.) */
908
+ appearances: EsFormAppearanceI[];
909
+ /** Current publish status */
910
+ publishStatus: FormPublishStatus | null;
911
+ }
912
+ /**
913
+ * Payload passed to {@link EditorConfigI.initialLoadErrorCallback}.
914
+ */
915
+ export interface InitialLoadErrorCallbackPayloadI {
916
+ /** HTTP status code of the failed request */
917
+ status: number;
918
+ }
919
+ /**
920
+ * Async pattern type for API calls.
921
+ */
922
+ export declare enum AsyncPatternType {
923
+ /** Use Promise-based API calls */
924
+ PROMISE = "PROMISE",
925
+ /** Use Observable-based API calls (RxJS) */
926
+ OBSERVABLE = "OBSERVABLE"
927
+ }
928
+ /**
929
+ * Simplified theme configuration for the Claspo Editor.
930
+ * This interface provides a streamlined API for external developers
931
+ * with only the essential customization options.
932
+ *
933
+ * @example
934
+ * ```typescript
935
+ * const theme: EditorThemeI = {
936
+ * primaryColor: '#F3492C',
937
+ * primaryFontFace: 'Montserrat, sans-serif',
938
+ * secondaryColor: '#ffffff',
939
+ * successColor: '#27C173',
940
+ * errorColor: '#E72324'
941
+ * };
942
+ * ```
943
+ */
944
+ export interface EditorThemeI {
945
+ /** Primary brand color used throughout the editor */
946
+ primaryColor: string;
947
+ /** Main font family for the editor UI */
948
+ primaryFontFace: string;
949
+ /** Secondary/background color */
950
+ secondaryColor?: string;
951
+ /** Success state color */
952
+ successColor?: string;
953
+ /** Warning state color */
954
+ warningColor?: string;
955
+ /** Info state color */
956
+ infoColor?: string;
957
+ /** Error state color */
958
+ errorColor?: string;
959
+ /** Disabled elements font color */
960
+ disabledFontColor?: string;
961
+ /** Primary text color */
962
+ primaryFontColor?: string;
963
+ /** Secondary text color */
964
+ secondaryFontColor?: string;
965
+ /** Button font weight */
966
+ buttonFontWeight?: string;
967
+ /** Primary button text color */
968
+ primaryButtonFontColor?: string;
969
+ /** Secondary button text color */
970
+ secondaryButtonFontColor?: string;
971
+ /** Secondary button border color */
972
+ secondaryButtonBorderColor?: string;
973
+ /** Secondary button border width */
974
+ secondaryButtonBorderWidth?: string;
975
+ /** Button loading state background */
976
+ buttonLoadingBackground?: string;
977
+ /** Button height */
978
+ buttonHeight?: string;
979
+ /** Button padding */
980
+ buttonPadding?: string;
981
+ /** Button padding when icon is present */
982
+ buttonPaddingWithIcon?: string;
983
+ /** Input loading state background */
984
+ inputLoadingBackground?: string;
985
+ /** Text input default border color */
986
+ textInputDefaultBorderColor?: string;
987
+ /** Text input default border width */
988
+ textInputDefaultBorderWidth?: string;
989
+ /** Text input default background color */
990
+ textInputDefaultBackgroundColor?: string;
991
+ /** Text input padding */
992
+ textInputPadding?: string;
993
+ /** Checkbox default border color */
994
+ checkboxDefaultBorderColor?: string;
995
+ /** Checkbox default border width */
996
+ checkboxDefaultBorderWidth?: string;
997
+ /** Checkbox default background color */
998
+ checkboxDefaultBackgroundColor?: string;
999
+ /** Checkbox selected icon color */
1000
+ checkboxSelectedIconColor?: string;
1001
+ /** Checkbox size */
1002
+ checkboxSize?: string;
1003
+ /** Radio button default background color */
1004
+ radioButtonDefaultBackgroundColor?: string;
1005
+ /** Switch default background color */
1006
+ switchDefaultBackgroundColor?: string;
1007
+ /** Switch icon color */
1008
+ switchIconColor?: string;
1009
+ /** Select default border color */
1010
+ selectDefaultBorderColor?: string;
1011
+ /** Select default border width */
1012
+ selectDefaultBorderWidth?: string;
1013
+ /** Select default background color */
1014
+ selectDefaultBackgroundColor?: string;
1015
+ /** Select padding */
1016
+ selectPadding?: string;
1017
+ /** Large border radius for rounded elements */
1018
+ largeBorderRadius?: string;
1019
+ /** Small border radius for subtle rounding */
1020
+ smallBorderRadius?: string;
1021
+ /** Context menu selected item background color */
1022
+ contextMenuSelectedBackgroundColor?: string;
1023
+ /** Snackbar position from top */
1024
+ snackBarPositionTop?: string;
1025
+ /** Snackbar padding */
1026
+ snackBarPadding?: string;
1027
+ /** Darker shade of primary color (CSS value) */
1028
+ darkerPrimaryColorKey?: string;
1029
+ /** Lighter shade of primary color */
1030
+ lighterPrimaryColor?: string;
1031
+ /** Very light shade of primary color (for backgrounds) */
1032
+ veryLightPrimaryColor?: string;
1033
+ /** Icon picker accent color */
1034
+ iconPickerColor?: string;
1035
+ /** Notification theme settings */
1036
+ notification?: {
1037
+ padding?: string;
1038
+ borderRadius?: string;
1039
+ boxShadow?: string;
1040
+ textColor?: string;
1041
+ warningBackgroundColor?: string;
1042
+ fontSize?: string;
1043
+ };
1044
+ /** Dialog theme settings */
1045
+ dialog?: {
1046
+ titleFontSize?: string;
1047
+ titleFontWeight?: string;
1048
+ };
1049
+ /** Checkbox component theme settings */
1050
+ checkbox?: {
1051
+ valueFontSize?: string;
1052
+ valueFontColor?: string;
1053
+ };
1054
+ /** Select filter theme settings */
1055
+ select?: {
1056
+ filterBorderRadius?: string;
1057
+ filterPadding?: string;
1058
+ filterIconPadding?: string;
1059
+ };
1060
+ /** Input field theme settings */
1061
+ input?: {
1062
+ labelMargin?: string;
1063
+ textInputTextareaPadding?: string;
1064
+ searchInputBackgroundIconColor?: string;
1065
+ searchInputBorderRadius?: string;
1066
+ searchInputIconColorActive?: string;
1067
+ };
1068
+ /** Dropdown menu theme settings */
1069
+ dropdown?: {
1070
+ borderRadius?: string;
1071
+ padding?: string;
1072
+ leftRightIndent?: string;
1073
+ };
1074
+ /** Editor option controls theme settings */
1075
+ editorOption?: {
1076
+ customPrizeImageSize?: string;
1077
+ borderDefaultColor?: string;
1078
+ borderClearButtonColor?: string;
1079
+ borderRadiusToggleButtons?: string;
1080
+ descriptionFontSize?: string;
1081
+ backgroundToggleButtonSelected?: string;
1082
+ backgroundToggleTextButtonSelected?: string;
1083
+ backgroundToggleButtonHover?: string;
1084
+ defaultBorder?: string;
1085
+ };
1086
+ /** Prize option editor theme settings */
1087
+ editorPrizeOption?: {
1088
+ gridTemplateColumns?: string;
1089
+ decrementIncrementGap?: string;
1090
+ chancePseudoBorderRight?: string;
1091
+ customEsInputFormWidth?: string;
1092
+ confirmButtonBottomPadding?: string;
1093
+ };
1094
+ /** Dropzone/code editor theme settings */
1095
+ dropzone?: {
1096
+ codeFont?: string;
1097
+ };
1098
+ /** Slidebar/sidebar theme settings */
1099
+ slidebar?: {
1100
+ padding?: string;
1101
+ margin?: string;
1102
+ titleFontSize?: string;
1103
+ titleFontWeight?: string;
1104
+ };
1105
+ /** Editor panel (tabs, property pane) theme settings */
1106
+ editorPanel?: {
1107
+ smallBorderRadius?: string;
1108
+ rewardsInputWidth?: string;
1109
+ errorNotificationBackgroundColor?: string;
1110
+ errorNotificationLeftPadding?: string;
1111
+ tabsBackgroundColor?: string;
1112
+ tabBackgroundColor?: string;
1113
+ tabsDeviceBackgroundColor?: string;
1114
+ tabHoverBackgroundColor?: string;
1115
+ tabHoverColor?: string;
1116
+ tabBorderRadius?: string;
1117
+ borderLeftWidthSelected?: string;
1118
+ borderTopWidthSelected?: string;
1119
+ borderRightWidthSelected?: string;
1120
+ borderBottomWidthSelected?: string;
1121
+ borderBottomWidth?: string;
1122
+ tabPadding?: string;
1123
+ tabHeaderPadding?: string;
1124
+ tabButtonPadding?: string;
1125
+ tabHeight?: string;
1126
+ tabGap?: string;
1127
+ };
1128
+ /** Editor inputs theme settings */
1129
+ editorInputs?: {
1130
+ selectDefaultAlignItems?: string;
1131
+ selectDefaultJustifyContent?: string;
1132
+ selectInputDefaultMinHeight?: string;
1133
+ selectInputDefaultLineHeight?: string;
1134
+ inputDefaultMinWidth?: string;
1135
+ inputSmallMinWidth?: string;
1136
+ selectBodyWidth?: string;
1137
+ searchInputBoxShadow?: string;
1138
+ searchInputBackgroundIconColor?: string;
1139
+ searchInputBorderRadius?: string;
1140
+ searchInputBackgroundActiveColor?: string;
1141
+ searchInputBorderActiveColorHover?: string;
1142
+ searchInputBackgroundActiveMargin?: string;
1143
+ selectTextParamsWidth?: string;
1144
+ };
1145
+ }
1146
+ /**
1147
+ * Data returned by {@link EditorApiConfigI.getWidgetData}.
1148
+ * Contains all information needed to initialize the editor.
1149
+ */
1150
+ export interface ResolvedDataI {
1151
+ /** Main widget data */
1152
+ widgetData: ResolvedWidgetDataI;
1153
+ /** Teaser (minimized widget) data, if enabled */
1154
+ teaserData: ResolvedWidgetDataI | null;
1155
+ /** Available languages for the widget */
1156
+ languages: FormLanguageI[];
1157
+ /** Current user information */
1158
+ userInfo: UserInfoDtoI;
1159
+ /** List of widgets that can be linked */
1160
+ linkedWidgets: FormsListItemI[];
1161
+ /** Prize pools for gamification widgets */
1162
+ prizePools?: PrizePoolModelI[];
1163
+ /** Widget type for creating new widget mock when widget data is absent */
1164
+ widgetType?: EsWidgetType;
1165
+ /** Layout type for creating new widget mock when widget data is absent */
1166
+ layoutType?: EsWidgetLayoutType;
1167
+ }
1168
+ /**
1169
+ * Widget-specific data within {@link ResolvedDataI}.
1170
+ */
1171
+ export interface ResolvedWidgetDataI {
1172
+ /** Widget variant (form) data */
1173
+ variant: EsFormVariantI;
1174
+ /** All appearances (desktop, mobile, etc.) */
1175
+ appearances: EsFormAppearanceI[];
1176
+ /** Latest saved revision */
1177
+ latestRevision: WidgetRevisionI | null;
1178
+ /** Currently loaded revision */
1179
+ currentRevision: WidgetRevisionI | null;
1180
+ /** Current publish status */
1181
+ publishStatus: FormPublishStatus | null;
1182
+ }
1183
+ /**
1184
+ * Data passed to {@link EditorApiConfigI.saveWidgetData}.
1185
+ * Contains both original and modified data for comparison.
1186
+ */
1187
+ export interface DataToSaveI {
1188
+ /** Main widget data to save */
1189
+ widgetData: WidgetDataToSaveI;
1190
+ /** Teaser data to save, if enabled */
1191
+ teaserData: WidgetDataToSaveI | null;
1192
+ /** Original project configs (for comparison) */
1193
+ pristineConfigs: WidgetProjectConfigI[];
1194
+ /** Modified project configs */
1195
+ updatedConfigs: WidgetProjectConfigI[];
1196
+ /** Whether to publish changes immediately */
1197
+ publishChanges: boolean;
1198
+ }
1199
+ /**
1200
+ * Widget-specific data within {@link DataToSaveI}.
1201
+ */
1202
+ export interface WidgetDataToSaveI {
1203
+ /** Original appearances (for comparison) */
1204
+ pristineAppearances: EsFormAppearanceI[];
1205
+ /** Modified appearances */
1206
+ updatedAppearances: EsFormAppearanceI[];
1207
+ /** Original variant (for comparison) */
1208
+ pristineVariant: FormVariantI;
1209
+ /** Modified variant */
1210
+ updatedVariant: FormVariantI;
1211
+ /** Current publish status */
1212
+ publishStatus: FormPublishStatus | null;
1213
+ }
1214
+ /**
1215
+ * HTTP API configuration for all editor operations.
1216
+ * All methods can return either Promise or Observable based on {@link EditorConfigI.defaultAsyncPattern}.
1217
+ *
1218
+ * @example
1219
+ * ```typescript
1220
+ * const api: EditorApiConfigI = {
1221
+ * getWidgetData: () => fetch('/api/widget').then(r => r.json()),
1222
+ * saveWidgetData: (data) => fetch('/api/widget', {
1223
+ * method: 'POST',
1224
+ * body: JSON.stringify(data)
1225
+ * }),
1226
+ * // ... other methods
1227
+ * };
1228
+ * ```
1229
+ */
1230
+ export interface EditorApiConfigI {
1231
+ /** Fetch initial widget data for editor initialization */
1232
+ getWidgetData: () => Observable<ResolvedDataI> | Promise<ResolvedDataI>;
1233
+ /** Save widget data (appearances, variant, configs) */
1234
+ saveWidgetData: (data: DataToSaveI) => Observable<void> | Promise<void>;
1235
+ /** Fetch appearances for a specific widget */
1236
+ getWidgetAppearances: (payload: GetWidgetAppearancesPayloadI) => Observable<EsFormAppearanceI[]> | Promise<EsFormAppearanceI[]>;
1237
+ /** Create a new widget revision (save point) */
1238
+ createWidgetRevision: (payload: CreateWidgetRevisionPayloadI) => Observable<CreateWidgetRevisionResponseI> | Promise<CreateWidgetRevisionResponseI>;
1239
+ /** Fetch list of widgets for linking */
1240
+ getWidgetsList: (params: BaseFormsListRequestParamsI) => Observable<BaseListDtoI<FormsListItemI>> | Promise<BaseListDtoI<FormsListItemI>>;
1241
+ /** Get files from common directory (icons, backgrounds, etc.) */
1242
+ getFilesFromCommonDir: (payload: GetFilesFromCommonDirPayloadI) => Observable<Array<{
1243
+ url: string;
1244
+ }>> | Promise<Array<{
1245
+ url: string;
1246
+ }>>;
1247
+ /** Remove an uploaded file */
1248
+ removeFile: (payload: RemoveFilePayloadI) => Observable<void> | Promise<void>;
1249
+ /** Fetch images from the image library */
1250
+ getImageLibrary: (params: ImageLibraryRequestParamsI) => Observable<ImageLibraryResponseDtoI> | Promise<ImageLibraryResponseDtoI>;
1251
+ /** Fetch user-uploaded images */
1252
+ getUserImages: (params: UserImagesRequestParamsI) => Observable<UserImagesResponseDtoI> | Promise<UserImagesResponseDtoI>;
1253
+ /** Upload an image file */
1254
+ uploadImage: (payload: UploadImagePayloadI) => Observable<{
1255
+ url: string;
1256
+ }> | Promise<{
1257
+ url: string;
1258
+ }>;
1259
+ /** Upload an image from URL */
1260
+ uploadImageByUrl: (payload: UploadImageByUrlPayloadI) => Observable<{
1261
+ url: string;
1262
+ }> | Promise<{
1263
+ url: string;
1264
+ }>;
1265
+ /** Copy an image by URL to widget storage */
1266
+ copyImageByUrl: (payload: CopyImageByUrlPayloadI) => Observable<{
1267
+ url: string;
1268
+ }> | Promise<{
1269
+ url: string;
1270
+ }>;
1271
+ /** Create a new prize pool for gamification */
1272
+ createWidgetPrizePool(body: PrizePoolModelI): Observable<{
1273
+ id: string;
1274
+ }> | Promise<{
1275
+ id: string;
1276
+ }>;
1277
+ /** Update prize options in a prize pool */
1278
+ updateWidgetPrizeOptions(payload: UpdateWidgetPrizeOptionsPayloadI): Observable<void> | Promise<void>;
1279
+ /** Translate text content */
1280
+ translate: (params: TranslateRequestI) => Observable<{
1281
+ response: TranslateRequestJsonI;
1282
+ }> | Promise<{
1283
+ response: TranslateRequestJsonI;
1284
+ }>;
1285
+ /** Enable/disable auto-translation */
1286
+ setAutoTranslate?: (payload: SetAutoTranslatePayloadI) => void;
1287
+ /** Fetch available contact mapping options */
1288
+ getContactMappingOptions: () => Observable<ClContactMappingOptionI[]> | Promise<ClContactMappingOptionI[]>;
1289
+ /** Fetch contact field groups */
1290
+ getContactFieldGroups?: () => Observable<EsAdditionalFieldsListI[]> | Promise<EsAdditionalFieldsListI[]>;
1291
+ /** Create a new widget */
1292
+ createWidget?: (payload: CreateFormParamsI) => Observable<CreateWidgetResponseI> | Promise<CreateWidgetResponseI>;
1293
+ }
1294
+ /**
1295
+ * Payload for {@link EditorApiConfigI.getWidgetAppearances}.
1296
+ */
1297
+ export interface GetWidgetAppearancesPayloadI {
1298
+ /** Widget ID */
1299
+ widgetId: number;
1300
+ /** Variant ID */
1301
+ variantId: number;
1302
+ }
1303
+ /**
1304
+ * Payload for {@link EditorApiConfigI.createWidgetRevision}.
1305
+ */
1306
+ export interface CreateWidgetRevisionPayloadI extends CreateWidgetRevisionRequestI {
1307
+ /** Widget ID */
1308
+ widgetId: number;
1309
+ /** Revision ID */
1310
+ revisionId: string;
1311
+ }
1312
+ /**
1313
+ * Payload for {@link EditorApiConfigI.getFilesFromCommonDir}.
1314
+ */
1315
+ export interface GetFilesFromCommonDirPayloadI {
1316
+ /** Type of files to retrieve (icons, backgrounds, etc.) */
1317
+ type?: TypeOfFilesFromCommonDir;
1318
+ }
1319
+ /**
1320
+ * Payload for {@link EditorApiConfigI.removeFile}.
1321
+ */
1322
+ export interface RemoveFilePayloadI {
1323
+ /** URL of the file to remove */
1324
+ fileUrl: string;
1325
+ /** Widget ID that owns the file */
1326
+ widgetId: number;
1327
+ }
1328
+ /**
1329
+ * Payload for {@link EditorApiConfigI.uploadImage}.
1330
+ */
1331
+ export interface UploadImagePayloadI {
1332
+ /** FormData containing the image file */
1333
+ file: FormData;
1334
+ /** Widget ID to associate the image with */
1335
+ widgetId: number;
1336
+ /** Optional image type category */
1337
+ type?: string;
1338
+ }
1339
+ /**
1340
+ * Payload for {@link EditorApiConfigI.uploadImageByUrl}.
1341
+ */
1342
+ export interface UploadImageByUrlPayloadI {
1343
+ /** URL of the image to upload */
1344
+ imageUrl: string;
1345
+ /** Widget ID to associate the image with */
1346
+ widgetId: number;
1347
+ }
1348
+ /**
1349
+ * Payload for {@link EditorApiConfigI.copyImageByUrl}.
1350
+ */
1351
+ export interface CopyImageByUrlPayloadI {
1352
+ /** URL of the image to copy */
1353
+ imageUrl: string;
1354
+ /** Widget ID to associate the copied image with */
1355
+ widgetId: number;
1356
+ /** Type category for the copied image */
1357
+ type?: TypeOfFilesFromCommonDir;
1358
+ }
1359
+ /**
1360
+ * Payload for {@link EditorApiConfigI.updateWidgetPrizeOptions}.
1361
+ */
1362
+ export interface UpdateWidgetPrizeOptionsPayloadI {
1363
+ /** Prize pool ID */
1364
+ poolId: string;
1365
+ /** Updated prize options */
1366
+ options: PrizePoolOptionI[];
1367
+ }
1368
+ /**
1369
+ * Payload for {@link EditorApiConfigI.setAutoTranslate}.
1370
+ */
1371
+ export interface SetAutoTranslatePayloadI {
1372
+ /** Enable or disable auto-translation */
1373
+ enabled: boolean;
1374
+ }
1375
+ /**
1376
+ * Payload for {@link EditorApiConfigI.getTemplate}.
1377
+ */
1378
+ export interface GetTemplatePayloadI {
1379
+ /** Template ID to fetch */
1380
+ templateId: number;
1381
+ }
1382
+ /**
1383
+ * Response from {@link EditorApiConfigI.createWidget}.
1384
+ */
1385
+ export interface CreateWidgetResponseI {
1386
+ /** Created widget variant */
1387
+ variant: FormVariantI;
1388
+ /** Created widget appearances */
1389
+ appearances: EsFormAppearanceI[];
1390
+ }
1391
+ /**
1392
+ * Logo configuration for the editor header.
1393
+ * @example
1394
+ * ```typescript
1395
+ * const logo: EditorLogoI = {
1396
+ * imageUrl: 'https://example.com/logo.png',
1397
+ * link: 'https://example.com'
1398
+ * };
1399
+ * ```
1400
+ */
1401
+ export interface EditorLogoI {
1402
+ /** URL of the logo image */
1403
+ imageUrl: string;
1404
+ /** Optional link URL when logo is clicked */
1405
+ link?: string;
1406
+ }
1407
+ /**
1408
+ * Contact mapping option for form field mapping.
1409
+ * Used to map form inputs to contact fields in CDP.
1410
+ */
1411
+ export interface ClContactMappingOptionI {
1412
+ /** Unique identifier for the mapping option */
1413
+ name: string;
1414
+ /** Display label for the option */
1415
+ label: string;
1416
+ /** Group name for categorization */
1417
+ group: string | null;
1418
+ /** Whether this field is used for deduplication */
1419
+ isDedupe: boolean;
1420
+ /** Whether this is a custom field */
1421
+ isCustom: boolean;
1422
+ /** Type of contact mapping */
1423
+ type?: ContactMappingOptionType;
1424
+ /** Predefined values for select-type fields */
1425
+ values?: string[];
1426
+ /** Additional options and limits */
1427
+ options?: ContactMappingOptionLimitsI;
1428
+ /** Flag indicating this is a newly created field */
1429
+ isNew?: boolean;
1430
+ /** Type of additional field (for custom fields) */
1431
+ additionalFieldType?: EsAdditionalFieldType;
1432
+ }
1433
+
1434
+ export {
1435
+ PrizePoolModelI,
1436
+ PrizePoolOptionI,
1437
+ };
1438
+
1439
+ export {};