@gem-sdk/components 2.6.0-staging.26 → 2.6.0-staging.28

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.
@@ -13,7 +13,9 @@ const mapWidgetLabel = {
13
13
  slider: 'Gift slider',
14
14
  message: 'Cart message',
15
15
  ['classic-bundle']: 'Classic bundle',
16
- ['quantity-break']: 'Quantity break'
16
+ ['quantity-break']: 'Quantity break',
17
+ 'mix-match': 'Mix and match',
18
+ fbt: 'Frequently Bought Together'
17
19
  };
18
20
  const BogosSampleContent = ({ setting })=>{
19
21
  const widgetLabel = setting?.widgetType && mapWidgetLabel[setting.widgetType];
@@ -29,6 +29,8 @@ const Bogos = ({ setting, advanced })=>{
29
29
  <div class="bogos-integration-page-builder-quantity-break"></div>
30
30
  {% when "mix-match" %}
31
31
  <div class="bogos-integration-page-builder-mix-match"></div>
32
+ {% when "fbt" %}
33
+ <div class="bogos-integration-page-builder-fbt-upsell"></div>
32
34
  {% endcase %}
33
35
  </div>
34
36
  `;
@@ -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
- flowTag: [
14
- 'Product'
15
- ]
13
+ flowPage: 'GP_PRODUCT'
16
14
  },
17
15
  component: {
18
16
  isThirdParty: true
@@ -88,6 +88,10 @@ const config = {
88
88
  {
89
89
  label: 'Mix and match',
90
90
  value: 'mix-match'
91
+ },
92
+ {
93
+ label: 'Frequently Bought Together',
94
+ value: 'fbt'
91
95
  }
92
96
  ]
93
97
  },
@@ -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 addScript = (id, src)=>{
17
- const existing = document.getElementById(id);
18
- if (existing) {
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.id = id;
23
- script.src = src;
24
- script.defer = true;
25
- script.type = 'text/javascript';
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
- return script;
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
- addScript(JudgemeReviews.JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_ID, JudgemeReviews.JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_URL);
51
- addScript(JudgemeReviews.JUDGEME_REVIEWS_INSTALLED_JS_ID, JudgemeReviews.JUDGEME_REVIEWS_INSTALLED_JS_URL);
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;
@@ -9,7 +9,9 @@ const mapWidgetLabel = {
9
9
  slider: 'Gift slider',
10
10
  message: 'Cart message',
11
11
  ['classic-bundle']: 'Classic bundle',
12
- ['quantity-break']: 'Quantity break'
12
+ ['quantity-break']: 'Quantity break',
13
+ 'mix-match': 'Mix and match',
14
+ fbt: 'Frequently Bought Together'
13
15
  };
14
16
  const BogosSampleContent = ({ setting })=>{
15
17
  const widgetLabel = setting?.widgetType && mapWidgetLabel[setting.widgetType];
@@ -25,6 +25,8 @@ const Bogos = ({ setting, advanced })=>{
25
25
  <div class="bogos-integration-page-builder-quantity-break"></div>
26
26
  {% when "mix-match" %}
27
27
  <div class="bogos-integration-page-builder-mix-match"></div>
28
+ {% when "fbt" %}
29
+ <div class="bogos-integration-page-builder-fbt-upsell"></div>
28
30
  {% endcase %}
29
31
  </div>
30
32
  `;
@@ -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
- flowTag: [
10
- 'Product'
11
- ]
9
+ flowPage: 'GP_PRODUCT'
12
10
  },
13
11
  component: {
14
12
  isThirdParty: true
@@ -84,6 +84,10 @@ const config = {
84
84
  {
85
85
  label: 'Mix and match',
86
86
  value: 'mix-match'
87
+ },
88
+ {
89
+ label: 'Frequently Bought Together',
90
+ value: 'fbt'
87
91
  }
88
92
  ]
89
93
  },
@@ -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, JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_ID, JUDGEME_REVIEWS_INSTALLED_JS_URL, JUDGEME_REVIEWS_INSTALLED_JS_ID } from '../types/JudgemeReviews.js';
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 addScript = (id, src)=>{
13
- const existing = document.getElementById(id);
14
- if (existing) {
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.id = id;
19
- script.src = src;
20
- script.defer = true;
21
- script.type = 'text/javascript';
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
- return script;
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
- addScript(JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_ID, JUDGEME_REVIEWS_WIDGET_PRELOADER_JS_URL);
47
- addScript(JUDGEME_REVIEWS_INSTALLED_JS_ID, JUDGEME_REVIEWS_INSTALLED_JS_URL);
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.6.0-staging.26",
3
+ "version": "2.6.0-staging.28",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",