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