pb-sxp-ui 1.4.3 → 1.5.0

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 (91) hide show
  1. package/dist/index.cjs +172 -130
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +172 -130
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.cjs +3 -3
  6. package/dist/index.min.cjs.map +1 -1
  7. package/dist/index.min.js +3 -3
  8. package/dist/index.min.js.map +1 -1
  9. package/dist/pb-ui.js +172 -130
  10. package/dist/pb-ui.js.map +1 -1
  11. package/dist/pb-ui.min.js +3 -3
  12. package/dist/pb-ui.min.js.map +1 -1
  13. package/es/core/components/SxpPageRender/WaterFall/List.js +7 -15
  14. package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +7 -15
  15. package/es/core/components/SxpPageRender/index.d.ts +6 -0
  16. package/es/core/components/SxpPageRender/index.js +2 -0
  17. package/es/core/context/SxpDataSourceProvider.js +2 -0
  18. package/es/core/utils/materials.d.ts +7 -0
  19. package/es/core/utils/materials.js +47 -0
  20. package/es/materials/sxp/HashTag/settingRender.d.ts +5 -0
  21. package/es/materials/sxp/HashTag/settingRender.js +2 -1
  22. package/es/materials/sxp/cta/AniLink/interactionRender.d.ts +1 -0
  23. package/es/materials/sxp/cta/AniLink/interactionRender.js +2 -1
  24. package/es/materials/sxp/cta/AniLinkPopup/interactionRender.d.ts +1 -0
  25. package/es/materials/sxp/cta/AniLinkPopup/interactionRender.js +2 -1
  26. package/es/materials/sxp/popup/CommodityDetail/index.js +7 -15
  27. package/es/materials/sxp/popup/CommodityDetail/settingRender.d.ts +9 -0
  28. package/es/materials/sxp/popup/CommodityDetail/settingRender.js +6 -3
  29. package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +7 -15
  30. package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +8 -0
  31. package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +6 -3
  32. package/es/materials/sxp/popup/CommodityList/index.js +9 -15
  33. package/es/materials/sxp/popup/CommodityList/settingRender.d.ts +5 -0
  34. package/es/materials/sxp/popup/CommodityList/settingRender.js +2 -1
  35. package/es/materials/sxp/template/Appoint/interactionRender.d.ts +1 -0
  36. package/es/materials/sxp/template/Appoint/interactionRender.js +2 -1
  37. package/es/materials/sxp/template/Commodity/interactionRender.d.ts +1 -0
  38. package/es/materials/sxp/template/Commodity/interactionRender.js +2 -1
  39. package/es/materials/sxp/template/CommodityDiro/interactionRender.d.ts +1 -0
  40. package/es/materials/sxp/template/CommodityDiro/interactionRender.js +2 -1
  41. package/es/materials/sxp/template/CommodityDiroNew/interactionRender.d.ts +1 -0
  42. package/es/materials/sxp/template/CommodityDiroNew/interactionRender.js +2 -1
  43. package/es/materials/sxp/template/Link/interactionRender.d.ts +1 -0
  44. package/es/materials/sxp/template/Link/interactionRender.js +2 -1
  45. package/es/materials/sxp/template/Link/material.js +1 -1
  46. package/es/materials/sxp/template/MultiCommodity/interactionRender.d.ts +1 -0
  47. package/es/materials/sxp/template/MultiCommodity/interactionRender.js +2 -1
  48. package/es/materials/sxp/template/MultiCommodityDiro/interactionRender.d.ts +1 -0
  49. package/es/materials/sxp/template/MultiCommodityDiro/interactionRender.js +2 -1
  50. package/es/materials/sxp/template/MultiCommodityDiroNew/interactionRender.d.ts +1 -0
  51. package/es/materials/sxp/template/MultiCommodityDiroNew/interactionRender.js +2 -1
  52. package/lib/core/components/SxpPageRender/WaterFall/List.js +7 -15
  53. package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +7 -15
  54. package/lib/core/components/SxpPageRender/index.d.ts +6 -0
  55. package/lib/core/components/SxpPageRender/index.js +2 -0
  56. package/lib/core/context/SxpDataSourceProvider.js +2 -0
  57. package/lib/core/utils/materials.d.ts +7 -0
  58. package/lib/core/utils/materials.js +49 -1
  59. package/lib/materials/sxp/HashTag/settingRender.d.ts +5 -0
  60. package/lib/materials/sxp/HashTag/settingRender.js +2 -1
  61. package/lib/materials/sxp/cta/AniLink/interactionRender.d.ts +1 -0
  62. package/lib/materials/sxp/cta/AniLink/interactionRender.js +2 -1
  63. package/lib/materials/sxp/cta/AniLinkPopup/interactionRender.d.ts +1 -0
  64. package/lib/materials/sxp/cta/AniLinkPopup/interactionRender.js +2 -1
  65. package/lib/materials/sxp/popup/CommodityDetail/index.js +7 -15
  66. package/lib/materials/sxp/popup/CommodityDetail/settingRender.d.ts +9 -0
  67. package/lib/materials/sxp/popup/CommodityDetail/settingRender.js +6 -3
  68. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +7 -15
  69. package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +8 -0
  70. package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +6 -3
  71. package/lib/materials/sxp/popup/CommodityList/index.js +9 -15
  72. package/lib/materials/sxp/popup/CommodityList/settingRender.d.ts +5 -0
  73. package/lib/materials/sxp/popup/CommodityList/settingRender.js +2 -1
  74. package/lib/materials/sxp/template/Appoint/interactionRender.d.ts +1 -0
  75. package/lib/materials/sxp/template/Appoint/interactionRender.js +2 -1
  76. package/lib/materials/sxp/template/Commodity/interactionRender.d.ts +1 -0
  77. package/lib/materials/sxp/template/Commodity/interactionRender.js +2 -1
  78. package/lib/materials/sxp/template/CommodityDiro/interactionRender.d.ts +1 -0
  79. package/lib/materials/sxp/template/CommodityDiro/interactionRender.js +2 -1
  80. package/lib/materials/sxp/template/CommodityDiroNew/interactionRender.d.ts +1 -0
  81. package/lib/materials/sxp/template/CommodityDiroNew/interactionRender.js +2 -1
  82. package/lib/materials/sxp/template/Link/interactionRender.d.ts +1 -0
  83. package/lib/materials/sxp/template/Link/interactionRender.js +2 -1
  84. package/lib/materials/sxp/template/Link/material.js +1 -1
  85. package/lib/materials/sxp/template/MultiCommodity/interactionRender.d.ts +1 -0
  86. package/lib/materials/sxp/template/MultiCommodity/interactionRender.js +2 -1
  87. package/lib/materials/sxp/template/MultiCommodityDiro/interactionRender.d.ts +1 -0
  88. package/lib/materials/sxp/template/MultiCommodityDiro/interactionRender.js +2 -1
  89. package/lib/materials/sxp/template/MultiCommodityDiroNew/interactionRender.d.ts +1 -0
  90. package/lib/materials/sxp/template/MultiCommodityDiroNew/interactionRender.js +2 -1
  91. package/package.json +1 -1
@@ -7,10 +7,11 @@ import { useSxpDataSource } from '../../../../core/hooks';
7
7
  import { css } from '@emotion/css';
8
8
  import { setFontForText } from '../../../../core/utils/tool';
9
9
  import { useEventReport } from '../../../../core/hooks/useEventReport';
10
+ import { getPriceText } from '../../../../core/utils/materials';
10
11
  const WaterfallFlowItem = (props) => {
11
12
  var _a;
12
13
  const { rec, index, list, reportTagsView, textStyles, space } = props;
13
- const { swiperRef, setRtcList, setOpenHashtag, sxpParameter } = useSxpDataSource();
14
+ const { swiperRef, setRtcList, setOpenHashtag, sxpParameter, globalConfig } = useSxpDataSource();
14
15
  const [showVideo, setShowVideo] = useState(false);
15
16
  const imgDom = useRef(null);
16
17
  const ref = useRef(null);
@@ -36,20 +37,11 @@ const WaterfallFlowItem = (props) => {
36
37
  var _a, _b;
37
38
  return ((_a = rec === null || rec === void 0 ? void 0 : rec.product) === null || _a === void 0 ? void 0 : _a.title) || ((_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.title) || null;
38
39
  }, [rec]);
39
- const priceText = useMemo(() => {
40
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
41
- const isToLocStr = ((_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice) === undefined || ((_b = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _b === void 0 ? void 0 : _b.enableFormattedPrice);
42
- if (((_c = rec === null || rec === void 0 ? void 0 : rec.product) === null || _c === void 0 ? void 0 : _c.currency) && ((_d = rec === null || rec === void 0 ? void 0 : rec.product) === null || _d === void 0 ? void 0 : _d.price)) {
43
- return `${(_h = (_g = (_f = (_e = rec === null || rec === void 0 ? void 0 : rec.product) === null || _e === void 0 ? void 0 : _e.currency) === null || _f === void 0 ? void 0 : _f.split('-')[1]) === null || _g === void 0 ? void 0 : _g.toUpperCase()) !== null && _h !== void 0 ? _h : ''}${isToLocStr
44
- ? (_l = (_k = (_j = rec === null || rec === void 0 ? void 0 : rec.product) === null || _j === void 0 ? void 0 : _j.price) === null || _k === void 0 ? void 0 : _k.toLocaleString('zh', {
45
- minimumFractionDigits: 0
46
- })) !== null && _l !== void 0 ? _l : ''
47
- : (_m = rec === null || rec === void 0 ? void 0 : rec.product) === null || _m === void 0 ? void 0 : _m.price}`;
48
- }
49
- else {
50
- return null;
51
- }
52
- }, [rec, (_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice]);
40
+ const priceText = getPriceText({
41
+ product: rec === null || rec === void 0 ? void 0 : rec.product,
42
+ enableFormattedPrice: (_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice,
43
+ globalConfig
44
+ });
53
45
  useEffect(() => {
54
46
  const observer = new IntersectionObserver((entries) => {
55
47
  entries.forEach((entry) => {
@@ -7,10 +7,11 @@ import FormatImage from '../FormatImage';
7
7
  import { css } from '@emotion/css';
8
8
  import { setFontForText } from '../../../../core/utils/tool';
9
9
  import { useEventReport } from '../../../../core/hooks/useEventReport';
10
+ import { getPriceText } from '../../../../core/utils/materials';
10
11
  const WaterfallFlowItem = (props) => {
11
12
  var _a;
12
13
  const { rec, style = {}, sizeChange = () => { }, unitWidth, index, showBorder, list, reportTagsView, textStyles, space } = props;
13
- const { swiperRef, setRtcList, setOpenHashtag, sxpParameter } = useSxpDataSource();
14
+ const { swiperRef, setRtcList, setOpenHashtag, sxpParameter, globalConfig } = useSxpDataSource();
14
15
  const [showVideo, setShowVideo] = useState(false);
15
16
  const [isLoading, setIsLoading] = useState(false);
16
17
  const [imgInfo, setImgInfo] = useState({
@@ -59,20 +60,11 @@ const WaterfallFlowItem = (props) => {
59
60
  return false;
60
61
  }
61
62
  }, [top, showBorder]);
62
- const priceText = useMemo(() => {
63
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
64
- const isToLocStr = ((_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice) === undefined || ((_b = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _b === void 0 ? void 0 : _b.enableFormattedPrice);
65
- if (((_c = rec === null || rec === void 0 ? void 0 : rec.product) === null || _c === void 0 ? void 0 : _c.currency) && ((_d = rec === null || rec === void 0 ? void 0 : rec.product) === null || _d === void 0 ? void 0 : _d.price)) {
66
- return `${(_h = (_g = (_f = (_e = rec === null || rec === void 0 ? void 0 : rec.product) === null || _e === void 0 ? void 0 : _e.currency) === null || _f === void 0 ? void 0 : _f.split('-')[1]) === null || _g === void 0 ? void 0 : _g.toUpperCase()) !== null && _h !== void 0 ? _h : ''}${isToLocStr
67
- ? (_l = (_k = (_j = rec === null || rec === void 0 ? void 0 : rec.product) === null || _j === void 0 ? void 0 : _j.price) === null || _k === void 0 ? void 0 : _k.toLocaleString('zh', {
68
- minimumFractionDigits: 0
69
- })) !== null && _l !== void 0 ? _l : ''
70
- : (_m = rec === null || rec === void 0 ? void 0 : rec.product) === null || _m === void 0 ? void 0 : _m.price}`;
71
- }
72
- else {
73
- return null;
74
- }
75
- }, [rec, (_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice]);
63
+ const priceText = getPriceText({
64
+ product: rec === null || rec === void 0 ? void 0 : rec.product,
65
+ enableFormattedPrice: (_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice,
66
+ globalConfig
67
+ });
76
68
  useEffect(() => {
77
69
  if (imgDom.current === null || src === '') {
78
70
  return;
@@ -51,6 +51,12 @@ export interface ISxpPageRenderProps {
51
51
  enableSwiperTip?: boolean;
52
52
  logoBar?: any;
53
53
  textUnderlineOffset?: number;
54
+ priceSymbol?: {
55
+ millesimalSymbol?: string;
56
+ decimalPoint?: string;
57
+ currencyPosition?: string;
58
+ showTwoDecimalPoint?: boolean;
59
+ };
54
60
  };
55
61
  descStyle?: CSSProperties;
56
62
  tipText?: {
@@ -192,6 +192,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
192
192
  return null;
193
193
  }
194
194
  });
195
+ if (!(list === null || list === void 0 ? void 0 : list.length))
196
+ return [];
195
197
  return !waterFallData && !isNoMoreData ? list.concat([{ loading: true }]) : list;
196
198
  }, [data, activeIndex, waterFallData, isEditor, isNoMoreData]);
197
199
  const renderLogo = useMemo(() => {
@@ -122,6 +122,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
122
122
  }
123
123
  setLoading(false);
124
124
  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 : []);
125
+ setRtcList(getFilterRecList(Object.assign(Object.assign({}, result.data), { recList: list })));
126
+ setCacheRtcList(getFilterRecList(Object.assign(Object.assign({}, result.data), { recList: list })));
125
127
  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));
126
128
  if (isNotNullList) {
127
129
  pageNum = pageNum + 1;
@@ -1,3 +1,5 @@
1
+ import { ISxpPageRenderProps } from '../components/SxpPageRender';
2
+ import { ProductInfoType } from '../components/SxpPageRender/typing';
1
3
  export declare const getMediaValueByMode: (obj?: Record<string, any>) => any;
2
4
  export declare const getBgStyle: (imgSrc: string) => "" | {
3
5
  backgroundImage: string;
@@ -9,3 +11,8 @@ export declare const getBgStyleByImg: (data: any) => "" | {
9
11
  backgroundRepeat: string;
10
12
  backgroundSize: string;
11
13
  };
14
+ export declare const getPriceText: ({ product, enableFormattedPrice, globalConfig }: {
15
+ product: ProductInfoType | undefined | null;
16
+ enableFormattedPrice: boolean | undefined;
17
+ globalConfig: ISxpPageRenderProps['globalConfig'];
18
+ }) => string;
@@ -29,3 +29,50 @@ export const getBgStyleByImg = (data) => {
29
29
  const imgSrc = typeof bgImg === 'string' ? bgImg : getMediaValueByMode(bgImg);
30
30
  return getBgStyle(imgSrc);
31
31
  };
32
+ export const getPriceText = ({ product, enableFormattedPrice, globalConfig }) => {
33
+ var _a, _b, _c, _d, _e;
34
+ 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;
35
+ let text = '';
36
+ let priceSymbol = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.priceSymbol;
37
+ 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 : '' : '$';
38
+ const isToLocStr = enableFormattedPrice === undefined || enableFormattedPrice || (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.millesimalSymbol) !== 'none';
39
+ let decPic = price.toString();
40
+ if (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.showTwoDecimalPoint) {
41
+ decPic = price === null || price === void 0 ? void 0 : price.toFixed(2);
42
+ }
43
+ let decInd = (_d = decPic === null || decPic === void 0 ? void 0 : decPic.indexOf('.')) !== null && _d !== void 0 ? _d : -1;
44
+ if (isToLocStr) {
45
+ text =
46
+ (_e = price === null || price === void 0 ? void 0 : price.toLocaleString('zh', {
47
+ minimumFractionDigits: (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.showTwoDecimalPoint) ? 2 : 0
48
+ })) !== null && _e !== void 0 ? _e : '';
49
+ let startIndex = 0;
50
+ let endIndex = decInd !== null && decInd !== void 0 ? decInd : text === null || text === void 0 ? void 0 : text.length;
51
+ if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.millesimalSymbol) === '.') {
52
+ text = text === null || text === void 0 ? void 0 : text.replace(/,/g, function (match, index) {
53
+ if (index >= startIndex && index < endIndex) {
54
+ return '.';
55
+ }
56
+ else {
57
+ return match;
58
+ }
59
+ });
60
+ }
61
+ else if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.millesimalSymbol) === ' ') {
62
+ text = text === null || text === void 0 ? void 0 : text.replace(',', ' ');
63
+ }
64
+ }
65
+ else {
66
+ text = `${(priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.showTwoDecimalPoint) ? price === null || price === void 0 ? void 0 : price.toFixed(2) : price}`;
67
+ }
68
+ if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.decimalPoint) === ',' && decInd > 0 && decInd + 1 < (text === null || text === void 0 ? void 0 : text.length)) {
69
+ text = text.slice(0, decInd + 1) + ',' + text.slice(decInd + 2);
70
+ }
71
+ if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) && (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) !== 'none') {
72
+ text = (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) === 'left' ? currency + text : text + currency;
73
+ }
74
+ else if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) !== 'none') {
75
+ text = currency + text;
76
+ }
77
+ return text;
78
+ };
@@ -28,6 +28,7 @@ declare const _default: ({
28
28
  name: string[];
29
29
  initialValue: string;
30
30
  child?: undefined;
31
+ belong?: undefined;
31
32
  } | {
32
33
  type: string;
33
34
  label: string;
@@ -39,6 +40,7 @@ declare const _default: ({
39
40
  options?: undefined;
40
41
  name?: undefined;
41
42
  initialValue?: undefined;
43
+ belong?: undefined;
42
44
  } | {
43
45
  type: string;
44
46
  label: string;
@@ -54,6 +56,7 @@ declare const _default: ({
54
56
  options?: undefined;
55
57
  name?: undefined;
56
58
  initialValue?: undefined;
59
+ belong?: undefined;
57
60
  } | {
58
61
  label: string;
59
62
  type: string;
@@ -61,11 +64,13 @@ declare const _default: ({
61
64
  name?: undefined;
62
65
  initialValue?: undefined;
63
66
  child?: undefined;
67
+ belong?: undefined;
64
68
  } | {
65
69
  label: string;
66
70
  type: string;
67
71
  name: string[];
68
72
  initialValue: boolean;
73
+ belong: string;
69
74
  options?: undefined;
70
75
  child?: undefined;
71
76
  })[];
@@ -108,7 +108,8 @@ export default [
108
108
  label: '价格千分符展示',
109
109
  type: 'Switch',
110
110
  name: ['enableFormattedPrice'],
111
- initialValue: true
111
+ initialValue: true,
112
+ belong: 'price'
112
113
  }
113
114
  ]
114
115
  }
@@ -3,6 +3,7 @@ declare const _default: ({
3
3
  child: {
4
4
  type: string;
5
5
  name: string;
6
+ hiddenUrl: boolean;
6
7
  }[];
7
8
  } | {
8
9
  title: string;
@@ -4,7 +4,8 @@ export default [
4
4
  child: [
5
5
  {
6
6
  type: 'link',
7
- name: 'onClick'
7
+ name: 'onClick',
8
+ hiddenUrl: true
8
9
  }
9
10
  ]
10
11
  },
@@ -3,6 +3,7 @@ declare const _default: ({
3
3
  child: {
4
4
  type: string;
5
5
  name: string;
6
+ hiddenUrl: boolean;
6
7
  }[];
7
8
  } | {
8
9
  title: string;
@@ -4,7 +4,8 @@ export default [
4
4
  child: [
5
5
  {
6
6
  type: 'link',
7
- name: 'onClick'
7
+ name: 'onClick',
8
+ hiddenUrl: true
8
9
  }
9
10
  ]
10
11
  },
@@ -11,10 +11,11 @@ import ExpandableText from '../../../../core/components/SxpPageRender/Expandable
11
11
  import FormatImage from '../../../../core/components/SxpPageRender/FormatImage';
12
12
  import { setFontForText } from '../../../../core/utils/tool';
13
13
  import CommodityGroup from '../../template/components/CommodityGroup';
14
+ import { getPriceText } from '../../../../core/utils/materials';
14
15
  const CommodityDetail = (_a) => {
15
16
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
16
17
  var { content, style, bgImg, onClick, schema, isDefault, bottom_image, tipText, isPost, viewTime, rec, swiper, commodityStyles, buttonStyle, index, commodityGroup, popupBg, iframeIcon, commodityImgRatio, isTel, iframeBgColor } = _a, props = __rest(_a, ["content", "style", "bgImg", "onClick", "schema", "isDefault", "bottom_image", "tipText", "isPost", "viewTime", "rec", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup", "popupBg", "iframeIcon", "commodityImgRatio", "isTel", "iframeBgColor"]);
17
- const { sxpParameter, popupDetailData, isPreview, bffFbReport, popupCurTimeRef, checkCommodityIndexRef } = useSxpDataSource();
18
+ const { sxpParameter, popupDetailData, isPreview, bffFbReport, popupCurTimeRef, checkCommodityIndexRef, globalConfig } = useSxpDataSource();
18
19
  const { jumpToWeb, productView } = useEventReport();
19
20
  const curTimeRef = useRef(null);
20
21
  const [showModal, setShowModal] = useState(false);
@@ -59,20 +60,11 @@ const CommodityDetail = (_a) => {
59
60
  window.removeEventListener('pageshow', initTime);
60
61
  };
61
62
  }, []);
62
- const priceText = useMemo(() => {
63
- var _a, _b, _c, _d, _e, _f, _g;
64
- const isToLocStr = ((_a = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice) === undefined || ((_b = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _b === void 0 ? void 0 : _b.enableFormattedPrice);
65
- if ((product === null || product === void 0 ? void 0 : product.currency) && (product === null || product === void 0 ? void 0 : product.price)) {
66
- return `${(_e = (_d = (_c = product === null || product === void 0 ? void 0 : product.currency) === null || _c === void 0 ? void 0 : _c.split('-')[1]) === null || _d === void 0 ? void 0 : _d.toUpperCase()) !== null && _e !== void 0 ? _e : ''}${isToLocStr
67
- ? (_g = (_f = product === null || product === void 0 ? void 0 : product.price) === null || _f === void 0 ? void 0 : _f.toLocaleString('zh', {
68
- minimumFractionDigits: 0
69
- })) !== null && _g !== void 0 ? _g : ''
70
- : product === null || product === void 0 ? void 0 : product.price}`;
71
- }
72
- else {
73
- return '$7,000';
74
- }
75
- }, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency, (_t = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _t === void 0 ? void 0 : _t.enableFormattedPrice]);
63
+ const priceText = getPriceText({
64
+ product: product,
65
+ enableFormattedPrice: (_t = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _t === void 0 ? void 0 : _t.enableFormattedPrice,
66
+ globalConfig
67
+ });
76
68
  const width = (isPreview ? 375 : (_u = style === null || style === void 0 ? void 0 : style.width) !== null && _u !== void 0 ? _u : window.innerWidth) - ((_v = popupBg === null || popupBg === void 0 ? void 0 : popupBg.horizontalMargin) !== null && _v !== void 0 ? _v : 0) * 2;
77
69
  const height = commodityImgRatio ? width * (commodityImgRatio.h / commodityImgRatio.w) : width;
78
70
  const renderContent = ({ isPost }) => {
@@ -95,6 +95,7 @@ declare const _default: ({
95
95
  name: string[];
96
96
  initialValue: string;
97
97
  child?: undefined;
98
+ belong?: undefined;
98
99
  } | {
99
100
  type: string;
100
101
  child: {
@@ -107,6 +108,7 @@ declare const _default: ({
107
108
  options?: undefined;
108
109
  name?: undefined;
109
110
  initialValue?: undefined;
111
+ belong?: undefined;
110
112
  } | {
111
113
  type: string;
112
114
  label: string;
@@ -118,6 +120,7 @@ declare const _default: ({
118
120
  options?: undefined;
119
121
  name?: undefined;
120
122
  initialValue?: undefined;
123
+ belong?: undefined;
121
124
  } | {
122
125
  type: string;
123
126
  label: string;
@@ -133,6 +136,7 @@ declare const _default: ({
133
136
  options?: undefined;
134
137
  name?: undefined;
135
138
  initialValue?: undefined;
139
+ belong?: undefined;
136
140
  } | {
137
141
  label: string;
138
142
  type: string;
@@ -140,6 +144,7 @@ declare const _default: ({
140
144
  name?: undefined;
141
145
  initialValue?: undefined;
142
146
  child?: undefined;
147
+ belong?: undefined;
143
148
  } | {
144
149
  label: string;
145
150
  type: string;
@@ -147,11 +152,13 @@ declare const _default: ({
147
152
  options?: undefined;
148
153
  initialValue?: undefined;
149
154
  child?: undefined;
155
+ belong?: undefined;
150
156
  } | {
151
157
  label: string;
152
158
  type: string;
153
159
  name: string[];
154
160
  initialValue: boolean;
161
+ belong: string;
155
162
  options?: undefined;
156
163
  child?: undefined;
157
164
  })[];
@@ -238,12 +245,14 @@ declare const _default: ({
238
245
  label: string;
239
246
  name: string[];
240
247
  type: string;
248
+ initialValue: string;
241
249
  addonAfter?: undefined;
242
250
  } | {
243
251
  label: string;
244
252
  name: string[];
245
253
  type: string;
246
254
  addonAfter: string;
255
+ initialValue?: undefined;
247
256
  })[];
248
257
  })[];
249
258
  export default _default;
@@ -217,7 +217,8 @@ export default [
217
217
  label: '价格千分符展示',
218
218
  type: 'Switch',
219
219
  name: ['enableFormattedPrice'],
220
- initialValue: true
220
+ initialValue: true,
221
+ belong: 'price'
221
222
  }
222
223
  ]
223
224
  }
@@ -333,12 +334,14 @@ export default [
333
334
  {
334
335
  label: '背景色',
335
336
  name: ['props', 'swiper', 'dotsBgColor'],
336
- type: 'Color'
337
+ type: 'Color',
338
+ initialValue: 'rgba(0,0,0,.2)'
337
339
  },
338
340
  {
339
341
  label: '选中色',
340
342
  name: ['props', 'swiper', 'dotsActiveColor'],
341
- type: 'Color'
343
+ type: 'Color',
344
+ initialValue: 'rgba(0,0,0,1)'
342
345
  },
343
346
  {
344
347
  label: '底边距',
@@ -11,11 +11,12 @@ import { useEventReport } from '../../../../core/hooks/useEventReport';
11
11
  import FormatImage from '../../../../core/components/SxpPageRender/FormatImage';
12
12
  import { setFontForText } from '../../../../core/utils/tool';
13
13
  import CommodityGroup from '../../template/components/CommodityGroup';
14
+ import { getPriceText } from '../../../../core/utils/materials';
14
15
  const CommodityDetailDiroNew = (_a) => {
15
16
  var _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;
16
17
  var { style, isDefault, rec, viewTime, isPost, bottom_image, tipText, swiper, commodityStyles, buttonStyle, index, commodityGroup, popupBg, iframeIcon, commodityImgRatio, isTel, iframeBgColor } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "tipText", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup", "popupBg", "iframeIcon", "commodityImgRatio", "isTel", "iframeBgColor"]);
17
18
  const [spread, setSpread] = useState(true);
18
- const { sxpParameter, popupCurTimeRef, popupDetailData, isPreview, bffFbReport, checkCommodityIndexRef } = useSxpDataSource();
19
+ const { sxpParameter, popupCurTimeRef, popupDetailData, isPreview, bffFbReport, checkCommodityIndexRef, globalConfig } = useSxpDataSource();
19
20
  const { jumpToWeb, productView } = useEventReport();
20
21
  const [stopSlide, setStopSlide] = useState(false);
21
22
  const [isBottom, setIsBottom] = useState(false);
@@ -63,20 +64,11 @@ const CommodityDetailDiroNew = (_a) => {
63
64
  window.removeEventListener('pageshow', initTime);
64
65
  };
65
66
  }, []);
66
- const priceText = useMemo(() => {
67
- var _a, _b, _c, _d, _e, _f, _g;
68
- const isToLocStr = ((_a = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice) === undefined || ((_b = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _b === void 0 ? void 0 : _b.enableFormattedPrice);
69
- if ((product === null || product === void 0 ? void 0 : product.currency) && (product === null || product === void 0 ? void 0 : product.price)) {
70
- return `${(_e = (_d = (_c = product === null || product === void 0 ? void 0 : product.currency) === null || _c === void 0 ? void 0 : _c.split('-')[1]) === null || _d === void 0 ? void 0 : _d.toUpperCase()) !== null && _e !== void 0 ? _e : ''}${isToLocStr
71
- ? (_g = (_f = product === null || product === void 0 ? void 0 : product.price) === null || _f === void 0 ? void 0 : _f.toLocaleString('zh', {
72
- minimumFractionDigits: 0
73
- })) !== null && _g !== void 0 ? _g : ''
74
- : product === null || product === void 0 ? void 0 : product.price}`;
75
- }
76
- else {
77
- return '£102,300.00';
78
- }
79
- }, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency, (_t = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _t === void 0 ? void 0 : _t.enableFormattedPrice]);
67
+ const priceText = getPriceText({
68
+ product,
69
+ enableFormattedPrice: (_t = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _t === void 0 ? void 0 : _t.enableFormattedPrice,
70
+ globalConfig
71
+ });
80
72
  const width = (isPreview ? 375 : (_u = style === null || style === void 0 ? void 0 : style.width) !== null && _u !== void 0 ? _u : window.innerWidth) - ((_v = popupBg === null || popupBg === void 0 ? void 0 : popupBg.horizontalMargin) !== null && _v !== void 0 ? _v : 0) * 2;
81
73
  const height = commodityImgRatio ? width * (commodityImgRatio.h / commodityImgRatio.w) : width;
82
74
  const handleClickCollapse = () => {
@@ -95,6 +95,7 @@ declare const _default: ({
95
95
  name: string[];
96
96
  initialValue: string;
97
97
  child?: undefined;
98
+ belong?: undefined;
98
99
  } | {
99
100
  type: string;
100
101
  label: string;
@@ -106,6 +107,7 @@ declare const _default: ({
106
107
  options?: undefined;
107
108
  name?: undefined;
108
109
  initialValue?: undefined;
110
+ belong?: undefined;
109
111
  } | {
110
112
  type: string;
111
113
  label: string;
@@ -121,6 +123,7 @@ declare const _default: ({
121
123
  options?: undefined;
122
124
  name?: undefined;
123
125
  initialValue?: undefined;
126
+ belong?: undefined;
124
127
  } | {
125
128
  label: string;
126
129
  type: string;
@@ -128,6 +131,7 @@ declare const _default: ({
128
131
  name?: undefined;
129
132
  initialValue?: undefined;
130
133
  child?: undefined;
134
+ belong?: undefined;
131
135
  } | {
132
136
  label: string;
133
137
  type: string;
@@ -135,11 +139,13 @@ declare const _default: ({
135
139
  options?: undefined;
136
140
  initialValue?: undefined;
137
141
  child?: undefined;
142
+ belong?: undefined;
138
143
  } | {
139
144
  label: string;
140
145
  type: string;
141
146
  name: string[];
142
147
  initialValue: boolean;
148
+ belong: string;
143
149
  options?: undefined;
144
150
  child?: undefined;
145
151
  })[];
@@ -226,12 +232,14 @@ declare const _default: ({
226
232
  label: string;
227
233
  name: string[];
228
234
  type: string;
235
+ initialValue: string;
229
236
  addonAfter?: undefined;
230
237
  } | {
231
238
  label: string;
232
239
  name: string[];
233
240
  type: string;
234
241
  addonAfter: string;
242
+ initialValue?: undefined;
235
243
  })[];
236
244
  })[];
237
245
  export default _default;
@@ -200,7 +200,8 @@ export default [
200
200
  label: '价格千分符展示',
201
201
  type: 'Switch',
202
202
  name: ['enableFormattedPrice'],
203
- initialValue: true
203
+ initialValue: true,
204
+ belong: 'price'
204
205
  }
205
206
  ]
206
207
  }
@@ -316,12 +317,14 @@ export default [
316
317
  {
317
318
  label: '背景色',
318
319
  name: ['props', 'swiper', 'dotsBgColor'],
319
- type: 'Color'
320
+ type: 'Color',
321
+ initialValue: 'rgba(0,0,0,.2)'
320
322
  },
321
323
  {
322
324
  label: '选中色',
323
325
  name: ['props', 'swiper', 'dotsActiveColor'],
324
- type: 'Color'
326
+ type: 'Color',
327
+ initialValue: 'rgba(0,0,0,1)'
325
328
  },
326
329
  {
327
330
  label: '底边距',
@@ -7,30 +7,24 @@ import { useEventReport } from '../../../../core/hooks/useEventReport';
7
7
  import { setFontForText } from '../../../../core/utils/tool';
8
8
  import Img from '../../template/components/Img';
9
9
  import { throttle } from 'lodash';
10
+ import { getPriceText } from '../../../../core/utils/materials';
10
11
  const CommodityList = (_a) => {
11
12
  var _b, _c, _d;
12
13
  var { style, isDefault, rec, viewTime, isPost, bottom_image, commodityStyles, buttonStyle, translateY = 0, commodityPicture, isExternalLink, onClick } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "commodityStyles", "buttonStyle", "translateY", "commodityPicture", "isExternalLink", "onClick"]);
13
- const { sxpParameter, popupDetailData, setPopupDetailData, ctaEvent } = useSxpDataSource();
14
+ const { sxpParameter, popupDetailData, setPopupDetailData, ctaEvent, globalConfig } = useSxpDataSource();
14
15
  const { jumpToWeb } = useEventReport();
15
16
  const { popup } = useEditor();
16
17
  const recData = isPost ? rec : popupDetailData;
17
18
  const product = (_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProducts) !== null && _c !== void 0 ? _c : [null, null, null, null];
18
19
  const index = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index;
19
20
  const priceText = useCallback((product) => {
20
- var _a, _b, _c, _d, _e, _f, _g;
21
- const isToLocStr = ((_a = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice) === undefined || ((_b = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _b === void 0 ? void 0 : _b.enableFormattedPrice);
22
- if ((product === null || product === void 0 ? void 0 : product.currency) && (product === null || product === void 0 ? void 0 : product.price)) {
23
- return `${(_e = (_d = (_c = product === null || product === void 0 ? void 0 : product.currency) === null || _c === void 0 ? void 0 : _c.split('-')[1]) === null || _d === void 0 ? void 0 : _d.toUpperCase()) !== null && _e !== void 0 ? _e : ''}${isToLocStr
24
- ? (_g = (_f = product === null || product === void 0 ? void 0 : product.price) === null || _f === void 0 ? void 0 : _f.toLocaleString('zh', {
25
- minimumFractionDigits: 0
26
- })) !== null && _g !== void 0 ? _g : ''
27
- : product === null || product === void 0 ? void 0 : product.price}`;
28
- }
29
- else {
30
- const p = 7000;
31
- return `$${isToLocStr ? p === null || p === void 0 ? void 0 : p.toLocaleString() : p}`;
32
- }
33
- }, [(_d = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _d === void 0 ? void 0 : _d.enableFormattedPrice]);
21
+ var _a;
22
+ return getPriceText({
23
+ product,
24
+ enableFormattedPrice: (_a = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice,
25
+ globalConfig
26
+ });
27
+ }, [(_d = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _d === void 0 ? void 0 : _d.enableFormattedPrice, globalConfig]);
34
28
  const handleClick = throttle((item, multiCheckIndex) => {
35
29
  ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
36
30
  eventSubject: 'clickCta',
@@ -62,6 +62,7 @@ declare const _default: ({
62
62
  name: string[];
63
63
  initialValue: string;
64
64
  child?: undefined;
65
+ belong?: undefined;
65
66
  } | {
66
67
  type: string;
67
68
  label: string;
@@ -73,6 +74,7 @@ declare const _default: ({
73
74
  options?: undefined;
74
75
  name?: undefined;
75
76
  initialValue?: undefined;
77
+ belong?: undefined;
76
78
  } | {
77
79
  type: string;
78
80
  label: string;
@@ -88,6 +90,7 @@ declare const _default: ({
88
90
  options?: undefined;
89
91
  name?: undefined;
90
92
  initialValue?: undefined;
93
+ belong?: undefined;
91
94
  } | {
92
95
  label: string;
93
96
  type: string;
@@ -95,11 +98,13 @@ declare const _default: ({
95
98
  name?: undefined;
96
99
  initialValue?: undefined;
97
100
  child?: undefined;
101
+ belong?: undefined;
98
102
  } | {
99
103
  label: string;
100
104
  type: string;
101
105
  name: string[];
102
106
  initialValue: boolean;
107
+ belong: string;
103
108
  options?: undefined;
104
109
  child?: undefined;
105
110
  })[];
@@ -140,7 +140,8 @@ export default [
140
140
  label: '价格千分符展示',
141
141
  type: 'Switch',
142
142
  name: ['enableFormattedPrice'],
143
- initialValue: true
143
+ initialValue: true,
144
+ belong: 'price'
144
145
  }
145
146
  ]
146
147
  }
@@ -3,6 +3,7 @@ declare const _default: {
3
3
  child: {
4
4
  type: string;
5
5
  name: string;
6
+ hiddenUrl: boolean;
6
7
  }[];
7
8
  }[];
8
9
  export default _default;