pb-sxp-ui 1.12.0 → 1.12.2

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.
@@ -21,7 +21,7 @@ const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, l
21
21
  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, utmParameter: data === null || data === void 0 ? void 0 : data.utm_parameter, data: data, dataList: dataList, onUpdateSchema: (d) => setSchema(d), onUpdateChannel: (d) => setChannel(d), render: ({ rtcList, tagList, pageData }) => {
22
22
  var _a;
23
23
  return (React.createElement(React.Fragment, null,
24
- React.createElement(SxpPageRender, Object.assign({}, (_a = pageData === null || pageData === void 0 ? void 0 : pageData.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER })),
24
+ React.createElement(SxpPageRender, Object.assign({ defaultData: data }, (_a = pageData === null || pageData === void 0 ? void 0 : pageData.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER })),
25
25
  React.createElement(Popup, null)));
26
26
  } })));
27
27
  };
@@ -110,6 +110,7 @@ export interface ISxpPageRenderProps {
110
110
  hashTagStyle?: CSSProperties;
111
111
  licenseUrl?: string;
112
112
  hashTagRightMargin: number;
113
+ defaultData?: any;
113
114
  }
114
115
  declare const SxpPageRender: FC<ISxpPageRenderProps>;
115
116
  export default SxpPageRender;
@@ -15,6 +15,7 @@ import WaterFall from './WaterFall';
15
15
  import Nudge from './Nudge';
16
16
  import SXP_EVENT_BUS, { SXP_EVENT_TYPE } from '../../../core/utils/event';
17
17
  import { useEditor, useSxpDataSource } from '../../../core/hooks';
18
+ import { refreshFeSessionId } from '../../../core/utils/sessionStore';
18
19
  import './index.less';
19
20
  import { useEventReport } from '../../../core/hooks/useEventReport';
20
21
  import withBindDataSource from '../../../core/hoc/withBindDataSource';
@@ -25,7 +26,7 @@ import ConsentPopup from './ConsentPopup';
25
26
  import MultiPosts from '../../../materials/sxp/MultiPosts';
26
27
  import { useEditorDataProvider } from '../../../core/context/EditorDataProvider';
27
28
  import NavBack from './NavBack';
28
- const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], licenseUrl }) => {
29
+ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], defaultData }) => {
29
30
  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;
30
31
  const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
31
32
  const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
@@ -55,12 +56,17 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
55
56
  }
56
57
  }, [data === null || data === void 0 ? void 0 : data.length]);
57
58
  const handleH5EnterLink = useCallback(() => {
59
+ var _a, _b, _c;
60
+ const defaultGlobalConfig = (_b = (_a = defaultData === null || defaultData === void 0 ? void 0 : defaultData.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf) === null || _b === void 0 ? void 0 : _b.globalConfig;
61
+ if (!((_c = defaultGlobalConfig === null || defaultGlobalConfig === void 0 ? void 0 : defaultGlobalConfig.session) === null || _c === void 0 ? void 0 : _c.enable)) {
62
+ refreshFeSessionId();
63
+ }
58
64
  h5EnterLink === null || h5EnterLink === void 0 ? void 0 : h5EnterLink();
59
65
  if (data.length > 0) {
60
66
  const now = new Date();
61
67
  viewTime.current = now;
62
68
  }
63
- }, [data.length, h5EnterLink]);
69
+ }, [data.length, h5EnterLink, defaultData]);
64
70
  useEffect(() => {
65
71
  var _a;
66
72
  if (!ctaType || (ctaType === null || ctaType === void 0 ? void 0 : ctaType.length) < 1)
@@ -128,7 +134,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
128
134
  handleReportProductView(item);
129
135
  }
130
136
  if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.playbook) !== 'organic menu' || activeIndex !== 0 || channel) {
131
- const isExpire = refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(true, handleSessionCompleted);
137
+ const isExpire = refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(false, handleSessionCompleted);
132
138
  if (!isExpire)
133
139
  handleSessionCompleted();
134
140
  }
@@ -376,7 +376,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
376
376
  });
377
377
  }, [bffEventReport, isFromHashtag]);
378
378
  const h5EnterLink = useCallback(() => {
379
- var _a, _b, _c, _d, _e;
379
+ var _a, _b;
380
380
  const queryString = location.search.slice(1);
381
381
  const params = qs.parse(queryString.replace(/\+/g, '%2B'));
382
382
  for (const key in params) {
@@ -384,10 +384,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
384
384
  }
385
385
  const getVal = (key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ''; };
386
386
  const time = new Date();
387
- const defaultGlobalConfig = (_b = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf) === null || _b === void 0 ? void 0 : _b.globalConfig;
388
- if (!((_c = defaultGlobalConfig === null || defaultGlobalConfig === void 0 ? void 0 : defaultGlobalConfig.session) === null || _c === void 0 ? void 0 : _c.enable) || !(curTime === null || curTime === void 0 ? void 0 : curTime.current)) {
389
- curTime.current = time;
390
- }
387
+ curTime.current = time;
391
388
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
392
389
  eventInfo: {
393
390
  eventSubject: 'h5LinkEnterFeed',
@@ -399,12 +396,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
399
396
  utmContent: getVal('utm_content'),
400
397
  enterTime: Math.floor(time / 1000) + '',
401
398
  requestId: null,
402
- enterUrl: (_e = (_d = window === null || window === void 0 ? void 0 : window.location) === null || _d === void 0 ? void 0 : _d.href) !== null && _e !== void 0 ? _e : '',
399
+ 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 : '',
403
400
  clSource: getVal('cl_source')
404
401
  },
405
402
  reportLayId: false
406
403
  });
407
- }, [bffEventReport, data, curTime]);
404
+ }, [bffEventReport]);
408
405
  useEffect(() => {
409
406
  if (!isShowConsent)
410
407
  h5EnterLink();
@@ -24,7 +24,7 @@ const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, l
24
24
  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, utmParameter: data === null || data === void 0 ? void 0 : data.utm_parameter, data: data, dataList: dataList, onUpdateSchema: (d) => setSchema(d), onUpdateChannel: (d) => setChannel(d), render: ({ rtcList, tagList, pageData }) => {
25
25
  var _a;
26
26
  return (react_1.default.createElement(react_1.default.Fragment, null,
27
- react_1.default.createElement(SxpPageRender_1.default, Object.assign({}, (_a = pageData === null || pageData === void 0 ? void 0 : pageData.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER })),
27
+ react_1.default.createElement(SxpPageRender_1.default, Object.assign({ defaultData: data }, (_a = pageData === null || pageData === void 0 ? void 0 : pageData.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER })),
28
28
  react_1.default.createElement(Popup_1.default, null)));
29
29
  } })));
30
30
  };
@@ -110,6 +110,7 @@ export interface ISxpPageRenderProps {
110
110
  hashTagStyle?: CSSProperties;
111
111
  licenseUrl?: string;
112
112
  hashTagRightMargin: number;
113
+ defaultData?: any;
113
114
  }
114
115
  declare const SxpPageRender: FC<ISxpPageRenderProps>;
115
116
  export default SxpPageRender;
@@ -18,6 +18,7 @@ const WaterFall_1 = tslib_1.__importDefault(require("./WaterFall"));
18
18
  const Nudge_1 = tslib_1.__importDefault(require("./Nudge"));
19
19
  const event_1 = tslib_1.__importStar(require("../../../core/utils/event"));
20
20
  const hooks_1 = require("../../../core/hooks");
21
+ const sessionStore_1 = require("../../../core/utils/sessionStore");
21
22
  require("./index.less");
22
23
  const useEventReport_1 = require("../../../core/hooks/useEventReport");
23
24
  const withBindDataSource_1 = tslib_1.__importDefault(require("../../../core/hoc/withBindDataSource"));
@@ -28,7 +29,7 @@ const ConsentPopup_1 = tslib_1.__importDefault(require("./ConsentPopup"));
28
29
  const MultiPosts_1 = tslib_1.__importDefault(require("../../../materials/sxp/MultiPosts"));
29
30
  const EditorDataProvider_1 = require("../../../core/context/EditorDataProvider");
30
31
  const NavBack_1 = tslib_1.__importDefault(require("./NavBack"));
31
- const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], licenseUrl }) => {
32
+ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], defaultData }) => {
32
33
  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;
33
34
  const mutedIcon = (0, useIconLink_1.useIconLink)('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
34
35
  const unmutedIcon = (0, useIconLink_1.useIconLink)('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
@@ -58,12 +59,17 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
58
59
  }
59
60
  }, [data === null || data === void 0 ? void 0 : data.length]);
60
61
  const handleH5EnterLink = (0, react_1.useCallback)(() => {
62
+ var _a, _b, _c;
63
+ const defaultGlobalConfig = (_b = (_a = defaultData === null || defaultData === void 0 ? void 0 : defaultData.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf) === null || _b === void 0 ? void 0 : _b.globalConfig;
64
+ if (!((_c = defaultGlobalConfig === null || defaultGlobalConfig === void 0 ? void 0 : defaultGlobalConfig.session) === null || _c === void 0 ? void 0 : _c.enable)) {
65
+ (0, sessionStore_1.refreshFeSessionId)();
66
+ }
61
67
  h5EnterLink === null || h5EnterLink === void 0 ? void 0 : h5EnterLink();
62
68
  if (data.length > 0) {
63
69
  const now = new Date();
64
70
  viewTime.current = now;
65
71
  }
66
- }, [data.length, h5EnterLink]);
72
+ }, [data.length, h5EnterLink, defaultData]);
67
73
  (0, react_1.useEffect)(() => {
68
74
  var _a;
69
75
  if (!ctaType || (ctaType === null || ctaType === void 0 ? void 0 : ctaType.length) < 1)
@@ -131,7 +137,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
131
137
  handleReportProductView(item);
132
138
  }
133
139
  if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.playbook) !== 'organic menu' || activeIndex !== 0 || channel) {
134
- const isExpire = refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(true, handleSessionCompleted);
140
+ const isExpire = refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(false, handleSessionCompleted);
135
141
  if (!isExpire)
136
142
  handleSessionCompleted();
137
143
  }
@@ -379,7 +379,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
379
379
  });
380
380
  }, [bffEventReport, isFromHashtag]);
381
381
  const h5EnterLink = (0, react_1.useCallback)(() => {
382
- var _a, _b, _c, _d, _e;
382
+ var _a, _b;
383
383
  const queryString = location.search.slice(1);
384
384
  const params = qs_1.default.parse(queryString.replace(/\+/g, '%2B'));
385
385
  for (const key in params) {
@@ -387,10 +387,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
387
387
  }
388
388
  const getVal = (key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ''; };
389
389
  const time = new Date();
390
- const defaultGlobalConfig = (_b = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf) === null || _b === void 0 ? void 0 : _b.globalConfig;
391
- if (!((_c = defaultGlobalConfig === null || defaultGlobalConfig === void 0 ? void 0 : defaultGlobalConfig.session) === null || _c === void 0 ? void 0 : _c.enable) || !(curTime === null || curTime === void 0 ? void 0 : curTime.current)) {
392
- curTime.current = time;
393
- }
390
+ curTime.current = time;
394
391
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
395
392
  eventInfo: {
396
393
  eventSubject: 'h5LinkEnterFeed',
@@ -402,12 +399,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
402
399
  utmContent: getVal('utm_content'),
403
400
  enterTime: Math.floor(time / 1000) + '',
404
401
  requestId: null,
405
- enterUrl: (_e = (_d = window === null || window === void 0 ? void 0 : window.location) === null || _d === void 0 ? void 0 : _d.href) !== null && _e !== void 0 ? _e : '',
402
+ 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 : '',
406
403
  clSource: getVal('cl_source')
407
404
  },
408
405
  reportLayId: false
409
406
  });
410
- }, [bffEventReport, data, curTime]);
407
+ }, [bffEventReport]);
411
408
  (0, react_1.useEffect)(() => {
412
409
  if (!isShowConsent)
413
410
  h5EnterLink();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.12.0",
3
+ "version": "1.12.2",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",