@gem-sdk/core 1.0.0
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/components/AddOn.js +18 -0
- package/dist/cjs/components/ComponentWrapper.js +45 -0
- package/dist/cjs/components/ComponentWrapperPreview.js +58 -0
- package/dist/cjs/components/Empty.js +7 -0
- package/dist/cjs/components/Render.js +28 -0
- package/dist/cjs/components/RenderBlock.js +21 -0
- package/dist/cjs/components/RenderPreview.js +28 -0
- package/dist/cjs/components/RenderSection.js +19 -0
- package/dist/cjs/contexts/AddonContext.js +25 -0
- package/dist/cjs/contexts/BuilderComponent.js +30 -0
- package/dist/cjs/contexts/BuilderContext.js +29 -0
- package/dist/cjs/contexts/BuilderPreviewContext.js +353 -0
- package/dist/cjs/contexts/CartLineContext.js +24 -0
- package/dist/cjs/contexts/CollectionContext.js +24 -0
- package/dist/cjs/contexts/ProductContext.js +126 -0
- package/dist/cjs/contexts/ProductListContext.js +24 -0
- package/dist/cjs/contexts/SectionContext.js +49 -0
- package/dist/cjs/contexts/ShopContext.js +43 -0
- package/dist/cjs/graphql/fragments/analytic.generated.js +11 -0
- package/dist/cjs/graphql/fragments/collection-detail.generated.js +13 -0
- package/dist/cjs/graphql/fragments/collection-product.generated.js +26 -0
- package/dist/cjs/graphql/fragments/data-seo.generated.js +11 -0
- package/dist/cjs/graphql/fragments/media.generated.js +14 -0
- package/dist/cjs/graphql/fragments/product-little.generated.js +25 -0
- package/dist/cjs/graphql/fragments/product-option-value.generated.js +13 -0
- package/dist/cjs/graphql/fragments/product-option.generated.js +14 -0
- package/dist/cjs/graphql/fragments/product.generated.js +33 -0
- package/dist/cjs/graphql/fragments/published-custom-section.generated.js +12 -0
- package/dist/cjs/graphql/fragments/published-page-section.generated.js +11 -0
- package/dist/cjs/graphql/fragments/published-theme-page.generated.js +27 -0
- package/dist/cjs/graphql/fragments/published-theme-style.generated.js +11 -0
- package/dist/cjs/graphql/fragments/selected-option.generated.js +11 -0
- package/dist/cjs/graphql/fragments/variant.generated.js +35 -0
- package/dist/cjs/graphql/queries/collection-detail-filter.generated.js +34 -0
- package/dist/cjs/graphql/queries/collection.generated.js +52 -0
- package/dist/cjs/graphql/queries/preview-page.generated.js +23 -0
- package/dist/cjs/graphql/queries/product-little-detail.generated.js +24 -0
- package/dist/cjs/graphql/queries/product-medias.generated.js +29 -0
- package/dist/cjs/graphql/queries/product-variants.generated.js +33 -0
- package/dist/cjs/graphql/queries/products.generated.js +41 -0
- package/dist/cjs/graphql/queries/published-theme-pages.generated.js +23 -0
- package/dist/cjs/graphql/queries/storeProperty.generated.js +12 -0
- package/dist/cjs/helpers/GlobalEvent.js +17 -0
- package/dist/cjs/helpers/background.js +104 -0
- package/dist/cjs/helpers/borders.js +138 -0
- package/dist/cjs/helpers/clone-deep.js +5 -0
- package/dist/cjs/helpers/cls.js +20 -0
- package/dist/cjs/helpers/colors.js +157 -0
- package/dist/cjs/helpers/compose-advance-style.js +132 -0
- package/dist/cjs/helpers/constant.js +17 -0
- package/dist/cjs/helpers/css-variable.js +7 -0
- package/dist/cjs/helpers/email.js +11 -0
- package/dist/cjs/helpers/flatten-connection.js +10 -0
- package/dist/cjs/helpers/fpixel.js +29 -0
- package/dist/cjs/helpers/get-resonsive-value.js +32 -0
- package/dist/cjs/helpers/get-shortname.js +92 -0
- package/dist/cjs/helpers/gtag.js +48 -0
- package/dist/cjs/helpers/is-browser.js +9 -0
- package/dist/cjs/helpers/is-defined.js +7 -0
- package/dist/cjs/helpers/is-empty-children.js +12 -0
- package/dist/cjs/helpers/layout.js +17 -0
- package/dist/cjs/helpers/load-script.js +32 -0
- package/dist/cjs/helpers/make-style.js +99 -0
- package/dist/cjs/helpers/normalize-builder-data.js +17 -0
- package/dist/cjs/helpers/prefetch-queries.js +68 -0
- package/dist/cjs/helpers/product.js +35 -0
- package/dist/cjs/helpers/queries/get-collection.js +173 -0
- package/dist/cjs/helpers/queries/get-product-by-slug.js +99 -0
- package/dist/cjs/helpers/queries/get-product.js +113 -0
- package/dist/cjs/helpers/queries/get-products.js +135 -0
- package/dist/cjs/helpers/radius.js +91 -0
- package/dist/cjs/helpers/shadow.js +48 -0
- package/dist/cjs/helpers/size.js +20 -0
- package/dist/cjs/helpers/spacing.js +45 -0
- package/dist/cjs/helpers/tiktokpixel.js +17 -0
- package/dist/cjs/helpers/typography.js +7 -0
- package/dist/cjs/hooks/cart/use-add-to-cart.js +20 -0
- package/dist/cjs/hooks/cart/use-cart-data.js +26 -0
- package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +20 -0
- package/dist/cjs/hooks/cart/use-cart-note-update.js +20 -0
- package/dist/cjs/hooks/cart/use-create-cart.js +22 -0
- package/dist/cjs/hooks/cart/use-remove-cart-item.js +20 -0
- package/dist/cjs/hooks/cart/use-update-cart-item.js +20 -0
- package/dist/cjs/hooks/shop/use-collection-query.js +16 -0
- package/dist/cjs/hooks/shop/use-product-query.js +16 -0
- package/dist/cjs/hooks/shop/use-products-query.js +16 -0
- package/dist/cjs/hooks/shop.js +80 -0
- package/dist/cjs/hooks/use-current-device.js +23 -0
- package/dist/cjs/hooks/use-lazy-video.js +15 -0
- package/dist/cjs/hooks/useCartId.js +36 -0
- package/dist/cjs/hooks/useCartLine.js +11 -0
- package/dist/cjs/hooks/useCartUI.js +42 -0
- package/dist/cjs/hooks/useCollection.js +9 -0
- package/dist/cjs/hooks/useFetchHandle.js +13 -0
- package/dist/cjs/hooks/useFormatMoney.js +17 -0
- package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +10 -0
- package/dist/cjs/hooks/useLoadScript.js +30 -0
- package/dist/cjs/hooks/useMoney.js +52 -0
- package/dist/cjs/hooks/usePrevious.js +17 -0
- package/dist/cjs/hooks/useProduct.js +90 -0
- package/dist/cjs/hooks/useProductList.js +21 -0
- package/dist/cjs/hooks/useSuspenseFetch.js +24 -0
- package/dist/cjs/hooks/useSwatchesOptions.js +39 -0
- package/dist/cjs/index.js +229 -0
- package/dist/cjs/types/global-style.js +7 -0
- package/dist/cjs/types/shop.js +2 -0
- package/dist/esm/components/AddOn.js +14 -0
- package/dist/esm/components/ComponentWrapper.js +40 -0
- package/dist/esm/components/ComponentWrapperPreview.js +54 -0
- package/dist/esm/components/Empty.js +3 -0
- package/dist/esm/components/Render.js +24 -0
- package/dist/esm/components/RenderBlock.js +17 -0
- package/dist/esm/components/RenderPreview.js +24 -0
- package/dist/esm/components/RenderSection.js +15 -0
- package/dist/esm/contexts/AddonContext.js +21 -0
- package/dist/esm/contexts/BuilderComponent.js +27 -0
- package/dist/esm/contexts/BuilderContext.js +26 -0
- package/dist/esm/contexts/BuilderPreviewContext.js +350 -0
- package/dist/esm/contexts/CartLineContext.js +21 -0
- package/dist/esm/contexts/CollectionContext.js +20 -0
- package/dist/esm/contexts/ProductContext.js +123 -0
- package/dist/esm/contexts/ProductListContext.js +20 -0
- package/dist/esm/contexts/SectionContext.js +45 -0
- package/dist/esm/contexts/ShopContext.js +40 -0
- package/dist/esm/graphql/fragments/analytic.generated.js +9 -0
- package/dist/esm/graphql/fragments/collection-detail.generated.js +11 -0
- package/dist/esm/graphql/fragments/collection-product.generated.js +24 -0
- package/dist/esm/graphql/fragments/data-seo.generated.js +9 -0
- package/dist/esm/graphql/fragments/media.generated.js +12 -0
- package/dist/esm/graphql/fragments/product-little.generated.js +23 -0
- package/dist/esm/graphql/fragments/product-option-value.generated.js +11 -0
- package/dist/esm/graphql/fragments/product-option.generated.js +12 -0
- package/dist/esm/graphql/fragments/product.generated.js +31 -0
- package/dist/esm/graphql/fragments/published-custom-section.generated.js +10 -0
- package/dist/esm/graphql/fragments/published-page-section.generated.js +9 -0
- package/dist/esm/graphql/fragments/published-theme-page.generated.js +25 -0
- package/dist/esm/graphql/fragments/published-theme-style.generated.js +9 -0
- package/dist/esm/graphql/fragments/selected-option.generated.js +9 -0
- package/dist/esm/graphql/fragments/variant.generated.js +33 -0
- package/dist/esm/graphql/queries/collection-detail-filter.generated.js +32 -0
- package/dist/esm/graphql/queries/collection.generated.js +50 -0
- package/dist/esm/graphql/queries/preview-page.generated.js +21 -0
- package/dist/esm/graphql/queries/product-little-detail.generated.js +22 -0
- package/dist/esm/graphql/queries/product-medias.generated.js +27 -0
- package/dist/esm/graphql/queries/product-variants.generated.js +31 -0
- package/dist/esm/graphql/queries/products.generated.js +38 -0
- package/dist/esm/graphql/queries/published-theme-pages.generated.js +21 -0
- package/dist/esm/graphql/queries/storeProperty.generated.js +10 -0
- package/dist/esm/helpers/GlobalEvent.js +13 -0
- package/dist/esm/helpers/background.js +102 -0
- package/dist/esm/helpers/borders.js +133 -0
- package/dist/esm/helpers/clone-deep.js +3 -0
- package/dist/esm/helpers/cls.js +18 -0
- package/dist/esm/helpers/colors.js +145 -0
- package/dist/esm/helpers/compose-advance-style.js +130 -0
- package/dist/esm/helpers/constant.js +13 -0
- package/dist/esm/helpers/css-variable.js +5 -0
- package/dist/esm/helpers/email.js +6 -0
- package/dist/esm/helpers/flatten-connection.js +8 -0
- package/dist/esm/helpers/fpixel.js +25 -0
- package/dist/esm/helpers/get-resonsive-value.js +28 -0
- package/dist/esm/helpers/get-shortname.js +90 -0
- package/dist/esm/helpers/gtag.js +45 -0
- package/dist/esm/helpers/is-browser.js +5 -0
- package/dist/esm/helpers/is-defined.js +5 -0
- package/dist/esm/helpers/is-empty-children.js +7 -0
- package/dist/esm/helpers/layout.js +15 -0
- package/dist/esm/helpers/load-script.js +30 -0
- package/dist/esm/helpers/make-style.js +91 -0
- package/dist/esm/helpers/normalize-builder-data.js +15 -0
- package/dist/esm/helpers/prefetch-queries.js +66 -0
- package/dist/esm/helpers/product.js +32 -0
- package/dist/esm/helpers/queries/get-collection.js +170 -0
- package/dist/esm/helpers/queries/get-product-by-slug.js +97 -0
- package/dist/esm/helpers/queries/get-product.js +109 -0
- package/dist/esm/helpers/queries/get-products.js +133 -0
- package/dist/esm/helpers/radius.js +86 -0
- package/dist/esm/helpers/shadow.js +45 -0
- package/dist/esm/helpers/size.js +18 -0
- package/dist/esm/helpers/spacing.js +42 -0
- package/dist/esm/helpers/tiktokpixel.js +15 -0
- package/dist/esm/helpers/typography.js +5 -0
- package/dist/esm/hooks/cart/use-add-to-cart.js +18 -0
- package/dist/esm/hooks/cart/use-cart-data.js +24 -0
- package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +18 -0
- package/dist/esm/hooks/cart/use-cart-note-update.js +18 -0
- package/dist/esm/hooks/cart/use-create-cart.js +20 -0
- package/dist/esm/hooks/cart/use-remove-cart-item.js +18 -0
- package/dist/esm/hooks/cart/use-update-cart-item.js +18 -0
- package/dist/esm/hooks/shop/use-collection-query.js +14 -0
- package/dist/esm/hooks/shop/use-product-query.js +14 -0
- package/dist/esm/hooks/shop/use-products-query.js +14 -0
- package/dist/esm/hooks/shop.js +68 -0
- package/dist/esm/hooks/use-current-device.js +21 -0
- package/dist/esm/hooks/use-lazy-video.js +13 -0
- package/dist/esm/hooks/useCartId.js +32 -0
- package/dist/esm/hooks/useCartLine.js +7 -0
- package/dist/esm/hooks/useCartUI.js +38 -0
- package/dist/esm/hooks/useCollection.js +7 -0
- package/dist/esm/hooks/useFetchHandle.js +11 -0
- package/dist/esm/hooks/useFormatMoney.js +13 -0
- package/dist/esm/hooks/useIsomorphicLayoutEffect.js +6 -0
- package/dist/esm/hooks/useLoadScript.js +26 -0
- package/dist/esm/hooks/useMoney.js +48 -0
- package/dist/esm/hooks/usePrevious.js +15 -0
- package/dist/esm/hooks/useProduct.js +78 -0
- package/dist/esm/hooks/useProductList.js +16 -0
- package/dist/esm/hooks/useSuspenseFetch.js +20 -0
- package/dist/esm/hooks/useSwatchesOptions.js +35 -0
- package/dist/esm/index.js +82 -0
- package/dist/esm/types/global-style.js +4 -0
- package/dist/esm/types/shop.js +1 -0
- package/dist/types/index.d.ts +7393 -0
- package/package.json +50 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const CollectionProductSelect = `
|
|
2
|
+
fragment CollectionProductSelect on Collection {
|
|
3
|
+
...CollectionDetailSelect
|
|
4
|
+
products(
|
|
5
|
+
first: $firstProduct
|
|
6
|
+
orderBy: $orderByProduct
|
|
7
|
+
after: $productsAfter
|
|
8
|
+
where: $whereProduct
|
|
9
|
+
) {
|
|
10
|
+
edges {
|
|
11
|
+
cursor
|
|
12
|
+
node {
|
|
13
|
+
...ProductSelect
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
pageInfo {
|
|
17
|
+
endCursor
|
|
18
|
+
hasNextPage
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
export { CollectionProductSelect };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const ProductLittleSelect = `
|
|
2
|
+
fragment ProductLittleSelect on Product {
|
|
3
|
+
id
|
|
4
|
+
title
|
|
5
|
+
description
|
|
6
|
+
descriptionHtml
|
|
7
|
+
handle
|
|
8
|
+
averageRating
|
|
9
|
+
isStorefront
|
|
10
|
+
isSample
|
|
11
|
+
baseID
|
|
12
|
+
sku
|
|
13
|
+
options {
|
|
14
|
+
...ProductOptionSelect
|
|
15
|
+
}
|
|
16
|
+
vendor
|
|
17
|
+
featuredImage {
|
|
18
|
+
...MediaSelect
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
export { ProductLittleSelect };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const ProductSelect = `
|
|
2
|
+
fragment ProductSelect on Product {
|
|
3
|
+
...ProductLittleSelect
|
|
4
|
+
medias(first: $firstMedia, after: $afterMedia) {
|
|
5
|
+
edges {
|
|
6
|
+
cursor
|
|
7
|
+
node {
|
|
8
|
+
...MediaSelect
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
pageInfo {
|
|
12
|
+
endCursor
|
|
13
|
+
hasNextPage
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
variants(first: $firstVariant, after: $afterVariant) {
|
|
17
|
+
edges {
|
|
18
|
+
cursor
|
|
19
|
+
node {
|
|
20
|
+
...VariantSelect
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
pageInfo {
|
|
24
|
+
hasNextPage
|
|
25
|
+
endCursor
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
export { ProductSelect };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const PublishedThemePageSelect = `
|
|
2
|
+
fragment PublishedThemePageSelect on PublishedThemePage {
|
|
3
|
+
id
|
|
4
|
+
name
|
|
5
|
+
isMobile
|
|
6
|
+
pageSections {
|
|
7
|
+
...PublishedPageSectionSelect
|
|
8
|
+
}
|
|
9
|
+
themePageCustomSections {
|
|
10
|
+
...PublishedCustomSectionSelect
|
|
11
|
+
}
|
|
12
|
+
themePageDataSEO {
|
|
13
|
+
...DataSEOSelect
|
|
14
|
+
}
|
|
15
|
+
pageStyle {
|
|
16
|
+
...PublishedThemeStyleSelect
|
|
17
|
+
}
|
|
18
|
+
sectionPosition
|
|
19
|
+
themePageAnalytic {
|
|
20
|
+
...AnalyticSelect
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
export { PublishedThemePageSelect };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const VariantSelect = `
|
|
2
|
+
fragment VariantSelect on ProductVariant {
|
|
3
|
+
id
|
|
4
|
+
title
|
|
5
|
+
barcode
|
|
6
|
+
baseID
|
|
7
|
+
costPrice
|
|
8
|
+
height
|
|
9
|
+
inventoryPolicy
|
|
10
|
+
inventoryQuantity
|
|
11
|
+
inventoryStatus
|
|
12
|
+
isDigital
|
|
13
|
+
length
|
|
14
|
+
lowInventoryAmount
|
|
15
|
+
manageInventory
|
|
16
|
+
mediaId
|
|
17
|
+
platform
|
|
18
|
+
price
|
|
19
|
+
salePrice
|
|
20
|
+
sku
|
|
21
|
+
soldIndividually
|
|
22
|
+
weight
|
|
23
|
+
width
|
|
24
|
+
selectedOptions {
|
|
25
|
+
...SelectedOptionSelect
|
|
26
|
+
}
|
|
27
|
+
media {
|
|
28
|
+
...MediaSelect
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
export { VariantSelect };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { CollectionProductSelect } from '../fragments/collection-product.generated.js';
|
|
2
|
+
import { CollectionDetailSelect } from '../fragments/collection-detail.generated.js';
|
|
3
|
+
import { ProductSelect } from '../fragments/product.generated.js';
|
|
4
|
+
import { ProductLittleSelect } from '../fragments/product-little.generated.js';
|
|
5
|
+
import { ProductOptionSelect } from '../fragments/product-option.generated.js';
|
|
6
|
+
import { ProductOptionValueSelect } from '../fragments/product-option-value.generated.js';
|
|
7
|
+
import { MediaSelect } from '../fragments/media.generated.js';
|
|
8
|
+
import { VariantSelect } from '../fragments/variant.generated.js';
|
|
9
|
+
import { SelectedOptionSelect } from '../fragments/selected-option.generated.js';
|
|
10
|
+
|
|
11
|
+
const CollectionDetailFilterDocument = `
|
|
12
|
+
query collectionDetailFilter($firstProduct: Int = 10, $orderBy: CollectionOrder, $where: CollectionWhereInput, $orderByProduct: ProductOrder, $productsAfter: Cursor, $firstVariant: Int, $afterVariant: Cursor, $afterMedia: Cursor, $firstMedia: Int, $whereProduct: ProductWhereInput) {
|
|
13
|
+
collections(first: 1, orderBy: $orderBy, where: $where) {
|
|
14
|
+
edges {
|
|
15
|
+
cursor
|
|
16
|
+
node {
|
|
17
|
+
...CollectionProductSelect
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
${CollectionProductSelect}
|
|
23
|
+
${CollectionDetailSelect}
|
|
24
|
+
${ProductSelect}
|
|
25
|
+
${ProductLittleSelect}
|
|
26
|
+
${ProductOptionSelect}
|
|
27
|
+
${ProductOptionValueSelect}
|
|
28
|
+
${MediaSelect}
|
|
29
|
+
${VariantSelect}
|
|
30
|
+
${SelectedOptionSelect}`;
|
|
31
|
+
|
|
32
|
+
export { CollectionDetailFilterDocument };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ProductSelect } from '../fragments/product.generated.js';
|
|
2
|
+
import { ProductLittleSelect } from '../fragments/product-little.generated.js';
|
|
3
|
+
import { ProductOptionSelect } from '../fragments/product-option.generated.js';
|
|
4
|
+
import { ProductOptionValueSelect } from '../fragments/product-option-value.generated.js';
|
|
5
|
+
import { MediaSelect } from '../fragments/media.generated.js';
|
|
6
|
+
import { VariantSelect } from '../fragments/variant.generated.js';
|
|
7
|
+
import { SelectedOptionSelect } from '../fragments/selected-option.generated.js';
|
|
8
|
+
|
|
9
|
+
const CollectionDocument = `
|
|
10
|
+
query collection($first: Int = 5, $firstMedia: Int = 20, $afterMedia: Cursor, $firstVariant: Int = 20, $afterVariant: Cursor, $handle: String, $id: ID) {
|
|
11
|
+
collection(handle: $handle, id: $id) {
|
|
12
|
+
baseID
|
|
13
|
+
createdAt
|
|
14
|
+
deletedAt
|
|
15
|
+
description
|
|
16
|
+
descriptionMeta
|
|
17
|
+
handle
|
|
18
|
+
id
|
|
19
|
+
platform
|
|
20
|
+
products(first: $first) {
|
|
21
|
+
edges {
|
|
22
|
+
cursor
|
|
23
|
+
node {
|
|
24
|
+
...ProductSelect
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
pageInfo {
|
|
28
|
+
endCursor
|
|
29
|
+
hasNextPage
|
|
30
|
+
hasPreviousPage
|
|
31
|
+
startCursor
|
|
32
|
+
}
|
|
33
|
+
totalCount
|
|
34
|
+
}
|
|
35
|
+
tags
|
|
36
|
+
templateSuffix
|
|
37
|
+
title
|
|
38
|
+
titleMeta
|
|
39
|
+
updatedAt
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
${ProductSelect}
|
|
43
|
+
${ProductLittleSelect}
|
|
44
|
+
${ProductOptionSelect}
|
|
45
|
+
${ProductOptionValueSelect}
|
|
46
|
+
${MediaSelect}
|
|
47
|
+
${VariantSelect}
|
|
48
|
+
${SelectedOptionSelect}`;
|
|
49
|
+
|
|
50
|
+
export { CollectionDocument };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PublishedThemePageSelect } from '../fragments/published-theme-page.generated.js';
|
|
2
|
+
import { PublishedPageSectionSelect } from '../fragments/published-page-section.generated.js';
|
|
3
|
+
import { PublishedCustomSectionSelect } from '../fragments/published-custom-section.generated.js';
|
|
4
|
+
import { DataSeoSelect } from '../fragments/data-seo.generated.js';
|
|
5
|
+
import { PublishedThemeStyleSelect } from '../fragments/published-theme-style.generated.js';
|
|
6
|
+
import { AnalyticSelect } from '../fragments/analytic.generated.js';
|
|
7
|
+
|
|
8
|
+
const PreviewPageDocument = `
|
|
9
|
+
query previewPage($handleURL: String, $pageType: PublishedThemePageType!) {
|
|
10
|
+
previewPage(handleURL: $handleURL, pageType: $pageType) {
|
|
11
|
+
...PublishedThemePageSelect
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
${PublishedThemePageSelect}
|
|
15
|
+
${PublishedPageSectionSelect}
|
|
16
|
+
${PublishedCustomSectionSelect}
|
|
17
|
+
${DataSeoSelect}
|
|
18
|
+
${PublishedThemeStyleSelect}
|
|
19
|
+
${AnalyticSelect}`;
|
|
20
|
+
|
|
21
|
+
export { PreviewPageDocument };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ProductLittleSelect } from '../fragments/product-little.generated.js';
|
|
2
|
+
import { ProductOptionSelect } from '../fragments/product-option.generated.js';
|
|
3
|
+
import { ProductOptionValueSelect } from '../fragments/product-option-value.generated.js';
|
|
4
|
+
import { MediaSelect } from '../fragments/media.generated.js';
|
|
5
|
+
|
|
6
|
+
const ProductLittleDetailDocument = `
|
|
7
|
+
query productLittleDetail($orderBy: ProductOrder, $where: ProductWhereInput) {
|
|
8
|
+
product: products(first: 1, orderBy: $orderBy, where: $where) {
|
|
9
|
+
edges {
|
|
10
|
+
cursor
|
|
11
|
+
node {
|
|
12
|
+
...ProductLittleSelect
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
${ProductLittleSelect}
|
|
18
|
+
${ProductOptionSelect}
|
|
19
|
+
${ProductOptionValueSelect}
|
|
20
|
+
${MediaSelect}`;
|
|
21
|
+
|
|
22
|
+
export { ProductLittleDetailDocument };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { MediaSelect } from '../fragments/media.generated.js';
|
|
2
|
+
|
|
3
|
+
const ProductMediasDocument = `
|
|
4
|
+
query productMedias($firstMedia: Int = 50, $afterMedia: Cursor, $orderBy: ProductOrder, $where: ProductWhereInput) {
|
|
5
|
+
medias: products(first: 1, orderBy: $orderBy, where: $where) {
|
|
6
|
+
edges {
|
|
7
|
+
node {
|
|
8
|
+
id
|
|
9
|
+
medias(first: $firstMedia, after: $afterMedia) {
|
|
10
|
+
edges {
|
|
11
|
+
cursor
|
|
12
|
+
node {
|
|
13
|
+
...MediaSelect
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
pageInfo {
|
|
17
|
+
hasNextPage
|
|
18
|
+
endCursor
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
${MediaSelect}`;
|
|
26
|
+
|
|
27
|
+
export { ProductMediasDocument };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { VariantSelect } from '../fragments/variant.generated.js';
|
|
2
|
+
import { SelectedOptionSelect } from '../fragments/selected-option.generated.js';
|
|
3
|
+
import { MediaSelect } from '../fragments/media.generated.js';
|
|
4
|
+
|
|
5
|
+
const ProductVariantsDocument = `
|
|
6
|
+
query productVariants($firstVariant: Int = 100, $afterVariant: Cursor, $orderBy: ProductOrder, $where: ProductWhereInput, $first: Int = 1) {
|
|
7
|
+
variants: products(first: $first, orderBy: $orderBy, where: $where) {
|
|
8
|
+
edges {
|
|
9
|
+
node {
|
|
10
|
+
id
|
|
11
|
+
variants(first: $firstVariant, after: $afterVariant) {
|
|
12
|
+
edges {
|
|
13
|
+
cursor
|
|
14
|
+
node {
|
|
15
|
+
...VariantSelect
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
pageInfo {
|
|
19
|
+
hasNextPage
|
|
20
|
+
endCursor
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
${VariantSelect}
|
|
28
|
+
${SelectedOptionSelect}
|
|
29
|
+
${MediaSelect}`;
|
|
30
|
+
|
|
31
|
+
export { ProductVariantsDocument };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ProductSelect } from '../fragments/product.generated.js';
|
|
2
|
+
import { ProductLittleSelect } from '../fragments/product-little.generated.js';
|
|
3
|
+
import { ProductOptionSelect } from '../fragments/product-option.generated.js';
|
|
4
|
+
import { ProductOptionValueSelect } from '../fragments/product-option-value.generated.js';
|
|
5
|
+
import { MediaSelect } from '../fragments/media.generated.js';
|
|
6
|
+
import { VariantSelect } from '../fragments/variant.generated.js';
|
|
7
|
+
import { SelectedOptionSelect } from '../fragments/selected-option.generated.js';
|
|
8
|
+
|
|
9
|
+
const ProductsEdgeDetail = `
|
|
10
|
+
fragment ProductsEdgeDetail on ProductEdge {
|
|
11
|
+
cursor
|
|
12
|
+
node {
|
|
13
|
+
...ProductSelect
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
`;
|
|
17
|
+
const ProductsDocument = `
|
|
18
|
+
query products($first: Int, $where: ProductWhereInput, $firstMedia: Int, $orderBy: ProductOrder, $after: Cursor, $firstVariant: Int, $afterVariant: Cursor, $afterMedia: Cursor) {
|
|
19
|
+
products(first: $first, where: $where, orderBy: $orderBy, after: $after) {
|
|
20
|
+
edges {
|
|
21
|
+
...ProductsEdgeDetail
|
|
22
|
+
}
|
|
23
|
+
pageInfo {
|
|
24
|
+
endCursor
|
|
25
|
+
hasNextPage
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
${ProductsEdgeDetail}
|
|
30
|
+
${ProductSelect}
|
|
31
|
+
${ProductLittleSelect}
|
|
32
|
+
${ProductOptionSelect}
|
|
33
|
+
${ProductOptionValueSelect}
|
|
34
|
+
${MediaSelect}
|
|
35
|
+
${VariantSelect}
|
|
36
|
+
${SelectedOptionSelect}`;
|
|
37
|
+
|
|
38
|
+
export { ProductsDocument, ProductsEdgeDetail };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PublishedThemePageSelect } from '../fragments/published-theme-page.generated.js';
|
|
2
|
+
import { PublishedPageSectionSelect } from '../fragments/published-page-section.generated.js';
|
|
3
|
+
import { PublishedCustomSectionSelect } from '../fragments/published-custom-section.generated.js';
|
|
4
|
+
import { DataSeoSelect } from '../fragments/data-seo.generated.js';
|
|
5
|
+
import { PublishedThemeStyleSelect } from '../fragments/published-theme-style.generated.js';
|
|
6
|
+
import { AnalyticSelect } from '../fragments/analytic.generated.js';
|
|
7
|
+
|
|
8
|
+
const PublishedThemePagesDocument = `
|
|
9
|
+
query publishedThemePages($slug: String, $slugType: PublishedThemePageType!) {
|
|
10
|
+
publishedThemePages(slug: $slug, slugType: $slugType) {
|
|
11
|
+
...PublishedThemePageSelect
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
${PublishedThemePageSelect}
|
|
15
|
+
${PublishedPageSectionSelect}
|
|
16
|
+
${PublishedCustomSectionSelect}
|
|
17
|
+
${DataSeoSelect}
|
|
18
|
+
${PublishedThemeStyleSelect}
|
|
19
|
+
${AnalyticSelect}`;
|
|
20
|
+
|
|
21
|
+
export { PublishedThemePagesDocument };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const globalEvent = {
|
|
2
|
+
subscribe(callback) {
|
|
3
|
+
document.addEventListener('onDispatch', (e) => callback(e.detail));
|
|
4
|
+
},
|
|
5
|
+
dispatch(data) {
|
|
6
|
+
document.dispatchEvent(new CustomEvent('onDispatch', { detail: data }));
|
|
7
|
+
},
|
|
8
|
+
remove(callback) {
|
|
9
|
+
document.removeEventListener('onDispatch', callback);
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { globalEvent as default };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { isColor } from './colors.js';
|
|
2
|
+
import { makeStyleResponsive } from './make-style.js';
|
|
3
|
+
|
|
4
|
+
const getStyleBackgroundByDevice = (background) => {
|
|
5
|
+
if (!background) {
|
|
6
|
+
return {};
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
...getStyleBgColor(background),
|
|
10
|
+
...getStyleBgImage(background),
|
|
11
|
+
...getStyleBgPosition(background),
|
|
12
|
+
...getStyleBgSize(background),
|
|
13
|
+
...getStyleBgRepeat(background),
|
|
14
|
+
...getStyleBgAttachment(background),
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
const getStyleBgColor = (background) => {
|
|
18
|
+
const bgColor = {
|
|
19
|
+
desktop: getBgColorByDevice(background, 'desktop'),
|
|
20
|
+
tablet: getBgColorByDevice(background, 'tablet'),
|
|
21
|
+
mobile: getBgColorByDevice(background, 'mobile'),
|
|
22
|
+
};
|
|
23
|
+
return makeStyleResponsive('bgc', bgColor);
|
|
24
|
+
};
|
|
25
|
+
const getBgColorByDevice = (background, device) => {
|
|
26
|
+
return getColor(background?.[device]?.color);
|
|
27
|
+
};
|
|
28
|
+
const getColor = (color) => {
|
|
29
|
+
if (!color) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (isColor(color?.toString())) {
|
|
33
|
+
return color;
|
|
34
|
+
}
|
|
35
|
+
return `var(--g-c-${color})`;
|
|
36
|
+
};
|
|
37
|
+
const getStyleBgImage = (background) => {
|
|
38
|
+
const bgImage = {
|
|
39
|
+
// desktop:
|
|
40
|
+
// background.desktop?.type === 'color' ? 'none' : getBgImageByDevice(background, 'desktop'),
|
|
41
|
+
// tablet: background.tablet?.type === 'color' ? 'none' : getBgImageByDevice(background, 'tablet'),
|
|
42
|
+
// mobile: background.mobile?.type === 'color' ? 'none' : getBgImageByDevice(background, 'mobile'),
|
|
43
|
+
desktop: getBgImageByDevice(background, 'desktop'),
|
|
44
|
+
tablet: getBgImageByDevice(background, 'tablet'),
|
|
45
|
+
mobile: getBgImageByDevice(background, 'mobile'),
|
|
46
|
+
};
|
|
47
|
+
return makeStyleResponsive('bgi', bgImage);
|
|
48
|
+
};
|
|
49
|
+
const getBgImageByDevice = (background, device) => {
|
|
50
|
+
const imageByDevice = background?.[device]?.image?.src;
|
|
51
|
+
if (typeof imageByDevice === 'string') {
|
|
52
|
+
return `url(${imageByDevice})`;
|
|
53
|
+
}
|
|
54
|
+
return;
|
|
55
|
+
};
|
|
56
|
+
const getStyleBgPosition = (background) => {
|
|
57
|
+
const bgPosition = {
|
|
58
|
+
desktop: getBgPositionByDevice(background, 'desktop'),
|
|
59
|
+
tablet: getBgPositionByDevice(background, 'tablet'),
|
|
60
|
+
mobile: getBgPositionByDevice(background, 'mobile'),
|
|
61
|
+
};
|
|
62
|
+
return makeStyleResponsive('bgp', bgPosition);
|
|
63
|
+
};
|
|
64
|
+
const getBgPositionByDevice = (background, device) => {
|
|
65
|
+
const positionByDevice = background?.[device]?.position;
|
|
66
|
+
return positionByDevice && `${positionByDevice.x}% ${positionByDevice.y}%`;
|
|
67
|
+
};
|
|
68
|
+
const getStyleBgSize = (background) => {
|
|
69
|
+
const bgSize = {
|
|
70
|
+
desktop: getBgSizeByDevice(background, 'desktop'),
|
|
71
|
+
tablet: getBgSizeByDevice(background, 'tablet'),
|
|
72
|
+
mobile: getBgSizeByDevice(background, 'mobile'),
|
|
73
|
+
};
|
|
74
|
+
return makeStyleResponsive('bgs', bgSize);
|
|
75
|
+
};
|
|
76
|
+
const getBgSizeByDevice = (background, device) => {
|
|
77
|
+
return background?.[device]?.size;
|
|
78
|
+
};
|
|
79
|
+
const getStyleBgRepeat = (background) => {
|
|
80
|
+
const bgRepeat = {
|
|
81
|
+
desktop: getBgRepeatByDevice(background, 'desktop'),
|
|
82
|
+
tablet: getBgRepeatByDevice(background, 'tablet'),
|
|
83
|
+
mobile: getBgRepeatByDevice(background, 'mobile'),
|
|
84
|
+
};
|
|
85
|
+
return makeStyleResponsive('bgr', bgRepeat);
|
|
86
|
+
};
|
|
87
|
+
const getBgRepeatByDevice = (background, device) => {
|
|
88
|
+
return background?.[device]?.repeat;
|
|
89
|
+
};
|
|
90
|
+
const getStyleBgAttachment = (background) => {
|
|
91
|
+
const bgAttachment = {
|
|
92
|
+
desktop: getBgAttachmentByDevice(background, 'desktop'),
|
|
93
|
+
tablet: getBgAttachmentByDevice(background, 'tablet'),
|
|
94
|
+
mobile: getBgAttachmentByDevice(background, 'mobile'),
|
|
95
|
+
};
|
|
96
|
+
return makeStyleResponsive('bga', bgAttachment);
|
|
97
|
+
};
|
|
98
|
+
const getBgAttachmentByDevice = (background, device) => {
|
|
99
|
+
return background?.[device]?.attachment;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export { getStyleBackgroundByDevice };
|