@gem-sdk/components 2.0.0-dev.869 → 2.0.0-dev.870
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.
|
@@ -116,7 +116,7 @@ ${core.RenderIf(core.isLocalEnv,'<script src="{{ \'gp-product.v2.js\' | asset_ur
|
|
|
116
116
|
if hasRelatedExclude
|
|
117
117
|
assign relatedExclude = '${u}'
|
|
118
118
|
endif
|
|
119
|
-
assign arrayRelatedExclude = relatedExclude |
|
|
119
|
+
assign arrayRelatedExclude = relatedExclude | split: ","
|
|
120
120
|
for collection in collections
|
|
121
121
|
assign collectionId = collection.id
|
|
122
122
|
assign isInCollection = false
|
|
@@ -184,15 +184,23 @@ ${core.RenderIf(core.isLocalEnv,'<script src="{{ \'gp-product.v2.js\' | asset_ur
|
|
|
184
184
|
if hasRelatedExclude
|
|
185
185
|
assign relatedExclude = '${u}'
|
|
186
186
|
endif
|
|
187
|
-
assign arrayRelatedExclude = relatedExclude |
|
|
187
|
+
assign arrayRelatedExclude = relatedExclude | split: ","
|
|
188
188
|
for item in allProducts
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
189
|
+
assign handle = item.handle
|
|
190
|
+
assign productF = all_products[handle] | sort
|
|
191
|
+
assign tagsOfProduct = all_products[handle].tags
|
|
192
|
+
assign isExcludedProduct = false
|
|
193
|
+
assign idOfProduct = all_products[handle].id
|
|
194
|
+
|
|
195
|
+
for tagExclude in arrayRelatedExclude
|
|
196
|
+
if tagsOfProduct contains tagExclude
|
|
197
|
+
assign isExcludedProduct = true
|
|
198
|
+
endif
|
|
199
|
+
endfor
|
|
200
|
+
unless isExcludedProduct
|
|
193
201
|
for tag in tagsAssignProduct
|
|
194
202
|
assign tagItem = tag
|
|
195
|
-
unless arrayListProducts contains handle
|
|
203
|
+
unless arrayListProducts contains handle
|
|
196
204
|
if tagsOfProduct contains tagItem and idAssignProduct != idOfProduct
|
|
197
205
|
assign products = products | concat: productF
|
|
198
206
|
if stringListProducts.size > 0
|
|
@@ -203,6 +211,7 @@ ${core.RenderIf(core.isLocalEnv,'<script src="{{ \'gp-product.v2.js\' | asset_ur
|
|
|
203
211
|
endif
|
|
204
212
|
endunless
|
|
205
213
|
endfor
|
|
214
|
+
endunless
|
|
206
215
|
endfor
|
|
207
216
|
endif
|
|
208
217
|
paginate products by ${P||4}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{getSizeSetting as t}from"../helpers/product.js";import{template as o,RenderIf as s,isLocalEnv as e,baseAssetURL as d,makeStyleResponsive as i,makeWidth as r,getResponsiveValueByScreen as n,cls as a}from"@gem-sdk/core";import c from"../../carousel/components/CarouselItem.liquid.js";import l from"../../carousel/components/Carousel.liquid.js";import{getInitialWidthForCarouselItem as u}from"../../carousel/components/common/carousel.js";import{getUpdatedArrowDisplay as p}from"../../carousel/components/common/arrow.js";import{getUpdatedDotStyle as g}from"../../carousel/components/common/dots.js";import{getStaticLocale as f}from"../../helpers.js";import{convertUnitToNumber as m}from"./ProductImages/common/productFeaturedImage.js";let ProductList=({setting:P,builderProps:h,styles:_,className:v,children:y,advanced:$,pageContext:S})=>{let
|
|
1
|
+
import{getSizeSetting as t}from"../helpers/product.js";import{template as o,RenderIf as s,isLocalEnv as e,baseAssetURL as d,makeStyleResponsive as i,makeWidth as r,getResponsiveValueByScreen as n,cls as a}from"@gem-sdk/core";import c from"../../carousel/components/CarouselItem.liquid.js";import l from"../../carousel/components/Carousel.liquid.js";import{getInitialWidthForCarouselItem as u}from"../../carousel/components/common/carousel.js";import{getUpdatedArrowDisplay as p}from"../../carousel/components/common/arrow.js";import{getUpdatedDotStyle as g}from"../../carousel/components/common/dots.js";import{getStaticLocale as f}from"../../helpers.js";import{convertUnitToNumber as m}from"./ProductImages/common/productFeaturedImage.js";let ProductList=({setting:P,builderProps:h,styles:_,className:v,children:y,advanced:$,pageContext:S})=>{let x="gid://shopify/Collection/",L=P?.productSetting,C=L?.relatedTag,E=L?.hasRelatedExclude,b=L?.relatedExclude,w=L?.productSrc??"Collection",O=L?.collectionId?.includes(x)?L?.collectionId?.replace(x,""):"latest",T=L?.productSrc==="PickProduct"&&L?.productIds?.length===0,I=_?.layout==="grid",k=m(P?.numberOfProducts,4),A="PickProduct"===w&&L?.productIds?.length?L?.productIds.map(t=>t.replace("gid://shopify/Product/","")):[],j="PickProduct"===w&&L?.productHandles?.length?L?.productHandles:[],R=p(P?.arrow,P?.controlOverContent),q=g(P?.dot),F=t=>o`
|
|
2
2
|
<div style="${{...i("w",r(_?.width,_?.fullWidth)),...i("rg",_?.horizontalGutter),...i("cg",_?.verticalGutter),...i("gtc",{desktop:`repeat(${n(P?.slidesToShow,"desktop")}, minmax(0, 1fr))`,tablet:P?.slidesToShow?.tablet&&`repeat(${n(P?.slidesToShow,"tablet")}, minmax(0, 1fr))`,mobile:P?.slidesToShow?.mobile&&`repeat(${n(P?.slidesToShow,"mobile")}, minmax(0, 1fr))`})}}"
|
|
3
3
|
class="${a(v,"gp-grid !gp-m-auto gp-w-full",$?.cssClass)}"
|
|
4
4
|
>
|
|
@@ -27,7 +27,7 @@ import{getSizeSetting as t}from"../helpers/product.js";import{template as o,Rend
|
|
|
27
27
|
</gp-product>
|
|
28
28
|
{% endfor %}
|
|
29
29
|
{%- if count == 0 and ${A.length} == 0 -%}
|
|
30
|
-
{% if '${
|
|
30
|
+
{% if '${w}' == 'RelatedProduct' -%}
|
|
31
31
|
<div>${f("ProductList","no_related_products")}</div>
|
|
32
32
|
{% else %}
|
|
33
33
|
<div>${f("ProductList","no_products_found")}</div>
|
|
@@ -52,7 +52,7 @@ import{getSizeSetting as t}from"../helpers/product.js";import{template as o,Rend
|
|
|
52
52
|
{%- endfor -%}
|
|
53
53
|
{%- if count == 0 and ${A.length} == 0 -%}
|
|
54
54
|
{%- if count == 0 and ${A.length} == 0 -%}
|
|
55
|
-
{% if '${
|
|
55
|
+
{% if '${w}' == 'RelatedProduct' -%}
|
|
56
56
|
<div>${f("ProductList","no_related_products")}</div>
|
|
57
57
|
{% else %}
|
|
58
58
|
<div>${f("ProductList","no_products_found")}</div>
|
|
@@ -63,15 +63,15 @@ import{getSizeSetting as t}from"../helpers/product.js";import{template as o,Rend
|
|
|
63
63
|
`,B=()=>o`
|
|
64
64
|
{%- if products == null -%}
|
|
65
65
|
{%- if count == 0 and ${A.length} == 0 -%}
|
|
66
|
-
{% if '${
|
|
66
|
+
{% if '${w}' == 'RelatedProduct' -%}
|
|
67
67
|
<div>${f("ProductList","no_related_products")}</div>
|
|
68
68
|
{% else %}
|
|
69
69
|
<div>${f("ProductList","no_products_found")}</div>
|
|
70
70
|
{%- endif -%}
|
|
71
71
|
{%- endif -%}
|
|
72
72
|
{%-else-%}
|
|
73
|
-
${s(
|
|
74
|
-
${s(!
|
|
73
|
+
${s(I,G())}
|
|
74
|
+
${s(!I,z())}
|
|
75
75
|
{%- endif -%}
|
|
76
76
|
`;return S?.pageType==="GP_FUNNEL_PAGE"?"":o`
|
|
77
77
|
${s(e,'<script src="{{ \'gp-product.v2.js\' | asset_url }}" defer="defer"></script>',`<script src="${d}/assets-v2/gp-product.v2.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
@@ -82,9 +82,9 @@ ${s(e,'<script src="{{ \'gp-product.v2.js\' | asset_url }}" defer="defer"></scri
|
|
|
82
82
|
assign products = null
|
|
83
83
|
assign stringListProducts = ''
|
|
84
84
|
assign target_collection = null
|
|
85
|
-
assign productSrc = '${
|
|
85
|
+
assign productSrc = '${w}'
|
|
86
86
|
assign c = 0
|
|
87
|
-
assign limit = ${
|
|
87
|
+
assign limit = ${I&&"latest"===O?"RelatedProduct"===w?k:L?.numOfSelectedProducts||4:k}
|
|
88
88
|
if request.page_type == 'collection' or preview_page_type == 'collection'
|
|
89
89
|
assign target_collection = collection
|
|
90
90
|
if target_collection == empty or target_collection == null
|
|
@@ -104,19 +104,19 @@ ${s(e,'<script src="{{ \'gp-product.v2.js\' | asset_url }}" defer="defer"></scri
|
|
|
104
104
|
endpaginate
|
|
105
105
|
else
|
|
106
106
|
if productSrc == 'RelatedProduct'
|
|
107
|
-
assign relatedTag = '${
|
|
107
|
+
assign relatedTag = '${C}'
|
|
108
108
|
assign products = null | sort
|
|
109
109
|
assign assignProduct = product
|
|
110
110
|
assign idAssignProduct = assignProduct.id
|
|
111
111
|
assign allProducts = collections.all.products
|
|
112
112
|
|
|
113
113
|
if relatedTag == 'collection'
|
|
114
|
-
assign hasRelatedExclude = ${
|
|
114
|
+
assign hasRelatedExclude = ${E}
|
|
115
115
|
assign relatedExclude = ''
|
|
116
116
|
if hasRelatedExclude
|
|
117
|
-
assign relatedExclude = '${
|
|
117
|
+
assign relatedExclude = '${b}'
|
|
118
118
|
endif
|
|
119
|
-
assign arrayRelatedExclude = relatedExclude |
|
|
119
|
+
assign arrayRelatedExclude = relatedExclude | split: ","
|
|
120
120
|
for collection in collections
|
|
121
121
|
assign collectionId = collection.id
|
|
122
122
|
assign isInCollection = false
|
|
@@ -179,20 +179,28 @@ ${s(e,'<script src="{{ \'gp-product.v2.js\' | asset_url }}" defer="defer"></scri
|
|
|
179
179
|
|
|
180
180
|
if relatedTag == 'tags'
|
|
181
181
|
assign tagsAssignProduct = assignProduct.tags
|
|
182
|
-
assign hasRelatedExclude = ${
|
|
182
|
+
assign hasRelatedExclude = ${E}
|
|
183
183
|
assign relatedExclude = ''
|
|
184
184
|
if hasRelatedExclude
|
|
185
|
-
assign relatedExclude = '${
|
|
185
|
+
assign relatedExclude = '${b}'
|
|
186
186
|
endif
|
|
187
|
-
assign arrayRelatedExclude = relatedExclude |
|
|
187
|
+
assign arrayRelatedExclude = relatedExclude | split: ","
|
|
188
188
|
for item in allProducts
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
189
|
+
assign handle = item.handle
|
|
190
|
+
assign productF = all_products[handle] | sort
|
|
191
|
+
assign tagsOfProduct = all_products[handle].tags
|
|
192
|
+
assign isExcludedProduct = false
|
|
193
|
+
assign idOfProduct = all_products[handle].id
|
|
194
|
+
|
|
195
|
+
for tagExclude in arrayRelatedExclude
|
|
196
|
+
if tagsOfProduct contains tagExclude
|
|
197
|
+
assign isExcludedProduct = true
|
|
198
|
+
endif
|
|
199
|
+
endfor
|
|
200
|
+
unless isExcludedProduct
|
|
193
201
|
for tag in tagsAssignProduct
|
|
194
202
|
assign tagItem = tag
|
|
195
|
-
unless arrayListProducts contains handle
|
|
203
|
+
unless arrayListProducts contains handle
|
|
196
204
|
if tagsOfProduct contains tagItem and idAssignProduct != idOfProduct
|
|
197
205
|
assign products = products | concat: productF
|
|
198
206
|
if stringListProducts.size > 0
|
|
@@ -203,6 +211,7 @@ ${s(e,'<script src="{{ \'gp-product.v2.js\' | asset_url }}" defer="defer"></scri
|
|
|
203
211
|
endif
|
|
204
212
|
endunless
|
|
205
213
|
endfor
|
|
214
|
+
endunless
|
|
206
215
|
endfor
|
|
207
216
|
endif
|
|
208
217
|
paginate products by ${k||4}
|