@conecli/cone-render 0.10.1-shop3.10 → 0.10.1-shop3.101

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