@coveo/shopify 1.3.1-pre.eb41b2c5d8 → 1.4.0-pre.a535b4e1fd

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.
@@ -82,6 +82,14 @@ function buildShopifyCommerceEngine({
82
82
  "Unable to find the _shopify_y cookie. Please ensure you are running this code in a Shopify store."
83
83
  );
84
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
+ }
85
93
  const appProxyResponse = {
86
94
  accessToken: commerceEngineOptions.configuration.accessToken,
87
95
  organizationId: commerceEngineOptions.configuration.organizationId,
@@ -38,6 +38,14 @@ export function buildShopifyCommerceEngine({ commerceEngineOptions, shopifyCooki
38
38
  if (!cookie) {
39
39
  throw new Error('Unable to find the _shopify_y cookie. Please ensure you are running this code in a Shopify store.');
40
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
+ }
41
49
  const appProxyResponse = {
42
50
  accessToken: commerceEngineOptions.configuration.accessToken,
43
51
  organizationId: commerceEngineOptions.configuration.organizationId,
@@ -80,6 +80,14 @@ function buildShopifySearchEngine({
80
80
  "Unable to find the _shopify_y cookie. Please ensure you are running this code in a Shopify store."
81
81
  );
82
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
+ }
83
91
  const appProxyResponse = {
84
92
  accessToken: searchEngineOptions.configuration.accessToken,
85
93
  organizationId: searchEngineOptions.configuration.organizationId,
@@ -38,6 +38,14 @@ export function buildShopifySearchEngine({ searchEngineOptions, environment, sho
38
38
  if (!cookie) {
39
39
  throw new Error('Unable to find the _shopify_y cookie. Please ensure you are running this code in a Shopify store.');
40
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
+ }
41
49
  const appProxyResponse = {
42
50
  accessToken: searchEngineOptions.configuration.accessToken,
43
51
  organizationId: searchEngineOptions.configuration.organizationId,
@@ -120,6 +120,14 @@ function buildShopifyCommerceEngine({
120
120
  "Unable to find the _shopify_y cookie. Please ensure you are running this code in a Shopify store."
121
121
  );
122
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
+ }
123
131
  const appProxyResponse = {
124
132
  accessToken: commerceEngineOptions.configuration.accessToken,
125
133
  organizationId: commerceEngineOptions.configuration.organizationId,
@@ -1,3 +1,4 @@
1
1
  export { getClientId } from './clientid';
2
2
  export { getShopifyCookie } from './shopify';
3
3
  export { fetchAppProxyConfig } from './app-proxy';
4
+ export * from '../constants';
@@ -1,3 +1,4 @@
1
1
  export { getClientId } from './clientid';
2
2
  export { getShopifyCookie } from './shopify';
3
3
  export { fetchAppProxyConfig } from './app-proxy';
4
+ export * from '../constants';
@@ -25,6 +25,7 @@ function getClientId(shopifyCookie) {
25
25
 
26
26
  // src/constants.ts
27
27
  var SHOPIFY_COOKIE_KEY = "_shopify_y";
28
+ var COVEO_SHOPIFY_CONFIG_KEY = "coveo_shopify_config";
28
29
 
29
30
  // src/utilities/shopify.ts
30
31
  function getShopifyCookie(name = SHOPIFY_COOKIE_KEY) {
@@ -43,6 +44,8 @@ async function fetchAppProxyConfig({
43
44
  return response.json();
44
45
  }
45
46
  export {
47
+ COVEO_SHOPIFY_CONFIG_KEY,
48
+ SHOPIFY_COOKIE_KEY,
46
49
  fetchAppProxyConfig,
47
50
  getClientId,
48
51
  getShopifyCookie
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.3.1-pre.eb41b2c5d8",
11
+ "version": "1.4.0-pre.a535b4e1fd",
12
12
  "files": [
13
13
  "dist/"
14
14
  ],
@@ -56,8 +56,8 @@
56
56
  "vitest": "3.1.4"
57
57
  },
58
58
  "dependencies": {
59
- "@coveo/headless": "3.25.1-pre.eb41b2c5d8",
60
- "@coveo/relay": "1.2.0",
59
+ "@coveo/headless": "3.25.1-pre.a535b4e1fd",
60
+ "@coveo/relay": "1.2.1",
61
61
  "uuid": "^11.0.0"
62
62
  },
63
63
  "engines": {