@sparkstudio/accounts-ui 1.1.52 → 1.1.53
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.
- package/dist/index.cjs +104 -0
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +96 -0
- package/package.json +1 -1
- package/sparkstudio-accounts-ui-1.1.53.tgz +0 -0
- package/sparkstudio-accounts-ui-1.1.52.tgz +0 -0
package/dist/index.cjs
CHANGED
|
@@ -3,6 +3,10 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
6
10
|
var __copyProps = (to, from, except, desc) => {
|
|
7
11
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
12
|
for (let key of __getOwnPropNames(from))
|
|
@@ -15,8 +19,108 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
15
19
|
|
|
16
20
|
// src/index.ts
|
|
17
21
|
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
TestButton: () => TestButton
|
|
24
|
+
});
|
|
18
25
|
module.exports = __toCommonJS(index_exports);
|
|
19
26
|
|
|
20
27
|
// src/components/TestButton.tsx
|
|
21
28
|
var import_react = require("react");
|
|
29
|
+
|
|
30
|
+
// src/api/Controllers/Home.ts
|
|
31
|
+
var Home = class {
|
|
32
|
+
baseUrl;
|
|
33
|
+
constructor(baseUrl) {
|
|
34
|
+
this.baseUrl = baseUrl;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// src/api/Controllers/Users.ts
|
|
39
|
+
var Users = class {
|
|
40
|
+
baseUrl;
|
|
41
|
+
constructor(baseUrl) {
|
|
42
|
+
this.baseUrl = baseUrl;
|
|
43
|
+
}
|
|
44
|
+
async GetUser(id) {
|
|
45
|
+
const url = `${this.baseUrl}/api/Users/GetUser/` + id;
|
|
46
|
+
const requestOptions = {
|
|
47
|
+
method: "GET",
|
|
48
|
+
headers: {
|
|
49
|
+
"Content-Type": "application/json"
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const response = await fetch(url, requestOptions);
|
|
53
|
+
if (!response.ok) throw new Error(await response.text());
|
|
54
|
+
return await response.json();
|
|
55
|
+
}
|
|
56
|
+
async CreateUser(userDTO) {
|
|
57
|
+
const url = `${this.baseUrl}/api/Users/CreateUser`;
|
|
58
|
+
const requestOptions = {
|
|
59
|
+
method: "POST",
|
|
60
|
+
headers: {
|
|
61
|
+
"Content-Type": "application/json"
|
|
62
|
+
},
|
|
63
|
+
body: JSON.stringify(userDTO)
|
|
64
|
+
};
|
|
65
|
+
const response = await fetch(url, requestOptions);
|
|
66
|
+
if (!response.ok) throw new Error(await response.text());
|
|
67
|
+
return await response.json();
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// src/api/SparkStudioAccountsSDK.ts
|
|
72
|
+
var SparkStudioAccountsSDK = class {
|
|
73
|
+
home;
|
|
74
|
+
users;
|
|
75
|
+
constructor(baseUrl) {
|
|
76
|
+
this.home = new Home(baseUrl);
|
|
77
|
+
this.users = new Users(baseUrl);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// src/components/TestButton.tsx
|
|
22
82
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
83
|
+
function TestButton({ className = "" }) {
|
|
84
|
+
const [loading, setLoading] = (0, import_react.useState)(false);
|
|
85
|
+
const handleClick = async () => {
|
|
86
|
+
if (loading) return;
|
|
87
|
+
setLoading(true);
|
|
88
|
+
try {
|
|
89
|
+
const api = new SparkStudioAccountsSDK("https://localhost:5001");
|
|
90
|
+
const result = await api.users.GetUser(
|
|
91
|
+
"00000000-0000-0000-0000-000000000000"
|
|
92
|
+
);
|
|
93
|
+
alert(`Success:
|
|
94
|
+
${JSON.stringify(result, null, 2)}`);
|
|
95
|
+
} catch (err) {
|
|
96
|
+
alert(`Error:
|
|
97
|
+
${err?.message ?? err}`);
|
|
98
|
+
} finally {
|
|
99
|
+
setLoading(false);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-100 text-center mb-3 ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
103
|
+
"button",
|
|
104
|
+
{
|
|
105
|
+
type: "button",
|
|
106
|
+
className: "btn btn-primary btn-lg",
|
|
107
|
+
onClick: handleClick,
|
|
108
|
+
disabled: loading,
|
|
109
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
110
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
111
|
+
"span",
|
|
112
|
+
{
|
|
113
|
+
className: "spinner-border spinner-border-sm me-2",
|
|
114
|
+
role: "status",
|
|
115
|
+
"aria-hidden": "true"
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
"Loading..."
|
|
119
|
+
] }) : "Test"
|
|
120
|
+
}
|
|
121
|
+
) });
|
|
122
|
+
}
|
|
123
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
124
|
+
0 && (module.exports = {
|
|
125
|
+
TestButton
|
|
126
|
+
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
1
3
|
interface TestButtonProps {
|
|
2
4
|
className?: string;
|
|
3
5
|
}
|
|
6
|
+
declare function TestButton({ className }: TestButtonProps): react_jsx_runtime.JSX.Element;
|
|
4
7
|
|
|
5
|
-
export
|
|
8
|
+
export { TestButton };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
1
3
|
interface TestButtonProps {
|
|
2
4
|
className?: string;
|
|
3
5
|
}
|
|
6
|
+
declare function TestButton({ className }: TestButtonProps): react_jsx_runtime.JSX.Element;
|
|
4
7
|
|
|
5
|
-
export
|
|
8
|
+
export { TestButton };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,99 @@
|
|
|
1
1
|
// src/components/TestButton.tsx
|
|
2
2
|
import { useState } from "react";
|
|
3
|
+
|
|
4
|
+
// src/api/Controllers/Home.ts
|
|
5
|
+
var Home = class {
|
|
6
|
+
baseUrl;
|
|
7
|
+
constructor(baseUrl) {
|
|
8
|
+
this.baseUrl = baseUrl;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// src/api/Controllers/Users.ts
|
|
13
|
+
var Users = class {
|
|
14
|
+
baseUrl;
|
|
15
|
+
constructor(baseUrl) {
|
|
16
|
+
this.baseUrl = baseUrl;
|
|
17
|
+
}
|
|
18
|
+
async GetUser(id) {
|
|
19
|
+
const url = `${this.baseUrl}/api/Users/GetUser/` + id;
|
|
20
|
+
const requestOptions = {
|
|
21
|
+
method: "GET",
|
|
22
|
+
headers: {
|
|
23
|
+
"Content-Type": "application/json"
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const response = await fetch(url, requestOptions);
|
|
27
|
+
if (!response.ok) throw new Error(await response.text());
|
|
28
|
+
return await response.json();
|
|
29
|
+
}
|
|
30
|
+
async CreateUser(userDTO) {
|
|
31
|
+
const url = `${this.baseUrl}/api/Users/CreateUser`;
|
|
32
|
+
const requestOptions = {
|
|
33
|
+
method: "POST",
|
|
34
|
+
headers: {
|
|
35
|
+
"Content-Type": "application/json"
|
|
36
|
+
},
|
|
37
|
+
body: JSON.stringify(userDTO)
|
|
38
|
+
};
|
|
39
|
+
const response = await fetch(url, requestOptions);
|
|
40
|
+
if (!response.ok) throw new Error(await response.text());
|
|
41
|
+
return await response.json();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// src/api/SparkStudioAccountsSDK.ts
|
|
46
|
+
var SparkStudioAccountsSDK = class {
|
|
47
|
+
home;
|
|
48
|
+
users;
|
|
49
|
+
constructor(baseUrl) {
|
|
50
|
+
this.home = new Home(baseUrl);
|
|
51
|
+
this.users = new Users(baseUrl);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// src/components/TestButton.tsx
|
|
3
56
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
57
|
+
function TestButton({ className = "" }) {
|
|
58
|
+
const [loading, setLoading] = useState(false);
|
|
59
|
+
const handleClick = async () => {
|
|
60
|
+
if (loading) return;
|
|
61
|
+
setLoading(true);
|
|
62
|
+
try {
|
|
63
|
+
const api = new SparkStudioAccountsSDK("https://localhost:5001");
|
|
64
|
+
const result = await api.users.GetUser(
|
|
65
|
+
"00000000-0000-0000-0000-000000000000"
|
|
66
|
+
);
|
|
67
|
+
alert(`Success:
|
|
68
|
+
${JSON.stringify(result, null, 2)}`);
|
|
69
|
+
} catch (err) {
|
|
70
|
+
alert(`Error:
|
|
71
|
+
${err?.message ?? err}`);
|
|
72
|
+
} finally {
|
|
73
|
+
setLoading(false);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
return /* @__PURE__ */ jsx("div", { className: `w-100 text-center mb-3 ${className}`, children: /* @__PURE__ */ jsx(
|
|
77
|
+
"button",
|
|
78
|
+
{
|
|
79
|
+
type: "button",
|
|
80
|
+
className: "btn btn-primary btn-lg",
|
|
81
|
+
onClick: handleClick,
|
|
82
|
+
disabled: loading,
|
|
83
|
+
children: loading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
84
|
+
/* @__PURE__ */ jsx(
|
|
85
|
+
"span",
|
|
86
|
+
{
|
|
87
|
+
className: "spinner-border spinner-border-sm me-2",
|
|
88
|
+
role: "status",
|
|
89
|
+
"aria-hidden": "true"
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
"Loading..."
|
|
93
|
+
] }) : "Test"
|
|
94
|
+
}
|
|
95
|
+
) });
|
|
96
|
+
}
|
|
97
|
+
export {
|
|
98
|
+
TestButton
|
|
99
|
+
};
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|