@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 global from '../common'
2
1
  objectToUrlEncode,
3
2
  parseQueryUrlString,
4
3
  filterUrlQueryData,
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: 'M-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
  getConfig(opt) {
22
21
  return Object.assign(this, {}, defaultConfig, opt)
23
22
  }
24
23
  updateInfo(
25
24
  routerInfo,
26
25
  logPname = LogPnameInfo.HOME,
27
26
  pageId = LogPageIdInfo.APP,
28
27
  ) {
29
28
  this.routerInfo = routerInfo
30
29
  this.logPname = logPname
31
30
  this.jumpConfig = Object.assign(
32
31
  {},
33
32
  this.jumpConfig,
34
33
  filterUrlQueryData(routerInfo?.params || {}),
35
34
  )
36
35
  this.logPageId = pageId
37
36
  }
38
37
 
39
38
  reportInfoPv(
40
39
  pageId = LogPageIdInfo.APP,
41
40
  opt: {
42
41
  pageParam?: any
43
42
  } = {},
44
43
  ) {
45
44
  const { pageParam } = opt
46
45
  const pageParamStr =
47
46
  typeof pageParam === 'object' ? JSON.stringify(pageParam) : pageParam
48
47
  this.logPageParamStr = pageParamStr
49
48
  ? pageParamStr
50
49
  : JSON.stringify(this.jumpConfig)
51
50
  return reportPV({
52
51
  pageId,
53
52
  pageParam: this.logPageParamStr,
54
53
  ...opt,
55
54
  })
56
55
  }
57
56
 
58
57
  jdJumpToProduct(skuIds, logEventInfo) {
59
58
  skuIds = skuIds.toString().trim()
60
59
  const getSkuId = skuIds.indexOf(',') !== -1 ? skuIds.split(',')[0] : skuIds
61
60
  this.jdNavigateToNative(
62
61
  `${this.jumpWebUrl.detail}${getSkuId}.html`,
63
62
  logEventInfo,
64
63
  )
65
64
  }
66
65
 
67
66
  jdJumpToRankList(contentId: string | number, rankType = 10, logEventInfo) {
68
67
  const rankUrl = `${this.jumpWebUrl.rank}?contentId=${contentId}&sku=&rankType=${rankType}&fromName=dcpws&hideAd=1`
69
68
  this.jdNavigateToNative(rankUrl, {
70
69
  contentId,
71
70
  ...logEventInfo,
72
71
  })
73
72
  }
74
73
 
75
74
  jdJumpToShopCategory(shopInfo) {
76
75
  this.jdNavigateToNative(
77
76
  `${this.jumpWebUrl.shopHome}?${objectToUrlEncode(
78
77
  this.getShopIdOrVenderIdParams(shopInfo),
79
78
  )}&tabActive=classify`,
80
79
  {
81
80
  ...shopInfo,
82
81
  },
83
82
  )
84
83
  }
85
84
 
86
85
  jdJumpToShopHome(shopInfo: JumpEventReportInterFace.ShopIdsInfo = {}) {
87
86
  this.jdNavigateToNative(
88
87
  `${this.jumpWebUrl.mshop}?${objectToUrlEncode(
89
88
  this.getShopIdOrVenderIdParams(shopInfo),
90
89
  )}`,
91
90
  {
92
91
  ...shopInfo,
93
92
  },
94
93
  )
95
94
  }
96
95
 
97
96
  jdJumpToShopLight(shopInfo) {
98
97
  this.jdNavigateToNative(
99
98
  `${this.jumpWebUrl.shopLight}?${objectToUrlEncode(
100
99
  this.getShopIdOrVenderIdParams(shopInfo),
101
100
  )}`,
102
101
  {
103
102
  ...shopInfo,
104
103
  },
105
104
  )
106
105
  }
107
106
 
108
107
  jdJumpToShopMember(shopInfo) {
109
108
  const getShopInfo = this.getShopIdOrVenderIdParams(shopInfo)
110
109
  this.jdJumpToWeb(
111
110
  `${this.jumpWebUrl.shopMember}?${objectToUrlEncode(
112
111
  getShopInfo,
113
112
  )}&venderType=1&channel=406`,
114
113
  shopInfo,
115
114
  )
116
115
  }
117
116
 
118
117
  jdJumpToShopMemberCard(shopInfo) {
119
118
  const getShopInfo = this.getShopIdOrVenderIdParams(shopInfo)
120
119
  this.jdJumpToWeb(
121
120
  `${this.jumpWebUrl.shopMember}?${objectToUrlEncode(getShopInfo)}`,
122
121
  shopInfo,
123
122
  )
124
123
  }
125
124
 
126
125
  jdJumpToTotalPromotion(shopInfo) {
127
126
  const { url, logEventInfo } = shopInfo
128
127
  if (this.isOpenJdAppUrl(url)) {
129
128
  const getOpenAppParams: any = this.jdOpenAppParams(url)
130
129
  if (getOpenAppParams) {
131
130
  if (getOpenAppParams?.activityId) {
132
131
  this.jdJumpToWeb(
133
132
  `${this.jumpWebUrl.totalPromotion}?activity_id=${getOpenAppParams?.activityId}`,
134
133
  shopInfo,
135
134
  )
136
135
  }
137
136
  }
138
137
  } else {
139
138
  this.jdJumpToWeb(url, logEventInfo)
140
139
  }
141
140
  }
142
141
 
143
142
  jdJumpToDongDongChat(paramInfo) {
144
143
  const { venderId = '1', entry = 'm_shop', ...otherInfo } = paramInfo
145
144
  const dongdongUrl = `${this.jumpWebUrl.dongDongChat}?venderId=${venderId}&entry=${entry}&sceneval=2`
146
145
  this.jdJumpToWeb(dongdongUrl, otherInfo)
147
146
  }
148
147
 
149
148
  jdJumpToShopDetail(shopInfo) {
150
149
  const getShopInfo = this.getShopIdOrVenderIdParams(shopInfo)
151
150
  this.jdJumpToWeb(
152
151
  `${this.jumpWebUrl.shopIntroduce}?${objectToUrlEncode(getShopInfo)}`,
153
152
  shopInfo,
154
153
  )
155
154
  }
156
155
 
157
156
  jdJumpToShopSearch(shopInfo) {
158
157
  const { shopId, categoryId, keyword, pageId, description, shopName } =
159
158
  shopInfo
160
159
  const cateId = categoryId ? `&cateId=${categoryId}` : ''
161
160
  const addKeyWord = keyword ? `&keyword=${keyword}` : ''
162
161
  const addPageId = pageId ? `&pageId=${pageId}` : ''
163
162
  const searchDes = description ? `&description=${description}` : ''
164
163
  const shopNameDes = shopName ? `&shopName=${shopName}` : ''
165
164
  const searchType = categoryId ? 5 : keyword ? 4 : 3
166
165
  this.jdJumpToWeb(
167
166
  `${this.jumpWebUrl.shopSearch}?shopId=${shopId}&searchType=${searchType}${cateId}${addKeyWord}${addPageId}${searchDes}${shopNameDes}`,
168
167
  shopInfo,
169
168
  )
170
169
  }
171
170
 
172
171
  jdJumpToWeb(
173
172
  url,
174
173
  logEventInfo,
175
174
  successBack?: Function | undefined,
176
175
  failBack?: Function | undefined,
177
176
  ) {
178
177
  this.jdNavigateToNative(
179
178
  url,
180
179
  {
181
180
  ...logEventInfo,
182
181
  },
183
182
  successBack,
184
183
  failBack,
185
184
  )
186
185
  }
187
186
 
188
187
  jdJumpToWebInner(url, logEventInfo) {
189
188
  this.jdJumpToWeb(url, logEventInfo)
190
189
  }
191
190
 
192
191
  jdJumpToLive(liveInfo, logEventInfo = {}) {
193
192
  if (liveInfo?.liveId) {
194
193
  this.jdJumpToWeb(
195
194
  `${this.jumpWebUrl.mLive}/${liveInfo?.liveId}?origin=30`,
196
195
  logEventInfo,
197
196
  )
198
197
  }
199
198
  }
200
199
 
201
200
  jdJumpToShopActivity(shopInfo) {
202
201
  const { configDataValue, logEventInfo, projectId } = shopInfo
203
202
  if (projectId && configDataValue) {
204
203
  this.jdJumpToWeb(
205
204
  `${this.jumpWebUrl.shopSecondActivity}${configDataValue.data}.html`,
206
205
  logEventInfo,
207
206
  )
208
207
  }
209
208
  }
210
209
 
211
210
  jdJumpToActivityPlace(spUrl, logEventInfo) {
212
211
  this.jdNavigateToNative(spUrl, logEventInfo)
213
212
  }
214
213
 
215
214
  jdJumpConfigUrl(detail, logEventInfo = {}) {
216
215
  const { configDataType, configDataValue } = detail
217
216
  console.log(
218
217
  'jdJumpConfigUrl web.base configDataType:',
219
218
  configDataType,
220
219
  configDataValue,
221
220
  )
222
221
  switch (configDataType) {
223
222
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
224
223
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo)
225
224
  break
226
225
  case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
227
226
  this.jdJumpToWeb(
228
227
  `${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
229
228
  {},
230
229
  )
231
230
  break
232
231
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
233
232
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
234
233
  const getShopSearchParams = this.jdOpenAppParams(
235
234
  configDataValue.clickUrl,
236
235
  )
237
236
  getShopSearchParams &&
238
237
  this.jdJumpToShopSearch(
239
238
  Object.assign({}, getShopSearchParams, {
240
239
  logEventInfo,
241
240
  }),
242
241
  )
243
242
  } else {
244
243
  this.jdJumpToShopSearch(
245
244
  configDataValue['cid']
246
245
  ? Object.assign(
247
246
  {},
248
247
  {
249
248
  shopId: global.info.queryInfo.shopId,
250
249
  categoryId: configDataValue.cid,
251
250
  ...configDataValue,
252
251
  logEventInfo,
253
252
  },
254
253
  )
255
254
  : {
256
255
  shopId: global.info.queryInfo.shopId,
257
256
  logEventInfo,
258
257
  },
259
258
  )
260
259
  }
261
260
  break
262
261
  case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
263
262
  this.jdJumpToShopCategory({
264
263
  ...configDataValue,
265
264
  logEventInfo,
266
265
  })
267
266
  break
268
267
  case LinkConfigType.CONFIG_TYPE_MEMBER:
269
268
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
270
269
  const getShopMemberParams = this.jdOpenAppParams(
271
270
  configDataValue.clickUrl,
272
271
  )
273
272
  getShopMemberParams &&
274
273
  this.jdJumpToShopMember(
275
274
  Object.assign({}, getShopMemberParams, {
276
275
  logEventInfo,
277
276
  }),
278
277
  )
279
278
  } else {
280
279
  this.jdJumpToShopMember({
281
280
  shopId: global.info.queryInfo.shopId,
282
281
  venderId: configDataValue.shopDetail,
283
282
  logEventInfo,
284
283
  })
285
284
  }
286
285
  break
287
286
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
288
287
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
289
288
  const getShopActivityParams = this.jdOpenAppParams(
290
289
  configDataValue.clickUrl,
291
290
  )
292
291
  if (
293
292
  getShopActivityParams &&
294
293
  getShopActivityParams['des'] == 'jshopActivity'
295
294
  ) {
296
295
  this.jdJumpToShopActivity({
297
296
  projectId: configDataValue['projectId'],
298
297
  configDataValue,
299
298
  logEventInfo,
300
299
  })
301
300
  }
302
301
  } else if (configDataValue['projectId']) {
303
302
  this.jdJumpToShopActivity({
304
303
  projectId: configDataValue['projectId'],
305
304
  configDataValue,
306
305
  logEventInfo,
307
306
  })
308
307
  }
309
308
  break
310
309
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
311
310
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON:
312
311
  const _url = configDataValue.linkUrl
313
312
  const isProductM = /item\.m\.jd\.com/.test(_url)
314
313
  const isProductPC = /item\.jd\.com/.test(_url)
315
314
  if (
316
315
  _url.indexOf('to=') === -1 &&
317
316
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
318
317
  ) {
319
318
  const _shopId = _url.match(/\d+/g)[0]
320
319
  this.jdJumpToShopHome({
321
320
  shopId: `${_shopId}`,
322
321
  logEventInfo,
323
322
  })
324
323
  } else if (this.isOpenJdAppUrl(_url)) {
325
324
  const getOpenAppParams: any = this.jdOpenAppParams(_url)
326
325
  if (getOpenAppParams) {
327
326
  if (getOpenAppParams.jumpTab == 'allProduct') {
328
327
  this.jdJumpToTabAllProduct(
329
328
  global.info.queryInfo.shopId,
330
329
  global.info.queryInfo.venderId,
331
330
  )
332
331
  } else if (
333
332
  getOpenAppParams.des == 'productList' &&
334
333
  getOpenAppParams.from == 'couponBatch'
335
334
  ) {
336
335
  this.jdJumpToCouponSearchProductList(getOpenAppParams?.couponId)
337
336
  } else if (getOpenAppParams.des == 'vapp') {
338
337
  this.jdJumpToWeb(
339
338
  `https:
340
339
  getOpenAppParams.category
341
340
  }&des=${getOpenAppParams.des}&vapptype=${
342
341
  getOpenAppParams.vapptype
343
342
  }&appId=${getOpenAppParams.appId}&path=${
344
343
  getOpenAppParams.path
345
344
  }&param=${encodeURI(JSON.stringify(getOpenAppParams.param))}`,
346
345
  logEventInfo,
347
346
  )
348
347
  } else {
349
348
  this.jdNavigateToNative(
350
349
  '',
351
350
  Object.assign({}, getOpenAppParams, {
352
351
  logEventInfo,
353
352
  }),
354
353
  )
355
354
  }
356
355
  }
357
356
  } else if (isProductM || isProductPC) {
358
357
  const skuid = _url.match(/\d+/g)[0]
359
358
  if (skuid) {
360
359
  this.jdJumpToProduct(skuid, logEventInfo)
361
360
  }
362
361
  } else {
363
362
  this.jdJumpToWeb(_url, logEventInfo)
364
363
  }
365
364
  break
366
365
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
367
366
  this.jdJumpToShopDetail({
368
367
  venderId: global.info.queryInfo.venderId,
369
368
  shopId: global.info.queryInfo.shopId,
370
369
  logEventInfo,
371
370
  })
372
371
  break
373
372
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
374
373
  this.jdJumpToShopHome({
375
374
  ...configDataValue,
376
375
  logEventInfo,
377
376
  })
378
377
  break
379
378
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
380
379
  break
381
380
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
382
381
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
383
382
  const getShoppingGuideParams = this.jdOpenAppParams(
384
383
  configDataValue.clickUrl,
385
384
  )
386
385
  getShoppingGuideParams &&
387
386
  this.jdJumpToShopActivity(
388
387
  Object.assign({}, getShoppingGuideParams, {
389
388
  logEventInfo,
390
389
  }),
391
390
  )
392
391
  }
393
392
  break
394
393
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
395
394
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '')
396
395
  const search = linkUrl.match(/\?.+/)
397
396
  if (search) {
398
397
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
399
398
  parseQueryUrlString(linkUrl)
400
399
  try {
401
400
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param)
402
401
  } catch (e) {
403
402
  console.warn('解析小程序 param 错误:', miniQueryData.param)
404
403
  }
405
404
  this.jdJumpToMiniProgram(miniQueryData)
406
405
  } else {
407
406
  console.warn('小程序地址错误:', linkUrl)
408
407
  }
409
408
  break
410
409
  }
411
410
  default:
412
411
  }
413
412
  }
414
413
 
415
414
  jdJumpToTabAllProduct(shopId, venderId, logEventInfo = {}) {
416
415
  this.jdJumpToWeb(
417
416
  `${this.jumpWebUrl.shopHome}?shopId=${shopId}&venderId=${venderId}&tabActive=home-product`,
418
417
  logEventInfo,
419
418
  )
420
419
  }
421
420
 
422
421
  jdJumpToTabAllProductInner(shopId, venderId, logEventInfo = {}) {
423
422
  this.jdJumpToTabAllProduct(shopId, venderId, logEventInfo)
424
423
  }
425
424
 
426
425
  jdJumpToCouponSearchProductList(couponId, logEventInfo = {}) {
427
426
  this.jdJumpToWeb(
428
427
  `${this.jumpWebUrl.couponSearch}?couponbatch=${couponId}&sceneval=2`,
429
428
  logEventInfo,
430
429
  )
431
430
  }
432
431
 
433
432
  jdNavigateToNative(
434
433
  url: string,
435
434
  params: {
436
435
  logEventInfo?: object
437
436
  } = {},
438
437
  successBack?: Function | undefined,
439
438
  failBack?: Function | undefined,
440
439
  ) {
441
440
  const { logEventInfo } = params
442
441
  const getEparam = logEventInfo || params
443
442
  console.log(`url:::::::${url}`)
444
443
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
445
444
  this.clickEventLog(getEparam)
446
445
  .then(() => {
447
446
  typeof successBack == 'function'
448
447
  ? successBack(url)
449
448
  : (window.location.href = url)
450
449
  })
451
450
  .catch(() => {
452
451
  typeof failBack == 'function' && failBack(url)
453
452
  })
454
453
  }
455
454
 
456
455
  clickEventLog(
457
456
  opts: JumpEventReportInterFace.OptEventLogParams = {},
458
457
  reportKey = 'click',
459
458
  ) {
460
459
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts
461
460
  ;/TerminatorNew_/.test(`${eventId}`) &&
462
461
  console.log(`当前h5的楼层模块eventId为====${eventId}`)
463
462
  if (eventId && jsonParam) {
464
463
  const { etModelInfo, logBaseInfo } = jsonParam
465
464
  const getJsonParam =
466
465
  etModelInfo && logBaseInfo
467
466
  ? logBaseInfo
468
467
  : Object.assign(
469
468
  {},
470
469
  {
471
470
  shopid: global.info.queryInfo?.shopId,
472
471
  },
473
472
  jsonParam,
474
473
  )
475
474
  const webLogParams = {
476
475
  eid: eventId,
477
476
  elevel: eventLevel,
478
477
  jsonParam: JSON.stringify(getJsonParam),
479
478
  etModel: JSON.stringify(etModelInfo || {}),
480
479
  pageId: this.logPageId,
481
480
  pageParam: this.logPageParamStr,
482
481
  ...otherParams,
483
482
  }
484
483
  return /click|exposure/.test(reportKey)
485
484
  ? reportClick(webLogParams)
486
485
  : reportToCart(opts)
487
486
  } else {
488
487
  console.log('暂无埋点参数eventId和jsonParam')
489
488
  return Promise.resolve(false)
490
489
  }
491
490
  }
492
491
 
493
492
  exposureEventLog(opts) {
494
493
  return global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
495
494
  ? this.clickEventLog(
496
495
  {
497
496
  ...opts,
498
497
  exposureState: true,
499
498
  },
500
499
  'exposure',
501
500
  )
502
501
  : Promise.resolve(false)
503
502
  }
503
+ import global from '../common';
504
504
  BUSINESS_TYPE,
505
505
  SHOP_MENU_ID_TYPE,
506
506
  SHOP_MENU_ID_NAME,
507
507
  SECTION_HOME_TAB_TYPE,
508
508
  SECTION_HOME_TAB_NAME_TYPE,
509
509
  objectToUrlEncode,
510
510
  parseQueryUrlString,
511
511
  filterUrlQueryData,
512
512
  isJdAndHarmonyDevice,
513
513
  showNormalToast,
514
514
  routerInfo: {
515
515
  params: {},
516
516
  },
517
517
  nativeEvent: null,
518
518
  jumpConfig: {
519
519
  venderId: null,
520
520
  shopId: null,
521
521
  sourceValue: '',
522
522
  sourceType: 'M-H5',
523
523
  activityType: 'shopx',
524
524
  moduleId: 'none',
525
525
  entrance: 'none',
526
526
  },
527
527
  logPageParamStr: '',
528
528
  public logPageId: string;
529
529
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig;
530
530
  getConfig(opt) {
531
531
  return Object.assign(this, {}, defaultConfig, opt);
532
532
  }
533
533
  updateInfo(routerInfo, logPname = LogPnameInfo.HOME, pageId = LogPageIdInfo.APP) {
534
534
  this.routerInfo = routerInfo;
535
535
  this.logPname = logPname;
536
536
  this.jumpConfig = Object.assign(
537
537
  {},
538
538
  this.jumpConfig,
539
539
  filterUrlQueryData(routerInfo?.params || {}),
540
540
  );
541
541
  this.logPageId = pageId;
542
542
  }
543
543
 
544
544
  reportInfoPv(
545
545
  pageId = LogPageIdInfo.APP,
546
546
  opt: {
547
547
  pageParam?: any;
548
548
  } = {},
549
549
  ) {
550
550
  const { pageParam, ...otherOpts } = opt;
551
551
  const pageParamStr = typeof pageParam === 'object' ? JSON.stringify(pageParam) : pageParam;
552
552
  this.logPageParamStr = pageParamStr ? pageParamStr : JSON.stringify(this.jumpConfig);
553
553
  return reportPV({
554
554
  pageId,
555
555
  pageParam: this.logPageParamStr,
556
556
  ...otherOpts,
557
557
  });
558
558
  }
559
559
 
560
560
  jdJumpToProduct(skuIds, logEventInfo) {
561
561
  skuIds = skuIds.toString().trim();
562
562
  const getSkuId = skuIds.indexOf(',') !== -1 ? skuIds.split(',')[0] : skuIds;
563
563
  const { jingxiSdx, ...otherLogInfo } = logEventInfo;
564
564
  if (jingxiSdx) {
565
565
  this.jdNavigateToNative(
566
566
  `${this.jumpWebUrl.detail}${getSkuId}.html?sdx=${jingxiSdx}`,
567
567
  otherLogInfo,
568
568
  );
569
569
  } else {
570
570
  this.jdNavigateToNative(`${this.jumpWebUrl.detail}${getSkuId}.html`, logEventInfo);
571
571
  }
572
572
  }
573
573
 
574
574
  jdJumpSkuInfoToProduct(skuInfo: any = {}, logEventInfo) {
575
575
  const getSkuId = skuInfo?.skuId;
576
576
  this.jdJumpToProduct(getSkuId, logEventInfo);
577
577
  }
578
578
 
579
579
  jdJumpToRankList(contentId: string | number, rankType = 10, logEventInfo) {
580
580
  const rankUrl = `${this.jumpWebUrl.rank}?contentId=${contentId}&sku=&rankType=${rankType}&fromName=dcpws&hideAd=1`;
581
581
  this.jdNavigateToNative(rankUrl, {
582
582
  contentId,
583
583
  ...logEventInfo,
584
584
  });
585
585
  }
586
586
 
587
587
  jdJumpToShopCategory(shopInfo) {
588
588
  this.jdNavigateToNative(
589
589
  `${this.jumpWebUrl.shopHome}?${objectToUrlEncode(
590
590
  this.getShopIdOrVenderIdParams(shopInfo),
591
591
  )}&tabActive=classify`,
592
592
  {
593
593
  ...shopInfo,
594
594
  },
595
595
  );
596
596
  }
597
597
 
598
598
  jdJumpToShopHome(shopInfo: JumpEventReportInterFace.ShopIdsInfo = {}) {
599
599
  const currentShopInfo = {
600
600
  shopId: global.info.queryInfo.shopId,
601
601
  venderId: global.info.queryInfo.venderId,
602
602
  };
603
603
  const restParams =
604
604
  (shopInfo?.shopId && shopInfo.shopId !== currentShopInfo.shopId) ||
605
605
  (shopInfo?.venderId && shopInfo.venderId !== currentShopInfo.venderId)
606
606
  ? {}
607
607
  : currentShopInfo;
608
608
  const getInfo = Object.assign({}, restParams, shopInfo);
609
609
  this.jdNavigateToNative(
610
610
  `${this.jumpWebUrl.mshop}?${objectToUrlEncode(this.getShopIdOrVenderIdParams(getInfo))}`,
611
611
  {
612
612
  ...getInfo,
613
613
  },
614
614
  );
615
615
  }
616
616
 
617
617
  jdJumpToShopLight(shopInfo) {
618
618
  this.jdNavigateToNative(
619
619
  `${this.jumpWebUrl.shopLight}?${objectToUrlEncode(this.getShopIdOrVenderIdParams(shopInfo))}`,
620
620
  {
621
621
  ...shopInfo,
622
622
  },
623
623
  );
624
624
  }
625
625
 
626
626
  jdJumpToShopMember(shopInfo) {
627
627
  const getShopInfo = this.getShopIdOrVenderIdParams(shopInfo);
628
628
  const memberHomeUrl =
629
629
  window?.shopGlobalSwitch?.openNewMemberEntry === 'true'
630
630
  ? this.jumpWebUrl.memberHome
631
631
  : this.jumpWebUrl.shopMember;
632
632
  this.jdJumpToWeb(
633
633
  `${memberHomeUrl}?${objectToUrlEncode(getShopInfo)}&venderType=1&channel=406`,
634
634
  shopInfo,
635
635
  );
636
636
  }
637
637
 
638
638
  jdJumpToShopMemberCard(shopInfo) {
639
639
  const { logEventInfo } = shopInfo;
640
640
  const getShopInfo = this.getShopIdOrVenderIdParams(shopInfo);
641
641
  this.jdJumpToWeb(
642
642
  `${this.jumpWebUrl.shopMember}?${objectToUrlEncode(getShopInfo)}`,
643
643
  logEventInfo,
644
644
  );
645
645
  }
646
646
 
647
647
  jdJumpToTotalPromotion(shopInfo) {
648
648
  const { url, logEventInfo } = shopInfo;
649
649
  if (this.isOpenJdAppUrl(url)) {
650
650
  const getOpenAppParams: any = this.jdOpenAppParams(url);
651
651
  if (getOpenAppParams) {
652
652
  if (getOpenAppParams?.activityId) {
653
653
  this.jdJumpToWeb(
654
654
  `${this.jumpWebUrl.totalPromotion}?activity_id=${getOpenAppParams?.activityId}`,
655
655
  shopInfo,
656
656
  );
657
657
  }
658
658
  }
659
659
  } else {
660
660
  this.jdJumpToWeb(url, logEventInfo);
661
661
  }
662
662
  }
663
663
 
664
664
  jdJumpToDongDongChat(paramInfo) {
665
665
  const getInfo = Object.assign(
666
666
  {},
667
667
  {
668
668
  venderId: global.info.queryInfo.venderId,
669
669
  },
670
670
  paramInfo,
671
671
  );
672
672
  const { venderId = '1', entry = 'm_shop', ...otherInfo } = getInfo;
673
673
  const dongdongUrl = `${this.jumpWebUrl.dongDongChat}?venderId=${venderId}&entry=${entry}&sceneval=2`;
674
674
  this.jdJumpToWeb(dongdongUrl, otherInfo);
675
675
  }
676
676
 
677
677
  jdJumpToShopDetail(shopInfo) {
678
678
  const getInfo = Object.assign(
679
679
  {},
680
680
  {
681
681
  shopId: global.info.queryInfo.shopId,
682
682
  venderId: global.info.queryInfo.venderId,
683
683
  },
684
684
  shopInfo,
685
685
  );
686
686
  const getShopInfo = this.getShopIdOrVenderIdParams(getInfo);
687
687
  this.jdJumpToWeb(`${this.jumpWebUrl.shopIntroduce}?${objectToUrlEncode(getShopInfo)}`, getInfo);
688
688
  }
689
689
 
690
690
  jdJumpToShopSearch(shopInfo) {
691
691
  const getInfo = Object.assign(
692
692
  {},
693
693
  {
694
694
  shopId: global.info.queryInfo.shopId,
695
695
  venderId: global.info.queryInfo.venderId,
696
696
  },
697
697
  shopInfo,
698
698
  );
699
699
  const {
700
700
  shopId,
701
701
  categoryId,
702
702
  keyword,
703
703
  pageId,
704
704
  description,
705
705
  shopName,
706
706
  keyWord,
707
707
  seller_actId,
708
708
  seller_actType,
709
709
  } = getInfo;
710
710
  const cateId = categoryId
711
711
  ? `&cateId=${typeof categoryId === 'string' ? categoryId?.trim() : categoryId}`
712
712
  : '';
713
713
  const addKeyWord = keyword || keyWord ? `&keyword=${keyword || keyWord}` : '';
714
714
  const addPageId = pageId ? `&pageId=${pageId}` : '';
715
715
  const searchDes = description ? `&description=${description}` : '';
716
716
  const shopNameDes = shopName ? `&shopName=${shopName}` : '';
717
717
  const searchType = categoryId ? 5 : keyword || keyWord ? 4 : 3;
718
718
  const activityId = seller_actId ? `&activityId=${seller_actId}` : '';
719
719
  const activityType = seller_actType ? `&activityType=${seller_actType}` : '';
720
720
  this.jdJumpToWeb(
721
721
  `${this.jumpWebUrl.shopSearch}?shopId=${shopId}&searchType=${searchType}${cateId}${addKeyWord}${addPageId}${searchDes}${shopNameDes}${activityId}${activityType}`,
722
722
  getInfo,
723
723
  );
724
724
  }
725
725
 
726
726
  jdJumpToWeb(
727
727
  url,
728
728
  logEventInfo,
729
729
  successBack?: Function | undefined,
730
730
  failBack?: Function | undefined,
731
731
  ) {
732
732
  console.log('web.base.ts - jdJumpToWeb');
733
733
  this.jdNavigateToNative(
734
734
  url,
735
735
  {
736
736
  ...logEventInfo,
737
737
  },
738
738
  successBack,
739
739
  failBack,
740
740
  );
741
741
  }
742
742
 
743
743
  jdJumpToWebInner(url, logEventInfo) {
744
744
  this.jdJumpToWeb(url, logEventInfo);
745
745
  }
746
746
 
747
747
  jdJumpToLive(liveInfo, logEventInfo = {}) {
748
748
  if (liveInfo?.liveId) {
749
749
  this.jdJumpToWeb(`${this.jumpWebUrl.mLive}/${liveInfo?.liveId}?origin=30`, logEventInfo);
750
750
  } else if (isJdAndHarmonyDevice) {
751
751
  const getShopLiveParams = this.jdOpenAppParams(liveInfo);
752
752
  console.log('getShopLiveParams=====', getShopLiveParams);
753
753
  if (typeof getShopLiveParams === 'object') {
754
754
  this.jdNavigateToNativeOpenApp({
755
755
  ...getShopLiveParams,
756
756
  logEventInfo,
757
757
  });
758
758
  }
759
759
  }
760
760
  }
761
761
 
762
762
  jdJumpToShopActivity(shopInfo) {
763
763
  const { configDataValue, logEventInfo, projectId } = shopInfo;
764
764
  if (projectId && configDataValue) {
765
765
  this.jdJumpToWeb(
766
766
  `${this.jumpWebUrl.shopSecondActivity}${configDataValue.data}.html`,
767
767
  logEventInfo,
768
768
  );
769
769
  }
770
770
  }
771
771
 
772
772
  jdJumpToActivityPlace(spUrl, logEventInfo) {
773
773
  this.jdNavigateToNative(spUrl, logEventInfo);
774
774
  }
775
775
 
776
776
  jdJumpConfigUrl(detail, logEventInfo = {}) {
777
777
  const { configDataType, configDataValue } = detail;
778
778
  console.log('jdJumpConfigUrl web.base configDataType:', configDataType, configDataValue);
779
779
  switch (configDataType) {
780
780
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
781
781
  if (logEventInfo?.jsonParam?.logBaseInfo?.mInfo) {
782
782
  logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds;
783
783
  }
784
784
  if (
785
785
  isJdAndHarmonyDevice &&
786
786
  global.info?.nonSellableSkuids?.[configDataValue.nonSellableKey]
787
787
  ) {
788
788
  showNormalToast({ title: '商品暂不可购买,请查看店内其他商品' });
789
789
  return;
790
790
  }
791
791
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo);
792
792
  break;
793
793
  case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
794
794
  this.jdJumpToWeb(
795
795
  `${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
796
796
  {},
797
797
  );
798
798
  break;
799
799
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
800
800
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
801
801
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
802
802
  getShopSearchParams &&
803
803
  this.jdJumpToShopSearch(
804
804
  Object.assign({}, getShopSearchParams, {
805
805
  logEventInfo,
806
806
  }),
807
807
  );
808
808
  } else {
809
809
  this.jdJumpToShopSearch(
810
810
  configDataValue['cid']
811
811
  ? Object.assign(
812
812
  {},
813
813
  {
814
814
  shopId: global.info.queryInfo.shopId,
815
815
  categoryId: configDataValue.cid,
816
816
  ...configDataValue,
817
817
  logEventInfo,
818
818
  },
819
819
  )
820
820
  : {
821
821
  shopId: global.info.queryInfo.shopId,
822
822
  logEventInfo,
823
823
  },
824
824
  );
825
825
  }
826
826
  break;
827
827
  case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
828
828
  this.jdJumpToShopCategory({
829
829
  ...configDataValue,
830
830
  logEventInfo,
831
831
  });
832
832
  break;
833
833
  case LinkConfigType.CONFIG_TYPE_MEMBER:
834
834
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
835
835
  const getShopMemberParams = this.jdOpenAppParams(configDataValue.clickUrl);
836
836
  getShopMemberParams &&
837
837
  this.jdJumpToShopMember(
838
838
  Object.assign({}, getShopMemberParams, {
839
839
  logEventInfo,
840
840
  }),
841
841
  );
842
842
  } else {
843
843
  this.jdJumpToShopMember({
844
844
  shopId: global.info.queryInfo.shopId,
845
845
  venderId: configDataValue.shopDetail,
846
846
  logEventInfo,
847
847
  });
848
848
  }
849
849
  break;
850
850
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
851
851
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
852
852
  const getShopActivityParams = this.jdOpenAppParams(configDataValue.clickUrl);
853
853
  if (getShopActivityParams && getShopActivityParams['des'] == 'jshopActivity') {
854
854
  this.jdJumpToShopActivity({
855
855
  projectId: configDataValue['projectId'],
856
856
  configDataValue,
857
857
  logEventInfo,
858
858
  });
859
859
  }
860
860
  } else if (configDataValue['projectId']) {
861
861
  this.jdJumpToShopActivity({
862
862
  projectId: configDataValue['projectId'],
863
863
  configDataValue,
864
864
  logEventInfo,
865
865
  });
866
866
  }
867
867
  break;
868
868
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
869
869
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON:
870
870
  const _url = configDataValue.linkUrl;
871
871
  const isProductM = /item\.m\.jd\.com/.test(_url);
872
872
  const isProductPC = /item\.jd\.com/.test(_url);
873
873
  if (
874
874
  _url.indexOf('to=') === -1 &&
875
875
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
876
876
  ) {
877
877
  const _shopId = _url.match(/\d+/g)[0];
878
878
  this.jdJumpToShopHome({
879
879
  shopId: `${_shopId}`,
880
880
  logEventInfo,
881
881
  });
882
882
  } else if (this.isOpenJdAppUrl(_url)) {
883
883
  const getOpenAppParams: any = this.jdOpenAppParams(_url);
884
884
  if (getOpenAppParams) {
885
885
  if (getOpenAppParams.jumpTab == 'allProduct') {
886
886
  this.jdJumpToTabAllProduct(
887
887
  global.info.queryInfo.shopId || getOpenAppParams?.shopId,
888
888
  global.info.queryInfo.venderId || getOpenAppParams?.venderId,
889
889
  );
890
890
  } else if (
891
891
  getOpenAppParams.des == 'productList' &&
892
892
  getOpenAppParams.from == 'couponBatch'
893
893
  ) {
894
894
  this.jdJumpToCouponSearchProductList(getOpenAppParams?.couponId);
895
895
  } else if (getOpenAppParams.des == 'vapp') {
896
896
  this.jdJumpToWeb(
897
897
  `https://conecli.com/apps/mpshare/index.html?category=${
898
898
  getOpenAppParams.category
899
899
  }&des=${getOpenAppParams.des}&vapptype=${
900
900
  getOpenAppParams.vapptype
901
901
  }&appId=${getOpenAppParams.appId}&path=${
902
902
  getOpenAppParams.path
903
903
  }&param=${encodeURI(JSON.stringify(getOpenAppParams.param))}`,
904
904
  logEventInfo,
905
905
  );
906
906
  } else {
907
907
  this.jdNavigateToNative(
908
908
  '',
909
909
  Object.assign({}, getOpenAppParams, {
910
910
  logEventInfo,
911
911
  }),
912
912
  );
913
913
  }
914
914
  }
915
915
  } else if (isProductM || isProductPC) {
916
916
  const skuid = _url.match(/\d+/g)[0];
917
917
  if (skuid) {
918
918
  this.jdJumpToProduct(skuid, logEventInfo);
919
919
  }
920
920
  } else {
921
921
  this.jdJumpToWeb(_url, logEventInfo);
922
922
  }
923
923
  break;
924
924
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
925
925
  this.jdJumpToShopDetail({
926
926
  venderId: global.info.queryInfo.venderId,
927
927
  shopId: global.info.queryInfo.shopId,
928
928
  logEventInfo,
929
929
  });
930
930
  break;
931
931
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
932
932
  this.jdJumpToShopHome({
933
933
  ...configDataValue,
934
934
  logEventInfo,
935
935
  });
936
936
  break;
937
937
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
938
938
  break;
939
939
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
940
940
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
941
941
  const getShoppingGuideParams = this.jdOpenAppParams(configDataValue.clickUrl);
942
942
  getShoppingGuideParams &&
943
943
  this.jdJumpToShopActivity(
944
944
  Object.assign({}, getShoppingGuideParams, {
945
945
  logEventInfo,
946
946
  }),
947
947
  );
948
948
  }
949
949
  break;
950
950
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
951
951
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '');
952
952
  const search = linkUrl.match(/\?.+/);
953
953
  if (search) {
954
954
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
955
955
  parseQueryUrlString(linkUrl);
956
956
  try {
957
957
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param);
958
958
  } catch (e) {
959
959
  console.warn('解析小程序 param 错误:', miniQueryData.param);
960
960
  }
961
961
  this.jdJumpToMiniProgram(miniQueryData);
962
962
  } else {
963
963
  console.warn('小程序地址错误:', linkUrl);
964
964
  }
965
965
  break;
966
966
  }
967
967
  case LinkConfigType.CONFIG_TYPE_SHOP_SEARCH: {
968
968
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
969
969
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
970
970
  console.log('web base 获取店铺结果落地页链接解析后的参数结果', getShopSearchParams);
971
971
  getShopSearchParams &&
972
972
  this.jdJumpToShopSearch(
973
973
  Object.assign({}, getShopSearchParams, {
974
974
  logEventInfo,
975
975
  }),
976
976
  );
977
977
  } else {
978
978
  this.jdJumpToWeb(configDataValue.clickUrl, logEventInfo);
979
979
  }
980
980
  break;
981
981
  }
982
982
  default:
983
983
  }
984
984
  }
985
985
 
986
986
  jdJumpToTabAllProduct(shopId, venderId, logEventInfo = {}) {
987
987
  console.log('web.base.ts - jdJumpToTabAllProduct');
988
988
  if (typeof shopId === 'undefined') shopId = global.info.queryInfo.shopId;
989
989
  if (typeof venderId === 'undefined') venderId = global.info.queryInfo.venderId;
990
990
  this.jdJumpToWeb(
991
991
  `${this.jumpWebUrl.shopHome}?${objectToUrlEncode({
992
992
  shopId,
993
993
  venderId,
994
994
  tabActive: 'home-product',
995
995
  })}`,
996
996
  logEventInfo,
997
997
  );
998
998
  }
999
999
 
1000
1000
  jdJumpToTabAllProductInner(shopId, venderId, logEventInfo = {}) {
1001
1001
  if (typeof shopId === 'undefined') shopId = global.info.queryInfo.shopId;
1002
1002
  if (typeof venderId === 'undefined') venderId = global.info.queryInfo.venderId;
1003
1003
  this.jdJumpToTabAllProduct(shopId, venderId, logEventInfo);
1004
1004
  }
1005
1005
 
1006
1006
  jdJumpToTopTabBase(type, shopInfo = {}) {
1007
1007
  const getInfo = Object.assign(
1008
1008
  {},
1009
1009
  {
1010
1010
  shopId: global.info.queryInfo.shopId,
1011
1011
  venderId: global.info.queryInfo.venderId,
1012
1012
  },
1013
1013
  shopInfo,
1014
1014
  );
1015
1015
  this.jdJumpToWeb(
1016
1016
  `${this.jumpWebUrl.shopHome}?${objectToUrlEncode(
1017
1017
  this.getShopIdOrVenderIdParams(getInfo),
1018
1018
  )}&tabActive=${type}`,
1019
1019
  getInfo,
1020
1020
  );
1021
1021
  }
1022
1022
 
1023
1023
  jdJumpToTabNew(shopInfo = {}) {
1024
1024
  console.log('上新tab');
1025
1025
  this.jdJumpToTopTabBase(
1026
1026
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_NEW_PRODUCT],
1027
1027
  shopInfo,
1028
1028
  );
1029
1029
  }
1030
1030
 
1031
1031
  jdJumpToTabNewInner(shopInfo = {}) {
1032
1032
  this.jdJumpToTabNew(shopInfo);
1033
1033
  }
1034
1034
 
1035
1035
  jdJumpToTabRank(shopInfo = {}) {
1036
1036
  console.log('榜单tab');
1037
1037
  this.jdJumpToTopTabBase(SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_RANK], shopInfo);
1038
1038
  }
1039
1039
  jdJumpToTabRankInner(shopInfo = {}) {
1040
1040
  this.jdJumpToTabRank(shopInfo);
1041
1041
  }
1042
1042
  jdJumpToTabBuyerShow(shopInfo = {}) {
1043
1043
  console.log('买家秀tab');
1044
1044
  this.jdJumpToTopTabBase(
1045
1045
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_BUYER_SHOW],
1046
1046
  shopInfo,
1047
1047
  );
1048
1048
  }
1049
1049
  jdJumpToTabBuyerShowInner(shopInfo = {}) {
1050
1050
  this.jdJumpToTabBuyerShow(shopInfo);
1051
1051
  }
1052
1052
  jdJumpToTabActivity(shopInfo = {}) {
1053
1053
  console.log('活动tab');
1054
1054
  this.jdJumpToTopTabBase(
1055
1055
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_ACTIVITY],
1056
1056
  shopInfo,
1057
1057
  );
1058
1058
  }
1059
1059
  jdJumpToTabActivityInner(shopInfo = {}) {
1060
1060
  this.jdJumpToTabActivity(shopInfo);
1061
1061
  }
1062
1062
  jdJumpToTabSecKill(shopInfo = {}) {
1063
1063
  console.log('秒杀tab');
1064
1064
  this.jdJumpToTopTabBase(
1065
1065
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_SECKILL],
1066
1066
  shopInfo,
1067
1067
  );
1068
1068
  }
1069
1069
  jdJumpToTabSecKillInner(shopInfo = {}) {
1070
1070
  this.jdJumpToTabSecKill(shopInfo);
1071
1071
  }
1072
1072
 
1073
1073
  jdJumpToBottomTabBase(type, shopInfo = {}) {
1074
1074
  this.jdJumpToTopTabBase(type, shopInfo);
1075
1075
  }
1076
1076
  jdJumpToBottomTabProduct(shopInfo = {}) {
1077
1077
  this.jdJumpToBottomTabBase(SHOP_MENU_ID_NAME[SHOP_MENU_ID_TYPE.PRODUCT], shopInfo);
1078
1078
  }
1079
1079
  jdJumpToBottomTabCategory(shopInfo = {}) {
1080
1080
  this.jdJumpToBottomTabBase(SHOP_MENU_ID_NAME[SHOP_MENU_ID_TYPE.CLASSIFY], shopInfo);
1081
1081
  }
1082
1082
  jdJumpToBottomTabFind(shopInfo = {}) {
1083
1083
  console.log('发现tab');
1084
1084
  }
1085
1085
  jdJumpToBottomTabBrandMember(shopInfo = {}) {
1086
1086
  const getInfo = Object.assign(
1087
1087
  {},
1088
1088
  {
1089
1089
  shopId: global.info.queryInfo.shopId,
1090
1090
  venderId: global.info.queryInfo.venderId,
1091
1091
  },
1092
1092
  shopInfo,
1093
1093
  );
1094
1094
  this.jdJumpToWeb(
1095
1095
  `${this.jumpWebUrl.memberHome}?${objectToUrlEncode(this.getShopIdOrVenderIdParams(getInfo))}`,
1096
1096
  getInfo,
1097
1097
  );
1098
1098
  }
1099
1099
  jdJumpToBottomTabBrandMemberInner(shopInfo = {}) {
1100
1100
  this.jdJumpToBottomTabBrandMember(shopInfo);
1101
1101
  }
1102
1102
 
1103
1103
  jdJumpToCouponSearchProductList(couponId, logEventInfo = {}) {
1104
1104
  this.jdJumpToWeb(
1105
1105
  `${this.jumpWebUrl.couponSearch}?couponbatch=${couponId}&sceneval=2`,
1106
1106
  logEventInfo,
1107
1107
  );
1108
1108
  }
1109
1109
 
1110
1110
  jdNavigateToNative(
1111
1111
  url: string,
1112
1112
  params: {
1113
1113
  logEventInfo?: object;
1114
1114
  } = {},
1115
1115
  successBack?: Function | undefined,
1116
1116
  failBack?: Function | undefined,
1117
1117
  ) {
1118
1118
  const { logEventInfo } = params;
1119
1119
  const getEparam = logEventInfo || params;
1120
1120
  console.log(`url:::::::${url}`);
1121
1121
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
1122
1122
  this.clickEventLog(getEparam)
1123
1123
  .then(() => {
1124
1124
  typeof successBack === 'function' ? successBack(url) : (window.location.href = url);
1125
1125
  })
1126
1126
  .catch(() => {
1127
1127
  typeof failBack === 'function' && failBack(url);
1128
1128
  });
1129
1129
  }
1130
1130
 
1131
1131
  jdNavigateToNativeOpenApp(
1132
1132
  params: {},
1133
1133
  url = 'openapp.jdmobile://virtual',
1134
1134
  successBack?: Function | null,
1135
1135
  failBack?: Function | null,
1136
1136
  ) {
1137
1137
  console.log('[降级H5] jdNavigateToNative web.jd:', params);
1138
1138
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams = Object.assign(
1139
1139
  {},
1140
1140
  {
1141
1141
  sourceValue: 'sourceValue_jshopModuleWeb',
1142
1142
  sourceType: 'sourceType_jshopModuleWeb',
1143
1143
  param: {},
1144
1144
  },
1145
1145
  params,
1146
1146
  );
1147
1147
  const { logEventInfo, ...otherParams } = getResParams;
1148
1148
  console.log('jd web 获取open协议参数 jdNavigateToNative params: ', getResParams);
1149
1149
  console.log('logEventInfo params: ', logEventInfo);
1150
1150
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
1151
1151
  this.clickEventLog(logEventInfo || getResParams)
1152
1152
  .then(() => {
1153
1153
  if (typeof successBack === 'function') {
1154
1154
  successBack(getResParams);
1155
1155
  } else {
1156
1156
  try {
1157
1157
  const paramsStr = JSON.stringify(otherParams);
1158
1158
  console.log('跳转web jd open协议', `${url}?params=${paramsStr}`);
1159
1159
  window.location.href = `${url}?params=${paramsStr}`;
1160
1160
  } catch (e) {
1161
1161
  console.log('跳转异常', e);
1162
1162
  }
1163
1163
  }
1164
1164
  })
1165
1165
  .catch(() => {
1166
1166
  typeof failBack === 'function' && failBack(getResParams);
1167
1167
  });
1168
1168
  }
1169
1169
 
1170
1170
  clickEventLog(opts: JumpEventReportInterFace.OptEventLogParams = {}, reportKey = 'click') {
1171
1171
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts;
1172
1172
  /TerminatorNew_/.test(`${eventId}`) && console.log(`当前h5的楼层模块eventId为====${eventId}`);
1173
1173
  if (eventId && jsonParam) {
1174
1174
  const { etModelInfo, logBaseInfo } = jsonParam;
1175
1175
  let getJsonParam = {};
1176
1176
  if (etModelInfo && logBaseInfo) {
1177
1177
  getJsonParam = logBaseInfo;
1178
1178
  } else {
1179
1179
  if (Array.isArray(jsonParam)) {
1180
1180
  getJsonParam = jsonParam;
1181
1181
  } else {
1182
1182
  getJsonParam = Object.assign(
1183
1183
  {},
1184
1184
  {
1185
1185
  shopid: global.info.queryInfo?.shopId,
1186
1186
  },
1187
1187
  jsonParam,
1188
1188
  );
1189
1189
  }
1190
1190
  }
1191
1191
  if (
1192
1192
  reportKey === 'exposure' &&
1193
1193
  /^TerminatorNew/.test(eventId) &&
1194
1194
  !Array.isArray(getJsonParam)
1195
1195
  ) {
1196
1196
  getJsonParam = [getJsonParam];
1197
1197
  }
1198
1198
  const webLogParams = {
1199
1199
  isExpo: reportKey === 'exposure',
1200
1200
  eid: eventId,
1201
1201
  elevel: eventLevel,
1202
1202
  jsonParam: JSON.stringify(getJsonParam),
1203
1203
  etModel: JSON.stringify(etModelInfo || {}),
1204
1204
  pageId: this.logPageId,
1205
1205
  pageParam: this.logPageParamStr,
1206
1206
  ...otherParams,
1207
1207
  };
1208
1208
  return /click|exposure/.test(reportKey)
1209
1209
  ? reportClick(webLogParams)
1210
1210
  : reportToCart(opts, webLogParams);
1211
1211
  } else {
1212
1212
  console.log('暂无埋点参数eventId和jsonParam');
1213
1213
  return Promise.resolve(false);
1214
1214
  }
1215
1215
  }
1216
1216
 
1217
1217
  exposureEventLog(opts) {
1218
1218
  return global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
1219
1219
  ? this.clickEventLog(
1220
1220
  {
1221
1221
  ...opts,
1222
1222
  exposureState: true,
1223
1223
  },
1224
1224
  'exposure',
1225
1225
  )
1226
1226
  : Promise.resolve(false);
1227
1227
  }