@windycom/plugin-devtools 1.0.8 → 2.0.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.
Files changed (52) hide show
  1. package/README.md +2 -0
  2. package/package.json +1 -1
  3. package/types/client/Drag.d.ts +8 -1
  4. package/types/client/MobileCalendar.d.ts +4 -0
  5. package/types/client/Overlay.d.ts +1 -1
  6. package/types/client/OverlayClasses.d.ts +1 -1
  7. package/types/client/Plugin.d.ts +4 -4
  8. package/types/client/Product.d.ts +14 -2
  9. package/types/client/ProductSwitch.d.ts +1 -1
  10. package/types/client/SveltePanePlugin.d.ts +4 -3
  11. package/types/client/Window.d.ts +0 -4
  12. package/types/client/WindowPlugin.d.ts +9 -8
  13. package/types/client/d.ts.files/broadcast.d.ts +7 -8
  14. package/types/client/d.ts.files/dataSpecifications.d.ts +24 -21
  15. package/types/client/d.ts.files/plugin-params.d.ts +12 -13
  16. package/types/client/d.ts.files/plugins.d.ts +11 -14
  17. package/types/client/d.ts.files/products.d.ts +5 -0
  18. package/types/client/d.ts.files/satellite.d.ts +1 -0
  19. package/types/client/device.d.ts +0 -1
  20. package/types/client/embed2.d.ts +3 -5
  21. package/types/client/fetch.d.ts +4 -10
  22. package/types/client/ga.d.ts +4 -0
  23. package/types/client/geolocation.d.ts +0 -1
  24. package/types/client/interpolator.d.ts +1 -1
  25. package/types/client/lib.d.ts +0 -4
  26. package/types/client/libHtml.d.ts +1 -1
  27. package/types/client/mobile.d.ts +5 -7
  28. package/types/client/models.d.ts +1 -1
  29. package/types/client/patchAndPromoCtrl.d.ts +13 -0
  30. package/types/client/permanentPromos.d.ts +0 -1
  31. package/types/client/pluginsCtrl.d.ts +12 -3
  32. package/types/client/promo.d.ts +25 -31
  33. package/types/client/renderTile.d.ts +1 -1
  34. package/types/client/renderers.d.ts +1 -1
  35. package/types/client/rootScope.d.ts +22 -14
  36. package/types/client/router.d.ts +1 -1
  37. package/types/client/{hp.d.ts → startupWeather.d.ts} +10 -2
  38. package/types/client/tileInterpolator.d.ts +3 -3
  39. package/types/client/user.d.ts +9 -4
  40. package/types/client/userFavs.d.ts +5 -12
  41. package/types/client/utils.d.ts +20 -6
  42. package/types/iconfont.d.ts +5 -4
  43. package/types/interfaces.d.ts +198 -202
  44. package/types/lang-files.d.ts +58 -18
  45. package/types/types.d.ts +64 -10
  46. package/publishExamples.sh +0 -19
  47. package/types/client/BindedDropDown.d.ts +0 -14
  48. package/types/client/Detail1hCheckbox.d.ts +0 -4
  49. package/types/client/DropDown.d.ts +0 -37
  50. package/types/client/Webcams.d.ts +0 -66
  51. package/types/client/loadersUI.d.ts +0 -1
  52. /package/types/client/d.ts.files/{tileInterpolator.d.ts → interpolatorTypes.d.ts} +0 -0
@@ -1,50 +1,42 @@
1
1
  /**
2
2
  * Main Windy interfaces
3
3
  */
4
+ import { ClientMessage } from '@plugins/offline/offline';
4
5
  import { Weekday } from '@windy/Calendar.d';
5
6
  import { ExtendedTileParams } from '@windy/DataTiler.d';
6
7
  import { FullRenderParameters } from '@windy/Layer.d';
7
8
  import { Particles } from '@windy/Particles';
8
9
  import { PluginsOpenParams, type PluginsQsParams } from '@windy/plugin-params.d';
9
10
  import { Plugins } from '@windy/plugins.d';
11
+ import { AcTimes, Isolines, Levels, Overlays, PointProducts, Products } from '@windy/rootScope.d';
10
12
  import {
11
- AcTimes,
12
- Isolines,
13
- Levels,
14
- Overlays,
15
- PointProducts,
16
- Products,
17
- SupportedLanguages,
18
- } from '@windy/rootScope.d';
19
- import {
20
- BatteryPreferences,
21
- CapAlertInfo,
22
- CapAlertSeverity,
23
- CapAlertType,
24
- DetailDisplayType,
25
- DetailRows,
26
- Directions,
27
- FavType,
28
- GoogleServicesPreferences,
29
- GpsPreferences,
30
- HTMLString,
31
- ISODateString,
32
- LocationPrefecernces,
33
- MeteogramLayers,
34
- MeteogramLevels,
35
- NoticicationPrefecernces,
36
- NumOrNull,
37
- NumValue,
38
- Path,
39
- Pixel,
40
- Platform,
41
- SearchType,
42
- StationOrPoiType,
43
- Timestamp,
44
- WidgetNotificationPreferences,
45
- YearMonthDay,
13
+ BatteryPreferences,
14
+ CapAlertInfo,
15
+ CapAlertSeverity,
16
+ CapAlertType,
17
+ DetailDisplayType,
18
+ DetailRows,
19
+ Directions,
20
+ FavType,
21
+ GoogleServicesPreferences,
22
+ GpsPreferences,
23
+ ISODateString,
24
+ LocationPreferences,
25
+ MeteogramLayers,
26
+ MeteogramLevels,
27
+ NotificationPreferences,
28
+ NumOrNull,
29
+ NumValue,
30
+ Path,
31
+ Pixel,
32
+ Platform,
33
+ SearchType,
34
+ StationOrPoiType,
35
+ Timestamp,
36
+ WidgetNotificationPreferences,
37
+ YearMonthDay,
38
+ type MigrationResult,
46
39
  } from '@windy/types.d';
47
- import { ClientMessage } from '@plugins/offline/offline';
48
40
 
49
41
  export interface ExportedObj {
50
42
  default?: unknown;
@@ -265,7 +257,7 @@ export interface Fav extends LatLon {
265
257
  /** Title of item */
266
258
  title: string;
267
259
 
268
- /** OBSOLETE DEPRACATED. Name was used till 2019, all should be refactored to `title` if it is safe */
260
+ /** @deprecated Name was used till 2019, all should be refactored to `title` if it is safe */
269
261
  name?: string;
270
262
 
271
263
  /** Unique invented key, for access */
@@ -285,6 +277,18 @@ export interface Fav extends LatLon {
285
277
 
286
278
  /** For saved routes */
287
279
  route?: string;
280
+
281
+ /**
282
+ * If user wants to pin to top this fav, this timestamp enable us to sort all the favs
283
+ * so the last pinned is on top
284
+ */
285
+ pin2top?: Timestamp | null;
286
+
287
+ /**
288
+ * If user wants to pin to homepage this fav, this timestamp enable us to sort all the favs
289
+ * so the last pinned is first in line
290
+ */
291
+ pin2homepage?: Timestamp | null;
288
292
  }
289
293
 
290
294
  /** Search result payload as received from backend */
@@ -358,7 +362,7 @@ export interface SavedFav extends Fav {
358
362
 
359
363
  overflowed?: boolean;
360
364
 
361
- /** DEPRACATED !!! Use `title` instead. This property is presented only because of in localstorage saved old favs compatibility. */
365
+ /** @deprecated Use `title` instead. This property is presented only because of in local storage saved old favs compatibility. */
362
366
  name?: string;
363
367
  /** Used for alerts to open slider on active timestamp */
364
368
  moveToTimestamp?: boolean;
@@ -430,7 +434,7 @@ export interface Bounds {
430
434
  }
431
435
 
432
436
  /**
433
- * Leflet's tilePoint
437
+ * Leaflet's tilePoint
434
438
  */
435
439
  export interface TilePoint {
436
440
  x: number;
@@ -448,7 +452,7 @@ export interface Celestial {
448
452
  TZabbrev: string;
449
453
 
450
454
  /**
451
- * Time zone name (for instance 'Europe/Luxemburg)
455
+ * Time zone name (for instance 'Europe/Luxembourg)
452
456
  */
453
457
  TZname: string;
454
458
 
@@ -468,12 +472,12 @@ export interface Celestial {
468
472
  TZoffsetMin: number;
469
473
 
470
474
  /**
471
- * Type of TZ type t..terrestial, n..nautical
475
+ * Type of TZ type t..terrestrial, n..nautical
472
476
  */
473
477
  TZtype: 't' | 'n';
474
478
 
475
479
  /**
476
- * Determines propability if the location is at sea or not as number from 1..0
480
+ * Determines probability if the location is at sea or not as number from 1..0
477
481
  */
478
482
  atSea: number;
479
483
 
@@ -494,7 +498,7 @@ export interface Celestial {
494
498
  night: ISODateString;
495
499
 
496
500
  /**
497
- * Monet when, the data object was creted (for check of being obsolete)
501
+ * Monet when, the data object was created (for check of being obsolete)
498
502
  */
499
503
  nowObserved: ISODateString;
500
504
 
@@ -514,19 +518,14 @@ export interface SummaryDay {
514
518
  date: YearMonthDay;
515
519
 
516
520
  /**
517
- * Day of the molnth (starting with 1)
521
+ * Day of the month (starting with 1)
518
522
  */
519
523
  day: number;
520
524
 
521
- /**
522
- * Weather icon identifier (legacy version)
523
- */
524
- icon: number;
525
-
526
525
  /**
527
526
  * Weather icon identifier
528
527
  */
529
- icon2: number;
528
+ icon: number;
530
529
 
531
530
  /**
532
531
  * At which index, in the data table, the day starts
@@ -569,9 +568,15 @@ export interface SummaryDay {
569
568
  windDir: NumValue;
570
569
 
571
570
  /**
572
- * CAP Alert warning identifier as teo letter designstor
571
+ * CAP Alert warning identifier as two letter designator
573
572
  */
574
573
  warning?: string;
574
+
575
+ /**
576
+ * Indicates that these data are fake, just for purpose to
577
+ * show non-premium users how the extended fcst looks like
578
+ */
579
+ isFake?: boolean;
575
580
  }
576
581
 
577
582
  /**
@@ -584,7 +589,7 @@ export interface SummaryDataHash {
584
589
  mm: NumValue[];
585
590
 
586
591
  /**
587
- * Is the preciptitaion in a form fo snow?
592
+ * Is the precipitation in a form fo snow?
588
593
  */
589
594
  snow: (1 | 0)[];
590
595
 
@@ -636,31 +641,16 @@ export interface DataHash extends SummaryDataHash, IsDay {
636
641
  */
637
642
  hour: number[];
638
643
 
639
- /**
640
- * Weather icon identifier (legacy version)
641
- */
642
- icon: number[];
643
-
644
644
  /**
645
645
  * Weather icon identifier
646
646
  */
647
- icon2: number[];
647
+ icon: number[];
648
648
 
649
649
  /**
650
650
  * Moon phase icon identifier
651
651
  */
652
652
  moonPhase: number[];
653
653
 
654
- /**
655
- * Date of segment beggining
656
- */
657
- origDate: ISODateString[];
658
-
659
- /**
660
- * TS of segment beggining (seems same as ts)
661
- */
662
- origTs: Timestamp[];
663
-
664
654
  /**
665
655
  * ?????
666
656
  */
@@ -756,6 +746,11 @@ export interface DataHash extends SummaryDataHash, IsDay {
756
746
 
757
747
  turbulence?: NumValue[];
758
748
  icing?: NumValue[];
749
+
750
+ /**
751
+ * Indicates, that these data are fake, just for purpose to show non-premium users how the extended fcst looks like
752
+ */
753
+ isFake?: boolean[];
759
754
  }
760
755
 
761
756
  /**
@@ -763,7 +758,7 @@ export interface DataHash extends SummaryDataHash, IsDay {
763
758
  * Strict means the extension has to be from both sides.
764
759
  *
765
760
  * @example
766
- * PickDataHashPropsByType<string[]> = { date: ..., origDate: ..., weathercode: ... };
761
+ * PickDataHashPropsByType<string[]> = { date: ..., weathercode: ... };
767
762
  * PickDataHashPropsByType<string, false> even with `warnings`, because the could be undefined and undefined does not extend number[]
768
763
  */
769
764
  export type PickDataHashPropsByType<U, Strict = true> = Pick<
@@ -808,7 +803,7 @@ export interface NodeForecastHeader {
808
803
  /**
809
804
  * Number of available days in forecast
810
805
  */
811
- daysAvail?: number;
806
+ daysAvail: number;
812
807
 
813
808
  /**
814
809
  * Served model
@@ -893,6 +888,18 @@ export interface NodeForecastHeader {
893
888
  sst?: number;
894
889
  }
895
890
 
891
+ /**
892
+ * Forecasted weather data for NOW
893
+ */
894
+
895
+ export interface WeatherDataNow {
896
+ icon: number;
897
+ temp: NumValue;
898
+ wind: NumValue;
899
+ windDir: NumValue;
900
+ moonPhase: NumValue;
901
+ }
902
+
896
903
  /**
897
904
  * Weather data or Summary Weather data JSON as received from node-forecast
898
905
  */
@@ -901,19 +908,11 @@ export interface WeatherDataPayload<T extends DataHash | SummaryDataHash> {
901
908
  celestial: Celestial;
902
909
  summary: Record<YearMonthDay, SummaryDay>;
903
910
  data: T;
904
- now?: T extends SummaryDataHash
905
- ? {
906
- icon: number;
907
- temp: NumValue;
908
- wind: NumValue;
909
- windDir: NumValue;
910
- moonPhase: NumValue;
911
- }
912
- : never;
911
+ now?: T extends SummaryDataHash ? WeatherDataNow : never;
913
912
  }
914
913
 
915
914
  /**
916
- * Minimsl rqrd options for RendererWeatherTable
915
+ * Minimal required options for RendererWeatherTable
917
916
  */
918
917
  export interface WeatherTableRenderingOptions {
919
918
  /**
@@ -976,7 +975,7 @@ export interface WeatherTableRenderingOptions {
976
975
  type DetailPluginOpenParams = PluginsOpenParams['detail'];
977
976
 
978
977
  /**
979
- * Parametrs used for displaying detail (poinr forecast)
978
+ * Parameters used for displaying detail (point forecast)
980
979
  */
981
980
  export interface DetailParams extends DetailPluginOpenParams, WeatherTableRenderingOptions {
982
981
  display: DetailDisplayType;
@@ -1019,12 +1018,12 @@ export interface DetailParams extends DetailPluginOpenParams, WeatherTableRender
1019
1018
  id?: string;
1020
1019
 
1021
1020
  /**
1022
- * height of temperature bacground canvas
1021
+ * height of temperature background canvas
1023
1022
  */
1024
1023
  tempBgH?: Pixel;
1025
1024
 
1026
1025
  /**
1027
- * Always incrementing synchornization number, that enables
1026
+ * Always incrementing synchronization number, that enables
1028
1027
  * to cancel async tasks, if we will have new version of params
1029
1028
  * available
1030
1029
  */
@@ -1053,7 +1052,7 @@ export interface MeteogramDataPayload {
1053
1052
  }
1054
1053
 
1055
1054
  /**
1056
- * Particle animation paramters
1055
+ * Particle animation parameters
1057
1056
  */
1058
1057
  export interface ExtendedRenderParams extends ExtendedTileParams, FullRenderParameters {
1059
1058
  canvas: HTMLCanvasElement;
@@ -1075,9 +1074,21 @@ export interface ExtendedRenderParams extends ExtendedTileParams, FullRenderPara
1075
1074
  * Info about articles, user has already seen
1076
1075
  */
1077
1076
  export interface SeenArticle {
1078
- seen: Timestamp;
1077
+ /**
1078
+ * Last time, the article has been displayed to the user
1079
+ */
1079
1080
  checked: Timestamp;
1081
+
1082
+ /**
1083
+ * How many times the article has been seen
1084
+ * (one count is added only if the article has been seen after 12 hours from the last seen time)
1085
+ */
1080
1086
  count: number;
1087
+
1088
+ /**
1089
+ * Marks beginning of 12h interval
1090
+ */
1091
+ seen: Timestamp;
1081
1092
  }
1082
1093
 
1083
1094
  /**
@@ -1090,102 +1101,6 @@ export interface ObservationInfo {
1090
1101
  records: number;
1091
1102
  }
1092
1103
 
1093
- export type ArticleImportances =
1094
- | 'extreme'
1095
- | 'severe'
1096
- | 'moderate'
1097
- | 'windyAnnounce'
1098
- | 'forecast'
1099
- | 'windyTutorial'
1100
- | 'educational'
1101
- | 'timeKilling'
1102
- | 'warning';
1103
-
1104
- export interface ArticleAuthor {
1105
- avatar: string;
1106
- profile: string;
1107
- reputation: number;
1108
- username: string;
1109
- userslug: string;
1110
- }
1111
-
1112
- /**
1113
- * This format is used backend payload for info on HP
1114
- */
1115
- export interface ArticleJson {
1116
- author: ArticleAuthor;
1117
- coverPhoto: {
1118
- desc: '' | string;
1119
- link: '' | string;
1120
- photo: '' | string;
1121
- showArticleCover: boolean;
1122
- src: string;
1123
- };
1124
- id: number;
1125
- importance: ArticleImportances;
1126
- language: SupportedLanguages;
1127
- ranking: number;
1128
- slug: string;
1129
- subtitle: '' | string;
1130
- title: string;
1131
- updated: ISODateString;
1132
-
1133
- /**
1134
- * Monkey patched props
1135
- */
1136
- count: number;
1137
- checked: Timestamp | 0;
1138
- key: string;
1139
- }
1140
-
1141
- /**
1142
- * This format is used backend payload for list of articles
1143
- */
1144
- export interface ExtendedArticleJson extends ArticleJson {
1145
- countries: string | string[] | '';
1146
- licence: 'cc-by' | 'proprietary';
1147
- originalAuthor: {
1148
- name: string | '';
1149
- link: string | '';
1150
- };
1151
- perex: string | '';
1152
- platform: 'all' | 'ios' | 'android';
1153
- target: 'all' | 'index' | 'mobile';
1154
- device: 'all' | 'desktop' | 'mobile';
1155
- pid: number;
1156
- published: ISODateString;
1157
- expire: string;
1158
- publishedBy: number;
1159
- tags: string[];
1160
- expiration: ISODateString;
1161
- homepage: boolean;
1162
- type?: 'article' | 'video';
1163
- }
1164
-
1165
- /**
1166
- * This format is used backend payload for particular article in article list
1167
- */
1168
- export interface Article extends ExtendedArticleJson {
1169
- status: 'published' | 'unpublished' | 'expired';
1170
- upvotes: number;
1171
- viewcount: number;
1172
- internalUrl: {
1173
- url: string;
1174
- search: string;
1175
- path: string;
1176
- internal: boolean;
1177
- }[];
1178
- containsTwitter: boolean;
1179
- video?: string;
1180
- articleCoverPhoto: {
1181
- src: string;
1182
- photo: string;
1183
- desc: string;
1184
- link: string;
1185
- };
1186
- content: HTMLString;
1187
- version: string;
1188
- }
1189
1104
  export interface ServiceGeoipResponse {
1190
1105
  country: string;
1191
1106
  region: `${number}`;
@@ -1198,7 +1113,7 @@ export interface ServiceGeoipResponse {
1198
1113
  ip: string;
1199
1114
 
1200
1115
  /**
1201
- * Deprecated
1116
+ * @deprecated
1202
1117
  */
1203
1118
  hash: 'oiurouoweruouoiuou';
1204
1119
  }
@@ -1348,7 +1263,7 @@ export interface IsAppleWatchPairedResult {
1348
1263
  value: boolean;
1349
1264
  }
1350
1265
 
1351
- export interface IsAppleWatchCompanionAppIntalledResult {
1266
+ export interface IsAppleWatchCompanionAppInstalledResult {
1352
1267
  value: boolean;
1353
1268
  }
1354
1269
 
@@ -1368,14 +1283,14 @@ export interface WindyWatchPlugin {
1368
1283
  * Watch conditions for the alert
1369
1284
  */
1370
1285
  isPaired: () => Promise<IsAppleWatchPairedResult>;
1371
- isWatchAppInstalled: () => Promise<IsAppleWatchCompanionAppIntalledResult>;
1286
+ isWatchAppInstalled: () => Promise<IsAppleWatchCompanionAppInstalledResult>;
1372
1287
  addWatchFace: () => Promise<unknown>;
1373
1288
  }
1374
1289
 
1375
1290
  export interface WindyServicePlugin {
1376
1291
  openSettings: () => Promise<void | string>;
1377
- getLocationPermnissions: () => Promise<LocationPrefecernces>;
1378
- getNotificationPermnissions: () => Promise<NoticicationPrefecernces>;
1292
+ getLocationPermissions: () => Promise<LocationPreferences>;
1293
+ getNotificationPermissions: () => Promise<NotificationPreferences>;
1379
1294
  openApplicationSettings: () => Promise<void | string>;
1380
1295
  isGpsEnabled: () => Promise<GpsPreferences>;
1381
1296
  getBatteryUsagePermissions: () => Promise<BatteryPreferences>;
@@ -1385,6 +1300,8 @@ export interface WindyServicePlugin {
1385
1300
  openWidgetNotificationSettings: () => Promise<void>;
1386
1301
  getBackgroundLocationPermission: () => Promise<GpsPreferences>;
1387
1302
  openBackgroundLocationSettings: () => Promise<void>;
1303
+ logError: (arg: { moduleName: string; msg: string; error?: string }) => Promise<void>;
1304
+ getId: () => Promise<{ identifier: string }>;
1388
1305
  }
1389
1306
  /**
1390
1307
  * A migration tool for transferring old Web View local storage to a new location.
@@ -1428,6 +1345,18 @@ export interface WindyMigrationPlugin {
1428
1345
  * Marks migration as completed and restart WebView from origin
1429
1346
  */
1430
1347
  markMigrationCompleted: () => Promise<void>;
1348
+ /**
1349
+ * Returns migration status flag - either migrationNotPerformed or migratingData
1350
+ */
1351
+ getMigrationStatus: () => Promise<MigrationResult>;
1352
+ /**
1353
+ * Sends migration data to native layer
1354
+ */
1355
+ setMigrationData: (opts: { data: string }) => Promise<void>;
1356
+ /**
1357
+ * Returns old localStorage data (sent to native layer via setMigrationData function)
1358
+ */
1359
+ getOldLocalStorageDataAndroid: () => Promise<{ result: string | null }>;
1431
1360
  }
1432
1361
 
1433
1362
  export interface SocialLoginParams {
@@ -1458,25 +1387,12 @@ export interface ObservationSummaryRecord {
1458
1387
 
1459
1388
  export type ObservationSummaryHash = Record<YearMonthDay, ObservationSummaryRecord>;
1460
1389
 
1461
- /**
1462
- * Observation Weather data used in station plugin (so far IMHO used only to render mobile fragment)
1463
- */
1464
- export interface ObservationFragmentHash {
1465
- summary: ObservationSummaryHash;
1466
- data: {
1467
- temp: NumOrNull[];
1468
- wind: NumOrNull[];
1469
- mm: NumOrNull[];
1470
- snow: NumOrNull[];
1471
- };
1472
- }
1473
-
1474
1390
  /**
1475
1391
  * Opening options for Window class
1476
1392
  */
1477
1393
  export interface WindowOpeningOptions {
1478
1394
  /**
1479
- * Should we open the widnow without animation?
1395
+ * Should we open the window without animation?
1480
1396
  */
1481
1397
  disableOpeningAnimation?: boolean;
1482
1398
  }
@@ -1735,6 +1651,12 @@ export interface ExternalPluginConfig {
1735
1651
  * space on the bottom of the screen.
1736
1652
  */
1737
1653
  mobileUI: 'fullscreen' | 'small';
1654
+
1655
+ /**
1656
+ * The plugin has NO LINK in the main menu, can be open only programmatically
1657
+ * and its installation is not persistent.
1658
+ */
1659
+ internal?: boolean;
1738
1660
  }
1739
1661
 
1740
1662
  export interface CompiledExternalPluginConfig extends ExternalPluginConfig {
@@ -1748,6 +1670,16 @@ export interface CompiledExternalPluginConfig extends ExternalPluginConfig {
1748
1670
  * If the final build contains screenshot, they are stored here
1749
1671
  */
1750
1672
  screenshot?: string;
1673
+
1674
+ /**
1675
+ * User ID of the author of the plugin
1676
+ */
1677
+ windyUserId: number;
1678
+
1679
+ /**
1680
+ * URL of users profile
1681
+ */
1682
+ communityProfileUrl: string;
1751
1683
  }
1752
1684
 
1753
1685
  /**
@@ -1755,17 +1687,81 @@ export interface CompiledExternalPluginConfig extends ExternalPluginConfig {
1755
1687
  */
1756
1688
  export interface InstalledExternalPluginConfig extends CompiledExternalPluginConfig {
1757
1689
  /**
1758
- * URL of the plguin is used as unique identifier
1690
+ * URL of the plugin is used as unique identifier
1759
1691
  */
1760
1692
  url: string;
1761
1693
 
1762
1694
  /**
1763
1695
  * From which process was plugin installed
1764
1696
  */
1765
- installedBy: 'dev' | 'gallery' | 'url';
1697
+ installedBy: 'dev' | 'gallery' | 'url' | 'patch';
1766
1698
 
1767
1699
  /**
1768
1700
  * When was this plugin installed by specific user
1769
1701
  */
1770
1702
  installed: Timestamp;
1771
1703
  }
1704
+
1705
+ interface PromoFilteringParams {
1706
+ isLoggedIn: boolean;
1707
+ sessionCounter: number;
1708
+ isPremium: boolean;
1709
+ }
1710
+
1711
+ /**
1712
+ * Main promo object, used in `client-patch`
1713
+ */
1714
+ interface PromoObj {
1715
+ /**
1716
+ * Main ID of the promo. This key is also used in `promo` object in localStorage
1717
+ */
1718
+ readonly id: string;
1719
+
1720
+ /**
1721
+ * ISO date, when the promo expires
1722
+ */
1723
+ readonly end: string;
1724
+
1725
+ /**
1726
+ * How many times display promo to the user (respective on one device)
1727
+ */
1728
+ counter: number;
1729
+
1730
+ /**
1731
+ * How often to display promo on particular device (in ms)
1732
+ */
1733
+ delay: number;
1734
+
1735
+ /**
1736
+ * Any others filters, deciding whether to display promo or not
1737
+ */
1738
+ filter: () => boolean;
1739
+
1740
+ /**
1741
+ * Should we display HP articles together with promo
1742
+ * @deprecated
1743
+ */
1744
+ loadArticles?: boolean;
1745
+
1746
+ /**
1747
+ * Required method to be run, when promo is executed. In this stage we can also
1748
+ * do some additional checks, if promo should be displayed or not, so we must
1749
+ * call `promo.hitCounter()` method ourselves.
1750
+ */
1751
+ readonly run: () => void;
1752
+
1753
+ /**
1754
+ * Optional HTML code to be used internally in `run` method
1755
+ */
1756
+ html?: string;
1757
+ }
1758
+
1759
+ /**
1760
+ * Client patch object
1761
+ */
1762
+ interface ClientPatch {
1763
+ __version: string;
1764
+ __css: string;
1765
+ exclusivePromos: PromoObj[];
1766
+ otherPromos: PromoObj[];
1767
+ }