@gem-sdk/components 2.4.9 → 2.4.11

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.
@@ -30,6 +30,7 @@ const PostPurchaseProductVariants = ({ builderProps, style, styles, setting })=>
30
30
  const { selectedOptions, setSelectedOption, forceSelectedOption } = core.useSelectedOption();
31
31
  const variantsWidth = core.makeStyleResponsive('w', core.makeWidth(width, fullWidth));
32
32
  const [variantId, setVariantId] = React.useState('');
33
+ const mode = core.useEditorMode();
33
34
  React.useEffect(()=>{
34
35
  const url = new URL(window.location.href);
35
36
  const variantParam = url.searchParams.get(VARIANT_PARAM_PATH);
@@ -231,10 +232,10 @@ const PostPurchaseProductVariants = ({ builderProps, style, styles, setting })=>
231
232
  })
232
233
  ]
233
234
  }) : /*#__PURE__*/ jsxRuntime.jsx("div", {
234
- children: /*#__PURE__*/ jsxRuntime.jsx("p", {
235
+ children: mode === 'edit' ? /*#__PURE__*/ jsxRuntime.jsx("p", {
235
236
  className: "gp-p-2 gp-text-center gp-text-sm gp-font-semibold gp-text-gray-500",
236
237
  children: "This product has only default variant"
237
- })
238
+ }) : null
238
239
  })
239
240
  });
240
241
  };
@@ -2,11 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var thirdParty = require('../helpers/thirdParty.js');
5
6
  var core = require('@gem-sdk/core');
6
7
 
7
8
  const Releasit = ({ setting, advanced })=>{
8
- const { align } = setting ?? {};
9
- return core.template`
9
+ const { align, version, appBlockId } = setting ?? {};
10
+ return version === 'v2' ? thirdParty.getLiquidForAppBlock(appBlockId, align, `${advanced?.cssClass ?? ''}!gp-block`) : core.template`
10
11
  <div
11
12
  class="${advanced?.cssClass}"
12
13
  style="${{
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var BoldProductOptionsConfig = {
6
6
  id: 'bold-product-options',
7
- label: 'Bold Product Options',
8
- logoUrl: 'https://ucarecdn.com/cae13b55-18b6-416a-a447-c18211d78cfe/-/format/auto/-/preview/3000x3000/-/quality/lighter/Bold%20Product%20Options.png',
7
+ label: 'SC Product Options',
8
+ logoUrl: 'https://cdn.shopify.com/app-store/listing_images/9a0bf1159f79c6ab0660ec422f350445/icon/CP2Uwo_GuYIDEAE=.png',
9
9
  tag: 'BoldProductOptions'
10
10
  };
11
11
 
@@ -11,6 +11,11 @@ const config = {
11
11
  editorConfigs: {
12
12
  component: {
13
13
  isThirdParty: true
14
+ },
15
+ placeholder: {
16
+ flowTag: [
17
+ 'Product'
18
+ ]
14
19
  }
15
20
  },
16
21
  presets: [
@@ -39,6 +44,16 @@ const config = {
39
44
  {
40
45
  id: 'setting',
41
46
  controls: [
47
+ {
48
+ id: 'appBlockId',
49
+ type: 'input',
50
+ default: ''
51
+ },
52
+ {
53
+ id: 'productHandle',
54
+ type: 'input',
55
+ default: ''
56
+ },
42
57
  {
43
58
  id: 'install',
44
59
  type: 'open-link',
@@ -55,6 +70,38 @@ const config = {
55
70
  href: 'https://admin.shopify.com/?redirect=/apps/releasit-cod-order-form',
56
71
  appName: Releasit.default.label
57
72
  },
73
+ {
74
+ id: 'version',
75
+ label: 'Choose version',
76
+ type: 'select',
77
+ default: 'v1',
78
+ options: [
79
+ {
80
+ label: 'V1',
81
+ value: 'v1'
82
+ },
83
+ {
84
+ label: 'V2',
85
+ value: 'v2'
86
+ }
87
+ ]
88
+ },
89
+ {
90
+ id: 'widgetTypeV2',
91
+ label: 'Choose widget',
92
+ type: 'select',
93
+ default: 'button-app-block',
94
+ options: [
95
+ {
96
+ label: 'Releasit button',
97
+ value: 'button-app-block'
98
+ },
99
+ {
100
+ label: 'Releasit embedded form',
101
+ value: 'form-app-block'
102
+ }
103
+ ]
104
+ },
58
105
  {
59
106
  id: 'align',
60
107
  label: 'Alignment',
@@ -95,12 +142,22 @@ const config = {
95
142
  {
96
143
  type: 'control',
97
144
  label: {
98
- en: 'Choose widget'
145
+ en: 'Choose version'
99
146
  },
100
147
  setting: {
101
- id: 'widgetType'
148
+ id: 'version'
102
149
  }
103
150
  },
151
+ {
152
+ type: 'control',
153
+ label: {
154
+ en: 'Choose widget'
155
+ },
156
+ setting: {
157
+ id: 'widgetTypeV2'
158
+ },
159
+ condition: 'version === "v2"'
160
+ },
104
161
  {
105
162
  type: 'control',
106
163
  setting: {
@@ -36,7 +36,7 @@ const HTML5Embed = (props)=>{
36
36
  style: props.style,
37
37
  controls: props.controls,
38
38
  loop: props.loop,
39
- muted: props.autoplay ? true : props.muted,
39
+ muted: props.muted ? true : undefined,
40
40
  autoPlay: props.autoplay,
41
41
  title: props.title,
42
42
  preload: props.autoplay ? 'metadata' : 'none',
@@ -57,7 +57,7 @@ const HTML5Embed = (props)=>{
57
57
  style="${props.style}"
58
58
  ${props.controls ? 'controls' : undefined}
59
59
  ${props.loop ? 'loop' : undefined}
60
- ${props.autoplay ? 'muted' : undefined}
60
+ ${props.muted ? 'muted' : undefined}
61
61
  ${props.autoplay && !preloadThumbnail ? 'autoplay' : undefined}
62
62
  title="${props.title}"
63
63
  preload="${props.autoplay && !preloadThumbnail || offLazyVideo ? 'metadata' : 'none'}"
@@ -1,5 +1,5 @@
1
1
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
- import { useVariants, useProduct, useIsSyncProduct, useSelectedOption, makeStyleResponsive, makeWidth, useInitialSwatchesOptions, useSwatchesOptions, optionLayoutStyle, cls, OptionSpecialStyle, getSelectedVariant } from '@gem-sdk/core';
2
+ import { useVariants, useProduct, useIsSyncProduct, useSelectedOption, makeStyleResponsive, makeWidth, useEditorMode, useInitialSwatchesOptions, useSwatchesOptions, optionLayoutStyle, cls, OptionSpecialStyle, getSelectedVariant } from '@gem-sdk/core';
3
3
  import { useState, useEffect, useMemo, useCallback } from 'react';
4
4
  import { checkDefaultVariant } from '../../../product/helpers/product.js';
5
5
  import { useTransition } from '../../../product/components/ProductVariants/common.js';
@@ -26,6 +26,7 @@ const PostPurchaseProductVariants = ({ builderProps, style, styles, setting })=>
26
26
  const { selectedOptions, setSelectedOption, forceSelectedOption } = useSelectedOption();
27
27
  const variantsWidth = makeStyleResponsive('w', makeWidth(width, fullWidth));
28
28
  const [variantId, setVariantId] = useState('');
29
+ const mode = useEditorMode();
29
30
  useEffect(()=>{
30
31
  const url = new URL(window.location.href);
31
32
  const variantParam = url.searchParams.get(VARIANT_PARAM_PATH);
@@ -227,10 +228,10 @@ const PostPurchaseProductVariants = ({ builderProps, style, styles, setting })=>
227
228
  })
228
229
  ]
229
230
  }) : /*#__PURE__*/ jsx("div", {
230
- children: /*#__PURE__*/ jsx("p", {
231
+ children: mode === 'edit' ? /*#__PURE__*/ jsx("p", {
231
232
  className: "gp-p-2 gp-text-center gp-text-sm gp-font-semibold gp-text-gray-500",
232
233
  children: "This product has only default variant"
233
- })
234
+ }) : null
234
235
  })
235
236
  });
236
237
  };
@@ -1,8 +1,9 @@
1
+ import { getLiquidForAppBlock } from '../helpers/thirdParty.js';
1
2
  import { template, makeStyleResponsive } from '@gem-sdk/core';
2
3
 
3
4
  const Releasit = ({ setting, advanced })=>{
4
- const { align } = setting ?? {};
5
- return template`
5
+ const { align, version, appBlockId } = setting ?? {};
6
+ return version === 'v2' ? getLiquidForAppBlock(appBlockId, align, `${advanced?.cssClass ?? ''}!gp-block`) : template`
6
7
  <div
7
8
  class="${advanced?.cssClass}"
8
9
  style="${{
@@ -1,7 +1,7 @@
1
1
  var BoldProductOptionsConfig = {
2
2
  id: 'bold-product-options',
3
- label: 'Bold Product Options',
4
- logoUrl: 'https://ucarecdn.com/cae13b55-18b6-416a-a447-c18211d78cfe/-/format/auto/-/preview/3000x3000/-/quality/lighter/Bold%20Product%20Options.png',
3
+ label: 'SC Product Options',
4
+ logoUrl: 'https://cdn.shopify.com/app-store/listing_images/9a0bf1159f79c6ab0660ec422f350445/icon/CP2Uwo_GuYIDEAE=.png',
5
5
  tag: 'BoldProductOptions'
6
6
  };
7
7
 
@@ -7,6 +7,11 @@ const config = {
7
7
  editorConfigs: {
8
8
  component: {
9
9
  isThirdParty: true
10
+ },
11
+ placeholder: {
12
+ flowTag: [
13
+ 'Product'
14
+ ]
10
15
  }
11
16
  },
12
17
  presets: [
@@ -35,6 +40,16 @@ const config = {
35
40
  {
36
41
  id: 'setting',
37
42
  controls: [
43
+ {
44
+ id: 'appBlockId',
45
+ type: 'input',
46
+ default: ''
47
+ },
48
+ {
49
+ id: 'productHandle',
50
+ type: 'input',
51
+ default: ''
52
+ },
38
53
  {
39
54
  id: 'install',
40
55
  type: 'open-link',
@@ -51,6 +66,38 @@ const config = {
51
66
  href: 'https://admin.shopify.com/?redirect=/apps/releasit-cod-order-form',
52
67
  appName: ReleasitConfig.label
53
68
  },
69
+ {
70
+ id: 'version',
71
+ label: 'Choose version',
72
+ type: 'select',
73
+ default: 'v1',
74
+ options: [
75
+ {
76
+ label: 'V1',
77
+ value: 'v1'
78
+ },
79
+ {
80
+ label: 'V2',
81
+ value: 'v2'
82
+ }
83
+ ]
84
+ },
85
+ {
86
+ id: 'widgetTypeV2',
87
+ label: 'Choose widget',
88
+ type: 'select',
89
+ default: 'button-app-block',
90
+ options: [
91
+ {
92
+ label: 'Releasit button',
93
+ value: 'button-app-block'
94
+ },
95
+ {
96
+ label: 'Releasit embedded form',
97
+ value: 'form-app-block'
98
+ }
99
+ ]
100
+ },
54
101
  {
55
102
  id: 'align',
56
103
  label: 'Alignment',
@@ -91,12 +138,22 @@ const config = {
91
138
  {
92
139
  type: 'control',
93
140
  label: {
94
- en: 'Choose widget'
141
+ en: 'Choose version'
95
142
  },
96
143
  setting: {
97
- id: 'widgetType'
144
+ id: 'version'
98
145
  }
99
146
  },
147
+ {
148
+ type: 'control',
149
+ label: {
150
+ en: 'Choose widget'
151
+ },
152
+ setting: {
153
+ id: 'widgetTypeV2'
154
+ },
155
+ condition: 'version === "v2"'
156
+ },
100
157
  {
101
158
  type: 'control',
102
159
  setting: {
@@ -32,7 +32,7 @@ const HTML5Embed = (props)=>{
32
32
  style: props.style,
33
33
  controls: props.controls,
34
34
  loop: props.loop,
35
- muted: props.autoplay ? true : props.muted,
35
+ muted: props.muted ? true : undefined,
36
36
  autoPlay: props.autoplay,
37
37
  title: props.title,
38
38
  preload: props.autoplay ? 'metadata' : 'none',
@@ -53,7 +53,7 @@ const HTML5Embed = (props)=>{
53
53
  style="${props.style}"
54
54
  ${props.controls ? 'controls' : undefined}
55
55
  ${props.loop ? 'loop' : undefined}
56
- ${props.autoplay ? 'muted' : undefined}
56
+ ${props.muted ? 'muted' : undefined}
57
57
  ${props.autoplay && !preloadThumbnail ? 'autoplay' : undefined}
58
58
  title="${props.title}"
59
59
  preload="${props.autoplay && !preloadThumbnail || offLazyVideo ? 'metadata' : 'none'}"
@@ -2875,6 +2875,10 @@ type ReleasitProps = BaseProps<{
2875
2875
  align?: ObjectDevices<AlignProp>;
2876
2876
  openApp?: any;
2877
2877
  install?: any;
2878
+ version?: 'v1' | 'v2';
2879
+ widgetTypeV2?: string;
2880
+ appBlockId?: string;
2881
+ productHandle?: string;
2878
2882
  }>;
2879
2883
  declare const Releasit$1: React.FC<ReleasitProps>;
2880
2884
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.4.9",
3
+ "version": "2.4.11",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -21,7 +21,7 @@
21
21
  "format": "prettier --write \"./src/**/*.{ts,tsx}\""
22
22
  },
23
23
  "devDependencies": {
24
- "@gem-sdk/core": "2.4.7",
24
+ "@gem-sdk/core": "2.4.11",
25
25
  "@gem-sdk/styles": "2.4.8",
26
26
  "@types/react-transition-group": "^4.4.5"
27
27
  },