@nizza/core 0.4.5-alpha.0 → 0.4.5-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.
@@ -1,4 +1,4 @@
1
- import { Attributes, EventBus, EventBusListener, EventBusSubscription } from '../../types';
1
+ import { Attributes, EventBus, EventBusListener, EventBusSubscription } from '../types';
2
2
  /**
3
3
  * Implementation of EventBus using BroadcastChannel for cross-window communication.
4
4
  */
@@ -1,4 +1,4 @@
1
- import { EventBus, EventBusListener, EventBusSubscription } from '../../types';
1
+ import { EventBus, EventBusListener, EventBusSubscription } from '../types';
2
2
  export declare class EventEmitter2EventBus implements EventBus {
3
3
  private emitter;
4
4
  constructor();
@@ -1,2 +1 @@
1
1
  export * from './StoreProvider';
2
- export * from './hooks';
@@ -1,22 +1,16 @@
1
1
  import log from 'loglevel';
2
- import { NizzaConfiguration, NizzaProductDataSource } from '../types';
3
- import { BroadcastChannelEventBus } from './event-buses';
4
- export declare class NizzaStore {
5
- private static _instance;
6
- private _productDataSource;
7
- private _configManager;
8
- private _eventBus;
9
- readonly instanceId: string;
10
- readonly log: log.RootLogger;
11
- private constructor();
12
- static instance(): NizzaStore;
13
- configure(config: NizzaConfiguration): Promise<this>;
14
- get config(): NizzaConfiguration | null;
15
- get account(): import("..").NizzaAccount;
16
- get ok(): boolean;
17
- get accountName(): string;
18
- get productDataSource(): NizzaProductDataSource | null;
19
- get eventBus(): BroadcastChannelEventBus;
20
- setProductDataSource(dataSource: NizzaProductDataSource): void;
21
- }
2
+ import { BroadcastChannelEventBus } from '../event-buses';
3
+ import { NizzaConfiguration, NizzaProductDataSource, NizzaState } from '../types';
4
+ export type NizzaStore = ReturnType<typeof createNizza>;
5
+ declare const createNizza: () => {
6
+ log: log.RootLogger;
7
+ state: NizzaState;
8
+ configure: (config: NizzaConfiguration) => Promise<void>;
9
+ setProductDataSource: (dataSource: NizzaProductDataSource) => void;
10
+ instanceId: string;
11
+ eventBus: BroadcastChannelEventBus;
12
+ readonly account: import("../accounts").NizzaAccount | undefined;
13
+ readonly productDataSource: NizzaProductDataSource | undefined;
14
+ };
22
15
  export declare const nizza: NizzaStore;
16
+ export {};
@@ -0,0 +1,22 @@
1
+ import log from 'loglevel';
2
+ import { NizzaConfiguration, NizzaProductDataSource } from '../types';
3
+ import { BroadcastChannelEventBus } from '../event-buses';
4
+ export declare class NizzaStore {
5
+ private static _instance;
6
+ private _productDataSource;
7
+ private _configManager;
8
+ private _eventBus;
9
+ readonly instanceId: string;
10
+ readonly log: log.RootLogger;
11
+ private constructor();
12
+ static instance(): NizzaStore;
13
+ configure(config: NizzaConfiguration): Promise<this>;
14
+ get config(): NizzaConfiguration | null;
15
+ get account(): import("..").NizzaAccount;
16
+ get ok(): boolean;
17
+ get accountName(): string;
18
+ get productDataSource(): NizzaProductDataSource | null;
19
+ get eventBus(): BroadcastChannelEventBus;
20
+ setProductDataSource(dataSource: NizzaProductDataSource): void;
21
+ }
22
+ export declare const nizza: NizzaStore;
@@ -1 +1,10 @@
1
- export declare function validateRequiredProps(): void;
1
+ /**
2
+ * Validates that required properties are defined in a given state object.
3
+ * It supports deep property paths (e.g., 'config.account').
4
+ *
5
+ * @param {Record<string, any>} state - The state object to be validated.
6
+ * @param {string[]} requiredProps - An array of strings representing the property paths to be validated.
7
+ * @throws {InvalidNizzaGlobalObjectError} Throws an error if a required property is missing or invalid.
8
+ * @throws {Error} Throws an error if the input arguments are not valid.
9
+ */
10
+ export declare function validateRequiredProps<T extends Record<string, any>>(state: T, requiredProps: string[]): void;
@@ -1,4 +1,2 @@
1
- export * from './ConfigManager';
2
1
  export * from './NizzaStore';
3
- export * from './event-buses';
4
2
  export * from './helpers';
@@ -1016,6 +1016,30 @@ export type UpdateCustomizationMutation = {
1016
1016
  timestamp: string;
1017
1017
  };
1018
1018
  };
1019
+ export type GetTimeLineQueryVariables = Exact<{
1020
+ data: GetTimeLineInput;
1021
+ }>;
1022
+ export type GetTimeLineQuery = {
1023
+ __typename?: 'Query';
1024
+ getTimeLine: {
1025
+ __typename: 'ErrorGeneral';
1026
+ message: string;
1027
+ statusCode: string;
1028
+ timestamp: string;
1029
+ } | {
1030
+ __typename: 'TimeLineArray';
1031
+ data?: Array<{
1032
+ __typename?: 'TimeLine';
1033
+ time: string;
1034
+ likes: number;
1035
+ comments: number;
1036
+ viewers: number;
1037
+ orders: number;
1038
+ minute: number;
1039
+ hour: number;
1040
+ }> | null;
1041
+ };
1042
+ };
1019
1043
  export type AppendProductsToSnackVideoMutationVariables = Exact<{
1020
1044
  data: RelateToProductsSnackVideoInput;
1021
1045
  }>;
@@ -1258,6 +1282,9 @@ export declare const GetAllCustomizationDocument: DocumentNode<GetAllCustomizati
1258
1282
  export declare const UpdateCustomizationDocument: DocumentNode<UpdateCustomizationMutation, Exact<{
1259
1283
  data: CustomPlayerInput;
1260
1284
  }>>;
1285
+ export declare const GetTimeLineDocument: DocumentNode<GetTimeLineQuery, Exact<{
1286
+ data: GetTimeLineInput;
1287
+ }>>;
1261
1288
  export declare const AppendProductsToSnackVideoDocument: DocumentNode<AppendProductsToSnackVideoMutation, Exact<{
1262
1289
  data: RelateToProductsSnackVideoInput;
1263
1290
  }>>;
@@ -1,5 +1,15 @@
1
+ import { NizzaAccount } from '../../accounts';
2
+ import { NizzaProductDataSource } from './productDataSource';
3
+ export type NizzaState = {
4
+ config: NizzaConfiguration | null;
5
+ ok: boolean;
6
+ account?: NizzaAccount;
7
+ accountName?: string;
8
+ productDataSource?: NizzaProductDataSource;
9
+ };
1
10
  export interface NizzaConfiguration {
2
11
  account: string;
12
+ getProductDataSource?: () => Promise<NizzaProductDataSource> | NizzaProductDataSource;
3
13
  }
4
14
  export interface NizzaCredentials {
5
15
  }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nizza/core",
3
- "version": "0.4.5-alpha.0",
3
+ "version": "0.4.5-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.5-alpha.0",
3
+ "version": "0.4.5-alpha.2",
4
4
  "type": "module",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.cjs",