pb-sxp-ui 14.0.2 → 14.0.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 (72) hide show
  1. package/dist/index.cjs +441 -795
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +0 -89
  4. package/dist/index.js +441 -795
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.cjs +6 -6
  7. package/dist/index.min.cjs.map +1 -1
  8. package/dist/index.min.js +6 -6
  9. package/dist/index.min.js.map +1 -1
  10. package/dist/pb-ui.js +441 -795
  11. package/dist/pb-ui.js.map +1 -1
  12. package/dist/pb-ui.min.js +6 -6
  13. package/dist/pb-ui.min.js.map +1 -1
  14. package/es/core/components/SxpPageRender/ConsentPopup.js +8 -8
  15. package/es/core/components/SxpPageRender/Navbar.js +1 -1
  16. package/es/core/components/SxpPageRender/WaterFall/preview.json +272 -207
  17. package/es/core/components/SxpPageRender/index.js +2 -5
  18. package/es/core/context/SxpDataSourceProvider.js +46 -43
  19. package/es/core/utils/materials.js +3 -5
  20. package/es/materials/sxp/consentPopup/Display/index.d.ts +2 -2
  21. package/es/materials/sxp/consentPopup/Display/index.js +5 -7
  22. package/es/materials/sxp/consentPopup/index.d.ts +0 -2
  23. package/es/materials/sxp/consentPopup/index.js +0 -2
  24. package/es/materials/sxp/cta/AniLink/index.js +1 -1
  25. package/es/materials/sxp/cta/AniLinkPopup/index.js +1 -1
  26. package/es/materials/sxp/popup/ConsentDetail/index.d.ts +1 -2
  27. package/es/materials/sxp/popup/ConsentDetail/index.js +2 -2
  28. package/es/materials/sxp/popup/Iframe/index.d.ts +4 -0
  29. package/es/materials/sxp/popup/Iframe/index.js +5 -4
  30. package/es/materials/sxp/popup/Iframe/settingRender.js +15 -0
  31. package/lib/core/components/SxpPageRender/ConsentPopup.js +7 -7
  32. package/lib/core/components/SxpPageRender/Navbar.js +1 -1
  33. package/lib/core/components/SxpPageRender/WaterFall/preview.json +272 -207
  34. package/lib/core/components/SxpPageRender/index.js +2 -5
  35. package/lib/core/context/SxpDataSourceProvider.js +46 -43
  36. package/lib/core/utils/materials.js +3 -5
  37. package/lib/materials/sxp/consentPopup/Display/index.d.ts +2 -2
  38. package/lib/materials/sxp/consentPopup/Display/index.js +5 -7
  39. package/lib/materials/sxp/consentPopup/index.d.ts +0 -2
  40. package/lib/materials/sxp/consentPopup/index.js +0 -2
  41. package/lib/materials/sxp/cta/AniLink/index.js +1 -1
  42. package/lib/materials/sxp/cta/AniLinkPopup/index.js +1 -1
  43. package/lib/materials/sxp/popup/ConsentDetail/index.d.ts +1 -2
  44. package/lib/materials/sxp/popup/ConsentDetail/index.js +2 -2
  45. package/lib/materials/sxp/popup/Iframe/index.d.ts +4 -0
  46. package/lib/materials/sxp/popup/Iframe/index.js +5 -4
  47. package/lib/materials/sxp/popup/Iframe/settingRender.js +15 -0
  48. package/package.json +1 -1
  49. package/es/materials/sxp/consentPopup/Click/index.d.ts +0 -19
  50. package/es/materials/sxp/consentPopup/Click/index.js +0 -19
  51. package/es/materials/sxp/consentPopup/Click/material.d.ts +0 -2
  52. package/es/materials/sxp/consentPopup/Click/material.js +0 -48
  53. package/es/materials/sxp/consentPopup/Click/settingRender.d.ts +0 -63
  54. package/es/materials/sxp/consentPopup/Click/settingRender.js +0 -210
  55. package/es/materials/sxp/consentPopup/Swipe/index.d.ts +0 -12
  56. package/es/materials/sxp/consentPopup/Swipe/index.js +0 -44
  57. package/es/materials/sxp/consentPopup/Swipe/material.d.ts +0 -2
  58. package/es/materials/sxp/consentPopup/Swipe/material.js +0 -24
  59. package/es/materials/sxp/consentPopup/Swipe/settingRender.d.ts +0 -29
  60. package/es/materials/sxp/consentPopup/Swipe/settingRender.js +0 -43
  61. package/lib/materials/sxp/consentPopup/Click/index.d.ts +0 -19
  62. package/lib/materials/sxp/consentPopup/Click/index.js +0 -21
  63. package/lib/materials/sxp/consentPopup/Click/material.d.ts +0 -2
  64. package/lib/materials/sxp/consentPopup/Click/material.js +0 -52
  65. package/lib/materials/sxp/consentPopup/Click/settingRender.d.ts +0 -63
  66. package/lib/materials/sxp/consentPopup/Click/settingRender.js +0 -212
  67. package/lib/materials/sxp/consentPopup/Swipe/index.d.ts +0 -12
  68. package/lib/materials/sxp/consentPopup/Swipe/index.js +0 -46
  69. package/lib/materials/sxp/consentPopup/Swipe/material.d.ts +0 -2
  70. package/lib/materials/sxp/consentPopup/Swipe/material.js +0 -28
  71. package/lib/materials/sxp/consentPopup/Swipe/settingRender.d.ts +0 -29
  72. package/lib/materials/sxp/consentPopup/Swipe/settingRender.js +0 -45
@@ -120,7 +120,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
120
120
  contentId: (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.itemId,
121
121
  productId: (_o = item === null || item === void 0 ? void 0 : item.product) === null || _o === void 0 ? void 0 : _o.itemId,
122
122
  position: activeIndex + '',
123
- fromKName: fk || fromKName,
123
+ fromKName: fk ? fk : fromKName,
124
124
  fromKPage: location === null || location === void 0 ? void 0 : location.href,
125
125
  ctatId: (_r = (_q = (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.bindCta) === null || _q === void 0 ? void 0 : _q.itemId) !== null && _r !== void 0 ? _r : '',
126
126
  traceInfo: (_v = (_t = (_s = item === null || item === void 0 ? void 0 : item.video) === null || _s === void 0 ? void 0 : _s.traceInfo) !== null && _t !== void 0 ? _t : (_u = item === null || item === void 0 ? void 0 : item.product) === null || _u === void 0 ? void 0 : _u.traceInfo) !== null && _v !== void 0 ? _v : ''
@@ -147,12 +147,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
147
147
  setIsReload(new Date().getTime());
148
148
  skipLinkRef.current = false;
149
149
  }
150
- refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(false);
151
150
  handleH5EnterLink();
152
151
  if (repCond) {
153
- setTimeout(() => {
154
- event_1.default.emit(event_1.SXP_EVENT_TYPE.PAGE_DID_SHOW, item);
155
- });
152
+ event_1.default.emit(event_1.SXP_EVENT_TYPE.PAGE_DID_SHOW, item);
156
153
  backMainFeed('external', selectTag);
157
154
  }
158
155
  }
@@ -4,13 +4,13 @@ exports.DEFAULT_TAG = exports.SxpDataSourceContext = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importStar(require("react"));
6
6
  const qs_1 = tslib_1.__importDefault(require("qs"));
7
+ const lodash_1 = require("lodash");
7
8
  const sessionStore_1 = require("../utils/sessionStore");
8
9
  const localStore_1 = require("../utils/localStore");
9
10
  const useIconLink_1 = require("../components/SxpPageRender/useIconLink");
10
11
  const event_1 = tslib_1.__importStar(require("../utils/event"));
11
12
  const Consent_1 = tslib_1.__importDefault(require("../components/Consent"));
12
13
  const tool_1 = require("../utils/tool");
13
- const lodash_1 = require("lodash");
14
14
  exports.SxpDataSourceContext = (0, react_1.createContext)({
15
15
  rtcList: [],
16
16
  tagList: []
@@ -102,32 +102,53 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
102
102
  const bffDataSource = (0, react_1.useMemo)(() => {
103
103
  return dataSources === null || dataSources === void 0 ? void 0 : dataSources.find((d) => d.type === DataSourceType.BFF);
104
104
  }, [dataSources]);
105
- const fakeUserId = (0, react_1.useMemo)(() => {
106
- var _a;
107
- return ((_a = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _a === void 0 ? void 0 : _a['x-app-id']) + (0, localStore_1.storeAndLoadFeUserId)();
108
- }, [bffDataSource]);
109
105
  const bffFetch = (0, react_1.useCallback)((path, options) => {
110
106
  if (!bffDataSource)
111
107
  return;
112
108
  const url = bffDataSource.url;
109
+ const fakeUserId = (0, localStore_1.storeAndLoadFeUserId)();
113
110
  if (options === null || options === void 0 ? void 0 : options.query) {
114
111
  const queryString = qs_1.default.stringify(options.query);
115
112
  path = `${path}?${queryString}`;
116
113
  }
117
114
  if (options.type === 'beacon' && navigator.sendBeacon) {
118
- return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
115
+ return navigator.sendBeacon(`${url}/api/v1${path}`, new Blob([
119
116
  JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))
120
117
  ], { type: 'application/json;charset=UTF-8' }));
121
118
  }
122
119
  return window
123
- .fetch(`${url}/api/${path}`, {
120
+ .fetch(`${url}/api/v1${path}`, {
124
121
  headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers),
125
122
  method: options.method,
126
123
  body: JSON.stringify(options.body)
127
124
  })
128
125
  .then((res) => res.json())
129
126
  .catch((err) => Promise.reject(err));
130
- }, [bffDataSource, fakeUserId]);
127
+ }, [bffDataSource]);
128
+ function splitUrlParams(urlParams) {
129
+ if (!urlParams)
130
+ return;
131
+ const indList = [];
132
+ for (let i = 0; i < urlParams.length; i++) {
133
+ const item = urlParams[i];
134
+ const curStr = urlParams.substring(i + 1, urlParams.length);
135
+ if (item === '&' &&
136
+ (curStr === null || curStr === void 0 ? void 0 : curStr.indexOf('=')) !== -1 &&
137
+ ((curStr === null || curStr === void 0 ? void 0 : curStr.indexOf('=')) < (curStr === null || curStr === void 0 ? void 0 : curStr.indexOf('&')) || (curStr === null || curStr === void 0 ? void 0 : curStr.indexOf('&')) === -1)) {
138
+ indList.push(i);
139
+ }
140
+ }
141
+ const splitList = indList.length > 0 ? [] : [urlParams];
142
+ let lastIndex = 0;
143
+ indList === null || indList === void 0 ? void 0 : indList.map((i) => {
144
+ splitList === null || splitList === void 0 ? void 0 : splitList.push(urlParams.substring(lastIndex, i));
145
+ lastIndex = i + 1;
146
+ if (i === indList[indList.length - 1] && i < urlParams.length) {
147
+ splitList === null || splitList === void 0 ? void 0 : splitList.push(urlParams.substring(lastIndex, urlParams.length));
148
+ }
149
+ });
150
+ return splitList !== null && splitList !== void 0 ? splitList : [];
151
+ }
131
152
  const getRecommendVideos = (0, react_1.useCallback)((query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
132
153
  var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
133
154
  query = {
@@ -144,7 +165,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
144
165
  query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(channel) });
145
166
  }
146
167
  else if (utmVal) {
147
- const val = (_k = (_j = (_h = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _h === void 0 ? void 0 : _h.filter((val) => {
168
+ const val = (_k = (_j = (_h = splitUrlParams(utmVal)) === null || _h === void 0 ? void 0 : _h.filter((val) => {
148
169
  var _a, _b;
149
170
  const key = val.split('=')[0];
150
171
  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);
@@ -164,7 +185,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
164
185
  const recurveRecList = (query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
165
186
  var _v, _w, _x, _y, _z, _0;
166
187
  query.pageNum = pageNum;
167
- result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/list', { method: 'POST', body: query }));
188
+ result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'POST', body: query }));
168
189
  if (!(result === null || result === void 0 ? void 0 : result.success)) {
169
190
  return undefined;
170
191
  }
@@ -186,7 +207,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
186
207
  if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
187
208
  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 });
188
209
  }
189
- const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/list', { method: 'POST', body: query }));
210
+ const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'POST', body: query }));
190
211
  if (!(result === null || result === void 0 ? void 0 : result.success)) {
191
212
  return undefined;
192
213
  }
@@ -236,7 +257,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
236
257
  return expire;
237
258
  }, [data]);
238
259
  const bffEventReport = (0, react_1.useCallback)(({ userInfo, eventInfo, reportLayId = true }) => {
239
- var _a;
240
260
  if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
241
261
  return;
242
262
  }
@@ -253,35 +273,26 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
253
273
  console.log('userInfo:', userInfo);
254
274
  console.log('eventInfo:', ef);
255
275
  console.log('========= 结束 =========');
256
- return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/event/report/CLD/${(_a = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _a === void 0 ? void 0 : _a['x-app-id']}/${eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.eventSubject}`, {
276
+ return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/event/report', {
257
277
  method: 'POST',
258
278
  body: { userInfo: realUserInfo, eventInfo: realEventInfo },
259
279
  type: 'beacon'
260
280
  });
261
- }, [
262
- bffFetch,
263
- curReqInfo,
264
- enableReportEvent,
265
- globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
266
- layoutVariantId,
267
- globalConfig,
268
- playbookType,
269
- bffDataSource
270
- ]);
281
+ }, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview, layoutVariantId, globalConfig, playbookType]);
271
282
  const bffFbReport = (0, react_1.useCallback)(({ eventName, product }) => {
272
- var _a, _b, _c, _d, _e, _f;
283
+ var _a, _b, _c, _d, _e;
273
284
  if (!enableReportEvent ||
274
285
  !enabledMetaConversionApi ||
275
286
  (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) ||
276
287
  !((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _a === void 0 ? void 0 : _a[eventName])) {
277
288
  return;
278
289
  }
279
- let jsonParams = (0, lodash_1.cloneDeep)((_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName]);
290
+ const jsonParams = (0, lodash_1.cloneDeep)((_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName]);
280
291
  const urlParams = new URLSearchParams(window.location.search);
281
292
  const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
282
293
  const fix_par = {
283
294
  event_source_url: (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href,
284
- external_id: fakeUserId,
295
+ external_id: (0, localStore_1.storeAndLoadFeUserId)(),
285
296
  client_user_agent: (_e = (_d = window === null || window === void 0 ? void 0 : window.navigator) === null || _d === void 0 ? void 0 : _d.userAgent) !== null && _e !== void 0 ? _e : '',
286
297
  fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
287
298
  fbp: (0, tool_1.getCookie)('_fbp') ? `fb.2.${new Date().getTime()}.${(0, tool_1.getCookie)('_fbp')}` : '',
@@ -333,30 +344,22 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
333
344
  }
334
345
  };
335
346
  getEventParams(jsonParams);
336
- return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/event/report/FB/${(_f = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _f === void 0 ? void 0 : _f['x-app-id']}/${eventName}`, {
347
+ return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/fb/events', {
337
348
  method: 'POST',
338
349
  body: jsonParams,
339
350
  type: 'beacon'
340
351
  });
341
- }, [
342
- bffFetch,
343
- enableReportEvent,
344
- enabledMetaConversionApi,
345
- globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
346
- globalConfig,
347
- fakeUserId,
348
- bffDataSource
349
- ]);
352
+ }, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview, globalConfig]);
350
353
  const bffMutateLike = (0, react_1.useCallback)((body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
351
- const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/like', { method: 'POST', body }));
354
+ const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/like', { method: 'POST', body }));
352
355
  return res === null || res === void 0 ? void 0 : res.success;
353
356
  }), [bffFetch]);
354
357
  const bffMutateUnlike = (0, react_1.useCallback)((body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
355
- const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/unlike', { method: 'POST', body }));
358
+ const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/unlike', { method: 'POST', body }));
356
359
  return res === null || res === void 0 ? void 0 : res.success;
357
360
  }), [bffFetch]);
358
361
  const bffSubmitForm = (0, react_1.useCallback)((body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
359
- const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/customform', { method: 'POST', body }));
362
+ const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/customform', { method: 'POST', body }));
360
363
  return res === null || res === void 0 ? void 0 : res.success;
361
364
  }), [bffFetch]);
362
365
  const bffGetTagList = (0, react_1.useCallback)((data) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
@@ -365,12 +368,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
365
368
  if (!utmVal || !isShowTag)
366
369
  return;
367
370
  try {
368
- const val = (_10 = (_9 = (_8 = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _8 === void 0 ? void 0 : _8.filter((val) => {
371
+ const val = (_10 = (_9 = (_8 = splitUrlParams(utmVal)) === null || _8 === void 0 ? void 0 : _8.filter((val) => {
369
372
  var _a, _b;
370
373
  const key = val.split('=')[0];
371
374
  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);
372
375
  })) === null || _9 === void 0 ? void 0 : _9.join('&')) !== null && _10 !== void 0 ? _10 : '';
373
- const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
376
+ const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
374
377
  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 : []);
375
378
  }
376
379
  catch (e) {
@@ -444,10 +447,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
444
447
  let curData;
445
448
  let gldata;
446
449
  if (data === null || data === void 0 ? void 0 : data.layoutVariantId) {
447
- layId = data === null || data === void 0 ? void 0 : data.layoutVariantId;
448
- setLayoutVariantId(data === null || data === void 0 ? void 0 : data.layoutVariantId);
449
450
  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];
450
451
  if (id) {
452
+ layId = id;
453
+ setLayoutVariantId(id);
451
454
  curData = dataList === null || dataList === void 0 ? void 0 : dataList.find((item) => (item === null || item === void 0 ? void 0 : item.id) === id);
452
455
  if (curData) {
453
456
  setPageData(curData);
@@ -38,16 +38,14 @@ const getBgStyleByImg = (data) => {
38
38
  exports.getBgStyleByImg = getBgStyleByImg;
39
39
  const getPriceText = ({ product, enableFormattedPrice, globalConfig, isHiddenDef, style }) => {
40
40
  var _a, _b, _c, _d, _e, _f, _g, _h;
41
- let text = '';
42
41
  if ((!(product === null || product === void 0 ? void 0 : product.currency) || !(product === null || product === void 0 ? void 0 : product.price)) && isHiddenDef)
43
42
  return null;
44
- let price = Number((product === null || product === void 0 ? void 0 : product.currency) && (product === null || product === void 0 ? void 0 : product.price) ? product === null || product === void 0 ? void 0 : product.price : 7000);
45
- if (typeof price !== 'number')
46
- return text;
43
+ let price = (product === null || product === void 0 ? void 0 : product.currency) && (product === null || product === void 0 ? void 0 : product.price) ? product === null || product === void 0 ? void 0 : product.price : 7000;
44
+ let text = '';
47
45
  let priceSymbol = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.priceSymbol;
48
46
  let currency = (product === null || product === void 0 ? void 0 : product.currency) ? (_c = (_b = (_a = product === null || product === void 0 ? void 0 : product.currency) === null || _a === void 0 ? void 0 : _a.split('-')[1]) === null || _b === void 0 ? void 0 : _b.toUpperCase()) !== null && _c !== void 0 ? _c : '' : '$';
49
47
  const isToLocStr = enableFormattedPrice === undefined || enableFormattedPrice;
50
- let decPic = price === null || price === void 0 ? void 0 : price.toString();
48
+ let decPic = price.toString();
51
49
  if (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.showTwoDecimalPoint) {
52
50
  decPic = price === null || price === void 0 ? void 0 : price.toFixed(2);
53
51
  }
@@ -13,9 +13,9 @@ export interface IDisplayProps {
13
13
  };
14
14
  style?: Record<string, any>;
15
15
  isTel?: boolean;
16
- isShowClose?: boolean;
17
- consentPopupCate?: string;
18
16
  onClick?: () => void;
17
+ contsentState?: boolean;
18
+ isShowClose?: boolean;
19
19
  }
20
20
  declare const _default: React.NamedExoticComponent<IDisplayProps>;
21
21
  export default _default;
@@ -3,20 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
5
  require("./index.less");
6
+ const EditorDataProvider_1 = require("../../../../core/context/EditorDataProvider");
6
7
  const close_svg_1 = tslib_1.__importDefault(require("./close.svg"));
7
8
  const tel_png_1 = tslib_1.__importDefault(require("./tel.png"));
8
9
  const tool_1 = require("../../../../core/utils/tool");
9
- const localStore_1 = require("../../../../core/utils/localStore");
10
10
  const Display = (_a) => {
11
11
  var _b, _c;
12
- var { isTel, isShowOnce, open, content, interaction, style, onClick, isShowClose, consentPopupCate } = _a, props = tslib_1.__rest(_a, ["isTel", "isShowOnce", "open", "content", "interaction", "style", "onClick", "isShowClose", "consentPopupCate"]);
12
+ var { isTel, isShowOnce, open, content, interaction, style, onClick, contsentState, isShowClose } = _a, props = tslib_1.__rest(_a, ["isTel", "isShowOnce", "open", "content", "interaction", "style", "onClick", "contsentState", "isShowClose"]);
13
+ const { consentPopupCate } = (0, EditorDataProvider_1.useEditorDataProvider)();
13
14
  const [isClose, setIsClose] = (0, react_1.useState)(false);
14
- const contsentState = (0, react_1.useMemo)(() => {
15
- return (0, localStore_1.getContsentState)();
16
- }, []);
17
15
  const visivle = (0, react_1.useMemo)(() => {
18
- return consentPopupCate || (open && (isShowOnce || contsentState) && style && !isClose);
19
- }, [consentPopupCate, open, isClose, contsentState]);
16
+ return consentPopupCate === 'Display' || (open && (isShowOnce || contsentState) && style && !isClose);
17
+ }, [consentPopupCate, open, isClose]);
20
18
  const handleClickClose = (0, react_1.useCallback)(() => {
21
19
  setIsClose(true);
22
20
  }, []);
@@ -1,3 +1 @@
1
1
  export * from './Display/material';
2
- export * from './Click/material';
3
- export * from './Swipe/material';
@@ -2,5 +2,3 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./Display/material"), exports);
5
- tslib_1.__exportStar(require("./Click/material"), exports);
6
- tslib_1.__exportStar(require("./Swipe/material"), exports);
@@ -37,7 +37,7 @@ const AniLink = (_a) => {
37
37
  onClick === null || onClick === void 0 ? void 0 : onClick();
38
38
  }
39
39
  };
40
- const title = (cta === null || cta === void 0 ? void 0 : cta.enTitle) || 'Show More';
40
+ const title = (cta === null || cta === void 0 ? void 0 : cta.enTitle) || '查看详情';
41
41
  const aniTimStyle = (0, react_1.useMemo)(() => {
42
42
  var _a, _b;
43
43
  const ani = event === null || event === void 0 ? void 0 : event.animation;
@@ -37,7 +37,7 @@ const AniLinkPopup = (_a) => {
37
37
  onClick === null || onClick === void 0 ? void 0 : onClick();
38
38
  }
39
39
  };
40
- const title = (cta === null || cta === void 0 ? void 0 : cta.enTitle) || 'Show More';
40
+ const title = (cta === null || cta === void 0 ? void 0 : cta.enTitle) || '查看详情';
41
41
  const aniTimStyle = (0, react_1.useMemo)(() => {
42
42
  const ani = event === null || event === void 0 ? void 0 : event.animation;
43
43
  if (ani) {
@@ -1,9 +1,8 @@
1
- import React, { CSSProperties } from 'react';
1
+ import React from 'react';
2
2
  import './index.less';
3
3
  export interface IConsentDetailProps {
4
4
  content?: string;
5
5
  isTel?: boolean;
6
- style?: CSSProperties;
7
6
  }
8
7
  declare const _default: React.NamedExoticComponent<IConsentDetailProps>;
9
8
  export default _default;
@@ -4,11 +4,11 @@ const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
5
  require("./index.less");
6
6
  const ConsentDetail = (_a) => {
7
- var { content, isTel, style } = _a, props = tslib_1.__rest(_a, ["content", "isTel", "style"]);
7
+ var { content, isTel } = _a, props = tslib_1.__rest(_a, ["content", "isTel"]);
8
8
  return (react_1.default.createElement("article", { className: 'consentDetail-article', dangerouslySetInnerHTML: {
9
9
  __html: typeof content === 'string' ? content : ''
10
10
  }, onClick: (e) => {
11
11
  e.stopPropagation();
12
- }, style: style }));
12
+ } }));
13
13
  };
14
14
  exports.default = (0, react_1.memo)(ConsentDetail);
@@ -12,6 +12,10 @@ export interface IIframeProps {
12
12
  submitButtonStyle?: CSSProperties;
13
13
  contentStyle?: CSSProperties;
14
14
  isTel?: boolean;
15
+ iframe?: {
16
+ src?: string;
17
+ allow?: string;
18
+ };
15
19
  }
16
20
  declare const _default: React.NamedExoticComponent<IIframeProps>;
17
21
  export default _default;
@@ -7,11 +7,12 @@ require("./index.less");
7
7
  const hooks_1 = require("../../../../core/hooks");
8
8
  const Iframe = (_a) => {
9
9
  var _b, _c;
10
- var { content, btnText, style, icon, isPopup, isExternalLink, onClose, onClick, submitButtonStyle, contentStyle, isTel } = _a, props = tslib_1.__rest(_a, ["content", "btnText", "style", "icon", "isPopup", "isExternalLink", "onClose", "onClick", "submitButtonStyle", "contentStyle", "isTel"]);
10
+ var { content, btnText, style, icon, isPopup, isExternalLink, onClose, onClick, submitButtonStyle, contentStyle, isTel, iframe } = _a, props = tslib_1.__rest(_a, ["content", "btnText", "style", "icon", "isPopup", "isExternalLink", "onClose", "onClick", "submitButtonStyle", "contentStyle", "isTel", "iframe"]);
11
11
  const { popupDetailData } = (0, hooks_1.useSxpDataSource)();
12
- const iframeUrl = (_c = (_b = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.video) === null || _b === void 0 ? void 0 : _b.bindCta) === null || _c === void 0 ? void 0 : _c.remark;
13
- return (react_1.default.createElement("div", Object.assign({ className: `${(0, css_1.css)(Object.assign({}, style))}` }, props),
14
- react_1.default.createElement("iframe", { src: iframeUrl, style: {
12
+ const { src, allow } = iframe || {};
13
+ const iframeUrl = src || ((_c = (_b = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.video) === null || _b === void 0 ? void 0 : _b.bindCta) === null || _c === void 0 ? void 0 : _c.remark);
14
+ return (react_1.default.createElement("div", Object.assign({ className: `${(0, css_1.css)(Object.assign(Object.assign({}, style), { overflow: 'hidden' }))}` }, props),
15
+ react_1.default.createElement("iframe", { src: iframeUrl, allow: allow, scrolling: 'no', style: {
15
16
  width: '100%',
16
17
  height: 'calc(100% - 50px)',
17
18
  marginTop: '50px',
@@ -10,5 +10,20 @@ exports.default = [
10
10
  name: ['style', 'backgroundColor']
11
11
  }
12
12
  ]
13
+ },
14
+ {
15
+ title: 'iframe',
16
+ child: [
17
+ {
18
+ type: 'TextArea',
19
+ label: 'url',
20
+ name: ['props', 'iframe', 'src']
21
+ },
22
+ {
23
+ type: 'TextArea',
24
+ label: 'allow',
25
+ name: ['props', 'iframe', 'allow']
26
+ }
27
+ ]
13
28
  }
14
29
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "14.0.2",
3
+ "version": "14.0.4",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -1,19 +0,0 @@
1
- import React, { CSSProperties } from 'react';
2
- import './index.less';
3
- export interface IClickProps {
4
- open?: boolean;
5
- content?: string;
6
- style?: Record<string, any>;
7
- isTel?: boolean;
8
- acceptButton?: {
9
- text?: string;
10
- style?: CSSProperties;
11
- };
12
- rejectButton?: {
13
- text?: string;
14
- style?: CSSProperties;
15
- };
16
- consentPopupCate?: string;
17
- }
18
- declare const _default: React.NamedExoticComponent<IClickProps>;
19
- export default _default;
@@ -1,19 +0,0 @@
1
- import { __rest } from "tslib";
2
- import React, { memo, useMemo } from 'react';
3
- import './index.less';
4
- import tel from './tel.png';
5
- import ConsentDetail from '../../popup/ConsentDetail';
6
- const Click = (_a) => {
7
- var { isTel, open, content, style, consentPopupCate, acceptButton, rejectButton } = _a, props = __rest(_a, ["isTel", "open", "content", "style", "consentPopupCate", "acceptButton", "rejectButton"]);
8
- const visivle = useMemo(() => {
9
- return consentPopupCate || (open && style);
10
- }, [consentPopupCate, open]);
11
- const handleClickAccept = () => { };
12
- const handleClickReject = () => { };
13
- return (React.createElement(React.Fragment, null, isTel ? (React.createElement("img", { src: tel, style: { objectFit: 'cover', width: '100%', height: '100%' } })) : (React.createElement(React.Fragment, null, visivle && (React.createElement("div", { className: 'consentPopupClick' },
14
- React.createElement("div", { className: 'consentPopupClick-container', style: style },
15
- React.createElement(ConsentDetail, { content: content, style: { padding: 0 } }),
16
- React.createElement("button", { style: acceptButton === null || acceptButton === void 0 ? void 0 : acceptButton.style, onClick: handleClickAccept }, acceptButton === null || acceptButton === void 0 ? void 0 : acceptButton.text),
17
- React.createElement("button", { style: rejectButton === null || rejectButton === void 0 ? void 0 : rejectButton.style, onClick: handleClickReject }, rejectButton === null || rejectButton === void 0 ? void 0 : rejectButton.text))))))));
18
- };
19
- export default memo(Click);
@@ -1,2 +0,0 @@
1
- declare const Click: import("../../../../core/create").MaterialComponet<import(".").IClickProps>;
2
- export { Click };
@@ -1,48 +0,0 @@
1
- import settingRender from './settingRender';
2
- import ClickComponent from '.';
3
- import { createMaterial } from '../../../../core/create';
4
- const Click = createMaterial(ClickComponent, {
5
- displayName: 'Click Consent',
6
- icon: '',
7
- category: 'consentPopup',
8
- type: 'Click',
9
- related: {
10
- settingRender,
11
- bindableProps: []
12
- },
13
- defaulSetting: {
14
- props: {
15
- content: '<p><strong><span style="font-size:14px"><span style="line-height:3">Your Cookie Preferences</span></span></strong></p><p>We use cookie, including third-party cookies, to ensure the proper functioning and security of this site, to analyse its use, and to show you personalised content. You can authorise the use of all cookies by clicking on &quot;Accept all cookies&quot;. If you click on &quot;Reject all cookies&quot;, we will only use cookies necessary for the proper functioning and security of this site. To personalise on adjust your preferences at any time, click on &quot;Cookies Settings&quot; below or at the bottom of any Fendi.com webpage. For more information, read our Cookie Policy.</p><p></p>',
16
- acceptButton: {
17
- text: 'Accept all cookies',
18
- style: {
19
- backgroundColor: '#000',
20
- height: 45,
21
- color: '#fff',
22
- fontSize: 12,
23
- textAlign: 'center',
24
- marginTop: 5,
25
- marginBottom: 5
26
- }
27
- },
28
- rejectButton: {
29
- text: 'Reject all cookies',
30
- style: {
31
- backgroundColor: '#000',
32
- height: 45,
33
- color: '#fff',
34
- fontSize: 12,
35
- textAlign: 'center',
36
- marginTop: 5,
37
- marginBottom: 5
38
- }
39
- }
40
- },
41
- style: {
42
- backgroundColor: '#fff',
43
- padding: 18
44
- }
45
- },
46
- sort: 2
47
- });
48
- export { Click };
@@ -1,63 +0,0 @@
1
- declare const _default: ({
2
- title: string;
3
- child: {
4
- type: string;
5
- name: string[];
6
- }[];
7
- } | {
8
- title: string;
9
- child: ({
10
- type: string;
11
- label: string;
12
- name: string[];
13
- addonAfter?: undefined;
14
- child?: undefined;
15
- } | {
16
- type: string;
17
- label: string;
18
- name: string[];
19
- addonAfter: string;
20
- child?: undefined;
21
- } | {
22
- type: string;
23
- label: string;
24
- child: ({
25
- type: string;
26
- name: string[];
27
- max: number;
28
- addonAfter?: undefined;
29
- } | {
30
- type: string;
31
- name: string[];
32
- addonAfter: string;
33
- max: number;
34
- })[];
35
- name?: undefined;
36
- addonAfter?: undefined;
37
- } | {
38
- type: string;
39
- label: string;
40
- child: {
41
- type: string;
42
- name: string[];
43
- bottomText: string;
44
- }[];
45
- name?: undefined;
46
- addonAfter?: undefined;
47
- } | {
48
- type: string;
49
- label: string;
50
- child: ({
51
- type: string;
52
- name: string[];
53
- addonAfter?: undefined;
54
- } | {
55
- type: string;
56
- name: string[];
57
- addonAfter: string;
58
- })[];
59
- name?: undefined;
60
- addonAfter?: undefined;
61
- })[];
62
- })[];
63
- export default _default;