@conecli/cone-render 0.8.19 → 0.8.20-beta.2

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 (183) hide show
  1. package/README.md +7 -1
  2. package/dist/api/index.ts +1 -1
  3. package/dist/assets/icon_blue_info.svg +1 -0
  4. package/dist/common/const.ts +1 -1
  5. package/dist/common/environmentType.ts +1 -0
  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/isvStorage/index.h5.ts +1 -0
  11. package/dist/common/isvStorage/index.ts +1 -0
  12. package/dist/common/jdplayerSdk.ts +1 -0
  13. package/dist/common/jssdk.ts +1 -0
  14. package/dist/common/pageType.ts +1 -0
  15. package/dist/common/sgmCustomCode.ts +1 -0
  16. package/dist/common/token/const.ts +1 -0
  17. package/dist/common/token/index.h5.ts +1 -0
  18. package/dist/common/token/index.ts +1 -0
  19. package/dist/common/token/token.jd.ts +1 -0
  20. package/dist/common/token/token.ts +1 -0
  21. package/dist/common/token/token.wxapp.ts +1 -0
  22. package/dist/common/wxappApi.jd.ts +1 -0
  23. package/dist/common/wxappApi.ts +1 -1
  24. package/dist/components/ErrorBoundary.tsx +1 -1
  25. package/dist/components/base/CommonFloorHead/index.module.scss +126 -111
  26. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  27. package/dist/components/base/CountDown/index.module.scss +49 -44
  28. package/dist/components/base/CountDown/index.tsx +1 -1
  29. package/dist/components/base/CustomScrollView/index.jd.tsx +1 -0
  30. package/dist/components/base/CustomScrollView/index.module.scss +7 -0
  31. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  32. package/dist/components/base/CustomVideo/common.ts +1 -0
  33. package/dist/components/base/CustomVideo/const.ts +1 -0
  34. package/dist/components/base/CustomVideo/index.module.scss +40 -64
  35. package/dist/components/base/CustomVideo/index.tsx +1 -1
  36. package/dist/components/base/Dialog/index.module.scss +22 -2
  37. package/dist/components/base/Dialog/index.tsx +1 -1
  38. package/dist/components/base/Exposure/index.h5.tsx +1 -1
  39. package/dist/components/base/ExposureSmart/const.ts +1 -0
  40. package/dist/components/base/ExposureSmart/index.h5.module.scss +30 -6
  41. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  42. package/dist/components/base/ExposureSmart/index.module.scss +20 -9
  43. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  44. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  45. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  46. package/dist/components/base/InViewRender/index.tsx +1 -1
  47. package/dist/components/base/InViewRender/index.weapp.tsx +1 -1
  48. package/dist/components/base/ItemViewExposureSmart/index.module.scss +8 -0
  49. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -0
  50. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  51. package/dist/components/base/LazyLayoutLoad/index.weapp.tsx +1 -1
  52. package/dist/components/base/LazyLoadImage/const.ts +1 -1
  53. package/dist/components/base/LazyLoadImage/index.h5.module.scss +24 -20
  54. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  55. package/dist/components/base/MobileCommonHeader/index.module.scss +17 -0
  56. package/dist/components/base/MobileCommonHeader/index.tsx +1 -0
  57. package/dist/components/base/NetworkDataError/const.ts +1 -1
  58. package/dist/components/base/NetworkDataError/index.module.scss +128 -69
  59. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  60. package/dist/components/base/Price/{const.ts → Base/const.ts} +0 -0
  61. package/dist/components/base/Price/Base/index.module.scss +148 -0
  62. package/dist/components/base/Price/Base/index.tsx +1 -0
  63. package/dist/components/base/Price/Double/index.module.scss +190 -0
  64. package/dist/components/base/Price/Double/index.tsx +1 -0
  65. package/dist/components/base/Price/index.tsx +1 -1
  66. package/dist/components/base/ShopLeGaoTag/index.h5.module.scss +35 -0
  67. package/dist/components/base/ShopLeGaoTag/index.h5.tsx +1 -0
  68. package/dist/components/base/ShopLeGaoTag/index.module.scss +33 -0
  69. package/dist/components/base/ShopLeGaoTag/index.tsx +1 -0
  70. package/dist/components/base/Skeleton/index.tsx +1 -1
  71. package/dist/components/debug/DebugLayout/index.module.scss +67 -0
  72. package/dist/components/debug/DebugLayout/index.tsx +1 -0
  73. package/dist/components/debug/DebugLayout/utils.ts +1 -0
  74. package/dist/components/decorate/DecorateFloorModule/index.module.scss +32 -2
  75. package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
  76. package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
  77. package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
  78. package/dist/components/floorItem.jd.tsx +1 -0
  79. package/dist/components/floorItem.tsx +1 -1
  80. package/dist/components/floorItem.weapp.tsx +1 -1
  81. package/dist/components/isv/Floor/index.tsx +1 -1
  82. package/dist/components/remoteFloorItem.tsx +1 -0
  83. package/dist/interface/common.ts +1 -1
  84. package/dist/interface/component.ts +1 -1
  85. package/dist/interface/jumpEventReport.ts +1 -1
  86. package/dist/interface/service.ts +1 -1
  87. package/dist/interface/utils.ts +1 -1
  88. package/dist/jumpEventReport/base.ts +1 -1
  89. package/dist/jumpEventReport/const.ts +1 -1
  90. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  91. package/dist/jumpEventReport/index.h5.ts +1 -1
  92. package/dist/jumpEventReport/index.jd.ts +1 -1
  93. package/dist/jumpEventReport/index.ts +1 -1
  94. package/dist/jumpEventReport/index.weapp.ts +1 -1
  95. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  96. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  97. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  98. package/dist/jumpEventReport/web/report.ts +1 -1
  99. package/dist/jumpEventReport/web.base.ts +1 -1
  100. package/dist/jumpEventReport/web.jd.ts +1 -1
  101. package/dist/jumpEventReport/web.jdb.ts +1 -0
  102. package/dist/jumpEventReport/web.jdjch.ts +1 -0
  103. package/dist/jumpEventReport/web.jxwxapp.ts +1 -0
  104. package/dist/jumpEventReport/web.pc.ts +1 -0
  105. package/dist/jumpEventReport/web.tjapp.ts +1 -0
  106. package/dist/jumpEventReport/web.tjm.ts +1 -0
  107. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  108. package/dist/language/en_US.json +231 -0
  109. package/dist/language/zh_CN.json +231 -0
  110. package/dist/language/zh_HK.json +231 -0
  111. package/dist/libs/taroAppReport.js +2 -2
  112. package/dist/modules/ContainerFloorList/index.h5.module.scss +66 -27
  113. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  114. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  115. package/dist/open/api/device.ts +1 -1
  116. package/dist/open/api/environment.ts +1 -1
  117. package/dist/open/api/index.ts +1 -1
  118. package/dist/open/api/jump/business.ts +1 -0
  119. package/dist/open/api/jump/index.ts +1 -0
  120. package/dist/open/api/jump/minPath.ts +1 -0
  121. package/dist/open/api/jump/side.ts +1 -0
  122. package/dist/open/api/jump/webUrl.ts +1 -0
  123. package/dist/open/api/jump copy.ts +1 -0
  124. package/dist/open/api/moduleUtil.ts +1 -1
  125. package/dist/open/api/request.ts +1 -0
  126. package/dist/open/api/shopMember.ts +1 -0
  127. package/dist/open/api/track.ts +1 -1
  128. package/dist/open/api/userToken.ts +1 -0
  129. package/dist/open/api/util.ts +1 -1
  130. package/dist/open/components/index.ts +1 -1
  131. package/dist/sass/app.h5.scss +294 -212
  132. package/dist/sass/base.scss +195 -137
  133. package/dist/service/bMallConst.ts +1 -0
  134. package/dist/service/bMallConst.weapp.ts +1 -0
  135. package/dist/service/fetchGateway.ts +1 -0
  136. package/dist/service/fetchGateway.weapp.ts +1 -0
  137. package/dist/service/fetchJsonp.ts +1 -0
  138. package/dist/service/http/colorSign.ts +1 -0
  139. package/dist/service/http/colorSign.weapp.ts +1 -0
  140. package/dist/service/http/const.ts +1 -0
  141. package/dist/service/http/h5Http.ts +1 -0
  142. package/dist/service/http/http.ts +1 -0
  143. package/dist/service/http/httpInterceptors.jd.ts +1 -0
  144. package/dist/service/http/httpInterceptors.ts +1 -0
  145. package/dist/service/http/index.h5.ts +1 -0
  146. package/dist/service/http/index.ts +1 -0
  147. package/dist/service/requestServer.h5.ts +1 -0
  148. package/dist/service/requestServer.ts +1 -0
  149. package/dist/service/requestServer.weapp.ts +1 -0
  150. package/dist/utils/connectNativeJsBridge.ts +1 -1
  151. package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
  152. package/dist/utils/draExceptionAndProfile.ts +1 -1
  153. package/dist/utils/h5Utils.ts +1 -1
  154. package/dist/utils/index.h5.ts +1 -1
  155. package/dist/utils/index.ts +1 -1
  156. package/dist/utils/index.weapp.ts +1 -1
  157. package/dist/utils/intersectionObserver.ts +1 -1
  158. package/dist/utils/jm-common.js +1 -1
  159. package/dist/utils/jumpExtMapUtil.h5.ts +1 -0
  160. package/dist/utils/jumpExtMapUtil.ts +1 -0
  161. package/dist/utils/priceUtils.js +1 -0
  162. package/dist/utils/ready.ts +1 -0
  163. package/dist/utils/sColor.js +1 -0
  164. package/dist/utils/sgmCodeUtils.ts +1 -0
  165. package/dist/utils/taroRenderUtil.ts +1 -0
  166. package/dist/utils/utils.ts +1 -1
  167. package/dist/wxapp/api/helper.js +1 -0
  168. package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
  169. package/dist/wxapp/common/user_info.js +1 -1
  170. package/dist/wxapp/components/launch-app/index.js +1 -0
  171. package/dist/wxapp/components/launch-app/index.json +5 -0
  172. package/dist/wxapp/components/launch-app/index.wxml +0 -0
  173. package/dist/wxapp/components/launch-app/index.wxss +0 -0
  174. package/dist/wxapp/components/subscribe-guider/helper.js +1 -0
  175. package/dist/wxapp/components/subscribe-guider/index.js +1 -0
  176. package/dist/wxapp/components/subscribe-guider/index.json +5 -0
  177. package/dist/wxapp/components/subscribe-guider/index.wxml +0 -0
  178. package/dist/wxapp/components/subscribe-guider/index.wxss +0 -0
  179. package/package.json +145 -114
  180. package/dist/components/base/Price/index.module.scss +0 -136
  181. package/dist/components/base/Skeleton/old.tsx +0 -1
  182. package/dist/customHooks/useDocumentVisibilitychange.ts +0 -1
  183. package/dist/open/api/jump.ts +0 -1
@@ -0,0 +1 @@
1
+ import Taro from '@tarojs/taro';
2
  UUID,
1
3
  isJdApp,
2
4
  jdAppVersionStr,
3
5
  isIosDevice,
4
6
  isPc,
5
7
  isJdAndIosDevice,
6
8
  isJdAndAndroidDevice,
7
9
  isJdAndHarmonyDevice,
8
10
  passSmartCouponInfoFunctionIdList,
9
11
  needFixClientValueToHarmonyFunctionIdList,
10
12
  clientVersion: isJdApp && jdAppVersionStr !== '' ? jdAppVersionStr : '11.0.0',
11
13
  client: isJdApp ? (isIosDevice ? 'apple' : 'android') : isPc ? 'pc' : 'wh5',
12
14
  screen: `${Math.ceil(window.screen?.width * devicePixelRatio)}*${Math.ceil(
13
15
  window.screen?.height * devicePixelRatio,
14
16
  )}`,
15
17
  area: '1_72_2799_0',
16
18
  uuid: UUID,
17
19
  const { area, realTimeArea } = areaInfo || {};
18
20
  area && area !== '' && (clientParams.area = area);
19
21
  realTimeArea && realTimeArea !== '' && (clientParams['realTimeArea'] = realTimeArea);
20
22
  console.warn(
21
23
  'cone-render中对外暴露fetchGateway收到原生端获取传来的四级地址信息',
22
24
  areaInfo,
23
25
  '更新后的接口底层信息',
24
26
  clientParams,
25
27
  );
26
28
  if (isH5 && (isJdAndIosDevice || isJdAndAndroidDevice)) {
27
29
  const smartCouponInfo = await getSmartCouponInfo();
28
30
  if (smartCouponInfo) {
29
31
  requestParams.smartCouponInfo = smartCouponInfo;
30
32
  }
31
33
  } else {
32
34
  console.warn('🚗 ~~ handleSmartCouponInfo ~~ 不支持的环境!');
33
35
  }
34
36
  functionId: string,
35
37
  body = {},
36
38
  options = {},
37
39
  requestOptions = {},
38
40
  const useBodyParams = { ...body };
39
41
  if (passSmartCouponInfoFunctionIdList.includes(functionId)) {
40
42
  await handleSmartCouponInfo(useBodyParams);
41
43
  }
42
44
  const params = Object.assign(
43
45
  {},
44
46
  {
45
47
  t: Date.now(),
46
48
  functionId,
47
49
  appid: 'shop_m_jd_com',
48
50
  body: JSON.stringify(useBodyParams),
49
51
  },
50
52
  clientParams,
51
53
  options,
52
54
  {
53
55
  area: clientParams.area,
54
56
  client: !isJdApp && options?.client ? options?.client : clientParams.client,
55
57
  clientVersion:
56
58
  !isJdApp && options?.clientVersion ? options?.clientVersion : clientParams.clientVersion,
57
59
  },
58
60
  );
59
61
  if (isJdAndHarmonyDevice && needFixClientValueToHarmonyFunctionIdList.includes(functionId)) {
60
62
  params.client = 'harmony';
61
63
  } else {
62
64
  }
63
65
  console.warn(
64
66
  'fetchGateway url:' + api.apiFunc + ',functionId:' + params.functionId,
65
67
  '底层默认的clientParams',
66
68
  clientParams,
67
69
  '下发的options',
68
70
  options,
69
71
  '最后params',
70
72
  params,
71
73
  );
72
74
  return http.post(api.apiFunc, params, requestOptions);
@@ -0,0 +1 @@
1
+ import Taro from '@tarojs/taro';
2
  clientVersion: '11.0.0',
1
3
  client: 'wh5',
2
4
  screen: `${Math.ceil(getSystemInfo?.screenWidth * devicePixelRatio)}*${Math.ceil(
3
5
  getSystemInfo?.screenHeight * devicePixelRatio,
4
6
  )}`,
5
7
  area: '1_72_2799_0',
6
8
  uuid: UUID,
7
9
  const { area, realTimeArea } = areaInfo || {};
8
10
  area && area !== '' && (clientParams.area = area);
9
11
  realTimeArea && realTimeArea !== '' && (clientParams['realTimeArea'] = realTimeArea);
10
12
  console.warn(
11
13
  'cone-render中对外暴露fetchGateway收到原生端获取传来的四级地址信息',
12
14
  areaInfo,
13
15
  '更新后的接口底层信息',
14
16
  clientParams,
15
17
  );
16
18
  functionId: string,
17
19
  body = {},
18
20
  options = {},
19
21
  requestOptions = {},
20
22
  const params = Object.assign(
21
23
  {},
22
24
  {
23
25
  t: Date.now(),
24
26
  functionId,
25
27
  appid: 'shop_m_jd_com',
26
28
  body: JSON.stringify(body),
27
29
  },
28
30
  clientParams,
29
31
  options,
30
32
  {
31
33
  area: clientParams.area,
32
34
  client: options?.client || clientParams.client,
33
35
  clientVersion: options?.clientVersion || clientParams.clientVersion,
34
36
  },
35
37
  );
36
38
  console.warn(
37
39
  'fetchGateway url:' + api.apiFunc + ',functionId:' + params.functionId,
38
40
  '底层默认的clientParams',
39
41
  clientParams,
40
42
  '下发的options',
41
43
  options,
42
44
  '最后params',
43
45
  params,
44
46
  );
45
47
  return http.post(api.apiFunc, params, requestOptions);
@@ -0,0 +1 @@
1
+ const defaultOptions = {
2
  timeout: 5000,
1
3
  jsonpCallback: 'callback',
2
4
  return `jsonp_${Date.now()}_${Math.ceil(Math.random() * 100000)}`
3
5
  try {
4
6
  delete window[functionName]
5
7
  } catch (e) {
6
8
  window[functionName] = undefined
7
9
  }
8
10
  const script = document.getElementById(scriptId)
9
11
  document.getElementsByTagName('head')[0].removeChild(script)
10
12
  const timeout =
11
13
 
12
14
  options.timeout != null ? options.timeout : defaultOptions.timeout
13
15
  const jsonpCallback =
14
16
 
15
17
  options.jsonpCallback != null
16
18
  ? options.jsonpCallback
17
19
  : defaultOptions.jsonpCallback
18
20
  let timeoutId: string | number | NodeJS.Timeout | undefined
19
21
  return new Promise((resolve, reject) => {
20
22
  const callbackFunction = generateCallbackFunction()
21
23
  window[callbackFunction] = function (response: any) {
22
24
  resolve({
23
25
  ok: true,
24
26
  json: function () {
25
27
  return Promise.resolve(response)
26
28
  },
27
29
  })
28
30
  if (timeoutId) clearTimeout(timeoutId)
29
31
  removeScript(jsonpCallback + '_' + callbackFunction)
30
32
  clearFunction(callbackFunction)
31
33
  }
32
34
  url += url.indexOf('?') === -1 ? '?' : '&'
33
35
  const jsonpScript = document.createElement('script')
34
36
  jsonpScript.setAttribute(
35
37
  'src',
36
38
  url + jsonpCallback + '=' + callbackFunction,
37
39
  )
38
40
  jsonpScript.id = jsonpCallback + '_' + callbackFunction
39
41
  document.getElementsByTagName('head')[0].appendChild(jsonpScript)
40
42
  timeoutId = setTimeout(() => {
41
43
  reject(new Error(`JSONP request to ${url} timed out`))
42
44
  clearFunction(callbackFunction)
43
45
  removeScript(jsonpCallback + '_' + callbackFunction)
44
46
  }, timeout)
45
47
  })
@@ -0,0 +1 @@
1
+ import { ServiceInterFace } from '../../interface';
2
  SHOP_VERIFY_CODE,
1
3
  PAGES_VERIFY_CODE,
2
4
  B2B_VERITY_CODE,
3
5
  PAGES_DOMAIN,
4
6
  B2BColorFunctionIdList,
5
7
  APPID,
6
8
  public fmInfo: {
7
9
  eid?: string;
8
10
  fp?: string;
9
11
  jsToken?: string;
10
12
  sdkToken?: string;
11
13
  };
12
14
  public api: ServiceInterFace.HttpApi;
13
15
  public paramsSignInstance: any;
14
16
  public paramsSignPagesInstance: any;
15
17
  public paramsSignBmallInstance: any;
16
18
  public isPageDomain: boolean;
17
19
  public initParamsSignInstance: any;
18
20
  public initJsTokenInstance: any;
19
21
  constructor() {
20
22
  this.api = api;
21
23
  this.isPageDomain = location?.hostname === PAGES_DOMAIN;
22
24
  this.paramsSignInstance = undefined;
23
25
  this.paramsSignPagesInstance = undefined;
24
26
  this.paramsSignBmallInstance = undefined;
25
27
  this.initParamsSignInstance = undefined;
26
28
  this.initJsTokenInstance = undefined;
27
29
  this.fmInfo = {};
28
30
  }
29
31
 
30
32
  _loadSingleJs(jsFileName, successCallback?, failCallback?) {
31
33
  const jsInfo = global.loadJsSdkList.find((item) => item?.fileName === jsFileName);
32
34
  if (jsInfo) {
33
35
  global
34
36
  .loadItemSdkPromise(jsInfo)
35
37
  .then(() => {
36
38
  typeof successCallback === 'function' && successCallback();
37
39
  })
38
40
  .catch(() => {
39
41
  console.info('业务发起接口请求前置加载js异常' + jsInfo?.src);
40
42
  typeof failCallback === 'function' && failCallback();
41
43
  });
42
44
  } else {
43
45
  typeof failCallback === 'function' && failCallback();
44
46
  }
45
47
  }
46
48
 
47
49
  _getMobileJsToken(): Promise<{
48
50
  ok: boolean;
49
51
  data?: any;
50
52
  error?: any;
51
53
  }> {
52
54
  return this._handleInitJsToken().then(() => {
53
55
  try {
54
56
  if (window?.getJsToken) {
55
57
  return new Promise((resolve) => {
56
58
  window.getJsToken(function (res) {
57
59
  console.log('JS token 获取结果', res);
58
60
  resolve({
59
61
  ok: true,
60
62
  data: res,
61
63
  });
62
64
  }, 600);
63
65
  });
64
66
  } else {
65
67
  console.log('没有识别到getJsToken全局方法');
66
68
  return Promise.resolve({
67
69
  ok: false,
68
70
  error: '没有识别到getJsToken全局方法',
69
71
  });
70
72
  }
71
73
  } catch (e) {
72
74
  console.log('获取指纹JS token 异常', e);
73
75
  return Promise.resolve({
74
76
  ok: false,
75
77
  error: e,
76
78
  });
77
79
  }
78
80
  });
79
81
  }
80
82
 
81
83
  async getFmInfo() {
82
84
  try {
83
85
  const { ok, data } = await this._getMobileJsToken();
84
86
  this.fmInfo = ok && data ? data : this.fmInfo;
85
87
  return this.fmInfo;
86
88
  } catch (e) {
87
89
  console.log('获取指纹信息异常', e);
88
90
  return this.fmInfo;
89
91
  }
90
92
  }
91
93
 
92
94
  _initSign() {
93
95
  this.paramsSignInstance = window.PSign
94
96
  ? window.PSign
95
97
  : window.ParamsSign
96
98
  ? this._initParamsSignInstance(SHOP_VERIFY_CODE)
97
99
  : null;
98
100
  this.paramsSignPagesInstance = window.ParamsSign
99
101
  ? this._initParamsSignInstance(PAGES_VERIFY_CODE)
100
102
  : null;
101
103
  this.paramsSignBmallInstance = window.ParamsSign
102
104
  ? this._initParamsSignInstance(B2B_VERITY_CODE)
103
105
  : null;
104
106
  }
105
107
 
106
108
  _initParamsSignInstance(appId) {
107
109
  return new window.ParamsSign({
108
110
  appId: appId,
109
111
  debug: false,
110
112
  preRequest: false,
111
113
  onSign: ({ code }) => {
112
114
  console.log('签名可用率监控', code);
113
115
  },
114
116
  onRequestTokenRemotely: ({ code, message }) => {
115
117
  console.log('算法接口可用率监控', code, message);
116
118
  },
117
119
  onRequestToken: ({ code, message }) => {
118
120
  console.log('token的可用率监控', code, message);
119
121
  },
120
122
  });
121
123
  }
122
124
 
123
125
  paramsSign(data) {
124
126
  try {
125
127
  return this._handleInitSign().then(() => {
126
128
  console.log('获取加签参数', data, this.paramsSignInstance);
127
129
  if (!data || typeof data !== 'object' || !this.paramsSignInstance) {
128
130
  return Promise.resolve(data);
129
131
  } else {
130
132
  const param: any = {
131
133
  appid: data.appid,
132
134
  client: data.client,
133
135
  clientVersion: data.clientVersion,
134
136
  functionId: data.functionId,
135
137
  t: data.t,
136
138
  sign: data?.sign,
137
139
  jsonp: data?.jsonp,
138
140
  };
139
141
  data && data.body && (param.body = sha256(data.body).toString());
140
142
  console.log(
141
143
  '获取加签前的参数处理',
142
144
  param,
143
145
  '获取下发data',
144
146
  data,
145
147
  '获取加签实例',
146
148
  this.paramsSignInstance,
147
149
  this.paramsSignPagesInstance,
148
150
  );
149
151
  return this._checkFunctionIdNeedSignForPages(data)
150
152
  ? this.paramsSignPagesInstance.sign(param)
151
153
  : this.paramsSignBmallInstance && B2BColorFunctionIdList.includes(param.functionId)
152
154
  ? this.paramsSignBmallInstance.sign(param)
153
155
  : this.paramsSignInstance.sign(param);
154
156
  }
155
157
  });
156
158
  } catch (e) {
157
159
  console.log('获取加签参数结果异常', e);
158
160
  return Promise.resolve(data);
159
161
  }
160
162
  }
161
163
 
162
164
  _checkFunctionIdNeedSignForPages(data) {
163
165
  const { appid, functionId } = data;
164
166
  return (
165
167
  this.isPageDomain &&
166
168
  this.paramsSignPagesInstance &&
167
169
  appid === APPID.PAGES_COLOR_APPID &&
168
170
  functionId
169
171
  );
170
172
  }
171
173
 
172
174
  _handleInitSign() {
173
175
  if (!this.initParamsSignInstance) {
174
176
  this.initParamsSignInstance = new Promise((resolve) => {
175
177
  if (window?.ParamsSign) {
176
178
  this._initSign();
177
179
  resolve({
178
180
  ok: true,
179
181
  msg: '加固js已加载',
180
182
  });
181
183
  } else if (window?.PAGE_DATA?.asyncLoadSecurityJs) {
182
184
  this._loadSingleJs(
183
185
  'securityJs',
184
186
  () => {
185
187
  this._initSign();
186
188
  resolve({
187
189
  ok: true,
188
190
  msg: '异步请求加固js成功加载',
189
191
  });
190
192
  },
191
193
  () => {
192
194
  resolve({
193
195
  ok: true,
194
196
  msg: '加固js加载异常',
195
197
  });
196
198
  },
197
199
  );
198
200
  } else {
199
201
  resolve({
200
202
  ok: true,
201
203
  msg: '加固js开关配置为false不加载',
202
204
  });
203
205
  }
204
206
  });
205
207
  }
206
208
  return this.initParamsSignInstance;
207
209
  }
208
210
 
209
211
  _handleInitJsToken() {
210
212
  if (!this.initJsTokenInstance) {
211
213
  this.initJsTokenInstance = new Promise((resolve) => {
212
214
  if (window?.getJsToken) {
213
215
  resolve({
214
216
  ok: true,
215
217
  msg: '指纹js已加载',
216
218
  });
217
219
  } else if (window?.PAGE_DATA?.asyncLoadMtkJs) {
218
220
  this._loadSingleJs(
219
221
  'mtkJs',
220
222
  () => {
221
223
  resolve({
222
224
  ok: true,
223
225
  msg: '异步请求指纹js成功加载',
224
226
  });
225
227
  },
226
228
  () => {
227
229
  resolve({
228
230
  ok: true,
229
231
  msg: '指纹js加载异常',
230
232
  });
231
233
  },
232
234
  );
233
235
  } else {
234
236
  resolve({
235
237
  ok: true,
236
238
  msg: '指纹js开关配置为false不加载',
237
239
  });
238
240
  }
239
241
  });
240
242
  }
241
243
  return this.initJsTokenInstance;
242
244
  }
@@ -0,0 +1 @@
1
+ import global from '../../common'
2
  WXAPP_VERIFY_CODE,
1
3
  WxappVerifyColorList
2
4
  public fmInfo: {
3
5
  eid?: string
4
6
  fp?: string
5
7
  jsToken?: string
6
8
  sdkToken?: string
7
9
  }
8
10
  constructor() {
9
11
  this.fmInfo = {}
10
12
  }
11
13
 
12
14
  async getFmInfo() {
13
15
  if (!this.fmInfo["eid"]) {
14
16
  try {
15
17
  const getFmRes = await global.wxAppFingerReportInstance.getFm();
16
18
  console.log("获取指纹信息", getFmRes);
17
19
  this.fmInfo = getFmRes;
18
20
  return this.fmInfo;
19
21
  } catch (e) {
20
22
  console.log("获取指纹信息异常", e);
21
23
  return this.fmInfo;
22
24
  }
23
25
  } else {
24
26
  return this.fmInfo;
25
27
  }
26
28
  }
27
29
 
28
30
  paramsSign(data) {
29
31
  return global?.wxAppParamsSignInstance
30
32
  ? global.wxAppParamsSignInstance?.paramsSign({
31
33
  color: WxappVerifyColorList.includes(data?.functionId),
32
34
  verifyCode: WXAPP_VERIFY_CODE,
33
35
  data,
34
36
  })
35
37
  : Promise.resolve(data)
36
38
  }
@@ -0,0 +1 @@
1
+ export const HttpStatus = {
2
  SUCCESS: 200,
1
3
  CREATED: 201,
2
4
  ACCEPTED: 202,
3
5
  CLIENT_ERROR: 400,
4
6
  AUTHENTICATE: 401,
5
7
  FORBIDDEN: 403,
6
8
  NOT_FOUND: 404,
7
9
  SERVER_ERROR: 500,
8
10
  BAD_GATEWAY: 502,
9
11
  SERVICE_UNAVAILABLE: 503,
10
12
  GATEWAY_TIMEOUT: 504,
11
13
  [HttpStatus.NOT_FOUND]: '请求资源不存在',
12
14
  [HttpStatus.BAD_GATEWAY]: '服务端异常,请稍后重试',
13
15
  [HttpStatus.FORBIDDEN]: '没有权限访问',
14
16
  [HttpStatus.AUTHENTICATE]: '需要鉴权',
15
17
  [HttpStatus.SUCCESS]: '成功',
16
18
  'whx_getShopHomeFloorInfo',
17
19
  'whx_searchWare',
18
20
  'shopGuessYouLike',
19
21
  'whx_getMShopCategory',
20
22
  'whx_newWareList',
21
23
  'getShopHomePromotionWebPage',
22
24
  'whx_getShopCampaignPage',
23
25
  'whx_getPromotionWares',
24
26
  'whx_buyerShowPage',
25
27
  'whx_getShopGwredPage',
26
28
  'whx_getShopSpeciSecKillPage',
27
29
  'whx_getSignInfo',
28
30
  'whx_getSignPrize',
29
31
  'getShopHomeFloorInfo',
30
32
  'shopGuessYouLike',
31
33
  'getShopHomePromotionWebPage',
32
34
  'getVipDetail',
33
35
  'getShopCategory',
34
36
  'getShopNavigationCategory',
35
37
  'colorApiPreview',
36
38
  'bmall_cart',
37
39
  'bmall_getOmittedProduct',
38
40
  'bmall_cartAdd',
39
41
  'bmall_cartChange',
40
42
  'bmall_cartRemove',
41
43
  'whx_getShopHomeFloorInfo',
42
44
  'whx_searchWare',
43
45
  'shopGuessYouLike',
44
46
  'whx_getMShopCategory',
45
47
  'whx_newWareList',
46
48
  'getShopHomePromotionWebPage',
47
49
  'whx_getShopCampaignPage',
48
50
  'whx_getPromotionWares',
49
51
  'whx_buyerShowPage',
50
52
  'getShopHomeFloorInfo',
51
53
  'getShopCategory',
52
54
  'getShopNavigationCategory',
53
55
  'giftCardAddCart',
54
56
  'receiveShopCoupon',
55
57
  'getShopHomePromotionWebPage',
56
58
  'shopGuessYouLike',
57
59
  'addRemind',
58
60
  'cancelRemind',
59
61
  'getVipDetail',
60
62
  'shopDetail',
61
63
  'address_queryAddress',
62
64
  'shopMemberSprintJoinActivity',
63
65
  'shopMemberSprintReceivePrize',
64
66
  'bmall_cart',
65
67
  'bmall_getOmittedProduct',
66
68
  'bmall_cartAdd',
67
69
  'bmall_cartChange',
68
70
  'bmall_cartRemove',
69
71
  SHOP_COLOR_APPID: 'shop_m_jd_com',
70
72
  JSHOPX_COLOR_APPID: 'jshopx_jd_com',
71
73
  PAGES_COLOR_APPID: 'pages_jd_com',
72
74
  B2B_COLOR_APPID: 'b2b',
73
75
  SHOP_MEMBER_COLOR_APPID: 'shopmember_m_jd_com',
74
76
  MALL_COLOR_APPID: 'mall_jd_com',
75
77
  'getSeriesTabData',
76
78
  'searchWare',
77
79
  'getDrShopDiscoveryFeeds',
78
80
  'searchWare',