@conecli/cone-render 0.10.1-shop3.12 → 0.10.1-shop3.121

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