pb-sxp-ui 1.0.3 → 1.0.5
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 +62 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -0
- package/dist/index.js +62 -24
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +3 -3
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +3 -3
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +62 -24
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +3 -3
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/RenderCard.js +3 -2
- package/es/core/components/SxpPageRender/index.js +1 -2
- package/es/materials/sxp/template/Appoint/index.d.ts +1 -0
- package/es/materials/sxp/template/Appoint/index.js +3 -3
- package/es/materials/sxp/template/Commodity/index.d.ts +1 -0
- package/es/materials/sxp/template/Commodity/index.js +2 -2
- package/es/materials/sxp/template/CommodityDiro/index.d.ts +1 -0
- package/es/materials/sxp/template/CommodityDiro/index.js +2 -2
- package/es/materials/sxp/template/CommodityDiroNew/index.d.ts +1 -0
- package/es/materials/sxp/template/CommodityDiroNew/index.js +2 -2
- package/es/materials/sxp/template/MultiCommodity/index.d.ts +1 -0
- package/es/materials/sxp/template/MultiCommodity/index.js +12 -2
- package/es/materials/sxp/template/MultiCommodityDiro/index.d.ts +1 -0
- package/es/materials/sxp/template/MultiCommodityDiro/index.js +12 -2
- package/es/materials/sxp/template/MultiCommodityDiroNew/index.d.ts +1 -0
- package/es/materials/sxp/template/MultiCommodityDiroNew/index.js +12 -2
- package/es/materials/sxp/template/components/EventProvider.d.ts +1 -0
- package/es/materials/sxp/template/components/EventProvider.js +15 -3
- package/lib/core/components/SxpPageRender/RenderCard.js +3 -2
- package/lib/core/components/SxpPageRender/index.js +1 -2
- package/lib/materials/sxp/template/Appoint/index.d.ts +1 -0
- package/lib/materials/sxp/template/Appoint/index.js +3 -3
- package/lib/materials/sxp/template/Commodity/index.d.ts +1 -0
- package/lib/materials/sxp/template/Commodity/index.js +2 -2
- package/lib/materials/sxp/template/CommodityDiro/index.d.ts +1 -0
- package/lib/materials/sxp/template/CommodityDiro/index.js +2 -2
- package/lib/materials/sxp/template/CommodityDiroNew/index.d.ts +1 -0
- package/lib/materials/sxp/template/CommodityDiroNew/index.js +2 -2
- package/lib/materials/sxp/template/MultiCommodity/index.d.ts +1 -0
- package/lib/materials/sxp/template/MultiCommodity/index.js +12 -2
- package/lib/materials/sxp/template/MultiCommodityDiro/index.d.ts +1 -0
- package/lib/materials/sxp/template/MultiCommodityDiro/index.js +12 -2
- package/lib/materials/sxp/template/MultiCommodityDiroNew/index.d.ts +1 -0
- package/lib/materials/sxp/template/MultiCommodityDiroNew/index.js +12 -2
- package/lib/materials/sxp/template/components/EventProvider.d.ts +1 -0
- package/lib/materials/sxp/template/components/EventProvider.js +15 -3
- package/package.json +1 -1
@@ -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
|
-
|
34
|
+
if (isExternalLink) {
|
35
|
+
if ((_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) {
|
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.bindProduct) === 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
|
};
|