@conecli/cone-render 0.8.38 → 0.8.40

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