@telia-ace/widget-core-flamingo 1.1.70-rc.9 → 1.1.71

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,7 @@ import { Wrapper } from '../components/wrapper.component';
4
4
  import { ComponentPlatform } from '../services/component-platform';
5
5
  import { StorageService } from '../services/storage.service';
6
6
  import { TextsService } from '../services/texts.service';
7
+ import { WidgetAPI } from '../services/widget-api';
7
8
  import { ApplicationOptions, PluginType, RenderStrategy, TriggerIcon, WidgetAnchor, WidgetConfig } from '../types';
8
9
  import { Container } from './container';
9
10
  export declare class Application {
@@ -24,6 +25,7 @@ export declare class Application {
24
25
  private componentResolver;
25
26
  private components;
26
27
  trigger: Trigger | null;
28
+ api: WidgetAPI;
27
29
  constructor(id: string, name: string, container: Container, settings: WidgetConfig, options: ApplicationOptions);
28
30
  activate(): Promise<void>;
29
31
  private loadPlugins;
@@ -1,13 +1,25 @@
1
1
  import { Application } from './application';
2
2
  import { Container } from './container';
3
3
  import { ApplicationOptions, PluginType, WidgetConfig } from '../types';
4
+ import { WidgetAPI } from '../services/widget-api';
5
+ import { SiteAPI } from '../services/site-api';
6
+ import { Site } from './site';
7
+ export type WidgetAPIHandler = (widget?: WidgetAPI) => void;
8
+ export type SiteConfigurationHandler = (site: SiteAPI) => void;
4
9
  export declare class Environment {
5
10
  applications: Application[];
6
11
  container: Container;
12
+ private bootstrapped;
13
+ private site;
14
+ widgetAPIHandlers: Map<string, WidgetAPIHandler[]>;
15
+ siteConfigurationHandlers: SiteConfigurationHandler[];
7
16
  constructor();
8
17
  bootstrap(): Promise<void>;
9
18
  private activate;
10
19
  private notifyWidgetsOfCreation;
20
+ configure(delegate: SiteConfigurationHandler): void;
21
+ widget(name: string, delegate: WidgetAPIHandler): void;
11
22
  registerApp(id: string, name: string, config: WidgetConfig, options: ApplicationOptions): void;
23
+ registerSite(site: Site): void;
12
24
  plugin(plugin: PluginType): this;
13
25
  }
package/models/site.d.ts CHANGED
@@ -1,10 +1,12 @@
1
+ import { SiteAPI } from '../services/site-api';
1
2
  import { InitConfig } from '../types';
2
3
  import { Environment } from './environment';
3
4
  export declare class Site {
4
- private environment?;
5
+ environment?: Environment;
5
6
  private configurations;
6
7
  private url?;
7
8
  private httpClient;
9
+ api: SiteAPI;
8
10
  constructor(urlOrConfig: string | InitConfig);
9
11
  load(url: string): Promise<void>;
10
12
  loadFromConfig(config: InitConfig): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/widget-core-flamingo",
3
- "version": "1.1.70-rc.9",
3
+ "version": "1.1.71",
4
4
  "dependencies": {
5
5
  "lit": "^3.0.2",
6
6
  "@teliads/icons": "^8.4.0",
@@ -0,0 +1,6 @@
1
+ import { Site } from '../models/site';
2
+ export declare class SiteAPI {
3
+ private site;
4
+ constructor(site: Site);
5
+ storagePolicy(policies: string[]): void;
6
+ }
@@ -1,7 +1,16 @@
1
+ export declare enum StorageCategory {
2
+ Mandatory = "mandatory",
3
+ Preferences = "preferences",
4
+ Analytics = "analytics"
5
+ }
1
6
  export declare class StorageService {
7
+ private storage;
8
+ private policy;
2
9
  private widgetId;
3
- constructor(widgetId: string);
4
- private _prefixKey;
5
- set(key: string, value: string): void;
10
+ constructor(widgetId: string, storageType: 'localStorage' | 'sessionStorage', policy: Record<StorageCategory, boolean>);
11
+ set<T>(key: string, value: T, category: StorageCategory): void;
6
12
  get<T>(key: string): T | null;
13
+ removeItem(key: string): void;
14
+ updatePolicy(newPolicy: Record<StorageCategory, boolean>): void;
15
+ private _prefixKey;
7
16
  }
@@ -0,0 +1,10 @@
1
+ import { Application } from '../models/application';
2
+ export declare class WidgetAPI {
3
+ private widget;
4
+ name: string;
5
+ constructor(widget: Application);
6
+ open(): void;
7
+ close(): void;
8
+ hideTriggerButton(): void;
9
+ showTriggerButton(): void;
10
+ }