@gem-sdk/components 2.0.0-dev.271 → 2.0.0-dev.275
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/article/components/ArticleImage.js +0 -5
- package/dist/cjs/article/components/ArticleList.js +1 -1
- package/dist/cjs/banner/components/HeroBannerItem.liquid.js +1 -1
- package/dist/cjs/builder.js +13 -13
- package/dist/cjs/cart/components/ShopPayButton/ShopPayButton.js +70 -0
- package/dist/cjs/cart/components/ShopPayButton/ShopPayButton.liquid.js +71 -0
- package/dist/cjs/cart/components/ShopPayButton/common/classes.js +18 -0
- package/dist/cjs/cart/components/ShopPayButton/common/helpers.js +31 -0
- package/dist/cjs/cart/components/ShopPayButton/common/styles.js +12 -0
- package/dist/cjs/cart/components/ShopPayButton/hooks/useShopPayButton.js +70 -0
- package/dist/cjs/cart/next.js +1 -1
- package/dist/cjs/estimate-delivery/components/EstimateDate.liquid.js +1 -1
- package/dist/cjs/form/setting/submit-button/configs/settings.js +2 -2
- package/dist/cjs/header/components/kind/basic/index.js +1 -1
- package/dist/cjs/header/components/kind/modern/index.js +1 -1
- package/dist/cjs/index.js +39 -39
- package/dist/cjs/index.liquid.js +9 -9
- package/dist/cjs/marquee/setting/configs/childImageTemplate.js +1 -1
- package/dist/cjs/post-purchase/advanced-list/components/common/getClasses.js +1 -1
- package/dist/cjs/post-purchase/advanced-list/setting/configs/presets.js +3 -1
- package/dist/cjs/post-purchase/advanced-list/setting/configs/settings.js +2 -1
- package/dist/cjs/post-purchase/advanced-list/setting/template.js +8 -3
- package/dist/cjs/post-purchase/callout-banner/setting/config/callout-text/setting.js +0 -7
- package/dist/cjs/post-purchase/callout-banner/setting/config/callout-text/uiV2.js +1 -1
- package/dist/cjs/post-purchase/image/setting/Image.js +2 -2
- package/dist/cjs/post-purchase/image/setting/setting-v2.js +25 -13
- package/dist/cjs/post-purchase/image/setting/ui-v2.js +1 -1
- package/dist/cjs/post-purchase/link/setting/configs/settings.js +7 -2
- package/dist/cjs/post-purchase/product/settings/product-variants/configs/uiV2.js +4 -2
- package/dist/cjs/product/components/DynamicCheckout/DynamicCheckout.js +28 -0
- package/dist/cjs/product/components/DynamicCheckout/DynamicCheckout.liquid.js +23 -0
- package/dist/cjs/product/components/DynamicCheckout/common/classes.js +32 -0
- package/dist/cjs/product/components/DynamicCheckout/common/styles.js +181 -0
- package/dist/cjs/product/components/DynamicCheckout/components/Button.liquid.js +58 -0
- package/dist/cjs/product/components/FileUpload/components/common/index.js +1 -1
- package/dist/cjs/product/components/ProductDescription/common/const.js +9 -0
- package/dist/cjs/product/components/ProductDescription/common/getClasses.js +30 -0
- package/dist/cjs/product/components/ProductDescription/common/getStyle.js +81 -0
- package/dist/cjs/product/components/ProductDescription/hooks/useGpDescription.js +90 -0
- package/dist/cjs/product/components/ProductDescription/index.js +115 -0
- package/dist/cjs/product/components/ProductDescription/index.liquid.js +86 -0
- package/dist/cjs/product/next.js +1 -1
- package/dist/cjs/setting.js +1 -1
- package/dist/esm/article/components/ArticleImage.js +0 -5
- package/dist/esm/article/components/ArticleList.js +1 -1
- package/dist/esm/banner/components/HeroBannerItem.liquid.js +1 -1
- package/dist/esm/builder.js +3 -3
- package/dist/esm/cart/components/ShopPayButton/ShopPayButton.js +66 -0
- package/dist/esm/cart/components/ShopPayButton/ShopPayButton.liquid.js +67 -0
- package/dist/esm/cart/components/ShopPayButton/common/classes.js +15 -0
- package/dist/esm/cart/components/ShopPayButton/common/helpers.js +27 -0
- package/dist/esm/cart/components/ShopPayButton/common/styles.js +10 -0
- package/dist/esm/cart/components/ShopPayButton/hooks/useShopPayButton.js +68 -0
- package/dist/esm/cart/next.js +1 -1
- package/dist/esm/estimate-delivery/components/EstimateDate.liquid.js +1 -1
- package/dist/esm/form/setting/submit-button/configs/settings.js +2 -2
- package/dist/esm/header/components/kind/basic/index.js +1 -1
- package/dist/esm/header/components/kind/modern/index.js +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.liquid.js +3 -3
- package/dist/esm/marquee/setting/configs/childImageTemplate.js +1 -1
- package/dist/esm/post-purchase/advanced-list/components/common/getClasses.js +1 -1
- package/dist/esm/post-purchase/advanced-list/setting/configs/presets.js +3 -1
- package/dist/esm/post-purchase/advanced-list/setting/configs/settings.js +2 -1
- package/dist/esm/post-purchase/advanced-list/setting/template.js +8 -3
- package/dist/esm/post-purchase/callout-banner/setting/config/callout-text/setting.js +0 -7
- package/dist/esm/post-purchase/callout-banner/setting/config/callout-text/uiV2.js +1 -1
- package/dist/esm/post-purchase/image/setting/Image.js +2 -2
- package/dist/esm/post-purchase/image/setting/setting-v2.js +25 -13
- package/dist/esm/post-purchase/image/setting/ui-v2.js +1 -1
- package/dist/esm/post-purchase/link/setting/configs/settings.js +7 -2
- package/dist/esm/post-purchase/product/settings/product-variants/configs/uiV2.js +4 -2
- package/dist/esm/product/components/DynamicCheckout/DynamicCheckout.js +24 -0
- package/dist/esm/product/components/DynamicCheckout/DynamicCheckout.liquid.js +19 -0
- package/dist/esm/product/components/DynamicCheckout/common/classes.js +30 -0
- package/dist/esm/product/components/DynamicCheckout/common/styles.js +179 -0
- package/dist/esm/product/components/DynamicCheckout/components/Button.liquid.js +54 -0
- package/dist/esm/product/components/FileUpload/components/common/index.js +1 -1
- package/dist/esm/product/components/ProductDescription/common/const.js +6 -0
- package/dist/esm/product/components/ProductDescription/common/getClasses.js +27 -0
- package/dist/esm/product/components/ProductDescription/common/getStyle.js +77 -0
- package/dist/esm/product/components/ProductDescription/hooks/useGpDescription.js +88 -0
- package/dist/esm/product/components/ProductDescription/index.js +111 -0
- package/dist/esm/product/components/ProductDescription/index.liquid.js +82 -0
- package/dist/esm/product/next.js +1 -1
- package/dist/esm/setting.js +1 -1
- package/dist/types/index.d.ts +29 -97
- package/package.json +1 -1
- package/dist/cjs/cart/components/ShopPayButton/ShopPayButtonCommon.js +0 -20
- package/dist/cjs/cart/components/ShopPayButton/index.js +0 -113
- package/dist/cjs/cart/components/ShopPayButton/index.liquid.js +0 -51
- package/dist/cjs/product/components/DynamicCheckout.liquid.js +0 -250
- package/dist/cjs/product/components/ProductDescription/const.js +0 -5
- package/dist/cjs/product/components/ProductDescription.js +0 -172
- package/dist/cjs/product/components/ProductDescription.liquid.js +0 -120
- package/dist/esm/cart/components/ShopPayButton/ShopPayButtonCommon.js +0 -17
- package/dist/esm/cart/components/ShopPayButton/index.js +0 -109
- package/dist/esm/cart/components/ShopPayButton/index.liquid.js +0 -47
- package/dist/esm/product/components/DynamicCheckout.liquid.js +0 -246
- package/dist/esm/product/components/ProductDescription/const.js +0 -3
- package/dist/esm/product/components/ProductDescription.js +0 -168
- package/dist/esm/product/components/ProductDescription.liquid.js +0 -116
- /package/dist/cjs/product/components/ProductDescription/{common.js → common/getMaxHeight.js} +0 -0
- /package/dist/esm/product/components/ProductDescription/{common.js → common/getMaxHeight.js} +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const getSPButton = ({ styles, buttons })=>{
|
|
2
|
+
const { DynamicCheckoutBlack, DynamicCheckoutWhite, DynamicCheckoutPurple, ExpressCheckoutBlack, ExpressCheckoutWhite, ExpressCheckoutPurple } = buttons;
|
|
3
|
+
if (styles?.type === 'dynamic') {
|
|
4
|
+
if (styles.color === 'black') return DynamicCheckoutBlack;
|
|
5
|
+
if (styles.color === 'purple') return DynamicCheckoutPurple;
|
|
6
|
+
return DynamicCheckoutWhite;
|
|
7
|
+
} else {
|
|
8
|
+
if (styles?.color === 'black') return ExpressCheckoutBlack;
|
|
9
|
+
if (styles?.color === 'purple') return ExpressCheckoutPurple;
|
|
10
|
+
return ExpressCheckoutWhite;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const getIdFromGid = (id)=>{
|
|
14
|
+
if (!id) return;
|
|
15
|
+
return id.split('/').at(-1);
|
|
16
|
+
};
|
|
17
|
+
const getStoreUrl = (url)=>{
|
|
18
|
+
if (!url) return;
|
|
19
|
+
try {
|
|
20
|
+
const data = new URL(url);
|
|
21
|
+
return data.origin;
|
|
22
|
+
} catch {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { getIdFromGid, getSPButton, getStoreUrl };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { useEditorMode, useQuantity, useCartData, useCurrentVariant, useShopStore, useCurrentVariantInStock } from '@gem-sdk/core';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { getStoreUrl, getIdFromGid } from '../common/helpers.js';
|
|
4
|
+
|
|
5
|
+
const useShopPayButton = (setting)=>{
|
|
6
|
+
const mode = useEditorMode();
|
|
7
|
+
const { quantity } = useQuantity();
|
|
8
|
+
const { data: cartData } = useCartData();
|
|
9
|
+
const currentVariant = useCurrentVariant();
|
|
10
|
+
const storefrontUrl = useShopStore((s)=>s.storefrontUrl);
|
|
11
|
+
const isCurrentVariantInStock = useCurrentVariantInStock();
|
|
12
|
+
const storeUrl = getStoreUrl(storefrontUrl);
|
|
13
|
+
const idsInCart = useMemo(()=>{
|
|
14
|
+
const items = cartData?.lineItems.map((v)=>({
|
|
15
|
+
id: v.variantId,
|
|
16
|
+
quantity: v.quantity
|
|
17
|
+
}))?.reduce((prev, curr)=>{
|
|
18
|
+
const bareId = getIdFromGid(curr?.id);
|
|
19
|
+
if (bareId) {
|
|
20
|
+
prev.push(`${bareId}:${curr?.quantity ?? 1}`);
|
|
21
|
+
}
|
|
22
|
+
return prev;
|
|
23
|
+
}, []);
|
|
24
|
+
return items;
|
|
25
|
+
}, [
|
|
26
|
+
cartData?.lineItems
|
|
27
|
+
]);
|
|
28
|
+
const variants = useMemo(()=>{
|
|
29
|
+
if (setting?.kind === 'cart-buy') {
|
|
30
|
+
return idsInCart;
|
|
31
|
+
}
|
|
32
|
+
if (currentVariant?.baseID && isCurrentVariantInStock && quantity) {
|
|
33
|
+
return [
|
|
34
|
+
`${getIdFromGid(currentVariant.baseID)}:${quantity}`
|
|
35
|
+
];
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
38
|
+
}, [
|
|
39
|
+
setting?.kind,
|
|
40
|
+
currentVariant?.baseID,
|
|
41
|
+
isCurrentVariantInStock,
|
|
42
|
+
quantity,
|
|
43
|
+
idsInCart
|
|
44
|
+
]);
|
|
45
|
+
const payUrl = `${storeUrl}/cart/${variants?.join(',')}?payment=shop_pay`;
|
|
46
|
+
const handleOnPay = ({ inputWidth = 600, inputHeight = 600 })=>{
|
|
47
|
+
if (mode === 'edit') return;
|
|
48
|
+
if (setting?.openMode === 'popup') {
|
|
49
|
+
const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : window.screenX;
|
|
50
|
+
const dualScreenTop = window.screenTop !== undefined ? window.screenTop : window.screenY;
|
|
51
|
+
const width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
|
|
52
|
+
const height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
|
|
53
|
+
const systemZoom = width / window.screen.availWidth;
|
|
54
|
+
const left = (width - inputWidth) / 2 / systemZoom + dualScreenLeft;
|
|
55
|
+
const top = (height - inputHeight) / 2 / systemZoom + dualScreenTop;
|
|
56
|
+
window.open(payUrl, 'shop_pay', `scrollbars=yes, width=${inputWidth / systemZoom}, height=${inputHeight / systemZoom}, top=${top}, left=${left}`);
|
|
57
|
+
} else {
|
|
58
|
+
!!payUrl && window.open(payUrl);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
storeUrl,
|
|
63
|
+
variants,
|
|
64
|
+
handleOnPay
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export { useShopPayButton };
|
package/dist/esm/cart/next.js
CHANGED
|
@@ -47,7 +47,7 @@ const CouponList = dynamic(()=>import('./components/CouponList.js'), {
|
|
|
47
47
|
const CheckoutNow = dynamic(()=>import('./components/CheckoutNow.js'), {
|
|
48
48
|
loading: Loading
|
|
49
49
|
});
|
|
50
|
-
const ShopPayButton = dynamic(()=>import('./components/ShopPayButton/
|
|
50
|
+
const ShopPayButton = dynamic(()=>import('./components/ShopPayButton/ShopPayButton.js'), {
|
|
51
51
|
ssr: false,
|
|
52
52
|
loading: Loading
|
|
53
53
|
});
|
|
@@ -16,7 +16,7 @@ import '@gem-sdk/keen-slider/react';
|
|
|
16
16
|
import 'next/image';
|
|
17
17
|
import 'react-youtube';
|
|
18
18
|
import '../../image/components/AdaptiveImage.js';
|
|
19
|
-
import '../../cart/components/ShopPayButton/
|
|
19
|
+
import '../../cart/components/ShopPayButton/ShopPayButton.js';
|
|
20
20
|
import '../../countdown-timer/setting/configs/settings.js';
|
|
21
21
|
import '../../header/components/Header.js';
|
|
22
22
|
import '../../header/components/kind/basic/index.js';
|
|
@@ -9,7 +9,7 @@ import 'next/head';
|
|
|
9
9
|
import 'next/image';
|
|
10
10
|
import 'react-youtube';
|
|
11
11
|
import Image from '../../../../image/components/Image.js';
|
|
12
|
-
import '../../../../cart/components/ShopPayButton/
|
|
12
|
+
import '../../../../cart/components/ShopPayButton/ShopPayButton.js';
|
|
13
13
|
import CheckoutNow from '../../../../cart/components/CheckoutNow.js';
|
|
14
14
|
|
|
15
15
|
const MobileMenu = dynamic(()=>import('./MobileMenu.js'));
|
|
@@ -9,7 +9,7 @@ import 'next/image';
|
|
|
9
9
|
import 'react-youtube';
|
|
10
10
|
import 'next/link';
|
|
11
11
|
import '../../../../image/components/AdaptiveImage.js';
|
|
12
|
-
import '../../../../cart/components/ShopPayButton/
|
|
12
|
+
import '../../../../cart/components/ShopPayButton/ShopPayButton.js';
|
|
13
13
|
|
|
14
14
|
const ModernHeader = (props)=>{
|
|
15
15
|
return /*#__PURE__*/ jsxs("div", {
|
package/dist/esm/index.js
CHANGED
|
@@ -25,7 +25,7 @@ export { default as CartDiscount } from './cart/components/CartDiscount.js';
|
|
|
25
25
|
export { default as CartOrderNote } from './cart/components/CartOrderNote.js';
|
|
26
26
|
export { default as CartLineAttribute } from './cart/components/CartLineAttribute.js';
|
|
27
27
|
export { default as CouponList } from './cart/components/CouponList.js';
|
|
28
|
-
export { default as ShopPayButton } from './cart/components/ShopPayButton/
|
|
28
|
+
export { default as ShopPayButton } from './cart/components/ShopPayButton/ShopPayButton.js';
|
|
29
29
|
export { default as CheckoutNow } from './cart/components/CheckoutNow.js';
|
|
30
30
|
export { default as collectionSetting } from './collection/setting/index.js';
|
|
31
31
|
export { default as CollectionTitle } from './collection/components/CollectionTitle.js';
|
|
@@ -68,7 +68,7 @@ export { default as productSetting } from './product/setting/index.js';
|
|
|
68
68
|
export { default as Product } from './product/components/Product.js';
|
|
69
69
|
export { default as ProductTitle } from './product/components/ProductTitle/index.js';
|
|
70
70
|
export { default as ProductQuantity } from './product/components/ProductQuantity.js';
|
|
71
|
-
export { default as ProductDescription } from './product/components/ProductDescription.js';
|
|
71
|
+
export { default as ProductDescription } from './product/components/ProductDescription/index.js';
|
|
72
72
|
export { default as ProductPrice } from './product/components/ProductPrice.js';
|
|
73
73
|
export { default as ProductButton } from './product/components/ProductButton.js';
|
|
74
74
|
export { default as ProductVariants } from './product/components/ProductVariants/index.js';
|
|
@@ -78,7 +78,7 @@ export { default as ProductPropertyInput } from './product/components/ProductPro
|
|
|
78
78
|
export { default as ProductQuickView } from './product/components/ProductQuickView/index.js';
|
|
79
79
|
export { default as ProductTag } from './product/components/ProductTag.js';
|
|
80
80
|
export { default as ProductList } from './product/components/ProductList.js';
|
|
81
|
-
export { default as DynamicCheckout } from './product/components/DynamicCheckout.js';
|
|
81
|
+
export { default as DynamicCheckout } from './product/components/DynamicCheckout/DynamicCheckout.js';
|
|
82
82
|
export { default as ProductBundleDiscount } from './product/components/ProductBundleDiscount.js';
|
|
83
83
|
export { default as ProductBundleDiscountItem } from './product/components/ProductBundleDiscountItem.js';
|
|
84
84
|
export { default as ProductVendor } from './product/components/Vendor.js';
|
package/dist/esm/index.liquid.js
CHANGED
|
@@ -12,7 +12,7 @@ export { default as Product } from './product/components/Product.liquid.js';
|
|
|
12
12
|
export { default as ProductTitle } from './product/components/ProductTitle/index.liquid.js';
|
|
13
13
|
export { ProductPrice } from './product/components/ProductPrice.liquid.js';
|
|
14
14
|
export { default as ProductButton } from './product/components/ProductButton.liquid.js';
|
|
15
|
-
export { default as ProductDescription } from './product/components/ProductDescription.liquid.js';
|
|
15
|
+
export { default as ProductDescription } from './product/components/ProductDescription/index.liquid.js';
|
|
16
16
|
export { default as ProductImages } from './product/components/ProductImages.liquid.js';
|
|
17
17
|
export { default as ProductImagesV2 } from './product/components/ProductImagesV2/liquid/ProductImages.liquid.js';
|
|
18
18
|
export { default as ProductQuantity } from './product/components/ProductQuantity.liquid.js';
|
|
@@ -20,7 +20,7 @@ export { default as ProductVariants } from './product/components/ProductVariants
|
|
|
20
20
|
export { default as ProductTag } from './product/components/ProductTag.liquid.js';
|
|
21
21
|
export { default as ProductProperties } from './product/components/ProductProperties.liquid.js';
|
|
22
22
|
export { default as ProductList } from './product/components/ProductList.liquid.js';
|
|
23
|
-
export { default as DynamicCheckout } from './product/components/DynamicCheckout.liquid.js';
|
|
23
|
+
export { default as DynamicCheckout } from './product/components/DynamicCheckout/DynamicCheckout.liquid.js';
|
|
24
24
|
export { default as ProductVendor } from './product/components/Vendor.liquid.js';
|
|
25
25
|
export { default as ProductBundleDiscount } from './product/components/ProductBundleDiscount.liquid.js';
|
|
26
26
|
export { default as ProductBundleDiscountItem } from './product/components/ProductBundleDiscountItem.liquid.js';
|
|
@@ -47,7 +47,7 @@ export { default as TabItem } from './tab/components/TabItem.liquid.js';
|
|
|
47
47
|
export { default as HeroBanner } from './banner/components/HeroBanner.liquid.js';
|
|
48
48
|
export { default as CSSCode } from './code/components/CSSCode.liquid.js';
|
|
49
49
|
export { default as StockCounter } from './stock-counter/components/StockCounter.liquid.js';
|
|
50
|
-
export { default as ShopPayButton } from './cart/components/ShopPayButton/
|
|
50
|
+
export { default as ShopPayButton } from './cart/components/ShopPayButton/ShopPayButton.liquid.js';
|
|
51
51
|
export { default as Newsletter } from './form/components/newsletter/Newsletter.liquid.js';
|
|
52
52
|
export { default as ContactForm } from './form/components/contact/Contact.liquid.js';
|
|
53
53
|
export { default as FormEmail } from './form/components/form-email/FormEmail.liquid.js';
|
|
@@ -22,7 +22,8 @@ const ConfigPreset = [
|
|
|
22
22
|
settings: {
|
|
23
23
|
childItem: [
|
|
24
24
|
'Item 1',
|
|
25
|
-
'Item 2'
|
|
25
|
+
'Item 2',
|
|
26
|
+
'Item 3'
|
|
26
27
|
]
|
|
27
28
|
},
|
|
28
29
|
advanced: {
|
|
@@ -30,6 +31,7 @@ const ConfigPreset = [
|
|
|
30
31
|
inlinePadding: 'none'
|
|
31
32
|
},
|
|
32
33
|
childrens: [
|
|
34
|
+
ChildTemplate,
|
|
33
35
|
ChildTemplate,
|
|
34
36
|
ChildTemplate
|
|
35
37
|
]
|
|
@@ -34,14 +34,16 @@ const ChildTemplate = {
|
|
|
34
34
|
label: 'Image',
|
|
35
35
|
styles: {
|
|
36
36
|
width: {
|
|
37
|
-
desktop: '
|
|
37
|
+
desktop: '32px'
|
|
38
38
|
},
|
|
39
|
+
aspectRatio: '1',
|
|
40
|
+
align: 'left',
|
|
39
41
|
enableBorder: 'none'
|
|
40
42
|
},
|
|
41
43
|
settings: {
|
|
42
44
|
srcSet: {
|
|
43
45
|
desktop: {
|
|
44
|
-
src: 'https://
|
|
46
|
+
src: 'https://cdn.shopify.com/s/files/1/0791/2780/6265/files/gempages_468220687216018311-d69940af-f03e-4864-a612-63cd9a4dce36.png'
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
}
|
|
@@ -59,7 +61,7 @@ const ChildTemplate = {
|
|
|
59
61
|
text: 'Your custom text goes here'
|
|
60
62
|
},
|
|
61
63
|
advanced: {
|
|
62
|
-
blockPadding: '
|
|
64
|
+
blockPadding: 'extraTight'
|
|
63
65
|
},
|
|
64
66
|
styles: {
|
|
65
67
|
typo: {
|
|
@@ -67,6 +69,9 @@ const ChildTemplate = {
|
|
|
67
69
|
textColor: 'default',
|
|
68
70
|
fontWeight: 'normal',
|
|
69
71
|
textTransform: 'none'
|
|
72
|
+
},
|
|
73
|
+
width: {
|
|
74
|
+
desktop: '100%'
|
|
70
75
|
}
|
|
71
76
|
}
|
|
72
77
|
}
|
|
@@ -76,13 +76,6 @@ const CalloutTextSettings = [
|
|
|
76
76
|
type: 'text',
|
|
77
77
|
tooltip: 'Align right',
|
|
78
78
|
iconName: 'polaris-text-align-right'
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
label: 'Justify',
|
|
82
|
-
value: 'justify',
|
|
83
|
-
type: 'text',
|
|
84
|
-
tooltip: 'Align justify',
|
|
85
|
-
iconName: 'gp-text-align-justify'
|
|
86
79
|
}
|
|
87
80
|
],
|
|
88
81
|
default: 'left'
|
|
@@ -88,7 +88,7 @@ const config = {
|
|
|
88
88
|
hideUnit: false,
|
|
89
89
|
devices: {
|
|
90
90
|
desktop: {
|
|
91
|
-
default:
|
|
91
|
+
default: '500px'
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
94
|
displayOptions: [
|
|
@@ -144,7 +144,7 @@ const config = {
|
|
|
144
144
|
tooltip: 'Align right'
|
|
145
145
|
}
|
|
146
146
|
],
|
|
147
|
-
default: '
|
|
147
|
+
default: 'left'
|
|
148
148
|
},
|
|
149
149
|
{
|
|
150
150
|
id: 'enableBorder',
|
|
@@ -41,39 +41,51 @@ const ImagePostPurchaseSettingV2 = [
|
|
|
41
41
|
type: 'select',
|
|
42
42
|
default: 'auto',
|
|
43
43
|
options: [
|
|
44
|
-
{
|
|
45
|
-
label: 'Original',
|
|
46
|
-
value: 'auto'
|
|
47
|
-
},
|
|
48
44
|
{
|
|
49
45
|
label: 'Square',
|
|
50
46
|
value: '1',
|
|
51
47
|
type: 'image-shape',
|
|
52
|
-
icon: 'image-shape-square'
|
|
48
|
+
icon: 'gp-image-shape-square'
|
|
53
49
|
},
|
|
54
50
|
{
|
|
55
51
|
label: 'Vertical',
|
|
56
52
|
value: '3/4',
|
|
57
53
|
type: 'image-shape',
|
|
58
|
-
icon: 'image-shape-vertical'
|
|
54
|
+
icon: 'gp-image-shape-vertical'
|
|
59
55
|
},
|
|
60
56
|
{
|
|
61
57
|
label: 'Horizontal',
|
|
62
58
|
value: '4/3',
|
|
63
59
|
type: 'image-shape',
|
|
64
|
-
icon: 'image-shape-horizontal'
|
|
60
|
+
icon: 'gp-image-shape-horizontal'
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
label: 'Original',
|
|
64
|
+
value: 'auto'
|
|
65
65
|
}
|
|
66
66
|
]
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
id: 'width',
|
|
70
|
-
type: 'input
|
|
70
|
+
type: 'dropdown:input',
|
|
71
71
|
label: 'Width',
|
|
72
|
-
|
|
72
|
+
inputType: 'number',
|
|
73
73
|
units: [
|
|
74
74
|
'px',
|
|
75
75
|
'%'
|
|
76
76
|
],
|
|
77
|
+
displayOptions: [
|
|
78
|
+
{
|
|
79
|
+
label: 'Full',
|
|
80
|
+
value: '100%',
|
|
81
|
+
showValue: true
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
label: 'Default',
|
|
85
|
+
value: '1200px',
|
|
86
|
+
showValue: true
|
|
87
|
+
}
|
|
88
|
+
],
|
|
77
89
|
devices: {
|
|
78
90
|
desktop: {
|
|
79
91
|
default: '500px'
|
|
@@ -128,21 +140,21 @@ const ImagePostPurchaseSettingV2 = [
|
|
|
128
140
|
iconName: 'gp-align-right'
|
|
129
141
|
}
|
|
130
142
|
],
|
|
131
|
-
default: '
|
|
143
|
+
default: 'left'
|
|
132
144
|
},
|
|
133
145
|
{
|
|
134
146
|
id: 'enableBorder',
|
|
135
|
-
type: '
|
|
147
|
+
type: 'segment',
|
|
136
148
|
default: 'none',
|
|
137
149
|
options: [
|
|
138
150
|
{
|
|
139
|
-
label: 'None',
|
|
140
151
|
value: 'none',
|
|
152
|
+
iconName: 'gp-cursor-none',
|
|
141
153
|
type: 'border'
|
|
142
154
|
},
|
|
143
155
|
{
|
|
144
|
-
label: 'Solid',
|
|
145
156
|
value: 'solid',
|
|
157
|
+
iconName: 'gp-line',
|
|
146
158
|
type: 'border'
|
|
147
159
|
}
|
|
148
160
|
]
|
|
@@ -34,14 +34,19 @@ const PostPurchaseLinkSettings = [
|
|
|
34
34
|
},
|
|
35
35
|
displayOptions: [
|
|
36
36
|
{
|
|
37
|
-
label: '
|
|
38
|
-
value: '
|
|
37
|
+
label: 'Fit content',
|
|
38
|
+
value: 'Auto',
|
|
39
39
|
showValue: true
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
label: 'Default',
|
|
43
43
|
value: '1200px',
|
|
44
44
|
showValue: true
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: 'Full',
|
|
48
|
+
value: '100%',
|
|
49
|
+
showValue: true
|
|
45
50
|
}
|
|
46
51
|
]
|
|
47
52
|
}
|
|
@@ -146,7 +146,6 @@ const ProductVariantsSettingUIV2 = [
|
|
|
146
146
|
]
|
|
147
147
|
},
|
|
148
148
|
{
|
|
149
|
-
conditionDisplay: "width !== '100%'",
|
|
150
149
|
controls: [
|
|
151
150
|
{
|
|
152
151
|
label: {
|
|
@@ -155,8 +154,11 @@ const ProductVariantsSettingUIV2 = [
|
|
|
155
154
|
setting: {
|
|
156
155
|
id: 'align'
|
|
157
156
|
},
|
|
157
|
+
conditionEnable: '!(parseInt(width) == 100 && width?.includes("%"))',
|
|
158
158
|
options: {
|
|
159
|
-
labelVariant: 'primary'
|
|
159
|
+
labelVariant: 'primary',
|
|
160
|
+
fullWidth: true,
|
|
161
|
+
disableMessage: `Horizontal alignment is disabled when the width is set to 100% or greater`
|
|
160
162
|
}
|
|
161
163
|
}
|
|
162
164
|
]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import Button from '../../../button/components/v2/ButtonV2.js';
|
|
4
|
+
import '@gem-sdk/core';
|
|
5
|
+
import 'next/link';
|
|
6
|
+
import 'react';
|
|
7
|
+
|
|
8
|
+
const DynamicCheckout = ({ builderProps, builderAttrs, style, styles, advanced, setting })=>{
|
|
9
|
+
const { ...buttonStyles } = styles ?? {};
|
|
10
|
+
const label = setting?.label || 'Buy it now';
|
|
11
|
+
return /*#__PURE__*/ jsx(Button, {
|
|
12
|
+
builderProps: builderProps,
|
|
13
|
+
builderAttrs: builderAttrs,
|
|
14
|
+
advanced: advanced,
|
|
15
|
+
setting: {
|
|
16
|
+
label: label,
|
|
17
|
+
htmlType: 'button'
|
|
18
|
+
},
|
|
19
|
+
style: style,
|
|
20
|
+
styles: buttonStyles
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { DynamicCheckout as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Button from './components/Button.liquid.js';
|
|
2
|
+
|
|
3
|
+
const DynamicCheckout = ({ builderProps, styles, advanced, setting, pageContext })=>{
|
|
4
|
+
const { ...buttonStyles } = styles ?? {};
|
|
5
|
+
const label = setting?.label || 'Buy it now';
|
|
6
|
+
return Button({
|
|
7
|
+
builderProps,
|
|
8
|
+
className: '',
|
|
9
|
+
advanced,
|
|
10
|
+
setting: {
|
|
11
|
+
label: label,
|
|
12
|
+
htmlType: 'button'
|
|
13
|
+
},
|
|
14
|
+
styles: buttonStyles,
|
|
15
|
+
pageContext
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { DynamicCheckout as default };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { getGlobalColorStateClassDynamicBtn, genTypoClass, genSizeClass } from '@gem-sdk/core';
|
|
2
|
+
|
|
3
|
+
const getBaseClasses = (uid)=>({
|
|
4
|
+
'gp-block': true,
|
|
5
|
+
[`wrap__button--unbranded__${uid}`]: true,
|
|
6
|
+
[String.raw`[&_.shopify-payment-button\_\_button--unbranded]:gp-min-h-fit`]: true,
|
|
7
|
+
[String.raw`disabled:[&_.shopify-payment-button\_\_button--unbranded]:gp-pointer-events-none`]: true
|
|
8
|
+
});
|
|
9
|
+
const getTypographyClass = (typoType)=>{
|
|
10
|
+
if (!typoType) return {};
|
|
11
|
+
return {
|
|
12
|
+
[String.raw`[&_.shopify-payment-button\_\_button--unbranded]:!${genTypoClass(typoType)}`]: true
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
const getSpacingClass = (spacingType)=>{
|
|
16
|
+
if (!spacingType) return {};
|
|
17
|
+
return {
|
|
18
|
+
[String.raw`[&_.shopify-payment-button\_\_button--unbranded]:!${genSizeClass(spacingType)}`]: true
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
const getButtonClasses = ({ uid = '', styles })=>{
|
|
22
|
+
return {
|
|
23
|
+
...getBaseClasses(uid),
|
|
24
|
+
...getTypographyClass(styles?.typo?.type),
|
|
25
|
+
...getSpacingClass(styles?.btnSpacing?.type),
|
|
26
|
+
[getGlobalColorStateClassDynamicBtn('text', styles?.textColor)]: true
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { getButtonClasses };
|