@shopify/hydrogen-react 0.0.0-next-3ab603c → 0.0.0-next-b381faf

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 CHANGED
@@ -150,7 +150,7 @@ Depending on the bundler or runtime that you're using, the correct bundle might
150
150
 
151
151
  Hydrogen React has a development `umd` build and a production `umd` build. Both are meant to be used directly either by `<script src=""></script>` tags in HTML or by `AMD`-compatible loaders.
152
152
 
153
- If you're using Hydrogen React as a global through the `<script>` tag, then the components can be accessed through the `storefrontkitreact` global variable.
153
+ If you're using Hydrogen React as a global through the `<script>` tag, then the components can be accessed through the `hydrogenreact` global variable.
154
154
 
155
155
  ## Enable Storefront API GraphQL autocompletion
156
156
 
@@ -2,36 +2,85 @@ import type { CurrencyCode, LanguageCode, Product, ProductVariant } from './stor
2
2
  import { AnalyticsEventName, ShopifySalesChannel } from './analytics-constants.js';
3
3
  import { SHOPIFY_Y, SHOPIFY_S } from './cart-constants.js';
4
4
  export type ClientBrowserParameters = {
5
- /** Shopify unique user token: Value of `_shopify_y` cookie. Use `getClientBrowserParameters()` to collect this value. */
5
+ /**
6
+ * Shopify unique user token: Value of `_shopify_y` cookie.
7
+ *
8
+ * Use `getClientBrowserParameters()` to collect this value.
9
+ **/
6
10
  uniqueToken: string;
7
- /** Shopify session token: Value of `_shopify_s` cookie. Use `getClientBrowserParameters()` to collect this value. */
11
+ /**
12
+ * Shopify session token: Value of `_shopify_s` cookie.
13
+ *
14
+ * Use `getClientBrowserParameters()` to collect this value.
15
+ **/
8
16
  visitToken: string;
9
- /** `window.location.href`. Use `getClientBrowserParameters()` to collect this value. */
17
+ /**
18
+ * Value of `window.location.href`.
19
+ *
20
+ * Use `getClientBrowserParameters()` to collect this value.
21
+ **/
10
22
  url: string;
11
- /** `window.location.pathname`. Use `getClientBrowserParameters()` to collect this value. */
23
+ /**
24
+ * Value of `window.location.pathname`.
25
+ *
26
+ * Use `getClientBrowserParameters()` to collect this value.
27
+ **/
12
28
  path: string;
13
- /** `window.location.search`. Use `getClientBrowserParameters()` to collect this value. */
29
+ /**
30
+ * Value of `window.location.search`.
31
+ *
32
+ * Use `getClientBrowserParameters()` to collect this value.
33
+ **/
14
34
  search: string;
15
- /** `window.location.referrer`. Use `getClientBrowserParameters()` to collect this value. */
35
+ /**
36
+ * Value of `window.location.referrer`.
37
+ *
38
+ * Use `getClientBrowserParameters()` to collect this value.
39
+ **/
16
40
  referrer: string;
17
- /** `document.title`. Use `getClientBrowserParameters()` to collect this value. */
41
+ /**
42
+ * Value of `document.title`.
43
+ *
44
+ * Use `getClientBrowserParameters()` to collect this value.
45
+ **/
18
46
  title: string;
19
- /** `navigator.userAgent`. Use `getClientBrowserParameters()` to collect this value. */
47
+ /**
48
+ * Value of `navigator.userAgent`.
49
+ *
50
+ * Use `getClientBrowserParameters()` to collect this value.
51
+ **/
20
52
  userAgent: string;
21
- /** Navigation type: 'navigate' | 'reload' | 'back_forward' | 'prerender' | 'unknown <number>'. Use `getClientBrowserParameters()` to collect this value. */
53
+ /**
54
+ * Navigation type: `'navigate' | 'reload' | 'back_forward' | 'prerender' | 'unknown'`.
55
+ *
56
+ * Use `getClientBrowserParameters()` to collect this value.
57
+ **/
22
58
  navigationType: string;
23
- /** Navigation api: 'PerformanceNavigationTiming' | 'performance.navigation'. Use `getClientBrowserParameters()` to collect this value. */
59
+ /**
60
+ * Navigation api: `'PerformanceNavigationTiming' | 'performance.navigation'`.
61
+ *
62
+ * Use `getClientBrowserParameters()` to collect this value.
63
+ **/
24
64
  navigationApi: string;
25
65
  };
26
66
  export type ShopifyAnalyticsProduct = {
67
+ /** Product id in the form of `gid://shopify/Product/<id>`. */
27
68
  productGid: Product['id'];
69
+ /** Variant id in the form of `gid://shopify/ProductVariant/<id>`. */
28
70
  variantGid?: ProductVariant['id'];
71
+ /** Product name. */
29
72
  name: Product['title'];
73
+ /** Variant name. */
30
74
  variantName?: ProductVariant['title'];
75
+ /** Product brand or vendor. */
31
76
  brand: Product['vendor'];
77
+ /** Product category or type. */
32
78
  category?: Product['productType'];
79
+ /** Product price. */
33
80
  price: ProductVariant['price']['amount'];
81
+ /** Product sku. */
34
82
  sku?: ProductVariant['sku'];
83
+ /** Quantity of the product in this event. */
35
84
  quantity?: number;
36
85
  };
37
86
  type ShopifyAnalyticsBase = {
@@ -51,7 +100,7 @@ type ShopifyAnalyticsBase = {
51
100
  customerId?: string;
52
101
  /** Total value of products. */
53
102
  totalValue?: number;
54
- /** Shopify products. */
103
+ /** Product list. */
55
104
  products?: ShopifyAnalyticsProduct[];
56
105
  };
57
106
  export type ShopifySalesChannels = keyof typeof ShopifySalesChannel;
@@ -1,5 +1,5 @@
1
1
  (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react")) : typeof define === "function" && define.amd ? define(["exports", "react"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.storefrontkitreact = {}, global.React));
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react")) : typeof define === "function" && define.amd ? define(["exports", "react"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.hydrogenreact = {}, global.React));
3
3
  })(this, function(exports2, React) {
4
4
  "use strict";
5
5
  function _interopNamespaceDefault(e2) {
@@ -1,4 +1,4 @@
1
- (function(A,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],s):(A=typeof globalThis<"u"?globalThis:A||self,s(A.storefrontkitreact={},A.React))})(this,function(A,s){"use strict";function At(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Oe=At(s);/*! *****************************************************************************
1
+ (function(A,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],s):(A=typeof globalThis<"u"?globalThis:A||self,s(A.hydrogenreact={},A.React))})(this,function(A,s){"use strict";function At(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Oe=At(s);/*! *****************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any