@conecli/cone-render 0.10.1-beta.4 → 0.10.1-beta.5

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 (50) hide show
  1. package/dist/api/index.ts +1 -1
  2. package/dist/common/const.ts +1 -1
  3. package/dist/common/index.h5.ts +1 -1
  4. package/dist/common/index.weapp.ts +1 -1
  5. package/dist/common/sgmCustomCode.ts +1 -1
  6. package/dist/components/ErrorBoundary.tsx +1 -1
  7. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  8. package/dist/components/base/CustomVideo/index.tsx +1 -1
  9. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  10. package/dist/components/base/InViewRender/index.weapp.tsx +1 -1
  11. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  12. package/dist/components/base/LazyLayoutLoad/index.weapp.tsx +1 -1
  13. package/dist/components/base/LazyLoadImage/index.h5.module.scss +3 -0
  14. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  15. package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
  16. package/dist/components/base/NetworkDataError/index.module.scss +3 -0
  17. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  18. package/dist/components/decorate/DecorateFloorModule/index.module.scss +11 -0
  19. package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
  20. package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
  21. package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
  22. package/dist/components/floorItem.tsx +1 -1
  23. package/dist/components/remoteFloorItem.tsx +1 -1
  24. package/dist/interface/common.ts +1 -1
  25. package/dist/interface/component.ts +1 -1
  26. package/dist/interface/service.ts +1 -1
  27. package/dist/jumpEventReport/base.ts +1 -1
  28. package/dist/jumpEventReport/const.ts +1 -1
  29. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  30. package/dist/jumpEventReport/web.base.ts +1 -1
  31. package/dist/jumpEventReport/web.jd.ts +1 -1
  32. package/dist/modules/ContainerFloorList/index.h5.module.scss +1 -0
  33. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  34. package/dist/open/api/device.ts +1 -1
  35. package/dist/open/api/request.ts +1 -1
  36. package/dist/open/api/shopMember.ts +1 -1
  37. package/dist/open/api/util.ts +1 -1
  38. package/dist/open/components/index.ts +1 -1
  39. package/dist/sass/app.h5.scss +5 -0
  40. package/dist/sass/base.scss +45 -0
  41. package/dist/service/requestServer.ts +1 -1
  42. package/dist/utils/connectNativeJsBridge.ts +1 -1
  43. package/dist/utils/h5Utils.ts +1 -1
  44. package/dist/utils/index.h5.ts +1 -1
  45. package/dist/utils/index.ts +1 -1
  46. package/dist/utils/index.weapp.ts +1 -1
  47. package/dist/utils/sgmCodeUtils.ts +1 -1
  48. package/dist/utils/taroRenderUtil.ts +1 -1
  49. package/dist/utils/utils.ts +1 -1
  50. package/package.json +24 -23
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
2
1
  nativePageShowToast,
3
2
  ToastAndroidType,
4
3
  ToastIosType,
5
4
  getMPaasConfigByNative,
6
5
  getAppChannelType,
7
6
  isAndroidDevice,
8
7
  isH5AndJdShopView,
9
8
  isChartH5,
10
9
  isH5AndJdShopViewNativeScroll,
11
10
  isIosDevice,
12
11
  isJdAndAndroidDevice,
13
12
  isJdAndIosDevice,
14
13
  isJdApp,
15
14
  isWxApp,
16
15
  isWxMiniH5View,
17
16
  isJdAndHarmonyDevice,
18
17
  isH5AndJingGouMini,
19
18
  urlCookie,
20
19
  sgmCustomReport,
21
20
  isMemberPage,
22
21
  isH5AndJdShopViewH5Scroll,
23
22
  isH5AndJdShopH5CustomScrollView,
24
23
  isAppClassifyPage,
25
24
  isPc,
26
25
  ipLoc_djd,
27
26
  jdAppVersionCompare,
28
27
  isTjScence,
29
28
  isH5AdnJxMini,
30
29
  isTjM,
31
30
  isTjJxM,
32
31
  isTJApp,
33
32
  isH5AdnHaoWuJie,
34
33
  tjChannel,
35
34
  dealNativePixelToCssPixel,
36
35
  isAppStowShop,
37
36
  isJdAndroidX5Core,
38
37
  parseQueryUrlObj,
39
38
  addHttps,
40
39
  clearTaroStorageKey,
41
40
  countStringify,
42
41
  dateFormat,
43
42
  dealAddress,
44
43
  dealShopContentData as originDealShopContentData,
45
44
  debounce,
46
45
  filterUrlQueryData,
47
46
  formatTabActiveMenuType,
48
47
  getAvifSupport,
49
48
  getWebpSupport,
50
49
  getTaroStorageKeyValue,
51
50
  getWxAppCookieStr,
52
51
  isH5,
53
52
  isMin,
54
53
  isJdMin,
55
54
  isWxMin,
56
55
  isWxMinAndWxapp,
57
56
  isJdMinAndHarmony,
58
57
  lodashThrottle,
59
58
  objectToUrlEncode,
60
59
  parseQueryUrlString,
61
60
  removeTaroStorageKey,
62
61
  setLowSmallPicUrl,
63
62
  setTaroStorage,
64
63
  showFailToast,
65
64
  showNormalToast,
66
65
  showSuccessToast,
67
66
  sliceArrToChunkList,
68
67
  throttle,
69
68
  getQualityImageNew,
70
69
  getQualityImageOld,
71
70
  isOpenJdAppUrl,
72
71
  jdOpenAppParams,
73
72
  createJdOpenAppUrl,
74
73
  isEmpty,
75
74
  getJdAppReportPageSource,
76
75
  dealJdOpenAppData,
77
76
  const getNum = Number(num)
78
77
  let _changeLayoutWidth = layoutWidth
79
78
  if (!_changeLayoutWidth) {
80
79
  _changeLayoutWidth =
81
80
  _ShopSystemInfo && _ShopSystemInfo?.windowWidth
82
81
  ? _ShopSystemInfo.windowWidth
83
82
  : Taro.getSystemInfoSync()?.windowWidth
84
83
  }
85
84
  return Math.round((getNum / widthSize) * _changeLayoutWidth)
86
85
  changeSize,
87
86
  designWidth = 750,
88
87
  systemInfo,
89
88
  const getRootFontSize =
90
89
  (40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750
91
90
  const getRealRootFontSize =
92
91
  getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize
93
92
  return Math.ceil(
94
93
  (((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) *
95
94
  getRealRootFontSize,
96
95
  )
97
96
  console.log(
98
97
  '获取系统宽度systemInfo?.windowWidth',
99
98
  systemInfo?.windowWidth,
100
99
  'taroToTransformRoutimePXNumber(changeWidth)',
101
100
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
102
101
  )
103
102
  return buildType === BUILD_TYPE.CLASSIFY && systemInfo?.windowWidth
104
103
  ? systemInfo?.windowWidth -
105
104
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
106
105
  : systemInfo?.windowWidth ?? 0
107
106
  const systemInfo = Taro.getSystemInfoSync()
108
107
  if (params && params?.pageWidth && params?.pageHeight) {
109
108
  systemInfo.windowWidth = params?.pageWidth
110
109
  systemInfo.windowHeight = params?.pageHeight
111
110
  }
112
111
  systemInfo['containerWidth'] = getContainerWidth(buildType, systemInfo)
113
112
  console.warn('====获取系统信息=====', systemInfo)
114
113
  return systemInfo
115
114
  const appVersionCheckPass = jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0
116
115
  const supportBuildType = /app-view|app-member|app-classify|member-home/
117
116
  const scopeCheckPass = supportBuildType.test(buildType || '')
118
117
  const enableAvifOptimize = appVersionCheckPass && scopeCheckPass
119
118
  if (enableAvifOptimize) {
120
119
  const configData = global.getDynamicConfig('avifSwitch')
121
120
  if (!hasOutputLog) {
122
121
  console.warn(
123
122
  '� ~~ file: utils.ts:187 ~~ isImageOptimizeEnable ~~ enableAvifOptimize:',
124
123
  enableAvifOptimize,
125
124
  ' appVersionCheckPass:',
126
125
  appVersionCheckPass,
127
126
  ' scopeCheckPass:',
128
127
  scopeCheckPass,
129
128
  )
130
129
  console.warn(
131
130
  '� ~~ file: utils.ts:188 ~~ global.getDynamicConfig ~~ configData:',
132
131
  configData,
133
132
  )
134
133
  }
135
134
  const {
136
135
  globalOn = true,
137
136
  ignoreOptimizeFromServer = false,
138
137
  page = {},
139
138
  whiteList = [],
140
139
  blackList = [],
141
140
  } = configData || {}
142
141
  const { shopId = '0', venderId = '0' } = parseQueryUrlObj
143
142
  let imageEnableResult = true
144
143
  isIgnoreOptimizeFromServer = ignoreOptimizeFromServer
145
144
  if (
146
145
  blackList.find(
147
146
  (item) => item.sId === Number(shopId) || item.vId === Number(venderId),
148
147
  )
149
148
  ) {
150
149
  imageEnableResult = false
151
150
  if (!hasOutputLog) {
152
151
  console.warn('� ~~ file: utils.ts:198 命中黑名单!')
153
152
  }
154
153
  } else if (
155
154
  whiteList.find(
156
155
  (item) => item.sId === Number(shopId) || item.vId === Number(venderId),
157
156
  )
158
157
  ) {
159
158
  imageEnableResult = true
160
159
  if (!hasOutputLog) {
161
160
  console.warn('� ~~ file: utils.ts:205 命中白名单!')
162
161
  }
163
162
  } else {
164
163
  imageEnableResult = globalOn === true || page[buildType] === true
165
164
  if (!hasOutputLog) {
166
165
  console.warn(
167
166
  '� ~~ file: utils.ts:211 走全局开关+页面开关控制逻辑,开关结果:',
168
167
  imageEnableResult,
169
168
  )
170
169
  }
171
170
  }
172
171
  if (!hasOutputLog) {
173
172
  hasOutputLog = true
174
173
  }
175
174
  return imageEnableResult
176
175
  } else {
177
176
  return false
178
177
  }
179
178
  if (typeof options === 'object' && isImageOptimizeEnable()) {
180
179
  return getQualityImageNew(imgUrl, options, isIgnoreOptimizeFromServer)
181
180
  } else {
182
181
  return getQualityImageOld(imgUrl, options)
183
182
  }
184
183
  const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
185
184
  windowWidth: window.innerWidth,
186
185
  containerWidth: getContainerWidth(buildType, {
187
186
  windowWidth: window.innerWidth,
188
187
  }),
189
188
  screenWidth: window.innerWidth,
190
189
  platform: '',
191
190
  model: '',
192
191
  system: '',
193
192
  }
194
193
  if (isJdApp && isAndroidDevice && getSystemInfo.windowWidth <= 0) {
195
194
  getSystemInfo.windowWidth = getSystemInfo.screenWidth
196
195
  getSystemInfo['containerWidth'] = getContainerWidth(
197
196
  buildType,
198
197
  getSystemInfo,
199
198
  )
200
199
  }
201
200
  return getSystemInfo
202
201
  const params = Object.assign(
203
202
  {},
204
203
  {
205
204
  title: '',
206
205
  duration: 1500,
207
206
  },
208
207
  options,
209
208
  )
210
209
  params.duration = params.duration / 1000
211
210
  if (isJdApp) {
212
211
  const showSuccessType = isIosDevice
213
212
  ? ToastIosType.SUCCESS
214
213
  : ToastAndroidType.SUCCESS
215
214
  const duration = isAndroidDevice ? 0 : params.duration
216
215
  nativePageShowToast(options.title, showSuccessType, duration)
217
216
  console.log('执行原生toast success')
218
217
  } else {
219
218
  showSuccessToast(options)
220
219
  }
221
220
  const params = Object.assign(
222
221
  {},
223
222
  {
224
223
  title: '',
225
224
  duration: 1500,
226
225
  },
227
226
  options,
228
227
  )
229
228
  params.duration = params.duration / 1000
230
229
  if (isJdApp) {
231
230
  const showSuccessType = isIosDevice
232
231
  ? ToastIosType.FAIL
233
232
  : ToastAndroidType.FAIL
234
233
  const duration = isAndroidDevice ? 0 : params.duration
235
234
  nativePageShowToast(options.title, showSuccessType, duration)
236
235
  console.log('执行原生toast fail')
237
236
  } else {
238
237
  console.log('执行H5 toast fail')
239
238
  showFailToast(options)
240
239
  }
241
240
  const params = Object.assign(
242
241
  {},
243
242
  {
244
243
  title: '',
245
244
  duration: 1500,
246
245
  },
247
246
  options,
248
247
  )
249
248
  params.duration = params.duration / 1000
250
249
  if (isJdApp) {
251
250
  const showSuccessType = isIosDevice
252
251
  ? ToastIosType.NORMAL
253
252
  : ToastAndroidType.NORMAL
254
253
  const duration = isAndroidDevice ? 0 : params.duration
255
254
  nativePageShowToast(options.title, showSuccessType, duration)
256
255
  } else {
257
256
  showNormalToast(options)
258
257
  }
259
258
  const createLoadingEle = document.createElement('div')
260
259
  createLoadingEle.id = 'J_shopLoading'
261
260
  createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`
262
261
  createLoadingEle.innerHTML = `<div class='d-loading-content'>
263
262
  <span class='d-shop-loading-icon'></span>
264
263
  <p class='d-shop-text'>${text}</p>
265
264
  </div>`
266
265
  const getEle = document.body
267
266
  ? document.body
268
267
  : document.getElementsByTagName('body')[0]
269
268
  getEle.appendChild(createLoadingEle)
270
269
  const getEle = document.getElementById('J_shopLoading')
271
270
  getEle && getEle.remove()
272
271
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes =
273
272
  getReviseSystemInfo(params)
274
273
  if (!systemInfo.system && window) {
275
274
  systemInfo.system = window.navigator.userAgent
276
275
  systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i)
277
276
  }
278
277
  const isIOS = !!systemInfo?.system.match(/ios/i)
279
278
  const isAndroid = !!systemInfo?.system.match(/android/i)
280
279
  systemInfo.navBarHeight = 0
281
280
  systemInfo.statusBarHeight = 0
282
281
  systemInfo.capsulePosition = null
283
282
  systemInfo.isIOS = isIOS
284
283
  systemInfo.isAndroid = isAndroid
285
284
  _ShopSystemInfo = systemInfo
286
285
  return systemInfo
287
286
  return originDealShopContentData(pageData, sgmCustomReport, isvdev)
288
287
  isJdApp,
289
288
  isWxApp,
290
289
  isIosDevice,
291
290
  isAndroidDevice,
292
291
  isJdAndIosDevice,
293
292
  isJdAndAndroidDevice,
294
293
  isJdAndHarmonyDevice,
295
294
  isJdAndroidX5Core,
296
295
  isMin,
297
296
  isWxMin,
298
297
  isWxMinAndWxapp,
299
298
  isJdMinAndHarmony,
300
299
  isJdMin,
301
300
  isH5,
302
301
  isH5AndJdShopView,
303
302
  isChartH5,
304
303
  isH5AndJdShopViewNativeScroll,
305
304
  isH5AndJdShopViewH5Scroll,
306
305
  isH5AndJdShopH5CustomScrollView,
307
306
  isH5AndJingGouMini,
308
307
  isWxMiniH5View,
309
308
  urlCookie,
310
309
  sliceArrToChunkList,
311
310
  dealAddress,
312
311
  objectToUrlEncode,
313
312
  parseQueryUrlString,
314
313
  setLowSmallPicUrl,
315
314
  setTaroStorage,
316
315
  getTaroStorageKeyValue,
317
316
  removeTaroStorageKey,
318
317
  clearTaroStorageKey,
319
318
  getAvifSupport,
320
319
  getWebpSupport,
321
320
  getQualityImage,
322
321
  countStringify,
323
322
  getWxAppCookieStr,
324
323
  getSystemInfos,
325
324
  pxTransformFromData,
326
325
  dealShopContentDataAndReport as dealShopContentData,
327
326
  dateFormat,
328
327
  throttle,
329
328
  lodashThrottle,
330
329
  debounce,
331
330
  addHttps,
332
331
  commonShowSuccessToast as showSuccessToast,
333
332
  commonShowFailToast as showFailToast,
334
333
  commonShowNormalToast as showNormalToast,
335
334
  showShopLoading,
336
335
  hideShopLoading,
337
336
  getAppChannelType,
338
337
  formatTabActiveMenuType,
339
338
  filterUrlQueryData,
340
339
  sgmCustomReport,
341
340
  isMemberPage,
342
341
  getFloorDataToDataDefines,
343
342
  isOpenJdAppUrl,
344
343
  jdOpenAppParams,
345
344
  createJdOpenAppUrl,
346
345
  isEmpty,
347
346
  getJdAppReportPageSource,
348
347
  isAppClassifyPage,
349
348
  isImageOptimizeEnable,
350
349
  isPc,
351
350
  ipLoc_djd,
352
351
  isTjScence,
353
352
  isH5AdnJxMini,
354
353
  isTjM,
355
354
  isTjJxM,
356
355
  isTJApp,
357
356
  isH5AdnHaoWuJie,
358
357
  tjChannel,
359
358
  dealJdOpenAppData,
360
359
  jdAppVersionCompare,
361
360
  dealNativePixelToCssPixel,
362
361
  isAppStowShop,
363
362
  getSgmCustomCode,
363
+ import Taro from "@tarojs/taro";
364
364
  nativePageShowToast,
365
365
  ToastAndroidType,
366
366
  ToastIosType,
367
367
  getMPaasConfigByNative,
368
368
  stopNativeScrollEvent,
369
369
  getAppChannelType,
370
370
  isAndroidDevice,
371
371
  isH5AndJdShopView,
372
372
  isChartH5,
373
373
  isH5AndJdShopViewNativeScroll,
374
374
  isIosDevice,
375
375
  isJdAndAndroidDevice,
376
376
  isJdAndIosDevice,
377
377
  isJdApp,
378
378
  isWxApp,
379
379
  isWxMiniH5View,
380
380
  isJdAndHarmonyDevice,
381
381
  isH5AndJingGouMini,
382
382
  urlCookie,
383
383
  sgmCustomReport,
384
384
  isMemberPage,
385
385
  isH5AndJdShopViewH5Scroll,
386
386
  isH5AndJdShopH5CustomScrollView,
387
387
  isAppClassifyPage,
388
388
  isAppHomeForMarketPage,
389
389
  isPc,
390
390
  ipLoc_djd,
391
391
  jdAppVersionCompare,
392
392
  isTjScence,
393
393
  isH5AdnJxMini,
394
394
  isTjM,
395
395
  isTjJxM,
396
396
  isTJApp,
397
397
  isH5AdnHaoWuJie,
398
398
  tjChannel,
399
399
  dealNativePixelToCssPixel,
400
400
  isAppStowShop,
401
401
  isJdAndroidX5Core,
402
402
  parseQueryUrlObj,
403
403
  addHttps,
404
404
  clearTaroStorageKey,
405
405
  countStringify,
406
406
  dateFormat,
407
407
  dealAddress,
408
408
  dealShopContentData as originDealShopContentData,
409
409
  debounce,
410
410
  filterUrlQueryData,
411
411
  formatTabActiveMenuType,
412
412
  getAvifSupport,
413
413
  getWebpSupport,
414
414
  getTaroStorageKeyValue,
415
415
  getWxAppCookieStr,
416
416
  isH5,
417
417
  isMin,
418
418
  isJdMin,
419
419
  isWxMin,
420
420
  isWxMinAndWxapp,
421
421
  isJdMinAndHarmony,
422
422
  lodashThrottle,
423
423
  objectToUrlEncode,
424
424
  parseQueryUrlString,
425
425
  removeTaroStorageKey,
426
426
  setLowSmallPicUrl,
427
427
  setTaroStorage,
428
428
  showFailToast,
429
429
  showNormalToast,
430
430
  showSuccessToast,
431
431
  sliceArrToChunkList,
432
432
  throttle,
433
433
  getQualityImageNew,
434
434
  getQualityImageOld,
435
435
  isOpenJdAppUrl,
436
436
  jdOpenAppParams,
437
437
  createJdOpenAppUrl,
438
438
  isEmpty,
439
439
  getJdAppReportPageSource,
440
440
  dealJdOpenAppData,
441
441
  const getNum = Number(num);
442
442
  let _changeLayoutWidth = layoutWidth;
443
443
  if (!_changeLayoutWidth) {
444
444
  _changeLayoutWidth =
445
445
  _ShopSystemInfo && _ShopSystemInfo?.windowWidth
446
446
  ? _ShopSystemInfo.windowWidth
447
447
  : Taro.getSystemInfoSync()?.windowWidth;
448
448
  }
449
449
  return Math.round((getNum / widthSize) * _changeLayoutWidth);
450
450
  changeSize,
451
451
  designWidth = 750,
452
452
  systemInfo
453
453
  const getRootFontSize =
454
454
  (40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750;
455
455
  const getRealRootFontSize =
456
456
  getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize;
457
457
  return Math.ceil(
458
458
  (((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) *
459
459
  getRealRootFontSize
460
460
  );
461
461
  console.log(
462
462
  "获取系统宽度systemInfo?.windowWidth",
463
463
  systemInfo?.windowWidth,
464
464
  "taroToTransformRoutimePXNumber(changeWidth)",
465
465
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
466
466
  );
467
467
  return buildType === BUILD_TYPE.CLASSIFY && systemInfo?.windowWidth
468
468
  ? systemInfo?.windowWidth -
469
469
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
470
470
  : systemInfo?.windowWidth ?? 0;
471
471
  const systemInfo = Taro.getSystemInfoSync();
472
472
  if (params && params?.pageWidth && params?.pageHeight) {
473
473
  systemInfo.windowWidth = params?.pageWidth;
474
474
  systemInfo.windowHeight = params?.pageHeight;
475
475
  }
476
476
  systemInfo["containerWidth"] = getContainerWidth(buildType, systemInfo);
477
477
  console.warn("====获取系统信息=====", systemInfo);
478
478
  return systemInfo;
479
479
  let result: boolean | null = null;
480
480
  return function () {
481
481
  if (result === null) {
482
482
  const appVersionCheckPass =
483
483
  jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0;
484
484
  if (!isJdApp) {
485
485
  console.warn("� ~~ file: utils.ts:191 站外H5默认打开图片优化~");
486
486
  isIgnoreOptimizeFromServer = true;
487
487
  result = true;
488
488
  return true;
489
489
  }
490
490
  const enableAvifOptimize = appVersionCheckPass;
491
491
  if (enableAvifOptimize) {
492
492
  const configData = global.getDynamicConfig("avifSwitch");
493
493
  console.warn(
494
494
  "� ~~ file: utils.ts:196 ~~ global.getDynamicConfig ~~ buildType:",
495
495
  buildType
496
496
  );
497
497
  console.warn(
498
498
  "� ~~ file: utils.ts:197 ~~ global.getDynamicConfig ~~ configData:",
499
499
  configData
500
500
  );
501
501
  const {
502
502
  globalOn = true,
503
503
  ignoreOptimizeFromServer = false,
504
504
  page = {},
505
505
  grayscale = {},
506
506
  whiteList = [],
507
507
  blackList = [],
508
508
  } = configData || {};
509
509
  const { shopId = "0", venderId = "0" } = parseQueryUrlObj;
510
510
  let imageEnableResult = true;
511
511
  isIgnoreOptimizeFromServer = ignoreOptimizeFromServer;
512
512
  if (
513
513
  blackList.find(
514
514
  (item) =>
515
515
  item.sId === Number(shopId) || item.vId === Number(venderId)
516
516
  )
517
517
  ) {
518
518
  imageEnableResult = false;
519
519
  console.warn("� ~~ file: utils.ts:198 命中黑名单~");
520
520
  } else if (
521
521
  whiteList.find(
522
522
  (item) =>
523
523
  item.sId === Number(shopId) || item.vId === Number(venderId)
524
524
  )
525
525
  ) {
526
526
  isIgnoreOptimizeFromServer = true;
527
527
  imageEnableResult = true;
528
528
  console.warn("� ~~ file: utils.ts:205 命中白名单~");
529
529
  } else if (
530
530
  grayscale[buildType] &&
531
531
  isInGrayscale(grayscale[buildType], "imageOptimizeSwitch")
532
532
  ) {
533
533
  isIgnoreOptimizeFromServer = true;
534
534
  imageEnableResult = true;
535
535
  console.warn("� ~~ file: utils.ts:214 命中灰度~");
536
536
  } else {
537
537
  imageEnableResult = globalOn === true || page[buildType] === true;
538
538
  if (globalOn === true) {
539
539
  isIgnoreOptimizeFromServer = true;
540
540
  console.warn(
541
541
  "� ~~ file: utils.ts:220 走全局开关控制逻辑,开关已打开~"
542
542
  );
543
543
  } else if (page[buildType] === true) {
544
544
  console.warn(
545
545
  "� ~~ file: utils.ts:220 走页面开关控制逻辑,开关已打开~"
546
546
  );
547
547
  } else {
548
548
  console.warn(
549
549
  "� ~~ file: utils.ts:220 走全局或页面开关控制逻辑,开关未打开!"
550
550
  );
551
551
  }
552
552
  }
553
553
  result = imageEnableResult;
554
554
  return imageEnableResult;
555
555
  } else {
556
556
  result = false;
557
557
  return false;
558
558
  }
559
559
  } else {
560
560
  return result;
561
561
  }
562
562
  };
563
563
  if (typeof options === "object" && isImageOptimizeEnable()) {
564
564
  return getQualityImageNew(imgUrl, options, isIgnoreOptimizeFromServer);
565
565
  } else {
566
566
  return getQualityImageOld(imgUrl, options);
567
567
  }
568
568
  const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
569
569
  windowWidth: window.innerWidth,
570
570
  containerWidth: getContainerWidth(buildType, {
571
571
  windowWidth: window.innerWidth,
572
572
  }),
573
573
  screenWidth: window.innerWidth,
574
574
  platform: "",
575
575
  model: "",
576
576
  system: "",
577
577
  };
578
578
  if (isJdApp && isAndroidDevice && getSystemInfo.windowWidth <= 0) {
579
579
  getSystemInfo.windowWidth = getSystemInfo.screenWidth;
580
580
  getSystemInfo["containerWidth"] = getContainerWidth(
581
581
  buildType,
582
582
  getSystemInfo
583
583
  );
584
584
  }
585
585
  return getSystemInfo;
586
586
  const params = Object.assign(
587
587
  {},
588
588
  {
589
589
  title: "",
590
590
  duration: 1500,
591
591
  },
592
592
  options
593
593
  );
594
594
  params.duration = params.duration / 1000;
595
595
  if (isJdApp) {
596
596
  const showSuccessType = isIosDevice
597
597
  ? ToastIosType.SUCCESS
598
598
  : ToastAndroidType.SUCCESS;
599
599
  const duration = isAndroidDevice ? 0 : params.duration;
600
600
  nativePageShowToast(options.title, showSuccessType, duration);
601
601
  console.log("执行原生toast success");
602
602
  } else {
603
603
  showSuccessToast(options);
604
604
  }
605
605
  const params = Object.assign(
606
606
  {},
607
607
  {
608
608
  title: "",
609
609
  duration: 1500,
610
610
  },
611
611
  options
612
612
  );
613
613
  params.duration = params.duration / 1000;
614
614
  if (isJdApp) {
615
615
  const showSuccessType = isIosDevice
616
616
  ? ToastIosType.FAIL
617
617
  : ToastAndroidType.FAIL;
618
618
  const duration = isAndroidDevice ? 0 : params.duration;
619
619
  nativePageShowToast(options.title, showSuccessType, duration);
620
620
  console.log("执行原生toast fail");
621
621
  } else {
622
622
  console.log("执行H5 toast fail");
623
623
  showFailToast(options);
624
624
  }
625
625
  const params = Object.assign(
626
626
  {},
627
627
  {
628
628
  title: "",
629
629
  duration: 1500,
630
630
  },
631
631
  options
632
632
  );
633
633
  params.duration = params.duration / 1000;
634
634
  if (isJdApp) {
635
635
  const showSuccessType = isIosDevice
636
636
  ? ToastIosType.NORMAL
637
637
  : ToastAndroidType.NORMAL;
638
638
  const duration = isAndroidDevice ? 0 : params.duration;
639
639
  nativePageShowToast(options.title, showSuccessType, duration);
640
640
  } else {
641
641
  showNormalToast(options);
642
642
  }
643
643
  const createLoadingEle = document.createElement("div");
644
644
  createLoadingEle.id = "J_shopLoading";
645
645
  createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`;
646
646
  createLoadingEle.innerHTML = `<div class='d-loading-content'>
647
647
  <span class='d-shop-loading-icon'></span>
648
648
  <p class='d-shop-text'>${text}</p>
649
649
  </div>`;
650
650
  const getEle = document.body
651
651
  ? document.body
652
652
  : document.getElementsByTagName("body")[0];
653
653
  getEle.appendChild(createLoadingEle);
654
654
  const getEle = document.getElementById("J_shopLoading");
655
655
  getEle && getEle.remove();
656
656
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes =
657
657
  getReviseSystemInfo(params);
658
658
  if (!systemInfo.system && window) {
659
659
  systemInfo.system = window.navigator.userAgent;
660
660
  systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i);
661
661
  }
662
662
  const isIOS = !!systemInfo?.system.match(/ios/i);
663
663
  const isAndroid = !!systemInfo?.system.match(/android/i);
664
664
  systemInfo.navBarHeight = 0;
665
665
  systemInfo.statusBarHeight = 0;
666
666
  systemInfo.capsulePosition = null;
667
667
  systemInfo.isIOS = isIOS;
668
668
  systemInfo.isAndroid = isAndroid;
669
669
  _ShopSystemInfo = systemInfo;
670
670
  return systemInfo;
671
671
  return originDealShopContentData(pageData, sgmCustomReport, isvdev);
672
672
  const numScale = Number(scale);
673
673
  if (isNaN(numScale)) {
674
674
  console.warn(
675
675
  `The 'scale' parameter of the 'isInGrayscale' function is invalid! Expected a number, but received ${scale}`
676
676
  );
677
677
  return false;
678
678
  }
679
679
  const { venderId } = global.info.queryInfo || {};
680
680
  const id = venderId;
681
681
  if (!id && numScale !== 1) {
682
682
  return false;
683
683
  }
684
684
  const useScale = Math.max(0, Math.min(1, numScale));
685
685
  const isMatch =
686
686
  numScale === 1 || Math.floor(Number(id) % (1 / useScale)) === 0;
687
687
  if (reportKey) {
688
688
  sgmCustomReport({
689
689
  code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
690
690
  msg: "灰度调用",
691
691
  });
692
692
  console.log(
693
693
  `基于KEY[${reportKey}]的灰度调用1次~`,
694
694
  getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`)
695
695
  );
696
696
  if (isMatch) {
697
697
  sgmCustomReport({
698
698
  code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
699
699
  msg: "灰度命中",
700
700
  });
701
701
  console.log(
702
702
  `基于KEY[${reportKey}]的命中1次灰度!`,
703
703
  getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`)
704
704
  );
705
705
  }
706
706
  }
707
707
  return isMatch;
708
708
  isJdApp,
709
709
  isWxApp,
710
710
  isIosDevice,
711
711
  isAndroidDevice,
712
712
  isJdAndIosDevice,
713
713
  isJdAndAndroidDevice,
714
714
  isJdAndHarmonyDevice,
715
715
  isJdAndroidX5Core,
716
716
  isMin,
717
717
  isWxMin,
718
718
  isWxMinAndWxapp,
719
719
  isJdMinAndHarmony,
720
720
  isJdMin,
721
721
  isH5,
722
722
  isH5AndJdShopView,
723
723
  isChartH5,
724
724
  isH5AndJdShopViewNativeScroll,
725
725
  isH5AndJdShopViewH5Scroll,
726
726
  isH5AndJdShopH5CustomScrollView,
727
727
  isH5AndJingGouMini,
728
728
  isWxMiniH5View,
729
729
  urlCookie,
730
730
  sliceArrToChunkList,
731
731
  dealAddress,
732
732
  objectToUrlEncode,
733
733
  parseQueryUrlString,
734
734
  setLowSmallPicUrl,
735
735
  setTaroStorage,
736
736
  getTaroStorageKeyValue,
737
737
  removeTaroStorageKey,
738
738
  clearTaroStorageKey,
739
739
  getAvifSupport,
740
740
  getWebpSupport,
741
741
  getQualityImage,
742
742
  countStringify,
743
743
  getWxAppCookieStr,
744
744
  getSystemInfos,
745
745
  pxTransformFromData,
746
746
  dealShopContentDataAndReport as dealShopContentData,
747
747
  dateFormat,
748
748
  throttle,
749
749
  lodashThrottle,
750
750
  debounce,
751
751
  addHttps,
752
752
  commonShowSuccessToast as showSuccessToast,
753
753
  commonShowFailToast as showFailToast,
754
754
  commonShowNormalToast as showNormalToast,
755
755
  showShopLoading,
756
756
  hideShopLoading,
757
757
  stopNativeScrollEvent,
758
758
  getAppChannelType,
759
759
  formatTabActiveMenuType,
760
760
  filterUrlQueryData,
761
761
  sgmCustomReport,
762
762
  isMemberPage,
763
763
  getFloorDataToDataDefines,
764
764
  isOpenJdAppUrl,
765
765
  jdOpenAppParams,
766
766
  createJdOpenAppUrl,
767
767
  isEmpty,
768
768
  getJdAppReportPageSource,
769
769
  isAppClassifyPage,
770
770
  isAppHomeForMarketPage,
771
771
  isImageOptimizeEnable,
772
772
  isPc,
773
773
  ipLoc_djd,
774
774
  isTjScence,
775
775
  isH5AdnJxMini,
776
776
  isTjM,
777
777
  isTjJxM,
778
778
  isTJApp,
779
779
  isH5AdnHaoWuJie,
780
780
  tjChannel,
781
781
  dealJdOpenAppData,
782
782
  jdAppVersionCompare,
783
783
  dealNativePixelToCssPixel,
784
784
  isAppStowShop,
785
785
  getSgmCustomCode,
786
786
  handleSgmCodeTaroVersion,
787
787
  isInGrayscale,