@conecli/cone-render 0.10.1-beta.6 → 0.10.1-beta.8

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 (65) 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.jd.ts +1 -1
  5. package/dist/common/index.ts +1 -1
  6. package/dist/common/index.weapp.ts +1 -1
  7. package/dist/common/jssdk.ts +1 -1
  8. package/dist/common/token/index.h5.ts +1 -1
  9. package/dist/common/token/token.jd.ts +1 -1
  10. package/dist/common/wxappApi.ts +1 -1
  11. package/dist/components/base/CommonFloorHead/index.module.scss +126 -111
  12. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  13. package/dist/components/base/CustomScrollView/index-back.tsx +1 -0
  14. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  15. package/dist/components/base/Dialog/index.module.scss +11 -0
  16. package/dist/components/base/ExposureSmart/index.h5.module.scss +12 -2
  17. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  18. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  19. package/dist/components/base/InViewRender/index.tsx +1 -1
  20. package/dist/components/base/ItemViewExposureSmart/index.module.scss +2 -2
  21. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  22. package/dist/components/debug/DebugLayout/index.module.scss +2 -2
  23. package/dist/components/floorItem.weapp.tsx +1 -1
  24. package/dist/interface/common.ts +1 -1
  25. package/dist/interface/jumpEventReport.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/index.weapp.ts +1 -1
  30. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  31. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  32. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  33. package/dist/jumpEventReport/web/report.ts +1 -1
  34. package/dist/jumpEventReport/web.base.ts +1 -1
  35. package/dist/jumpEventReport/web.jd.ts +1 -1
  36. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  37. package/dist/libs/taroAppReport.js +2 -2
  38. package/dist/modules/ContainerFloorList/index.h5.module.scss +66 -53
  39. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  40. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  41. package/dist/open/api/environment.ts +1 -1
  42. package/dist/open/api/shopMember.ts +1 -1
  43. package/dist/open/api/util.ts +1 -1
  44. package/dist/sass/app.h5.scss +273 -224
  45. package/dist/service/fetchGateway.ts +1 -1
  46. package/dist/service/fetchGateway.weapp.ts +1 -0
  47. package/dist/service/http/colorSign.ts +1 -1
  48. package/dist/service/http/const.ts +1 -1
  49. package/dist/service/http/h5Http.ts +1 -1
  50. package/dist/service/requestServer.h5.ts +1 -1
  51. package/dist/service/requestServer.ts +1 -1
  52. package/dist/service/requestServer.weapp.ts +1 -0
  53. package/dist/utils/connectNativeJsBridge.ts +1 -1
  54. package/dist/utils/h5Utils.ts +1 -1
  55. package/dist/utils/index.h5.ts +1 -1
  56. package/dist/utils/index.ts +1 -1
  57. package/dist/utils/index.weapp.ts +1 -1
  58. package/dist/utils/jumpExtMapUtil.h5.ts +1 -0
  59. package/dist/utils/jumpExtMapUtil.ts +1 -0
  60. package/dist/utils/log.ts +1 -0
  61. package/dist/utils/sColor.js +1 -0
  62. package/dist/utils/utils.ts +1 -1
  63. package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
  64. package/dist/wxapp/common/user_info.js +1 -1
  65. 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
  routerInfo: {
407
407
  params: {},
408
408
  },
409
409
  nativeEvent: null,
410
410
  jumpConfig: {
411
411
  venderId: null,
412
412
  shopId: null,
413
413
  sourceValue: '',
414
414
  sourceType: 'App-H5',
415
415
  activityType: 'shopx',
416
416
  moduleId: 'none',
417
417
  entrance: 'none',
418
418
  },
419
419
  logPageParamStr: '',
420
420
  public logPageId: string;
421
421
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig;
422
422
  constructor(opt = {}) {
423
423
  super(opt);
424
424
  this.getConfig(opt);
425
425
  }
426
426
  getConfig(opt = {}) {
427
427
  return Object.assign(this, {}, defaultConfig, opt);
428
428
  }
429
429
  updateInfo(routerInfo, logPname = LogPnameInfo.HOME, pageId = LogPageIdInfo.APP) {
430
430
  this.logPageId = pageId;
431
431
  this.routerInfo = routerInfo;
432
432
  this.jumpConfig = Object.assign({}, this.jumpConfig, routerInfo.params);
433
433
  this.logPname = logPname;
434
434
  }
435
435
  reportInfoPv(
436
436
  pageId = LogPageIdInfo.APP,
437
437
  opt: {
438
438
  pageParam?: any;
439
439
  } = {},
440
440
  ) {
441
441
  const { pageParam } = opt;
442
442
  this.logPageParamStr = pageParam
443
443
  ? pageParam
444
444
  : this.creatParamToLogStr(this.jumpConfig)
445
445
  .replace(/moduleId/, 'JumpmoduleID')
446
446
  .replace(/entrance/, 'Jumpentrance');
447
447
  reportPV({
448
448
  pageId,
449
449
  pageParam: this.logPageParamStr,
450
450
  ...opt,
451
451
  });
452
452
  }
453
453
 
454
454
  jdJumpToDongDongChatGroup(groupId, source = '4') {
455
455
  this.jdNavigateToNative({
456
456
  category: 'jump',
457
457
  des: 'dongdong_group_chat',
458
458
  source: source,
459
459
  groupId: `${groupId}`,
460
460
  });
461
461
  }
462
462
 
463
463
  jdJumpToWeb(
464
464
  url,
465
465
  logEventInfo,
466
466
  successBack?: functionType | undefined,
467
467
  failBack?: functionType | undefined,
468
468
  ) {
469
469
  console.log('jd web', this.isOpenJdAppUrl(url), url);
470
470
  if (this.isOpenJdAppUrl(url)) {
471
471
  const getOpenAppParams = this.jdOpenAppParams(url);
472
472
  console.log('jd web 获取自定义openApp链接解析后的参数结果', getOpenAppParams);
473
473
  if (getOpenAppParams) {
474
474
  this.jdNavigateToNative(
475
475
  Object.assign({}, getOpenAppParams, {
476
476
  logEventInfo,
477
477
  }),
478
478
  );
479
479
  }
480
480
  } else {
481
481
  let _getLastUrl = url;
482
482
  if (/shop\.m\.jd\.com|pages\.jd\.com/.test(_getLastUrl)) {
483
483
  const getUrlSearchParamState = _getLastUrl.indexOf('?') !== -1;
484
484
  if (!/jwebprog=0/.test(_getLastUrl)) {
485
485
  _getLastUrl = `${_getLastUrl}${getUrlSearchParamState ? '&' : '?'}jwebprog=0`;
486
486
  }
487
487
  if (global.info.sysInfo?.isJdTabletDevice && !/device=tablet/.test(_getLastUrl)) {
488
488
  _getLastUrl = `${_getLastUrl}${getUrlSearchParamState ? '&' : '?'}device=tablet`;
489
489
  }
490
490
  }
491
491
  super.jdJumpToWeb(
492
492
  _getLastUrl,
493
493
  {
494
494
  ...logEventInfo,
495
495
  },
496
496
  successBack,
497
497
  failBack,
498
498
  );
499
499
  }
500
500
  }
501
501
 
502
502
  jdJumpToWebInner(url, logEventInfo) {
503
503
  this.jdJumpToWeb(url, logEventInfo);
504
504
  }
505
505
 
506
506
  jdJumpConfigUrl(detail, logEventInfo = {}) {
507
507
  const { configDataType, configDataValue } = detail;
508
508
  switch (configDataType) {
509
509
  case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
510
510
  this.jdJumpToShopCategory({
511
511
  ...configDataValue,
512
512
  logEventInfo,
513
513
  });
514
514
  break;
515
515
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
516
516
  if (logEventInfo?.jsonParam?.logBaseInfo?.mInfo) {
517
517
  logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds;
518
518
  }
519
519
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo);
520
520
  break;
521
521
  case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
522
522
  this.jdJumpToWeb(
523
523
  `${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
524
524
  {},
525
525
  );
526
526
  break;
527
527
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
528
528
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
529
529
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
530
530
  console.log('jd web 获取店铺分类链接解析后的参数结果', getShopSearchParams);
531
531
  getShopSearchParams &&
532
532
  this.jdJumpToShopSearch(
533
533
  Object.assign({}, getShopSearchParams, {
534
534
  logEventInfo,
535
535
  }),
536
536
  );
537
537
  } else {
538
538
  this.jdJumpToShopSearch(
539
539
  configDataValue['cid']
540
540
  ? Object.assign(
541
541
  {},
542
542
  {
543
543
  shopId: global.info.queryInfo.shopId,
544
544
  categoryId: configDataValue.cid,
545
545
  searchType: '5',
546
546
  logEventInfo,
547
547
  },
548
548
  )
549
549
  : {
550
550
  shopId: global.info.queryInfo.shopId,
551
551
  logEventInfo,
552
552
  },
553
553
  );
554
554
  }
555
555
  break;
556
556
  case LinkConfigType.CONFIG_TYPE_MEMBER:
557
557
  if (isAppHomeForMarketPage) {
558
558
  this.jdJumpToBottomTabBrandMember({
559
559
  logEventInfo,
560
560
  });
561
561
  } else {
562
562
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
563
563
  const getShopMemberParams = this.jdOpenAppParams(configDataValue.clickUrl);
564
564
  getShopMemberParams &&
565
565
  this.jdJumpToShopMember(
566
566
  Object.assign({}, getShopMemberParams, {
567
567
  logEventInfo,
568
568
  }),
569
569
  );
570
570
  } else {
571
571
  this.jdJumpToShopMember({
572
572
  shopId: global.info.queryInfo.shopId,
573
573
  venderId: configDataValue.shopDetail,
574
574
  logEventInfo,
575
575
  });
576
576
  }
577
577
  }
578
578
  break;
579
579
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
580
580
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
581
581
  const getShopActivityParams = this.jdOpenAppParams(configDataValue.clickUrl);
582
582
  getShopActivityParams &&
583
583
  this.jdJumpToShopActivity(
584
584
  Object.assign({}, getShopActivityParams, {
585
585
  logEventInfo,
586
586
  }),
587
587
  );
588
588
  } else if (configDataValue['projectId']) {
589
589
  this.jdJumpToShopActivity({
590
590
  projectId: configDataValue['projectId'],
591
591
  configDataValue,
592
592
  logEventInfo,
593
593
  });
594
594
  }
595
595
  break;
596
596
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
597
597
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
598
598
  const _url = configDataValue.linkUrl;
599
599
  if (
600
600
  _url.indexOf('to=') === -1 &&
601
601
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
602
602
  ) {
603
603
  const _shopId = _url.match(/\d+/g)[0];
604
604
  this.jdJumpToShopHome({
605
605
  shopId: `${_shopId}`,
606
606
  logEventInfo,
607
607
  });
608
608
  } else if (this.isOpenJdAppUrl(_url)) {
609
609
  const getOpenAppParams = this.jdOpenAppParams(_url);
610
610
  console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams);
611
611
  if (getOpenAppParams) {
612
612
  let _changeOpenAppParams = getOpenAppParams;
613
613
  if (isAppHomeForMarketPage) {
614
614
  const { operation, ...otherOpenAppParams } = getOpenAppParams;
615
615
  if (operation && operation === 'jumpTabInner') {
616
616
  _changeOpenAppParams = otherOpenAppParams;
617
617
  }
618
618
  }
619
619
  this.jdNavigateToNative(
620
620
  Object.assign({}, _changeOpenAppParams, {
621
621
  logEventInfo,
622
622
  }),
623
623
  );
624
624
  }
625
625
  } else {
626
626
  this.jdJumpToWeb(_url, logEventInfo);
627
627
  }
628
628
  break;
629
629
  }
630
630
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
631
631
  this.jdJumpToShopDetail({
632
632
  venderId: global.info.queryInfo.venderId,
633
633
  shopId: global.info.queryInfo.shopId,
634
634
  logEventInfo,
635
635
  });
636
636
  break;
637
637
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
638
638
  this.jdJumpToShopHome({
639
639
  ...configDataValue,
640
640
  logEventInfo,
641
641
  });
642
642
  break;
643
643
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
644
644
  break;
645
645
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
646
646
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
647
647
  const getShoppingGuideParams = this.jdOpenAppParams(configDataValue.clickUrl);
648
648
  getShoppingGuideParams &&
649
649
  this.jdJumpToShopActivity(
650
650
  Object.assign({}, getShoppingGuideParams, {
651
651
  logEventInfo,
652
652
  }),
653
653
  );
654
654
  }
655
655
  break;
656
656
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
657
657
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '');
658
658
  const search = linkUrl.match(/\?.+/);
659
659
  if (search) {
660
660
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
661
661
  parseQueryUrlString(linkUrl);
662
662
  try {
663
663
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param);
664
664
  } catch (e) {
665
665
  console.warn('解析小程序 param 错误:', miniQueryData.param);
666
666
  }
667
667
  this.jdJumpToMiniProgram(miniQueryData);
668
668
  } else {
669
669
  console.warn('小程序地址错误:', linkUrl);
670
670
  }
671
671
  break;
672
672
  }
673
673
  case LinkConfigType.CONFIG_TYPE_SHOP_SEARCH: {
674
674
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
675
675
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
676
676
  console.log('jd web 获取店铺结果落地页链接解析后的参数结果', getShopSearchParams);
677
677
  getShopSearchParams &&
678
678
  this.jdJumpToShopSearch(
679
679
  Object.assign({}, getShopSearchParams, {
680
680
  logEventInfo,
681
681
  }),
682
682
  );
683
683
  } else {
684
684
  this.jdJumpToWeb(configDataValue.clickUrl, logEventInfo);
685
685
  }
686
686
  break;
687
687
  }
688
688
  default:
689
689
  }
690
690
  }
691
691
 
692
692
  jdNavigateToNative(
693
693
  params: object,
694
694
  url = 'openapp.jdmobile://virtual',
695
695
  successBack?: functionType | null,
696
696
  failBack?: functionType | null,
697
697
  ) {
698
698
  console.log('[降级H5] jdNavigateToNative web.jd:', params);
699
699
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams = Object.assign(
700
700
  {},
701
701
  {
702
702
  sourceValue: 'sourceValue_jshopModuleWeb',
703
703
  sourceType: 'sourceType_jshopModuleWeb',
704
704
  param: {},
705
705
  },
706
706
  params,
707
707
  );
708
708
  const { logEventInfo, ...otherParams } = getResParams;
709
709
  console.log('jd web 获取open协议参数 jdNavigateToNative params: ', getResParams);
710
710
  console.log('logEventInfo params: ', logEventInfo);
711
711
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
712
712
  this.clickEventLog(logEventInfo || getResParams)
713
713
  .then(() => {
714
714
  if (typeof successBack === 'function') {
715
715
  successBack(getResParams);
716
716
  } else {
717
717
  try {
718
718
  const paramsStr = JSON.stringify(otherParams);
719
719
  console.log('跳转web jd open协议', `${url}?params=${paramsStr}`);
720
720
  window.location.href = `${url}?params=${paramsStr}`;
721
721
  } catch (e) {
722
722
  console.log('跳转异常', e);
723
723
  }
724
724
  }
725
725
  })
726
726
  .catch(() => {
727
727
  typeof failBack === 'function' && failBack(getResParams);
728
728
  });
729
729
  }
730
730
 
731
731
  clickEventLog(opts: JumpEventReportInterFace.OptEventLogParams = {}, reportKey = 'click') {
732
732
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts;
733
733
  if (eventId && jsonParam) {
734
734
  const { etModelInfo, logBaseInfo } = jsonParam;
735
735
  let getJsonParam = {};
736
736
  if (etModelInfo && logBaseInfo) {
737
737
  getJsonParam = logBaseInfo;
738
738
  } else {
739
739
  if (Array.isArray(jsonParam)) {
740
740
  getJsonParam = jsonParam;
741
741
  } else {
742
742
  getJsonParam = Object.assign(
743
743
  {},
744
744
  {
745
745
  shopid: global.info.queryInfo?.shopId,
746
746
  },
747
747
  jsonParam,
748
748
  );
749
749
  }
750
750
  }
751
751
  if (
752
752
  reportKey === 'exposure' &&
753
753
  /^TerminatorNew/.test(eventId) &&
754
754
  !Array.isArray(getJsonParam)
755
755
  ) {
756
756
  getJsonParam = [getJsonParam];
757
757
  }
758
758
  const webLogParams = {
759
759
  isExpo: reportKey === 'exposure',
760
760
  eid: eventId,
761
761
  elevel: eventLevel,
762
762
  jsonParam: JSON.stringify(getJsonParam),
763
763
  etModel: JSON.stringify(etModelInfo || {}),
764
764
  pageId: this.logPageId,
765
765
  pageParam: this.logPageParamStr,
766
766
  ...otherParams,
767
767
  };
768
768
  return /click|exposure/.test(reportKey)
769
769
  ? reportClick(webLogParams)
770
770
  : reportToCart(opts, webLogParams);
771
771
  } else {
772
772
  console.log('暂无埋点参数eventId和eventParam');
773
773
  return Promise.resolve(false);
774
774
  }
775
775
  }
776
776
 
777
777
  exposureEventLog(opts) {
778
778
  return global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
779
779
  ? this.clickEventLog(
780
780
  {
781
781
  ...opts,
782
782
  exposureState: true,
783
783
  },
784
784
  'exposure',
785
785
  )
786
786
  : Promise.resolve(false);
787
787
  }