@shopify/hydrogen 0.6.0 → 0.6.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.
Files changed (35) hide show
  1. package/dist/esnext/foundation/useServerState/use-server-state.d.ts +1 -1
  2. package/dist/esnext/foundation/useServerState/use-server-state.js +1 -1
  3. package/dist/esnext/utilities/flattenConnection/flattenConnection.d.ts +12 -0
  4. package/dist/esnext/utilities/flattenConnection/flattenConnection.js +14 -0
  5. package/dist/esnext/utilities/flattenConnection/index.d.ts +1 -0
  6. package/dist/esnext/utilities/flattenConnection/index.js +1 -0
  7. package/dist/esnext/utilities/index.d.ts +3 -3
  8. package/dist/esnext/utilities/index.js +3 -3
  9. package/dist/esnext/utilities/{meaurement.d.ts → measurement.d.ts} +0 -0
  10. package/dist/esnext/utilities/{meaurement.js → measurement.js} +0 -0
  11. package/dist/esnext/utilities/{metafields → parseMetafieldValue}/index.d.ts +0 -0
  12. package/dist/esnext/utilities/{metafields → parseMetafieldValue}/index.js +0 -0
  13. package/dist/esnext/utilities/{metafields → parseMetafieldValue}/parseMetafieldValue.d.ts +1 -6
  14. package/dist/esnext/utilities/{metafields → parseMetafieldValue}/parseMetafieldValue.js +1 -6
  15. package/dist/esnext/version.d.ts +1 -1
  16. package/dist/esnext/version.js +1 -1
  17. package/dist/node/utilities/flattenConnection/flattenConnection.d.ts +12 -0
  18. package/dist/node/utilities/flattenConnection/flattenConnection.js +18 -0
  19. package/dist/node/utilities/flattenConnection/index.d.ts +1 -0
  20. package/dist/node/utilities/flattenConnection/index.js +5 -0
  21. package/dist/node/utilities/index.d.ts +3 -3
  22. package/dist/node/utilities/index.js +7 -7
  23. package/dist/node/utilities/{meaurement.d.ts → measurement.d.ts} +0 -0
  24. package/dist/node/utilities/{meaurement.js → measurement.js} +0 -0
  25. package/dist/node/utilities/{metafields → parseMetafieldValue}/index.d.ts +0 -0
  26. package/dist/node/utilities/{metafields → parseMetafieldValue}/index.js +0 -0
  27. package/dist/node/utilities/{metafields → parseMetafieldValue}/parseMetafieldValue.d.ts +1 -6
  28. package/dist/node/utilities/{metafields → parseMetafieldValue}/parseMetafieldValue.js +1 -6
  29. package/dist/node/version.d.ts +1 -1
  30. package/dist/node/version.js +1 -1
  31. package/package.json +2 -2
  32. package/dist/esnext/utilities/connections.d.ts +0 -2
  33. package/dist/esnext/utilities/connections.js +0 -4
  34. package/dist/node/utilities/connections.d.ts +0 -2
  35. package/dist/node/utilities/connections.js +0 -8
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The `useServerState` hook allows you to [manage server state](/custom-storefronts/hydrogen/framework/server-state) when using Hydrogen as a React Server Component framework.
2
+ * The `useServerState` hook allows you to [manage server state](/api/hydrogen/framework/server-state) when using Hydrogen as a React Server Component framework.
3
3
  *
4
4
  * ## Return value
5
5
  *
@@ -1,7 +1,7 @@
1
1
  import { useContext } from 'react';
2
2
  import { ServerStateContext } from '../ServerStateProvider';
3
3
  /**
4
- * The `useServerState` hook allows you to [manage server state](/custom-storefronts/hydrogen/framework/server-state) when using Hydrogen as a React Server Component framework.
4
+ * The `useServerState` hook allows you to [manage server state](/api/hydrogen/framework/server-state) when using Hydrogen as a React Server Component framework.
5
5
  *
6
6
  * ## Return value
7
7
  *
@@ -0,0 +1,12 @@
1
+ import { GraphQLConnection } from '../../types';
2
+ /**
3
+ * The `flattenConnection` utility transforms a connection object from the Storefront API (for example, [Product-related connections](api/storefront/reference/products/product#connections)) into a flat array of nodes.
4
+ * ## Arguments
5
+ * | Description | Required |
6
+ * | ------------| --------- |
7
+ * | A connection object with the field `edges` whose value is an array of objects corresponding to `{node: Value}`. For example, any of the [Product connections](api/storefront/reference/products/product#connections) | Yes |
8
+ *
9
+ * ## Return type
10
+ * A flat array whose elements correspond to the `node` value in each element of the original `edges` array.
11
+ */
12
+ export declare function flattenConnection<T>(connection: GraphQLConnection<T>): T[];
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The `flattenConnection` utility transforms a connection object from the Storefront API (for example, [Product-related connections](api/storefront/reference/products/product#connections)) into a flat array of nodes.
3
+ * ## Arguments
4
+ * | Description | Required |
5
+ * | ------------| --------- |
6
+ * | A connection object with the field `edges` whose value is an array of objects corresponding to `{node: Value}`. For example, any of the [Product connections](api/storefront/reference/products/product#connections) | Yes |
7
+ *
8
+ * ## Return type
9
+ * A flat array whose elements correspond to the `node` value in each element of the original `edges` array.
10
+ */
11
+ export function flattenConnection(connection) {
12
+ var _a;
13
+ return ((_a = connection.edges) !== null && _a !== void 0 ? _a : []).map((edge) => edge.node);
14
+ }
@@ -0,0 +1 @@
1
+ export { flattenConnection } from './flattenConnection';
@@ -0,0 +1 @@
1
+ export { flattenConnection } from './flattenConnection';
@@ -2,9 +2,9 @@ export { addImageSizeParametersToUrl, ImageSizeOptions, ImageLoaderOptions, useI
2
2
  export { YouTube, Vimeo, addParametersToEmbeddedVideoUrl, useEmbeddedVideoUrl, } from './video_parameters';
3
3
  export { loadScript } from './script_loader';
4
4
  export { wrapPromise } from './suspense';
5
- export { flattenConnection } from './connections';
5
+ export { flattenConnection } from './flattenConnection';
6
6
  export { isClient } from './isClient';
7
7
  export { isServer } from './isServer';
8
- export { getMeasurementAsParts, getMeasurementAsString } from './meaurement';
9
- export { parseMetafieldValue } from './metafields';
8
+ export { getMeasurementAsParts, getMeasurementAsString } from './measurement';
9
+ export { parseMetafieldValue } from './parseMetafieldValue';
10
10
  export { fetchBuilder, graphqlRequestBody, decodeShopifyId } from './fetch';
@@ -2,9 +2,9 @@ export { addImageSizeParametersToUrl, useImageUrl, getShopifyImageDimensions, sh
2
2
  export { addParametersToEmbeddedVideoUrl, useEmbeddedVideoUrl, } from './video_parameters';
3
3
  export { loadScript } from './script_loader';
4
4
  export { wrapPromise } from './suspense';
5
- export { flattenConnection } from './connections';
5
+ export { flattenConnection } from './flattenConnection';
6
6
  export { isClient } from './isClient';
7
7
  export { isServer } from './isServer';
8
- export { getMeasurementAsParts, getMeasurementAsString } from './meaurement';
9
- export { parseMetafieldValue } from './metafields';
8
+ export { getMeasurementAsParts, getMeasurementAsString } from './measurement';
9
+ export { parseMetafieldValue } from './parseMetafieldValue';
10
10
  export { fetchBuilder, graphqlRequestBody, decodeShopifyId } from './fetch';
@@ -8,7 +8,7 @@ import { Metafield } from '../../graphql/types/types';
8
8
  * | ------------------------------------------------------------------------- | -------- |
9
9
  * | A [Metafield object](/api/storefront/reference/common-objects/metafield). | Yes |
10
10
  *
11
- * ## Return Type
11
+ * ## Return type
12
12
  *
13
13
  * Depending on the `type` specified in the passed [Metafield](/api/storefront/reference/common-objects/metafield), the following type is returned:
14
14
  *
@@ -32,10 +32,5 @@ import { Metafield } from '../../graphql/types/types';
32
32
  * | `page_reference` | string |
33
33
  * | `variant_reference` | string |
34
34
  * | `url` | string |
35
- *
36
- *
37
- * ## Related hook
38
- *
39
- * - [`useParsedMetafields`](/api/hydrogen/hooks/metafield/useparsedmetafields)
40
35
  */
41
36
  export declare function parseMetafieldValue(metafield: Partial<Metafield>): any;
@@ -7,7 +7,7 @@
7
7
  * | ------------------------------------------------------------------------- | -------- |
8
8
  * | A [Metafield object](/api/storefront/reference/common-objects/metafield). | Yes |
9
9
  *
10
- * ## Return Type
10
+ * ## Return type
11
11
  *
12
12
  * Depending on the `type` specified in the passed [Metafield](/api/storefront/reference/common-objects/metafield), the following type is returned:
13
13
  *
@@ -31,11 +31,6 @@
31
31
  * | `page_reference` | string |
32
32
  * | `variant_reference` | string |
33
33
  * | `url` | string |
34
- *
35
- *
36
- * ## Related hook
37
- *
38
- * - [`useParsedMetafields`](/api/hydrogen/hooks/metafield/useparsedmetafields)
39
34
  */
40
35
  export function parseMetafieldValue(metafield) {
41
36
  if (metafield.value == null) {
@@ -1 +1 @@
1
- export declare const LIB_VERSION = "0.6.0";
1
+ export declare const LIB_VERSION = "0.6.1";
@@ -1 +1 @@
1
- export const LIB_VERSION = '0.6.0';
1
+ export const LIB_VERSION = '0.6.1';
@@ -0,0 +1,12 @@
1
+ import { GraphQLConnection } from '../../types';
2
+ /**
3
+ * The `flattenConnection` utility transforms a connection object from the Storefront API (for example, [Product-related connections](api/storefront/reference/products/product#connections)) into a flat array of nodes.
4
+ * ## Arguments
5
+ * | Description | Required |
6
+ * | ------------| --------- |
7
+ * | A connection object with the field `edges` whose value is an array of objects corresponding to `{node: Value}`. For example, any of the [Product connections](api/storefront/reference/products/product#connections) | Yes |
8
+ *
9
+ * ## Return type
10
+ * A flat array whose elements correspond to the `node` value in each element of the original `edges` array.
11
+ */
12
+ export declare function flattenConnection<T>(connection: GraphQLConnection<T>): T[];
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.flattenConnection = void 0;
4
+ /**
5
+ * The `flattenConnection` utility transforms a connection object from the Storefront API (for example, [Product-related connections](api/storefront/reference/products/product#connections)) into a flat array of nodes.
6
+ * ## Arguments
7
+ * | Description | Required |
8
+ * | ------------| --------- |
9
+ * | A connection object with the field `edges` whose value is an array of objects corresponding to `{node: Value}`. For example, any of the [Product connections](api/storefront/reference/products/product#connections) | Yes |
10
+ *
11
+ * ## Return type
12
+ * A flat array whose elements correspond to the `node` value in each element of the original `edges` array.
13
+ */
14
+ function flattenConnection(connection) {
15
+ var _a;
16
+ return ((_a = connection.edges) !== null && _a !== void 0 ? _a : []).map((edge) => edge.node);
17
+ }
18
+ exports.flattenConnection = flattenConnection;
@@ -0,0 +1 @@
1
+ export { flattenConnection } from './flattenConnection';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.flattenConnection = void 0;
4
+ var flattenConnection_1 = require("./flattenConnection");
5
+ Object.defineProperty(exports, "flattenConnection", { enumerable: true, get: function () { return flattenConnection_1.flattenConnection; } });
@@ -2,9 +2,9 @@ export { addImageSizeParametersToUrl, ImageSizeOptions, ImageLoaderOptions, useI
2
2
  export { YouTube, Vimeo, addParametersToEmbeddedVideoUrl, useEmbeddedVideoUrl, } from './video_parameters';
3
3
  export { loadScript } from './script_loader';
4
4
  export { wrapPromise } from './suspense';
5
- export { flattenConnection } from './connections';
5
+ export { flattenConnection } from './flattenConnection';
6
6
  export { isClient } from './isClient';
7
7
  export { isServer } from './isServer';
8
- export { getMeasurementAsParts, getMeasurementAsString } from './meaurement';
9
- export { parseMetafieldValue } from './metafields';
8
+ export { getMeasurementAsParts, getMeasurementAsString } from './measurement';
9
+ export { parseMetafieldValue } from './parseMetafieldValue';
10
10
  export { fetchBuilder, graphqlRequestBody, decodeShopifyId } from './fetch';
@@ -13,17 +13,17 @@ var script_loader_1 = require("./script_loader");
13
13
  Object.defineProperty(exports, "loadScript", { enumerable: true, get: function () { return script_loader_1.loadScript; } });
14
14
  var suspense_1 = require("./suspense");
15
15
  Object.defineProperty(exports, "wrapPromise", { enumerable: true, get: function () { return suspense_1.wrapPromise; } });
16
- var connections_1 = require("./connections");
17
- Object.defineProperty(exports, "flattenConnection", { enumerable: true, get: function () { return connections_1.flattenConnection; } });
16
+ var flattenConnection_1 = require("./flattenConnection");
17
+ Object.defineProperty(exports, "flattenConnection", { enumerable: true, get: function () { return flattenConnection_1.flattenConnection; } });
18
18
  var isClient_1 = require("./isClient");
19
19
  Object.defineProperty(exports, "isClient", { enumerable: true, get: function () { return isClient_1.isClient; } });
20
20
  var isServer_1 = require("./isServer");
21
21
  Object.defineProperty(exports, "isServer", { enumerable: true, get: function () { return isServer_1.isServer; } });
22
- var meaurement_1 = require("./meaurement");
23
- Object.defineProperty(exports, "getMeasurementAsParts", { enumerable: true, get: function () { return meaurement_1.getMeasurementAsParts; } });
24
- Object.defineProperty(exports, "getMeasurementAsString", { enumerable: true, get: function () { return meaurement_1.getMeasurementAsString; } });
25
- var metafields_1 = require("./metafields");
26
- Object.defineProperty(exports, "parseMetafieldValue", { enumerable: true, get: function () { return metafields_1.parseMetafieldValue; } });
22
+ var measurement_1 = require("./measurement");
23
+ Object.defineProperty(exports, "getMeasurementAsParts", { enumerable: true, get: function () { return measurement_1.getMeasurementAsParts; } });
24
+ Object.defineProperty(exports, "getMeasurementAsString", { enumerable: true, get: function () { return measurement_1.getMeasurementAsString; } });
25
+ var parseMetafieldValue_1 = require("./parseMetafieldValue");
26
+ Object.defineProperty(exports, "parseMetafieldValue", { enumerable: true, get: function () { return parseMetafieldValue_1.parseMetafieldValue; } });
27
27
  var fetch_1 = require("./fetch");
28
28
  Object.defineProperty(exports, "fetchBuilder", { enumerable: true, get: function () { return fetch_1.fetchBuilder; } });
29
29
  Object.defineProperty(exports, "graphqlRequestBody", { enumerable: true, get: function () { return fetch_1.graphqlRequestBody; } });
@@ -8,7 +8,7 @@ import { Metafield } from '../../graphql/types/types';
8
8
  * | ------------------------------------------------------------------------- | -------- |
9
9
  * | A [Metafield object](/api/storefront/reference/common-objects/metafield). | Yes |
10
10
  *
11
- * ## Return Type
11
+ * ## Return type
12
12
  *
13
13
  * Depending on the `type` specified in the passed [Metafield](/api/storefront/reference/common-objects/metafield), the following type is returned:
14
14
  *
@@ -32,10 +32,5 @@ import { Metafield } from '../../graphql/types/types';
32
32
  * | `page_reference` | string |
33
33
  * | `variant_reference` | string |
34
34
  * | `url` | string |
35
- *
36
- *
37
- * ## Related hook
38
- *
39
- * - [`useParsedMetafields`](/api/hydrogen/hooks/metafield/useparsedmetafields)
40
35
  */
41
36
  export declare function parseMetafieldValue(metafield: Partial<Metafield>): any;
@@ -10,7 +10,7 @@ exports.parseMetafieldValue = void 0;
10
10
  * | ------------------------------------------------------------------------- | -------- |
11
11
  * | A [Metafield object](/api/storefront/reference/common-objects/metafield). | Yes |
12
12
  *
13
- * ## Return Type
13
+ * ## Return type
14
14
  *
15
15
  * Depending on the `type` specified in the passed [Metafield](/api/storefront/reference/common-objects/metafield), the following type is returned:
16
16
  *
@@ -34,11 +34,6 @@ exports.parseMetafieldValue = void 0;
34
34
  * | `page_reference` | string |
35
35
  * | `variant_reference` | string |
36
36
  * | `url` | string |
37
- *
38
- *
39
- * ## Related hook
40
- *
41
- * - [`useParsedMetafields`](/api/hydrogen/hooks/metafield/useparsedmetafields)
42
37
  */
43
38
  function parseMetafieldValue(metafield) {
44
39
  if (metafield.value == null) {
@@ -1 +1 @@
1
- export declare const LIB_VERSION = "0.6.0";
1
+ export declare const LIB_VERSION = "0.6.1";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LIB_VERSION = void 0;
4
- exports.LIB_VERSION = '0.6.0';
4
+ exports.LIB_VERSION = '0.6.1';
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public",
5
5
  "@shopify:registry": "https://registry.npmjs.org"
6
6
  },
7
- "version": "0.6.0",
7
+ "version": "0.6.1",
8
8
  "description": "Modern custom Shopify storefronts",
9
9
  "license": "MIT",
10
10
  "main": "dist/esnext/index.js",
@@ -95,5 +95,5 @@
95
95
  "react-ssr-prepass": "^1.4.0",
96
96
  "vite-plugin-inspect": "^0.3.6"
97
97
  },
98
- "gitHead": "6f08959ac91c34f4bd2c26d7e7e9c144abae0d0c"
98
+ "gitHead": "8b292618107390b2e81a03a068b20899f66f0761"
99
99
  }
@@ -1,2 +0,0 @@
1
- import { GraphQLConnection } from '../types';
2
- export declare function flattenConnection<T>(connection: GraphQLConnection<T>): T[];
@@ -1,4 +0,0 @@
1
- export function flattenConnection(connection) {
2
- var _a;
3
- return ((_a = connection.edges) !== null && _a !== void 0 ? _a : []).map((edge) => edge.node);
4
- }
@@ -1,2 +0,0 @@
1
- import { GraphQLConnection } from '../types';
2
- export declare function flattenConnection<T>(connection: GraphQLConnection<T>): T[];
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.flattenConnection = void 0;
4
- function flattenConnection(connection) {
5
- var _a;
6
- return ((_a = connection.edges) !== null && _a !== void 0 ? _a : []).map((edge) => edge.node);
7
- }
8
- exports.flattenConnection = flattenConnection;