@nizza/core 0.4.0-alpha.0 → 0.4.0-alpha.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.
@@ -0,0 +1,6 @@
1
+ export declare enum NizzaEventStatus {
2
+ CREATED = "CREATED",
3
+ STARTING = "STARTING",
4
+ LIVE = "LIVE",
5
+ FINALIZED = "FINALIZED"
6
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Enumeration of common event wildcards used in the EventBus.
3
+ * This enumeration provides predefined wildcards for different
4
+ * event categories, facilitating event subscription and management.
5
+ *
6
+ * Each wildcard represents a specific category or group of events
7
+ * in the EventBus and is used as a pattern to match multiple events.
8
+ *
9
+ */
10
+ export declare const EventBusWildcards: {
11
+ ALL: string;
12
+ CORE: string;
13
+ LIVE_STREAMING_EVENT: string;
14
+ EVENT_CHAT: string;
15
+ EVENT_PRODUCTS: string;
16
+ CUSTOMIZE_LIVE: string;
17
+ PLAYER: string;
18
+ SNACK_SIZE_VIDEO: string;
19
+ SNACK_SIZE_VIDEO_ADMIN: string;
20
+ UI: string;
21
+ UTILS: string;
22
+ };
23
+ /**
24
+ * Enumeration that defines the names of events used in the application.
25
+ * This enumeration provides a list of event names used throughout
26
+ * the application to facilitate event communication and management.
27
+ *
28
+ * Each event name should be unique and represent a specific action that
29
+ * has occurred in the application.
30
+ *
31
+ */
32
+ export declare const EventNames: {
33
+ EVENT_STATUS_CHANGED: string;
34
+ };
@@ -1,2 +1,4 @@
1
+ export * from './event';
2
+ export * from './eventBus';
1
3
  export * from './i18n';
2
4
  export * from './products';
@@ -5,5 +5,6 @@ export * from './errors';
5
5
  export * from './i18n';
6
6
  export * from './jotai';
7
7
  export * from './mobx';
8
+ export * from './nizza-store';
8
9
  export * from './types';
9
10
  export * from './utils';
@@ -1,3 +1,2 @@
1
- export * from './NizzaStore';
2
1
  export * from './StoreProvider';
3
2
  export * from './hooks';
@@ -0,0 +1,13 @@
1
+ import { NizzaAccount } from '../accounts';
2
+ import { NizzaConfiguration } from '../types';
3
+ export declare class ConfigManager {
4
+ private _config;
5
+ private _account;
6
+ constructor();
7
+ configure(config: NizzaConfiguration): Promise<void>;
8
+ get config(): NizzaConfiguration | null;
9
+ get account(): NizzaAccount;
10
+ get ok(): boolean;
11
+ get accountName(): string;
12
+ setAccount(account: NizzaAccount): void;
13
+ }
@@ -0,0 +1,7 @@
1
+ import { EventBus, EventBusListener, EventBusSubscription } from '../types';
2
+ export declare class DefaultEventBus implements EventBus {
3
+ private emitter;
4
+ constructor();
5
+ on(event: string, listener: EventBusListener): EventBusSubscription;
6
+ emit(event: string, data: any): void;
7
+ }
@@ -1,20 +1,20 @@
1
- import { NizzaAccount } from '../accounts';
2
1
  import { NizzaConfiguration, NizzaProductDataSource } from '../types';
2
+ import { DefaultEventBus } from './DefaultEventBus';
3
3
  export declare class NizzaStore {
4
4
  private static _instance;
5
- private _config;
6
- private _account;
7
5
  private _productDataSource;
6
+ private _configManager;
7
+ private _eventBus;
8
8
  readonly instanceId: string;
9
9
  private constructor();
10
10
  static instance(): NizzaStore;
11
11
  configure(config: NizzaConfiguration): Promise<this>;
12
- get account(): NizzaAccount;
12
+ get config(): NizzaConfiguration | null;
13
+ get account(): import("..").NizzaAccount;
13
14
  get ok(): boolean;
14
15
  get accountName(): string;
15
16
  get productDataSource(): NizzaProductDataSource | null;
16
- get config(): NizzaConfiguration | null;
17
+ get eventBus(): DefaultEventBus;
17
18
  setProductDataSource(dataSource: NizzaProductDataSource): void;
18
- private validateRequiredProps;
19
19
  }
20
20
  export declare const nizza: NizzaStore;
@@ -0,0 +1 @@
1
+ export declare function validateRequiredProps(): void;
@@ -0,0 +1 @@
1
+ export * from './NizzaStore';
@@ -0,0 +1,15 @@
1
+ export interface EventBusPayload {
2
+ name: string;
3
+ wildcard: string;
4
+ data: any;
5
+ attrs: Record<string, any>;
6
+ }
7
+ export interface EventBusSubscription {
8
+ off: () => void;
9
+ event: string;
10
+ }
11
+ export type EventBusListener = (event: EventBusPayload) => void;
12
+ export interface EventBus {
13
+ on(event: string, listener: EventBusListener): EventBusSubscription;
14
+ emit(event: string, data: any): void;
15
+ }
@@ -1,4 +1,5 @@
1
1
  export * from './chat';
2
+ export * from './eventBus';
2
3
  export * from './main';
3
4
  export * from './nizzaGlobalObject';
4
5
  export * from './product';
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nizza/core",
3
- "version": "0.4.0-alpha.0",
3
+ "version": "0.4.0-alpha.2",
4
4
  "type": "module",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.cjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nizza/core",
3
- "version": "0.4.0-alpha.0",
3
+ "version": "0.4.0-alpha.2",
4
4
  "type": "module",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.cjs",