pb-sxp-ui 1.20.2 → 1.20.4
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 +379 -123
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +379 -123
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +7 -7
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +7 -7
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +379 -123
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +7 -7
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/LikeButton/index.js +12 -4
- package/es/core/components/SxpPageRender/VideoWidget/index.js +6 -2
- package/es/core/components/SxpPageRender/WaterFall/List.js +12 -22
- package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +6 -4
- package/es/core/components/SxpPageRender/WaterFall/index.js +6 -2
- package/es/core/components/SxpPageRender/index.js +62 -16
- package/es/core/context/SxpDataSourceProvider.d.ts +8 -3
- package/es/core/context/SxpDataSourceProvider.js +63 -43
- package/es/core/utils/tool.d.ts +2 -1
- package/es/core/utils/tool.js +15 -1
- package/es/materials/sxp/cta/AniLink/index.js +18 -7
- package/es/materials/sxp/cta/AniLinkPopup/index.js +21 -10
- package/es/materials/sxp/popup/CommodityDetail/index.js +59 -2
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +60 -3
- package/es/materials/sxp/popup/CommodityList/index.js +21 -5
- package/es/materials/sxp/template/components/EventProvider.js +22 -10
- package/lib/core/components/SxpPageRender/LikeButton/index.js +12 -4
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +6 -2
- package/lib/core/components/SxpPageRender/WaterFall/List.js +11 -21
- package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +6 -4
- package/lib/core/components/SxpPageRender/WaterFall/index.js +6 -2
- package/lib/core/components/SxpPageRender/index.js +62 -16
- package/lib/core/context/SxpDataSourceProvider.d.ts +8 -3
- package/lib/core/context/SxpDataSourceProvider.js +61 -41
- package/lib/core/utils/tool.d.ts +2 -1
- package/lib/core/utils/tool.js +16 -1
- package/lib/materials/sxp/cta/AniLink/index.js +18 -7
- package/lib/materials/sxp/cta/AniLinkPopup/index.js +21 -10
- package/lib/materials/sxp/popup/CommodityDetail/index.js +59 -2
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +60 -3
- package/lib/materials/sxp/popup/CommodityList/index.js +21 -5
- package/lib/materials/sxp/template/components/EventProvider.js +22 -10
- package/package.json +1 -1
|
@@ -97,7 +97,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
97
97
|
(_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index);
|
|
98
98
|
}, [data, ctaType, swiperRef]);
|
|
99
99
|
const handleSessionCompleted = (0, react_1.useCallback)((fk) => {
|
|
100
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
100
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
|
|
101
101
|
const item = data === null || data === void 0 ? void 0 : data[activeIndex];
|
|
102
102
|
let fromKName = '';
|
|
103
103
|
if (popupDetailData && (((_b = (_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) || ((_c = item === null || item === void 0 ? void 0 : item.video) === null || _c === void 0 ? void 0 : _c.bindProduct))) {
|
|
@@ -132,7 +132,18 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
132
132
|
traceInfo: (_v = (_t = (_s = item === null || item === void 0 ? void 0 : item.video) === null || _s === void 0 ? void 0 : _s.traceInfo) !== null && _t !== void 0 ? _t : (_u = item === null || item === void 0 ? void 0 : item.product) === null || _u === void 0 ? void 0 : _u.traceInfo) !== null && _v !== void 0 ? _v : ''
|
|
133
133
|
}
|
|
134
134
|
});
|
|
135
|
-
|
|
135
|
+
const isPostType = ((_w = item === null || item === void 0 ? void 0 : item.video) === null || _w === void 0 ? void 0 : _w.url) || ((_y = (_x = item === null || item === void 0 ? void 0 : item.video) === null || _x === void 0 ? void 0 : _x.imgUrls) === null || _y === void 0 ? void 0 : _y.length);
|
|
136
|
+
if (!popupDetailData) {
|
|
137
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
|
138
|
+
eventName: 'ExitFeed',
|
|
139
|
+
product: isPostType ? (_z = item === null || item === void 0 ? void 0 : item.video) === null || _z === void 0 ? void 0 : _z.bindProducts : (item === null || item === void 0 ? void 0 : item.product) ? [item === null || item === void 0 ? void 0 : item.product] : [],
|
|
140
|
+
rec: item,
|
|
141
|
+
position: activeIndex,
|
|
142
|
+
content_id: isPostType ? (_1 = (_0 = item === null || item === void 0 ? void 0 : item.video) === null || _0 === void 0 ? void 0 : _0.itemId) !== null && _1 !== void 0 ? _1 : '' : (_3 = (_2 = item === null || item === void 0 ? void 0 : item.product) === null || _2 === void 0 ? void 0 : _2.itemId) !== null && _3 !== void 0 ? _3 : '',
|
|
143
|
+
view_time: new Date() - viewTime.current
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}, [data, bffEventReport, activeIndex, popupDetailData, tempMap, isFromHashtag, curTime, bffFbReport]);
|
|
136
147
|
(0, react_1.useEffect)(() => {
|
|
137
148
|
const item = data === null || data === void 0 ? void 0 : data[activeIndex];
|
|
138
149
|
const visibleChange = () => {
|
|
@@ -432,48 +443,79 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
432
443
|
}
|
|
433
444
|
};
|
|
434
445
|
const handleScrollEvent = (swiper) => {
|
|
435
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
446
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10;
|
|
436
447
|
const item = data[swiper.previousIndex];
|
|
448
|
+
const activeItem = data[swiper.activeIndex];
|
|
437
449
|
if (!item)
|
|
438
450
|
return;
|
|
439
451
|
let contentFormat = null;
|
|
440
|
-
|
|
452
|
+
let previousContentType = 'post';
|
|
453
|
+
let previousContentId = (_b = (_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.itemId) !== null && _b !== void 0 ? _b : '';
|
|
454
|
+
let previousProduct = (_c = item === null || item === void 0 ? void 0 : item.video) === null || _c === void 0 ? void 0 : _c.bindProducts;
|
|
455
|
+
let previousContentsName = (_e = (_d = item === null || item === void 0 ? void 0 : item.video) === null || _d === void 0 ? void 0 : _d.title) !== null && _e !== void 0 ? _e : '';
|
|
456
|
+
let previousDirection = '';
|
|
457
|
+
let contentId = (_g = (_f = activeItem === null || activeItem === void 0 ? void 0 : activeItem.video) === null || _f === void 0 ? void 0 : _f.itemId) !== null && _g !== void 0 ? _g : '';
|
|
458
|
+
if ((_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.url) {
|
|
441
459
|
contentFormat = 'video';
|
|
442
460
|
}
|
|
443
|
-
else if ((
|
|
461
|
+
else if ((_k = (_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.imgUrls) === null || _k === void 0 ? void 0 : _k.length) {
|
|
444
462
|
contentFormat = 'image';
|
|
445
463
|
}
|
|
464
|
+
else {
|
|
465
|
+
previousContentType = 'product';
|
|
466
|
+
previousContentId = (_m = (_l = item === null || item === void 0 ? void 0 : item.product) === null || _l === void 0 ? void 0 : _l.itemId) !== null && _m !== void 0 ? _m : '';
|
|
467
|
+
previousProduct = (item === null || item === void 0 ? void 0 : item.product) ? [item === null || item === void 0 ? void 0 : item.product] : [];
|
|
468
|
+
previousContentsName = '';
|
|
469
|
+
}
|
|
470
|
+
if (!((_o = activeItem === null || activeItem === void 0 ? void 0 : activeItem.video) === null || _o === void 0 ? void 0 : _o.url) && !((_q = (_p = activeItem === null || activeItem === void 0 ? void 0 : activeItem.video) === null || _p === void 0 ? void 0 : _p.imgUrls) === null || _q === void 0 ? void 0 : _q.length)) {
|
|
471
|
+
contentId = (_s = (_r = activeItem === null || activeItem === void 0 ? void 0 : activeItem.product) === null || _r === void 0 ? void 0 : _r.itemId) !== null && _s !== void 0 ? _s : '';
|
|
472
|
+
}
|
|
446
473
|
if (swiper.previousIndex - swiper.activeIndex < 0) {
|
|
447
474
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
|
448
475
|
eventInfo: {
|
|
449
476
|
eventSubject: 'scrollDown',
|
|
450
477
|
eventDescription: 'User scroll down',
|
|
451
|
-
contentId: (
|
|
452
|
-
productId: (
|
|
478
|
+
contentId: (_u = (_t = item === null || item === void 0 ? void 0 : item.video) === null || _t === void 0 ? void 0 : _t.itemId) !== null && _u !== void 0 ? _u : '',
|
|
479
|
+
productId: (_w = (_v = item === null || item === void 0 ? void 0 : item.product) === null || _v === void 0 ? void 0 : _v.itemId) !== null && _w !== void 0 ? _w : '',
|
|
453
480
|
requestId: null,
|
|
454
|
-
traceInfo: (
|
|
481
|
+
traceInfo: (_0 = (_y = (_x = item === null || item === void 0 ? void 0 : item.video) === null || _x === void 0 ? void 0 : _x.traceInfo) !== null && _y !== void 0 ? _y : (_z = item === null || item === void 0 ? void 0 : item.product) === null || _z === void 0 ? void 0 : _z.traceInfo) !== null && _0 !== void 0 ? _0 : '',
|
|
455
482
|
contentFormat,
|
|
456
|
-
position: ((
|
|
483
|
+
position: ((_1 = swiper.previousIndex) !== null && _1 !== void 0 ? _1 : 0) + ''
|
|
457
484
|
}
|
|
458
485
|
});
|
|
459
486
|
handleViewImageStartEnd(item);
|
|
460
487
|
handleSlideSkip(item, swiper.previousIndex);
|
|
488
|
+
previousDirection = 'up';
|
|
461
489
|
}
|
|
462
490
|
else {
|
|
463
491
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
|
464
492
|
eventInfo: {
|
|
465
493
|
eventSubject: 'scrollUp',
|
|
466
494
|
eventDescription: 'User scroll up',
|
|
467
|
-
contentId: (
|
|
468
|
-
productId: (
|
|
495
|
+
contentId: (_3 = (_2 = item === null || item === void 0 ? void 0 : item.video) === null || _2 === void 0 ? void 0 : _2.itemId) !== null && _3 !== void 0 ? _3 : '',
|
|
496
|
+
productId: (_5 = (_4 = item.product) === null || _4 === void 0 ? void 0 : _4.itemId) !== null && _5 !== void 0 ? _5 : '',
|
|
469
497
|
requestId: null,
|
|
470
|
-
traceInfo: (
|
|
498
|
+
traceInfo: (_9 = (_7 = (_6 = item === null || item === void 0 ? void 0 : item.video) === null || _6 === void 0 ? void 0 : _6.traceInfo) !== null && _7 !== void 0 ? _7 : (_8 = item === null || item === void 0 ? void 0 : item.product) === null || _8 === void 0 ? void 0 : _8.traceInfo) !== null && _9 !== void 0 ? _9 : '',
|
|
471
499
|
contentFormat,
|
|
472
|
-
position: ((
|
|
500
|
+
position: ((_10 = swiper.previousIndex) !== null && _10 !== void 0 ? _10 : 0) + ''
|
|
473
501
|
}
|
|
474
502
|
});
|
|
475
503
|
handleViewImageStartEnd(item);
|
|
476
|
-
|
|
504
|
+
previousDirection = 'down';
|
|
505
|
+
}
|
|
506
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
|
507
|
+
eventName: 'ContentSwipe',
|
|
508
|
+
product: previousProduct,
|
|
509
|
+
rec: activeItem,
|
|
510
|
+
position: swiper.activeIndex,
|
|
511
|
+
previous_content_id: previousContentId,
|
|
512
|
+
previous_content_type: previousContentType,
|
|
513
|
+
previous_contents_name: previousContentsName,
|
|
514
|
+
previosu_position: swiper.previousIndex,
|
|
515
|
+
swipe_direction: previousDirection,
|
|
516
|
+
view_time: new Date() - viewTime.current,
|
|
517
|
+
content_id: contentId
|
|
518
|
+
});
|
|
477
519
|
handleReportProductView(item);
|
|
478
520
|
viewTime.current = new Date();
|
|
479
521
|
};
|
|
@@ -574,11 +616,15 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
574
616
|
if (enableCapi) {
|
|
575
617
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
|
576
618
|
eventName: 'ViewContent',
|
|
577
|
-
product: (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.
|
|
619
|
+
product: (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.bindProducts,
|
|
620
|
+
rec: item,
|
|
621
|
+
position: activeIndex
|
|
578
622
|
});
|
|
579
623
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
|
580
624
|
eventName: 'PageView',
|
|
581
|
-
product: (_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.
|
|
625
|
+
product: (_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.bindProducts,
|
|
626
|
+
rec: item,
|
|
627
|
+
position: activeIndex
|
|
582
628
|
});
|
|
583
629
|
}
|
|
584
630
|
}
|
|
@@ -12,6 +12,7 @@ export interface IEventTimeType {
|
|
|
12
12
|
time: Date;
|
|
13
13
|
target: EventTarget;
|
|
14
14
|
}
|
|
15
|
+
export type ICapiEventNameType = 'PageView' | 'ProductView' | 'ViewContent' | 'ClickCTA' | 'ContentSwipe' | 'Engagement' | 'ExitFeed';
|
|
15
16
|
export interface ISxpDataSourceContext {
|
|
16
17
|
rtcList: RecItemType[];
|
|
17
18
|
setRtcList?: React.Dispatch<React.SetStateAction<RecItemType[]>>;
|
|
@@ -51,7 +52,7 @@ export interface ISxpDataSourceContext {
|
|
|
51
52
|
sxpParameter?: PageData['sxp_parameter'];
|
|
52
53
|
waterFallData?: IWaterFallDataType;
|
|
53
54
|
setWaterFallData?: React.Dispatch<React.SetStateAction<IWaterFallDataType | undefined>>;
|
|
54
|
-
ctaEvent?: (eventInfo: any, rec?: RecItemType, product?: ProductInfoType | VideoInfoType | null, number?: number) => void;
|
|
55
|
+
ctaEvent?: (eventInfo: any, rec?: RecItemType, product?: ProductInfoType | VideoInfoType | null, number?: number, ctaActionType?: 'open_internal_popup' | 'open_external_link', targetUrl?: string | null, contentType?: 'product' | 'post') => void;
|
|
55
56
|
swiperRef?: any;
|
|
56
57
|
openHashtag?: boolean;
|
|
57
58
|
setOpenHashtag?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
@@ -72,8 +73,12 @@ export interface ISxpDataSourceContext {
|
|
|
72
73
|
videoRef?: any;
|
|
73
74
|
setVideoRef?: React.Dispatch<React.SetStateAction<any>>;
|
|
74
75
|
bffFbReport?: (body: {
|
|
75
|
-
eventName:
|
|
76
|
-
product?:
|
|
76
|
+
eventName: ICapiEventNameType;
|
|
77
|
+
product?: ProductInfoType[];
|
|
78
|
+
contentType?: 'product' | 'post';
|
|
79
|
+
rec?: RecItemType;
|
|
80
|
+
position?: number;
|
|
81
|
+
[key: string]: any;
|
|
77
82
|
}) => void;
|
|
78
83
|
curTime?: any;
|
|
79
84
|
h5EnterLink?: () => void;
|
|
@@ -331,7 +331,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
331
331
|
}
|
|
332
332
|
});
|
|
333
333
|
};
|
|
334
|
-
}, [
|
|
334
|
+
}, []);
|
|
335
335
|
(0, react_1.useEffect)(() => {
|
|
336
336
|
const originalOpen = XMLHttpRequest.prototype.open;
|
|
337
337
|
const originalSend = XMLHttpRequest.prototype.send;
|
|
@@ -535,19 +535,45 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
535
535
|
playbookType,
|
|
536
536
|
bffDataSource
|
|
537
537
|
]);
|
|
538
|
-
const getEventParamsByJson = (0, react_1.useCallback)((
|
|
539
|
-
var
|
|
538
|
+
const getEventParamsByJson = (0, react_1.useCallback)((_a) => {
|
|
539
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
540
|
+
var { json, product = [], rec, contentType = 'post', position, eventName } = _a, props = tslib_1.__rest(_a, ["json", "product", "rec", "contentType", "position", "eventName"]);
|
|
540
541
|
const jsonParams = (0, lodash_1.cloneDeep)(json);
|
|
541
542
|
const urlParams = new URLSearchParams(window.location.search);
|
|
542
543
|
const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
|
|
543
544
|
const fix_par = {
|
|
544
|
-
event_source_url: (
|
|
545
|
+
event_source_url: (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.href,
|
|
545
546
|
external_id: fakeUserId,
|
|
546
|
-
client_user_agent: (
|
|
547
|
+
client_user_agent: (_d = (_c = window === null || window === void 0 ? void 0 : window.navigator) === null || _c === void 0 ? void 0 : _c.userAgent) !== null && _d !== void 0 ? _d : '',
|
|
547
548
|
fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
|
|
548
549
|
fbp: (0, tool_1.getCookie)('_fbp') ? `${(0, tool_1.getCookie)('_fbp')}` : '',
|
|
549
550
|
time: Math.floor(Date.now() / 1000)
|
|
550
551
|
};
|
|
552
|
+
let customData = Object.assign({ content_ids: [(_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.itemId, ...((_f = product === null || product === void 0 ? void 0 : product.map((item) => item === null || item === void 0 ? void 0 : item.itemId)) !== null && _f !== void 0 ? _f : [])], content_type: contentType, content_name: (_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.title, total_posts: rtcList === null || rtcList === void 0 ? void 0 : rtcList.length, position, currency: (_h = product === null || product === void 0 ? void 0 : product[0]) === null || _h === void 0 ? void 0 : _h.currency, contents: (_j = product === null || product === void 0 ? void 0 : product.map((item) => ({
|
|
553
|
+
item_id: item === null || item === void 0 ? void 0 : item.itemId,
|
|
554
|
+
item_price: item === null || item === void 0 ? void 0 : item.price
|
|
555
|
+
}))) !== null && _j !== void 0 ? _j : [], image_urls: (_l = (_k = rec === null || rec === void 0 ? void 0 : rec.video) === null || _k === void 0 ? void 0 : _k.imgUrls) !== null && _l !== void 0 ? _l : [], video_urls: (_m = rec === null || rec === void 0 ? void 0 : rec.video) === null || _m === void 0 ? void 0 : _m.url, headline: (0, tool_1.getUrlParamByKey)('headline'), scene: (0, tool_1.getUrlParamByKey)('scene'), campaign_id: (0, tool_1.getUrlParamByKey)('campaign_id'), ad_id: (0, tool_1.getUrlParamByKey)('ad_id'), utm_source: (0, tool_1.getUrlParamByKey)('utm_source'), utm_medium: (0, tool_1.getUrlParamByKey)('utm_medium'), utm_campaign: (0, tool_1.getUrlParamByKey)('utm_campaign'), utm_content: (0, tool_1.getUrlParamByKey)('utm_content') }, props);
|
|
556
|
+
if (!((_o = rec === null || rec === void 0 ? void 0 : rec.video) === null || _o === void 0 ? void 0 : _o.url) && !((_q = (_p = rec === null || rec === void 0 ? void 0 : rec.video) === null || _p === void 0 ? void 0 : _p.imgUrls) === null || _q === void 0 ? void 0 : _q.length) && (rec === null || rec === void 0 ? void 0 : rec.product) && Array.isArray(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) && ((_r = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _r === void 0 ? void 0 : _r.length) > 0) {
|
|
557
|
+
const product = rec === null || rec === void 0 ? void 0 : rec.product;
|
|
558
|
+
const productCustomData = {
|
|
559
|
+
content_ids: [product === null || product === void 0 ? void 0 : product.itemId],
|
|
560
|
+
content_type: 'product',
|
|
561
|
+
content_name: '',
|
|
562
|
+
contents: [{
|
|
563
|
+
item_id: product === null || product === void 0 ? void 0 : product.itemId,
|
|
564
|
+
item_price: product === null || product === void 0 ? void 0 : product.price
|
|
565
|
+
}],
|
|
566
|
+
image_urls: (_s = product.homePage) !== null && _s !== void 0 ? _s : []
|
|
567
|
+
};
|
|
568
|
+
customData = Object.assign(Object.assign({}, customData), productCustomData);
|
|
569
|
+
}
|
|
570
|
+
if (eventName === 'ContentSwipe' || eventName === 'Engagement' || eventName === 'ExitFeed') {
|
|
571
|
+
const deleteKeys = ['content_ids', 'content_category', 'currency', 'contents', 'image_urls', 'video_urls', 'prompt'];
|
|
572
|
+
deleteKeys.forEach(key => {
|
|
573
|
+
if (customData === null || customData === void 0 ? void 0 : customData[key])
|
|
574
|
+
delete customData[key];
|
|
575
|
+
});
|
|
576
|
+
}
|
|
551
577
|
const regex = /\{\{(.*?)\}\}/g;
|
|
552
578
|
const getEventParams = (obj) => {
|
|
553
579
|
if (!obj)
|
|
@@ -560,6 +586,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
560
586
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
561
587
|
const value = obj === null || obj === void 0 ? void 0 : obj[key];
|
|
562
588
|
if (typeof value === 'object') {
|
|
589
|
+
if (key === 'custom_data') {
|
|
590
|
+
obj[key] = customData !== null && customData !== void 0 ? customData : {};
|
|
591
|
+
}
|
|
563
592
|
getEventParams(value);
|
|
564
593
|
}
|
|
565
594
|
else if (typeof value === 'string') {
|
|
@@ -569,7 +598,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
569
598
|
var _a;
|
|
570
599
|
const prop = match.substring(2, match.length - 2);
|
|
571
600
|
try {
|
|
572
|
-
let replaceValue = new Function('fix_par', 'product', `return ${prop}`)(fix_par, product);
|
|
601
|
+
let replaceValue = new Function('fix_par', 'product', `return ${prop}`)(fix_par, product === null || product === void 0 ? void 0 : product[0]);
|
|
573
602
|
if (replaceValue) {
|
|
574
603
|
if ((prop === null || prop === void 0 ? void 0 : prop.indexOf('currency')) !== -1 &&
|
|
575
604
|
(replaceValue === null || replaceValue === void 0 ? void 0 : replaceValue.indexOf('-')) !== -1 &&
|
|
@@ -594,15 +623,17 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
594
623
|
}
|
|
595
624
|
};
|
|
596
625
|
getEventParams(jsonParams);
|
|
626
|
+
console.log('capi event params:', jsonParams);
|
|
597
627
|
return jsonParams;
|
|
598
|
-
}, [fakeUserId]);
|
|
599
|
-
const bffFbReport = (0, react_1.useCallback)((
|
|
600
|
-
var
|
|
628
|
+
}, [fakeUserId, globalConfig, rtcList]);
|
|
629
|
+
const bffFbReport = (0, react_1.useCallback)((_a) => {
|
|
630
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
631
|
+
var { eventName } = _a, props = tslib_1.__rest(_a, ["eventName"]);
|
|
601
632
|
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) || getTargetingCookie()) {
|
|
602
633
|
return;
|
|
603
634
|
}
|
|
604
635
|
let isPushState = false;
|
|
605
|
-
const pixelEventParamsJson = (
|
|
636
|
+
const pixelEventParamsJson = (_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.pixel) === null || _b === void 0 ? void 0 : _b[eventName];
|
|
606
637
|
if ((pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name) && typeof (window === null || window === void 0 ? void 0 : window.fbq) === 'function') {
|
|
607
638
|
function updateQueryStringParameter(uri, key, value) {
|
|
608
639
|
const re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i');
|
|
@@ -626,39 +657,39 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
626
657
|
}
|
|
627
658
|
}
|
|
628
659
|
else {
|
|
629
|
-
window === null || window === void 0 ? void 0 : window.fbq('track', pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name, getEventParamsByJson(pixelEventParamsJson,
|
|
660
|
+
window === null || window === void 0 ? void 0 : window.fbq('track', pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name, getEventParamsByJson(Object.assign({ json: pixelEventParamsJson, eventName }, props)));
|
|
630
661
|
}
|
|
631
662
|
}
|
|
632
663
|
if (!isPushState) {
|
|
633
664
|
if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
|
|
634
665
|
window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view');
|
|
635
666
|
}
|
|
636
|
-
const tiktokPixelEventParamsJson = (
|
|
667
|
+
const tiktokPixelEventParamsJson = (_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.tiktokPixel) === null || _c === void 0 ? void 0 : _c[eventName];
|
|
637
668
|
if ((tiktokPixelEventParamsJson === null || tiktokPixelEventParamsJson === void 0 ? void 0 : tiktokPixelEventParamsJson.event_name) &&
|
|
638
669
|
typeof (window === null || window === void 0 ? void 0 : window.ttq) === 'object' &&
|
|
639
|
-
typeof ((
|
|
640
|
-
(
|
|
670
|
+
typeof ((_d = window === null || window === void 0 ? void 0 : window.ttq) === null || _d === void 0 ? void 0 : _d.track) === 'function') {
|
|
671
|
+
(_e = window === null || window === void 0 ? void 0 : window.ttq) === null || _e === void 0 ? void 0 : _e.track(tiktokPixelEventParamsJson === null || tiktokPixelEventParamsJson === void 0 ? void 0 : tiktokPixelEventParamsJson.event_name, getEventParamsByJson(Object.assign({ json: tiktokPixelEventParamsJson, eventName }, props)));
|
|
641
672
|
}
|
|
642
673
|
}
|
|
643
|
-
const snapchatPixelEventParamsJson = (
|
|
674
|
+
const snapchatPixelEventParamsJson = (_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.snapchatPixel) === null || _f === void 0 ? void 0 : _f[eventName];
|
|
644
675
|
if ((snapchatPixelEventParamsJson === null || snapchatPixelEventParamsJson === void 0 ? void 0 : snapchatPixelEventParamsJson.event_name) && typeof (window === null || window === void 0 ? void 0 : window.snaptr) === 'function') {
|
|
645
|
-
window === null || window === void 0 ? void 0 : window.snaptr('track', snapchatPixelEventParamsJson === null || snapchatPixelEventParamsJson === void 0 ? void 0 : snapchatPixelEventParamsJson.event_name, getEventParamsByJson(snapchatPixelEventParamsJson,
|
|
676
|
+
window === null || window === void 0 ? void 0 : window.snaptr('track', snapchatPixelEventParamsJson === null || snapchatPixelEventParamsJson === void 0 ? void 0 : snapchatPixelEventParamsJson.event_name, getEventParamsByJson(Object.assign({ json: snapchatPixelEventParamsJson, eventName }, props)));
|
|
646
677
|
}
|
|
647
|
-
if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.Northbeam) === 'object' && typeof ((
|
|
648
|
-
(
|
|
678
|
+
if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.Northbeam) === 'object' && typeof ((_g = window === null || window === void 0 ? void 0 : window.Northbeam) === null || _g === void 0 ? void 0 : _g.trackPageView) === 'function') {
|
|
679
|
+
(_h = window === null || window === void 0 ? void 0 : window.Northbeam) === null || _h === void 0 ? void 0 : _h.trackPageView();
|
|
649
680
|
}
|
|
650
|
-
const converApiEventParamsJson = (
|
|
681
|
+
const converApiEventParamsJson = (_j = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _j === void 0 ? void 0 : _j[eventName];
|
|
651
682
|
if (enabledMetaConversionApi && converApiEventParamsJson) {
|
|
652
|
-
const body = getEventParamsByJson(converApiEventParamsJson,
|
|
683
|
+
const body = getEventParamsByJson(Object.assign({ json: converApiEventParamsJson, eventName }, props));
|
|
653
684
|
const params = {};
|
|
654
685
|
const queryString = location.search.slice(1);
|
|
655
|
-
(
|
|
686
|
+
(_k = (0, tool_1.splitUrlParams)(queryString)) === null || _k === void 0 ? void 0 : _k.forEach((val) => {
|
|
656
687
|
const key = val.split('=')[0];
|
|
657
688
|
const value = val.split('=')[1];
|
|
658
689
|
params[key] = value;
|
|
659
690
|
});
|
|
660
691
|
const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
|
|
661
|
-
bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/fb/${(
|
|
692
|
+
bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/fb/${(_l = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _l === void 0 ? void 0 : _l['x-app-id']}/${eventName}${cl_source ? `/${decodeURIComponent(cl_source)}` : ''}`, {
|
|
662
693
|
method: 'POST',
|
|
663
694
|
body,
|
|
664
695
|
type: 'beacon'
|
|
@@ -695,7 +726,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
695
726
|
console.log('e', e);
|
|
696
727
|
}
|
|
697
728
|
}), [bffFetch, utmVal]);
|
|
698
|
-
const ctaEvent = (0, react_1.useCallback)((eventInfo, rec, product, position) => {
|
|
729
|
+
const ctaEvent = (0, react_1.useCallback)((eventInfo, rec, product, position, ctaActionType, targetUrl, contentType) => {
|
|
699
730
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
|
|
700
731
|
const cta = product === null || product === void 0 ? void 0 : product.bindCta;
|
|
701
732
|
const isProd = ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProduct) || (((_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.bindProducts) && ((_d = (_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.bindProducts) === null || _d === void 0 ? void 0 : _d.length) > 0);
|
|
@@ -718,32 +749,21 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
718
749
|
});
|
|
719
750
|
}, [bffEventReport, isFromHashtag]);
|
|
720
751
|
const h5EnterLink = (0, react_1.useCallback)(() => {
|
|
721
|
-
var _a, _b
|
|
722
|
-
const queryString = location.search.slice(1);
|
|
723
|
-
const params = {};
|
|
724
|
-
(_a = (0, tool_1.splitUrlParams)(queryString.replace(/\+/g, '%2B'))) === null || _a === void 0 ? void 0 : _a.map((val) => {
|
|
725
|
-
const key = val.split('=')[0];
|
|
726
|
-
const value = val.split('=')[1];
|
|
727
|
-
params[key] = value;
|
|
728
|
-
});
|
|
729
|
-
for (const key in params) {
|
|
730
|
-
params[key] = params[key].replace(/%2B/g, '+');
|
|
731
|
-
}
|
|
732
|
-
const getVal = (key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ''; };
|
|
752
|
+
var _a, _b;
|
|
733
753
|
const time = new Date();
|
|
734
754
|
curTime.current = time;
|
|
735
755
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
|
736
756
|
eventInfo: {
|
|
737
757
|
eventSubject: 'h5LinkEnterFeed',
|
|
738
758
|
eventDescription: 'User enter h5 link',
|
|
739
|
-
utmSource:
|
|
740
|
-
utmMedium:
|
|
741
|
-
utmCampaign:
|
|
742
|
-
utmId:
|
|
743
|
-
utmContent:
|
|
759
|
+
utmSource: (0, tool_1.getUrlParamByKey)('utm_source'),
|
|
760
|
+
utmMedium: (0, tool_1.getUrlParamByKey)('utm_medium'),
|
|
761
|
+
utmCampaign: (0, tool_1.getUrlParamByKey)('utm_campaign'),
|
|
762
|
+
utmId: (0, tool_1.getUrlParamByKey)('utm_id'),
|
|
763
|
+
utmContent: (0, tool_1.getUrlParamByKey)('utm_content'),
|
|
744
764
|
enterTime: Math.floor(time / 1000) + '',
|
|
745
765
|
requestId: null,
|
|
746
|
-
enterUrl: (
|
|
766
|
+
enterUrl: (_b = (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.href) !== null && _b !== void 0 ? _b : ''
|
|
747
767
|
},
|
|
748
768
|
reportLayId: false
|
|
749
769
|
});
|
package/lib/core/utils/tool.d.ts
CHANGED
|
@@ -15,4 +15,5 @@ declare function getScreenReader(): boolean;
|
|
|
15
15
|
declare function splitUrlParams(urlParams: string): string[] | undefined;
|
|
16
16
|
declare function deleteCookie(name: string, path?: string, domain?: string): void;
|
|
17
17
|
declare function setCookie(name: string, value: string, days?: number, path?: string, domain?: string, secure?: boolean, sameSite?: string): void;
|
|
18
|
-
|
|
18
|
+
declare function getUrlParamByKey(key: string): any;
|
|
19
|
+
export { uuid, getIndexByblockType, getBrowserInfo, getDevice, getSystem, getCookie, getScreenReader, splitUrlParams, deleteCookie, setCookie, getUrlParamByKey };
|
package/lib/core/utils/tool.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setCookie = exports.deleteCookie = exports.splitUrlParams = exports.getScreenReader = exports.getCookie = exports.getSystem = exports.getDevice = exports.getBrowserInfo = exports.getIndexByblockType = exports.uuid = exports.setFontForText = exports.getUid = exports.generateRandomString = void 0;
|
|
3
|
+
exports.getUrlParamByKey = exports.setCookie = exports.deleteCookie = exports.splitUrlParams = exports.getScreenReader = exports.getCookie = exports.getSystem = exports.getDevice = exports.getBrowserInfo = exports.getIndexByblockType = exports.uuid = exports.setFontForText = exports.getUid = exports.generateRandomString = void 0;
|
|
4
4
|
const uuid_1 = require("uuid");
|
|
5
5
|
function uuid(len, radix) {
|
|
6
6
|
const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
|
|
@@ -235,3 +235,18 @@ function setCookie(name, value, days = 0, path = '/', domain = '', secure = fals
|
|
|
235
235
|
document.cookie = cookieString;
|
|
236
236
|
}
|
|
237
237
|
exports.setCookie = setCookie;
|
|
238
|
+
function getUrlParamByKey(key) {
|
|
239
|
+
var _a, _b;
|
|
240
|
+
const queryString = location.search.slice(1);
|
|
241
|
+
const params = {};
|
|
242
|
+
(_a = splitUrlParams(queryString.replace(/\+/g, '%2B'))) === null || _a === void 0 ? void 0 : _a.map((val) => {
|
|
243
|
+
const key = val.split('=')[0];
|
|
244
|
+
const value = val.split('=')[1];
|
|
245
|
+
params[key] = value;
|
|
246
|
+
});
|
|
247
|
+
for (const key in params) {
|
|
248
|
+
params[key] = params[key].replace(/%2B/g, '+');
|
|
249
|
+
}
|
|
250
|
+
return (_b = params[key]) !== null && _b !== void 0 ? _b : '';
|
|
251
|
+
}
|
|
252
|
+
exports.getUrlParamByKey = getUrlParamByKey;
|
|
@@ -3,15 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const css_1 = require("@emotion/css");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const index_module_less_1 = tslib_1.__importDefault(require("./index.module.less"));
|
|
6
7
|
const hooks_1 = require("../../../../core/hooks");
|
|
7
8
|
const useEventReport_1 = require("../../../../core/hooks/useEventReport");
|
|
8
9
|
const tool_1 = require("../../../../core/utils/tool");
|
|
9
|
-
const index_module_less_1 = tslib_1.__importDefault(require("./index.module.less"));
|
|
10
10
|
const useOnScreen_1 = tslib_1.__importDefault(require("../../../../core/hooks/useOnScreen"));
|
|
11
11
|
const AniLink = (_a) => {
|
|
12
12
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
13
13
|
var { style, recData, ctaTempStyles, index, event, onClick, isExternalLink = false, isActive } = _a, props = tslib_1.__rest(_a, ["style", "recData", "ctaTempStyles", "index", "event", "onClick", "isExternalLink", "isActive"]);
|
|
14
|
-
const { ctaEvent, setPopupDetailData } = (0, hooks_1.useSxpDataSource)();
|
|
14
|
+
const { ctaEvent, setPopupDetailData, bffFbReport } = (0, hooks_1.useSxpDataSource)();
|
|
15
15
|
const { jumpToWeb } = (0, useEventReport_1.useEventReport)();
|
|
16
16
|
const [visible, setVisible] = (0, react_1.useState)(false);
|
|
17
17
|
const ref = (0, react_1.useRef)(null);
|
|
@@ -21,17 +21,28 @@ const AniLink = (_a) => {
|
|
|
21
21
|
const handleTo = (e) => {
|
|
22
22
|
var _a, _b, _c, _d;
|
|
23
23
|
const item = ((_b = (_a = recData === null || recData === void 0 ? void 0 : recData.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b[0]) || ((_c = recData === null || recData === void 0 ? void 0 : recData.video) === null || _c === void 0 ? void 0 : _c.bindProduct) || (recData === null || recData === void 0 ? void 0 : recData.video);
|
|
24
|
+
const link = (product === null || product === void 0 ? void 0 : product.link) || ((_d = item === null || item === void 0 ? void 0 : item.bindCta) === null || _d === void 0 ? void 0 : _d.link);
|
|
24
25
|
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
|
25
26
|
eventSubject: 'clickCta',
|
|
26
27
|
eventDescription: 'User clicked the CTA'
|
|
27
28
|
}, recData, item, index);
|
|
29
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
|
30
|
+
eventName: 'ClickCTA',
|
|
31
|
+
product: product ? [product] : undefined,
|
|
32
|
+
contentType: 'post',
|
|
33
|
+
recData,
|
|
34
|
+
index,
|
|
35
|
+
cta_text: cta === null || cta === void 0 ? void 0 : cta.enTitle,
|
|
36
|
+
cta_action_type: (isExternalLink && !!link) ? 'open_external_link' : 'open_internal_popup',
|
|
37
|
+
target_content_id: product === null || product === void 0 ? void 0 : product.itemId,
|
|
38
|
+
target_url: link
|
|
39
|
+
});
|
|
28
40
|
setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, recData), { index }));
|
|
29
41
|
if (isExternalLink) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
42
|
+
if (!link)
|
|
43
|
+
return;
|
|
44
|
+
jumpToWeb(e, recData, product, cta, index);
|
|
45
|
+
window.location.href = window.getJointUtmLink(link);
|
|
35
46
|
}
|
|
36
47
|
else {
|
|
37
48
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
@@ -3,17 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const css_1 = require("@emotion/css");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const Img_1 = tslib_1.__importDefault(require("../../template/components/Img"));
|
|
7
|
+
const index_module_less_1 = tslib_1.__importDefault(require("./index.module.less"));
|
|
6
8
|
const hooks_1 = require("../../../../core/hooks");
|
|
7
9
|
const useEventReport_1 = require("../../../../core/hooks/useEventReport");
|
|
8
|
-
const Img_1 = tslib_1.__importDefault(require("../../template/components/Img"));
|
|
9
10
|
const tool_1 = require("../../../../core/utils/tool");
|
|
10
|
-
const index_module_less_1 = tslib_1.__importDefault(require("./index.module.less"));
|
|
11
11
|
const closeIcon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjhJREFUWEfFlztOw0AQhmeWiJ4CCmpQ5DiRQsIJyAWg5A0lR0AIChDiCJS8ER0cADgBeRSxt4CCDgkaKiq8i+zYeWx2413HEWmiJJv9v535Z2aN8M8vFPT9z3zETD0aAUChUJjwvPFHAJhBhB3Hqd6OAsK2yyucwykAvP38eJX398Z3AJDLlVYR8ToU9Rhj25TWr9KEsKy5dULIGQCMtfZly45TvwsAstm56UwG6wA4FUFwzrdctxZBDcWSy5XWEPG8I84/GcMipdWPtgcsaz5PCHtKG0IuTiqUvjT9U/WYMG2IOPE+AP+LtCB0xKUAAyA2Xbd2o2OG0NQXvTnvhL17D7EPtH9TRCIWwkRcGYGIQgYBABuqPuHXOQBc6pw80lBGwBQiiXhsBHQhkoprA6iM6acjhDQKu5YJZW6XeOI3XJdpvfsdTu52VfXEekD8owQiXGIubpSCbhDbLu8DwKEAd+A41SOdPpE4BS0viFOtvV2iKWqUgn5x/tmS70xR01GuDSCKc86/OCcLgTyyZ0ScDGNhFAktAJV4NFJ9YyaFiAWIE+9uVkkgBgLoig8DMWAa9ro9ynkUdlW5maZDCmB6clmz0k1HH4Cs1Ezbq2p2yEpUuBOKTSZZex00RUWIrltxuuK6EOGDSbGIOPZicpMx6fny650377qNRgBgWeVFQuA+6UjVgREhGIMlSqsPUQqIbZdOOIdZQmCv2axRnU1N1+TzJYsxOEaEV8ep7frPZ7Gd0FTEdP0ft0/kMNdg0eoAAAAASUVORK5CYII=';
|
|
12
12
|
const AniLinkPopup = (_a) => {
|
|
13
13
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
14
14
|
var { style, recData, ctaTempStyles, index, event, bottom_image, translateY, isTel, onClick, isExternalLink = false, isActive } = _a, props = tslib_1.__rest(_a, ["style", "recData", "ctaTempStyles", "index", "event", "bottom_image", "translateY", "isTel", "onClick", "isExternalLink", "isActive"]);
|
|
15
15
|
style === null || style === void 0 ? true : delete style.transform;
|
|
16
|
-
const { sxpParameter, globalConfig, ctaEvent, setPopupDetailData } = (0, hooks_1.useSxpDataSource)();
|
|
16
|
+
const { sxpParameter, globalConfig, ctaEvent, setPopupDetailData, bffFbReport } = (0, hooks_1.useSxpDataSource)();
|
|
17
17
|
const { jumpToWeb } = (0, useEventReport_1.useEventReport)();
|
|
18
18
|
const [visible, setVisible] = (0, react_1.useState)(true);
|
|
19
19
|
const cta = ((_d = (_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProducts) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.bindCta) || ((_f = (_e = recData === null || recData === void 0 ? void 0 : recData.video) === null || _e === void 0 ? void 0 : _e.bindProduct) === null || _f === void 0 ? void 0 : _f.bindCta) || ((_g = recData === null || recData === void 0 ? void 0 : recData.video) === null || _g === void 0 ? void 0 : _g.bindCta);
|
|
@@ -21,17 +21,28 @@ const AniLinkPopup = (_a) => {
|
|
|
21
21
|
const handleTo = (e) => {
|
|
22
22
|
var _a, _b, _c, _d;
|
|
23
23
|
const item = ((_b = (_a = recData === null || recData === void 0 ? void 0 : recData.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b[0]) || ((_c = recData === null || recData === void 0 ? void 0 : recData.video) === null || _c === void 0 ? void 0 : _c.bindProduct) || (recData === null || recData === void 0 ? void 0 : recData.video);
|
|
24
|
+
const link = (product === null || product === void 0 ? void 0 : product.link) || ((_d = item === null || item === void 0 ? void 0 : item.bindCta) === null || _d === void 0 ? void 0 : _d.link);
|
|
24
25
|
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
|
25
26
|
eventSubject: 'clickCta',
|
|
26
27
|
eventDescription: 'User clicked the CTA'
|
|
27
28
|
}, recData, item, index);
|
|
29
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
|
30
|
+
eventName: 'ClickCTA',
|
|
31
|
+
product: product ? [product] : undefined,
|
|
32
|
+
contentType: 'post',
|
|
33
|
+
recData,
|
|
34
|
+
index,
|
|
35
|
+
cta_text: cta === null || cta === void 0 ? void 0 : cta.enTitle,
|
|
36
|
+
cta_action_type: (isExternalLink && !!link) ? 'open_external_link' : 'open_internal_popup',
|
|
37
|
+
target_content_id: product === null || product === void 0 ? void 0 : product.itemId,
|
|
38
|
+
target_url: link
|
|
39
|
+
});
|
|
28
40
|
setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, recData), { index }));
|
|
29
41
|
if (isExternalLink) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
42
|
+
if (!link)
|
|
43
|
+
return;
|
|
44
|
+
jumpToWeb(e, recData, product, cta, index);
|
|
45
|
+
window.location.href = window.getJointUtmLink(link);
|
|
35
46
|
}
|
|
36
47
|
else {
|
|
37
48
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
@@ -65,8 +76,8 @@ const AniLinkPopup = (_a) => {
|
|
|
65
76
|
height: '40px',
|
|
66
77
|
lineHeight: '40px',
|
|
67
78
|
paddingLeft: '6px'
|
|
68
|
-
} }, "Cta Title")) : (react_1.default.createElement("div", Object.assign({}, props, { className: `${(0, css_1.css)(Object.assign(Object.assign({}, style), { '--transY': `translateY(calc(100% + ${(_r = style === null || style === void 0 ? void 0 : style.margin) !== null && _r !== void 0 ? _r : 0}px))` }))} ${index_module_less_1.default
|
|
69
|
-
react_1.default.createElement("div", { onClick: onClose, className: index_module_less_1.default['modal-icon-wrapper'], style: { padding: (_s = style === null || style === void 0 ? void 0 : style
|
|
79
|
+
} }, "Cta Title")) : (react_1.default.createElement("div", Object.assign({}, props, { className: `${(0, css_1.css)(Object.assign(Object.assign({}, style), { '--transY': `translateY(calc(100% + ${(_r = style === null || style === void 0 ? void 0 : style.margin) !== null && _r !== void 0 ? _r : 0}px))` }))} ${index_module_less_1.default.aniLinkPopup} ${aniNamStyle} ${(0, css_1.css)(aniTimStyle)}`, onClick: handleTo }),
|
|
80
|
+
react_1.default.createElement("div", { onClick: onClose, className: index_module_less_1.default['modal-icon-wrapper'], style: { padding: (_s = style === null || style === void 0 ? void 0 : style.padding) !== null && _s !== void 0 ? _s : 0 } },
|
|
70
81
|
react_1.default.createElement("img", { src: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.popupCloseIcon) || closeIcon, alt: 'close', className: index_module_less_1.default['modal-icon-wrapper-img'] })),
|
|
71
82
|
react_1.default.createElement(Img_1.default, { src: src, rec: recData, item: (_x = (_v = (_u = (_t = recData === null || recData === void 0 ? void 0 : recData.video) === null || _t === void 0 ? void 0 : _t.bindProducts) === null || _u === void 0 ? void 0 : _u[0]) !== null && _v !== void 0 ? _v : (_w = recData === null || recData === void 0 ? void 0 : recData.video) === null || _w === void 0 ? void 0 : _w.bindProduct) !== null && _x !== void 0 ? _x : recData === null || recData === void 0 ? void 0 : recData.video, index: index, translateY: translateY, imgStyle: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img, isActive: isActive }),
|
|
72
83
|
(!recData || (product === null || product === void 0 ? void 0 : product.title)) && (react_1.default.createElement("div", { className: index_module_less_1.default['one-line-ellipsis'], style: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.title, dangerouslySetInnerHTML: {
|