@conecli/cone-render 0.8.34 → 0.8.35

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 (52) hide show
  1. package/dist/common/const.ts +1 -1
  2. package/dist/common/index.h5.ts +1 -1
  3. package/dist/common/index.jd.ts +1 -1
  4. package/dist/common/index.ts +1 -1
  5. package/dist/common/index.weapp.ts +1 -1
  6. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  7. package/dist/components/base/ExposureSmart/const.ts +1 -0
  8. package/dist/components/base/ExposureSmart/index.h5.module.scss +18 -4
  9. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  10. package/dist/components/base/ExposureSmart/index.module.scss +20 -9
  11. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  12. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  13. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  14. package/dist/components/base/InViewRender/index.tsx +1 -1
  15. package/dist/components/base/InViewRender/index.weapp.tsx +1 -1
  16. package/dist/components/base/ItemViewExposureSmart/index.module.scss +8 -0
  17. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -0
  18. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  19. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  20. package/dist/components/base/NetworkDataError/const.ts +1 -1
  21. package/dist/components/base/NetworkDataError/index.module.scss +4 -1
  22. package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
  23. package/dist/interface/common.ts +1 -1
  24. package/dist/jumpEventReport/base.ts +1 -1
  25. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  26. package/dist/jumpEventReport/index.h5.ts +1 -1
  27. package/dist/jumpEventReport/index.weapp.ts +1 -1
  28. package/dist/jumpEventReport/web/report.ts +1 -1
  29. package/dist/jumpEventReport/web.base.ts +1 -1
  30. package/dist/jumpEventReport/web.jd.ts +1 -1
  31. package/dist/jumpEventReport/web.jdb.ts +1 -1
  32. package/dist/jumpEventReport/web.jdjch.ts +1 -0
  33. package/dist/libs/taroAppReport.js +2 -2
  34. package/dist/modules/ContainerFloorList/index.h5.module.scss +10 -1
  35. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  36. package/dist/open/api/device.ts +1 -1
  37. package/dist/open/api/track.ts +1 -1
  38. package/dist/open/api/util.ts +1 -1
  39. package/dist/open/components/index.ts +1 -1
  40. package/dist/service/bMallConst.ts +1 -1
  41. package/dist/utils/connectNativeJsBridge.ts +1 -1
  42. package/dist/utils/connectNativeJsBridge.weapp.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/intersectionObserver.ts +1 -1
  48. package/dist/utils/jm-common.js +1 -1
  49. package/dist/utils/utils.ts +1 -1
  50. package/package.json +1 -1
  51. /package/dist/service/{bMallConst.wxapp.ts → bMallConst.weapp.ts} +0 -0
  52. /package/dist/service/http/{colorSign.wxapp.ts → colorSign.weapp.ts} +0 -0
@@ -1 +1 @@
1
- import React from 'react'
2
1
  NETWORK_DATA_TYPE,
3
2
  M_SHOP_DOWNLOAD_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT,
4
3
  APP_SHOP_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT,
5
4
  containerFloorListData: ComponentInterFace.ContainerItemData[]
6
5
  className?: string
7
6
  containerItemClass?: object
8
7
  style?: object
9
8
  hasGoodsFeeds?: boolean
10
9
  builtInComponents?: Object
11
10
  loadingEndComponentFn?: Function
12
11
  sectionType?: string
13
12
  updateShopFloorDataFn?: Function
14
13
  updateContainerFloorListDataFn?: Function
15
14
  customErrorIsvFloorModule?: React.ReactElement
16
15
  const {
17
16
  className,
18
17
  style,
19
18
  containerItemClass = null,
20
19
  containerFloorListData,
21
20
  builtInComponents,
22
21
  loadingEndComponentFn,
23
22
  sectionType,
24
23
  updateShopFloorDataFn,
25
24
  updateContainerFloorListDataFn,
26
25
  customErrorIsvFloorModule,
27
26
  } = props
28
27
 
29
28
  const renderFloorItem = (
30
29
  item,
31
30
  floorItem,
32
31
  floorIndex,
33
32
  containerLayoutLeftRightMargin,
34
33
  lazyLoadState = false,
35
34
  ) => {
36
35
  return (
37
36
  <View
38
37
  className={classNames(shopContainerListStyle['d-floor-item'])}
39
38
  data-floor-uid={floorItem?.uid}
40
39
  data-floor-type={floorItem?.floorExtInfo?.moduleFlag || ''}
41
40
  data-lazy-load={lazyLoadState}
42
41
  key={floorItem.uid}
43
42
  id={`J_floor_${floorItem.uid}`}
44
43
  style={{
45
44
  borderRadius: `${item?.borderRadius || 0}px`,
46
45
  }}
47
46
  >
48
47
  <FloorListItem
49
48
  floorIndex={floorIndex}
50
49
  floorData={floorItem}
51
50
  layoutLeftRightMargin={containerLayoutLeftRightMargin}
52
51
  containerBorderRadius={item?.borderRadius || 0}
53
52
  updateShopFloorDataFn={updateShopFloorDataFn}
54
53
  loadingEndComponentFn={loadingEndComponentFn}
55
54
  key={floorItem.uid}
56
55
  builtInComponents={builtInComponents}
57
56
  updateContainerFloorListDataFn={updateContainerFloorListDataFn}
58
57
  customErrorIsvFloorModule={customErrorIsvFloorModule}
59
58
  />
60
59
  </View>
61
60
  )
62
61
  }
63
62
 
64
63
  const getFloorSetHeight = (item) => {
65
64
  const getHeight = item?.floorExtInfo?.floorHeight
66
65
  ? Number(item?.floorExtInfo?.floorHeight)
67
66
  : 200
68
67
  return getHeight > 0 ? getHeight : 200
69
68
  }
70
69
  return (
71
70
  <View
72
71
  className={classNames(
73
72
  className,
74
73
  shopContainerListStyle['d-shop-container-list'],
75
74
  )}
76
75
  style={style}
77
76
  >
78
77
  <View id="J_shopContainerFloorList">
79
78
  {containerFloorListData.length > 0 ? (
80
79
  containerFloorListData.map((item, index) => {
81
80
  const containerLayoutLeftRightMargin =
82
81
  (item.marginLeft || 0) + (item.marginRight || 0)
83
82
  const getContainerId = `J_container_${item.containerId}`
84
83
  return (
85
84
  <View
86
85
  className={classNames(
87
86
  shopContainerListStyle['d-container-item'],
88
87
  containerItemClass,
89
88
  )}
90
89
  id={getContainerId}
91
90
  key={item.containerId}
92
91
  data-container-id={item?.containerId}
93
92
  data-container-type={item?.typeCode}
94
93
  style={{
95
94
  marginBottom: item.marginBottom
96
95
  ? `${item.marginBottom}px`
97
96
  : 0,
98
97
  marginTop: item.marginTop ? `${item.marginTop}px` : 0,
99
98
  marginLeft: item.marginLeft ? `${item.marginLeft}px` : 0,
100
99
  marginRight: item.marginRight ? `${item.marginRight}px` : 0,
101
100
  borderRadius: item.borderRadius
102
101
  ? `${item.borderRadius}px`
103
102
  : 0,
104
103
  }}
105
104
  >
106
105
  {item.floors &&
107
106
  item.floors.length > 0 &&
108
107
  item.floors?.map((floorItem, floorIndex) => {
109
108
  return index > 4 ? (
110
109
  <LazyLayoutLoad
111
110
  key={item.containerId}
112
111
  sectionType={sectionType}
113
112
  containerId={getContainerId}
114
113
  height={getFloorSetHeight(floorItem)}
115
114
  floorData={floorItem}
116
115
  >
117
116
  {renderFloorItem(
118
117
  item,
119
118
  floorItem,
120
119
  floorIndex,
121
120
  containerLayoutLeftRightMargin,
122
121
  true,
123
122
  )}
124
123
  </LazyLayoutLoad>
125
124
  ) : (
126
125
  renderFloorItem(
127
126
  item,
128
127
  floorItem,
129
128
  floorIndex,
130
129
  containerLayoutLeftRightMargin,
131
130
  )
132
131
  )
133
132
  })}
134
133
  </View>
135
134
  )
136
135
  })
137
136
  ) : (
138
137
  <View
139
138
  className={shopContainerListStyle['d-container-list-no-data']}
140
139
  style={{
141
140
  height: `${
142
141
  windowHeight -
143
142
  (isJdApp
144
143
  ? APP_SHOP_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT
145
144
  : M_SHOP_DOWNLOAD_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT)
146
145
  }px`,
147
146
  }}
148
147
  >
149
148
  <NetworkDataError
150
149
  netWorkShowType={NetWorkShowType.PART}
151
150
  netWorkDataType={NETWORK_DATA_TYPE.DATA_ERROR}
152
151
  />
153
152
  </View>
154
153
  )}
155
154
  </View>
156
155
  </View>
157
156
  )
158
157
  updateShopDataFn: null,
158
+ import React from 'react'
159
159
  NETWORK_DATA_TYPE,
160
160
  M_SHOP_DOWNLOAD_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT,
161
161
  APP_SHOP_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT,
162
162
  containerFloorListData: ComponentInterFace.ContainerItemData[]
163
163
  className?: string
164
164
  containerItemClass?: object
165
165
  style?: object
166
166
  hasGoodsFeeds?: boolean
167
167
  builtInComponents?: Object
168
168
  loadingEndComponentFn?: Function
169
169
  sectionType?: string
170
170
  updateShopFloorDataFn?: Function
171
171
  updateContainerFloorListDataFn?: Function
172
172
  customErrorIsvFloorModule?: React.ReactElement
173
173
  const {
174
174
  className,
175
175
  style,
176
176
  containerItemClass = null,
177
177
  containerFloorListData,
178
178
  builtInComponents,
179
179
  loadingEndComponentFn,
180
180
  sectionType,
181
181
  updateShopFloorDataFn,
182
182
  updateContainerFloorListDataFn,
183
183
  customErrorIsvFloorModule,
184
184
  } = props
185
185
 
186
186
  const renderFloorItem = (
187
187
  item,
188
188
  floorItem,
189
189
  floorIndex,
190
190
  containerLayoutLeftRightMargin,
191
191
  lazyLoadState = false,
192
192
  ) => {
193
193
  return (
194
194
  <View
195
195
  className={classNames(shopContainerListStyle['d-floor-item'])}
196
196
  data-floor-uid={floorItem?.uid}
197
197
  data-floor-type={floorItem?.floorExtInfo?.moduleFlag || ''}
198
198
  data-lazy-load={lazyLoadState}
199
199
  key={floorItem.uid}
200
200
  id={`J_floor_${floorItem.uid}`}
201
201
  style={{
202
202
  borderRadius: `${item?.borderRadius || 0}px`,
203
203
  }}
204
204
  >
205
205
  {
206
206
  isChartH5 &&
207
207
  <View className={shopContainerListStyle['d-floor-chart-item']} id={`J_chart_floor_${floorItem?.uid}`}
208
208
  data-floor-uid={floorItem?.uid}
209
209
  data-floor-type={floorItem?.floorExtInfo?.moduleFlag || ''} />
210
210
  }
211
211
  <FloorListItem
212
212
  floorIndex={floorIndex}
213
213
  floorData={floorItem}
214
214
  layoutLeftRightMargin={containerLayoutLeftRightMargin}
215
215
  containerBorderRadius={item?.borderRadius || 0}
216
216
  updateShopFloorDataFn={updateShopFloorDataFn}
217
217
  loadingEndComponentFn={loadingEndComponentFn}
218
218
  key={floorItem.uid}
219
219
  builtInComponents={builtInComponents}
220
220
  updateContainerFloorListDataFn={
221
221
  updateContainerFloorListDataFn
222
222
  }
223
223
  customErrorIsvFloorModule={customErrorIsvFloorModule}
224
224
  />
225
225
  </View>
226
226
  )
227
227
  }
228
228
 
229
229
  const getFloorSetHeight = (item) => {
230
230
  const getHeight = item?.floorExtInfo?.floorHeight
231
231
  ? Number(item?.floorExtInfo?.floorHeight)
232
232
  : 200
233
233
  return getHeight > 0 ? getHeight : 200
234
234
  }
235
235
  return (
236
236
  <View
237
237
  className={classNames(
238
238
  className,
239
239
  shopContainerListStyle['d-shop-container-list'],
240
240
  )}
241
241
  style={style}
242
242
  >
243
243
  <View id='J_shopContainerFloorList'>
244
244
  {containerFloorListData.length > 0 ? (
245
245
  containerFloorListData.map((item, index) => {
246
246
  const containerLayoutLeftRightMargin =
247
247
  (item.marginLeft || 0) + (item.marginRight || 0)
248
248
  const getContainerId = `J_container_${item.containerId}`
249
249
  return (
250
250
  <View
251
251
  className={classNames(
252
252
  shopContainerListStyle['d-container-item'],
253
253
  containerItemClass,
254
254
  )}
255
255
  id={getContainerId}
256
256
  key={item.containerId}
257
257
  data-container-id={item?.containerId}
258
258
  data-container-type={item?.typeCode}
259
259
  style={{
260
260
  marginBottom: item.marginBottom
261
261
  ? `${item.marginBottom}px`
262
262
  : 0,
263
263
  marginTop: item.marginTop
264
264
  ? `${item.marginTop}px`
265
265
  : 0,
266
266
  marginLeft: item.marginLeft
267
267
  ? `${item.marginLeft}px`
268
268
  : 0,
269
269
  marginRight: item.marginRight
270
270
  ? `${item.marginRight}px`
271
271
  : 0,
272
272
  borderRadius: item.borderRadius
273
273
  ? `${item.borderRadius}px`
274
274
  : 0,
275
275
  }}
276
276
  >
277
277
  {item.floors &&
278
278
  item.floors.length > 0 &&
279
279
  item.floors?.map(
280
280
  (floorItem, floorIndex) => {
281
281
  return index > lazyLoadStartIndex ? (
282
282
  <LazyLayoutLoad
283
283
  key={item.containerId}
284
284
  sectionType={sectionType}
285
285
  containerId={getContainerId}
286
286
  height={getFloorSetHeight(
287
287
  floorItem,
288
288
  )}
289
289
  floorData={floorItem}
290
290
  >
291
291
  {renderFloorItem(
292
292
  item,
293
293
  floorItem,
294
294
  floorIndex,
295
295
  containerLayoutLeftRightMargin,
296
296
  true,
297
297
  )}
298
298
  </LazyLayoutLoad>
299
299
  ) : (
300
300
  renderFloorItem(
301
301
  item,
302
302
  floorItem,
303
303
  floorIndex,
304
304
  containerLayoutLeftRightMargin,
305
305
  )
306
306
  )
307
307
  },
308
308
  )}
309
309
  </View>
310
310
  )
311
311
  })
312
312
  ) : (
313
313
  <View
314
314
  className={
315
315
  shopContainerListStyle['d-container-list-no-data']
316
316
  }
317
317
  style={{
318
318
  height: `${
319
319
  windowHeight -
320
320
  (isJdApp
321
321
  ? APP_SHOP_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT
322
322
  : M_SHOP_DOWNLOAD_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT)
323
323
  }px`,
324
324
  }}
325
325
  >
326
326
  <NetworkDataError
327
327
  netWorkShowType={NetWorkShowType.PART}
328
328
  netWorkDataType={NETWORK_DATA_TYPE.DATA_ERROR}
329
329
  />
330
330
  </View>
331
331
  )}
332
332
  </View>
333
333
  </View>
334
334
  )
335
335
  updateShopDataFn: null,
@@ -1 +1 @@
1
- import taroJdBaseInfo from '../../common'
1
+ import taroJdBaseInfo from '../../common'
@@ -1 +1 @@
1
- import { JumpEventReport, JumpEventReportPromise } from '../../jumpEventReport'
2
1
  initReportBaseData: ReportContainerData.initReportBaseData.bind(ReportContainerData),
3
2
  updateSectionTabDataInfo: ReportContainerData.updateSectionTabDataInfo.bind(ReportContainerData),
3
+ import { JumpEventReport, JumpEventReportPromise } from '../../jumpEventReport'
4
4
  initOpenTriggerExposure: (type: string) => void
5
5
  logPageIdInfo: Object
6
6
  logPnameInfo: Object
7
7
  getFloorPointIndexClassName: (obj: object, index?: number, tip?: string) => string
8
8
  initOpenTriggerExposure: () => {},
9
9
  initOpenTriggerExposure,
10
10
  logPageIdInfo,
11
11
  logPnameInfo
12
12
  initReportBaseData: ReportContainerData.initReportBaseData.bind(ReportContainerData),
13
13
  updateSectionTabDataInfo: ReportContainerData.updateSectionTabDataInfo.bind(ReportContainerData),
14
14
  initOpenTriggerExposure: initOpenTriggerExposure.bind(JumpEventReport),
15
15
  logPnameInfo: logPnameInfo,
16
16
  logPageIdInfo: logPageIdInfo,
17
17
  getFloorPointIndexClassName: ReportContainerData.getFloorPointIndexClassName.bind(ReportContainerData)
@@ -1 +1 @@
1
- import { dateFormat, showSuccessToast, showFailToast,showNormalToast } from '../../utils'
1
+ import {
2
2
  dateFormat,
3
3
  showSuccessToast,
4
4
  showFailToast,
5
5
  showNormalToast,
6
6
  isJdApp,
7
7
  isH5AndJdShopView,
8
8
  isH5,
9
9
  isH5AndJdShopViewH5Scroll
10
10
  openTaroEventDialog,
11
11
  closeTaroEventDialog,
12
12
  dateFormat,
13
13
  showSuccessToast,
14
14
  showFailToast,
15
15
  showNormalToast,
16
16
  openDialog: openTaroEventDialog,
17
17
  closeDialog: closeTaroEventDialog,
18
18
  isJdApp,
19
19
  isH5AndJdShopView,
20
20
  isH5,
21
21
  isH5AndJdShopViewH5Scroll
@@ -1 +1 @@
1
- import CountDown from "../../components/base/CountDown";
1
+ import CountDown from "../../components/base/CountDown";
2
2
  Exposure,
3
3
  ItemViewExposureSmart,
@@ -1 +1 @@
1
- import { isAndroidDevice } from '../utils'
2
1
  buId: '',
3
2
  console.log('getBMallUserInfo')
4
3
  if (!isApp('jdb')) {
5
4
  return null
6
5
  }
7
6
  if (bMallUserInfo) {
8
7
  return new Promise((resolve) => resolve(bMallUserInfo))
9
8
  }
10
9
  const requestTimeoutPromise = new Promise((resolve) => {
11
10
  setTimeout(() => {
12
11
  resolve({})
13
12
  }, 3000)
14
13
  })
15
14
  const userInfoPromise = new Promise((resolve) => {
16
15
  let result: any = {}
17
16
  try {
18
17
  if (isAndroidDevice) {
19
18
  result = JSON.parse(
20
19
  window.WebViewCommon && window.WebViewCommon.getUserInfo(),
21
20
  )
22
21
  bMallUserInfo = result
23
22
  commonParam.buId = result?.data?.buId
24
23
  resolve(result)
25
24
  } else {
26
25
  window.getUserInfoCallBack = null
27
26
  window.getUserInfoCallBack = function (callBackJson) {
28
27
  if (callBackJson) {
29
28
  result.data = JSON.parse(callBackJson)
30
29
  bMallUserInfo = result
31
30
  commonParam.buId = result?.data?.buId
32
31
  resolve(result)
33
32
  }
34
33
  }
35
34
  window?.webkit?.messageHandlers?.WebViewCommon?.postMessage({
36
35
  businessType: 'router://com.jd.jlstudio/getUserInfo',
37
36
  params: {},
38
37
  callBackName: 'getUserInfoCallBack',
39
38
  method: 'callRouterModuleWithParams',
40
39
  })
41
40
  }
42
41
  } catch (e) {
43
42
  resolve(result)
44
43
  }
45
44
  })
46
45
  return Promise.race([userInfoPromise, requestTimeoutPromise])
47
46
  process.env.NODE_ENV === 'development'
48
47
  ? {
49
48
  apolloId: '48ee955b0fb04d19b9f9fe8cb73d387f',
50
49
  apolloSecret: '0d9c76ee66b0487da4e17d3cf1d7af7a',
51
50
  }
52
51
  : {
53
52
  apolloId: '80c46fd06e4442998609d9f6a4ab96f0',
54
53
  apolloSecret: 'f36bef08bcba4683b409732095793fb2',
55
54
  }
56
55
  if (typeof window.crypto === 'object') {
57
56
  if (typeof (window.crypto as any).randomUUID === 'function') {
58
57
  return (window.crypto as any).randomUUID()
59
58
  }
60
59
  if (
61
60
  typeof (window.crypto as any).getRandomValues === 'function' &&
62
61
  typeof Uint8Array === 'function'
63
62
  ) {
64
63
  const callback = (c) => {
65
64
  const num = Number(c)
66
65
  return (
67
66
  num ^
68
67
  ((window.crypto as any).getRandomValues(new Uint8Array(1))[0] &
69
68
  (15 >> (num / 4)))
70
69
  ).toString(16)
71
70
  }
72
71
  return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, callback)
73
72
  }
74
73
  }
75
74
  let timestamp = new Date().getTime()
76
75
  let perforNow =
77
76
  (typeof window.performance !== 'undefined' &&
78
77
  window.performance.now &&
79
78
  window.performance.now() * 1000) ||
80
79
  0
81
80
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
82
81
  let random = Math.random() * 16
83
82
  if (timestamp > 0) {
84
83
  random = (timestamp + random) % 16 | 0
85
84
  timestamp = Math.floor(timestamp / 16)
86
85
  } else {
87
86
  random = (perforNow + random) % 16 | 0
88
87
  perforNow = Math.floor(perforNow / 16)
89
88
  }
90
89
  return (c === 'x' ? random : (random & 0x3) | 0x8).toString(16)
91
90
  })
92
91
  skuId,
93
92
  bMallTag = 1,
94
93
  num,
95
94
  skuUuid,
96
95
  ...otherGoodParams
97
96
  let buId = commonParam.buId
98
97
  if (!buId) {
99
98
  const useInfo: any = await getBMallUserInfo()
100
99
  buId = useInfo?.data?.buId
101
100
  }
102
101
  let params: any = {
103
102
  uniformBizInfo: {
104
103
  tenantId: 1024,
105
104
  ua: 1,
106
105
  buId: buId || 456,
107
106
  bMallTag: bMallTag,
108
107
  },
109
108
  commonParam: {
110
109
  pid: 100,
111
110
  verticalCode: 'cn_retail_bmall',
112
111
  ua: 1,
113
112
  language: 'zh',
114
113
  },
115
114
  operations: [{ TheSkus: [{ Id: skuId, num: num ?? 1 }] }],
116
115
  apolloId: APOLLO.apolloId,
117
116
  apolloSecret: APOLLO.apolloSecret,
118
117
  client: 'H5',
119
118
  verticalTag: 'cn_retail_bmall',
120
119
  carttype: bMallTag == 1 ? 21 : 22,
121
120
  bMallTag: bMallTag,
122
121
  traceId: getUuid(),
123
122
  noResponse: true,
124
123
  }
125
124
  if (skuUuid) {
126
125
  params.operations[0].TheSkus[0].skuUuid = skuUuid
127
126
  }
128
127
  if (otherGoodParams.buId) {
129
128
  const uniformBizInfo = {
130
129
  buId: otherGoodParams.buId,
131
130
  }
132
131
  params.operations[0].TheSkus[0].uniformBizInfo = uniformBizInfo
133
132
  }
134
133
  if (window?.siteTransResult?.gridInfoList) {
135
134
  params = {
136
135
  ...params,
137
136
  cartLocationList: [
138
137
  {
139
138
  gridInfos:
140
139
  window?.siteTransResult?.gridInfoList &&
141
140
  JSON.parse(window?.siteTransResult?.gridInfoList),
142
141
  areaIdSet:
143
142
  window?.siteTransResult?.area &&
144
143
  window?.siteTransResult?.area?.split('-'),
145
144
  },
146
145
  ],
147
146
  }
148
147
  }
149
148
  return params
149
+ import { isAndroidDevice } from '../utils'
150
150
  buId: '',
151
151
  console.log('getBMallUserInfo')
152
152
  if (!(isApp('jdb') || isApp('jdjch'))) {
153
153
  return null
154
154
  }
155
155
  if (bMallUserInfo) {
156
156
  return new Promise((resolve) => resolve(bMallUserInfo))
157
157
  }
158
158
  const requestTimeoutPromise = new Promise((resolve) => {
159
159
  setTimeout(() => {
160
160
  resolve({})
161
161
  }, 3000)
162
162
  })
163
163
  const userInfoPromise = new Promise((resolve) => {
164
164
  let result: any = {}
165
165
  try {
166
166
  if(isApp('jdjch')) {
167
167
  const { user } = window['@jd/jdb-jssdk-b2b'] || {}
168
168
  user && user.getUserInfo().then((res) => {
169
169
  resolve(res?.data || {})
170
170
  })
171
171
  }else {
172
172
  if (isAndroidDevice) {
173
173
  result = JSON.parse(
174
174
  window.WebViewCommon && window.WebViewCommon.getUserInfo(),
175
175
  )
176
176
  bMallUserInfo = result
177
177
  commonParam.buId = result?.data?.buId
178
178
  resolve(result)
179
179
  } else {
180
180
  window.getUserInfoCallBack = null
181
181
  window.getUserInfoCallBack = function (callBackJson) {
182
182
  if (callBackJson) {
183
183
  result.data = JSON.parse(callBackJson)
184
184
  bMallUserInfo = result
185
185
  commonParam.buId = result?.data?.buId
186
186
  resolve(result)
187
187
  }
188
188
  }
189
189
  window?.webkit?.messageHandlers?.WebViewCommon?.postMessage({
190
190
  businessType: 'router://com.jd.jlstudio/getUserInfo',
191
191
  params: {},
192
192
  callBackName: 'getUserInfoCallBack',
193
193
  method: 'callRouterModuleWithParams',
194
194
  })
195
195
  }
196
196
  }
197
197
  } catch (e) {
198
198
  resolve(result)
199
199
  }
200
200
  })
201
201
  return Promise.race([userInfoPromise, requestTimeoutPromise])
202
202
  process.env.NODE_ENV === 'development'
203
203
  ? {
204
204
  apolloId: '48ee955b0fb04d19b9f9fe8cb73d387f',
205
205
  apolloSecret: '0d9c76ee66b0487da4e17d3cf1d7af7a',
206
206
  }
207
207
  : {
208
208
  apolloId: '80c46fd06e4442998609d9f6a4ab96f0',
209
209
  apolloSecret: 'f36bef08bcba4683b409732095793fb2',
210
210
  }
211
211
  if (typeof window.crypto === 'object') {
212
212
  if (typeof (window.crypto as any).randomUUID === 'function') {
213
213
  return (window.crypto as any).randomUUID()
214
214
  }
215
215
  if (
216
216
  typeof (window.crypto as any).getRandomValues === 'function' &&
217
217
  typeof Uint8Array === 'function'
218
218
  ) {
219
219
  const callback = (c) => {
220
220
  const num = Number(c)
221
221
  return (
222
222
  num ^
223
223
  ((window.crypto as any).getRandomValues(new Uint8Array(1))[0] &
224
224
  (15 >> (num / 4)))
225
225
  ).toString(16)
226
226
  }
227
227
  return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, callback)
228
228
  }
229
229
  }
230
230
  let timestamp = new Date().getTime()
231
231
  let perforNow =
232
232
  (typeof window.performance !== 'undefined' &&
233
233
  window.performance.now &&
234
234
  window.performance.now() * 1000) ||
235
235
  0
236
236
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
237
237
  let random = Math.random() * 16
238
238
  if (timestamp > 0) {
239
239
  random = (timestamp + random) % 16 | 0
240
240
  timestamp = Math.floor(timestamp / 16)
241
241
  } else {
242
242
  random = (perforNow + random) % 16 | 0
243
243
  perforNow = Math.floor(perforNow / 16)
244
244
  }
245
245
  return (c === 'x' ? random : (random & 0x3) | 0x8).toString(16)
246
246
  })
247
247
  skuId,
248
248
  bMallTag = 1,
249
249
  num,
250
250
  skuUuid,
251
251
  ...otherGoodParams
252
252
  let buId = commonParam.buId
253
253
  if (!buId) {
254
254
  const useInfo: any = await getBMallUserInfo()
255
255
  buId = useInfo?.data?.buId
256
256
  }
257
257
  let params: any = {
258
258
  uniformBizInfo: {
259
259
  tenantId: 1024,
260
260
  ua: 1,
261
261
  buId: buId || 456,
262
262
  bMallTag: bMallTag,
263
263
  },
264
264
  commonParam: {
265
265
  pid: 100,
266
266
  verticalCode: 'cn_retail_bmall',
267
267
  ua: 1,
268
268
  language: 'zh',
269
269
  },
270
270
  operations: [{ TheSkus: [{ Id: skuId, num: num ?? 1 }] }],
271
271
  apolloId: APOLLO.apolloId,
272
272
  apolloSecret: APOLLO.apolloSecret,
273
273
  client: 'H5',
274
274
  verticalTag: 'cn_retail_bmall',
275
275
  carttype: bMallTag == 1 ? 21 : 22,
276
276
  bMallTag: bMallTag,
277
277
  traceId: getUuid(),
278
278
  noResponse: true,
279
279
  }
280
280
  if (skuUuid) {
281
281
  params.operations[0].TheSkus[0].skuUuid = skuUuid
282
282
  }
283
283
  if (otherGoodParams.buId) {
284
284
  const uniformBizInfo = {
285
285
  buId: otherGoodParams.buId,
286
286
  }
287
287
  params.operations[0].TheSkus[0].uniformBizInfo = uniformBizInfo
288
288
  }
289
289
  if (window?.siteTransResult?.gridInfoList) {
290
290
  params = {
291
291
  ...params,
292
292
  cartLocationList: [
293
293
  {
294
294
  gridInfos:
295
295
  window?.siteTransResult?.gridInfoList &&
296
296
  JSON.parse(window?.siteTransResult?.gridInfoList),
297
297
  areaIdSet:
298
298
  window?.siteTransResult?.area &&
299
299
  window?.siteTransResult?.area?.split('-'),
300
300
  },
301
301
  ],
302
302
  }
303
303
  }
304
304
  return params