@nizza/core 0.4.5-alpha.0 → 0.4.5-alpha.10
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/dist/index.cjs +31 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.mjs +2722 -4788
- package/dist/index.mjs.map +1 -1
- package/dist/lib/{nizza-store/event-buses → event-buses}/BroadcastChannelEventBus.d.ts +2 -2
- package/dist/lib/{nizza-store/event-buses → event-buses}/EventEmitter2EventBus.d.ts +1 -1
- package/dist/lib/i18n/buildTranslations.d.ts +5 -2
- package/dist/lib/i18n/index.d.ts +1 -0
- package/dist/lib/i18n/init.d.ts +2 -1
- package/dist/lib/i18n/nizza.d.ts +2 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/mobx/index.d.ts +0 -1
- package/dist/lib/nizza-store/ConfigManager.d.ts +3 -3
- package/dist/lib/nizza-store/NizzaStore.d.ts +3 -21
- package/dist/lib/nizza-store/NizzaStore.v1.d.ts +22 -0
- package/dist/lib/nizza-store/helpers.d.ts +10 -1
- package/dist/lib/nizza-store/index.d.ts +0 -2
- package/dist/lib/types/api-graphql-types.d.ts +28 -0
- package/dist/lib/types/nizza/chat.d.ts +1 -0
- package/dist/lib/types/nizza/globalStore.d.ts +41 -0
- package/dist/lib/types/nizza/index.d.ts +1 -1
- package/dist/lib/types/nizza/main.d.ts +5 -1
- package/dist/lib/types/nizza/product.d.ts +1 -0
- package/dist/lib/utils/downloadFile.d.ts +5 -0
- package/dist/lib/utils/logger.d.ts +7 -27
- package/dist/package.json +3 -2
- package/package.json +2 -1
- package/dist/lib/types/nizza/nizzaGlobalObject.d.ts +0 -5
- /package/dist/lib/{nizza-store/event-buses → event-buses}/index.d.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Attributes, EventBus, EventBusListener, EventBusSubscription } from '
|
|
1
|
+
import { Attributes, EventBus, EventBusListener, EventBusSubscription } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Implementation of EventBus using BroadcastChannel for cross-window communication.
|
|
4
4
|
*/
|
|
@@ -6,7 +6,7 @@ export declare class BroadcastChannelEventBus implements EventBus {
|
|
|
6
6
|
private channel;
|
|
7
7
|
private listeners;
|
|
8
8
|
private eventQueue;
|
|
9
|
-
constructor();
|
|
9
|
+
constructor(channelName: string);
|
|
10
10
|
/**
|
|
11
11
|
* Subscribe a listener function to a specific event with wildcards.
|
|
12
12
|
*
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { i18n } from 'i18next';
|
|
2
|
+
import { TranslationFiles, Translations } from '../types';
|
|
3
|
+
export declare function buildLanguageTranslations(langTranslations: Record<string, Record<string, string>>): Record<string, string>;
|
|
4
|
+
export declare function buildTranslations(translationFiles: TranslationFiles): Translations;
|
|
5
|
+
export declare function registerTranslationsOf(i18Instance: i18n, translationFiles: TranslationFiles): void;
|
package/dist/lib/i18n/index.d.ts
CHANGED
package/dist/lib/i18n/init.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { i18n } from 'i18next';
|
|
2
|
+
export declare function i18Init(i18Instance: i18n): void;
|
package/dist/lib/index.d.ts
CHANGED
package/dist/lib/mobx/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { NizzaAccount } from '../accounts';
|
|
2
|
-
import {
|
|
2
|
+
import { NizzaConfig } from '../types';
|
|
3
3
|
export declare class ConfigManager {
|
|
4
4
|
private _config;
|
|
5
5
|
private _account;
|
|
6
6
|
constructor();
|
|
7
|
-
configure(config:
|
|
8
|
-
get config():
|
|
7
|
+
configure(config: NizzaConfig): Promise<void>;
|
|
8
|
+
get config(): NizzaConfig | null;
|
|
9
9
|
get account(): NizzaAccount;
|
|
10
10
|
get ok(): boolean;
|
|
11
11
|
get accountName(): string;
|
|
@@ -1,22 +1,4 @@
|
|
|
1
|
-
import
|
|
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
|
-
}
|
|
1
|
+
import { NizzaStore } from '../types';
|
|
22
2
|
export declare const nizza: NizzaStore;
|
|
3
|
+
export declare const logger: import("loglevel").Logger;
|
|
4
|
+
export declare const coreLogger: import("loglevel").Logger;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import log from 'loglevel';
|
|
2
|
+
import { NizzaConfig, 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: NizzaConfig): Promise<this>;
|
|
14
|
+
get config(): NizzaConfig | 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
|
-
|
|
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;
|
|
@@ -928,6 +928,7 @@ export type GetAllChatMessageQuery = {
|
|
|
928
928
|
isAdmin?: boolean | null;
|
|
929
929
|
urlGif?: string | null;
|
|
930
930
|
second?: number | null;
|
|
931
|
+
ip?: string | null;
|
|
931
932
|
}> | null;
|
|
932
933
|
} | {
|
|
933
934
|
__typename: 'ErrorGeneral';
|
|
@@ -1016,6 +1017,30 @@ export type UpdateCustomizationMutation = {
|
|
|
1016
1017
|
timestamp: string;
|
|
1017
1018
|
};
|
|
1018
1019
|
};
|
|
1020
|
+
export type GetTimeLineQueryVariables = Exact<{
|
|
1021
|
+
data: GetTimeLineInput;
|
|
1022
|
+
}>;
|
|
1023
|
+
export type GetTimeLineQuery = {
|
|
1024
|
+
__typename?: 'Query';
|
|
1025
|
+
getTimeLine: {
|
|
1026
|
+
__typename: 'ErrorGeneral';
|
|
1027
|
+
message: string;
|
|
1028
|
+
statusCode: string;
|
|
1029
|
+
timestamp: string;
|
|
1030
|
+
} | {
|
|
1031
|
+
__typename: 'TimeLineArray';
|
|
1032
|
+
data?: Array<{
|
|
1033
|
+
__typename?: 'TimeLine';
|
|
1034
|
+
time: string;
|
|
1035
|
+
likes: number;
|
|
1036
|
+
comments: number;
|
|
1037
|
+
viewers: number;
|
|
1038
|
+
orders: number;
|
|
1039
|
+
minute: number;
|
|
1040
|
+
hour: number;
|
|
1041
|
+
}> | null;
|
|
1042
|
+
};
|
|
1043
|
+
};
|
|
1019
1044
|
export type AppendProductsToSnackVideoMutationVariables = Exact<{
|
|
1020
1045
|
data: RelateToProductsSnackVideoInput;
|
|
1021
1046
|
}>;
|
|
@@ -1258,6 +1283,9 @@ export declare const GetAllCustomizationDocument: DocumentNode<GetAllCustomizati
|
|
|
1258
1283
|
export declare const UpdateCustomizationDocument: DocumentNode<UpdateCustomizationMutation, Exact<{
|
|
1259
1284
|
data: CustomPlayerInput;
|
|
1260
1285
|
}>>;
|
|
1286
|
+
export declare const GetTimeLineDocument: DocumentNode<GetTimeLineQuery, Exact<{
|
|
1287
|
+
data: GetTimeLineInput;
|
|
1288
|
+
}>>;
|
|
1261
1289
|
export declare const AppendProductsToSnackVideoDocument: DocumentNode<AppendProductsToSnackVideoMutation, Exact<{
|
|
1262
1290
|
data: RelateToProductsSnackVideoInput;
|
|
1263
1291
|
}>>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { NizzaAccount } from '../../accounts';
|
|
2
|
+
import { BroadcastChannelEventBus } from '../../event-buses';
|
|
3
|
+
import { Logger } from '../../utils';
|
|
4
|
+
import { NizzaProductDataSource } from './productDataSource';
|
|
5
|
+
export interface GlobalStoreConfig {
|
|
6
|
+
account: string;
|
|
7
|
+
getProductDataSource?: () => Promise<any> | any;
|
|
8
|
+
}
|
|
9
|
+
export interface GlobalState {
|
|
10
|
+
config: GlobalStoreConfig | null;
|
|
11
|
+
ok: boolean;
|
|
12
|
+
account?: any;
|
|
13
|
+
accountName?: string;
|
|
14
|
+
productDataSource?: any;
|
|
15
|
+
}
|
|
16
|
+
export interface GlobalStore {
|
|
17
|
+
state: GlobalState;
|
|
18
|
+
instanceId: string;
|
|
19
|
+
log: Logger;
|
|
20
|
+
eventBus: BroadcastChannelEventBus;
|
|
21
|
+
readonly account?: any;
|
|
22
|
+
readonly productDataSource?: any;
|
|
23
|
+
configure: (config: GlobalStoreConfig) => Promise<void>;
|
|
24
|
+
setProductDataSource: (dataSource: any) => void;
|
|
25
|
+
}
|
|
26
|
+
export interface NizzaConfig extends GlobalStoreConfig {
|
|
27
|
+
account: string;
|
|
28
|
+
getProductDataSource?: () => Promise<NizzaProductDataSource> | NizzaProductDataSource;
|
|
29
|
+
}
|
|
30
|
+
export interface NizzaState extends GlobalState {
|
|
31
|
+
config: NizzaConfig | null;
|
|
32
|
+
account?: NizzaAccount;
|
|
33
|
+
productDataSource?: NizzaProductDataSource;
|
|
34
|
+
}
|
|
35
|
+
export interface NizzaStore extends GlobalStore {
|
|
36
|
+
state: NizzaState;
|
|
37
|
+
configure: (config: NizzaConfig) => Promise<void>;
|
|
38
|
+
setProductDataSource: (dataSource: NizzaProductDataSource) => void;
|
|
39
|
+
readonly account?: NizzaAccount;
|
|
40
|
+
readonly productDataSource?: NizzaProductDataSource;
|
|
41
|
+
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { NizzaProduct } from './product';
|
|
2
|
-
export type
|
|
2
|
+
export type NizzaAddToCartHandlerParams = {
|
|
3
|
+
product: NizzaProduct;
|
|
4
|
+
quantity: number;
|
|
5
|
+
};
|
|
6
|
+
export type NizzaAddToCartHandler = (params: NizzaAddToCartHandlerParams) => Promise<void>;
|
|
3
7
|
export type NizzaSetUTMHandler = (utm: string) => Promise<void>;
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
/// <reference types="node" />
|
|
5
|
+
/// <reference types="node" />
|
|
1
6
|
export declare function downloadFile(filename: string, url: string, ext: string): void;
|
|
2
7
|
export declare const jsDownload: (data: Blob, filename: string, mime?: string) => boolean | NodeJS.Timeout;
|
|
@@ -1,27 +1,7 @@
|
|
|
1
|
-
import { Logger } from 'loglevel';
|
|
2
|
-
export declare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*/
|
|
9
|
-
export declare function createLogger(context: string): Logger;
|
|
10
|
-
/**
|
|
11
|
-
* Register a logger instance in registry
|
|
12
|
-
* @param {string} context - The context of the logger to register
|
|
13
|
-
* @param {Logger} logger - The logger instance
|
|
14
|
-
*/
|
|
15
|
-
export declare function registerLogger(context: string, logger: Logger): void;
|
|
16
|
-
/**
|
|
17
|
-
* Get a logger instance from registry by context
|
|
18
|
-
* @param {string} context - The context to get the logger for
|
|
19
|
-
* @returns {Logger} The registered LogLevel logger
|
|
20
|
-
*/
|
|
21
|
-
export declare function getLogger(context: string): Logger;
|
|
22
|
-
/**
|
|
23
|
-
* Initialize a logger - create, register and return instance
|
|
24
|
-
* @param {string} context - The context to initialize logger for
|
|
25
|
-
* @returns {Logger} The initialized LogLevel logger instance
|
|
26
|
-
*/
|
|
27
|
-
export declare function initializeLogger(context: string): Logger;
|
|
1
|
+
import { Logger as LogLevelLogger } from 'loglevel';
|
|
2
|
+
export declare class Logger {
|
|
3
|
+
private defaultLevel;
|
|
4
|
+
private namePrefix;
|
|
5
|
+
constructor(namePrefix?: string);
|
|
6
|
+
createLogger(context: string): LogLevelLogger;
|
|
7
|
+
}
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nizza/core",
|
|
3
|
-
"version": "0.4.5-alpha.
|
|
3
|
+
"version": "0.4.5-alpha.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -9,5 +9,6 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
|
-
"scripts": {}
|
|
12
|
+
"scripts": {},
|
|
13
|
+
"dependencies": {}
|
|
13
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nizza/core",
|
|
3
|
-
"version": "0.4.5-alpha.
|
|
3
|
+
"version": "0.4.5-alpha.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -9,5 +9,6 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
|
+
"dependencies": {},
|
|
12
13
|
"scripts": {}
|
|
13
14
|
}
|
|
File without changes
|