@conecli/cone-render 0.10.1-shop3.13 → 0.10.1-shop3.14

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.
@@ -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?: functionType | undefined,
63
62
  failBack?: functionType | 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(_getLastUrl)) {
79
78
  const getUrlSearchParamState = _getLastUrl.indexOf('?') !== -1;
80
79
  if (!/jwebprog=0/.test(_getLastUrl)) {
81
80
  _getLastUrl = `${_getLastUrl}${getUrlSearchParamState ? '&' : '?'}jwebprog=0`;
82
81
  }
83
82
  if (isJdTabletDevice && !/device=tablet/.test(_getLastUrl)) {
84
83
  _getLastUrl = `${_getLastUrl}${getUrlSearchParamState ? '&' : '?'}device=tablet`;
85
84
  }
86
85
  }
87
86
  super.jdJumpToWeb(
88
87
  _getLastUrl,
89
88
  {
90
89
  ...logEventInfo,
91
90
  },
92
91
  successBack,
93
92
  failBack,
94
93
  );
95
94
  }
96
95
  }
97
96
 
98
97
  jdJumpToWebInner(url, logEventInfo) {
99
98
  this.jdJumpToWeb(url, logEventInfo);
100
99
  }
101
100
 
102
101
  jdJumpConfigUrl(detail, logEventInfo = {}) {
103
102
  const { configDataType, configDataValue } = detail;
104
103
  switch (configDataType) {
105
104
  case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
106
105
  this.jdJumpToShopCategory({
107
106
  ...configDataValue,
108
107
  logEventInfo,
109
108
  });
110
109
  break;
111
110
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
112
111
  if (logEventInfo?.jsonParam?.logBaseInfo?.mInfo) {
113
112
  logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds;
114
113
  }
115
114
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo);
116
115
  break;
117
116
  case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
118
117
  this.jdJumpToWeb(
119
118
  `${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
120
119
  {},
121
120
  );
122
121
  break;
123
122
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
124
123
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
125
124
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
126
125
  console.log('jd web 获取店铺分类链接解析后的参数结果', getShopSearchParams);
127
126
  getShopSearchParams &&
128
127
  this.jdJumpToShopSearch(
129
128
  Object.assign({}, getShopSearchParams, {
130
129
  logEventInfo,
131
130
  }),
132
131
  );
133
132
  } else {
134
133
  this.jdJumpToShopSearch(
135
134
  configDataValue['cid']
136
135
  ? Object.assign(
137
136
  {},
138
137
  {
139
138
  shopId: global.info.queryInfo.shopId,
140
139
  categoryId: configDataValue.cid,
141
140
  searchType: '5',
142
141
  logEventInfo,
143
142
  },
144
143
  )
145
144
  : {
146
145
  shopId: global.info.queryInfo.shopId,
147
146
  logEventInfo,
148
147
  },
149
148
  );
150
149
  }
151
150
  break;
152
151
  case LinkConfigType.CONFIG_TYPE_MEMBER:
153
152
  if (isAppHomeForMarketPage) {
154
153
  this.jdJumpToBottomTabBrandMember({
155
154
  logEventInfo,
156
155
  });
157
156
  } else {
158
157
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
159
158
  const getShopMemberParams = this.jdOpenAppParams(configDataValue.clickUrl);
160
159
  getShopMemberParams &&
161
160
  this.jdJumpToShopMember(
162
161
  Object.assign({}, getShopMemberParams, {
163
162
  logEventInfo,
164
163
  }),
165
164
  );
166
165
  } else {
167
166
  this.jdJumpToShopMember({
168
167
  shopId: global.info.queryInfo.shopId,
169
168
  venderId: configDataValue.shopDetail,
170
169
  logEventInfo,
171
170
  });
172
171
  }
173
172
  }
174
173
  break;
175
174
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
176
175
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
177
176
  const getShopActivityParams = this.jdOpenAppParams(configDataValue.clickUrl);
178
177
  getShopActivityParams &&
179
178
  this.jdJumpToShopActivity(
180
179
  Object.assign({}, getShopActivityParams, {
181
180
  logEventInfo,
182
181
  }),
183
182
  );
184
183
  } else if (configDataValue['projectId']) {
185
184
  this.jdJumpToShopActivity({
186
185
  projectId: configDataValue['projectId'],
187
186
  configDataValue,
188
187
  logEventInfo,
189
188
  });
190
189
  }
191
190
  break;
192
191
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
193
192
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
194
193
  const _url = configDataValue.linkUrl;
195
194
  if (
196
195
  _url.indexOf('to=') === -1 &&
197
196
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
198
197
  ) {
199
198
  const _shopId = _url.match(/\d+/g)[0];
200
199
  this.jdJumpToShopHome({
201
200
  shopId: `${_shopId}`,
202
201
  logEventInfo,
203
202
  });
204
203
  } else if (this.isOpenJdAppUrl(_url)) {
205
204
  const getOpenAppParams = this.jdOpenAppParams(_url);
206
205
  console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams);
207
206
  if (getOpenAppParams) {
208
207
  let _changeOpenAppParams = getOpenAppParams;
209
208
  if (isAppHomeForMarketPage) {
210
209
  const { operation, ...otherOpenAppParams } = getOpenAppParams;
211
210
  if (operation && operation === 'jumpTabInner') {
212
211
  _changeOpenAppParams = otherOpenAppParams;
213
212
  }
214
213
  }
215
214
  this.jdNavigateToNative(
216
215
  Object.assign({}, _changeOpenAppParams, {
217
216
  logEventInfo,
218
217
  }),
219
218
  );
220
219
  }
221
220
  } else {
222
221
  this.jdJumpToWeb(_url, logEventInfo);
223
222
  }
224
223
  break;
225
224
  }
226
225
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
227
226
  this.jdJumpToShopDetail({
228
227
  venderId: global.info.queryInfo.venderId,
229
228
  shopId: global.info.queryInfo.shopId,
230
229
  logEventInfo,
231
230
  });
232
231
  break;
233
232
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
234
233
  this.jdJumpToShopHome({
235
234
  ...configDataValue,
236
235
  logEventInfo,
237
236
  });
238
237
  break;
239
238
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
240
239
  break;
241
240
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
242
241
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
243
242
  const getShoppingGuideParams = this.jdOpenAppParams(configDataValue.clickUrl);
244
243
  getShoppingGuideParams &&
245
244
  this.jdJumpToShopActivity(
246
245
  Object.assign({}, getShoppingGuideParams, {
247
246
  logEventInfo,
248
247
  }),
249
248
  );
250
249
  }
251
250
  break;
252
251
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
253
252
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '');
254
253
  const search = linkUrl.match(/\?.+/);
255
254
  if (search) {
256
255
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
257
256
  parseQueryUrlString(linkUrl);
258
257
  try {
259
258
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param);
260
259
  } catch (e) {
261
260
  console.warn('解析小程序 param 错误:', miniQueryData.param);
262
261
  }
263
262
  this.jdJumpToMiniProgram(miniQueryData);
264
263
  } else {
265
264
  console.warn('小程序地址错误:', linkUrl);
266
265
  }
267
266
  break;
268
267
  }
269
268
  case LinkConfigType.CONFIG_TYPE_SHOP_SEARCH: {
270
269
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
271
270
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
272
271
  console.log('jd web 获取店铺结果落地页链接解析后的参数结果', getShopSearchParams);
273
272
  getShopSearchParams &&
274
273
  this.jdJumpToShopSearch(
275
274
  Object.assign({}, getShopSearchParams, {
276
275
  logEventInfo,
277
276
  }),
278
277
  );
279
278
  } else {
280
279
  this.jdJumpToWeb(configDataValue.clickUrl, logEventInfo);
281
280
  }
282
281
  break;
283
282
  }
284
283
  default:
285
284
  }
286
285
  }
287
286
 
288
287
  jdNavigateToNative(
289
288
  params: object,
290
289
  url = 'openapp.jdmobile://virtual',
291
290
  successBack?: functionType | null,
292
291
  failBack?: functionType | null,
293
292
  ) {
294
293
  console.log('[降级H5] jdNavigateToNative web.jd:', params);
295
294
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams = Object.assign(
296
295
  {},
297
296
  {
298
297
  sourceValue: 'sourceValue_jshopModuleWeb',
299
298
  sourceType: 'sourceType_jshopModuleWeb',
300
299
  param: {},
301
300
  },
302
301
  params,
303
302
  );
304
303
  const { logEventInfo, ...otherParams } = getResParams;
305
304
  console.log('jd web 获取open协议参数 jdNavigateToNative params: ', getResParams);
306
305
  console.log('logEventInfo params: ', logEventInfo);
307
306
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
308
307
  this.clickEventLog(logEventInfo || getResParams)
309
308
  .then(() => {
310
309
  if (typeof successBack === 'function') {
311
310
  successBack(getResParams);
312
311
  } else {
313
312
  try {
314
313
  const paramsStr = JSON.stringify(otherParams);
315
314
  console.log('跳转web jd open协议', `${url}?params=${paramsStr}`);
316
315
  window.location.href = `${url}?params=${paramsStr}`;
317
316
  } catch (e) {
318
317
  console.log('跳转异常', e);
319
318
  }
320
319
  }
321
320
  })
322
321
  .catch(() => {
323
322
  typeof failBack === 'function' && failBack(getResParams);
324
323
  });
325
324
  }
326
325
 
327
326
  clickEventLog(opts: JumpEventReportInterFace.OptEventLogParams = {}, reportKey = 'click') {
328
327
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts;
329
328
  if (eventId && jsonParam) {
330
329
  const { etModelInfo, logBaseInfo } = jsonParam;
331
330
  let getJsonParam = {};
332
331
  if (etModelInfo && logBaseInfo) {
333
332
  getJsonParam = logBaseInfo;
334
333
  } else {
335
334
  if (Array.isArray(jsonParam)) {
336
335
  getJsonParam = jsonParam;
337
336
  } else {
338
337
  getJsonParam = Object.assign(
339
338
  {},
340
339
  {
341
340
  shopid: global.info.queryInfo?.shopId,
342
341
  },
343
342
  jsonParam,
344
343
  );
345
344
  }
346
345
  }
347
346
  if (
348
347
  reportKey === 'exposure' &&
349
348
  /^TerminatorNew/.test(eventId) &&
350
349
  !Array.isArray(getJsonParam)
351
350
  ) {
352
351
  getJsonParam = [getJsonParam];
353
352
  }
354
353
  const webLogParams = {
355
354
  isExpo: reportKey === 'exposure',
356
355
  eid: eventId,
357
356
  elevel: eventLevel,
358
357
  jsonParam: JSON.stringify(getJsonParam),
359
358
  etModel: JSON.stringify(etModelInfo || {}),
360
359
  pageId: this.logPageId,
361
360
  pageParam: this.logPageParamStr,
362
361
  ...otherParams,
363
362
  };
364
363
  return /click|exposure/.test(reportKey)
365
364
  ? reportClick(webLogParams)
366
365
  : reportToCart(opts, webLogParams);
367
366
  } else {
368
367
  console.log('暂无埋点参数eventId和eventParam');
369
368
  return Promise.resolve(false);
370
369
  }
371
370
  }
372
371
 
373
372
  exposureEventLog(opts) {
374
373
  return global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
375
374
  ? this.clickEventLog(
376
375
  {
377
376
  ...opts,
378
377
  exposureState: true,
379
378
  },
380
379
  'exposure',
381
380
  )
382
381
  : Promise.resolve(false);
383
382
  }
383
+ import { JdJumpJdApp } from './jdJumpJdApp';
384
384
  routerInfo: {
385
385
  params: {},
386
386
  },
387
387
  nativeEvent: null,
388
388
  jumpConfig: {
389
389
  venderId: null,
390
390
  shopId: null,
391
391
  sourceValue: '',
392
392
  sourceType: 'App-H5',
393
393
  activityType: 'shopx',
394
394
  moduleId: 'none',
395
395
  entrance: 'none',
396
396
  },
397
397
  logPageParamStr: '',
398
398
  public logPageId: string;
399
399
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig;
400
400
  constructor(opt = {}) {
401
401
  super(opt);
402
402
  this.getConfig(opt);
403
403
  }
404
404
  getConfig(opt = {}) {
405
405
  return Object.assign(this, {}, defaultConfig, opt);
406
406
  }
407
407
  updateInfo(routerInfo, logPname = LogPnameInfo.HOME, pageId = LogPageIdInfo.APP) {
408
408
  this.logPageId = pageId;
409
409
  this.routerInfo = routerInfo;
410
410
  this.jumpConfig = Object.assign({}, this.jumpConfig, routerInfo.params);
411
411
  this.logPname = logPname;
412
412
  }
413
413
  reportInfoPv(
414
414
  pageId = LogPageIdInfo.APP,
415
415
  opt: {
416
416
  pageParam?: any;
417
417
  } = {},
418
418
  ) {
419
419
  const { pageParam } = opt;
420
420
  this.logPageParamStr = pageParam
421
421
  ? pageParam
422
422
  : this.creatParamToLogStr(this.jumpConfig)
423
423
  .replace(/moduleId/, 'JumpmoduleID')
424
424
  .replace(/entrance/, 'Jumpentrance');
425
425
  reportPV({
426
426
  pageId,
427
427
  pageParam: this.logPageParamStr,
428
428
  ...opt,
429
429
  });
430
430
  }
431
431
 
432
432
  jdJumpToDongDongChatGroup(groupId, source = '4') {
433
433
  this.jdNavigateToNative({
434
434
  category: 'jump',
435
435
  des: 'dongdong_group_chat',
436
436
  source: source,
437
437
  groupId: `${groupId}`,
438
438
  });
439
439
  }
440
440
 
441
441
  jdJumpToWeb(
442
442
  url,
443
443
  logEventInfo,
444
444
  successBack?: functionType | undefined,
445
445
  failBack?: functionType | undefined,
446
446
  ) {
447
447
  console.log('jd web', this.isOpenJdAppUrl(url), url);
448
448
  if (this.isOpenJdAppUrl(url)) {
449
449
  const getOpenAppParams = this.jdOpenAppParams(url);
450
450
  console.log('jd web 获取自定义openApp链接解析后的参数结果', getOpenAppParams);
451
451
  if (getOpenAppParams) {
452
452
  this.jdNavigateToNative(
453
453
  Object.assign({}, getOpenAppParams, {
454
454
  logEventInfo,
455
455
  }),
456
456
  );
457
457
  }
458
458
  } else {
459
459
  let _getLastUrl = url;
460
460
  if (/shop\.m\.jd\.com|pages\.jd\.com/.test(_getLastUrl)) {
461
461
  const getUrlSearchParamState = _getLastUrl.indexOf('?') !== -1;
462
462
  if (!/jwebprog=0/.test(_getLastUrl)) {
463
463
  _getLastUrl = `${_getLastUrl}${getUrlSearchParamState ? '&' : '?'}jwebprog=0`;
464
464
  }
465
465
  if (global.info.sysInfo?.isJdTabletDevice && !/device=tablet/.test(_getLastUrl)) {
466
466
  _getLastUrl = `${_getLastUrl}${getUrlSearchParamState ? '&' : '?'}device=tablet`;
467
467
  }
468
468
  }
469
469
  super.jdJumpToWeb(
470
470
  _getLastUrl,
471
471
  {
472
472
  ...logEventInfo,
473
473
  },
474
474
  successBack,
475
475
  failBack,
476
476
  );
477
477
  }
478
478
  }
479
479
 
480
480
  jdJumpToWebInner(url, logEventInfo) {
481
481
  this.jdJumpToWeb(url, logEventInfo);
482
482
  }
483
483
 
484
484
  jdJumpConfigUrl(detail, logEventInfo = {}) {
485
485
  const { configDataType, configDataValue } = detail;
486
486
  switch (configDataType) {
487
487
  case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
488
488
  this.jdJumpToShopCategory({
489
489
  ...configDataValue,
490
490
  logEventInfo,
491
491
  });
492
492
  break;
493
493
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
494
494
  if (logEventInfo?.jsonParam?.logBaseInfo?.mInfo) {
495
495
  logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds;
496
496
  }
497
497
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo);
498
498
  break;
499
499
  case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
500
500
  this.jdJumpToWeb(
501
501
  `${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
502
502
  {},
503
503
  );
504
504
  break;
505
505
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
506
506
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
507
507
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
508
508
  console.log('jd web 获取店铺分类链接解析后的参数结果', getShopSearchParams);
509
509
  getShopSearchParams &&
510
510
  this.jdJumpToShopSearch(
511
511
  Object.assign({}, getShopSearchParams, {
512
512
  logEventInfo,
513
513
  }),
514
514
  );
515
515
  } else {
516
516
  this.jdJumpToShopSearch(
517
517
  configDataValue['cid']
518
518
  ? Object.assign(
519
519
  {},
520
520
  {
521
521
  shopId: global.info.queryInfo.shopId,
522
522
  categoryId: configDataValue.cid,
523
523
  searchType: '5',
524
524
  logEventInfo,
525
525
  },
526
526
  )
527
527
  : {
528
528
  shopId: global.info.queryInfo.shopId,
529
529
  logEventInfo,
530
530
  },
531
531
  );
532
532
  }
533
533
  break;
534
534
  case LinkConfigType.CONFIG_TYPE_MEMBER:
535
535
  if (isAppHomeForMarketPage) {
536
536
  this.jdJumpToBottomTabBrandMember({
537
537
  logEventInfo,
538
538
  });
539
539
  } else {
540
540
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
541
541
  const getShopMemberParams = this.jdOpenAppParams(configDataValue.clickUrl);
542
542
  getShopMemberParams &&
543
543
  this.jdJumpToShopMember(
544
544
  Object.assign({}, getShopMemberParams, {
545
545
  logEventInfo,
546
546
  }),
547
547
  );
548
548
  } else {
549
549
  this.jdJumpToShopMember({
550
550
  shopId: global.info.queryInfo.shopId,
551
551
  venderId: configDataValue.shopDetail,
552
552
  logEventInfo,
553
553
  });
554
554
  }
555
555
  }
556
556
  break;
557
557
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
558
558
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
559
559
  const getShopActivityParams = this.jdOpenAppParams(configDataValue.clickUrl);
560
560
  getShopActivityParams &&
561
561
  this.jdJumpToShopActivity(
562
562
  Object.assign({}, getShopActivityParams, {
563
563
  logEventInfo,
564
564
  }),
565
565
  );
566
566
  } else if (configDataValue['projectId']) {
567
567
  this.jdJumpToShopActivity({
568
568
  projectId: configDataValue['projectId'],
569
569
  configDataValue,
570
570
  logEventInfo,
571
571
  });
572
572
  }
573
573
  break;
574
574
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
575
575
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
576
576
  const _url = configDataValue.linkUrl;
577
577
  if (
578
578
  _url.indexOf('to=') === -1 &&
579
579
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
580
580
  ) {
581
581
  const _shopId = _url.match(/\d+/g)[0];
582
582
  this.jdJumpToShopHome({
583
583
  shopId: `${_shopId}`,
584
584
  logEventInfo,
585
585
  });
586
586
  } else if (this.isOpenJdAppUrl(_url)) {
587
587
  const getOpenAppParams = this.jdOpenAppParams(_url);
588
588
  console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams);
589
589
  if (getOpenAppParams) {
590
590
  let _changeOpenAppParams = getOpenAppParams;
591
591
  if (isAppHomeForMarketPage) {
592
592
  const { operation, ...otherOpenAppParams } = getOpenAppParams;
593
593
  if (operation && operation === 'jumpTabInner') {
594
594
  _changeOpenAppParams = otherOpenAppParams;
595
595
  }
596
596
  }
597
597
  this.jdNavigateToNative(
598
598
  Object.assign({}, _changeOpenAppParams, {
599
599
  logEventInfo,
600
600
  }),
601
601
  );
602
602
  }
603
603
  } else {
604
604
  this.jdJumpToWeb(_url, logEventInfo);
605
605
  }
606
606
  break;
607
607
  }
608
608
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
609
609
  this.jdJumpToShopDetail({
610
610
  venderId: global.info.queryInfo.venderId,
611
611
  shopId: global.info.queryInfo.shopId,
612
612
  logEventInfo,
613
613
  });
614
614
  break;
615
615
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
616
616
  this.jdJumpToShopHome({
617
617
  ...configDataValue,
618
618
  logEventInfo,
619
619
  });
620
620
  break;
621
621
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
622
622
  break;
623
623
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
624
624
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
625
625
  const getShoppingGuideParams = this.jdOpenAppParams(configDataValue.clickUrl);
626
626
  getShoppingGuideParams &&
627
627
  this.jdJumpToShopActivity(
628
628
  Object.assign({}, getShoppingGuideParams, {
629
629
  logEventInfo,
630
630
  }),
631
631
  );
632
632
  }
633
633
  break;
634
634
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
635
635
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '');
636
636
  const search = linkUrl.match(/\?.+/);
637
637
  if (search) {
638
638
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
639
639
  parseQueryUrlString(linkUrl);
640
640
  try {
641
641
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param);
642
642
  } catch (e) {
643
643
  console.warn('解析小程序 param 错误:', miniQueryData.param);
644
644
  }
645
645
  this.jdJumpToMiniProgram(miniQueryData);
646
646
  } else {
647
647
  console.warn('小程序地址错误:', linkUrl);
648
648
  }
649
649
  break;
650
650
  }
651
651
  case LinkConfigType.CONFIG_TYPE_SHOP_SEARCH: {
652
652
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
653
653
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
654
654
  console.log('jd web 获取店铺结果落地页链接解析后的参数结果', getShopSearchParams);
655
655
  getShopSearchParams &&
656
656
  this.jdJumpToShopSearch(
657
657
  Object.assign({}, getShopSearchParams, {
658
658
  logEventInfo,
659
659
  }),
660
660
  );
661
661
  } else {
662
662
  this.jdJumpToWeb(configDataValue.clickUrl, logEventInfo);
663
663
  }
664
664
  break;
665
665
  }
666
666
  default:
667
667
  }
668
668
  }
669
669
 
670
670
  jdNavigateToNative(
671
671
  params: object,
672
672
  url = 'openapp.jdmobile://virtual',
673
673
  successBack?: functionType | null,
674
674
  failBack?: functionType | null,
675
675
  ) {
676
676
  console.log('[降级H5] jdNavigateToNative web.jd:', params);
677
677
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams = Object.assign(
678
678
  {},
679
679
  {
680
680
  sourceValue: 'sourceValue_jshopModuleWeb',
681
681
  sourceType: 'sourceType_jshopModuleWeb',
682
682
  param: {},
683
683
  },
684
684
  params,
685
685
  );
686
686
  const { logEventInfo, ...otherParams } = getResParams;
687
687
  console.log('jd web 获取open协议参数 jdNavigateToNative params: ', getResParams);
688
688
  console.log('logEventInfo params: ', logEventInfo);
689
689
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
690
690
  this.clickEventLog(logEventInfo || getResParams)
691
691
  .then(() => {
692
692
  if (typeof successBack === 'function') {
693
693
  successBack(getResParams);
694
694
  } else {
695
695
  try {
696
696
  const paramsStr = JSON.stringify(otherParams);
697
697
  console.log('跳转web jd open协议', `${url}?params=${paramsStr}`);
698
698
  window.location.href = `${url}?params=${paramsStr}`;
699
699
  } catch (e) {
700
700
  console.log('跳转异常', e);
701
701
  }
702
702
  }
703
703
  })
704
704
  .catch(() => {
705
705
  typeof failBack === 'function' && failBack(getResParams);
706
706
  });
707
707
  }
708
708
 
709
709
  clickEventLog(opts: JumpEventReportInterFace.OptEventLogParams = {}, reportKey = 'click') {
710
710
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts;
711
711
  if (eventId && jsonParam) {
712
712
  const { etModelInfo, logBaseInfo } = jsonParam;
713
713
  let getJsonParam = {};
714
714
  if (etModelInfo && logBaseInfo) {
715
715
  getJsonParam = logBaseInfo;
716
716
  } else {
717
717
  if (Array.isArray(jsonParam)) {
718
718
  getJsonParam = jsonParam;
719
719
  } else {
720
720
  getJsonParam = Object.assign(
721
721
  {},
722
722
  {
723
723
  shopid: global.info.queryInfo?.shopId,
724
724
  },
725
725
  jsonParam,
726
726
  );
727
727
  }
728
728
  }
729
729
  if (
730
730
  reportKey === 'exposure' &&
731
731
  /^TerminatorNew/.test(eventId) &&
732
732
  !Array.isArray(getJsonParam)
733
733
  ) {
734
734
  getJsonParam = [getJsonParam];
735
735
  }
736
736
  const webLogParams = {
737
737
  isExpo: reportKey === 'exposure',
738
738
  eid: eventId,
739
739
  elevel: eventLevel,
740
740
  jsonParam: JSON.stringify(getJsonParam),
741
741
  etModel: JSON.stringify(etModelInfo || {}),
742
742
  pageId: this.logPageId,
743
743
  pageParam: this.logPageParamStr,
744
744
  ...otherParams,
745
745
  };
746
746
  return /click|exposure/.test(reportKey)
747
747
  ? reportClick(webLogParams)
748
748
  : reportToCart(opts, webLogParams);
749
749
  } else {
750
750
  console.log('暂无埋点参数eventId和eventParam');
751
751
  return Promise.resolve(false);
752
752
  }
753
753
  }
754
754
 
755
755
  exposureEventLog(opts) {
756
756
  return global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
757
757
  ? this.clickEventLog(
758
758
  {
759
759
  ...opts,
760
760
  exposureState: true,
761
761
  },
762
762
  'exposure',
763
763
  )
764
764
  : Promise.resolve(false);
765
765
  }
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro';
2
1
  TaroEventType,
3
2
  JUMP_MEMBER_CHANNEL,
4
3
  CENTERDISPATCH_JUMPPAGE_VALUE,
5
4
 
6
5
  CARD_BANNER = 'shopMemberCardVenderCardBanner',
7
6
 
8
7
  CARD_NAME = 'shopMemberCardVenderCardName',
9
8
 
10
9
  MEMBERSHIP_LEVEL = 'shopMemberCardMembershipLevel',
11
10
 
12
11
  MEMBERSHIP_RULE_ENTRANCE = 'shopMemberCardMembershipRuleEntrance',
13
12
 
14
13
  MEMBERSHIP_POINT = 'shopMemberCardMembershipPoint',
15
14
  return new Promise((resolve) => {
16
15
  requestServer
17
16
  .getCustomerCenterDispatch(params)
18
17
  .then((response) => {
19
18
  if (response.result && response.code === '0') {
20
19
  resolve(response.result);
21
20
  } else {
22
21
  resolve({
23
22
  jumpPage:
24
23
  response.code === '1'
25
24
  ? CENTERDISPATCH_JUMPPAGE_VALUE.NOT_LOGGED_IN
26
25
  : CENTERDISPATCH_JUMPPAGE_VALUE.SYSTEM_ERROR,
27
26
  });
28
27
  }
29
28
  })
30
29
  .catch((err) => {
31
30
  resolve({ jumpPage: CENTERDISPATCH_JUMPPAGE_VALUE.NETWORK_ERROR });
32
31
  console.log('oneKeyJoinMember getcustomerCenterDispatch err', err);
33
32
  });
34
33
  });
35
34
  const currentVenderId = global.info.queryInfo.venderId;
36
35
  const currentShopId = global.info.queryInfo.shopId;
37
36
  const channel = JUMP_MEMBER_CHANNEL.POP_WEBVIEW;
38
37
  const toastOpt = {
39
38
  duration: 3000,
40
39
  image:
41
40
  'https://img13.360buyimg.com/img/jfs/t1/196933/39/19850/1479/61b059aaEe969b8db/acb37a47b9034333.png',
42
41
  };
43
42
  if (isAppHomeForMarketPage) {
44
43
  JumpEventReport.jdJumpToBottomTabBrandMember({
45
44
  shopId: currentShopId,
46
45
  venderId: currentVenderId,
47
46
  });
48
47
  return;
49
48
  }
50
49
  const params = {
51
50
  venderId: currentVenderId,
52
51
  channel,
53
52
  queryVersion: isH5AndJdShopView && jdAppVersionStr !== '' ? jdAppVersionStr : '9.2.0',
54
53
  };
55
54
  const centerDispatchResult = await getCenterDispatchResult(params);
56
55
  console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回值', centerDispatchResult);
57
56
  const { jumpPage } = centerDispatchResult;
58
57
  if (typeof jumpPage !== 'number') {
59
58
  console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回 jumpPage 值类型异常,非数字');
60
59
  showFailToast({
61
60
  title: '网络繁忙,稍后再试吧~',
62
61
  ...toastOpt,
63
62
  });
64
63
  return;
65
64
  }
66
65
  const centerDispatchJumpPageValue = Number(jumpPage);
67
66
  if (
68
67
  centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.NETWORK_ERROR ||
69
68
  centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.SYSTEM_ERROR
70
69
  ) {
71
70
  console.log('oneKeyJoinMember getcustomerCenterDispatch 接口网络异常或接口异常', jumpPage);
72
71
  showFailToast({
73
72
  title: '网络繁忙,稍后再试吧~',
74
73
  ...toastOpt,
75
74
  });
76
75
  return;
77
76
  }
78
77
  if (centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.NOT_LOGGED_IN) {
79
78
  console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回未登录,跳登录页');
80
79
  global
81
80
  .doLogin()
82
81
  .then((res) => {
83
82
  console.log('登录成功', res);
84
83
  })
85
84
  .catch((err) => {
86
85
  console.log('登录失败', err);
87
86
  });
88
87
  return;
89
88
  }
90
89
  const memberRoleJumpPageValueArr = [
91
90
  CENTERDISPATCH_JUMPPAGE_VALUE.MEMBER_CENTER,
92
91
  CENTERDISPATCH_JUMPPAGE_VALUE.ISV_MEMBER,
93
92
  CENTERDISPATCH_JUMPPAGE_VALUE.JSHOP_ISV_PAGE,
94
93
  ];
95
94
  const isMemberRole = memberRoleJumpPageValueArr.includes(centerDispatchJumpPageValue);
96
95
  if (isMemberRole) {
97
96
  showFailToast({
98
97
  title: '您已是本店会员,无需再次入会',
99
98
  ...toastOpt,
100
99
  });
101
100
  return;
102
101
  }
103
102
  if (!isH5AndJdShopView) {
104
103
  JumpEventReport.jdJumpToNewH5MemberCard();
105
104
  return;
106
105
  }
107
106
  const { isDegrade = true, isLowVersion = true } = centerDispatchResult;
108
107
  console.log('一键入会,是否已降级', isDegrade);
109
108
  console.log('一键入会,是否低版本', isLowVersion);
110
109
  if (isDegrade) {
111
110
  console.log('一键入会,已降级');
112
111
  showFailToast({
113
112
  title: '网络繁忙,稍后再试吧~',
114
113
  ...toastOpt,
115
114
  });
116
115
  return;
117
116
  }
118
117
  if (isLowVersion) {
119
118
  console.log('一键入会,低版本');
120
119
  JumpEventReport.jdJumpToMemberTab();
121
120
  return;
122
121
  }
123
122
  return new Promise((resolve) => {
124
123
  const getOpenCardUrlParams = {
125
124
  venderId: currentVenderId,
126
125
  shopId: currentShopId,
127
126
  channel: JUMP_MEMBER_CHANNEL.POP_WEBVIEW,
128
127
  device: isJdTabletDevice ? 'tablet' : 'all',
129
128
  };
130
129
  const memberCardurl =
131
130
  window?.shopGlobalSwitch?.openNewMemberEntry === 'true'
132
131
  ? `${JumpWebUrl.memberCard}?${objectToUrlEncode(getOpenCardUrlParams)}`
133
132
  : `${JumpWebUrl.shopH5MemberCardAPP}?${objectToUrlEncode(getOpenCardUrlParams)}`;
134
133
  const sourceUrl = encodeURIComponent(window.location.href || '');
135
134
  const url =
136
135
  sourceUrl && sourceUrl !== '' ? `${memberCardurl}&sourceUrl=${sourceUrl}` : memberCardurl;
137
136
  console.log('openPopWebview url', url);
138
137
  nativeOpenPopWebView({
139
138
  url,
140
139
  });
141
140
  Taro.eventCenter.off(TaroEventType.JOIN_MEMBER_SUCCESS);
142
141
  Taro.eventCenter.on(TaroEventType.JOIN_MEMBER_SUCCESS, (res) => {
143
142
  console.log('TaroEventType.JOIN_MEMBER_SUCCESS res', res);
144
143
  const { shopId, venderId } = res;
145
144
  if (shopId === currentShopId && venderId === currentVenderId) {
146
145
  resolve(true);
147
146
  } else {
148
147
  console.log(
149
148
  'TaroEventType.JOIN_MEMBER_SUCCESS shopId venderId 不匹配,currentShopId, currentVenderId',
150
149
  currentShopId,
151
150
  currentVenderId,
152
151
  );
153
152
  resolve(false);
154
153
  }
155
154
  });
156
155
  });
156
+ import Taro from '@tarojs/taro';
157
157
  TaroEventType,
158
158
  JUMP_MEMBER_CHANNEL,
159
159
  CENTERDISPATCH_JUMPPAGE_VALUE,
160
160
 
161
161
  CARD_BANNER = 'shopMemberCardVenderCardBanner',
162
162
 
163
163
  CARD_NAME = 'shopMemberCardVenderCardName',
164
164
 
165
165
  MEMBERSHIP_LEVEL = 'shopMemberCardMembershipLevel',
166
166
 
167
167
  MEMBERSHIP_RULE_ENTRANCE = 'shopMemberCardMembershipRuleEntrance',
168
168
 
169
169
  MEMBERSHIP_POINT = 'shopMemberCardMembershipPoint',
170
170
  return new Promise((resolve) => {
171
171
  requestServer
172
172
  .getCustomerCenterDispatch(params)
173
173
  .then((response) => {
174
174
  if (response.result && response.code === '0') {
175
175
  resolve(response.result);
176
176
  } else {
177
177
  resolve({
178
178
  jumpPage:
179
179
  response.code === '1'
180
180
  ? CENTERDISPATCH_JUMPPAGE_VALUE.NOT_LOGGED_IN
181
181
  : CENTERDISPATCH_JUMPPAGE_VALUE.SYSTEM_ERROR,
182
182
  });
183
183
  }
184
184
  })
185
185
  .catch((err) => {
186
186
  resolve({ jumpPage: CENTERDISPATCH_JUMPPAGE_VALUE.NETWORK_ERROR });
187
187
  console.log('oneKeyJoinMember getcustomerCenterDispatch err', err);
188
188
  });
189
189
  });
190
190
  const currentVenderId = global.info.queryInfo.venderId;
191
191
  const currentShopId = global.info.queryInfo.shopId;
192
192
  const channel = JUMP_MEMBER_CHANNEL.POP_WEBVIEW;
193
193
  const toastOpt = {
194
194
  duration: 3000,
195
195
  image:
196
196
  'https://img13.360buyimg.com/img/jfs/t1/196933/39/19850/1479/61b059aaEe969b8db/acb37a47b9034333.png',
197
197
  };
198
198
  if (isAppHomeForMarketPage) {
199
199
  JumpEventReport.jdJumpToBottomTabBrandMember({
200
200
  shopId: currentShopId,
201
201
  venderId: currentVenderId,
202
202
  });
203
203
  return;
204
204
  }
205
205
  const params = {
206
206
  venderId: currentVenderId,
207
207
  channel,
208
208
  queryVersion: isH5AndJdShopView && jdAppVersionStr !== '' ? jdAppVersionStr : '9.2.0',
209
209
  };
210
210
  const centerDispatchResult = await getCenterDispatchResult(params);
211
211
  console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回值', centerDispatchResult);
212
212
  const { jumpPage } = centerDispatchResult;
213
213
  if (typeof jumpPage !== 'number') {
214
214
  console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回 jumpPage 值类型异常,非数字');
215
215
  showFailToast({
216
216
  title: '网络繁忙,稍后再试吧~',
217
217
  ...toastOpt,
218
218
  });
219
219
  return;
220
220
  }
221
221
  const centerDispatchJumpPageValue = Number(jumpPage);
222
222
  if (
223
223
  centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.NETWORK_ERROR ||
224
224
  centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.SYSTEM_ERROR
225
225
  ) {
226
226
  console.log('oneKeyJoinMember getcustomerCenterDispatch 接口网络异常或接口异常', jumpPage);
227
227
  showFailToast({
228
228
  title: '网络繁忙,稍后再试吧~',
229
229
  ...toastOpt,
230
230
  });
231
231
  return;
232
232
  }
233
233
  if (centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.NOT_LOGGED_IN) {
234
234
  console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回未登录,跳登录页');
235
235
  global
236
236
  .doLogin()
237
237
  .then((res) => {
238
238
  console.log('登录成功', res);
239
239
  })
240
240
  .catch((err) => {
241
241
  console.log('登录失败', err);
242
242
  });
243
243
  return;
244
244
  }
245
245
  const memberRoleJumpPageValueArr = [
246
246
  CENTERDISPATCH_JUMPPAGE_VALUE.MEMBER_CENTER,
247
247
  CENTERDISPATCH_JUMPPAGE_VALUE.ISV_MEMBER,
248
248
  CENTERDISPATCH_JUMPPAGE_VALUE.JSHOP_ISV_PAGE,
249
249
  ];
250
250
  const isMemberRole = memberRoleJumpPageValueArr.includes(centerDispatchJumpPageValue);
251
251
  if (isMemberRole) {
252
252
  showFailToast({
253
253
  title: '您已是本店会员,无需再次入会',
254
254
  ...toastOpt,
255
255
  });
256
256
  return;
257
257
  }
258
258
  if (!isH5AndJdShopView) {
259
259
  JumpEventReport.jdJumpToNewH5MemberCard();
260
260
  return;
261
261
  }
262
262
  const { isDegrade = true, isLowVersion = true } = centerDispatchResult;
263
263
  console.log('一键入会,是否已降级', isDegrade);
264
264
  console.log('一键入会,是否低版本', isLowVersion);
265
265
  if (isDegrade) {
266
266
  console.log('一键入会,已降级');
267
267
  showFailToast({
268
268
  title: '网络繁忙,稍后再试吧~',
269
269
  ...toastOpt,
270
270
  });
271
271
  return;
272
272
  }
273
273
  if (isLowVersion) {
274
274
  console.log('一键入会,低版本');
275
275
  JumpEventReport.jdJumpToMemberTab();
276
276
  return;
277
277
  }
278
278
  return new Promise((resolve) => {
279
279
  const getOpenCardUrlParams = {
280
280
  venderId: currentVenderId,
281
281
  shopId: currentShopId,
282
282
  channel: JUMP_MEMBER_CHANNEL.POP_WEBVIEW,
283
283
  device: global.info.sysInfo?.isJdTabletDevice ? 'tablet' : 'all',
284
284
  };
285
285
  const memberCardurl =
286
286
  window?.shopGlobalSwitch?.openNewMemberEntry === 'true'
287
287
  ? `${JumpWebUrl.memberCard}?${objectToUrlEncode(getOpenCardUrlParams)}`
288
288
  : `${JumpWebUrl.shopH5MemberCardAPP}?${objectToUrlEncode(getOpenCardUrlParams)}`;
289
289
  const sourceUrl = encodeURIComponent(window.location.href || '');
290
290
  const url =
291
291
  sourceUrl && sourceUrl !== '' ? `${memberCardurl}&sourceUrl=${sourceUrl}` : memberCardurl;
292
292
  console.log('openPopWebview url', url);
293
293
  nativeOpenPopWebView({
294
294
  url,
295
295
  });
296
296
  Taro.eventCenter.off(TaroEventType.JOIN_MEMBER_SUCCESS);
297
297
  Taro.eventCenter.on(TaroEventType.JOIN_MEMBER_SUCCESS, (res) => {
298
298
  console.log('TaroEventType.JOIN_MEMBER_SUCCESS res', res);
299
299
  const { shopId, venderId } = res;
300
300
  if (shopId === currentShopId && venderId === currentVenderId) {
301
301
  resolve(true);
302
302
  } else {
303
303
  console.log(
304
304
  'TaroEventType.JOIN_MEMBER_SUCCESS shopId venderId 不匹配,currentShopId, currentVenderId',
305
305
  currentShopId,
306
306
  currentVenderId,
307
307
  );
308
308
  resolve(false);
309
309
  }
310
310
  });
311
311
  });
@@ -1 +1 @@
1
- export const HttpStatus = {
2
1
  SUCCESS: 200,
3
2
  CREATED: 201,
4
3
  ACCEPTED: 202,
5
4
  CLIENT_ERROR: 400,
6
5
  AUTHENTICATE: 401,
7
6
  FORBIDDEN: 403,
8
7
  NOT_FOUND: 404,
9
8
  SERVER_ERROR: 500,
10
9
  BAD_GATEWAY: 502,
11
10
  SERVICE_UNAVAILABLE: 503,
12
11
  GATEWAY_TIMEOUT: 504,
13
12
  [HttpStatus.NOT_FOUND]: '请求资源不存在',
14
13
  [HttpStatus.BAD_GATEWAY]: '服务端异常,请稍后重试',
15
14
  [HttpStatus.FORBIDDEN]: '没有权限访问',
16
15
  [HttpStatus.AUTHENTICATE]: '需要鉴权',
17
16
  [HttpStatus.SUCCESS]: '成功',
18
17
  'whx_getShopHomeFloorInfo',
19
18
  'whx_searchWare',
20
19
  'shopGuessYouLike',
21
20
  'whx_getMShopCategory',
22
21
  'whx_newWareList',
23
22
  'getShopHomePromotionWebPage',
24
23
  'whx_getShopCampaignPage',
25
24
  'whx_getPromotionWares',
26
25
  'whx_buyerShowPage',
27
26
  'whx_getShopGwredPage',
28
27
  'whx_getShopSpeciSecKillPage',
29
28
  'whx_getSignInfo',
30
29
  'whx_getSignPrize',
31
30
  'getShopHomeFloorInfo',
32
31
  'shopGuessYouLike',
33
32
  'getShopHomePromotionWebPage',
34
33
  'getVipDetail',
35
34
  'getShopCategory',
36
35
  'getShopNavigationCategory',
37
36
  'getPagePreview',
38
37
  'bmall_cart',
39
38
  'bmall_getOmittedProduct',
40
39
  'bmall_cartAdd',
41
40
  'bmall_cartChange',
42
41
  'bmall_cartRemove',
43
42
  'whx_getShopHomeFloorInfo',
44
43
  'whx_searchWare',
45
44
  'shopGuessYouLike',
46
45
  'whx_getMShopCategory',
47
46
  'whx_newWareList',
48
47
  'getShopHomePromotionWebPage',
49
48
  'whx_getShopCampaignPage',
50
49
  'whx_getPromotionWares',
51
50
  'whx_buyerShowPage',
52
51
  'getShopHomeFloorInfo',
53
52
  'getShopCategory',
54
53
  'getShopNavigationCategory',
55
54
  'giftCardAddCart',
56
55
  'receiveShopCoupon',
57
56
  'getShopHomePromotionWebPage',
58
57
  'shopGuessYouLike',
59
58
  'addRemind',
60
59
  'cancelRemind',
61
60
  'getVipDetail',
62
61
  'shopDetail',
63
62
  'address_queryAddress',
64
63
  'shopMemberSprintJoinActivity',
65
64
  'shopMemberSprintReceivePrize',
66
65
  'bmall_cart',
67
66
  'bmall_getOmittedProduct',
68
67
  'bmall_cartAdd',
69
68
  'bmall_cartChange',
70
69
  'bmall_cartRemove',
71
70
  SHOP_COLOR_APPID: 'shop_m_jd_com',
72
71
  JSHOPX_COLOR_APPID: 'jshopx_jd_com',
73
72
  PAGES_COLOR_APPID: 'pages_jd_com',
74
73
  B2B_COLOR_APPID: 'b2b',
75
74
  SHOP_MEMBER_COLOR_APPID: 'shopmember_m_jd_com',
76
75
  MALL_COLOR_APPID: 'mall_jd_com',
77
76
  'getSeriesTabData',
78
77
  'searchWare',
79
78
  'getDrShopDiscoveryFeeds',
79
+ export const HttpStatus = {
80
80
  SUCCESS: 200,
81
81
  CREATED: 201,
82
82
  ACCEPTED: 202,
83
83
  CLIENT_ERROR: 400,
84
84
  AUTHENTICATE: 401,
85
85
  FORBIDDEN: 403,
86
86
  NOT_FOUND: 404,
87
87
  SERVER_ERROR: 500,
88
88
  BAD_GATEWAY: 502,
89
89
  SERVICE_UNAVAILABLE: 503,
90
90
  GATEWAY_TIMEOUT: 504,
91
91
  [HttpStatus.NOT_FOUND]: '请求资源不存在',
92
92
  [HttpStatus.BAD_GATEWAY]: '服务端异常,请稍后重试',
93
93
  [HttpStatus.FORBIDDEN]: '没有权限访问',
94
94
  [HttpStatus.AUTHENTICATE]: '需要鉴权',
95
95
  [HttpStatus.SUCCESS]: '成功',
96
96
  'whx_getShopHomeFloorInfo',
97
97
  'whx_searchWare',
98
98
  'shopGuessYouLike',
99
99
  'whx_getMShopCategory',
100
100
  'whx_newWareList',
101
101
  'getShopHomePromotionWebPage',
102
102
  'whx_getShopCampaignPage',
103
103
  'whx_getPromotionWares',
104
104
  'whx_buyerShowPage',
105
105
  'whx_getShopGwredPage',
106
106
  'whx_getShopSpeciSecKillPage',
107
107
  'whx_getSignInfo',
108
108
  'whx_getSignPrize',
109
109
  'getShopHomeFloorInfo',
110
110
  'shopGuessYouLike',
111
111
  'getShopHomePromotionWebPage',
112
112
  'getVipDetail',
113
113
  'getShopCategory',
114
114
  'getShopNavigationCategory',
115
115
  'colorApiPreview',
116
116
  'bmall_cart',
117
117
  'bmall_getOmittedProduct',
118
118
  'bmall_cartAdd',
119
119
  'bmall_cartChange',
120
120
  'bmall_cartRemove',
121
121
  'whx_getShopHomeFloorInfo',
122
122
  'whx_searchWare',
123
123
  'shopGuessYouLike',
124
124
  'whx_getMShopCategory',
125
125
  'whx_newWareList',
126
126
  'getShopHomePromotionWebPage',
127
127
  'whx_getShopCampaignPage',
128
128
  'whx_getPromotionWares',
129
129
  'whx_buyerShowPage',
130
130
  'getShopHomeFloorInfo',
131
131
  'getShopCategory',
132
132
  'getShopNavigationCategory',
133
133
  'giftCardAddCart',
134
134
  'receiveShopCoupon',
135
135
  'getShopHomePromotionWebPage',
136
136
  'shopGuessYouLike',
137
137
  'addRemind',
138
138
  'cancelRemind',
139
139
  'getVipDetail',
140
140
  'shopDetail',
141
141
  'address_queryAddress',
142
142
  'shopMemberSprintJoinActivity',
143
143
  'shopMemberSprintReceivePrize',
144
144
  'bmall_cart',
145
145
  'bmall_getOmittedProduct',
146
146
  'bmall_cartAdd',
147
147
  'bmall_cartChange',
148
148
  'bmall_cartRemove',
149
149
  SHOP_COLOR_APPID: 'shop_m_jd_com',
150
150
  JSHOPX_COLOR_APPID: 'jshopx_jd_com',
151
151
  PAGES_COLOR_APPID: 'pages_jd_com',
152
152
  B2B_COLOR_APPID: 'b2b',
153
153
  SHOP_MEMBER_COLOR_APPID: 'shopmember_m_jd_com',
154
154
  MALL_COLOR_APPID: 'mall_jd_com',
155
155
  'getSeriesTabData',
156
156
  'searchWare',
157
157
  'getDrShopDiscoveryFeeds',
@@ -1 +1 @@
1
- const colorDSM = 'https://api.m.jd.com/client.action?functionId=';
2
1
  [
3
2
  colorDSM + 'op_getGoodListByCatesIds',
4
3
  ['dsm.jshop.operations.api.inner.service.ProductJsfService.getGoodListByCatesIds', true],
5
4
  ,
6
5
  ],
7
6
  console.log('getSColorPara ~ url is:', url);
8
7
  url = colorDSM + url;
9
8
  if (isDowngradeSDM(url)) {
10
9
  return {};
11
10
  }
12
11
  return getDSMValue(url)
13
12
  ? {
14
13
  url: '/api?v=1.0&appId=IEAFE4HKEFPYCKVAUVBR&api=' + getDSMValue(url)[0],
15
14
  }
16
15
  : {};
17
16
  url = colorDSM + url;
18
17
  try {
19
18
  if (isDowngradeSDM(url)) {
20
19
  return false;
21
20
  }
22
21
  console.log('is DSM', !!getDSMValue(url));
23
22
  return !!getDSMValue(url);
24
23
  } catch (error) {
25
24
  console.log('🚀 ~ checkIsDSM ~ error:', error);
26
25
  return false;
27
26
  }
28
27
  url = colorDSM + url;
29
28
  if (isDowngradeSDM(url)) {
30
29
  return false;
31
30
  }
32
31
  console.log('is need deconstruction', getDSMValue(url) ? getDSMValue(url)[1] : false);
33
32
  return getDSMValue(url) ? getDSMValue(url)[1] : false;
34
33
  for (let [key, value] of DSM) {
35
34
  if (url.startsWith(key) && url.includes('?')) {
36
35
  return value;
37
36
  }
38
37
  if (key === url) {
39
38
  return value;
40
39
  }
41
40
  }
42
41
  return '';
43
42
  const { nodePageData } = window;
44
43
  const { DSMDowngradeList } = nodePageData;
45
44
  console.log('DSMDowngradeList:', DSMDowngradeList);
46
45
  if (
47
46
  !Array.isArray(DSMDowngradeList) ||
48
47
  (DSMDowngradeList.length > 0 &&
49
48
  DSMDowngradeList.some((prefix) => url.startsWith(prefix)) &&
50
49
  url.includes('?')) ||
51
50
  DSMDowngradeList.includes(url)
52
51
  ) {
53
52
  return true;
54
53
  }
55
54
  return false;
56
55
  getSColorPara: (url) => getSColorPara(url),
57
56
  checkIsNeedDeconstruction: (url) => checkIsNeedDeconstruction(url),
58
57
  checkIsDSM: (url) => checkIsDSM(url),
58
+ const colorDSM = 'https://api.m.jd.com/client.action?functionId=';
59
59
  [
60
60
  colorDSM + 'op_getGoodListByCatesIds',
61
61
  ['dsm.jshop.operations.api.inner.service.ProductJsfService.getGoodListByCatesIds', true],
62
62
  ,
63
63
  ],
64
64
  console.log('getSColorPara ~ url is:', url);
65
65
  url = colorDSM + url;
66
66
  if (isDowngradeSDM(url)) {
67
67
  return {};
68
68
  }
69
69
  return getDSMValue(url)
70
70
  ? {
71
71
  url: '/api?v=1.0&appId=IEAFE4HKEFPYCKVAUVBR&api=' + getDSMValue(url)[0],
72
72
  }
73
73
  : {};
74
74
  url = colorDSM + url;
75
75
  try {
76
76
  if (isDowngradeSDM(url)) {
77
77
  return false;
78
78
  }
79
79
  console.log('is DSM', !!getDSMValue(url));
80
80
  return !!getDSMValue(url);
81
81
  } catch (error) {
82
82
  console.log('🚀 ~ checkIsDSM ~ error:', error);
83
83
  return false;
84
84
  }
85
85
  url = colorDSM + url;
86
86
  if (isDowngradeSDM(url)) {
87
87
  return false;
88
88
  }
89
89
  console.log('is need deconstruction', getDSMValue(url) ? getDSMValue(url)[1] : false);
90
90
  return getDSMValue(url) ? getDSMValue(url)[1] : false;
91
91
  for (let [key, value] of DSM) {
92
92
  if (url.startsWith(key) && url.includes('?')) {
93
93
  return value;
94
94
  }
95
95
  if (key === url) {
96
96
  return value;
97
97
  }
98
98
  }
99
99
  return '';
100
100
  try {
101
101
  const { nodePageData } = window;
102
102
  const { DSMDowngradeList = null, routeBlackList = null } = nodePageData;
103
103
  if (
104
104
  nodePageData &&
105
105
  routeBlackList &&
106
106
  Array.isArray(routeBlackList) &&
107
107
  ((routeBlackList.length > 0 &&
108
108
  routeBlackList.some((prefix) => url.startsWith(prefix)) &&
109
109
  url.includes('?')) ||
110
110
  routeBlackList.includes(url))
111
111
  ) {
112
112
  return true;
113
113
  }
114
114
  if (DSMDowngradeList === null) return true;
115
115
  if (
116
116
  !Array.isArray(DSMDowngradeList) ||
117
117
  (DSMDowngradeList.length > 0 &&
118
118
  DSMDowngradeList.some((prefix) => url.startsWith(prefix)) &&
119
119
  url.includes('?')) ||
120
120
  DSMDowngradeList.includes(url)
121
121
  ) {
122
122
  return true;
123
123
  }
124
124
  return false;
125
125
  } catch (error) {
126
126
  console.log('🚀 ~ isDowngradeSDM ~ error:', error)
127
127
  return false;
128
128
  }
129
129
  getSColorPara: (url) => getSColorPara(url),
130
130
  checkIsNeedDeconstruction: (url) => checkIsNeedDeconstruction(url),
131
131
  checkIsDSM: (url) => checkIsDSM(url),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conecli/cone-render",
3
- "version": "0.10.1-shop3.13",
3
+ "version": "0.10.1-shop3.14",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist/"