@usereactify/search 5.2.0-beta.0 → 5.2.0-beta.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.
- package/CHANGELOG.md +7 -0
- package/dist/package.json +1 -1
- package/dist/src/utility/liquid.d.ts +12 -8
- package/dist/src/utility/liquid.js +24 -19
- package/dist/src/utility/liquid.js.map +1 -1
- package/package.json +1 -1
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.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
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* improve liquid utilities ([b54a8ca](https://bitbucket.org/usereactify/reactify-search-ui/commit/b54a8caa6c498d3798068fe47527ac5bcde74aca))
|
|
11
|
+
|
|
5
12
|
## [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
13
|
|
|
7
14
|
|
package/dist/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ReactifySearchProviderProps } from "../components";
|
|
3
|
-
export declare
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
export declare class ReactifySearchLiquidFactory {
|
|
4
|
+
providerProps: Omit<ReactifySearchProviderProps, "shopifyPermanentDomain"> & {
|
|
5
|
+
shopifyPermanentDomain?: string;
|
|
6
|
+
collectionHandle?: string;
|
|
7
|
+
};
|
|
8
|
+
constructor(providerProps: Omit<ReactifySearchProviderProps, "shopifyPermanentDomain"> & {
|
|
9
|
+
shopifyPermanentDomain?: string;
|
|
10
|
+
collectionHandle?: string;
|
|
11
|
+
});
|
|
12
|
+
getProvider(): React.FC<{}>;
|
|
13
|
+
getMountNode(): HTMLElement;
|
|
14
|
+
}
|
|
@@ -3,28 +3,33 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.ReactifySearchLiquidFactory = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const components_1 = require("../components");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (!shopifyPermanentDomain) {
|
|
13
|
-
throw new Error("Cannot determine shopifyPermanentDomain from window");
|
|
9
|
+
class ReactifySearchLiquidFactory {
|
|
10
|
+
constructor(providerProps) {
|
|
11
|
+
this.providerProps = providerProps;
|
|
14
12
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
getProvider() {
|
|
14
|
+
var _a, _b, _c, _d;
|
|
15
|
+
const shopifyPermanentDomain = (_a = this.providerProps.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;
|
|
16
|
+
if (!shopifyPermanentDomain) {
|
|
17
|
+
throw new Error("Cannot determine shopifyPermanentDomain from window");
|
|
18
|
+
}
|
|
19
|
+
const collectionHandle = (_d = this.providerProps.collectionHandle) !== null && _d !== void 0 ? _d : window.location.href.split(/\//)[4];
|
|
20
|
+
if (this.providerProps.mode === "collection" && !collectionHandle) {
|
|
21
|
+
throw new Error("Cannot determine collectionHandle from URL");
|
|
22
|
+
}
|
|
23
|
+
const provider = (props) => (react_1.default.createElement(components_1.ReactifySearchProvider, Object.assign({}, this.providerProps, { shopifyPermanentDomain: shopifyPermanentDomain, collectionHandle: collectionHandle }), props.children));
|
|
24
|
+
return provider;
|
|
18
25
|
}
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
throw new Error(`Cannot find mount node with ID "reactify-mount-${props.mode}"`);
|
|
26
|
+
getMountNode() {
|
|
27
|
+
const mountNode = document.getElementById(`reactify-mount-${this.providerProps.mode}`);
|
|
28
|
+
if (!mountNode) {
|
|
29
|
+
throw new Error(`Cannot find mount node with ID "reactify-mount-${this.providerProps.mode}"`);
|
|
30
|
+
}
|
|
31
|
+
return mountNode;
|
|
26
32
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
exports.getLiquidMountNode = getLiquidMountNode;
|
|
33
|
+
}
|
|
34
|
+
exports.ReactifySearchLiquidFactory = ReactifySearchLiquidFactory;
|
|
30
35
|
//# sourceMappingURL=liquid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liquid.js","sourceRoot":"","sources":["../../../src/utility/liquid.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,8CAGuB;
|
|
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"]}
|