@usereactify/search 5.1.6-beta.0 → 5.2.0-beta.0

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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [5.2.0-beta.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/beta-v5.1.6-beta.0...beta-v5.2.0-beta.0) (2022-08-10)
6
+
7
+
8
+ ### Features
9
+
10
+ * add utilities for liquid consumers ([e8d738c](https://bitbucket.org/usereactify/reactify-search-ui/commit/e8d738c2a242e4437f05ab0832e86cabed756f75))
11
+
5
12
  ### [5.1.6-beta.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/beta-v5.1.4-beta.1...beta-v5.1.6-beta.0) (2022-08-10)
6
13
 
7
14
 
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@usereactify/search",
3
3
  "description": "React UI library for Reactify Search",
4
- "version": "5.1.6-beta.0",
4
+ "version": "5.2.0-beta.0",
5
5
  "license": "MIT",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",
@@ -1 +1,2 @@
1
1
  export * from "./debug";
2
+ export * from "./liquid";
@@ -11,4 +11,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./debug"), exports);
14
+ __exportStar(require("./liquid"), exports);
14
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utility/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAAwB","sourcesContent":["export * from \"./debug\";"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utility/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAAwB;AACxB,2CAAyB","sourcesContent":["export * from \"./debug\";\nexport * from \"./liquid\";\n"]}
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { ReactifySearchProviderProps } from "../components";
3
+ export declare const getLiquidProvider: (props: ReactifySearchProviderProps & {
4
+ mode: "collection";
5
+ collectionHandle?: string;
6
+ }, children: React.ReactNode) => () => JSX.Element;
7
+ export declare const getLiquidMountNode: (props: ReactifySearchProviderProps & {
8
+ mode: "collection";
9
+ collectionHandle?: string;
10
+ }, children: React.ReactNode) => HTMLElement;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getLiquidMountNode = exports.getLiquidProvider = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const components_1 = require("../components");
9
+ const getLiquidProvider = (props, children) => {
10
+ var _a, _b, _c, _d;
11
+ const shopifyPermanentDomain = (_a = props.shopifyPermanentDomain) !== null && _a !== void 0 ? _a : (_c = (_b = window) === null || _b === void 0 ? void 0 : _b.Shopify) === null || _c === void 0 ? void 0 : _c.shop;
12
+ if (!shopifyPermanentDomain) {
13
+ throw new Error("Cannot determine shopifyPermanentDomain from window");
14
+ }
15
+ const collectionHandle = (_d = props.collectionHandle) !== null && _d !== void 0 ? _d : window.location.href.split(/\//)[4];
16
+ if (props.mode === "collection" && !collectionHandle) {
17
+ throw new Error("Cannot determine collectionHandle from URL");
18
+ }
19
+ return () => (react_1.default.createElement(components_1.ReactifySearchProvider, Object.assign({}, props, { shopifyPermanentDomain: shopifyPermanentDomain, collectionHandle: collectionHandle }), children));
20
+ };
21
+ exports.getLiquidProvider = getLiquidProvider;
22
+ const getLiquidMountNode = (props, children) => {
23
+ const ReactifySearchMountNode = document.getElementById(`reactify-mount-${props.mode}`);
24
+ if (!ReactifySearchMountNode) {
25
+ throw new Error(`Cannot find mount node with ID "reactify-mount-${props.mode}"`);
26
+ }
27
+ return ReactifySearchMountNode;
28
+ };
29
+ exports.getLiquidMountNode = getLiquidMountNode;
30
+ //# sourceMappingURL=liquid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"liquid.js","sourceRoot":"","sources":["../../../src/utility/liquid.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,8CAGuB;AAEhB,MAAM,iBAAiB,GAAG,CAC/B,KAGC,EACD,QAAyB,EACzB,EAAE;;IACF,MAAM,sBAAsB,GAC1B,MAAA,KAAK,CAAC,sBAAsB,mCAAI,MAAA,MAAC,MAAc,0CAAE,OAAO,0CAAE,IAAI,CAAC;IACjE,IAAI,CAAC,sBAAsB,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;KACxE;IAED,MAAM,gBAAgB,GACpB,MAAA,KAAK,CAAC,gBAAgB,mCAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAChE,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,IAAI,CAAC,gBAAgB,EAAE;QACpD,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;KAC/D;IAED,OAAO,GAAG,EAAE,CAAC,CACX,8BAAC,mCAAsB,oBACjB,KAAK,IACT,sBAAsB,EAAE,sBAAsB,EAC9C,gBAAgB,EAAE,gBAAgB,KAEjC,QAAQ,CACc,CAC1B,CAAC;AACJ,CAAC,CAAC;AA5BW,QAAA,iBAAiB,qBA4B5B;AAEK,MAAM,kBAAkB,GAAG,CAChC,KAGC,EACD,QAAyB,EACzB,EAAE;IACF,MAAM,uBAAuB,GAAG,QAAQ,CAAC,cAAc,CACrD,kBAAkB,KAAK,CAAC,IAAI,EAAE,CAC/B,CAAC;IACF,IAAI,CAAC,uBAAuB,EAAE;QAC5B,MAAM,IAAI,KAAK,CACb,kDAAkD,KAAK,CAAC,IAAI,GAAG,CAChE,CAAC;KACH;IAED,OAAO,uBAAuB,CAAC;AACjC,CAAC,CAAC;AAjBW,QAAA,kBAAkB,sBAiB7B","sourcesContent":["import React from \"react\";\n\nimport {\n ReactifySearchProvider,\n ReactifySearchProviderProps,\n} from \"../components\";\n\nexport const getLiquidProvider = (\n props: ReactifySearchProviderProps & {\n mode: \"collection\";\n collectionHandle?: string;\n },\n children: React.ReactNode\n) => {\n const shopifyPermanentDomain =\n props.shopifyPermanentDomain ?? (window as any)?.Shopify?.shop;\n if (!shopifyPermanentDomain) {\n throw new Error(\"Cannot determine shopifyPermanentDomain from window\");\n }\n\n const collectionHandle =\n props.collectionHandle ?? window.location.href.split(/\\//)[4];\n if (props.mode === \"collection\" && !collectionHandle) {\n throw new Error(\"Cannot determine collectionHandle from URL\");\n }\n\n return () => (\n <ReactifySearchProvider\n {...props}\n shopifyPermanentDomain={shopifyPermanentDomain}\n collectionHandle={collectionHandle}\n >\n {children}\n </ReactifySearchProvider>\n );\n};\n\nexport const getLiquidMountNode = (\n props: ReactifySearchProviderProps & {\n mode: \"collection\";\n collectionHandle?: string;\n },\n children: React.ReactNode\n) => {\n const ReactifySearchMountNode = document.getElementById(\n `reactify-mount-${props.mode}`\n );\n if (!ReactifySearchMountNode) {\n throw new Error(\n `Cannot find mount node with ID \"reactify-mount-${props.mode}\"`\n );\n }\n\n return ReactifySearchMountNode;\n};\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@usereactify/search",
3
3
  "description": "React UI library for Reactify Search",
4
- "version": "5.1.6-beta.0",
4
+ "version": "5.2.0-beta.0",
5
5
  "license": "MIT",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",