@conecli/cone-render 0.10.1-shop3.8 → 0.10.1-shop3.80

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