@conecli/cone-render 0.10.1-shop3.4 → 0.10.1-shop3.6

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