pb-sxp-ui 1.0.4 → 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 +93 -107
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +93 -107
- 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 +93 -107
- 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 +4 -5
- package/es/materials/sxp/template/MultiCommodityDiro/index.js +4 -5
- package/es/materials/sxp/template/MultiCommodityDiroNew/index.js +4 -5
- package/es/materials/sxp/template/components/EventProvider.js +4 -4
- 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 +4 -5
- package/lib/materials/sxp/template/MultiCommodityDiro/index.js +4 -5
- package/lib/materials/sxp/template/MultiCommodityDiroNew/index.js +4 -5
- package/lib/materials/sxp/template/components/EventProvider.js +4 -4
- 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(() => {
|
@@ -9198,17 +9187,17 @@ Made in Italy` })));
|
|
9198
9187
|
}, rec, item);
|
9199
9188
|
setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(rec);
|
9200
9189
|
if (isExternalLink) {
|
9201
|
-
if ((_d = (_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.
|
9190
|
+
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) {
|
9202
9191
|
const cta = (_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.bindCta;
|
9203
9192
|
const product = (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.bindProduct;
|
9204
9193
|
jumpToWeb(rec, product, cta);
|
9205
|
-
window.location.href = (_h = (_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.
|
9194
|
+
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;
|
9206
9195
|
}
|
9207
9196
|
}
|
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,26 +9665,25 @@ 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) => {
|
9683
|
-
var _a;
|
9684
9672
|
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
9685
9673
|
eventSubject: 'clickCta',
|
9686
9674
|
eventDescription: 'User clicked the CTA'
|
9687
9675
|
}, recData, item);
|
9688
9676
|
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 }) }));
|
9689
9677
|
if (isExternalLink) {
|
9690
|
-
if (
|
9678
|
+
if (item === null || item === void 0 ? void 0 : item.link) {
|
9691
9679
|
jumpToWeb(recData, item, item.bindCta);
|
9692
|
-
window.location.href = item.
|
9680
|
+
window.location.href = item.link;
|
9693
9681
|
}
|
9694
9682
|
}
|
9695
9683
|
else {
|
9696
9684
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
9697
9685
|
}
|
9698
|
-
},
|
9686
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
9699
9687
|
return (React.createElement(Scroll$1, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
|
9700
9688
|
var _a, _b, _c, _d, _e, _f;
|
9701
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) }),
|
@@ -9790,26 +9778,25 @@ Made in Italy` })));
|
|
9790
9778
|
var { content, style, bgImg, recData, onClick, bottom_image, ctaTempStyles, isExternalLink } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "onClick", "bottom_image", "ctaTempStyles", "isExternalLink"]);
|
9791
9779
|
const { sxpParameter } = useSxpDataSource();
|
9792
9780
|
const { ctaEvent, setPopupDetailData } = useSxpDataSource();
|
9793
|
-
const {
|
9781
|
+
const { popup } = useEditor();
|
9794
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]);
|
9795
9783
|
const { jumpToWeb } = useEventReport();
|
9796
9784
|
const handleClick = lodash.throttle((item) => {
|
9797
|
-
var _a;
|
9798
9785
|
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
9799
9786
|
eventSubject: 'clickCta',
|
9800
9787
|
eventDescription: 'User clicked the CTA'
|
9801
9788
|
}, recData, item);
|
9802
9789
|
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 }) }));
|
9803
9790
|
if (isExternalLink) {
|
9804
|
-
if (
|
9791
|
+
if (item === null || item === void 0 ? void 0 : item.link) {
|
9805
9792
|
jumpToWeb(recData, item, item.bindCta);
|
9806
|
-
window.location.href = item.
|
9793
|
+
window.location.href = item.link;
|
9807
9794
|
}
|
9808
9795
|
}
|
9809
9796
|
else {
|
9810
9797
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
9811
9798
|
}
|
9812
|
-
},
|
9799
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
9813
9800
|
return (React.createElement(Scroll$1, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
|
9814
9801
|
var _a, _b, _c, _d, _e, _f;
|
9815
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) }),
|
@@ -9903,26 +9890,25 @@ Made in Italy` })));
|
|
9903
9890
|
var _b, _c;
|
9904
9891
|
var { content, style, bgImg, recData, onClick, bottom_image, ctaTempStyles, isExternalLink } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "onClick", "bottom_image", "ctaTempStyles", "isExternalLink"]);
|
9905
9892
|
const { ctaEvent, setPopupDetailData, sxpParameter } = useSxpDataSource();
|
9906
|
-
const {
|
9893
|
+
const { popup } = useEditor();
|
9907
9894
|
const { jumpToWeb } = useEventReport();
|
9908
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]);
|
9909
9896
|
const handleClick = lodash.throttle((item) => {
|
9910
|
-
var _a;
|
9911
9897
|
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
9912
9898
|
eventSubject: 'clickCta',
|
9913
9899
|
eventDescription: 'User clicked the CTA'
|
9914
9900
|
}, recData, item);
|
9915
9901
|
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 }) }));
|
9916
9902
|
if (isExternalLink) {
|
9917
|
-
if (
|
9903
|
+
if (item === null || item === void 0 ? void 0 : item.link) {
|
9918
9904
|
jumpToWeb(recData, item, item.bindCta);
|
9919
|
-
window.location.href = item.
|
9905
|
+
window.location.href = item.link;
|
9920
9906
|
}
|
9921
9907
|
}
|
9922
9908
|
else {
|
9923
9909
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
9924
9910
|
}
|
9925
|
-
},
|
9911
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
9926
9912
|
return (React.createElement(Scroll$1, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
|
9927
9913
|
var _a, _b, _c, _d, _e, _f;
|
9928
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) }),
|
@@ -11678,7 +11664,7 @@ Made in Italy` })));
|
|
11678
11664
|
* @Author: binruan@chatlabs.com
|
11679
11665
|
* @Date: 2024-01-10 10:58:24
|
11680
11666
|
* @LastEditors: binruan@chatlabs.com
|
11681
|
-
* @LastEditTime: 2024-04-
|
11667
|
+
* @LastEditTime: 2024-04-12 11:29:01
|
11682
11668
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\WaterFall\index.tsx
|
11683
11669
|
*
|
11684
11670
|
*/
|
@@ -11742,7 +11728,7 @@ Made in Italy` })));
|
|
11742
11728
|
relatedContentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
11743
11729
|
position: rec === null || rec === void 0 ? void 0 : rec.position,
|
11744
11730
|
contentTags: JSON.stringify((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.tags),
|
11745
|
-
traceInfo:
|
11731
|
+
traceInfo: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.traceInfo,
|
11746
11732
|
hashTags: JSON.stringify([recData === null || recData === void 0 ? void 0 : recData.hashTag]),
|
11747
11733
|
fromKName,
|
11748
11734
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
@@ -12846,15 +12832,15 @@ Made in Italy` })));
|
|
12846
12832
|
* @Author: binruan@chatlabs.com
|
12847
12833
|
* @Date: 2023-10-31 10:56:01
|
12848
12834
|
* @LastEditors: binruan@chatlabs.com
|
12849
|
-
* @LastEditTime: 2024-04-
|
12835
|
+
* @LastEditTime: 2024-04-12 09:50:58
|
12850
12836
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\Popup\index.tsx
|
12851
12837
|
*
|
12852
12838
|
*/
|
12853
12839
|
const Popup = () => {
|
12854
|
-
const { schema, resolver, popup
|
12840
|
+
const { schema, resolver, popup } = useEditor();
|
12855
12841
|
const { setPopupDetailData, popupDetailData, bffEventReport } = useSxpDataSource();
|
12856
12842
|
const { productView } = useEventReport();
|
12857
|
-
const [visible, setVisible] = React.useState(
|
12843
|
+
const [visible, setVisible] = React.useState();
|
12858
12844
|
const curTimeRef = React.useRef(null);
|
12859
12845
|
React.useEffect(() => {
|
12860
12846
|
const initTime = () => {
|
@@ -12867,33 +12853,33 @@ Made in Italy` })));
|
|
12867
12853
|
};
|
12868
12854
|
}, []);
|
12869
12855
|
React.useEffect(() => {
|
12870
|
-
if (popup && popup !== '') {
|
12856
|
+
if (popup && (popup === null || popup === void 0 ? void 0 : popup.id) && (popup === null || popup === void 0 ? void 0 : popup.id) !== '') {
|
12871
12857
|
curTimeRef.current = new Date();
|
12872
|
-
setVisible(
|
12858
|
+
setVisible(popup);
|
12873
12859
|
}
|
12874
12860
|
}, [popup]);
|
12875
12861
|
const handleClose = () => {
|
12876
|
-
var _a, _b, _c;
|
12877
|
-
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)) {
|
12878
12864
|
return;
|
12879
12865
|
}
|
12880
|
-
setVisible(
|
12866
|
+
setVisible(Object.assign(Object.assign({}, popup), { id: '' }));
|
12881
12867
|
const data = popupDetailData;
|
12882
|
-
const product = (
|
12883
|
-
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;
|
12884
12870
|
if (product && cta) {
|
12885
12871
|
productView(data, product, cta, curTimeRef.current);
|
12886
12872
|
}
|
12887
12873
|
setTimeout(() => {
|
12888
12874
|
window === null || window === void 0 ? void 0 : window.sxpPopup('');
|
12889
12875
|
setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(null);
|
12890
|
-
},
|
12876
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
12891
12877
|
};
|
12892
12878
|
const renderPopupDetail = React.useMemo(() => {
|
12893
12879
|
var _a, _b, _c;
|
12894
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) => {
|
12895
12881
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
12896
|
-
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)) {
|
12897
12883
|
const t = resolver[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
|
12898
12884
|
const Component = withBindDataSource(t);
|
12899
12885
|
const defaulSetting = (_b = t === null || t === void 0 ? void 0 : t.extend) === null || _b === void 0 ? void 0 : _b.defaulSetting;
|
@@ -12904,7 +12890,7 @@ Made in Italy` })));
|
|
12904
12890
|
}
|
12905
12891
|
});
|
12906
12892
|
}, [schema, popup, resolver]);
|
12907
|
-
return (React.createElement(Modal$1, {
|
12893
|
+
return (React.createElement(Modal$1, { popup: visible, onClose: handleClose, padding: 0, modalStyle: { position: 'fixed' } }, renderPopupDetail));
|
12908
12894
|
};
|
12909
12895
|
|
12910
12896
|
/*
|