kenny-login 0.0.1 → 0.0.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.
@@ -0,0 +1,2 @@
1
+ export declare function SignInForm(): import("react").JSX.Element;
2
+ //# sourceMappingURL=signin-form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signin-form.d.ts","sourceRoot":"","sources":["../../src/components/signin-form.tsx"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,gCAiCzB"}
@@ -0,0 +1,29 @@
1
+ export function SignInForm() {
2
+ return (<div className="kl-sign-in-form--wrapper">
3
+ <form id="signInForm" name="Sign In" className="kl-sign-in-form">
4
+ <title>Sign in</title>
5
+ <div className="kl-sign-in-form--field-group">
6
+ <label htmlFor="email">
7
+ Email
8
+ </label>
9
+ <input name="email" id="email"/>
10
+ </div>
11
+ <div className="kl-sign-in-form--field-group">
12
+ <label htmlFor="password">
13
+ Password
14
+ </label>
15
+ <input name="password" id="password"/>
16
+ </div>
17
+ <button type="submit" className="kl-sign-in-form--submit-button">
18
+ Sign In
19
+ </button>
20
+ </form>
21
+ {/* TODO: Make this a loop over providers */}
22
+ <form className="kl-sign-in-form--providers-list">
23
+ <button type="submit">
24
+ <span>Sign in with [provider name]</span>
25
+ </button>
26
+ </form>
27
+ </div>);
28
+ }
29
+ //# sourceMappingURL=signin-form.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signin-form.jsx","sourceRoot":"","sources":["../../src/components/signin-form.tsx"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU;IACxB,OAAO,CACL,CAAC,GAAG,CAAC,SAAS,CAAC,0BAA0B,CACvC;MAAA,CAAC,IAAI,CACH,EAAE,CAAC,YAAY,CACf,IAAI,CAAC,SAAS,CACd,SAAS,CAAC,iBAAiB,CAE3B;QAAA,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CACrB;QAAA,CAAC,GAAG,CAAC,SAAS,CAAC,8BAA8B,CAC3C;UAAA,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CACpB;;UACF,EAAE,KAAK,CACP;UAAA,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAChC;QAAA,EAAE,GAAG,CACL;QAAA,CAAC,GAAG,CAAC,SAAS,CAAC,8BAA8B,CAC3C;UAAA,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CACvB;;UACF,EAAE,KAAK,CACP;UAAA,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,EACtC;QAAA,EAAE,GAAG,CACL;QAAA,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,gCAAgC,CAC9D;;QACF,EAAE,MAAM,CACV;MAAA,EAAE,IAAI,CACN;MAAA,CAAC,2CAA2C,CAC1C;QAAA,CAAC,IAAI,CAAC,SAAS,CAAC,iCAAiC,CAC/C;UAAA,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CACnB;YAAA,CAAC,IAAI,CAAC,4BAA4B,EAAE,IAAI,CAC1C;UAAA,EAAE,MAAM,CACV;QAAA,EAAE,IAAI,CACV;IAAA,EAAE,GAAG,CAAC,CACP,CAAA;AACH,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export { handlers, signIn, signOut, auth } from "./auth";
2
+ export { SignInForm } from "./components/signin-form";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export { handlers, signIn, signOut, auth } from "./auth";
2
+ export { SignInForm } from "./components/signin-form";
2
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kenny-login",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "author": {
5
5
  "name": "fjorge"
6
6
  },
@@ -24,6 +24,7 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "^22",
27
+ "@types/react": "^19.2.7",
27
28
  "typescript": "^5"
28
29
  }
29
- }
30
+ }
@@ -1,4 +0,0 @@
1
- export declare function getUser(): Promise<any>;
2
- export declare function fetchContent(endPoint: string, query: Object | null): Promise<any>;
3
- export declare function postContent(endpoint: string, updateData: Object): Promise<any>;
4
- //# sourceMappingURL=strapi-api.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"strapi-api.d.ts","sourceRoot":"","sources":["../../src/utils/strapi-api.ts"],"names":[],"mappings":"AAUA,wBAAsB,OAAO,iBAyB5B;AAKD,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,gBA4BxE;AAED,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gBAuBrE"}
@@ -1,87 +0,0 @@
1
- import { getSession } from 'next-auth/react';
2
- import { headers } from 'next/headers';
3
- //path for endpoing, default to local if not in env
4
- function getPath(path) {
5
- return process.env.NEXT_PUBLIC_API_URL ? `${process.env.NEXT_PUBLIC_API_URL}/api/${path}` : `http://localhost:1337/api${path}`;
6
- }
7
- // gets user data
8
- export async function getUser() {
9
- var requestUrl = getPath('users/me');
10
- const session = await getSession();
11
- const options = {
12
- method: 'GET',
13
- headers: {
14
- 'Content-Type': 'application/json',
15
- 'Authorization': `Bearer ${session?.jwt}`
16
- }
17
- };
18
- try {
19
- const response = await fetch(requestUrl, options);
20
- if (!response.ok) {
21
- throw new Error(`HTTP error! status: ${response.status}`);
22
- }
23
- const data = await response.json();
24
- return data;
25
- }
26
- catch (error) {
27
- console.error("Error feting data: ", error);
28
- throw error;
29
- }
30
- }
31
- // as long as an enpoint is passed it will return
32
- // endpoint example to pass if there is and articles path 'articles/12'
33
- // allows for query
34
- export async function fetchContent(endPoint, query) {
35
- var requestUrl = getPath(endPoint);
36
- if (query !== null) {
37
- const qs = require('qs');
38
- let stringQuery = qs.stringify(query);
39
- requestUrl + '?' + stringQuery;
40
- }
41
- const session = await getSession();
42
- const options = {
43
- method: 'GET',
44
- headers: {
45
- 'Content-Type': 'application/json',
46
- //'Authorization': `Bearer ${session?.jwt}` // not sure if needed for public content
47
- }
48
- };
49
- try {
50
- const response = await fetch(requestUrl, options);
51
- if (!response.ok) {
52
- throw new Error(`HTTP error! status: ${response.status}`);
53
- }
54
- const data = await response.json();
55
- return data;
56
- }
57
- catch (error) {
58
- console.error("Error feting data: ", error);
59
- throw error;
60
- }
61
- }
62
- // need to define data structure possibly
63
- export async function postContent(endpoint, updateData) {
64
- const requestUrl = getPath(endpoint);
65
- const session = await getSession();
66
- const options = {
67
- method: 'POST',
68
- headers: {
69
- 'Content-Type': 'application/json',
70
- //'Authentication': `Bearer: ${session.jwt}`
71
- },
72
- body: JSON.stringify({ data: updateData }),
73
- };
74
- try {
75
- const response = await fetch(requestUrl, options);
76
- if (!response.ok) {
77
- throw new Error(`HTTP error! status: ${response.status}`);
78
- }
79
- const result = await response.json();
80
- return result.data;
81
- }
82
- catch (error) {
83
- console.error("Error updating data: ", error);
84
- return null;
85
- }
86
- }
87
- //# sourceMappingURL=strapi-api.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"strapi-api.js","sourceRoot":"","sources":["../../src/utils/strapi-api.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,mDAAmD;AACnD,SAAS,OAAO,CAAC,IAAY;IACzB,OAAO,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC,4BAA4B,IAAI,EAAE,CAAC;AACnI,CAAC;AAED,iBAAiB;AACjB,MAAM,CAAC,KAAK,UAAU,OAAO;IACzB,IAAI,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,MAAM,UAAU,EAAE,CAAC;IAEnC,MAAM,OAAO,GAAG;QACZ,MAAM,EAAE,KAAK;QACb,OAAO,EAAE;YACL,cAAc,EAAG,kBAAkB;YACnC,eAAe,EAAE,UAAU,OAAO,EAAE,GAAG,EAAE;SAC5C;KACJ,CAAA;IAED,IAAI,CAAC;QACL,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAElD,IAAG,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,uBAAuB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QAC9D,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IA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