@conecli/cone-render 0.10.1-shop3.5 → 0.10.1-shop3.50

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 (99) hide show
  1. package/README.md +1 -1
  2. package/dist/common/accessibility.h5.ts +1 -0
  3. package/dist/common/accessibility.ts +0 -0
  4. package/dist/common/const.ts +1 -1
  5. package/dist/common/index.h5.ts +1 -1
  6. package/dist/common/index.jd.ts +1 -1
  7. package/dist/common/index.ts +1 -1
  8. package/dist/common/index.weapp.ts +1 -1
  9. package/dist/common/jdplayerSdk.weapp.tsx +1 -0
  10. package/dist/common/jssdk.ts +1 -1
  11. package/dist/common/jssdk.weapp.ts +1 -0
  12. package/dist/common/pageType.ts +1 -1
  13. package/dist/common/token/index.h5.ts +1 -1
  14. package/dist/common/token/token.jd.ts +1 -1
  15. package/dist/common/wxappApi.ts +1 -1
  16. package/dist/components/ErrorBoundary.tsx +1 -1
  17. package/dist/components/base/CommonFloorHead/index.module.scss +126 -111
  18. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  19. package/dist/components/base/CountDown/index.tsx +1 -1
  20. package/dist/components/base/CustomScrollView/index-back.tsx +1 -0
  21. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  22. package/dist/components/base/CustomVideo/index.tsx +1 -1
  23. package/dist/components/base/CustomVideo/index.weapp.tsx +1 -0
  24. package/dist/components/base/Dialog/index.module.scss +11 -0
  25. package/dist/components/base/InOrOutViewObserver/index.weapp.tsx +1 -0
  26. package/dist/components/base/InViewRender/index.tsx +1 -1
  27. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  28. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  29. package/dist/components/base/MobileCommonHeader/index.weapp.tsx +1 -0
  30. package/dist/components/base/NetworkDataError/const.ts +1 -1
  31. package/dist/components/base/NetworkDataError/index.module.scss +118 -72
  32. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  33. package/dist/components/base/Price/Base/index.module.scss +12 -0
  34. package/dist/components/base/Price/Base/index.tsx +1 -1
  35. package/dist/components/base/Price/Double/index.module.scss +24 -0
  36. package/dist/components/base/Price/Double/index.tsx +1 -1
  37. package/dist/components/debug/DebugLayout/index.module.scss +2 -2
  38. package/dist/components/floorItem.weapp.tsx +1 -1
  39. package/dist/interface/common.ts +1 -1
  40. package/dist/interface/component.ts +1 -1
  41. package/dist/interface/jumpEventReport.ts +1 -1
  42. package/dist/jumpEventReport/base.ts +1 -1
  43. package/dist/jumpEventReport/const.ts +1 -1
  44. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  45. package/dist/jumpEventReport/index.h5.ts +1 -1
  46. package/dist/jumpEventReport/index.jd.ts +1 -1
  47. package/dist/jumpEventReport/index.weapp.ts +1 -1
  48. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  49. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  50. package/dist/jumpEventReport/logEventConfig.h5.ts +1 -0
  51. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  52. package/dist/jumpEventReport/web/report.ts +1 -1
  53. package/dist/jumpEventReport/web.base.ts +1 -1
  54. package/dist/jumpEventReport/web.jd.ts +1 -1
  55. package/dist/jumpEventReport/web.pc.ts +1 -1
  56. package/dist/jumpEventReport/web.tjm.ts +1 -1
  57. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  58. package/dist/language/en_US.json +231 -0
  59. package/dist/language/zh_CN.json +231 -0
  60. package/dist/language/zh_HK.json +231 -0
  61. package/dist/libs/taroAppReport.js +2 -2
  62. package/dist/modules/ContainerFloorList/index.h5.module.scss +66 -56
  63. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  64. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  65. package/dist/modules/DecorateContainerFloorList/index.weapp.tsx +1 -0
  66. package/dist/open/api/environment.ts +1 -1
  67. package/dist/open/api/shopMember.ts +1 -1
  68. package/dist/open/api/shopMember.weapp.ts +1 -0
  69. package/dist/open/api/util.ts +1 -1
  70. package/dist/open/index.ts +1 -1
  71. package/dist/sass/app.h5.scss +278 -224
  72. package/dist/service/fetchGateway.ts +1 -1
  73. package/dist/service/fetchGateway.weapp.ts +1 -0
  74. package/dist/service/fetchJsonp.weapp.ts +1 -0
  75. package/dist/service/http/colorSign.ts +1 -1
  76. package/dist/service/http/const.ts +1 -1
  77. package/dist/service/http/h5Http.ts +1 -1
  78. package/dist/service/http/httpInterceptors.weapp.ts +1 -0
  79. package/dist/service/requestServer.h5.ts +1 -1
  80. package/dist/service/requestServer.ts +1 -1
  81. package/dist/service/requestServer.weapp.ts +1 -0
  82. package/dist/utils/connectNativeJsBridge.ts +1 -1
  83. package/dist/utils/h5Utils.ts +1 -1
  84. package/dist/utils/harmonyCallRouter.h5.ts +1 -0
  85. package/dist/utils/harmonyCallRouter.ts +0 -0
  86. package/dist/utils/index.h5.ts +1 -1
  87. package/dist/utils/index.ts +1 -1
  88. package/dist/utils/index.weapp.ts +1 -1
  89. package/dist/utils/jumpExtMapUtil.h5.ts +1 -0
  90. package/dist/utils/jumpExtMapUtil.ts +1 -0
  91. package/dist/utils/log.ts +1 -0
  92. package/dist/utils/{sColor.js → sColor.ts} +1 -1
  93. package/dist/utils/sColor.weapp.ts +1 -0
  94. package/dist/utils/utils.ts +1 -1
  95. package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
  96. package/dist/wxapp/common/user_info.js +1 -1
  97. package/package.json +160 -141
  98. package/dist/jumpEventReport/web/wqshop.report.ts +0 -1
  99. package/dist/utils/priceUtils.js +0 -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
  isAppHomeForMarketPage,
381
381
  isJdAndHarmonyDevice,
382
382
  isNewHarmonyShop,
383
383
  parseQueryUrlString,
384
384
  objectToUrlEncode,
385
385
  routerInfo: {
386
386
  params: {},
387
387
  },
388
388
  nativeEvent: null,
389
389
  jumpConfig: {
390
390
  venderId: null,
391
391
  shopId: null,
392
392
  sourceValue: '',
393
393
  sourceType: 'App-H5',
394
394
  activityType: 'shopx',
395
395
  moduleId: 'none',
396
396
  entrance: 'none',
397
397
  },
398
398
  logPageParamStr: '',
399
399
  public logPageId: string;
400
400
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig;
401
401
  constructor(opt = {}) {
402
402
  super(opt);
403
403
  this.getConfig(opt);
404
404
  }
405
405
  getConfig(opt = {}) {
406
406
  return Object.assign(this, {}, defaultConfig, opt);
407
407
  }
408
408
  updateInfo(routerInfo, logPname = LogPnameInfo.HOME, pageId = LogPageIdInfo.APP) {
409
409
  this.logPageId = pageId;
410
410
  this.routerInfo = routerInfo;
411
411
  this.jumpConfig = Object.assign({}, this.jumpConfig, routerInfo.params);
412
412
  this.logPname = logPname;
413
413
  }
414
414
  reportInfoPv(
415
415
  pageId = LogPageIdInfo.APP,
416
416
  opt: {
417
417
  pageParam?: any;
418
418
  } = {},
419
419
  ) {
420
420
  const { pageParam } = opt;
421
421
  this.logPageParamStr = pageParam
422
422
  ? pageParam
423
423
  : this.creatParamToLogStr(this.jumpConfig)
424
424
  .replace(/moduleId/, 'JumpmoduleID')
425
425
  .replace(/entrance/, 'Jumpentrance');
426
426
  reportPV({
427
427
  pageId,
428
428
  pageParam: this.logPageParamStr,
429
429
  ...opt,
430
430
  });
431
431
  }
432
432
 
433
433
  jdJumpToDongDongChatGroup(groupId, source = '4') {
434
434
  this.jdNavigateToNative({
435
435
  category: 'jump',
436
436
  des: 'dongdong_group_chat',
437
437
  source: source,
438
438
  groupId: `${groupId}`,
439
439
  });
440
440
  }
441
441
 
442
442
  jdJumpToWeb(
443
443
  url,
444
444
  logEventInfo,
445
445
  successBack?: functionType | undefined,
446
446
  failBack?: functionType | undefined,
447
447
  ) {
448
448
  console.log('jd web', this.isOpenJdAppUrl(url), url);
449
449
  if (this.isOpenJdAppUrl(url)) {
450
450
  const getOpenAppParams = this.jdOpenAppParams(url);
451
451
  console.log('jd web 获取自定义openApp链接解析后的参数结果', getOpenAppParams);
452
452
  if (getOpenAppParams) {
453
453
 
454
454
  const { useEncodeParams, ...otherLogInfo } = logEventInfo || {};
455
455
  this.jdNavigateToNative(
456
456
  Object.assign({}, getOpenAppParams, {
457
457
  logEventInfo: otherLogInfo,
458
458
  useEncodeParams: Boolean(useEncodeParams),
459
459
  }),
460
460
  );
461
461
  }
462
462
  } else {
463
463
  let _getLastUrl = url;
464
464
  if (/shop\.m\.jd\.com|pages\.jd\.com/.test(_getLastUrl)) {
465
465
  const getUrlSearchParamState = _getLastUrl.indexOf('?') !== -1;
466
466
  if (!/jwebprog=0/.test(_getLastUrl)) {
467
467
  _getLastUrl = `${_getLastUrl}${getUrlSearchParamState ? '&' : '?'}jwebprog=0`;
468
468
  }
469
469
  if (global.info.sysInfo?.isJdTabletDevice && !/device=tablet/.test(_getLastUrl)) {
470
470
  _getLastUrl = `${_getLastUrl}${getUrlSearchParamState ? '&' : '?'}device=tablet`;
471
471
  }
472
472
  }
473
473
  super.jdJumpToWeb(
474
474
  _getLastUrl,
475
475
  {
476
476
  ...logEventInfo,
477
477
  },
478
478
  successBack,
479
479
  failBack,
480
480
  );
481
481
  }
482
482
  }
483
483
 
484
484
  jdJumpToWebInner(url, logEventInfo) {
485
485
  this.jdJumpToWeb(url, logEventInfo);
486
486
  }
487
487
 
488
488
  jdJumpConfigUrl(detail, logEventInfo = {}) {
489
489
  const { configDataType, configDataValue } = detail;
490
490
  switch (configDataType) {
491
491
  case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
492
492
  this.jdJumpToShopCategory({
493
493
  ...configDataValue,
494
494
  logEventInfo,
495
495
  });
496
496
  break;
497
497
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
498
498
  if (logEventInfo?.jsonParam?.logBaseInfo?.mInfo) {
499
499
  logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds;
500
500
  }
501
501
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo);
502
502
  break;
503
503
  case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
504
504
  this.jdJumpToWeb(
505
505
  `${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
506
506
  {},
507
507
  );
508
508
  break;
509
509
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
510
510
  if (isJdAndHarmonyDevice && isNewHarmonyShop && jdAppVersionStr === '15.1.70') {
511
511
  const baseInfo = {
512
512
  shopId: global.info.queryInfo.shopId,
513
513
  venderId: global.info.queryInfo.venderId,
514
514
  };
515
515
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
516
516
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
517
517
  console.log('jd web 获取店铺分类链接解析后的参数结果', getShopSearchParams);
518
518
  let openAppParams =
519
519
  typeof getShopSearchParams === 'boolean'
520
520
  ? { categoryId: '', ...baseInfo }
521
521
  : getShopSearchParams;
522
522
  const getInfo = openAppParams['categoryId']
523
523
  ? { ...openAppParams, cateId: openAppParams['categoryId'] }
524
524
  : openAppParams;
525
525
  console.log('处理后的参数', objectToUrlEncode(getInfo));
526
526
  this.jdJumpToWeb(
527
527
  `${this.jumpWebUrl.shopSearch}?${objectToUrlEncode(getInfo)}`,
528
528
  logEventInfo,
529
529
  );
530
530
  } else {
531
531
  const getInfo = configDataValue['cid']
532
532
  ? { ...baseInfo, ...configDataValue, cateId: configDataValue.cid, searchType: '5' }
533
533
  : { ...baseInfo, ...configDataValue };
534
534
  this.jdJumpToWeb(
535
535
  `${this.jumpWebUrl.shopSearch}?${objectToUrlEncode(getInfo)}`,
536
536
  logEventInfo,
537
537
  );
538
538
  }
539
539
  } else {
540
540
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
541
541
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
542
542
  console.log('jd web 获取店铺分类链接解析后的参数结果', getShopSearchParams);
543
543
  getShopSearchParams &&
544
544
  this.jdJumpToShopSearch(
545
545
  Object.assign({}, getShopSearchParams, {
546
546
  logEventInfo,
547
547
  }),
548
548
  );
549
549
  } else {
550
550
  this.jdJumpToShopSearch(
551
551
  configDataValue['cid']
552
552
  ? Object.assign(
553
553
  {},
554
554
  {
555
555
  shopId: global.info.queryInfo.shopId,
556
556
  categoryId: configDataValue.cid,
557
557
  searchType: '5',
558
558
  logEventInfo,
559
559
  },
560
560
  )
561
561
  : {
562
562
  shopId: global.info.queryInfo.shopId,
563
563
  logEventInfo,
564
564
  },
565
565
  );
566
566
  }
567
567
  }
568
568
  break;
569
569
  case LinkConfigType.CONFIG_TYPE_MEMBER:
570
570
  if (isAppHomeForMarketPage) {
571
571
  this.jdJumpToBottomTabBrandMember({
572
572
  logEventInfo,
573
573
  });
574
574
  } else {
575
575
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
576
576
  const getShopMemberParams = this.jdOpenAppParams(configDataValue.clickUrl);
577
577
  getShopMemberParams &&
578
578
  this.jdJumpToShopMember(
579
579
  Object.assign({}, getShopMemberParams, {
580
580
  logEventInfo,
581
581
  }),
582
582
  );
583
583
  } else {
584
584
  this.jdJumpToShopMember({
585
585
  shopId: global.info.queryInfo.shopId,
586
586
  venderId: configDataValue.shopDetail,
587
587
  logEventInfo,
588
588
  });
589
589
  }
590
590
  }
591
591
  break;
592
592
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
593
593
  if (this.isNewHarmony()) {
594
594
  const url = `${domain.sale}/m/h5/${configDataValue.data}.html`;
595
595
  this.jdJumpToWeb(url, logEventInfo);
596
596
  } else {
597
597
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
598
598
  const getShopActivityParams = this.jdOpenAppParams(configDataValue.clickUrl);
599
599
  getShopActivityParams &&
600
600
  this.jdJumpToShopActivity(
601
601
  Object.assign({}, getShopActivityParams, {
602
602
  logEventInfo,
603
603
  }),
604
604
  );
605
605
  } else if (configDataValue['projectId']) {
606
606
  this.jdJumpToShopActivity({
607
607
  projectId: configDataValue['projectId'],
608
608
  configDataValue,
609
609
  logEventInfo,
610
610
  });
611
611
  }
612
612
  }
613
613
  break;
614
614
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
615
615
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
616
616
  const _url = configDataValue.linkUrl;
617
617
  if (
618
618
  _url.indexOf('to=') === -1 &&
619
619
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
620
620
  ) {
621
621
  const _shopId = _url.match(/\d+/g)[0];
622
622
  this.jdJumpToShopHome({
623
623
  shopId: `${_shopId}`,
624
624
  logEventInfo,
625
625
  });
626
626
  } else if (this.isOpenJdAppUrl(_url)) {
627
627
  const getOpenAppParams = this.jdOpenAppParams(_url);
628
628
  console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams);
629
629
  if (getOpenAppParams) {
630
630
  let _changeOpenAppParams = getOpenAppParams;
631
631
  if (isAppHomeForMarketPage) {
632
632
  const { operation, ...otherOpenAppParams } = getOpenAppParams;
633
633
  if (operation && operation === 'jumpTabInner') {
634
634
  _changeOpenAppParams = otherOpenAppParams;
635
635
  }
636
636
  }
637
637
  this.jdNavigateToNative(
638
638
  Object.assign({}, _changeOpenAppParams, {
639
639
  logEventInfo,
640
640
  }),
641
641
  );
642
642
  }
643
643
  } else {
644
644
  this.jdJumpToWeb(_url, logEventInfo);
645
645
  }
646
646
  break;
647
647
  }
648
648
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
649
649
  this.jdJumpToShopDetail({
650
650
  venderId: global.info.queryInfo.venderId,
651
651
  shopId: global.info.queryInfo.shopId,
652
652
  logEventInfo,
653
653
  });
654
654
  break;
655
655
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
656
656
  this.jdJumpToShopHome({
657
657
  ...configDataValue,
658
658
  logEventInfo,
659
659
  });
660
660
  break;
661
661
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
662
662
  break;
663
663
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
664
664
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
665
665
  const getShoppingGuideParams = this.jdOpenAppParams(configDataValue.clickUrl);
666
666
  getShoppingGuideParams &&
667
667
  this.jdJumpToShopActivity(
668
668
  Object.assign({}, getShoppingGuideParams, {
669
669
  logEventInfo,
670
670
  }),
671
671
  );
672
672
  }
673
673
  break;
674
674
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
675
675
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '');
676
676
  const search = linkUrl.match(/\?.+/);
677
677
  if (search) {
678
678
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
679
679
  parseQueryUrlString(linkUrl);
680
680
  try {
681
681
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param);
682
682
  } catch (e) {
683
683
  console.warn('解析小程序 param 错误:', miniQueryData.param);
684
684
  }
685
685
  this.jdJumpToMiniProgram(miniQueryData);
686
686
  } else {
687
687
  console.warn('小程序地址错误:', linkUrl);
688
688
  }
689
689
  break;
690
690
  }
691
691
  case LinkConfigType.CONFIG_TYPE_SHOP_SEARCH: {
692
692
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
693
693
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
694
694
  console.log('jd web 获取店铺结果落地页链接解析后的参数结果', getShopSearchParams);
695
695
  getShopSearchParams &&
696
696
  this.jdJumpToShopSearch(
697
697
  Object.assign({}, getShopSearchParams, {
698
698
  logEventInfo,
699
699
  }),
700
700
  );
701
701
  } else {
702
702
  this.jdJumpToWeb(configDataValue.clickUrl, logEventInfo);
703
703
  }
704
704
  break;
705
705
  }
706
706
  default:
707
707
  }
708
708
  }
709
709
 
710
710
  isNewHarmony() {
711
711
  return isJdAndHarmonyDevice && isNewHarmonyShop;
712
712
  }
713
713
 
714
714
  jdNavigateToNative(
715
715
  params: object,
716
716
  url = 'openapp.jdmobile://virtual',
717
717
  successBack?: functionType | null,
718
718
  failBack?: functionType | null,
719
719
  ) {
720
720
  console.log('[降级H5] jdNavigateToNative web.jd:', params);
721
721
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams = Object.assign(
722
722
  {},
723
723
  {
724
724
  sourceValue: 'sourceValue_jshopModuleWeb',
725
725
  sourceType: 'sourceType_jshopModuleWeb',
726
726
  param: {},
727
727
  },
728
728
  params,
729
729
  );
730
730
  const { logEventInfo, useEncodeParams, ...otherParams } = getResParams;
731
731
  console.log('jd web 获取open协议参数 jdNavigateToNative params: ', getResParams);
732
732
  console.log('logEventInfo params: ', logEventInfo);
733
733
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
734
734
  this.clickEventLog(logEventInfo || getResParams)
735
735
  .then(() => {
736
736
  if (typeof successBack === 'function') {
737
737
  successBack(getResParams);
738
738
  } else {
739
739
  if (this.isNewHarmony() && params.operation === 'jumpTabInner') {
740
740
  if (params.jumpTab) {
741
741
  JumpTabBarInCurrentShop({ position: 'top', item: params.jumpTab });
742
742
  } else if (params.jumpBottomTab) {
743
743
  JumpTabBarInCurrentShop({ position: 'bottom', item: params.jumpBottomTab });
744
744
  } else {
745
745
  console.log('[降级H5] 跳转异常 params:', params);
746
746
  }
747
747
  } else if (
748
748
  this.isNewHarmony() &&
749
749
  (params.operation === 'jumpBottomTabMember' || params.des === 'jshopMember')
750
750
  ) {
751
751
  JumpTabBarInCurrentShop({ position: 'bottom', item: 'brandMember' });
752
752
  } else {
753
753
  try {
754
754
  const paramsStr = JSON.stringify(otherParams);
755
755
  console.log('跳转web jd open协议', `${url}?params=${paramsStr}`);
756
756
  window.location.href =
757
757
  isJdAndHarmonyDevice || useEncodeParams
758
758
  ? `${url}?params=${encodeURIComponent(paramsStr)}`
759
759
  : `${url}?params=${paramsStr}`;
760
760
  } catch (e) {
761
761
  console.log('跳转异常', e);
762
762
  draBusinessCustomReport({
763
763
  type: 'jdapp_jdNavigateToNative_catch_err',
764
764
  errMsg: '跳转web jd open协议发生错误',
765
765
  originReqDataStr: JSON.stringify({
766
766
  url,
767
767
  isJdApp,
768
768
  jdAppVersion: jdAppVersionStr,
769
769
  ...otherParams,
770
770
  }),
771
771
  });
772
772
  }
773
773
  }
774
774
  }
775
775
  })
776
776
  .catch(() => {
777
777
  typeof failBack === 'function' && failBack(getResParams);
778
778
  });
779
779
  }
780
780
 
781
781
  clickEventLog(opts: JumpEventReportInterFace.OptEventLogParams = {}, reportKey = 'click') {
782
782
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts;
783
783
  if (eventId && jsonParam) {
784
784
  const { etModelInfo, logBaseInfo } = jsonParam;
785
785
  let getJsonParam = {};
786
786
  if (etModelInfo && logBaseInfo) {
787
787
  getJsonParam = logBaseInfo;
788
788
  } else {
789
789
  if (Array.isArray(jsonParam)) {
790
790
  getJsonParam = jsonParam;
791
791
  } else {
792
792
  getJsonParam = Object.assign(
793
793
  {},
794
794
  {
795
795
  shopid: global.info.queryInfo?.shopId,
796
796
  },
797
797
  jsonParam,
798
798
  );
799
799
  }
800
800
  }
801
801
  if (
802
802
  reportKey === 'exposure' &&
803
803
  /^TerminatorNew/.test(eventId) &&
804
804
  !Array.isArray(getJsonParam)
805
805
  ) {
806
806
  getJsonParam = [getJsonParam];
807
807
  }
808
808
  const webLogParams = {
809
809
  isExpo: reportKey === 'exposure',
810
810
  eid: eventId,
811
811
  elevel: eventLevel,
812
812
  jsonParam: JSON.stringify(getJsonParam),
813
813
  etModel: JSON.stringify(etModelInfo || {}),
814
814
  pageId: this.logPageId,
815
815
  pageParam: this.logPageParamStr,
816
816
  ...otherParams,
817
817
  };
818
818
  return /click|exposure/.test(reportKey)
819
819
  ? reportClick(webLogParams)
820
820
  : reportToCart(opts, webLogParams);
821
821
  } else {
822
822
  console.log('暂无埋点参数eventId和eventParam');
823
823
  return Promise.resolve(false);
824
824
  }
825
825
  }
826
826
 
827
827
  exposureEventLog(opts) {
828
828
  return global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
829
829
  ? this.clickEventLog(
830
830
  {
831
831
  ...opts,
832
832
  exposureState: true,
833
833
  },
834
834
  'exposure',
835
835
  )
836
836
  : Promise.resolve(false);
837
837
  }