@conecli/cone-render 0.8.20-shop.21 → 0.8.20-shop.211

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 (163) 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.module.scss +1 -1
  29. package/dist/components/base/CustomVideo/index.tsx +1 -1
  30. package/dist/components/base/Dialog/index.module.scss +16 -0
  31. package/dist/components/base/Dialog/index.tsx +1 -1
  32. package/dist/components/base/Exposure/index.h5.tsx +1 -1
  33. package/dist/components/base/ExposureSmart/const.ts +1 -0
  34. package/dist/components/base/ExposureSmart/index.h5.module.scss +30 -6
  35. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  36. package/dist/components/base/ExposureSmart/index.module.scss +20 -9
  37. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  38. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  39. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  40. package/dist/components/base/InViewRender/index.tsx +1 -1
  41. package/dist/components/base/InViewRender/index.weapp.tsx +1 -1
  42. package/dist/components/base/ItemViewExposureSmart/index.module.scss +8 -0
  43. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -0
  44. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  45. package/dist/components/base/LazyLayoutLoad/index.weapp.tsx +1 -1
  46. package/dist/components/base/LazyLoadImage/const.ts +1 -1
  47. package/dist/components/base/LazyLoadImage/index.h5.module.scss +24 -20
  48. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  49. package/dist/components/base/MobileCommonHeader/index.module.scss +17 -0
  50. package/dist/components/base/MobileCommonHeader/index.tsx +1 -0
  51. package/dist/components/base/NetworkDataError/const.ts +1 -1
  52. package/dist/components/base/NetworkDataError/index.module.scss +125 -69
  53. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  54. package/dist/components/base/Price/Base/index.module.scss +12 -0
  55. package/dist/components/base/Price/Base/index.tsx +1 -1
  56. package/dist/components/base/Price/Double/index.module.scss +32 -0
  57. package/dist/components/base/Price/Double/index.tsx +1 -1
  58. package/dist/components/base/Price/index.tsx +1 -1
  59. package/dist/components/base/Skeleton/index.tsx +1 -1
  60. package/dist/components/debug/DebugLayout/index.module.scss +67 -0
  61. package/dist/components/debug/DebugLayout/index.tsx +1 -0
  62. package/dist/components/debug/DebugLayout/utils.ts +1 -0
  63. package/dist/components/decorate/DecorateFloorModule/index.module.scss +32 -2
  64. package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
  65. package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
  66. package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
  67. package/dist/components/floorItem.jd.tsx +1 -1
  68. package/dist/components/floorItem.tsx +1 -1
  69. package/dist/components/floorItem.weapp.tsx +1 -1
  70. package/dist/components/isv/Floor/index.tsx +1 -1
  71. package/dist/components/remoteFloorItem.tsx +1 -0
  72. package/dist/interface/common.ts +1 -1
  73. package/dist/interface/component.ts +1 -1
  74. package/dist/interface/jumpEventReport.ts +1 -1
  75. package/dist/interface/service.ts +1 -1
  76. package/dist/interface/utils.ts +1 -1
  77. package/dist/jumpEventReport/base.ts +1 -1
  78. package/dist/jumpEventReport/const.ts +1 -1
  79. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  80. package/dist/jumpEventReport/index.h5.ts +1 -1
  81. package/dist/jumpEventReport/index.jd.ts +1 -1
  82. package/dist/jumpEventReport/index.ts +1 -1
  83. package/dist/jumpEventReport/index.weapp.ts +1 -1
  84. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  85. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  86. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  87. package/dist/jumpEventReport/web/report.ts +1 -1
  88. package/dist/jumpEventReport/web.base.ts +1 -1
  89. package/dist/jumpEventReport/web.jd.ts +1 -1
  90. package/dist/jumpEventReport/web.jdb.ts +1 -1
  91. package/dist/jumpEventReport/web.jdjch.ts +1 -0
  92. package/dist/jumpEventReport/web.jxwxapp.ts +1 -0
  93. package/dist/jumpEventReport/web.pc.ts +1 -0
  94. package/dist/jumpEventReport/web.tjapp.ts +1 -0
  95. package/dist/jumpEventReport/web.tjm.ts +1 -0
  96. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  97. package/dist/language/en_US.json +178 -0
  98. package/dist/language/zh_CN.json +178 -0
  99. package/dist/language/zh_HK.json +178 -0
  100. package/dist/libs/taroAppReport.js +2 -2
  101. package/dist/modules/ContainerFloorList/index.h5.module.scss +66 -27
  102. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  103. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  104. package/dist/open/api/device.ts +1 -1
  105. package/dist/open/api/environment.ts +1 -1
  106. package/dist/open/api/index.ts +1 -1
  107. package/dist/open/api/jump/business.ts +1 -0
  108. package/dist/open/api/jump/index.ts +1 -0
  109. package/dist/open/api/jump/minPath.ts +1 -0
  110. package/dist/open/api/jump/side.ts +1 -0
  111. package/dist/open/api/jump/webUrl.ts +1 -0
  112. package/dist/open/api/jump copy.ts +1 -0
  113. package/dist/open/api/request.ts +1 -1
  114. package/dist/open/api/shopMember.ts +1 -1
  115. package/dist/open/api/track.ts +1 -1
  116. package/dist/open/api/util.ts +1 -1
  117. package/dist/open/components/index.ts +1 -1
  118. package/dist/sass/app.h5.scss +289 -212
  119. package/dist/sass/base.scss +195 -137
  120. package/dist/service/bMallConst.ts +1 -1
  121. package/dist/service/fetchGateway.ts +1 -1
  122. package/dist/service/fetchGateway.weapp.ts +1 -0
  123. package/dist/service/http/colorSign.ts +1 -1
  124. package/dist/service/http/const.ts +1 -1
  125. package/dist/service/http/h5Http.ts +1 -0
  126. package/dist/service/http/index.h5.ts +1 -0
  127. package/dist/service/requestServer.h5.ts +1 -0
  128. package/dist/service/requestServer.ts +1 -1
  129. package/dist/service/requestServer.weapp.ts +1 -0
  130. package/dist/utils/connectNativeJsBridge.ts +1 -1
  131. package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
  132. package/dist/utils/draExceptionAndProfile.ts +1 -1
  133. package/dist/utils/h5Utils.ts +1 -1
  134. package/dist/utils/index.h5.ts +1 -1
  135. package/dist/utils/index.ts +1 -1
  136. package/dist/utils/index.weapp.ts +1 -1
  137. package/dist/utils/intersectionObserver.ts +1 -1
  138. package/dist/utils/jm-common.js +1 -1
  139. package/dist/utils/jumpExtMapUtil.h5.ts +1 -0
  140. package/dist/utils/jumpExtMapUtil.ts +1 -0
  141. package/dist/utils/sColor.js +1 -0
  142. package/dist/utils/sgmCodeUtils.ts +1 -0
  143. package/dist/utils/taroRenderUtil.ts +1 -0
  144. package/dist/utils/utils.ts +1 -1
  145. package/dist/wxapp/api/helper.js +1 -0
  146. package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
  147. package/dist/wxapp/common/user_info.js +1 -1
  148. package/dist/wxapp/components/launch-app/index.js +1 -0
  149. package/dist/wxapp/components/launch-app/index.json +5 -0
  150. package/dist/wxapp/components/launch-app/index.wxml +0 -0
  151. package/dist/wxapp/components/launch-app/index.wxss +0 -0
  152. package/dist/wxapp/components/subscribe-guider/helper.js +1 -0
  153. package/dist/wxapp/components/subscribe-guider/index.js +1 -0
  154. package/dist/wxapp/components/subscribe-guider/index.json +5 -0
  155. package/dist/wxapp/components/subscribe-guider/index.wxml +0 -0
  156. package/dist/wxapp/components/subscribe-guider/index.wxss +0 -0
  157. package/package.json +148 -115
  158. package/dist/components/base/Skeleton/old.tsx +0 -1
  159. package/dist/customHooks/useDocumentVisibilitychange.ts +0 -1
  160. package/dist/open/api/jump.ts +0 -1
  161. package/dist/utils/memberFormatUtils.js +0 -1
  162. /package/dist/service/{bMallConst.wxapp.ts → bMallConst.weapp.ts} +0 -0
  163. /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
  this.jdNavigateToNative(
406
406
  Object.assign({}, getOpenAppParams, {
407
407
  logEventInfo,
408
408
  }),
409
409
  );
410
410
  }
411
411
  } else {
412
412
  let _getLastUrl = url;
413
413
  if (/shop\.m\.jd\.com|pages\.jd\.com/.test(_getLastUrl)) {
414
414
  const getUrlSearchParamState = _getLastUrl.indexOf('?') !== -1;
415
415
  if (!/jwebprog=0/.test(_getLastUrl)) {
416
416
  _getLastUrl = `${_getLastUrl}${getUrlSearchParamState ? '&' : '?'}jwebprog=0`;
417
417
  }
418
418
  if (global.info.sysInfo?.isJdTabletDevice && !/device=tablet/.test(_getLastUrl)) {
419
419
  _getLastUrl = `${_getLastUrl}${getUrlSearchParamState ? '&' : '?'}device=tablet`;
420
420
  }
421
421
  }
422
422
  super.jdJumpToWeb(
423
423
  _getLastUrl,
424
424
  {
425
425
  ...logEventInfo,
426
426
  },
427
427
  successBack,
428
428
  failBack,
429
429
  );
430
430
  }
431
431
  }
432
432
 
433
433
  jdJumpToWebInner(url, logEventInfo) {
434
434
  this.jdJumpToWeb(url, logEventInfo);
435
435
  }
436
436
 
437
437
  jdJumpConfigUrl(detail, logEventInfo = {}) {
438
438
  const { configDataType, configDataValue } = detail;
439
439
  switch (configDataType) {
440
440
  case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
441
441
  this.jdJumpToShopCategory({
442
442
  ...configDataValue,
443
443
  logEventInfo,
444
444
  });
445
445
  break;
446
446
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
447
447
  if (logEventInfo?.jsonParam?.logBaseInfo?.mInfo) {
448
448
  logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds;
449
449
  }
450
450
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo);
451
451
  break;
452
452
  case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
453
453
  this.jdJumpToWeb(
454
454
  `${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
455
455
  {},
456
456
  );
457
457
  break;
458
458
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
459
459
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
460
460
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
461
461
  console.log('jd web 获取店铺分类链接解析后的参数结果', getShopSearchParams);
462
462
  getShopSearchParams &&
463
463
  this.jdJumpToShopSearch(
464
464
  Object.assign({}, getShopSearchParams, {
465
465
  logEventInfo,
466
466
  }),
467
467
  );
468
468
  } else {
469
469
  this.jdJumpToShopSearch(
470
470
  configDataValue['cid']
471
471
  ? Object.assign(
472
472
  {},
473
473
  {
474
474
  shopId: global.info.queryInfo.shopId,
475
475
  categoryId: configDataValue.cid,
476
476
  searchType: '5',
477
477
  logEventInfo,
478
478
  },
479
479
  )
480
480
  : {
481
481
  shopId: global.info.queryInfo.shopId,
482
482
  logEventInfo,
483
483
  },
484
484
  );
485
485
  }
486
486
  break;
487
487
  case LinkConfigType.CONFIG_TYPE_MEMBER:
488
488
  if (isAppHomeForMarketPage) {
489
489
  this.jdJumpToBottomTabBrandMember({
490
490
  logEventInfo,
491
491
  });
492
492
  } else {
493
493
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
494
494
  const getShopMemberParams = this.jdOpenAppParams(configDataValue.clickUrl);
495
495
  getShopMemberParams &&
496
496
  this.jdJumpToShopMember(
497
497
  Object.assign({}, getShopMemberParams, {
498
498
  logEventInfo,
499
499
  }),
500
500
  );
501
501
  } else {
502
502
  this.jdJumpToShopMember({
503
503
  shopId: global.info.queryInfo.shopId,
504
504
  venderId: configDataValue.shopDetail,
505
505
  logEventInfo,
506
506
  });
507
507
  }
508
508
  }
509
509
  break;
510
510
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
511
511
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
512
512
  const getShopActivityParams = this.jdOpenAppParams(configDataValue.clickUrl);
513
513
  getShopActivityParams &&
514
514
  this.jdJumpToShopActivity(
515
515
  Object.assign({}, getShopActivityParams, {
516
516
  logEventInfo,
517
517
  }),
518
518
  );
519
519
  } else if (configDataValue['projectId']) {
520
520
  this.jdJumpToShopActivity({
521
521
  projectId: configDataValue['projectId'],
522
522
  configDataValue,
523
523
  logEventInfo,
524
524
  });
525
525
  }
526
526
  break;
527
527
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
528
528
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
529
529
  const _url = configDataValue.linkUrl;
530
530
  if (
531
531
  _url.indexOf('to=') === -1 &&
532
532
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
533
533
  ) {
534
534
  const _shopId = _url.match(/\d+/g)[0];
535
535
  this.jdJumpToShopHome({
536
536
  shopId: `${_shopId}`,
537
537
  logEventInfo,
538
538
  });
539
539
  } else if (this.isOpenJdAppUrl(_url)) {
540
540
  const getOpenAppParams = this.jdOpenAppParams(_url);
541
541
  console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams);
542
542
  if (getOpenAppParams) {
543
543
  let _changeOpenAppParams = getOpenAppParams;
544
544
  if (isAppHomeForMarketPage) {
545
545
  const { operation, ...otherOpenAppParams } = getOpenAppParams;
546
546
  if (operation && operation === 'jumpTabInner') {
547
547
  _changeOpenAppParams = otherOpenAppParams;
548
548
  }
549
549
  }
550
550
  this.jdNavigateToNative(
551
551
  Object.assign({}, _changeOpenAppParams, {
552
552
  logEventInfo,
553
553
  }),
554
554
  );
555
555
  }
556
556
  } else {
557
557
  this.jdJumpToWeb(_url, logEventInfo);
558
558
  }
559
559
  break;
560
560
  }
561
561
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
562
562
  this.jdJumpToShopDetail({
563
563
  venderId: global.info.queryInfo.venderId,
564
564
  shopId: global.info.queryInfo.shopId,
565
565
  logEventInfo,
566
566
  });
567
567
  break;
568
568
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
569
569
  this.jdJumpToShopHome({
570
570
  ...configDataValue,
571
571
  logEventInfo,
572
572
  });
573
573
  break;
574
574
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
575
575
  break;
576
576
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
577
577
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
578
578
  const getShoppingGuideParams = this.jdOpenAppParams(configDataValue.clickUrl);
579
579
  getShoppingGuideParams &&
580
580
  this.jdJumpToShopActivity(
581
581
  Object.assign({}, getShoppingGuideParams, {
582
582
  logEventInfo,
583
583
  }),
584
584
  );
585
585
  }
586
586
  break;
587
587
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
588
588
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '');
589
589
  const search = linkUrl.match(/\?.+/);
590
590
  if (search) {
591
591
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
592
592
  parseQueryUrlString(linkUrl);
593
593
  try {
594
594
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param);
595
595
  } catch (e) {
596
596
  console.warn('解析小程序 param 错误:', miniQueryData.param);
597
597
  }
598
598
  this.jdJumpToMiniProgram(miniQueryData);
599
599
  } else {
600
600
  console.warn('小程序地址错误:', linkUrl);
601
601
  }
602
602
  break;
603
603
  }
604
604
  case LinkConfigType.CONFIG_TYPE_SHOP_SEARCH: {
605
605
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
606
606
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
607
607
  console.log('jd web 获取店铺结果落地页链接解析后的参数结果', getShopSearchParams);
608
608
  getShopSearchParams &&
609
609
  this.jdJumpToShopSearch(
610
610
  Object.assign({}, getShopSearchParams, {
611
611
  logEventInfo,
612
612
  }),
613
613
  );
614
614
  } else {
615
615
  this.jdJumpToWeb(configDataValue.clickUrl, logEventInfo);
616
616
  }
617
617
  break;
618
618
  }
619
619
  default:
620
620
  }
621
621
  }
622
622
 
623
623
  jdNavigateToNative(
624
624
  params: object,
625
625
  url = 'openapp.jdmobile://virtual',
626
626
  successBack?: functionType | null,
627
627
  failBack?: functionType | null,
628
628
  ) {
629
629
  console.log('[降级H5] jdNavigateToNative web.jd:', params);
630
630
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams = Object.assign(
631
631
  {},
632
632
  {
633
633
  sourceValue: 'sourceValue_jshopModuleWeb',
634
634
  sourceType: 'sourceType_jshopModuleWeb',
635
635
  param: {},
636
636
  },
637
637
  params,
638
638
  );
639
639
  const { logEventInfo, ...otherParams } = getResParams;
640
640
  console.log('jd web 获取open协议参数 jdNavigateToNative params: ', getResParams);
641
641
  console.log('logEventInfo params: ', logEventInfo);
642
642
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
643
643
  this.clickEventLog(logEventInfo || getResParams)
644
644
  .then(() => {
645
645
  if (typeof successBack === 'function') {
646
646
  successBack(getResParams);
647
647
  } else {
648
648
  try {
649
649
  const paramsStr = JSON.stringify(otherParams);
650
650
  console.log('跳转web jd open协议', `${url}?params=${paramsStr}`);
651
651
  window.location.href = `${url}?params=${paramsStr}`;
652
652
  } catch (e) {
653
653
  console.log('跳转异常', e);
654
654
  }
655
655
  }
656
656
  })
657
657
  .catch(() => {
658
658
  typeof failBack === 'function' && failBack(getResParams);
659
659
  });
660
660
  }
661
661
 
662
662
  clickEventLog(opts: JumpEventReportInterFace.OptEventLogParams = {}, reportKey = 'click') {
663
663
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts;
664
664
  if (eventId && jsonParam) {
665
665
  const { etModelInfo, logBaseInfo } = jsonParam;
666
666
  let getJsonParam = {};
667
667
  if (etModelInfo && logBaseInfo) {
668
668
  getJsonParam = logBaseInfo;
669
669
  } else {
670
670
  if (Array.isArray(jsonParam)) {
671
671
  getJsonParam = jsonParam;
672
672
  } else {
673
673
  getJsonParam = Object.assign(
674
674
  {},
675
675
  {
676
676
  shopid: global.info.queryInfo?.shopId,
677
677
  },
678
678
  jsonParam,
679
679
  );
680
680
  }
681
681
  }
682
682
  if (
683
683
  reportKey === 'exposure' &&
684
684
  /^TerminatorNew/.test(eventId) &&
685
685
  !Array.isArray(getJsonParam)
686
686
  ) {
687
687
  getJsonParam = [getJsonParam];
688
688
  }
689
689
  const webLogParams = {
690
690
  isExpo: reportKey === 'exposure',
691
691
  eid: eventId,
692
692
  elevel: eventLevel,
693
693
  jsonParam: JSON.stringify(getJsonParam),
694
694
  etModel: JSON.stringify(etModelInfo || {}),
695
695
  pageId: this.logPageId,
696
696
  pageParam: this.logPageParamStr,
697
697
  ...otherParams,
698
698
  };
699
699
  return /click|exposure/.test(reportKey)
700
700
  ? reportClick(webLogParams)
701
701
  : reportToCart(opts, webLogParams);
702
702
  } else {
703
703
  console.log('暂无埋点参数eventId和eventParam');
704
704
  return Promise.resolve(false);
705
705
  }
706
706
  }
707
707
 
708
708
  exposureEventLog(opts) {
709
709
  return global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
710
710
  ? this.clickEventLog(
711
711
  {
712
712
  ...opts,
713
713
  exposureState: true,
714
714
  },
715
715
  'exposure',
716
716
  )
717
717
  : Promise.resolve(false);
718
718
  }