@lowdefy/client 4.0.0-alpha.29 → 4.0.0-alpha.31

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.
@@ -0,0 +1,32 @@
1
+ /*
2
+ Copyright 2020-2022 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ async function request({ url , method ='GET' , body }) {
16
+ const res = await fetch(url, {
17
+ method,
18
+ headers: {
19
+ 'Content-Type': 'application/json'
20
+ },
21
+ body: JSON.stringify(body)
22
+ });
23
+ if (!res.ok) {
24
+ // TODO: check
25
+ const body = await res.json();
26
+ console.log(res);
27
+ console.log(body);
28
+ throw new Error(body.message || 'Request error');
29
+ }
30
+ return res.json();
31
+ }
32
+ export default request;
@@ -0,0 +1,51 @@
1
+ /*
2
+ Copyright 2020-2022 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ import { createLink } from '@lowdefy/engine';
16
+ function setupLink(lowdefy) {
17
+ const { router } = lowdefy._internal;
18
+ const { window } = lowdefy._internal.globals;
19
+ const backLink = ()=>router.back();
20
+ const disabledLink = ()=>{};
21
+ const newOriginLink = ({ url , query , newTab })=>{
22
+ if (newTab) {
23
+ return window.open(`${url}${query ? `?${query}` : ''}`, '_blank').focus();
24
+ } else {
25
+ return window.location.assign(`${url}${query ? `?${query}` : ''}`);
26
+ }
27
+ };
28
+ const sameOriginLink = ({ newTab , pathname , query , setInput })=>{
29
+ if (newTab) {
30
+ return window.open(`${window.location.origin}${lowdefy.basePath}${pathname}${query ? `?${query}` : ''}`, '_blank').focus();
31
+ } else {
32
+ setInput();
33
+ return router.push({
34
+ pathname,
35
+ query
36
+ });
37
+ }
38
+ };
39
+ const noLink = ()=>{
40
+ throw new Error(`Invalid Link.`);
41
+ };
42
+ return createLink({
43
+ backLink,
44
+ disabledLink,
45
+ lowdefy,
46
+ newOriginLink,
47
+ noLink,
48
+ sameOriginLink
49
+ });
50
+ }
51
+ export default setupLink;
@@ -0,0 +1,29 @@
1
+ /*
2
+ Copyright 2020-2022 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ .icon-spin {
18
+ animation: spin 1s infinite linear;
19
+ }
20
+
21
+ @keyframes spin {
22
+ 0% {
23
+ transform: rotate(0deg);
24
+ }
25
+
26
+ 100% {
27
+ transform: rotate(360deg);
28
+ }
29
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/client",
3
- "version": "4.0.0-alpha.29",
3
+ "version": "4.0.0-alpha.31",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Lowdefy Client",
6
6
  "homepage": "https://lowdefy.com",
@@ -42,17 +42,17 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@ant-design/icons": "4.7.0",
45
- "@lowdefy/block-utils": "4.0.0-alpha.29",
46
- "@lowdefy/engine": "4.0.0-alpha.29",
47
- "@lowdefy/helpers": "4.0.0-alpha.29",
48
- "@lowdefy/layout": "4.0.0-alpha.29",
45
+ "@lowdefy/block-utils": "4.0.0-alpha.31",
46
+ "@lowdefy/engine": "4.0.0-alpha.31",
47
+ "@lowdefy/helpers": "4.0.0-alpha.31",
48
+ "@lowdefy/layout": "4.0.0-alpha.31",
49
49
  "classnames": "2.3.1",
50
- "react": "18.1.0",
51
- "react-dom": "18.1.0"
50
+ "react": "18.2.0",
51
+ "react-dom": "18.2.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@emotion/jest": "11.9.1",
55
- "@lowdefy/jest-yaml-transform": "4.0.0-alpha.29",
55
+ "@lowdefy/jest-yaml-transform": "4.0.0-alpha.31",
56
56
  "@swc/cli": "0.1.57",
57
57
  "@swc/core": "1.2.194",
58
58
  "@swc/jest": "0.2.21",
@@ -67,5 +67,5 @@
67
67
  "publishConfig": {
68
68
  "access": "public"
69
69
  },
70
- "gitHead": "621a191ebc0a1569ee6669dc74c12f8be5a8c7f3"
70
+ "gitHead": "96ef86d4ce4849f8f11110662efbbaede1bcd5a5"
71
71
  }