@gem-sdk/components 2.6.0-staging.26 → 2.6.0-staging.27
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/dist/cjs/third-party/setting/AovFreeGiftBuyXGetYBogo.js +1 -3
- package/dist/cjs/third-party-instant/components/InstantJudgemeReviews.js +30 -14
- package/dist/cjs/third-party-instant/types/JudgemeReviews.js +4 -0
- package/dist/esm/third-party/setting/AovFreeGiftBuyXGetYBogo.js +1 -3
- package/dist/esm/third-party-instant/components/InstantJudgemeReviews.js +32 -16
- package/dist/esm/third-party-instant/types/JudgemeReviews.js +3 -1
- package/package.json +1 -1
|
@@ -10,9 +10,7 @@ const config = {
|
|
|
10
10
|
icon: '<img class="gp-w-[24px] gp-border gp-border-[#494949] gp-rounded-[3px]" src="https://cdn.shopify.com/app-store/listing_images/b957b53ca225f32cac0ad2cd41f89a1f/icon/CI6dsMjDr4cDEAE=.png">',
|
|
11
11
|
editorConfigs: {
|
|
12
12
|
placeholder: {
|
|
13
|
-
|
|
14
|
-
'Product'
|
|
15
|
-
]
|
|
13
|
+
flowPage: 'GP_PRODUCT'
|
|
16
14
|
},
|
|
17
15
|
component: {
|
|
18
16
|
isThirdParty: true
|
|
@@ -11,22 +11,22 @@ var WithoutProduct = require('./Judgeme/WithoutProduct.js');
|
|
|
11
11
|
|
|
12
12
|
const InstantJudgemeReviews = ({ setting, styles, builderProps })=>{
|
|
13
13
|
const { widgetType, publicToken } = setting ?? {};
|
|
14
|
+
const mode = core.useEditorMode();
|
|
14
15
|
const { storefrontUrl } = core.useStoreFront();
|
|
15
16
|
const SHOPIFY_DOMAIN = storefrontUrl?.replace('https://', '')?.replace('http://', '')?.split('/')?.[0];
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return existing;
|
|
20
|
-
} else {
|
|
17
|
+
const addScripts = (scripts)=>{
|
|
18
|
+
scripts.forEach(([id, src])=>{
|
|
19
|
+
if (document.getElementById(id)) return;
|
|
21
20
|
const script = document.createElement('script');
|
|
22
|
-
script
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
Object.assign(script, {
|
|
22
|
+
id,
|
|
23
|
+
src,
|
|
24
|
+
defer: true,
|
|
25
|
+
type: 'text/javascript'
|
|
26
|
+
});
|
|
26
27
|
script.setAttribute('data-cfasync', 'false');
|
|
27
28
|
document.head.appendChild(script);
|
|
28
|
-
|
|
29
|
-
}
|
|
29
|
+
});
|
|
30
30
|
};
|
|
31
31
|
const addTextScript = React.useCallback((id, public_token)=>{
|
|
32
32
|
if (SHOPIFY_DOMAIN && public_token) {
|
|
@@ -47,9 +47,25 @@ const InstantJudgemeReviews = ({ setting, styles, builderProps })=>{
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
React.useEffect(()=>{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
if (mode !== 'edit') {
|
|
51
|
+
addScripts([
|
|
52
|
+
[
|
|
53
|
+
JudgemeReviews.JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_ID,
|
|
54
|
+
JudgemeReviews.JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_URL
|
|
55
|
+
],
|
|
56
|
+
[
|
|
57
|
+
JudgemeReviews.JUDGEME_REVIEWS_INSTALLED_JS_ID,
|
|
58
|
+
JudgemeReviews.JUDGEME_REVIEWS_INSTALLED_JS_URL
|
|
59
|
+
],
|
|
60
|
+
[
|
|
61
|
+
JudgemeReviews.JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_I_V2,
|
|
62
|
+
JudgemeReviews.JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_URL_V2
|
|
63
|
+
]
|
|
64
|
+
]);
|
|
65
|
+
}
|
|
66
|
+
}, [
|
|
67
|
+
mode
|
|
68
|
+
]);
|
|
53
69
|
React.useEffect(()=>{
|
|
54
70
|
if (publicToken) {
|
|
55
71
|
removeScript(JudgemeReviews.JUDGEME_REVIEWS_PUBLIC_TOKEN_JS_ID);
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
const JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_URL = 'https://cdn.judge.me/widget_preloader.js';
|
|
4
4
|
const JUDGEME_REVIEWS_INSTALLED_JS_URL = 'https://cdn.judge.me/assets/installed.js';
|
|
5
|
+
const JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_URL_V2 = 'https://cdnwidget.judge.me/widget_preloader.js';
|
|
5
6
|
const JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_ID = 'judge_widget_preloader';
|
|
7
|
+
const JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_I_V2 = 'judge_widget_preloader_v2';
|
|
6
8
|
const JUDGEME_REVIEWS_INSTALLED_JS_ID = 'judge_installed';
|
|
7
9
|
const JUDGEME_REVIEWS_PUBLIC_TOKEN_JS_ID = 'judge_public_token';
|
|
8
10
|
|
|
@@ -10,4 +12,6 @@ exports.JUDGEME_REVIEWS_INSTALLED_JS_ID = JUDGEME_REVIEWS_INSTALLED_JS_ID;
|
|
|
10
12
|
exports.JUDGEME_REVIEWS_INSTALLED_JS_URL = JUDGEME_REVIEWS_INSTALLED_JS_URL;
|
|
11
13
|
exports.JUDGEME_REVIEWS_PUBLIC_TOKEN_JS_ID = JUDGEME_REVIEWS_PUBLIC_TOKEN_JS_ID;
|
|
12
14
|
exports.JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_ID = JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_ID;
|
|
15
|
+
exports.JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_I_V2 = JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_I_V2;
|
|
13
16
|
exports.JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_URL = JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_URL;
|
|
17
|
+
exports.JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_URL_V2 = JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_URL_V2;
|
|
@@ -6,9 +6,7 @@ const config = {
|
|
|
6
6
|
icon: '<img class="gp-w-[24px] gp-border gp-border-[#494949] gp-rounded-[3px]" src="https://cdn.shopify.com/app-store/listing_images/b957b53ca225f32cac0ad2cd41f89a1f/icon/CI6dsMjDr4cDEAE=.png">',
|
|
7
7
|
editorConfigs: {
|
|
8
8
|
placeholder: {
|
|
9
|
-
|
|
10
|
-
'Product'
|
|
11
|
-
]
|
|
9
|
+
flowPage: 'GP_PRODUCT'
|
|
12
10
|
},
|
|
13
11
|
component: {
|
|
14
12
|
isThirdParty: true
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { useStoreFront } from '@gem-sdk/core';
|
|
2
|
+
import { useEditorMode, useStoreFront } from '@gem-sdk/core';
|
|
3
3
|
import { useCallback, useEffect } from 'react';
|
|
4
|
-
import { JUDGEME_REVIEWS_PUBLIC_TOKEN_JS_ID, JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_URL,
|
|
4
|
+
import { JUDGEME_REVIEWS_PUBLIC_TOKEN_JS_ID, JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_ID, JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_URL, JUDGEME_REVIEWS_INSTALLED_JS_ID, JUDGEME_REVIEWS_INSTALLED_JS_URL, JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_I_V2, JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_URL_V2 } from '../types/JudgemeReviews.js';
|
|
5
5
|
import JudgemeSingleProduct from './Judgeme/SingleProduct.js';
|
|
6
6
|
import JudgemeWithoutProduct from './Judgeme/WithoutProduct.js';
|
|
7
7
|
|
|
8
8
|
const InstantJudgemeReviews = ({ setting, styles, builderProps })=>{
|
|
9
9
|
const { widgetType, publicToken } = setting ?? {};
|
|
10
|
+
const mode = useEditorMode();
|
|
10
11
|
const { storefrontUrl } = useStoreFront();
|
|
11
12
|
const SHOPIFY_DOMAIN = storefrontUrl?.replace('https://', '')?.replace('http://', '')?.split('/')?.[0];
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return existing;
|
|
16
|
-
} else {
|
|
13
|
+
const addScripts = (scripts)=>{
|
|
14
|
+
scripts.forEach(([id, src])=>{
|
|
15
|
+
if (document.getElementById(id)) return;
|
|
17
16
|
const script = document.createElement('script');
|
|
18
|
-
script
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
Object.assign(script, {
|
|
18
|
+
id,
|
|
19
|
+
src,
|
|
20
|
+
defer: true,
|
|
21
|
+
type: 'text/javascript'
|
|
22
|
+
});
|
|
22
23
|
script.setAttribute('data-cfasync', 'false');
|
|
23
24
|
document.head.appendChild(script);
|
|
24
|
-
|
|
25
|
-
}
|
|
25
|
+
});
|
|
26
26
|
};
|
|
27
27
|
const addTextScript = useCallback((id, public_token)=>{
|
|
28
28
|
if (SHOPIFY_DOMAIN && public_token) {
|
|
@@ -43,9 +43,25 @@ const InstantJudgemeReviews = ({ setting, styles, builderProps })=>{
|
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
useEffect(()=>{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
if (mode !== 'edit') {
|
|
47
|
+
addScripts([
|
|
48
|
+
[
|
|
49
|
+
JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_ID,
|
|
50
|
+
JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_URL
|
|
51
|
+
],
|
|
52
|
+
[
|
|
53
|
+
JUDGEME_REVIEWS_INSTALLED_JS_ID,
|
|
54
|
+
JUDGEME_REVIEWS_INSTALLED_JS_URL
|
|
55
|
+
],
|
|
56
|
+
[
|
|
57
|
+
JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_I_V2,
|
|
58
|
+
JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_URL_V2
|
|
59
|
+
]
|
|
60
|
+
]);
|
|
61
|
+
}
|
|
62
|
+
}, [
|
|
63
|
+
mode
|
|
64
|
+
]);
|
|
49
65
|
useEffect(()=>{
|
|
50
66
|
if (publicToken) {
|
|
51
67
|
removeScript(JUDGEME_REVIEWS_PUBLIC_TOKEN_JS_ID);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
const JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_URL = 'https://cdn.judge.me/widget_preloader.js';
|
|
2
2
|
const JUDGEME_REVIEWS_INSTALLED_JS_URL = 'https://cdn.judge.me/assets/installed.js';
|
|
3
|
+
const JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_URL_V2 = 'https://cdnwidget.judge.me/widget_preloader.js';
|
|
3
4
|
const JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_ID = 'judge_widget_preloader';
|
|
5
|
+
const JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_I_V2 = 'judge_widget_preloader_v2';
|
|
4
6
|
const JUDGEME_REVIEWS_INSTALLED_JS_ID = 'judge_installed';
|
|
5
7
|
const JUDGEME_REVIEWS_PUBLIC_TOKEN_JS_ID = 'judge_public_token';
|
|
6
8
|
|
|
7
|
-
export { JUDGEME_REVIEWS_INSTALLED_JS_ID, JUDGEME_REVIEWS_INSTALLED_JS_URL, JUDGEME_REVIEWS_PUBLIC_TOKEN_JS_ID, JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_ID, JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_URL };
|
|
9
|
+
export { JUDGEME_REVIEWS_INSTALLED_JS_ID, JUDGEME_REVIEWS_INSTALLED_JS_URL, JUDGEME_REVIEWS_PUBLIC_TOKEN_JS_ID, JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_ID, JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_I_V2, JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_URL, JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_URL_V2 };
|