pb-sxp-ui 1.15.13-alpha.2 → 1.15.13-alpha.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.
Files changed (31) hide show
  1. package/dist/index.cjs +146 -111
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +144 -109
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.cjs +6 -6
  6. package/dist/index.min.cjs.map +1 -1
  7. package/dist/index.min.js +6 -6
  8. package/dist/index.min.js.map +1 -1
  9. package/dist/pb-ui.js +146 -111
  10. package/dist/pb-ui.js.map +1 -1
  11. package/dist/pb-ui.min.js +6 -6
  12. package/dist/pb-ui.min.js.map +1 -1
  13. package/es/core/components/DiyStoryPreview/VideoWidget.d.ts +2 -0
  14. package/es/core/components/DiyStoryPreview/VideoWidget.js +6 -4
  15. package/es/core/components/DiyStoryPreview/index.d.ts +3 -0
  16. package/es/core/components/DiyStoryPreview/index.js +36 -24
  17. package/es/core/components/SxpPageCore/index.d.ts +1 -0
  18. package/es/core/components/SxpPageCore/index.js +7 -7
  19. package/es/core/context/EditorContext.js +1 -1
  20. package/es/core/context/SxpDataSourceProvider.d.ts +1 -1
  21. package/es/core/context/SxpDataSourceProvider.js +23 -24
  22. package/lib/core/components/DiyStoryPreview/VideoWidget.d.ts +2 -0
  23. package/lib/core/components/DiyStoryPreview/VideoWidget.js +6 -4
  24. package/lib/core/components/DiyStoryPreview/index.d.ts +3 -0
  25. package/lib/core/components/DiyStoryPreview/index.js +34 -22
  26. package/lib/core/components/SxpPageCore/index.d.ts +1 -0
  27. package/lib/core/components/SxpPageCore/index.js +7 -7
  28. package/lib/core/context/EditorContext.js +1 -1
  29. package/lib/core/context/SxpDataSourceProvider.d.ts +1 -1
  30. package/lib/core/context/SxpDataSourceProvider.js +23 -24
  31. package/package.json +1 -1
@@ -131,7 +131,7 @@ export interface SxpDataSourceProviderProps {
131
131
  isEditor?: boolean;
132
132
  utmParameter?: PageData['utm_parameter'];
133
133
  channelQueryList?: any[];
134
- data?: PageData;
134
+ data?: any;
135
135
  dataList?: PageData[];
136
136
  onUpdateSchema?: (d: PageData['data']) => void;
137
137
  onUpdateChannel?: (d: string) => void;
@@ -147,17 +147,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
147
147
  .catch((err) => Promise.reject(err));
148
148
  }, [bffDataSource]);
149
149
  const getRecommendVideos = (0, react_1.useCallback)((query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
150
- var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
151
- query = Object.assign({ maxSize: (_f = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _f !== void 0 ? _f : maxSize, defaultSize: (_g = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _g !== void 0 ? _g : defaultSize, hashTag: query === null || query === void 0 ? void 0 : query.hashTag, traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo, themeTag: query === null || query === void 0 ? void 0 : query.themeTag, pageNum: query === null || query === void 0 ? void 0 : query.pageNum, contentFilter: query === null || query === void 0 ? void 0 : query.contentFilter, productFilter: query === null || query === void 0 ? void 0 : query.productFilter }, (chatlabsId && { chatlabsId }));
150
+ var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
151
+ query = Object.assign({ maxSize: 50, defaultSize: 50, hashTag: query === null || query === void 0 ? void 0 : query.hashTag, traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo, themeTag: query === null || query === void 0 ? void 0 : query.themeTag, pageNum: query === null || query === void 0 ? void 0 : query.pageNum, contentFilter: query === null || query === void 0 ? void 0 : query.contentFilter, productFilter: query === null || query === void 0 ? void 0 : query.productFilter }, (chatlabsId && { chatlabsId }));
152
152
  if (channel) {
153
153
  query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(channel) });
154
154
  }
155
155
  else if (utmVal) {
156
- const val = (_k = (_j = (_h = (0, tool_1.splitUrlParams)(utmVal)) === null || _h === void 0 ? void 0 : _h.filter((val) => {
157
- var _a, _b;
156
+ const val = (_h = (_g = (_f = (0, tool_1.splitUrlParams)(utmVal)) === null || _f === void 0 ? void 0 : _f.filter((val) => {
158
157
  const key = val.split('=')[0];
159
- return (_b = ((_a = utmParameter === null || utmParameter === void 0 ? void 0 : utmParameter.channels) !== null && _a !== void 0 ? _a : [])) === null || _b === void 0 ? void 0 : _b.includes(key);
160
- })) === null || _j === void 0 ? void 0 : _j.join('&')) !== null && _k !== void 0 ? _k : '';
158
+ return key;
159
+ })) === null || _g === void 0 ? void 0 : _g.join('&')) !== null && _h !== void 0 ? _h : '';
161
160
  if (val)
162
161
  query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
163
162
  }
@@ -171,19 +170,19 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
171
170
  let list = [];
172
171
  let result = null;
173
172
  const recurveRecList = (query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
174
- var _v, _w, _x, _y, _z, _0;
173
+ var _t, _u, _v, _w, _x, _y;
175
174
  query.pageNum = pageNum;
176
175
  result = yield (bffFetchAdmin === null || bffFetchAdmin === void 0 ? void 0 : bffFetchAdmin('recommend/direct_page', { method: 'POST', body: query }));
177
176
  if (!(result === null || result === void 0 ? void 0 : result.success)) {
178
177
  return undefined;
179
178
  }
180
179
  setLoading(false);
181
- list = list.concat((_y = (_x = (_w = (_v = result === null || result === void 0 ? void 0 : result.data) === null || _v === void 0 ? void 0 : _v.recList) === null || _w === void 0 ? void 0 : _w.filter) === null || _x === void 0 ? void 0 : _x.call(_w, (item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video))) !== null && _y !== void 0 ? _y : []);
180
+ list = list.concat((_w = (_v = (_u = (_t = result === null || result === void 0 ? void 0 : result.data) === null || _t === void 0 ? void 0 : _t.recList) === null || _u === void 0 ? void 0 : _u.filter) === null || _v === void 0 ? void 0 : _v.call(_u, (item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video))) !== null && _w !== void 0 ? _w : []);
182
181
  if ((rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) === 0) {
183
182
  setRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
184
183
  setCacheRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
185
184
  }
186
- const isNotNullList = (_0 = (_z = result === null || result === void 0 ? void 0 : result.data) === null || _z === void 0 ? void 0 : _z.recList) === null || _0 === void 0 ? void 0 : _0.some((item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video));
185
+ const isNotNullList = (_y = (_x = result === null || result === void 0 ? void 0 : result.data) === null || _x === void 0 ? void 0 : _x.recList) === null || _y === void 0 ? void 0 : _y.some((item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video));
187
186
  if (isNotNullList) {
188
187
  pageNum = pageNum + 1;
189
188
  yield recurveRecList(query);
@@ -191,13 +190,13 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
191
190
  });
192
191
  yield recurveRecList(query);
193
192
  if (!(query === null || query === void 0 ? void 0 : query.hashTag) && result)
194
- setCurReqInfo({ rtc: (_l = result === null || result === void 0 ? void 0 : result.data) === null || _l === void 0 ? void 0 : _l.rtc, requestId: (_m = result === null || result === void 0 ? void 0 : result.data) === null || _m === void 0 ? void 0 : _m.requestId });
193
+ setCurReqInfo({ rtc: (_j = result === null || result === void 0 ? void 0 : result.data) === null || _j === void 0 ? void 0 : _j.rtc, requestId: (_k = result === null || result === void 0 ? void 0 : result.data) === null || _k === void 0 ? void 0 : _k.requestId });
195
194
  return Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list });
196
195
  }
197
196
  if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
198
- query = Object.assign(Object.assign({}, query), { directPage: true, level: 1, pageNum: (_o = query === null || query === void 0 ? void 0 : query.pageNum) !== null && _o !== void 0 ? _o : 1 });
197
+ query = Object.assign(Object.assign({}, query), { directPage: true, level: 1, pageNum: (_l = query === null || query === void 0 ? void 0 : query.pageNum) !== null && _l !== void 0 ? _l : 1 });
199
198
  }
200
- const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/list', { method: 'POST', body: query }));
199
+ const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v3/recommend/direct', { method: 'POST', body: query }));
201
200
  if (!(result === null || result === void 0 ? void 0 : result.success)) {
202
201
  return undefined;
203
202
  }
@@ -205,8 +204,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
205
204
  setCurReqInfo({ rtc: result.data.rtc, requestId: result.data.requestId });
206
205
  if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor) {
207
206
  let list = [];
208
- list = list.concat((_s = (_r = (_q = (_p = result === null || result === void 0 ? void 0 : result.data) === null || _p === void 0 ? void 0 : _p.recList) === null || _q === void 0 ? void 0 : _q.filter) === null || _r === void 0 ? void 0 : _r.call(_q, (item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video))) !== null && _s !== void 0 ? _s : []);
209
- const isNotNullList = (_u = (_t = result === null || result === void 0 ? void 0 : result.data) === null || _t === void 0 ? void 0 : _t.recList) === null || _u === void 0 ? void 0 : _u.some((item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video));
207
+ list = list.concat((_q = (_p = (_o = (_m = result === null || result === void 0 ? void 0 : result.data) === null || _m === void 0 ? void 0 : _m.recList) === null || _o === void 0 ? void 0 : _o.filter) === null || _p === void 0 ? void 0 : _p.call(_o, (item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video))) !== null && _q !== void 0 ? _q : []);
208
+ const isNotNullList = (_s = (_r = result === null || result === void 0 ? void 0 : result.data) === null || _r === void 0 ? void 0 : _r.recList) === null || _s === void 0 ? void 0 : _s.some((item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video));
210
209
  if (!isNotNullList) {
211
210
  setIsNoMoreData(true);
212
211
  }
@@ -215,12 +214,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
215
214
  return result === null || result === void 0 ? void 0 : result.data;
216
215
  }), [bffFetch, utmVal, maxSize, defaultSize, channelQueryList, channel, chatlabsId, bffFetchAdmin]);
217
216
  const loadVideos = (0, react_1.useCallback)((pageNum) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
218
- var _1, _2, _3, _4;
217
+ var _z, _0, _1, _2;
219
218
  if (rtcList.length <= 0) {
220
219
  return;
221
220
  }
222
221
  const lastItem = rtcList === null || rtcList === void 0 ? void 0 : rtcList[(rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) - 1];
223
- const data = yield getRecommendVideos(Object.assign(Object.assign(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((_1 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _1 === void 0 ? void 0 : _1.itemId) && { productFilter: [(_2 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _2 === void 0 ? void 0 : _2.itemId] })), (((_3 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _3 === void 0 ? void 0 : _3.itemId) && { contentFilter: [(_4 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _4 === void 0 ? void 0 : _4.itemId] })), { themeTag: themeTag.current }), ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor && { pageNum })));
222
+ const data = yield getRecommendVideos(Object.assign(Object.assign(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((_z = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _z === void 0 ? void 0 : _z.itemId) && { productFilter: [(_0 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _0 === void 0 ? void 0 : _0.itemId] })), (((_1 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _1 === void 0 ? void 0 : _1.itemId) && { contentFilter: [(_2 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _2 === void 0 ? void 0 : _2.itemId] })), { themeTag: themeTag.current }), ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor && { pageNum })));
224
223
  setRtcList(rtcList.concat(getFilterRecList(data)));
225
224
  setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
226
225
  return data;
@@ -379,18 +378,18 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
379
378
  return res === null || res === void 0 ? void 0 : res.success;
380
379
  }), [bffFetch]);
381
380
  const bffGetTagList = (0, react_1.useCallback)((data) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
382
- var _5, _6, _7, _8, _9, _10, _11, _12;
383
- const isShowTag = !!((_7 = (_6 = (_5 = data === null || data === void 0 ? void 0 : data.data) === null || _5 === void 0 ? void 0 : _5.sxpPageConf) === null || _6 === void 0 ? void 0 : _6.globalConfig) === null || _7 === void 0 ? void 0 : _7.isShowTag);
381
+ var _3, _4, _5, _6, _7, _8, _9, _10;
382
+ const isShowTag = !!((_5 = (_4 = (_3 = data === null || data === void 0 ? void 0 : data.data) === null || _3 === void 0 ? void 0 : _3.sxpPageConf) === null || _4 === void 0 ? void 0 : _4.globalConfig) === null || _5 === void 0 ? void 0 : _5.isShowTag);
384
383
  if (!utmVal || !isShowTag)
385
384
  return;
386
385
  try {
387
- const val = (_10 = (_9 = (_8 = (0, tool_1.splitUrlParams)(utmVal)) === null || _8 === void 0 ? void 0 : _8.filter((val) => {
386
+ const val = (_8 = (_7 = (_6 = (0, tool_1.splitUrlParams)(utmVal)) === null || _6 === void 0 ? void 0 : _6.filter((val) => {
388
387
  var _a, _b;
389
388
  const key = val.split('=')[0];
390
389
  return (_b = ((_a = utmParameter === null || utmParameter === void 0 ? void 0 : utmParameter.channels) !== null && _a !== void 0 ? _a : [])) === null || _b === void 0 ? void 0 : _b.includes(key);
391
- })) === null || _9 === void 0 ? void 0 : _9.join('&')) !== null && _10 !== void 0 ? _10 : '';
390
+ })) === null || _7 === void 0 ? void 0 : _7.join('&')) !== null && _8 !== void 0 ? _8 : '';
392
391
  const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
393
- setTagList((_12 = (_11 = result === null || result === void 0 ? void 0 : result.data) === null || _11 === void 0 ? void 0 : _11.tags) !== null && _12 !== void 0 ? _12 : []);
392
+ setTagList((_10 = (_9 = result === null || result === void 0 ? void 0 : result.data) === null || _9 === void 0 ? void 0 : _9.tags) !== null && _10 !== void 0 ? _10 : []);
394
393
  }
395
394
  catch (e) {
396
395
  console.log('e', e);
@@ -450,10 +449,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
450
449
  });
451
450
  }, [bffEventReport]);
452
451
  const getAccount = (0, react_1.useCallback)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
453
- var _13, _14;
452
+ var _11, _12;
454
453
  const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/account', { method: 'GET' }));
455
- setChatlabsId((_13 = res === null || res === void 0 ? void 0 : res.data) === null || _13 === void 0 ? void 0 : _13.chatLabsId);
456
- return ((_14 = res === null || res === void 0 ? void 0 : res.data) === null || _14 === void 0 ? void 0 : _14.consentResult) === 'true';
454
+ setChatlabsId((_11 = res === null || res === void 0 ? void 0 : res.data) === null || _11 === void 0 ? void 0 : _11.chatLabsId);
455
+ return ((_12 = res === null || res === void 0 ? void 0 : res.data) === null || _12 === void 0 ? void 0 : _12.consentResult) === 'true';
457
456
  }), [bffFetch]);
458
457
  const accountSonsent = (0, react_1.useCallback)((consentResult) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
459
458
  const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/account/consent', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.15.13-alpha.2",
3
+ "version": "1.15.13-alpha.4",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",