pb-sxp-ui 1.0.3 → 1.0.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 (50) hide show
  1. package/dist/index.cjs +64 -23
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +1 -0
  4. package/dist/index.js +64 -23
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.cjs +3 -3
  7. package/dist/index.min.cjs.map +1 -1
  8. package/dist/index.min.js +3 -3
  9. package/dist/index.min.js.map +1 -1
  10. package/dist/pb-ui.js +64 -23
  11. package/dist/pb-ui.js.map +1 -1
  12. package/dist/pb-ui.min.js +3 -3
  13. package/dist/pb-ui.min.js.map +1 -1
  14. package/es/core/components/SxpPageRender/RenderCard.js +3 -2
  15. package/es/core/components/SxpPageRender/index.js +1 -2
  16. package/es/materials/sxp/template/Appoint/index.d.ts +1 -0
  17. package/es/materials/sxp/template/Appoint/index.js +3 -3
  18. package/es/materials/sxp/template/Commodity/index.d.ts +1 -0
  19. package/es/materials/sxp/template/Commodity/index.js +2 -2
  20. package/es/materials/sxp/template/CommodityDiro/index.d.ts +1 -0
  21. package/es/materials/sxp/template/CommodityDiro/index.js +2 -2
  22. package/es/materials/sxp/template/CommodityDiroNew/index.d.ts +1 -0
  23. package/es/materials/sxp/template/CommodityDiroNew/index.js +2 -2
  24. package/es/materials/sxp/template/MultiCommodity/index.d.ts +1 -0
  25. package/es/materials/sxp/template/MultiCommodity/index.js +13 -2
  26. package/es/materials/sxp/template/MultiCommodityDiro/index.d.ts +1 -0
  27. package/es/materials/sxp/template/MultiCommodityDiro/index.js +13 -2
  28. package/es/materials/sxp/template/MultiCommodityDiroNew/index.d.ts +1 -0
  29. package/es/materials/sxp/template/MultiCommodityDiroNew/index.js +13 -2
  30. package/es/materials/sxp/template/components/EventProvider.d.ts +1 -0
  31. package/es/materials/sxp/template/components/EventProvider.js +15 -3
  32. package/lib/core/components/SxpPageRender/RenderCard.js +3 -2
  33. package/lib/core/components/SxpPageRender/index.js +1 -2
  34. package/lib/materials/sxp/template/Appoint/index.d.ts +1 -0
  35. package/lib/materials/sxp/template/Appoint/index.js +3 -3
  36. package/lib/materials/sxp/template/Commodity/index.d.ts +1 -0
  37. package/lib/materials/sxp/template/Commodity/index.js +2 -2
  38. package/lib/materials/sxp/template/CommodityDiro/index.d.ts +1 -0
  39. package/lib/materials/sxp/template/CommodityDiro/index.js +2 -2
  40. package/lib/materials/sxp/template/CommodityDiroNew/index.d.ts +1 -0
  41. package/lib/materials/sxp/template/CommodityDiroNew/index.js +2 -2
  42. package/lib/materials/sxp/template/MultiCommodity/index.d.ts +1 -0
  43. package/lib/materials/sxp/template/MultiCommodity/index.js +13 -2
  44. package/lib/materials/sxp/template/MultiCommodityDiro/index.d.ts +1 -0
  45. package/lib/materials/sxp/template/MultiCommodityDiro/index.js +13 -2
  46. package/lib/materials/sxp/template/MultiCommodityDiroNew/index.d.ts +1 -0
  47. package/lib/materials/sxp/template/MultiCommodityDiroNew/index.js +13 -2
  48. package/lib/materials/sxp/template/components/EventProvider.d.ts +1 -0
  49. package/lib/materials/sxp/template/components/EventProvider.js +15 -3
  50. package/package.json +1 -1
@@ -9,19 +9,30 @@ const Scroll_1 = tslib_1.__importDefault(require("../components/Scroll"));
9
9
  const Img_1 = tslib_1.__importDefault(require("../components/Img"));
10
10
  const index_module_less_1 = tslib_1.__importDefault(require("./index.module.less"));
11
11
  const hooks_1 = require("../../../../core/hooks");
12
+ const useEventReport_1 = require("../../../../core/hooks/useEventReport");
12
13
  const MultiCommodityDiroNew = (_a) => {
13
14
  var _b, _c;
14
- var { content, style, bgImg, recData, onClick, bottom_image, ctaTempStyles } = _a, props = tslib_1.__rest(_a, ["content", "style", "bgImg", "recData", "onClick", "bottom_image", "ctaTempStyles"]);
15
+ var { content, style, bgImg, recData, onClick, bottom_image, ctaTempStyles, isExternalLink } = _a, props = tslib_1.__rest(_a, ["content", "style", "bgImg", "recData", "onClick", "bottom_image", "ctaTempStyles", "isExternalLink"]);
15
16
  const { ctaEvent, setPopupDetailData, sxpParameter } = (0, hooks_1.useSxpDataSource)();
16
17
  const { popupAni } = (0, hooks_1.useEditor)();
18
+ const { jumpToWeb } = (0, useEventReport_1.useEventReport)();
17
19
  const [products, setProducts] = (0, react_1.useState)((_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProducts) !== null && _c !== void 0 ? _c : [1, 2]);
18
20
  const handleClick = (0, lodash_1.throttle)((item) => {
21
+ var _a;
19
22
  ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
20
23
  eventSubject: 'clickCta',
21
24
  eventDescription: 'User clicked the CTA'
22
25
  }, recData, item);
23
26
  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 }) }));
24
- onClick === null || onClick === void 0 ? void 0 : onClick();
27
+ if (isExternalLink) {
28
+ if ((_a = item === null || item === void 0 ? void 0 : item.bindCta) === null || _a === void 0 ? void 0 : _a.link) {
29
+ jumpToWeb(recData, item, item.bindCta);
30
+ window.location.href = item.bindCta.link;
31
+ }
32
+ }
33
+ else {
34
+ onClick === null || onClick === void 0 ? void 0 : onClick();
35
+ }
25
36
  }, popupAni === null || popupAni === void 0 ? void 0 : popupAni.duration);
26
37
  return (react_1.default.createElement(Scroll_1.default, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
27
38
  var _a, _b, _c, _d, _e, _f;
@@ -6,6 +6,7 @@ export interface IImgProps {
6
6
  className?: any;
7
7
  onClick?: any;
8
8
  style?: CSSProperties;
9
+ isExternalLink?: boolean;
9
10
  }
10
11
  declare const _default: React.NamedExoticComponent<IImgProps>;
11
12
  export default _default;
@@ -5,12 +5,14 @@ const react_1 = tslib_1.__importStar(require("react"));
5
5
  const lodash_1 = require("lodash");
6
6
  const useOnScreen_1 = tslib_1.__importDefault(require("../../../../core/hooks/useOnScreen"));
7
7
  const hooks_1 = require("../../../../core/hooks");
8
+ const useEventReport_1 = require("../../../../core/hooks/useEventReport");
8
9
  const EventProvider = (_a) => {
9
- var { rec, children, className, onClick, style } = _a, props = tslib_1.__rest(_a, ["rec", "children", "className", "onClick", "style"]);
10
+ var { rec, children, className, onClick, style, isExternalLink = false } = _a, props = tslib_1.__rest(_a, ["rec", "children", "className", "onClick", "style", "isExternalLink"]);
10
11
  const ref = (0, react_1.useRef)(null);
11
12
  const isOnScreen = (0, useOnScreen_1.default)(ref);
12
13
  const { popupAni } = (0, hooks_1.useEditor)();
13
14
  const { setPopupDetailData, ctaEvent } = (0, hooks_1.useSxpDataSource)();
15
+ const { jumpToWeb } = (0, useEventReport_1.useEventReport)();
14
16
  (0, react_1.useEffect)(() => {
15
17
  var _a, _b;
16
18
  if (isOnScreen && (ref === null || ref === void 0 ? void 0 : ref.current)) {
@@ -22,14 +24,24 @@ const EventProvider = (_a) => {
22
24
  }
23
25
  }, [isOnScreen, ref, rec, ctaEvent]);
24
26
  const handleClick = (0, lodash_1.throttle)(() => {
25
- var _a, _b;
27
+ var _a, _b, _c, _d, _e, _f, _g, _h;
26
28
  const item = (_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;
27
29
  ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
28
30
  eventSubject: 'clickCta',
29
31
  eventDescription: 'User clicked the CTA'
30
32
  }, rec, item);
31
33
  setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(rec);
32
- onClick === null || onClick === void 0 ? void 0 : onClick();
34
+ if (isExternalLink) {
35
+ if ((_d = (_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.bindCta) === null || _d === void 0 ? void 0 : _d.link) {
36
+ const cta = (_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.bindCta;
37
+ const product = (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.bindProduct;
38
+ jumpToWeb(rec, product, cta);
39
+ window.location.href = (_h = (_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.bindCta) === null || _h === void 0 ? void 0 : _h.link;
40
+ }
41
+ }
42
+ else {
43
+ onClick === null || onClick === void 0 ? void 0 : onClick();
44
+ }
33
45
  }, popupAni === null || popupAni === void 0 ? void 0 : popupAni.duration);
34
46
  return (react_1.default.createElement("div", { ref: ref, className: className, style: style, onClick: handleClick }, children));
35
47
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",