pb-sxp-ui 1.15.10 → 1.15.12-alpha.1

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.
@@ -114,7 +114,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
114
114
  }
115
115
  if (options.type === 'beacon' && navigator.sendBeacon) {
116
116
  return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
117
- JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))
117
+ JSON.stringify({
118
+ body: btoa(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId })))
119
+ })
118
120
  ], { type: 'application/json;charset=UTF-8' }));
119
121
  }
120
122
  return window
@@ -269,7 +271,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
269
271
  console.log('userInfo:', userInfo);
270
272
  console.log('eventInfo:', ef);
271
273
  console.log('========= 结束 =========');
272
- return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/event/report/CLD/${(_b = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _b === void 0 ? void 0 : _b['x-app-id']}/${eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.eventSubject}`, {
274
+ return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/cld/${(_b = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _b === void 0 ? void 0 : _b['x-app-id']}/${eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.eventSubject}${cl_source ? `/${decodeURIComponent(cl_source)}` : ''}`, {
273
275
  method: 'POST',
274
276
  body: { userInfo: realUserInfo, eventInfo: realEventInfo },
275
277
  type: 'beacon'
@@ -6,9 +6,11 @@ import tel from './tel.png';
6
6
  import { setFontForText } from '../../../../core/utils/tool';
7
7
  import { useSxpDataSource } from '../../../../core/hooks';
8
8
  import { getUserConsentResult, setUserConsentResult } from '../../../../core/utils/localStore';
9
+ import { useEditorDataProvider } from '../../../../core/context/EditorDataProvider';
9
10
  const Click = (_a) => {
10
11
  var { isTel, open, content, style, consentPopupCate, acceptButton, rejectButton, showRejectButton } = _a, props = __rest(_a, ["isTel", "open", "content", "style", "consentPopupCate", "acceptButton", "rejectButton", "showRejectButton"]);
11
12
  const { getAccount, accountSonsent } = useSxpDataSource();
13
+ const { setConsentPopupCate } = useEditorDataProvider();
12
14
  const [consentResult, setConsentResult] = useState(true);
13
15
  const handleGetAccount = () => __awaiter(void 0, void 0, void 0, function* () {
14
16
  const res = yield (getAccount === null || getAccount === void 0 ? void 0 : getAccount());
@@ -21,14 +23,24 @@ const Click = (_a) => {
21
23
  !consentPopupCate && open && style && !getUserConsentResult() && handleGetAccount();
22
24
  }, []);
23
25
  const handleClickAccept = () => __awaiter(void 0, void 0, void 0, function* () {
24
- const res = yield (accountSonsent === null || accountSonsent === void 0 ? void 0 : accountSonsent(true));
25
- if (res) {
26
+ if (consentPopupCate) {
27
+ setConsentPopupCate === null || setConsentPopupCate === void 0 ? void 0 : setConsentPopupCate('');
28
+ }
29
+ else {
30
+ const res = yield (accountSonsent === null || accountSonsent === void 0 ? void 0 : accountSonsent(true));
31
+ if (!res)
32
+ return;
26
33
  setConsentResult(true);
27
34
  setUserConsentResult();
28
35
  }
29
36
  });
30
37
  const handleClickReject = () => {
31
- history === null || history === void 0 ? void 0 : history.back();
38
+ if (consentPopupCate) {
39
+ setConsentPopupCate === null || setConsentPopupCate === void 0 ? void 0 : setConsentPopupCate('');
40
+ }
41
+ else {
42
+ history === null || history === void 0 ? void 0 : history.back();
43
+ }
32
44
  };
33
45
  return (React.createElement(React.Fragment, null, isTel ? (React.createElement("img", { src: tel, style: { objectFit: 'cover', width: '100%', height: '100%' } })) : (React.createElement(React.Fragment, null, visivle && (React.createElement("div", { className: 'consentPopupClick' },
34
46
  React.createElement("div", { className: 'consentPopupClick-container', style: style },
@@ -5,11 +5,13 @@ import ConsentDetail from '../../popup/ConsentDetail';
5
5
  import tel from './tel.png';
6
6
  import { useSxpDataSource } from '../../../../core/hooks';
7
7
  import { getUserConsentResult, setUserConsentResult } from '../../../../core/utils/localStore';
8
+ import { useEditorDataProvider } from '../../../../core/context/EditorDataProvider';
8
9
  const Swipe = (_a) => {
9
10
  var { isTel, open, content, style, consentPopupCate, swipeIcon } = _a, props = __rest(_a, ["isTel", "open", "content", "style", "consentPopupCate", "swipeIcon"]);
10
11
  const touchInfo = useRef();
11
12
  const threshold = 50;
12
13
  const { getAccount, accountSonsent } = useSxpDataSource();
14
+ const { setConsentPopupCate } = useEditorDataProvider();
13
15
  const [consentResult, setConsentResult] = useState(true);
14
16
  const handleGetAccount = () => __awaiter(void 0, void 0, void 0, function* () {
15
17
  const res = yield (getAccount === null || getAccount === void 0 ? void 0 : getAccount());
@@ -22,8 +24,13 @@ const Swipe = (_a) => {
22
24
  !consentPopupCate && open && style && !getUserConsentResult() && handleGetAccount();
23
25
  }, []);
24
26
  const handleClickAccept = () => __awaiter(void 0, void 0, void 0, function* () {
25
- const res = yield (accountSonsent === null || accountSonsent === void 0 ? void 0 : accountSonsent(true));
26
- if (res) {
27
+ if (consentPopupCate) {
28
+ setConsentPopupCate === null || setConsentPopupCate === void 0 ? void 0 : setConsentPopupCate('');
29
+ }
30
+ else {
31
+ const res = yield (accountSonsent === null || accountSonsent === void 0 ? void 0 : accountSonsent(true));
32
+ if (!res)
33
+ return;
27
34
  setConsentResult(true);
28
35
  setUserConsentResult();
29
36
  }
@@ -50,7 +57,12 @@ const Swipe = (_a) => {
50
57
  }
51
58
  touchInfo.current = {};
52
59
  };
53
- return (React.createElement(React.Fragment, null, isTel ? (React.createElement("img", { src: tel, style: { objectFit: 'cover', width: '100%', height: '100%' } })) : (React.createElement(React.Fragment, null, visivle && (React.createElement("div", { className: 'consentPopupSwipe', onTouchStart: handleTouchStart, onTouchMove: handleTouchMove, onTouchEnd: handleTouchEnd },
60
+ const handleClick = () => {
61
+ if (consentPopupCate) {
62
+ setConsentPopupCate === null || setConsentPopupCate === void 0 ? void 0 : setConsentPopupCate('');
63
+ }
64
+ };
65
+ return (React.createElement(React.Fragment, null, isTel ? (React.createElement("img", { src: tel, style: { objectFit: 'cover', width: '100%', height: '100%' } })) : (React.createElement(React.Fragment, null, visivle && (React.createElement("div", { className: 'consentPopupSwipe', onTouchStart: handleTouchStart, onTouchMove: handleTouchMove, onTouchEnd: handleTouchEnd, onClick: handleClick },
54
66
  React.createElement("div", { className: 'consentPopupSwipe-container', style: style },
55
67
  React.createElement("div", { className: 'consentPopupSwipe-container-content' },
56
68
  React.createElement(ConsentDetail, { content: content, style: { padding: 0 } })),
@@ -117,7 +117,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
117
117
  }
118
118
  if (options.type === 'beacon' && navigator.sendBeacon) {
119
119
  return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
120
- JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))
120
+ JSON.stringify({
121
+ body: btoa(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId })))
122
+ })
121
123
  ], { type: 'application/json;charset=UTF-8' }));
122
124
  }
123
125
  return window
@@ -272,7 +274,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
272
274
  console.log('userInfo:', userInfo);
273
275
  console.log('eventInfo:', ef);
274
276
  console.log('========= 结束 =========');
275
- return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/event/report/CLD/${(_b = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _b === void 0 ? void 0 : _b['x-app-id']}/${eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.eventSubject}`, {
277
+ return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/cld/${(_b = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _b === void 0 ? void 0 : _b['x-app-id']}/${eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.eventSubject}${cl_source ? `/${decodeURIComponent(cl_source)}` : ''}`, {
276
278
  method: 'POST',
277
279
  body: { userInfo: realUserInfo, eventInfo: realEventInfo },
278
280
  type: 'beacon'
@@ -8,9 +8,11 @@ const tel_png_1 = tslib_1.__importDefault(require("./tel.png"));
8
8
  const tool_1 = require("../../../../core/utils/tool");
9
9
  const hooks_1 = require("../../../../core/hooks");
10
10
  const localStore_1 = require("../../../../core/utils/localStore");
11
+ const EditorDataProvider_1 = require("../../../../core/context/EditorDataProvider");
11
12
  const Click = (_a) => {
12
13
  var { isTel, open, content, style, consentPopupCate, acceptButton, rejectButton, showRejectButton } = _a, props = tslib_1.__rest(_a, ["isTel", "open", "content", "style", "consentPopupCate", "acceptButton", "rejectButton", "showRejectButton"]);
13
14
  const { getAccount, accountSonsent } = (0, hooks_1.useSxpDataSource)();
15
+ const { setConsentPopupCate } = (0, EditorDataProvider_1.useEditorDataProvider)();
14
16
  const [consentResult, setConsentResult] = (0, react_1.useState)(true);
15
17
  const handleGetAccount = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
16
18
  const res = yield (getAccount === null || getAccount === void 0 ? void 0 : getAccount());
@@ -23,14 +25,24 @@ const Click = (_a) => {
23
25
  !consentPopupCate && open && style && !(0, localStore_1.getUserConsentResult)() && handleGetAccount();
24
26
  }, []);
25
27
  const handleClickAccept = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
26
- const res = yield (accountSonsent === null || accountSonsent === void 0 ? void 0 : accountSonsent(true));
27
- if (res) {
28
+ if (consentPopupCate) {
29
+ setConsentPopupCate === null || setConsentPopupCate === void 0 ? void 0 : setConsentPopupCate('');
30
+ }
31
+ else {
32
+ const res = yield (accountSonsent === null || accountSonsent === void 0 ? void 0 : accountSonsent(true));
33
+ if (!res)
34
+ return;
28
35
  setConsentResult(true);
29
36
  (0, localStore_1.setUserConsentResult)();
30
37
  }
31
38
  });
32
39
  const handleClickReject = () => {
33
- history === null || history === void 0 ? void 0 : history.back();
40
+ if (consentPopupCate) {
41
+ setConsentPopupCate === null || setConsentPopupCate === void 0 ? void 0 : setConsentPopupCate('');
42
+ }
43
+ else {
44
+ history === null || history === void 0 ? void 0 : history.back();
45
+ }
34
46
  };
35
47
  return (react_1.default.createElement(react_1.default.Fragment, null, isTel ? (react_1.default.createElement("img", { src: tel_png_1.default, style: { objectFit: 'cover', width: '100%', height: '100%' } })) : (react_1.default.createElement(react_1.default.Fragment, null, visivle && (react_1.default.createElement("div", { className: 'consentPopupClick' },
36
48
  react_1.default.createElement("div", { className: 'consentPopupClick-container', style: style },
@@ -7,11 +7,13 @@ const ConsentDetail_1 = tslib_1.__importDefault(require("../../popup/ConsentDeta
7
7
  const tel_png_1 = tslib_1.__importDefault(require("./tel.png"));
8
8
  const hooks_1 = require("../../../../core/hooks");
9
9
  const localStore_1 = require("../../../../core/utils/localStore");
10
+ const EditorDataProvider_1 = require("../../../../core/context/EditorDataProvider");
10
11
  const Swipe = (_a) => {
11
12
  var { isTel, open, content, style, consentPopupCate, swipeIcon } = _a, props = tslib_1.__rest(_a, ["isTel", "open", "content", "style", "consentPopupCate", "swipeIcon"]);
12
13
  const touchInfo = (0, react_1.useRef)();
13
14
  const threshold = 50;
14
15
  const { getAccount, accountSonsent } = (0, hooks_1.useSxpDataSource)();
16
+ const { setConsentPopupCate } = (0, EditorDataProvider_1.useEditorDataProvider)();
15
17
  const [consentResult, setConsentResult] = (0, react_1.useState)(true);
16
18
  const handleGetAccount = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
17
19
  const res = yield (getAccount === null || getAccount === void 0 ? void 0 : getAccount());
@@ -24,8 +26,13 @@ const Swipe = (_a) => {
24
26
  !consentPopupCate && open && style && !(0, localStore_1.getUserConsentResult)() && handleGetAccount();
25
27
  }, []);
26
28
  const handleClickAccept = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
27
- const res = yield (accountSonsent === null || accountSonsent === void 0 ? void 0 : accountSonsent(true));
28
- if (res) {
29
+ if (consentPopupCate) {
30
+ setConsentPopupCate === null || setConsentPopupCate === void 0 ? void 0 : setConsentPopupCate('');
31
+ }
32
+ else {
33
+ const res = yield (accountSonsent === null || accountSonsent === void 0 ? void 0 : accountSonsent(true));
34
+ if (!res)
35
+ return;
29
36
  setConsentResult(true);
30
37
  (0, localStore_1.setUserConsentResult)();
31
38
  }
@@ -52,7 +59,12 @@ const Swipe = (_a) => {
52
59
  }
53
60
  touchInfo.current = {};
54
61
  };
55
- return (react_1.default.createElement(react_1.default.Fragment, null, isTel ? (react_1.default.createElement("img", { src: tel_png_1.default, style: { objectFit: 'cover', width: '100%', height: '100%' } })) : (react_1.default.createElement(react_1.default.Fragment, null, visivle && (react_1.default.createElement("div", { className: 'consentPopupSwipe', onTouchStart: handleTouchStart, onTouchMove: handleTouchMove, onTouchEnd: handleTouchEnd },
62
+ const handleClick = () => {
63
+ if (consentPopupCate) {
64
+ setConsentPopupCate === null || setConsentPopupCate === void 0 ? void 0 : setConsentPopupCate('');
65
+ }
66
+ };
67
+ return (react_1.default.createElement(react_1.default.Fragment, null, isTel ? (react_1.default.createElement("img", { src: tel_png_1.default, style: { objectFit: 'cover', width: '100%', height: '100%' } })) : (react_1.default.createElement(react_1.default.Fragment, null, visivle && (react_1.default.createElement("div", { className: 'consentPopupSwipe', onTouchStart: handleTouchStart, onTouchMove: handleTouchMove, onTouchEnd: handleTouchEnd, onClick: handleClick },
56
68
  react_1.default.createElement("div", { className: 'consentPopupSwipe-container', style: style },
57
69
  react_1.default.createElement("div", { className: 'consentPopupSwipe-container-content' },
58
70
  react_1.default.createElement(ConsentDetail_1.default, { content: content, style: { padding: 0 } })),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.15.10",
3
+ "version": "1.15.12-alpha.1",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",