@gem-sdk/plugin-loox 1.0.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/README.md ADDED
@@ -0,0 +1 @@
1
+ # GemX Plugin
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var react = require('react');
7
+ var Script = require('next/script');
8
+
9
+ const ProductReview = ({ productId, type, shop }) => {
10
+ const props = react.useMemo(() => {
11
+ switch (type) {
12
+ case 'star':
13
+ return {
14
+ 'data-fetch': true,
15
+ className: 'loox-rating',
16
+ 'data-id': productId,
17
+ };
18
+ case 'carousel':
19
+ return {
20
+ id: 'looxCarousel',
21
+ 'data-show-more': true,
22
+ 'data-product-ids': productId,
23
+ };
24
+ default:
25
+ return {
26
+ id: 'looxReviews',
27
+ 'data-product-id': productId,
28
+ };
29
+ }
30
+ }, [productId, type]);
31
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Script, { src: `//loox.io/widget/loox.js?shop=${shop}` }), jsxRuntime.jsx("div", { ...props })] }));
32
+ };
33
+
34
+ exports.default = ProductReview;
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var ProductReview = require('./components/ProductReview.js');
6
+
7
+
8
+
9
+ exports.default = ProductReview.default;
@@ -0,0 +1,30 @@
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import { useMemo } from 'react';
3
+ import Script from 'next/script';
4
+
5
+ const ProductReview = ({ productId, type, shop }) => {
6
+ const props = useMemo(() => {
7
+ switch (type) {
8
+ case 'star':
9
+ return {
10
+ 'data-fetch': true,
11
+ className: 'loox-rating',
12
+ 'data-id': productId,
13
+ };
14
+ case 'carousel':
15
+ return {
16
+ id: 'looxCarousel',
17
+ 'data-show-more': true,
18
+ 'data-product-ids': productId,
19
+ };
20
+ default:
21
+ return {
22
+ id: 'looxReviews',
23
+ 'data-product-id': productId,
24
+ };
25
+ }
26
+ }, [productId, type]);
27
+ return (jsxs(Fragment, { children: [jsx(Script, { src: `//loox.io/widget/loox.js?shop=${shop}` }), jsx("div", { ...props })] }));
28
+ };
29
+
30
+ export { ProductReview as default };
@@ -0,0 +1,2 @@
1
+ import ProductReview from './components/ProductReview.js';
2
+ export { default } from './components/ProductReview.js';
@@ -0,0 +1,8 @@
1
+ type ProductReviewProps = {
2
+ productId: string;
3
+ type?: 'star' | 'carousel' | 'default';
4
+ shop: string;
5
+ };
6
+ declare const ProductReview: React.FC<ProductReviewProps>;
7
+
8
+ export { ProductReview as default };
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@gem-sdk/plugin-loox",
3
+ "version": "1.0.0",
4
+ "license": "MIT",
5
+ "sideEffects": false,
6
+ "main": "dist/cjs/index.js",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "cleanup": "rimraf es dist lib",
12
+ "prebuild": "yarn cleanup",
13
+ "pre:publish": "node ./../../helpers/convert-publish.js -p",
14
+ "post:publish": "node ./../../helpers/convert-publish.js",
15
+ "watch": "rollup -c ./../../helpers/rollup.config.mjs -w",
16
+ "build": "rollup -c ./../../helpers/rollup.config.mjs --environment NODE_ENV:production",
17
+ "lint": "eslint ./src --ext .tsx,.ts",
18
+ "type-check": "yarn tsc --noEmit",
19
+ "test": "jest -c ./../../helpers/jest.config.ts"
20
+ },
21
+ "dependencies": {
22
+ "@gem-sdk/styles": "*"
23
+ },
24
+ "devDependencies": {
25
+ "@gem-sdk/core": "*"
26
+ },
27
+ "peerDependencies": {
28
+ "react": "^17 || ^18",
29
+ "react-dom": "^17 || ^18"
30
+ },
31
+ "module": "dist/esm/index.js",
32
+ "types": "dist/types/index.d.ts",
33
+ "exports": {
34
+ "./package.json": "./package.json",
35
+ ".": {
36
+ "import": "./dist/esm/index.js",
37
+ "require": "./dist/cjs/index.js",
38
+ "types": "./dist/types/index.d.ts"
39
+ }
40
+ }
41
+ }