pb-sxp-ui 1.20.18 → 1.20.20

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.
Files changed (46) hide show
  1. package/dist/index.cjs +737 -26
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +291 -0
  4. package/dist/index.js +737 -26
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.cjs +44 -5
  7. package/dist/index.min.cjs.map +1 -1
  8. package/dist/index.min.js +44 -5
  9. package/dist/index.min.js.map +1 -1
  10. package/dist/pb-ui.js +737 -26
  11. package/dist/pb-ui.js.map +1 -1
  12. package/dist/pb-ui.min.js +44 -5
  13. package/dist/pb-ui.min.js.map +1 -1
  14. package/es/core/components/SxpPageRender/index.d.ts +2 -0
  15. package/es/core/context/SxpDataSourceProvider.d.ts +1 -1
  16. package/es/materials/sxp/popup/AddToCart/index.d.ts +33 -0
  17. package/es/materials/sxp/popup/AddToCart/index.js +279 -0
  18. package/es/materials/sxp/popup/AddToCart/interactionRender.d.ts +3 -0
  19. package/es/materials/sxp/popup/AddToCart/interactionRender.js +11 -0
  20. package/es/materials/sxp/popup/AddToCart/material.d.ts +2 -0
  21. package/es/materials/sxp/popup/AddToCart/material.js +75 -0
  22. package/es/materials/sxp/popup/AddToCart/settingRender.d.ts +160 -0
  23. package/es/materials/sxp/popup/AddToCart/settingRender.js +277 -0
  24. package/es/materials/sxp/popup/CommodityDetail/index.d.ts +2 -0
  25. package/es/materials/sxp/popup/CommodityDetail/index.js +30 -2
  26. package/es/materials/sxp/popup/CommodityDetail/settingRender.d.ts +13 -0
  27. package/es/materials/sxp/popup/CommodityDetail/settingRender.js +16 -0
  28. package/es/materials/sxp/popup/index.d.ts +1 -0
  29. package/es/materials/sxp/popup/index.js +1 -0
  30. package/lib/core/components/SxpPageRender/index.d.ts +2 -0
  31. package/lib/core/context/SxpDataSourceProvider.d.ts +1 -1
  32. package/lib/materials/sxp/popup/AddToCart/index.d.ts +33 -0
  33. package/lib/materials/sxp/popup/AddToCart/index.js +281 -0
  34. package/lib/materials/sxp/popup/AddToCart/interactionRender.d.ts +3 -0
  35. package/lib/materials/sxp/popup/AddToCart/interactionRender.js +14 -0
  36. package/lib/materials/sxp/popup/AddToCart/material.d.ts +2 -0
  37. package/lib/materials/sxp/popup/AddToCart/material.js +79 -0
  38. package/lib/materials/sxp/popup/AddToCart/settingRender.d.ts +160 -0
  39. package/lib/materials/sxp/popup/AddToCart/settingRender.js +279 -0
  40. package/lib/materials/sxp/popup/CommodityDetail/index.d.ts +2 -0
  41. package/lib/materials/sxp/popup/CommodityDetail/index.js +30 -2
  42. package/lib/materials/sxp/popup/CommodityDetail/settingRender.d.ts +13 -0
  43. package/lib/materials/sxp/popup/CommodityDetail/settingRender.js +16 -0
  44. package/lib/materials/sxp/popup/index.d.ts +1 -0
  45. package/lib/materials/sxp/popup/index.js +1 -0
  46. package/package.json +1 -1
@@ -0,0 +1,279 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = [
4
+ {
5
+ title: 'Shopify配置',
6
+ child: [
7
+ {
8
+ type: 'Input',
9
+ label: 'Shopify域名',
10
+ name: ['props', 'shopifyDomain'],
11
+ placeholder: 'your-store.myshopify.com'
12
+ },
13
+ {
14
+ type: 'Input',
15
+ label: 'Storefront Token',
16
+ name: ['props', 'storefrontAccessToken'],
17
+ placeholder: 'Storefront Access Token'
18
+ }
19
+ ]
20
+ },
21
+ {
22
+ title: '弹窗背景',
23
+ child: [
24
+ {
25
+ type: 'Number',
26
+ label: '左右边距',
27
+ name: ['props', 'popupBg', 'horizontalMargin']
28
+ },
29
+ {
30
+ type: 'Number',
31
+ label: '下边距',
32
+ name: ['props', 'popupBg', 'bottomMargin']
33
+ }
34
+ ]
35
+ },
36
+ {
37
+ title: '商品信息样式',
38
+ child: [
39
+ {
40
+ name: ['props', 'variantStyles'],
41
+ type: 'SelectLinkage',
42
+ child: [
43
+ {
44
+ label: '字段',
45
+ type: 'Select',
46
+ options: [
47
+ {
48
+ label: '商品标题',
49
+ value: 'title'
50
+ },
51
+ {
52
+ label: '价格',
53
+ value: 'price'
54
+ },
55
+ {
56
+ label: '规格选项',
57
+ value: 'option'
58
+ },
59
+ {
60
+ label: '已选规格',
61
+ value: 'selectedOption'
62
+ }
63
+ ],
64
+ name: ['props', 'variantStyles', 'field'],
65
+ initialValue: 'title'
66
+ },
67
+ {
68
+ type: 'Group',
69
+ child: [
70
+ {
71
+ label: '上边距',
72
+ type: 'Number',
73
+ addonAfter: 'px',
74
+ name: ['marginTop']
75
+ },
76
+ {
77
+ label: '下边距',
78
+ type: 'Number',
79
+ addonAfter: 'px',
80
+ name: ['marginBottom']
81
+ }
82
+ ]
83
+ },
84
+ {
85
+ type: 'Group',
86
+ label: '字体',
87
+ child: [
88
+ {
89
+ type: 'Select',
90
+ name: ['fontFamily-cn'],
91
+ bottomText: '中文字体'
92
+ },
93
+ {
94
+ type: 'Select',
95
+ name: ['fontFamily-en'],
96
+ bottomText: '英文/其他字体'
97
+ }
98
+ ]
99
+ },
100
+ {
101
+ type: 'Group',
102
+ label: '',
103
+ child: [
104
+ {
105
+ type: 'Color',
106
+ name: ['color']
107
+ },
108
+ {
109
+ type: 'Number',
110
+ addonAfter: 'px',
111
+ name: ['fontSize']
112
+ }
113
+ ]
114
+ },
115
+ {
116
+ label: '样式',
117
+ type: 'TextStyle'
118
+ },
119
+ {
120
+ label: '对齐',
121
+ type: 'TextAlign'
122
+ },
123
+ {
124
+ label: '间距',
125
+ type: 'TextSpace'
126
+ }
127
+ ]
128
+ }
129
+ ]
130
+ },
131
+ {
132
+ title: '加购按钮样式',
133
+ child: [
134
+ {
135
+ label: '英文大小写',
136
+ type: 'Select',
137
+ name: ['props', 'buttonStyle', 'textTransform'],
138
+ options: [
139
+ {
140
+ label: '默认',
141
+ value: 'unset'
142
+ },
143
+ {
144
+ label: '小写',
145
+ value: 'lowercase'
146
+ },
147
+ {
148
+ label: '大写',
149
+ value: 'uppercase'
150
+ }
151
+ ]
152
+ },
153
+ {
154
+ type: 'Color',
155
+ label: '背景色',
156
+ name: ['props', 'buttonStyle', 'backgroundColor'],
157
+ initialValue: '#000'
158
+ },
159
+ {
160
+ type: 'Group',
161
+ label: '尺寸',
162
+ child: [
163
+ {
164
+ type: 'Number',
165
+ name: ['props', 'buttonStyle', 'height'],
166
+ addonAfter: 'H'
167
+ }
168
+ ]
169
+ },
170
+ {
171
+ type: 'Group',
172
+ label: '圆角',
173
+ child: [
174
+ {
175
+ type: 'Slider',
176
+ name: ['props', 'buttonStyle', 'borderRadius'],
177
+ max: 100
178
+ },
179
+ {
180
+ type: 'Number',
181
+ name: ['props', 'buttonStyle', 'borderRadius'],
182
+ addonAfter: 'px',
183
+ max: 100
184
+ }
185
+ ]
186
+ },
187
+ {
188
+ type: 'TextMargin',
189
+ name: ['props', 'buttonStyle']
190
+ },
191
+ {
192
+ type: 'Group',
193
+ label: '字体',
194
+ child: [
195
+ {
196
+ type: 'Select',
197
+ name: ['props', 'buttonStyle', 'fontFamily-cn'],
198
+ bottomText: '中文字体'
199
+ },
200
+ {
201
+ type: 'Select',
202
+ name: ['props', 'buttonStyle', 'fontFamily-en'],
203
+ bottomText: '英文/其他字体'
204
+ }
205
+ ]
206
+ },
207
+ {
208
+ type: 'Group',
209
+ label: '',
210
+ child: [
211
+ {
212
+ type: 'Color',
213
+ name: ['props', 'buttonStyle', 'color'],
214
+ initialValue: '#fff'
215
+ },
216
+ {
217
+ type: 'Number',
218
+ name: ['props', 'buttonStyle', 'fontSize'],
219
+ addonAfter: 'px'
220
+ }
221
+ ]
222
+ },
223
+ {
224
+ type: 'TextStyle',
225
+ name: ['props', 'buttonStyle']
226
+ },
227
+ {
228
+ type: 'TextAlign',
229
+ name: ['props', 'buttonStyle']
230
+ },
231
+ {
232
+ label: '间距',
233
+ type: 'TextSpace',
234
+ name: ['props', 'buttonStyle']
235
+ }
236
+ ]
237
+ },
238
+ {
239
+ title: '文案配置',
240
+ child: [
241
+ {
242
+ type: 'Input',
243
+ label: '加购按钮文案',
244
+ name: ['props', 'texts', 'addToCart'],
245
+ placeholder: 'Add to Cart'
246
+ },
247
+ {
248
+ type: 'Input',
249
+ label: '选择规格提示',
250
+ name: ['props', 'texts', 'selectOptions'],
251
+ placeholder: 'Please select options'
252
+ },
253
+ {
254
+ type: 'Input',
255
+ label: '加载文案',
256
+ name: ['props', 'texts', 'loading'],
257
+ placeholder: 'Loading...'
258
+ },
259
+ {
260
+ type: 'Input',
261
+ label: '错误文案',
262
+ name: ['props', 'texts', 'error'],
263
+ placeholder: 'Failed to load product'
264
+ }
265
+ ]
266
+ },
267
+ {
268
+ title: '数量选择器',
269
+ child: [
270
+ {
271
+ type: 'Number',
272
+ label: '按钮间距',
273
+ name: ['props', 'quantityStyle', 'gap'],
274
+ addonAfter: 'px',
275
+ initialValue: 12
276
+ }
277
+ ]
278
+ }
279
+ ];
@@ -53,6 +53,8 @@ export interface ICommodityDetailProps {
53
53
  isTel?: boolean;
54
54
  iframeBgColor?: string;
55
55
  isActive?: boolean;
56
+ enableAddToCart?: boolean;
57
+ addToCartPopupId?: string;
56
58
  }
57
59
  declare const _default: React.NamedExoticComponent<ICommodityDetailProps>;
58
60
  export default _default;
@@ -17,8 +17,8 @@ const materials_1 = require("../../../../core/utils/materials");
17
17
  const event_1 = tslib_1.__importStar(require("../../../../core/utils/event"));
18
18
  const CommodityDetail = (_a) => {
19
19
  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;
20
- 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 = tslib_1.__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"]);
21
- const { sxpParameter, popupDetailData, isPreview, bffFbReport, popupCurTimeRef, checkCommodityIndexRef, globalConfig, ctaEvent } = (0, hooks_1.useSxpDataSource)();
20
+ 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 = tslib_1.__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"]);
21
+ const { sxpParameter, popupDetailData, isPreview, bffFbReport, popupCurTimeRef, checkCommodityIndexRef, globalConfig, ctaEvent, setPopupDetailData } = (0, hooks_1.useSxpDataSource)();
22
22
  const { jumpToWeb, productView } = (0, useEventReport_1.useEventReport)();
23
23
  const curTimeRef = (0, react_1.useRef)(null);
24
24
  const [showModal, setShowModal] = (0, react_1.useState)(false);
@@ -39,6 +39,27 @@ const CommodityDetail = (_a) => {
39
39
  cta = p === null || p === void 0 ? void 0 : p.bindCta;
40
40
  }
41
41
  const handleLink = (e) => {
42
+ if (enableAddToCart && addToCartPopupId) {
43
+ setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, data), { index: position }));
44
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
45
+ eventName: 'ClickCTA',
46
+ product: product ? [product] : undefined,
47
+ contentType: 'product',
48
+ data,
49
+ position,
50
+ cta_text: cta === null || cta === void 0 ? void 0 : cta.enTitle,
51
+ cta_action_type: 'open_internal_popup',
52
+ target_content_id: product === null || product === void 0 ? void 0 : product.itemId
53
+ });
54
+ console.log('[CommodityDetail] 打开加购弹窗:', addToCartPopupId);
55
+ if (typeof window !== 'undefined' && window.sxpPopup) {
56
+ window.sxpPopup(addToCartPopupId);
57
+ }
58
+ else {
59
+ console.warn('[CommodityDetail] sxpPopup 方法不存在');
60
+ }
61
+ return;
62
+ }
42
63
  if (product === null || product === void 0 ? void 0 : product.link) {
43
64
  jumpToWeb(e, data, product, cta, position);
44
65
  if (!isPost) {
@@ -63,6 +84,13 @@ const CommodityDetail = (_a) => {
63
84
  }
64
85
  window.location.href = window.getJointUtmLink(product.link);
65
86
  }
87
+ else {
88
+ console.warn('[CommodityDetail] 商品未配置跳转链接,且未启用加购功能', {
89
+ productId: product === null || product === void 0 ? void 0 : product.itemId,
90
+ enableAddToCart,
91
+ addToCartPopupId
92
+ });
93
+ }
66
94
  };
67
95
  (0, react_1.useEffect)(() => {
68
96
  var _a, _b;
@@ -270,5 +270,18 @@ declare const _default: ({
270
270
  addonAfter: string;
271
271
  initialValue?: undefined;
272
272
  })[];
273
+ } | {
274
+ title: string;
275
+ child: ({
276
+ label: string;
277
+ type: string;
278
+ name: string[];
279
+ placeholder?: undefined;
280
+ } | {
281
+ label: string;
282
+ type: string;
283
+ name: string[];
284
+ placeholder: string;
285
+ })[];
273
286
  })[];
274
287
  export default _default;
@@ -398,5 +398,21 @@ exports.default = [
398
398
  name: ['props', 'enableFixedCloseButton']
399
399
  }
400
400
  ]
401
+ },
402
+ {
403
+ title: '加购功能',
404
+ child: [
405
+ {
406
+ label: '启用加购弹窗',
407
+ type: 'Switch',
408
+ name: ['props', 'enableAddToCart']
409
+ },
410
+ {
411
+ label: '加购弹窗ID',
412
+ type: 'Input',
413
+ name: ['props', 'addToCartPopupId'],
414
+ placeholder: '请输入加购弹窗的ID'
415
+ }
416
+ ]
401
417
  }
402
418
  ];
@@ -5,3 +5,4 @@ export * from './CommodityDetailDiroNew/material';
5
5
  export * from './CommodityList/material';
6
6
  export * from './Iframe/material';
7
7
  export * from './ConsentDetail/material';
8
+ export * from './AddToCart/material';
@@ -8,3 +8,4 @@ tslib_1.__exportStar(require("./CommodityDetailDiroNew/material"), exports);
8
8
  tslib_1.__exportStar(require("./CommodityList/material"), exports);
9
9
  tslib_1.__exportStar(require("./Iframe/material"), exports);
10
10
  tslib_1.__exportStar(require("./ConsentDetail/material"), exports);
11
+ tslib_1.__exportStar(require("./AddToCart/material"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.20.18",
3
+ "version": "1.20.20",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",