pb-sxp-ui 1.4.4 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/index.cjs +171 -125
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +171 -125
  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 +171 -125
  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 +54 -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 +7 -0
  28. package/es/materials/sxp/popup/CommodityDetail/settingRender.js +2 -1
  29. package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +7 -15
  30. package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +6 -0
  31. package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +2 -1
  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 +56 -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 +7 -0
  67. package/lib/materials/sxp/popup/CommodityDetail/settingRender.js +2 -1
  68. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +7 -15
  69. package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +6 -0
  70. package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +2 -1
  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
@@ -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;
@@ -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
  export default _default;
@@ -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
  }
@@ -5,7 +5,7 @@ import LinkComponent from '.';
5
5
  import { createMaterial } from '../../../../core/create';
6
6
  import interactionRender from './interactionRender';
7
7
  const Link = createMaterial(LinkComponent, {
8
- displayName: '跳转指引',
8
+ displayName: '普通CTA',
9
9
  icon: '',
10
10
  category: 'template',
11
11
  type: 'Link',
@@ -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;
@@ -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
  export default _default;
@@ -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
  export default _default;
@@ -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
  }
@@ -9,10 +9,11 @@ const hooks_1 = require("../../../../core/hooks");
9
9
  const css_1 = require("@emotion/css");
10
10
  const tool_1 = require("../../../../core/utils/tool");
11
11
  const useEventReport_1 = require("../../../../core/hooks/useEventReport");
12
+ const materials_1 = require("../../../../core/utils/materials");
12
13
  const WaterfallFlowItem = (props) => {
13
14
  var _a;
14
15
  const { rec, index, list, reportTagsView, textStyles, space } = props;
15
- const { swiperRef, setRtcList, setOpenHashtag, sxpParameter } = (0, hooks_1.useSxpDataSource)();
16
+ const { swiperRef, setRtcList, setOpenHashtag, sxpParameter, globalConfig } = (0, hooks_1.useSxpDataSource)();
16
17
  const [showVideo, setShowVideo] = (0, react_1.useState)(false);
17
18
  const imgDom = (0, react_1.useRef)(null);
18
19
  const ref = (0, react_1.useRef)(null);
@@ -38,20 +39,11 @@ const WaterfallFlowItem = (props) => {
38
39
  var _a, _b;
39
40
  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;
40
41
  }, [rec]);
41
- const priceText = (0, react_1.useMemo)(() => {
42
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
43
- 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);
44
- 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)) {
45
- 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
46
- ? (_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', {
47
- minimumFractionDigits: 0
48
- })) !== null && _l !== void 0 ? _l : ''
49
- : (_m = rec === null || rec === void 0 ? void 0 : rec.product) === null || _m === void 0 ? void 0 : _m.price}`;
50
- }
51
- else {
52
- return null;
53
- }
54
- }, [rec, (_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice]);
42
+ const priceText = (0, materials_1.getPriceText)({
43
+ product: rec === null || rec === void 0 ? void 0 : rec.product,
44
+ enableFormattedPrice: (_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice,
45
+ globalConfig
46
+ });
55
47
  (0, react_1.useEffect)(() => {
56
48
  const observer = new IntersectionObserver((entries) => {
57
49
  entries.forEach((entry) => {
@@ -9,10 +9,11 @@ const FormatImage_1 = tslib_1.__importDefault(require("../FormatImage"));
9
9
  const css_1 = require("@emotion/css");
10
10
  const tool_1 = require("../../../../core/utils/tool");
11
11
  const useEventReport_1 = require("../../../../core/hooks/useEventReport");
12
+ const materials_1 = require("../../../../core/utils/materials");
12
13
  const WaterfallFlowItem = (props) => {
13
14
  var _a;
14
15
  const { rec, style = {}, sizeChange = () => { }, unitWidth, index, showBorder, list, reportTagsView, textStyles, space } = props;
15
- const { swiperRef, setRtcList, setOpenHashtag, sxpParameter } = (0, hooks_1.useSxpDataSource)();
16
+ const { swiperRef, setRtcList, setOpenHashtag, sxpParameter, globalConfig } = (0, hooks_1.useSxpDataSource)();
16
17
  const [showVideo, setShowVideo] = (0, react_1.useState)(false);
17
18
  const [isLoading, setIsLoading] = (0, react_1.useState)(false);
18
19
  const [imgInfo, setImgInfo] = (0, react_1.useState)({
@@ -61,20 +62,11 @@ const WaterfallFlowItem = (props) => {
61
62
  return false;
62
63
  }
63
64
  }, [top, showBorder]);
64
- const priceText = (0, react_1.useMemo)(() => {
65
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
66
- 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);
67
- 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)) {
68
- 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
69
- ? (_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', {
70
- minimumFractionDigits: 0
71
- })) !== null && _l !== void 0 ? _l : ''
72
- : (_m = rec === null || rec === void 0 ? void 0 : rec.product) === null || _m === void 0 ? void 0 : _m.price}`;
73
- }
74
- else {
75
- return null;
76
- }
77
- }, [rec, (_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice]);
65
+ const priceText = (0, materials_1.getPriceText)({
66
+ product: rec === null || rec === void 0 ? void 0 : rec.product,
67
+ enableFormattedPrice: (_a = textStyles === null || textStyles === void 0 ? void 0 : textStyles.price) === null || _a === void 0 ? void 0 : _a.enableFormattedPrice,
68
+ globalConfig
69
+ });
78
70
  (0, react_1.useEffect)(() => {
79
71
  if (imgDom.current === null || src === '') {
80
72
  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?: {
@@ -195,6 +195,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
195
195
  return null;
196
196
  }
197
197
  });
198
+ if (!(list === null || list === void 0 ? void 0 : list.length))
199
+ return [];
198
200
  return !waterFallData && !isNoMoreData ? list.concat([{ loading: true }]) : list;
199
201
  }, [data, activeIndex, waterFallData, isEditor, isNoMoreData]);
200
202
  const renderLogo = (0, react_1.useMemo)(() => {
@@ -125,6 +125,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
125
125
  }
126
126
  setLoading(false);
127
127
  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 : []);
128
+ setRtcList(getFilterRecList(Object.assign(Object.assign({}, result.data), { recList: list })));
129
+ setCacheRtcList(getFilterRecList(Object.assign(Object.assign({}, result.data), { recList: list })));
128
130
  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));
129
131
  if (isNotNullList) {
130
132
  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;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBgStyleByImg = exports.getBgStyle = exports.getMediaValueByMode = void 0;
3
+ exports.getPriceText = exports.getBgStyleByImg = exports.getBgStyle = exports.getMediaValueByMode = void 0;
4
4
  const getMediaValueByMode = (obj) => {
5
5
  var _a;
6
6
  if (!obj || typeof obj !== 'object') {
@@ -35,3 +35,58 @@ const getBgStyleByImg = (data) => {
35
35
  return (0, exports.getBgStyle)(imgSrc);
36
36
  };
37
37
  exports.getBgStyleByImg = getBgStyleByImg;
38
+ const getPriceText = ({ product, enableFormattedPrice, globalConfig }) => {
39
+ var _a, _b, _c, _d, _e;
40
+ 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;
41
+ let text = '';
42
+ let priceSymbol = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.priceSymbol;
43
+ 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 : '' : '$';
44
+ const isToLocStr = enableFormattedPrice === undefined || enableFormattedPrice;
45
+ let decPic = price.toString();
46
+ if (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.showTwoDecimalPoint) {
47
+ decPic = price === null || price === void 0 ? void 0 : price.toFixed(2);
48
+ }
49
+ let decInd = (_d = decPic === null || decPic === void 0 ? void 0 : decPic.indexOf('.')) !== null && _d !== void 0 ? _d : -1;
50
+ if (isToLocStr) {
51
+ text =
52
+ (_e = price === null || price === void 0 ? void 0 : price.toLocaleString('zh', {
53
+ minimumFractionDigits: (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.showTwoDecimalPoint) ? 2 : 0
54
+ })) !== null && _e !== void 0 ? _e : '';
55
+ let startIndex = 0;
56
+ let endIndex = decInd !== null && decInd !== void 0 ? decInd : text === null || text === void 0 ? void 0 : text.length;
57
+ if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.millesimalSymbol) === '.') {
58
+ text = text === null || text === void 0 ? void 0 : text.replace(/\,/g, function (match, index) {
59
+ if (index >= startIndex && index < endIndex) {
60
+ return '.';
61
+ }
62
+ else {
63
+ return match;
64
+ }
65
+ });
66
+ }
67
+ else if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.millesimalSymbol) === ' ') {
68
+ text = text === null || text === void 0 ? void 0 : text.replace(',', ' ');
69
+ }
70
+ }
71
+ else {
72
+ text = `${(priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.showTwoDecimalPoint) ? price === null || price === void 0 ? void 0 : price.toFixed(2) : price}`;
73
+ }
74
+ if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.decimalPoint) === ',' && decInd > 0) {
75
+ text = text = text === null || text === void 0 ? void 0 : text.replace(/\./g, function (match, index) {
76
+ if (index >= decInd && index < (text === null || text === void 0 ? void 0 : text.length)) {
77
+ return ',';
78
+ }
79
+ else {
80
+ return match;
81
+ }
82
+ });
83
+ }
84
+ if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) && (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) !== 'none') {
85
+ text = (priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) === 'left' ? currency + text : text + currency;
86
+ }
87
+ else if ((priceSymbol === null || priceSymbol === void 0 ? void 0 : priceSymbol.currencyPosition) !== 'none') {
88
+ text = currency + text;
89
+ }
90
+ return text;
91
+ };
92
+ exports.getPriceText = getPriceText;
@@ -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
  })[];
@@ -110,7 +110,8 @@ exports.default = [
110
110
  label: '价格千分符展示',
111
111
  type: 'Switch',
112
112
  name: ['enableFormattedPrice'],
113
- initialValue: true
113
+ initialValue: true,
114
+ belong: 'price'
114
115
  }
115
116
  ]
116
117
  }
@@ -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;
@@ -6,7 +6,8 @@ exports.default = [
6
6
  child: [
7
7
  {
8
8
  type: 'link',
9
- name: 'onClick'
9
+ name: 'onClick',
10
+ hiddenUrl: true
10
11
  }
11
12
  ]
12
13
  },
@@ -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;
@@ -6,7 +6,8 @@ exports.default = [
6
6
  child: [
7
7
  {
8
8
  type: 'link',
9
- name: 'onClick'
9
+ name: 'onClick',
10
+ hiddenUrl: true
10
11
  }
11
12
  ]
12
13
  },
@@ -13,10 +13,11 @@ const ExpandableText_1 = tslib_1.__importDefault(require("../../../../core/compo
13
13
  const FormatImage_1 = tslib_1.__importDefault(require("../../../../core/components/SxpPageRender/FormatImage"));
14
14
  const tool_1 = require("../../../../core/utils/tool");
15
15
  const CommodityGroup_1 = tslib_1.__importDefault(require("../../template/components/CommodityGroup"));
16
+ const materials_1 = require("../../../../core/utils/materials");
16
17
  const CommodityDetail = (_a) => {
17
18
  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;
18
19
  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 = tslib_1.__rest(_a, ["content", "style", "bgImg", "onClick", "schema", "isDefault", "bottom_image", "tipText", "isPost", "viewTime", "rec", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup", "popupBg", "iframeIcon", "commodityImgRatio", "isTel", "iframeBgColor"]);
19
- const { sxpParameter, popupDetailData, isPreview, bffFbReport, popupCurTimeRef, checkCommodityIndexRef } = (0, hooks_1.useSxpDataSource)();
20
+ const { sxpParameter, popupDetailData, isPreview, bffFbReport, popupCurTimeRef, checkCommodityIndexRef, globalConfig } = (0, hooks_1.useSxpDataSource)();
20
21
  const { jumpToWeb, productView } = (0, useEventReport_1.useEventReport)();
21
22
  const curTimeRef = (0, react_1.useRef)(null);
22
23
  const [showModal, setShowModal] = (0, react_1.useState)(false);
@@ -61,20 +62,11 @@ const CommodityDetail = (_a) => {
61
62
  window.removeEventListener('pageshow', initTime);
62
63
  };
63
64
  }, []);
64
- const priceText = (0, react_1.useMemo)(() => {
65
- var _a, _b, _c, _d, _e, _f, _g;
66
- 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);
67
- if ((product === null || product === void 0 ? void 0 : product.currency) && (product === null || product === void 0 ? void 0 : product.price)) {
68
- 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
69
- ? (_g = (_f = product === null || product === void 0 ? void 0 : product.price) === null || _f === void 0 ? void 0 : _f.toLocaleString('zh', {
70
- minimumFractionDigits: 0
71
- })) !== null && _g !== void 0 ? _g : ''
72
- : product === null || product === void 0 ? void 0 : product.price}`;
73
- }
74
- else {
75
- return '$7,000';
76
- }
77
- }, [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]);
65
+ const priceText = (0, materials_1.getPriceText)({
66
+ product: product,
67
+ enableFormattedPrice: (_t = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _t === void 0 ? void 0 : _t.enableFormattedPrice,
68
+ globalConfig
69
+ });
78
70
  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;
79
71
  const height = commodityImgRatio ? width * (commodityImgRatio.h / commodityImgRatio.w) : width;
80
72
  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
  })[];
@@ -219,7 +219,8 @@ exports.default = [
219
219
  label: '价格千分符展示',
220
220
  type: 'Switch',
221
221
  name: ['enableFormattedPrice'],
222
- initialValue: true
222
+ initialValue: true,
223
+ belong: 'price'
223
224
  }
224
225
  ]
225
226
  }
@@ -13,11 +13,12 @@ const useEventReport_1 = require("../../../../core/hooks/useEventReport");
13
13
  const FormatImage_1 = tslib_1.__importDefault(require("../../../../core/components/SxpPageRender/FormatImage"));
14
14
  const tool_1 = require("../../../../core/utils/tool");
15
15
  const CommodityGroup_1 = tslib_1.__importDefault(require("../../template/components/CommodityGroup"));
16
+ const materials_1 = require("../../../../core/utils/materials");
16
17
  const CommodityDetailDiroNew = (_a) => {
17
18
  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;
18
19
  var { style, isDefault, rec, viewTime, isPost, bottom_image, tipText, swiper, commodityStyles, buttonStyle, index, commodityGroup, popupBg, iframeIcon, commodityImgRatio, isTel, iframeBgColor } = _a, props = tslib_1.__rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "tipText", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup", "popupBg", "iframeIcon", "commodityImgRatio", "isTel", "iframeBgColor"]);
19
20
  const [spread, setSpread] = (0, react_1.useState)(true);
20
- const { sxpParameter, popupCurTimeRef, popupDetailData, isPreview, bffFbReport, checkCommodityIndexRef } = (0, hooks_1.useSxpDataSource)();
21
+ const { sxpParameter, popupCurTimeRef, popupDetailData, isPreview, bffFbReport, checkCommodityIndexRef, globalConfig } = (0, hooks_1.useSxpDataSource)();
21
22
  const { jumpToWeb, productView } = (0, useEventReport_1.useEventReport)();
22
23
  const [stopSlide, setStopSlide] = (0, react_1.useState)(false);
23
24
  const [isBottom, setIsBottom] = (0, react_1.useState)(false);
@@ -65,20 +66,11 @@ const CommodityDetailDiroNew = (_a) => {
65
66
  window.removeEventListener('pageshow', initTime);
66
67
  };
67
68
  }, []);
68
- const priceText = (0, react_1.useMemo)(() => {
69
- var _a, _b, _c, _d, _e, _f, _g;
70
- 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);
71
- if ((product === null || product === void 0 ? void 0 : product.currency) && (product === null || product === void 0 ? void 0 : product.price)) {
72
- 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
73
- ? (_g = (_f = product === null || product === void 0 ? void 0 : product.price) === null || _f === void 0 ? void 0 : _f.toLocaleString('zh', {
74
- minimumFractionDigits: 0
75
- })) !== null && _g !== void 0 ? _g : ''
76
- : product === null || product === void 0 ? void 0 : product.price}`;
77
- }
78
- else {
79
- return '£102,300.00';
80
- }
81
- }, [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]);
69
+ const priceText = (0, materials_1.getPriceText)({
70
+ product,
71
+ enableFormattedPrice: (_t = commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price) === null || _t === void 0 ? void 0 : _t.enableFormattedPrice,
72
+ globalConfig
73
+ });
82
74
  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;
83
75
  const height = commodityImgRatio ? width * (commodityImgRatio.h / commodityImgRatio.w) : width;
84
76
  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
  })[];
@@ -202,7 +202,8 @@ exports.default = [
202
202
  label: '价格千分符展示',
203
203
  type: 'Switch',
204
204
  name: ['enableFormattedPrice'],
205
- initialValue: true
205
+ initialValue: true,
206
+ belong: 'price'
206
207
  }
207
208
  ]
208
209
  }