@liquidcommercedev/rmn-sdk 1.4.1-beta.1 → 1.4.1-beta.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.cjs +17131 -0
- package/dist/index.esm.js +17127 -0
- package/dist/types/common/helpers/helpers.interface.d.ts +14 -0
- package/dist/types/common/helpers/index.d.ts +2 -0
- package/dist/types/common/helpers/object.helper.d.ts +95 -0
- package/dist/types/common/helpers/string.helper.d.ts +39 -0
- package/dist/types/common/http/api.constant.d.ts +6 -0
- package/dist/types/common/http/api.interface.d.ts +39 -0
- package/dist/types/common/http/base.api.d.ts +79 -0
- package/dist/types/common/http/encrypted.api.d.ts +66 -0
- package/dist/types/common/http/error.api.d.ts +5 -0
- package/dist/types/common/http/index.d.ts +5 -0
- package/dist/types/common/singleton-manager/index.d.ts +1 -0
- package/dist/types/common/singleton-manager/singleton-manager.d.ts +12 -0
- package/dist/types/enums.d.ts +7 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.umd.d.ts +2 -0
- package/dist/types/modules/auth/auth.constant.d.ts +1 -0
- package/dist/types/modules/auth/auth.interface.d.ts +27 -0
- package/dist/types/modules/auth/auth.service.d.ts +22 -0
- package/dist/types/modules/auth/index.d.ts +3 -0
- package/dist/types/modules/spot/html/index.d.ts +1 -0
- package/dist/types/modules/spot/html/spot.element.service.d.ts +7 -0
- package/dist/types/modules/spot/html/spot.element.shadow-root.d.ts +4 -0
- package/dist/types/modules/spot/html/templates/iab/billboard/billboard-v1.template.d.ts +2 -0
- package/dist/types/modules/spot/html/templates/iab/billboard/billboard-v2.template.d.ts +2 -0
- package/dist/types/modules/spot/html/templates/iab/billboard/billboard-v3.template.d.ts +2 -0
- package/dist/types/modules/spot/html/templates/iab/billboard/index.d.ts +3 -0
- package/dist/types/modules/spot/html/templates/iab/constants/fonts.constant.d.ts +3 -0
- package/dist/types/modules/spot/html/templates/iab/in-text/in-text-v1.template.d.ts +2 -0
- package/dist/types/modules/spot/html/templates/iab/in-text/index.d.ts +1 -0
- package/dist/types/modules/spot/html/templates/iab/index.d.ts +7 -0
- package/dist/types/modules/spot/html/templates/iab/large-leaderboard/index.d.ts +2 -0
- package/dist/types/modules/spot/html/templates/iab/large-leaderboard/large-leaderboard-v1.template.d.ts +2 -0
- package/dist/types/modules/spot/html/templates/iab/large-leaderboard/large-leaderboard-v2.template.d.ts +2 -0
- package/dist/types/modules/spot/html/templates/iab/large-rectangle/index.d.ts +1 -0
- package/dist/types/modules/spot/html/templates/iab/large-rectangle/large-rectangle-v1.template.d.ts +2 -0
- package/dist/types/modules/spot/html/templates/iab/square/index.d.ts +2 -0
- package/dist/types/modules/spot/html/templates/iab/square/square-v1.template.d.ts +2 -0
- package/dist/types/modules/spot/html/templates/iab/square/square-v2.template.d.ts +2 -0
- package/dist/types/modules/spot/html/templates/iab/vertical-rectangle/index.d.ts +1 -0
- package/dist/types/modules/spot/html/templates/iab/vertical-rectangle/vertical-rectangle-v1.template.d.ts +2 -0
- package/dist/types/modules/spot/html/templates/iab/wide-skyscraper/index.d.ts +1 -0
- package/dist/types/modules/spot/html/templates/iab/wide-skyscraper/wide-skyscraper-v1.template.d.ts +2 -0
- package/dist/types/modules/spot/html/templates/index.d.ts +1 -0
- package/dist/types/modules/spot/html/templates/reservebar/collection-banner-without-text-block.template.d.ts +2 -0
- package/dist/types/modules/spot/html/templates/reservebar/homepage-hero-full-image.template.d.ts +2 -0
- package/dist/types/modules/spot/html/templates/reservebar/homepage-hero-three-tile.template.d.ts +2 -0
- package/dist/types/modules/spot/html/templates/reservebar/homepage-hero-two-tile.template.d.ts +2 -0
- package/dist/types/modules/spot/html/templates/reservebar/index.d.ts +8 -0
- package/dist/types/modules/spot/html/templates/reservebar/large-category-image-tout.template.d.ts +2 -0
- package/dist/types/modules/spot/html/templates/reservebar/navigation-banner.template.d.ts +2 -0
- package/dist/types/modules/spot/html/templates/reservebar/small-category-image-tout.template.d.ts +2 -0
- package/dist/types/modules/spot/html/templates/reservebar/small-discover-tout.template.d.ts +2 -0
- package/dist/types/modules/spot/html/templates/spot.template.d.ts +21 -0
- package/dist/types/modules/spot/index.d.ts +6 -0
- package/dist/types/modules/spot/spot.constant.d.ts +3 -0
- package/dist/types/modules/spot/spot.enum.d.ts +57 -0
- package/dist/types/modules/spot/spot.html.service.d.ts +22 -0
- package/dist/types/modules/spot/spot.interface.d.ts +44 -0
- package/dist/types/modules/spot/spot.selection.service.d.ts +16 -0
- package/dist/types/modules/spot/spot.type.d.ts +27 -0
- package/dist/types/rmn-client.d.ts +58 -0
- package/dist/types/types.d.ts +11 -0
- package/package.json +34 -14
- package/umd/liquidcommerce-rmn-sdk.min.js +1 -0
- package/CHANGELOG.md +0 -65
- package/dist/index.d.ts +0 -192
- package/dist/index.js +0 -19
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -19
- package/dist/index.mjs.map +0 -1
@@ -0,0 +1,14 @@
|
|
1
|
+
export interface IObjectHelper {
|
2
|
+
merge<T>(target: Record<string, T>, ...sources: Array<Record<string, any>>): Record<string, any>;
|
3
|
+
values<T>(source: Record<string, T>): T[];
|
4
|
+
includes(source: Record<string, any>, key: string): boolean;
|
5
|
+
valuesIncludes(source: Record<string, any>, value: string): boolean;
|
6
|
+
hasAllValues(source: Record<string, any>, keys: string[]): boolean;
|
7
|
+
isArray(obj: any): boolean;
|
8
|
+
}
|
9
|
+
export interface IStringHelper {
|
10
|
+
includes(val: string | string[], search: string, start?: number): boolean;
|
11
|
+
split(val: string, delimiter: string): string[];
|
12
|
+
upperCase(val: string): string;
|
13
|
+
toString(val: unknown): string;
|
14
|
+
}
|
@@ -0,0 +1,95 @@
|
|
1
|
+
import type { IObjectHelper } from './helpers.interface';
|
2
|
+
export declare class ObjectHelper implements IObjectHelper {
|
3
|
+
/**
|
4
|
+
* Returns an instance of the ObjectHelper class.
|
5
|
+
*
|
6
|
+
* @return {ObjectHelper} An instance of the ObjectHelper class.
|
7
|
+
*/
|
8
|
+
static getInstance(): ObjectHelper;
|
9
|
+
/**
|
10
|
+
* Merges multiple source objects into a target object.
|
11
|
+
*
|
12
|
+
* @template T - The type of values in the target object.
|
13
|
+
* @param {Record<string, T>} target - The target object to merge into.
|
14
|
+
* @param {...Array<Record<string, any>>} sources - The source objects to merge.
|
15
|
+
* @returns {Record<string, any>} - The merged object.
|
16
|
+
*/
|
17
|
+
merge<T>(target: Record<string, T>, ...sources: Array<Record<string, any>>): Record<string, any>;
|
18
|
+
/**
|
19
|
+
* Retrieves the values of an input object and returns them as an array.
|
20
|
+
*
|
21
|
+
* @param {Record<string, T>} source - The input object.
|
22
|
+
* @template T - The type of the values in the object.
|
23
|
+
* @return {T[]} - An array containing the values of the input object.
|
24
|
+
*/
|
25
|
+
values<T>(source: Record<string, T>): T[];
|
26
|
+
/**
|
27
|
+
* Checks if a given key is present in a source object.
|
28
|
+
*
|
29
|
+
* @param {Record<string, any>} source - The object to search within.
|
30
|
+
* @param {string} key - The key to check for.
|
31
|
+
* @return {boolean} - True if the key is present in the source, false otherwise.
|
32
|
+
*/
|
33
|
+
includes(source: Record<string, any>, key: string): boolean;
|
34
|
+
/**
|
35
|
+
* Checks if the given value is included in the values of a source object.
|
36
|
+
*
|
37
|
+
* @param {Record<string, any>} source - The source object to check the values from.
|
38
|
+
* @param {string} value - The value to search for in the source object values.
|
39
|
+
* @returns {boolean} - True if the value is found in the source object values, false otherwise.
|
40
|
+
*/
|
41
|
+
valuesIncludes(source: Record<string, any>, value: string): boolean;
|
42
|
+
/**
|
43
|
+
* Checks if all keys from the given 'keys' array are present in the 'source' object.
|
44
|
+
*
|
45
|
+
* @param {Record<string, any>} source - The object to be checked.
|
46
|
+
* @param {string[]} keys - The array of keys to be checked in the 'source' object.
|
47
|
+
* @return {boolean} - Returns true if all keys are present in the 'source' object,
|
48
|
+
* false otherwise.
|
49
|
+
*/
|
50
|
+
hasAllValues(source: Record<string, any>, keys: string[]): boolean;
|
51
|
+
/**
|
52
|
+
* Checks if the given object is an array.
|
53
|
+
*
|
54
|
+
* @param {any} obj - The object to check.
|
55
|
+
* @return {boolean} - Returns true if the object is an array, otherwise returns false.
|
56
|
+
*/
|
57
|
+
isArray(obj: any): boolean;
|
58
|
+
/**
|
59
|
+
* Merges the value with the target value.
|
60
|
+
*
|
61
|
+
* @param {any[] | Record<string, T>} targetValue - The target value to merge with.
|
62
|
+
* @param {Record<string, any>} value - The value to merge.
|
63
|
+
* @returns {Record<string, any>} - The merged value.
|
64
|
+
*/
|
65
|
+
private mergeValue;
|
66
|
+
/**
|
67
|
+
* Merges the values of an array or object with a given array of objects and returns the merged result as an object.
|
68
|
+
* If the targetValue is not an array, it returns a copy of the value array.
|
69
|
+
*
|
70
|
+
* @param targetValue - The target array or object to merge values into.
|
71
|
+
* @param value - The array of objects containing values to merge into the targetValue.
|
72
|
+
* @returns The merged result as an object.
|
73
|
+
*/
|
74
|
+
private mergeArrayValues;
|
75
|
+
/**
|
76
|
+
* Merges the values of two objects or arrays into a single object.
|
77
|
+
* If the target value is an array or a record, the method merges the values into the target value.
|
78
|
+
* If the target value is not an array or a record, it returns the new value.
|
79
|
+
*
|
80
|
+
* @template T - The type of the values in the target object.
|
81
|
+
* @param {object[]|Record<string, T>} targetValue - The target object or array to merge the values into.
|
82
|
+
* @param {Record<string, any>} value - The new values to merge into the target object or array.
|
83
|
+
* @returns {Record<string, any>} - The merged object or array.
|
84
|
+
*/
|
85
|
+
private mergeObjectValues;
|
86
|
+
/**
|
87
|
+
* Merges the properties of the source object into the target object.
|
88
|
+
*
|
89
|
+
* @param {Record<string, any>} target - The target object to merge the properties into.
|
90
|
+
* @param {Record<string, any>} source - The source object containing the properties to merge.
|
91
|
+
*
|
92
|
+
* @return {void} - This method does not return any value.
|
93
|
+
*/
|
94
|
+
private innerMerge;
|
95
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import type { IStringHelper } from './helpers.interface';
|
2
|
+
export declare class StringHelper implements IStringHelper {
|
3
|
+
/**
|
4
|
+
* Returns an instance of the StringHelper class.
|
5
|
+
* @return {StringHelper} An instance of the StringHelper class.
|
6
|
+
*/
|
7
|
+
static getInstance(): StringHelper;
|
8
|
+
/**
|
9
|
+
* Checks whether a string or an array of strings includes a given search string.
|
10
|
+
*
|
11
|
+
* @param {string | string[]} val - The string or array of strings to search in.
|
12
|
+
* @param {string} search - The search string to look for in the value.
|
13
|
+
* @param {number} [start=0] - The optional starting index for the search.
|
14
|
+
* @return {boolean} - Returns true if the search string is found, otherwise false.
|
15
|
+
*/
|
16
|
+
includes(val: string | string[], search: string, start?: number): boolean;
|
17
|
+
/**
|
18
|
+
* Splits a string into an array of substrings using a given delimiter.
|
19
|
+
*
|
20
|
+
* @param {string} val - The string to be split.
|
21
|
+
* @param {string} delimiter - The delimiter used to split the string.
|
22
|
+
* @return {string[]} - An array of substrings.
|
23
|
+
*/
|
24
|
+
split(val: string, delimiter: string): string[];
|
25
|
+
/**
|
26
|
+
* Converts a given string to uppercase.
|
27
|
+
*
|
28
|
+
* @param {string} val - The string to be converted.
|
29
|
+
* @return {string} - The uppercase version of the input string.
|
30
|
+
*/
|
31
|
+
upperCase(val: string): string;
|
32
|
+
/**
|
33
|
+
* Converts the specified value to a string representation.
|
34
|
+
*
|
35
|
+
* @param {unknown} val - The value to convert to a string.
|
36
|
+
* @return {string} - The string representation of the value.
|
37
|
+
*/
|
38
|
+
toString(val: unknown): string;
|
39
|
+
}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import type { IAuthConfigs } from '../../modules/auth';
|
2
|
+
export declare const REQUEST_CLOUD_PROTECTED_KEY = "X-Liquid-Protected";
|
3
|
+
export declare const REQUEST_CLOUD_PROTECTED_TIMESTAMP = "X-Liquid-Timestamp";
|
4
|
+
export declare const REQUEST_CLOUD_API_KEY = "X-Liquid-Api-Key";
|
5
|
+
export declare const REQUEST_CLOUD_API_ENV = "X-Liquid-Api-Env";
|
6
|
+
export declare const SDK_CONFIG: IAuthConfigs;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import type { AxiosRequestConfig, AxiosResponse } from 'axios';
|
2
|
+
import type { JWTVerifyResult } from 'jose';
|
3
|
+
import type { IAuthCredentials } from '../../modules/auth';
|
4
|
+
import type { ApiError } from './error.api';
|
5
|
+
export type Result<T, E = Error> = {
|
6
|
+
isOk: true;
|
7
|
+
val: T;
|
8
|
+
isErr: false;
|
9
|
+
} | {
|
10
|
+
isOk: false;
|
11
|
+
val: null;
|
12
|
+
isErr: E;
|
13
|
+
};
|
14
|
+
export interface IResponseMetadataDefault {
|
15
|
+
timestamp: number;
|
16
|
+
timezone: string;
|
17
|
+
requestId: string;
|
18
|
+
path: string;
|
19
|
+
version: string;
|
20
|
+
repoVersion: string;
|
21
|
+
[key: string]: any;
|
22
|
+
}
|
23
|
+
export interface IResponseDefault<T = Record<string, any>> {
|
24
|
+
statusCode?: number;
|
25
|
+
message?: string;
|
26
|
+
refresh: IAuthCredentials;
|
27
|
+
_metadata?: IResponseMetadataDefault;
|
28
|
+
data?: T;
|
29
|
+
}
|
30
|
+
export interface IEncryptedApi {
|
31
|
+
handleEncryption(data: Record<string, any>, LT: number): Promise<string | undefined>;
|
32
|
+
handleDecryption(data: string, LT: number): Promise<JWTVerifyResult>;
|
33
|
+
}
|
34
|
+
export declare abstract class BaseApiAbstract {
|
35
|
+
protected abstract getConfig(): AxiosRequestConfig | Record<string, any>;
|
36
|
+
protected abstract get<T>(path: string, configOverrides: AxiosRequestConfig): Promise<Result<T | null, ApiError>>;
|
37
|
+
protected abstract post<T>(path: string, data: Record<string, any>, configOverrides: AxiosRequestConfig): Promise<Result<T | null, ApiError>>;
|
38
|
+
protected abstract createRequest<T>(subPath: string | null, configOverrides: AxiosRequestConfig | null, requestFunction: (url: string, config: AxiosRequestConfig | undefined) => Promise<AxiosResponse | null>): Promise<Result<T | null, ApiError>>;
|
39
|
+
}
|
@@ -0,0 +1,79 @@
|
|
1
|
+
import type { AxiosRequestConfig, AxiosResponse, RawAxiosRequestHeaders } from 'axios';
|
2
|
+
import type { IAuthCredentials } from '../../modules/auth';
|
3
|
+
import type { Result } from './api.interface';
|
4
|
+
import { BaseApiAbstract } from './api.interface';
|
5
|
+
import { ApiError } from './error.api';
|
6
|
+
export declare class BaseApi extends BaseApiAbstract {
|
7
|
+
readonly authInfo: IAuthCredentials;
|
8
|
+
private readonly baseUrl;
|
9
|
+
private readonly objectHelper;
|
10
|
+
private readonly encryptedApi;
|
11
|
+
private readonly client;
|
12
|
+
constructor(auth: IAuthCredentials);
|
13
|
+
/**
|
14
|
+
* Retrieve the configuration for making an Axios request.
|
15
|
+
*
|
16
|
+
* @param {RawAxiosRequestHeaders} [headers] - Optional headers to be included in the request.
|
17
|
+
* @return {AxiosRequestConfig|Record<string, any>} The configuration object containing the request headers.
|
18
|
+
*/
|
19
|
+
protected getConfig(headers?: RawAxiosRequestHeaders): AxiosRequestConfig | Record<string, any>;
|
20
|
+
/**
|
21
|
+
* Retrieves data from the specified path using a GET request.
|
22
|
+
*
|
23
|
+
* @param {string} path - The path to retrieve data from.
|
24
|
+
* @param {AxiosRequestConfig} configOverrides - Additional configuration options for the request.
|
25
|
+
* @returns {Promise<Result<T | null, ApiError>>} A promise that resolves to the result, which can be either data of type T or null, or an error of type ApiError.
|
26
|
+
*/
|
27
|
+
protected get<T>(path: string, configOverrides: AxiosRequestConfig): Promise<Result<T | null, ApiError>>;
|
28
|
+
/**
|
29
|
+
* Sends a POST request to the specified path with the given data and configuration overrides.
|
30
|
+
*
|
31
|
+
* @param {string} path - The path to send the POST request to.
|
32
|
+
* @param {Record<string, any>} data - The data to send with the request.
|
33
|
+
* @param {AxiosRequestConfig} configOverrides - The configuration overrides for the request.
|
34
|
+
*
|
35
|
+
* @returns {Promise<Result<T | null, ApiError>>} - A Promise that resolves to the result of the POST request.
|
36
|
+
*/
|
37
|
+
protected post<T>(path: string, data: Record<string, any>, configOverrides: AxiosRequestConfig): Promise<Result<T | null, ApiError>>;
|
38
|
+
/**
|
39
|
+
* Create a request to the API server.
|
40
|
+
* @param {string | null} subPath - The subpath of the API endpoint, can be null if there is no subpath.
|
41
|
+
* @param {AxiosRequestConfig | null} configOverrides - The config overrides for the Axios request, can be null if there are no overrides.
|
42
|
+
* @param {function} requestFunction - The function to send the request, must accept the URL and config as parameters and return a promise of the Axios response or null.
|
43
|
+
* @returns {Promise<Result<T | null, ApiError>>} - A promise that resolves to a Result object containing the response data or null on success, or an ApiError object on failure.
|
44
|
+
*/
|
45
|
+
protected createRequest<T>(subPath: string | null, configOverrides: AxiosRequestConfig | null, requestFunction: (url: string, config: AxiosRequestConfig | undefined) => Promise<AxiosResponse | null>): Promise<Result<T | null, ApiError>>;
|
46
|
+
/**
|
47
|
+
* Private method that creates a full Axios request configuration.
|
48
|
+
*
|
49
|
+
* @param {AxiosRequestConfig | null} configOverrides - The optional overrides for the Axios request configuration.
|
50
|
+
* @returns {AxiosRequestConfig} - The merged Axios request configuration.
|
51
|
+
*/
|
52
|
+
private createFullConfig;
|
53
|
+
/**
|
54
|
+
* Sends a request to the specified URL with the given configuration.
|
55
|
+
*
|
56
|
+
* @param {string} url - The URL to send the request to.
|
57
|
+
* @param {AxiosRequestConfig} config - The configuration options for the request.
|
58
|
+
* @param {function} requestFunction - The function to use for sending the request.
|
59
|
+
* It should have the following signature: (url: string, config: AxiosRequestConfig | undefined) => Promise<AxiosResponse | null>
|
60
|
+
* @return {Promise<AxiosResponse | null>} - A Promise that resolves with the response from the request function,
|
61
|
+
* or null if the request was unsuccessful.
|
62
|
+
*/
|
63
|
+
private sendRequest;
|
64
|
+
/**
|
65
|
+
* Gets the response from an Axios response object and handles decryption if necessary.
|
66
|
+
*
|
67
|
+
* @template T - The type of the response data.
|
68
|
+
* @param {AxiosResponse | null} response - The Axios response object.
|
69
|
+
* @returns {Promise<Result<T | null, ApiError>>} - A promise that resolves to a Result object containing the response data or an ApiError.
|
70
|
+
*/
|
71
|
+
private getResponse;
|
72
|
+
/**
|
73
|
+
* Creates a URL by concatenating the base URL with the provided path.
|
74
|
+
*
|
75
|
+
* @param {string | null} path - The path to be appended to the base URL.
|
76
|
+
* @return {string} The concatenated URL.
|
77
|
+
*/
|
78
|
+
private createURL;
|
79
|
+
}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import type { JWTVerifyResult } from 'jose';
|
2
|
+
import type { IEncryptedApi } from './api.interface';
|
3
|
+
export declare class EncryptedApi implements IEncryptedApi {
|
4
|
+
private apiKey;
|
5
|
+
constructor(apiKey: string);
|
6
|
+
/**
|
7
|
+
* Returns an instance of the EncryptedAPI class.
|
8
|
+
*
|
9
|
+
* @returns {EncryptedApi} The instance of the EncryptedAPI class.
|
10
|
+
*/
|
11
|
+
static getInstance(apiKey: string): EncryptedApi;
|
12
|
+
/**
|
13
|
+
* Encrypts the given data using the provided encryption key and LT value.
|
14
|
+
*
|
15
|
+
* @param {Record<string, any>} data - The data to be encrypted.
|
16
|
+
* @param {number} LT - The LT (Lifetime) value used for encryption.
|
17
|
+
* @returns {Promise<string | undefined>} - The encrypted data as a string, or undefined if encryption fails.
|
18
|
+
*/
|
19
|
+
handleEncryption(data: Record<string, any>, LT: number): Promise<string | undefined>;
|
20
|
+
/**
|
21
|
+
* Decrypts the given data using a key generated based on LT.
|
22
|
+
*
|
23
|
+
* @param {string} data - The data to be decrypted.
|
24
|
+
* @param {number} LT - The LT value used to generate the decryption key.
|
25
|
+
* @return {Promise<JWTVerifyResult>} A promise that resolves with the decrypted data.
|
26
|
+
*/
|
27
|
+
handleDecryption(data: string, LT: number): Promise<JWTVerifyResult>;
|
28
|
+
/**
|
29
|
+
* Returns the key based on the given LT value.
|
30
|
+
*
|
31
|
+
* @param {number} LT - The LT value used to retrieve the key.
|
32
|
+
* @returns {string} - The key retrieved from the credentials.
|
33
|
+
*/
|
34
|
+
private getKey;
|
35
|
+
/**
|
36
|
+
* Moves the given timestamp forward by the specified number of minutes.
|
37
|
+
*
|
38
|
+
* @param {number} minutes - The number of minutes to move forward.
|
39
|
+
* @param {number} LT - The initial timestamp in milliseconds.
|
40
|
+
* @return {number} - The new timestamp after moving forward by the specified number of minutes.
|
41
|
+
*/
|
42
|
+
private forwardInMinutes;
|
43
|
+
/**
|
44
|
+
* Decrypts the given data using the specified key and returns the result as a Promise of JWTVerifyResult.
|
45
|
+
*
|
46
|
+
* @param {string} data - The data to be decrypted.
|
47
|
+
* @param {string} key - The key used for decryption.
|
48
|
+
* @return {Promise<JWTVerifyResult>} A Promise that resolves to the decrypted JWT payload.
|
49
|
+
*/
|
50
|
+
joseDecrypt(data: string, key: string): Promise<JWTVerifyResult>;
|
51
|
+
/**
|
52
|
+
* Encrypts and signs the given data using the JOSE encryption standard.
|
53
|
+
* @param {Record<string, any>} data - The data to encrypt and sign.
|
54
|
+
* @param {string} key - The encryption key.
|
55
|
+
* @param {Date | number} exp - The expiration time for the encrypted data.
|
56
|
+
* @returns {Promise<string>} - The encrypted and signed data as a string.
|
57
|
+
*/
|
58
|
+
private joseEncrypt;
|
59
|
+
/**
|
60
|
+
* Handles the error by throwing an ApiError.
|
61
|
+
*
|
62
|
+
* @param {unknown} error - The error object to handle.
|
63
|
+
* @throws {ApiError} - The ApiError object.
|
64
|
+
*/
|
65
|
+
private handleError;
|
66
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './singleton-manager';
|
@@ -0,0 +1,12 @@
|
|
1
|
+
export declare class SingletonManager {
|
2
|
+
private static instances;
|
3
|
+
/**
|
4
|
+
* Retrieves an instance of the specified class using the provided instance creator function.
|
5
|
+
*
|
6
|
+
* @template T The type of the instance.
|
7
|
+
* @param {string} className The name of the class.
|
8
|
+
* @param {() => T} instanceCreator The function that creates the instance.
|
9
|
+
* @returns {T} The instance of the specified class.
|
10
|
+
*/
|
11
|
+
static getInstance<T>(className: string, instanceCreator: () => T): T;
|
12
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const AUTH_API_PATH = "/auth";
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import type { RMN_ENV } from '../../enums';
|
2
|
+
export interface IAuthCredentials {
|
3
|
+
authenticated: boolean;
|
4
|
+
token: string;
|
5
|
+
apiKey: string;
|
6
|
+
env: RMN_ENV;
|
7
|
+
}
|
8
|
+
export interface IAuthResponse {
|
9
|
+
statusCode: number;
|
10
|
+
message: string;
|
11
|
+
data: IAuthCredentials | Record<string, any>;
|
12
|
+
}
|
13
|
+
export interface IAuthUrls {
|
14
|
+
local: string;
|
15
|
+
development: string;
|
16
|
+
staging: string;
|
17
|
+
production: string;
|
18
|
+
}
|
19
|
+
export interface IAuthConfigs {
|
20
|
+
url: IAuthUrls;
|
21
|
+
apiHeader: string;
|
22
|
+
accessHeader: string;
|
23
|
+
credentials: IAuthCredentials;
|
24
|
+
}
|
25
|
+
export interface IAuthService {
|
26
|
+
initialize(): Promise<IAuthCredentials>;
|
27
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { BaseApi } from '../../common/http';
|
2
|
+
import type { RMN_ENV } from '../../enums';
|
3
|
+
import type { IAuthCredentials, IAuthService } from './auth.interface';
|
4
|
+
declare class AuthService extends BaseApi implements IAuthService {
|
5
|
+
private constructor();
|
6
|
+
/**
|
7
|
+
* Retrieves the singleton instance of the AuthService class.
|
8
|
+
*
|
9
|
+
* @param {string} apiKey - The API key used for authentication.
|
10
|
+
* @param {RMN_ENV} env - The environment enum value.
|
11
|
+
* @returns {AuthService} The singleton instance of the AuthService class.
|
12
|
+
*/
|
13
|
+
static getInstance(apiKey: string, env: RMN_ENV): AuthService;
|
14
|
+
/**
|
15
|
+
* Initializes the authentication process.
|
16
|
+
*
|
17
|
+
* @returns {Promise<IAuthCredentials>} A Promise that resolves to the authenticated credentials.
|
18
|
+
* @throws {Error} If there is an error during authentication or the authentication response is unsuccessful.
|
19
|
+
*/
|
20
|
+
initialize(): Promise<IAuthCredentials>;
|
21
|
+
}
|
22
|
+
export default AuthService;
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './spot.element.service';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './in-text-v1.template';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './large-rectangle-v1.template';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './vertical-rectangle-v1.template';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './wide-skyscraper-v1.template';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './spot.template';
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export * from './collection-banner-without-text-block.template';
|
2
|
+
export * from './homepage-hero-full-image.template';
|
3
|
+
export * from './homepage-hero-three-tile.template';
|
4
|
+
export * from './homepage-hero-two-tile.template';
|
5
|
+
export * from './large-category-image-tout.template';
|
6
|
+
export * from './navigation-banner.template';
|
7
|
+
export * from './small-category-image-tout.template';
|
8
|
+
export * from './small-discover-tout.template';
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import type { ISpot } from 'types';
|
2
|
+
export declare enum ENUM_SPOT_ELEMENT_ATTRIBUTE {
|
3
|
+
WIDTH = "width",
|
4
|
+
HEIGHT = "height",
|
5
|
+
FLUID = "fluid",
|
6
|
+
REDIRECT_ON_CLICK = "redirect-on-click"
|
7
|
+
}
|
8
|
+
export interface ISpotHtmlAttribute {
|
9
|
+
[ENUM_SPOT_ELEMENT_ATTRIBUTE.WIDTH]: number;
|
10
|
+
[ENUM_SPOT_ELEMENT_ATTRIBUTE.HEIGHT]: number;
|
11
|
+
[ENUM_SPOT_ELEMENT_ATTRIBUTE.FLUID]: string;
|
12
|
+
[ENUM_SPOT_ELEMENT_ATTRIBUTE.REDIRECT_ON_CLICK]: string;
|
13
|
+
}
|
14
|
+
/**
|
15
|
+
* Creates the spot html string based on the provided spot data.
|
16
|
+
*
|
17
|
+
* @param {ISpot} data - The spot data.
|
18
|
+
*
|
19
|
+
* @return {string} - The spot html string.
|
20
|
+
*/
|
21
|
+
export declare const GET_SPOT_TEMPLATE_HTML_STRING: (data: ISpot) => string;
|