@conecli/cone-render 0.10.1-shop3.9 → 0.10.1-shop3.90

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 (114) hide show
  1. package/README.md +1 -1
  2. package/dist/api/index.ts +1 -1
  3. package/dist/common/accessibility.h5.ts +1 -0
  4. package/dist/common/accessibility.ts +0 -0
  5. package/dist/common/const.ts +1 -1
  6. package/dist/common/index.h5.ts +1 -1
  7. package/dist/common/index.jd.ts +1 -1
  8. package/dist/common/index.ts +1 -1
  9. package/dist/common/index.weapp.ts +1 -1
  10. package/dist/common/jdplayerSdk.weapp.tsx +1 -0
  11. package/dist/common/jssdk.ts +1 -1
  12. package/dist/common/jssdk.weapp.ts +1 -0
  13. package/dist/common/pageType.ts +1 -1
  14. package/dist/common/token/index.h5.ts +1 -1
  15. package/dist/common/token/token.jd.ts +1 -1
  16. package/dist/common/wxappApi.ascf.ts +1 -0
  17. package/dist/common/wxappApi.ts +1 -1
  18. package/dist/components/ErrorBoundary.tsx +1 -1
  19. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  20. package/dist/components/base/CountDown/index.tsx +1 -1
  21. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  22. package/dist/components/base/CustomVideo/index.tsx +1 -1
  23. package/dist/components/base/CustomVideo/index.weapp.tsx +1 -0
  24. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  25. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  26. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  27. package/dist/components/base/InOrOutViewObserver/index.weapp.tsx +1 -0
  28. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  29. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  30. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  31. package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
  32. package/dist/components/base/MobileCommonHeader/index.weapp.tsx +1 -0
  33. package/dist/components/base/NetworkDataError/const.ts +1 -1
  34. package/dist/components/base/NetworkDataError/index.module.scss +118 -72
  35. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  36. package/dist/components/base/Price/Base/index.module.scss +12 -0
  37. package/dist/components/base/Price/Base/index.tsx +1 -1
  38. package/dist/components/base/Price/Double/index.module.scss +25 -1
  39. package/dist/components/base/Price/Double/index.tsx +1 -1
  40. package/dist/components/base/ShopLeGaoTag/index.h5.module.scss +35 -0
  41. package/dist/components/base/ShopLeGaoTag/index.h5.tsx +1 -0
  42. package/dist/components/base/ShopLeGaoTag/index.module.scss +33 -0
  43. package/dist/components/base/ShopLeGaoTag/index.tsx +1 -0
  44. package/dist/components/debug/DebugLayout/index.module.scss +2 -2
  45. package/dist/components/floorItem.tsx +1 -1
  46. package/dist/components/isv/Floor/index.tsx +1 -1
  47. package/dist/components/remoteFloorItem.tsx +1 -1
  48. package/dist/config/env.ts +1 -1
  49. package/dist/interface/common.ts +1 -1
  50. package/dist/interface/component.ts +1 -1
  51. package/dist/interface/jumpEventReport.ts +1 -1
  52. package/dist/interface/service.ts +1 -1
  53. package/dist/jumpEventReport/base.ts +1 -1
  54. package/dist/jumpEventReport/const.ts +1 -1
  55. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  56. package/dist/jumpEventReport/index.h5.ts +1 -1
  57. package/dist/jumpEventReport/index.jd.ts +1 -1
  58. package/dist/jumpEventReport/index.weapp.ts +1 -1
  59. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  60. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  61. package/dist/jumpEventReport/logEventConfig.h5.ts +1 -0
  62. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  63. package/dist/jumpEventReport/web/report.ts +1 -1
  64. package/dist/jumpEventReport/web.base.ts +1 -1
  65. package/dist/jumpEventReport/web.jd.ts +1 -1
  66. package/dist/jumpEventReport/web.pc.ts +1 -1
  67. package/dist/jumpEventReport/web.tjm.ts +1 -1
  68. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  69. package/dist/language/en_US.json +309 -0
  70. package/dist/language/zh_CN.json +309 -0
  71. package/dist/language/zh_HK.json +309 -0
  72. package/dist/libs/openShopBridge.js +161 -0
  73. package/dist/libs/openShopBridge.min.js +1 -0
  74. package/dist/libs/taroAppReport.js +2 -2
  75. package/dist/modules/ContainerFloorList/index.h5.module.scss +16 -2
  76. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  77. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  78. package/dist/modules/DecorateContainerFloorList/index.weapp.tsx +1 -0
  79. package/dist/open/api/environment.ts +1 -1
  80. package/dist/open/api/shopMember.ts +1 -1
  81. package/dist/open/api/shopMember.weapp.ts +1 -0
  82. package/dist/open/api/track.ts +1 -1
  83. package/dist/open/api/util.ts +1 -1
  84. package/dist/open/components/index.ts +1 -1
  85. package/dist/open/index.ts +1 -1
  86. package/dist/sass/app.h5.scss +27 -1
  87. package/dist/sass/base.scss +8 -4
  88. package/dist/service/fetchGateway.ts +1 -1
  89. package/dist/service/fetchGateway.weapp.ts +1 -1
  90. package/dist/service/fetchJsonp.weapp.ts +1 -0
  91. package/dist/service/http/const.ts +1 -1
  92. package/dist/service/http/h5Http.ts +1 -1
  93. package/dist/service/http/httpInterceptors.weapp.ts +1 -0
  94. package/dist/service/requestServer.h5.ts +1 -1
  95. package/dist/service/requestServer.ts +1 -1
  96. package/dist/service/requestServer.weapp.ts +1 -1
  97. package/dist/utils/connectNativeJsBridge.ts +1 -1
  98. package/dist/utils/h5Utils.ts +1 -1
  99. package/dist/utils/harmonyCallRouter.h5.ts +1 -0
  100. package/dist/utils/harmonyCallRouter.ts +0 -0
  101. package/dist/utils/index.h5.ts +1 -1
  102. package/dist/utils/index.ts +1 -1
  103. package/dist/utils/index.weapp.ts +1 -1
  104. package/dist/utils/jumpExtMapUtil.ts +1 -0
  105. package/dist/utils/log.ts +1 -0
  106. package/dist/utils/{sColor.js → sColor.ts} +1 -1
  107. package/dist/utils/sColor.weapp.ts +1 -0
  108. package/dist/utils/utils.ts +1 -1
  109. package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
  110. package/dist/wxapp/common/user_info.js +1 -1
  111. package/package.json +162 -141
  112. package/dist/jumpEventReport/web/wqshop.report.ts +0 -1
  113. package/dist/utils/priceUtils.js +0 -1
  114. /package/dist/utils/{jumpExtMapUtil.js → jumpExtMapUtil.h5.ts} +0 -0
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro';
2
1
  stopNativeScrollEvent,
3
2
  getAppChannelType,
4
3
  isAndroidDevice,
5
4
  isH5AndJdShopView,
6
5
  isChartH5,
7
6
  isH5AndJdShopViewNativeScroll,
8
7
  isIosDevice,
9
8
  isJdAndAndroidDevice,
10
9
  isJdAndIosDevice,
11
10
  isJdApp,
12
11
  isWxApp,
13
12
  isWxMiniH5View,
14
13
  isJdAndHarmonyDevice,
15
14
  isH5AndJingGouMini,
16
15
  urlCookie,
17
16
  sgmCustomReport,
18
17
  draCustomReport,
19
18
  remoteCustomReport,
20
19
  draInterfaceCustomReport,
21
20
  draBusinessCustomReport,
22
21
  isMemberPage,
23
22
  isH5AndJdShopViewH5Scroll,
24
23
  isH5AndJdShopH5CustomScrollView,
25
24
  isAppClassifyPage,
26
25
  isAppHomeForMarketPage,
27
26
  isPc,
28
27
  ipLoc_djd,
29
28
  jdAppVersionCompare,
30
29
  isTjScence,
31
30
  isH5AdnJxMini,
32
31
  isTjM,
33
32
  isTjJxM,
34
33
  isTJApp,
35
34
  isH5AdnHaoWuJie,
36
35
  tjChannel,
37
36
  dealNativePixelToCssPixel,
38
37
  isAppStowShop,
39
38
  isJdAndroidX5Core,
40
39
  parseQueryUrlObj,
41
40
  isIpadDevice,
42
41
  isTabletDevice,
43
42
  isJdTabletDevice,
44
43
  jdTabletDeviceInfo,
45
44
  isSupportHybridHttpRequest,
46
45
  isLanguageForEn,
47
46
  sColor,
48
47
  draInterfaceDSMCustomReport,
49
48
  addHttps,
50
49
  clearTaroStorageKey,
51
50
  countStringify as h5CountStringify,
52
51
  dateFormat,
53
52
  dealAddress,
54
53
  dealShopContentData as originDealShopContentData,
55
54
  debounce,
56
55
  filterUrlQueryData,
57
56
  formatTabActiveMenuType,
58
57
  getAvifSupport,
59
58
  getWebpSupport,
60
59
  getTaroStorageKeyValue,
61
60
  getWxAppCookieStr,
62
61
  isH5,
63
62
  isMin,
64
63
  isJdMin,
65
64
  isWxMin,
66
65
  isWxMinAndWxapp,
67
66
  isJdMinAndHarmony,
68
67
  lodashThrottle,
69
68
  objectToUrlEncode,
70
69
  parseQueryUrlString,
71
70
  removeTaroStorageKey,
72
71
  setLowSmallPicUrl,
73
72
  setTaroStorage,
74
73
  showFailToast,
75
74
  showNormalToast,
76
75
  showSuccessToast,
77
76
  sliceArrToChunkList,
78
77
  throttle,
79
78
  getQualityImageNew,
80
79
  getQualityImageOld,
81
80
  isOpenJdAppUrl,
82
81
  jdOpenAppParams,
83
82
  createJdOpenAppUrl,
84
83
  isEmpty,
85
84
  getJdAppReportPageSource,
86
85
  dealJdOpenAppData,
87
86
  getBorderStyle,
88
87
  const getNum = Number(num);
89
88
  let _changeLayoutWidth = layoutWidth;
90
89
  if (!_changeLayoutWidth) {
91
90
  _changeLayoutWidth =
92
91
  _ShopSystemInfo && _ShopSystemInfo?.windowWidth
93
92
  ? _ShopSystemInfo.windowWidth
94
93
  : Taro.getSystemInfoSync()?.windowWidth;
95
94
  }
96
95
  return isJdTabletDevice && !layoutWidth
97
96
  ? Math.floor(getNum * 1.2 * (_changeLayoutWidth / 720))
98
97
  : Math.round((getNum / widthSize) * _changeLayoutWidth);
99
98
  const getRootFontSize = (40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750;
100
99
  let getRealRootFontSize = getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize;
101
100
  if (isJdTabletDevice) {
102
101
  getRealRootFontSize = Math.floor(
103
102
  24 * ((systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth) / 720),
104
103
  );
105
104
  }
106
105
  return Math.ceil(
107
106
  (((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) * getRealRootFontSize,
108
107
  );
109
108
  console.log(
110
109
  '获取系统宽度systemInfo?.windowWidth',
111
110
  systemInfo?.windowWidth,
112
111
  'taroToTransformRoutimePXNumber(changeWidth)',
113
112
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
114
113
  );
115
114
  return buildType === BUILD_TYPE.CLASSIFY && systemInfo?.windowWidth
116
115
  ? systemInfo?.windowWidth - taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
117
116
  : (systemInfo?.windowWidth ?? 0);
118
117
  const systemInfo = Taro.getSystemInfoSync();
119
118
  if (params && params?.pageWidth && params?.pageHeight) {
120
119
  systemInfo.windowWidth = params?.pageWidth;
121
120
  systemInfo.windowHeight = params?.pageHeight;
122
121
  console.warn('松果app内获取重置系统信息宽度值', params, ',systemInfo信息集合为', systemInfo);
123
122
  } else {
124
123
  if (isPc) {
125
124
  systemInfo.windowWidth = 375;
126
125
  } else {
127
126
  const getWinWidth = window.innerWidth;
128
127
  const getWinHeight = window.innerHeight;
129
128
  const getScreenWidth = window.screen.width;
130
129
  const getScreenHeight = window.screen.height;
131
130
  systemInfo.isJdTabletDevice = jdTabletDeviceInfo.isTablet;
132
131
  systemInfo.isJdTabletLandscape = jdTabletDeviceInfo.isLandscape;
133
132
  if (isJdApp && isAndroidDevice && !jdTabletDeviceInfo.isTablet && systemInfo) {
134
133
  const isLandscape = getScreenWidth >= getScreenHeight;
135
134
  const { windowWidth, windowHeight, screenWidth, screenHeight } = systemInfo;
136
135
  if (windowWidth <= 0) {
137
136
  systemInfo.initWindowWidth = windowWidth;
138
137
  if (isLandscape) {
139
138
  systemInfo.windowWidth = getScreenHeight;
140
139
  systemInfo.windowHeight = getScreenWidth;
141
140
  systemInfo.screenWidth = getScreenHeight;
142
141
  systemInfo.screenHeight = getScreenWidth;
143
142
  } else {
144
143
  systemInfo.windowWidth = getScreenWidth;
145
144
  systemInfo.windowHeight = getScreenHeight;
146
145
  systemInfo.screenWidth = getScreenWidth;
147
146
  systemInfo.screenHeight = getScreenHeight;
148
147
  }
149
148
  console.warn(
150
149
  `松果安卓app内获取系统信息宽度异常为小于等于0,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取窗口高度值${windowHeight},重置后的高度值${systemInfo.windowHeight}`,
151
150
  );
152
151
  sgmCustomReport({
153
152
  type: 2,
154
153
  code: 'android_jdapp_width_error_info',
155
154
  msg: {
156
155
  title: `松果安卓app内获取系统信息宽度为小于等于0,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight}`,
157
156
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
158
157
  taroSysInfo: systemInfo,
159
158
  },
160
159
  });
161
160
  } else {
162
161
  let _getChangeWinWidthState = false;
163
162
  if (getWinWidth > 0 && windowWidth > 0 && windowWidth > getWinWidth) {
164
163
  if (isLandscape) {
165
164
  systemInfo.windowWidth = getScreenHeight;
166
165
  systemInfo.windowHeight = getScreenWidth;
167
166
  systemInfo.screenWidth = getScreenHeight;
168
167
  systemInfo.screenHeight = getScreenWidth;
169
168
  } else {
170
169
  systemInfo.windowWidth = getScreenWidth;
171
170
  systemInfo.windowHeight = getScreenHeight;
172
171
  systemInfo.screenWidth = getScreenWidth;
173
172
  systemInfo.screenHeight = getScreenHeight;
174
173
  }
175
174
  _getChangeWinWidthState = true;
176
175
  }
177
176
  _getChangeWinWidthState &&
178
177
  console.warn(
179
178
  `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取屏幕宽度值${screenWidth},重置后的宽度值${systemInfo.screenWidth}`,
180
179
  );
181
180
  _getChangeWinWidthState &&
182
181
  sgmCustomReport({
183
182
  type: 2,
184
183
  code: 'android_jdapp_width_error_info',
185
184
  msg: {
186
185
  title: `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight}`,
187
186
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
188
187
  taroSysInfo: systemInfo,
189
188
  },
190
189
  });
191
190
  }
192
191
  }
193
192
 
194
193
  if (jdTabletDeviceInfo.isTablet) {
195
194
  systemInfo.windowWidth = getScreenWidth;
196
195
  systemInfo.windowHeight = getScreenHeight;
197
196
  if (jdTabletDeviceInfo.isLandscape) {
198
197
  if (window?.PAGE_DATA?.isFitJdPadRenderCenter) {
199
198
  systemInfo.windowWidth = Math.min(getScreenWidth, getScreenHeight);
200
199
  systemInfo.windowHeight = Math.max(getScreenWidth, getScreenHeight);
201
200
  }
202
201
  }
203
202
  console.warn(
204
203
  '====初始化获取当前设备是否是平板设备,是否是横屏=====',
205
204
  jdTabletDeviceInfo,
206
205
  '屏幕信息',
207
206
  window.screen,
208
207
  '当前是否要求居中展示,居中展示那么宽高值要对调',
209
208
  window?.PAGE_DATA?.isFitJdPadRenderCenter,
210
209
  );
211
210
  }
212
211
  }
213
212
  }
214
213
  systemInfo['containerWidth'] = getContainerWidth(buildType, systemInfo);
215
214
  console.warn('====获取系统信息=====', systemInfo);
216
215
  return systemInfo;
217
216
  let result: boolean | null = null;
218
217
  return function () {
219
218
  if (result === null) {
220
219
  const appVersionCheckPass = jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0;
221
220
  if (!isJdApp) {
222
221
  console.warn('🚗 ~~ file: utils.ts:191 站外H5默认打开图片优化~');
223
222
  isIgnoreOptimizeFromServer = true;
224
223
  result = true;
225
224
  return true;
226
225
  }
227
226
  const enableAvifOptimize = appVersionCheckPass;
228
227
  if (enableAvifOptimize) {
229
228
  const configData = global.getDynamicConfig('avifSwitch');
230
229
  const {
231
230
  globalOn = true,
232
231
  ignoreOptimizeFromServer = false,
233
232
  page = {},
234
233
  grayscale = {},
235
234
  whiteList = [],
236
235
  blackList = [],
237
236
  } = configData || {};
238
237
  const { shopId = '0', venderId = '0' } = parseQueryUrlObj;
239
238
  let imageEnableResult = true;
240
239
  isIgnoreOptimizeFromServer = ignoreOptimizeFromServer;
241
240
  if (
242
241
  blackList.find((item) => item.sId === Number(shopId) || item.vId === Number(venderId))
243
242
  ) {
244
243
  imageEnableResult = false;
245
244
  } else if (
246
245
  whiteList.find((item) => item.sId === Number(shopId) || item.vId === Number(venderId))
247
246
  ) {
248
247
  isIgnoreOptimizeFromServer = true;
249
248
  imageEnableResult = true;
250
249
  } else if (grayscale[buildType] && isInGrayscale(grayscale[buildType])) {
251
250
  isIgnoreOptimizeFromServer = true;
252
251
  imageEnableResult = true;
253
252
  } else {
254
253
  imageEnableResult = globalOn === true || page[buildType] === true;
255
254
  if (globalOn === true) {
256
255
  isIgnoreOptimizeFromServer = true;
257
256
  } else if (page[buildType] === true) {
258
257
  } else {
259
258
  }
260
259
  }
261
260
  result = imageEnableResult;
262
261
  return imageEnableResult;
263
262
  } else {
264
263
  result = false;
265
264
  return false;
266
265
  }
267
266
  } else {
268
267
  return result;
269
268
  }
270
269
  };
271
270
  if (typeof options === 'object' && isImageOptimizeEnable()) {
272
271
  return getQualityImageNew(imgUrl, options, isIgnoreOptimizeFromServer);
273
272
  } else {
274
273
  return getQualityImageOld(imgUrl, options);
275
274
  }
276
275
  const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
277
276
  windowWidth: window.innerWidth,
278
277
  containerWidth: getContainerWidth(buildType, {
279
278
  windowWidth: window.innerWidth,
280
279
  }),
281
280
  screenWidth: window.innerWidth,
282
281
  platform: '',
283
282
  model: '',
284
283
  system: '',
285
284
  };
286
285
  return getSystemInfo;
287
286
  const params = Object.assign(
288
287
  {},
289
288
  {
290
289
  title: '',
291
290
  duration: 1500,
292
291
  },
293
292
  options,
294
293
  );
295
294
  params.duration = params.duration / 1000;
296
295
  if (isJdApp && !isJdAndHarmonyDevice) {
297
296
  const showSuccessType = isIosDevice ? ToastIosType.SUCCESS : ToastAndroidType.SUCCESS;
298
297
  const duration = isAndroidDevice ? 0 : params.duration;
299
298
  nativePageShowToast(options.title, showSuccessType, duration);
300
299
  console.log('执行原生toast success');
301
300
  } else {
302
301
  showSuccessToast(options);
303
302
  }
304
303
  const params = Object.assign(
305
304
  {},
306
305
  {
307
306
  title: '',
308
307
  duration: 1500,
309
308
  },
310
309
  options,
311
310
  );
312
311
  params.duration = params.duration / 1000;
313
312
  if (isJdApp) {
314
313
  const showSuccessType = isIosDevice ? ToastIosType.FAIL : ToastAndroidType.FAIL;
315
314
  const duration = isAndroidDevice ? 0 : params.duration;
316
315
  nativePageShowToast(options.title, showSuccessType, duration);
317
316
  console.log('执行原生toast fail');
318
317
  } else {
319
318
  console.log('执行H5 toast fail');
320
319
  showFailToast(options);
321
320
  }
322
321
  const params = Object.assign(
323
322
  {},
324
323
  {
325
324
  title: '',
326
325
  duration: 1500,
327
326
  },
328
327
  options,
329
328
  );
330
329
  params.duration = params.duration / 1000;
331
330
  if (isJdApp) {
332
331
  const showSuccessType = isIosDevice ? ToastIosType.NORMAL : ToastAndroidType.NORMAL;
333
332
  const duration = isAndroidDevice ? 0 : params.duration;
334
333
  nativePageShowToast(options.title, showSuccessType, duration);
335
334
  } else {
336
335
  showNormalToast(options);
337
336
  }
338
337
  if (isLanguageForEn) {
339
338
  count = Number(count);
340
339
  if (count >= 1000000000) {
341
340
  return (count / 1000000000).toFixed(fixedNum) + 'B';
342
341
  } else if (count >= 1000000) {
343
342
  return (count / 1000000).toFixed(fixedNum) + 'M';
344
343
  } else if (count >= 1000) {
345
344
  return (count / 1000).toFixed(fixedNum) + 'K';
346
345
  } else {
347
346
  return count;
348
347
  }
349
348
  } else {
350
349
  return h5CountStringify(count, fixedNum, unit, maxNum);
351
350
  }
352
351
  const createLoadingEle = document.createElement('div');
353
352
  createLoadingEle.id = 'J_shopLoading';
354
353
  createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`;
355
354
  createLoadingEle.innerHTML = `<div class='d-loading-content'>
356
355
  <span class='d-shop-loading-icon'></span>
357
356
  <p class='d-shop-text'>${text}</p>
358
357
  </div>`;
359
358
  const getEle = document.body ? document.body : document.getElementsByTagName('body')[0];
360
359
  getEle.appendChild(createLoadingEle);
361
360
  const getEle = document.getElementById('J_shopLoading');
362
361
  getEle && getEle.remove();
363
362
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getReviseSystemInfo(params);
364
363
  if (!systemInfo.system && window) {
365
364
  systemInfo.system = window.navigator.userAgent;
366
365
  systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i);
367
366
  }
368
367
  const isIOS = !!systemInfo?.system.match(/ios/i);
369
368
  const isAndroid = !!systemInfo?.system.match(/android/i);
370
369
  systemInfo.navBarHeight = 0;
371
370
  systemInfo.statusBarHeight = 0;
372
371
  systemInfo.capsulePosition = null;
373
372
  systemInfo.isIOS = isIOS;
374
373
  systemInfo.isAndroid = isAndroid;
375
374
  _ShopSystemInfo = systemInfo;
376
375
  return systemInfo;
377
376
  return originDealShopContentData(pageData, sgmCustomReport, isvdev);
378
377
  const numScale = Number(scale);
379
378
  if (isNaN(numScale)) {
380
379
  console.warn(
381
380
  `The 'scale' parameter of the 'isInGrayscale' function is invalid! Expected a number, but received ${scale}`,
382
381
  );
383
382
  return false;
384
383
  }
385
384
  const { venderId } = global.info.queryInfo || {};
386
385
  const id = venderId;
387
386
  if (!id && numScale !== 1) {
388
387
  return false;
389
388
  }
390
389
  const useScale = Math.max(0, Math.min(1, numScale));
391
390
  const isMatch = numScale === 1 || Math.floor(Number(id) % (1 / useScale)) === 0;
392
391
  if (reportKey) {
393
392
  sgmCustomReport({
394
393
  code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
395
394
  msg: '灰度调用',
396
395
  });
397
396
  console.log(
398
397
  `基于KEY[${reportKey}]的灰度调用1次~`,
399
398
  getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
400
399
  );
401
400
  if (isMatch) {
402
401
  sgmCustomReport({
403
402
  code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
404
403
  msg: '灰度命中',
405
404
  });
406
405
  console.log(
407
406
  `基于KEY[${reportKey}]的命中1次灰度!`,
408
407
  getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
409
408
  );
410
409
  }
411
410
  }
412
411
  return isMatch;
413
412
  isJdApp,
414
413
  isWxApp,
415
414
  isIosDevice,
416
415
  isAndroidDevice,
417
416
  isJdAndIosDevice,
418
417
  isJdAndAndroidDevice,
419
418
  isJdAndHarmonyDevice,
420
419
  isJdAndroidX5Core,
421
420
  isMin,
422
421
  isWxMin,
423
422
  isWxMinAndWxapp,
424
423
  isJdMinAndHarmony,
425
424
  isJdMin,
426
425
  isH5,
427
426
  isH5AndJdShopView,
428
427
  isChartH5,
429
428
  isH5AndJdShopViewNativeScroll,
430
429
  isH5AndJdShopViewH5Scroll,
431
430
  isH5AndJdShopH5CustomScrollView,
432
431
  isH5AndJingGouMini,
433
432
  isWxMiniH5View,
434
433
  urlCookie,
435
434
  sliceArrToChunkList,
436
435
  dealAddress,
437
436
  objectToUrlEncode,
438
437
  parseQueryUrlString,
439
438
  setLowSmallPicUrl,
440
439
  setTaroStorage,
441
440
  getTaroStorageKeyValue,
442
441
  removeTaroStorageKey,
443
442
  clearTaroStorageKey,
444
443
  getAvifSupport,
445
444
  getWebpSupport,
446
445
  getQualityImage,
447
446
  formatCountForUnit as countStringify,
448
447
  getWxAppCookieStr,
449
448
  getSystemInfos,
450
449
  pxTransformFromData,
451
450
  dealShopContentDataAndReport as dealShopContentData,
452
451
  dateFormat,
453
452
  throttle,
454
453
  lodashThrottle,
455
454
  debounce,
456
455
  addHttps,
457
456
  commonShowSuccessToast as showSuccessToast,
458
457
  commonShowFailToast as showFailToast,
459
458
  commonShowNormalToast as showNormalToast,
460
459
  showShopLoading,
461
460
  hideShopLoading,
462
461
  stopNativeScrollEvent,
463
462
  getAppChannelType,
464
463
  formatTabActiveMenuType,
465
464
  filterUrlQueryData,
466
465
  sgmCustomReport,
467
466
  draCustomReport,
468
467
  remoteCustomReport,
469
468
  draInterfaceCustomReport,
470
469
  draBusinessCustomReport,
471
470
  isMemberPage,
472
471
  getFloorDataToDataDefines,
473
472
  isOpenJdAppUrl,
474
473
  jdOpenAppParams,
475
474
  createJdOpenAppUrl,
476
475
  isEmpty,
477
476
  getJdAppReportPageSource,
478
477
  isAppClassifyPage,
479
478
  isAppHomeForMarketPage,
480
479
  isImageOptimizeEnable,
481
480
  isPc,
482
481
  ipLoc_djd,
483
482
  isTjScence,
484
483
  isH5AdnJxMini,
485
484
  isTjM,
486
485
  isTjJxM,
487
486
  isTJApp,
488
487
  isH5AdnHaoWuJie,
489
488
  tjChannel,
490
489
  dealJdOpenAppData,
491
490
  jdAppVersionCompare,
492
491
  dealNativePixelToCssPixel,
493
492
  isAppStowShop,
494
493
  getSgmCustomCode,
495
494
  handleSgmCodeTaroVersion,
496
495
  isInGrayscale,
497
496
  isIpadDevice,
498
497
  getBorderStyle,
499
498
  isSupportHybridHttpRequest,
500
499
  isLanguageForEn,
501
500
  sColor,
502
501
  draInterfaceDSMCustomReport,
503
502
  isTabletDevice,
504
503
  isJdTabletDevice,
505
504
  jdTabletDeviceInfo,
505
+ import Taro from '@tarojs/taro';
506
506
  stopNativeScrollEvent,
507
507
  getAppChannelType,
508
508
  isAndroidDevice,
509
509
  isHarmonyDevice,
510
510
  isH5AndJdShopView,
511
511
  isChartH5,
512
512
  isH5AndJdShopViewNativeScroll,
513
513
  isIosDevice,
514
514
  isJdAndAndroidDevice,
515
515
  isJdAndIosDevice,
516
516
  isJdApp,
517
517
  isWxApp,
518
518
  isWxMiniH5View,
519
519
  isJdAndHarmonyDevice,
520
520
  isNewHarmonyShop,
521
521
  isH5AndJingGouMini,
522
522
  urlCookie,
523
523
  draCustomReport,
524
524
  remoteCustomReport,
525
525
  draInterfaceCustomReport,
526
526
  draBusinessCustomReport,
527
527
  draBusinessCustomLogReport,
528
528
  isMemberPage,
529
529
  isH5AndJdShopViewH5Scroll,
530
530
  isH5AndJdShopH5CustomScrollView,
531
531
  isAppClassifyPage,
532
532
  isAppHomeForMarketPage,
533
533
  isPc,
534
534
  isPcClassifyPage,
535
535
  ipLoc_djd,
536
536
  jdAppVersionCompare,
537
537
  isTjScence,
538
538
  isH5AdnJxMini,
539
539
  isTjM,
540
540
  isTjJxM,
541
541
  isTJApp,
542
542
  isH5AdnHaoWuJie,
543
543
  tjChannel,
544
544
  dealNativePixelToCssPixel,
545
545
  isAppStowShop,
546
546
  isJdAndroidX5Core,
547
547
  parseQueryUrlObj,
548
548
  isIpadDevice,
549
549
  isTabletDevice,
550
550
  checkPadScreenOrientationIsLandscape,
551
551
  isSupportHybridHttpRequest,
552
552
  isLanguageForEn,
553
553
  sColor,
554
554
  isInJdShopView,
555
555
  isDongWebView,
556
556
  isLanguageForHk,
557
557
  languageNowType,
558
558
  isAscfApp,
559
559
  isInJdAppH5DebugMode,
560
560
  isJdLiteApp,
561
561
  isJdAppForNotMain,
562
562
  addHttps,
563
563
  clearTaroStorageKey,
564
564
  countStringify as h5CountStringify,
565
565
  dateFormat,
566
566
  dealAddress,
567
567
  dealShopContentData as originDealShopContentData,
568
568
  debounce,
569
569
  filterUrlQueryData,
570
570
  formatTabActiveMenuType,
571
571
  getAvifSupport,
572
572
  getWebpSupport,
573
573
  getTaroStorageKeyValue,
574
574
  getWxAppCookieStr,
575
575
  isH5,
576
576
  isMin,
577
577
  isJdMin,
578
578
  isWxMin,
579
579
  isWxMinAndWxapp,
580
580
  isJdMinAndHarmony,
581
581
  lodashThrottle,
582
582
  objectToUrlEncode,
583
583
  parseQueryUrlString,
584
584
  removeTaroStorageKey,
585
585
  setLowSmallPicUrl,
586
586
  setTaroStorage,
587
587
  showFailToast,
588
588
  showNormalToast,
589
589
  showSuccessToast,
590
590
  sliceArrToChunkList,
591
591
  throttle,
592
592
  getQualityImageNew,
593
593
  getQualityImageOld,
594
594
  isOpenJdAppUrl,
595
595
  jdOpenAppParams,
596
596
  createJdOpenAppUrl,
597
597
  isEmpty,
598
598
  getJdAppReportPageSource,
599
599
  dealJdOpenAppData,
600
600
  getBorderStyle,
601
601
  isInHarmonyBlacklistByModuleFlag,
602
602
  const getNum = Number(num);
603
603
  let _changeLayoutWidth = layoutWidth;
604
604
  if (!_changeLayoutWidth) {
605
605
  _changeLayoutWidth =
606
606
  _ShopSystemInfo && _ShopSystemInfo?.windowWidth
607
607
  ? _ShopSystemInfo.windowWidth
608
608
  : Taro.getSystemInfoSync()?.windowWidth;
609
609
  }
610
610
  return _ShopSystemInfo?.isJdTabletDevice && !layoutWidth
611
611
  ? Math.floor(getNum * 1.2 * (_changeLayoutWidth / 720))
612
612
  : Math.round((getNum / widthSize) * _changeLayoutWidth);
613
613
  const getRootFontSize = (40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750;
614
614
  let getRealRootFontSize = getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize;
615
615
  if (_ShopSystemInfo?.isJdTabletDevice) {
616
616
  getRealRootFontSize = Math.floor(
617
617
  24 * ((systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth) / 720),
618
618
  );
619
619
  }
620
620
  return Math.ceil(
621
621
  (((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) * getRealRootFontSize,
622
622
  );
623
623
  console.log(
624
624
  '获取系统宽度systemInfo?.windowWidth',
625
625
  systemInfo?.windowWidth,
626
626
  'taroToTransformRoutimePXNumber(changeWidth)',
627
627
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
628
628
  );
629
629
  return buildType === BUILD_TYPE.CLASSIFY && systemInfo?.windowWidth
630
630
  ? systemInfo?.windowWidth - taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
631
631
  : (systemInfo?.windowWidth ?? 0);
632
632
  const systemInfo = _ShopSystemInfo || Taro.getSystemInfoSync();
633
633
  console.log(
634
634
  '获取系统宽度systemInfo?.windowWidth',
635
635
  systemInfo?.windowWidth,
636
636
  'taroToTransformRoutimePXNumber(changeWidth)',
637
637
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
638
638
  );
639
639
  const containerWidth =
640
640
  isClassify && systemInfo?.windowWidth
641
641
  ? systemInfo?.windowWidth - taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
642
642
  : (systemInfo?.windowWidth ?? 0);
643
643
  if (global?.info?.sysInfo) {
644
644
  global.info.sysInfo['containerWidth'] = containerWidth;
645
645
  }
646
646
  return (
647
647
  isJdApp &&
648
648
  (parseQueryUrlObj['device'] === 'tablet' || Math.min(rootEleWidth, window.screen.height) >= 720)
649
649
  );
650
650
  const systemInfo = Taro.getSystemInfoSync();
651
651
  if (params && params?.pageWidth && params?.pageHeight) {
652
652
  systemInfo.windowWidth = params?.pageWidth;
653
653
  systemInfo.windowHeight = params?.pageHeight;
654
654
  console.warn('松果app内获取重置系统信息宽度值', params, ',systemInfo信息集合为', systemInfo);
655
655
  } else {
656
656
  if (isPc) {
657
657
  systemInfo.windowWidth = 375;
658
658
  } else {
659
659
  const getWinWidth = window.innerWidth;
660
660
  const getWinHeight = window.innerHeight;
661
661
  const getScreenWidth = window.screen.width;
662
662
  const getScreenHeight = window.screen.height;
663
663
  const getRootEleInitWidth = params?.rootEleInitWidth || 0;
664
664
  const isReplaceSystemWidth = params?.replaceSystemWidth || false;
665
665
  systemInfo.isJdTabletDevice = checkIsJdTabletDevice(getRootEleInitWidth);
666
666
  systemInfo.isJdTabletLandscape =
667
667
  systemInfo.isJdTabletDevice &&
668
668
  checkPadScreenOrientationIsLandscape(getRootEleInitWidth, getScreenWidth, getScreenHeight);
669
669
  if (!systemInfo.isJdTabletDevice && isReplaceSystemWidth) {
670
670
  if (systemInfo?.windowWidth <= 0) {
671
671
  systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth);
672
672
  systemInfo.windowHeight = getScreenHeight;
673
673
  console.warn(
674
674
  '====初始化获取当前设备不是pad,但是触发屏幕宽高最小值600,系统获取宽度为0,进行重置系统宽度为根元素宽度与屏幕宽度最小值====',
675
675
  systemInfo.windowWidth,
676
676
  'getRootEleInitWidth',
677
677
  getRootEleInitWidth,
678
678
  'getScreenWidth',
679
679
  getScreenWidth,
680
680
  'getScreenHeight',
681
681
  getScreenHeight,
682
682
  );
683
683
  draBusinessCustomReport({
684
684
  eventName: 'business',
685
685
  errorName: 'jdapp_pad_width_error_info',
686
686
  errorMessage: `松果app内获取当前设备不是pad,触发屏幕宽高最小值600,系统信息宽度为0,进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
687
687
  extraData: JSON.stringify({
688
688
  isJdApp,
689
689
  isAndroidDevice,
690
690
  getScreenWidth,
691
691
  getScreenHeight,
692
692
  getWinWidth,
693
693
  getWinHeight,
694
694
  getRootEleInitWidth,
695
695
  }),
696
696
  });
697
697
  }
698
698
  } else {
699
699
  if (isJdApp && isAndroidDevice && !systemInfo.isJdTabletDevice && systemInfo) {
700
700
  const isLandscape = getScreenWidth >= getScreenHeight;
701
701
  const { windowWidth, windowHeight, screenWidth, screenHeight } = systemInfo;
702
702
  if (windowWidth <= 0) {
703
703
  systemInfo.initWindowWidth = windowWidth;
704
704
  if (isLandscape) {
705
705
  systemInfo.windowWidth = getScreenHeight;
706
706
  systemInfo.windowHeight = getScreenWidth;
707
707
  systemInfo.screenWidth = getScreenHeight;
708
708
  systemInfo.screenHeight = getScreenWidth;
709
709
  } else {
710
710
  systemInfo.windowWidth = getScreenWidth;
711
711
  systemInfo.windowHeight = getScreenHeight;
712
712
  systemInfo.screenWidth = getScreenWidth;
713
713
  systemInfo.screenHeight = getScreenHeight;
714
714
  }
715
715
  console.warn(
716
716
  `松果安卓app内获取系统信息宽度异常为小于等于0,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取窗口高度值${windowHeight},重置后的高度值${systemInfo.windowHeight},根元素宽度值${getRootEleInitWidth}`,
717
717
  );
718
718
  draBusinessCustomReport({
719
719
  eventName: 'UIInteract',
720
720
  errorName: 'android_jdapp_width_error_info',
721
721
  errorMessage: `松果安卓app内获取系统信息宽度为小于等于0,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
722
722
  extraData: JSON.stringify({
723
723
  isJdApp,
724
724
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
725
725
  getScreenWidth,
726
726
  getScreenHeight,
727
727
  getWinWidth,
728
728
  getWinHeight,
729
729
  getRootEleInitWidth,
730
730
  }),
731
731
  });
732
732
  } else {
733
733
  let _getChangeWinWidthState = false;
734
734
  if (getWinWidth > 0 && windowWidth > 0 && windowWidth > getWinWidth) {
735
735
  if (isLandscape) {
736
736
  systemInfo.windowWidth = getScreenHeight;
737
737
  systemInfo.windowHeight = getScreenWidth;
738
738
  systemInfo.screenWidth = getScreenHeight;
739
739
  systemInfo.screenHeight = getScreenWidth;
740
740
  } else {
741
741
  systemInfo.windowWidth = getScreenWidth;
742
742
  systemInfo.windowHeight = getScreenHeight;
743
743
  systemInfo.screenWidth = getScreenWidth;
744
744
  systemInfo.screenHeight = getScreenHeight;
745
745
  }
746
746
  _getChangeWinWidthState = true;
747
747
  }
748
748
  _getChangeWinWidthState &&
749
749
  console.warn(
750
750
  `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取屏幕宽度值${screenWidth},重置后的宽度值${systemInfo.screenWidth}`,
751
751
  );
752
752
  if (_getChangeWinWidthState) {
753
753
  draBusinessCustomReport({
754
754
  eventName: 'business',
755
755
  errorName: 'android_jdapp_width_error_info_2',
756
756
  errorMessage: `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
757
757
  extraData: JSON.stringify({
758
758
  isJdApp,
759
759
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
760
760
  getScreenWidth,
761
761
  getScreenHeight,
762
762
  getWinWidth,
763
763
  getWinHeight,
764
764
  getRootEleInitWidth,
765
765
  }),
766
766
  });
767
767
  }
768
768
  }
769
769
  }
770
770
  }
771
771
 
772
772
  if (systemInfo.isJdTabletDevice) {
773
773
  systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth, getScreenHeight);
774
774
  systemInfo.windowHeight = Math.max(getScreenWidth, getScreenHeight);
775
775
  if (systemInfo.isJdTabletLandscape) {
776
776
  const getRenderCenterState = window?.PAGE_DATA?.businessData?.fitPadCenterRenderLowVersion
777
777
  ? jdAppVersionCompare(window.PAGE_DATA.businessData.fitPadCenterRenderLowVersion) < 0
778
778
  : false;
779
779
  if (getRenderCenterState && window?.PAGE_DATA) {
780
780
  window.PAGE_DATA.isFitJdPadRenderCenter = true;
781
781
  }
782
782
  if (window?.PAGE_DATA?.isFitJdPadRenderCenter) {
783
783
  systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth, getScreenHeight);
784
784
  systemInfo.windowHeight = Math.max(
785
785
  getRootEleInitWidth,
786
786
  getScreenWidth,
787
787
  getScreenHeight,
788
788
  );
789
789
  } else {
790
790
  systemInfo.windowWidth = Math.max(getRootEleInitWidth, getScreenWidth, getScreenHeight);
791
791
  systemInfo.windowHeight = Math.min(
792
792
  getRootEleInitWidth,
793
793
  getScreenWidth,
794
794
  getScreenHeight,
795
795
  );
796
796
  }
797
797
  }
798
798
  console.warn(
799
799
  '====初始化获取当前设备是否是平板设备,是否横屏====',
800
800
  systemInfo.isJdTabletDevice,
801
801
  systemInfo.isJdTabletLandscape,
802
802
  '屏幕信息',
803
803
  window.screen,
804
804
  'getScreenWidth',
805
805
  getScreenWidth,
806
806
  'getScreenHeight',
807
807
  getScreenHeight,
808
808
  'getRootEleInitWidth',
809
809
  getRootEleInitWidth,
810
810
  '当前是否要求居中展示,居中展示那么宽高值要对调',
811
811
  window?.PAGE_DATA?.isFitJdPadRenderCenter,
812
812
  '当前pad最终展示的窗口宽度',
813
813
  systemInfo.windowWidth,
814
814
  );
815
815
  }
816
816
  }
817
817
  }
818
818
  systemInfo['containerWidth'] = getContainerWidth(buildType, systemInfo);
819
819
  console.warn('====获取系统信息=====', systemInfo);
820
820
  return systemInfo;
821
821
  let result: boolean | null = null;
822
822
  return function () {
823
823
  if (result === null) {
824
824
  const appVersionCheckPass = jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0;
825
825
  if (!isJdApp) {
826
826
  console.warn('🚗 ~~ file: utils.ts:191 站外H5默认打开图片优化~');
827
827
  isIgnoreOptimizeFromServer = true;
828
828
  result = true;
829
829
  return true;
830
830
  }
831
831
  const enableAvifOptimize = appVersionCheckPass;
832
832
  if (enableAvifOptimize) {
833
833
  const configData = global?.getDynamicConfig('avifSwitch');
834
834
  const {
835
835
  globalOn = true,
836
836
  ignoreOptimizeFromServer = false,
837
837
  page = {},
838
838
  grayscale = {},
839
839
  whiteList = [],
840
840
  blackList = [],
841
841
  } = configData || {};
842
842
  const { shopId = '0', venderId = '0' } = parseQueryUrlObj;
843
843
  let imageEnableResult = true;
844
844
  isIgnoreOptimizeFromServer = ignoreOptimizeFromServer;
845
845
  if (
846
846
  blackList.find((item) => item.sId === Number(shopId) || item.vId === Number(venderId))
847
847
  ) {
848
848
  imageEnableResult = false;
849
849
  } else if (
850
850
  whiteList.find((item) => item.sId === Number(shopId) || item.vId === Number(venderId))
851
851
  ) {
852
852
  isIgnoreOptimizeFromServer = true;
853
853
  imageEnableResult = true;
854
854
  } else if (grayscale[buildType] && isInGrayscale(grayscale[buildType])) {
855
855
  isIgnoreOptimizeFromServer = true;
856
856
  imageEnableResult = true;
857
857
  } else {
858
858
  imageEnableResult = globalOn === true || page[buildType] === true;
859
859
  if (globalOn === true) {
860
860
  isIgnoreOptimizeFromServer = true;
861
861
  } else if (page[buildType] === true) {
862
862
  } else {
863
863
  }
864
864
  }
865
865
  result = imageEnableResult;
866
866
  return imageEnableResult;
867
867
  } else {
868
868
  result = false;
869
869
  return false;
870
870
  }
871
871
  } else {
872
872
  return result;
873
873
  }
874
874
  };
875
875
  if (typeof options === 'object' && isImageOptimizeEnable()) {
876
876
  return getQualityImageNew(imgUrl, options, isIgnoreOptimizeFromServer);
877
877
  } else {
878
878
  return getQualityImageOld(imgUrl, options);
879
879
  }
880
880
  const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
881
881
  windowWidth: window.innerWidth,
882
882
  containerWidth: getContainerWidth(buildType, {
883
883
  windowWidth: window.innerWidth,
884
884
  }),
885
885
  screenWidth: window.innerWidth,
886
886
  platform: '',
887
887
  model: '',
888
888
  system: '',
889
889
  };
890
890
  return getSystemInfo;
891
891
  const params = Object.assign(
892
892
  {},
893
893
  {
894
894
  title: '',
895
895
  duration: 1500,
896
896
  },
897
897
  options,
898
898
  );
899
899
  params.duration = params.duration / 1000;
900
900
  if (
901
901
  isJdApp &&
902
902
  !isJdAppForNotMain &&
903
903
  !isJdAndHarmonyDevice &&
904
904
  !window?.PAGE_DATA?.businessData?.hideNativeToast
905
905
  ) {
906
906
  const showSuccessType = isIosDevice ? ToastIosType.SUCCESS : ToastAndroidType.SUCCESS;
907
907
  const duration = isAndroidDevice ? 0 : params.duration;
908
908
  nativePageShowToast(options.title, showSuccessType, duration);
909
909
  console.log('执行原生toast success');
910
910
  } else {
911
911
  showSuccessToast(options);
912
912
  }
913
913
  const params = Object.assign(
914
914
  {},
915
915
  {
916
916
  title: '',
917
917
  duration: 1500,
918
918
  },
919
919
  options,
920
920
  );
921
921
  params.duration = params.duration / 1000;
922
922
  if (isJdApp && !isJdAppForNotMain && !window?.PAGE_DATA?.businessData?.hideNativeToast) {
923
923
  const showSuccessType = isIosDevice ? ToastIosType.FAIL : ToastAndroidType.FAIL;
924
924
  const duration = isAndroidDevice ? 0 : params.duration;
925
925
  nativePageShowToast(options.title, showSuccessType, duration);
926
926
  console.log('执行原生toast fail');
927
927
  } else {
928
928
  console.log('执行H5 toast fail');
929
929
  showFailToast(options);
930
930
  }
931
931
  const params = Object.assign(
932
932
  {},
933
933
  {
934
934
  title: '',
935
935
  duration: 1500,
936
936
  },
937
937
  options,
938
938
  );
939
939
  params.duration = params.duration / 1000;
940
940
  if (isJdApp && !isJdAppForNotMain && !window?.PAGE_DATA?.businessData?.hideNativeToast) {
941
941
  const showSuccessType = isIosDevice ? ToastIosType.NORMAL : ToastAndroidType.NORMAL;
942
942
  const duration = isAndroidDevice ? 0 : params.duration;
943
943
  nativePageShowToast(options.title, showSuccessType, duration);
944
944
  } else {
945
945
  showNormalToast(options);
946
946
  }
947
947
  if (isLanguageForEn) {
948
948
  count = Number(count);
949
949
  if (count >= 1000000000) {
950
950
  return (count / 1000000000).toFixed(fixedNum) + 'B';
951
951
  } else if (count >= 1000000) {
952
952
  return (count / 1000000).toFixed(fixedNum) + 'M';
953
953
  } else if (count >= 1000) {
954
954
  return (count / 1000).toFixed(fixedNum) + 'K';
955
955
  } else {
956
956
  return count;
957
957
  }
958
958
  } else {
959
959
  return h5CountStringify(count, fixedNum, unit, maxNum);
960
960
  }
961
961
  const createLoadingEle = document.createElement('div');
962
962
  createLoadingEle.id = 'J_shopLoading';
963
963
  createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`;
964
964
  createLoadingEle.innerHTML = `<div class='d-loading-content'>
965
965
  <span class='d-shop-loading-icon'></span>
966
966
  <p class='d-shop-text'>${text}</p>
967
967
  </div>`;
968
968
  const getEle = document.body ? document.body : document.getElementsByTagName('body')[0];
969
969
  getEle.appendChild(createLoadingEle);
970
970
  const getEle = document.getElementById('J_shopLoading');
971
971
  getEle && getEle.remove();
972
972
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getReviseSystemInfo(params);
973
973
  if (!systemInfo.system && window) {
974
974
  systemInfo.system = window.navigator.userAgent;
975
975
  systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i);
976
976
  }
977
977
  const isIOS = !!systemInfo?.system.match(/ios/i);
978
978
  const isAndroid = !!systemInfo?.system.match(/android/i);
979
979
  systemInfo.navBarHeight = 0;
980
980
  systemInfo.statusBarHeight = 0;
981
981
  systemInfo.capsulePosition = null;
982
982
  systemInfo.isIOS = isIOS;
983
983
  systemInfo.isAndroid = isAndroid;
984
984
  _ShopSystemInfo = systemInfo;
985
985
  return systemInfo;
986
986
  const result = originDealShopContentData(pageData, draBusinessCustomReport, isvdev);
987
987
  if (isJdAndHarmonyDevice && isNewHarmonyShop) {
988
988
  result.shopContentContainerListData = result.shopContentContainerListData.filter(
989
989
  (item) =>
990
990
  item.floors.length > 0 &&
991
991
  !isInHarmonyBlacklistByModuleFlag(item.containerId, result.shopContentContainerListData),
992
992
  );
993
993
  }
994
994
  return result;
995
995
  const numScale = Number(scale);
996
996
  if (isNaN(numScale)) {
997
997
  console.warn(
998
998
  `The 'scale' parameter of the 'isInGrayscale' function is invalid! Expected a number, but received ${scale}`,
999
999
  );
1000
1000
  return false;
1001
1001
  }
1002
1002
  const { venderId } = global.info.queryInfo || {};
1003
1003
  const id = venderId;
1004
1004
  if (!id && numScale !== 1) {
1005
1005
  return false;
1006
1006
  }
1007
1007
  const useScale = Math.max(0, Math.min(1, numScale));
1008
1008
  const isMatch = numScale === 1 || Math.floor(Number(id) % (1 / useScale)) === 0;
1009
1009
  if (reportKey) {
1010
1010
  console.log(
1011
1011
  `基于KEY[${reportKey}]的灰度调用1次~`,
1012
1012
  getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
1013
1013
  );
1014
1014
  if (isMatch) {
1015
1015
  console.log(
1016
1016
  `基于KEY[${reportKey}]的命中1次灰度!`,
1017
1017
  getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
1018
1018
  );
1019
1019
  }
1020
1020
  }
1021
1021
  return isMatch;
1022
1022
  isJdApp,
1023
1023
  isWxApp,
1024
1024
  isIosDevice,
1025
1025
  isAndroidDevice,
1026
1026
  isHarmonyDevice,
1027
1027
  isJdAndIosDevice,
1028
1028
  isJdAndAndroidDevice,
1029
1029
  isJdAndHarmonyDevice,
1030
1030
  isNewHarmonyShop,
1031
1031
  isJdAndroidX5Core,
1032
1032
  isMin,
1033
1033
  isWxMin,
1034
1034
  isWxMinAndWxapp,
1035
1035
  isJdMinAndHarmony,
1036
1036
  isJdMin,
1037
1037
  isH5,
1038
1038
  isH5AndJdShopView,
1039
1039
  isChartH5,
1040
1040
  isH5AndJdShopViewNativeScroll,
1041
1041
  isH5AndJdShopViewH5Scroll,
1042
1042
  isH5AndJdShopH5CustomScrollView,
1043
1043
  isH5AndJingGouMini,
1044
1044
  isWxMiniH5View,
1045
1045
  isAscfApp,
1046
1046
  urlCookie,
1047
1047
  sliceArrToChunkList,
1048
1048
  dealAddress,
1049
1049
  objectToUrlEncode,
1050
1050
  parseQueryUrlString,
1051
1051
  setLowSmallPicUrl,
1052
1052
  setTaroStorage,
1053
1053
  getTaroStorageKeyValue,
1054
1054
  removeTaroStorageKey,
1055
1055
  clearTaroStorageKey,
1056
1056
  getAvifSupport,
1057
1057
  getWebpSupport,
1058
1058
  getQualityImage,
1059
1059
  formatCountForUnit as countStringify,
1060
1060
  getWxAppCookieStr,
1061
1061
  getSystemInfos,
1062
1062
  pxTransformFromData,
1063
1063
  dealShopContentDataAndReport as dealShopContentData,
1064
1064
  dateFormat,
1065
1065
  throttle,
1066
1066
  lodashThrottle,
1067
1067
  debounce,
1068
1068
  addHttps,
1069
1069
  commonShowSuccessToast as showSuccessToast,
1070
1070
  commonShowFailToast as showFailToast,
1071
1071
  commonShowNormalToast as showNormalToast,
1072
1072
  showShopLoading,
1073
1073
  hideShopLoading,
1074
1074
  stopNativeScrollEvent,
1075
1075
  getAppChannelType,
1076
1076
  formatTabActiveMenuType,
1077
1077
  filterUrlQueryData,
1078
1078
  draCustomReport,
1079
1079
  remoteCustomReport,
1080
1080
  draInterfaceCustomReport,
1081
1081
  draBusinessCustomReport,
1082
1082
  draBusinessCustomLogReport,
1083
1083
  isMemberPage,
1084
1084
  getFloorDataToDataDefines,
1085
1085
  isOpenJdAppUrl,
1086
1086
  jdOpenAppParams,
1087
1087
  createJdOpenAppUrl,
1088
1088
  isEmpty,
1089
1089
  getJdAppReportPageSource,
1090
1090
  isAppClassifyPage,
1091
1091
  isAppHomeForMarketPage,
1092
1092
  isImageOptimizeEnable,
1093
1093
  isPc,
1094
1094
  isPcClassifyPage,
1095
1095
  ipLoc_djd,
1096
1096
  isTjScence,
1097
1097
  isH5AdnJxMini,
1098
1098
  isTjM,
1099
1099
  isTjJxM,
1100
1100
  isTJApp,
1101
1101
  isH5AdnHaoWuJie,
1102
1102
  tjChannel,
1103
1103
  dealJdOpenAppData,
1104
1104
  jdAppVersionCompare,
1105
1105
  dealNativePixelToCssPixel,
1106
1106
  isAppStowShop,
1107
1107
  getSgmCustomCode,
1108
1108
  handleSgmCodeTaroVersion,
1109
1109
  isInGrayscale,
1110
1110
  isIpadDevice,
1111
1111
  getBorderStyle,
1112
1112
  isSupportHybridHttpRequest,
1113
1113
  isLanguageForEn,
1114
1114
  sColor,
1115
1115
  isTabletDevice,
1116
1116
  taroToTransformRoutimePXNumber,
1117
1117
  updateContainerWidth,
1118
1118
  isInJdShopView,
1119
1119
  isDongWebView,
1120
1120
  isLanguageForHk,
1121
1121
  languageNowType,
1122
1122
  isInJdAppH5DebugMode,
1123
1123
  isJdLiteApp,
1124
1124
  isJdAppForNotMain,