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

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 (91) hide show
  1. package/dist/api/index.ts +1 -1
  2. package/dist/common/const.ts +1 -1
  3. package/dist/common/index.h5.ts +1 -1
  4. package/dist/common/index.jd.ts +1 -1
  5. package/dist/common/isvStorage/index.h5.ts +1 -0
  6. package/dist/common/isvStorage/index.ts +1 -0
  7. package/dist/common/token/const.ts +1 -0
  8. package/dist/common/token/index.h5.ts +1 -0
  9. package/dist/common/token/index.ts +1 -0
  10. package/dist/common/token/token.jd.ts +1 -0
  11. package/dist/common/token/token.ts +1 -0
  12. package/dist/common/token/token.wxapp.ts +1 -0
  13. package/dist/components/base/CommonFloorHead/index.module.scss +1 -1
  14. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  15. package/dist/components/base/CustomVideo/const.ts +1 -0
  16. package/dist/components/base/CustomVideo/index.module.scss +40 -64
  17. package/dist/components/base/CustomVideo/index.tsx +1 -1
  18. package/dist/components/base/Dialog/index.module.scss +6 -2
  19. package/dist/components/base/Dialog/index.tsx +1 -1
  20. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  21. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  22. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  23. package/dist/components/base/NetworkDataError/const.ts +1 -1
  24. package/dist/components/base/NetworkDataError/index.module.scss +3 -0
  25. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  26. package/dist/components/base/Price/{const.ts → Base/const.ts} +0 -0
  27. package/dist/components/base/Price/Base/index.module.scss +136 -0
  28. package/dist/components/base/Price/Base/index.tsx +1 -0
  29. package/dist/components/base/Price/Double/index.module.scss +158 -0
  30. package/dist/components/base/Price/Double/index.tsx +1 -0
  31. package/dist/components/base/Price/index.tsx +1 -1
  32. package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
  33. package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
  34. package/dist/components/floorItem.jd.tsx +1 -0
  35. package/dist/components/floorItem.tsx +1 -1
  36. package/dist/components/isv/Floor/index.tsx +1 -1
  37. package/dist/interface/component.ts +1 -1
  38. package/dist/interface/jumpEventReport.ts +1 -1
  39. package/dist/interface/service.ts +1 -1
  40. package/dist/jumpEventReport/base.ts +1 -1
  41. package/dist/jumpEventReport/const.ts +1 -1
  42. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  43. package/dist/jumpEventReport/index.h5.ts +1 -1
  44. package/dist/jumpEventReport/index.weapp.ts +1 -1
  45. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  46. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  47. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  48. package/dist/jumpEventReport/web/report.ts +1 -1
  49. package/dist/jumpEventReport/web.base.ts +1 -1
  50. package/dist/jumpEventReport/web.jd.ts +1 -1
  51. package/dist/jumpEventReport/web.jdb.ts +1 -0
  52. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  53. package/dist/libs/taroAppReport.js +2 -2
  54. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  55. package/dist/open/api/index.ts +1 -1
  56. package/dist/open/api/jump/business.ts +1 -0
  57. package/dist/open/api/jump/index.ts +1 -0
  58. package/dist/open/api/jump/minPath.ts +1 -0
  59. package/dist/open/api/jump/side.ts +1 -0
  60. package/dist/open/api/jump/webUrl.ts +1 -0
  61. package/dist/open/api/jump copy.ts +1 -0
  62. package/dist/open/api/moduleUtil.ts +1 -1
  63. package/dist/open/api/request.ts +1 -0
  64. package/dist/open/api/shopMember.ts +1 -0
  65. package/dist/open/api/userToken.ts +1 -0
  66. package/dist/service/bMallConst.ts +1 -0
  67. package/dist/service/bMallConst.wxapp.ts +1 -0
  68. package/dist/service/fetchGateway.ts +1 -0
  69. package/dist/service/fetchJsonp.ts +1 -0
  70. package/dist/service/http/colorSign.ts +1 -0
  71. package/dist/service/http/colorSign.wxapp.ts +1 -0
  72. package/dist/service/http/const.ts +1 -0
  73. package/dist/service/http/http.ts +1 -0
  74. package/dist/service/http/httpInterceptors.jd.ts +1 -0
  75. package/dist/service/http/httpInterceptors.ts +1 -0
  76. package/dist/service/http/index.ts +1 -0
  77. package/dist/service/requestServer.ts +1 -0
  78. package/dist/utils/connectNativeJsBridge.ts +1 -1
  79. package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
  80. package/dist/utils/h5Utils.ts +1 -1
  81. package/dist/utils/index.h5.ts +1 -1
  82. package/dist/utils/index.ts +1 -1
  83. package/dist/utils/index.weapp.ts +1 -1
  84. package/dist/utils/jm-common.js +1 -1
  85. package/dist/utils/memberFormatUtils.js +1 -0
  86. package/dist/utils/priceUtils.js +1 -0
  87. package/dist/utils/ready.ts +1 -0
  88. package/dist/utils/utils.ts +1 -1
  89. package/package.json +5 -4
  90. package/dist/components/base/Price/index.module.scss +0 -136
  91. package/dist/open/api/jump.ts +0 -1
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
1
+ import Taro from '@tarojs/taro'
2
2
  routerInfo: {
3
3
  params: {},
4
4
  },
5
5
  nativeEvent: null,
6
6
  logPageParamStr: '',
7
7
  implements JumpEventReportInterFace.JumpEventReportInit
8
8
  public jingGouMiniState: boolean
9
9
  public logPageId: string
10
10
  public logPageParamStr: string
11
11
  public nativeEvent: any
12
12
  public routerInfo: JumpEventReportInterFace.RouterInfo
13
13
  public logPname: LogPnameInfo
14
14
  public jumpMiniPath: JumpEventReportInterFace.JumpMiniPath
15
15
  public jumpWebUrl: JumpEventReportInterFace.jumpWebUrl
16
16
  public sectionExposureInfo: object
17
17
  constructor(opt = {}) {
18
18
  this.logPageId = LogPageIdInfo.APP
19
19
  this.jingGouMiniState = false
20
20
  this.jumpMiniPath = JumpMiniPath
21
21
  this.jumpWebUrl = JumpWebUrl
22
22
  this.sectionExposureInfo = {}
23
23
  this.getConfig(opt)
24
24
  }
25
25
  getConfig(opt) {
26
26
  return Object.assign(this, {}, defaultConfig, opt)
27
27
  }
28
28
 
29
29
  updateInfo(
30
30
  routerInfo,
31
31
  logPname = LogPnameInfo.HOME,
32
32
  pageId = LogPageIdInfo.APP,
33
33
  ) {
34
34
  this.routerInfo = routerInfo
35
35
  this.logPname = logPname
36
36
  this.logPageId = pageId
37
37
  }
38
38
  reportInfoPv(_pageId, _opt = {}) {}
39
39
 
40
40
  getShopIdOrVenderIdParams(
41
41
  params: JumpEventReportInterFace.ShopIdsInfo = {},
42
42
  ): JumpEventReportInterFace.ShopIdsInfo {
43
43
  const setParams = {}
44
44
  params.shopId && (setParams['shopId'] = `${params.shopId}`)
45
45
  params.venderId && (setParams['venderId'] = `${params.venderId}`)
46
46
  return setParams
47
47
  }
48
48
 
49
49
  getShopIdsInfo(params = {}): JumpEventReportInterFace.ShopIdsInfo {
50
50
  let setParams = this.getShopIdOrVenderIdParams(params)
51
51
  setParams = {
52
52
  ...params,
53
53
  ...setParams,
54
54
  }
55
55
  return setParams
56
56
  }
57
57
 
58
58
  jdJumpToShopHome(shopInfo: JumpEventReportInterFace.ShopIdsInfo = {}) {
59
59
  console.log('[降级H5] jdJumpToShopHome base')
60
60
  this.jdJumpToShopBase(shopInfo)
61
61
  }
62
62
 
63
63
  jdJumpToShopBase(shopInfo) {
64
64
  console.log('[降级H5] jdJumpToShopBase')
65
65
  this.jdNavigateToNative(
66
66
  `${this.jumpMiniPath.shop}?${objectToUrlEncode(
67
67
  this.getShopIdOrVenderIdParams(shopInfo),
68
68
  )}`,
69
69
  {
70
70
  ...shopInfo,
71
71
  },
72
72
  )
73
73
  }
74
74
 
75
75
  jdJumpToShopLight(shopInfo) {
76
76
  this.jdNavigateToNative(
77
77
  `${this.jumpMiniPath.shopLight}?${objectToUrlEncode(
78
78
  this.getShopIdOrVenderIdParams(shopInfo),
79
79
  )}`,
80
80
  {
81
81
  ...shopInfo,
82
82
  },
83
83
  )
84
84
  }
85
85
 
86
86
  jdJumpToProduct(skuIds, logEventInfo) {
87
87
  skuIds = skuIds.toString().trim()
88
88
  const getSkuId = skuIds.indexOf(',') !== -1 ? skuIds.split(',')[0] : skuIds
89
89
  this.jdNavigateToNative(
90
90
  `${this.jumpMiniPath.detail}?sku=${getSkuId}`,
91
91
  logEventInfo,
92
92
  )
93
93
  }
94
94
 
95
95
  jdJumpToFlashSaleTab(_logEventInfo) {
96
96
  console.log('跳转闪购', _logEventInfo)
97
97
  }
98
98
 
99
99
 
100
100
  jdJumpToShopMemberInfo(logEventInfo) {
101
101
  console.log('跳转修改会员信息页', logEventInfo)
102
102
  }
103
103
 
104
104
  jdJumpToShopMemberPointDetail(logEventInfo) {
105
105
  const venderId = global.info.queryInfo.venderId
106
106
  const shopId = global.info.queryInfo.shopId
107
107
  this.jdJumpToWeb(
108
108
  `${this.jumpWebUrl.shopMemberPointDetail}?venderId=${venderId}&shopId=${shopId}`,
109
109
  logEventInfo,
110
110
  )
111
111
  }
112
112
 
113
113
  jdJumpToShopMemberBenefit(logEventInfo) {
114
114
  const venderId = global.info.queryInfo.venderId
115
115
  const shopId = global.info.queryInfo.shopId
116
116
  this.jdJumpToWeb(
117
117
  `${this.jumpWebUrl.shopMemberBenefit}?venderId=${venderId}&shopId=${shopId}`,
118
118
  logEventInfo,
119
119
  )
120
120
  }
121
121
 
122
122
  jdJumpToShopMemberRule(logEventInfo) {
123
123
  const venderId = global.info.queryInfo.venderId
124
124
  const shopId = global.info.queryInfo.shopId
125
125
  console.log('会员规则页h5 global.info', global.info)
126
126
  this.jdJumpToWeb(
127
127
  `${this.jumpWebUrl.shopMemberRule}?venderId=${venderId}&shopId=${shopId}&sign=member`,
128
128
  logEventInfo,
129
129
  )
130
130
  }
131
131
 
132
132
  jdJumpToShopMemberCloseAccount(venderType, logEventInfo) {
133
133
  const venderId = global.info.queryInfo.venderId
134
134
  const shopId = global.info.queryInfo.shopId
135
135
  console.log('注销会员页h5 global.info', global.info)
136
136
  this.jdJumpToWeb(
137
137
  `${this.jumpWebUrl.shopMemberCloseAccount}?venderId=${venderId}&shopId=${shopId}&venderType=${venderType}`,
138
138
  logEventInfo,
139
139
  )
140
140
  }
141
141
 
142
142
  jdJumpToShopMemberPointExchange(venderType, levelZeroMenuUrl, logEventInfo) {
143
143
  const venderId = global.info.queryInfo.venderId
144
144
  const shopId = global.info.queryInfo.shopId
145
145
  const channel = JUMP_MEMBER_CHANNEL.H5
146
146
  this.jdJumpToWeb(
147
147
  `${this.jumpWebUrl.shopMemberPointExchange}?venderId=${venderId}&shopId=${shopId}&venderType=${venderType}&channel=${channel}&levelZeroMenuUrl=${levelZeroMenuUrl}`,
148
148
  logEventInfo,
149
149
  )
150
150
  }
151
151
 
152
152
  jdJumpToShopMemberBonusPurchase(customerLevel, logEventInfo) {
153
153
  const venderId = global.info.queryInfo.venderId
154
154
  const shopId = global.info.queryInfo.shopId
155
155
  this.jdJumpToWeb(
156
156
  `${this.jumpWebUrl.shopMemberBonusPurchase}?venderId=${venderId}&shopId=${shopId}`,
157
157
  logEventInfo,
158
158
  )
159
159
  }
160
160
 
161
161
  jdJumpToShopMemberGood(customerLevel, logEventInfo) {
162
162
  const venderId = global.info.queryInfo.venderId
163
163
  const shopId = global.info.queryInfo.shopId
164
164
  this.jdJumpToWeb(
165
165
  `${this.jumpWebUrl.shopMemberGood}?venderId=${venderId}&shopId=${shopId}&customerLevel=${customerLevel}`,
166
166
  logEventInfo,
167
167
  )
168
168
  }
169
169
 
170
170
  jdJumpToBeanDetail(logEventInfo) {
171
171
  console.log('this.jumpWebUrl.beanDetail', this.jumpWebUrl.beanDetail)
172
172
  this.jdJumpToWeb(
173
173
  `${this.jumpWebUrl.beanDetail}?source=dianpuhuiyuan`,
174
174
  logEventInfo,
175
175
  )
176
176
  }
177
177
 
178
178
  jdJumpToMyRedEnvelope(logEventInfo) {
179
179
  console.log('跳转红包页', logEventInfo)
180
180
  }
181
181
 
182
182
  jdJumpToMyCoupon(logEventInfo) {
183
183
  console.log('跳转优惠券页', logEventInfo)
184
184
  }
185
185
 
186
186
  jdJumpToNewH5MemberCard(logEventInfo?) {
187
187
  const venderId = global.info.queryInfo.venderId
188
188
  const shopId = global.info.queryInfo.shopId
189
189
  this.jdJumpToWeb(
190
190
  `${this.jumpWebUrl.shopH5MemberCardM}?venderId=${venderId}&shopId=${shopId}`,
191
191
  logEventInfo,
192
192
  )
193
193
  }
194
194
 
195
195
 
196
196
  jdJumpToTabAllProduct(shopId, venderId, logEventInfo = {}) {
197
197
  this.jdJumpToWeb(
198
198
  `${this.jumpWebUrl.pages}?shopId=${shopId}&venderId=${venderId}&tabActive=home-product`,
199
199
  logEventInfo,
200
200
  )
201
201
  }
202
202
 
203
203
  jdJumpToTabAllProductInner(shopId, venderId, logEventInfo = {}) {
204
204
  this.jdJumpToTabAllProduct(shopId, venderId, logEventInfo)
205
205
  }
206
206
 
207
207
  jdJumpToAppHome(logEventInfo) {
208
208
  this.jdJumpToWeb(
209
209
  `${this.jumpWebUrl.mobileHome}?originReferer=shopx`,
210
210
  logEventInfo,
211
211
  )
212
212
  }
213
213
 
214
214
  jdJumpToShopSearch(queryParams) {
215
215
  const getInfo = Object.assign(
216
216
  {},
217
217
  {
218
218
  shopId: global.info.queryInfo.shopId,
219
219
  venderId: global.info.queryInfo.venderId,
220
220
  },
221
221
  queryParams,
222
222
  )
223
223
  const { shopId, categoryId, keyword, pageId, description, shopName } =
224
224
  getInfo
225
225
  const cateId = categoryId ? `&cateId=${typeof categoryId === 'string' ? categoryId?.trim() : categoryId}` : ''
226
226
  const addKeyWord = keyword ? `&keyword=${keyword}` : ''
227
227
  const addPageId = pageId ? `&pageId=${pageId}` : ''
228
228
  const searchDes = description ? `&description=${description}` : ''
229
229
  const shopNameDes = shopName ? `&shopName=${shopName}` : ''
230
230
  const searchType = categoryId ? 5 : keyword ? 4 : 3
231
231
  this.jdJumpToWeb(
232
232
  `${this.jumpWebUrl.shopSearch}?shopId=${shopId}&searchType=${searchType}${cateId}${addKeyWord}${addPageId}${searchDes}${shopNameDes}`,
233
233
  getInfo,
234
234
  )
235
235
  }
236
236
 
237
237
  jdJumpToOrderList() {
238
238
  console.warn(
239
239
  '触发基类的jdJumpToOrderList,这不是一个期望的结果,应该调用各端子类来实现',
240
240
  )
241
241
  }
242
242
 
243
243
  jdJumpToCouponSearchProductList(couponId, logEventInfo = {}) {
244
244
  this.jdJumpToWeb(
245
245
  `${this.jumpWebUrl.couponSearch}?couponbatch=${couponId}&sceneval=2`,
246
246
  logEventInfo,
247
247
  )
248
248
  }
249
249
 
250
250
  jdJumpToWeb(
251
251
  spUrl,
252
252
  logEventInfo,
253
253
  successBack?: Function | undefined,
254
254
  failBack?: Function | undefined,
255
255
  ) {
256
256
  this.jdNavigateToNative(
257
257
  `${this.jumpMiniPath.h5}?encode_url=` + encodeURIComponent(spUrl),
258
258
  {
259
259
  ...logEventInfo,
260
260
  },
261
261
  successBack,
262
262
  failBack,
263
263
  )
264
264
  }
265
265
 
266
266
  jdJumpToWebInner(url, logEventInfo) {
267
267
  this.jdJumpToWeb(url, logEventInfo)
268
268
  }
269
269
 
270
270
  weappRedirectToWeb(
271
271
  url: string,
272
272
  logEventInfo: JumpEventReportInterFace.OptEventLogParams = {},
273
273
  ) {
274
274
  console.log('weappRedirectToWeb base:', url)
275
275
  }
276
276
 
277
277
  jdJumpToLive(liveInfo, logEventInfo = {}) {
278
278
  if (liveInfo?.liveId) {
279
279
  this.jdJumpToWeb(
280
280
  `${this.jumpWebUrl.mLive}/${liveInfo?.liveId}?origin=30`,
281
281
  logEventInfo,
282
282
  )
283
283
  }
284
284
  }
285
285
 
286
286
  jdJumpToUgcContent(urlObj, logEventInfo = {}) {
287
287
  if (typeof urlObj === 'object') {
288
288
  this.jdJumpToWeb(
289
289
  `${this.jumpWebUrl.shopUseShareOrderUgcContent}?${objectToUrlEncode(
290
290
  urlObj,
291
291
  )}`,
292
292
  { logEventInfo },
293
293
  )
294
294
  } else {
295
295
  const getShopUgcParams = this.jdOpenAppParams(urlObj)
296
296
  console.log('getShopUgcParams=====', getShopUgcParams)
297
297
  if (getShopUgcParams) {
298
298
  getShopUgcParams['category'] && delete getShopUgcParams['category']
299
299
  getShopUgcParams['des'] && delete getShopUgcParams['des']
300
300
  this.jdJumpToWeb(
301
301
  `${this.jumpWebUrl.shopUseShareOrderUgcContent}?${objectToUrlEncode(
302
302
  getShopUgcParams as Object,
303
303
  )}`,
304
304
  { logEventInfo },
305
305
  )
306
306
  }
307
307
  }
308
308
  }
309
309
 
310
310
  jdJumpToShopActivity(shopInfo) {
311
311
  const getParams = Object.assign(
312
312
  {},
313
313
  {
314
314
  category: 'jump',
315
315
  des: 'jshopActivity',
316
316
  shopId: global.info.queryInfo.shopId,
317
317
  venderId: global.info.queryInfo.venderId,
318
318
  },
319
319
  shopInfo,
320
320
  )
321
321
  getParams['projectId'] &&
322
322
  (getParams['projectId'] = `${getParams['projectId']}`)
323
323
  }
324
324
 
325
325
  jdJumpToShopMember(shopInfo) {
326
326
  const getShopInfo = this.getShopIdOrVenderIdParams(shopInfo)
327
327
  this.jdJumpToWeb(
328
328
  `${this.jumpWebUrl.wqShopMember}?${objectToUrlEncode(getShopInfo)}`,
329
329
  shopInfo,
330
330
  )
331
331
  }
332
332
 
333
333
  jdJumpToMemberTab(shopInfo?) {
334
334
  console.log('店内跳转会员tab', shopInfo)
335
335
  }
336
336
 
337
337
  jdJumpToShopMemberCard(shopInfo) {
338
338
  const getShopInfo = this.getShopIdOrVenderIdParams(shopInfo)
339
339
  this.jdJumpToWeb(
340
340
  `${this.jumpWebUrl.shopMember}?${objectToUrlEncode(getShopInfo)}`,
341
341
  shopInfo,
342
342
  )
343
343
  }
344
344
 
345
345
  jdJumpToTotalPromotion(shopInfo) {
346
346
  const { url, logEventInfo } = shopInfo
347
347
  if (this.isOpenJdAppUrl(url)) {
348
348
  const getOpenAppParams: any = this.jdOpenAppParams(url)
349
349
  if (getOpenAppParams) {
350
350
  if (getOpenAppParams?.activityId) {
351
351
  this.jdJumpToWeb(
352
352
  `${this.jumpWebUrl.totalPromotion}?activity_id=${getOpenAppParams?.activityId}`,
353
353
  shopInfo,
354
354
  )
355
355
  }
356
356
  }
357
357
  } else {
358
358
  this.jdJumpToWeb(url, logEventInfo)
359
359
  }
360
360
  }
361
361
 
362
362
  jdJumpToDongDongChat(paramInfo) {
363
363
  const { venderId = '1', entry = 'm_shop', ...otherInfo } = paramInfo
364
364
  const dongdongUrl = `${this.jumpWebUrl.dongDongChat}?venderId=${venderId}&entry=${entry}&sceneval=2`
365
365
  this.jdJumpToWeb(dongdongUrl, otherInfo)
366
366
  }
367
367
 
368
368
  jdJumpToShopDetail(shopInfo) {
369
369
  const getShopInfo = this.getShopIdOrVenderIdParams(shopInfo)
370
370
  this.jdJumpToWeb(
371
371
  `${this.jumpWebUrl.shopIntroduce}?${objectToUrlEncode(getShopInfo)}`,
372
372
  shopInfo,
373
373
  )
374
374
  }
375
375
 
376
376
  jdJumpToMiniProgram({
377
377
  appId,
378
378
  path,
379
379
  param = {},
380
380
  }: JumpEventReportInterFace.LinkMiniParams) {
381
381
  const pageName = param['pageType'] || 'home'
382
382
  path = `pages/${pageName}/index`
383
383
  if (appId === global.info.pageInfo?.appId) {
384
384
  Taro.navigateTo({
385
385
  url: `/${path}?${objectToUrlEncode(param)}`,
386
386
  }).catch((err) => {
387
387
  console.warn('跳转小程序页面错误:', err)
388
388
  })
389
389
  } else {
390
390
  console.log('一个小程序跳转到另一个小程序暂无此业务')
391
391
  }
392
392
  }
393
393
 
394
394
  jdJumpToAppMiniProgram(
395
395
  path: string,
396
396
  param = {},
397
397
  successBack?: Function,
398
398
  failBack?: Function,
399
399
  ) {
400
400
  this.jdNavigateToNative(path, param, successBack, failBack)
401
401
  }
402
402
 
403
403
  jdJumpConfigUrl(detail, logEventInfo = {}) {
404
404
  const { configDataType, configDataValue } = detail
405
405
  switch (configDataType) {
406
406
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
407
407
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo)
408
408
  break
409
409
  case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
410
410
  this.jdJumpToWeb(
411
411
  `${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
412
412
  logEventInfo,
413
413
  )
414
414
  break
415
415
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
416
416
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
417
417
  const getShopSearchParams = this.jdOpenAppParams(
418
418
  configDataValue.clickUrl,
419
419
  )
420
420
  getShopSearchParams &&
421
421
  this.jdJumpToShopSearch(
422
422
  Object.assign({}, getShopSearchParams, {
423
423
  logEventInfo,
424
424
  }),
425
425
  )
426
426
  } else {
427
427
  this.jdJumpToShopSearch(
428
428
  configDataValue['cid']
429
429
  ? Object.assign(
430
430
  {},
431
431
  {
432
432
  shopId: global.info.queryInfo.shopId,
433
433
  categoryId: configDataValue.cid,
434
434
  logEventInfo,
435
435
  },
436
436
  )
437
437
  : {
438
438
  shopId: global.info.queryInfo.shopId,
439
439
  logEventInfo,
440
440
  },
441
441
  )
442
442
  }
443
443
  break
444
444
  case LinkConfigType.CONFIG_TYPE_MEMBER:
445
445
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
446
446
  const getShopMemberParams = this.jdOpenAppParams(
447
447
  configDataValue.clickUrl,
448
448
  )
449
449
  getShopMemberParams &&
450
450
  this.jdJumpToShopMember(
451
451
  Object.assign({}, getShopMemberParams, {
452
452
  logEventInfo,
453
453
  }),
454
454
  )
455
455
  } else {
456
456
  this.jdJumpToShopMember({
457
457
  shopId: global.info.queryInfo.shopId,
458
458
  venderId: configDataValue.shopDetail,
459
459
  logEventInfo,
460
460
  })
461
461
  }
462
462
  break
463
463
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
464
464
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
465
465
  const getShopActivityParams = this.jdOpenAppParams(
466
466
  configDataValue.clickUrl,
467
467
  )
468
468
  getShopActivityParams &&
469
469
  this.jdJumpToShopActivity(
470
470
  Object.assign({}, getShopActivityParams, {
471
471
  logEventInfo,
472
472
  }),
473
473
  )
474
474
  } else if (configDataValue['projectId']) {
475
475
  this.jdJumpToShopActivity({
476
476
  projectId: configDataValue['projectId'],
477
477
  configDataValue,
478
478
  logEventInfo,
479
479
  })
480
480
  }
481
481
  break
482
482
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
483
483
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
484
484
  const _url = configDataValue.linkUrl
485
485
  if (
486
486
  _url.indexOf('to=') === -1 &&
487
487
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
488
488
  ) {
489
489
  const _shopId = _url.match(/\d+/g)[0]
490
490
  this.jdJumpToShopHome({
491
491
  shopId: `${_shopId}`,
492
492
  logEventInfo,
493
493
  })
494
494
  } else if (this.isOpenJdAppUrl(_url)) {
495
495
  const getOpenAppParams = this.jdOpenAppParams(_url)
496
496
  console.log('获取解析后的参数结果', getOpenAppParams)
497
497
  if (getOpenAppParams) {
498
498
  isJdApp
499
499
  ? this.jdNavigateToNative(
500
500
  Object.assign({}, getOpenAppParams, {
501
501
  logEventInfo,
502
502
  }),
503
503
  )
504
504
  : this.jdNavigateToNative(
505
505
  '',
506
506
  Object.assign({}, getOpenAppParams, {
507
507
  logEventInfo,
508
508
  }),
509
509
  )
510
510
  } else {
511
511
  this.jdNavigateToNative(
512
512
  '',
513
513
  Object.assign({}, getOpenAppParams, {
514
514
  logEventInfo,
515
515
  }),
516
516
  )
517
517
  }
518
518
  } else {
519
519
  this.jdJumpToWeb(_url, logEventInfo)
520
520
  }
521
521
  break
522
522
  }
523
523
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
524
524
  this.jdJumpToShopDetail({
525
525
  venderId: global.info.queryInfo.venderId,
526
526
  shopId: global.info.queryInfo.shopId,
527
527
  logEventInfo,
528
528
  })
529
529
  break
530
530
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
531
531
  this.jdJumpToShopHome({
532
532
  ...configDataValue,
533
533
  logEventInfo,
534
534
  })
535
535
  break
536
536
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
537
537
  break
538
538
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
539
539
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
540
540
  const getShoppingGuideParams = this.jdOpenAppParams(
541
541
  configDataValue.clickUrl,
542
542
  )
543
543
  getShoppingGuideParams &&
544
544
  this.jdJumpToShopActivity(
545
545
  Object.assign({}, getShoppingGuideParams, {
546
546
  logEventInfo,
547
547
  }),
548
548
  )
549
549
  }
550
550
  break
551
551
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
552
552
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '')
553
553
  const search = linkUrl.match(/\?.+/)
554
554
  if (search) {
555
555
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
556
556
  parseQueryUrlString(linkUrl)
557
557
  try {
558
558
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param)
559
559
  } catch (e) {
560
560
  console.warn('解析小程序 param 错误:', miniQueryData.param)
561
561
  }
562
562
  this.jdJumpToMiniProgram(miniQueryData)
563
563
  } else {
564
564
  console.warn('小程序地址错误:', linkUrl)
565
565
  }
566
566
  break
567
567
  }
568
568
  default:
569
569
  }
570
570
  }
571
571
 
572
572
  jdOpenAppParams(openAppUrl): Object | boolean {
573
573
  let getParams: boolean | Object = false
574
574
  if (this.isOpenJdAppUrl(openAppUrl)) {
575
575
  try {
576
576
  getParams = openAppUrl.replace(
577
577
  /openApp\.jdMobile:\/\/virtual\?params=/i,
578
578
  '',
579
579
  )
580
580
  getParams = JSON.parse(String(getParams))
581
581
  } catch (e) {
582
582
  console.log(e)
583
583
  }
584
584
  }
585
585
  return getParams
586
586
  }
587
587
  isOpenJdAppUrl(openAppUrl) {
588
588
  return /openApp\.jdMobile:\/\/virtual\?params=/i.test(openAppUrl)
589
589
  }
590
590
 
591
591
  creatParamToLogStr(eventParam) {
592
592
  return eventParam
593
593
  ? Object.keys(eventParam)
594
594
  .map((key) => {
595
595
  return `${key}_${eventParam[key]}`
596
596
  })
597
597
  .join('_')
598
598
  : ''
599
599
  }
600
600
 
601
601
  jdNavigateToNative(
602
602
  url: string,
603
603
  params: {
604
604
  logEventInfo?: object
605
605
  } = {},
606
606
  successBack?: Function | undefined,
607
607
  failBack?: Function | undefined,
608
608
  ) {
609
609
  const { logEventInfo } = params
610
610
  const getEparam = logEventInfo || params
611
611
  console.log('jdNavigateToNative params: ', params)
612
612
  console.log('logEventInfo params: ', logEventInfo)
613
613
  try {
614
614
  this.clickEventLog(getEparam)
615
615
  } catch (e) {
616
616
  console.log(e)
617
617
  }
618
618
  setTimeout(() => {
619
619
  Taro.navigateTo({
620
620
  url,
621
621
  })
622
622
  .then((res) => {
623
623
  typeof successBack === 'function' && successBack(res)
624
624
  console.log('navigateToWxapp.success', res)
625
625
  })
626
626
  .catch((err) => {
627
627
  typeof failBack === 'function' && failBack(err)
628
628
  console.log('navigateToWxapp.fail', err)
629
629
  })
630
630
  }, 200)
631
631
  }
632
632
 
633
633
  clickEventLog(
634
634
  opts: JumpEventReportInterFace.OptEventLogParams = {},
635
635
  clickKey = 'click',
636
636
  ) {
637
637
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts
638
638
  if (eventId && jsonParam) {
639
639
  const { etModelInfo, logBaseInfo } = jsonParam
640
640
  const miniClickKey = clickKey === 'addToCart' ? 'addToCart' : 'click'
641
641
  const miniLogParams = {
642
642
  eid: eventId,
643
643
  elevel: eventLevel,
644
644
  ext: JSON.stringify(logBaseInfo || jsonParam),
645
645
  etModel: JSON.stringify(etModelInfo || {}),
646
646
  pname: this.logPname,
647
647
  pparam: JSON.stringify(this.routerInfo.params),
648
648
  target: this.routerInfo.path,
649
649
  event: this.nativeEvent,
650
650
  pageId: this.logPageId,
651
651
  ...otherParams,
652
652
  }
653
653
  console.log('点击埋点参数对象', miniLogParams, miniClickKey)
654
654
  global.miniAppLogInstance &&
655
655
  global.miniAppLogInstance[miniClickKey](miniLogParams)
656
656
  }
657
657
  }
658
658
 
659
659
  exposureEventLog(opts: JumpEventReportInterFace.OptEventLogParams = {}) {
660
660
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts
661
661
  if (eventId && jsonParam) {
662
662
  const { etModelInfo, logBaseInfo } = jsonParam
663
663
  const miniLogParams = {
664
664
  eid: eventId,
665
665
  elevel: eventLevel,
666
666
  ext: JSON.stringify(logBaseInfo || jsonParam),
667
667
  etModel: JSON.stringify(etModelInfo || {}),
668
668
  pname: this.logPname,
669
669
  pparam: JSON.stringify(this.routerInfo.params),
670
670
  target: this.routerInfo.path,
671
671
  pageId: this.logPageId,
672
672
  ...otherParams,
673
673
  }
674
674
  global.miniAppLogInstance &&
675
675
  global.miniAppLogInstance['exposure'](miniLogParams)
676
676
  }
677
677
  }
678
678
 
679
679
  initOpenTriggerExposure(type) {
680
680
  if (!this.sectionExposureInfo[type]) {
681
681
  Taro.nextTick(() => {
682
682
  setTimeout(() => {
683
683
  global.info.pageInfo.isExposureState = true
684
684
  taroEventInitExposure()
685
685
  this.sectionExposureInfo[`${type}`] = true
686
686
  }, 200)
687
687
  })
688
688
  }
689
689
  }