pb-sxp-ui 1.13.1 → 1.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -99,32 +99,29 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
99
99
  const bffDataSource = useMemo(() => {
100
100
  return dataSources === null || dataSources === void 0 ? void 0 : dataSources.find((d) => d.type === DataSourceType.BFF);
101
101
  }, [dataSources]);
102
- const fakeUserId = useMemo(() => {
103
- var _a;
104
- return ((_a = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _a === void 0 ? void 0 : _a['x-app-id']) + storeAndLoadFeUserId();
105
- }, [bffDataSource]);
106
102
  const bffFetch = useCallback((path, options) => {
107
103
  if (!bffDataSource)
108
104
  return;
109
105
  const url = bffDataSource.url;
106
+ const fakeUserId = storeAndLoadFeUserId();
110
107
  if (options === null || options === void 0 ? void 0 : options.query) {
111
108
  const queryString = qs.stringify(options.query);
112
109
  path = `${path}?${queryString}`;
113
110
  }
114
111
  if (options.type === 'beacon' && navigator.sendBeacon) {
115
- return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
112
+ return navigator.sendBeacon(`${url}/api/v1${path}`, new Blob([
116
113
  JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))
117
114
  ], { type: 'application/json;charset=UTF-8' }));
118
115
  }
119
116
  return window
120
- .fetch(`${url}/api/${path}`, {
117
+ .fetch(`${url}/api/v1${path}`, {
121
118
  headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers),
122
119
  method: options.method,
123
120
  body: JSON.stringify(options.body)
124
121
  })
125
122
  .then((res) => res.json())
126
123
  .catch((err) => Promise.reject(err));
127
- }, [bffDataSource, fakeUserId]);
124
+ }, [bffDataSource]);
128
125
  const getRecommendVideos = useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
129
126
  var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
130
127
  query = {
@@ -161,7 +158,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
161
158
  const recurveRecList = (query) => __awaiter(void 0, void 0, void 0, function* () {
162
159
  var _v, _w, _x, _y, _z, _0;
163
160
  query.pageNum = pageNum;
164
- result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/list', { method: 'POST', body: query }));
161
+ result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'POST', body: query }));
165
162
  if (!(result === null || result === void 0 ? void 0 : result.success)) {
166
163
  return undefined;
167
164
  }
@@ -183,7 +180,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
183
180
  if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
184
181
  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 });
185
182
  }
186
- const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/list', { method: 'POST', body: query }));
183
+ const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'POST', body: query }));
187
184
  if (!(result === null || result === void 0 ? void 0 : result.success)) {
188
185
  return undefined;
189
186
  }
@@ -233,7 +230,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
233
230
  return expire;
234
231
  }, [data]);
235
232
  const bffEventReport = useCallback(({ userInfo, eventInfo, reportLayId = true }) => {
236
- var _a;
237
233
  if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
238
234
  return;
239
235
  }
@@ -250,23 +246,14 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
250
246
  console.log('userInfo:', userInfo);
251
247
  console.log('eventInfo:', ef);
252
248
  console.log('========= 结束 =========');
253
- 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}`, {
249
+ return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/event/report', {
254
250
  method: 'POST',
255
251
  body: { userInfo: realUserInfo, eventInfo: realEventInfo },
256
252
  type: 'beacon'
257
253
  });
258
- }, [
259
- bffFetch,
260
- curReqInfo,
261
- enableReportEvent,
262
- globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
263
- layoutVariantId,
264
- globalConfig,
265
- playbookType,
266
- bffDataSource
267
- ]);
254
+ }, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview, layoutVariantId, globalConfig, playbookType]);
268
255
  const bffFbReport = useCallback(({ eventName, product }) => {
269
- var _a, _b, _c, _d, _e, _f;
256
+ var _a, _b, _c, _d, _e;
270
257
  if (!enableReportEvent ||
271
258
  !enabledMetaConversionApi ||
272
259
  (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) ||
@@ -278,7 +265,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
278
265
  const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
279
266
  const fix_par = {
280
267
  event_source_url: (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href,
281
- external_id: fakeUserId,
268
+ external_id: storeAndLoadFeUserId(),
282
269
  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 : '',
283
270
  fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
284
271
  fbp: getCookie('_fbp') ? `fb.2.${new Date().getTime()}.${getCookie('_fbp')}` : '',
@@ -330,30 +317,22 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
330
317
  }
331
318
  };
332
319
  getEventParams(jsonParams);
333
- 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}`, {
320
+ return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/fb/events', {
334
321
  method: 'POST',
335
322
  body: jsonParams,
336
323
  type: 'beacon'
337
324
  });
338
- }, [
339
- bffFetch,
340
- enableReportEvent,
341
- enabledMetaConversionApi,
342
- globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
343
- globalConfig,
344
- fakeUserId,
345
- bffDataSource
346
- ]);
325
+ }, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview, globalConfig]);
347
326
  const bffMutateLike = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
348
- const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/like', { method: 'POST', body }));
327
+ const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/like', { method: 'POST', body }));
349
328
  return res === null || res === void 0 ? void 0 : res.success;
350
329
  }), [bffFetch]);
351
330
  const bffMutateUnlike = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
352
- const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/unlike', { method: 'POST', body }));
331
+ const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/unlike', { method: 'POST', body }));
353
332
  return res === null || res === void 0 ? void 0 : res.success;
354
333
  }), [bffFetch]);
355
334
  const bffSubmitForm = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
356
- const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/customform', { method: 'POST', body }));
335
+ const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/customform', { method: 'POST', body }));
357
336
  return res === null || res === void 0 ? void 0 : res.success;
358
337
  }), [bffFetch]);
359
338
  const bffGetTagList = useCallback((data) => __awaiter(void 0, void 0, void 0, function* () {
@@ -367,7 +346,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
367
346
  const key = val.split('=')[0];
368
347
  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);
369
348
  })) === null || _9 === void 0 ? void 0 : _9.join('&')) !== null && _10 !== void 0 ? _10 : '';
370
- const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
349
+ const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
371
350
  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 : []);
372
351
  }
373
352
  catch (e) {
@@ -441,10 +420,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
441
420
  let curData;
442
421
  let gldata;
443
422
  if (data === null || data === void 0 ? void 0 : data.layoutVariantId) {
444
- layId = data === null || data === void 0 ? void 0 : data.layoutVariantId;
445
- setLayoutVariantId(data === null || data === void 0 ? void 0 : data.layoutVariantId);
446
423
  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];
447
424
  if (id) {
425
+ layId = id;
426
+ setLayoutVariantId(id);
448
427
  curData = dataList === null || dataList === void 0 ? void 0 : dataList.find((item) => (item === null || item === void 0 ? void 0 : item.id) === id);
449
428
  if (curData) {
450
429
  setPageData(curData);
@@ -32,16 +32,14 @@ export const getBgStyleByImg = (data) => {
32
32
  };
33
33
  export const getPriceText = ({ product, enableFormattedPrice, globalConfig, isHiddenDef, style }) => {
34
34
  var _a, _b, _c, _d, _e, _f, _g, _h;
35
- let text = '';
36
35
  if ((!(product === null || product === void 0 ? void 0 : product.currency) || !(product === null || product === void 0 ? void 0 : product.price)) && isHiddenDef)
37
36
  return null;
38
- 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);
39
- if (typeof price !== 'number')
40
- return text;
37
+ 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;
38
+ let text = '';
41
39
  let priceSymbol = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.priceSymbol;
42
40
  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 : '' : '$';
43
41
  const isToLocStr = enableFormattedPrice === undefined || enableFormattedPrice;
44
- let decPic = price === null || price === void 0 ? void 0 : price.toString();
42
+ let decPic = price.toString();
45
43
  if (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.showTwoDecimalPoint) {
46
44
  decPic = price === null || price === void 0 ? void 0 : price.toFixed(2);
47
45
  }
@@ -12,10 +12,6 @@ export interface IIframeProps {
12
12
  submitButtonStyle?: CSSProperties;
13
13
  contentStyle?: CSSProperties;
14
14
  isTel?: boolean;
15
- iframe?: {
16
- src?: string;
17
- allow?: string;
18
- };
19
15
  }
20
16
  declare const _default: React.NamedExoticComponent<IIframeProps>;
21
17
  export default _default;
@@ -5,12 +5,11 @@ import './index.less';
5
5
  import { useSxpDataSource } from '../../../../core/hooks';
6
6
  const Iframe = (_a) => {
7
7
  var _b, _c;
8
- var { content, btnText, style, icon, isPopup, isExternalLink, onClose, onClick, submitButtonStyle, contentStyle, isTel, iframe } = _a, props = __rest(_a, ["content", "btnText", "style", "icon", "isPopup", "isExternalLink", "onClose", "onClick", "submitButtonStyle", "contentStyle", "isTel", "iframe"]);
8
+ var { content, btnText, style, icon, isPopup, isExternalLink, onClose, onClick, submitButtonStyle, contentStyle, isTel } = _a, props = __rest(_a, ["content", "btnText", "style", "icon", "isPopup", "isExternalLink", "onClose", "onClick", "submitButtonStyle", "contentStyle", "isTel"]);
9
9
  const { popupDetailData } = useSxpDataSource();
10
- const { src, allow } = iframe || {};
11
- 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);
12
- return (React.createElement("div", Object.assign({ className: `${css(Object.assign(Object.assign({}, style), { overflow: 'hidden' }))}` }, props),
13
- React.createElement("iframe", { src: iframeUrl, allow: allow, scrolling: 'no', style: {
10
+ 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;
11
+ return (React.createElement("div", Object.assign({ className: `${css(Object.assign({}, style))}` }, props),
12
+ React.createElement("iframe", { src: iframeUrl, style: {
14
13
  width: '100%',
15
14
  height: 'calc(100% - 50px)',
16
15
  marginTop: '50px',
@@ -8,20 +8,5 @@ export default [
8
8
  name: ['style', 'backgroundColor']
9
9
  }
10
10
  ]
11
- },
12
- {
13
- title: 'iframe',
14
- child: [
15
- {
16
- type: 'TextArea',
17
- label: 'url',
18
- name: ['props', 'iframe', 'src']
19
- },
20
- {
21
- type: 'TextArea',
22
- label: 'allow',
23
- name: ['props', 'iframe', 'allow']
24
- }
25
- ]
26
11
  }
27
12
  ];
@@ -102,32 +102,29 @@ 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]);
131
128
  const getRecommendVideos = (0, react_1.useCallback)((query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
132
129
  var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
133
130
  query = {
@@ -164,7 +161,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
164
161
  const recurveRecList = (query) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
165
162
  var _v, _w, _x, _y, _z, _0;
166
163
  query.pageNum = pageNum;
167
- result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/list', { method: 'POST', body: query }));
164
+ result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'POST', body: query }));
168
165
  if (!(result === null || result === void 0 ? void 0 : result.success)) {
169
166
  return undefined;
170
167
  }
@@ -186,7 +183,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
186
183
  if (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) {
187
184
  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
185
  }
189
- const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/list', { method: 'POST', body: query }));
186
+ const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'POST', body: query }));
190
187
  if (!(result === null || result === void 0 ? void 0 : result.success)) {
191
188
  return undefined;
192
189
  }
@@ -236,7 +233,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
236
233
  return expire;
237
234
  }, [data]);
238
235
  const bffEventReport = (0, react_1.useCallback)(({ userInfo, eventInfo, reportLayId = true }) => {
239
- var _a;
240
236
  if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
241
237
  return;
242
238
  }
@@ -253,23 +249,14 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
253
249
  console.log('userInfo:', userInfo);
254
250
  console.log('eventInfo:', ef);
255
251
  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}`, {
252
+ return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/event/report', {
257
253
  method: 'POST',
258
254
  body: { userInfo: realUserInfo, eventInfo: realEventInfo },
259
255
  type: 'beacon'
260
256
  });
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
- ]);
257
+ }, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview, layoutVariantId, globalConfig, playbookType]);
271
258
  const bffFbReport = (0, react_1.useCallback)(({ eventName, product }) => {
272
- var _a, _b, _c, _d, _e, _f;
259
+ var _a, _b, _c, _d, _e;
273
260
  if (!enableReportEvent ||
274
261
  !enabledMetaConversionApi ||
275
262
  (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) ||
@@ -281,7 +268,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
281
268
  const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
282
269
  const fix_par = {
283
270
  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,
271
+ external_id: (0, localStore_1.storeAndLoadFeUserId)(),
285
272
  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
273
  fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
287
274
  fbp: (0, tool_1.getCookie)('_fbp') ? `fb.2.${new Date().getTime()}.${(0, tool_1.getCookie)('_fbp')}` : '',
@@ -333,30 +320,22 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
333
320
  }
334
321
  };
335
322
  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}`, {
323
+ return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/fb/events', {
337
324
  method: 'POST',
338
325
  body: jsonParams,
339
326
  type: 'beacon'
340
327
  });
341
- }, [
342
- bffFetch,
343
- enableReportEvent,
344
- enabledMetaConversionApi,
345
- globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
346
- globalConfig,
347
- fakeUserId,
348
- bffDataSource
349
- ]);
328
+ }, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview, globalConfig]);
350
329
  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 }));
330
+ const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/like', { method: 'POST', body }));
352
331
  return res === null || res === void 0 ? void 0 : res.success;
353
332
  }), [bffFetch]);
354
333
  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 }));
334
+ const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/unlike', { method: 'POST', body }));
356
335
  return res === null || res === void 0 ? void 0 : res.success;
357
336
  }), [bffFetch]);
358
337
  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 }));
338
+ const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/customform', { method: 'POST', body }));
360
339
  return res === null || res === void 0 ? void 0 : res.success;
361
340
  }), [bffFetch]);
362
341
  const bffGetTagList = (0, react_1.useCallback)((data) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
@@ -370,7 +349,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
370
349
  const key = val.split('=')[0];
371
350
  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
351
  })) === 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) } }));
352
+ const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
374
353
  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
354
  }
376
355
  catch (e) {
@@ -444,10 +423,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
444
423
  let curData;
445
424
  let gldata;
446
425
  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
426
  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
427
  if (id) {
428
+ layId = id;
429
+ setLayoutVariantId(id);
451
430
  curData = dataList === null || dataList === void 0 ? void 0 : dataList.find((item) => (item === null || item === void 0 ? void 0 : item.id) === id);
452
431
  if (curData) {
453
432
  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
  }
@@ -12,10 +12,6 @@ export interface IIframeProps {
12
12
  submitButtonStyle?: CSSProperties;
13
13
  contentStyle?: CSSProperties;
14
14
  isTel?: boolean;
15
- iframe?: {
16
- src?: string;
17
- allow?: string;
18
- };
19
15
  }
20
16
  declare const _default: React.NamedExoticComponent<IIframeProps>;
21
17
  export default _default;
@@ -7,12 +7,11 @@ 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, iframe } = _a, props = tslib_1.__rest(_a, ["content", "btnText", "style", "icon", "isPopup", "isExternalLink", "onClose", "onClick", "submitButtonStyle", "contentStyle", "isTel", "iframe"]);
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"]);
11
11
  const { popupDetailData } = (0, hooks_1.useSxpDataSource)();
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: {
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: {
16
15
  width: '100%',
17
16
  height: 'calc(100% - 50px)',
18
17
  marginTop: '50px',
@@ -10,20 +10,5 @@ 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
- ]
28
13
  }
29
14
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.13.1",
3
+ "version": "1.13.3",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",