pb-sxp-ui 1.0.53 → 1.0.55
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 +112 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +112 -62
- 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 +112 -62
- 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/SxpPageCore/index.d.ts +1 -0
- package/es/core/components/SxpPageCore/index.js +2 -2
- package/es/core/components/SxpPageRender/Popup/index.js +1 -1
- package/es/core/components/SxpPageRender/VideoWidget/index.js +10 -2
- package/es/core/components/SxpPageRender/index.js +16 -2
- package/es/core/context/SxpDataSourceProvider.d.ts +7 -0
- package/es/core/context/SxpDataSourceProvider.js +15 -2
- package/es/materials/sxp/popup/AppointForm/index.d.ts +1 -0
- package/es/materials/sxp/popup/AppointForm/index.js +14 -9
- package/es/materials/sxp/popup/CommodityDetail/index.js +8 -1
- package/es/materials/sxp/popup/CommodityDetailDiro/index.js +8 -1
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +8 -1
- package/lib/core/components/SxpPageCore/index.d.ts +1 -0
- package/lib/core/components/SxpPageCore/index.js +2 -2
- package/lib/core/components/SxpPageRender/Popup/index.js +1 -1
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +10 -2
- package/lib/core/components/SxpPageRender/index.js +16 -2
- package/lib/core/context/SxpDataSourceProvider.d.ts +7 -0
- package/lib/core/context/SxpDataSourceProvider.js +15 -2
- package/lib/materials/sxp/popup/AppointForm/index.d.ts +1 -0
- package/lib/materials/sxp/popup/AppointForm/index.js +14 -9
- package/lib/materials/sxp/popup/CommodityDetail/index.js +8 -1
- package/lib/materials/sxp/popup/CommodityDetailDiro/index.js +8 -1
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +8 -1
- package/package.json +1 -1
@@ -8,7 +8,7 @@ const RESOLVER = {};
|
|
8
8
|
Object.values(_materials_).forEach((v) => {
|
9
9
|
RESOLVER[v.extend.type] = v;
|
10
10
|
});
|
11
|
-
const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, loadingImage, appDomain, licenseUrl }) => {
|
11
|
+
const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, loadingImage, appDomain, licenseUrl, enabledMetaConversionApi }) => {
|
12
12
|
var _a, _b, _c, _d, _e, _f;
|
13
13
|
const utmVal = useMemo(() => {
|
14
14
|
var _a;
|
@@ -16,7 +16,7 @@ const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, l
|
|
16
16
|
return searchParams;
|
17
17
|
}, []);
|
18
18
|
return (React.createElement(EditorCore, { resolver: RESOLVER, enableDataSource: false, schema: data === null || data === void 0 ? void 0 : data.data, utmVal: utmVal },
|
19
|
-
React.createElement(SxpDataSourceProvider, { utmVal: utmVal, dataSources: data === null || data === void 0 ? void 0 : data.data_sources, sxpParameter: data === null || data === void 0 ? void 0 : data.sxp_parameter, maxSize: (_b = (_a = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _a === void 0 ? void 0 : _a.personalized_recommend) !== null && _b !== void 0 ? _b : maxSize, defaultSize: (_d = (_c = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _c === void 0 ? void 0 : _c.default_recommend) !== null && _d !== void 0 ? _d : defaultSize, hashTagSize: (_f = (_e = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _e === void 0 ? void 0 : _e.hash_tag_size) !== null && _f !== void 0 ? _f : hashTagSize, loadingImage: loadingImage, appDomain: appDomain, render: ({ rtcList, tagList }) => {
|
19
|
+
React.createElement(SxpDataSourceProvider, { utmVal: utmVal, dataSources: data === null || data === void 0 ? void 0 : data.data_sources, sxpParameter: data === null || data === void 0 ? void 0 : data.sxp_parameter, maxSize: (_b = (_a = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _a === void 0 ? void 0 : _a.personalized_recommend) !== null && _b !== void 0 ? _b : maxSize, defaultSize: (_d = (_c = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _c === void 0 ? void 0 : _c.default_recommend) !== null && _d !== void 0 ? _d : defaultSize, hashTagSize: (_f = (_e = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _e === void 0 ? void 0 : _e.hash_tag_size) !== null && _f !== void 0 ? _f : hashTagSize, loadingImage: loadingImage, appDomain: appDomain, enabledMetaConversionApi: enabledMetaConversionApi, render: ({ rtcList, tagList }) => {
|
20
20
|
var _a;
|
21
21
|
return (React.createElement(React.Fragment, null,
|
22
22
|
React.createElement(SxpPageRender, Object.assign({}, (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER, licenseUrl: licenseUrl })),
|
@@ -50,7 +50,7 @@ const Popup = () => {
|
|
50
50
|
const t = resolver[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
|
51
51
|
const Component = withBindDataSource(t);
|
52
52
|
const defaulSetting = (_b = t === null || t === void 0 ? void 0 : t.extend) === null || _b === void 0 ? void 0 : _b.defaulSetting;
|
53
|
-
return (React.createElement(Component, Object.assign({ key: index, style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_c = value === null || value === void 0 ? void 0 : value.item) === null || _c === void 0 ? void 0 : _c.style), { width: '100%', height: '80vh', overflow: 'auto' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_d = value === null || value === void 0 ? void 0 : value.item) === null || _d === void 0 ? void 0 : _d.textStyle), bindDatas: (_f = (_e = value === null || value === void 0 ? void 0 : value.item) === null || _e === void 0 ? void 0 : _e.bindDatas) !== null && _f !== void 0 ? _f : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_g = value === null || value === void 0 ? void 0 : value.item) === null || _g === void 0 ? void 0 : _g.props, { event: ((_h = value === null || value === void 0 ? void 0 : value.item) === null || _h === void 0 ? void 0 : _h.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id })));
|
53
|
+
return (React.createElement(Component, Object.assign({ key: index, style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_c = value === null || value === void 0 ? void 0 : value.item) === null || _c === void 0 ? void 0 : _c.style), { width: '100%', height: '80vh', overflow: 'auto' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_d = value === null || value === void 0 ? void 0 : value.item) === null || _d === void 0 ? void 0 : _d.textStyle), bindDatas: (_f = (_e = value === null || value === void 0 ? void 0 : value.item) === null || _e === void 0 ? void 0 : _e.bindDatas) !== null && _f !== void 0 ? _f : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_g = value === null || value === void 0 ? void 0 : value.item) === null || _g === void 0 ? void 0 : _g.props, { event: ((_h = value === null || value === void 0 ? void 0 : value.item) === null || _h === void 0 ? void 0 : _h.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, onClose: handleClose })));
|
54
54
|
}
|
55
55
|
else {
|
56
56
|
return React.createElement(React.Fragment, null);
|
@@ -6,7 +6,7 @@ import { useSxpDataSource } from '../../../../core/hooks';
|
|
6
6
|
import SXP_EVENT_BUS, { SXP_EVENT_TYPE } from '../../../../core/utils/event';
|
7
7
|
const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoRef }) => {
|
8
8
|
const [isPauseVideo, setIsPauseVideo] = useState(false);
|
9
|
-
const { bffEventReport, sxpParameter, waterFallData, openHashtag } = useSxpDataSource();
|
9
|
+
const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport } = useSxpDataSource();
|
10
10
|
const videoStartTime = useRef(0);
|
11
11
|
const [isLoadFinish, setIsLoadFinish] = useState(false);
|
12
12
|
const [isFirstPlay, setIsFirstPlay] = useState(true);
|
@@ -207,6 +207,9 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
207
207
|
if (!videoRef || !isLoadFinish)
|
208
208
|
return;
|
209
209
|
if (isActive) {
|
210
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
211
|
+
eventName: 'ViewContent'
|
212
|
+
});
|
210
213
|
videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
|
211
214
|
}
|
212
215
|
else {
|
@@ -227,7 +230,12 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
227
230
|
useEffect(() => {
|
228
231
|
if (!isActive)
|
229
232
|
return;
|
230
|
-
const onShow =
|
233
|
+
const onShow = () => {
|
234
|
+
handleClickVideo('start')();
|
235
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
236
|
+
eventName: 'ViewContent'
|
237
|
+
});
|
238
|
+
};
|
231
239
|
const onHide = handleClickVideo('pause');
|
232
240
|
SXP_EVENT_BUS.on(SXP_EVENT_TYPE.PAGE_DID_SHOW, onShow);
|
233
241
|
SXP_EVENT_BUS.on(SXP_EVENT_TYPE.PAGE_DID_HIDE, onHide);
|
@@ -21,6 +21,7 @@ import './index.less';
|
|
21
21
|
import { useEventReport } from '../../../core/hooks/useEventReport';
|
22
22
|
import withBindDataSource from '../../../core/hoc/withBindDataSource';
|
23
23
|
import { getFeUserId } from '../../../core/utils/localStore';
|
24
|
+
import Tagbar from './Tagbar';
|
24
25
|
const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, tagList = [], licenseUrl }) => {
|
25
26
|
var _a, _b, _c, _d, _e, _f, _g;
|
26
27
|
const { schema } = useEditor();
|
@@ -32,7 +33,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
32
33
|
const viewTime = useRef();
|
33
34
|
const [isLoadMore, setIsLoadMore] = useState(false);
|
34
35
|
const [isShowMore, setIsShowMore] = useState(false);
|
35
|
-
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData } = useSxpDataSource();
|
36
|
+
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport } = useSxpDataSource();
|
36
37
|
const [videoRef, setVideoRef] = useState(null);
|
37
38
|
const playerRef = useRef();
|
38
39
|
const { productView } = useEventReport();
|
@@ -63,8 +64,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
63
64
|
requestId: null
|
64
65
|
}
|
65
66
|
});
|
67
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
68
|
+
eventName: 'PageView'
|
69
|
+
});
|
66
70
|
setIsInit(true);
|
67
|
-
}, [bffEventReport, data.length]);
|
71
|
+
}, [bffEventReport, data.length, bffFbReport]);
|
68
72
|
const initTime = () => {
|
69
73
|
curTime.current = new Date();
|
70
74
|
viewTime.current = new Date();
|
@@ -166,6 +170,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
166
170
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
|
167
171
|
minusHeight += 45;
|
168
172
|
}
|
173
|
+
if (tagList.length > 0) {
|
174
|
+
minusHeight += 45;
|
175
|
+
}
|
169
176
|
return containerHeight - minusHeight;
|
170
177
|
}, [globalConfig, containerHeight, tagList]);
|
171
178
|
const renderLogo = useMemo(() => {
|
@@ -320,6 +327,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
320
327
|
var _a, _b, _c;
|
321
328
|
if (!((_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.url) && !((_b = item === null || item === void 0 ? void 0 : item.video) === null || _b === void 0 ? void 0 : _b.imgUrls) && (item === null || item === void 0 ? void 0 : item.product)) {
|
322
329
|
productView(item, item.product, (_c = item === null || item === void 0 ? void 0 : item.product) === null || _c === void 0 ? void 0 : _c.bindCta, viewTime.current, activeIndex);
|
330
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
331
|
+
eventName: 'ProductView'
|
332
|
+
});
|
323
333
|
}
|
324
334
|
};
|
325
335
|
useEffect(() => {
|
@@ -346,6 +356,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
346
356
|
traceInfo: item.video.traceInfo
|
347
357
|
}
|
348
358
|
});
|
359
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
360
|
+
eventName: 'ViewContent'
|
361
|
+
});
|
349
362
|
}
|
350
363
|
};
|
351
364
|
const visList = useMemo(() => {
|
@@ -385,6 +398,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
385
398
|
setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(true);
|
386
399
|
} })),
|
387
400
|
renderLogo,
|
401
|
+
React.createElement(Tagbar, { tagList: tagList, setActiveIndex: setActiveIndex }),
|
388
402
|
isShowFingerTip ? React.createElement(FingerSwipeTip, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon }) : null,
|
389
403
|
React.createElement(Swiper, { ref: swiperRef, onSlideChange: () => {
|
390
404
|
swiperRef.current.swiper.allowTouchMove = false;
|
@@ -64,6 +64,12 @@ export interface ISxpDataSourceContext {
|
|
64
64
|
setLoading?: React.Dispatch<React.SetStateAction<boolean>>;
|
65
65
|
videoRef?: any;
|
66
66
|
setVideoRef?: React.Dispatch<React.SetStateAction<any>>;
|
67
|
+
bffFbReport?: (body: {
|
68
|
+
eventName: string;
|
69
|
+
actionSource?: string;
|
70
|
+
eventSourceUrl?: string;
|
71
|
+
externalId?: string;
|
72
|
+
}) => Promise<any> | undefined | boolean;
|
67
73
|
}
|
68
74
|
export declare const SxpDataSourceContext: React.Context<ISxpDataSourceContext>;
|
69
75
|
export interface SxpDataSourceProviderProps {
|
@@ -94,6 +100,7 @@ export interface SxpDataSourceProviderProps {
|
|
94
100
|
appDomain?: string;
|
95
101
|
loadingImage?: string;
|
96
102
|
isOpenHashTag?: boolean;
|
103
|
+
enabledMetaConversionApi?: boolean;
|
97
104
|
}
|
98
105
|
declare const _default: React.NamedExoticComponent<SxpDataSourceProviderProps>;
|
99
106
|
export default _default;
|
@@ -13,7 +13,7 @@ var DataSourceType;
|
|
13
13
|
DataSourceType[DataSourceType["BFF"] = 5] = "BFF";
|
14
14
|
})(DataSourceType || (DataSourceType = {}));
|
15
15
|
const UTM_KEYS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_id', 'utm_content', 'cl_source'];
|
16
|
-
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false }) => {
|
16
|
+
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false }) => {
|
17
17
|
const [rtcList, setRtcList] = useState([]);
|
18
18
|
const [tagList, setTagList] = useState([]);
|
19
19
|
const [loading, setLoading] = useState(false);
|
@@ -117,6 +117,18 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
117
117
|
type: 'beacon'
|
118
118
|
});
|
119
119
|
}, [bffFetch, curReqInfo, enableReportEvent]);
|
120
|
+
const bffFbReport = useCallback((_a) => {
|
121
|
+
var _b;
|
122
|
+
var { eventName, actionSource = 'website', eventSourceUrl = (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.href, externalId } = _a;
|
123
|
+
if (!enableReportEvent || !enabledMetaConversionApi) {
|
124
|
+
return;
|
125
|
+
}
|
126
|
+
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/fb/events', {
|
127
|
+
method: 'POST',
|
128
|
+
body: { eventName, actionSource, eventSourceUrl, 'userData.externalId': externalId },
|
129
|
+
type: 'beacon'
|
130
|
+
});
|
131
|
+
}, [bffFetch, enableReportEvent, enabledMetaConversionApi]);
|
120
132
|
const bffMutateLike = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
121
133
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/like', { method: 'POST', body }));
|
122
134
|
return res === null || res === void 0 ? void 0 : res.success;
|
@@ -223,7 +235,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
223
235
|
tagList,
|
224
236
|
setLoading,
|
225
237
|
videoRef,
|
226
|
-
setVideoRef
|
238
|
+
setVideoRef,
|
239
|
+
bffFbReport
|
227
240
|
} }, render({
|
228
241
|
rtcList,
|
229
242
|
mutateLike: bffMutateLike,
|
@@ -13,6 +13,7 @@ export interface IAppointFormProps {
|
|
13
13
|
submitEmail?: string;
|
14
14
|
layoutType?: 'horizontal' | 'vertical' | 'inline';
|
15
15
|
onClick?: () => void;
|
16
|
+
onClose?: () => void;
|
16
17
|
}
|
17
18
|
declare const _default: React.NamedExoticComponent<IAppointFormProps>;
|
18
19
|
export default _default;
|
@@ -6,7 +6,7 @@ import { cloneDeep, debounce } from 'lodash';
|
|
6
6
|
import { useSxpDataSource } from '../../../../core/hooks';
|
7
7
|
import './index.less';
|
8
8
|
const AppointForm = (_a) => {
|
9
|
-
var { columns, style, title, textStyle, submitBgColor, submitColor, submitText, layoutType, onClick } = _a, props = __rest(_a, ["columns", "style", "title", "textStyle", "submitBgColor", "submitColor", "submitText", "layoutType", "onClick"]);
|
9
|
+
var { columns, style, title, textStyle, submitBgColor, submitColor, submitText, layoutType, onClick, onClose } = _a, props = __rest(_a, ["columns", "style", "title", "textStyle", "submitBgColor", "submitColor", "submitText", "layoutType", "onClick", "onClose"]);
|
10
10
|
const { submitForm } = useSxpDataSource();
|
11
11
|
const formRef = useRef();
|
12
12
|
const [loading, setLoading] = useState(false);
|
@@ -47,19 +47,24 @@ const AppointForm = (_a) => {
|
|
47
47
|
}, [layoutType, columns, defaultColumns]);
|
48
48
|
const handleSubmit = debounce(() => __awaiter(void 0, void 0, void 0, function* () {
|
49
49
|
var _b, _c, _d;
|
50
|
-
setLoading(true);
|
51
50
|
const vals = yield ((_b = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _b === void 0 ? void 0 : _b.getFieldsValue());
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
51
|
+
if (!vals)
|
52
|
+
return;
|
53
|
+
const arr = (_d = (_c = Object.keys(vals)) === null || _c === void 0 ? void 0 : _c.map((key) => {
|
54
|
+
var _a;
|
55
|
+
return ({
|
56
|
+
name: key,
|
57
|
+
value: (_a = vals[key]) !== null && _a !== void 0 ? _a : ''
|
58
|
+
});
|
59
|
+
})) === null || _d === void 0 ? void 0 : _d.filter((item) => item === null || item === void 0 ? void 0 : item.value);
|
56
60
|
if (!arr || !(arr === null || arr === void 0 ? void 0 : arr.length))
|
57
61
|
return;
|
58
|
-
|
62
|
+
setLoading(true);
|
63
|
+
const res = (yield (submitForm === null || submitForm === void 0 ? void 0 : submitForm({ attributes: arr })));
|
59
64
|
setLoading(false);
|
60
65
|
if (res) {
|
61
|
-
|
62
|
-
|
66
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
67
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
63
68
|
}
|
64
69
|
}), 1000);
|
65
70
|
return (React.createElement("div", { className: 'pb-appoint-form' },
|
@@ -13,7 +13,7 @@ const CommodityDetail = (_a) => {
|
|
13
13
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
14
14
|
var { content, style, bgImg, onClick, schema, isDefault, bottom_image, tipText, isPost, viewTime, rec, swiper, commodityStyles, buttonStyle, index } = _a, props = __rest(_a, ["content", "style", "bgImg", "onClick", "schema", "isDefault", "bottom_image", "tipText", "isPost", "viewTime", "rec", "swiper", "commodityStyles", "buttonStyle", "index"]);
|
15
15
|
const { sxpParameter } = useSxpDataSource();
|
16
|
-
const { popupDetailData, bffEventReport, isPreview,
|
16
|
+
const { popupDetailData, bffEventReport, isPreview, bffFbReport } = useSxpDataSource();
|
17
17
|
const { jumpToWeb, productView } = useEventReport();
|
18
18
|
const curTimeRef = useRef(null);
|
19
19
|
const [showModal, setShowModal] = useState(false);
|
@@ -30,6 +30,13 @@ const CommodityDetail = (_a) => {
|
|
30
30
|
window.location.href = window.getJointUtmLink(product.link);
|
31
31
|
}
|
32
32
|
};
|
33
|
+
useEffect(() => {
|
34
|
+
if (!isPost) {
|
35
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
36
|
+
eventName: 'ProductView'
|
37
|
+
});
|
38
|
+
}
|
39
|
+
}, [isPost, bffFbReport]);
|
33
40
|
useEffect(() => {
|
34
41
|
const initTime = () => {
|
35
42
|
curTimeRef.current = new Date();
|
@@ -13,7 +13,7 @@ const CommodityDetailDiro = (_a) => {
|
|
13
13
|
var { style, isDefault, rec, viewTime, isPost, bottom_image, index } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "index"]);
|
14
14
|
const [spread, setSpread] = useState(true);
|
15
15
|
const { sxpParameter } = useSxpDataSource();
|
16
|
-
const { popupDetailData, bffEventReport, isPreview, swiperRef,
|
16
|
+
const { popupDetailData, bffEventReport, isPreview, swiperRef, bffFbReport } = useSxpDataSource();
|
17
17
|
const { jumpToWeb, productView } = useEventReport();
|
18
18
|
const scrollRef = useRef(null);
|
19
19
|
const touchRef = useRef(null);
|
@@ -35,6 +35,13 @@ const CommodityDetailDiro = (_a) => {
|
|
35
35
|
window.location.href = window.getJointUtmLink(product.link);
|
36
36
|
}
|
37
37
|
};
|
38
|
+
useEffect(() => {
|
39
|
+
if (!isPost) {
|
40
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
41
|
+
eventName: 'ProductView'
|
42
|
+
});
|
43
|
+
}
|
44
|
+
}, [isPost, bffFbReport]);
|
38
45
|
useEffect(() => {
|
39
46
|
const initTime = () => {
|
40
47
|
curTimeRef.current = new Date();
|
@@ -14,7 +14,7 @@ const CommodityDetailDiroNew = (_a) => {
|
|
14
14
|
var { style, isDefault, rec, viewTime, isPost, bottom_image, tipText, swiper, commodityStyles, buttonStyle, index } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "tipText", "swiper", "commodityStyles", "buttonStyle", "index"]);
|
15
15
|
const [spread, setSpread] = useState(true);
|
16
16
|
const { sxpParameter } = useSxpDataSource();
|
17
|
-
const { popupDetailData, bffEventReport, isPreview, swiperRef,
|
17
|
+
const { popupDetailData, bffEventReport, isPreview, swiperRef, bffFbReport } = useSxpDataSource();
|
18
18
|
const { jumpToWeb, productView } = useEventReport();
|
19
19
|
const scrollRef = useRef(null);
|
20
20
|
const touchRef = useRef(null);
|
@@ -37,6 +37,13 @@ const CommodityDetailDiroNew = (_a) => {
|
|
37
37
|
window.location.href = window.getJointUtmLink(product.link);
|
38
38
|
}
|
39
39
|
};
|
40
|
+
useEffect(() => {
|
41
|
+
if (!isPost) {
|
42
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
43
|
+
eventName: 'ProductView'
|
44
|
+
});
|
45
|
+
}
|
46
|
+
}, [isPost, bffFbReport]);
|
40
47
|
useEffect(() => {
|
41
48
|
const initTime = () => {
|
42
49
|
curTimeRef.current = new Date();
|
@@ -11,7 +11,7 @@ const RESOLVER = {};
|
|
11
11
|
Object.values(_materials_).forEach((v) => {
|
12
12
|
RESOLVER[v.extend.type] = v;
|
13
13
|
});
|
14
|
-
const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, loadingImage, appDomain, licenseUrl }) => {
|
14
|
+
const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, loadingImage, appDomain, licenseUrl, enabledMetaConversionApi }) => {
|
15
15
|
var _a, _b, _c, _d, _e, _f;
|
16
16
|
const utmVal = (0, react_1.useMemo)(() => {
|
17
17
|
var _a;
|
@@ -19,7 +19,7 @@ const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, l
|
|
19
19
|
return searchParams;
|
20
20
|
}, []);
|
21
21
|
return (react_1.default.createElement(core_1.EditorCore, { resolver: RESOLVER, enableDataSource: false, schema: data === null || data === void 0 ? void 0 : data.data, utmVal: utmVal },
|
22
|
-
react_1.default.createElement(SxpDataSourceProvider_1.default, { utmVal: utmVal, dataSources: data === null || data === void 0 ? void 0 : data.data_sources, sxpParameter: data === null || data === void 0 ? void 0 : data.sxp_parameter, maxSize: (_b = (_a = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _a === void 0 ? void 0 : _a.personalized_recommend) !== null && _b !== void 0 ? _b : maxSize, defaultSize: (_d = (_c = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _c === void 0 ? void 0 : _c.default_recommend) !== null && _d !== void 0 ? _d : defaultSize, hashTagSize: (_f = (_e = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _e === void 0 ? void 0 : _e.hash_tag_size) !== null && _f !== void 0 ? _f : hashTagSize, loadingImage: loadingImage, appDomain: appDomain, render: ({ rtcList, tagList }) => {
|
22
|
+
react_1.default.createElement(SxpDataSourceProvider_1.default, { utmVal: utmVal, dataSources: data === null || data === void 0 ? void 0 : data.data_sources, sxpParameter: data === null || data === void 0 ? void 0 : data.sxp_parameter, maxSize: (_b = (_a = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _a === void 0 ? void 0 : _a.personalized_recommend) !== null && _b !== void 0 ? _b : maxSize, defaultSize: (_d = (_c = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _c === void 0 ? void 0 : _c.default_recommend) !== null && _d !== void 0 ? _d : defaultSize, hashTagSize: (_f = (_e = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _e === void 0 ? void 0 : _e.hash_tag_size) !== null && _f !== void 0 ? _f : hashTagSize, loadingImage: loadingImage, appDomain: appDomain, enabledMetaConversionApi: enabledMetaConversionApi, render: ({ rtcList, tagList }) => {
|
23
23
|
var _a;
|
24
24
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
25
25
|
react_1.default.createElement(SxpPageRender_1.default, Object.assign({}, (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER, licenseUrl: licenseUrl })),
|
@@ -53,7 +53,7 @@ const Popup = () => {
|
|
53
53
|
const t = resolver[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
|
54
54
|
const Component = (0, withBindDataSource_1.default)(t);
|
55
55
|
const defaulSetting = (_b = t === null || t === void 0 ? void 0 : t.extend) === null || _b === void 0 ? void 0 : _b.defaulSetting;
|
56
|
-
return (react_1.default.createElement(Component, Object.assign({ key: index, style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_c = value === null || value === void 0 ? void 0 : value.item) === null || _c === void 0 ? void 0 : _c.style), { width: '100%', height: '80vh', overflow: 'auto' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_d = value === null || value === void 0 ? void 0 : value.item) === null || _d === void 0 ? void 0 : _d.textStyle), bindDatas: (_f = (_e = value === null || value === void 0 ? void 0 : value.item) === null || _e === void 0 ? void 0 : _e.bindDatas) !== null && _f !== void 0 ? _f : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_g = value === null || value === void 0 ? void 0 : value.item) === null || _g === void 0 ? void 0 : _g.props, { event: ((_h = value === null || value === void 0 ? void 0 : value.item) === null || _h === void 0 ? void 0 : _h.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id })));
|
56
|
+
return (react_1.default.createElement(Component, Object.assign({ key: index, style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_c = value === null || value === void 0 ? void 0 : value.item) === null || _c === void 0 ? void 0 : _c.style), { width: '100%', height: '80vh', overflow: 'auto' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_d = value === null || value === void 0 ? void 0 : value.item) === null || _d === void 0 ? void 0 : _d.textStyle), bindDatas: (_f = (_e = value === null || value === void 0 ? void 0 : value.item) === null || _e === void 0 ? void 0 : _e.bindDatas) !== null && _f !== void 0 ? _f : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_g = value === null || value === void 0 ? void 0 : value.item) === null || _g === void 0 ? void 0 : _g.props, { event: ((_h = value === null || value === void 0 ? void 0 : value.item) === null || _h === void 0 ? void 0 : _h.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, onClose: handleClose })));
|
57
57
|
}
|
58
58
|
else {
|
59
59
|
return react_1.default.createElement(react_1.default.Fragment, null);
|
@@ -9,7 +9,7 @@ const hooks_1 = require("../../../../core/hooks");
|
|
9
9
|
const event_1 = tslib_1.__importStar(require("../../../../core/utils/event"));
|
10
10
|
const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoRef }) => {
|
11
11
|
const [isPauseVideo, setIsPauseVideo] = (0, react_1.useState)(false);
|
12
|
-
const { bffEventReport, sxpParameter, waterFallData, openHashtag } = (0, hooks_1.useSxpDataSource)();
|
12
|
+
const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport } = (0, hooks_1.useSxpDataSource)();
|
13
13
|
const videoStartTime = (0, react_1.useRef)(0);
|
14
14
|
const [isLoadFinish, setIsLoadFinish] = (0, react_1.useState)(false);
|
15
15
|
const [isFirstPlay, setIsFirstPlay] = (0, react_1.useState)(true);
|
@@ -210,6 +210,9 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
210
210
|
if (!videoRef || !isLoadFinish)
|
211
211
|
return;
|
212
212
|
if (isActive) {
|
213
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
214
|
+
eventName: 'ViewContent'
|
215
|
+
});
|
213
216
|
videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
|
214
217
|
}
|
215
218
|
else {
|
@@ -230,7 +233,12 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
230
233
|
(0, react_1.useEffect)(() => {
|
231
234
|
if (!isActive)
|
232
235
|
return;
|
233
|
-
const onShow =
|
236
|
+
const onShow = () => {
|
237
|
+
handleClickVideo('start')();
|
238
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
239
|
+
eventName: 'ViewContent'
|
240
|
+
});
|
241
|
+
};
|
234
242
|
const onHide = handleClickVideo('pause');
|
235
243
|
event_1.default.on(event_1.SXP_EVENT_TYPE.PAGE_DID_SHOW, onShow);
|
236
244
|
event_1.default.on(event_1.SXP_EVENT_TYPE.PAGE_DID_HIDE, onHide);
|
@@ -24,6 +24,7 @@ require("./index.less");
|
|
24
24
|
const useEventReport_1 = require("../../../core/hooks/useEventReport");
|
25
25
|
const withBindDataSource_1 = tslib_1.__importDefault(require("../../../core/hoc/withBindDataSource"));
|
26
26
|
const localStore_1 = require("../../../core/utils/localStore");
|
27
|
+
const Tagbar_1 = tslib_1.__importDefault(require("./Tagbar"));
|
27
28
|
const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, tagList = [], licenseUrl }) => {
|
28
29
|
var _a, _b, _c, _d, _e, _f, _g;
|
29
30
|
const { schema } = (0, hooks_1.useEditor)();
|
@@ -35,7 +36,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
35
36
|
const viewTime = (0, react_1.useRef)();
|
36
37
|
const [isLoadMore, setIsLoadMore] = (0, react_1.useState)(false);
|
37
38
|
const [isShowMore, setIsShowMore] = (0, react_1.useState)(false);
|
38
|
-
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData } = (0, hooks_1.useSxpDataSource)();
|
39
|
+
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport } = (0, hooks_1.useSxpDataSource)();
|
39
40
|
const [videoRef, setVideoRef] = (0, react_1.useState)(null);
|
40
41
|
const playerRef = (0, react_1.useRef)();
|
41
42
|
const { productView } = (0, useEventReport_1.useEventReport)();
|
@@ -66,8 +67,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
66
67
|
requestId: null
|
67
68
|
}
|
68
69
|
});
|
70
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
71
|
+
eventName: 'PageView'
|
72
|
+
});
|
69
73
|
setIsInit(true);
|
70
|
-
}, [bffEventReport, data.length]);
|
74
|
+
}, [bffEventReport, data.length, bffFbReport]);
|
71
75
|
const initTime = () => {
|
72
76
|
curTime.current = new Date();
|
73
77
|
viewTime.current = new Date();
|
@@ -169,6 +173,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
169
173
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
|
170
174
|
minusHeight += 45;
|
171
175
|
}
|
176
|
+
if (tagList.length > 0) {
|
177
|
+
minusHeight += 45;
|
178
|
+
}
|
172
179
|
return containerHeight - minusHeight;
|
173
180
|
}, [globalConfig, containerHeight, tagList]);
|
174
181
|
const renderLogo = (0, react_1.useMemo)(() => {
|
@@ -323,6 +330,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
323
330
|
var _a, _b, _c;
|
324
331
|
if (!((_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.url) && !((_b = item === null || item === void 0 ? void 0 : item.video) === null || _b === void 0 ? void 0 : _b.imgUrls) && (item === null || item === void 0 ? void 0 : item.product)) {
|
325
332
|
productView(item, item.product, (_c = item === null || item === void 0 ? void 0 : item.product) === null || _c === void 0 ? void 0 : _c.bindCta, viewTime.current, activeIndex);
|
333
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
334
|
+
eventName: 'ProductView'
|
335
|
+
});
|
326
336
|
}
|
327
337
|
};
|
328
338
|
(0, react_1.useEffect)(() => {
|
@@ -349,6 +359,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
349
359
|
traceInfo: item.video.traceInfo
|
350
360
|
}
|
351
361
|
});
|
362
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
363
|
+
eventName: 'ViewContent'
|
364
|
+
});
|
352
365
|
}
|
353
366
|
};
|
354
367
|
const visList = (0, react_1.useMemo)(() => {
|
@@ -388,6 +401,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
388
401
|
setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(true);
|
389
402
|
} })),
|
390
403
|
renderLogo,
|
404
|
+
react_1.default.createElement(Tagbar_1.default, { tagList: tagList, setActiveIndex: setActiveIndex }),
|
391
405
|
isShowFingerTip ? react_1.default.createElement(FingerSwipeTip_1.default, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon }) : null,
|
392
406
|
react_1.default.createElement(react_2.Swiper, { ref: swiperRef, onSlideChange: () => {
|
393
407
|
swiperRef.current.swiper.allowTouchMove = false;
|
@@ -64,6 +64,12 @@ export interface ISxpDataSourceContext {
|
|
64
64
|
setLoading?: React.Dispatch<React.SetStateAction<boolean>>;
|
65
65
|
videoRef?: any;
|
66
66
|
setVideoRef?: React.Dispatch<React.SetStateAction<any>>;
|
67
|
+
bffFbReport?: (body: {
|
68
|
+
eventName: string;
|
69
|
+
actionSource?: string;
|
70
|
+
eventSourceUrl?: string;
|
71
|
+
externalId?: string;
|
72
|
+
}) => Promise<any> | undefined | boolean;
|
67
73
|
}
|
68
74
|
export declare const SxpDataSourceContext: React.Context<ISxpDataSourceContext>;
|
69
75
|
export interface SxpDataSourceProviderProps {
|
@@ -94,6 +100,7 @@ export interface SxpDataSourceProviderProps {
|
|
94
100
|
appDomain?: string;
|
95
101
|
loadingImage?: string;
|
96
102
|
isOpenHashTag?: boolean;
|
103
|
+
enabledMetaConversionApi?: boolean;
|
97
104
|
}
|
98
105
|
declare const _default: React.NamedExoticComponent<SxpDataSourceProviderProps>;
|
99
106
|
export default _default;
|
@@ -16,7 +16,7 @@ var DataSourceType;
|
|
16
16
|
DataSourceType[DataSourceType["BFF"] = 5] = "BFF";
|
17
17
|
})(DataSourceType || (DataSourceType = {}));
|
18
18
|
const UTM_KEYS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_id', 'utm_content', 'cl_source'];
|
19
|
-
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false }) => {
|
19
|
+
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false }) => {
|
20
20
|
const [rtcList, setRtcList] = (0, react_1.useState)([]);
|
21
21
|
const [tagList, setTagList] = (0, react_1.useState)([]);
|
22
22
|
const [loading, setLoading] = (0, react_1.useState)(false);
|
@@ -120,6 +120,18 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
120
120
|
type: 'beacon'
|
121
121
|
});
|
122
122
|
}, [bffFetch, curReqInfo, enableReportEvent]);
|
123
|
+
const bffFbReport = (0, react_1.useCallback)((_a) => {
|
124
|
+
var _b;
|
125
|
+
var { eventName, actionSource = 'website', eventSourceUrl = (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.href, externalId } = _a;
|
126
|
+
if (!enableReportEvent || !enabledMetaConversionApi) {
|
127
|
+
return;
|
128
|
+
}
|
129
|
+
return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/fb/events', {
|
130
|
+
method: 'POST',
|
131
|
+
body: { eventName, actionSource, eventSourceUrl, 'userData.externalId': externalId },
|
132
|
+
type: 'beacon'
|
133
|
+
});
|
134
|
+
}, [bffFetch, enableReportEvent, enabledMetaConversionApi]);
|
123
135
|
const bffMutateLike = (0, react_1.useCallback)((body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
124
136
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/like', { method: 'POST', body }));
|
125
137
|
return res === null || res === void 0 ? void 0 : res.success;
|
@@ -226,7 +238,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
226
238
|
tagList,
|
227
239
|
setLoading,
|
228
240
|
videoRef,
|
229
|
-
setVideoRef
|
241
|
+
setVideoRef,
|
242
|
+
bffFbReport
|
230
243
|
} }, render({
|
231
244
|
rtcList,
|
232
245
|
mutateLike: bffMutateLike,
|
@@ -13,6 +13,7 @@ export interface IAppointFormProps {
|
|
13
13
|
submitEmail?: string;
|
14
14
|
layoutType?: 'horizontal' | 'vertical' | 'inline';
|
15
15
|
onClick?: () => void;
|
16
|
+
onClose?: () => void;
|
16
17
|
}
|
17
18
|
declare const _default: React.NamedExoticComponent<IAppointFormProps>;
|
18
19
|
export default _default;
|
@@ -8,7 +8,7 @@ const lodash_1 = require("lodash");
|
|
8
8
|
const hooks_1 = require("../../../../core/hooks");
|
9
9
|
require("./index.less");
|
10
10
|
const AppointForm = (_a) => {
|
11
|
-
var { columns, style, title, textStyle, submitBgColor, submitColor, submitText, layoutType, onClick } = _a, props = tslib_1.__rest(_a, ["columns", "style", "title", "textStyle", "submitBgColor", "submitColor", "submitText", "layoutType", "onClick"]);
|
11
|
+
var { columns, style, title, textStyle, submitBgColor, submitColor, submitText, layoutType, onClick, onClose } = _a, props = tslib_1.__rest(_a, ["columns", "style", "title", "textStyle", "submitBgColor", "submitColor", "submitText", "layoutType", "onClick", "onClose"]);
|
12
12
|
const { submitForm } = (0, hooks_1.useSxpDataSource)();
|
13
13
|
const formRef = (0, react_1.useRef)();
|
14
14
|
const [loading, setLoading] = (0, react_1.useState)(false);
|
@@ -49,19 +49,24 @@ const AppointForm = (_a) => {
|
|
49
49
|
}, [layoutType, columns, defaultColumns]);
|
50
50
|
const handleSubmit = (0, lodash_1.debounce)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
51
51
|
var _b, _c, _d;
|
52
|
-
setLoading(true);
|
53
52
|
const vals = yield ((_b = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _b === void 0 ? void 0 : _b.getFieldsValue());
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
53
|
+
if (!vals)
|
54
|
+
return;
|
55
|
+
const arr = (_d = (_c = Object.keys(vals)) === null || _c === void 0 ? void 0 : _c.map((key) => {
|
56
|
+
var _a;
|
57
|
+
return ({
|
58
|
+
name: key,
|
59
|
+
value: (_a = vals[key]) !== null && _a !== void 0 ? _a : ''
|
60
|
+
});
|
61
|
+
})) === null || _d === void 0 ? void 0 : _d.filter((item) => item === null || item === void 0 ? void 0 : item.value);
|
58
62
|
if (!arr || !(arr === null || arr === void 0 ? void 0 : arr.length))
|
59
63
|
return;
|
60
|
-
|
64
|
+
setLoading(true);
|
65
|
+
const res = (yield (submitForm === null || submitForm === void 0 ? void 0 : submitForm({ attributes: arr })));
|
61
66
|
setLoading(false);
|
62
67
|
if (res) {
|
63
|
-
|
64
|
-
|
68
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
69
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
65
70
|
}
|
66
71
|
}), 1000);
|
67
72
|
return (react_1.default.createElement("div", { className: 'pb-appoint-form' },
|
@@ -15,7 +15,7 @@ const CommodityDetail = (_a) => {
|
|
15
15
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
16
16
|
var { content, style, bgImg, onClick, schema, isDefault, bottom_image, tipText, isPost, viewTime, rec, swiper, commodityStyles, buttonStyle, index } = _a, props = tslib_1.__rest(_a, ["content", "style", "bgImg", "onClick", "schema", "isDefault", "bottom_image", "tipText", "isPost", "viewTime", "rec", "swiper", "commodityStyles", "buttonStyle", "index"]);
|
17
17
|
const { sxpParameter } = (0, hooks_1.useSxpDataSource)();
|
18
|
-
const { popupDetailData, bffEventReport, isPreview,
|
18
|
+
const { popupDetailData, bffEventReport, isPreview, bffFbReport } = (0, hooks_1.useSxpDataSource)();
|
19
19
|
const { jumpToWeb, productView } = (0, useEventReport_1.useEventReport)();
|
20
20
|
const curTimeRef = (0, react_1.useRef)(null);
|
21
21
|
const [showModal, setShowModal] = (0, react_1.useState)(false);
|
@@ -32,6 +32,13 @@ const CommodityDetail = (_a) => {
|
|
32
32
|
window.location.href = window.getJointUtmLink(product.link);
|
33
33
|
}
|
34
34
|
};
|
35
|
+
(0, react_1.useEffect)(() => {
|
36
|
+
if (!isPost) {
|
37
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
38
|
+
eventName: 'ProductView'
|
39
|
+
});
|
40
|
+
}
|
41
|
+
}, [isPost, bffFbReport]);
|
35
42
|
(0, react_1.useEffect)(() => {
|
36
43
|
const initTime = () => {
|
37
44
|
curTimeRef.current = new Date();
|