@conecli/cone-render 0.10.1-shop-beta.22 → 0.10.1-shop-beta.24

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/dist/api/index.ts +1 -1
  2. package/dist/common/accessibility.h5.ts +1 -0
  3. package/dist/common/accessibility.ts +0 -0
  4. package/dist/common/const.ts +1 -1
  5. package/dist/common/index.h5.ts +1 -1
  6. package/dist/common/index.jd.ts +1 -1
  7. package/dist/common/index.ts +1 -1
  8. package/dist/common/index.weapp.ts +1 -1
  9. package/dist/common/jdplayerSdk.weapp.tsx +1 -0
  10. package/dist/common/jssdk.weapp.ts +1 -0
  11. package/dist/common/pageType.ts +1 -1
  12. package/dist/common/token/token.jd.ts +1 -1
  13. package/dist/components/ErrorBoundary.tsx +1 -1
  14. package/dist/components/base/CountDown/index.tsx +1 -1
  15. package/dist/components/base/CustomVideo/index.tsx +1 -1
  16. package/dist/components/base/CustomVideo/index.weapp.tsx +1 -0
  17. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  18. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  19. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  20. package/dist/components/base/InOrOutViewObserver/index.weapp.tsx +1 -0
  21. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  22. package/dist/components/base/JdLoading/index.module.scss +0 -2
  23. package/dist/components/base/JdLoading/index.tsx +1 -1
  24. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  25. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  26. package/dist/components/base/LazyLoadImage/index.tsx +1 -1
  27. package/dist/components/base/MobileCommonHeader/index.weapp.tsx +1 -0
  28. package/dist/components/base/NetworkDataError/const.ts +1 -1
  29. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  30. package/dist/components/base/Price/Base/index.tsx +1 -1
  31. package/dist/components/base/Price/Double/index.module.scss +18 -0
  32. package/dist/components/base/Price/Double/index.tsx +1 -1
  33. package/dist/components/base/ShopLeGaoTag/index.h5.module.scss +35 -0
  34. package/dist/components/base/ShopLeGaoTag/index.h5.tsx +1 -0
  35. package/dist/components/base/ShopLeGaoTag/index.module.scss +33 -0
  36. package/dist/components/base/ShopLeGaoTag/index.tsx +1 -0
  37. package/dist/components/floorItem.tsx +1 -1
  38. package/dist/components/isv/Floor/index.tsx +1 -1
  39. package/dist/components/remoteFloorItem.tsx +1 -1
  40. package/dist/config/env.ts +1 -1
  41. package/dist/interface/common.ts +1 -1
  42. package/dist/interface/component.ts +1 -1
  43. package/dist/interface/jumpEventReport.ts +1 -1
  44. package/dist/interface/service.ts +1 -1
  45. package/dist/jumpEventReport/base.ts +1 -1
  46. package/dist/jumpEventReport/const.ts +1 -1
  47. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  48. package/dist/jumpEventReport/index.ts +1 -1
  49. package/dist/jumpEventReport/index.weapp.ts +1 -1
  50. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  51. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  52. package/dist/jumpEventReport/logEventConfig.h5.ts +1 -0
  53. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  54. package/dist/jumpEventReport/web/report.ts +1 -1
  55. package/dist/jumpEventReport/web.base.ts +1 -1
  56. package/dist/jumpEventReport/web.jd.ts +1 -1
  57. package/dist/jumpEventReport/web.pc.ts +1 -1
  58. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  59. package/dist/language/en_US.json +179 -83
  60. package/dist/language/zh_CN.json +178 -82
  61. package/dist/language/zh_HK.json +178 -82
  62. package/dist/libs/openShopBridge.js +161 -0
  63. package/dist/libs/openShopBridge.min.js +1 -0
  64. package/dist/libs/taroAppReport.js +2 -2
  65. package/dist/modules/ContainerFloorList/index.h5.module.scss +16 -2
  66. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  67. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  68. package/dist/modules/DecorateContainerFloorList/index.weapp.tsx +1 -0
  69. package/dist/open/api/index.ts +1 -1
  70. package/dist/open/api/shopMember.weapp.ts +1 -0
  71. package/dist/open/api/track.ts +1 -1
  72. package/dist/open/api/util.ts +1 -1
  73. package/dist/open/components/index.ts +1 -1
  74. package/dist/open/index.ts +1 -1
  75. package/dist/sass/app.h5.scss +6 -1
  76. package/dist/service/fetchGateway.ts +1 -1
  77. package/dist/service/fetchGateway.weapp.ts +1 -1
  78. package/dist/service/fetchJsonp.ts +1 -1
  79. package/dist/service/fetchJsonp.weapp.ts +1 -0
  80. package/dist/service/http/h5Http.ts +1 -1
  81. package/dist/service/http/http.ts +1 -1
  82. package/dist/service/http/httpInterceptors.weapp.ts +1 -0
  83. package/dist/service/requestServer.h5.ts +1 -1
  84. package/dist/service/requestServer.ts +1 -1
  85. package/dist/service/requestServer.weapp.ts +1 -1
  86. package/dist/utils/connectNativeJsBridge.ts +1 -1
  87. package/dist/utils/h5Utils.ts +1 -1
  88. package/dist/utils/harmonyCallRouter.h5.ts +1 -0
  89. package/dist/utils/harmonyCallRouter.ts +0 -0
  90. package/dist/utils/index.h5.ts +1 -1
  91. package/dist/utils/index.ts +1 -1
  92. package/dist/utils/index.weapp.ts +1 -1
  93. package/dist/utils/intersectionObserver.ts +1 -1
  94. package/dist/utils/sColor.weapp.ts +1 -0
  95. package/dist/utils/utils.ts +1 -1
  96. package/package.json +13 -15
  97. package/dist/common/index.dynamic.ts +0 -1
  98. package/dist/components/base/Dialog/index.dynamic.module.scss +0 -126
  99. package/dist/components/base/Dialog/index.dynamic.tsx +0 -1
  100. package/dist/components/base/DynamicTest/index.dynamic.module.scss +0 -15
  101. package/dist/components/base/DynamicTest/index.module.scss +0 -16
  102. package/dist/components/base/DynamicTest/index.tsx +0 -1
  103. package/dist/components/base/LazyLoadImage/index.dynamic.module.scss +0 -40
  104. package/dist/components/base/LazyLoadImage/index.dynamic.tsx +0 -1
  105. package/dist/components/base/NetworkDataError/index.dynamic.module.scss +0 -95
  106. package/dist/components/base/NetworkDataError/index.dynamic.tsx +0 -1
  107. package/dist/components/base/Price/Base/index.dynamic.module.scss +0 -63
  108. package/dist/components/base/Price/Base/index.dynamic.tsx +0 -1
  109. package/dist/components/base/Price/Double/index.dynamic.module.scss +0 -172
  110. package/dist/components/base/Price/Double/index.dynamic.tsx +0 -1
  111. package/dist/jumpEventReport/index.dynamic.ts +0 -1
  112. package/dist/jumpEventReport/web/wqshop.report.ts +0 -1
  113. package/dist/open/api/shopMember.dynamic.ts +0 -1
  114. package/dist/open/components/index.dynamic.ts +0 -1
  115. package/dist/sass/app.dynamic.scss +0 -306
  116. package/dist/service/fetchGateway.h5.ts +0 -1
  117. package/dist/service/fetchJsonp.h5.ts +0 -1
  118. package/dist/service/http/colorSign.dynamic.ts +0 -1
  119. package/dist/utils/connectNativeJsBridge.dynamic.ts +0 -1
  120. package/dist/utils/priceUtils.js +0 -1
  121. /package/dist/utils/{sColor.js → sColor.ts} +0 -0
@@ -1 +1 @@
1
- import { JdJumpJdApp } from './jdJumpJdApp';
2
1
  isAppHomeForMarketPage,
3
2
  isJdAndHarmonyDevice,
4
3
  isNewHarmonyShop,
5
4
  parseQueryUrlString,
6
5
  objectToUrlEncode,
7
6
  routerInfo: {
8
7
  params: {},
9
8
  },
10
9
  nativeEvent: null,
11
10
  jumpConfig: {
12
11
  venderId: null,
13
12
  shopId: null,
14
13
  sourceValue: '',
15
14
  sourceType: 'App-H5',
16
15
  activityType: 'shopx',
17
16
  moduleId: 'none',
18
17
  entrance: 'none',
19
18
  },
20
19
  logPageParamStr: '',
21
20
  public logPageId: string;
22
21
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig;
23
22
  constructor(opt = {}) {
24
23
  super(opt);
25
24
  this.getConfig(opt);
26
25
  }
27
26
  getConfig(opt = {}) {
28
27
  return Object.assign(this, {}, defaultConfig, opt);
29
28
  }
30
29
  updateInfo(routerInfo, logPname = LogPnameInfo.HOME, pageId = LogPageIdInfo.APP) {
31
30
  this.logPageId = pageId;
32
31
  this.routerInfo = routerInfo;
33
32
  this.jumpConfig = Object.assign({}, this.jumpConfig, routerInfo.params);
34
33
  this.logPname = logPname;
35
34
  }
36
35
  reportInfoPv(
37
36
  pageId = LogPageIdInfo.APP,
38
37
  opt: {
39
38
  pageParam?: any;
40
39
  } = {},
41
40
  ) {
42
41
  const { pageParam } = opt;
43
42
  this.logPageParamStr = pageParam
44
43
  ? pageParam
45
44
  : this.creatParamToLogStr(this.jumpConfig)
46
45
  .replace(/moduleId/, 'JumpmoduleID')
47
46
  .replace(/entrance/, 'Jumpentrance');
48
47
  reportPV({
49
48
  pageId,
50
49
  pageParam: this.logPageParamStr,
51
50
  ...opt,
52
51
  });
53
52
  }
54
53
 
55
54
  jdJumpToDongDongChatGroup(groupId, source = '4') {
56
55
  this.jdNavigateToNative({
57
56
  category: 'jump',
58
57
  des: 'dongdong_group_chat',
59
58
  source: source,
60
59
  groupId: `${groupId}`,
61
60
  });
62
61
  }
63
62
 
64
63
  jdJumpToWeb(
65
64
  url,
66
65
  logEventInfo,
67
66
  successBack?: functionType | undefined,
68
67
  failBack?: functionType | undefined,
69
68
  ) {
70
69
  console.log('jd web', this.isOpenJdAppUrl(url), url);
71
70
  if (this.isOpenJdAppUrl(url)) {
72
71
  const getOpenAppParams = this.jdOpenAppParams(url);
73
72
  console.log('jd web 获取自定义openApp链接解析后的参数结果', getOpenAppParams);
74
73
  if (getOpenAppParams) {
75
74
  this.jdNavigateToNative(
76
75
  Object.assign({}, getOpenAppParams, {
77
76
  logEventInfo,
78
77
  }),
79
78
  );
80
79
  }
81
80
  } else {
82
81
  let _getLastUrl = url;
83
82
  if (/shop\.m\.jd\.com|pages\.jd\.com/.test(_getLastUrl)) {
84
83
  const getUrlSearchParamState = _getLastUrl.indexOf('?') !== -1;
85
84
  if (!/jwebprog=0/.test(_getLastUrl)) {
86
85
  _getLastUrl = `${_getLastUrl}${getUrlSearchParamState ? '&' : '?'}jwebprog=0`;
87
86
  }
88
87
  if (global.info.sysInfo?.isJdTabletDevice && !/device=tablet/.test(_getLastUrl)) {
89
88
  _getLastUrl = `${_getLastUrl}${getUrlSearchParamState ? '&' : '?'}device=tablet`;
90
89
  }
91
90
  }
92
91
  super.jdJumpToWeb(
93
92
  _getLastUrl,
94
93
  {
95
94
  ...logEventInfo,
96
95
  },
97
96
  successBack,
98
97
  failBack,
99
98
  );
100
99
  }
101
100
  }
102
101
 
103
102
  jdJumpToWebInner(url, logEventInfo) {
104
103
  this.jdJumpToWeb(url, logEventInfo);
105
104
  }
106
105
 
107
106
  jdJumpConfigUrl(detail, logEventInfo = {}) {
108
107
  const { configDataType, configDataValue } = detail;
109
108
  switch (configDataType) {
110
109
  case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
111
110
  this.jdJumpToShopCategory({
112
111
  ...configDataValue,
113
112
  logEventInfo,
114
113
  });
115
114
  break;
116
115
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
117
116
  if (logEventInfo?.jsonParam?.logBaseInfo?.mInfo) {
118
117
  logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds;
119
118
  }
120
119
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo);
121
120
  break;
122
121
  case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
123
122
  this.jdJumpToWeb(
124
123
  `${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
125
124
  {},
126
125
  );
127
126
  break;
128
127
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
129
128
  if (isJdAndHarmonyDevice && isNewHarmonyShop && jdAppVersionStr === '15.1.70') {
130
129
  const baseInfo = {
131
130
  shopId: global.info.queryInfo.shopId,
132
131
  venderId: global.info.queryInfo.venderId,
133
132
  };
134
133
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
135
134
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
136
135
  console.log('jd web 获取店铺分类链接解析后的参数结果', getShopSearchParams);
137
136
  let openAppParams =
138
137
  typeof getShopSearchParams === 'boolean'
139
138
  ? { categoryId: '', ...baseInfo }
140
139
  : getShopSearchParams;
141
140
  const getInfo = openAppParams['categoryId']
142
141
  ? { ...openAppParams, cateId: openAppParams['categoryId'] }
143
142
  : openAppParams;
144
143
  console.log('处理后的参数', objectToUrlEncode(getInfo));
145
144
  this.jdJumpToWeb(
146
145
  `${this.jumpWebUrl.shopSearch}?${objectToUrlEncode(getInfo)}`,
147
146
  logEventInfo,
148
147
  );
149
148
  } else {
150
149
  const getInfo = configDataValue['cid']
151
150
  ? { ...baseInfo, ...configDataValue, cateId: configDataValue.cid, searchType: '5' }
152
151
  : { ...baseInfo, ...configDataValue };
153
152
  this.jdJumpToWeb(
154
153
  `${this.jumpWebUrl.shopSearch}?${objectToUrlEncode(getInfo)}`,
155
154
  logEventInfo,
156
155
  );
157
156
  }
158
157
  } else {
159
158
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
160
159
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
161
160
  console.log('jd web 获取店铺分类链接解析后的参数结果', getShopSearchParams);
162
161
  getShopSearchParams &&
163
162
  this.jdJumpToShopSearch(
164
163
  Object.assign({}, getShopSearchParams, {
165
164
  logEventInfo,
166
165
  }),
167
166
  );
168
167
  } else {
169
168
  this.jdJumpToShopSearch(
170
169
  configDataValue['cid']
171
170
  ? Object.assign(
172
171
  {},
173
172
  {
174
173
  shopId: global.info.queryInfo.shopId,
175
174
  categoryId: configDataValue.cid,
176
175
  searchType: '5',
177
176
  logEventInfo,
178
177
  },
179
178
  )
180
179
  : {
181
180
  shopId: global.info.queryInfo.shopId,
182
181
  logEventInfo,
183
182
  },
184
183
  );
185
184
  }
186
185
  }
187
186
  break;
188
187
  case LinkConfigType.CONFIG_TYPE_MEMBER:
189
188
  if (isAppHomeForMarketPage) {
190
189
  this.jdJumpToBottomTabBrandMember({
191
190
  logEventInfo,
192
191
  });
193
192
  } else {
194
193
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
195
194
  const getShopMemberParams = this.jdOpenAppParams(configDataValue.clickUrl);
196
195
  getShopMemberParams &&
197
196
  this.jdJumpToShopMember(
198
197
  Object.assign({}, getShopMemberParams, {
199
198
  logEventInfo,
200
199
  }),
201
200
  );
202
201
  } else {
203
202
  this.jdJumpToShopMember({
204
203
  shopId: global.info.queryInfo.shopId,
205
204
  venderId: configDataValue.shopDetail,
206
205
  logEventInfo,
207
206
  });
208
207
  }
209
208
  }
210
209
  break;
211
210
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
212
211
  if (this.isNewHarmony()) {
213
212
  const url = `${domain.sale}/m/h5/${configDataValue.data}.html`;
214
213
  this.jdJumpToWeb(url, logEventInfo);
215
214
  } else {
216
215
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
217
216
  const getShopActivityParams = this.jdOpenAppParams(configDataValue.clickUrl);
218
217
  getShopActivityParams &&
219
218
  this.jdJumpToShopActivity(
220
219
  Object.assign({}, getShopActivityParams, {
221
220
  logEventInfo,
222
221
  }),
223
222
  );
224
223
  } else if (configDataValue['projectId']) {
225
224
  this.jdJumpToShopActivity({
226
225
  projectId: configDataValue['projectId'],
227
226
  configDataValue,
228
227
  logEventInfo,
229
228
  });
230
229
  }
231
230
  }
232
231
  break;
233
232
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
234
233
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
235
234
  const _url = configDataValue.linkUrl;
236
235
  if (
237
236
  _url.indexOf('to=') === -1 &&
238
237
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
239
238
  ) {
240
239
  const _shopId = _url.match(/\d+/g)[0];
241
240
  this.jdJumpToShopHome({
242
241
  shopId: `${_shopId}`,
243
242
  logEventInfo,
244
243
  });
245
244
  } else if (this.isOpenJdAppUrl(_url)) {
246
245
  const getOpenAppParams = this.jdOpenAppParams(_url);
247
246
  console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams);
248
247
  if (getOpenAppParams) {
249
248
  let _changeOpenAppParams = getOpenAppParams;
250
249
  if (isAppHomeForMarketPage) {
251
250
  const { operation, ...otherOpenAppParams } = getOpenAppParams;
252
251
  if (operation && operation === 'jumpTabInner') {
253
252
  _changeOpenAppParams = otherOpenAppParams;
254
253
  }
255
254
  }
256
255
  this.jdNavigateToNative(
257
256
  Object.assign({}, _changeOpenAppParams, {
258
257
  logEventInfo,
259
258
  }),
260
259
  );
261
260
  }
262
261
  } else {
263
262
  this.jdJumpToWeb(_url, logEventInfo);
264
263
  }
265
264
  break;
266
265
  }
267
266
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
268
267
  this.jdJumpToShopDetail({
269
268
  venderId: global.info.queryInfo.venderId,
270
269
  shopId: global.info.queryInfo.shopId,
271
270
  logEventInfo,
272
271
  });
273
272
  break;
274
273
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
275
274
  this.jdJumpToShopHome({
276
275
  ...configDataValue,
277
276
  logEventInfo,
278
277
  });
279
278
  break;
280
279
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
281
280
  break;
282
281
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
283
282
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
284
283
  const getShoppingGuideParams = this.jdOpenAppParams(configDataValue.clickUrl);
285
284
  getShoppingGuideParams &&
286
285
  this.jdJumpToShopActivity(
287
286
  Object.assign({}, getShoppingGuideParams, {
288
287
  logEventInfo,
289
288
  }),
290
289
  );
291
290
  }
292
291
  break;
293
292
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
294
293
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '');
295
294
  const search = linkUrl.match(/\?.+/);
296
295
  if (search) {
297
296
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
298
297
  parseQueryUrlString(linkUrl);
299
298
  try {
300
299
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param);
301
300
  } catch (e) {
302
301
  console.warn('解析小程序 param 错误:', miniQueryData.param);
303
302
  }
304
303
  this.jdJumpToMiniProgram(miniQueryData);
305
304
  } else {
306
305
  console.warn('小程序地址错误:', linkUrl);
307
306
  }
308
307
  break;
309
308
  }
310
309
  case LinkConfigType.CONFIG_TYPE_SHOP_SEARCH: {
311
310
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
312
311
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
313
312
  console.log('jd web 获取店铺结果落地页链接解析后的参数结果', getShopSearchParams);
314
313
  getShopSearchParams &&
315
314
  this.jdJumpToShopSearch(
316
315
  Object.assign({}, getShopSearchParams, {
317
316
  logEventInfo,
318
317
  }),
319
318
  );
320
319
  } else {
321
320
  this.jdJumpToWeb(configDataValue.clickUrl, logEventInfo);
322
321
  }
323
322
  break;
324
323
  }
325
324
  default:
326
325
  }
327
326
  }
328
327
 
329
328
  isNewHarmony() {
330
329
  return isJdAndHarmonyDevice && isNewHarmonyShop;
331
330
  }
332
331
 
333
332
  jdNavigateToNative(
334
333
  params: object,
335
334
  url = 'openapp.jdmobile://virtual',
336
335
  successBack?: functionType | null,
337
336
  failBack?: functionType | null,
338
337
  ) {
339
338
  console.log('[降级H5] jdNavigateToNative web.jd:', params);
340
339
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams = Object.assign(
341
340
  {},
342
341
  {
343
342
  sourceValue: 'sourceValue_jshopModuleWeb',
344
343
  sourceType: 'sourceType_jshopModuleWeb',
345
344
  param: {},
346
345
  },
347
346
  params,
348
347
  );
349
348
  const { logEventInfo, ...otherParams } = getResParams;
350
349
  console.log('jd web 获取open协议参数 jdNavigateToNative params: ', getResParams);
351
350
  console.log('logEventInfo params: ', logEventInfo);
352
351
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
353
352
  this.clickEventLog(logEventInfo || getResParams)
354
353
  .then(() => {
355
354
  if (typeof successBack === 'function') {
356
355
  successBack(getResParams);
357
356
  } else {
358
357
  if (this.isNewHarmony() && params.operation === 'jumpTabInner') {
359
358
  if (params.jumpTab) {
360
359
  JumpTabBarInCurrentShop({ position: 'top', item: params.jumpTab });
361
360
  } else if (params.jumpBottomTab) {
362
361
  JumpTabBarInCurrentShop({ position: 'bottom', item: params.jumpBottomTab });
363
362
  } else {
364
363
  console.log('[降级H5] 跳转异常 params:', params);
365
364
  }
366
365
  } else if (
367
366
  this.isNewHarmony() &&
368
367
  (params.operation === 'jumpBottomTabMember' || params.des === 'jshopMember')
369
368
  ) {
370
369
  JumpTabBarInCurrentShop({ position: 'bottom', item: 'brandMember' });
371
370
  } else {
372
371
  try {
373
372
  const paramsStr = JSON.stringify(otherParams);
374
373
  console.log('跳转web jd open协议', `${url}?params=${paramsStr}`);
375
374
  window.location.href = `${url}?params=${paramsStr}`;
376
375
  } catch (e) {
377
376
  console.log('跳转异常', e);
378
377
  }
379
378
  }
380
379
  }
381
380
  })
382
381
  .catch(() => {
383
382
  typeof failBack === 'function' && failBack(getResParams);
384
383
  });
385
384
  }
386
385
 
387
386
  clickEventLog(opts: JumpEventReportInterFace.OptEventLogParams = {}, reportKey = 'click') {
388
387
  const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts;
389
388
  if (eventId && jsonParam) {
390
389
  const { etModelInfo, logBaseInfo } = jsonParam;
391
390
  let getJsonParam = {};
392
391
  if (etModelInfo && logBaseInfo) {
393
392
  getJsonParam = logBaseInfo;
394
393
  } else {
395
394
  if (Array.isArray(jsonParam)) {
396
395
  getJsonParam = jsonParam;
397
396
  } else {
398
397
  getJsonParam = Object.assign(
399
398
  {},
400
399
  {
401
400
  shopid: global.info.queryInfo?.shopId,
402
401
  },
403
402
  jsonParam,
404
403
  );
405
404
  }
406
405
  }
407
406
  if (
408
407
  reportKey === 'exposure' &&
409
408
  /^TerminatorNew/.test(eventId) &&
410
409
  !Array.isArray(getJsonParam)
411
410
  ) {
412
411
  getJsonParam = [getJsonParam];
413
412
  }
414
413
  const webLogParams = {
415
414
  isExpo: reportKey === 'exposure',
416
415
  eid: eventId,
417
416
  elevel: eventLevel,
418
417
  jsonParam: JSON.stringify(getJsonParam),
419
418
  etModel: JSON.stringify(etModelInfo || {}),
420
419
  pageId: this.logPageId,
421
420
  pageParam: this.logPageParamStr,
422
421
  ...otherParams,
423
422
  };
424
423
  return /click|exposure/.test(reportKey)
425
424
  ? reportClick(webLogParams)
426
425
  : reportToCart(opts, webLogParams);
427
426
  } else {
428
427
  console.log('暂无埋点参数eventId和eventParam');
429
428
  return Promise.resolve(false);
430
429
  }
431
430
  }
432
431
 
433
432
  exposureEventLog(opts) {
434
433
  return global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
435
434
  ? this.clickEventLog(
436
435
  {
437
436
  ...opts,
438
437
  exposureState: true,
439
438
  },
440
439
  'exposure',
441
440
  )
442
441
  : Promise.resolve(false);
443
442
  }
443
+ import { JdJumpJdApp } from './jdJumpJdApp';
444
444
  isAppHomeForMarketPage,
445
445
  isJdAndHarmonyDevice,
446
446
  isNewHarmonyShop,
447
447
  parseQueryUrlString,
448
448
  objectToUrlEncode,
449
449
  routerInfo: {
450
450
  params: {},
451
451
  },
452
452
  nativeEvent: null,
453
453
  jumpConfig: {
454
454
  venderId: null,
455
455
  shopId: null,
456
456
  sourceValue: '',
457
457
  sourceType: 'App-H5',
458
458
  activityType: 'shopx',
459
459
  moduleId: 'none',
460
460
  entrance: 'none',
461
461
  },
462
462
  logPageParamStr: '',
463
463
  public logPageId: string;
464
464
  public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig;
465
465
  constructor(opt = {}) {
466
466
  super(opt);
467
467
  this.getConfig(opt);
468
468
  }
469
469
  getConfig(opt = {}) {
470
470
  return Object.assign(this, {}, defaultConfig, opt);
471
471
  }
472
472
  updateInfo(routerInfo, logPname = LogPnameInfo.HOME, pageId = LogPageIdInfo.APP) {
473
473
  this.logPageId = pageId;
474
474
  this.routerInfo = routerInfo;
475
475
  this.jumpConfig = Object.assign({}, this.jumpConfig, routerInfo.params);
476
476
  this.logPname = logPname;
477
477
  }
478
478
  reportInfoPv(
479
479
  pageId = LogPageIdInfo.APP,
480
480
  opt: {
481
481
  pageParam?: any;
482
482
  } = {},
483
483
  ) {
484
484
  const { pageParam, ...otherOpts } = opt;
485
485
  const pageParamStr = typeof pageParam === 'object' ? JSON.stringify(pageParam) : pageParam;
486
486
  this.logPageParamStr = pageParamStr ? pageParamStr : this.creatParamToLogStr(this.jumpConfig)
487
487
  .replace(/moduleId/, 'JumpmoduleID')
488
488
  .replace(/entrance/, 'Jumpentrance');
489
489
  reportPV({
490
490
  pageId,
491
491
  pageParam: this.logPageParamStr,
492
492
  ...otherOpts,
493
493
  });
494
494
  }
495
495
 
496
496
  jdJumpToDongDongChatGroup(groupId, source = '4') {
497
497
  this.jdNavigateToNative({
498
498
  category: 'jump',
499
499
  des: 'dongdong_group_chat',
500
500
  source: source,
501
501
  groupId: `${groupId}`,
502
502
  });
503
503
  }
504
504
 
505
505
  jdJumpToWeb(
506
506
  url,
507
507
  logEventInfo,
508
508
  successBack?: functionType | undefined,
509
509
  failBack?: functionType | undefined,
510
510
  ) {
511
511
  console.log('jd web', this.isOpenJdAppUrl(url), url);
512
512
  if (this.isOpenJdAppUrl(url)) {
513
513
  const getOpenAppParams = this.jdOpenAppParams(url);
514
514
  console.log('jd web 获取自定义openApp链接解析后的参数结果', getOpenAppParams);
515
515
  if (getOpenAppParams) {
516
516
 
517
517
  const { useEncodeParams, ...otherLogInfo } = logEventInfo || {};
518
518
  this.jdNavigateToNative(
519
519
  Object.assign({}, getOpenAppParams, {
520
520
  logEventInfo: otherLogInfo,
521
521
  useEncodeParams: Boolean(useEncodeParams),
522
522
  }),
523
523
  );
524
524
  }
525
525
  } else {
526
526
  let _getLastUrl = url;
527
527
  if (/shop\.m\.jd\.com|pages\.jd\.com/.test(_getLastUrl)) {
528
528
  const getUrlSearchParamState = _getLastUrl.indexOf('?') !== -1;
529
529
  if (!/jwebprog=0/.test(_getLastUrl)) {
530
530
  _getLastUrl = `${_getLastUrl}${getUrlSearchParamState ? '&' : '?'}jwebprog=0`;
531
531
  }
532
532
  if (global.info.sysInfo?.isJdTabletDevice && !/device=tablet/.test(_getLastUrl)) {
533
533
  _getLastUrl = `${_getLastUrl}${getUrlSearchParamState ? '&' : '?'}device=tablet`;
534
534
  }
535
535
  }
536
536
  super.jdJumpToWeb(
537
537
  _getLastUrl,
538
538
  {
539
539
  ...logEventInfo,
540
540
  },
541
541
  successBack,
542
542
  failBack,
543
543
  );
544
544
  }
545
545
  }
546
546
 
547
547
  jdJumpToWebInner(url, logEventInfo) {
548
548
  this.jdJumpToWeb(url, logEventInfo);
549
549
  }
550
550
 
551
551
  jdJumpConfigUrl(detail, logEventInfo = {}) {
552
552
  const { configDataType, configDataValue } = detail;
553
553
  switch (configDataType) {
554
554
  case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
555
555
  this.jdJumpToShopCategory({
556
556
  ...configDataValue,
557
557
  logEventInfo,
558
558
  });
559
559
  break;
560
560
  case LinkConfigType.CONFIG_TYPE_SKU_LIST:
561
561
  if (logEventInfo?.jsonParam?.logBaseInfo?.mInfo) {
562
562
  logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds;
563
563
  }
564
564
  this.jdJumpToProduct(configDataValue.skuIds, logEventInfo);
565
565
  break;
566
566
  case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
567
567
  this.jdJumpToWeb(
568
568
  `${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
569
569
  {},
570
570
  );
571
571
  break;
572
572
  case LinkConfigType.CONFIG_TYPE_CATEGORY:
573
573
  if (isJdAndHarmonyDevice && isNewHarmonyShop && jdAppVersionStr === '15.1.70') {
574
574
  const baseInfo = {
575
575
  shopId: global.info.queryInfo.shopId,
576
576
  venderId: global.info.queryInfo.venderId,
577
577
  };
578
578
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
579
579
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
580
580
  console.log('jd web 获取店铺分类链接解析后的参数结果', getShopSearchParams);
581
581
  let openAppParams =
582
582
  typeof getShopSearchParams === 'boolean'
583
583
  ? { categoryId: '', ...baseInfo }
584
584
  : getShopSearchParams;
585
585
  const getInfo = openAppParams['categoryId']
586
586
  ? { ...openAppParams, cateId: openAppParams['categoryId'] }
587
587
  : openAppParams;
588
588
  console.log('处理后的参数', objectToUrlEncode(getInfo));
589
589
  this.jdJumpToWeb(
590
590
  `${this.jumpWebUrl.shopSearch}?${objectToUrlEncode(getInfo)}`,
591
591
  logEventInfo,
592
592
  );
593
593
  } else {
594
594
  const getInfo = configDataValue['cid']
595
595
  ? { ...baseInfo, ...configDataValue, cateId: configDataValue.cid, searchType: '5' }
596
596
  : { ...baseInfo, ...configDataValue };
597
597
  this.jdJumpToWeb(
598
598
  `${this.jumpWebUrl.shopSearch}?${objectToUrlEncode(getInfo)}`,
599
599
  logEventInfo,
600
600
  );
601
601
  }
602
602
  } else {
603
603
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
604
604
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
605
605
  console.log('jd web 获取店铺分类链接解析后的参数结果', getShopSearchParams);
606
606
  getShopSearchParams &&
607
607
  this.jdJumpToShopSearch(
608
608
  Object.assign({}, getShopSearchParams, {
609
609
  logEventInfo,
610
610
  }),
611
611
  );
612
612
  } else {
613
613
  this.jdJumpToShopSearch(
614
614
  configDataValue['cid']
615
615
  ? Object.assign(
616
616
  {},
617
617
  {
618
618
  shopId: global.info.queryInfo.shopId,
619
619
  categoryId: configDataValue.cid,
620
620
  searchType: '5',
621
621
  logEventInfo,
622
622
  },
623
623
  )
624
624
  : {
625
625
  shopId: global.info.queryInfo.shopId,
626
626
  logEventInfo,
627
627
  },
628
628
  );
629
629
  }
630
630
  }
631
631
  break;
632
632
  case LinkConfigType.CONFIG_TYPE_MEMBER:
633
633
  if (isAppHomeForMarketPage) {
634
634
  this.jdJumpToBottomTabBrandMember({
635
635
  logEventInfo,
636
636
  });
637
637
  } else {
638
638
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
639
639
  const getShopMemberParams = this.jdOpenAppParams(configDataValue.clickUrl);
640
640
  getShopMemberParams &&
641
641
  this.jdJumpToShopMember(
642
642
  Object.assign({}, getShopMemberParams, {
643
643
  logEventInfo,
644
644
  }),
645
645
  );
646
646
  } else {
647
647
  this.jdJumpToShopMember({
648
648
  shopId: global.info.queryInfo.shopId,
649
649
  venderId: configDataValue.shopDetail,
650
650
  logEventInfo,
651
651
  });
652
652
  }
653
653
  }
654
654
  break;
655
655
  case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
656
656
  if (this.isNewHarmony()) {
657
657
  const url = `${domain.sale}/m/h5/${configDataValue.data}.html`;
658
658
  this.jdJumpToWeb(url, logEventInfo);
659
659
  } else {
660
660
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
661
661
  const getShopActivityParams = this.jdOpenAppParams(configDataValue.clickUrl);
662
662
  getShopActivityParams &&
663
663
  this.jdJumpToShopActivity(
664
664
  Object.assign({}, getShopActivityParams, {
665
665
  logEventInfo,
666
666
  }),
667
667
  );
668
668
  } else if (configDataValue['projectId']) {
669
669
  this.jdJumpToShopActivity({
670
670
  projectId: configDataValue['projectId'],
671
671
  configDataValue,
672
672
  logEventInfo,
673
673
  });
674
674
  }
675
675
  }
676
676
  break;
677
677
  case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
678
678
  case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
679
679
  const _url = configDataValue.linkUrl;
680
680
  if (
681
681
  _url.indexOf('to=') === -1 &&
682
682
  _url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
683
683
  ) {
684
684
  const _shopId = _url.match(/\d+/g)[0];
685
685
  this.jdJumpToShopHome({
686
686
  shopId: `${_shopId}`,
687
687
  logEventInfo,
688
688
  });
689
689
  } else if (this.isOpenJdAppUrl(_url)) {
690
690
  const getOpenAppParams = this.jdOpenAppParams(_url);
691
691
  console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams);
692
692
  if (getOpenAppParams) {
693
693
  let _changeOpenAppParams = getOpenAppParams;
694
694
  if (isAppHomeForMarketPage) {
695
695
  const { operation, ...otherOpenAppParams } = getOpenAppParams;
696
696
  if (operation && operation === 'jumpTabInner') {
697
697
  _changeOpenAppParams = otherOpenAppParams;
698
698
  }
699
699
  }
700
700
  this.jdNavigateToNative(
701
701
  Object.assign({}, _changeOpenAppParams, {
702
702
  logEventInfo,
703
703
  }),
704
704
  );
705
705
  }
706
706
  } else {
707
707
  this.jdJumpToWeb(_url, logEventInfo);
708
708
  }
709
709
  break;
710
710
  }
711
711
  case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
712
712
  this.jdJumpToShopDetail({
713
713
  venderId: global.info.queryInfo.venderId,
714
714
  shopId: global.info.queryInfo.shopId,
715
715
  logEventInfo,
716
716
  });
717
717
  break;
718
718
  case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
719
719
  this.jdJumpToShopHome({
720
720
  ...configDataValue,
721
721
  logEventInfo,
722
722
  });
723
723
  break;
724
724
  case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
725
725
  break;
726
726
  case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
727
727
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
728
728
  const getShoppingGuideParams = this.jdOpenAppParams(configDataValue.clickUrl);
729
729
  getShoppingGuideParams &&
730
730
  this.jdJumpToShopActivity(
731
731
  Object.assign({}, getShoppingGuideParams, {
732
732
  logEventInfo,
733
733
  }),
734
734
  );
735
735
  }
736
736
  break;
737
737
  case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
738
738
  const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '');
739
739
  const search = linkUrl.match(/\?.+/);
740
740
  if (search) {
741
741
  const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
742
742
  parseQueryUrlString(linkUrl);
743
743
  try {
744
744
  miniQueryData.param = JSON.parse(<string>miniQueryData?.param);
745
745
  } catch (e) {
746
746
  console.warn('解析小程序 param 错误:', miniQueryData.param);
747
747
  }
748
748
  this.jdJumpToMiniProgram(miniQueryData);
749
749
  } else {
750
750
  console.warn('小程序地址错误:', linkUrl);
751
751
  }
752
752
  break;
753
753
  }
754
754
  case LinkConfigType.CONFIG_TYPE_SHOP_SEARCH: {
755
755
  if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
756
756
  const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
757
757
  console.log('jd web 获取店铺结果落地页链接解析后的参数结果', getShopSearchParams);
758
758
  getShopSearchParams &&
759
759
  this.jdJumpToShopSearch(
760
760
  Object.assign({}, getShopSearchParams, {
761
761
  logEventInfo,
762
762
  }),
763
763
  );
764
764
  } else {
765
765
  this.jdJumpToWeb(configDataValue.clickUrl, logEventInfo);
766
766
  }
767
767
  break;
768
768
  }
769
769
  default:
770
770
  }
771
771
  }
772
772
 
773
773
  isNewHarmony() {
774
774
  return isJdAndHarmonyDevice && isNewHarmonyShop;
775
775
  }
776
776
 
777
777
  jdNavigateToNative(
778
778
  params: object,
779
779
  url = 'openapp.jdmobile://virtual',
780
780
  successBack?: functionType | null,
781
781
  failBack?: functionType | null,
782
782
  ) {
783
783
  console.log('[降级H5] jdNavigateToNative web.jd:', params);
784
784
  const getResParams: JumpEventReportInterFace.JdMiniJumpParams = Object.assign(
785
785
  {},
786
786
  {
787
787
  sourceValue: 'sourceValue_jshopModuleWeb',
788
788
  sourceType: 'sourceType_jshopModuleWeb',
789
789
  param: {},
790
790
  },
791
791
  params,
792
792
  );
793
793
  const { logEventInfo, useEncodeParams, ...otherParams } = getResParams;
794
794
  console.log('jd web 获取open协议参数 jdNavigateToNative params: ', getResParams);
795
795
  console.log('logEventInfo params: ', logEventInfo);
796
796
  global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
797
797
  this.clickEventLog(logEventInfo || getResParams)
798
798
  .then(() => {
799
799
  if (typeof successBack === 'function') {
800
800
  successBack(getResParams);
801
801
  } else {
802
802
  if (this.isNewHarmony() && params.operation === 'jumpTabInner') {
803
803
  if (params.jumpTab) {
804
804
  JumpTabBarInCurrentShop({ position: 'top', item: params.jumpTab, ...params });
805
805
  } else if (params.jumpBottomTab) {
806
806
  JumpTabBarInCurrentShop({ position: 'bottom', item: params.jumpBottomTab, ...params });
807
807
  } else {
808
808
  console.log('[降级H5] 跳转异常 params:', params);
809
809
  }
810
810
  } else if (
811
811
  this.isNewHarmony() &&
812
812
  (params.operation === 'jumpBottomTabMember' || params.des === 'jshopMember')
813
813
  ) {
814
814
  JumpTabBarInCurrentShop({ position: 'bottom', item: 'brandMember', ...params });
815
815
  } else {
816
816
  try {
817
817
  const paramsStr = JSON.stringify(otherParams);
818
818
  console.log('跳转web jd open协议', `${url}?params=${paramsStr}`);
819
819
  window.location.href =
820
820
  isJdAndHarmonyDevice || useEncodeParams
821
821
  ? `${url}?params=${encodeURIComponent(paramsStr)}`
822
822
  : `${url}?params=${paramsStr}`;
823
823
  } catch (e) {
824
824
  draBusinessCustomReport({
825
825
  eventName: 'entryProtocol',
826
826
  errorName: 'shop_jdNavigateToNative_error',
827
827
  errorMessage: '跳转web jd open协议发生错误',
828
828
  extraData: JSON.stringify({
829
829
  url,
830
830
  isJdApp,
831
831
  jdAppVersion: jdAppVersionStr,
832
832
  ...otherParams,
833
833
  }),
834
834
  });
835
835
  }
836
836
  }
837
837
  }
838
838
  })
839
839
  .catch(() => {
840
840
  typeof failBack === 'function' && failBack(getResParams);
841
841
  });
842
842
  }
843
843
 
844
844
  clickEventLog(opts: JumpEventReportInterFace.OptEventLogParams = {}, reportKey = 'click') {
845
845
  const { eventId, spmAllCode, spmCodeForCD, jsonParam, eventLevel = 3, ...otherParams } = opts;
846
846
  if ((eventId || spmAllCode || spmCodeForCD) && jsonParam) {
847
847
  const { etModelInfo, logBaseInfo } = jsonParam;
848
848
  let getJsonParam = {};
849
849
  if (etModelInfo && logBaseInfo) {
850
850
  getJsonParam = logBaseInfo;
851
851
  } else {
852
852
  if (Array.isArray(jsonParam)) {
853
853
  getJsonParam = jsonParam;
854
854
  } else {
855
855
  getJsonParam = Object.assign(
856
856
  {},
857
857
  {
858
858
  shopid: global.info.queryInfo?.shopId,
859
859
  },
860
860
  jsonParam,
861
861
  );
862
862
  }
863
863
  }
864
864
  if (
865
865
  reportKey === 'exposure' &&
866
866
  /^TerminatorNew/.test(eventId) &&
867
867
  !Array.isArray(getJsonParam)
868
868
  ) {
869
869
  getJsonParam = [getJsonParam];
870
870
  }
871
871
  const webLogParams = {
872
872
  isExpo: reportKey === 'exposure',
873
873
  eid: eventId,
874
874
  elevel: eventLevel,
875
875
  jsonParam: JSON.stringify(getJsonParam),
876
876
  etModel: JSON.stringify(etModelInfo || {}),
877
877
  pageId: this.logPageId,
878
878
  pageParam: this.logPageParamStr,
879
879
  spmAllCode,
880
880
  spmCodeForCD,
881
881
  ...otherParams,
882
882
  };
883
883
  return /click|exposure/.test(reportKey)
884
884
  ? reportClick(webLogParams)
885
885
  : reportToCart(opts, webLogParams);
886
886
  } else {
887
887
  console.log('暂无埋点参数eventId和eventParam');
888
888
  return Promise.resolve(false);
889
889
  }
890
890
  }
891
891
 
892
892
  exposureEventLog(opts) {
893
893
  return global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
894
894
  ? this.clickEventLog(
895
895
  {
896
896
  ...opts,
897
897
  exposureState: true,
898
898
  },
899
899
  'exposure',
900
900
  )
901
901
  : Promise.resolve(false);
902
902
  }