@conecli/cone-render 0.10.1-shop3.14 → 0.10.1-shop3.140

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