@claspo/editor 1.0.13 → 1.0.15

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.15",
4
4
  "description": "Claspo Editor SDK and types",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -19,6 +19,7 @@
19
19
  "build:types": "node scripts/build-types.js && node scripts/types-postprocessing.js && node scripts/generate-enum-values.js",
20
20
  "build:docs": "typedoc --options typedoc.md.json && node scripts/postprocess-md.js && node scripts/add-frontmatter.js",
21
21
  "build:all": "npm run build:types && npm run build:docs",
22
+ "sync:docs": "node ../../../scripts/sync-docs.js --package=editor",
22
23
 
23
24
  "generate-reexports": "echo 'DO NOT CALL IT, WILL REWRITE editor-config.interface.ts' && node scripts/generate-esng-reexports.js"
24
25
  },
@@ -29,8 +30,8 @@
29
30
  },
30
31
  "peerDependencies": {
31
32
  "rxjs": ">=6.0.0",
32
- "@claspo/common": "6.0.6",
33
- "@claspo/document-connector": "15.0.5"
33
+ "@claspo/common": "6.0.14",
34
+ "@claspo/document-connector": "15.0.12"
34
35
  },
35
36
  "peerDependenciesMeta": {
36
37
  "rxjs": { "optional": true }
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,38 +76,12 @@ 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",
83
83
  });
84
84
 
85
- exports.FormTestingStatus = Object.freeze({
86
- TESTING: "TESTING",
87
- OFF: "OFF",
88
- });
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
85
  exports.EsFormIntegrationType = Object.freeze({
112
86
  WEBHOOK: "webhook",
113
87
  EMBEDDED: "embedded",
package/src/types.d.ts CHANGED
@@ -1,6 +1,9 @@
1
+ import { ComponentManifestI } from '@claspo/common/component-manifest/ComponentManifest.interface';
1
2
  import { ClPropertyPaneManifestModelName } from '@claspo/common/component-manifest/PropertyPaneManifest.interface';
2
- import { ClBaseComponentI, ClComponentType, ClDocumentActionType, ClDocumentI as CommonDocumentI, ClDocumentSharedI as CommonDocumentSharedI } from '@claspo/common/document/Document.interface';
3
+ import { ClBaseComponentI, ClBaseComponentI as ClBaseComponentI$1, ClComponentType, ClDocumentActionType, ClDocumentI as CommonDocumentI, ClDocumentSharedI as CommonDocumentSharedI } from '@claspo/common/document/Document.interface';
4
+ import { LayoutType, LayoutType as LayoutType$1 } from '@claspo/common/LayoutType';
3
5
  import { PrizePoolModelI, PrizePoolOptionI } from '@claspo/common/PrizePool.interface';
6
+ import { WidgetType, WidgetType as WidgetType$1 } from '@claspo/common/WidgetType';
4
7
  import LayoutFactory from '@claspo/document-connector/layouts/LayoutFactory';
5
8
  import { Observable } from 'rxjs';
6
9
  declare enum BaseListSortOption {
@@ -64,7 +67,31 @@ export interface ClComponentSyncMapI {
64
67
  syncState: ClComponentSyncState | null;
65
68
  env?: ClPreviewEnvironment;
66
69
  }
67
- declare enum PlacementInsertType {
70
+ export interface BaseListDtoI<T> {
71
+ totalCount: number;
72
+ items: T[];
73
+ }
74
+ export interface UserInfoI {
75
+ userId: number;
76
+ userName: string;
77
+ language: string;
78
+ }
79
+ export interface ComponentTranslateMapI {
80
+ [propPath: string]: string;
81
+ }
82
+ export interface LanguageTranslateState {
83
+ [id: string]: ComponentTranslateMapI;
84
+ }
85
+ export interface TranslateRequestI {
86
+ json: TranslateRequestJsonI;
87
+ sourceLanguage: string;
88
+ targetLanguage: string;
89
+ }
90
+ export interface TranslateRequestJsonI {
91
+ widgetTranslations: LanguageTranslateState;
92
+ teaserTranslations?: LanguageTranslateState;
93
+ }
94
+ declare enum WidgetPlacementInsertType {
68
95
  BEFORE_BEGIN = "BEFORE_BEGIN",
69
96
  AFTER_BEGIN = "AFTER_BEGIN",
70
97
  BEFORE_END = "BEFORE_END",
@@ -132,84 +159,49 @@ export interface ContactMappingOptionLimitsI {
132
159
  MIN_VALUE?: number;
133
160
  ANNUAL?: boolean;
134
161
  }
135
- export interface FormsListItemI {
162
+ export interface WidgetsListItemI {
136
163
  id: number;
137
164
  name: string;
138
- publishStatus: FormPublishStatus;
139
- testingStatus: FormTestingStatus;
140
- fullyConfigured: boolean;
165
+ publishStatus: WidgetPublishStatus;
141
166
  createdDate: string;
142
167
  updatedDate: string;
143
- draft: boolean;
144
168
  variantIds: number[];
145
- abTestId: number | null;
146
- config: EsFormVariantI;
147
- restrictions?: EsFormRestrictionI;
148
- deleted?: boolean;
169
+ config: WidgetVariantDtoI;
149
170
  }
150
- export declare enum FormPublishStatus {
171
+ export declare enum WidgetPublishStatus {
151
172
  FOR_ALL = "FOR_ALL",
152
173
  PAUSED = "PAUSED",// teaser disabled. Any other status means that teaser is enabled and status works as usual
153
174
  DEBUG = "DEBUG"
154
175
  }
155
- declare enum FormTestingStatus {
156
- TESTING = "TESTING",
157
- OFF = "OFF"
158
- }
159
- export interface EsFormI {
176
+ export interface WidgetModelI {
160
177
  id: number;
161
178
  name: string;
162
- publishStatus: FormPublishStatus;
179
+ publishStatus: WidgetPublishStatus;
163
180
  createdDate: string;
164
181
  updatedDate: string;
165
- variants: EsFormVariantI[];
166
- config: EsFormVariantI;
182
+ variants: WidgetVariantDtoI[];
183
+ config: WidgetVariantDtoI;
167
184
  }
168
- export interface EsFormRestrictionI {
169
- BRANDED?: EsFormBrandingI;
170
- }
171
- export interface EsFormBrandingI {
172
- reason?: string;
173
- }
174
- export interface EsFormVariantI {
185
+ export interface WidgetVariantDtoI {
175
186
  formId: number;
176
187
  id: number;
177
- config: EsFormVariantConfigI;
178
- appearances: EsFormVariantAppearanceI[];
188
+ config: WidgetVariantConfigDtoI;
189
+ appearances: WidgetAppearanceBriefI[];
179
190
  linkedToVariantId: number;
180
- type: EsWidgetType;
191
+ type: WidgetType;
181
192
  revision?: string;
182
193
  publishedRevision?: string;
183
194
  }
184
- export interface EsFormVariantConfigI {
185
- type: EsWidgetLayoutType;
186
- placements?: EsFormVariantPlacementI[];
195
+ export interface WidgetVariantConfigDtoI {
196
+ type: LayoutType$1;
197
+ placements?: WidgetPlacementI[];
187
198
  prizePoolIds?: string[];
188
199
  }
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 {
200
+ export interface WidgetPlacementI {
209
201
  selector: string | null;
210
- insertType: PlacementInsertType | null;
202
+ insertType: WidgetPlacementInsertType | null;
211
203
  }
212
- export interface EsFormVariantAppearanceI {
204
+ export interface WidgetAppearanceBriefI {
213
205
  id: number | string;
214
206
  language: string | null;
215
207
  origin: boolean | null;
@@ -232,7 +224,7 @@ export interface EsFormIntegrationParamsI {
232
224
  uuid: string;
233
225
  consumers?: string[];
234
226
  }
235
- export interface EsFormAppearanceI {
227
+ export interface WidgetAppearanceI {
236
228
  id: number | string;
237
229
  origin: boolean;
238
230
  language: string | null;
@@ -244,64 +236,40 @@ export interface EsFormAppearanceI {
244
236
  revision?: string;
245
237
  publishedRevision?: string;
246
238
  }
247
- export interface FormLanguageI {
239
+ export interface WidgetLanguageI {
248
240
  languageCode: string;
249
241
  name: string;
250
242
  localisation: MessageLanguageLocalisationI;
251
243
  }
252
- export interface FormVariantI {
244
+ export interface WidgetVariantI {
253
245
  formId: number;
254
246
  id: number;
255
- config: FormVariantConfigI;
256
- appearances: EsFormVariantAppearanceI[];
247
+ config: WidgetVariantConfigI;
248
+ appearances: WidgetAppearanceBriefI[];
257
249
  linkedToVariantId: number | null;
258
- type: EsWidgetType;
250
+ type: WidgetType;
259
251
  revision: string | null;
260
252
  publishedRevision: string | null;
261
253
  }
262
- export interface FormVariantConfigI {
263
- type: EsWidgetLayoutType;
264
- placements: EsFormVariantPlacementI[];
254
+ export interface WidgetVariantConfigI {
255
+ type: LayoutType$1;
256
+ placements: WidgetPlacementI[];
265
257
  prizePoolIds?: string[];
266
258
  }
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
259
  export interface CreateWidgetRevisionRequestI {
292
260
  changesSaved: boolean;
293
261
  payload: WidgetRevisionPayloadI;
294
262
  }
295
263
  export interface WidgetRevisionPayloadI {
296
- type: EsWidgetType;
264
+ type: WidgetType;
297
265
  presentation: WidgetRevisionPresentationI;
298
266
  appearances: WidgetRevisionAppearanceI[];
299
267
  prizePoolIds?: string[];
300
- publishStatus?: FormPublishStatus;
268
+ publishStatus?: WidgetPublishStatus;
301
269
  linkedTo?: number | null;
302
270
  }
303
271
  export interface WidgetRevisionPresentationI {
304
- type: EsWidgetLayoutType;
272
+ type: LayoutType$1;
305
273
  }
306
274
  export interface WidgetRevisionAppearanceI {
307
275
  id: number | string;
@@ -338,16 +306,16 @@ export declare enum WidgetProjectConfigId {
338
306
  CABINET_AB_TESTS = "CABINET_AB_TESTS"
339
307
  }
340
308
  export interface BaseFormsListRequestParamsI {
341
- layoutTypes?: EsWidgetLayoutType[];
309
+ layoutTypes?: LayoutType$1[];
342
310
  order?: BaseListOrderOption;
343
311
  search?: string;
344
312
  offset?: number;
345
313
  limit?: number;
346
314
  sort?: BaseListSortOption;
347
- types?: EsWidgetType[];
315
+ types?: WidgetType[];
348
316
  projectId?: number;
349
317
  filters?: FormListRequestFilter;
350
- publishStatus?: FormPublishStatus;
318
+ publishStatus?: WidgetPublishStatus;
351
319
  publishDateFrom?: string;
352
320
  publishDateTo?: string;
353
321
  withDeleted?: boolean;
@@ -361,14 +329,14 @@ declare enum FormListRequestFilter {
361
329
  export interface CreateFormParamsI {
362
330
  name: string;
363
331
  variant: CreateFormParamsVariantI;
364
- publishStatus?: FormPublishStatus;
332
+ publishStatus?: WidgetPublishStatus;
365
333
  }
366
334
  export interface CreateFormParamsVariantI {
367
335
  description: string;
368
- type: EsWidgetType;
369
- config: EsFormVariantConfigI;
336
+ type: WidgetType;
337
+ config: WidgetVariantConfigDtoI;
370
338
  integration: EsFormVariantIntegrationV2I | null;
371
- appearances: EsFormAppearanceI[];
339
+ appearances: WidgetAppearanceI[];
372
340
  draft: boolean;
373
341
  linkedToVariantId?: number;
374
342
  }
@@ -526,7 +494,7 @@ export interface EditorConfigI {
526
494
  /** Available languages for multilingual versions of the same widget
527
495
  * @default A set of popular languages will be used
528
496
  * */
529
- languagesForMultilingualVersions?: FormLanguageI[];
497
+ languagesForMultilingualVersions?: WidgetLanguageI[];
530
498
  /**
531
499
  * Callback fired on initial data loading errors.
532
500
  * If not provided, default error UI will be shown.
@@ -694,7 +662,7 @@ export interface TeaserFeatureConfigI {
694
662
  /** Default document model for new teasers */
695
663
  defaultDocumentModel: ClDocumentI;
696
664
  /** Layouts where teaser is available */
697
- enabledForLayouts?: EsWidgetLayoutType[];
665
+ enabledForLayouts?: LayoutType[];
698
666
  /** Component panel configuration for teaser editor */
699
667
  availableComponentsPanel?: AvailableComponentsPanelConfigI;
700
668
  }
@@ -703,18 +671,18 @@ export interface TeaserFeatureConfigI {
703
671
  */
704
672
  export interface CloseEditorCallbackPayloadI {
705
673
  /** Current widget variant data */
706
- variant: FormVariantI;
674
+ variant: WidgetVariantI;
707
675
  }
708
676
  /**
709
677
  * Payload passed to {@link EditorConfigI.getRevisionPayloadCallback}.
710
678
  */
711
679
  export interface GetRevisionPayloadCallbackPayloadI {
712
680
  /** Current widget variant */
713
- variant: FormVariantI;
681
+ variant: WidgetVariantI;
714
682
  /** All widget appearances (desktop, mobile, etc.) */
715
- appearances: EsFormAppearanceI[];
683
+ appearances: WidgetAppearanceI[];
716
684
  /** Current publish status */
717
- publishStatus: FormPublishStatus | null;
685
+ publishStatus: WidgetPublishStatus | null;
718
686
  }
719
687
  /**
720
688
  * Payload passed to {@link EditorConfigI.initialLoadErrorCallback}.
@@ -960,7 +928,7 @@ export interface ResolvedDataI {
960
928
  /** Teaser (minimized widget) data, if enabled */
961
929
  teaserData: ResolvedWidgetDataI | null;
962
930
  /** List of widgets that can be linked */
963
- linkedWidgets: FormsListItemI[];
931
+ linkedWidgets: WidgetsListItemI[];
964
932
  /** Prize pools for gamification widgets */
965
933
  prizePools?: PrizePoolModelI[];
966
934
  }
@@ -969,15 +937,15 @@ export interface ResolvedDataI {
969
937
  */
970
938
  export interface ResolvedWidgetDataI {
971
939
  /** Widget variant (form) data */
972
- variant: EsFormVariantI;
940
+ variant: WidgetVariantDtoI;
973
941
  /** All appearances (desktop, mobile, etc.) */
974
- appearances: EsFormAppearanceI[];
942
+ appearances: WidgetAppearanceI[];
975
943
  /** Latest saved revision */
976
944
  latestRevision: WidgetRevisionI | null;
977
945
  /** Currently loaded revision */
978
946
  currentRevision: WidgetRevisionI | null;
979
947
  /** Current publish status */
980
- publishStatus: FormPublishStatus | null;
948
+ publishStatus: WidgetPublishStatus | null;
981
949
  }
982
950
  /**
983
951
  * Data passed to {@link EditorApiConfigI.saveWidgetData}.
@@ -1000,15 +968,15 @@ export interface DataToSaveI {
1000
968
  */
1001
969
  export interface WidgetDataToSaveI {
1002
970
  /** Original appearances (for comparison) */
1003
- pristineAppearances: EsFormAppearanceI[];
971
+ pristineAppearances: WidgetAppearanceI[];
1004
972
  /** Modified appearances */
1005
- updatedAppearances: EsFormAppearanceI[];
973
+ updatedAppearances: WidgetAppearanceI[];
1006
974
  /** Original variant (for comparison) */
1007
- pristineVariant: FormVariantI;
975
+ pristineVariant: WidgetVariantI;
1008
976
  /** Modified variant */
1009
- updatedVariant: FormVariantI;
977
+ updatedVariant: WidgetVariantI;
1010
978
  /** Current publish status */
1011
- publishStatus: FormPublishStatus | null;
979
+ publishStatus: WidgetPublishStatus | null;
1012
980
  }
1013
981
  /**
1014
982
  * HTTP API configuration for all editor operations.
@@ -1032,11 +1000,11 @@ export interface EditorApiConfigI {
1032
1000
  /** Save widget data (appearances, variant, configs) */
1033
1001
  saveWidgetData: (data: DataToSaveI) => Observable<void> | Promise<void>;
1034
1002
  /** Fetch appearances for a specific widget */
1035
- getWidgetAppearances: (payload: GetWidgetAppearancesPayloadI) => Observable<EsFormAppearanceI[]> | Promise<EsFormAppearanceI[]>;
1003
+ getWidgetAppearances: (payload: GetWidgetAppearancesPayloadI) => Observable<WidgetAppearanceI[]> | Promise<WidgetAppearanceI[]>;
1036
1004
  /** Create a new widget revision (save point) */
1037
1005
  createWidgetRevision: (payload: CreateWidgetRevisionPayloadI) => Observable<CreateWidgetRevisionResponseI> | Promise<CreateWidgetRevisionResponseI>;
1038
1006
  /** Fetch list of widgets for linking */
1039
- getWidgetsList: (params: BaseFormsListRequestParamsI) => Observable<BaseListDtoI<FormsListItemI>> | Promise<BaseListDtoI<FormsListItemI>>;
1007
+ getWidgetsList: (params: BaseFormsListRequestParamsI) => Observable<BaseListDtoI<WidgetsListItemI>> | Promise<BaseListDtoI<WidgetsListItemI>>;
1040
1008
  /** Get files from common directory (icons, backgrounds, etc.) */
1041
1009
  getFilesFromCommonDir: (payload: GetFilesFromCommonDirPayloadI) => Observable<Array<{
1042
1010
  url: string;
@@ -1181,9 +1149,9 @@ export interface GetTemplatePayloadI {
1181
1149
  */
1182
1150
  export interface CreateWidgetResponseI {
1183
1151
  /** Created widget variant */
1184
- variant: FormVariantI;
1152
+ variant: WidgetVariantI;
1185
1153
  /** Created widget appearances */
1186
- appearances: EsFormAppearanceI[];
1154
+ appearances: WidgetAppearanceI[];
1187
1155
  }
1188
1156
  /**
1189
1157
  * Logo configuration for the editor header.
@@ -1229,8 +1197,10 @@ export interface ClContactMappingOptionI {
1229
1197
  }
1230
1198
 
1231
1199
  export {
1200
+ LayoutType,
1232
1201
  PrizePoolModelI,
1233
1202
  PrizePoolOptionI,
1203
+ WidgetType$1 as WidgetType,
1234
1204
  };
1235
1205
 
1236
1206
  export {};