@conecli/cone-render 0.10.1-shop3.9 → 0.10.1-shop3.91

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 (114) 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.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 +309 -0
  70. package/dist/language/zh_CN.json +309 -0
  71. package/dist/language/zh_HK.json +309 -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 +27 -1
  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/log.ts +1 -0
  106. package/dist/utils/{sColor.js → sColor.ts} +1 -1
  107. package/dist/utils/sColor.weapp.ts +1 -0
  108. package/dist/utils/utils.ts +1 -1
  109. package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
  110. package/dist/wxapp/common/user_info.js +1 -1
  111. package/package.json +162 -141
  112. package/dist/jumpEventReport/web/wqshop.report.ts +0 -1
  113. package/dist/utils/priceUtils.js +0 -1
  114. /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?.isJdTabletDevice && !/device=tablet/.test(_getLastUrl)) {
476
476
  _getLastUrl = `${_getLastUrl}${_getLastUrl.indexOf('?') !== -1 ? '&' : '?'}device=tablet`;
477
477
  }
478
478
  if (isInJdShopView && /sale\/home/.test(_getLastUrl)) {
479
479
  _getLastUrl = `${_getLastUrl}${_getLastUrl.indexOf('?') !== -1 ? '&' : '?'}origin=appShop`;
480
480
  }
481
481
  }
482
482
  super.jdJumpToWeb(
483
483
  _getLastUrl,
484
484
  {
485
485
  ...logEventInfo,
486
486
  },
487
487
  successBack,
488
488
  failBack,
489
489
  );
490
490
  }
491
491
  }
492
492
 
493
493
  jdJumpToWebInner(url, logEventInfo) {
494
494
  this.jdJumpToWeb(url, logEventInfo);
495
495
  }
496
496
 
497
497
  jdJumpConfigUrl(detail, logEventInfo = {}) {
498
498
  const { configDataType, configDataValue } = detail;
499
499
  switch (configDataType) {
500
500
  case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
501
501
  this.jdJumpToShopCategory({
502
502
  ...configDataValue,
503
503
  logEventInfo,
504
504
  });
505
505
  break;
506
506
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
507
507
  if (logEventInfo?.jsonParam?.logBaseInfo?.mInfo) {
508
508
  logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds;
509
509
  }
510
510
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo);
511
511
  break;
512
512
  case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
513
513
  this.jdJumpToWeb(
514
514
  `${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
515
515
  {},
516
516
  );
517
517
  break;
518
518
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
519
519
  if (isJdAndHarmonyDevice && isNewHarmonyShop && jdAppVersionStr === '15.1.70') {
520
520
  const baseInfo = {
521
521
  shopId: global.info.queryInfo.shopId,
522
522
  venderId: global.info.queryInfo.venderId,
523
523
  };
524
524
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
525
525
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
526
526
  console.log('jd web 获取店铺分类链接解析后的参数结果', getShopSearchParams);
527
527
  let openAppParams =
528
528
  typeof getShopSearchParams === 'boolean'
529
529
  ? { categoryId: '', ...baseInfo }
530
530
  : getShopSearchParams;
531
531
  const getInfo = openAppParams['categoryId']
532
532
  ? { ...openAppParams, cateId: openAppParams['categoryId'] }
533
533
  : openAppParams;
534
534
  console.log('处理后的参数', objectToUrlEncode(getInfo));
535
535
  this.jdJumpToWeb(
536
536
  `${this.jumpWebUrl.shopSearch}?${objectToUrlEncode(getInfo)}`,
537
537
  logEventInfo,
538
538
  );
539
539
  } else {
540
540
  const getInfo = configDataValue['cid']
541
541
  ? { ...baseInfo, ...configDataValue, cateId: configDataValue.cid, searchType: '5' }
542
542
  : { ...baseInfo, ...configDataValue };
543
543
  this.jdJumpToWeb(
544
544
  `${this.jumpWebUrl.shopSearch}?${objectToUrlEncode(getInfo)}`,
545
545
  logEventInfo,
546
546
  );
547
547
  }
548
548
  } else {
549
549
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
550
550
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
551
551
  console.log('jd web 获取店铺分类链接解析后的参数结果', getShopSearchParams);
552
552
  getShopSearchParams &&
553
553
  this.jdJumpToShopSearch(
554
554
  Object.assign({}, getShopSearchParams, {
555
555
  logEventInfo,
556
556
  }),
557
557
  );
558
558
  } else {
559
559
  const extraParam = configDataValue?.pageId ? { pageId: configDataValue.pageId } : {};
560
560
  this.jdJumpToShopSearch(
561
561
  configDataValue['cid']
562
562
  ? Object.assign(
563
563
  {},
564
564
  {
565
565
  shopId: global.info.queryInfo.shopId,
566
566
  categoryId: configDataValue.cid,
567
567
  searchType: '5',
568
568
  ...extraParam,
569
569
  logEventInfo,
570
570
  },
571
571
  )
572
572
  : {
573
573
  shopId: global.info.queryInfo.shopId,
574
574
  ...extraParam,
575
575
  logEventInfo,
576
576
  },
577
577
  );
578
578
  }
579
579
  }
580
580
  break;
581
581
  case LinkConfigType.CONFIG_TYPE_MEMBER:
582
582
  if (isAppHomeForMarketPage) {
583
583
  this.jdJumpToBottomTabBrandMember({
584
584
  logEventInfo,
585
585
  });
586
586
  } else {
587
587
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
588
588
  const getShopMemberParams = this.jdOpenAppParams(configDataValue.clickUrl);
589
589
  getShopMemberParams &&
590
590
  this.jdJumpToShopMember(
591
591
  Object.assign({}, getShopMemberParams, {
592
592
  logEventInfo,
593
593
  }),
594
594
  );
595
595
  } else {
596
596
  this.jdJumpToShopMember({
597
597
  shopId: global.info.queryInfo.shopId,
598
598
  venderId: configDataValue.shopDetail,
599
599
  logEventInfo,
600
600
  });
601
601
  }
602
602
  }
603
603
  break;
604
604
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
605
605
  if (this.isNewHarmony()) {
606
606
  const url = `${domain.sale}/m/h5/${configDataValue.data}.html`;
607
607
  this.jdJumpToWeb(url, logEventInfo);
608
608
  } else {
609
609
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
610
610
  const getShopActivityParams = this.jdOpenAppParams(configDataValue.clickUrl);
611
611
  getShopActivityParams &&
612
612
  this.jdJumpToShopActivity(
613
613
  Object.assign({}, getShopActivityParams, {
614
614
  logEventInfo,
615
615
  }),
616
616
  );
617
617
  } else if (configDataValue['projectId']) {
618
618
  this.jdJumpToShopActivity({
619
619
  projectId: configDataValue['projectId'],
620
620
  configDataValue,
621
621
  logEventInfo,
622
622
  });
623
623
  }
624
624
  }
625
625
  break;
626
626
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
627
627
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
628
628
  const _url = configDataValue.linkUrl;
629
629
  if (
630
630
  _url.indexOf('to=') === -1 &&
631
631
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
632
632
  ) {
633
633
  const _shopId = _url.match(/\d+/g)[0];
634
634
  this.jdJumpToShopHome({
635
635
  shopId: `${_shopId}`,
636
636
  logEventInfo,
637
637
  });
638
638
  } else if (this.isOpenJdAppUrl(_url)) {
639
639
  const getOpenAppParams = this.jdOpenAppParams(_url);
640
640
  console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams);
641
641
  if (getOpenAppParams) {
642
642
  let _changeOpenAppParams = getOpenAppParams;
643
643
  if (isAppHomeForMarketPage) {
644
644
  const { operation, ...otherOpenAppParams } = getOpenAppParams;
645
645
  if (operation && operation === 'jumpTabInner') {
646
646
  _changeOpenAppParams = otherOpenAppParams;
647
647
  }
648
648
  }
649
649
  this.jdNavigateToNative(
650
650
  Object.assign({}, _changeOpenAppParams, {
651
651
  logEventInfo,
652
652
  }),
653
653
  );
654
654
  }
655
655
  } else {
656
656
  this.jdJumpToWeb(_url, logEventInfo);
657
657
  }
658
658
  break;
659
659
  }
660
660
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
661
661
  this.jdJumpToShopDetail({
662
662
  venderId: global.info.queryInfo.venderId,
663
663
  shopId: global.info.queryInfo.shopId,
664
664
  logEventInfo,
665
665
  });
666
666
  break;
667
667
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
668
668
  this.jdJumpToShopHome({
669
669
  ...configDataValue,
670
670
  logEventInfo,
671
671
  });
672
672
  break;
673
673
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
674
674
  break;
675
675
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
676
676
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
677
677
  const getShoppingGuideParams = this.jdOpenAppParams(configDataValue.clickUrl);
678
678
  getShoppingGuideParams &&
679
679
  this.jdJumpToShopActivity(
680
680
  Object.assign({}, getShoppingGuideParams, {
681
681
  logEventInfo,
682
682
  }),
683
683
  );
684
684
  }
685
685
  break;
686
686
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
687
687
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '');
688
688
  const search = linkUrl.match(/\?.+/);
689
689
  if (search) {
690
690
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
691
691
  parseQueryUrlString(linkUrl);
692
692
  try {
693
693
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param);
694
694
  } catch (e) {
695
695
  console.warn('解析小程序 param 错误:', miniQueryData.param);
696
696
  }
697
697
  this.jdJumpToMiniProgram(miniQueryData);
698
698
  } else {
699
699
  console.warn('小程序地址错误:', linkUrl);
700
700
  }
701
701
  break;
702
702
  }
703
703
  case LinkConfigType.CONFIG_TYPE_SHOP_SEARCH: {
704
704
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
705
705
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
706
706
  console.log('jd web 获取店铺结果落地页链接解析后的参数结果', getShopSearchParams);
707
707
  getShopSearchParams &&
708
708
  this.jdJumpToShopSearch(
709
709
  Object.assign({}, getShopSearchParams, {
710
710
  logEventInfo,
711
711
  }),
712
712
  );
713
713
  } else {
714
714
  this.jdJumpToWeb(configDataValue.clickUrl, logEventInfo);
715
715
  }
716
716
  break;
717
717
  }
718
718
  default:
719
719
  }
720
720
  }
721
721
 
722
722
  isNewHarmony() {
723
723
  return isJdAndHarmonyDevice && isNewHarmonyShop;
724
724
  }
725
725
 
726
726
  jdNavigateToNative(
727
727
  params: object,
728
728
  url = 'openapp.jdmobile://virtual',
729
729
  successBack?: functionType | null,
730
730
  failBack?: functionType | null,
731
731
  ) {
732
732
  console.log('[降级H5] jdNavigateToNative web.jd:', params);
733
733
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams = Object.assign(
734
734
  {},
735
735
  {
736
736
  sourceValue: 'sourceValue_jshopModuleWeb',
737
737
  sourceType: 'sourceType_jshopModuleWeb',
738
738
  param: {},
739
739
  },
740
740
  params,
741
741
  );
742
742
  const { logEventInfo, useEncodeParams, ...otherParams } = getResParams;
743
743
  console.log('jd web 获取open协议参数 jdNavigateToNative params: ', getResParams);
744
744
  console.log('logEventInfo params: ', logEventInfo);
745
745
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
746
746
  this.clickEventLog(logEventInfo || getResParams)
747
747
  .then(() => {
748
748
  if (typeof successBack === 'function') {
749
749
  successBack(getResParams);
750
750
  } else {
751
751
  if (this.isNewHarmony() && params.operation === 'jumpTabInner') {
752
752
  if (params.jumpTab) {
753
753
  JumpTabBarInCurrentShop({ position: 'top', item: params.jumpTab, ...params });
754
754
  } else if (params.jumpBottomTab) {
755
755
  JumpTabBarInCurrentShop({
756
756
  position: 'bottom',
757
757
  item: params.jumpBottomTab,
758
758
  ...params,
759
759
  });
760
760
  } else {
761
761
  console.log('[降级H5] 跳转异常 params:', params);
762
762
  }
763
763
  } else if (
764
764
  this.isNewHarmony() &&
765
765
  (params.operation === 'jumpBottomTabMember' || params.des === 'jshopMember')
766
766
  ) {
767
767
  JumpTabBarInCurrentShop({ position: 'bottom', item: 'brandMember', ...params });
768
768
  } else {
769
769
  try {
770
770
  const paramsStr = JSON.stringify(otherParams);
771
771
  console.log('跳转web jd open协议', `${url}?params=${paramsStr}`);
772
772
  window.location.href =
773
773
  isJdAndHarmonyDevice || useEncodeParams
774
774
  ? `${url}?params=${encodeURIComponent(paramsStr)}`
775
775
  : `${url}?params=${paramsStr}`;
776
776
  } catch (e) {
777
777
  draBusinessCustomReport({
778
778
  eventName: 'entryProtocol',
779
779
  errorName: 'shop_jdNavigateToNative_error',
780
780
  errorMessage: '跳转web jd open协议发生错误',
781
781
  extraData: JSON.stringify({
782
782
  url,
783
783
  isJdApp,
784
784
  jdAppVersion: jdAppVersionStr,
785
785
  ...otherParams,
786
786
  }),
787
787
  });
788
788
  }
789
789
  }
790
790
  }
791
791
  })
792
792
  .catch(() => {
793
793
  typeof failBack === 'function' && failBack(getResParams);
794
794
  });
795
795
  }
796
796
 
797
797
  clickEventLog(opts: JumpEventReportInterFace.OptEventLogParams = {}, reportKey = 'click') {
798
798
  const { eventId, spmAllCode, spmCodeForCD, jsonParam, eventLevel = 3, ...otherParams } = opts;
799
799
  if ((eventId || spmAllCode || spmCodeForCD) && jsonParam) {
800
800
  const { etModelInfo, logBaseInfo } = jsonParam;
801
801
  let getJsonParam = {};
802
802
  if (etModelInfo && logBaseInfo) {
803
803
  getJsonParam = logBaseInfo;
804
804
  } else {
805
805
  if (Array.isArray(jsonParam)) {
806
806
  getJsonParam = jsonParam;
807
807
  } else {
808
808
  getJsonParam = Object.assign(
809
809
  {},
810
810
  {
811
811
  shopid: global.info.queryInfo?.shopId,
812
812
  },
813
813
  jsonParam,
814
814
  );
815
815
  }
816
816
  }
817
817
  if (
818
818
  reportKey === 'exposure' &&
819
819
  /^TerminatorNew/.test(eventId) &&
820
820
  !Array.isArray(getJsonParam)
821
821
  ) {
822
822
  getJsonParam = [getJsonParam];
823
823
  }
824
824
  const webLogParams = {
825
825
  isExpo: reportKey === 'exposure',
826
826
  eid: eventId,
827
827
  elevel: eventLevel,
828
828
  jsonParam: JSON.stringify(getJsonParam),
829
829
  etModel: JSON.stringify(etModelInfo || {}),
830
830
  pageId: this.logPageId,
831
831
  pageParam: this.logPageParamStr,
832
832
  spmAllCode,
833
833
  spmCodeForCD,
834
834
  ...otherParams,
835
835
  };
836
836
  return /click|exposure/.test(reportKey)
837
837
  ? reportClick(webLogParams)
838
838
  : reportToCart(opts, webLogParams);
839
839
  } else {
840
840
  console.log('暂无埋点参数eventId和eventParam');
841
841
  return Promise.resolve(false);
842
842
  }
843
843
  }
844
844
 
845
845
  exposureEventLog(opts) {
846
846
  return global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
847
847
  ? this.clickEventLog(
848
848
  {
849
849
  ...opts,
850
850
  exposureState: true,
851
851
  },
852
852
  'exposure',
853
853
  )
854
854
  : Promise.resolve(false);
855
855
  }