pb-sxp-ui 1.20.2 → 1.20.4

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 (45) hide show
  1. package/dist/index.cjs +379 -123
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +379 -123
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.cjs +7 -7
  6. package/dist/index.min.cjs.map +1 -1
  7. package/dist/index.min.js +7 -7
  8. package/dist/index.min.js.map +1 -1
  9. package/dist/pb-ui.js +379 -123
  10. package/dist/pb-ui.js.map +1 -1
  11. package/dist/pb-ui.min.js +7 -7
  12. package/dist/pb-ui.min.js.map +1 -1
  13. package/es/core/components/SxpPageRender/LikeButton/index.js +12 -4
  14. package/es/core/components/SxpPageRender/VideoWidget/index.js +6 -2
  15. package/es/core/components/SxpPageRender/WaterFall/List.js +12 -22
  16. package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +6 -4
  17. package/es/core/components/SxpPageRender/WaterFall/index.js +6 -2
  18. package/es/core/components/SxpPageRender/index.js +62 -16
  19. package/es/core/context/SxpDataSourceProvider.d.ts +8 -3
  20. package/es/core/context/SxpDataSourceProvider.js +63 -43
  21. package/es/core/utils/tool.d.ts +2 -1
  22. package/es/core/utils/tool.js +15 -1
  23. package/es/materials/sxp/cta/AniLink/index.js +18 -7
  24. package/es/materials/sxp/cta/AniLinkPopup/index.js +21 -10
  25. package/es/materials/sxp/popup/CommodityDetail/index.js +59 -2
  26. package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +60 -3
  27. package/es/materials/sxp/popup/CommodityList/index.js +21 -5
  28. package/es/materials/sxp/template/components/EventProvider.js +22 -10
  29. package/lib/core/components/SxpPageRender/LikeButton/index.js +12 -4
  30. package/lib/core/components/SxpPageRender/VideoWidget/index.js +6 -2
  31. package/lib/core/components/SxpPageRender/WaterFall/List.js +11 -21
  32. package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +6 -4
  33. package/lib/core/components/SxpPageRender/WaterFall/index.js +6 -2
  34. package/lib/core/components/SxpPageRender/index.js +62 -16
  35. package/lib/core/context/SxpDataSourceProvider.d.ts +8 -3
  36. package/lib/core/context/SxpDataSourceProvider.js +61 -41
  37. package/lib/core/utils/tool.d.ts +2 -1
  38. package/lib/core/utils/tool.js +16 -1
  39. package/lib/materials/sxp/cta/AniLink/index.js +18 -7
  40. package/lib/materials/sxp/cta/AniLinkPopup/index.js +21 -10
  41. package/lib/materials/sxp/popup/CommodityDetail/index.js +59 -2
  42. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +60 -3
  43. package/lib/materials/sxp/popup/CommodityList/index.js +21 -5
  44. package/lib/materials/sxp/template/components/EventProvider.js +22 -10
  45. package/package.json +1 -1
@@ -14,6 +14,7 @@ const ExpandableText_1 = tslib_1.__importDefault(require("../../../../core/compo
14
14
  const FormatImage_1 = tslib_1.__importDefault(require("../../../../core/components/SxpPageRender/FormatImage"));
15
15
  const tool_1 = require("../../../../core/utils/tool");
16
16
  const materials_1 = require("../../../../core/utils/materials");
17
+ const event_1 = tslib_1.__importStar(require("../../../../core/utils/event"));
17
18
  const CommodityDetail = (_a) => {
18
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;
19
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"]);
@@ -48,22 +49,78 @@ const CommodityDetail = (_a) => {
48
49
  eventSubject: 'clickCta',
49
50
  eventDescription: 'User clicked the CTA'
50
51
  }, data, product, position);
52
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
53
+ eventName: 'ClickCTA',
54
+ product: product ? [product] : undefined,
55
+ contentType: 'product',
56
+ data,
57
+ position,
58
+ cta_text: cta === null || cta === void 0 ? void 0 : cta.enTitle,
59
+ cta_action_type: 'open_external_link',
60
+ target_content_id: product === null || product === void 0 ? void 0 : product.itemId,
61
+ target_url: product.link
62
+ });
51
63
  }
52
64
  window.location.href = window.getJointUtmLink(product.link);
53
65
  }
54
66
  };
55
67
  (0, react_1.useEffect)(() => {
68
+ var _a;
56
69
  if (!isActive)
57
70
  return;
71
+ const recData = Object.assign(Object.assign({}, data), { video: (data === null || data === void 0 ? void 0 : data.video) ? Object.assign(Object.assign({}, data === null || data === void 0 ? void 0 : data.video), { title: '', imgUrls: !isPost ? product === null || product === void 0 ? void 0 : product.homePage : (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.imgUrls }) : null });
58
72
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
59
73
  eventName: 'ProductView',
60
- product
74
+ product: product ? [product] : undefined,
75
+ contentType: 'product',
76
+ rec: recData,
77
+ position
61
78
  });
62
79
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
63
80
  eventName: 'PageView',
64
- product
81
+ product: product ? [product] : undefined,
82
+ contentType: 'product',
83
+ rec: recData,
84
+ position
65
85
  });
66
86
  }, [isActive, bffFbReport]);
87
+ (0, react_1.useEffect)(() => {
88
+ if (!isActive || isPost)
89
+ return;
90
+ const onShow = () => {
91
+ curTimeRef.current = new Date();
92
+ };
93
+ const recData = Object.assign(Object.assign({}, data), { video: (data === null || data === void 0 ? void 0 : data.video) ? Object.assign(Object.assign({}, data === null || data === void 0 ? void 0 : data.video), { title: '' }) : null });
94
+ const onHide = () => {
95
+ var _a;
96
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
97
+ eventName: 'ExitFeed',
98
+ product: product ? [product] : undefined,
99
+ contentType: 'product',
100
+ rec: recData,
101
+ position,
102
+ view_time: new Date() - curTimeRef.current,
103
+ content_id: (_a = product === null || product === void 0 ? void 0 : product.itemId) !== null && _a !== void 0 ? _a : ''
104
+ });
105
+ };
106
+ event_1.default.on(event_1.SXP_EVENT_TYPE.PAGE_DID_SHOW, () => onShow());
107
+ event_1.default.on(event_1.SXP_EVENT_TYPE.PAGE_DID_HIDE, () => onHide());
108
+ return () => {
109
+ var _a;
110
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
111
+ eventName: 'Engagement',
112
+ product: product ? [product] : undefined,
113
+ rec: recData,
114
+ position,
115
+ content_id: (_a = product === null || product === void 0 ? void 0 : product.itemId) !== null && _a !== void 0 ? _a : '',
116
+ engagement_type: 'close_popup',
117
+ contentType: 'product',
118
+ view_time: new Date() - curTimeRef.current
119
+ });
120
+ event_1.default.off(event_1.SXP_EVENT_TYPE.PAGE_DID_SHOW, () => onShow());
121
+ event_1.default.off(event_1.SXP_EVENT_TYPE.PAGE_DID_HIDE, () => onHide());
122
+ };
123
+ }, [isActive, isPost, bffFbReport, data, product, position, curTimeRef]);
67
124
  (0, react_1.useEffect)(() => {
68
125
  const initTime = () => {
69
126
  curTimeRef.current = new Date();
@@ -14,6 +14,7 @@ const useEventReport_1 = require("../../../../core/hooks/useEventReport");
14
14
  const FormatImage_1 = tslib_1.__importDefault(require("../../../../core/components/SxpPageRender/FormatImage"));
15
15
  const tool_1 = require("../../../../core/utils/tool");
16
16
  const materials_1 = require("../../../../core/utils/materials");
17
+ const event_1 = tslib_1.__importStar(require("../../../../core/utils/event"));
17
18
  const CommodityDetailDiroNew = (_a) => {
18
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, _1, _2, _3, _4;
19
20
  var { style, isDefault, rec, viewTime, isPost, bottom_image, tipText, swiper, commodityStyles, buttonStyle, index, commodityGroup, popupBg, iframeIcon, commodityImgRatio, isTel, iframeBgColor, isActive = true } = _a, props = tslib_1.__rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "tipText", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup", "popupBg", "iframeIcon", "commodityImgRatio", "isTel", "iframeBgColor", "isActive"]);
@@ -52,22 +53,78 @@ const CommodityDetailDiroNew = (_a) => {
52
53
  eventSubject: 'clickCta',
53
54
  eventDescription: 'User clicked the CTA'
54
55
  }, data, product, position);
56
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
57
+ eventName: 'ClickCTA',
58
+ product: product ? [product] : undefined,
59
+ contentType: 'product',
60
+ data,
61
+ position,
62
+ cta_text: cta === null || cta === void 0 ? void 0 : cta.enTitle,
63
+ cta_action_type: 'open_external_link',
64
+ target_content_id: product === null || product === void 0 ? void 0 : product.itemId,
65
+ target_url: product.link
66
+ });
55
67
  }
56
68
  window.location.href = window.getJointUtmLink(product.link);
57
69
  }
58
70
  };
59
71
  (0, react_1.useEffect)(() => {
72
+ var _a;
60
73
  if (!isActive)
61
74
  return;
75
+ const recData = Object.assign(Object.assign({}, data), { video: (data === null || data === void 0 ? void 0 : data.video) ? Object.assign(Object.assign({}, data === null || data === void 0 ? void 0 : data.video), { title: '', imgUrls: !isPost ? product === null || product === void 0 ? void 0 : product.homePage : (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.imgUrls }) : null });
62
76
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
63
77
  eventName: 'ProductView',
64
- product
78
+ product: product ? [product] : undefined,
79
+ contentType: 'product',
80
+ rec: recData,
81
+ position
65
82
  });
66
83
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
67
84
  eventName: 'PageView',
68
- product
85
+ product: product ? [product] : undefined,
86
+ contentType: 'product',
87
+ rec: recData,
88
+ position
69
89
  });
70
- }, [isActive, bffFbReport]);
90
+ }, [isActive, bffFbReport, isPost]);
91
+ (0, react_1.useEffect)(() => {
92
+ if (!isActive || isPost)
93
+ return;
94
+ const onShow = () => {
95
+ curTimeRef.current = new Date();
96
+ };
97
+ const recData = Object.assign(Object.assign({}, data), { video: (data === null || data === void 0 ? void 0 : data.video) ? Object.assign(Object.assign({}, data === null || data === void 0 ? void 0 : data.video), { title: '' }) : null });
98
+ const onHide = () => {
99
+ var _a;
100
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
101
+ eventName: 'ExitFeed',
102
+ product: product ? [product] : undefined,
103
+ contentType: 'product',
104
+ rec: recData,
105
+ position,
106
+ view_time: new Date() - curTimeRef.current,
107
+ content_id: (_a = product === null || product === void 0 ? void 0 : product.itemId) !== null && _a !== void 0 ? _a : ''
108
+ });
109
+ };
110
+ event_1.default.on(event_1.SXP_EVENT_TYPE.PAGE_DID_SHOW, () => onShow());
111
+ event_1.default.on(event_1.SXP_EVENT_TYPE.PAGE_DID_HIDE, () => onHide());
112
+ return () => {
113
+ var _a;
114
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
115
+ eventName: 'Engagement',
116
+ product: product ? [product] : undefined,
117
+ rec: recData,
118
+ position,
119
+ content_id: (_a = product === null || product === void 0 ? void 0 : product.itemId) !== null && _a !== void 0 ? _a : '',
120
+ engagement_type: 'close_popup',
121
+ contentType: 'product',
122
+ view_time: new Date() - curTimeRef.current
123
+ });
124
+ event_1.default.off(event_1.SXP_EVENT_TYPE.PAGE_DID_SHOW, () => onShow());
125
+ event_1.default.off(event_1.SXP_EVENT_TYPE.PAGE_DID_HIDE, () => onHide());
126
+ };
127
+ }, [isActive, isPost, bffFbReport, data, product, position, curTimeRef]);
71
128
  (0, react_1.useEffect)(() => {
72
129
  const initTime = () => {
73
130
  if (!isActive)
@@ -29,16 +29,28 @@ const CommodityList = (_a) => {
29
29
  });
30
30
  }, [(_d = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _d === void 0 ? void 0 : _d.enableFormattedPrice, globalConfig]);
31
31
  const handleClick = (0, lodash_1.throttle)((item, multiCheckIndex, e) => {
32
+ var _a;
32
33
  ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
33
34
  eventSubject: 'clickCta',
34
35
  eventDescription: 'User clicked the CTA'
35
36
  }, recData, item, index);
37
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
38
+ eventName: 'ClickCTA',
39
+ product: item ? [item] : undefined,
40
+ contentType: 'product',
41
+ recData,
42
+ index,
43
+ cta_text: (_a = item === null || item === void 0 ? void 0 : item.bindCta) === null || _a === void 0 ? void 0 : _a.enTitle,
44
+ cta_action_type: isExternalLink && !!(item === null || item === void 0 ? void 0 : item.link) ? 'open_external_link' : 'open_internal_popup',
45
+ target_content_id: item === null || item === void 0 ? void 0 : item.itemId,
46
+ target_url: item.link
47
+ });
36
48
  setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, recData), { video: Object.assign(Object.assign({}, recData === null || recData === void 0 ? void 0 : recData.video), { bindProduct: item }), index, multiCheckIndex }));
37
49
  if (isExternalLink) {
38
- if (item === null || item === void 0 ? void 0 : item.link) {
39
- jumpToWeb(e, recData, item, item.bindCta, index);
40
- window.location.href = window.getJointUtmLink(item.link);
41
- }
50
+ if (!(item === null || item === void 0 ? void 0 : item.link))
51
+ return;
52
+ jumpToWeb(e, recData, item, item.bindCta, index);
53
+ window.location.href = window.getJointUtmLink(item.link);
42
54
  }
43
55
  else {
44
56
  onClick === null || onClick === void 0 ? void 0 : onClick();
@@ -46,7 +58,11 @@ const CommodityList = (_a) => {
46
58
  }, popup === null || popup === void 0 ? void 0 : popup.duration);
47
59
  (0, react_1.useEffect)(() => {
48
60
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
49
- eventName: 'PageView'
61
+ eventName: 'PageView',
62
+ product: (product !== null && product !== void 0 ? product : []),
63
+ contentType: 'product',
64
+ rec: recData,
65
+ position: index
50
66
  });
51
67
  }, []);
52
68
  return (react_1.default.createElement("ul", { role: 'list', className: (0, css_1.css)(Object.assign(Object.assign({}, style), { display: 'flex', flexDirection: 'column', gap: '10px', padding: '0 20px', marginTop: '50px', boxSizing: 'border-box' })) }, product === null || product === void 0 ? void 0 : product.map((item, index) => {
@@ -9,28 +9,40 @@ const EventProvider = (_a) => {
9
9
  var { rec, children, className, onClick, style, isExternalLink = false, index, jumpLink, multItem, multiCheckIndex } = _a, props = tslib_1.__rest(_a, ["rec", "children", "className", "onClick", "style", "isExternalLink", "index", "jumpLink", "multItem", "multiCheckIndex"]);
10
10
  const ref = (0, react_1.useRef)(null);
11
11
  const { popup } = (0, hooks_1.useEditor)();
12
- const { setPopupDetailData, ctaEvent } = (0, hooks_1.useSxpDataSource)();
12
+ const { setPopupDetailData, ctaEvent, bffFbReport } = (0, hooks_1.useSxpDataSource)();
13
13
  const { jumpToWeb } = (0, useEventReport_1.useEventReport)();
14
14
  const [element, setElement] = (0, react_1.useState)(null);
15
15
  const handleClick = (0, lodash_1.throttle)((e) => {
16
- var _a, _b, _c, _d, _e, _f;
16
+ var _a, _b, _c, _d, _e, _f, _g, _h;
17
17
  e.preventDefault();
18
- const item = multItem ? multItem : (_b = (_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProduct) !== null && _b !== void 0 ? _b : rec === null || rec === void 0 ? void 0 : rec.video;
18
+ const item = multItem || ((_b = (_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProduct) !== null && _b !== void 0 ? _b : rec === null || rec === void 0 ? void 0 : rec.video);
19
+ const link = jumpLink || ((_d = (_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.bindProduct) === null || _d === void 0 ? void 0 : _d.link) || (multItem === null || multItem === void 0 ? void 0 : multItem.link) || '';
19
20
  ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
20
21
  eventSubject: 'clickCta',
21
22
  eventDescription: 'User clicked the CTA'
22
23
  }, rec, item, index);
24
+ const product = multItem || ((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.bindProduct);
25
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
26
+ eventName: 'ClickCTA',
27
+ product: product ? [product] : undefined,
28
+ contentType: 'post',
29
+ rec,
30
+ index,
31
+ cta_text: (_f = item === null || item === void 0 ? void 0 : item.bindCta) === null || _f === void 0 ? void 0 : _f.enTitle,
32
+ cta_action_type: isExternalLink && (!!link) ? 'open_external_link' : 'open_internal_popup',
33
+ target_content_id: product === null || product === void 0 ? void 0 : product.itemId,
34
+ target_url: link
35
+ });
23
36
  setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(multItem && multiCheckIndex !== undefined && multiCheckIndex >= 0
24
37
  ? Object.assign(Object.assign({}, rec), { video: Object.assign(Object.assign({}, rec === null || rec === void 0 ? void 0 : rec.video), { bindProduct: multItem }), index, multiCheckIndex }) : Object.assign(Object.assign({}, rec), { index }));
25
38
  setElement(ref === null || ref === void 0 ? void 0 : ref.current);
26
39
  if (isExternalLink) {
27
- const link = ((_d = (_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.bindProduct) === null || _d === void 0 ? void 0 : _d.link) || (multItem === null || multItem === void 0 ? void 0 : multItem.link);
28
- if (jumpLink || link) {
29
- const cta = ((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.bindCta) || (multItem === null || multItem === void 0 ? void 0 : multItem.bindCta);
30
- const product = ((_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.bindProduct) || multItem;
31
- jumpToWeb(e, rec, product, cta, index);
32
- window.location.href = window.getJointUtmLink(jumpLink || link || '');
33
- }
40
+ if (!link)
41
+ return;
42
+ const cta = ((_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.bindCta) || (multItem === null || multItem === void 0 ? void 0 : multItem.bindCta);
43
+ const product = ((_h = rec === null || rec === void 0 ? void 0 : rec.video) === null || _h === void 0 ? void 0 : _h.bindProduct) || multItem;
44
+ jumpToWeb(e, rec, product, cta, index);
45
+ window.location.href = window.getJointUtmLink(link);
34
46
  }
35
47
  else {
36
48
  onClick === null || onClick === void 0 ? void 0 : onClick();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.20.2",
3
+ "version": "1.20.4",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",