pb-sxp-ui 1.0.5 → 1.0.6
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 +85 -96
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +85 -96
- 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 +85 -96
- 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/Modal/index.d.ts +2 -2
- package/es/core/components/SxpPageRender/Modal/index.js +12 -11
- package/es/core/components/SxpPageRender/Popup/index.js +12 -12
- package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +3 -4
- package/es/core/components/SxpPageRender/WaterFall/index.js +1 -1
- package/es/core/context/EditorContext.d.ts +7 -5
- package/es/core/context/EditorContext.js +10 -25
- package/es/core/hooks/useEventReport.js +39 -35
- package/es/materials/sxp/popup/AppointForm/index.js +1 -2
- package/es/materials/sxp/popup/Prompt/index.js +0 -2
- package/es/materials/sxp/template/MultiCommodity/index.js +2 -2
- package/es/materials/sxp/template/MultiCommodityDiro/index.js +2 -2
- package/es/materials/sxp/template/MultiCommodityDiroNew/index.js +2 -2
- package/es/materials/sxp/template/components/EventProvider.js +2 -2
- package/lib/core/components/SxpPageRender/Modal/index.d.ts +2 -2
- package/lib/core/components/SxpPageRender/Modal/index.js +11 -10
- package/lib/core/components/SxpPageRender/Popup/index.js +12 -12
- package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +2 -3
- package/lib/core/components/SxpPageRender/WaterFall/index.js +1 -1
- package/lib/core/context/EditorContext.d.ts +7 -5
- package/lib/core/context/EditorContext.js +10 -25
- package/lib/core/hooks/useEventReport.js +39 -35
- package/lib/materials/sxp/popup/AppointForm/index.js +0 -1
- package/lib/materials/sxp/popup/Prompt/index.js +0 -2
- package/lib/materials/sxp/template/MultiCommodity/index.js +2 -2
- package/lib/materials/sxp/template/MultiCommodityDiro/index.js +2 -2
- package/lib/materials/sxp/template/MultiCommodityDiroNew/index.js +2 -2
- package/lib/materials/sxp/template/components/EventProvider.js +2 -2
- package/package.json +1 -1
- package/es/core/components/SxpPageRender/ProductInfo/index.d.ts +0 -14
- package/es/core/components/SxpPageRender/ProductInfo/index.js +0 -55
- package/lib/core/components/SxpPageRender/ProductInfo/index.d.ts +0 -14
- package/lib/core/components/SxpPageRender/ProductInfo/index.js +0 -58
package/dist/pb-ui.js
CHANGED
@@ -716,6 +716,11 @@
|
|
716
716
|
pathArr: [0],
|
717
717
|
positionY: 0
|
718
718
|
};
|
719
|
+
const popupInit = {
|
720
|
+
id: '',
|
721
|
+
duration: 0,
|
722
|
+
name: 'none'
|
723
|
+
};
|
719
724
|
const EditorContext = React.createContext({
|
720
725
|
resolver: {},
|
721
726
|
currentNode: null,
|
@@ -735,12 +740,8 @@
|
|
735
740
|
prePiontData: [],
|
736
741
|
undoStack: [item],
|
737
742
|
redoStack: [],
|
738
|
-
popup:
|
739
|
-
setPopup: () => { }
|
740
|
-
popupAni: {
|
741
|
-
name: 'none',
|
742
|
-
duration: 0
|
743
|
-
}
|
743
|
+
popup: popupInit,
|
744
|
+
setPopup: () => { }
|
744
745
|
});
|
745
746
|
const EditorCore = React.forwardRef(({ children, resolver, isSsr, schema, enableDataSource = true, utmVal }, ref) => {
|
746
747
|
const [currentNode, setCurrentNode] = React.useState(null);
|
@@ -763,25 +764,10 @@
|
|
763
764
|
*/
|
764
765
|
const [undoStack, setUndoStack] = React.useState([[item]]);
|
765
766
|
const [redoStack, setRedoStack] = React.useState([]);
|
766
|
-
const [popup, setPopup] = React.useState(
|
767
|
-
const [popupAni, setPopupAni] = React.useState({
|
768
|
-
name: 'none',
|
769
|
-
duration: 0
|
770
|
-
});
|
767
|
+
const [popup, setPopup] = React.useState(popupInit);
|
771
768
|
typeof window !== 'undefined' &&
|
772
769
|
(window.sxpPopup = (type, aniType) => {
|
773
|
-
|
774
|
-
setPopupAni(Object.assign(Object.assign({}, popupAni), aniType));
|
775
|
-
}
|
776
|
-
else {
|
777
|
-
setPopupAni({
|
778
|
-
name: 'none',
|
779
|
-
duration: 0
|
780
|
-
});
|
781
|
-
}
|
782
|
-
setTimeout(() => {
|
783
|
-
setPopup(type);
|
784
|
-
});
|
770
|
+
setPopup(Object.assign(Object.assign(Object.assign({}, popupInit), { id: type }), aniType));
|
785
771
|
});
|
786
772
|
typeof window !== 'undefined' &&
|
787
773
|
(window.getJointUtmLink = (url) => {
|
@@ -857,8 +843,7 @@
|
|
857
843
|
setUndoStack,
|
858
844
|
getCurPageConf,
|
859
845
|
popup,
|
860
|
-
setPopup
|
861
|
-
popupAni
|
846
|
+
setPopup
|
862
847
|
} },
|
863
848
|
React.createElement(DataSourceProvider$1, { isSsr: isSsr, enable: enableDataSource }, children)));
|
864
849
|
});
|
@@ -997,7 +982,6 @@
|
|
997
982
|
|
998
983
|
const AppointForm$1 = (_a) => {
|
999
984
|
var { columns, style, title, textStyle, submitBgColor, submitColor, submitText, layoutType, onClick } = _a, props = __rest(_a, ["columns", "style", "title", "textStyle", "submitBgColor", "submitColor", "submitText", "layoutType", "onClick"]);
|
1000
|
-
useEditor();
|
1001
985
|
const { submitForm } = useSxpDataSource();
|
1002
986
|
const formRef = React.useRef();
|
1003
987
|
const [loading, setLoading] = React.useState(false);
|
@@ -8094,7 +8078,7 @@
|
|
8094
8078
|
* @Author: binruan@chatlabs.com
|
8095
8079
|
* @Date: 2024-03-12 10:59:06
|
8096
8080
|
* @LastEditors: binruan@chatlabs.com
|
8097
|
-
* @LastEditTime: 2024-
|
8081
|
+
* @LastEditTime: 2024-04-11 22:30:45
|
8098
8082
|
* @FilePath: \pb-sxp-ui\src\core\hooks\useEventReport.ts
|
8099
8083
|
*
|
8100
8084
|
*/
|
@@ -8118,23 +8102,25 @@
|
|
8118
8102
|
else if (data === null || data === void 0 ? void 0 : data.product) {
|
8119
8103
|
fromKName = 'productPage';
|
8120
8104
|
}
|
8121
|
-
|
8122
|
-
|
8123
|
-
|
8124
|
-
|
8125
|
-
|
8126
|
-
|
8127
|
-
|
8128
|
-
|
8129
|
-
|
8130
|
-
|
8131
|
-
|
8132
|
-
|
8133
|
-
|
8134
|
-
|
8135
|
-
|
8136
|
-
|
8137
|
-
|
8105
|
+
if (product === null || product === void 0 ? void 0 : product.price) {
|
8106
|
+
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
8107
|
+
eventInfo: {
|
8108
|
+
eventSubject: 'jumpToWeb',
|
8109
|
+
eventDescription: 'User jumped to website',
|
8110
|
+
productId: (_h = product === null || product === void 0 ? void 0 : product.itemId) !== null && _h !== void 0 ? _h : '',
|
8111
|
+
productName: (_j = product === null || product === void 0 ? void 0 : product.title) !== null && _j !== void 0 ? _j : '',
|
8112
|
+
price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0',
|
8113
|
+
productCollection: (_k = product === null || product === void 0 ? void 0 : product.collection) !== null && _k !== void 0 ? _k : '',
|
8114
|
+
fromKName,
|
8115
|
+
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
8116
|
+
contentTags: (product === null || product === void 0 ? void 0 : product.tags) ? JSON.stringify(product === null || product === void 0 ? void 0 : product.tags) : '',
|
8117
|
+
position: (data === null || data === void 0 ? void 0 : data.position) + '',
|
8118
|
+
relatedContentId: (_m = (_l = data === null || data === void 0 ? void 0 : data.video) === null || _l === void 0 ? void 0 : _l.itemId) !== null && _m !== void 0 ? _m : '',
|
8119
|
+
relatedCtatId: (_o = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _o !== void 0 ? _o : '',
|
8120
|
+
traceInfo: (_p = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _p !== void 0 ? _p : ''
|
8121
|
+
}
|
8122
|
+
});
|
8123
|
+
}
|
8138
8124
|
}, [bffEventReport, popupDetailData, isFromHashtag]);
|
8139
8125
|
const productView = React.useCallback((data, product, cta, viewTime) => {
|
8140
8126
|
var _a, _b, _c, _d;
|
@@ -8145,24 +8131,26 @@
|
|
8145
8131
|
else if (data === null || data === void 0 ? void 0 : data.product) {
|
8146
8132
|
fromKName = 'productPage';
|
8147
8133
|
}
|
8148
|
-
|
8149
|
-
|
8150
|
-
|
8151
|
-
|
8152
|
-
|
8153
|
-
|
8154
|
-
|
8155
|
-
|
8156
|
-
|
8157
|
-
|
8158
|
-
|
8159
|
-
|
8160
|
-
|
8161
|
-
|
8162
|
-
|
8163
|
-
|
8164
|
-
|
8165
|
-
|
8134
|
+
if (product === null || product === void 0 ? void 0 : product.price) {
|
8135
|
+
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
8136
|
+
eventInfo: {
|
8137
|
+
productId: product === null || product === void 0 ? void 0 : product.itemId,
|
8138
|
+
productName: product === null || product === void 0 ? void 0 : product.title,
|
8139
|
+
price: (product === null || product === void 0 ? void 0 : product.price) + '',
|
8140
|
+
productCollection: product === null || product === void 0 ? void 0 : product.collection,
|
8141
|
+
fromKName,
|
8142
|
+
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
8143
|
+
contentTags: JSON.stringify(product === null || product === void 0 ? void 0 : product.tags),
|
8144
|
+
position: (data === null || data === void 0 ? void 0 : data.position) + '',
|
8145
|
+
relatedContentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
8146
|
+
relatedCtatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
|
8147
|
+
traceInfo: product === null || product === void 0 ? void 0 : product.traceInfo,
|
8148
|
+
timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
|
8149
|
+
eventSubject: 'productView',
|
8150
|
+
eventDescription: 'User browsed the product'
|
8151
|
+
}
|
8152
|
+
});
|
8153
|
+
}
|
8166
8154
|
}, [bffEventReport, popupDetailData]);
|
8167
8155
|
return {
|
8168
8156
|
jumpToWeb,
|
@@ -8174,14 +8162,13 @@
|
|
8174
8162
|
* @Author: binruan@chatlabs.com
|
8175
8163
|
* @Date: 2023-11-02 18:34:34
|
8176
8164
|
* @LastEditors: binruan@chatlabs.com
|
8177
|
-
* @LastEditTime: 2024-04-
|
8165
|
+
* @LastEditTime: 2024-04-12 11:23:00
|
8178
8166
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\Modal\index.tsx
|
8179
8167
|
*
|
8180
8168
|
*/
|
8181
8169
|
const closeIcon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjhJREFUWEfFlztOw0AQhmeWiJ4CCmpQ5DiRQsIJyAWg5A0lR0AIChDiCJS8ER0cADgBeRSxt4CCDgkaKiq8i+zYeWx2413HEWmiJJv9v535Z2aN8M8vFPT9z3zETD0aAUChUJjwvPFHAJhBhB3Hqd6OAsK2yyucwykAvP38eJX398Z3AJDLlVYR8ToU9Rhj25TWr9KEsKy5dULIGQCMtfZly45TvwsAstm56UwG6wA4FUFwzrdctxZBDcWSy5XWEPG8I84/GcMipdWPtgcsaz5PCHtKG0IuTiqUvjT9U/WYMG2IOPE+AP+LtCB0xKUAAyA2Xbd2o2OG0NQXvTnvhL17D7EPtH9TRCIWwkRcGYGIQgYBABuqPuHXOQBc6pw80lBGwBQiiXhsBHQhkoprA6iM6acjhDQKu5YJZW6XeOI3XJdpvfsdTu52VfXEekD8owQiXGIubpSCbhDbLu8DwKEAd+A41SOdPpE4BS0viFOtvV2iKWqUgn5x/tmS70xR01GuDSCKc86/OCcLgTyyZ0ScDGNhFAktAJV4NFJ9YyaFiAWIE+9uVkkgBgLoig8DMWAa9ro9ynkUdlW5maZDCmB6clmz0k1HH4Cs1Ezbq2p2yEpUuBOKTSZZex00RUWIrltxuuK6EOGDSbGIOPZicpMx6fny650377qNRgBgWeVFQuA+6UjVgREhGIMlSqsPUQqIbZdOOIdZQmCv2axRnU1N1+TzJYsxOEaEV8ep7frPZ7Gd0FTEdP0ft0/kMNdg0eoAAAAASUVORK5CYII=';
|
8182
|
-
const Modal = ({ visible, onClose, children, modalStyle, padding,
|
8183
|
-
|
8184
|
-
const cssAni = popupAniData !== null && popupAniData !== void 0 ? popupAniData : popupAni;
|
8170
|
+
const Modal = ({ visible, onClose, children, modalStyle, padding, popup }) => {
|
8171
|
+
var _a;
|
8185
8172
|
const [isShow, setIsShow] = React.useState(false);
|
8186
8173
|
const modalEleRef = React.useRef(null);
|
8187
8174
|
React.useEffect(() => {
|
@@ -8196,29 +8183,32 @@
|
|
8196
8183
|
parentNode === null || parentNode === void 0 ? void 0 : parentNode.appendChild(modalEleRef.current);
|
8197
8184
|
}
|
8198
8185
|
}, []);
|
8186
|
+
const isOpen = React.useMemo(() => {
|
8187
|
+
return ((popup === null || popup === void 0 ? void 0 : popup.id) && (popup === null || popup === void 0 ? void 0 : popup.id) !== '') || visible;
|
8188
|
+
}, [visible, popup]);
|
8199
8189
|
React.useEffect(() => {
|
8200
|
-
if (
|
8190
|
+
if (isOpen) {
|
8201
8191
|
setIsShow(true);
|
8202
8192
|
}
|
8203
8193
|
else {
|
8204
8194
|
setTimeout(() => {
|
8205
8195
|
setIsShow(false);
|
8206
|
-
},
|
8196
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
8207
8197
|
}
|
8208
|
-
}, [
|
8198
|
+
}, [isOpen, popup]);
|
8209
8199
|
if (!modalEleRef.current)
|
8210
8200
|
return null;
|
8211
8201
|
const handleClose = lodash.debounce(() => {
|
8212
8202
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
8213
8203
|
}, 300);
|
8214
|
-
return ReactDOM__namespace.createPortal(React.createElement("div", { className: 'modal-bg', style: Object.assign({ display:
|
8215
|
-
React.createElement("div", { className: `modal-container ${
|
8204
|
+
return ReactDOM__namespace.createPortal(React.createElement(React.Fragment, null, isShow && (React.createElement("div", { className: 'modal-bg', style: Object.assign({ display: 'flex', backgroundColor: isOpen ? 'rgba(0, 0, 0, 0.7)' : 'rgba(0, 0, 0, 0)' }, modalStyle), onClick: handleClose },
|
8205
|
+
React.createElement("div", { className: `modal-container ${isOpen ? 'modal-popIn' : 'modal-popOut'}`, style: { padding, animationDuration: ((_a = popup === null || popup === void 0 ? void 0 : popup.duration) !== null && _a !== void 0 ? _a : 0) / 1000 + 's' }, onClick: (e) => {
|
8216
8206
|
e.stopPropagation();
|
8217
8207
|
e.preventDefault();
|
8218
8208
|
} },
|
8219
8209
|
React.createElement("div", { onClick: onClose, className: 'modal-icon-wrapper' },
|
8220
8210
|
React.createElement("img", { src: closeIcon, alt: 'close', className: 'modal-icon' })),
|
8221
|
-
children)), modalEleRef.current);
|
8211
|
+
children)))), modalEleRef.current);
|
8222
8212
|
};
|
8223
8213
|
var Modal$1 = React.memo(Modal);
|
8224
8214
|
|
@@ -8524,7 +8514,6 @@
|
|
8524
8514
|
|
8525
8515
|
const Prompt$1 = (_a) => {
|
8526
8516
|
var { content, btnText, style, icon, onClick } = _a, props = __rest(_a, ["content", "btnText", "style", "icon", "onClick"]);
|
8527
|
-
useEditor();
|
8528
8517
|
const iconSrc = typeof icon === 'string' ? icon : getMediaValueByMode(icon);
|
8529
8518
|
const handleOk = () => {
|
8530
8519
|
window === null || window === void 0 ? void 0 : window.sxpPopup('');
|
@@ -9176,7 +9165,7 @@ Made in Italy` })));
|
|
9176
9165
|
var { rec, children, className, onClick, style, isExternalLink = false } = _a; __rest(_a, ["rec", "children", "className", "onClick", "style", "isExternalLink"]);
|
9177
9166
|
const ref = React.useRef(null);
|
9178
9167
|
const isOnScreen = useOnScreen(ref);
|
9179
|
-
const {
|
9168
|
+
const { popup } = useEditor();
|
9180
9169
|
const { setPopupDetailData, ctaEvent } = useSxpDataSource();
|
9181
9170
|
const { jumpToWeb } = useEventReport();
|
9182
9171
|
React.useEffect(() => {
|
@@ -9208,7 +9197,7 @@ Made in Italy` })));
|
|
9208
9197
|
else {
|
9209
9198
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
9210
9199
|
}
|
9211
|
-
},
|
9200
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
9212
9201
|
return (React.createElement("div", { ref: ref, className: className, style: style, onClick: handleClick }, children));
|
9213
9202
|
};
|
9214
9203
|
var EventProvider$1 = React.memo(EventProvider);
|
@@ -9676,7 +9665,7 @@ Made in Italy` })));
|
|
9676
9665
|
var _b, _c;
|
9677
9666
|
var { content, style, bgImg, recData, onClick, bottom_image, ctaTempStyles, isExternalLink } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "onClick", "bottom_image", "ctaTempStyles", "isExternalLink"]);
|
9678
9667
|
const { ctaEvent, setPopupDetailData, sxpParameter } = useSxpDataSource();
|
9679
|
-
const {
|
9668
|
+
const { popup } = useEditor();
|
9680
9669
|
const { jumpToWeb } = useEventReport();
|
9681
9670
|
const [products, setProducts] = React.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]);
|
9682
9671
|
const handleClick = lodash.throttle((item) => {
|
@@ -9694,7 +9683,7 @@ Made in Italy` })));
|
|
9694
9683
|
else {
|
9695
9684
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
9696
9685
|
}
|
9697
|
-
},
|
9686
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
9698
9687
|
return (React.createElement(Scroll$1, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
|
9699
9688
|
var _a, _b, _c, _d, _e, _f;
|
9700
9689
|
return (React.createElement(SwiperSlide, Object.assign({ hidden: recData && !(item === null || item === void 0 ? void 0 : item.bindCta), key: item === null || item === void 0 ? void 0 : item.itemId, className: css.css(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
|
@@ -9789,7 +9778,7 @@ Made in Italy` })));
|
|
9789
9778
|
var { content, style, bgImg, recData, onClick, bottom_image, ctaTempStyles, isExternalLink } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "onClick", "bottom_image", "ctaTempStyles", "isExternalLink"]);
|
9790
9779
|
const { sxpParameter } = useSxpDataSource();
|
9791
9780
|
const { ctaEvent, setPopupDetailData } = useSxpDataSource();
|
9792
|
-
const {
|
9781
|
+
const { popup } = useEditor();
|
9793
9782
|
const [products, setProducts] = React.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]);
|
9794
9783
|
const { jumpToWeb } = useEventReport();
|
9795
9784
|
const handleClick = lodash.throttle((item) => {
|
@@ -9807,7 +9796,7 @@ Made in Italy` })));
|
|
9807
9796
|
else {
|
9808
9797
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
9809
9798
|
}
|
9810
|
-
},
|
9799
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
9811
9800
|
return (React.createElement(Scroll$1, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
|
9812
9801
|
var _a, _b, _c, _d, _e, _f;
|
9813
9802
|
return (React.createElement(SwiperSlide, Object.assign({ hidden: recData && !(item === null || item === void 0 ? void 0 : item.bindCta), key: item.itemId, className: css.css(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
|
@@ -9901,7 +9890,7 @@ Made in Italy` })));
|
|
9901
9890
|
var _b, _c;
|
9902
9891
|
var { content, style, bgImg, recData, onClick, bottom_image, ctaTempStyles, isExternalLink } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "onClick", "bottom_image", "ctaTempStyles", "isExternalLink"]);
|
9903
9892
|
const { ctaEvent, setPopupDetailData, sxpParameter } = useSxpDataSource();
|
9904
|
-
const {
|
9893
|
+
const { popup } = useEditor();
|
9905
9894
|
const { jumpToWeb } = useEventReport();
|
9906
9895
|
const [products, setProducts] = React.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]);
|
9907
9896
|
const handleClick = lodash.throttle((item) => {
|
@@ -9919,7 +9908,7 @@ Made in Italy` })));
|
|
9919
9908
|
else {
|
9920
9909
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
9921
9910
|
}
|
9922
|
-
},
|
9911
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
9923
9912
|
return (React.createElement(Scroll$1, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
|
9924
9913
|
var _a, _b, _c, _d, _e, _f;
|
9925
9914
|
return (React.createElement(SwiperSlide, Object.assign({ hidden: recData && !(item === null || item === void 0 ? void 0 : item.bindCta), key: item === null || item === void 0 ? void 0 : item.itemId, className: css.css(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
|
@@ -11675,7 +11664,7 @@ Made in Italy` })));
|
|
11675
11664
|
* @Author: binruan@chatlabs.com
|
11676
11665
|
* @Date: 2024-01-10 10:58:24
|
11677
11666
|
* @LastEditors: binruan@chatlabs.com
|
11678
|
-
* @LastEditTime: 2024-04-
|
11667
|
+
* @LastEditTime: 2024-04-12 11:29:01
|
11679
11668
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\WaterFall\index.tsx
|
11680
11669
|
*
|
11681
11670
|
*/
|
@@ -11739,7 +11728,7 @@ Made in Italy` })));
|
|
11739
11728
|
relatedContentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
11740
11729
|
position: rec === null || rec === void 0 ? void 0 : rec.position,
|
11741
11730
|
contentTags: JSON.stringify((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.tags),
|
11742
|
-
traceInfo:
|
11731
|
+
traceInfo: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.traceInfo,
|
11743
11732
|
hashTags: JSON.stringify([recData === null || recData === void 0 ? void 0 : recData.hashTag]),
|
11744
11733
|
fromKName,
|
11745
11734
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
@@ -12843,15 +12832,15 @@ Made in Italy` })));
|
|
12843
12832
|
* @Author: binruan@chatlabs.com
|
12844
12833
|
* @Date: 2023-10-31 10:56:01
|
12845
12834
|
* @LastEditors: binruan@chatlabs.com
|
12846
|
-
* @LastEditTime: 2024-04-
|
12835
|
+
* @LastEditTime: 2024-04-12 09:50:58
|
12847
12836
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\Popup\index.tsx
|
12848
12837
|
*
|
12849
12838
|
*/
|
12850
12839
|
const Popup = () => {
|
12851
|
-
const { schema, resolver, popup
|
12840
|
+
const { schema, resolver, popup } = useEditor();
|
12852
12841
|
const { setPopupDetailData, popupDetailData, bffEventReport } = useSxpDataSource();
|
12853
12842
|
const { productView } = useEventReport();
|
12854
|
-
const [visible, setVisible] = React.useState(
|
12843
|
+
const [visible, setVisible] = React.useState();
|
12855
12844
|
const curTimeRef = React.useRef(null);
|
12856
12845
|
React.useEffect(() => {
|
12857
12846
|
const initTime = () => {
|
@@ -12864,33 +12853,33 @@ Made in Italy` })));
|
|
12864
12853
|
};
|
12865
12854
|
}, []);
|
12866
12855
|
React.useEffect(() => {
|
12867
|
-
if (popup && popup !== '') {
|
12856
|
+
if (popup && (popup === null || popup === void 0 ? void 0 : popup.id) && (popup === null || popup === void 0 ? void 0 : popup.id) !== '') {
|
12868
12857
|
curTimeRef.current = new Date();
|
12869
|
-
setVisible(
|
12858
|
+
setVisible(popup);
|
12870
12859
|
}
|
12871
12860
|
}, [popup]);
|
12872
12861
|
const handleClose = () => {
|
12873
|
-
var _a, _b, _c;
|
12874
|
-
if (!popup || popup === '' || !visible || new Date() - curTimeRef.current < (
|
12862
|
+
var _a, _b, _c, _d;
|
12863
|
+
if (!popup || (popup === null || popup === void 0 ? void 0 : popup.id) === '' || !visible || new Date() - curTimeRef.current < ((_a = popup === null || popup === void 0 ? void 0 : popup.duration) !== null && _a !== void 0 ? _a : 0)) {
|
12875
12864
|
return;
|
12876
12865
|
}
|
12877
|
-
setVisible(
|
12866
|
+
setVisible(Object.assign(Object.assign({}, popup), { id: '' }));
|
12878
12867
|
const data = popupDetailData;
|
12879
|
-
const product = (
|
12880
|
-
const cta = (
|
12868
|
+
const product = (_b = data === null || data === void 0 ? void 0 : data.video) === null || _b === void 0 ? void 0 : _b.bindProduct;
|
12869
|
+
const cta = (_d = (_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct) === null || _d === void 0 ? void 0 : _d.bindCta;
|
12881
12870
|
if (product && cta) {
|
12882
12871
|
productView(data, product, cta, curTimeRef.current);
|
12883
12872
|
}
|
12884
12873
|
setTimeout(() => {
|
12885
12874
|
window === null || window === void 0 ? void 0 : window.sxpPopup('');
|
12886
12875
|
setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(null);
|
12887
|
-
},
|
12876
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
12888
12877
|
};
|
12889
12878
|
const renderPopupDetail = React.useMemo(() => {
|
12890
12879
|
var _a, _b, _c;
|
12891
12880
|
return (_c = (_b = (_a = schema === null || schema === void 0 ? void 0 : schema.sxpPageConf) === null || _a === void 0 ? void 0 : _a.globalConfig) === null || _b === void 0 ? void 0 : _b.popupList) === null || _c === void 0 ? void 0 : _c.map((value, index) => {
|
12892
12881
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
12893
|
-
if ((value === null || value === void 0 ? void 0 : value.id) === popup) {
|
12882
|
+
if ((value === null || value === void 0 ? void 0 : value.id) === (popup === null || popup === void 0 ? void 0 : popup.id)) {
|
12894
12883
|
const t = resolver[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
|
12895
12884
|
const Component = withBindDataSource(t);
|
12896
12885
|
const defaulSetting = (_b = t === null || t === void 0 ? void 0 : t.extend) === null || _b === void 0 ? void 0 : _b.defaulSetting;
|
@@ -12901,7 +12890,7 @@ Made in Italy` })));
|
|
12901
12890
|
}
|
12902
12891
|
});
|
12903
12892
|
}, [schema, popup, resolver]);
|
12904
|
-
return (React.createElement(Modal$1, {
|
12893
|
+
return (React.createElement(Modal$1, { popup: visible, onClose: handleClose, padding: 0, modalStyle: { position: 'fixed' } }, renderPopupDetail));
|
12905
12894
|
};
|
12906
12895
|
|
12907
12896
|
/*
|