pb-sxp-ui 1.20.17 → 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.
Files changed (48) hide show
  1. package/dist/index.cjs +732 -32
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +291 -0
  4. package/dist/index.js +732 -32
  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 +732 -32
  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 +24 -6
  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/CommodityDetailDiroNew/index.js +2 -2
  29. package/es/materials/sxp/popup/index.d.ts +1 -0
  30. package/es/materials/sxp/popup/index.js +1 -0
  31. package/lib/core/components/SxpPageRender/index.d.ts +2 -0
  32. package/lib/core/context/SxpDataSourceProvider.d.ts +1 -1
  33. package/lib/materials/sxp/popup/AddToCart/index.d.ts +33 -0
  34. package/lib/materials/sxp/popup/AddToCart/index.js +281 -0
  35. package/lib/materials/sxp/popup/AddToCart/interactionRender.d.ts +3 -0
  36. package/lib/materials/sxp/popup/AddToCart/interactionRender.js +14 -0
  37. package/lib/materials/sxp/popup/AddToCart/material.d.ts +2 -0
  38. package/lib/materials/sxp/popup/AddToCart/material.js +79 -0
  39. package/lib/materials/sxp/popup/AddToCart/settingRender.d.ts +160 -0
  40. package/lib/materials/sxp/popup/AddToCart/settingRender.js +279 -0
  41. package/lib/materials/sxp/popup/CommodityDetail/index.d.ts +2 -0
  42. package/lib/materials/sxp/popup/CommodityDetail/index.js +24 -6
  43. package/lib/materials/sxp/popup/CommodityDetail/settingRender.d.ts +13 -0
  44. package/lib/materials/sxp/popup/CommodityDetail/settingRender.js +16 -0
  45. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +2 -2
  46. package/lib/materials/sxp/popup/index.d.ts +1 -0
  47. package/lib/materials/sxp/popup/index.js +1 -0
  48. package/package.json +1 -1
@@ -0,0 +1,277 @@
1
+ export default [
2
+ {
3
+ title: 'Shopify配置',
4
+ child: [
5
+ {
6
+ type: 'Input',
7
+ label: 'Shopify域名',
8
+ name: ['props', 'shopifyDomain'],
9
+ placeholder: 'your-store.myshopify.com'
10
+ },
11
+ {
12
+ type: 'Input',
13
+ label: 'Storefront Token',
14
+ name: ['props', 'storefrontAccessToken'],
15
+ placeholder: 'Storefront Access Token'
16
+ }
17
+ ]
18
+ },
19
+ {
20
+ title: '弹窗背景',
21
+ child: [
22
+ {
23
+ type: 'Number',
24
+ label: '左右边距',
25
+ name: ['props', 'popupBg', 'horizontalMargin']
26
+ },
27
+ {
28
+ type: 'Number',
29
+ label: '下边距',
30
+ name: ['props', 'popupBg', 'bottomMargin']
31
+ }
32
+ ]
33
+ },
34
+ {
35
+ title: '商品信息样式',
36
+ child: [
37
+ {
38
+ name: ['props', 'variantStyles'],
39
+ type: 'SelectLinkage',
40
+ child: [
41
+ {
42
+ label: '字段',
43
+ type: 'Select',
44
+ options: [
45
+ {
46
+ label: '商品标题',
47
+ value: 'title'
48
+ },
49
+ {
50
+ label: '价格',
51
+ value: 'price'
52
+ },
53
+ {
54
+ label: '规格选项',
55
+ value: 'option'
56
+ },
57
+ {
58
+ label: '已选规格',
59
+ value: 'selectedOption'
60
+ }
61
+ ],
62
+ name: ['props', 'variantStyles', 'field'],
63
+ initialValue: 'title'
64
+ },
65
+ {
66
+ type: 'Group',
67
+ child: [
68
+ {
69
+ label: '上边距',
70
+ type: 'Number',
71
+ addonAfter: 'px',
72
+ name: ['marginTop']
73
+ },
74
+ {
75
+ label: '下边距',
76
+ type: 'Number',
77
+ addonAfter: 'px',
78
+ name: ['marginBottom']
79
+ }
80
+ ]
81
+ },
82
+ {
83
+ type: 'Group',
84
+ label: '字体',
85
+ child: [
86
+ {
87
+ type: 'Select',
88
+ name: ['fontFamily-cn'],
89
+ bottomText: '中文字体'
90
+ },
91
+ {
92
+ type: 'Select',
93
+ name: ['fontFamily-en'],
94
+ bottomText: '英文/其他字体'
95
+ }
96
+ ]
97
+ },
98
+ {
99
+ type: 'Group',
100
+ label: '',
101
+ child: [
102
+ {
103
+ type: 'Color',
104
+ name: ['color']
105
+ },
106
+ {
107
+ type: 'Number',
108
+ addonAfter: 'px',
109
+ name: ['fontSize']
110
+ }
111
+ ]
112
+ },
113
+ {
114
+ label: '样式',
115
+ type: 'TextStyle'
116
+ },
117
+ {
118
+ label: '对齐',
119
+ type: 'TextAlign'
120
+ },
121
+ {
122
+ label: '间距',
123
+ type: 'TextSpace'
124
+ }
125
+ ]
126
+ }
127
+ ]
128
+ },
129
+ {
130
+ title: '加购按钮样式',
131
+ child: [
132
+ {
133
+ label: '英文大小写',
134
+ type: 'Select',
135
+ name: ['props', 'buttonStyle', 'textTransform'],
136
+ options: [
137
+ {
138
+ label: '默认',
139
+ value: 'unset'
140
+ },
141
+ {
142
+ label: '小写',
143
+ value: 'lowercase'
144
+ },
145
+ {
146
+ label: '大写',
147
+ value: 'uppercase'
148
+ }
149
+ ]
150
+ },
151
+ {
152
+ type: 'Color',
153
+ label: '背景色',
154
+ name: ['props', 'buttonStyle', 'backgroundColor'],
155
+ initialValue: '#000'
156
+ },
157
+ {
158
+ type: 'Group',
159
+ label: '尺寸',
160
+ child: [
161
+ {
162
+ type: 'Number',
163
+ name: ['props', 'buttonStyle', 'height'],
164
+ addonAfter: 'H'
165
+ }
166
+ ]
167
+ },
168
+ {
169
+ type: 'Group',
170
+ label: '圆角',
171
+ child: [
172
+ {
173
+ type: 'Slider',
174
+ name: ['props', 'buttonStyle', 'borderRadius'],
175
+ max: 100
176
+ },
177
+ {
178
+ type: 'Number',
179
+ name: ['props', 'buttonStyle', 'borderRadius'],
180
+ addonAfter: 'px',
181
+ max: 100
182
+ }
183
+ ]
184
+ },
185
+ {
186
+ type: 'TextMargin',
187
+ name: ['props', 'buttonStyle']
188
+ },
189
+ {
190
+ type: 'Group',
191
+ label: '字体',
192
+ child: [
193
+ {
194
+ type: 'Select',
195
+ name: ['props', 'buttonStyle', 'fontFamily-cn'],
196
+ bottomText: '中文字体'
197
+ },
198
+ {
199
+ type: 'Select',
200
+ name: ['props', 'buttonStyle', 'fontFamily-en'],
201
+ bottomText: '英文/其他字体'
202
+ }
203
+ ]
204
+ },
205
+ {
206
+ type: 'Group',
207
+ label: '',
208
+ child: [
209
+ {
210
+ type: 'Color',
211
+ name: ['props', 'buttonStyle', 'color'],
212
+ initialValue: '#fff'
213
+ },
214
+ {
215
+ type: 'Number',
216
+ name: ['props', 'buttonStyle', 'fontSize'],
217
+ addonAfter: 'px'
218
+ }
219
+ ]
220
+ },
221
+ {
222
+ type: 'TextStyle',
223
+ name: ['props', 'buttonStyle']
224
+ },
225
+ {
226
+ type: 'TextAlign',
227
+ name: ['props', 'buttonStyle']
228
+ },
229
+ {
230
+ label: '间距',
231
+ type: 'TextSpace',
232
+ name: ['props', 'buttonStyle']
233
+ }
234
+ ]
235
+ },
236
+ {
237
+ title: '文案配置',
238
+ child: [
239
+ {
240
+ type: 'Input',
241
+ label: '加购按钮文案',
242
+ name: ['props', 'texts', 'addToCart'],
243
+ placeholder: 'Add to Cart'
244
+ },
245
+ {
246
+ type: 'Input',
247
+ label: '选择规格提示',
248
+ name: ['props', 'texts', 'selectOptions'],
249
+ placeholder: 'Please select options'
250
+ },
251
+ {
252
+ type: 'Input',
253
+ label: '加载文案',
254
+ name: ['props', 'texts', 'loading'],
255
+ placeholder: 'Loading...'
256
+ },
257
+ {
258
+ type: 'Input',
259
+ label: '错误文案',
260
+ name: ['props', 'texts', 'error'],
261
+ placeholder: 'Failed to load product'
262
+ }
263
+ ]
264
+ },
265
+ {
266
+ title: '数量选择器',
267
+ child: [
268
+ {
269
+ type: 'Number',
270
+ label: '按钮间距',
271
+ name: ['props', 'quantityStyle', 'gap'],
272
+ addonAfter: 'px',
273
+ initialValue: 12
274
+ }
275
+ ]
276
+ }
277
+ ];
@@ -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;
@@ -15,8 +15,8 @@ import { getPriceText } from '../../../../core/utils/materials';
15
15
  import SXP_EVENT_BUS, { SXP_EVENT_TYPE } from '../../../../core/utils/event';
16
16
  const CommodityDetail = (_a) => {
17
17
  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;
18
- 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"]);
19
- const { sxpParameter, popupDetailData, isPreview, bffFbReport, popupCurTimeRef, checkCommodityIndexRef, globalConfig, ctaEvent } = useSxpDataSource();
18
+ 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"]);
19
+ const { sxpParameter, popupDetailData, isPreview, bffFbReport, popupCurTimeRef, checkCommodityIndexRef, globalConfig, ctaEvent, setPopupDetailData } = useSxpDataSource();
20
20
  const { jumpToWeb, productView } = useEventReport();
21
21
  const curTimeRef = useRef(null);
22
22
  const [showModal, setShowModal] = useState(false);
@@ -37,6 +37,23 @@ const CommodityDetail = (_a) => {
37
37
  cta = p === null || p === void 0 ? void 0 : p.bindCta;
38
38
  }
39
39
  const handleLink = (e) => {
40
+ if (enableAddToCart && addToCartPopupId) {
41
+ setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, data), { index: position }));
42
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
43
+ eventName: 'ClickCTA',
44
+ product: product ? [product] : undefined,
45
+ contentType: 'product',
46
+ data,
47
+ position,
48
+ cta_text: cta === null || cta === void 0 ? void 0 : cta.enTitle,
49
+ cta_action_type: 'open_internal_popup',
50
+ target_content_id: product === null || product === void 0 ? void 0 : product.itemId
51
+ });
52
+ if (typeof window !== 'undefined' && window.sxpPopup) {
53
+ window.sxpPopup(addToCartPopupId);
54
+ }
55
+ return;
56
+ }
40
57
  if (product === null || product === void 0 ? void 0 : product.link) {
41
58
  jumpToWeb(e, data, product, cta, position);
42
59
  if (!isPost) {
@@ -161,10 +178,11 @@ const CommodityDetail = (_a) => {
161
178
  };
162
179
  const renderBtn = () => {
163
180
  var _a, _b;
164
- return (React.createElement(React.Fragment, null, (isDefault || (product === null || product === void 0 ? void 0 : product.link)) && (React.createElement("a", { "aria-label": (_a = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _a !== void 0 ? _a : 'Purchase on Website', role: 'button', tabIndex: 0, onClick: handleLink, className: 'pb-commondity-btn', style: buttonStyle },
165
- React.createElement("span", { dangerouslySetInnerHTML: {
166
- __html: setFontForText((_b = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _b !== void 0 ? _b : 'Purchase on Website', buttonStyle)
167
- } })))));
181
+ return (React.createElement(React.Fragment, null,
182
+ React.createElement("a", { "aria-label": (_a = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _a !== void 0 ? _a : 'Purchase on Website', role: 'button', tabIndex: 0, onClick: handleLink, className: 'pb-commondity-btn', style: buttonStyle },
183
+ React.createElement("span", { dangerouslySetInnerHTML: {
184
+ __html: setFontForText((_b = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _b !== void 0 ? _b : 'Purchase on Website', buttonStyle)
185
+ } }))));
168
186
  };
169
187
  const getStyle = useCallback((style) => {
170
188
  if (style === null || style === void 0 ? void 0 : style.lineClamp) {
@@ -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;
@@ -396,5 +396,21 @@ export default [
396
396
  name: ['props', 'enableFixedCloseButton']
397
397
  }
398
398
  ]
399
+ },
400
+ {
401
+ title: '加购功能',
402
+ child: [
403
+ {
404
+ label: '启用加购弹窗',
405
+ type: 'Switch',
406
+ name: ['props', 'enableAddToCart']
407
+ },
408
+ {
409
+ label: '加购弹窗ID',
410
+ type: 'Input',
411
+ name: ['props', 'addToCartPopupId'],
412
+ placeholder: '请输入加购弹窗的ID'
413
+ }
414
+ ]
399
415
  }
400
416
  ];
@@ -281,10 +281,10 @@ Made in Italy` })));
281
281
  React.createElement("div", { className: 'pb-commondityDiroNew-content-top-right-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.taxInfo), style: getStyle(commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo), dangerouslySetInnerHTML: {
282
282
  __html: setFontForText((_2 = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _2 !== void 0 ? _2 : '税费', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo)
283
283
  } }))),
284
- (!product || (product === null || product === void 0 ? void 0 : product.link)) && (React.createElement("a", { "aria-label": (_3 = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _3 !== void 0 ? _3 : 'Shop now', role: 'button', tabIndex: 0, onClick: handleLink, className: 'pb-commondityDiroNew-btn', style: buttonStyle },
284
+ React.createElement("a", { "aria-label": (_3 = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _3 !== void 0 ? _3 : 'Shop now', role: 'button', tabIndex: 0, onClick: handleLink, className: 'pb-commondityDiroNew-btn', style: buttonStyle },
285
285
  React.createElement("span", { dangerouslySetInnerHTML: {
286
286
  __html: setFontForText((_4 = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _4 !== void 0 ? _4 : 'Shop now', buttonStyle)
287
- } }))),
287
+ } })),
288
288
  productInfoText({ isPost }))),
289
289
  React.createElement(Modal, { visible: showModal, onClose: () => setShowModal(false) },
290
290
  React.createElement("div", { style: { paddingTop: '34px' } }, productInfoText({ isPost: false }))),
@@ -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';
@@ -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';
@@ -79,6 +79,8 @@ export interface ISxpPageRenderProps {
79
79
  expires?: number;
80
80
  enable?: boolean;
81
81
  };
82
+ shopifyDomain?: string;
83
+ storefrontAccessToken?: string;
82
84
  };
83
85
  descStyle?: CSSProperties;
84
86
  tipText?: {
@@ -12,7 +12,7 @@ export interface IEventTimeType {
12
12
  time: Date;
13
13
  target: EventTarget;
14
14
  }
15
- export type ICapiEventNameType = 'PageView' | 'ProductView' | 'ViewContent' | 'ClickCTA' | 'ContentSwipe' | 'Engagement' | 'ExitFeed';
15
+ export type ICapiEventNameType = 'PageView' | 'ProductView' | 'ViewContent' | 'ClickCTA' | 'ContentSwipe' | 'Engagement' | 'ExitFeed' | 'AddToCart';
16
16
  export interface ISxpDataSourceContext {
17
17
  rtcList: RecItemType[];
18
18
  setRtcList?: React.Dispatch<React.SetStateAction<RecItemType[]>>;
@@ -0,0 +1,33 @@
1
+ import { FC, CSSProperties } from 'react';
2
+ import './index.less';
3
+ export interface IAddToCartPopupProps {
4
+ style?: CSSProperties;
5
+ isActive?: boolean;
6
+ index?: number;
7
+ shopifyDomain?: string;
8
+ storefrontAccessToken?: string;
9
+ variantStyles?: {
10
+ title?: CSSProperties;
11
+ price?: CSSProperties;
12
+ option?: CSSProperties;
13
+ selectedOption?: CSSProperties;
14
+ };
15
+ buttonStyle?: CSSProperties;
16
+ quantityStyle?: CSSProperties;
17
+ texts?: {
18
+ addToCart?: string;
19
+ selectOptions?: string;
20
+ loading?: string;
21
+ error?: string;
22
+ color?: string;
23
+ size?: string;
24
+ material?: string;
25
+ style?: string;
26
+ };
27
+ popupBg?: {
28
+ horizontalMargin?: number;
29
+ bottomMargin?: number;
30
+ };
31
+ }
32
+ declare const AddToCartPopup: FC<IAddToCartPopupProps>;
33
+ export default AddToCartPopup;