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/index.cjs
CHANGED
@@ -724,6 +724,11 @@ const item = {
|
|
724
724
|
pathArr: [0],
|
725
725
|
positionY: 0
|
726
726
|
};
|
727
|
+
const popupInit = {
|
728
|
+
id: '',
|
729
|
+
duration: 0,
|
730
|
+
name: 'none'
|
731
|
+
};
|
727
732
|
const EditorContext = React.createContext({
|
728
733
|
resolver: {},
|
729
734
|
currentNode: null,
|
@@ -743,12 +748,8 @@ const EditorContext = React.createContext({
|
|
743
748
|
prePiontData: [],
|
744
749
|
undoStack: [item],
|
745
750
|
redoStack: [],
|
746
|
-
popup:
|
747
|
-
setPopup: () => { }
|
748
|
-
popupAni: {
|
749
|
-
name: 'none',
|
750
|
-
duration: 0
|
751
|
-
}
|
751
|
+
popup: popupInit,
|
752
|
+
setPopup: () => { }
|
752
753
|
});
|
753
754
|
const EditorCore = React.forwardRef(({ children, resolver, isSsr, schema, enableDataSource = true, utmVal }, ref) => {
|
754
755
|
const [currentNode, setCurrentNode] = React.useState(null);
|
@@ -771,25 +772,10 @@ const EditorCore = React.forwardRef(({ children, resolver, isSsr, schema, enable
|
|
771
772
|
*/
|
772
773
|
const [undoStack, setUndoStack] = React.useState([[item]]);
|
773
774
|
const [redoStack, setRedoStack] = React.useState([]);
|
774
|
-
const [popup, setPopup] = React.useState(
|
775
|
-
const [popupAni, setPopupAni] = React.useState({
|
776
|
-
name: 'none',
|
777
|
-
duration: 0
|
778
|
-
});
|
775
|
+
const [popup, setPopup] = React.useState(popupInit);
|
779
776
|
typeof window !== 'undefined' &&
|
780
777
|
(window.sxpPopup = (type, aniType) => {
|
781
|
-
|
782
|
-
setPopupAni(Object.assign(Object.assign({}, popupAni), aniType));
|
783
|
-
}
|
784
|
-
else {
|
785
|
-
setPopupAni({
|
786
|
-
name: 'none',
|
787
|
-
duration: 0
|
788
|
-
});
|
789
|
-
}
|
790
|
-
setTimeout(() => {
|
791
|
-
setPopup(type);
|
792
|
-
});
|
778
|
+
setPopup(Object.assign(Object.assign(Object.assign({}, popupInit), { id: type }), aniType));
|
793
779
|
});
|
794
780
|
typeof window !== 'undefined' &&
|
795
781
|
(window.getJointUtmLink = (url) => {
|
@@ -865,8 +851,7 @@ const EditorCore = React.forwardRef(({ children, resolver, isSsr, schema, enable
|
|
865
851
|
setUndoStack,
|
866
852
|
getCurPageConf,
|
867
853
|
popup,
|
868
|
-
setPopup
|
869
|
-
popupAni
|
854
|
+
setPopup
|
870
855
|
} },
|
871
856
|
React.createElement(DataSourceProvider$1, { isSsr: isSsr, enable: enableDataSource }, children)));
|
872
857
|
});
|
@@ -1005,7 +990,6 @@ var settingRender$5 = [
|
|
1005
990
|
|
1006
991
|
const AppointForm$1 = (_a) => {
|
1007
992
|
var { columns, style, title, textStyle, submitBgColor, submitColor, submitText, layoutType, onClick } = _a, props = __rest(_a, ["columns", "style", "title", "textStyle", "submitBgColor", "submitColor", "submitText", "layoutType", "onClick"]);
|
1008
|
-
useEditor();
|
1009
993
|
const { submitForm } = useSxpDataSource();
|
1010
994
|
const formRef = React.useRef();
|
1011
995
|
const [loading, setLoading] = React.useState(false);
|
@@ -8102,7 +8086,7 @@ SwiperSlide.displayName = 'SwiperSlide';
|
|
8102
8086
|
* @Author: binruan@chatlabs.com
|
8103
8087
|
* @Date: 2024-03-12 10:59:06
|
8104
8088
|
* @LastEditors: binruan@chatlabs.com
|
8105
|
-
* @LastEditTime: 2024-
|
8089
|
+
* @LastEditTime: 2024-04-11 22:30:45
|
8106
8090
|
* @FilePath: \pb-sxp-ui\src\core\hooks\useEventReport.ts
|
8107
8091
|
*
|
8108
8092
|
*/
|
@@ -8126,23 +8110,25 @@ function useEventReport() {
|
|
8126
8110
|
else if (data === null || data === void 0 ? void 0 : data.product) {
|
8127
8111
|
fromKName = 'productPage';
|
8128
8112
|
}
|
8129
|
-
|
8130
|
-
|
8131
|
-
|
8132
|
-
|
8133
|
-
|
8134
|
-
|
8135
|
-
|
8136
|
-
|
8137
|
-
|
8138
|
-
|
8139
|
-
|
8140
|
-
|
8141
|
-
|
8142
|
-
|
8143
|
-
|
8144
|
-
|
8145
|
-
|
8113
|
+
if (product === null || product === void 0 ? void 0 : product.price) {
|
8114
|
+
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
8115
|
+
eventInfo: {
|
8116
|
+
eventSubject: 'jumpToWeb',
|
8117
|
+
eventDescription: 'User jumped to website',
|
8118
|
+
productId: (_h = product === null || product === void 0 ? void 0 : product.itemId) !== null && _h !== void 0 ? _h : '',
|
8119
|
+
productName: (_j = product === null || product === void 0 ? void 0 : product.title) !== null && _j !== void 0 ? _j : '',
|
8120
|
+
price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0',
|
8121
|
+
productCollection: (_k = product === null || product === void 0 ? void 0 : product.collection) !== null && _k !== void 0 ? _k : '',
|
8122
|
+
fromKName,
|
8123
|
+
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
8124
|
+
contentTags: (product === null || product === void 0 ? void 0 : product.tags) ? JSON.stringify(product === null || product === void 0 ? void 0 : product.tags) : '',
|
8125
|
+
position: (data === null || data === void 0 ? void 0 : data.position) + '',
|
8126
|
+
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 : '',
|
8127
|
+
relatedCtatId: (_o = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _o !== void 0 ? _o : '',
|
8128
|
+
traceInfo: (_p = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _p !== void 0 ? _p : ''
|
8129
|
+
}
|
8130
|
+
});
|
8131
|
+
}
|
8146
8132
|
}, [bffEventReport, popupDetailData, isFromHashtag]);
|
8147
8133
|
const productView = React.useCallback((data, product, cta, viewTime) => {
|
8148
8134
|
var _a, _b, _c, _d;
|
@@ -8153,24 +8139,26 @@ function useEventReport() {
|
|
8153
8139
|
else if (data === null || data === void 0 ? void 0 : data.product) {
|
8154
8140
|
fromKName = 'productPage';
|
8155
8141
|
}
|
8156
|
-
|
8157
|
-
|
8158
|
-
|
8159
|
-
|
8160
|
-
|
8161
|
-
|
8162
|
-
|
8163
|
-
|
8164
|
-
|
8165
|
-
|
8166
|
-
|
8167
|
-
|
8168
|
-
|
8169
|
-
|
8170
|
-
|
8171
|
-
|
8172
|
-
|
8173
|
-
|
8142
|
+
if (product === null || product === void 0 ? void 0 : product.price) {
|
8143
|
+
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
8144
|
+
eventInfo: {
|
8145
|
+
productId: product === null || product === void 0 ? void 0 : product.itemId,
|
8146
|
+
productName: product === null || product === void 0 ? void 0 : product.title,
|
8147
|
+
price: (product === null || product === void 0 ? void 0 : product.price) + '',
|
8148
|
+
productCollection: product === null || product === void 0 ? void 0 : product.collection,
|
8149
|
+
fromKName,
|
8150
|
+
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
8151
|
+
contentTags: JSON.stringify(product === null || product === void 0 ? void 0 : product.tags),
|
8152
|
+
position: (data === null || data === void 0 ? void 0 : data.position) + '',
|
8153
|
+
relatedContentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
8154
|
+
relatedCtatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
|
8155
|
+
traceInfo: product === null || product === void 0 ? void 0 : product.traceInfo,
|
8156
|
+
timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
|
8157
|
+
eventSubject: 'productView',
|
8158
|
+
eventDescription: 'User browsed the product'
|
8159
|
+
}
|
8160
|
+
});
|
8161
|
+
}
|
8174
8162
|
}, [bffEventReport, popupDetailData]);
|
8175
8163
|
return {
|
8176
8164
|
jumpToWeb,
|
@@ -8182,14 +8170,13 @@ function useEventReport() {
|
|
8182
8170
|
* @Author: binruan@chatlabs.com
|
8183
8171
|
* @Date: 2023-11-02 18:34:34
|
8184
8172
|
* @LastEditors: binruan@chatlabs.com
|
8185
|
-
* @LastEditTime: 2024-04-
|
8173
|
+
* @LastEditTime: 2024-04-12 11:23:00
|
8186
8174
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\Modal\index.tsx
|
8187
8175
|
*
|
8188
8176
|
*/
|
8189
8177
|
const closeIcon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjhJREFUWEfFlztOw0AQhmeWiJ4CCmpQ5DiRQsIJyAWg5A0lR0AIChDiCJS8ER0cADgBeRSxt4CCDgkaKiq8i+zYeWx2413HEWmiJJv9v535Z2aN8M8vFPT9z3zETD0aAUChUJjwvPFHAJhBhB3Hqd6OAsK2yyucwykAvP38eJX398Z3AJDLlVYR8ToU9Rhj25TWr9KEsKy5dULIGQCMtfZly45TvwsAstm56UwG6wA4FUFwzrdctxZBDcWSy5XWEPG8I84/GcMipdWPtgcsaz5PCHtKG0IuTiqUvjT9U/WYMG2IOPE+AP+LtCB0xKUAAyA2Xbd2o2OG0NQXvTnvhL17D7EPtH9TRCIWwkRcGYGIQgYBABuqPuHXOQBc6pw80lBGwBQiiXhsBHQhkoprA6iM6acjhDQKu5YJZW6XeOI3XJdpvfsdTu52VfXEekD8owQiXGIubpSCbhDbLu8DwKEAd+A41SOdPpE4BS0viFOtvV2iKWqUgn5x/tmS70xR01GuDSCKc86/OCcLgTyyZ0ScDGNhFAktAJV4NFJ9YyaFiAWIE+9uVkkgBgLoig8DMWAa9ro9ynkUdlW5maZDCmB6clmz0k1HH4Cs1Ezbq2p2yEpUuBOKTSZZex00RUWIrltxuuK6EOGDSbGIOPZicpMx6fny650377qNRgBgWeVFQuA+6UjVgREhGIMlSqsPUQqIbZdOOIdZQmCv2axRnU1N1+TzJYsxOEaEV8ep7frPZ7Gd0FTEdP0ft0/kMNdg0eoAAAAASUVORK5CYII=';
|
8190
|
-
const Modal = ({ visible, onClose, children, modalStyle, padding,
|
8191
|
-
|
8192
|
-
const cssAni = popupAniData !== null && popupAniData !== void 0 ? popupAniData : popupAni;
|
8178
|
+
const Modal = ({ visible, onClose, children, modalStyle, padding, popup }) => {
|
8179
|
+
var _a;
|
8193
8180
|
const [isShow, setIsShow] = React.useState(false);
|
8194
8181
|
const modalEleRef = React.useRef(null);
|
8195
8182
|
React.useEffect(() => {
|
@@ -8204,29 +8191,32 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popupAniData }
|
|
8204
8191
|
parentNode === null || parentNode === void 0 ? void 0 : parentNode.appendChild(modalEleRef.current);
|
8205
8192
|
}
|
8206
8193
|
}, []);
|
8194
|
+
const isOpen = React.useMemo(() => {
|
8195
|
+
return ((popup === null || popup === void 0 ? void 0 : popup.id) && (popup === null || popup === void 0 ? void 0 : popup.id) !== '') || visible;
|
8196
|
+
}, [visible, popup]);
|
8207
8197
|
React.useEffect(() => {
|
8208
|
-
if (
|
8198
|
+
if (isOpen) {
|
8209
8199
|
setIsShow(true);
|
8210
8200
|
}
|
8211
8201
|
else {
|
8212
8202
|
setTimeout(() => {
|
8213
8203
|
setIsShow(false);
|
8214
|
-
},
|
8204
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
8215
8205
|
}
|
8216
|
-
}, [
|
8206
|
+
}, [isOpen, popup]);
|
8217
8207
|
if (!modalEleRef.current)
|
8218
8208
|
return null;
|
8219
8209
|
const handleClose = lodash.debounce(() => {
|
8220
8210
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
8221
8211
|
}, 300);
|
8222
|
-
return ReactDOM__namespace.createPortal(React.createElement("div", { className: 'modal-bg', style: Object.assign({ display:
|
8223
|
-
React.createElement("div", { className: `modal-container ${
|
8212
|
+
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 },
|
8213
|
+
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) => {
|
8224
8214
|
e.stopPropagation();
|
8225
8215
|
e.preventDefault();
|
8226
8216
|
} },
|
8227
8217
|
React.createElement("div", { onClick: onClose, className: 'modal-icon-wrapper' },
|
8228
8218
|
React.createElement("img", { src: closeIcon, alt: 'close', className: 'modal-icon' })),
|
8229
|
-
children)), modalEleRef.current);
|
8219
|
+
children)))), modalEleRef.current);
|
8230
8220
|
};
|
8231
8221
|
var Modal$1 = React.memo(Modal);
|
8232
8222
|
|
@@ -8532,7 +8522,6 @@ const getMediaValueByMode = (obj) => {
|
|
8532
8522
|
|
8533
8523
|
const Prompt$1 = (_a) => {
|
8534
8524
|
var { content, btnText, style, icon, onClick } = _a, props = __rest(_a, ["content", "btnText", "style", "icon", "onClick"]);
|
8535
|
-
useEditor();
|
8536
8525
|
const iconSrc = typeof icon === 'string' ? icon : getMediaValueByMode(icon);
|
8537
8526
|
const handleOk = () => {
|
8538
8527
|
window === null || window === void 0 ? void 0 : window.sxpPopup('');
|
@@ -9184,7 +9173,7 @@ const EventProvider = (_a) => {
|
|
9184
9173
|
var { rec, children, className, onClick, style, isExternalLink = false } = _a; __rest(_a, ["rec", "children", "className", "onClick", "style", "isExternalLink"]);
|
9185
9174
|
const ref = React.useRef(null);
|
9186
9175
|
const isOnScreen = useOnScreen(ref);
|
9187
|
-
const {
|
9176
|
+
const { popup } = useEditor();
|
9188
9177
|
const { setPopupDetailData, ctaEvent } = useSxpDataSource();
|
9189
9178
|
const { jumpToWeb } = useEventReport();
|
9190
9179
|
React.useEffect(() => {
|
@@ -9206,17 +9195,17 @@ const EventProvider = (_a) => {
|
|
9206
9195
|
}, rec, item);
|
9207
9196
|
setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(rec);
|
9208
9197
|
if (isExternalLink) {
|
9209
|
-
if ((_d = (_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.
|
9198
|
+
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) {
|
9210
9199
|
const cta = (_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.bindCta;
|
9211
9200
|
const product = (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.bindProduct;
|
9212
9201
|
jumpToWeb(rec, product, cta);
|
9213
|
-
window.location.href = (_h = (_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.
|
9202
|
+
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;
|
9214
9203
|
}
|
9215
9204
|
}
|
9216
9205
|
else {
|
9217
9206
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
9218
9207
|
}
|
9219
|
-
},
|
9208
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
9220
9209
|
return (React.createElement("div", { ref: ref, className: className, style: style, onClick: handleClick }, children));
|
9221
9210
|
};
|
9222
9211
|
var EventProvider$1 = React.memo(EventProvider);
|
@@ -9684,26 +9673,25 @@ const MultiCommodityDiro$1 = (_a) => {
|
|
9684
9673
|
var _b, _c;
|
9685
9674
|
var { content, style, bgImg, recData, onClick, bottom_image, ctaTempStyles, isExternalLink } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "onClick", "bottom_image", "ctaTempStyles", "isExternalLink"]);
|
9686
9675
|
const { ctaEvent, setPopupDetailData, sxpParameter } = useSxpDataSource();
|
9687
|
-
const {
|
9676
|
+
const { popup } = useEditor();
|
9688
9677
|
const { jumpToWeb } = useEventReport();
|
9689
9678
|
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]);
|
9690
9679
|
const handleClick = lodash.throttle((item) => {
|
9691
|
-
var _a;
|
9692
9680
|
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
9693
9681
|
eventSubject: 'clickCta',
|
9694
9682
|
eventDescription: 'User clicked the CTA'
|
9695
9683
|
}, recData, item);
|
9696
9684
|
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 }) }));
|
9697
9685
|
if (isExternalLink) {
|
9698
|
-
if (
|
9686
|
+
if (item === null || item === void 0 ? void 0 : item.link) {
|
9699
9687
|
jumpToWeb(recData, item, item.bindCta);
|
9700
|
-
window.location.href = item.
|
9688
|
+
window.location.href = item.link;
|
9701
9689
|
}
|
9702
9690
|
}
|
9703
9691
|
else {
|
9704
9692
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
9705
9693
|
}
|
9706
|
-
},
|
9694
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
9707
9695
|
return (React.createElement(Scroll$1, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
|
9708
9696
|
var _a, _b, _c, _d, _e, _f;
|
9709
9697
|
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) }),
|
@@ -9798,26 +9786,25 @@ const MultiCommodity$1 = (_a) => {
|
|
9798
9786
|
var { content, style, bgImg, recData, onClick, bottom_image, ctaTempStyles, isExternalLink } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "onClick", "bottom_image", "ctaTempStyles", "isExternalLink"]);
|
9799
9787
|
const { sxpParameter } = useSxpDataSource();
|
9800
9788
|
const { ctaEvent, setPopupDetailData } = useSxpDataSource();
|
9801
|
-
const {
|
9789
|
+
const { popup } = useEditor();
|
9802
9790
|
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]);
|
9803
9791
|
const { jumpToWeb } = useEventReport();
|
9804
9792
|
const handleClick = lodash.throttle((item) => {
|
9805
|
-
var _a;
|
9806
9793
|
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
9807
9794
|
eventSubject: 'clickCta',
|
9808
9795
|
eventDescription: 'User clicked the CTA'
|
9809
9796
|
}, recData, item);
|
9810
9797
|
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 }) }));
|
9811
9798
|
if (isExternalLink) {
|
9812
|
-
if (
|
9799
|
+
if (item === null || item === void 0 ? void 0 : item.link) {
|
9813
9800
|
jumpToWeb(recData, item, item.bindCta);
|
9814
|
-
window.location.href = item.
|
9801
|
+
window.location.href = item.link;
|
9815
9802
|
}
|
9816
9803
|
}
|
9817
9804
|
else {
|
9818
9805
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
9819
9806
|
}
|
9820
|
-
},
|
9807
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
9821
9808
|
return (React.createElement(Scroll$1, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
|
9822
9809
|
var _a, _b, _c, _d, _e, _f;
|
9823
9810
|
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) }),
|
@@ -9911,26 +9898,25 @@ const MultiCommodityDiroNew$1 = (_a) => {
|
|
9911
9898
|
var _b, _c;
|
9912
9899
|
var { content, style, bgImg, recData, onClick, bottom_image, ctaTempStyles, isExternalLink } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "onClick", "bottom_image", "ctaTempStyles", "isExternalLink"]);
|
9913
9900
|
const { ctaEvent, setPopupDetailData, sxpParameter } = useSxpDataSource();
|
9914
|
-
const {
|
9901
|
+
const { popup } = useEditor();
|
9915
9902
|
const { jumpToWeb } = useEventReport();
|
9916
9903
|
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]);
|
9917
9904
|
const handleClick = lodash.throttle((item) => {
|
9918
|
-
var _a;
|
9919
9905
|
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
9920
9906
|
eventSubject: 'clickCta',
|
9921
9907
|
eventDescription: 'User clicked the CTA'
|
9922
9908
|
}, recData, item);
|
9923
9909
|
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 }) }));
|
9924
9910
|
if (isExternalLink) {
|
9925
|
-
if (
|
9911
|
+
if (item === null || item === void 0 ? void 0 : item.link) {
|
9926
9912
|
jumpToWeb(recData, item, item.bindCta);
|
9927
|
-
window.location.href = item.
|
9913
|
+
window.location.href = item.link;
|
9928
9914
|
}
|
9929
9915
|
}
|
9930
9916
|
else {
|
9931
9917
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
9932
9918
|
}
|
9933
|
-
},
|
9919
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
9934
9920
|
return (React.createElement(Scroll$1, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
|
9935
9921
|
var _a, _b, _c, _d, _e, _f;
|
9936
9922
|
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) }),
|
@@ -11686,7 +11672,7 @@ var img$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeA
|
|
11686
11672
|
* @Author: binruan@chatlabs.com
|
11687
11673
|
* @Date: 2024-01-10 10:58:24
|
11688
11674
|
* @LastEditors: binruan@chatlabs.com
|
11689
|
-
* @LastEditTime: 2024-04-
|
11675
|
+
* @LastEditTime: 2024-04-12 11:29:01
|
11690
11676
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\WaterFall\index.tsx
|
11691
11677
|
*
|
11692
11678
|
*/
|
@@ -11750,7 +11736,7 @@ const WaterFall = (props) => {
|
|
11750
11736
|
relatedContentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
11751
11737
|
position: rec === null || rec === void 0 ? void 0 : rec.position,
|
11752
11738
|
contentTags: JSON.stringify((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.tags),
|
11753
|
-
traceInfo:
|
11739
|
+
traceInfo: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.traceInfo,
|
11754
11740
|
hashTags: JSON.stringify([recData === null || recData === void 0 ? void 0 : recData.hashTag]),
|
11755
11741
|
fromKName,
|
11756
11742
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
@@ -12854,15 +12840,15 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12854
12840
|
* @Author: binruan@chatlabs.com
|
12855
12841
|
* @Date: 2023-10-31 10:56:01
|
12856
12842
|
* @LastEditors: binruan@chatlabs.com
|
12857
|
-
* @LastEditTime: 2024-04-
|
12843
|
+
* @LastEditTime: 2024-04-12 09:50:58
|
12858
12844
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\Popup\index.tsx
|
12859
12845
|
*
|
12860
12846
|
*/
|
12861
12847
|
const Popup = () => {
|
12862
|
-
const { schema, resolver, popup
|
12848
|
+
const { schema, resolver, popup } = useEditor();
|
12863
12849
|
const { setPopupDetailData, popupDetailData, bffEventReport } = useSxpDataSource();
|
12864
12850
|
const { productView } = useEventReport();
|
12865
|
-
const [visible, setVisible] = React.useState(
|
12851
|
+
const [visible, setVisible] = React.useState();
|
12866
12852
|
const curTimeRef = React.useRef(null);
|
12867
12853
|
React.useEffect(() => {
|
12868
12854
|
const initTime = () => {
|
@@ -12875,33 +12861,33 @@ const Popup = () => {
|
|
12875
12861
|
};
|
12876
12862
|
}, []);
|
12877
12863
|
React.useEffect(() => {
|
12878
|
-
if (popup && popup !== '') {
|
12864
|
+
if (popup && (popup === null || popup === void 0 ? void 0 : popup.id) && (popup === null || popup === void 0 ? void 0 : popup.id) !== '') {
|
12879
12865
|
curTimeRef.current = new Date();
|
12880
|
-
setVisible(
|
12866
|
+
setVisible(popup);
|
12881
12867
|
}
|
12882
12868
|
}, [popup]);
|
12883
12869
|
const handleClose = () => {
|
12884
|
-
var _a, _b, _c;
|
12885
|
-
if (!popup || popup === '' || !visible || new Date() - curTimeRef.current < (
|
12870
|
+
var _a, _b, _c, _d;
|
12871
|
+
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)) {
|
12886
12872
|
return;
|
12887
12873
|
}
|
12888
|
-
setVisible(
|
12874
|
+
setVisible(Object.assign(Object.assign({}, popup), { id: '' }));
|
12889
12875
|
const data = popupDetailData;
|
12890
|
-
const product = (
|
12891
|
-
const cta = (
|
12876
|
+
const product = (_b = data === null || data === void 0 ? void 0 : data.video) === null || _b === void 0 ? void 0 : _b.bindProduct;
|
12877
|
+
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;
|
12892
12878
|
if (product && cta) {
|
12893
12879
|
productView(data, product, cta, curTimeRef.current);
|
12894
12880
|
}
|
12895
12881
|
setTimeout(() => {
|
12896
12882
|
window === null || window === void 0 ? void 0 : window.sxpPopup('');
|
12897
12883
|
setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(null);
|
12898
|
-
},
|
12884
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
12899
12885
|
};
|
12900
12886
|
const renderPopupDetail = React.useMemo(() => {
|
12901
12887
|
var _a, _b, _c;
|
12902
12888
|
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) => {
|
12903
12889
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
12904
|
-
if ((value === null || value === void 0 ? void 0 : value.id) === popup) {
|
12890
|
+
if ((value === null || value === void 0 ? void 0 : value.id) === (popup === null || popup === void 0 ? void 0 : popup.id)) {
|
12905
12891
|
const t = resolver[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
|
12906
12892
|
const Component = withBindDataSource(t);
|
12907
12893
|
const defaulSetting = (_b = t === null || t === void 0 ? void 0 : t.extend) === null || _b === void 0 ? void 0 : _b.defaulSetting;
|
@@ -12912,7 +12898,7 @@ const Popup = () => {
|
|
12912
12898
|
}
|
12913
12899
|
});
|
12914
12900
|
}, [schema, popup, resolver]);
|
12915
|
-
return (React.createElement(Modal$1, {
|
12901
|
+
return (React.createElement(Modal$1, { popup: visible, onClose: handleClose, padding: 0, modalStyle: { position: 'fixed' } }, renderPopupDetail));
|
12916
12902
|
};
|
12917
12903
|
|
12918
12904
|
/*
|