@claspo/editor 1.0.13 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claspo/editor",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "Claspo Editor SDK and types",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
package/src/index.js CHANGED
@@ -44,7 +44,7 @@ exports.ClComponentSyncState = Object.freeze({
44
44
  ONLY_THIS_CROSS_ENV_WHILE_VALUES_MATCH: "ONLY_THIS_CROSS_ENV_WHILE_VALUES_MATCH",
45
45
  });
46
46
 
47
- exports.PlacementInsertType = Object.freeze({
47
+ exports.WidgetPlacementInsertType = Object.freeze({
48
48
  BEFORE_BEGIN: "BEFORE_BEGIN",
49
49
  AFTER_BEGIN: "AFTER_BEGIN",
50
50
  BEFORE_END: "BEFORE_END",
@@ -76,7 +76,7 @@ exports.ContactMappingOptionType = Object.freeze({
76
76
  UNKNOWN: "unknown",
77
77
  });
78
78
 
79
- exports.FormPublishStatus = Object.freeze({
79
+ exports.WidgetPublishStatus = Object.freeze({
80
80
  FOR_ALL: "FOR_ALL",
81
81
  PAUSED: "PAUSED",
82
82
  DEBUG: "DEBUG",
@@ -87,27 +87,6 @@ exports.FormTestingStatus = Object.freeze({
87
87
  OFF: "OFF",
88
88
  });
89
89
 
90
- exports.EsWidgetLayoutType = Object.freeze({
91
- BUILT_IN: "BUILT_IN",
92
- DETACHED: "DETACHED",
93
- FLOATING_BOX: "FLOATING_BOX",
94
- FLOATING_BAR: "FLOATING_BAR",
95
- LAUNCHER: "LAUNCHER",
96
- CONTENT_LOCKER: "CONTENT_LOCKER",
97
- SLIDE_UP: "SLIDE_UP",
98
- POP_UP: "POP_UP",
99
- BOTTOM_BAR: "BOTTOM_BAR",
100
- });
101
-
102
- exports.EsWidgetType = Object.freeze({
103
- SUBSCRIPTION_FORM: "SUBSCRIPTION_FORM",
104
- INFORMER: "INFORMER",
105
- REQUEST_FORM: "REQUEST_FORM",
106
- LAUNCHER: "LAUNCHER",
107
- AGE_VERIFY: "AGE_VERIFY",
108
- TEASER: "TEASER",
109
- });
110
-
111
90
  exports.EsFormIntegrationType = Object.freeze({
112
91
  WEBHOOK: "webhook",
113
92
  EMBEDDED: "embedded",
package/src/types.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { ClPropertyPaneManifestModelName } from '@claspo/common/component-manifest/PropertyPaneManifest.interface';
2
2
  import { ClBaseComponentI, ClComponentType, ClDocumentActionType, ClDocumentI as CommonDocumentI, ClDocumentSharedI as CommonDocumentSharedI } from '@claspo/common/document/Document.interface';
3
+ import { LayoutType } from '@claspo/common/LayoutType';
3
4
  import { PrizePoolModelI, PrizePoolOptionI } from '@claspo/common/PrizePool.interface';
5
+ import { WidgetType } from '@claspo/common/WidgetType';
4
6
  import LayoutFactory from '@claspo/document-connector/layouts/LayoutFactory';
5
7
  import { Observable } from 'rxjs';
6
8
  declare enum BaseListSortOption {
@@ -64,7 +66,31 @@ export interface ClComponentSyncMapI {
64
66
  syncState: ClComponentSyncState | null;
65
67
  env?: ClPreviewEnvironment;
66
68
  }
67
- declare enum PlacementInsertType {
69
+ export interface BaseListDtoI<T> {
70
+ totalCount: number;
71
+ items: T[];
72
+ }
73
+ export interface UserInfoI {
74
+ userId: number;
75
+ userName: string;
76
+ language: string;
77
+ }
78
+ export interface ComponentTranslateMapI {
79
+ [propPath: string]: string;
80
+ }
81
+ export interface LanguageTranslateState {
82
+ [id: string]: ComponentTranslateMapI;
83
+ }
84
+ export interface TranslateRequestI {
85
+ json: TranslateRequestJsonI;
86
+ sourceLanguage: string;
87
+ targetLanguage: string;
88
+ }
89
+ export interface TranslateRequestJsonI {
90
+ widgetTranslations: LanguageTranslateState;
91
+ teaserTranslations?: LanguageTranslateState;
92
+ }
93
+ declare enum WidgetPlacementInsertType {
68
94
  BEFORE_BEGIN = "BEFORE_BEGIN",
69
95
  AFTER_BEGIN = "AFTER_BEGIN",
70
96
  BEFORE_END = "BEFORE_END",
@@ -132,10 +158,10 @@ export interface ContactMappingOptionLimitsI {
132
158
  MIN_VALUE?: number;
133
159
  ANNUAL?: boolean;
134
160
  }
135
- export interface FormsListItemI {
161
+ export interface WidgetsListItemI {
136
162
  id: number;
137
163
  name: string;
138
- publishStatus: FormPublishStatus;
164
+ publishStatus: WidgetPublishStatus;
139
165
  testingStatus: FormTestingStatus;
140
166
  fullyConfigured: boolean;
141
167
  createdDate: string;
@@ -143,11 +169,11 @@ export interface FormsListItemI {
143
169
  draft: boolean;
144
170
  variantIds: number[];
145
171
  abTestId: number | null;
146
- config: EsFormVariantI;
172
+ config: WidgetVariantDtoI;
147
173
  restrictions?: EsFormRestrictionI;
148
174
  deleted?: boolean;
149
175
  }
150
- export declare enum FormPublishStatus {
176
+ export declare enum WidgetPublishStatus {
151
177
  FOR_ALL = "FOR_ALL",
152
178
  PAUSED = "PAUSED",// teaser disabled. Any other status means that teaser is enabled and status works as usual
153
179
  DEBUG = "DEBUG"
@@ -156,14 +182,14 @@ declare enum FormTestingStatus {
156
182
  TESTING = "TESTING",
157
183
  OFF = "OFF"
158
184
  }
159
- export interface EsFormI {
185
+ export interface WidgetModelI {
160
186
  id: number;
161
187
  name: string;
162
- publishStatus: FormPublishStatus;
188
+ publishStatus: WidgetPublishStatus;
163
189
  createdDate: string;
164
190
  updatedDate: string;
165
- variants: EsFormVariantI[];
166
- config: EsFormVariantI;
191
+ variants: WidgetVariantDtoI[];
192
+ config: WidgetVariantDtoI;
167
193
  }
168
194
  export interface EsFormRestrictionI {
169
195
  BRANDED?: EsFormBrandingI;
@@ -171,45 +197,26 @@ export interface EsFormRestrictionI {
171
197
  export interface EsFormBrandingI {
172
198
  reason?: string;
173
199
  }
174
- export interface EsFormVariantI {
200
+ export interface WidgetVariantDtoI {
175
201
  formId: number;
176
202
  id: number;
177
- config: EsFormVariantConfigI;
178
- appearances: EsFormVariantAppearanceI[];
203
+ config: WidgetVariantConfigDtoI;
204
+ appearances: WidgetAppearanceBriefI[];
179
205
  linkedToVariantId: number;
180
- type: EsWidgetType;
206
+ type: WidgetType;
181
207
  revision?: string;
182
208
  publishedRevision?: string;
183
209
  }
184
- export interface EsFormVariantConfigI {
185
- type: EsWidgetLayoutType;
186
- placements?: EsFormVariantPlacementI[];
210
+ export interface WidgetVariantConfigDtoI {
211
+ type: LayoutType;
212
+ placements?: WidgetPlacementI[];
187
213
  prizePoolIds?: string[];
188
214
  }
189
- export declare enum EsWidgetLayoutType {
190
- BUILT_IN = "BUILT_IN",
191
- DETACHED = "DETACHED",
192
- FLOATING_BOX = "FLOATING_BOX",
193
- FLOATING_BAR = "FLOATING_BAR",
194
- LAUNCHER = "LAUNCHER",
195
- CONTENT_LOCKER = "CONTENT_LOCKER",
196
- SLIDE_UP = "SLIDE_UP",
197
- POP_UP = "POP_UP",
198
- BOTTOM_BAR = "BOTTOM_BAR"
199
- }
200
- export declare enum EsWidgetType {
201
- SUBSCRIPTION_FORM = "SUBSCRIPTION_FORM",
202
- INFORMER = "INFORMER",
203
- REQUEST_FORM = "REQUEST_FORM",
204
- LAUNCHER = "LAUNCHER",
205
- AGE_VERIFY = "AGE_VERIFY",
206
- TEASER = "TEASER"
207
- }
208
- export interface EsFormVariantPlacementI {
215
+ export interface WidgetPlacementI {
209
216
  selector: string | null;
210
- insertType: PlacementInsertType | null;
217
+ insertType: WidgetPlacementInsertType | null;
211
218
  }
212
- export interface EsFormVariantAppearanceI {
219
+ export interface WidgetAppearanceBriefI {
213
220
  id: number | string;
214
221
  language: string | null;
215
222
  origin: boolean | null;
@@ -232,7 +239,7 @@ export interface EsFormIntegrationParamsI {
232
239
  uuid: string;
233
240
  consumers?: string[];
234
241
  }
235
- export interface EsFormAppearanceI {
242
+ export interface WidgetAppearanceI {
236
243
  id: number | string;
237
244
  origin: boolean;
238
245
  language: string | null;
@@ -244,64 +251,40 @@ export interface EsFormAppearanceI {
244
251
  revision?: string;
245
252
  publishedRevision?: string;
246
253
  }
247
- export interface FormLanguageI {
254
+ export interface WidgetLanguageI {
248
255
  languageCode: string;
249
256
  name: string;
250
257
  localisation: MessageLanguageLocalisationI;
251
258
  }
252
- export interface FormVariantI {
259
+ export interface WidgetVariantI {
253
260
  formId: number;
254
261
  id: number;
255
- config: FormVariantConfigI;
256
- appearances: EsFormVariantAppearanceI[];
262
+ config: WidgetVariantConfigI;
263
+ appearances: WidgetAppearanceBriefI[];
257
264
  linkedToVariantId: number | null;
258
- type: EsWidgetType;
265
+ type: WidgetType;
259
266
  revision: string | null;
260
267
  publishedRevision: string | null;
261
268
  }
262
- export interface FormVariantConfigI {
263
- type: EsWidgetLayoutType;
264
- placements: EsFormVariantPlacementI[];
269
+ export interface WidgetVariantConfigI {
270
+ type: LayoutType;
271
+ placements: WidgetPlacementI[];
265
272
  prizePoolIds?: string[];
266
273
  }
267
- export interface BaseListDtoI<T> {
268
- totalCount: number;
269
- items: T[];
270
- }
271
- export interface UserInfoI {
272
- userId: number;
273
- userName: string;
274
- language: string;
275
- }
276
- export interface ComponentTranslateMapI {
277
- [propPath: string]: string;
278
- }
279
- export interface LanguageTranslateState {
280
- [id: string]: ComponentTranslateMapI;
281
- }
282
- export interface TranslateRequestI {
283
- json: TranslateRequestJsonI;
284
- sourceLanguage: string;
285
- targetLanguage: string;
286
- }
287
- export interface TranslateRequestJsonI {
288
- widgetTranslations: LanguageTranslateState;
289
- teaserTranslations?: LanguageTranslateState;
290
- }
291
274
  export interface CreateWidgetRevisionRequestI {
292
275
  changesSaved: boolean;
293
276
  payload: WidgetRevisionPayloadI;
294
277
  }
295
278
  export interface WidgetRevisionPayloadI {
296
- type: EsWidgetType;
279
+ type: WidgetType;
297
280
  presentation: WidgetRevisionPresentationI;
298
281
  appearances: WidgetRevisionAppearanceI[];
299
282
  prizePoolIds?: string[];
300
- publishStatus?: FormPublishStatus;
283
+ publishStatus?: WidgetPublishStatus;
301
284
  linkedTo?: number | null;
302
285
  }
303
286
  export interface WidgetRevisionPresentationI {
304
- type: EsWidgetLayoutType;
287
+ type: LayoutType;
305
288
  }
306
289
  export interface WidgetRevisionAppearanceI {
307
290
  id: number | string;
@@ -338,16 +321,16 @@ export declare enum WidgetProjectConfigId {
338
321
  CABINET_AB_TESTS = "CABINET_AB_TESTS"
339
322
  }
340
323
  export interface BaseFormsListRequestParamsI {
341
- layoutTypes?: EsWidgetLayoutType[];
324
+ layoutTypes?: LayoutType[];
342
325
  order?: BaseListOrderOption;
343
326
  search?: string;
344
327
  offset?: number;
345
328
  limit?: number;
346
329
  sort?: BaseListSortOption;
347
- types?: EsWidgetType[];
330
+ types?: WidgetType[];
348
331
  projectId?: number;
349
332
  filters?: FormListRequestFilter;
350
- publishStatus?: FormPublishStatus;
333
+ publishStatus?: WidgetPublishStatus;
351
334
  publishDateFrom?: string;
352
335
  publishDateTo?: string;
353
336
  withDeleted?: boolean;
@@ -361,14 +344,14 @@ declare enum FormListRequestFilter {
361
344
  export interface CreateFormParamsI {
362
345
  name: string;
363
346
  variant: CreateFormParamsVariantI;
364
- publishStatus?: FormPublishStatus;
347
+ publishStatus?: WidgetPublishStatus;
365
348
  }
366
349
  export interface CreateFormParamsVariantI {
367
350
  description: string;
368
- type: EsWidgetType;
369
- config: EsFormVariantConfigI;
351
+ type: WidgetType;
352
+ config: WidgetVariantConfigDtoI;
370
353
  integration: EsFormVariantIntegrationV2I | null;
371
- appearances: EsFormAppearanceI[];
354
+ appearances: WidgetAppearanceI[];
372
355
  draft: boolean;
373
356
  linkedToVariantId?: number;
374
357
  }
@@ -526,7 +509,7 @@ export interface EditorConfigI {
526
509
  /** Available languages for multilingual versions of the same widget
527
510
  * @default A set of popular languages will be used
528
511
  * */
529
- languagesForMultilingualVersions?: FormLanguageI[];
512
+ languagesForMultilingualVersions?: WidgetLanguageI[];
530
513
  /**
531
514
  * Callback fired on initial data loading errors.
532
515
  * If not provided, default error UI will be shown.
@@ -694,7 +677,7 @@ export interface TeaserFeatureConfigI {
694
677
  /** Default document model for new teasers */
695
678
  defaultDocumentModel: ClDocumentI;
696
679
  /** Layouts where teaser is available */
697
- enabledForLayouts?: EsWidgetLayoutType[];
680
+ enabledForLayouts?: LayoutType[];
698
681
  /** Component panel configuration for teaser editor */
699
682
  availableComponentsPanel?: AvailableComponentsPanelConfigI;
700
683
  }
@@ -703,18 +686,18 @@ export interface TeaserFeatureConfigI {
703
686
  */
704
687
  export interface CloseEditorCallbackPayloadI {
705
688
  /** Current widget variant data */
706
- variant: FormVariantI;
689
+ variant: WidgetVariantI;
707
690
  }
708
691
  /**
709
692
  * Payload passed to {@link EditorConfigI.getRevisionPayloadCallback}.
710
693
  */
711
694
  export interface GetRevisionPayloadCallbackPayloadI {
712
695
  /** Current widget variant */
713
- variant: FormVariantI;
696
+ variant: WidgetVariantI;
714
697
  /** All widget appearances (desktop, mobile, etc.) */
715
- appearances: EsFormAppearanceI[];
698
+ appearances: WidgetAppearanceI[];
716
699
  /** Current publish status */
717
- publishStatus: FormPublishStatus | null;
700
+ publishStatus: WidgetPublishStatus | null;
718
701
  }
719
702
  /**
720
703
  * Payload passed to {@link EditorConfigI.initialLoadErrorCallback}.
@@ -960,7 +943,7 @@ export interface ResolvedDataI {
960
943
  /** Teaser (minimized widget) data, if enabled */
961
944
  teaserData: ResolvedWidgetDataI | null;
962
945
  /** List of widgets that can be linked */
963
- linkedWidgets: FormsListItemI[];
946
+ linkedWidgets: WidgetsListItemI[];
964
947
  /** Prize pools for gamification widgets */
965
948
  prizePools?: PrizePoolModelI[];
966
949
  }
@@ -969,15 +952,15 @@ export interface ResolvedDataI {
969
952
  */
970
953
  export interface ResolvedWidgetDataI {
971
954
  /** Widget variant (form) data */
972
- variant: EsFormVariantI;
955
+ variant: WidgetVariantDtoI;
973
956
  /** All appearances (desktop, mobile, etc.) */
974
- appearances: EsFormAppearanceI[];
957
+ appearances: WidgetAppearanceI[];
975
958
  /** Latest saved revision */
976
959
  latestRevision: WidgetRevisionI | null;
977
960
  /** Currently loaded revision */
978
961
  currentRevision: WidgetRevisionI | null;
979
962
  /** Current publish status */
980
- publishStatus: FormPublishStatus | null;
963
+ publishStatus: WidgetPublishStatus | null;
981
964
  }
982
965
  /**
983
966
  * Data passed to {@link EditorApiConfigI.saveWidgetData}.
@@ -1000,15 +983,15 @@ export interface DataToSaveI {
1000
983
  */
1001
984
  export interface WidgetDataToSaveI {
1002
985
  /** Original appearances (for comparison) */
1003
- pristineAppearances: EsFormAppearanceI[];
986
+ pristineAppearances: WidgetAppearanceI[];
1004
987
  /** Modified appearances */
1005
- updatedAppearances: EsFormAppearanceI[];
988
+ updatedAppearances: WidgetAppearanceI[];
1006
989
  /** Original variant (for comparison) */
1007
- pristineVariant: FormVariantI;
990
+ pristineVariant: WidgetVariantI;
1008
991
  /** Modified variant */
1009
- updatedVariant: FormVariantI;
992
+ updatedVariant: WidgetVariantI;
1010
993
  /** Current publish status */
1011
- publishStatus: FormPublishStatus | null;
994
+ publishStatus: WidgetPublishStatus | null;
1012
995
  }
1013
996
  /**
1014
997
  * HTTP API configuration for all editor operations.
@@ -1032,11 +1015,11 @@ export interface EditorApiConfigI {
1032
1015
  /** Save widget data (appearances, variant, configs) */
1033
1016
  saveWidgetData: (data: DataToSaveI) => Observable<void> | Promise<void>;
1034
1017
  /** Fetch appearances for a specific widget */
1035
- getWidgetAppearances: (payload: GetWidgetAppearancesPayloadI) => Observable<EsFormAppearanceI[]> | Promise<EsFormAppearanceI[]>;
1018
+ getWidgetAppearances: (payload: GetWidgetAppearancesPayloadI) => Observable<WidgetAppearanceI[]> | Promise<WidgetAppearanceI[]>;
1036
1019
  /** Create a new widget revision (save point) */
1037
1020
  createWidgetRevision: (payload: CreateWidgetRevisionPayloadI) => Observable<CreateWidgetRevisionResponseI> | Promise<CreateWidgetRevisionResponseI>;
1038
1021
  /** Fetch list of widgets for linking */
1039
- getWidgetsList: (params: BaseFormsListRequestParamsI) => Observable<BaseListDtoI<FormsListItemI>> | Promise<BaseListDtoI<FormsListItemI>>;
1022
+ getWidgetsList: (params: BaseFormsListRequestParamsI) => Observable<BaseListDtoI<WidgetsListItemI>> | Promise<BaseListDtoI<WidgetsListItemI>>;
1040
1023
  /** Get files from common directory (icons, backgrounds, etc.) */
1041
1024
  getFilesFromCommonDir: (payload: GetFilesFromCommonDirPayloadI) => Observable<Array<{
1042
1025
  url: string;
@@ -1181,9 +1164,9 @@ export interface GetTemplatePayloadI {
1181
1164
  */
1182
1165
  export interface CreateWidgetResponseI {
1183
1166
  /** Created widget variant */
1184
- variant: FormVariantI;
1167
+ variant: WidgetVariantI;
1185
1168
  /** Created widget appearances */
1186
- appearances: EsFormAppearanceI[];
1169
+ appearances: WidgetAppearanceI[];
1187
1170
  }
1188
1171
  /**
1189
1172
  * Logo configuration for the editor header.
@@ -1229,8 +1212,10 @@ export interface ClContactMappingOptionI {
1229
1212
  }
1230
1213
 
1231
1214
  export {
1215
+ LayoutType,
1232
1216
  PrizePoolModelI,
1233
1217
  PrizePoolOptionI,
1218
+ WidgetType,
1234
1219
  };
1235
1220
 
1236
1221
  export {};