pb-sxp-ui 1.20.1 → 1.20.3
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 +253 -120
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +253 -120
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +6 -6
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +6 -6
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +253 -120
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +6 -6
- 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 +15 -16
- package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +14 -2
- package/es/core/components/SxpPageRender/WaterFall/index.d.ts +2 -0
- package/es/core/components/SxpPageRender/WaterFall/index.js +1 -4
- package/es/core/components/SxpPageRender/index.js +62 -18
- package/es/core/context/SxpDataSourceProvider.d.ts +8 -3
- package/es/core/context/SxpDataSourceProvider.js +76 -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 +7 -7
- package/es/materials/sxp/cta/AniLinkPopup/index.js +10 -10
- package/es/materials/sxp/popup/CommodityDetail/index.js +9 -3
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +9 -3
- package/es/materials/sxp/popup/CommodityList/index.js +10 -6
- package/es/materials/sxp/template/components/EventProvider.js +9 -9
- 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 +14 -15
- package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +14 -2
- package/lib/core/components/SxpPageRender/WaterFall/index.d.ts +2 -0
- package/lib/core/components/SxpPageRender/WaterFall/index.js +1 -4
- package/lib/core/components/SxpPageRender/index.js +62 -18
- package/lib/core/context/SxpDataSourceProvider.d.ts +8 -3
- package/lib/core/context/SxpDataSourceProvider.js +74 -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 +7 -7
- package/lib/materials/sxp/cta/AniLinkPopup/index.js +10 -10
- package/lib/materials/sxp/popup/CommodityDetail/index.js +9 -3
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +9 -3
- package/lib/materials/sxp/popup/CommodityList/index.js +10 -6
- package/lib/materials/sxp/template/components/EventProvider.js +9 -9
- package/package.json +1 -1
|
@@ -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: product === null || product === void 0 ? void 0 : product.title,
|
|
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);
|
|
@@ -716,34 +747,36 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
|
716
747
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
|
717
748
|
eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (_r = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _r !== void 0 ? _r : '', ctaName: (_s = cta === null || cta === void 0 ? void 0 : cta.title) !== null && _s !== void 0 ? _s : '', contentTags: contentTags ? JSON.stringify(contentTags) : '', position: position + '', contentId: (_u = (_t = rec === null || rec === void 0 ? void 0 : rec.video) === null || _t === void 0 ? void 0 : _t.itemId) !== null && _u !== void 0 ? _u : '', productId: isProd ? product === null || product === void 0 ? void 0 : product.itemId : '', traceInfo: (_10 = (_7 = (_2 = (_y = (_v = cta === null || cta === void 0 ? void 0 : cta.traceInfo) !== null && _v !== void 0 ? _v : (_x = (_w = rec === null || rec === void 0 ? void 0 : rec.video) === null || _w === void 0 ? void 0 : _w.bindCta) === null || _x === void 0 ? void 0 : _x.traceInfo) !== null && _y !== void 0 ? _y : (_1 = (_0 = (_z = rec === null || rec === void 0 ? void 0 : rec.video) === null || _z === void 0 ? void 0 : _z.bindProduct) === null || _0 === void 0 ? void 0 : _0.bindCta) === null || _1 === void 0 ? void 0 : _1.traceInfo) !== null && _2 !== void 0 ? _2 : (_6 = (_5 = (_4 = (_3 = rec === null || rec === void 0 ? void 0 : rec.video) === null || _3 === void 0 ? void 0 : _3.bindProducts) === null || _4 === void 0 ? void 0 : _4[0]) === null || _5 === void 0 ? void 0 : _5.bindCta) === null || _6 === void 0 ? void 0 : _6.traceInfo) !== null && _7 !== void 0 ? _7 : (_9 = (_8 = rec === null || rec === void 0 ? void 0 : rec.product) === null || _8 === void 0 ? void 0 : _8.bindCta) === null || _9 === void 0 ? void 0 : _9.traceInfo) !== null && _10 !== void 0 ? _10 : '', fromKName, fromKPage: (_11 = location === null || location === void 0 ? void 0 : location.href) !== null && _11 !== void 0 ? _11 : '', contentFormat })
|
|
718
749
|
});
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
750
|
+
if ((eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.eventSubject) === 'clickCta') {
|
|
751
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
|
752
|
+
eventName: 'ClickCTA',
|
|
753
|
+
product: product ? [product] : undefined,
|
|
754
|
+
contentType: contentType !== null && contentType !== void 0 ? contentType : 'post',
|
|
755
|
+
rec,
|
|
756
|
+
position,
|
|
757
|
+
cta_text: cta === null || cta === void 0 ? void 0 : cta.enTitle,
|
|
758
|
+
cta_action_type: ctaActionType,
|
|
759
|
+
target_content_id: product === null || product === void 0 ? void 0 : product.itemId,
|
|
760
|
+
target_url: targetUrl
|
|
761
|
+
});
|
|
731
762
|
}
|
|
732
|
-
|
|
763
|
+
}, [bffEventReport, isFromHashtag, bffFbReport]);
|
|
764
|
+
const h5EnterLink = (0, react_1.useCallback)(() => {
|
|
765
|
+
var _a, _b;
|
|
733
766
|
const time = new Date();
|
|
734
767
|
curTime.current = time;
|
|
735
768
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
|
736
769
|
eventInfo: {
|
|
737
770
|
eventSubject: 'h5LinkEnterFeed',
|
|
738
771
|
eventDescription: 'User enter h5 link',
|
|
739
|
-
utmSource:
|
|
740
|
-
utmMedium:
|
|
741
|
-
utmCampaign:
|
|
742
|
-
utmId:
|
|
743
|
-
utmContent:
|
|
772
|
+
utmSource: (0, tool_1.getUrlParamByKey)('utm_source'),
|
|
773
|
+
utmMedium: (0, tool_1.getUrlParamByKey)('utm_medium'),
|
|
774
|
+
utmCampaign: (0, tool_1.getUrlParamByKey)('utm_campaign'),
|
|
775
|
+
utmId: (0, tool_1.getUrlParamByKey)('utm_id'),
|
|
776
|
+
utmContent: (0, tool_1.getUrlParamByKey)('utm_content'),
|
|
744
777
|
enterTime: Math.floor(time / 1000) + '',
|
|
745
778
|
requestId: null,
|
|
746
|
-
enterUrl: (
|
|
779
|
+
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
780
|
},
|
|
748
781
|
reportLayId: false
|
|
749
782
|
});
|
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,10 +3,10 @@ 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;
|
|
@@ -21,17 +21,17 @@ 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
|
-
}, recData, item, index);
|
|
28
|
+
}, recData, item, index, (isExternalLink && !!link) ? 'open_external_link' : 'open_internal_popup', link);
|
|
28
29
|
setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, recData), { index }));
|
|
29
30
|
if (isExternalLink) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
31
|
+
if (!link)
|
|
32
|
+
return;
|
|
33
|
+
jumpToWeb(e, recData, product, cta, index);
|
|
34
|
+
window.location.href = window.getJointUtmLink(link);
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
37
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
@@ -3,11 +3,11 @@ 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;
|
|
@@ -21,17 +21,17 @@ 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
|
-
}, recData, item, index);
|
|
28
|
+
}, recData, item, index, (isExternalLink && !!link) ? 'open_external_link' : 'open_internal_popup', link);
|
|
28
29
|
setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(Object.assign(Object.assign({}, recData), { index }));
|
|
29
30
|
if (isExternalLink) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
31
|
+
if (!link)
|
|
32
|
+
return;
|
|
33
|
+
jumpToWeb(e, recData, product, cta, index);
|
|
34
|
+
window.location.href = window.getJointUtmLink(link);
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
37
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
@@ -65,8 +65,8 @@ const AniLinkPopup = (_a) => {
|
|
|
65
65
|
height: '40px',
|
|
66
66
|
lineHeight: '40px',
|
|
67
67
|
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
|
|
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.aniLinkPopup} ${aniNamStyle} ${(0, css_1.css)(aniTimStyle)}`, onClick: handleTo }),
|
|
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.padding) !== null && _s !== void 0 ? _s : 0 } },
|
|
70
70
|
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
71
|
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
72
|
(!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: {
|
|
@@ -47,7 +47,7 @@ const CommodityDetail = (_a) => {
|
|
|
47
47
|
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
|
48
48
|
eventSubject: 'clickCta',
|
|
49
49
|
eventDescription: 'User clicked the CTA'
|
|
50
|
-
}, data, product, position);
|
|
50
|
+
}, data, product, position, 'open_external_link', product.link, 'product');
|
|
51
51
|
}
|
|
52
52
|
window.location.href = window.getJointUtmLink(product.link);
|
|
53
53
|
}
|
|
@@ -57,11 +57,17 @@ const CommodityDetail = (_a) => {
|
|
|
57
57
|
return;
|
|
58
58
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
|
59
59
|
eventName: 'ProductView',
|
|
60
|
-
product
|
|
60
|
+
product: product ? [product] : undefined,
|
|
61
|
+
contentType: 'product',
|
|
62
|
+
rec: data,
|
|
63
|
+
position
|
|
61
64
|
});
|
|
62
65
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
|
63
66
|
eventName: 'PageView',
|
|
64
|
-
product
|
|
67
|
+
product: product ? [product] : undefined,
|
|
68
|
+
contentType: 'product',
|
|
69
|
+
rec: data,
|
|
70
|
+
position
|
|
65
71
|
});
|
|
66
72
|
}, [isActive, bffFbReport]);
|
|
67
73
|
(0, react_1.useEffect)(() => {
|
|
@@ -51,7 +51,7 @@ const CommodityDetailDiroNew = (_a) => {
|
|
|
51
51
|
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
|
52
52
|
eventSubject: 'clickCta',
|
|
53
53
|
eventDescription: 'User clicked the CTA'
|
|
54
|
-
}, data, product, position);
|
|
54
|
+
}, data, product, position, 'open_external_link', product.link, 'product');
|
|
55
55
|
}
|
|
56
56
|
window.location.href = window.getJointUtmLink(product.link);
|
|
57
57
|
}
|
|
@@ -61,11 +61,17 @@ const CommodityDetailDiroNew = (_a) => {
|
|
|
61
61
|
return;
|
|
62
62
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
|
63
63
|
eventName: 'ProductView',
|
|
64
|
-
product
|
|
64
|
+
product: product ? [product] : undefined,
|
|
65
|
+
contentType: 'product',
|
|
66
|
+
rec: data,
|
|
67
|
+
position
|
|
65
68
|
});
|
|
66
69
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
|
67
70
|
eventName: 'PageView',
|
|
68
|
-
product
|
|
71
|
+
product: product ? [product] : undefined,
|
|
72
|
+
contentType: 'product',
|
|
73
|
+
rec: data,
|
|
74
|
+
position
|
|
69
75
|
});
|
|
70
76
|
}, [isActive, bffFbReport]);
|
|
71
77
|
(0, react_1.useEffect)(() => {
|
|
@@ -32,13 +32,13 @@ const CommodityList = (_a) => {
|
|
|
32
32
|
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
|
33
33
|
eventSubject: 'clickCta',
|
|
34
34
|
eventDescription: 'User clicked the CTA'
|
|
35
|
-
}, recData, item, index);
|
|
35
|
+
}, recData, item, index, isExternalLink && !!(item === null || item === void 0 ? void 0 : item.link) ? 'open_external_link' : 'open_internal_popup', item.link, 'product');
|
|
36
36
|
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 }), index, multiCheckIndex }));
|
|
37
37
|
if (isExternalLink) {
|
|
38
|
-
if (item === null || item === void 0 ? void 0 : item.link)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
if (!(item === null || item === void 0 ? void 0 : item.link))
|
|
39
|
+
return;
|
|
40
|
+
jumpToWeb(e, recData, item, item.bindCta, index);
|
|
41
|
+
window.location.href = window.getJointUtmLink(item.link);
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
44
44
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
@@ -46,7 +46,11 @@ const CommodityList = (_a) => {
|
|
|
46
46
|
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
|
47
47
|
(0, react_1.useEffect)(() => {
|
|
48
48
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
|
49
|
-
eventName: 'PageView'
|
|
49
|
+
eventName: 'PageView',
|
|
50
|
+
product: (product !== null && product !== void 0 ? product : []),
|
|
51
|
+
contentType: 'product',
|
|
52
|
+
rec: recData,
|
|
53
|
+
position: index
|
|
50
54
|
});
|
|
51
55
|
}, []);
|
|
52
56
|
return (react_1.default.createElement("ul", { role: 'list', className: (0, css_1.css)(Object.assign(Object.assign({}, style), { display: 'flex', flexDirection: 'column', gap: '10px', padding: '0 20px', marginTop: '50px', boxSizing: 'border-box' })) }, product === null || product === void 0 ? void 0 : product.map((item, index) => {
|
|
@@ -15,22 +15,22 @@ const EventProvider = (_a) => {
|
|
|
15
15
|
const handleClick = (0, lodash_1.throttle)((e) => {
|
|
16
16
|
var _a, _b, _c, _d, _e, _f;
|
|
17
17
|
e.preventDefault();
|
|
18
|
-
const item = multItem
|
|
18
|
+
const item = multItem || ((_b = (_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProduct) !== null && _b !== void 0 ? _b : rec === null || rec === void 0 ? void 0 : rec.video);
|
|
19
|
+
const link = ((_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) || (multItem === null || multItem === void 0 ? void 0 : multItem.link);
|
|
19
20
|
ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
|
|
20
21
|
eventSubject: 'clickCta',
|
|
21
22
|
eventDescription: 'User clicked the CTA'
|
|
22
|
-
}, rec, item, index);
|
|
23
|
+
}, rec, item, index, isExternalLink && (jumpLink || !!link) ? 'open_external_link' : 'open_internal_popup', link);
|
|
23
24
|
setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(multItem && multiCheckIndex !== undefined && multiCheckIndex >= 0
|
|
24
25
|
? Object.assign(Object.assign({}, rec), { video: Object.assign(Object.assign({}, rec === null || rec === void 0 ? void 0 : rec.video), { bindProduct: multItem }), index, multiCheckIndex }) : Object.assign(Object.assign({}, rec), { index }));
|
|
25
26
|
setElement(ref === null || ref === void 0 ? void 0 : ref.current);
|
|
26
27
|
if (isExternalLink) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
28
|
+
if (!jumpLink && !link)
|
|
29
|
+
return;
|
|
30
|
+
const cta = ((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.bindCta) || (multItem === null || multItem === void 0 ? void 0 : multItem.bindCta);
|
|
31
|
+
const product = ((_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.bindProduct) || multItem;
|
|
32
|
+
jumpToWeb(e, rec, product, cta, index);
|
|
33
|
+
window.location.href = window.getJointUtmLink(link);
|
|
34
34
|
}
|
|
35
35
|
else {
|
|
36
36
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|