@usereactify/search 5.2.0-beta.1 → 5.2.0-beta.2

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.2](https://bitbucket.org/usereactify/reactify-search-ui/compare/beta-v5.2.0-beta.1...beta-v5.2.0-beta.2) (2022-08-10)
6
+
7
+
8
+ ### Features
9
+
10
+ * add getData method to liquid utility ([bf3b75c](https://bitbucket.org/usereactify/reactify-search-ui/commit/bf3b75c0b3a9f6ece11120ff190f0e740021a58f))
11
+
5
12
  ## [5.2.0-beta.1](https://bitbucket.org/usereactify/reactify-search-ui/compare/beta-v5.2.0-beta.0...beta-v5.2.0-beta.1) (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.2.0-beta.1",
4
+ "version": "5.2.0-beta.2",
5
5
  "license": "MIT",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",
@@ -11,4 +11,5 @@ export declare class ReactifySearchLiquidFactory {
11
11
  });
12
12
  getProvider(): React.FC<{}>;
13
13
  getMountNode(): HTMLElement;
14
+ getData(): any;
14
15
  }
@@ -30,6 +30,19 @@ class ReactifySearchLiquidFactory {
30
30
  }
31
31
  return mountNode;
32
32
  }
33
+ getData() {
34
+ const dataNode = document.getElementById("reactify-data");
35
+ if (!dataNode) {
36
+ throw new Error(`Cannot find data node with ID "reactify-data"`);
37
+ }
38
+ try {
39
+ const data = JSON.parse(dataNode.innerHTML);
40
+ return data;
41
+ }
42
+ catch (_a) {
43
+ throw new Error(`Cannot parse the data node with ID "reactify-data", check your liquid formatting`);
44
+ }
45
+ }
33
46
  }
34
47
  exports.ReactifySearchLiquidFactory = ReactifySearchLiquidFactory;
35
48
  //# sourceMappingURL=liquid.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"liquid.js","sourceRoot":"","sources":["../../../src/utility/liquid.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,8CAGuB;AAEvB,MAAa,2BAA2B;IACtC,YACS,aAMN;QANM,kBAAa,GAAb,aAAa,CAMnB;IACA,CAAC;IAEJ,WAAW;;QACT,MAAM,sBAAsB,GAC1B,MAAA,IAAI,CAAC,aAAa,CAAC,sBAAsB,mCACzC,MAAA,MAAC,MAAc,0CAAE,OAAO,0CAAE,IAAI,CAAC;QACjC,IAAI,CAAC,sBAAsB,EAAE;YAC3B,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;SACxE;QAED,MAAM,gBAAgB,GACpB,MAAA,IAAI,CAAC,aAAa,CAAC,gBAAgB,mCACnC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACtC,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,YAAY,IAAI,CAAC,gBAAgB,EAAE;YACjE,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;SAC/D;QAED,MAAM,QAAQ,GAAa,CAAC,KAAK,EAAE,EAAE,CAAC,CACpC,8BAAC,mCAAsB,oBACjB,IAAI,CAAC,aAAa,IACtB,sBAAsB,EAAE,sBAAsB,EAC9C,gBAAgB,EAAE,gBAAgB,KAEjC,KAAK,CAAC,QAAQ,CACQ,CAC1B,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,YAAY;QACV,MAAM,SAAS,GAAG,QAAQ,CAAC,cAAc,CACvC,kBAAkB,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAC5C,CAAC;QACF,IAAI,CAAC,SAAS,EAAE;YACd,MAAM,IAAI,KAAK,CACb,kDAAkD,IAAI,CAAC,aAAa,CAAC,IAAI,GAAG,CAC7E,CAAC;SACH;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAnDD,kEAmDC","sourcesContent":["import React from \"react\";\n\nimport {\n ReactifySearchProvider,\n ReactifySearchProviderProps,\n} from \"../components\";\n\nexport class ReactifySearchLiquidFactory {\n constructor(\n public providerProps: Omit<\n ReactifySearchProviderProps,\n \"shopifyPermanentDomain\"\n > & {\n shopifyPermanentDomain?: string;\n collectionHandle?: string;\n }\n ) {}\n\n getProvider() {\n const shopifyPermanentDomain =\n this.providerProps.shopifyPermanentDomain ??\n (window as any)?.Shopify?.shop;\n if (!shopifyPermanentDomain) {\n throw new Error(\"Cannot determine shopifyPermanentDomain from window\");\n }\n\n const collectionHandle =\n this.providerProps.collectionHandle ??\n window.location.href.split(/\\//)[4];\n if (this.providerProps.mode === \"collection\" && !collectionHandle) {\n throw new Error(\"Cannot determine collectionHandle from URL\");\n }\n\n const provider: React.FC = (props) => (\n <ReactifySearchProvider\n {...this.providerProps}\n shopifyPermanentDomain={shopifyPermanentDomain}\n collectionHandle={collectionHandle}\n >\n {props.children}\n </ReactifySearchProvider>\n );\n\n return provider;\n }\n\n getMountNode() {\n const mountNode = document.getElementById(\n `reactify-mount-${this.providerProps.mode}`\n );\n if (!mountNode) {\n throw new Error(\n `Cannot find mount node with ID \"reactify-mount-${this.providerProps.mode}\"`\n );\n }\n\n return mountNode;\n }\n}\n"]}
1
+ {"version":3,"file":"liquid.js","sourceRoot":"","sources":["../../../src/utility/liquid.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,8CAGuB;AAEvB,MAAa,2BAA2B;IACtC,YACS,aAMN;QANM,kBAAa,GAAb,aAAa,CAMnB;IACA,CAAC;IAEJ,WAAW;;QACT,MAAM,sBAAsB,GAC1B,MAAA,IAAI,CAAC,aAAa,CAAC,sBAAsB,mCACzC,MAAA,MAAC,MAAc,0CAAE,OAAO,0CAAE,IAAI,CAAC;QACjC,IAAI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;SACH;IACH,CAAC;CACF;AApED,kEAoEC","sourcesContent":["import React from \"react\";\n\nimport {\n ReactifySearchProvider,\n ReactifySearchProviderProps,\n} from \"../components\";\n\nexport class ReactifySearchLiquidFactory {\n constructor(\n public providerProps: Omit<\n ReactifySearchProviderProps,\n \"shopifyPermanentDomain\"\n > & {\n shopifyPermanentDomain?: string;\n collectionHandle?: string;\n }\n ) {}\n\n getProvider() {\n const shopifyPermanentDomain =\n this.providerProps.shopifyPermanentDomain ??\n (window as any)?.Shopify?.shop;\n if (!shopifyPermanentDomain) {\n throw new Error(\"Cannot determine shopifyPermanentDomain from window\");\n }\n\n const collectionHandle =\n this.providerProps.collectionHandle ??\n window.location.href.split(/\\//)[4];\n if (this.providerProps.mode === \"collection\" && !collectionHandle) {\n throw new Error(\"Cannot determine collectionHandle from URL\");\n }\n\n const provider: React.FC = (props) => (\n <ReactifySearchProvider\n {...this.providerProps}\n shopifyPermanentDomain={shopifyPermanentDomain}\n collectionHandle={collectionHandle}\n >\n {props.children}\n </ReactifySearchProvider>\n );\n\n return provider;\n }\n\n getMountNode() {\n const mountNode = document.getElementById(\n `reactify-mount-${this.providerProps.mode}`\n );\n if (!mountNode) {\n throw new Error(\n `Cannot find mount node with ID \"reactify-mount-${this.providerProps.mode}\"`\n );\n }\n\n return mountNode;\n }\n\n getData() {\n const dataNode = document.getElementById(\"reactify-data\");\n if (!dataNode) {\n throw new Error(`Cannot find data node with ID \"reactify-data\"`);\n }\n\n try {\n const data = JSON.parse(dataNode.innerHTML);\n\n return data;\n } catch {\n throw new Error(\n `Cannot parse the data node with ID \"reactify-data\", check your liquid formatting`\n );\n }\n }\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.2.0-beta.1",
4
+ "version": "5.2.0-beta.2",
5
5
  "license": "MIT",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",