@gem-sdk/components 2.1.13-staging.20 → 2.1.13-staging.22
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/product/components/ProductImagesV2/jsx/components/ProductFeaturedImageCarousel.js +12 -4
- package/dist/cjs/third-party/components/QikifyUpsell.liquid.js +3 -46
- package/dist/cjs/third-party/setting/QikifyUpsell.js +11 -1
- package/dist/esm/product/components/ProductImagesV2/jsx/components/ProductFeaturedImageCarousel.js +13 -5
- package/dist/esm/third-party/components/QikifyUpsell.liquid.js +3 -46
- package/dist/esm/third-party/setting/QikifyUpsell.js +11 -1
- package/dist/types/index.d.ts +2 -0
- package/package.json +1 -1
package/dist/cjs/product/components/ProductImagesV2/jsx/components/ProductFeaturedImageCarousel.js
CHANGED
|
@@ -20,12 +20,20 @@ const ProductFeaturedImageCarousel = ({ productImages, imgRef, onHandleClick, on
|
|
|
20
20
|
const { onListener, ref } = core.useInteraction();
|
|
21
21
|
let delayTimeout;
|
|
22
22
|
const mode = core.useEditorMode();
|
|
23
|
-
const
|
|
23
|
+
const getImageActiveIndex = React.useCallback(()=>{
|
|
24
24
|
const index = productImages?.findIndex((item)=>item.id === featuredImageGlobal?.id);
|
|
25
|
-
return index;
|
|
25
|
+
return index ?? 0;
|
|
26
26
|
}, [
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
featuredImageGlobal?.id,
|
|
28
|
+
productImages
|
|
29
|
+
]);
|
|
30
|
+
const [imageActiveIndex, setImageActiveIndex] = React.useState(getImageActiveIndex());
|
|
31
|
+
React.useEffect(()=>{
|
|
32
|
+
setImageActiveIndex(getImageActiveIndex());
|
|
33
|
+
}, [
|
|
34
|
+
featuredImageGlobal,
|
|
35
|
+
getImageActiveIndex,
|
|
36
|
+
productImages
|
|
29
37
|
]);
|
|
30
38
|
const imageActive = React.useMemo(()=>{
|
|
31
39
|
if (productImages?.length) return featuredImageGlobal || productImages?.[0];
|
|
@@ -2,54 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var thirdParty = require('../helpers/thirdParty.js');
|
|
6
6
|
|
|
7
7
|
const QikifyUpsell = ({ setting, advanced })=>{
|
|
8
|
-
const { align,
|
|
9
|
-
|
|
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: '
|
|
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',
|
package/dist/esm/product/components/ProductImagesV2/jsx/components/ProductFeaturedImageCarousel.js
CHANGED
|
@@ -6,7 +6,7 @@ import { getAspectRatio } from '../../common/common.js';
|
|
|
6
6
|
import { checkRenderFeaturedCarousel, getDotSettingByLayout } from '../../common/productFeaturedImage.js';
|
|
7
7
|
import { handleMouseMove, handleMouseOut } from '../../common/hoverAction.js';
|
|
8
8
|
import ProductFeaturedImageOnly from './ProductFeaturedImageOnly.js';
|
|
9
|
-
import { memo,
|
|
9
|
+
import { memo, useCallback, useState, useEffect, useMemo, createRef } from 'react';
|
|
10
10
|
import { handleSetSrcForFeatureProductImage } from '../../../../../image/helpers/getSrcSet.js';
|
|
11
11
|
|
|
12
12
|
const ProductFeaturedImageCarousel = ({ productImages, imgRef, onHandleClick, onClickArrow, onHandleLoaded, onHandleUpdateActiveIndex, builderPropUID, builderPropsClass, children, parentUid, ...setting })=>{
|
|
@@ -16,12 +16,20 @@ const ProductFeaturedImageCarousel = ({ productImages, imgRef, onHandleClick, on
|
|
|
16
16
|
const { onListener, ref } = useInteraction();
|
|
17
17
|
let delayTimeout;
|
|
18
18
|
const mode = useEditorMode();
|
|
19
|
-
const
|
|
19
|
+
const getImageActiveIndex = useCallback(()=>{
|
|
20
20
|
const index = productImages?.findIndex((item)=>item.id === featuredImageGlobal?.id);
|
|
21
|
-
return index;
|
|
21
|
+
return index ?? 0;
|
|
22
22
|
}, [
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
featuredImageGlobal?.id,
|
|
24
|
+
productImages
|
|
25
|
+
]);
|
|
26
|
+
const [imageActiveIndex, setImageActiveIndex] = useState(getImageActiveIndex());
|
|
27
|
+
useEffect(()=>{
|
|
28
|
+
setImageActiveIndex(getImageActiveIndex());
|
|
29
|
+
}, [
|
|
30
|
+
featuredImageGlobal,
|
|
31
|
+
getImageActiveIndex,
|
|
32
|
+
productImages
|
|
25
33
|
]);
|
|
26
34
|
const imageActive = useMemo(()=>{
|
|
27
35
|
if (productImages?.length) return featuredImageGlobal || productImages?.[0];
|
|
@@ -1,51 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getLiquidForAppBlock } from '../helpers/thirdParty.js';
|
|
2
2
|
|
|
3
3
|
const QikifyUpsell = ({ setting, advanced })=>{
|
|
4
|
-
const { align,
|
|
5
|
-
|
|
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: '
|
|
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',
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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
|
|