@feedmepos/mf-common 1.6.1-rc.1 → 1.6.1-rc.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.
- package/dist/app.js +18 -17
- package/dist/auth.d.ts +3 -3
- package/dist/auth.d.ts.map +1 -1
- package/dist/vite-preset.d.ts.map +1 -1
- package/dist/vite-preset.js +6 -7
- package/package.json +1 -1
package/dist/app.js
CHANGED
@@ -5,20 +5,14 @@ import { ref as Xa, defineComponent as Jd, watchEffect as MF, watch as s0, resol
|
|
5
5
|
import { defineStore as X5t, storeToRefs as Q5t } from "pinia";
|
6
6
|
import { useRouter as K5t } from "vue-router";
|
7
7
|
class gg {
|
8
|
+
static get token() {
|
9
|
+
if (!this.bgIframe)
|
10
|
+
throw new Error("FeedMeAuth.token must be called after initialize()");
|
11
|
+
return this.bgIframe.contentWindow.postMessage("fm-get-token", this.baseUrl + "/one-tap/background"), this._token;
|
12
|
+
}
|
8
13
|
static setBaseUrl(a) {
|
9
14
|
this.baseUrl = `https://account.feedme${a ? "dev" : ""}.cc`;
|
10
15
|
}
|
11
|
-
static startBackground() {
|
12
|
-
if (!document)
|
13
|
-
throw new Error("FeedMeAuth.prompt() must be called in the browser");
|
14
|
-
const a = document.createElement("div");
|
15
|
-
a.id = "feedme-auth-bg", this.bgIframe = document.createElement("iframe"), this.bgIframe.src = this.baseUrl + "/one-tap/background?client_id=" + this.clientId, a.appendChild(this.bgIframe), a.style.display = "none", document.body.appendChild(a), window.addEventListener("message", (l) => {
|
16
|
-
if (l.origin === this.baseUrl && typeof l.data == "object") {
|
17
|
-
const m = l.data;
|
18
|
-
m.type === "fm-auth-state-changed" && (this._token = m.token, Object.values(this.authStateChangeCallbacks).forEach((y) => y(m.user, m.token)), this._token && this.unmountPrompt());
|
19
|
-
}
|
20
|
-
});
|
21
|
-
}
|
22
16
|
static initialize(a) {
|
23
17
|
if (!a)
|
24
18
|
throw new Error("FeedMeAuth: clientId is required");
|
@@ -58,6 +52,7 @@ class gg {
|
|
58
52
|
}
|
59
53
|
`, document.head.appendChild(l);
|
60
54
|
}
|
55
|
+
// Doing the SSO sign in
|
61
56
|
static signIn(a) {
|
62
57
|
if (!document)
|
63
58
|
throw new Error("FeedMeAuth.prompt() must be called in the browser");
|
@@ -102,11 +97,6 @@ class gg {
|
|
102
97
|
document.body.removeChild(a);
|
103
98
|
}, 300));
|
104
99
|
}
|
105
|
-
static get token() {
|
106
|
-
if (!this.bgIframe)
|
107
|
-
throw new Error("FeedMeAuth.token must be called after initialize()");
|
108
|
-
return this.bgIframe.contentWindow.postMessage("fm-get-token", this.baseUrl + "/one-tap/background"), this._token;
|
109
|
-
}
|
110
100
|
static async getCustomToken() {
|
111
101
|
const a = await fetch(this.baseUrl + "/api/token/custom", {
|
112
102
|
method: "POST",
|
@@ -147,8 +137,19 @@ class gg {
|
|
147
137
|
throw new Error("Failed to get user claims");
|
148
138
|
return await a.json();
|
149
139
|
}
|
140
|
+
static startBackground() {
|
141
|
+
if (!document)
|
142
|
+
throw new Error("FeedMeAuth.prompt() must be called in the browser");
|
143
|
+
const a = document.createElement("div");
|
144
|
+
a.id = "feedme-auth-bg", this.bgIframe = document.createElement("iframe"), this.bgIframe.src = this.baseUrl + "/one-tap/background?client_id=" + this.clientId, a.appendChild(this.bgIframe), a.style.display = "none", document.body.appendChild(a), window.addEventListener("message", (l) => {
|
145
|
+
if (l.origin === this.baseUrl && typeof l.data == "object") {
|
146
|
+
const m = l.data;
|
147
|
+
m.type === "fm-auth-state-changed" && (this._token = m.token, Object.values(this.authStateChangeCallbacks).forEach((y) => y(m.user, m.token)), this._token && this.unmountPrompt());
|
148
|
+
}
|
149
|
+
});
|
150
|
+
}
|
150
151
|
}
|
151
|
-
Ky(gg, "clientId"), Ky(gg, "baseUrl", "https://account.feedmedev.cc"), Ky(gg, "
|
152
|
+
Ky(gg, "clientId"), Ky(gg, "baseUrl", "https://account.feedmedev.cc"), Ky(gg, "authStateChangeCallbacks", {}), Ky(gg, "bgIframe", null), Ky(gg, "_token", null);
|
152
153
|
var iu = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
153
154
|
function Z5t(i) {
|
154
155
|
if (i.__esModule)
|
package/dist/auth.d.ts
CHANGED
@@ -11,18 +11,17 @@ export interface FeedMeUser {
|
|
11
11
|
export declare class FeedMeAuth {
|
12
12
|
static clientId: string;
|
13
13
|
static baseUrl: string;
|
14
|
-
private static _token;
|
15
14
|
private static authStateChangeCallbacks;
|
16
15
|
private static bgIframe;
|
16
|
+
private static _token;
|
17
|
+
static get token(): string | null;
|
17
18
|
static setBaseUrl(isDev: boolean): void;
|
18
|
-
private static startBackground;
|
19
19
|
static initialize(clientId: string): void;
|
20
20
|
static signIn(root?: HTMLElement): void;
|
21
21
|
static setToken(token: string): void;
|
22
22
|
static onAuthStateChanged(callback: (user: FeedMeUser | null, token: string | null) => void): () => void;
|
23
23
|
static signOut(): void;
|
24
24
|
static unmountPrompt(): void;
|
25
|
-
static get token(): string | null;
|
26
25
|
static getCustomToken(): Promise<string>;
|
27
26
|
static refreshToken(): Promise<string>;
|
28
27
|
static getUserClaims(): Promise<{
|
@@ -30,5 +29,6 @@ export declare class FeedMeAuth {
|
|
30
29
|
exp: number;
|
31
30
|
customClaims: Record<string, unknown> | undefined;
|
32
31
|
}>;
|
32
|
+
private static startBackground;
|
33
33
|
}
|
34
34
|
//# sourceMappingURL=auth.d.ts.map
|
package/dist/auth.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/auth.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,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3F,MAAM,CAAC,OAAO;IASd,MAAM,CAAC,aAAa;WASP,cAAc;WAgBd,YAAY;WA4BZ,aAAa,IAAI,OAAO,CAAC;QACpC,uCAAuC;QACvC,GAAG,EAAE,MAAM,CAAA;QACX,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;KAClD,CAAC;IAaF,OAAO,CAAC,MAAM,CAAC,eAAe;CA4B/B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"vite-preset.d.ts","sourceRoot":"","sources":["../vite-preset.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAU,UAAU,EAAE,MAAM,MAAM,CAAA;AAKzD,MAAM,WAAW,kBAAkB;IACjC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC9B,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC7C;AAED,eAAO,MAAM,eAAe,WAClB,UAAU,qBACC,SAAS,YACnB,kBAAkB,KAC1B,
|
1
|
+
{"version":3,"file":"vite-preset.d.ts","sourceRoot":"","sources":["../vite-preset.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAU,UAAU,EAAE,MAAM,MAAM,CAAA;AAKzD,MAAM,WAAW,kBAAkB;IACjC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC9B,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC7C;AAED,eAAO,MAAM,eAAe,WAClB,UAAU,qBACC,SAAS,YACnB,kBAAkB,KAC1B,UAwHF,CAAA"}
|
package/dist/vite-preset.js
CHANGED
@@ -72,16 +72,15 @@ const b = (l) => {
|
|
72
72
|
}), (d = r.excludeFmmfPackages) == null || d.forEach((t) => {
|
73
73
|
delete c[t];
|
74
74
|
});
|
75
|
-
|
76
|
-
"@vue/devtools-api": "^6.5.0/lib/esm/index.js"
|
77
|
-
}, u = [...Object.keys(o), ...Object.keys(c)];
|
78
|
-
const p = { ...l };
|
79
|
-
s == "build" && e == "fmmf" && (o = {
|
80
|
-
...o,
|
75
|
+
const o = {
|
76
|
+
"@vue/devtools-api": "^6.5.0/lib/esm/index.js",
|
81
77
|
vue: "^3.3.4/dist/vue.esm-browser.prod.min.js",
|
82
78
|
"vue-router": "^4.2.5/dist/vue-router.esm-browser.min.js",
|
83
79
|
pinia: "^2.1.7/+esm"
|
84
|
-
}
|
80
|
+
};
|
81
|
+
let u = [...Object.keys(o), ...Object.keys(c)];
|
82
|
+
const p = { ...l };
|
83
|
+
s == "build" && e == "fmmf" && (u = [...Object.keys(c), ...Object.keys(o)], p.build = {
|
85
84
|
emptyOutDir: !0,
|
86
85
|
lib: {
|
87
86
|
entry: {
|