@coveo/shopify 1.5.2-pre.d64c8a48cb → 1.6.0-pre.39a35b416e
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/README.md +1 -26
- package/dist/constants.d.ts +0 -1
- package/dist/constants.js +0 -1
- package/dist/headless/commerce.d.ts +4 -32
- package/dist/headless/commerce.esm.js +6 -57
- package/dist/headless/commerce.js +7 -41
- package/dist/headless/search.d.ts +3 -30
- package/dist/headless/search.esm.js +6 -52
- package/dist/headless/search.js +6 -36
- package/dist/headless.esm.js +8 -63
- package/dist/types.d.ts +3 -3
- package/dist/types.js +1 -4
- package/dist/utilities/index.d.ts +2 -2
- package/dist/utilities/index.js +1 -2
- package/dist/utilities/shopify.d.ts +4 -14
- package/dist/utilities/shopify.js +0 -15
- package/dist/utilities.esm.js +8 -19
- package/package.json +3 -4
- package/dist/utilities/clientid.d.ts +0 -12
- package/dist/utilities/clientid.js +0 -15
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ It includes functions to fetch app proxy configurations and build a commerce eng
|
|
|
6
6
|
|
|
7
7
|
## Benefits
|
|
8
8
|
|
|
9
|
-
Using the `@coveo/shopify` package ensures that the commerce engine will
|
|
9
|
+
Using the `@coveo/shopify` package ensures that the commerce engine will activate Shopify Web Pixels by emitting an event that contains everything they need to ensure consistent tracking and personalization across storefronts and pixels.
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
@@ -56,8 +56,6 @@ Builds a commerce engine instance configured for Shopify.
|
|
|
56
56
|
#### Parameters
|
|
57
57
|
|
|
58
58
|
- `commerceEngineOptions` (required): Options for the commerce engine.
|
|
59
|
-
- `shopifyCookie` (optional): The value of the Shopify `_shopify_y` cookie. If not provided, it will attempt to retrieve it from the browser's cookies.
|
|
60
|
-
- `environment` (optional): A custom environment configuration (useful for testing & SSR).
|
|
61
59
|
|
|
62
60
|
#### Returns
|
|
63
61
|
|
|
@@ -102,31 +100,8 @@ console.log(engine);
|
|
|
102
100
|
</script>
|
|
103
101
|
```
|
|
104
102
|
|
|
105
|
-
### `getClientId`
|
|
106
|
-
|
|
107
|
-
Generates a unique client identifier for the Shopify store, based on the value of the Shopify `_shopify_y` cookie. This ensures consistent identification of users across storefronts and Shopify Web Pixels.
|
|
108
|
-
|
|
109
|
-
#### Parameters
|
|
110
|
-
|
|
111
|
-
- `shopifyCookie` (required): The value of the Shopify `_shopify_y` cookie.
|
|
112
|
-
|
|
113
|
-
#### Returns
|
|
114
|
-
|
|
115
|
-
A version 5 UUID string uniquely representing the client.
|
|
116
|
-
|
|
117
|
-
#### Example
|
|
118
|
-
|
|
119
|
-
```typescript
|
|
120
|
-
import {getClientId, getShopifyCookie} from '@coveo/shopify/utilities';
|
|
121
|
-
|
|
122
|
-
const shopifyCookie = getShopifyCookie();
|
|
123
|
-
const clientId = getClientId(shopifyCookie!);
|
|
124
|
-
console.log(clientId);
|
|
125
|
-
```
|
|
126
|
-
|
|
127
103
|
**Key constants:**
|
|
128
104
|
|
|
129
|
-
- `SHOPIFY_COOKIE_KEY`: The name of the Shopify cookie used for client identification (`_shopify_y`).
|
|
130
105
|
- `COVEO_SHOPIFY_CONFIG_KEY`: The key for the custom event and cookie used to share app proxy configuration (`coveo_shopify_config`).
|
|
131
106
|
|
|
132
107
|
---
|
package/dist/constants.d.ts
CHANGED
package/dist/constants.js
CHANGED
|
@@ -1,47 +1,19 @@
|
|
|
1
1
|
import { CommerceEngineOptions } from '@coveo/headless/commerce';
|
|
2
|
-
|
|
3
|
-
export { SHOPIFY_COOKIE_KEY, COVEO_SHOPIFY_CONFIG_KEY } from '../constants';
|
|
2
|
+
export { COVEO_SHOPIFY_CONFIG_KEY } from '../constants';
|
|
4
3
|
export * from '@coveo/headless/commerce';
|
|
5
4
|
export * from '../utilities';
|
|
6
|
-
export type { AppProxyConfig, AppProxyResponse
|
|
7
|
-
/**
|
|
8
|
-
* Options for building a Shopify commerce engine.
|
|
9
|
-
*
|
|
10
|
-
* @typedef BuildShopifyCommerceEngineOptions
|
|
11
|
-
* @property {CommerceEngineOptions} commerceEngineOptions - The core options for configuring the commerce engine.
|
|
12
|
-
* @property {ShopifyCustomEnvironment} [environment] - Optional browser environment; if not provided, a default one is created. Mainly useful when not running in a browser environment.
|
|
13
|
-
* @property {string} [shopifyCookie] - Optional value of the "_shopify_y" cookie. If not provided, it will attempt to retrieve it from the browser's cookies.
|
|
14
|
-
*
|
|
15
|
-
* @remarks
|
|
16
|
-
* The `generateUUID` and `storage` properties are omitted from the custom environment for Shopify
|
|
17
|
-
* to ensure that client IDs are generated consistently across web pixels and storefronts. This is
|
|
18
|
-
* critical for maintaining a unified tracking and personalization experience.
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
5
|
+
export type { AppProxyConfig, AppProxyResponse } from '../types';
|
|
21
6
|
export interface BuildShopifyCommerceEngineOptions {
|
|
22
7
|
commerceEngineOptions: CommerceEngineOptions;
|
|
23
|
-
shopifyCookie?: string;
|
|
24
|
-
environment?: ShopifyCustomEnvironment;
|
|
25
8
|
}
|
|
26
9
|
/**
|
|
27
10
|
* Builds the commerce engine for a Shopify store.
|
|
28
11
|
*
|
|
29
12
|
* This function initializes a commerce engine instance specific to a Shopify store by:
|
|
30
|
-
* -
|
|
31
|
-
* - Retrieving the "_shopify_y" cookie to confirm it is running in a Shopify context.
|
|
32
|
-
* - Emitting a custom event with the app proxy response to enable tracking and analytics with shopify webpixels.
|
|
33
|
-
* - Storing a client identifier derived from the shop and cookie value in the browser environment's storage.
|
|
13
|
+
* - Emitting a custom event to enable tracking and analytics with shopify webpixels.
|
|
34
14
|
* - Building and returning the commerce engine with the provided options.
|
|
35
15
|
*
|
|
36
|
-
* @remarks
|
|
37
|
-
* The `generateUUID` and `storage` properties are omitted from the custom environment for Shopify
|
|
38
|
-
* to ensure that client IDs are generated consistently across web pixels and storefronts. This is
|
|
39
|
-
* critical for maintaining a unified tracking and personalization experience.
|
|
40
|
-
*
|
|
41
16
|
* @param commerceEngineOptions - Options to configure the commerce engine.
|
|
42
|
-
* @param shopifyCookie - Optional value of the "_shopify_y" cookie. If not provided, it will attempt to retrieve it from the browser's cookies.
|
|
43
|
-
* @param environment - Optional browser environment; if not provided, a default one is created. Mainly useful when not running in a browser environment.
|
|
44
17
|
* @returns The constructed commerce engine instance.
|
|
45
|
-
* @throws Error if the required "_shopify_y" cookie is not found, ensuring the code runs within a Shopify store.
|
|
46
18
|
*/
|
|
47
|
-
export declare function buildShopifyCommerceEngine({ commerceEngineOptions,
|
|
19
|
+
export declare function buildShopifyCommerceEngine({ commerceEngineOptions, }: BuildShopifyCommerceEngineOptions): import("@coveo/headless/commerce").CommerceEngine<{}>;
|
|
@@ -20,32 +20,11 @@
|
|
|
20
20
|
import {
|
|
21
21
|
buildCommerceEngine
|
|
22
22
|
} from "@coveo/headless/commerce";
|
|
23
|
-
import { buildBrowserEnvironment } from "@coveo/relay";
|
|
24
23
|
|
|
25
24
|
// src/constants.ts
|
|
26
|
-
var SHOPIFY_COOKIE_KEY = "_shopify_y";
|
|
27
25
|
var COVEO_SHOPIFY_CONFIG_KEY = "coveo_shopify_config";
|
|
28
26
|
|
|
29
|
-
// src/types.ts
|
|
30
|
-
function getShopifyCustomEnvironment(environment) {
|
|
31
|
-
const { storage, generateUUID, ...rest } = environment;
|
|
32
|
-
return rest;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// src/utilities/clientid.ts
|
|
36
|
-
import { v5 } from "uuid";
|
|
37
|
-
var UUID_NAMESPACE = "c2db3701-991e-424d-b117-03e30d43b651";
|
|
38
|
-
function getClientId(shopifyCookie) {
|
|
39
|
-
return v5(shopifyCookie, UUID_NAMESPACE);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
27
|
// src/utilities/shopify.ts
|
|
43
|
-
function getShopifyCookie(name = SHOPIFY_COOKIE_KEY) {
|
|
44
|
-
const match = document.cookie.match(
|
|
45
|
-
new RegExp("(?:^|;\\s*)" + name + "=([^;]*)")
|
|
46
|
-
);
|
|
47
|
-
return match ? decodeURIComponent(match[1]) : null;
|
|
48
|
-
}
|
|
49
28
|
function publishCustomShopifyEvent(key, customData) {
|
|
50
29
|
if (typeof window.Shopify?.analytics?.publish === "function") {
|
|
51
30
|
window.Shopify.analytics.publish(key, customData);
|
|
@@ -66,55 +45,25 @@ async function fetchAppProxyConfig({
|
|
|
66
45
|
|
|
67
46
|
// src/headless/commerce.ts
|
|
68
47
|
function buildShopifyCommerceEngine({
|
|
69
|
-
commerceEngineOptions
|
|
70
|
-
shopifyCookie,
|
|
71
|
-
environment
|
|
48
|
+
commerceEngineOptions
|
|
72
49
|
}) {
|
|
73
|
-
const customEnvironment = environment ?? getShopifyCustomEnvironment(buildBrowserEnvironment());
|
|
74
|
-
const cookie = shopifyCookie || getShopifyCookie();
|
|
75
|
-
if (!commerceEngineOptions.configuration.analytics.trackingId) {
|
|
76
|
-
throw new Error(
|
|
77
|
-
"The configuration for the commerce engine must include an analytics tracking ID."
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
if (!cookie) {
|
|
81
|
-
throw new Error(
|
|
82
|
-
"Unable to find the _shopify_y cookie. Please ensure you are running this code in a Shopify store."
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
if (!commerceEngineOptions.navigatorContextProvider) {
|
|
86
|
-
commerceEngineOptions.navigatorContextProvider = () => ({
|
|
87
|
-
clientId: getClientId(cookie),
|
|
88
|
-
referrer: document.referrer,
|
|
89
|
-
userAgent: navigator.userAgent,
|
|
90
|
-
location: window.location.href
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
50
|
const appProxyResponse = {
|
|
94
51
|
accessToken: commerceEngineOptions.configuration.accessToken,
|
|
95
52
|
organizationId: commerceEngineOptions.configuration.organizationId,
|
|
96
53
|
environment: commerceEngineOptions.configuration.environment,
|
|
97
54
|
trackingId: commerceEngineOptions.configuration.analytics.trackingId
|
|
98
55
|
};
|
|
99
|
-
publishCustomShopifyEvent(
|
|
100
|
-
COVEO_SHOPIFY_CONFIG_KEY,
|
|
101
|
-
appProxyResponse
|
|
102
|
-
);
|
|
103
|
-
const clientId = getClientId(cookie);
|
|
104
56
|
const engine = buildCommerceEngine(commerceEngineOptions);
|
|
105
|
-
engine.relay.
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
57
|
+
const clientId = engine.relay.getMeta("").clientId;
|
|
58
|
+
publishCustomShopifyEvent(COVEO_SHOPIFY_CONFIG_KEY, {
|
|
59
|
+
...appProxyResponse,
|
|
60
|
+
clientId
|
|
110
61
|
});
|
|
111
62
|
return engine;
|
|
112
63
|
}
|
|
113
64
|
export {
|
|
114
65
|
COVEO_SHOPIFY_CONFIG_KEY,
|
|
115
|
-
SHOPIFY_COOKIE_KEY,
|
|
116
66
|
buildShopifyCommerceEngine,
|
|
117
67
|
fetchAppProxyConfig,
|
|
118
|
-
|
|
119
|
-
getShopifyCookie
|
|
68
|
+
publishCustomShopifyEvent
|
|
120
69
|
};
|
|
@@ -1,65 +1,31 @@
|
|
|
1
1
|
import { buildCommerceEngine, } from '@coveo/headless/commerce';
|
|
2
|
-
import { buildBrowserEnvironment } from '@coveo/relay';
|
|
3
2
|
import { COVEO_SHOPIFY_CONFIG_KEY } from '../constants';
|
|
4
|
-
import { getShopifyCustomEnvironment, } from '../types';
|
|
5
|
-
import { getClientId } from '../utilities/clientid';
|
|
6
3
|
import { publishCustomShopifyEvent } from '../utilities/shopify';
|
|
7
|
-
|
|
8
|
-
export { SHOPIFY_COOKIE_KEY, COVEO_SHOPIFY_CONFIG_KEY } from '../constants';
|
|
4
|
+
export { COVEO_SHOPIFY_CONFIG_KEY } from '../constants';
|
|
9
5
|
export * from '@coveo/headless/commerce';
|
|
10
6
|
export * from '../utilities';
|
|
11
7
|
/**
|
|
12
8
|
* Builds the commerce engine for a Shopify store.
|
|
13
9
|
*
|
|
14
10
|
* This function initializes a commerce engine instance specific to a Shopify store by:
|
|
15
|
-
* -
|
|
16
|
-
* - Retrieving the "_shopify_y" cookie to confirm it is running in a Shopify context.
|
|
17
|
-
* - Emitting a custom event with the app proxy response to enable tracking and analytics with shopify webpixels.
|
|
18
|
-
* - Storing a client identifier derived from the shop and cookie value in the browser environment's storage.
|
|
11
|
+
* - Emitting a custom event to enable tracking and analytics with shopify webpixels.
|
|
19
12
|
* - Building and returning the commerce engine with the provided options.
|
|
20
13
|
*
|
|
21
|
-
* @remarks
|
|
22
|
-
* The `generateUUID` and `storage` properties are omitted from the custom environment for Shopify
|
|
23
|
-
* to ensure that client IDs are generated consistently across web pixels and storefronts. This is
|
|
24
|
-
* critical for maintaining a unified tracking and personalization experience.
|
|
25
|
-
*
|
|
26
14
|
* @param commerceEngineOptions - Options to configure the commerce engine.
|
|
27
|
-
* @param shopifyCookie - Optional value of the "_shopify_y" cookie. If not provided, it will attempt to retrieve it from the browser's cookies.
|
|
28
|
-
* @param environment - Optional browser environment; if not provided, a default one is created. Mainly useful when not running in a browser environment.
|
|
29
15
|
* @returns The constructed commerce engine instance.
|
|
30
|
-
* @throws Error if the required "_shopify_y" cookie is not found, ensuring the code runs within a Shopify store.
|
|
31
16
|
*/
|
|
32
|
-
export function buildShopifyCommerceEngine({ commerceEngineOptions,
|
|
33
|
-
const customEnvironment = environment ?? getShopifyCustomEnvironment(buildBrowserEnvironment());
|
|
34
|
-
const cookie = shopifyCookie || getShopifyCookie();
|
|
35
|
-
if (!commerceEngineOptions.configuration.analytics.trackingId) {
|
|
36
|
-
throw new Error('The configuration for the commerce engine must include an analytics tracking ID.');
|
|
37
|
-
}
|
|
38
|
-
if (!cookie) {
|
|
39
|
-
throw new Error('Unable to find the _shopify_y cookie. Please ensure you are running this code in a Shopify store.');
|
|
40
|
-
}
|
|
41
|
-
if (!commerceEngineOptions.navigatorContextProvider) {
|
|
42
|
-
commerceEngineOptions.navigatorContextProvider = () => ({
|
|
43
|
-
clientId: getClientId(cookie),
|
|
44
|
-
referrer: document.referrer,
|
|
45
|
-
userAgent: navigator.userAgent,
|
|
46
|
-
location: window.location.href,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
17
|
+
export function buildShopifyCommerceEngine({ commerceEngineOptions, }) {
|
|
49
18
|
const appProxyResponse = {
|
|
50
19
|
accessToken: commerceEngineOptions.configuration.accessToken,
|
|
51
20
|
organizationId: commerceEngineOptions.configuration.organizationId,
|
|
52
21
|
environment: commerceEngineOptions.configuration.environment,
|
|
53
22
|
trackingId: commerceEngineOptions.configuration.analytics.trackingId,
|
|
54
23
|
};
|
|
55
|
-
publishCustomShopifyEvent(COVEO_SHOPIFY_CONFIG_KEY, appProxyResponse);
|
|
56
|
-
const clientId = getClientId(cookie);
|
|
57
24
|
const engine = buildCommerceEngine(commerceEngineOptions);
|
|
58
|
-
engine.relay.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
},
|
|
25
|
+
const clientId = engine.relay.getMeta('').clientId;
|
|
26
|
+
publishCustomShopifyEvent(COVEO_SHOPIFY_CONFIG_KEY, {
|
|
27
|
+
...appProxyResponse,
|
|
28
|
+
clientId,
|
|
63
29
|
});
|
|
64
30
|
return engine;
|
|
65
31
|
}
|
|
@@ -1,47 +1,20 @@
|
|
|
1
1
|
import { SearchEngineOptions } from '@coveo/headless';
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
export type { AppProxyConfig, AppProxyResponse, ShopifyCustomEnvironment, } from '../types';
|
|
2
|
+
export { COVEO_SHOPIFY_CONFIG_KEY } from '../constants';
|
|
3
|
+
export type { AppProxyConfig, AppProxyResponse } from '../types';
|
|
5
4
|
export * from '@coveo/headless';
|
|
6
5
|
export * from '../utilities';
|
|
7
|
-
/**
|
|
8
|
-
* Options for building a Shopify search engine instance.
|
|
9
|
-
*
|
|
10
|
-
* @typedef BuildShopifySearchEngineOptions
|
|
11
|
-
* @property {SearchEngineOptions} searchEngineOptions - The core options for configuring the search engine.
|
|
12
|
-
* @property {ShopifyCustomEnvironment} [environment] - Optional browser environment; if not provided, a default one is created. Mainly useful when not running in a browser environment.
|
|
13
|
-
* @property {string} [shopifyCookie] - Optional value of the "_shopify_y" cookie. If not provided, it will attempt to retrieve it from the browser's cookies.
|
|
14
|
-
*
|
|
15
|
-
* @remarks
|
|
16
|
-
* The `generateUUID` and `storage` properties are omitted from the custom environment for Shopify
|
|
17
|
-
* to ensure that client IDs are generated consistently across web pixels and storefronts. This is
|
|
18
|
-
* critical for maintaining a unified tracking and personalization experience.
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
6
|
export interface BuildShopifySearchEngineOptions {
|
|
22
7
|
searchEngineOptions: SearchEngineOptions;
|
|
23
|
-
environment?: ShopifyCustomEnvironment;
|
|
24
|
-
shopifyCookie?: string;
|
|
25
8
|
}
|
|
26
9
|
/**
|
|
27
10
|
* Builds the search engine for a Shopify store.
|
|
28
11
|
*
|
|
29
12
|
* This function initializes a search engine instance specific to a Shopify store by:
|
|
30
|
-
* - Creating or using an existing browser environment.
|
|
31
|
-
* - Retrieving the "_shopify_y" cookie to confirm it is running in a Shopify context.
|
|
32
13
|
* - Emitting a custom event with the app proxy response to enable tracking and analytics with shopify webpixels.
|
|
33
|
-
* - Storing a client identifier derived from the shop and cookie value in the browser environment's storage.
|
|
34
14
|
* - Building and returning the search engine with the provided options.
|
|
35
15
|
*
|
|
36
|
-
* @remarks
|
|
37
|
-
* The `generateUUID` and `storage` properties are omitted from the custom environment for Shopify
|
|
38
|
-
* to ensure that client IDs are generated consistently across web pixels and storefronts. This is
|
|
39
|
-
* critical for maintaining a unified tracking and personalization experience.
|
|
40
|
-
*
|
|
41
16
|
* @param searchEngineOptions - Options to configure the search engine.
|
|
42
|
-
* @param shopifyCookie - Optional value of the "_shopify_y" cookie. If not provided, it will attempt to retrieve it from the browser's cookies.
|
|
43
|
-
* @param environment - Optional browser environment; if not provided, a default one is created. Mainly useful when not running in a browser environment.
|
|
44
17
|
* @returns The constructed search engine instance.
|
|
45
18
|
* @throws Error if the required "_shopify_y" cookie is not found, ensuring the code runs within a Shopify store.
|
|
46
19
|
*/
|
|
47
|
-
export declare function buildShopifySearchEngine({ searchEngineOptions,
|
|
20
|
+
export declare function buildShopifySearchEngine({ searchEngineOptions, }: BuildShopifySearchEngineOptions): import("@coveo/headless").SearchEngine<{}>;
|
|
@@ -18,32 +18,11 @@
|
|
|
18
18
|
|
|
19
19
|
// src/headless/search.ts
|
|
20
20
|
import { buildSearchEngine } from "@coveo/headless";
|
|
21
|
-
import { buildBrowserEnvironment } from "@coveo/relay";
|
|
22
21
|
|
|
23
22
|
// src/constants.ts
|
|
24
|
-
var SHOPIFY_COOKIE_KEY = "_shopify_y";
|
|
25
23
|
var COVEO_SHOPIFY_CONFIG_KEY = "coveo_shopify_config";
|
|
26
24
|
|
|
27
|
-
// src/types.ts
|
|
28
|
-
function getShopifyCustomEnvironment(environment) {
|
|
29
|
-
const { storage, generateUUID, ...rest } = environment;
|
|
30
|
-
return rest;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// src/utilities/clientid.ts
|
|
34
|
-
import { v5 } from "uuid";
|
|
35
|
-
var UUID_NAMESPACE = "c2db3701-991e-424d-b117-03e30d43b651";
|
|
36
|
-
function getClientId(shopifyCookie) {
|
|
37
|
-
return v5(shopifyCookie, UUID_NAMESPACE);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
25
|
// src/utilities/shopify.ts
|
|
41
|
-
function getShopifyCookie(name = SHOPIFY_COOKIE_KEY) {
|
|
42
|
-
const match = document.cookie.match(
|
|
43
|
-
new RegExp("(?:^|;\\s*)" + name + "=([^;]*)")
|
|
44
|
-
);
|
|
45
|
-
return match ? decodeURIComponent(match[1]) : null;
|
|
46
|
-
}
|
|
47
26
|
function publishCustomShopifyEvent(key, customData) {
|
|
48
27
|
if (typeof window.Shopify?.analytics?.publish === "function") {
|
|
49
28
|
window.Shopify.analytics.publish(key, customData);
|
|
@@ -64,55 +43,30 @@ async function fetchAppProxyConfig({
|
|
|
64
43
|
|
|
65
44
|
// src/headless/search.ts
|
|
66
45
|
function buildShopifySearchEngine({
|
|
67
|
-
searchEngineOptions
|
|
68
|
-
environment,
|
|
69
|
-
shopifyCookie
|
|
46
|
+
searchEngineOptions
|
|
70
47
|
}) {
|
|
71
|
-
const customEnvironment = environment ?? getShopifyCustomEnvironment(buildBrowserEnvironment());
|
|
72
|
-
const cookie = shopifyCookie || getShopifyCookie();
|
|
73
48
|
if (!searchEngineOptions.configuration.analytics?.trackingId) {
|
|
74
49
|
throw new Error(
|
|
75
50
|
"The configuration for the search engine must include an analytics tracking ID."
|
|
76
51
|
);
|
|
77
52
|
}
|
|
78
|
-
if (!cookie) {
|
|
79
|
-
throw new Error(
|
|
80
|
-
"Unable to find the _shopify_y cookie. Please ensure you are running this code in a Shopify store."
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
if (!searchEngineOptions.navigatorContextProvider) {
|
|
84
|
-
searchEngineOptions.navigatorContextProvider = () => ({
|
|
85
|
-
clientId: getClientId(cookie),
|
|
86
|
-
referrer: document.referrer,
|
|
87
|
-
userAgent: navigator.userAgent,
|
|
88
|
-
location: window.location.href
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
53
|
const appProxyResponse = {
|
|
92
54
|
accessToken: searchEngineOptions.configuration.accessToken,
|
|
93
55
|
organizationId: searchEngineOptions.configuration.organizationId,
|
|
94
56
|
environment: searchEngineOptions.configuration.environment,
|
|
95
57
|
trackingId: searchEngineOptions.configuration.analytics.trackingId
|
|
96
58
|
};
|
|
97
|
-
publishCustomShopifyEvent(
|
|
98
|
-
COVEO_SHOPIFY_CONFIG_KEY,
|
|
99
|
-
appProxyResponse
|
|
100
|
-
);
|
|
101
|
-
const clientId = getClientId(cookie);
|
|
102
59
|
const engine = buildSearchEngine(searchEngineOptions);
|
|
103
|
-
engine.relay.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
60
|
+
const clientId = engine.relay.getMeta("").clientId;
|
|
61
|
+
publishCustomShopifyEvent(COVEO_SHOPIFY_CONFIG_KEY, {
|
|
62
|
+
...appProxyResponse,
|
|
63
|
+
clientId
|
|
108
64
|
});
|
|
109
65
|
return engine;
|
|
110
66
|
}
|
|
111
67
|
export {
|
|
112
68
|
COVEO_SHOPIFY_CONFIG_KEY,
|
|
113
|
-
SHOPIFY_COOKIE_KEY,
|
|
114
69
|
buildShopifySearchEngine,
|
|
115
70
|
fetchAppProxyConfig,
|
|
116
|
-
|
|
117
|
-
getShopifyCookie
|
|
71
|
+
publishCustomShopifyEvent
|
|
118
72
|
};
|
package/dist/headless/search.js
CHANGED
|
@@ -1,65 +1,35 @@
|
|
|
1
1
|
import { buildSearchEngine } from '@coveo/headless';
|
|
2
|
-
import { buildBrowserEnvironment } from '@coveo/relay';
|
|
3
2
|
import { COVEO_SHOPIFY_CONFIG_KEY } from '../constants';
|
|
4
|
-
import { getShopifyCustomEnvironment, } from '../types';
|
|
5
|
-
import { getClientId } from '../utilities/clientid';
|
|
6
3
|
import { publishCustomShopifyEvent } from '../utilities/shopify';
|
|
7
|
-
|
|
8
|
-
export { SHOPIFY_COOKIE_KEY, COVEO_SHOPIFY_CONFIG_KEY } from '../constants';
|
|
4
|
+
export { COVEO_SHOPIFY_CONFIG_KEY } from '../constants';
|
|
9
5
|
export * from '@coveo/headless';
|
|
10
6
|
export * from '../utilities';
|
|
11
7
|
/**
|
|
12
8
|
* Builds the search engine for a Shopify store.
|
|
13
9
|
*
|
|
14
10
|
* This function initializes a search engine instance specific to a Shopify store by:
|
|
15
|
-
* - Creating or using an existing browser environment.
|
|
16
|
-
* - Retrieving the "_shopify_y" cookie to confirm it is running in a Shopify context.
|
|
17
11
|
* - Emitting a custom event with the app proxy response to enable tracking and analytics with shopify webpixels.
|
|
18
|
-
* - Storing a client identifier derived from the shop and cookie value in the browser environment's storage.
|
|
19
12
|
* - Building and returning the search engine with the provided options.
|
|
20
13
|
*
|
|
21
|
-
* @remarks
|
|
22
|
-
* The `generateUUID` and `storage` properties are omitted from the custom environment for Shopify
|
|
23
|
-
* to ensure that client IDs are generated consistently across web pixels and storefronts. This is
|
|
24
|
-
* critical for maintaining a unified tracking and personalization experience.
|
|
25
|
-
*
|
|
26
14
|
* @param searchEngineOptions - Options to configure the search engine.
|
|
27
|
-
* @param shopifyCookie - Optional value of the "_shopify_y" cookie. If not provided, it will attempt to retrieve it from the browser's cookies.
|
|
28
|
-
* @param environment - Optional browser environment; if not provided, a default one is created. Mainly useful when not running in a browser environment.
|
|
29
15
|
* @returns The constructed search engine instance.
|
|
30
16
|
* @throws Error if the required "_shopify_y" cookie is not found, ensuring the code runs within a Shopify store.
|
|
31
17
|
*/
|
|
32
|
-
export function buildShopifySearchEngine({ searchEngineOptions,
|
|
33
|
-
const customEnvironment = environment ?? getShopifyCustomEnvironment(buildBrowserEnvironment());
|
|
34
|
-
const cookie = shopifyCookie || getShopifyCookie();
|
|
18
|
+
export function buildShopifySearchEngine({ searchEngineOptions, }) {
|
|
35
19
|
if (!searchEngineOptions.configuration.analytics?.trackingId) {
|
|
36
20
|
throw new Error('The configuration for the search engine must include an analytics tracking ID.');
|
|
37
21
|
}
|
|
38
|
-
if (!cookie) {
|
|
39
|
-
throw new Error('Unable to find the _shopify_y cookie. Please ensure you are running this code in a Shopify store.');
|
|
40
|
-
}
|
|
41
|
-
if (!searchEngineOptions.navigatorContextProvider) {
|
|
42
|
-
searchEngineOptions.navigatorContextProvider = () => ({
|
|
43
|
-
clientId: getClientId(cookie),
|
|
44
|
-
referrer: document.referrer,
|
|
45
|
-
userAgent: navigator.userAgent,
|
|
46
|
-
location: window.location.href,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
22
|
const appProxyResponse = {
|
|
50
23
|
accessToken: searchEngineOptions.configuration.accessToken,
|
|
51
24
|
organizationId: searchEngineOptions.configuration.organizationId,
|
|
52
25
|
environment: searchEngineOptions.configuration.environment,
|
|
53
26
|
trackingId: searchEngineOptions.configuration.analytics.trackingId,
|
|
54
27
|
};
|
|
55
|
-
publishCustomShopifyEvent(COVEO_SHOPIFY_CONFIG_KEY, appProxyResponse);
|
|
56
|
-
const clientId = getClientId(cookie);
|
|
57
28
|
const engine = buildSearchEngine(searchEngineOptions);
|
|
58
|
-
engine.relay.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
},
|
|
29
|
+
const clientId = engine.relay.getMeta('').clientId;
|
|
30
|
+
publishCustomShopifyEvent(COVEO_SHOPIFY_CONFIG_KEY, {
|
|
31
|
+
...appProxyResponse,
|
|
32
|
+
clientId,
|
|
63
33
|
});
|
|
64
34
|
return engine;
|
|
65
35
|
}
|
package/dist/headless.esm.js
CHANGED
|
@@ -37,52 +37,27 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
|
|
|
37
37
|
var index_exports = {};
|
|
38
38
|
__export(index_exports, {
|
|
39
39
|
COVEO_SHOPIFY_CONFIG_KEY: () => COVEO_SHOPIFY_CONFIG_KEY,
|
|
40
|
-
SHOPIFY_COOKIE_KEY: () => SHOPIFY_COOKIE_KEY,
|
|
41
40
|
buildShopifyCommerceEngine: () => buildShopifyCommerceEngine,
|
|
42
41
|
fetchAppProxyConfig: () => fetchAppProxyConfig,
|
|
43
|
-
|
|
44
|
-
getShopifyCookie: () => getShopifyCookie
|
|
42
|
+
publishCustomShopifyEvent: () => publishCustomShopifyEvent
|
|
45
43
|
});
|
|
46
44
|
|
|
47
45
|
// src/headless/commerce.ts
|
|
48
46
|
var commerce_exports = {};
|
|
49
47
|
__export(commerce_exports, {
|
|
50
48
|
COVEO_SHOPIFY_CONFIG_KEY: () => COVEO_SHOPIFY_CONFIG_KEY,
|
|
51
|
-
SHOPIFY_COOKIE_KEY: () => SHOPIFY_COOKIE_KEY,
|
|
52
49
|
buildShopifyCommerceEngine: () => buildShopifyCommerceEngine,
|
|
53
50
|
fetchAppProxyConfig: () => fetchAppProxyConfig,
|
|
54
|
-
|
|
55
|
-
getShopifyCookie: () => getShopifyCookie
|
|
51
|
+
publishCustomShopifyEvent: () => publishCustomShopifyEvent
|
|
56
52
|
});
|
|
57
53
|
import {
|
|
58
54
|
buildCommerceEngine
|
|
59
55
|
} from "@coveo/headless/commerce";
|
|
60
|
-
import { buildBrowserEnvironment } from "@coveo/relay";
|
|
61
56
|
|
|
62
57
|
// src/constants.ts
|
|
63
|
-
var SHOPIFY_COOKIE_KEY = "_shopify_y";
|
|
64
58
|
var COVEO_SHOPIFY_CONFIG_KEY = "coveo_shopify_config";
|
|
65
59
|
|
|
66
|
-
// src/types.ts
|
|
67
|
-
function getShopifyCustomEnvironment(environment) {
|
|
68
|
-
const { storage, generateUUID, ...rest } = environment;
|
|
69
|
-
return rest;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// src/utilities/clientid.ts
|
|
73
|
-
import { v5 } from "uuid";
|
|
74
|
-
var UUID_NAMESPACE = "c2db3701-991e-424d-b117-03e30d43b651";
|
|
75
|
-
function getClientId(shopifyCookie) {
|
|
76
|
-
return v5(shopifyCookie, UUID_NAMESPACE);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
60
|
// src/utilities/shopify.ts
|
|
80
|
-
function getShopifyCookie(name = SHOPIFY_COOKIE_KEY) {
|
|
81
|
-
const match = document.cookie.match(
|
|
82
|
-
new RegExp("(?:^|;\\s*)" + name + "=([^;]*)")
|
|
83
|
-
);
|
|
84
|
-
return match ? decodeURIComponent(match[1]) : null;
|
|
85
|
-
}
|
|
86
61
|
function publishCustomShopifyEvent(key, customData) {
|
|
87
62
|
if (typeof window.Shopify?.analytics?.publish === "function") {
|
|
88
63
|
window.Shopify.analytics.publish(key, customData);
|
|
@@ -104,47 +79,19 @@ async function fetchAppProxyConfig({
|
|
|
104
79
|
|
|
105
80
|
// src/headless/commerce.ts
|
|
106
81
|
function buildShopifyCommerceEngine({
|
|
107
|
-
commerceEngineOptions
|
|
108
|
-
shopifyCookie,
|
|
109
|
-
environment
|
|
82
|
+
commerceEngineOptions
|
|
110
83
|
}) {
|
|
111
|
-
const customEnvironment = environment ?? getShopifyCustomEnvironment(buildBrowserEnvironment());
|
|
112
|
-
const cookie = shopifyCookie || getShopifyCookie();
|
|
113
|
-
if (!commerceEngineOptions.configuration.analytics.trackingId) {
|
|
114
|
-
throw new Error(
|
|
115
|
-
"The configuration for the commerce engine must include an analytics tracking ID."
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
if (!cookie) {
|
|
119
|
-
throw new Error(
|
|
120
|
-
"Unable to find the _shopify_y cookie. Please ensure you are running this code in a Shopify store."
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
if (!commerceEngineOptions.navigatorContextProvider) {
|
|
124
|
-
commerceEngineOptions.navigatorContextProvider = () => ({
|
|
125
|
-
clientId: getClientId(cookie),
|
|
126
|
-
referrer: document.referrer,
|
|
127
|
-
userAgent: navigator.userAgent,
|
|
128
|
-
location: window.location.href
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
84
|
const appProxyResponse = {
|
|
132
85
|
accessToken: commerceEngineOptions.configuration.accessToken,
|
|
133
86
|
organizationId: commerceEngineOptions.configuration.organizationId,
|
|
134
87
|
environment: commerceEngineOptions.configuration.environment,
|
|
135
88
|
trackingId: commerceEngineOptions.configuration.analytics.trackingId
|
|
136
89
|
};
|
|
137
|
-
publishCustomShopifyEvent(
|
|
138
|
-
COVEO_SHOPIFY_CONFIG_KEY,
|
|
139
|
-
appProxyResponse
|
|
140
|
-
);
|
|
141
|
-
const clientId = getClientId(cookie);
|
|
142
90
|
const engine = buildCommerceEngine(commerceEngineOptions);
|
|
143
|
-
engine.relay.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
91
|
+
const clientId = engine.relay.getMeta("").clientId;
|
|
92
|
+
publishCustomShopifyEvent(COVEO_SHOPIFY_CONFIG_KEY, {
|
|
93
|
+
...appProxyResponse,
|
|
94
|
+
clientId
|
|
148
95
|
});
|
|
149
96
|
return engine;
|
|
150
97
|
}
|
|
@@ -153,9 +100,7 @@ function buildShopifyCommerceEngine({
|
|
|
153
100
|
__reExport(index_exports, commerce_exports);
|
|
154
101
|
export {
|
|
155
102
|
COVEO_SHOPIFY_CONFIG_KEY,
|
|
156
|
-
SHOPIFY_COOKIE_KEY,
|
|
157
103
|
buildShopifyCommerceEngine,
|
|
158
104
|
fetchAppProxyConfig,
|
|
159
|
-
|
|
160
|
-
getShopifyCookie
|
|
105
|
+
publishCustomShopifyEvent
|
|
161
106
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CommerceEngineOptions } from '@coveo/headless/commerce';
|
|
2
|
-
import { CustomEnvironment } from '@coveo/relay';
|
|
3
2
|
export interface AppProxyConfig {
|
|
4
3
|
appProxyUrl?: string;
|
|
5
4
|
marketId: string;
|
|
@@ -10,5 +9,6 @@ export interface AppProxyResponse {
|
|
|
10
9
|
environment: CommerceEngineOptions['configuration']['environment'];
|
|
11
10
|
trackingId: string;
|
|
12
11
|
}
|
|
13
|
-
export type
|
|
14
|
-
|
|
12
|
+
export type CoveoShopifyCustomEvent = AppProxyResponse & {
|
|
13
|
+
clientId: string;
|
|
14
|
+
};
|
package/dist/types.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export type { CoveoShopifyCustomEvent } from '../types';
|
|
2
|
+
export { publishCustomShopifyEvent } from './shopify';
|
|
3
3
|
export { fetchAppProxyConfig } from './app-proxy';
|
|
4
4
|
export * from '../constants';
|
package/dist/utilities/index.js
CHANGED
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Retrieves the value of a specified Shopify cookie by its name.
|
|
4
|
-
*
|
|
5
|
-
* @remarks
|
|
6
|
-
* This function is intended for use in browser environments only, as it relies on the `document.cookie` API.
|
|
7
|
-
* Attempting to use this function in non-browser environments will result in an error or undefined behavior.
|
|
8
|
-
*
|
|
9
|
-
* @param name - The name of the Shopify cookie to retrieve. Defaults to `'_shopify_y'`.
|
|
10
|
-
* @returns The value of the specified cookie, or `null` if the cookie is not found.
|
|
11
|
-
*/
|
|
12
|
-
export declare function getShopifyCookie(name?: string): string | null;
|
|
1
|
+
import { CoveoShopifyCustomEvent } from '../types';
|
|
2
|
+
export type { CoveoShopifyCustomEvent } from '../types';
|
|
13
3
|
declare global {
|
|
14
4
|
interface Window {
|
|
15
5
|
Shopify?: {
|
|
16
6
|
analytics: {
|
|
17
|
-
publish: (eventName: string, eventData:
|
|
7
|
+
publish: (eventName: string, eventData: CoveoShopifyCustomEvent) => void;
|
|
18
8
|
};
|
|
19
9
|
};
|
|
20
10
|
}
|
|
21
11
|
}
|
|
22
|
-
export declare function publishCustomShopifyEvent(key: string, customData:
|
|
12
|
+
export declare function publishCustomShopifyEvent(key: string, customData: CoveoShopifyCustomEvent): void;
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
import { SHOPIFY_COOKIE_KEY } from '../constants';
|
|
2
|
-
/**
|
|
3
|
-
* Retrieves the value of a specified Shopify cookie by its name.
|
|
4
|
-
*
|
|
5
|
-
* @remarks
|
|
6
|
-
* This function is intended for use in browser environments only, as it relies on the `document.cookie` API.
|
|
7
|
-
* Attempting to use this function in non-browser environments will result in an error or undefined behavior.
|
|
8
|
-
*
|
|
9
|
-
* @param name - The name of the Shopify cookie to retrieve. Defaults to `'_shopify_y'`.
|
|
10
|
-
* @returns The value of the specified cookie, or `null` if the cookie is not found.
|
|
11
|
-
*/
|
|
12
|
-
export function getShopifyCookie(name = SHOPIFY_COOKIE_KEY) {
|
|
13
|
-
const match = document.cookie.match(new RegExp('(?:^|;\\s*)' + name + '=([^;]*)'));
|
|
14
|
-
return match ? decodeURIComponent(match[1]) : null;
|
|
15
|
-
}
|
|
16
1
|
export function publishCustomShopifyEvent(key, customData) {
|
|
17
2
|
if (typeof window.Shopify?.analytics?.publish === 'function') {
|
|
18
3
|
window.Shopify.analytics.publish(key, customData);
|
package/dist/utilities.esm.js
CHANGED
|
@@ -16,23 +16,11 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
// src/utilities/clientid.ts
|
|
20
|
-
import { v5 } from "uuid";
|
|
21
|
-
var UUID_NAMESPACE = "c2db3701-991e-424d-b117-03e30d43b651";
|
|
22
|
-
function getClientId(shopifyCookie) {
|
|
23
|
-
return v5(shopifyCookie, UUID_NAMESPACE);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// src/constants.ts
|
|
27
|
-
var SHOPIFY_COOKIE_KEY = "_shopify_y";
|
|
28
|
-
var COVEO_SHOPIFY_CONFIG_KEY = "coveo_shopify_config";
|
|
29
|
-
|
|
30
19
|
// src/utilities/shopify.ts
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return match ? decodeURIComponent(match[1]) : null;
|
|
20
|
+
function publishCustomShopifyEvent(key, customData) {
|
|
21
|
+
if (typeof window.Shopify?.analytics?.publish === "function") {
|
|
22
|
+
window.Shopify.analytics.publish(key, customData);
|
|
23
|
+
}
|
|
36
24
|
}
|
|
37
25
|
|
|
38
26
|
// src/utilities/app-proxy.ts
|
|
@@ -43,10 +31,11 @@ async function fetchAppProxyConfig({
|
|
|
43
31
|
const response = await fetch(`${appProxyUrl}?marketId=${marketId}]`);
|
|
44
32
|
return response.json();
|
|
45
33
|
}
|
|
34
|
+
|
|
35
|
+
// src/constants.ts
|
|
36
|
+
var COVEO_SHOPIFY_CONFIG_KEY = "coveo_shopify_config";
|
|
46
37
|
export {
|
|
47
38
|
COVEO_SHOPIFY_CONFIG_KEY,
|
|
48
|
-
SHOPIFY_COOKIE_KEY,
|
|
49
39
|
fetchAppProxyConfig,
|
|
50
|
-
|
|
51
|
-
getShopifyCookie
|
|
40
|
+
publishCustomShopifyEvent
|
|
52
41
|
};
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"main": "./dist/headless.esm.js",
|
|
9
9
|
"module": "./dist/headless.esm.js",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
|
-
"version": "1.
|
|
11
|
+
"version": "1.6.0-pre.39a35b416e",
|
|
12
12
|
"files": [
|
|
13
13
|
"dist/"
|
|
14
14
|
],
|
|
@@ -53,11 +53,10 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@coveo/ci": "1.0.0",
|
|
56
|
-
"vitest": "3.2.
|
|
56
|
+
"vitest": "3.2.3"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@coveo/headless": "3.26.1-pre.
|
|
60
|
-
"@coveo/relay": "1.2.1",
|
|
59
|
+
"@coveo/headless": "3.26.1-pre.39a35b416e",
|
|
61
60
|
"uuid": "^11.0.0"
|
|
62
61
|
},
|
|
63
62
|
"engines": {
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const UUID_NAMESPACE = "c2db3701-991e-424d-b117-03e30d43b651";
|
|
2
|
-
/**
|
|
3
|
-
* Generates a unique client identifier for the Shopify store.
|
|
4
|
-
*
|
|
5
|
-
* This function creates a version 5 UUID based on the provided
|
|
6
|
-
* shop-specific data and the Shopify cookie value.
|
|
7
|
-
*
|
|
8
|
-
* @param shop - The identifier of the Shopify store.
|
|
9
|
-
* @param shopifyCookie - The value of the Shopify _shopify_y cookie.
|
|
10
|
-
* @returns A version 5 UUID string uniquely representing the client.
|
|
11
|
-
*/
|
|
12
|
-
export declare function getClientId(shopifyCookie: string): string;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { v5 } from 'uuid';
|
|
2
|
-
export const UUID_NAMESPACE = 'c2db3701-991e-424d-b117-03e30d43b651';
|
|
3
|
-
/**
|
|
4
|
-
* Generates a unique client identifier for the Shopify store.
|
|
5
|
-
*
|
|
6
|
-
* This function creates a version 5 UUID based on the provided
|
|
7
|
-
* shop-specific data and the Shopify cookie value.
|
|
8
|
-
*
|
|
9
|
-
* @param shop - The identifier of the Shopify store.
|
|
10
|
-
* @param shopifyCookie - The value of the Shopify _shopify_y cookie.
|
|
11
|
-
* @returns A version 5 UUID string uniquely representing the client.
|
|
12
|
-
*/
|
|
13
|
-
export function getClientId(shopifyCookie) {
|
|
14
|
-
return v5(shopifyCookie, UUID_NAMESPACE);
|
|
15
|
-
}
|