@gem-sdk/components 2.1.13-staging.20 → 2.1.13-staging.21

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.
@@ -2,54 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var core = require('@gem-sdk/core');
5
+ var thirdParty = require('../helpers/thirdParty.js');
6
6
 
7
7
  const QikifyUpsell = ({ setting, advanced })=>{
8
- const { align, widgetType } = setting ?? {};
9
- const prefix = ()=>{
10
- switch(widgetType){
11
- // case 'bogo':
12
- // return 'qbk-bogo-offer';
13
- case 'bundle':
14
- return 'qbk-bundle-offer';
15
- case 'volume':
16
- return 'qbk-volume-offer';
17
- case 'upsurge':
18
- return 'qbk-upsurge-offer';
19
- // case 'free-gift':
20
- // return 'qbk-free-gift-offer';
21
- default:
22
- return '';
23
- }
24
- };
25
- return core.template`
26
- <div
27
- class="${advanced?.cssClass}"
28
- style="${{
29
- ...core.makeStyleResponsive('ta', align)
30
- }}"
31
- >
32
- {% assign productData = product %}
33
- {% if productData %}
34
- {% liquid
35
- assign triggerId = productData.selected_or_first_available_variant.id
36
- assign handle = productData.handle
37
- assign productId = productData.id
38
- assign blockId = block.id
39
- %}
40
- <div id="${prefix()}-{{ productId }}"></div>
41
- <qbk-inject-offer
42
- mount-id="${prefix()}-{{ productId }}"
43
- handle="{{ handle }}"
44
- section-id="{{ section.id }}"
45
- trigger-id="{{ triggerId }}"
46
- product-id="{{ productId }}"
47
- type="${widgetType}"
48
- >
49
- </qbk-inject-offer>
50
- {% endif %}
51
- </div>
52
- `;
8
+ const { align, appBlockId } = setting ?? {};
9
+ return thirdParty.getLiquidForAppBlock(appBlockId, align, `${advanced?.cssClass ?? ''} !gp-block`);
53
10
  };
54
11
 
55
12
  exports.default = QikifyUpsell;
@@ -44,6 +44,11 @@ const config = {
44
44
  {
45
45
  id: 'setting',
46
46
  controls: [
47
+ {
48
+ id: 'appBlockId',
49
+ type: 'input',
50
+ default: ''
51
+ },
47
52
  {
48
53
  id: 'install',
49
54
  type: 'open-link',
@@ -64,9 +69,14 @@ const config = {
64
69
  id: 'widgetType',
65
70
  label: 'Choose widget',
66
71
  type: 'select',
67
- default: 'bogo',
72
+ default: 'bogo_offer',
68
73
  options: QikifyUpsell.WidgetOptions
69
74
  },
75
+ {
76
+ id: 'productHandle',
77
+ type: 'product-handle',
78
+ hide: true
79
+ },
70
80
  {
71
81
  id: 'align',
72
82
  label: 'Alignment',
@@ -1,51 +1,8 @@
1
- import { template, makeStyleResponsive } from '@gem-sdk/core';
1
+ import { getLiquidForAppBlock } from '../helpers/thirdParty.js';
2
2
 
3
3
  const QikifyUpsell = ({ setting, advanced })=>{
4
- const { align, widgetType } = setting ?? {};
5
- const prefix = ()=>{
6
- switch(widgetType){
7
- // case 'bogo':
8
- // return 'qbk-bogo-offer';
9
- case 'bundle':
10
- return 'qbk-bundle-offer';
11
- case 'volume':
12
- return 'qbk-volume-offer';
13
- case 'upsurge':
14
- return 'qbk-upsurge-offer';
15
- // case 'free-gift':
16
- // return 'qbk-free-gift-offer';
17
- default:
18
- return '';
19
- }
20
- };
21
- return template`
22
- <div
23
- class="${advanced?.cssClass}"
24
- style="${{
25
- ...makeStyleResponsive('ta', align)
26
- }}"
27
- >
28
- {% assign productData = product %}
29
- {% if productData %}
30
- {% liquid
31
- assign triggerId = productData.selected_or_first_available_variant.id
32
- assign handle = productData.handle
33
- assign productId = productData.id
34
- assign blockId = block.id
35
- %}
36
- <div id="${prefix()}-{{ productId }}"></div>
37
- <qbk-inject-offer
38
- mount-id="${prefix()}-{{ productId }}"
39
- handle="{{ handle }}"
40
- section-id="{{ section.id }}"
41
- trigger-id="{{ triggerId }}"
42
- product-id="{{ productId }}"
43
- type="${widgetType}"
44
- >
45
- </qbk-inject-offer>
46
- {% endif %}
47
- </div>
48
- `;
4
+ const { align, appBlockId } = setting ?? {};
5
+ return getLiquidForAppBlock(appBlockId, align, `${advanced?.cssClass ?? ''} !gp-block`);
49
6
  };
50
7
 
51
8
  export { QikifyUpsell as default };
@@ -40,6 +40,11 @@ const config = {
40
40
  {
41
41
  id: 'setting',
42
42
  controls: [
43
+ {
44
+ id: 'appBlockId',
45
+ type: 'input',
46
+ default: ''
47
+ },
43
48
  {
44
49
  id: 'install',
45
50
  type: 'open-link',
@@ -60,9 +65,14 @@ const config = {
60
65
  id: 'widgetType',
61
66
  label: 'Choose widget',
62
67
  type: 'select',
63
- default: 'bogo',
68
+ default: 'bogo_offer',
64
69
  options: WidgetOptions
65
70
  },
71
+ {
72
+ id: 'productHandle',
73
+ type: 'product-handle',
74
+ hide: true
75
+ },
66
76
  {
67
77
  id: 'align',
68
78
  label: 'Alignment',
@@ -2848,6 +2848,8 @@ type QikifyUpsellProps = BaseProps<{
2848
2848
  align?: ObjectDevices<AlignProp>;
2849
2849
  openApp?: any;
2850
2850
  install?: any;
2851
+ appBlockId?: string;
2852
+ productHandle?: string;
2851
2853
  }>;
2852
2854
  declare const QikifyUpsell$1: React.FC<QikifyUpsellProps>;
2853
2855
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.1.13-staging.20",
3
+ "version": "2.1.13-staging.21",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",