@conecli/cone-render 0.8.20-beta.0 → 0.8.20-beta.2

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