@conecli/cone-render 0.10.1-shop3.1 → 0.10.1-shop3.100

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 (129) hide show
  1. package/README.md +1 -1
  2. package/dist/api/index.ts +1 -1
  3. package/dist/common/accessibility.h5.ts +1 -0
  4. package/dist/common/accessibility.ts +1 -0
  5. package/dist/common/const.ts +1 -1
  6. package/dist/common/index.h5.ts +1 -1
  7. package/dist/common/index.jd.ts +1 -1
  8. package/dist/common/index.ts +1 -1
  9. package/dist/common/index.weapp.ts +1 -1
  10. package/dist/common/jdplayerSdk.weapp.tsx +1 -0
  11. package/dist/common/jssdk.ts +1 -1
  12. package/dist/common/jssdk.weapp.ts +1 -0
  13. package/dist/common/pageType.ts +1 -1
  14. package/dist/common/token/index.h5.ts +1 -1
  15. package/dist/common/token/token.jd.ts +1 -1
  16. package/dist/common/wxappApi.ascf.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.module.scss +126 -111
  20. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  21. package/dist/components/base/CountDown/index.module.scss +49 -44
  22. package/dist/components/base/CountDown/index.tsx +1 -1
  23. package/dist/components/base/CustomScrollView/index-back.tsx +1 -0
  24. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  25. package/dist/components/base/CustomVideo/index.tsx +1 -1
  26. package/dist/components/base/CustomVideo/index.weapp.tsx +1 -0
  27. package/dist/components/base/Dialog/index.module.scss +11 -0
  28. package/dist/components/base/ExposureSmart/index.h5.module.scss +12 -2
  29. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  30. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  31. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  32. package/dist/components/base/InOrOutViewObserver/index.weapp.tsx +1 -0
  33. package/dist/components/base/InViewRender/index.tsx +1 -1
  34. package/dist/components/base/ItemViewExposureSmart/index.module.scss +2 -2
  35. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  36. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  37. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  38. package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
  39. package/dist/components/base/MobileCommonHeader/index.weapp.tsx +1 -0
  40. package/dist/components/base/NetworkDataError/const.ts +1 -1
  41. package/dist/components/base/NetworkDataError/index.module.scss +118 -72
  42. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  43. package/dist/components/base/Price/Base/index.module.scss +12 -0
  44. package/dist/components/base/Price/Base/index.tsx +1 -1
  45. package/dist/components/base/Price/Double/index.module.scss +33 -1
  46. package/dist/components/base/Price/Double/index.tsx +1 -1
  47. package/dist/components/base/ShopLeGaoTag/index.h5.module.scss +35 -0
  48. package/dist/components/base/ShopLeGaoTag/index.h5.tsx +1 -0
  49. package/dist/components/base/ShopLeGaoTag/index.module.scss +33 -0
  50. package/dist/components/base/ShopLeGaoTag/index.tsx +1 -0
  51. package/dist/components/debug/DebugLayout/index.module.scss +2 -2
  52. package/dist/components/floorItem.tsx +1 -1
  53. package/dist/components/floorItem.weapp.tsx +1 -1
  54. package/dist/components/isv/Floor/index.tsx +1 -1
  55. package/dist/components/remoteFloorItem.tsx +1 -1
  56. package/dist/config/env.ts +1 -1
  57. package/dist/interface/common.ts +1 -1
  58. package/dist/interface/component.ts +1 -1
  59. package/dist/interface/jumpEventReport.ts +1 -1
  60. package/dist/interface/service.ts +1 -1
  61. package/dist/jumpEventReport/base.ts +1 -1
  62. package/dist/jumpEventReport/const.ts +1 -1
  63. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  64. package/dist/jumpEventReport/index.h5.ts +1 -1
  65. package/dist/jumpEventReport/index.jd.ts +1 -1
  66. package/dist/jumpEventReport/index.weapp.ts +1 -1
  67. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  68. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  69. package/dist/jumpEventReport/logEventConfig.h5.ts +1 -0
  70. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  71. package/dist/jumpEventReport/web/report.ts +1 -1
  72. package/dist/jumpEventReport/web.base.ts +1 -1
  73. package/dist/jumpEventReport/web.jd.ts +1 -1
  74. package/dist/jumpEventReport/web.jdb.ts +1 -1
  75. package/dist/jumpEventReport/web.jdjch.ts +1 -1
  76. package/dist/jumpEventReport/web.jxwxapp.ts +1 -1
  77. package/dist/jumpEventReport/web.pc.ts +1 -1
  78. package/dist/jumpEventReport/web.tjapp.ts +1 -1
  79. package/dist/jumpEventReport/web.tjm.ts +1 -1
  80. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  81. package/dist/language/en_US.json +395 -0
  82. package/dist/language/zh_CN.json +395 -0
  83. package/dist/language/zh_HK.json +395 -0
  84. package/dist/libs/openShopBridge.js +161 -0
  85. package/dist/libs/openShopBridge.min.js +1 -0
  86. package/dist/libs/taroAppReport.js +2 -2
  87. package/dist/modules/ContainerFloorList/index.h5.module.scss +80 -53
  88. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  89. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  90. package/dist/modules/DecorateContainerFloorList/index.weapp.tsx +1 -0
  91. package/dist/open/api/environment.ts +1 -1
  92. package/dist/open/api/shopMember.ts +1 -1
  93. package/dist/open/api/shopMember.weapp.ts +1 -0
  94. package/dist/open/api/track.ts +1 -1
  95. package/dist/open/api/util.ts +1 -1
  96. package/dist/open/components/index.ts +1 -1
  97. package/dist/open/index.ts +1 -1
  98. package/dist/sass/app.h5.scss +278 -224
  99. package/dist/sass/base.scss +150 -145
  100. package/dist/service/fetchGateway.ts +1 -1
  101. package/dist/service/fetchGateway.weapp.ts +1 -0
  102. package/dist/service/fetchJsonp.weapp.ts +1 -0
  103. package/dist/service/http/colorSign.ts +1 -1
  104. package/dist/service/http/const.ts +1 -1
  105. package/dist/service/http/h5Http.ts +1 -1
  106. package/dist/service/http/httpInterceptors.weapp.ts +1 -0
  107. package/dist/service/requestServer.h5.ts +1 -1
  108. package/dist/service/requestServer.ts +1 -1
  109. package/dist/service/requestServer.weapp.ts +1 -0
  110. package/dist/utils/connectNativeJsBridge.ts +1 -1
  111. package/dist/utils/h5Utils.ts +1 -1
  112. package/dist/utils/harmonyCallRouter.h5.ts +1 -0
  113. package/dist/utils/harmonyCallRouter.ts +0 -0
  114. package/dist/utils/index.h5.ts +1 -1
  115. package/dist/utils/index.ts +1 -1
  116. package/dist/utils/index.weapp.ts +1 -1
  117. package/dist/utils/jumpExtMapUtil.h5.ts +1 -0
  118. package/dist/utils/jumpExtMapUtil.ts +1 -0
  119. package/dist/utils/jumpExtMapUtil.weapp.ts +1 -0
  120. package/dist/utils/log.ts +1 -0
  121. package/dist/utils/sColor.ts +1 -0
  122. package/dist/utils/sColor.weapp.ts +1 -0
  123. package/dist/utils/utils.ts +1 -1
  124. package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
  125. package/dist/wxapp/common/user_info.js +1 -1
  126. package/package.json +162 -141
  127. package/dist/jumpEventReport/web/wqshop.report.ts +0 -1
  128. package/dist/utils/memberFormatUtils.js +0 -1
  129. package/dist/utils/priceUtils.js +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
  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
  isInJdShopView,
412
412
  routerInfo: {
413
413
  params: {},
414
414
  },
415
415
  nativeEvent: null,
416
416
  jumpConfig: {
417
417
  venderId: null,
418
418
  shopId: null,
419
419
  sourceValue: '',
420
420
  sourceType: 'App-H5',
421
421
  activityType: 'shopx',
422
422
  moduleId: 'none',
423
423
  entrance: 'none',
424
424
  },
425
425
  logPageParamStr: '',
426
426
  public logPageId: string;
427
427
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig;
428
428
  constructor(opt = {}) {
429
429
  super(opt);
430
430
  this.getConfig(opt);
431
431
  }
432
432
  getConfig(opt = {}) {
433
433
  return Object.assign(this, {}, defaultConfig, opt);
434
434
  }
435
435
  updateInfo(routerInfo, logPname = LogPnameInfo.HOME, pageId = LogPageIdInfo.APP) {
436
436
  this.logPageId = pageId;
437
437
  this.routerInfo = routerInfo;
438
438
  this.jumpConfig = Object.assign({}, this.jumpConfig, routerInfo.params);
439
439
  this.logPname = logPname;
440
440
  }
441
441
  reportInfoPv(
442
442
  pageId = LogPageIdInfo.APP,
443
443
  opt: {
444
444
  pageParam?: any;
445
445
  } = {},
446
446
  ) {
447
447
  const { pageParam, ...otherOpts } = opt;
448
448
  const pageParamStr = typeof pageParam === 'object' ? JSON.stringify(pageParam) : pageParam;
449
449
  this.logPageParamStr = pageParamStr
450
450
  ? pageParamStr
451
451
  : this.creatParamToLogStr(this.jumpConfig)
452
452
  .replace(/moduleId/, 'JumpmoduleID')
453
453
  .replace(/entrance/, 'Jumpentrance');
454
454
  reportPV({
455
455
  pageId,
456
456
  pageParam: this.logPageParamStr,
457
457
  ...otherOpts,
458
458
  });
459
459
  }
460
460
 
461
461
  jdJumpToDongDongChatGroup(groupId, source = '4') {
462
462
  this.jdNavigateToNative({
463
463
  category: 'jump',
464
464
  des: 'dongdong_group_chat',
465
465
  source: source,
466
466
  groupId: `${groupId}`,
467
467
  });
468
468
  }
469
469
 
470
470
  jdJumpToWeb(
471
471
  url,
472
472
  logEventInfo,
473
473
  successBack?: functionType | undefined,
474
474
  failBack?: functionType | undefined,
475
475
  ) {
476
476
  console.log('jd web', this.isOpenJdAppUrl(url), url);
477
477
  if (this.isOpenJdAppUrl(url)) {
478
478
  const getOpenAppParams = this.jdOpenAppParams(url);
479
479
  console.log('jd web 获取自定义openApp链接解析后的参数结果', getOpenAppParams);
480
480
  if (getOpenAppParams) {
481
481
 
482
482
  const { useEncodeParams, ...otherLogInfo } = logEventInfo || {};
483
483
  this.jdNavigateToNative(
484
484
  Object.assign({}, getOpenAppParams, {
485
485
  logEventInfo: otherLogInfo,
486
486
  useEncodeParams: Boolean(useEncodeParams),
487
487
  }),
488
488
  );
489
489
  }
490
490
  } else {
491
491
  let _getLastUrl = url;
492
492
  if (/shop\.m\.jd\.com|pages\.jd\.com/.test(_getLastUrl)) {
493
493
  const getUrlSearchParamState = _getLastUrl.indexOf('?') !== -1;
494
494
  if (!/jwebprog=0/.test(_getLastUrl)) {
495
495
  _getLastUrl = `${_getLastUrl}${getUrlSearchParamState ? '&' : '?'}jwebprog=0`;
496
496
  }
497
497
  if (global.info.sysInfo?.newFlexPad && !/terminal=flex/.test(_getLastUrl)) {
498
498
  _getLastUrl = `${_getLastUrl}${_getLastUrl.indexOf('?') !== -1 ? '&' : '?'}terminal=flex`;
499
499
  } else if (
500
500
  global.info.sysInfo?.isJdTabletDevice &&
501
501
  !global.info.sysInfo?.newFlexPad &&
502
502
  !/device=tablet/.test(_getLastUrl)
503
503
  ) {
504
504
  _getLastUrl = `${_getLastUrl}${_getLastUrl.indexOf('?') !== -1 ? '&' : '?'}device=tablet`;
505
505
  }
506
506
  if (isInJdShopView && !/origin=appShop/.test(_getLastUrl)) {
507
507
  _getLastUrl = `${_getLastUrl}${_getLastUrl.indexOf('?') !== -1 ? '&' : '?'}origin=appShop`;
508
508
  }
509
509
  }
510
510
  super.jdJumpToWeb(
511
511
  _getLastUrl,
512
512
  {
513
513
  ...logEventInfo,
514
514
  },
515
515
  successBack,
516
516
  failBack,
517
517
  );
518
518
  }
519
519
  }
520
520
 
521
521
  jdJumpToWebInner(url, logEventInfo) {
522
522
  this.jdJumpToWeb(url, logEventInfo);
523
523
  }
524
524
 
525
525
  jdJumpConfigUrl(detail, logEventInfo = {}) {
526
526
  const { configDataType, configDataValue } = detail;
527
527
  switch (configDataType) {
528
528
  case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
529
529
  this.jdJumpToShopCategory({
530
530
  ...configDataValue,
531
531
  logEventInfo,
532
532
  });
533
533
  break;
534
534
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
535
535
  if (logEventInfo?.jsonParam?.logBaseInfo?.mInfo) {
536
536
  logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds;
537
537
  }
538
538
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo);
539
539
  break;
540
540
  case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
541
541
  this.jdJumpToWeb(
542
542
  `${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
543
543
  {},
544
544
  );
545
545
  break;
546
546
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
547
547
  if (isJdAndHarmonyDevice && isNewHarmonyShop && jdAppVersionStr === '15.1.70') {
548
548
  const baseInfo = {
549
549
  shopId: global.info.queryInfo.shopId,
550
550
  venderId: global.info.queryInfo.venderId,
551
551
  };
552
552
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
553
553
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
554
554
  console.log('jd web 获取店铺分类链接解析后的参数结果', getShopSearchParams);
555
555
  let openAppParams =
556
556
  typeof getShopSearchParams === 'boolean'
557
557
  ? { categoryId: '', ...baseInfo }
558
558
  : getShopSearchParams;
559
559
  const getInfo = openAppParams['categoryId']
560
560
  ? { ...openAppParams, cateId: openAppParams['categoryId'] }
561
561
  : openAppParams;
562
562
  console.log('处理后的参数', objectToUrlEncode(getInfo));
563
563
  this.jdJumpToWeb(
564
564
  `${this.jumpWebUrl.shopSearch}?${objectToUrlEncode(getInfo)}`,
565
565
  logEventInfo,
566
566
  );
567
567
  } else {
568
568
  const getInfo = configDataValue['cid']
569
569
  ? { ...baseInfo, ...configDataValue, cateId: configDataValue.cid, searchType: '5' }
570
570
  : { ...baseInfo, ...configDataValue };
571
571
  this.jdJumpToWeb(
572
572
  `${this.jumpWebUrl.shopSearch}?${objectToUrlEncode(getInfo)}`,
573
573
  logEventInfo,
574
574
  );
575
575
  }
576
576
  } else {
577
577
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
578
578
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
579
579
  console.log('jd web 获取店铺分类链接解析后的参数结果', getShopSearchParams);
580
580
  getShopSearchParams &&
581
581
  this.jdJumpToShopSearch(
582
582
  Object.assign({}, getShopSearchParams, {
583
583
  logEventInfo,
584
584
  }),
585
585
  );
586
586
  } else {
587
587
  const extraParam = configDataValue?.pageId ? { pageId: configDataValue.pageId } : {};
588
588
  this.jdJumpToShopSearch(
589
589
  configDataValue['cid']
590
590
  ? Object.assign(
591
591
  {},
592
592
  {
593
593
  shopId: global.info.queryInfo.shopId,
594
594
  categoryId: configDataValue.cid,
595
595
  searchType: '5',
596
596
  ...extraParam,
597
597
  logEventInfo,
598
598
  },
599
599
  )
600
600
  : {
601
601
  shopId: global.info.queryInfo.shopId,
602
602
  ...extraParam,
603
603
  logEventInfo,
604
604
  },
605
605
  );
606
606
  }
607
607
  }
608
608
  break;
609
609
  case LinkConfigType.CONFIG_TYPE_MEMBER:
610
610
  if (isAppHomeForMarketPage) {
611
611
  this.jdJumpToBottomTabBrandMember({
612
612
  logEventInfo,
613
613
  });
614
614
  } else {
615
615
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
616
616
  const getShopMemberParams = this.jdOpenAppParams(configDataValue.clickUrl);
617
617
  getShopMemberParams &&
618
618
  this.jdJumpToShopMember(
619
619
  Object.assign({}, getShopMemberParams, {
620
620
  logEventInfo,
621
621
  }),
622
622
  );
623
623
  } else {
624
624
  this.jdJumpToShopMember({
625
625
  shopId: global.info.queryInfo.shopId,
626
626
  venderId: configDataValue.shopDetail,
627
627
  logEventInfo,
628
628
  });
629
629
  }
630
630
  }
631
631
  break;
632
632
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
633
633
  if (this.isNewHarmony()) {
634
634
  const url = `${domain.sale}/m/h5/${configDataValue.data}.html`;
635
635
  this.jdJumpToWeb(url, logEventInfo);
636
636
  } else {
637
637
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
638
638
  const getShopActivityParams = this.jdOpenAppParams(configDataValue.clickUrl);
639
639
  getShopActivityParams &&
640
640
  this.jdJumpToShopActivity(
641
641
  Object.assign({}, getShopActivityParams, {
642
642
  logEventInfo,
643
643
  }),
644
644
  );
645
645
  } else if (configDataValue['projectId']) {
646
646
  this.jdJumpToShopActivity({
647
647
  projectId: configDataValue['projectId'],
648
648
  configDataValue,
649
649
  logEventInfo,
650
650
  });
651
651
  }
652
652
  }
653
653
  break;
654
654
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
655
655
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
656
656
  const _url = configDataValue.linkUrl;
657
657
  if (
658
658
  _url.indexOf('to=') === -1 &&
659
659
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
660
660
  ) {
661
661
  const _shopId = _url.match(/\d+/g)[0];
662
662
  this.jdJumpToShopHome({
663
663
  shopId: `${_shopId}`,
664
664
  logEventInfo,
665
665
  });
666
666
  } else if (this.isOpenJdAppUrl(_url)) {
667
667
  const getOpenAppParams = this.jdOpenAppParams(_url);
668
668
  console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams);
669
669
  if (getOpenAppParams) {
670
670
  let _changeOpenAppParams = getOpenAppParams;
671
671
  if (isAppHomeForMarketPage) {
672
672
  const { operation, ...otherOpenAppParams } = getOpenAppParams;
673
673
  if (operation && operation === 'jumpTabInner') {
674
674
  _changeOpenAppParams = otherOpenAppParams;
675
675
  }
676
676
  }
677
677
  this.jdNavigateToNative(
678
678
  Object.assign({}, _changeOpenAppParams, {
679
679
  logEventInfo,
680
680
  }),
681
681
  );
682
682
  }
683
683
  } else {
684
684
  this.jdJumpToWeb(_url, logEventInfo);
685
685
  }
686
686
  break;
687
687
  }
688
688
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
689
689
  this.jdJumpToShopDetail({
690
690
  venderId: global.info.queryInfo.venderId,
691
691
  shopId: global.info.queryInfo.shopId,
692
692
  logEventInfo,
693
693
  });
694
694
  break;
695
695
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
696
696
  this.jdJumpToShopHome({
697
697
  ...configDataValue,
698
698
  logEventInfo,
699
699
  });
700
700
  break;
701
701
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
702
702
  break;
703
703
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
704
704
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
705
705
  const getShoppingGuideParams = this.jdOpenAppParams(configDataValue.clickUrl);
706
706
  getShoppingGuideParams &&
707
707
  this.jdJumpToShopActivity(
708
708
  Object.assign({}, getShoppingGuideParams, {
709
709
  logEventInfo,
710
710
  }),
711
711
  );
712
712
  }
713
713
  break;
714
714
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
715
715
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '');
716
716
  const search = linkUrl.match(/\?.+/);
717
717
  if (search) {
718
718
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
719
719
  parseQueryUrlString(linkUrl);
720
720
  try {
721
721
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param);
722
722
  } catch (e) {
723
723
  console.warn('解析小程序 param 错误:', miniQueryData.param);
724
724
  }
725
725
  this.jdJumpToMiniProgram(miniQueryData);
726
726
  } else {
727
727
  console.warn('小程序地址错误:', linkUrl);
728
728
  }
729
729
  break;
730
730
  }
731
731
  case LinkConfigType.CONFIG_TYPE_SHOP_SEARCH: {
732
732
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
733
733
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
734
734
  console.log('jd web 获取店铺结果落地页链接解析后的参数结果', getShopSearchParams);
735
735
  getShopSearchParams &&
736
736
  this.jdJumpToShopSearch(
737
737
  Object.assign({}, getShopSearchParams, {
738
738
  logEventInfo,
739
739
  }),
740
740
  );
741
741
  } else {
742
742
  this.jdJumpToWeb(configDataValue.clickUrl, logEventInfo);
743
743
  }
744
744
  break;
745
745
  }
746
746
  default:
747
747
  }
748
748
  }
749
749
 
750
750
  isNewHarmony() {
751
751
  return isJdAndHarmonyDevice && isNewHarmonyShop;
752
752
  }
753
753
 
754
754
  jdNavigateToNative(
755
755
  params: object,
756
756
  url = 'openapp.jdmobile://virtual',
757
757
  successBack?: functionType | null,
758
758
  failBack?: functionType | null,
759
759
  ) {
760
760
  console.log('[降级H5] jdNavigateToNative web.jd:', params);
761
761
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams = Object.assign(
762
762
  {},
763
763
  {
764
764
  sourceValue: 'sourceValue_jshopModuleWeb',
765
765
  sourceType: 'sourceType_jshopModuleWeb',
766
766
  param: {},
767
767
  },
768
768
  params,
769
769
  );
770
770
  const { logEventInfo, useEncodeParams, ...otherParams } = getResParams;
771
771
  console.log('jd web 获取open协议参数 jdNavigateToNative params: ', getResParams);
772
772
  console.log('logEventInfo params: ', logEventInfo);
773
773
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
774
774
  this.clickEventLog(logEventInfo || getResParams)
775
775
  .then(() => {
776
776
  if (typeof successBack === 'function') {
777
777
  successBack(getResParams);
778
778
  } else {
779
779
  if (this.isNewHarmony() && params.operation === 'jumpTabInner') {
780
780
  if (params.jumpTab) {
781
781
  JumpTabBarInCurrentShop({ position: 'top', item: params.jumpTab, ...params });
782
782
  } else if (params.jumpBottomTab) {
783
783
  JumpTabBarInCurrentShop({
784
784
  position: 'bottom',
785
785
  item: params.jumpBottomTab,
786
786
  ...params,
787
787
  });
788
788
  } else {
789
789
  console.log('[降级H5] 跳转异常 params:', params);
790
790
  }
791
791
  } else if (
792
792
  this.isNewHarmony() &&
793
793
  (params.operation === 'jumpBottomTabMember' || params.des === 'jshopMember')
794
794
  ) {
795
795
  JumpTabBarInCurrentShop({ position: 'bottom', item: 'brandMember', ...params });
796
796
  } else {
797
797
  try {
798
798
  const paramsStr = JSON.stringify(otherParams);
799
799
  console.log('跳转web jd open协议', `${url}?params=${paramsStr}`);
800
800
  window.location.href =
801
801
  isJdAndHarmonyDevice || useEncodeParams
802
802
  ? `${url}?params=${encodeURIComponent(paramsStr)}`
803
803
  : `${url}?params=${paramsStr}`;
804
804
  } catch (e) {
805
805
  draBusinessCustomReport({
806
806
  eventName: 'entryProtocol',
807
807
  errorName: 'shop_jdNavigateToNative_error',
808
808
  errorMessage: '跳转web jd open协议发生错误',
809
809
  extraData: JSON.stringify({
810
810
  url,
811
811
  isJdApp,
812
812
  jdAppVersion: jdAppVersionStr,
813
813
  ...otherParams,
814
814
  }),
815
815
  });
816
816
  }
817
817
  }
818
818
  }
819
819
  })
820
820
  .catch(() => {
821
821
  typeof failBack === 'function' && failBack(getResParams);
822
822
  });
823
823
  }
824
824
 
825
825
  clickEventLog(opts: JumpEventReportInterFace.OptEventLogParams = {}, reportKey = 'click') {
826
826
  const { eventId, spmAllCode, spmCodeForCD, jsonParam, eventLevel = 3, ...otherParams } = opts;
827
827
  if ((eventId || spmAllCode || spmCodeForCD) && jsonParam) {
828
828
  const { etModelInfo, logBaseInfo } = jsonParam;
829
829
  let getJsonParam = {};
830
830
  if (etModelInfo && logBaseInfo) {
831
831
  getJsonParam = logBaseInfo;
832
832
  } else {
833
833
  if (Array.isArray(jsonParam)) {
834
834
  getJsonParam = jsonParam;
835
835
  } else {
836
836
  getJsonParam = Object.assign(
837
837
  {},
838
838
  {
839
839
  shopid: global.info.queryInfo?.shopId,
840
840
  },
841
841
  jsonParam,
842
842
  );
843
843
  }
844
844
  }
845
845
  if (
846
846
  reportKey === 'exposure' &&
847
847
  /^TerminatorNew/.test(eventId) &&
848
848
  !Array.isArray(getJsonParam)
849
849
  ) {
850
850
  getJsonParam = [getJsonParam];
851
851
  }
852
852
  const webLogParams = {
853
853
  isExpo: reportKey === 'exposure',
854
854
  eid: eventId,
855
855
  elevel: eventLevel,
856
856
  jsonParam: JSON.stringify(getJsonParam),
857
857
  etModel: JSON.stringify(etModelInfo || {}),
858
858
  pageId: this.logPageId,
859
859
  pageParam: this.logPageParamStr,
860
860
  spmAllCode,
861
861
  spmCodeForCD,
862
862
  ...otherParams,
863
863
  };
864
864
  return /click|exposure/.test(reportKey)
865
865
  ? reportClick(webLogParams)
866
866
  : reportToCart(opts, webLogParams);
867
867
  } else {
868
868
  console.log('暂无埋点参数eventId和eventParam');
869
869
  return Promise.resolve(false);
870
870
  }
871
871
  }
872
872
 
873
873
  exposureEventLog(opts) {
874
874
  return global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
875
875
  ? this.clickEventLog(
876
876
  {
877
877
  ...opts,
878
878
  exposureState: true,
879
879
  },
880
880
  'exposure',
881
881
  )
882
882
  : Promise.resolve(false);
883
883
  }