@conecli/cone-render 0.10.1-shop3.3 → 0.10.1-shop3.30

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 (82) hide show
  1. package/README.md +1 -1
  2. package/dist/api/index.ts +1 -1
  3. package/dist/common/const.ts +1 -1
  4. package/dist/common/index.h5.ts +1 -1
  5. package/dist/common/index.jd.ts +1 -1
  6. package/dist/common/index.ts +1 -1
  7. package/dist/common/index.weapp.ts +1 -1
  8. package/dist/common/jssdk.ts +1 -1
  9. package/dist/common/token/index.h5.ts +1 -1
  10. package/dist/common/token/token.jd.ts +1 -1
  11. package/dist/common/wxappApi.ts +1 -1
  12. package/dist/components/base/CommonFloorHead/index.module.scss +126 -111
  13. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  14. package/dist/components/base/CountDown/index.tsx +1 -1
  15. package/dist/components/base/CustomScrollView/index-back.tsx +1 -0
  16. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  17. package/dist/components/base/Dialog/index.module.scss +11 -0
  18. package/dist/components/base/ExposureSmart/index.h5.module.scss +12 -2
  19. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  20. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  21. package/dist/components/base/InViewRender/index.tsx +1 -1
  22. package/dist/components/base/ItemViewExposureSmart/index.module.scss +2 -2
  23. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  24. package/dist/components/base/NetworkDataError/const.ts +1 -1
  25. package/dist/components/base/NetworkDataError/index.module.scss +117 -71
  26. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  27. package/dist/components/base/Price/Base/index.module.scss +12 -0
  28. package/dist/components/base/Price/Base/index.tsx +1 -1
  29. package/dist/components/base/Price/Double/index.module.scss +6 -0
  30. package/dist/components/base/Price/Double/index.tsx +1 -1
  31. package/dist/components/debug/DebugLayout/index.module.scss +2 -2
  32. package/dist/components/floorItem.weapp.tsx +1 -1
  33. package/dist/interface/common.ts +1 -1
  34. package/dist/interface/component.ts +1 -1
  35. package/dist/interface/jumpEventReport.ts +1 -1
  36. package/dist/interface/service.ts +1 -1
  37. package/dist/jumpEventReport/base.ts +1 -1
  38. package/dist/jumpEventReport/const.ts +1 -1
  39. package/dist/jumpEventReport/index.h5.ts +1 -1
  40. package/dist/jumpEventReport/index.jd.ts +1 -1
  41. package/dist/jumpEventReport/index.weapp.ts +1 -1
  42. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  43. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  44. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  45. package/dist/jumpEventReport/web/report.ts +1 -1
  46. package/dist/jumpEventReport/web.base.ts +1 -1
  47. package/dist/jumpEventReport/web.jd.ts +1 -1
  48. package/dist/jumpEventReport/web.pc.ts +1 -1
  49. package/dist/jumpEventReport/web.tjm.ts +1 -1
  50. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  51. package/dist/language/en_US.json +176 -0
  52. package/dist/language/zh_CN.json +176 -0
  53. package/dist/language/zh_HK.json +176 -0
  54. package/dist/libs/taroAppReport.js +2 -2
  55. package/dist/modules/ContainerFloorList/index.h5.module.scss +66 -53
  56. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  57. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  58. package/dist/open/api/environment.ts +1 -1
  59. package/dist/open/api/shopMember.ts +1 -1
  60. package/dist/open/api/util.ts +1 -1
  61. package/dist/sass/app.h5.scss +273 -224
  62. package/dist/service/fetchGateway.ts +1 -1
  63. package/dist/service/fetchGateway.weapp.ts +1 -0
  64. package/dist/service/http/colorSign.ts +1 -1
  65. package/dist/service/http/const.ts +1 -1
  66. package/dist/service/http/h5Http.ts +1 -1
  67. package/dist/service/requestServer.h5.ts +1 -1
  68. package/dist/service/requestServer.ts +1 -1
  69. package/dist/service/requestServer.weapp.ts +1 -0
  70. package/dist/utils/connectNativeJsBridge.ts +1 -1
  71. package/dist/utils/h5Utils.ts +1 -1
  72. package/dist/utils/index.h5.ts +1 -1
  73. package/dist/utils/index.ts +1 -1
  74. package/dist/utils/index.weapp.ts +1 -1
  75. package/dist/utils/jumpExtMapUtil.h5.ts +1 -0
  76. package/dist/utils/jumpExtMapUtil.ts +1 -0
  77. package/dist/utils/log.ts +1 -0
  78. package/dist/utils/sColor.js +1 -0
  79. package/dist/utils/utils.ts +1 -1
  80. package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
  81. package/dist/wxapp/common/user_info.js +1 -1
  82. package/package.json +158 -141
@@ -1 +1 @@
1
- import { JdJumpJdApp } from './jdJumpJdApp'
2
1
  reportClick,
3
2
  reportPV,
4
3
  reportToCart,
5
4
  routerInfo: {
6
5
  params: {},
7
6
  },
8
7
  nativeEvent: null,
9
8
  jumpConfig: {
10
9
  venderId: null,
11
10
  shopId: null,
12
11
  sourceValue: '',
13
12
  sourceType: 'App-H5',
14
13
  activityType: 'shopx',
15
14
  moduleId: 'none',
16
15
  entrance: 'none',
17
16
  },
18
17
  logPageParamStr: '',
19
18
  public logPageId: string
20
19
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig
21
20
  constructor(opt = {}) {
22
21
  super(opt)
23
22
  this.getConfig(opt)
24
23
  }
25
24
  getConfig(opt = {}) {
26
25
  return Object.assign(this, {}, defaultConfig, opt)
27
26
  }
28
27
  updateInfo(
29
28
  routerInfo,
30
29
  logPname = LogPnameInfo.HOME,
31
30
  pageId = LogPageIdInfo.APP,
32
31
  ) {
33
32
  this.logPageId = pageId
34
33
  this.routerInfo = routerInfo
35
34
  this.jumpConfig = Object.assign({}, this.jumpConfig, routerInfo.params)
36
35
  this.logPname = logPname
37
36
  }
38
37
  reportInfoPv(
39
38
  pageId = LogPageIdInfo.APP,
40
39
  opt: {
41
40
  pageParam?: any
42
41
  } = {},
43
42
  ) {
44
43
  const { pageParam } = opt
45
44
  this.logPageParamStr = pageParam
46
45
  ? pageParam
47
46
  : this.creatParamToLogStr(this.jumpConfig)
48
47
  .replace(/moduleId/, 'JumpmoduleID')
49
48
  .replace(/entrance/, 'Jumpentrance')
50
49
  reportPV({
51
50
  pageId,
52
51
  pageParam: this.logPageParamStr,
53
52
  ...opt,
54
53
  })
55
54
  }
56
55
 
57
56
  jdJumpToDongDongChatGroup(groupId, source = '4') {
58
57
  this.jdNavigateToNative({
59
58
  category: 'jump',
60
59
  des: 'dongdong_group_chat',
61
60
  source: source,
62
61
  groupId: `${groupId}`,
63
62
  })
64
63
  }
65
64
 
66
65
  jdJumpToWeb(
67
66
  url,
68
67
  logEventInfo,
69
68
  successBack?: Function | undefined,
70
69
  failBack?: Function | undefined,
71
70
  ) {
72
71
  console.log('jd web',this.isOpenJdAppUrl(url),url)
73
72
  if (this.isOpenJdAppUrl(url)) {
74
73
  const getOpenAppParams = this.jdOpenAppParams(url)
75
74
  console.log(
76
75
  'jd web 获取自定义openApp链接解析后的参数结果',
77
76
  getOpenAppParams,
78
77
  )
79
78
  if (getOpenAppParams) {
80
79
  this.jdNavigateToNative(
81
80
  Object.assign({}, getOpenAppParams, {
82
81
  logEventInfo,
83
82
  }),
84
83
  )
85
84
  }
86
85
  } else {
87
86
  let _getLastUrl = url
88
87
  if(/shop\.m\.jd\.com|pages\.jd\.com/.test(url)){
89
88
  _getLastUrl = !/jwebprog=0/.test(url) ? `${url}${url.indexOf("?") !== -1 ? '&jwebprog=0' : '?jwebprog=0'}` : url
90
89
  }
91
90
  super.jdJumpToWeb(
92
91
  _getLastUrl,
93
92
  {
94
93
  ...logEventInfo,
95
94
  },
96
95
  successBack,
97
96
  failBack,
98
97
  )
99
98
  }
100
99
  }
101
100
 
102
101
  jdJumpToWebInner(url, logEventInfo) {
103
102
  this.jdJumpToWeb(url, logEventInfo)
104
103
  }
105
104
 
106
105
  jdJumpConfigUrl(detail, logEventInfo = {}) {
107
106
  const { configDataType, configDataValue } = detail
108
107
  switch (configDataType) {
109
108
  case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
110
109
  this.jdJumpToShopCategory({
111
110
  ...configDataValue,
112
111
  logEventInfo,
113
112
  })
114
113
  break
115
114
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
116
115
  if(logEventInfo?.jsonParam?.logBaseInfo?.mInfo){
117
116
  logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds
118
117
  }
119
118
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo)
120
119
  break
121
120
  case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
122
121
  this.jdJumpToWeb(
123
122
  `${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
124
123
  {},
125
124
  )
126
125
  break
127
126
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
128
127
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
129
128
  const getShopSearchParams = this.jdOpenAppParams(
130
129
  configDataValue.clickUrl,
131
130
  )
132
131
  console.log(
133
132
  'jd web 获取店铺分类链接解析后的参数结果',
134
133
  getShopSearchParams,
135
134
  )
136
135
  getShopSearchParams &&
137
136
  this.jdJumpToShopSearch(
138
137
  Object.assign({}, getShopSearchParams, {
139
138
  logEventInfo,
140
139
  }),
141
140
  )
142
141
  } else {
143
142
  this.jdJumpToShopSearch(
144
143
  configDataValue['cid']
145
144
  ? Object.assign(
146
145
  {},
147
146
  {
148
147
  shopId: global.info.queryInfo.shopId,
149
148
  categoryId: configDataValue.cid,
150
149
  searchType: '5',
151
150
  logEventInfo,
152
151
  },
153
152
  )
154
153
  : {
155
154
  shopId: global.info.queryInfo.shopId,
156
155
  logEventInfo,
157
156
  },
158
157
  )
159
158
  }
160
159
  break
161
160
  case LinkConfigType.CONFIG_TYPE_MEMBER:
162
161
  if(isAppHomeForMarketPage){
163
162
  this.jdJumpToBottomTabBrandMember({
164
163
  logEventInfo
165
164
  })
166
165
  }else {
167
166
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
168
167
  const getShopMemberParams = this.jdOpenAppParams(
169
168
  configDataValue.clickUrl,
170
169
  )
171
170
  getShopMemberParams &&
172
171
  this.jdJumpToShopMember(
173
172
  Object.assign({}, getShopMemberParams, {
174
173
  logEventInfo,
175
174
  }),
176
175
  )
177
176
  } else {
178
177
  this.jdJumpToShopMember({
179
178
  shopId: global.info.queryInfo.shopId,
180
179
  venderId: configDataValue.shopDetail,
181
180
  logEventInfo,
182
181
  })
183
182
  }
184
183
  }
185
184
  break
186
185
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
187
186
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
188
187
  const getShopActivityParams = this.jdOpenAppParams(
189
188
  configDataValue.clickUrl,
190
189
  )
191
190
  getShopActivityParams &&
192
191
  this.jdJumpToShopActivity(
193
192
  Object.assign({}, getShopActivityParams, {
194
193
  logEventInfo,
195
194
  }),
196
195
  )
197
196
  } else if (configDataValue['projectId']) {
198
197
  this.jdJumpToShopActivity({
199
198
  projectId: configDataValue['projectId'],
200
199
  configDataValue,
201
200
  logEventInfo,
202
201
  })
203
202
  }
204
203
  break
205
204
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
206
205
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
207
206
  const _url = configDataValue.linkUrl
208
207
  if (
209
208
  _url.indexOf('to=') === -1 &&
210
209
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
211
210
  ) {
212
211
  const _shopId = _url.match(/\d+/g)[0]
213
212
  this.jdJumpToShopHome({
214
213
  shopId: `${_shopId}`,
215
214
  logEventInfo,
216
215
  })
217
216
  } else if (this.isOpenJdAppUrl(_url)) {
218
217
  const getOpenAppParams = this.jdOpenAppParams(_url)
219
218
  console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams)
220
219
  if (getOpenAppParams) {
221
220
  let _changeOpenAppParams = getOpenAppParams
222
221
  if(isAppHomeForMarketPage){
223
222
  const { operation, ...otherOpenAppParams } = getOpenAppParams
224
223
  if(operation && operation === 'jumpTabInner'){
225
224
  _changeOpenAppParams = otherOpenAppParams
226
225
  }
227
226
  }
228
227
  this.jdNavigateToNative(
229
228
  Object.assign({}, _changeOpenAppParams, {
230
229
  logEventInfo,
231
230
  }),
232
231
  )
233
232
  }
234
233
  } else {
235
234
  this.jdJumpToWeb(_url, logEventInfo)
236
235
  }
237
236
  break
238
237
  }
239
238
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
240
239
  this.jdJumpToShopDetail({
241
240
  venderId: global.info.queryInfo.venderId,
242
241
  shopId: global.info.queryInfo.shopId,
243
242
  logEventInfo,
244
243
  })
245
244
  break
246
245
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
247
246
  this.jdJumpToShopHome({
248
247
  ...configDataValue,
249
248
  logEventInfo,
250
249
  })
251
250
  break
252
251
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
253
252
  break
254
253
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
255
254
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
256
255
  const getShoppingGuideParams = this.jdOpenAppParams(
257
256
  configDataValue.clickUrl,
258
257
  )
259
258
  getShoppingGuideParams &&
260
259
  this.jdJumpToShopActivity(
261
260
  Object.assign({}, getShoppingGuideParams, {
262
261
  logEventInfo,
263
262
  }),
264
263
  )
265
264
  }
266
265
  break
267
266
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
268
267
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '')
269
268
  const search = linkUrl.match(/\?.+/)
270
269
  if (search) {
271
270
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
272
271
  parseQueryUrlString(linkUrl)
273
272
  try {
274
273
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param)
275
274
  } catch (e) {
276
275
  console.warn('解析小程序 param 错误:', miniQueryData.param)
277
276
  }
278
277
  this.jdJumpToMiniProgram(miniQueryData)
279
278
  } else {
280
279
  console.warn('小程序地址错误:', linkUrl)
281
280
  }
282
281
  break
283
282
  }
284
283
  case LinkConfigType.CONFIG_TYPE_SHOP_SEARCH: {
285
284
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
286
285
  const getShopSearchParams = this.jdOpenAppParams(
287
286
  configDataValue.clickUrl,
288
287
  )
289
288
  console.log(
290
289
  'jd web 获取店铺结果落地页链接解析后的参数结果',
291
290
  getShopSearchParams,
292
291
  )
293
292
  getShopSearchParams &&
294
293
  this.jdJumpToShopSearch(
295
294
  Object.assign({}, getShopSearchParams, {
296
295
  logEventInfo,
297
296
  }),
298
297
  )
299
298
  } else {
300
299
  this.jdJumpToWeb(configDataValue.clickUrl, logEventInfo)
301
300
  }
302
301
  break
303
302
  }
304
303
  default:
305
304
  }
306
305
  }
307
306
 
308
307
  jdNavigateToNative(
309
308
  params: {},
310
309
  url = 'openapp.jdmobile://virtual',
311
310
  successBack?: Function | null,
312
311
  failBack?: Function | null,
313
312
  ) {
314
313
  console.log('[降级H5] jdNavigateToNative web.jd:', params)
315
314
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams =
316
315
  Object.assign(
317
316
  {},
318
317
  {
319
318
  sourceValue: 'sourceValue_jshopModuleWeb',
320
319
  sourceType: 'sourceType_jshopModuleWeb',
321
320
  param: {},
322
321
  },
323
322
  params,
324
323
  )
325
324
  const { logEventInfo, ...otherParams } = getResParams
326
325
  console.log(
327
326
  'jd web 获取open协议参数 jdNavigateToNative params: ',
328
327
  getResParams,
329
328
  )
330
329
  console.log('logEventInfo params: ', logEventInfo)
331
330
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
332
331
  this.clickEventLog(logEventInfo || getResParams)
333
332
  .then(() => {
334
333
  if (typeof successBack == 'function') {
335
334
  successBack(getResParams)
336
335
  } else {
337
336
  try {
338
337
  const paramsStr = JSON.stringify(otherParams)
339
338
  console.log('跳转web jd open协议', `${url}?params=${paramsStr}`)
340
339
  window.location.href = `${url}?params=${paramsStr}`
341
340
  } catch (e) {
342
341
  console.log('跳转异常', e)
343
342
  }
344
343
  }
345
344
  })
346
345
  .catch(() => {
347
346
  typeof failBack == 'function' && failBack(getResParams)
348
347
  })
349
348
  }
350
349
 
351
350
  clickEventLog(
352
351
  opts: JumpEventReportInterFace.OptEventLogParams = {},
353
352
  reportKey = 'click',
354
353
  ) {
355
354
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts
356
355
  if (eventId && jsonParam) {
357
356
  const { etModelInfo, logBaseInfo } = jsonParam
358
357
  let getJsonParam = {}
359
358
  if (etModelInfo && logBaseInfo) {
360
359
  getJsonParam = logBaseInfo
361
360
  } else {
362
361
  if (Array.isArray(jsonParam)){
363
362
  getJsonParam = jsonParam
364
363
  } else {
365
364
  getJsonParam = Object.assign(
366
365
  {},
367
366
  {
368
367
  shopid: global.info.queryInfo?.shopId,
369
368
  },
370
369
  jsonParam,
371
370
  )
372
371
  }
373
372
  }
374
373
  if(reportKey === 'exposure' && /^TerminatorNew/.test(eventId) && !Array.isArray(getJsonParam)){
375
374
  getJsonParam = [getJsonParam]
376
375
  }
377
376
  const webLogParams = {
378
377
  eid: eventId,
379
378
  elevel: eventLevel,
380
379
  jsonParam: JSON.stringify(getJsonParam),
381
380
  etModel: JSON.stringify(etModelInfo || {}),
382
381
  pageId: this.logPageId,
383
382
  pageParam: this.logPageParamStr,
384
383
  ...otherParams,
385
384
  }
386
385
  return /click|exposure/.test(reportKey)
387
386
  ? reportClick(webLogParams)
388
387
  : reportToCart(opts,webLogParams)
389
388
  } else {
390
389
  console.log('暂无埋点参数eventId和eventParam')
391
390
  return Promise.resolve(false)
392
391
  }
393
392
  }
394
393
 
395
394
  exposureEventLog(opts) {
396
395
  return global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
397
396
  ? this.clickEventLog(
398
397
  {
399
398
  ...opts,
400
399
  exposureState: true,
401
400
  },
402
401
  'exposure',
403
402
  )
404
403
  : Promise.resolve(false)
405
404
  }
405
+ import { JdJumpJdApp } from './jdJumpJdApp';
406
406
  isAppHomeForMarketPage,
407
407
  isJdAndHarmonyDevice,
408
408
  isNewHarmonyShop,
409
409
  parseQueryUrlString,
410
410
  objectToUrlEncode,
411
411
  routerInfo: {
412
412
  params: {},
413
413
  },
414
414
  nativeEvent: null,
415
415
  jumpConfig: {
416
416
  venderId: null,
417
417
  shopId: null,
418
418
  sourceValue: '',
419
419
  sourceType: 'App-H5',
420
420
  activityType: 'shopx',
421
421
  moduleId: 'none',
422
422
  entrance: 'none',
423
423
  },
424
424
  logPageParamStr: '',
425
425
  public logPageId: string;
426
426
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig;
427
427
  constructor(opt = {}) {
428
428
  super(opt);
429
429
  this.getConfig(opt);
430
430
  }
431
431
  getConfig(opt = {}) {
432
432
  return Object.assign(this, {}, defaultConfig, opt);
433
433
  }
434
434
  updateInfo(routerInfo, logPname = LogPnameInfo.HOME, pageId = LogPageIdInfo.APP) {
435
435
  this.logPageId = pageId;
436
436
  this.routerInfo = routerInfo;
437
437
  this.jumpConfig = Object.assign({}, this.jumpConfig, routerInfo.params);
438
438
  this.logPname = logPname;
439
439
  }
440
440
  reportInfoPv(
441
441
  pageId = LogPageIdInfo.APP,
442
442
  opt: {
443
443
  pageParam?: any;
444
444
  } = {},
445
445
  ) {
446
446
  const { pageParam } = opt;
447
447
  this.logPageParamStr = pageParam
448
448
  ? pageParam
449
449
  : this.creatParamToLogStr(this.jumpConfig)
450
450
  .replace(/moduleId/, 'JumpmoduleID')
451
451
  .replace(/entrance/, 'Jumpentrance');
452
452
  reportPV({
453
453
  pageId,
454
454
  pageParam: this.logPageParamStr,
455
455
  ...opt,
456
456
  });
457
457
  }
458
458
 
459
459
  jdJumpToDongDongChatGroup(groupId, source = '4') {
460
460
  this.jdNavigateToNative({
461
461
  category: 'jump',
462
462
  des: 'dongdong_group_chat',
463
463
  source: source,
464
464
  groupId: `${groupId}`,
465
465
  });
466
466
  }
467
467
 
468
468
  jdJumpToWeb(
469
469
  url,
470
470
  logEventInfo,
471
471
  successBack?: functionType | undefined,
472
472
  failBack?: functionType | undefined,
473
473
  ) {
474
474
  console.log('jd web', this.isOpenJdAppUrl(url), url);
475
475
  if (this.isOpenJdAppUrl(url)) {
476
476
  const getOpenAppParams = this.jdOpenAppParams(url);
477
477
  console.log('jd web 获取自定义openApp链接解析后的参数结果', getOpenAppParams);
478
478
  if (getOpenAppParams) {
479
479
  this.jdNavigateToNative(
480
480
  Object.assign({}, getOpenAppParams, {
481
481
  logEventInfo,
482
482
  }),
483
483
  );
484
484
  }
485
485
  } else {
486
486
  let _getLastUrl = url;
487
487
  if (/shop\.m\.jd\.com|pages\.jd\.com/.test(_getLastUrl)) {
488
488
  const getUrlSearchParamState = _getLastUrl.indexOf('?') !== -1;
489
489
  if (!/jwebprog=0/.test(_getLastUrl)) {
490
490
  _getLastUrl = `${_getLastUrl}${getUrlSearchParamState ? '&' : '?'}jwebprog=0`;
491
491
  }
492
492
  if (global.info.sysInfo?.isJdTabletDevice && !/device=tablet/.test(_getLastUrl)) {
493
493
  _getLastUrl = `${_getLastUrl}${getUrlSearchParamState ? '&' : '?'}device=tablet`;
494
494
  }
495
495
  }
496
496
  super.jdJumpToWeb(
497
497
  _getLastUrl,
498
498
  {
499
499
  ...logEventInfo,
500
500
  },
501
501
  successBack,
502
502
  failBack,
503
503
  );
504
504
  }
505
505
  }
506
506
 
507
507
  jdJumpToWebInner(url, logEventInfo) {
508
508
  this.jdJumpToWeb(url, logEventInfo);
509
509
  }
510
510
 
511
511
  jdJumpConfigUrl(detail, logEventInfo = {}) {
512
512
  const { configDataType, configDataValue } = detail;
513
513
  switch (configDataType) {
514
514
  case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
515
515
  this.jdJumpToShopCategory({
516
516
  ...configDataValue,
517
517
  logEventInfo,
518
518
  });
519
519
  break;
520
520
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
521
521
  if (logEventInfo?.jsonParam?.logBaseInfo?.mInfo) {
522
522
  logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds;
523
523
  }
524
524
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo);
525
525
  break;
526
526
  case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
527
527
  this.jdJumpToWeb(
528
528
  `${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
529
529
  {},
530
530
  );
531
531
  break;
532
532
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
533
533
  if (isJdAndHarmonyDevice && isNewHarmonyShop && jdAppVersionStr === '15.1.70') {
534
534
  const baseInfo = {
535
535
  shopId: global.info.queryInfo.shopId,
536
536
  venderId: global.info.queryInfo.venderId,
537
537
  };
538
538
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
539
539
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
540
540
  console.log('jd web 获取店铺分类链接解析后的参数结果', getShopSearchParams);
541
541
  let openAppParams =
542
542
  typeof getShopSearchParams === 'boolean'
543
543
  ? { categoryId: '', ...baseInfo }
544
544
  : getShopSearchParams;
545
545
  const getInfo = openAppParams['categoryId']
546
546
  ? { ...openAppParams, cateId: openAppParams['categoryId'] }
547
547
  : openAppParams;
548
548
  console.log('处理后的参数', objectToUrlEncode(getInfo));
549
549
  this.jdJumpToWeb(
550
550
  `${this.jumpWebUrl.shopSearch}?${objectToUrlEncode(getInfo)}`,
551
551
  logEventInfo,
552
552
  );
553
553
  } else {
554
554
  const getInfo = configDataValue['cid']
555
555
  ? { ...baseInfo, ...configDataValue, cateId: configDataValue.cid, searchType: '5' }
556
556
  : { ...baseInfo, ...configDataValue };
557
557
  this.jdJumpToWeb(
558
558
  `${this.jumpWebUrl.shopSearch}?${objectToUrlEncode(getInfo)}`,
559
559
  logEventInfo,
560
560
  );
561
561
  }
562
562
  } else {
563
563
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
564
564
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
565
565
  console.log('jd web 获取店铺分类链接解析后的参数结果', getShopSearchParams);
566
566
  getShopSearchParams &&
567
567
  this.jdJumpToShopSearch(
568
568
  Object.assign({}, getShopSearchParams, {
569
569
  logEventInfo,
570
570
  }),
571
571
  );
572
572
  } else {
573
573
  this.jdJumpToShopSearch(
574
574
  configDataValue['cid']
575
575
  ? Object.assign(
576
576
  {},
577
577
  {
578
578
  shopId: global.info.queryInfo.shopId,
579
579
  categoryId: configDataValue.cid,
580
580
  searchType: '5',
581
581
  logEventInfo,
582
582
  },
583
583
  )
584
584
  : {
585
585
  shopId: global.info.queryInfo.shopId,
586
586
  logEventInfo,
587
587
  },
588
588
  );
589
589
  }
590
590
  }
591
591
  break;
592
592
  case LinkConfigType.CONFIG_TYPE_MEMBER:
593
593
  if (isAppHomeForMarketPage) {
594
594
  this.jdJumpToBottomTabBrandMember({
595
595
  logEventInfo,
596
596
  });
597
597
  } else {
598
598
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
599
599
  const getShopMemberParams = this.jdOpenAppParams(configDataValue.clickUrl);
600
600
  getShopMemberParams &&
601
601
  this.jdJumpToShopMember(
602
602
  Object.assign({}, getShopMemberParams, {
603
603
  logEventInfo,
604
604
  }),
605
605
  );
606
606
  } else {
607
607
  this.jdJumpToShopMember({
608
608
  shopId: global.info.queryInfo.shopId,
609
609
  venderId: configDataValue.shopDetail,
610
610
  logEventInfo,
611
611
  });
612
612
  }
613
613
  }
614
614
  break;
615
615
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
616
616
  if (this.isNewHarmony()) {
617
617
  const url = `${domain.sale}/m/h5/${configDataValue.data}.html`;
618
618
  this.jdJumpToWeb(url, logEventInfo);
619
619
  } else {
620
620
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
621
621
  const getShopActivityParams = this.jdOpenAppParams(configDataValue.clickUrl);
622
622
  getShopActivityParams &&
623
623
  this.jdJumpToShopActivity(
624
624
  Object.assign({}, getShopActivityParams, {
625
625
  logEventInfo,
626
626
  }),
627
627
  );
628
628
  } else if (configDataValue['projectId']) {
629
629
  this.jdJumpToShopActivity({
630
630
  projectId: configDataValue['projectId'],
631
631
  configDataValue,
632
632
  logEventInfo,
633
633
  });
634
634
  }
635
635
  }
636
636
  break;
637
637
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
638
638
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
639
639
  const _url = configDataValue.linkUrl;
640
640
  if (
641
641
  _url.indexOf('to=') === -1 &&
642
642
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
643
643
  ) {
644
644
  const _shopId = _url.match(/\d+/g)[0];
645
645
  this.jdJumpToShopHome({
646
646
  shopId: `${_shopId}`,
647
647
  logEventInfo,
648
648
  });
649
649
  } else if (this.isOpenJdAppUrl(_url)) {
650
650
  const getOpenAppParams = this.jdOpenAppParams(_url);
651
651
  console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams);
652
652
  if (getOpenAppParams) {
653
653
  let _changeOpenAppParams = getOpenAppParams;
654
654
  if (isAppHomeForMarketPage) {
655
655
  const { operation, ...otherOpenAppParams } = getOpenAppParams;
656
656
  if (operation && operation === 'jumpTabInner') {
657
657
  _changeOpenAppParams = otherOpenAppParams;
658
658
  }
659
659
  }
660
660
  this.jdNavigateToNative(
661
661
  Object.assign({}, _changeOpenAppParams, {
662
662
  logEventInfo,
663
663
  }),
664
664
  );
665
665
  }
666
666
  } else {
667
667
  this.jdJumpToWeb(_url, logEventInfo);
668
668
  }
669
669
  break;
670
670
  }
671
671
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
672
672
  this.jdJumpToShopDetail({
673
673
  venderId: global.info.queryInfo.venderId,
674
674
  shopId: global.info.queryInfo.shopId,
675
675
  logEventInfo,
676
676
  });
677
677
  break;
678
678
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
679
679
  this.jdJumpToShopHome({
680
680
  ...configDataValue,
681
681
  logEventInfo,
682
682
  });
683
683
  break;
684
684
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
685
685
  break;
686
686
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
687
687
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
688
688
  const getShoppingGuideParams = this.jdOpenAppParams(configDataValue.clickUrl);
689
689
  getShoppingGuideParams &&
690
690
  this.jdJumpToShopActivity(
691
691
  Object.assign({}, getShoppingGuideParams, {
692
692
  logEventInfo,
693
693
  }),
694
694
  );
695
695
  }
696
696
  break;
697
697
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
698
698
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '');
699
699
  const search = linkUrl.match(/\?.+/);
700
700
  if (search) {
701
701
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
702
702
  parseQueryUrlString(linkUrl);
703
703
  try {
704
704
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param);
705
705
  } catch (e) {
706
706
  console.warn('解析小程序 param 错误:', miniQueryData.param);
707
707
  }
708
708
  this.jdJumpToMiniProgram(miniQueryData);
709
709
  } else {
710
710
  console.warn('小程序地址错误:', linkUrl);
711
711
  }
712
712
  break;
713
713
  }
714
714
  case LinkConfigType.CONFIG_TYPE_SHOP_SEARCH: {
715
715
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
716
716
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
717
717
  console.log('jd web 获取店铺结果落地页链接解析后的参数结果', getShopSearchParams);
718
718
  getShopSearchParams &&
719
719
  this.jdJumpToShopSearch(
720
720
  Object.assign({}, getShopSearchParams, {
721
721
  logEventInfo,
722
722
  }),
723
723
  );
724
724
  } else {
725
725
  this.jdJumpToWeb(configDataValue.clickUrl, logEventInfo);
726
726
  }
727
727
  break;
728
728
  }
729
729
  default:
730
730
  }
731
731
  }
732
732
 
733
733
  isNewHarmony() {
734
734
  return isJdAndHarmonyDevice && isNewHarmonyShop;
735
735
  }
736
736
 
737
737
  jdNavigateToNative(
738
738
  params: object,
739
739
  url = 'openapp.jdmobile://virtual',
740
740
  successBack?: functionType | null,
741
741
  failBack?: functionType | null,
742
742
  ) {
743
743
  console.log('[降级H5] jdNavigateToNative web.jd:', params);
744
744
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams = Object.assign(
745
745
  {},
746
746
  {
747
747
  sourceValue: 'sourceValue_jshopModuleWeb',
748
748
  sourceType: 'sourceType_jshopModuleWeb',
749
749
  param: {},
750
750
  },
751
751
  params,
752
752
  );
753
753
  const { logEventInfo, ...otherParams } = getResParams;
754
754
  console.log('jd web 获取open协议参数 jdNavigateToNative params: ', getResParams);
755
755
  console.log('logEventInfo params: ', logEventInfo);
756
756
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
757
757
  this.clickEventLog(logEventInfo || getResParams)
758
758
  .then(() => {
759
759
  if (typeof successBack === 'function') {
760
760
  successBack(getResParams);
761
761
  } else {
762
762
  if (this.isNewHarmony() && params.operation === 'jumpTabInner') {
763
763
  if (params.jumpTab) {
764
764
  JumpTabBarInCurrentShop({ position: 'top', item: params.jumpTab });
765
765
  } else if (params.jumpBottomTab) {
766
766
  JumpTabBarInCurrentShop({ position: 'bottom', item: params.jumpBottomTab });
767
767
  } else {
768
768
  console.log('[降级H5] 跳转异常 params:', params);
769
769
  }
770
770
  } else if (
771
771
  this.isNewHarmony() &&
772
772
  (params.operation === 'jumpBottomTabMember' || params.des === 'jshopMember')
773
773
  ) {
774
774
  JumpTabBarInCurrentShop({ position: 'bottom', item: 'brandMember' });
775
775
  } else {
776
776
  try {
777
777
  const paramsStr = JSON.stringify(otherParams);
778
778
  console.log('跳转web jd open协议', `${url}?params=${paramsStr}`);
779
779
  window.location.href = `${url}?params=${paramsStr}`;
780
780
  } catch (e) {
781
781
  console.log('跳转异常', e);
782
782
  }
783
783
  }
784
784
  }
785
785
  })
786
786
  .catch(() => {
787
787
  typeof failBack === 'function' && failBack(getResParams);
788
788
  });
789
789
  }
790
790
 
791
791
  clickEventLog(opts: JumpEventReportInterFace.OptEventLogParams = {}, reportKey = 'click') {
792
792
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts;
793
793
  if (eventId && jsonParam) {
794
794
  const { etModelInfo, logBaseInfo } = jsonParam;
795
795
  let getJsonParam = {};
796
796
  if (etModelInfo && logBaseInfo) {
797
797
  getJsonParam = logBaseInfo;
798
798
  } else {
799
799
  if (Array.isArray(jsonParam)) {
800
800
  getJsonParam = jsonParam;
801
801
  } else {
802
802
  getJsonParam = Object.assign(
803
803
  {},
804
804
  {
805
805
  shopid: global.info.queryInfo?.shopId,
806
806
  },
807
807
  jsonParam,
808
808
  );
809
809
  }
810
810
  }
811
811
  if (
812
812
  reportKey === 'exposure' &&
813
813
  /^TerminatorNew/.test(eventId) &&
814
814
  !Array.isArray(getJsonParam)
815
815
  ) {
816
816
  getJsonParam = [getJsonParam];
817
817
  }
818
818
  const webLogParams = {
819
819
  isExpo: reportKey === 'exposure',
820
820
  eid: eventId,
821
821
  elevel: eventLevel,
822
822
  jsonParam: JSON.stringify(getJsonParam),
823
823
  etModel: JSON.stringify(etModelInfo || {}),
824
824
  pageId: this.logPageId,
825
825
  pageParam: this.logPageParamStr,
826
826
  ...otherParams,
827
827
  };
828
828
  return /click|exposure/.test(reportKey)
829
829
  ? reportClick(webLogParams)
830
830
  : reportToCart(opts, webLogParams);
831
831
  } else {
832
832
  console.log('暂无埋点参数eventId和eventParam');
833
833
  return Promise.resolve(false);
834
834
  }
835
835
  }
836
836
 
837
837
  exposureEventLog(opts) {
838
838
  return global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
839
839
  ? this.clickEventLog(
840
840
  {
841
841
  ...opts,
842
842
  exposureState: true,
843
843
  },
844
844
  'exposure',
845
845
  )
846
846
  : Promise.resolve(false);
847
847
  }