@rebuy/rebuy 1.5.0 → 1.6.0-alpha.1
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/api.d.ts +30 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/client.d.ts +13 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/cookie.d.ts +57 -0
- package/dist/cookie.d.ts.map +1 -0
- package/dist/geolocation.d.ts +6 -0
- package/dist/geolocation.d.ts.map +1 -0
- package/dist/identity.d.ts +10 -0
- package/dist/identity.d.ts.map +1 -0
- package/{index.js → dist/index.d.ts} +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +790 -0
- package/dist/index.js.map +7 -0
- package/dist/index.mjs +767 -0
- package/dist/index.mjs.map +7 -0
- package/dist/session.d.ts +8 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/utilities.d.ts +166 -0
- package/dist/utilities.d.ts.map +1 -0
- package/package.json +50 -16
- package/.git/logs/refs/heads/REB-2426/add-index.js +0 -2
- package/.git/refs/heads/REB-2426/add-index.js +0 -1
- package/api.js +0 -130
- package/client.js +0 -148
- package/cookie.js +0 -153
- package/geolocation.js +0 -63
- package/identity.js +0 -72
- package/session.js +0 -52
- package/utilities.js +0 -342
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type Config = {
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated
|
|
4
|
+
*/
|
|
5
|
+
cdnDomain: string;
|
|
6
|
+
domain: string;
|
|
7
|
+
eventDomain: string;
|
|
8
|
+
geoDomain: string;
|
|
9
|
+
key: string | null;
|
|
10
|
+
shieldDomain: string;
|
|
11
|
+
shop: string | null;
|
|
12
|
+
staticDomain: string;
|
|
13
|
+
};
|
|
14
|
+
type FetchOptions = {
|
|
15
|
+
fetch?: RequestInit & {
|
|
16
|
+
strictErrors?: boolean;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
type RequestData = Record<string, any> | null;
|
|
20
|
+
export declare class Api {
|
|
21
|
+
constructor(options: string | Partial<Config> | null);
|
|
22
|
+
callEvent(method: string, path: string, data: RequestData, options?: FetchOptions): Promise<any>;
|
|
23
|
+
callShield(method: string, path: string, data: RequestData, options?: FetchOptions): Promise<any>;
|
|
24
|
+
callStatic(method: string, path: string, data: RequestData, options?: FetchOptions): Promise<any>;
|
|
25
|
+
callGeo(method: string, path: string, data: RequestData, options?: FetchOptions): Promise<any>;
|
|
26
|
+
callCdn(method: string, path: string, data: RequestData, options?: FetchOptions): Promise<any>;
|
|
27
|
+
callApi(method: string, path: string, data: RequestData, options?: FetchOptions): Promise<any>;
|
|
28
|
+
}
|
|
29
|
+
export default Api;
|
|
30
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAMA,KAAK,MAAM,GAAG;IACV;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACxB,CAAC;AAIF,KAAK,YAAY,GAAG;IAChB,KAAK,CAAC,EAAE,WAAW,GAAG;QAAE,YAAY,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CACpD,CAAC;AAEF,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;AAuF9C,qBAAa,GAAG;gBACA,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI;IAoB9C,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC;IAIhG,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC;IAIjG,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC;IAIjG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC;IAI9F,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC;IAI9F,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC;CAGvG;AAGD,eAAe,GAAG,CAAC"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class RebuyClient {
|
|
2
|
+
constructor(key: string, defaultParameters?: Record<string, any>, shop?: string);
|
|
3
|
+
setDefaultParameters(defaultParameters: Record<string, any>): void;
|
|
4
|
+
setContextParameters(contextParameters: Record<string, any>): void;
|
|
5
|
+
getData(endpoint: string, params: Record<string, any>, options?: Record<string, any>): Promise<any>;
|
|
6
|
+
getDataFromCDN(endpoint: string, params: Record<string, any>, options?: Record<string, any>): Promise<any>;
|
|
7
|
+
getShieldedAsset(endpoint: string, params: Record<string, any>, options?: Record<string, any>): Promise<any>;
|
|
8
|
+
getStaticAsset(endpoint: string, params: Record<string, any>, options?: Record<string, any>): Promise<any>;
|
|
9
|
+
getStorefrontData(endpoint: string, params: Record<string, any>, options?: Record<string, any>): Promise<any>;
|
|
10
|
+
trackProductViewed(data: Record<string, any>): Promise<any>;
|
|
11
|
+
}
|
|
12
|
+
export default RebuyClient;
|
|
13
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAqGA,qBAAa,WAAW;gBACR,GAAG,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM;IAiB/E,oBAAoB,CAAC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAMlE,oBAAoB,CAAC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAM5D,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAIvG,cAAc,CAChB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAClC,OAAO,CAAC,GAAG,CAAC;IAIT,gBAAgB,CAClB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAClC,OAAO,CAAC,GAAG,CAAC;IAIT,cAAc,CAChB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAClC,OAAO,CAAC,GAAG,CAAC;IAIT,iBAAiB,CACnB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAClC,OAAO,CAAC,GAAG,CAAC;IAIT,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;CAqBpE;AAGD,eAAe,WAAW,CAAC"}
|
package/dist/cookie.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get a cookie by name
|
|
3
|
+
*
|
|
4
|
+
* @param {string} name - The name of the cookie to get
|
|
5
|
+
*
|
|
6
|
+
* @returns {any} The value of the cookie or null if the cookie is not found
|
|
7
|
+
*/
|
|
8
|
+
export declare function get(name: string): any | null;
|
|
9
|
+
/**
|
|
10
|
+
* Get all cookies
|
|
11
|
+
*
|
|
12
|
+
* @returns {Record<string, any>} All cookies
|
|
13
|
+
*/
|
|
14
|
+
export declare function getAll(): Record<string, any>;
|
|
15
|
+
/**
|
|
16
|
+
* Set a cookie
|
|
17
|
+
*
|
|
18
|
+
* @param {string} name - The name of the cookie
|
|
19
|
+
* @param {any} value - The value of the cookie
|
|
20
|
+
* @param {any} config - The configuration of the cookie
|
|
21
|
+
*
|
|
22
|
+
* @returns {void}
|
|
23
|
+
*/
|
|
24
|
+
export declare function set(name: string, value: any, config: any): void;
|
|
25
|
+
/**
|
|
26
|
+
* Find all cookies that match a name
|
|
27
|
+
*
|
|
28
|
+
* @param {string} name - The name of the cookie to find
|
|
29
|
+
*
|
|
30
|
+
* @returns {Array<{ name: string; value: any }>} All cookies that match the name
|
|
31
|
+
*/
|
|
32
|
+
export declare function find(name: string): {
|
|
33
|
+
name: string;
|
|
34
|
+
value: any;
|
|
35
|
+
}[];
|
|
36
|
+
/**
|
|
37
|
+
* Destroy a cookie
|
|
38
|
+
*
|
|
39
|
+
* @param {string} name - The name of the cookie to destroy
|
|
40
|
+
*/
|
|
41
|
+
export declare function destroy(name: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* Check if cookies are enabled
|
|
44
|
+
*
|
|
45
|
+
* @returns {boolean} True if cookies are enabled, false otherwise
|
|
46
|
+
*/
|
|
47
|
+
export declare function enabled(): boolean;
|
|
48
|
+
declare const _default: {
|
|
49
|
+
destroy: typeof destroy;
|
|
50
|
+
enabled: typeof enabled;
|
|
51
|
+
find: typeof find;
|
|
52
|
+
get: typeof get;
|
|
53
|
+
getAll: typeof getAll;
|
|
54
|
+
set: typeof set;
|
|
55
|
+
};
|
|
56
|
+
export default _default;
|
|
57
|
+
//# sourceMappingURL=cookie.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie.d.ts","sourceRoot":"","sources":["../src/cookie.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,IAAI,CAsB5C;AAED;;;;GAIG;AACH,wBAAgB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAsB5C;AAED;;;;;;;;GAQG;AACH,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAG,IAAI,CA+D/D;AAED;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,GAAG,CAAA;CAAE,EAAE,CAcjE;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED;;;;GAIG;AACH,wBAAgB,OAAO,IAAI,OAAO,CAejC;;;;;;;;;AAGD,wBAA4D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geolocation.d.ts","sourceRoot":"","sources":["../src/geolocation.ts"],"names":[],"mappings":"AA8CA,qBAAa,WAAW;gBACR,GAAG,EAAE,MAAM,GAAG,IAAI;IAiBxB,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC;CAOpC;AAGD,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class Identity {
|
|
2
|
+
constructor(key: string | null);
|
|
3
|
+
visitorId(): string | null;
|
|
4
|
+
sessionId(): string;
|
|
5
|
+
sessionStart(): string;
|
|
6
|
+
sessionDuration(): string;
|
|
7
|
+
geolocation(): Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export default Identity;
|
|
10
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AA4BA,qBAAa,QAAQ;gBACL,GAAG,EAAE,MAAM,GAAG,IAAI;IAkC9B,SAAS,IAAI,MAAM,GAAG,IAAI;IAI1B,SAAS,IAAI,MAAM;IAInB,YAAY,IAAI,MAAM;IAItB,eAAe,IAAI,MAAM;IAInB,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC;CAGpC;AAGD,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}
|