pb-sxp-ui 1.9.8 → 1.10.1

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 (66) hide show
  1. package/dist/index.cjs +521 -163
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +35 -0
  4. package/dist/index.js +521 -163
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.cjs +7 -3
  7. package/dist/index.min.cjs.map +1 -1
  8. package/dist/index.min.js +7 -3
  9. package/dist/index.min.js.map +1 -1
  10. package/dist/pb-ui.js +521 -163
  11. package/dist/pb-ui.js.map +1 -1
  12. package/dist/pb-ui.min.js +7 -3
  13. package/dist/pb-ui.min.js.map +1 -1
  14. package/es/core/Pagebuilder/index.js +3 -4
  15. package/es/core/components/SxpPageCore/index.d.ts +1 -1
  16. package/es/core/components/SxpPageCore/index.js +7 -6
  17. package/es/core/components/SxpPageRender/NavBack.d.ts +9 -0
  18. package/es/core/components/SxpPageRender/NavBack.js +16 -0
  19. package/es/core/components/SxpPageRender/PictureGroup/index.js +3 -1
  20. package/es/core/components/SxpPageRender/index.d.ts +2 -0
  21. package/es/core/components/SxpPageRender/index.js +30 -22
  22. package/es/core/components/SxpPageRender/typing.d.ts +1 -0
  23. package/es/core/context/EditorContext.d.ts +2 -0
  24. package/es/core/context/EditorContext.js +9 -3
  25. package/es/core/context/EditorDataProvider.d.ts +2 -0
  26. package/es/core/context/EditorDataProvider.js +4 -1
  27. package/es/core/context/SxpDataSourceProvider.d.ts +4 -2
  28. package/es/core/context/SxpDataSourceProvider.js +84 -53
  29. package/es/core/utils/materials.d.ts +1 -1
  30. package/es/materials/sxp/MultiPosts/index.d.ts +26 -0
  31. package/es/materials/sxp/MultiPosts/index.js +98 -0
  32. package/es/materials/sxp/MultiPosts/interactionRender.d.ts +9 -0
  33. package/es/materials/sxp/MultiPosts/interactionRender.js +42 -0
  34. package/es/materials/sxp/MultiPosts/material.d.ts +2 -0
  35. package/es/materials/sxp/MultiPosts/material.js +22 -0
  36. package/es/materials/sxp/MultiPosts/settingRender.d.ts +73 -0
  37. package/es/materials/sxp/MultiPosts/settingRender.js +115 -0
  38. package/es/materials/sxp/index.d.ts +1 -0
  39. package/es/materials/sxp/index.js +1 -0
  40. package/lib/core/Pagebuilder/index.js +3 -4
  41. package/lib/core/components/SxpPageCore/index.d.ts +1 -1
  42. package/lib/core/components/SxpPageCore/index.js +6 -5
  43. package/lib/core/components/SxpPageRender/NavBack.d.ts +9 -0
  44. package/lib/core/components/SxpPageRender/NavBack.js +19 -0
  45. package/lib/core/components/SxpPageRender/PictureGroup/index.js +3 -1
  46. package/lib/core/components/SxpPageRender/index.d.ts +2 -0
  47. package/lib/core/components/SxpPageRender/index.js +30 -22
  48. package/lib/core/components/SxpPageRender/typing.d.ts +1 -0
  49. package/lib/core/context/EditorContext.d.ts +2 -0
  50. package/lib/core/context/EditorContext.js +9 -3
  51. package/lib/core/context/EditorDataProvider.d.ts +2 -0
  52. package/lib/core/context/EditorDataProvider.js +4 -1
  53. package/lib/core/context/SxpDataSourceProvider.d.ts +4 -2
  54. package/lib/core/context/SxpDataSourceProvider.js +84 -53
  55. package/lib/core/utils/materials.d.ts +1 -1
  56. package/lib/materials/sxp/MultiPosts/index.d.ts +26 -0
  57. package/lib/materials/sxp/MultiPosts/index.js +100 -0
  58. package/lib/materials/sxp/MultiPosts/interactionRender.d.ts +9 -0
  59. package/lib/materials/sxp/MultiPosts/interactionRender.js +44 -0
  60. package/lib/materials/sxp/MultiPosts/material.d.ts +2 -0
  61. package/lib/materials/sxp/MultiPosts/material.js +26 -0
  62. package/lib/materials/sxp/MultiPosts/settingRender.d.ts +73 -0
  63. package/lib/materials/sxp/MultiPosts/settingRender.js +117 -0
  64. package/lib/materials/sxp/index.d.ts +1 -0
  65. package/lib/materials/sxp/index.js +1 -0
  66. package/package.json +1 -1
@@ -11,6 +11,7 @@ const event_1 = tslib_1.__importStar(require("../utils/event"));
11
11
  const Consent_1 = tslib_1.__importDefault(require("../components/Consent"));
12
12
  const tool_1 = require("../utils/tool");
13
13
  const lodash_1 = require("lodash");
14
+ const useEditor_1 = require("../hooks/useEditor");
14
15
  exports.SxpDataSourceContext = (0, react_1.createContext)({
15
16
  rtcList: [],
16
17
  tagList: []
@@ -20,8 +21,9 @@ var DataSourceType;
20
21
  DataSourceType[DataSourceType["BFF"] = 5] = "BFF";
21
22
  })(DataSourceType || (DataSourceType = {}));
22
23
  exports.DEFAULT_TAG = 'FOR U';
23
- const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isShowTag = true, isOpenConsent = false, globalConfig, isEditor = false, utmParameter, channelQueryList }) => {
24
- var _a, _b, _c;
24
+ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isOpenConsent = false, isEditor = false, utmParameter, channelQueryList, data, dataList, onUpdateSchema }) => {
25
+ var _a, _b, _c, _d, _e;
26
+ const { channel } = (0, useEditor_1.useEditor)();
25
27
  const [rtcList, setRtcList] = (0, react_1.useState)([]);
26
28
  const [tagList, setTagList] = (0, react_1.useState)([]);
27
29
  const [loading, setLoading] = (0, react_1.useState)(false);
@@ -42,10 +44,15 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
42
44
  const checkCommodityIndexRef = (0, react_1.useRef)(-1);
43
45
  const popupCurTimeRef = (0, react_1.useRef)(null);
44
46
  const [isNoMoreData, setIsNoMoreData] = (0, react_1.useState)(false);
47
+ const [globalConfig, setGlobalConfig] = (0, react_1.useState)((_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);
48
+ const [pageData, setPageData] = (0, react_1.useState)(data);
49
+ const [showConsent, setShowConsent] = (0, react_1.useState)(false);
50
+ const [layoutVariantId, setLayoutVariantId] = (0, react_1.useState)();
45
51
  const isShowConsent = (0, react_1.useMemo)(() => {
46
52
  var _a, _b, _c, _d;
47
- return (((_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.privacy_necessity) && !isAgreePolicy && !isEditor) || isOpenConsent;
48
- }, [isAgreePolicy, globalConfig, isOpenConsent, isEditor]);
53
+ return (((((_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.privacy_necessity) && !isAgreePolicy && !isEditor) || isOpenConsent) &&
54
+ showConsent);
55
+ }, [isAgreePolicy, globalConfig, isOpenConsent, isEditor, showConsent]);
49
56
  const getFilterRecList = (0, react_1.useCallback)((data) => {
50
57
  var _a;
51
58
  const recList = data === null || data === void 0 ? void 0 : data.recList;
@@ -102,10 +109,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
102
109
  .catch((err) => Promise.reject(err));
103
110
  }, [bffDataSource]);
104
111
  const getRecommendVideos = (0, react_1.useCallback)((query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
105
- var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
112
+ var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
106
113
  query = {
107
- maxSize: (_d = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _d !== void 0 ? _d : maxSize,
108
- defaultSize: (_e = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _e !== void 0 ? _e : defaultSize,
114
+ maxSize: (_f = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _f !== void 0 ? _f : maxSize,
115
+ defaultSize: (_g = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _g !== void 0 ? _g : defaultSize,
109
116
  hashTag: query === null || query === void 0 ? void 0 : query.hashTag,
110
117
  traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo,
111
118
  themeTag: query === null || query === void 0 ? void 0 : query.themeTag,
@@ -113,13 +120,17 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
113
120
  contentFilter: query === null || query === void 0 ? void 0 : query.contentFilter,
114
121
  productFilter: query === null || query === void 0 ? void 0 : query.productFilter
115
122
  };
116
- if (utmVal) {
117
- const val = (_h = (_g = (_f = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _f === void 0 ? void 0 : _f.filter((val) => {
123
+ if (channel) {
124
+ query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(channel) });
125
+ }
126
+ else if (utmVal) {
127
+ const val = (_k = (_j = (_h = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _h === void 0 ? void 0 : _h.filter((val) => {
118
128
  var _a, _b;
119
129
  const key = val.split('=')[0];
120
130
  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);
121
- })) === null || _g === void 0 ? void 0 : _g.join('&')) !== null && _h !== void 0 ? _h : '';
122
- query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
131
+ })) === null || _j === void 0 ? void 0 : _j.join('&')) !== null && _k !== void 0 ? _k : '';
132
+ if (val)
133
+ query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
123
134
  }
124
135
  if (isEditor) {
125
136
  let pageNum = 1;
@@ -131,17 +142,17 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
131
142
  let list = [];
132
143
  let result = null;
133
144
  const recurveRecList = (query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
134
- var _t, _u, _v, _w, _x, _y;
145
+ var _v, _w, _x, _y, _z, _0;
135
146
  query.pageNum = pageNum;
136
147
  result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'POST', body: query }));
137
148
  if (!(result === null || result === void 0 ? void 0 : result.success)) {
138
149
  return undefined;
139
150
  }
140
151
  setLoading(false);
141
- 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 : []);
152
+ 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 : []);
142
153
  setRtcList(getFilterRecList(Object.assign(Object.assign({}, result.data), { recList: list })));
143
154
  setCacheRtcList(getFilterRecList(Object.assign(Object.assign({}, result.data), { recList: list })));
144
- 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));
155
+ 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));
145
156
  if (isNotNullList) {
146
157
  pageNum = pageNum + 1;
147
158
  yield recurveRecList(query);
@@ -149,11 +160,11 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
149
160
  });
150
161
  yield recurveRecList(query);
151
162
  if (!(query === null || query === void 0 ? void 0 : query.hashTag) && result)
152
- 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 });
163
+ 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 });
153
164
  return Object.assign(Object.assign({}, result.data), { recList: list });
154
165
  }
155
166
  if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
156
- 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 });
167
+ 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 });
157
168
  }
158
169
  const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'POST', body: query }));
159
170
  if (!(result === null || result === void 0 ? void 0 : result.success)) {
@@ -163,27 +174,27 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
163
174
  setCurReqInfo({ rtc: result.data.rtc, requestId: result.data.requestId });
164
175
  if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor) {
165
176
  let list = [];
166
- 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 : []);
167
- 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));
177
+ 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 : []);
178
+ 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));
168
179
  if (!isNotNullList) {
169
180
  setIsNoMoreData(true);
170
181
  }
171
182
  return Object.assign(Object.assign({}, result.data), { recList: list });
172
183
  }
173
184
  return result === null || result === void 0 ? void 0 : result.data;
174
- }), [bffFetch, utmVal, maxSize, defaultSize, channelQueryList]);
185
+ }), [bffFetch, utmVal, maxSize, defaultSize, channelQueryList, channel]);
175
186
  const loadVideos = (0, react_1.useCallback)((pageNum) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
176
- var _z, _0, _1, _2;
187
+ var _1, _2, _3, _4;
177
188
  if (rtcList.length <= 0) {
178
189
  return;
179
190
  }
180
191
  const lastItem = rtcList === null || rtcList === void 0 ? void 0 : rtcList[(rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) - 1];
181
- 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 })));
192
+ 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 })));
182
193
  setRtcList(rtcList.concat(getFilterRecList(data)));
183
194
  setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
184
195
  return data;
185
196
  }), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
186
- const bffEventReport = (0, react_1.useCallback)(({ userInfo, eventInfo }) => {
197
+ const bffEventReport = (0, react_1.useCallback)(({ userInfo, eventInfo, reportLayId = true }) => {
187
198
  if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
188
199
  return;
189
200
  }
@@ -191,7 +202,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
191
202
  userInfo = {};
192
203
  }
193
204
  const sessionID = (0, sessionStore_1.storeAndLoadFeSessionId)();
194
- const ef = Object.assign(Object.assign(Object.assign(Object.assign({ sessionID, rtc: curReqInfo.rtc, requestId: curReqInfo.requestId }, eventInfo), ((0, tool_1.getDevice)() && { sxpDevice: (0, tool_1.getDevice)() })), ((0, tool_1.getSystem)() && { sxpSystem: (0, tool_1.getSystem)() })), ((0, tool_1.getBrowserInfo)() && { sxpBrowser: (0, tool_1.getBrowserInfo)() }));
205
+ const ef = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ sessionID, rtc: curReqInfo.rtc, requestId: curReqInfo.requestId }, eventInfo), ((0, tool_1.getDevice)() && { sxpDevice: (0, tool_1.getDevice)() })), ((0, tool_1.getSystem)() && { sxpSystem: (0, tool_1.getSystem)() })), ((0, tool_1.getBrowserInfo)() && { sxpBrowser: (0, tool_1.getBrowserInfo)() })), { playbookType: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.playbook) === 'organic menu' ? 'organicMenu' : 'paidMedia' }), (layoutVariantId && reportLayId && { layoutVariantId }));
195
206
  const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
196
207
  const realEventInfo = Object.entries(ef)
197
208
  .map(([k, v]) => v && { name: k, value: v })
@@ -205,7 +216,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
205
216
  body: { userInfo: realUserInfo, eventInfo: realEventInfo },
206
217
  type: 'beacon'
207
218
  });
208
- }, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview]);
219
+ }, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview, layoutVariantId]);
209
220
  const bffFbReport = (0, react_1.useCallback)(({ eventName, product }) => {
210
221
  var _a, _b, _c, _d, _e;
211
222
  if (!enableReportEvent ||
@@ -289,23 +300,24 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
289
300
  const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/customform', { method: 'POST', body }));
290
301
  return res === null || res === void 0 ? void 0 : res.success;
291
302
  }), [bffFetch]);
292
- const bffGetTagList = (0, react_1.useCallback)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
293
- var _3, _4, _5, _6, _7;
303
+ const bffGetTagList = (0, react_1.useCallback)((data) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
304
+ var _5, _6, _7, _8, _9, _10, _11, _12;
305
+ 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);
294
306
  if (!utmVal || !isShowTag)
295
307
  return;
296
308
  try {
297
- const val = (_5 = (_4 = (_3 = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _3 === void 0 ? void 0 : _3.filter((val) => {
309
+ const val = (_10 = (_9 = (_8 = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _8 === void 0 ? void 0 : _8.filter((val) => {
298
310
  var _a, _b;
299
311
  const key = val.split('=')[0];
300
312
  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);
301
- })) === null || _4 === void 0 ? void 0 : _4.join('&')) !== null && _5 !== void 0 ? _5 : '';
313
+ })) === null || _9 === void 0 ? void 0 : _9.join('&')) !== null && _10 !== void 0 ? _10 : '';
302
314
  const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
303
- setTagList((_7 = (_6 = result === null || result === void 0 ? void 0 : result.data) === null || _6 === void 0 ? void 0 : _6.tags) !== null && _7 !== void 0 ? _7 : []);
315
+ 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 : []);
304
316
  }
305
317
  catch (e) {
306
318
  console.log('e', e);
307
319
  }
308
- }), [bffFetch, utmVal, isShowTag]);
320
+ }), [bffFetch, utmVal]);
309
321
  const ctaEvent = (0, react_1.useCallback)((eventInfo, rec, product, position) => {
310
322
  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;
311
323
  const cta = product === null || product === void 0 ? void 0 : product.bindCta;
@@ -351,7 +363,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
351
363
  requestId: null,
352
364
  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 : '',
353
365
  clSource: getVal('cl_source')
354
- }
366
+ },
367
+ reportLayId: false
355
368
  });
356
369
  }, [bffEventReport]);
357
370
  (0, react_1.useEffect)(() => {
@@ -359,49 +372,67 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
359
372
  h5EnterLink();
360
373
  }, [isShowConsent]);
361
374
  (0, react_1.useEffect)(() => {
362
- if (isShowConsent)
375
+ if (isShowConsent || isPreview)
363
376
  return;
364
377
  setLoading(true);
365
- bffGetTagList();
378
+ let layId;
366
379
  getRecommendVideos()
367
380
  .then((data) => {
381
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
368
382
  if (data) {
369
- setRtcList(getFilterRecList(data));
370
- setCacheRtcList(getFilterRecList(data));
383
+ const list = getFilterRecList(data);
384
+ if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.playbook) === 'organic menu' && !channel) {
385
+ list.unshift('organic menu');
386
+ }
387
+ setRtcList(list);
388
+ setCacheRtcList(list);
389
+ let curData;
390
+ if (data === null || data === void 0 ? void 0 : data.layoutVariantId) {
391
+ const id = (_b = (_a = data === null || data === void 0 ? void 0 : data.layoutVariantId) === null || _a === void 0 ? void 0 : _a.split('-')) === null || _b === void 0 ? void 0 : _b[1];
392
+ if (id) {
393
+ layId = id;
394
+ setLayoutVariantId(id);
395
+ curData = dataList === null || dataList === void 0 ? void 0 : dataList.find((item) => (item === null || item === void 0 ? void 0 : item.id) === id);
396
+ if (curData) {
397
+ setPageData(curData);
398
+ document.title = (_c = curData === null || curData === void 0 ? void 0 : curData.name) !== null && _c !== void 0 ? _c : 'home';
399
+ setGlobalConfig((_d = curData === null || curData === void 0 ? void 0 : curData.data) === null || _d === void 0 ? void 0 : _d.globalConfig);
400
+ onUpdateSchema === null || onUpdateSchema === void 0 ? void 0 : onUpdateSchema(curData === null || curData === void 0 ? void 0 : curData.data);
401
+ if ((_k = (_j = (_h = (_g = (_f = (_e = curData === null || curData === void 0 ? void 0 : curData.data) === null || _e === void 0 ? void 0 : _e.globalConfig) === null || _f === void 0 ? void 0 : _f.consent) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.item) === null || _j === void 0 ? void 0 : _j.props) === null || _k === void 0 ? void 0 : _k.privacy_necessity)
402
+ setShowConsent(true);
403
+ }
404
+ }
405
+ }
406
+ bffGetTagList(curData !== null && curData !== void 0 ? curData : pageData);
371
407
  }
372
408
  })
373
409
  .finally(() => {
374
410
  bffEventReport({
375
- eventInfo: {
376
- eventSubject: 'apiRequest',
377
- eventDescription: 'api request succeed'
378
- }
411
+ eventInfo: Object.assign({ eventSubject: 'apiRequest', eventDescription: 'api request succeed' }, (layId && { layoutVariantId: layId }))
379
412
  });
380
413
  setLoading(false);
381
414
  });
382
- }, [isShowConsent]);
415
+ }, [isShowConsent, channel]);
383
416
  (0, react_1.useEffect)(() => {
384
417
  if (!isPreview)
385
418
  return;
386
419
  setLoading(true);
387
- bffGetTagList();
420
+ bffGetTagList(pageData);
388
421
  getRecommendVideos()
389
422
  .then((data) => {
390
423
  if (data) {
391
- setRtcList(getFilterRecList(data));
392
- setCacheRtcList(getFilterRecList(data));
424
+ const list = getFilterRecList(data);
425
+ if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.playbook) === 'organic menu' && !channel) {
426
+ list.unshift('organic menu');
427
+ }
428
+ setRtcList(list);
429
+ setCacheRtcList(list);
393
430
  }
394
431
  })
395
432
  .finally(() => {
396
- bffEventReport({
397
- eventInfo: {
398
- eventSubject: 'apiRequest',
399
- eventDescription: 'api request succeed'
400
- }
401
- });
402
433
  setLoading(false);
403
434
  });
404
- }, [getRecommendVideos, bffGetTagList]);
435
+ }, [getRecommendVideos, bffGetTagList, channel]);
405
436
  const defaultLoadingImage = (0, useIconLink_1.useIconLink)('/pb_static/a65d23c5893c49d7aaaa81681d3179e2.gif', appDomain);
406
437
  return (react_1.default.createElement(exports.SxpDataSourceContext.Provider, { value: {
407
438
  rtcList,
@@ -414,7 +445,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
414
445
  setPopupDetailData,
415
446
  getRecommendVideos,
416
447
  bffEventReport,
417
- utmVal,
418
448
  isPreview,
419
449
  loading,
420
450
  sxpParameter,
@@ -452,12 +482,13 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
452
482
  checkCommodityIndexRef,
453
483
  isEditor,
454
484
  isNoMoreData
455
- } }, isShowConsent ? (react_1.default.createElement(Consent_1.default, Object.assign({}, (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props))) : (render({
485
+ } }, isShowConsent ? (react_1.default.createElement(Consent_1.default, Object.assign({}, (_e = (_d = (_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.item) === null || _e === void 0 ? void 0 : _e.props))) : (render({
456
486
  rtcList,
457
487
  mutateLike: bffMutateLike,
458
488
  mutateUnlike: bffMutateUnlike,
459
489
  submitForm: bffSubmitForm,
460
- tagList
490
+ tagList,
491
+ pageData
461
492
  }))));
462
493
  };
463
494
  exports.default = (0, react_1.memo)(SxpDataSourceProvider);
@@ -1,7 +1,7 @@
1
1
  import { ISxpPageRenderProps } from '../components/SxpPageRender';
2
2
  import { ProductInfoType } from '../components/SxpPageRender/typing';
3
3
  export declare const getMediaValueByMode: (obj?: Record<string, any>) => any;
4
- export declare const getBgStyle: (imgSrc: string) => "" | {
4
+ export declare const getBgStyle: (imgSrc?: string) => "" | {
5
5
  backgroundImage: string;
6
6
  backgroundRepeat: string;
7
7
  backgroundSize: string;
@@ -0,0 +1,26 @@
1
+ import React, { CSSProperties } from 'react';
2
+ import './index.less';
3
+ import { RecItemType } from '../../../core/components/SxpPageRender/typing';
4
+ export interface IMultiPostsProps {
5
+ bgImgUrl?: string;
6
+ backButton?: {
7
+ enable: boolean;
8
+ icon: string;
9
+ xPosit: string;
10
+ x: number;
11
+ yPosit: string;
12
+ y: number;
13
+ };
14
+ button1Url?: string;
15
+ button2Url?: string;
16
+ button3Url?: string;
17
+ button4Url?: string;
18
+ style?: CSSProperties;
19
+ button1?: any;
20
+ button2?: any;
21
+ button3?: any;
22
+ button4?: any;
23
+ recData?: RecItemType;
24
+ }
25
+ declare const _default: React.NamedExoticComponent<IMultiPostsProps>;
26
+ export default _default;
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const materials_1 = require("../../../core/utils/materials");
5
+ const react_1 = tslib_1.__importStar(require("react"));
6
+ require("./index.less");
7
+ const hooks_1 = require("../../../core/hooks");
8
+ const event_1 = tslib_1.__importStar(require("../../../core/utils/event"));
9
+ const react_2 = require("swiper/react");
10
+ const MultiPosts = (_a) => {
11
+ var _b, _c;
12
+ var { bgImgUrl, style, recData } = _a, props = tslib_1.__rest(_a, ["bgImgUrl", "style", "recData"]);
13
+ const { setChannel } = (0, hooks_1.useEditor)();
14
+ const { bffEventReport, curTime } = (0, hooks_1.useSxpDataSource)();
15
+ const { isActive } = (0, react_2.useSwiperSlide)() || {};
16
+ const initRef = (0, react_1.useRef)(false);
17
+ const viewTime = (0, react_1.useRef)();
18
+ const traceinfo = (_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.traceInfo) !== null && _c !== void 0 ? _c : '';
19
+ const getPropsVal = (0, react_1.useCallback)((index, str) => {
20
+ try {
21
+ return new Function('props', 'str', `if (str) {
22
+ return props?.button${index + 1}${str}
23
+ } else {
24
+ return props?.button${index + 1}
25
+ }`)(props, str);
26
+ }
27
+ catch (_a) { }
28
+ }, [props]);
29
+ const handleClick = (0, react_1.useCallback)((index) => {
30
+ const v = getPropsVal(index);
31
+ const value = v === null || v === void 0 ? void 0 : v.value;
32
+ if (!value)
33
+ return;
34
+ bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
35
+ eventInfo: {
36
+ eventSubject: 'multiPostClick',
37
+ eventDescription: 'multiPostClick',
38
+ traceinfo,
39
+ branchfeed: (v === null || v === void 0 ? void 0 : v.linkType) === 'recommendFlow' && value ? value : ''
40
+ }
41
+ });
42
+ if ((v === null || v === void 0 ? void 0 : v.linkType) === 'recommendFlow') {
43
+ endMultiPost('multipostClick');
44
+ setChannel === null || setChannel === void 0 ? void 0 : setChannel(value);
45
+ curTime.current = new Date();
46
+ }
47
+ else {
48
+ new Function(value)();
49
+ }
50
+ }, [props]);
51
+ const startMultiPost = (0, react_1.useCallback)(() => {
52
+ viewTime.current = new Date();
53
+ bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
54
+ eventInfo: {
55
+ eventSubject: 'startMultiPost',
56
+ eventDescription: 'startMultiPost',
57
+ contentFormat: 'IMAGE',
58
+ position: '0',
59
+ traceinfo
60
+ }
61
+ });
62
+ }, []);
63
+ const endMultiPost = (0, react_1.useCallback)((nextStep) => {
64
+ bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
65
+ eventInfo: {
66
+ eventSubject: 'endMultiPost',
67
+ eventDescription: 'endMultiPost',
68
+ contentFormat: 'IMAGE',
69
+ position: '0',
70
+ traceinfo,
71
+ nextStep: nextStep || 'others',
72
+ timeOnSite: Math.floor((new Date() - (viewTime === null || viewTime === void 0 ? void 0 : viewTime.current)) / 1000) + ''
73
+ }
74
+ });
75
+ }, []);
76
+ (0, react_1.useEffect)(() => {
77
+ if (isActive) {
78
+ startMultiPost();
79
+ initRef.current = true;
80
+ }
81
+ else if (initRef.current) {
82
+ endMultiPost();
83
+ }
84
+ }, [isActive]);
85
+ (0, react_1.useEffect)(() => {
86
+ const onShow = () => startMultiPost();
87
+ const onHide = () => endMultiPost();
88
+ event_1.default.on(event_1.SXP_EVENT_TYPE.PAGE_DID_SHOW, onShow);
89
+ event_1.default.on(event_1.SXP_EVENT_TYPE.PAGE_DID_HIDE, onHide);
90
+ return () => {
91
+ event_1.default.off(event_1.SXP_EVENT_TYPE.PAGE_DID_SHOW, onShow);
92
+ event_1.default.off(event_1.SXP_EVENT_TYPE.PAGE_DID_HIDE, onHide);
93
+ };
94
+ }, [isActive]);
95
+ return (react_1.default.createElement("div", { className: 'multiposts', style: Object.assign(Object.assign({}, style), (0, materials_1.getBgStyle)(bgImgUrl)) }, Array.from({ length: 4 }, (_, index) => {
96
+ return (react_1.default.createElement("button", { className: 'multiposts-btn', role: 'button', "aria-label": `multiposts-${index + 1}`, onClick: () => handleClick(index) },
97
+ react_1.default.createElement("img", { className: 'multiposts-btn-img', src: getPropsVal(index, 'Url'), alt: `multiposts-img-${index + 1}` })));
98
+ })));
99
+ };
100
+ exports.default = (0, react_1.memo)(MultiPosts);
@@ -0,0 +1,9 @@
1
+ declare const _default: {
2
+ title: string;
3
+ child: {
4
+ type: string;
5
+ name: string;
6
+ isMultiPosts: boolean;
7
+ }[];
8
+ }[];
9
+ export default _default;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = [
4
+ {
5
+ title: '按钮1点击事件',
6
+ child: [
7
+ {
8
+ type: 'link',
9
+ name: 'button1',
10
+ isMultiPosts: true
11
+ }
12
+ ]
13
+ },
14
+ {
15
+ title: '按钮2点击事件',
16
+ child: [
17
+ {
18
+ type: 'link',
19
+ name: 'button2',
20
+ isMultiPosts: true
21
+ }
22
+ ]
23
+ },
24
+ {
25
+ title: '按钮3点击事件',
26
+ child: [
27
+ {
28
+ type: 'link',
29
+ name: 'button3',
30
+ isMultiPosts: true
31
+ }
32
+ ]
33
+ },
34
+ {
35
+ title: '按钮4点击事件',
36
+ child: [
37
+ {
38
+ type: 'link',
39
+ name: 'button4',
40
+ isMultiPosts: true
41
+ }
42
+ ]
43
+ }
44
+ ];
@@ -0,0 +1,2 @@
1
+ declare const MultiPosts: import("../../../core/create").MaterialComponet<import(".").IMultiPostsProps>;
2
+ export { MultiPosts };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MultiPosts = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const settingRender_1 = tslib_1.__importDefault(require("./settingRender"));
6
+ const _1 = tslib_1.__importDefault(require("."));
7
+ const create_1 = require("../../../core/create");
8
+ const interactionRender_1 = tslib_1.__importDefault(require("./interactionRender"));
9
+ const MultiPosts = (0, create_1.createMaterial)(_1.default, {
10
+ displayName: 'MultiPosts',
11
+ icon: '',
12
+ category: 'base',
13
+ type: 'MultiPosts',
14
+ related: {
15
+ settingRender: settingRender_1.default,
16
+ interactionRender: interactionRender_1.default
17
+ },
18
+ defaulSetting: {
19
+ props: {},
20
+ style: {}
21
+ },
22
+ w: 100,
23
+ h: 40,
24
+ sort: 1
25
+ });
26
+ exports.MultiPosts = MultiPosts;
@@ -0,0 +1,73 @@
1
+ declare const _default: ({
2
+ title: string;
3
+ child: ({
4
+ label: string;
5
+ type: string;
6
+ name: string[];
7
+ child?: undefined;
8
+ } | {
9
+ type: string;
10
+ label: string;
11
+ child: ({
12
+ type: string;
13
+ name: string[];
14
+ text?: undefined;
15
+ } | {
16
+ type: string;
17
+ name: string[];
18
+ text: string;
19
+ })[];
20
+ name?: undefined;
21
+ } | {
22
+ type: string;
23
+ label: string;
24
+ child: ({
25
+ type: string;
26
+ name: string[];
27
+ options: {
28
+ label: string;
29
+ value: string;
30
+ }[];
31
+ initialValue: string;
32
+ addonAfter?: undefined;
33
+ } | {
34
+ type: string;
35
+ name: string[];
36
+ addonAfter: string;
37
+ options?: undefined;
38
+ initialValue?: undefined;
39
+ })[];
40
+ name?: undefined;
41
+ } | {
42
+ type: string;
43
+ label: string;
44
+ child: ({
45
+ type: string;
46
+ name: string[];
47
+ options: {
48
+ label: string;
49
+ value: string;
50
+ }[];
51
+ initialValue: string;
52
+ addonAfter?: undefined;
53
+ } | {
54
+ type: string;
55
+ name: string[];
56
+ addonAfter: string;
57
+ initialValue: number;
58
+ options?: undefined;
59
+ })[];
60
+ name?: undefined;
61
+ })[];
62
+ } | {
63
+ title: string;
64
+ child: {
65
+ type: string;
66
+ child: {
67
+ type: string;
68
+ name: string[];
69
+ text: string;
70
+ }[];
71
+ }[];
72
+ })[];
73
+ export default _default;