@titaui/pc 1.15.41 → 1.15.42

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.
@@ -9,12 +9,12 @@ exports.parseTag = exports.parseStringV2 = exports.parseString = exports.parseOp
9
9
 
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
 
12
+ var Sentry = _interopRequireWildcard(require("@sentry/browser"));
13
+
12
14
  var _bsGlobal = require("./bs-global");
13
15
 
14
16
  var _openDataPainter = require("../components/open-data-painter");
15
17
 
16
- var _helpers = require("./helpers");
17
-
18
18
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
19
 
20
20
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -77,60 +77,13 @@ function openData() {
77
77
  var _getBSGlobal;
78
78
 
79
79
  // 企业微信租户 && 非自建应用
80
- if ((getSource() === WX_SOURCE || getUA().includes(WX_UA_STR)) && ((_getBSGlobal = (0, _bsGlobal.getBSGlobal)('tenantInfo')) === null || _getBSGlobal === void 0 ? void 0 : _getBSGlobal.corpCreateType) !== 2 // 2:自建应用
81
- ) {
82
- // 企业微信初始化失败
83
- // if (!window.WWOpenData && !window.top.WWOpenData) {
84
- // return (p) => {
85
- // if (p.name == undefined || p.id == undefined) {
86
- // try {
87
- // errorLog(1, JSON.stringify({
88
- // errorType: 'WWOpenData is undefined',
89
- // pName: p.name == undefined ? 'undefined' : p.name,
90
- // pId: p.id == undefined ? 'undefined' : p.id,
91
- // pType: p.type,
92
- // }))
93
- // } catch (e) {
94
- // console.log(e)
95
- // }
96
- // }
97
- // return p.name || p.id || null
98
- // }
99
- // }
80
+ if ((getSource() === WX_SOURCE || getUA().includes(WX_UA_STR)) && (_getBSGlobal = (0, _bsGlobal.getBSGlobal)('tenantInfo')) !== null && _getBSGlobal !== void 0 && _getBSGlobal.isTranslate) {
100
81
  return function (p) {
101
82
  var pId = p.id,
102
83
  pName = p.name,
103
84
  pCorpId = p.corpId,
104
85
  pType = p.type;
105
86
  var ref = (0, _react.useRef)(null);
106
- (0, _react.useEffect)(function () {
107
- var openId = pCorpId || getOpenId(pId, pType);
108
-
109
- if (!openId) {
110
- if (pId !== undefined && !ignorePIds.includes(pId)) {
111
- try {
112
- // BSGlobal
113
- var openIds;
114
-
115
- if (pType === 'userName') {
116
- openIds = (0, _bsGlobal.getBSGlobal)('openIds');
117
- } else if (pType === 'departmentName') {
118
- openIds = (0, _bsGlobal.getBSGlobal)('openDepartmentIds');
119
- }
120
-
121
- (0, _helpers.errorLog)(1, JSON.stringify({
122
- errorType: 'openId 不存在',
123
- pName: pName === undefined ? 'undefined' : pName,
124
- pId: pId === undefined ? 'undefined' : pId,
125
- pType: pType,
126
- openIds: openIds
127
- }));
128
- } catch (e) {
129
- console.log(e);
130
- }
131
- }
132
- }
133
- }, [pId, pName]);
134
87
  (0, _react.useLayoutEffect)(function () {
135
88
  var _ref;
136
89
 
@@ -146,21 +99,19 @@ function openData() {
146
99
  var openId = pCorpId || getOpenId(pId, pType);
147
100
 
148
101
  if (!openId) {
149
- if (pId !== undefined && !ignorePIds.includes(pId)) {// Sentry.withScope((scope) => {
150
- // scope.setTag('error-level', 'P1')
151
- // scope.setTag('error-type', '企业微信openData调用失败')
152
- // scope.setExtra('fail_type', pType)
153
- // scope.setExtra('p_id', pId)
154
- // scope.setExtra('p_name', pName)
155
- // scope.setExtra('corp_id', pCorpId)
156
- // scope.setExtra('open_id', getOpenId(pId, pType))
157
- // p.callFunc && scope.setExtra('fail_callFunc', p.callFunc)
158
- // p.extra && scope.setExtra('fail_extra', p.extra)
159
- // Sentry.captureException(
160
- // new Error('企业微信openData调用失败'),
161
- // scope,
162
- // )
163
- // })
102
+ if (pId !== undefined && !ignorePIds.includes(pId)) {
103
+ Sentry.withScope(function (scope) {
104
+ scope.setTag('error-level', 'P1');
105
+ scope.setTag('error-type', 'openId不存在');
106
+ scope.setExtra('fail_type', pType);
107
+ scope.setExtra('p_id', pId);
108
+ scope.setExtra('p_name', pName);
109
+ scope.setExtra('corp_id', pCorpId);
110
+ scope.setExtra('open_id', getOpenId(pId, pType));
111
+ p.callFunc && scope.setExtra('fail_callFunc', p.callFunc);
112
+ p.extra && scope.setExtra('fail_extra', p.extra);
113
+ Sentry.captureException(new Error('企业微信openData调用失败'), scope);
114
+ });
164
115
  }
165
116
 
166
117
  return pName || pId || null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@titaui/pc",
3
- "version": "1.15.41",
3
+ "version": "1.15.42",
4
4
  "nameCN": "",
5
5
  "description": "",
6
6
  "main": "lib/index.js",