@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
|
@@ -15,7 +15,7 @@ const ArticleList = ({ styles, setting, className, children, builderProps })=>{
|
|
|
15
15
|
const { articleSetting, numberOfArticle } = setting ?? {};
|
|
16
16
|
const { articleIds, articlePickType } = articleSetting ?? {};
|
|
17
17
|
const articlesQuery = {
|
|
18
|
-
first:
|
|
18
|
+
first: articleIds?.length ?? 50,
|
|
19
19
|
where: {
|
|
20
20
|
baseIDIn: [
|
|
21
21
|
...articleSetting?.articleIds ?? []
|
|
@@ -23,7 +23,7 @@ var getSrcSet = require('../../image/helpers/getSrcSet.js');
|
|
|
23
23
|
var common$1 = require('../../video/helpers/common.js');
|
|
24
24
|
require('react-youtube');
|
|
25
25
|
require('../../image/components/AdaptiveImage.js');
|
|
26
|
-
require('../../cart/components/ShopPayButton/
|
|
26
|
+
require('../../cart/components/ShopPayButton/ShopPayButton.js');
|
|
27
27
|
require('../../countdown-timer/setting/configs/settings.js');
|
|
28
28
|
require('../../header/components/Header.js');
|
|
29
29
|
require('../../header/components/kind/basic/index.js');
|
package/dist/cjs/builder.js
CHANGED
|
@@ -140,7 +140,7 @@ var CartDiscount = require('./cart/components/CartDiscount.js');
|
|
|
140
140
|
var CartOrderNote = require('./cart/components/CartOrderNote.js');
|
|
141
141
|
var CartLineAttribute = require('./cart/components/CartLineAttribute.js');
|
|
142
142
|
var CouponList = require('./cart/components/CouponList.js');
|
|
143
|
-
var
|
|
143
|
+
var ShopPayButton = require('./cart/components/ShopPayButton/ShopPayButton.js');
|
|
144
144
|
var CheckoutNow = require('./cart/components/CheckoutNow.js');
|
|
145
145
|
var CollectionTitle = require('./collection/components/CollectionTitle.js');
|
|
146
146
|
var CollectionBanner = require('./collection/components/CollectionBanner.js');
|
|
@@ -155,8 +155,8 @@ var Section = require('./grid/section/Section.js');
|
|
|
155
155
|
var Root = require('./grid/components/Root.js');
|
|
156
156
|
var Heading = require('./heading/Heading.js');
|
|
157
157
|
var Header = require('./header/components/Header.js');
|
|
158
|
-
var index
|
|
159
|
-
var index$
|
|
158
|
+
var index = require('./header/components/kind/basic/index.js');
|
|
159
|
+
var index$1 = require('./header/components/kind/modern/index.js');
|
|
160
160
|
var MobileMenu = require('./header/components/kind/basic/MobileMenu.js');
|
|
161
161
|
var DesktopMenu = require('./header/components/kind/basic/DesktopMenu.js');
|
|
162
162
|
var Icon = require('./icon/components/Icon.js');
|
|
@@ -172,7 +172,7 @@ var Pagination = require('./pagination/Pagination.js');
|
|
|
172
172
|
require('./estimate-delivery/setting/configs/settings.js');
|
|
173
173
|
var EstimateDate = require('./estimate-delivery/components/EstimateDate.js');
|
|
174
174
|
var ProductTitle = require('./post-purchase/product/components/ProductTitle.js');
|
|
175
|
-
var ProductDescription
|
|
175
|
+
var ProductDescription = require('./post-purchase/product/components/ProductDescription.js');
|
|
176
176
|
var ProductPrice$1 = require('./post-purchase/product/components/ProductPrice.js');
|
|
177
177
|
var AcceptButton = require('./post-purchase/product/components/AcceptButton.js');
|
|
178
178
|
var ProductQuantity$1 = require('./post-purchase/product/components/ProductQuantity.js');
|
|
@@ -182,9 +182,9 @@ var ProductDiscountTag = require('./post-purchase/product/components/ProductDisc
|
|
|
182
182
|
var index$7 = require('./post-purchase/product/components/product-image/index.js');
|
|
183
183
|
var ProductVariant = require('./post-purchase/product/components/product-variant/components/ProductVariant.js');
|
|
184
184
|
var Product = require('./product/components/Product.js');
|
|
185
|
-
var index$
|
|
185
|
+
var index$2 = require('./product/components/ProductTitle/index.js');
|
|
186
186
|
var ProductQuantity = require('./product/components/ProductQuantity.js');
|
|
187
|
-
var
|
|
187
|
+
var index$3 = require('./product/components/ProductDescription/index.js');
|
|
188
188
|
var ProductPrice = require('./product/components/ProductPrice.js');
|
|
189
189
|
var ProductButton = require('./product/components/ProductButton.js');
|
|
190
190
|
var index$4 = require('./product/components/ProductVariants/index.js');
|
|
@@ -194,7 +194,7 @@ var ProductProperties = require('./product/components/ProductProperties.js');
|
|
|
194
194
|
var index$5 = require('./product/components/ProductQuickView/index.js');
|
|
195
195
|
var ProductTag = require('./product/components/ProductTag.js');
|
|
196
196
|
var ProductList = require('./product/components/ProductList.js');
|
|
197
|
-
var DynamicCheckout = require('./product/components/DynamicCheckout.js');
|
|
197
|
+
var DynamicCheckout = require('./product/components/DynamicCheckout/DynamicCheckout.js');
|
|
198
198
|
var ProductBundleDiscount = require('./product/components/ProductBundleDiscount.js');
|
|
199
199
|
var ProductBundleDiscountItem = require('./product/components/ProductBundleDiscountItem.js');
|
|
200
200
|
var Vendor = require('./product/components/Vendor.js');
|
|
@@ -343,7 +343,7 @@ var builder = {
|
|
|
343
343
|
CartOrderNote: CartOrderNote.default,
|
|
344
344
|
CartLineAttribute: CartLineAttribute.default,
|
|
345
345
|
CouponList: CouponList.default,
|
|
346
|
-
ShopPayButton:
|
|
346
|
+
ShopPayButton: ShopPayButton.default,
|
|
347
347
|
CheckoutNow: CheckoutNow.default,
|
|
348
348
|
CollectionTitle: CollectionTitle.default,
|
|
349
349
|
CollectionDescription: CollectionDescription.default,
|
|
@@ -357,8 +357,8 @@ var builder = {
|
|
|
357
357
|
Root: Root.default,
|
|
358
358
|
Heading: Heading.default,
|
|
359
359
|
Header: Header.default,
|
|
360
|
-
BasicHeader: index
|
|
361
|
-
ModernHeader: index$
|
|
360
|
+
BasicHeader: index.default,
|
|
361
|
+
ModernHeader: index$1.default,
|
|
362
362
|
MobileMenu: MobileMenu.default,
|
|
363
363
|
DesktopMenu: DesktopMenu.default,
|
|
364
364
|
Icon: Icon.default,
|
|
@@ -371,7 +371,7 @@ var builder = {
|
|
|
371
371
|
Modal: Modal.default,
|
|
372
372
|
Pagination: Pagination.default,
|
|
373
373
|
Product: Product.default,
|
|
374
|
-
ProductTitle: index$
|
|
374
|
+
ProductTitle: index$2.default,
|
|
375
375
|
ProductQuantity: ProductQuantity.default,
|
|
376
376
|
ProductPrice: ProductPrice.default,
|
|
377
377
|
ProductSku: Sku.default,
|
|
@@ -379,7 +379,7 @@ var builder = {
|
|
|
379
379
|
ProductBundleDiscount: ProductBundleDiscount.default,
|
|
380
380
|
ProductBundleDiscountItem: ProductBundleDiscountItem.default,
|
|
381
381
|
ProductButton: ProductButton.default,
|
|
382
|
-
ProductDescription:
|
|
382
|
+
ProductDescription: index$3.default,
|
|
383
383
|
ProductVariants: index$4.default,
|
|
384
384
|
ProductImages: ProductImages.default,
|
|
385
385
|
ProductImagesV2: ProductImages$1.default,
|
|
@@ -469,7 +469,7 @@ var builder = {
|
|
|
469
469
|
PostPurchaseText: Text$1.default,
|
|
470
470
|
PostPurchaseImage: Image$1.default,
|
|
471
471
|
PostPurchaseButton: Button.default,
|
|
472
|
-
PostPurchaseProductDescription: ProductDescription
|
|
472
|
+
PostPurchaseProductDescription: ProductDescription.default,
|
|
473
473
|
PostPurchaseProductPrice: ProductPrice$1.default,
|
|
474
474
|
PostPurchaseProductTitle: ProductTitle.default,
|
|
475
475
|
PostPurchaseProductVariants: ProductVariant.default,
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var system = require('@gem-sdk/system');
|
|
8
|
+
var dynamic = require('next/dynamic');
|
|
9
|
+
var classes = require('./common/classes.js');
|
|
10
|
+
var helpers = require('./common/helpers.js');
|
|
11
|
+
var styles = require('./common/styles.js');
|
|
12
|
+
var useShopPayButton = require('./hooks/useShopPayButton.js');
|
|
13
|
+
|
|
14
|
+
const DynamicCheckoutBlack = dynamic(()=>Promise.resolve().then(function () { return require('./icons/DynamicCheckoutBlack.js'); }));
|
|
15
|
+
const DynamicCheckoutPurple = dynamic(()=>Promise.resolve().then(function () { return require('./icons/DynamicCheckoutPurple.js'); }));
|
|
16
|
+
const DynamicCheckoutWhite = dynamic(()=>Promise.resolve().then(function () { return require('./icons/DynamicCheckoutWhite.js'); }));
|
|
17
|
+
const ExpressCheckoutBlack = dynamic(()=>Promise.resolve().then(function () { return require('./icons/ExpressCheckoutBlack.js'); }));
|
|
18
|
+
const ExpressCheckoutPurple = dynamic(()=>Promise.resolve().then(function () { return require('./icons/ExpressCheckoutPurple.js'); }));
|
|
19
|
+
const ExpressCheckoutWhite = dynamic(()=>Promise.resolve().then(function () { return require('./icons/ExpressCheckoutWhite.js'); }));
|
|
20
|
+
/**
|
|
21
|
+
* The `ShopPayButton` component renders a button that redirects to the Shop Pay checkout.
|
|
22
|
+
*/ const ShopPayButton = ({ style, styles: styles$1, setting, className, builderAttrs })=>{
|
|
23
|
+
const { variants, storeUrl, handleOnPay } = useShopPayButton.useShopPayButton(setting);
|
|
24
|
+
if (!storeUrl) {
|
|
25
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
26
|
+
...builderAttrs,
|
|
27
|
+
children: "URL Not Found"
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
const SPButton = helpers.getSPButton({
|
|
31
|
+
styles: styles$1,
|
|
32
|
+
buttons: {
|
|
33
|
+
DynamicCheckoutBlack,
|
|
34
|
+
DynamicCheckoutPurple,
|
|
35
|
+
DynamicCheckoutWhite,
|
|
36
|
+
ExpressCheckoutBlack,
|
|
37
|
+
ExpressCheckoutPurple,
|
|
38
|
+
ExpressCheckoutWhite
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
const buttonWrapperStyles = system.createStyle({
|
|
42
|
+
...styles.getButtonWrapperStyles(style, styles$1)
|
|
43
|
+
});
|
|
44
|
+
const buttonClasses = system.createClass({
|
|
45
|
+
...classes.getButtonClasses()
|
|
46
|
+
});
|
|
47
|
+
const buttonWrapperClasses = system.createClass({
|
|
48
|
+
...classes.getButtonWrapperClasses(className)
|
|
49
|
+
});
|
|
50
|
+
const buttonAttributes = system.createAttr({
|
|
51
|
+
disabled: !variants?.length,
|
|
52
|
+
'aria-label': 'Buy with Shop Pay'
|
|
53
|
+
});
|
|
54
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
55
|
+
...builderAttrs,
|
|
56
|
+
style: buttonWrapperStyles,
|
|
57
|
+
className: buttonWrapperClasses,
|
|
58
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
59
|
+
...buttonAttributes,
|
|
60
|
+
className: buttonClasses,
|
|
61
|
+
onClick: ()=>handleOnPay({
|
|
62
|
+
inputWidth: 600,
|
|
63
|
+
inputHeight: 600
|
|
64
|
+
}),
|
|
65
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(SPButton, {})
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
exports.default = ShopPayButton;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var core = require('@gem-sdk/core');
|
|
6
|
+
var system = require('@gem-sdk/system');
|
|
7
|
+
var helpers$1 = require('../../../helpers.js');
|
|
8
|
+
var classes = require('./common/classes.js');
|
|
9
|
+
var helpers = require('./common/helpers.js');
|
|
10
|
+
var styles = require('./common/styles.js');
|
|
11
|
+
var DynamicCheckoutBlack_liquid = require('./icons/DynamicCheckoutBlack.liquid.js');
|
|
12
|
+
var DynamicCheckoutPurple_liquid = require('./icons/DynamicCheckoutPurple.liquid.js');
|
|
13
|
+
var DynamicCheckoutWhite_liquid = require('./icons/DynamicCheckoutWhite.liquid.js');
|
|
14
|
+
var ExpressCheckoutBlack_liquid = require('./icons/ExpressCheckoutBlack.liquid.js');
|
|
15
|
+
var ExpressCheckoutPurple_liquid = require('./icons/ExpressCheckoutPurple.liquid.js');
|
|
16
|
+
var ExpressCheckoutWhite_liquid = require('./icons/ExpressCheckoutWhite.liquid.js');
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The `ShopPayButton` component renders a button that redirects to the Shop Pay checkout.
|
|
20
|
+
*/ const ShopPayButton = ({ style, styles: styles$1, setting, className, builderAttrs })=>{
|
|
21
|
+
const SPButton = helpers.getSPButton({
|
|
22
|
+
styles: styles$1,
|
|
23
|
+
buttons: {
|
|
24
|
+
DynamicCheckoutBlack: DynamicCheckoutBlack_liquid.default({}),
|
|
25
|
+
DynamicCheckoutPurple: DynamicCheckoutPurple_liquid.default({}),
|
|
26
|
+
DynamicCheckoutWhite: DynamicCheckoutWhite_liquid.default({}),
|
|
27
|
+
ExpressCheckoutBlack: ExpressCheckoutBlack_liquid.default({}),
|
|
28
|
+
ExpressCheckoutPurple: ExpressCheckoutPurple_liquid.default({}),
|
|
29
|
+
ExpressCheckoutWhite: ExpressCheckoutWhite_liquid.default({})
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const buttonWrapperStyles = system.createStyle({
|
|
33
|
+
...styles.getButtonWrapperStyles(style, styles$1)
|
|
34
|
+
});
|
|
35
|
+
const buttonClasses = system.createClass({
|
|
36
|
+
...classes.getButtonClasses()
|
|
37
|
+
});
|
|
38
|
+
const buttonWrapperClasses = system.createClass({
|
|
39
|
+
...classes.getButtonWrapperClasses(className)
|
|
40
|
+
});
|
|
41
|
+
const buttonAttributes = system.createAttr({
|
|
42
|
+
disabled: false,
|
|
43
|
+
'aria-label': 'Buy with Shop Pay'
|
|
44
|
+
});
|
|
45
|
+
const buttonState = system.createStateOrContext({
|
|
46
|
+
setting: JSON.stringify(setting),
|
|
47
|
+
shop_url: '{{shop.url}}'
|
|
48
|
+
});
|
|
49
|
+
return core.template`
|
|
50
|
+
<gp-shop-pay-button
|
|
51
|
+
${{
|
|
52
|
+
...builderAttrs
|
|
53
|
+
}}
|
|
54
|
+
style="${buttonWrapperStyles}"
|
|
55
|
+
class="${buttonWrapperClasses}"
|
|
56
|
+
gp-data='${buttonState}'
|
|
57
|
+
>
|
|
58
|
+
<button
|
|
59
|
+
${{
|
|
60
|
+
...buttonAttributes
|
|
61
|
+
}}
|
|
62
|
+
class="${buttonClasses}"
|
|
63
|
+
>
|
|
64
|
+
${SPButton}
|
|
65
|
+
</button>
|
|
66
|
+
</gp-shop-pay-button>
|
|
67
|
+
${system.If(core.isLocalEnv, `<script ${helpers$1.getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-shop-pay-button.js' | asset_url }}" defer="defer"></script>`, `<script ${helpers$1.getSettingPreloadData('class="gps-link" delay', 'src')}="${core.baseAssetURL}/assets-v2/gp-shop-pay-button.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
68
|
+
`;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
exports.default = ShopPayButton;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const getButtonWrapperClasses = (className)=>{
|
|
4
|
+
return {
|
|
5
|
+
...className && {
|
|
6
|
+
[className]: true
|
|
7
|
+
},
|
|
8
|
+
'gp-flex': true
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
const getButtonClasses = ()=>{
|
|
12
|
+
return {
|
|
13
|
+
'disabled:gp-cursor-not-allowed disabled:gp-opacity-50 gp-shop-button': true
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.getButtonClasses = getButtonClasses;
|
|
18
|
+
exports.getButtonWrapperClasses = getButtonWrapperClasses;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const getSPButton = ({ styles, buttons })=>{
|
|
4
|
+
const { DynamicCheckoutBlack, DynamicCheckoutWhite, DynamicCheckoutPurple, ExpressCheckoutBlack, ExpressCheckoutWhite, ExpressCheckoutPurple } = buttons;
|
|
5
|
+
if (styles?.type === 'dynamic') {
|
|
6
|
+
if (styles.color === 'black') return DynamicCheckoutBlack;
|
|
7
|
+
if (styles.color === 'purple') return DynamicCheckoutPurple;
|
|
8
|
+
return DynamicCheckoutWhite;
|
|
9
|
+
} else {
|
|
10
|
+
if (styles?.color === 'black') return ExpressCheckoutBlack;
|
|
11
|
+
if (styles?.color === 'purple') return ExpressCheckoutPurple;
|
|
12
|
+
return ExpressCheckoutWhite;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const getIdFromGid = (id)=>{
|
|
16
|
+
if (!id) return;
|
|
17
|
+
return id.split('/').at(-1);
|
|
18
|
+
};
|
|
19
|
+
const getStoreUrl = (url)=>{
|
|
20
|
+
if (!url) return;
|
|
21
|
+
try {
|
|
22
|
+
const data = new URL(url);
|
|
23
|
+
return data.origin;
|
|
24
|
+
} catch {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
exports.getIdFromGid = getIdFromGid;
|
|
30
|
+
exports.getSPButton = getSPButton;
|
|
31
|
+
exports.getStoreUrl = getStoreUrl;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var helpers = require('../common/helpers.js');
|
|
6
|
+
|
|
7
|
+
const useShopPayButton = (setting)=>{
|
|
8
|
+
const mode = core.useEditorMode();
|
|
9
|
+
const { quantity } = core.useQuantity();
|
|
10
|
+
const { data: cartData } = core.useCartData();
|
|
11
|
+
const currentVariant = core.useCurrentVariant();
|
|
12
|
+
const storefrontUrl = core.useShopStore((s)=>s.storefrontUrl);
|
|
13
|
+
const isCurrentVariantInStock = core.useCurrentVariantInStock();
|
|
14
|
+
const storeUrl = helpers.getStoreUrl(storefrontUrl);
|
|
15
|
+
const idsInCart = React.useMemo(()=>{
|
|
16
|
+
const items = cartData?.lineItems.map((v)=>({
|
|
17
|
+
id: v.variantId,
|
|
18
|
+
quantity: v.quantity
|
|
19
|
+
}))?.reduce((prev, curr)=>{
|
|
20
|
+
const bareId = helpers.getIdFromGid(curr?.id);
|
|
21
|
+
if (bareId) {
|
|
22
|
+
prev.push(`${bareId}:${curr?.quantity ?? 1}`);
|
|
23
|
+
}
|
|
24
|
+
return prev;
|
|
25
|
+
}, []);
|
|
26
|
+
return items;
|
|
27
|
+
}, [
|
|
28
|
+
cartData?.lineItems
|
|
29
|
+
]);
|
|
30
|
+
const variants = React.useMemo(()=>{
|
|
31
|
+
if (setting?.kind === 'cart-buy') {
|
|
32
|
+
return idsInCart;
|
|
33
|
+
}
|
|
34
|
+
if (currentVariant?.baseID && isCurrentVariantInStock && quantity) {
|
|
35
|
+
return [
|
|
36
|
+
`${helpers.getIdFromGid(currentVariant.baseID)}:${quantity}`
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
return undefined;
|
|
40
|
+
}, [
|
|
41
|
+
setting?.kind,
|
|
42
|
+
currentVariant?.baseID,
|
|
43
|
+
isCurrentVariantInStock,
|
|
44
|
+
quantity,
|
|
45
|
+
idsInCart
|
|
46
|
+
]);
|
|
47
|
+
const payUrl = `${storeUrl}/cart/${variants?.join(',')}?payment=shop_pay`;
|
|
48
|
+
const handleOnPay = ({ inputWidth = 600, inputHeight = 600 })=>{
|
|
49
|
+
if (mode === 'edit') return;
|
|
50
|
+
if (setting?.openMode === 'popup') {
|
|
51
|
+
const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : window.screenX;
|
|
52
|
+
const dualScreenTop = window.screenTop !== undefined ? window.screenTop : window.screenY;
|
|
53
|
+
const width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
|
|
54
|
+
const height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
|
|
55
|
+
const systemZoom = width / window.screen.availWidth;
|
|
56
|
+
const left = (width - inputWidth) / 2 / systemZoom + dualScreenLeft;
|
|
57
|
+
const top = (height - inputHeight) / 2 / systemZoom + dualScreenTop;
|
|
58
|
+
window.open(payUrl, 'shop_pay', `scrollbars=yes, width=${inputWidth / systemZoom}, height=${inputHeight / systemZoom}, top=${top}, left=${left}`);
|
|
59
|
+
} else {
|
|
60
|
+
!!payUrl && window.open(payUrl);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
return {
|
|
64
|
+
storeUrl,
|
|
65
|
+
variants,
|
|
66
|
+
handleOnPay
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
exports.useShopPayButton = useShopPayButton;
|
package/dist/cjs/cart/next.js
CHANGED
|
@@ -51,7 +51,7 @@ const CouponList = dynamic(()=>Promise.resolve().then(function () { return requi
|
|
|
51
51
|
const CheckoutNow = dynamic(()=>Promise.resolve().then(function () { return require('./components/CheckoutNow.js'); }), {
|
|
52
52
|
loading: Loading.default
|
|
53
53
|
});
|
|
54
|
-
const ShopPayButton = dynamic(()=>Promise.resolve().then(function () { return require('./components/ShopPayButton/
|
|
54
|
+
const ShopPayButton = dynamic(()=>Promise.resolve().then(function () { return require('./components/ShopPayButton/ShopPayButton.js'); }), {
|
|
55
55
|
ssr: false,
|
|
56
56
|
loading: Loading.default
|
|
57
57
|
});
|
|
@@ -20,7 +20,7 @@ require('@gem-sdk/keen-slider/react');
|
|
|
20
20
|
require('next/image');
|
|
21
21
|
require('react-youtube');
|
|
22
22
|
require('../../image/components/AdaptiveImage.js');
|
|
23
|
-
require('../../cart/components/ShopPayButton/
|
|
23
|
+
require('../../cart/components/ShopPayButton/ShopPayButton.js');
|
|
24
24
|
require('../../countdown-timer/setting/configs/settings.js');
|
|
25
25
|
require('../../header/components/Header.js');
|
|
26
26
|
require('../../header/components/kind/basic/index.js');
|
|
@@ -13,7 +13,7 @@ require('next/head');
|
|
|
13
13
|
require('next/image');
|
|
14
14
|
require('react-youtube');
|
|
15
15
|
var Image = require('../../../../image/components/Image.js');
|
|
16
|
-
require('../../../../cart/components/ShopPayButton/
|
|
16
|
+
require('../../../../cart/components/ShopPayButton/ShopPayButton.js');
|
|
17
17
|
var CheckoutNow = require('../../../../cart/components/CheckoutNow.js');
|
|
18
18
|
|
|
19
19
|
const MobileMenu = dynamic(()=>Promise.resolve().then(function () { return require('./MobileMenu.js'); }));
|
|
@@ -13,7 +13,7 @@ require('next/image');
|
|
|
13
13
|
require('react-youtube');
|
|
14
14
|
require('next/link');
|
|
15
15
|
require('../../../../image/components/AdaptiveImage.js');
|
|
16
|
-
require('../../../../cart/components/ShopPayButton/
|
|
16
|
+
require('../../../../cart/components/ShopPayButton/ShopPayButton.js');
|
|
17
17
|
|
|
18
18
|
const ModernHeader = (props)=>{
|
|
19
19
|
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
package/dist/cjs/index.js
CHANGED
|
@@ -13,7 +13,7 @@ var Coupon = require('./coupon/components/Coupon.js');
|
|
|
13
13
|
var index$4 = require('./carousel/setting/index.js');
|
|
14
14
|
var Carousel = require('./carousel/components/Carousel.js');
|
|
15
15
|
var CarouselItem = require('./carousel/components/CarouselItem.js');
|
|
16
|
-
var index$
|
|
16
|
+
var index$5 = require('./cart/setting/index.js');
|
|
17
17
|
var CartLineVariant = require('./cart/components/CartLineVariant.js');
|
|
18
18
|
var Cart = require('./cart/components/Cart.js');
|
|
19
19
|
var CartList = require('./cart/components/CartList.js');
|
|
@@ -27,50 +27,50 @@ var CartDiscount = require('./cart/components/CartDiscount.js');
|
|
|
27
27
|
var CartOrderNote = require('./cart/components/CartOrderNote.js');
|
|
28
28
|
var CartLineAttribute = require('./cart/components/CartLineAttribute.js');
|
|
29
29
|
var CouponList = require('./cart/components/CouponList.js');
|
|
30
|
-
var
|
|
30
|
+
var ShopPayButton = require('./cart/components/ShopPayButton/ShopPayButton.js');
|
|
31
31
|
var CheckoutNow = require('./cart/components/CheckoutNow.js');
|
|
32
|
-
var index$
|
|
32
|
+
var index$6 = require('./collection/setting/index.js');
|
|
33
33
|
var CollectionTitle = require('./collection/components/CollectionTitle.js');
|
|
34
34
|
var CollectionBanner = require('./collection/components/CollectionBanner.js');
|
|
35
35
|
var CollectionDescription = require('./collection/components/CollectionDescription.js');
|
|
36
36
|
var CollectionToolbar = require('./collection/components/CollectionToolbar.js');
|
|
37
37
|
var CollectionPaginator = require('./collection/components/CollectionPaginator.js');
|
|
38
|
-
var index$
|
|
38
|
+
var index$7 = require('./countdown-timer/setting/index.js');
|
|
39
39
|
var Countdown = require('./countdown-timer/components/Countdown.js');
|
|
40
|
-
var index$
|
|
40
|
+
var index$8 = require('./grid/setting/index.js');
|
|
41
41
|
var Col = require('./grid/col/Col.js');
|
|
42
42
|
var Row = require('./grid/row/Row.js');
|
|
43
43
|
var Section = require('./grid/section/Section.js');
|
|
44
44
|
var Root = require('./grid/components/Root.js');
|
|
45
|
-
var index$
|
|
45
|
+
var index$9 = require('./heading/setting/index.js');
|
|
46
46
|
var Heading = require('./heading/Heading.js');
|
|
47
|
-
var index$
|
|
47
|
+
var index$c = require('./header/setting/index.js');
|
|
48
48
|
var Header = require('./header/components/Header.js');
|
|
49
|
-
var index$
|
|
50
|
-
var index$
|
|
49
|
+
var index$a = require('./header/components/kind/basic/index.js');
|
|
50
|
+
var index$b = require('./header/components/kind/modern/index.js');
|
|
51
51
|
var MobileMenu = require('./header/components/kind/basic/MobileMenu.js');
|
|
52
52
|
var DesktopMenu = require('./header/components/kind/basic/DesktopMenu.js');
|
|
53
|
-
var index$
|
|
53
|
+
var index$d = require('./icon/setting/index.js');
|
|
54
54
|
var Icon = require('./icon/components/Icon.js');
|
|
55
|
-
var index$
|
|
55
|
+
var index$e = require('./image/setting/index.js');
|
|
56
56
|
var Image = require('./image/components/Image.js');
|
|
57
57
|
var BackgroundImage = require('./image/components/BackgroundImage.js');
|
|
58
|
-
var index$
|
|
58
|
+
var index$f = require('./input/setting/index.js');
|
|
59
59
|
var Input = require('./input/Input.js');
|
|
60
|
-
var index$
|
|
60
|
+
var index$g = require('./line/setting/index.js');
|
|
61
61
|
var Line = require('./line/Line.js');
|
|
62
|
-
var index$
|
|
62
|
+
var index$h = require('./link/setting/index.js');
|
|
63
63
|
var Link = require('./link/components/Link.js');
|
|
64
|
-
var index$
|
|
64
|
+
var index$i = require('./modal/setting/index.js');
|
|
65
65
|
var confirm = require('./modal/components/confirm.js');
|
|
66
66
|
var Modal = require('./modal/components/Modal.js');
|
|
67
|
-
var index$
|
|
67
|
+
var index$j = require('./pagination/setting/index.js');
|
|
68
68
|
var Pagination = require('./pagination/Pagination.js');
|
|
69
69
|
var index$p = require('./product/setting/index.js');
|
|
70
70
|
var Product = require('./product/components/Product.js');
|
|
71
|
-
var index$
|
|
71
|
+
var index$k = require('./product/components/ProductTitle/index.js');
|
|
72
72
|
var ProductQuantity = require('./product/components/ProductQuantity.js');
|
|
73
|
-
var
|
|
73
|
+
var index$l = require('./product/components/ProductDescription/index.js');
|
|
74
74
|
var ProductPrice = require('./product/components/ProductPrice.js');
|
|
75
75
|
var ProductButton = require('./product/components/ProductButton.js');
|
|
76
76
|
var index$m = require('./product/components/ProductVariants/index.js');
|
|
@@ -80,7 +80,7 @@ var ProductProperties = require('./product/components/ProductProperties.js');
|
|
|
80
80
|
var index$n = require('./product/components/ProductQuickView/index.js');
|
|
81
81
|
var ProductTag = require('./product/components/ProductTag.js');
|
|
82
82
|
var ProductList = require('./product/components/ProductList.js');
|
|
83
|
-
var DynamicCheckout = require('./product/components/DynamicCheckout.js');
|
|
83
|
+
var DynamicCheckout = require('./product/components/DynamicCheckout/DynamicCheckout.js');
|
|
84
84
|
var ProductBundleDiscount = require('./product/components/ProductBundleDiscount.js');
|
|
85
85
|
var ProductBundleDiscountItem = require('./product/components/ProductBundleDiscountItem.js');
|
|
86
86
|
var Vendor = require('./product/components/Vendor.js');
|
|
@@ -269,7 +269,7 @@ var product2Col = require('./post-purchase/product/settings/presets-config/produ
|
|
|
269
269
|
var productDefault = require('./post-purchase/product/settings/presets-config/product-presets/product-default.js');
|
|
270
270
|
var index$R = require('./post-purchase/product/settings/index.js');
|
|
271
271
|
var ProductTitle = require('./post-purchase/product/components/ProductTitle.js');
|
|
272
|
-
var ProductDescription
|
|
272
|
+
var ProductDescription = require('./post-purchase/product/components/ProductDescription.js');
|
|
273
273
|
var ProductPrice$1 = require('./post-purchase/product/components/ProductPrice.js');
|
|
274
274
|
var AcceptButton = require('./post-purchase/product/components/AcceptButton.js');
|
|
275
275
|
var ProductQuantity$1 = require('./post-purchase/product/components/ProductQuantity.js');
|
|
@@ -334,7 +334,7 @@ exports.Coupon = Coupon.default;
|
|
|
334
334
|
exports.carouselSetting = index$4.default;
|
|
335
335
|
exports.Carousel = Carousel.default;
|
|
336
336
|
exports.CarouselItem = CarouselItem.default;
|
|
337
|
-
exports.cartSetting = index$
|
|
337
|
+
exports.cartSetting = index$5.default;
|
|
338
338
|
exports.CartLineVariant = CartLineVariant.default;
|
|
339
339
|
exports.Cart = Cart.default;
|
|
340
340
|
exports.CartList = CartList.default;
|
|
@@ -348,50 +348,50 @@ exports.CartDiscount = CartDiscount.default;
|
|
|
348
348
|
exports.CartOrderNote = CartOrderNote.default;
|
|
349
349
|
exports.CartLineAttribute = CartLineAttribute.default;
|
|
350
350
|
exports.CouponList = CouponList.default;
|
|
351
|
-
exports.ShopPayButton =
|
|
351
|
+
exports.ShopPayButton = ShopPayButton.default;
|
|
352
352
|
exports.CheckoutNow = CheckoutNow.default;
|
|
353
|
-
exports.collectionSetting = index$
|
|
353
|
+
exports.collectionSetting = index$6.default;
|
|
354
354
|
exports.CollectionTitle = CollectionTitle.default;
|
|
355
355
|
exports.CollectionBanner = CollectionBanner.default;
|
|
356
356
|
exports.CollectionDescription = CollectionDescription.default;
|
|
357
357
|
exports.CollectionToolbar = CollectionToolbar.default;
|
|
358
358
|
exports.CollectionPaginator = CollectionPaginator.default;
|
|
359
|
-
exports.countdownSetting = index$
|
|
359
|
+
exports.countdownSetting = index$7.default;
|
|
360
360
|
exports.Countdown = Countdown.default;
|
|
361
|
-
exports.gridSetting = index$
|
|
361
|
+
exports.gridSetting = index$8.default;
|
|
362
362
|
exports.Col = Col.default;
|
|
363
363
|
exports.Row = Row.default;
|
|
364
364
|
exports.Section = Section.default;
|
|
365
365
|
exports.Root = Root.default;
|
|
366
|
-
exports.headingSetting = index$
|
|
366
|
+
exports.headingSetting = index$9.default;
|
|
367
367
|
exports.Heading = Heading.default;
|
|
368
|
-
exports.headerSetting = index$
|
|
368
|
+
exports.headerSetting = index$c.default;
|
|
369
369
|
exports.Header = Header.default;
|
|
370
|
-
exports.BasicHeader = index$
|
|
371
|
-
exports.ModernHeader = index$
|
|
370
|
+
exports.BasicHeader = index$a.default;
|
|
371
|
+
exports.ModernHeader = index$b.default;
|
|
372
372
|
exports.MobileMenu = MobileMenu.default;
|
|
373
373
|
exports.DesktopMenu = DesktopMenu.default;
|
|
374
|
-
exports.iconSetting = index$
|
|
374
|
+
exports.iconSetting = index$d.default;
|
|
375
375
|
exports.Icon = Icon.default;
|
|
376
|
-
exports.imageSetting = index$
|
|
376
|
+
exports.imageSetting = index$e.default;
|
|
377
377
|
exports.Image = Image.default;
|
|
378
378
|
exports.BackgroundImage = BackgroundImage.default;
|
|
379
|
-
exports.inputSetting = index$
|
|
379
|
+
exports.inputSetting = index$f.default;
|
|
380
380
|
exports.Input = Input.default;
|
|
381
|
-
exports.lineSetting = index$
|
|
381
|
+
exports.lineSetting = index$g.default;
|
|
382
382
|
exports.Line = Line.default;
|
|
383
|
-
exports.linkSetting = index$
|
|
383
|
+
exports.linkSetting = index$h.default;
|
|
384
384
|
exports.Link = Link.default;
|
|
385
|
-
exports.modalSetting = index$
|
|
385
|
+
exports.modalSetting = index$i.default;
|
|
386
386
|
exports.openConfirm = confirm.openConfirm;
|
|
387
387
|
exports.Modal = Modal.default;
|
|
388
|
-
exports.paginationSetting = index$
|
|
388
|
+
exports.paginationSetting = index$j.default;
|
|
389
389
|
exports.Pagination = Pagination.default;
|
|
390
390
|
exports.productSetting = index$p.default;
|
|
391
391
|
exports.Product = Product.default;
|
|
392
|
-
exports.ProductTitle = index$
|
|
392
|
+
exports.ProductTitle = index$k.default;
|
|
393
393
|
exports.ProductQuantity = ProductQuantity.default;
|
|
394
|
-
exports.ProductDescription =
|
|
394
|
+
exports.ProductDescription = index$l.default;
|
|
395
395
|
exports.ProductPrice = ProductPrice.default;
|
|
396
396
|
exports.ProductButton = ProductButton.default;
|
|
397
397
|
exports.ProductVariants = index$m.default;
|
|
@@ -590,7 +590,7 @@ exports.postPurchaseProduct2Col = product2Col.postPurchaseProduct2Col;
|
|
|
590
590
|
exports.postPurchaseProductDefault = productDefault.postPurchaseProductDefault;
|
|
591
591
|
exports.postPurchaseProductSetting = index$R.default;
|
|
592
592
|
exports.PostPurchaseProductTitle = ProductTitle.default;
|
|
593
|
-
exports.PostPurchaseProductDescription = ProductDescription
|
|
593
|
+
exports.PostPurchaseProductDescription = ProductDescription.default;
|
|
594
594
|
exports.PostPurchaseProductPrice = ProductPrice$1.default;
|
|
595
595
|
exports.PostPurchaseAcceptButton = AcceptButton.default;
|
|
596
596
|
exports.PostPurchaseProductQuantity = ProductQuantity$1.default;
|