@sitecore-content-sdk/analytics-core 2.0.0-canary.12
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/LICENSE.txt +202 -0
- package/README.md +99 -0
- package/dist/cjs/package.json +78 -0
- package/dist/cjs/src/client-id/fetch-client-id-from-edge-proxy.js +41 -0
- package/dist/cjs/src/client-id/get-client-id.js +12 -0
- package/dist/cjs/src/client-id/resolve-get-client-id-url.js +13 -0
- package/dist/cjs/src/consts.js +42 -0
- package/dist/cjs/src/cookie/get-default-cookie-attributes.js +20 -0
- package/dist/cjs/src/correlation-id/generate-correlation-id.js +12 -0
- package/dist/cjs/src/index.js +11 -0
- package/dist/cjs/src/infer/infer.js +28 -0
- package/dist/cjs/src/initialization/browser-adapter.js +42 -0
- package/dist/cjs/src/initialization/const.js +8 -0
- package/dist/cjs/src/initialization/plugin.js +75 -0
- package/dist/cjs/src/initialization/server-adapter.js +91 -0
- package/dist/cjs/src/initialization/types.js +2 -0
- package/dist/cjs/src/interfaces.js +2 -0
- package/dist/cjs/src/internal.js +24 -0
- package/dist/cjs/src/utils/browser/appendScriptWithAttributes.js +15 -0
- package/dist/cjs/src/utils/converters/base-64-converter.js +18 -0
- package/dist/cjs/src/utils/converters/flatten-object.js +35 -0
- package/dist/cjs/src/utils/cookies/consts.js +4 -0
- package/dist/cjs/src/utils/cookies/cookie-exists-in-server-side.js +14 -0
- package/dist/cjs/src/utils/cookies/cookie-exists.js +13 -0
- package/dist/cjs/src/utils/cookies/create-cookie-string.js +20 -0
- package/dist/cjs/src/utils/cookies/delete-cookie.js +11 -0
- package/dist/cjs/src/utils/cookies/get-cookie-server-side.js +14 -0
- package/dist/cjs/src/utils/cookies/get-cookie-value-client-side.js +15 -0
- package/dist/cjs/src/utils/cookies/get-cookie.js +20 -0
- package/dist/cjs/src/utils/cookies/interfaces.js +2 -0
- package/dist/cjs/src/utils/generators/generate-v4-uuid.js +11 -0
- package/dist/cjs/src/utils/interfaces.js +2 -0
- package/dist/cjs/src/utils/validators/is-short-iso-date-string.js +20 -0
- package/dist/cjs/src/utils/validators/is-valid-email.js +16 -0
- package/dist/cjs/src/utils.js +23 -0
- package/dist/esm/package.json +78 -0
- package/dist/esm/src/client-id/fetch-client-id-from-edge-proxy.js +38 -0
- package/dist/esm/src/client-id/get-client-id.js +9 -0
- package/dist/esm/src/client-id/resolve-get-client-id-url.js +10 -0
- package/dist/esm/src/consts.js +36 -0
- package/dist/esm/src/cookie/get-default-cookie-attributes.js +17 -0
- package/dist/esm/src/correlation-id/generate-correlation-id.js +9 -0
- package/dist/esm/src/index.js +4 -0
- package/dist/esm/src/infer/infer.js +24 -0
- package/dist/esm/src/initialization/browser-adapter.js +39 -0
- package/dist/esm/src/initialization/const.js +5 -0
- package/dist/esm/src/initialization/plugin.js +71 -0
- package/dist/esm/src/initialization/server-adapter.js +88 -0
- package/dist/esm/src/initialization/types.js +1 -0
- package/dist/esm/src/interfaces.js +1 -0
- package/dist/esm/src/internal.js +7 -0
- package/dist/esm/src/utils/browser/appendScriptWithAttributes.js +12 -0
- package/dist/esm/src/utils/converters/base-64-converter.js +15 -0
- package/dist/esm/src/utils/converters/flatten-object.js +32 -0
- package/dist/esm/src/utils/cookies/consts.js +1 -0
- package/dist/esm/src/utils/cookies/cookie-exists-in-server-side.js +11 -0
- package/dist/esm/src/utils/cookies/cookie-exists.js +10 -0
- package/dist/esm/src/utils/cookies/create-cookie-string.js +17 -0
- package/dist/esm/src/utils/cookies/delete-cookie.js +8 -0
- package/dist/esm/src/utils/cookies/get-cookie-server-side.js +11 -0
- package/dist/esm/src/utils/cookies/get-cookie-value-client-side.js +12 -0
- package/dist/esm/src/utils/cookies/get-cookie.js +17 -0
- package/dist/esm/src/utils/cookies/interfaces.js +1 -0
- package/dist/esm/src/utils/generators/generate-v4-uuid.js +8 -0
- package/dist/esm/src/utils/interfaces.js +1 -0
- package/dist/esm/src/utils/validators/is-short-iso-date-string.js +17 -0
- package/dist/esm/src/utils/validators/is-valid-email.js +13 -0
- package/dist/esm/src/utils.js +10 -0
- package/internal.d.ts +2 -0
- package/package.json +78 -0
- package/types/src/client-id/fetch-client-id-from-edge-proxy.d.ts +11 -0
- package/types/src/client-id/fetch-client-id-from-edge-proxy.d.ts.map +1 -0
- package/types/src/client-id/get-client-id.d.ts +7 -0
- package/types/src/client-id/get-client-id.d.ts.map +1 -0
- package/types/src/client-id/resolve-get-client-id-url.d.ts +8 -0
- package/types/src/client-id/resolve-get-client-id-url.d.ts.map +1 -0
- package/types/src/consts.d.ts +36 -0
- package/types/src/consts.d.ts.map +1 -0
- package/types/src/cookie/get-default-cookie-attributes.d.ts +10 -0
- package/types/src/cookie/get-default-cookie-attributes.d.ts.map +1 -0
- package/types/src/correlation-id/generate-correlation-id.d.ts +7 -0
- package/types/src/correlation-id/generate-correlation-id.d.ts.map +1 -0
- package/types/src/index.d.ts +9 -0
- package/types/src/index.d.ts.map +1 -0
- package/types/src/infer/infer.d.ts +15 -0
- package/types/src/infer/infer.d.ts.map +1 -0
- package/types/src/initialization/browser-adapter.d.ts +20 -0
- package/types/src/initialization/browser-adapter.d.ts.map +1 -0
- package/types/src/initialization/const.d.ts +6 -0
- package/types/src/initialization/const.d.ts.map +1 -0
- package/types/src/initialization/plugin.d.ts +65 -0
- package/types/src/initialization/plugin.d.ts.map +1 -0
- package/types/src/initialization/server-adapter.d.ts +25 -0
- package/types/src/initialization/server-adapter.d.ts.map +1 -0
- package/types/src/initialization/types.d.ts +92 -0
- package/types/src/initialization/types.d.ts.map +1 -0
- package/types/src/interfaces.d.ts +34 -0
- package/types/src/interfaces.d.ts.map +1 -0
- package/types/src/internal.d.ts +12 -0
- package/types/src/internal.d.ts.map +1 -0
- package/types/src/utils/browser/appendScriptWithAttributes.d.ts +21 -0
- package/types/src/utils/browser/appendScriptWithAttributes.d.ts.map +1 -0
- package/types/src/utils/converters/base-64-converter.d.ts +10 -0
- package/types/src/utils/converters/base-64-converter.d.ts.map +1 -0
- package/types/src/utils/converters/flatten-object.d.ts +41 -0
- package/types/src/utils/converters/flatten-object.d.ts.map +1 -0
- package/types/src/utils/cookies/consts.d.ts +2 -0
- package/types/src/utils/cookies/consts.d.ts.map +1 -0
- package/types/src/utils/cookies/cookie-exists-in-server-side.d.ts +9 -0
- package/types/src/utils/cookies/cookie-exists-in-server-side.d.ts.map +1 -0
- package/types/src/utils/cookies/cookie-exists.d.ts +9 -0
- package/types/src/utils/cookies/cookie-exists.d.ts.map +1 -0
- package/types/src/utils/cookies/create-cookie-string.d.ts +11 -0
- package/types/src/utils/cookies/create-cookie-string.d.ts.map +1 -0
- package/types/src/utils/cookies/delete-cookie.d.ts +7 -0
- package/types/src/utils/cookies/delete-cookie.d.ts.map +1 -0
- package/types/src/utils/cookies/get-cookie-server-side.d.ts +12 -0
- package/types/src/utils/cookies/get-cookie-server-side.d.ts.map +1 -0
- package/types/src/utils/cookies/get-cookie-value-client-side.d.ts +8 -0
- package/types/src/utils/cookies/get-cookie-value-client-side.d.ts.map +1 -0
- package/types/src/utils/cookies/get-cookie.d.ts +12 -0
- package/types/src/utils/cookies/get-cookie.d.ts.map +1 -0
- package/types/src/utils/cookies/interfaces.d.ts +35 -0
- package/types/src/utils/cookies/interfaces.d.ts.map +1 -0
- package/types/src/utils/generators/generate-v4-uuid.d.ts +7 -0
- package/types/src/utils/generators/generate-v4-uuid.d.ts.map +1 -0
- package/types/src/utils/interfaces.d.ts +8 -0
- package/types/src/utils/interfaces.d.ts.map +1 -0
- package/types/src/utils/validators/is-short-iso-date-string.d.ts +8 -0
- package/types/src/utils/validators/is-short-iso-date-string.d.ts.map +1 -0
- package/types/src/utils/validators/is-valid-email.d.ts +8 -0
- package/types/src/utils/validators/is-valid-email.d.ts.map +1 -0
- package/types/src/utils.d.ts +14 -0
- package/types/src/utils.d.ts.map +1 -0
- package/utils.d.ts +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-client-id.d.ts","sourceRoot":"","sources":["../../../src/client-id/get-client-id.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAEpC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves the URL for retrieving the proxy settings from the EDGE events proxy.
|
|
3
|
+
* @param {string} edgeUrl - The base URL for the EDGE proxy.
|
|
4
|
+
* @returns {string} The URL string for retrieving the client ID and client key.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveGetClientIdUrl(edgeUrl: string): string;
|
|
8
|
+
//# sourceMappingURL=resolve-get-client-id-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-get-client-id-url.d.ts","sourceRoot":"","sources":["../../../src/client-id/resolve-get-client-id-url.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE7D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The package version.
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare const LIBRARY_VERSION: string;
|
|
6
|
+
/**
|
|
7
|
+
* The prefix for cookie names used by the analytics library.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare const COOKIE_NAME_PREFIX = "sc_";
|
|
11
|
+
/**
|
|
12
|
+
* The name of the client ID cookie.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare const CLIENT_ID_COOKIE_NAME = "cid";
|
|
16
|
+
/**
|
|
17
|
+
* The default number of days until the client ID cookie expires.
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare const DEFAULT_COOKIE_EXPIRY_DAYS = 730;
|
|
21
|
+
/**
|
|
22
|
+
* The seconds in a day, used for cookie expiration calculations.
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
export declare const DAILY_SECONDS = 86400;
|
|
26
|
+
/**
|
|
27
|
+
* The api version of the Edge Proxy.
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
export declare const API_VERSION = "v1.2";
|
|
31
|
+
/**
|
|
32
|
+
* The header name for the correlation ID used in analytics requests.
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
export declare const CORRELATION_ID_HEADER = "x-sc-correlation-id";
|
|
36
|
+
//# sourceMappingURL=consts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../src/consts.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAsB,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAAQ,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAE9C;;;GAGG;AACH,eAAO,MAAM,aAAa,QAAQ,CAAC;AAEnC;;;GAGG;AACH,eAAO,MAAM,WAAW,SAAS,CAAC;AAElC;;;GAGG;AACH,eAAO,MAAM,qBAAqB,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CookieProperties } from '../utils';
|
|
2
|
+
/**
|
|
3
|
+
* Gets the default cookie attributes.
|
|
4
|
+
* @param {number} [maxAge] - Sets the cookie "Max-Age" attribute in days.
|
|
5
|
+
* @param {string} [cookieDomain] - Optional domain for the cookie.
|
|
6
|
+
* @returns {CookieProperties} The default configuration settings for the cookie string.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare function getDefaultCookieAttributes(maxAge?: number, cookieDomain?: string): CookieProperties;
|
|
10
|
+
//# sourceMappingURL=get-default-cookie-attributes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-default-cookie-attributes.d.ts","sourceRoot":"","sources":["../../../src/cookie/get-default-cookie-attributes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,GAAE,MAAmC,EAC3C,YAAY,CAAC,EAAE,MAAM,GACpB,gBAAgB,CAQlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-correlation-id.d.ts","sourceRoot":"","sources":["../../../src/correlation-id/generate-correlation-id.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { getClientId } from './client-id/get-client-id';
|
|
2
|
+
export type { AnalyticsPluginParams } from './initialization/plugin';
|
|
3
|
+
export type { AnalyticsPlugin } from './initialization/types';
|
|
4
|
+
export { analyticsPlugin } from './initialization/plugin';
|
|
5
|
+
export type { AnalyticsServerAdapter } from './initialization/server-adapter';
|
|
6
|
+
export { analyticsServerAdapter } from './initialization/server-adapter';
|
|
7
|
+
export type { AnalyticsBrowserAdapter } from './initialization/browser-adapter';
|
|
8
|
+
export { analyticsBrowserAdapter } from './initialization/browser-adapter';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,YAAY,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,YAAY,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE,YAAY,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the uppercase language code of the current web page's root HTML element, using the `lang` attribute.
|
|
3
|
+
* If unavailable or invalid, undefined is returned.
|
|
4
|
+
* @returns The language attribute or undefined.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare function language(): string | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Returns the name of the current page extracted from the URL's pathname.
|
|
10
|
+
* If it's the home page, it returns `Home Page`.
|
|
11
|
+
* @returns `Home Page` if root, otherwise the pathname segment.
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare function pageName(): string;
|
|
15
|
+
//# sourceMappingURL=infer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infer.d.ts","sourceRoot":"","sources":["../../../src/infer/infer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,QAAQ,uBAIvB;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,WAMvB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AnalyticsAdapter } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Defines the AnalyticsBrowserAdapter.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface AnalyticsBrowserAdapter extends AnalyticsAdapter {
|
|
7
|
+
/**
|
|
8
|
+
* The type of the adapter.
|
|
9
|
+
*/
|
|
10
|
+
type: 'browser';
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Creates a browser-based analytics adapter that reads and writes the visitor ID
|
|
14
|
+
* using cookies and can resolve a new client ID from the Edge proxy when needed.
|
|
15
|
+
* The adapter also provides access to the current URL search parameters.
|
|
16
|
+
* @returns {AnalyticsBrowserAdapter} The analytics browser adapter.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export declare function analyticsBrowserAdapter(): AnalyticsBrowserAdapter;
|
|
20
|
+
//# sourceMappingURL=browser-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-adapter.d.ts","sourceRoot":"","sources":["../../../src/initialization/browser-adapter.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG3C;;;GAGG;AACH,MAAM,WAAW,uBAAwB,SAAQ,gBAAgB;IAC/D;;OAEG;IACH,IAAI,EAAE,SAAS,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,IAAI,uBAAuB,CA8CjE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../../../src/initialization/const.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { AnalyticsAdapter, AnalyticsPlugin } from './types';
|
|
2
|
+
import { CoreContext } from '@sitecore-content-sdk/core';
|
|
3
|
+
import { getClientId } from '../client-id/get-client-id';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for creating an analytics plugin.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export interface AnalyticsPluginParams {
|
|
9
|
+
/**
|
|
10
|
+
* Optional configuration options for the analytics plugin.
|
|
11
|
+
*/
|
|
12
|
+
options?: {
|
|
13
|
+
/**
|
|
14
|
+
* The domain for which the cookie is valid.
|
|
15
|
+
*/
|
|
16
|
+
cookieDomain?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The number of days until the cookie expires.
|
|
19
|
+
*/
|
|
20
|
+
cookieExpiryDays?: number;
|
|
21
|
+
/**
|
|
22
|
+
* The path for which the cookie is valid.
|
|
23
|
+
*/
|
|
24
|
+
cookiePath?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the cookie should be set.
|
|
27
|
+
*/
|
|
28
|
+
enableCookie?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* The timeout duration for the analytics plugin, in milliseconds.
|
|
31
|
+
*/
|
|
32
|
+
timeout?: number;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* The adapter to be used for the analytics plugin.
|
|
36
|
+
*/
|
|
37
|
+
adapter: AnalyticsAdapter;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Creates an analytics plugin with the provided options.
|
|
41
|
+
* @param {AnalyticsPluginParams} params - The parameters for the analytics plugin.
|
|
42
|
+
* @returns {AnalyticsPlugin} The analytics plugin instance.
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
export declare function analyticsPlugin(params: AnalyticsPluginParams): AnalyticsPlugin;
|
|
46
|
+
/**
|
|
47
|
+
* Retrieves the analytics plugin instance from the core context.
|
|
48
|
+
* @returns {AnalyticsPlugin} The analytics plugin instance.
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
export declare function getAnalyticsPlugin(): AnalyticsPlugin;
|
|
52
|
+
declare global {
|
|
53
|
+
interface AnalyticsCore {
|
|
54
|
+
getClientId: typeof getClientId;
|
|
55
|
+
options: CoreContext['config'];
|
|
56
|
+
version: string;
|
|
57
|
+
}
|
|
58
|
+
interface ScContentSDK {
|
|
59
|
+
analytics_core: AnalyticsCore;
|
|
60
|
+
}
|
|
61
|
+
interface Window {
|
|
62
|
+
scContentSDK: ScContentSDK;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/initialization/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAQ5D,OAAO,EAAyB,WAAW,EAAa,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAKzD;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,OAAO,CAAC,EAAE;QACR;;WAEG;QACH,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB;;WAEG;QACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B;;WAEG;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB;;WAEG;QACH,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF;;OAEG;IACH,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,eAAe,CAoB9E;AAwCD;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,eAAe,CAOpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,aAAa;QACrB,WAAW,EAAE,OAAO,WAAW,CAAC;QAChC,OAAO,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC/B,OAAO,EAAE,MAAM,CAAC;KACjB;IACD,UAAU,YAAY;QACpB,cAAc,EAAE,aAAa,CAAC;KAC/B;IAED,UAAU,MAAM;QACd,YAAY,EAAE,YAAY,CAAC;KAC5B;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AnalyticsAdapter } from './types';
|
|
2
|
+
import type { IncomingMessage, OutgoingMessage } from 'http';
|
|
3
|
+
/**
|
|
4
|
+
* Defines the AnalyticsServerAdapter.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface AnalyticsServerAdapter extends AnalyticsAdapter {
|
|
8
|
+
/**
|
|
9
|
+
* The type of the adapter.
|
|
10
|
+
*/
|
|
11
|
+
type: 'server';
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates a server-based analytics adapter that reads and writes the visitor ID
|
|
15
|
+
* using cookies and can resolve a new client ID from the Edge proxy when needed.
|
|
16
|
+
* The adapter also provides access to the current URL search parameters.
|
|
17
|
+
* @template Request - The HTTP request type extending `IncomingMessage`.
|
|
18
|
+
* @template Response - The HTTP response type extending `OutgoingMessage`.
|
|
19
|
+
* @param {Request} request - The HTTP request object.
|
|
20
|
+
* @param {Response} response - The HTTP response object.
|
|
21
|
+
* @returns {AnalyticsServerAdapter} The analytics server adapter.
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
export declare function analyticsServerAdapter<Request extends IncomingMessage, Response extends OutgoingMessage>(request: Request, response: Response): AnalyticsServerAdapter;
|
|
25
|
+
//# sourceMappingURL=server-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-adapter.d.ts","sourceRoot":"","sources":["../../../src/initialization/server-adapter.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAE7D;;;GAGG;AACH,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC9D;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,SAAS,eAAe,EAC/B,QAAQ,SAAS,eAAe,EAChC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,sBAAsB,CAiF9D"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { VisitorIds } from '../interfaces';
|
|
2
|
+
import { Plugin, type PluginAdapter } from '@sitecore-content-sdk/core';
|
|
3
|
+
import { ANALYTICS_PLUGIN_NAME } from './const';
|
|
4
|
+
/**
|
|
5
|
+
* Defines the structure of the analytics adapter, including methods for getting and setting the client ID, and retrieving search parameters from the location.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export interface AnalyticsAdapter extends PluginAdapter {
|
|
9
|
+
/**
|
|
10
|
+
* Gets the client ID.
|
|
11
|
+
* @returns {string | null} The client ID, or null if it is not set.
|
|
12
|
+
*/
|
|
13
|
+
getClientId: () => string | null;
|
|
14
|
+
/**
|
|
15
|
+
* Sets the client ID.
|
|
16
|
+
* @returns {Promise<void>} A promise that resolves when the client ID has been set.
|
|
17
|
+
*/
|
|
18
|
+
setClientId: () => Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* The location object, which provides a method for getting search parameters.
|
|
21
|
+
*/
|
|
22
|
+
location: {
|
|
23
|
+
/**
|
|
24
|
+
* Gets the search parameters from the location.
|
|
25
|
+
* @returns {string} The search parameters from the location.
|
|
26
|
+
*/
|
|
27
|
+
getSearchParams: () => string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Defines options for the Analytics plugin.
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export interface AnalyticsOptions {
|
|
35
|
+
/**
|
|
36
|
+
* The cookie settings for the analytics plugin.
|
|
37
|
+
*/
|
|
38
|
+
cookies: {
|
|
39
|
+
/**
|
|
40
|
+
* The name of the cookie used to store the client ID.
|
|
41
|
+
*/
|
|
42
|
+
name: string;
|
|
43
|
+
/**
|
|
44
|
+
* The domain for which the cookie is valid.
|
|
45
|
+
*/
|
|
46
|
+
domain?: string;
|
|
47
|
+
/**
|
|
48
|
+
* The number of days until the cookie expires.
|
|
49
|
+
*/
|
|
50
|
+
expiryDays: number;
|
|
51
|
+
/**
|
|
52
|
+
* The path for which the cookie is valid.
|
|
53
|
+
*/
|
|
54
|
+
path?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Whether the cookie should be set.
|
|
57
|
+
*/
|
|
58
|
+
enabled?: boolean;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* The visitor IDs returned from the Edge Proxy.
|
|
62
|
+
*/
|
|
63
|
+
visitorIds?: VisitorIds;
|
|
64
|
+
/**
|
|
65
|
+
* The timeout duration for the analytics plugin, in milliseconds.
|
|
66
|
+
*/
|
|
67
|
+
timeout?: number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Defines the structure of the analytics plugin, including its initialization method, name, options, and adapter.
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
73
|
+
export interface AnalyticsPlugin extends Plugin {
|
|
74
|
+
/**
|
|
75
|
+
* The options for the analytics plugin.
|
|
76
|
+
*/
|
|
77
|
+
options: AnalyticsOptions;
|
|
78
|
+
/**
|
|
79
|
+
* The adapter for the analytics plugin, which provides methods to get and set the client ID, and access location search parameters. The adapter allows the analytics plugin to interact with the underlying platform or environment in a consistent way.
|
|
80
|
+
*/
|
|
81
|
+
adapter: AnalyticsAdapter;
|
|
82
|
+
/**
|
|
83
|
+
* Initializes the analytics plugin, which may involve setting up necessary configurations, loading scripts, or performing any asynchronous operations required for the plugin to function properly.
|
|
84
|
+
* @returns A promise that resolves when the initialization is complete.
|
|
85
|
+
*/
|
|
86
|
+
init: () => Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* The name of the analytics plugin.
|
|
89
|
+
*/
|
|
90
|
+
name: typeof ANALYTICS_PLUGIN_NAME;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/initialization/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEhD;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD;;;OAGG;IACH,WAAW,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IACjC;;;OAGG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC;;OAEG;IACH,QAAQ,EAAE;QACR;;;WAGG;QACH,eAAe,EAAE,MAAM,MAAM,CAAC;KAC/B,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,OAAO,EAAE;QACP;;WAEG;QACH,IAAI,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;WAEG;QACH,UAAU,EAAE,MAAM,CAAC;QACnB;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QACd;;WAEG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;IACF;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,MAAM;IAC7C;;OAEG;IACH,OAAO,EAAE,gBAAgB,CAAC;IAC1B;;OAEG;IACH,OAAO,EAAE,gBAAgB,CAAC;IAC1B;;;OAGG;IACH,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B;;OAEG;IACH,IAAI,EAAE,OAAO,qBAAqB,CAAC;CACpC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The response object that Sitecore Edge Proxy returns.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export interface EPResponse {
|
|
6
|
+
ref: string;
|
|
7
|
+
status: string;
|
|
8
|
+
version: string;
|
|
9
|
+
client_key: string;
|
|
10
|
+
customer_ref: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The visitor IDs returned from the Edge Proxy.
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export interface VisitorIds {
|
|
17
|
+
/**
|
|
18
|
+
* The client ID associated with the visitor.
|
|
19
|
+
*/
|
|
20
|
+
clientId: string;
|
|
21
|
+
/**
|
|
22
|
+
* The profile ID associated with the visitor.
|
|
23
|
+
*/
|
|
24
|
+
profileId: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Interface for supporting response `IncomingMessage` HTTP node type.
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
export interface Infer {
|
|
31
|
+
language: () => string | undefined;
|
|
32
|
+
pageName: () => string;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,KAAK;IACpB,QAAQ,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,EAAE,MAAM,MAAM,CAAC;CACxB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { getDefaultCookieAttributes } from './cookie/get-default-cookie-attributes';
|
|
2
|
+
export { language, pageName } from './infer/infer';
|
|
3
|
+
export { generateCorrelationId } from './correlation-id/generate-correlation-id';
|
|
4
|
+
export { API_VERSION, COOKIE_NAME_PREFIX, DAILY_SECONDS, DEFAULT_COOKIE_EXPIRY_DAYS, LIBRARY_VERSION, CORRELATION_ID_HEADER, CLIENT_ID_COOKIE_NAME, } from './consts';
|
|
5
|
+
export type { EPResponse, Infer } from './interfaces';
|
|
6
|
+
export { fetchClientIdFromEdgeProxy } from './client-id/fetch-client-id-from-edge-proxy';
|
|
7
|
+
export { getAnalyticsPlugin } from './initialization/plugin';
|
|
8
|
+
export { ANALYTICS_PLUGIN_NAME } from './initialization/const';
|
|
9
|
+
export type { AnalyticsPlugin } from './initialization/types';
|
|
10
|
+
export { AnalyticsAdapter, AnalyticsOptions } from './initialization/types';
|
|
11
|
+
export type { VisitorIds } from './interfaces';
|
|
12
|
+
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEjF,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,0BAA0B,EAC1B,eAAe,EACf,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAGlB,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Appends a script element to the document head with the specified attributes.
|
|
3
|
+
* @param {ScriptAttributes} attributes - The attributes to set on the script element.
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare function appendScriptWithAttributes(attributes: ScriptAttributes): void;
|
|
7
|
+
/**
|
|
8
|
+
* The script attributes required to append a script element.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export interface ScriptAttributes {
|
|
12
|
+
/**
|
|
13
|
+
* A boolean value that controls how the script should be executed.
|
|
14
|
+
*/
|
|
15
|
+
async: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Represents the URL of an external script; this can be used as an alternative to embedding a script directly within a document. It reflects the `src` attribute of the `script` element.
|
|
18
|
+
*/
|
|
19
|
+
src: string;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=appendScriptWithAttributes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appendScriptWithAttributes.d.ts","sourceRoot":"","sources":["../../../../src/utils/browser/appendScriptWithAttributes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,gBAAgB,QAQtE;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACb"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a string or plain object to a base64 string representation.
|
|
3
|
+
* @param {string | Record<string, unknown>} input The value to convert.
|
|
4
|
+
* @returns {string} The base64-encoded string.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare function convertToBase64(input: string | {
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}): string;
|
|
10
|
+
//# sourceMappingURL=base-64-converter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-64-converter.d.ts","sourceRoot":"","sources":["../../../../src/utils/converters/base-64-converter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,GAAG,MAAM,CASlF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { BasicTypes } from '../interfaces';
|
|
2
|
+
/**
|
|
3
|
+
* Flattens a nested object by concatenating keys with an underscore.
|
|
4
|
+
* @param {FlattenObjectDataParameters} data Parameters describing the flatten operation.
|
|
5
|
+
* @returns {FlattenedObject} A new flattened object.
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* const object = { order: { amount: 1, delivered: false } };
|
|
9
|
+
* const flattenedObject = flattenObject(object);
|
|
10
|
+
* // flattenedObject is { order_amount: 1, order_delivered: false }
|
|
11
|
+
* ```
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare function flattenObject(data: FlattenObjectDataParameters): FlattenedObject;
|
|
15
|
+
/**
|
|
16
|
+
* Interface for the data object parameter of the flattenObject function
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export interface FlattenObjectDataParameters {
|
|
20
|
+
object: NestedObject;
|
|
21
|
+
currentKey?: string;
|
|
22
|
+
newObject?: FlattenedObject;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Interface for the return object of the flattenObject function
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export interface FlattenedObject {
|
|
29
|
+
[key: string]: BasicTypes;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Interface of the object to flatten
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export interface NestedObject {
|
|
36
|
+
/**
|
|
37
|
+
* They keys of the object can be any string, and the values can be either basic types or another nested object.
|
|
38
|
+
*/
|
|
39
|
+
[key: string]: BasicTypes | NestedObject;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=flatten-object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flatten-object.d.ts","sourceRoot":"","sources":["../../../../src/utils/converters/flatten-object.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,2BAA2B,mBAoB9D;AAED;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,YAAY,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,eAAe,CAAC;CAC7B;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,YAAY,CAAC;CAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../../src/utils/cookies/consts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,QAAQ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether a cookie exists in a server-side request header string.
|
|
3
|
+
* @param {string} cookiesHeader Raw `cookie` header contents.
|
|
4
|
+
* @param {string} cookieName The cookie name to search for.
|
|
5
|
+
* @returns {boolean} True when the cookie is present.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare function cookieExistsInServerSide(cookiesHeader: string, cookieName: string): boolean;
|
|
9
|
+
//# sourceMappingURL=cookie-exists-in-server-side.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie-exists-in-server-side.d.ts","sourceRoot":"","sources":["../../../../src/utils/cookies/cookie-exists-in-server-side.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAE3F"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether the cookie exists within a cookie string.
|
|
3
|
+
* @param {string} cookieStr Cookie string containing individual cookies.
|
|
4
|
+
* @param {string} cookieName The cookie name to search for.
|
|
5
|
+
* @returns {boolean} True when the cookie exists in the string.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare function cookieExists(cookieStr: string, cookieName: string): boolean;
|
|
9
|
+
//# sourceMappingURL=cookie-exists.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie-exists.d.ts","sourceRoot":"","sources":["../../../../src/utils/cookies/cookie-exists.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAE3E"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CookieProperties } from './interfaces';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a cookie string with the provided attributes.
|
|
4
|
+
* @param {string} name Cookie name.
|
|
5
|
+
* @param {string} value Cookie value.
|
|
6
|
+
* @param {CookieProperties} attributes Supported cookie attributes.
|
|
7
|
+
* @returns {string} Serialized cookie ready to be assigned to `document.cookie`.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare function createCookieString(name: string, value: string, attributes: CookieProperties): string;
|
|
11
|
+
//# sourceMappingURL=create-cookie-string.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-cookie-string.d.ts","sourceRoot":"","sources":["../../../../src/utils/cookies/create-cookie-string.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,gBAAgB,GAC3B,MAAM,CAWR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-cookie.d.ts","sourceRoot":"","sources":["../../../../src/utils/cookies/delete-cookie.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAErD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves a cookie from the server-side request header string.
|
|
3
|
+
* @param {string | undefined} cookiesHeader Raw `cookie` header contents.
|
|
4
|
+
* @param {string} cookieName The cookie name to look up.
|
|
5
|
+
* @returns {{ name: string; value: string } | undefined} The resolved cookie information when found.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare function getCookieServerSide(cookiesHeader: string | undefined, cookieName: string): {
|
|
9
|
+
name: string;
|
|
10
|
+
value: string;
|
|
11
|
+
} | undefined;
|
|
12
|
+
//# sourceMappingURL=get-cookie-server-side.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-cookie-server-side.d.ts","sourceRoot":"","sources":["../../../../src/utils/cookies/get-cookie-server-side.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,UAAU,EAAE,MAAM,GACjB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAE7C"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves the value of a cookie in the browser context.
|
|
3
|
+
* @param {string} cookieName The name of the cookie to read.
|
|
4
|
+
* @returns {string} The cookie value or an empty string when not found.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare function getCookieValueClientSide(cookieName: string): string;
|
|
8
|
+
//# sourceMappingURL=get-cookie-value-client-side.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-cookie-value-client-side.d.ts","sourceRoot":"","sources":["../../../../src/utils/cookies/get-cookie-value-client-side.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAInE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves a cookie by name from a cookie string.
|
|
3
|
+
* @param {string | undefined} cookieStr Cookie string containing serialized cookies.
|
|
4
|
+
* @param {string} cookieName The cookie name to locate.
|
|
5
|
+
* @returns {{ name: string; value: string } | undefined} The cookie name/value pair when found.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare function getCookie(cookieStr: string | undefined, cookieName: string): {
|
|
9
|
+
name: string;
|
|
10
|
+
value: string;
|
|
11
|
+
} | undefined;
|
|
12
|
+
//# sourceMappingURL=get-cookie.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-cookie.d.ts","sourceRoot":"","sources":["../../../../src/utils/cookies/get-cookie.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,SAAS,CACvB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,UAAU,EAAE,MAAM,GACjB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAU7C"}
|