pb-sxp-ui 1.20.18 → 1.20.19
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/index.cjs +725 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +291 -0
- package/dist/index.js +725 -26
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +44 -5
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +44 -5
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +725 -26
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +44 -5
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/index.d.ts +2 -0
- package/es/core/context/SxpDataSourceProvider.d.ts +1 -1
- package/es/materials/sxp/popup/AddToCart/index.d.ts +33 -0
- package/es/materials/sxp/popup/AddToCart/index.js +279 -0
- package/es/materials/sxp/popup/AddToCart/interactionRender.d.ts +3 -0
- package/es/materials/sxp/popup/AddToCart/interactionRender.js +11 -0
- package/es/materials/sxp/popup/AddToCart/material.d.ts +2 -0
- package/es/materials/sxp/popup/AddToCart/material.js +75 -0
- package/es/materials/sxp/popup/AddToCart/settingRender.d.ts +160 -0
- package/es/materials/sxp/popup/AddToCart/settingRender.js +277 -0
- package/es/materials/sxp/popup/CommodityDetail/index.d.ts +2 -0
- package/es/materials/sxp/popup/CommodityDetail/index.js +19 -2
- package/es/materials/sxp/popup/CommodityDetail/settingRender.d.ts +13 -0
- package/es/materials/sxp/popup/CommodityDetail/settingRender.js +16 -0
- package/es/materials/sxp/popup/index.d.ts +1 -0
- package/es/materials/sxp/popup/index.js +1 -0
- package/lib/core/components/SxpPageRender/index.d.ts +2 -0
- package/lib/core/context/SxpDataSourceProvider.d.ts +1 -1
- package/lib/materials/sxp/popup/AddToCart/index.d.ts +33 -0
- package/lib/materials/sxp/popup/AddToCart/index.js +281 -0
- package/lib/materials/sxp/popup/AddToCart/interactionRender.d.ts +3 -0
- package/lib/materials/sxp/popup/AddToCart/interactionRender.js +14 -0
- package/lib/materials/sxp/popup/AddToCart/material.d.ts +2 -0
- package/lib/materials/sxp/popup/AddToCart/material.js +79 -0
- package/lib/materials/sxp/popup/AddToCart/settingRender.d.ts +160 -0
- package/lib/materials/sxp/popup/AddToCart/settingRender.js +279 -0
- package/lib/materials/sxp/popup/CommodityDetail/index.d.ts +2 -0
- package/lib/materials/sxp/popup/CommodityDetail/index.js +19 -2
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.d.ts +13 -0
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.js +16 -0
- package/lib/materials/sxp/popup/index.d.ts +1 -0
- package/lib/materials/sxp/popup/index.js +1 -0
- package/package.json +1 -1
package/dist/pb-ui.js
CHANGED
|
@@ -2781,7 +2781,7 @@
|
|
|
2781
2781
|
StructurePage: StructurePage
|
|
2782
2782
|
});
|
|
2783
2783
|
|
|
2784
|
-
var interactionRender$
|
|
2784
|
+
var interactionRender$i = [
|
|
2785
2785
|
{
|
|
2786
2786
|
title: '点击事件',
|
|
2787
2787
|
child: [
|
|
@@ -2801,7 +2801,7 @@
|
|
|
2801
2801
|
* @FilePath: \pb-sxp-ui\src\materials\sxp\popup\AppointForm\settingRender.tsx
|
|
2802
2802
|
*
|
|
2803
2803
|
*/
|
|
2804
|
-
var settingRender$
|
|
2804
|
+
var settingRender$g = [
|
|
2805
2805
|
{
|
|
2806
2806
|
title: '弹窗背景',
|
|
2807
2807
|
child: [
|
|
@@ -3238,9 +3238,9 @@
|
|
|
3238
3238
|
category: 'popup',
|
|
3239
3239
|
type: 'AppointForm',
|
|
3240
3240
|
related: {
|
|
3241
|
-
settingRender: settingRender$
|
|
3241
|
+
settingRender: settingRender$g,
|
|
3242
3242
|
bindableProps: [],
|
|
3243
|
-
interactionRender: interactionRender$
|
|
3243
|
+
interactionRender: interactionRender$i
|
|
3244
3244
|
},
|
|
3245
3245
|
defaulSetting: {
|
|
3246
3246
|
name: '表单',
|
|
@@ -3263,7 +3263,7 @@
|
|
|
3263
3263
|
sort: 2
|
|
3264
3264
|
});
|
|
3265
3265
|
|
|
3266
|
-
var settingRender$
|
|
3266
|
+
var settingRender$f = [
|
|
3267
3267
|
{
|
|
3268
3268
|
title: '弹窗背景',
|
|
3269
3269
|
child: [
|
|
@@ -3661,6 +3661,22 @@
|
|
|
3661
3661
|
name: ['props', 'enableFixedCloseButton']
|
|
3662
3662
|
}
|
|
3663
3663
|
]
|
|
3664
|
+
},
|
|
3665
|
+
{
|
|
3666
|
+
title: '加购功能',
|
|
3667
|
+
child: [
|
|
3668
|
+
{
|
|
3669
|
+
label: '启用加购弹窗',
|
|
3670
|
+
type: 'Switch',
|
|
3671
|
+
name: ['props', 'enableAddToCart']
|
|
3672
|
+
},
|
|
3673
|
+
{
|
|
3674
|
+
label: '加购弹窗ID',
|
|
3675
|
+
type: 'Input',
|
|
3676
|
+
name: ['props', 'addToCartPopupId'],
|
|
3677
|
+
placeholder: '请输入加购弹窗的ID'
|
|
3678
|
+
}
|
|
3679
|
+
]
|
|
3664
3680
|
}
|
|
3665
3681
|
];
|
|
3666
3682
|
|
|
@@ -3680,7 +3696,7 @@
|
|
|
3680
3696
|
* @FilePath: \pb-sxp-ui\src\materials\sxp\cta\AniLink\interactionRender.tsx
|
|
3681
3697
|
*
|
|
3682
3698
|
*/
|
|
3683
|
-
var interactionRender$
|
|
3699
|
+
var interactionRender$h = [
|
|
3684
3700
|
{
|
|
3685
3701
|
title: '滑动事件',
|
|
3686
3702
|
child: [
|
|
@@ -11658,8 +11674,8 @@
|
|
|
11658
11674
|
|
|
11659
11675
|
const CommodityDetail$1 = (_a) => {
|
|
11660
11676
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
11661
|
-
var { content, style, bgImg, onClick, schema, isDefault, bottom_image, tipText, isPost, viewTime, rec, swiper, commodityStyles, buttonStyle, index, commodityGroup, popupBg, iframeIcon, commodityImgRatio, isTel, iframeBgColor, isActive = true } = _a, props = __rest(_a, ["content", "style", "bgImg", "onClick", "schema", "isDefault", "bottom_image", "tipText", "isPost", "viewTime", "rec", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup", "popupBg", "iframeIcon", "commodityImgRatio", "isTel", "iframeBgColor", "isActive"]);
|
|
11662
|
-
const { sxpParameter, popupDetailData, isPreview, bffFbReport, popupCurTimeRef, checkCommodityIndexRef, globalConfig, ctaEvent } = useSxpDataSource();
|
|
11677
|
+
var { content, style, bgImg, onClick, schema, isDefault, bottom_image, tipText, isPost, viewTime, rec, swiper, commodityStyles, buttonStyle, index, commodityGroup, popupBg, iframeIcon, commodityImgRatio, isTel, iframeBgColor, isActive = true, enableAddToCart = false, addToCartPopupId = '' } = _a, props = __rest(_a, ["content", "style", "bgImg", "onClick", "schema", "isDefault", "bottom_image", "tipText", "isPost", "viewTime", "rec", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup", "popupBg", "iframeIcon", "commodityImgRatio", "isTel", "iframeBgColor", "isActive", "enableAddToCart", "addToCartPopupId"]);
|
|
11678
|
+
const { sxpParameter, popupDetailData, isPreview, bffFbReport, popupCurTimeRef, checkCommodityIndexRef, globalConfig, ctaEvent, setPopupDetailData } = useSxpDataSource();
|
|
11663
11679
|
const { jumpToWeb, productView } = useEventReport();
|
|
11664
11680
|
const curTimeRef = React.useRef(null);
|
|
11665
11681
|
const [showModal, setShowModal] = React.useState(false);
|
|
@@ -11680,6 +11696,28 @@
|
|
|
11680
11696
|
cta = p === null || p === void 0 ? void 0 : p.bindCta;
|
|
11681
11697
|
}
|
|
11682
11698
|
const handleLink = (e) => {
|
|
11699
|
+
// 如果启用了加购功能且配置了加购弹窗ID,则打开加购弹窗
|
|
11700
|
+
if (enableAddToCart && addToCartPopupId) {
|
|
11701
|
+
// 设置弹窗数据
|
|
11702
|
+
setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, data), { index: position }));
|
|
11703
|
+
// 上报点击事件
|
|
11704
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
|
11705
|
+
eventName: 'ClickCTA',
|
|
11706
|
+
product: product ? [product] : undefined,
|
|
11707
|
+
contentType: 'product',
|
|
11708
|
+
data,
|
|
11709
|
+
position,
|
|
11710
|
+
cta_text: cta === null || cta === void 0 ? void 0 : cta.enTitle,
|
|
11711
|
+
cta_action_type: 'open_internal_popup',
|
|
11712
|
+
target_content_id: product === null || product === void 0 ? void 0 : product.itemId
|
|
11713
|
+
});
|
|
11714
|
+
// 打开加购弹窗
|
|
11715
|
+
if (typeof window !== 'undefined' && window.sxpPopup) {
|
|
11716
|
+
window.sxpPopup(addToCartPopupId);
|
|
11717
|
+
}
|
|
11718
|
+
return;
|
|
11719
|
+
}
|
|
11720
|
+
// 默认行为:跳转到商品链接
|
|
11683
11721
|
if (product === null || product === void 0 ? void 0 : product.link) {
|
|
11684
11722
|
jumpToWeb(e, data, product, cta, position);
|
|
11685
11723
|
if (!isPost) {
|
|
@@ -11951,8 +11989,8 @@
|
|
|
11951
11989
|
category: 'popup',
|
|
11952
11990
|
type: 'CommodityDetail',
|
|
11953
11991
|
related: {
|
|
11954
|
-
settingRender: settingRender$
|
|
11955
|
-
interactionRender: interactionRender$
|
|
11992
|
+
settingRender: settingRender$f,
|
|
11993
|
+
interactionRender: interactionRender$h
|
|
11956
11994
|
},
|
|
11957
11995
|
defaulSetting: {
|
|
11958
11996
|
props: {
|
|
@@ -12007,7 +12045,7 @@
|
|
|
12007
12045
|
sort: 1
|
|
12008
12046
|
});
|
|
12009
12047
|
|
|
12010
|
-
var interactionRender$
|
|
12048
|
+
var interactionRender$g = [
|
|
12011
12049
|
{
|
|
12012
12050
|
title: '点击事件',
|
|
12013
12051
|
child: [
|
|
@@ -12027,7 +12065,7 @@
|
|
|
12027
12065
|
* @FilePath: \pb-sxp-ui\src\materials\sxp\popup\Prompt\settingRender.tsx
|
|
12028
12066
|
*
|
|
12029
12067
|
*/
|
|
12030
|
-
var settingRender$
|
|
12068
|
+
var settingRender$e = [
|
|
12031
12069
|
{
|
|
12032
12070
|
title: '弹窗背景',
|
|
12033
12071
|
child: [
|
|
@@ -12207,9 +12245,9 @@
|
|
|
12207
12245
|
category: 'popup',
|
|
12208
12246
|
type: 'Prompt',
|
|
12209
12247
|
related: {
|
|
12210
|
-
settingRender: settingRender$
|
|
12248
|
+
settingRender: settingRender$e,
|
|
12211
12249
|
bindableProps: [],
|
|
12212
|
-
interactionRender: interactionRender$
|
|
12250
|
+
interactionRender: interactionRender$g
|
|
12213
12251
|
},
|
|
12214
12252
|
defaulSetting: {
|
|
12215
12253
|
props: {
|
|
@@ -12232,7 +12270,7 @@
|
|
|
12232
12270
|
* @FilePath: \pb-sxp-ui\src\materials\sxp\popup\CommodityDetailDiroNew\settingRender.tsx
|
|
12233
12271
|
*
|
|
12234
12272
|
*/
|
|
12235
|
-
var settingRender$
|
|
12273
|
+
var settingRender$d = [
|
|
12236
12274
|
{
|
|
12237
12275
|
title: '弹窗背景',
|
|
12238
12276
|
child: [
|
|
@@ -12965,7 +13003,7 @@ Made in Italy` })));
|
|
|
12965
13003
|
* @FilePath: \pb-sxp-ui\src\materials\sxp\cta\AniLink\interactionRender.tsx
|
|
12966
13004
|
*
|
|
12967
13005
|
*/
|
|
12968
|
-
var interactionRender$
|
|
13006
|
+
var interactionRender$f = [
|
|
12969
13007
|
{
|
|
12970
13008
|
title: '滑动事件',
|
|
12971
13009
|
child: [
|
|
@@ -12992,8 +13030,8 @@ Made in Italy` })));
|
|
|
12992
13030
|
category: 'popup',
|
|
12993
13031
|
type: 'CommodityDetailDiroNew',
|
|
12994
13032
|
related: {
|
|
12995
|
-
settingRender: settingRender$
|
|
12996
|
-
interactionRender: interactionRender$
|
|
13033
|
+
settingRender: settingRender$d,
|
|
13034
|
+
interactionRender: interactionRender$f
|
|
12997
13035
|
},
|
|
12998
13036
|
defaulSetting: {
|
|
12999
13037
|
props: {
|
|
@@ -13057,7 +13095,7 @@ Made in Italy` })));
|
|
|
13057
13095
|
* @FilePath: \pb-sxp-ui\src\materials\sxp\popup\CommodityList\settingRender.tsx
|
|
13058
13096
|
*
|
|
13059
13097
|
*/
|
|
13060
|
-
var settingRender$
|
|
13098
|
+
var settingRender$c = [
|
|
13061
13099
|
{
|
|
13062
13100
|
title: '弹窗背景',
|
|
13063
13101
|
child: [
|
|
@@ -13482,7 +13520,7 @@ Made in Italy` })));
|
|
|
13482
13520
|
* @FilePath: \pb-sxp-ui\src\materials\sxp\cta\AniLink\interactionRender.tsx
|
|
13483
13521
|
*
|
|
13484
13522
|
*/
|
|
13485
|
-
var interactionRender$
|
|
13523
|
+
var interactionRender$e = [
|
|
13486
13524
|
{
|
|
13487
13525
|
title: '点击事件',
|
|
13488
13526
|
child: [
|
|
@@ -13509,8 +13547,8 @@ Made in Italy` })));
|
|
|
13509
13547
|
category: 'popup',
|
|
13510
13548
|
type: 'CommodityList',
|
|
13511
13549
|
related: {
|
|
13512
|
-
settingRender: settingRender$
|
|
13513
|
-
interactionRender: interactionRender$
|
|
13550
|
+
settingRender: settingRender$c,
|
|
13551
|
+
interactionRender: interactionRender$e
|
|
13514
13552
|
},
|
|
13515
13553
|
defaulSetting: {
|
|
13516
13554
|
props: {
|
|
@@ -13558,7 +13596,7 @@ Made in Italy` })));
|
|
|
13558
13596
|
* @FilePath: \pb-sxp-ui\src\materials\sxp\popup\Iframe\settingRender.tsx
|
|
13559
13597
|
*
|
|
13560
13598
|
*/
|
|
13561
|
-
var settingRender$
|
|
13599
|
+
var settingRender$b = [
|
|
13562
13600
|
{
|
|
13563
13601
|
title: '背景样式',
|
|
13564
13602
|
child: [
|
|
@@ -13592,7 +13630,7 @@ Made in Italy` })));
|
|
|
13592
13630
|
category: 'popup',
|
|
13593
13631
|
type: 'Iframe',
|
|
13594
13632
|
related: {
|
|
13595
|
-
settingRender: settingRender$
|
|
13633
|
+
settingRender: settingRender$b,
|
|
13596
13634
|
bindableProps: []
|
|
13597
13635
|
},
|
|
13598
13636
|
defaulSetting: {
|
|
@@ -13612,7 +13650,7 @@ Made in Italy` })));
|
|
|
13612
13650
|
* @FilePath: \pb-sxp-ui\src\materials\sxp\popup\ConsentDetail\settingRender.tsx
|
|
13613
13651
|
*
|
|
13614
13652
|
*/
|
|
13615
|
-
var settingRender$
|
|
13653
|
+
var settingRender$a = [
|
|
13616
13654
|
{
|
|
13617
13655
|
title: '弹窗文本',
|
|
13618
13656
|
child: [
|
|
@@ -13641,7 +13679,7 @@ Made in Italy` })));
|
|
|
13641
13679
|
category: 'popup',
|
|
13642
13680
|
type: 'ConsentDetail',
|
|
13643
13681
|
related: {
|
|
13644
|
-
settingRender: settingRender$
|
|
13682
|
+
settingRender: settingRender$a,
|
|
13645
13683
|
bindableProps: []
|
|
13646
13684
|
},
|
|
13647
13685
|
defaulSetting: {
|
|
@@ -13653,6 +13691,666 @@ Made in Italy` })));
|
|
|
13653
13691
|
sort: 7
|
|
13654
13692
|
});
|
|
13655
13693
|
|
|
13694
|
+
var settingRender$9 = [
|
|
13695
|
+
{
|
|
13696
|
+
title: 'Shopify配置',
|
|
13697
|
+
child: [
|
|
13698
|
+
{
|
|
13699
|
+
type: 'Input',
|
|
13700
|
+
label: 'Shopify域名',
|
|
13701
|
+
name: ['props', 'shopifyDomain'],
|
|
13702
|
+
placeholder: 'your-store.myshopify.com'
|
|
13703
|
+
},
|
|
13704
|
+
{
|
|
13705
|
+
type: 'Input',
|
|
13706
|
+
label: 'Storefront Token',
|
|
13707
|
+
name: ['props', 'storefrontAccessToken'],
|
|
13708
|
+
placeholder: 'Storefront Access Token'
|
|
13709
|
+
}
|
|
13710
|
+
]
|
|
13711
|
+
},
|
|
13712
|
+
{
|
|
13713
|
+
title: '弹窗背景',
|
|
13714
|
+
child: [
|
|
13715
|
+
{
|
|
13716
|
+
type: 'Number',
|
|
13717
|
+
label: '左右边距',
|
|
13718
|
+
name: ['props', 'popupBg', 'horizontalMargin']
|
|
13719
|
+
},
|
|
13720
|
+
{
|
|
13721
|
+
type: 'Number',
|
|
13722
|
+
label: '下边距',
|
|
13723
|
+
name: ['props', 'popupBg', 'bottomMargin']
|
|
13724
|
+
}
|
|
13725
|
+
]
|
|
13726
|
+
},
|
|
13727
|
+
{
|
|
13728
|
+
title: '商品信息样式',
|
|
13729
|
+
child: [
|
|
13730
|
+
{
|
|
13731
|
+
name: ['props', 'variantStyles'],
|
|
13732
|
+
type: 'SelectLinkage',
|
|
13733
|
+
child: [
|
|
13734
|
+
{
|
|
13735
|
+
label: '字段',
|
|
13736
|
+
type: 'Select',
|
|
13737
|
+
options: [
|
|
13738
|
+
{
|
|
13739
|
+
label: '商品标题',
|
|
13740
|
+
value: 'title'
|
|
13741
|
+
},
|
|
13742
|
+
{
|
|
13743
|
+
label: '价格',
|
|
13744
|
+
value: 'price'
|
|
13745
|
+
},
|
|
13746
|
+
{
|
|
13747
|
+
label: '规格选项',
|
|
13748
|
+
value: 'option'
|
|
13749
|
+
},
|
|
13750
|
+
{
|
|
13751
|
+
label: '已选规格',
|
|
13752
|
+
value: 'selectedOption'
|
|
13753
|
+
}
|
|
13754
|
+
],
|
|
13755
|
+
name: ['props', 'variantStyles', 'field'],
|
|
13756
|
+
initialValue: 'title'
|
|
13757
|
+
},
|
|
13758
|
+
{
|
|
13759
|
+
type: 'Group',
|
|
13760
|
+
child: [
|
|
13761
|
+
{
|
|
13762
|
+
label: '上边距',
|
|
13763
|
+
type: 'Number',
|
|
13764
|
+
addonAfter: 'px',
|
|
13765
|
+
name: ['marginTop']
|
|
13766
|
+
},
|
|
13767
|
+
{
|
|
13768
|
+
label: '下边距',
|
|
13769
|
+
type: 'Number',
|
|
13770
|
+
addonAfter: 'px',
|
|
13771
|
+
name: ['marginBottom']
|
|
13772
|
+
}
|
|
13773
|
+
]
|
|
13774
|
+
},
|
|
13775
|
+
{
|
|
13776
|
+
type: 'Group',
|
|
13777
|
+
label: '字体',
|
|
13778
|
+
child: [
|
|
13779
|
+
{
|
|
13780
|
+
type: 'Select',
|
|
13781
|
+
name: ['fontFamily-cn'],
|
|
13782
|
+
bottomText: '中文字体'
|
|
13783
|
+
},
|
|
13784
|
+
{
|
|
13785
|
+
type: 'Select',
|
|
13786
|
+
name: ['fontFamily-en'],
|
|
13787
|
+
bottomText: '英文/其他字体'
|
|
13788
|
+
}
|
|
13789
|
+
]
|
|
13790
|
+
},
|
|
13791
|
+
{
|
|
13792
|
+
type: 'Group',
|
|
13793
|
+
label: '',
|
|
13794
|
+
child: [
|
|
13795
|
+
{
|
|
13796
|
+
type: 'Color',
|
|
13797
|
+
name: ['color']
|
|
13798
|
+
},
|
|
13799
|
+
{
|
|
13800
|
+
type: 'Number',
|
|
13801
|
+
addonAfter: 'px',
|
|
13802
|
+
name: ['fontSize']
|
|
13803
|
+
}
|
|
13804
|
+
]
|
|
13805
|
+
},
|
|
13806
|
+
{
|
|
13807
|
+
label: '样式',
|
|
13808
|
+
type: 'TextStyle'
|
|
13809
|
+
},
|
|
13810
|
+
{
|
|
13811
|
+
label: '对齐',
|
|
13812
|
+
type: 'TextAlign'
|
|
13813
|
+
},
|
|
13814
|
+
{
|
|
13815
|
+
label: '间距',
|
|
13816
|
+
type: 'TextSpace'
|
|
13817
|
+
}
|
|
13818
|
+
]
|
|
13819
|
+
}
|
|
13820
|
+
]
|
|
13821
|
+
},
|
|
13822
|
+
{
|
|
13823
|
+
title: '加购按钮样式',
|
|
13824
|
+
child: [
|
|
13825
|
+
{
|
|
13826
|
+
label: '英文大小写',
|
|
13827
|
+
type: 'Select',
|
|
13828
|
+
name: ['props', 'buttonStyle', 'textTransform'],
|
|
13829
|
+
options: [
|
|
13830
|
+
{
|
|
13831
|
+
label: '默认',
|
|
13832
|
+
value: 'unset'
|
|
13833
|
+
},
|
|
13834
|
+
{
|
|
13835
|
+
label: '小写',
|
|
13836
|
+
value: 'lowercase'
|
|
13837
|
+
},
|
|
13838
|
+
{
|
|
13839
|
+
label: '大写',
|
|
13840
|
+
value: 'uppercase'
|
|
13841
|
+
}
|
|
13842
|
+
]
|
|
13843
|
+
},
|
|
13844
|
+
{
|
|
13845
|
+
type: 'Color',
|
|
13846
|
+
label: '背景色',
|
|
13847
|
+
name: ['props', 'buttonStyle', 'backgroundColor'],
|
|
13848
|
+
initialValue: '#000'
|
|
13849
|
+
},
|
|
13850
|
+
{
|
|
13851
|
+
type: 'Group',
|
|
13852
|
+
label: '尺寸',
|
|
13853
|
+
child: [
|
|
13854
|
+
{
|
|
13855
|
+
type: 'Number',
|
|
13856
|
+
name: ['props', 'buttonStyle', 'height'],
|
|
13857
|
+
addonAfter: 'H'
|
|
13858
|
+
}
|
|
13859
|
+
]
|
|
13860
|
+
},
|
|
13861
|
+
{
|
|
13862
|
+
type: 'Group',
|
|
13863
|
+
label: '圆角',
|
|
13864
|
+
child: [
|
|
13865
|
+
{
|
|
13866
|
+
type: 'Slider',
|
|
13867
|
+
name: ['props', 'buttonStyle', 'borderRadius'],
|
|
13868
|
+
max: 100
|
|
13869
|
+
},
|
|
13870
|
+
{
|
|
13871
|
+
type: 'Number',
|
|
13872
|
+
name: ['props', 'buttonStyle', 'borderRadius'],
|
|
13873
|
+
addonAfter: 'px',
|
|
13874
|
+
max: 100
|
|
13875
|
+
}
|
|
13876
|
+
]
|
|
13877
|
+
},
|
|
13878
|
+
{
|
|
13879
|
+
type: 'TextMargin',
|
|
13880
|
+
name: ['props', 'buttonStyle']
|
|
13881
|
+
},
|
|
13882
|
+
{
|
|
13883
|
+
type: 'Group',
|
|
13884
|
+
label: '字体',
|
|
13885
|
+
child: [
|
|
13886
|
+
{
|
|
13887
|
+
type: 'Select',
|
|
13888
|
+
name: ['props', 'buttonStyle', 'fontFamily-cn'],
|
|
13889
|
+
bottomText: '中文字体'
|
|
13890
|
+
},
|
|
13891
|
+
{
|
|
13892
|
+
type: 'Select',
|
|
13893
|
+
name: ['props', 'buttonStyle', 'fontFamily-en'],
|
|
13894
|
+
bottomText: '英文/其他字体'
|
|
13895
|
+
}
|
|
13896
|
+
]
|
|
13897
|
+
},
|
|
13898
|
+
{
|
|
13899
|
+
type: 'Group',
|
|
13900
|
+
label: '',
|
|
13901
|
+
child: [
|
|
13902
|
+
{
|
|
13903
|
+
type: 'Color',
|
|
13904
|
+
name: ['props', 'buttonStyle', 'color'],
|
|
13905
|
+
initialValue: '#fff'
|
|
13906
|
+
},
|
|
13907
|
+
{
|
|
13908
|
+
type: 'Number',
|
|
13909
|
+
name: ['props', 'buttonStyle', 'fontSize'],
|
|
13910
|
+
addonAfter: 'px'
|
|
13911
|
+
}
|
|
13912
|
+
]
|
|
13913
|
+
},
|
|
13914
|
+
{
|
|
13915
|
+
type: 'TextStyle',
|
|
13916
|
+
name: ['props', 'buttonStyle']
|
|
13917
|
+
},
|
|
13918
|
+
{
|
|
13919
|
+
type: 'TextAlign',
|
|
13920
|
+
name: ['props', 'buttonStyle']
|
|
13921
|
+
},
|
|
13922
|
+
{
|
|
13923
|
+
label: '间距',
|
|
13924
|
+
type: 'TextSpace',
|
|
13925
|
+
name: ['props', 'buttonStyle']
|
|
13926
|
+
}
|
|
13927
|
+
]
|
|
13928
|
+
},
|
|
13929
|
+
{
|
|
13930
|
+
title: '文案配置',
|
|
13931
|
+
child: [
|
|
13932
|
+
{
|
|
13933
|
+
type: 'Input',
|
|
13934
|
+
label: '加购按钮文案',
|
|
13935
|
+
name: ['props', 'texts', 'addToCart'],
|
|
13936
|
+
placeholder: 'Add to Cart'
|
|
13937
|
+
},
|
|
13938
|
+
{
|
|
13939
|
+
type: 'Input',
|
|
13940
|
+
label: '选择规格提示',
|
|
13941
|
+
name: ['props', 'texts', 'selectOptions'],
|
|
13942
|
+
placeholder: 'Please select options'
|
|
13943
|
+
},
|
|
13944
|
+
{
|
|
13945
|
+
type: 'Input',
|
|
13946
|
+
label: '加载文案',
|
|
13947
|
+
name: ['props', 'texts', 'loading'],
|
|
13948
|
+
placeholder: 'Loading...'
|
|
13949
|
+
},
|
|
13950
|
+
{
|
|
13951
|
+
type: 'Input',
|
|
13952
|
+
label: '错误文案',
|
|
13953
|
+
name: ['props', 'texts', 'error'],
|
|
13954
|
+
placeholder: 'Failed to load product'
|
|
13955
|
+
}
|
|
13956
|
+
]
|
|
13957
|
+
},
|
|
13958
|
+
{
|
|
13959
|
+
title: '数量选择器',
|
|
13960
|
+
child: [
|
|
13961
|
+
{
|
|
13962
|
+
type: 'Number',
|
|
13963
|
+
label: '按钮间距',
|
|
13964
|
+
name: ['props', 'quantityStyle', 'gap'],
|
|
13965
|
+
addonAfter: 'px',
|
|
13966
|
+
initialValue: 12
|
|
13967
|
+
}
|
|
13968
|
+
]
|
|
13969
|
+
}
|
|
13970
|
+
];
|
|
13971
|
+
|
|
13972
|
+
/*
|
|
13973
|
+
* @Author: tao
|
|
13974
|
+
* @Date: 2026-01-12
|
|
13975
|
+
* @Description: Add to Cart 交互配置
|
|
13976
|
+
*/
|
|
13977
|
+
var interactionRender$d = () => {
|
|
13978
|
+
return (React.createElement("div", { style: { padding: '20px', color: '#666' } },
|
|
13979
|
+
React.createElement("p", null, "\u52A0\u8D2D\u5546\u54C1\u5F39\u7A97\u4EA4\u4E92\u8BF4\u660E\uFF1A"),
|
|
13980
|
+
React.createElement("ul", { style: { paddingLeft: '20px', lineHeight: '1.8' } },
|
|
13981
|
+
React.createElement("li", null, "\u70B9\u51FB\u5546\u54C1\u8BE6\u60C5\u5F39\u7A97\u7684\"Shop Now\"\u6309\u94AE\u540E\u81EA\u52A8\u5C55\u793A"),
|
|
13982
|
+
React.createElement("li", null, "\u901A\u8FC7Shopify Storefront API\u83B7\u53D6\u5546\u54C1\u89C4\u683C\u548C\u5E93\u5B58\u4FE1\u606F"),
|
|
13983
|
+
React.createElement("li", null, "\u7528\u6237\u9009\u62E9\u89C4\u683C\u540E\u5B9E\u65F6\u663E\u793A\u5BF9\u5E94SKU\u7684\u4EF7\u683C\u548C\u5E93\u5B58"),
|
|
13984
|
+
React.createElement("li", null, "\u70B9\u51FB\"Add to Cart\"\u6309\u94AE\u540E\u8DF3\u8F6C\u81F3Shopify\u8D2D\u7269\u8F66\u9875\u9762"),
|
|
13985
|
+
React.createElement("li", null, "\u65E0\u5E93\u5B58\u6216\u4E0D\u53EF\u552E\u5356\u7684\u89C4\u683C\u81EA\u52A8\u7F6E\u7070\u4E0D\u53EF\u9009"))));
|
|
13986
|
+
};
|
|
13987
|
+
|
|
13988
|
+
const AddToCartPopup$1 = (_a) => {
|
|
13989
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
13990
|
+
var { style, isActive = true, index, shopifyDomain = '', storefrontAccessToken = '', variantStyles = {}, buttonStyle = {}, quantityStyle = {}, texts = {}, popupBg = {} } = _a, props = __rest(_a, ["style", "isActive", "index", "shopifyDomain", "storefrontAccessToken", "variantStyles", "buttonStyle", "quantityStyle", "texts", "popupBg"]);
|
|
13991
|
+
const { sxpParameter, popupDetailData, isPreview, bffFbReport, globalConfig } = useSxpDataSource();
|
|
13992
|
+
useEventReport();
|
|
13993
|
+
const curTimeRef = React.useRef(null);
|
|
13994
|
+
const [productData, setProductData] = React.useState(null);
|
|
13995
|
+
const [selectedOptions, setSelectedOptions] = React.useState({});
|
|
13996
|
+
const [selectedVariant, setSelectedVariant] = React.useState(null);
|
|
13997
|
+
const [quantity, setQuantity] = React.useState(1);
|
|
13998
|
+
const [loading, setLoading] = React.useState(true);
|
|
13999
|
+
const [error, setError] = React.useState(null);
|
|
14000
|
+
// 获取当前弹窗商品数据(自动从 popupDetailData 获取)
|
|
14001
|
+
const data = popupDetailData;
|
|
14002
|
+
const product = (_c = (_b = data === null || data === void 0 ? void 0 : data.video) === null || _b === void 0 ? void 0 : _b.bindProduct) !== null && _c !== void 0 ? _c : (_e = (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.bindProducts) === null || _e === void 0 ? void 0 : _e[0];
|
|
14003
|
+
product === null || product === void 0 ? void 0 : product.bindCta;
|
|
14004
|
+
const position = (_g = (_f = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index) !== null && _f !== void 0 ? _f : index) !== null && _g !== void 0 ? _g : 0;
|
|
14005
|
+
// Shopify配置 - 优先级:props > globalConfig > 默认值
|
|
14006
|
+
const finalShopifyDomain = shopifyDomain || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.shopifyDomain) || 'dev-store-749237498237498636.myshopify.com';
|
|
14007
|
+
const finalStorefrontToken = storefrontAccessToken || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.storefrontAccessToken) || '77d894c490f79430ce7bd0a7efdff6b7';
|
|
14008
|
+
// 自动从商品数据获取 Shopify Product ID
|
|
14009
|
+
const productId = (product === null || product === void 0 ? void 0 : product.itemId) || '';
|
|
14010
|
+
// 文案
|
|
14011
|
+
const finalTexts = {
|
|
14012
|
+
addToCart: texts.addToCart || 'Add to Cart',
|
|
14013
|
+
selectOptions: texts.selectOptions || 'Please select options',
|
|
14014
|
+
loading: texts.loading || 'Loading...',
|
|
14015
|
+
error: texts.error || 'Failed to load product',
|
|
14016
|
+
color: texts.color || 'Color',
|
|
14017
|
+
size: texts.size || 'Size',
|
|
14018
|
+
material: texts.material || 'Material',
|
|
14019
|
+
style: texts.style || 'Style'
|
|
14020
|
+
};
|
|
14021
|
+
// 查询Shopify商品数据
|
|
14022
|
+
const fetchProductData = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
14023
|
+
var _m;
|
|
14024
|
+
if (!productId || !finalShopifyDomain || !finalStorefrontToken) {
|
|
14025
|
+
console.log('[AddToCartPopup] 缺少必要配置:', {
|
|
14026
|
+
productId,
|
|
14027
|
+
shopifyDomain: finalShopifyDomain,
|
|
14028
|
+
hasToken: !!finalStorefrontToken
|
|
14029
|
+
});
|
|
14030
|
+
setLoading(false);
|
|
14031
|
+
return;
|
|
14032
|
+
}
|
|
14033
|
+
console.log('[AddToCartPopup] 开始加载商品数据:', {
|
|
14034
|
+
productId,
|
|
14035
|
+
shopifyDomain: finalShopifyDomain
|
|
14036
|
+
});
|
|
14037
|
+
setLoading(true);
|
|
14038
|
+
setError(null);
|
|
14039
|
+
try {
|
|
14040
|
+
const query = `
|
|
14041
|
+
query getProduct($id: ID!) {
|
|
14042
|
+
product(id: $id) {
|
|
14043
|
+
id
|
|
14044
|
+
title
|
|
14045
|
+
images(first: 10) {
|
|
14046
|
+
edges {
|
|
14047
|
+
node {
|
|
14048
|
+
url
|
|
14049
|
+
}
|
|
14050
|
+
}
|
|
14051
|
+
}
|
|
14052
|
+
options {
|
|
14053
|
+
name
|
|
14054
|
+
values
|
|
14055
|
+
}
|
|
14056
|
+
variants(first: 100) {
|
|
14057
|
+
edges {
|
|
14058
|
+
node {
|
|
14059
|
+
id
|
|
14060
|
+
title
|
|
14061
|
+
availableForSale
|
|
14062
|
+
quantityAvailable
|
|
14063
|
+
price {
|
|
14064
|
+
amount
|
|
14065
|
+
currencyCode
|
|
14066
|
+
}
|
|
14067
|
+
image {
|
|
14068
|
+
url
|
|
14069
|
+
}
|
|
14070
|
+
selectedOptions {
|
|
14071
|
+
name
|
|
14072
|
+
value
|
|
14073
|
+
}
|
|
14074
|
+
}
|
|
14075
|
+
}
|
|
14076
|
+
}
|
|
14077
|
+
}
|
|
14078
|
+
}
|
|
14079
|
+
`;
|
|
14080
|
+
// 确保 Product ID 格式正确
|
|
14081
|
+
const formattedProductId = productId.startsWith('gid://')
|
|
14082
|
+
? productId
|
|
14083
|
+
: `gid://shopify/Product/${productId}`;
|
|
14084
|
+
console.log('[AddToCartPopup] 使用的 Product ID:', formattedProductId);
|
|
14085
|
+
const response = yield fetch(`https://${finalShopifyDomain}/api/2024-01/graphql.json`, {
|
|
14086
|
+
method: 'POST',
|
|
14087
|
+
headers: {
|
|
14088
|
+
'Content-Type': 'application/json',
|
|
14089
|
+
'X-Shopify-Storefront-Access-Token': finalStorefrontToken
|
|
14090
|
+
},
|
|
14091
|
+
body: JSON.stringify({
|
|
14092
|
+
query,
|
|
14093
|
+
variables: { id: formattedProductId }
|
|
14094
|
+
})
|
|
14095
|
+
});
|
|
14096
|
+
if (!response.ok) {
|
|
14097
|
+
throw new Error(`HTTP ${response.status}`);
|
|
14098
|
+
}
|
|
14099
|
+
const result = yield response.json();
|
|
14100
|
+
if (result.errors) {
|
|
14101
|
+
console.error('[AddToCartPopup] GraphQL 错误:', result.errors);
|
|
14102
|
+
throw new Error(result.errors[0].message);
|
|
14103
|
+
}
|
|
14104
|
+
if (!((_m = result.data) === null || _m === void 0 ? void 0 : _m.product)) {
|
|
14105
|
+
console.error('[AddToCartPopup] 未找到商品');
|
|
14106
|
+
throw new Error('Product not found');
|
|
14107
|
+
}
|
|
14108
|
+
console.log('[AddToCartPopup] 商品数据加载成功:', result.data.product.title);
|
|
14109
|
+
setProductData(result.data.product);
|
|
14110
|
+
}
|
|
14111
|
+
catch (err) {
|
|
14112
|
+
const errorMessage = err instanceof Error ? err.message : finalTexts.error;
|
|
14113
|
+
setError(errorMessage);
|
|
14114
|
+
console.error('[AddToCartPopup] 加载失败:', err);
|
|
14115
|
+
}
|
|
14116
|
+
finally {
|
|
14117
|
+
setLoading(false);
|
|
14118
|
+
}
|
|
14119
|
+
}), [productId, finalShopifyDomain, finalStorefrontToken, finalTexts.error]);
|
|
14120
|
+
React.useEffect(() => {
|
|
14121
|
+
if (isActive) {
|
|
14122
|
+
fetchProductData();
|
|
14123
|
+
}
|
|
14124
|
+
}, [isActive, fetchProductData]);
|
|
14125
|
+
// 根据选中的规格匹配variant
|
|
14126
|
+
React.useEffect(() => {
|
|
14127
|
+
if (!productData)
|
|
14128
|
+
return;
|
|
14129
|
+
const variants = productData.variants.edges.map(edge => edge.node);
|
|
14130
|
+
const optionsCount = productData.options.length;
|
|
14131
|
+
const selectedCount = Object.keys(selectedOptions).length;
|
|
14132
|
+
if (selectedCount === 0 || selectedCount < optionsCount) {
|
|
14133
|
+
setSelectedVariant(null);
|
|
14134
|
+
return;
|
|
14135
|
+
}
|
|
14136
|
+
const matchedVariant = variants.find(variant => {
|
|
14137
|
+
return variant.selectedOptions.every(option => selectedOptions[option.name] === option.value);
|
|
14138
|
+
});
|
|
14139
|
+
setSelectedVariant(matchedVariant || null);
|
|
14140
|
+
setQuantity(1);
|
|
14141
|
+
}, [selectedOptions, productData]);
|
|
14142
|
+
// 处理规格选择
|
|
14143
|
+
const handleOptionSelect = React.useCallback((optionName, value) => {
|
|
14144
|
+
setSelectedOptions(prev => {
|
|
14145
|
+
const newOptions = Object.assign({}, prev);
|
|
14146
|
+
if (newOptions[optionName] === value) {
|
|
14147
|
+
delete newOptions[optionName];
|
|
14148
|
+
}
|
|
14149
|
+
else {
|
|
14150
|
+
newOptions[optionName] = value;
|
|
14151
|
+
}
|
|
14152
|
+
return newOptions;
|
|
14153
|
+
});
|
|
14154
|
+
}, []);
|
|
14155
|
+
// 处理数量变化
|
|
14156
|
+
const handleQuantityChange = React.useCallback((delta) => {
|
|
14157
|
+
setQuantity(prev => {
|
|
14158
|
+
var _a;
|
|
14159
|
+
const newQuantity = prev + delta;
|
|
14160
|
+
const maxQuantity = (_a = selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.quantityAvailable) !== null && _a !== void 0 ? _a : 999;
|
|
14161
|
+
return Math.max(1, Math.min(newQuantity, maxQuantity));
|
|
14162
|
+
});
|
|
14163
|
+
}, [selectedVariant]);
|
|
14164
|
+
// 检查某个规格值是否可用
|
|
14165
|
+
const isOptionValueAvailable = React.useCallback((optionName, value) => {
|
|
14166
|
+
if (!productData)
|
|
14167
|
+
return false;
|
|
14168
|
+
const variants = productData.variants.edges.map(edge => edge.node);
|
|
14169
|
+
const tempOptions = Object.assign(Object.assign({}, selectedOptions), { [optionName]: value });
|
|
14170
|
+
return variants.some(variant => {
|
|
14171
|
+
const matches = variant.selectedOptions.every(option => !tempOptions[option.name] || tempOptions[option.name] === option.value);
|
|
14172
|
+
const hasStock = variant.quantityAvailable === null || variant.quantityAvailable > 0;
|
|
14173
|
+
return matches && variant.availableForSale && hasStock;
|
|
14174
|
+
});
|
|
14175
|
+
}, [productData, selectedOptions]);
|
|
14176
|
+
// 处理加购
|
|
14177
|
+
const handleAddToCart = React.useCallback(() => {
|
|
14178
|
+
var _a;
|
|
14179
|
+
if (!selectedVariant || quantity === 0)
|
|
14180
|
+
return;
|
|
14181
|
+
const variantId = selectedVariant.id.split('/').pop();
|
|
14182
|
+
const cartUrl = `https://${finalShopifyDomain}/cart/add?id=${variantId}&quantity=${quantity}`;
|
|
14183
|
+
console.log('[AddToCartPopup] 加购:', {
|
|
14184
|
+
variantId,
|
|
14185
|
+
quantity,
|
|
14186
|
+
cartUrl
|
|
14187
|
+
});
|
|
14188
|
+
// 上报事件
|
|
14189
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
|
14190
|
+
eventName: 'AddToCart',
|
|
14191
|
+
product: product ? [product] : undefined,
|
|
14192
|
+
contentType: 'product',
|
|
14193
|
+
data,
|
|
14194
|
+
position,
|
|
14195
|
+
content_id: (_a = product === null || product === void 0 ? void 0 : product.itemId) !== null && _a !== void 0 ? _a : '',
|
|
14196
|
+
value: parseFloat(selectedVariant.price.amount) * quantity,
|
|
14197
|
+
currency: selectedVariant.price.currencyCode,
|
|
14198
|
+
contents: [{
|
|
14199
|
+
id: variantId,
|
|
14200
|
+
quantity
|
|
14201
|
+
}]
|
|
14202
|
+
});
|
|
14203
|
+
// 跳转到Shopify购物车页面
|
|
14204
|
+
window.location.href = cartUrl;
|
|
14205
|
+
}, [selectedVariant, quantity, finalShopifyDomain, bffFbReport, product, data, position]);
|
|
14206
|
+
// 计算总价
|
|
14207
|
+
const totalPrice = React.useMemo(() => {
|
|
14208
|
+
if (!selectedVariant)
|
|
14209
|
+
return null;
|
|
14210
|
+
const price = parseFloat(selectedVariant.price.amount);
|
|
14211
|
+
const total = price * quantity;
|
|
14212
|
+
return total.toFixed(2);
|
|
14213
|
+
}, [selectedVariant, quantity]);
|
|
14214
|
+
// 初始化时间
|
|
14215
|
+
React.useEffect(() => {
|
|
14216
|
+
const initTime = () => {
|
|
14217
|
+
curTimeRef.current = new Date();
|
|
14218
|
+
};
|
|
14219
|
+
initTime();
|
|
14220
|
+
window.addEventListener('pageshow', initTime);
|
|
14221
|
+
return () => {
|
|
14222
|
+
window.removeEventListener('pageshow', initTime);
|
|
14223
|
+
};
|
|
14224
|
+
}, []);
|
|
14225
|
+
// 加载中
|
|
14226
|
+
if (loading) {
|
|
14227
|
+
return (React.createElement("div", { className: "add-to-cart-popup-loading", style: style },
|
|
14228
|
+
React.createElement("div", null, finalTexts.loading)));
|
|
14229
|
+
}
|
|
14230
|
+
// 错误状态
|
|
14231
|
+
if (error || !productData) {
|
|
14232
|
+
return (React.createElement("div", { className: "add-to-cart-popup-error", style: style },
|
|
14233
|
+
React.createElement("div", null,
|
|
14234
|
+
finalTexts.error,
|
|
14235
|
+
": ",
|
|
14236
|
+
error || 'Product not found')));
|
|
14237
|
+
}
|
|
14238
|
+
const mainImage = ((_h = selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.image) === null || _h === void 0 ? void 0 : _h.url) || ((_j = productData.images.edges[0]) === null || _j === void 0 ? void 0 : _j.node.url) || ((_k = product === null || product === void 0 ? void 0 : product.homePage) === null || _k === void 0 ? void 0 : _k[0]) || '';
|
|
14239
|
+
const hasAllOptionsSelected = productData.options.length === Object.keys(selectedOptions).length;
|
|
14240
|
+
const isAddToCartDisabled = !selectedVariant || quantity === 0;
|
|
14241
|
+
return (React.createElement("div", Object.assign({ className: "add-to-cart-popup-container", style: style }, props),
|
|
14242
|
+
React.createElement("div", { className: "variant-detail-section" },
|
|
14243
|
+
React.createElement("div", { className: "variant-image-wrapper" },
|
|
14244
|
+
React.createElement("img", { src: mainImage, alt: productData.title, className: "variant-image" })),
|
|
14245
|
+
React.createElement("div", { className: "variant-info-wrapper" },
|
|
14246
|
+
React.createElement("h2", { className: "product-title-text", style: variantStyles.title, dangerouslySetInnerHTML: {
|
|
14247
|
+
__html: setFontForText(productData.title, variantStyles.title)
|
|
14248
|
+
} }),
|
|
14249
|
+
selectedVariant && (React.createElement(React.Fragment, null,
|
|
14250
|
+
React.createElement("div", { className: "selected-options-tags" }, selectedVariant.selectedOptions.map(option => (React.createElement("span", { key: option.name, className: "option-tag", style: variantStyles.selectedOption },
|
|
14251
|
+
option.name,
|
|
14252
|
+
": ",
|
|
14253
|
+
option.value)))),
|
|
14254
|
+
React.createElement("div", { className: "price-display" },
|
|
14255
|
+
React.createElement("span", { className: "price-value", style: variantStyles.price, dangerouslySetInnerHTML: {
|
|
14256
|
+
__html: setFontForText(`${selectedVariant.price.currencyCode} $${totalPrice}`, variantStyles.price)
|
|
14257
|
+
} })),
|
|
14258
|
+
React.createElement("div", { className: "quantity-selector-wrapper", style: quantityStyle },
|
|
14259
|
+
React.createElement("button", { className: "quantity-btn quantity-decrease", onClick: () => handleQuantityChange(-1), disabled: quantity <= 1, "aria-label": "Decrease quantity" }, "-"),
|
|
14260
|
+
React.createElement("input", { type: "number", value: quantity, readOnly: true, className: "quantity-input-field", "aria-label": "Quantity" }),
|
|
14261
|
+
React.createElement("button", { className: "quantity-btn quantity-increase", onClick: () => handleQuantityChange(1), disabled: quantity >= ((_l = selectedVariant.quantityAvailable) !== null && _l !== void 0 ? _l : 999), "aria-label": "Increase quantity" }, "+")))),
|
|
14262
|
+
!hasAllOptionsSelected && (React.createElement("div", { className: "no-selection-hint", style: variantStyles.option }, finalTexts.selectOptions)))),
|
|
14263
|
+
React.createElement("div", { className: "variant-options-section" }, productData.options.map(option => (React.createElement("div", { key: option.name, className: "option-group-wrapper" },
|
|
14264
|
+
React.createElement("h3", { className: "option-group-name", style: variantStyles.option, dangerouslySetInnerHTML: {
|
|
14265
|
+
__html: setFontForText(option.name, variantStyles.option)
|
|
14266
|
+
} }),
|
|
14267
|
+
React.createElement("div", { className: "option-values-grid" }, option.values.map(value => {
|
|
14268
|
+
const isSelected = selectedOptions[option.name] === value;
|
|
14269
|
+
const isAvailable = isOptionValueAvailable(option.name, value);
|
|
14270
|
+
return (React.createElement("button", { key: value, className: `option-value-button ${isSelected ? 'selected' : ''} ${!isAvailable ? 'disabled' : ''}`, onClick: () => isAvailable && handleOptionSelect(option.name, value), disabled: !isAvailable, "aria-label": `${option.name}: ${value}`, "aria-pressed": isSelected }, value));
|
|
14271
|
+
})))))),
|
|
14272
|
+
React.createElement("button", { className: `add-to-cart-button ${isAddToCartDisabled ? 'disabled' : ''}`, style: buttonStyle, onClick: handleAddToCart, disabled: isAddToCartDisabled, "aria-label": finalTexts.addToCart },
|
|
14273
|
+
React.createElement("span", { dangerouslySetInnerHTML: {
|
|
14274
|
+
__html: setFontForText(finalTexts.addToCart, buttonStyle)
|
|
14275
|
+
} }))));
|
|
14276
|
+
};
|
|
14277
|
+
|
|
14278
|
+
/*
|
|
14279
|
+
* @Author: tao
|
|
14280
|
+
* @Date: 2026-01-12
|
|
14281
|
+
* @Description: Add to Cart 弹窗组件物料配置
|
|
14282
|
+
*/
|
|
14283
|
+
const AddToCartPopup = createMaterial(AddToCartPopup$1, {
|
|
14284
|
+
displayName: '加购商品',
|
|
14285
|
+
icon: '',
|
|
14286
|
+
category: 'popup',
|
|
14287
|
+
type: 'AddToCartPopup',
|
|
14288
|
+
related: {
|
|
14289
|
+
settingRender: settingRender$9,
|
|
14290
|
+
interactionRender: interactionRender$d
|
|
14291
|
+
},
|
|
14292
|
+
defaulSetting: {
|
|
14293
|
+
props: {
|
|
14294
|
+
shopifyDomain: '',
|
|
14295
|
+
storefrontAccessToken: '',
|
|
14296
|
+
variantStyles: {
|
|
14297
|
+
title: {
|
|
14298
|
+
color: '#000',
|
|
14299
|
+
fontSize: 20,
|
|
14300
|
+
fontWeight: 600,
|
|
14301
|
+
marginBottom: 12
|
|
14302
|
+
},
|
|
14303
|
+
price: {
|
|
14304
|
+
color: '#000',
|
|
14305
|
+
fontSize: 24,
|
|
14306
|
+
fontWeight: 700,
|
|
14307
|
+
marginBottom: 16
|
|
14308
|
+
},
|
|
14309
|
+
option: {
|
|
14310
|
+
color: '#111',
|
|
14311
|
+
fontSize: 16,
|
|
14312
|
+
fontWeight: 600,
|
|
14313
|
+
marginBottom: 12
|
|
14314
|
+
},
|
|
14315
|
+
selectedOption: {
|
|
14316
|
+
fontSize: 14,
|
|
14317
|
+
color: '#374151'
|
|
14318
|
+
}
|
|
14319
|
+
},
|
|
14320
|
+
buttonStyle: {
|
|
14321
|
+
backgroundColor: '#000',
|
|
14322
|
+
color: '#fff',
|
|
14323
|
+
fontSize: 16,
|
|
14324
|
+
height: 52,
|
|
14325
|
+
fontWeight: 600,
|
|
14326
|
+
textAlign: 'center',
|
|
14327
|
+
textTransform: 'uppercase'
|
|
14328
|
+
},
|
|
14329
|
+
quantityStyle: {
|
|
14330
|
+
gap: 12
|
|
14331
|
+
},
|
|
14332
|
+
texts: {
|
|
14333
|
+
addToCart: 'Add to Cart',
|
|
14334
|
+
selectOptions: 'Please select options',
|
|
14335
|
+
loading: 'Loading...',
|
|
14336
|
+
error: 'Failed to load product',
|
|
14337
|
+
color: 'Color',
|
|
14338
|
+
size: 'Size',
|
|
14339
|
+
material: 'Material',
|
|
14340
|
+
style: 'Style'
|
|
14341
|
+
},
|
|
14342
|
+
popupBg: {
|
|
14343
|
+
horizontalMargin: 0,
|
|
14344
|
+
bottomMargin: 0
|
|
14345
|
+
}
|
|
14346
|
+
},
|
|
14347
|
+
style: {}
|
|
14348
|
+
},
|
|
14349
|
+
w: 100,
|
|
14350
|
+
h: 40,
|
|
14351
|
+
sort: 7
|
|
14352
|
+
});
|
|
14353
|
+
|
|
13656
14354
|
/*
|
|
13657
14355
|
* @Author: binruan@chatlabs.com
|
|
13658
14356
|
* @Date: 2024-03-26 16:50:25
|
|
@@ -19144,6 +19842,7 @@ Made in Italy` })));
|
|
|
19144
19842
|
|
|
19145
19843
|
var _materials_ = /*#__PURE__*/Object.freeze({
|
|
19146
19844
|
__proto__: null,
|
|
19845
|
+
AddToCartPopup: AddToCartPopup,
|
|
19147
19846
|
AniLink: AniLink,
|
|
19148
19847
|
AniLinkPopup: AniLinkPopup,
|
|
19149
19848
|
Appoint: Appoint,
|