@schibsted/account-sdk-browser 6.0.0-alpha.10 → 6.0.0-alpha.12
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/README.md +18 -10
- package/dist/account.d.ts +9 -2
- package/dist/compatibility/index.d.ts +2 -0
- package/dist/compatibility/install-legacy-compatibility.d.ts +10 -0
- package/dist/compatibility/legacy-identity.d.ts +32 -0
- package/dist/compatibility/legacy-monetization.d.ts +9 -0
- package/dist/compatibility/types.d.ts +43 -0
- package/dist/compatibility/warnings.d.ts +3 -0
- package/dist/compatibility.js +171 -0
- package/dist/compatibility.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +199 -208
- package/dist/index.js.map +1 -1
- package/dist/monetization.d.ts +1 -1
- package/dist/resolve-browser-window-wUnycyxt.js +21 -0
- package/dist/resolve-browser-window-wUnycyxt.js.map +1 -0
- package/dist/session-state.d.ts +13 -0
- package/dist/types/account.d.ts +35 -6
- package/dist/types/common.d.ts +2 -2
- package/dist/types/session.d.ts +2 -0
- package/dist/version.d.ts +1 -1
- package/package.json +7 -3
- package/src/account.ts +36 -8
- package/src/compatibility/index.ts +10 -0
- package/src/compatibility/install-legacy-compatibility.ts +139 -0
- package/src/compatibility/legacy-identity.ts +229 -0
- package/src/compatibility/legacy-monetization.ts +30 -0
- package/src/compatibility/types.ts +79 -0
- package/src/compatibility/warnings.ts +28 -0
- package/src/identity.ts +4 -1
- package/src/index.ts +4 -0
- package/src/monetization.ts +5 -2
- package/src/session-state.ts +20 -0
- package/src/types/account.ts +38 -5
- package/src/types/common.ts +2 -2
- package/src/types/session.ts +2 -0
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,8 @@ Welcome! This is the home of the Schibsted Account JavaScript SDK for browsers.
|
|
|
8
8
|
sign up and log in with Schibsted Account, read the current session, and check access to products
|
|
9
9
|
and features.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
See the [public SDK documentation](https://schibsted.github.io/account-sdk-browser/) for setup,
|
|
12
|
+
integration guidance, and the API reference.
|
|
12
13
|
|
|
13
14
|
## Before You Start
|
|
14
15
|
|
|
@@ -44,19 +45,26 @@ npm run typecheck
|
|
|
44
45
|
|
|
45
46
|
Public API documentation is generated from TypeScript source comments with TypeDoc.
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
npm run docs:build
|
|
49
|
-
npm run docs:open
|
|
50
|
-
```
|
|
48
|
+
Documentation commands:
|
|
51
49
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
npm run docs:
|
|
56
|
-
```
|
|
50
|
+
- `npm run docs:build` generates the documentation once in `docs/`.
|
|
51
|
+
- `npm run docs:watch` rebuilds `docs/` when source files change, without starting a server.
|
|
52
|
+
- `npm run docs:preview` builds and serves the documentation locally in the versioned layout.
|
|
53
|
+
- `npm run docs:test` tests documentation versioning and publishing.
|
|
57
54
|
|
|
58
55
|
Generated docs are written to `docs/` and are not committed.
|
|
59
56
|
|
|
57
|
+
After npm publishing succeeds, the
|
|
58
|
+
[documentation workflow](./.github/workflows/github-pages.yml) builds docs from the release tag and
|
|
59
|
+
adds them to the public
|
|
60
|
+
[`schibsted/account-sdk-browser`](https://github.com/schibsted/account-sdk-browser) repository.
|
|
61
|
+
Existing versions remain available, and the documentation root and version selector point to the
|
|
62
|
+
latest published version.
|
|
63
|
+
|
|
64
|
+
To publish an existing release again, run the documentation workflow manually with its tag.
|
|
65
|
+
Publishing requires the `public-docs` environment with a `PUBLIC_GITHUB_DOCS_DEPLOY_KEY` secret
|
|
66
|
+
containing the private key for a write-enabled deploy key configured in the public repository.
|
|
67
|
+
|
|
60
68
|
## Example Project
|
|
61
69
|
|
|
62
70
|
The internal example integration is available in the
|
package/dist/account.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountConfig, AccountEventListener, AccountEventName } from './types/account.js';
|
|
1
|
+
import { AccountConfig, AccountEventListener, AccountEventName, ResolvedAccountConfig } from './types/account.js';
|
|
2
2
|
import { LoginOptions, SimplifiedLoginData, SimplifiedLoginWidgetLoginOptions, SimplifiedLoginWidgetOptions } from './types/login.js';
|
|
3
3
|
import { HasAccessResult } from './types/monetization.js';
|
|
4
4
|
import { ConnectedSessionResponse, SessionResponse, SessionUserId } from './types/session.js';
|
|
@@ -14,6 +14,13 @@ import { ConnectedSessionResponse, SessionResponse, SessionUserId } from './type
|
|
|
14
14
|
export declare class Account {
|
|
15
15
|
#private;
|
|
16
16
|
constructor(config: AccountConfig);
|
|
17
|
+
/**
|
|
18
|
+
* The configuration passed when this instance was created.
|
|
19
|
+
*
|
|
20
|
+
* The returned object and its `defaultProductIds` and `varnish` values are frozen copies;
|
|
21
|
+
* changing them does not reconfigure the SDK.
|
|
22
|
+
*/
|
|
23
|
+
get config(): ResolvedAccountConfig;
|
|
17
24
|
/**
|
|
18
25
|
* Queries Session Service and returns the current browser session state.
|
|
19
26
|
*
|
|
@@ -149,7 +156,7 @@ export declare class Account {
|
|
|
149
156
|
* @throws {SDKError} If product ids are not provided or configured, `sessionDomain` is missing,
|
|
150
157
|
* the current user cannot be resolved, input is invalid, or the request fails.
|
|
151
158
|
*/
|
|
152
|
-
hasAccess(productIds?: string[] | undefined): Promise<HasAccessResult | null>;
|
|
159
|
+
hasAccess(productIds?: readonly string[] | undefined): Promise<HasAccessResult | null>;
|
|
153
160
|
/**
|
|
154
161
|
* Removes a cached access-check result.
|
|
155
162
|
*
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LegacyCompatibilityOptions } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Enables the temporary v5 global and ready-event compatibility layer for Account SDK v6.
|
|
4
|
+
*
|
|
5
|
+
* Call this before `createAccountSdk()` when a dependency still expects v5 globals. If Account
|
|
6
|
+
* already exists, the legacy shims are installed immediately.
|
|
7
|
+
*
|
|
8
|
+
* @deprecated Migrate dependencies to the Account API. This entrypoint will be removed in v7.
|
|
9
|
+
*/
|
|
10
|
+
export declare function enableLegacyCompatibility(options?: LegacyCompatibilityOptions): void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Account } from '../account.js';
|
|
2
|
+
import { AccountEnvironment } from '../types/common.js';
|
|
3
|
+
import { LoginOptions } from '../types/login.js';
|
|
4
|
+
import { LegacyIdentity, LegacyLogoutListener } from './types.js';
|
|
5
|
+
export declare class LegacyIdentityAdapter implements LegacyIdentity {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(account: Account);
|
|
8
|
+
get clientId(): string;
|
|
9
|
+
get env(): AccountEnvironment;
|
|
10
|
+
get redirectUri(): string;
|
|
11
|
+
get _session(): LegacyIdentity['_session'];
|
|
12
|
+
hasSession(): ReturnType<Account['hasSession']>;
|
|
13
|
+
isLoggedIn(): ReturnType<Account['isLoggedIn']>;
|
|
14
|
+
isConnected(): ReturnType<Account['isConnected']>;
|
|
15
|
+
getUser(): ReturnType<Account['getUser']>;
|
|
16
|
+
getUserId(): ReturnType<Account['getUserId']>;
|
|
17
|
+
getExternalId(...args: Parameters<Account['getExternalId']>): ReturnType<Account['getExternalId']>;
|
|
18
|
+
getUserUuid(): ReturnType<Account['getUserUuid']>;
|
|
19
|
+
getUserSDRN(): ReturnType<Account['getUserSDRN']>;
|
|
20
|
+
getUserContextData(): ReturnType<Account['getUserContextData']>;
|
|
21
|
+
getSpId(): ReturnType<Account['getSpId']>;
|
|
22
|
+
login(...args: Parameters<Account['login']>): ReturnType<Account['login']>;
|
|
23
|
+
logout(...args: Parameters<Account['logout']>): ReturnType<Account['logout']>;
|
|
24
|
+
loginUrl(options: LoginOptions): string;
|
|
25
|
+
loginUrl(state: string, acrValues?: string, scope?: string, redirectUri?: string, loginHint?: string, tag?: string, teaser?: string, maxAge?: number | string): string;
|
|
26
|
+
logoutUrl(...args: Parameters<Account['logoutUrl']>): ReturnType<Account['logoutUrl']>;
|
|
27
|
+
accountUrl(...args: Parameters<Account['accountUrl']>): ReturnType<Account['accountUrl']>;
|
|
28
|
+
showSimplifiedLoginWidget(...args: Parameters<Account['showSimplifiedLoginWidget']>): ReturnType<Account['showSimplifiedLoginWidget']>;
|
|
29
|
+
clearCachedUserSession(): ReturnType<Account['clearCachedUserSession']>;
|
|
30
|
+
on(event: 'logout', listener: LegacyLogoutListener, context?: unknown): this;
|
|
31
|
+
off(event: 'logout', listener?: LegacyLogoutListener): this;
|
|
32
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Account } from '../account.js';
|
|
2
|
+
import { SessionUserId } from '../types/session.js';
|
|
3
|
+
import { LegacyMonetization } from './types.js';
|
|
4
|
+
export declare class LegacyMonetizationAdapter implements LegacyMonetization {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(account: Account);
|
|
7
|
+
hasAccess(productIds: string[], _userId: SessionUserId): ReturnType<Account['hasAccess']>;
|
|
8
|
+
clearCachedAccessResult(productIds: string[], userId: SessionUserId): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Account } from '../account.js';
|
|
2
|
+
import { AccountEnvironment } from '../types/common.js';
|
|
3
|
+
import { LoginOptions } from '../types/login.js';
|
|
4
|
+
import { SessionObjectResponse, SessionUserId } from '../types/session.js';
|
|
5
|
+
export type LegacyLogoutListener = (session?: SessionObjectResponse) => void;
|
|
6
|
+
type LegacyIdentityMethods = Pick<Account, 'hasSession' | 'isLoggedIn' | 'isConnected' | 'getUser' | 'getUserId' | 'getExternalId' | 'getUserUuid' | 'getUserSDRN' | 'getUserContextData' | 'getSpId' | 'login' | 'logout' | 'logoutUrl' | 'accountUrl' | 'showSimplifiedLoginWidget' | 'clearCachedUserSession'>;
|
|
7
|
+
export type LegacyIdentity = LegacyIdentityMethods & {
|
|
8
|
+
/** @deprecated Use `account.loginUrl(options)`. Removed in v7. */
|
|
9
|
+
loginUrl(options: LoginOptions): string;
|
|
10
|
+
/** @deprecated Pass an options object to `account.loginUrl()`. Removed in v7. */
|
|
11
|
+
loginUrl(state: string, acrValues?: string, scope?: string, redirectUri?: string, loginHint?: string, tag?: string, teaser?: string, maxAge?: number | string): string;
|
|
12
|
+
/** @deprecated Use `account.config.clientId`. Removed in v7. */
|
|
13
|
+
readonly clientId: string;
|
|
14
|
+
/** @deprecated Use `account.config.env`. Removed in v7. */
|
|
15
|
+
readonly env: AccountEnvironment;
|
|
16
|
+
/** @deprecated Use `account.config.redirectUri`. Removed in v7. */
|
|
17
|
+
readonly redirectUri: string;
|
|
18
|
+
/** @deprecated Use the Account session methods and events. Removed in v7. */
|
|
19
|
+
readonly _session: SessionObjectResponse;
|
|
20
|
+
/** @deprecated Only the legacy `logout` event is bridged. Removed in v7. */
|
|
21
|
+
on(event: 'logout', listener: LegacyLogoutListener, context?: unknown): LegacyIdentity;
|
|
22
|
+
/** @deprecated Only the legacy `logout` event is bridged. Removed in v7. */
|
|
23
|
+
off(event: 'logout', listener?: LegacyLogoutListener): LegacyIdentity;
|
|
24
|
+
};
|
|
25
|
+
export interface LegacyMonetization {
|
|
26
|
+
hasAccess(productIds: string[], userId: SessionUserId): ReturnType<Account['hasAccess']>;
|
|
27
|
+
clearCachedAccessResult(productIds: string[], userId: SessionUserId): void;
|
|
28
|
+
}
|
|
29
|
+
export type LegacyCompatibilityOptions = {
|
|
30
|
+
/** Window on which the legacy globals and ready events should be installed. */
|
|
31
|
+
window?: Window;
|
|
32
|
+
};
|
|
33
|
+
declare global {
|
|
34
|
+
interface Window {
|
|
35
|
+
/** @deprecated Use `window.schAccount`. Removed in v7. */
|
|
36
|
+
schIdentity?: LegacyIdentity;
|
|
37
|
+
/** @deprecated Use `window.schAccount`. Removed in v7. */
|
|
38
|
+
Identity?: LegacyIdentity;
|
|
39
|
+
/** @deprecated Use `window.schAccount`. Removed in v7. */
|
|
40
|
+
schMonetization?: LegacyMonetization;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { n as e, r as t, t as n } from "./resolve-browser-window-wUnycyxt.js";
|
|
2
|
+
//#region src/compatibility/warnings.ts
|
|
3
|
+
var r = "[Account SDK compatibility]", i = !1, a = () => {
|
|
4
|
+
i || (i = !0, console.warn(`${r} The legacy compatibility layer is enabled. Migrate application code to the Account API. This compatibility layer will be removed in v7.`));
|
|
5
|
+
}, o = (e, t) => {
|
|
6
|
+
console.warn(`${r} ${e} is deprecated. Use ${t} instead. It will be removed in v7.`);
|
|
7
|
+
}, s = () => {
|
|
8
|
+
console.warn(`${r} schMonetization.hasAccess() ignores the legacy userId argument. Account.hasAccess() resolves the logged-in user automatically. It will be removed in v7.`);
|
|
9
|
+
}, c = class {
|
|
10
|
+
#e;
|
|
11
|
+
#t;
|
|
12
|
+
#n = [];
|
|
13
|
+
constructor(n) {
|
|
14
|
+
this.#e = n;
|
|
15
|
+
let r = e.get(n);
|
|
16
|
+
if (!r) throw new t("Legacy compatibility requires an Account from the same SDK build");
|
|
17
|
+
this.#t = r, r.beforeUpdate = (e, t) => {
|
|
18
|
+
"userId" in e && e.userId && !("userId" in t && t.userId) && this.#a(t);
|
|
19
|
+
}, this.#e.on("logoutRequested", () => this.#a());
|
|
20
|
+
}
|
|
21
|
+
get clientId() {
|
|
22
|
+
return o("schIdentity.clientId", "account.config.clientId"), this.#e.config.clientId;
|
|
23
|
+
}
|
|
24
|
+
get env() {
|
|
25
|
+
return o("schIdentity.env", "account.config.env"), this.#e.config.env;
|
|
26
|
+
}
|
|
27
|
+
get redirectUri() {
|
|
28
|
+
return o("schIdentity.redirectUri", "account.config.redirectUri"), this.#e.config.redirectUri;
|
|
29
|
+
}
|
|
30
|
+
get _session() {
|
|
31
|
+
return o("schIdentity._session", "account.hasSession()"), this.#t.getSession();
|
|
32
|
+
}
|
|
33
|
+
hasSession() {
|
|
34
|
+
return this.#r("hasSession"), this.#e.hasSession();
|
|
35
|
+
}
|
|
36
|
+
isLoggedIn() {
|
|
37
|
+
return this.#r("isLoggedIn"), this.#e.isLoggedIn();
|
|
38
|
+
}
|
|
39
|
+
isConnected() {
|
|
40
|
+
return this.#r("isConnected"), this.#e.isConnected();
|
|
41
|
+
}
|
|
42
|
+
getUser() {
|
|
43
|
+
return this.#r("getUser"), this.#e.getUser();
|
|
44
|
+
}
|
|
45
|
+
getUserId() {
|
|
46
|
+
return this.#r("getUserId"), this.#e.getUserId();
|
|
47
|
+
}
|
|
48
|
+
getExternalId(...e) {
|
|
49
|
+
return this.#r("getExternalId"), this.#e.getExternalId(...e);
|
|
50
|
+
}
|
|
51
|
+
getUserUuid() {
|
|
52
|
+
return this.#r("getUserUuid"), this.#e.getUserUuid();
|
|
53
|
+
}
|
|
54
|
+
getUserSDRN() {
|
|
55
|
+
return this.#r("getUserSDRN"), this.#e.getUserSDRN();
|
|
56
|
+
}
|
|
57
|
+
getUserContextData() {
|
|
58
|
+
return this.#r("getUserContextData"), this.#e.getUserContextData();
|
|
59
|
+
}
|
|
60
|
+
getSpId() {
|
|
61
|
+
return this.#r("getSpId"), this.#e.getSpId();
|
|
62
|
+
}
|
|
63
|
+
login(...e) {
|
|
64
|
+
return this.#r("login"), this.#e.login(...e);
|
|
65
|
+
}
|
|
66
|
+
logout(...e) {
|
|
67
|
+
return this.#r("logout"), this.#e.logout(...e);
|
|
68
|
+
}
|
|
69
|
+
loginUrl(e, t, n, r, i, a, o, s) {
|
|
70
|
+
return this.#r("loginUrl"), typeof e == "string" ? this.#e.loginUrl({
|
|
71
|
+
state: e,
|
|
72
|
+
acrValues: t,
|
|
73
|
+
scope: n || void 0,
|
|
74
|
+
redirectUri: r || void 0,
|
|
75
|
+
loginHint: i || void 0,
|
|
76
|
+
tag: a || void 0,
|
|
77
|
+
teaser: o || void 0,
|
|
78
|
+
maxAge: Number.isNaN(Number(s)) ? void 0 : s
|
|
79
|
+
}) : this.#e.loginUrl(e);
|
|
80
|
+
}
|
|
81
|
+
logoutUrl(...e) {
|
|
82
|
+
return this.#r("logoutUrl"), this.#e.logoutUrl(...e);
|
|
83
|
+
}
|
|
84
|
+
accountUrl(...e) {
|
|
85
|
+
return this.#r("accountUrl"), this.#e.accountUrl(...e);
|
|
86
|
+
}
|
|
87
|
+
showSimplifiedLoginWidget(...e) {
|
|
88
|
+
return this.#r("showSimplifiedLoginWidget"), this.#e.showSimplifiedLoginWidget(...e);
|
|
89
|
+
}
|
|
90
|
+
clearCachedUserSession() {
|
|
91
|
+
return this.#r("clearCachedUserSession"), this.#e.clearCachedUserSession();
|
|
92
|
+
}
|
|
93
|
+
on(e, t, n) {
|
|
94
|
+
return o("schIdentity.on('logout')", "account.on('logoutRequested') and account.on('sessionUpdated')"), this.#i(e), this.#n.push({
|
|
95
|
+
listener: t,
|
|
96
|
+
context: n
|
|
97
|
+
}), this;
|
|
98
|
+
}
|
|
99
|
+
off(e, t) {
|
|
100
|
+
return o("schIdentity.off('logout')", "account.off('logoutRequested') and account.off('sessionUpdated')"), this.#i(e), this.#n = t ? this.#n.filter((e) => e.listener !== t) : [], this;
|
|
101
|
+
}
|
|
102
|
+
#r(e) {
|
|
103
|
+
o(`schIdentity.${e}()`, `account.${e}()`);
|
|
104
|
+
}
|
|
105
|
+
#i(e) {
|
|
106
|
+
if (e !== "logout") throw new t(`Account SDK legacy compatibility does not support the Identity "${e}" event`);
|
|
107
|
+
}
|
|
108
|
+
#a(...e) {
|
|
109
|
+
for (let { listener: t, context: n } of [...this.#n]) try {
|
|
110
|
+
t.apply(n, e);
|
|
111
|
+
} catch (e) {
|
|
112
|
+
console.error("[Account SDK compatibility] Legacy logout listener failed", e);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}, l = class {
|
|
116
|
+
#e;
|
|
117
|
+
constructor(e) {
|
|
118
|
+
this.#e = e;
|
|
119
|
+
}
|
|
120
|
+
hasAccess(e, t) {
|
|
121
|
+
return o("schMonetization.hasAccess()", "account.hasAccess()"), s(), this.#e.hasAccess(e);
|
|
122
|
+
}
|
|
123
|
+
clearCachedAccessResult(e, t) {
|
|
124
|
+
o("schMonetization.clearCachedAccessResult()", "account.clearCachedAccessResult()"), this.#e.clearCachedAccessResult(e, t);
|
|
125
|
+
}
|
|
126
|
+
}, u = "schAccount:ready", d = "schIdentity:ready", f = "schMonetization:ready", p = /* @__PURE__ */ new WeakSet(), m = () => new t("Account SDK legacy compatibility is not available in this browser context"), h = () => new t(`Account SDK legacy compatibility received ${u} without window.schAccount`), g = (e) => new t(`Account SDK legacy compatibility cannot define window.${e} because it already exists`), _ = (e) => {
|
|
127
|
+
for (let t of [
|
|
128
|
+
"schIdentity",
|
|
129
|
+
"Identity",
|
|
130
|
+
"schMonetization"
|
|
131
|
+
]) {
|
|
132
|
+
let n = Object.getOwnPropertyDescriptor(e, t), r = n?.configurable && "value" in n && n.value == null;
|
|
133
|
+
if (n && !r) throw g(t);
|
|
134
|
+
}
|
|
135
|
+
}, v = (e, t, n) => ({
|
|
136
|
+
configurable: !0,
|
|
137
|
+
enumerable: !0,
|
|
138
|
+
get: t,
|
|
139
|
+
set: (t) => {
|
|
140
|
+
if (t !== n) throw g(e);
|
|
141
|
+
o(`window.${e}`, "window.schAccount");
|
|
142
|
+
}
|
|
143
|
+
}), y = (e, t, n) => {
|
|
144
|
+
e.dispatchEvent(new CustomEvent(t, { detail: { instance: n } }));
|
|
145
|
+
}, b = (e, t) => {
|
|
146
|
+
_(e);
|
|
147
|
+
let n = new c(t), r = new l(t);
|
|
148
|
+
Object.defineProperties(e, {
|
|
149
|
+
schIdentity: v("schIdentity", () => (o("window.schIdentity", "window.schAccount"), n), n),
|
|
150
|
+
Identity: v("Identity", () => (o("window.Identity", "window.schAccount"), n), n),
|
|
151
|
+
schMonetization: v("schMonetization", () => (o("window.schMonetization", "window.schAccount"), r), r)
|
|
152
|
+
}), y(e, d, n), y(e, f, r);
|
|
153
|
+
};
|
|
154
|
+
function x(e = {}) {
|
|
155
|
+
let t = n(e.window);
|
|
156
|
+
if (!t) throw m();
|
|
157
|
+
if (a(), !p.has(t)) {
|
|
158
|
+
if (_(t), p.add(t), t.schAccount) {
|
|
159
|
+
b(t, t.schAccount);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
t.addEventListener(u, () => {
|
|
163
|
+
if (!t.schAccount) throw h();
|
|
164
|
+
b(t, t.schAccount);
|
|
165
|
+
}, { once: !0 });
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
//#endregion
|
|
169
|
+
export { x as enableLegacyCompatibility };
|
|
170
|
+
|
|
171
|
+
//# sourceMappingURL=compatibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compatibility.js","names":["#account","#sessionState","#emitLegacyLogout","#warn","#assertLogoutEvent","#logoutListeners","#account"],"sources":["../src/compatibility/warnings.ts","../src/compatibility/legacy-identity.ts","../src/compatibility/legacy-monetization.ts","../src/compatibility/install-legacy-compatibility.ts"],"sourcesContent":["/* Copyright 2026 Schibsted Products & Technology AS. Licensed under the terms of the MIT license.\n * See LICENSE.md in the project root.\n */\n\nconst PREFIX = '[Account SDK compatibility]';\nlet compatibilityWarningEmitted = false;\n\nexport const warnCompatibilityEnabled = (): void => {\n if (compatibilityWarningEmitted) {\n return;\n }\n compatibilityWarningEmitted = true;\n console.warn(\n `${PREFIX} The legacy compatibility layer is enabled. Migrate application code to the Account API. This compatibility layer will be removed in v7.`,\n );\n};\n\nexport const warnLegacyUsage = (legacyApi: string, replacement: string): void => {\n console.warn(\n `${PREFIX} ${legacyApi} is deprecated. Use ${replacement} instead. It will be removed in v7.`,\n );\n};\n\nexport const warnIgnoredHasAccessUserId = (): void => {\n console.warn(\n `${PREFIX} schMonetization.hasAccess() ignores the legacy userId argument. Account.hasAccess() resolves the logged-in user automatically. It will be removed in v7.`,\n );\n};\n","/* Copyright 2026 Schibsted Products & Technology AS. Licensed under the terms of the MIT license.\n * See LICENSE.md in the project root.\n */\n\nimport type { Account } from '../account.js';\nimport SDKError from '../sdk-error.js';\nimport { type SessionState, sessionStates } from '../session-state.js';\nimport type { AccountEnvironment } from '../types/common.js';\nimport type { LoginOptions } from '../types/login.js';\nimport type { SessionObjectResponse } from '../types/session.js';\nimport type { LegacyIdentity, LegacyLogoutListener } from './types.js';\nimport { warnLegacyUsage } from './warnings.js';\n\nexport class LegacyIdentityAdapter implements LegacyIdentity {\n readonly #account: Account;\n readonly #sessionState: SessionState;\n #logoutListeners: { listener: LegacyLogoutListener; context?: unknown }[] = [];\n\n constructor(account: Account) {\n this.#account = account;\n\n const sessionState = sessionStates.get(account);\n if (!sessionState) {\n throw new SDKError('Legacy compatibility requires an Account from the same SDK build');\n }\n this.#sessionState = sessionState;\n // v5 notified logout listeners before replacing _session, on every session result.\n sessionState.beforeUpdate = (previous, current) => {\n if (\n 'userId' in previous &&\n previous.userId &&\n !('userId' in current && current.userId)\n ) {\n this.#emitLegacyLogout(current);\n }\n };\n this.#account.on('logoutRequested', () => this.#emitLegacyLogout());\n }\n\n get clientId(): string {\n warnLegacyUsage('schIdentity.clientId', 'account.config.clientId');\n return this.#account.config.clientId;\n }\n\n get env(): AccountEnvironment {\n warnLegacyUsage('schIdentity.env', 'account.config.env');\n return this.#account.config.env;\n }\n\n get redirectUri(): string {\n warnLegacyUsage('schIdentity.redirectUri', 'account.config.redirectUri');\n return this.#account.config.redirectUri;\n }\n\n get _session(): LegacyIdentity['_session'] {\n warnLegacyUsage('schIdentity._session', 'account.hasSession()');\n return this.#sessionState.getSession();\n }\n\n hasSession(): ReturnType<Account['hasSession']> {\n this.#warn('hasSession');\n return this.#account.hasSession();\n }\n\n isLoggedIn(): ReturnType<Account['isLoggedIn']> {\n this.#warn('isLoggedIn');\n return this.#account.isLoggedIn();\n }\n\n isConnected(): ReturnType<Account['isConnected']> {\n this.#warn('isConnected');\n return this.#account.isConnected();\n }\n\n getUser(): ReturnType<Account['getUser']> {\n this.#warn('getUser');\n return this.#account.getUser();\n }\n\n getUserId(): ReturnType<Account['getUserId']> {\n this.#warn('getUserId');\n return this.#account.getUserId();\n }\n\n getExternalId(\n ...args: Parameters<Account['getExternalId']>\n ): ReturnType<Account['getExternalId']> {\n this.#warn('getExternalId');\n return this.#account.getExternalId(...args);\n }\n\n getUserUuid(): ReturnType<Account['getUserUuid']> {\n this.#warn('getUserUuid');\n return this.#account.getUserUuid();\n }\n\n getUserSDRN(): ReturnType<Account['getUserSDRN']> {\n this.#warn('getUserSDRN');\n return this.#account.getUserSDRN();\n }\n\n getUserContextData(): ReturnType<Account['getUserContextData']> {\n this.#warn('getUserContextData');\n return this.#account.getUserContextData();\n }\n\n getSpId(): ReturnType<Account['getSpId']> {\n this.#warn('getSpId');\n return this.#account.getSpId();\n }\n\n login(...args: Parameters<Account['login']>): ReturnType<Account['login']> {\n this.#warn('login');\n return this.#account.login(...args);\n }\n\n logout(...args: Parameters<Account['logout']>): ReturnType<Account['logout']> {\n this.#warn('logout');\n return this.#account.logout(...args);\n }\n\n loginUrl(options: LoginOptions): string;\n loginUrl(\n state: string,\n acrValues?: string,\n scope?: string,\n redirectUri?: string,\n loginHint?: string,\n tag?: string,\n teaser?: string,\n maxAge?: number | string,\n ): string;\n loginUrl(\n options: LoginOptions | string,\n acrValues?: string,\n scope?: string,\n redirectUri?: string,\n loginHint?: string,\n tag?: string,\n teaser?: string,\n maxAge?: number | string,\n ): string {\n this.#warn('loginUrl');\n if (typeof options !== 'string') {\n return this.#account.loginUrl(options);\n }\n\n // v5 treated empty positional values as omitted, except for numeric maxAge (including 0).\n return this.#account.loginUrl({\n state: options,\n acrValues,\n scope: scope || undefined,\n redirectUri: redirectUri || undefined,\n loginHint: loginHint || undefined,\n tag: tag || undefined,\n teaser: teaser || undefined,\n maxAge: Number.isNaN(Number(maxAge)) ? undefined : maxAge,\n });\n }\n\n logoutUrl(...args: Parameters<Account['logoutUrl']>): ReturnType<Account['logoutUrl']> {\n this.#warn('logoutUrl');\n return this.#account.logoutUrl(...args);\n }\n\n accountUrl(...args: Parameters<Account['accountUrl']>): ReturnType<Account['accountUrl']> {\n this.#warn('accountUrl');\n return this.#account.accountUrl(...args);\n }\n\n showSimplifiedLoginWidget(\n ...args: Parameters<Account['showSimplifiedLoginWidget']>\n ): ReturnType<Account['showSimplifiedLoginWidget']> {\n this.#warn('showSimplifiedLoginWidget');\n return this.#account.showSimplifiedLoginWidget(...args);\n }\n\n clearCachedUserSession(): ReturnType<Account['clearCachedUserSession']> {\n this.#warn('clearCachedUserSession');\n return this.#account.clearCachedUserSession();\n }\n\n on(event: 'logout', listener: LegacyLogoutListener, context?: unknown): this {\n warnLegacyUsage(\n \"schIdentity.on('logout')\",\n \"account.on('logoutRequested') and account.on('sessionUpdated')\",\n );\n this.#assertLogoutEvent(event);\n\n this.#logoutListeners.push({ listener, context });\n return this;\n }\n\n off(event: 'logout', listener?: LegacyLogoutListener): this {\n warnLegacyUsage(\n \"schIdentity.off('logout')\",\n \"account.off('logoutRequested') and account.off('sessionUpdated')\",\n );\n this.#assertLogoutEvent(event);\n\n this.#logoutListeners = listener\n ? this.#logoutListeners.filter((registered) => registered.listener !== listener)\n : [];\n return this;\n }\n\n #warn(method: keyof LegacyIdentity): void {\n warnLegacyUsage(`schIdentity.${method}()`, `account.${method}()`);\n }\n\n #assertLogoutEvent(event: string): void {\n if (event !== 'logout') {\n throw new SDKError(\n `Account SDK legacy compatibility does not support the Identity \"${event}\" event`,\n );\n }\n }\n\n #emitLegacyLogout(...args: [] | [SessionObjectResponse]): void {\n for (const { listener, context } of [...this.#logoutListeners]) {\n try {\n listener.apply(context, args);\n } catch (error) {\n // A legacy consumer must not prevent Account from updating its session.\n console.error('[Account SDK compatibility] Legacy logout listener failed', error);\n }\n }\n }\n}\n","/* Copyright 2026 Schibsted Products & Technology AS. Licensed under the terms of the MIT license.\n * See LICENSE.md in the project root.\n */\n\nimport type { Account } from '../account.js';\nimport type { SessionUserId } from '../types/session.js';\nimport type { LegacyMonetization } from './types.js';\nimport { warnIgnoredHasAccessUserId, warnLegacyUsage } from './warnings.js';\n\nexport class LegacyMonetizationAdapter implements LegacyMonetization {\n readonly #account: Account;\n\n constructor(account: Account) {\n this.#account = account;\n }\n\n hasAccess(productIds: string[], _userId: SessionUserId): ReturnType<Account['hasAccess']> {\n warnLegacyUsage('schMonetization.hasAccess()', 'account.hasAccess()');\n warnIgnoredHasAccessUserId();\n return this.#account.hasAccess(productIds);\n }\n\n clearCachedAccessResult(productIds: string[], userId: SessionUserId): void {\n warnLegacyUsage(\n 'schMonetization.clearCachedAccessResult()',\n 'account.clearCachedAccessResult()',\n );\n this.#account.clearCachedAccessResult(productIds, userId);\n }\n}\n","/* Copyright 2026 Schibsted Products & Technology AS. Licensed under the terms of the MIT license.\n * See LICENSE.md in the project root.\n */\n\nimport type { Account } from '../account.js';\nimport { resolveBrowserWindow } from '../resolve-browser-window.js';\nimport SDKError from '../sdk-error.js';\nimport { LegacyIdentityAdapter } from './legacy-identity.js';\nimport { LegacyMonetizationAdapter } from './legacy-monetization.js';\nimport type { LegacyCompatibilityOptions } from './types.js';\nimport { warnCompatibilityEnabled, warnLegacyUsage } from './warnings.js';\n\nconst ACCOUNT_READY_EVENT = 'schAccount:ready';\nconst IDENTITY_READY_EVENT = 'schIdentity:ready';\nconst MONETIZATION_READY_EVENT = 'schMonetization:ready';\n\nconst enabledWindows = new WeakSet<Window>();\n\nconst createUnavailableError = (): SDKError =>\n new SDKError('Account SDK legacy compatibility is not available in this browser context');\n\nconst createMissingAccountError = (): SDKError =>\n new SDKError(\n `Account SDK legacy compatibility received ${ACCOUNT_READY_EVENT} without window.schAccount`,\n );\n\nconst createGlobalConflictError = (globalName: string): SDKError =>\n new SDKError(\n `Account SDK legacy compatibility cannot define window.${globalName} because it already exists`,\n );\n\nconst assertLegacyGlobalsAvailable = (browserWindow: Window): void => {\n for (const globalName of ['schIdentity', 'Identity', 'schMonetization']) {\n const descriptor = Object.getOwnPropertyDescriptor(browserWindow, globalName);\n const emptyPlaceholder =\n descriptor?.configurable && 'value' in descriptor && descriptor.value == null;\n if (descriptor && !emptyPlaceholder) {\n throw createGlobalConflictError(globalName);\n }\n }\n};\n\nconst legacyGlobalDescriptor = <Instance>(\n globalName: string,\n getter: () => Instance,\n instance: Instance,\n): PropertyDescriptor => ({\n configurable: true,\n enumerable: true,\n get: getter,\n set: (value: Instance) => {\n // Some hosts still assign window.Identity = window.schIdentity after initialization.\n if (value !== instance) {\n throw createGlobalConflictError(globalName);\n }\n warnLegacyUsage(`window.${globalName}`, 'window.schAccount');\n },\n});\n\nconst dispatchReadyEvent = <Instance>(\n browserWindow: Window,\n eventName: string,\n instance: Instance,\n): void => {\n browserWindow.dispatchEvent(new CustomEvent(eventName, { detail: { instance } }));\n};\n\nconst installLegacyGlobals = (browserWindow: Window, account: Account): void => {\n assertLegacyGlobalsAvailable(browserWindow);\n\n const identityShim = new LegacyIdentityAdapter(account);\n const monetizationShim = new LegacyMonetizationAdapter(account);\n const identityGetter = () => {\n warnLegacyUsage('window.schIdentity', 'window.schAccount');\n return identityShim;\n };\n const monetizationGetter = () => {\n warnLegacyUsage('window.schMonetization', 'window.schAccount');\n return monetizationShim;\n };\n const legacyIdentityGetter = () => {\n warnLegacyUsage('window.Identity', 'window.schAccount');\n return identityShim;\n };\n\n Object.defineProperties(browserWindow, {\n schIdentity: legacyGlobalDescriptor('schIdentity', identityGetter, identityShim),\n Identity: legacyGlobalDescriptor('Identity', legacyIdentityGetter, identityShim),\n schMonetization: legacyGlobalDescriptor(\n 'schMonetization',\n monetizationGetter,\n monetizationShim,\n ),\n });\n\n dispatchReadyEvent(browserWindow, IDENTITY_READY_EVENT, identityShim);\n dispatchReadyEvent(browserWindow, MONETIZATION_READY_EVENT, monetizationShim);\n};\n\n/**\n * Enables the temporary v5 global and ready-event compatibility layer for Account SDK v6.\n *\n * Call this before `createAccountSdk()` when a dependency still expects v5 globals. If Account\n * already exists, the legacy shims are installed immediately.\n *\n * @deprecated Migrate dependencies to the Account API. This entrypoint will be removed in v7.\n */\nexport function enableLegacyCompatibility(options: LegacyCompatibilityOptions = {}): void {\n const browserWindow = resolveBrowserWindow(options.window);\n if (!browserWindow) {\n throw createUnavailableError();\n }\n\n warnCompatibilityEnabled();\n\n if (enabledWindows.has(browserWindow)) {\n return;\n }\n\n assertLegacyGlobalsAvailable(browserWindow);\n\n enabledWindows.add(browserWindow);\n\n if (browserWindow.schAccount) {\n installLegacyGlobals(browserWindow, browserWindow.schAccount);\n return;\n }\n\n browserWindow.addEventListener(\n ACCOUNT_READY_EVENT,\n () => {\n if (!browserWindow.schAccount) {\n throw createMissingAccountError();\n }\n installLegacyGlobals(browserWindow, browserWindow.schAccount);\n },\n { once: true },\n );\n}\n"],"mappings":";;AAIA,IAAM,IAAS,+BACX,IAA8B,IAErB,UAAuC;CAC5C,MAGJ,IAA8B,IAC9B,QAAQ,KACJ,GAAG,EAAO,yIACd;AACJ,GAEa,KAAmB,GAAmB,MAA8B;CAC7E,QAAQ,KACJ,GAAG,EAAO,GAAG,EAAU,sBAAsB,EAAY,oCAC7D;AACJ,GAEa,UAAyC;CAClD,QAAQ,KACJ,GAAG,EAAO,0JACd;AACJ,GCda,IAAb,MAA6D;CACzD;CACA;CACA,KAA4E,CAAC;CAE7E,YAAY,GAAkB;EAC1B,KAAKA,KAAW;EAEhB,IAAM,IAAe,EAAc,IAAI,CAAO;EAC9C,IAAI,CAAC,GACD,MAAM,IAAI,EAAS,kEAAkE;EAazF,AAXA,KAAKC,KAAgB,GAErB,EAAa,gBAAgB,GAAU,MAAY;GAC/C,AACI,YAAY,KACZ,EAAS,UACT,EAAE,YAAY,KAAW,EAAQ,WAEjC,KAAKC,GAAkB,CAAO;EAEtC,GACA,KAAKF,GAAS,GAAG,yBAAyB,KAAKE,GAAkB,CAAC;CACtE;CAEA,IAAI,WAAmB;EAEnB,OADA,EAAgB,wBAAwB,yBAAyB,GAC1D,KAAKF,GAAS,OAAO;CAChC;CAEA,IAAI,MAA0B;EAE1B,OADA,EAAgB,mBAAmB,oBAAoB,GAChD,KAAKA,GAAS,OAAO;CAChC;CAEA,IAAI,cAAsB;EAEtB,OADA,EAAgB,2BAA2B,4BAA4B,GAChE,KAAKA,GAAS,OAA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,iBAAiB,GAAe;EACnC,aAAa,EAAuB,sBAbpC,EAAgB,sBAAsB,mBAAmB,GAClD,IAY4D,CAAY;EAC/E,UAAU,EAAuB,mBANjC,EAAgB,mBAAmB,mBAAmB,GAC/C,IAK4D,CAAY;EAC/E,iBAAiB,EACb,0BAZJ,EAAgB,0BAA0B,mBAAmB,GACtD,IAaH,CACJ;CACJ,CAAC,GAED,EAAmB,GAAe,GAAsB,CAAY,GACpE,EAAmB,GAAe,GAA0B,CAAgB;AAChF;AAUA,SAAgB,EAA0B,IAAsC,CAAC,GAAS;CACtF,IAAM,IAAgB,EAAqB,EAAQ,MAAM;CACzD,IAAI,CAAC,GACD,MAAM,EAAuB;CAGjC,MAAyB,GAErB,GAAe,IAAI,CAAa,GAQpC;MAJA,EAA6B,CAAa,GAE1C,EAAe,IAAI,CAAa,GAE5B,EAAc,YAAY;GAC1B,EAAqB,GAAe,EAAc,UAAU;GAC5D;EACJ;EAEA,EAAc,iBACV,SACM;GACF,IAAI,CAAC,EAAc,YACf,MAAM,EAA0B;GAEpC,EAAqB,GAAe,EAAc,UAAU;EAChE,GACA,EAAE,MAAM,GAAK,CACjB;CAXA;AAYJ"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export * from './globals.js';
|
|
|
4
4
|
export { default as SDKError } from './sdk-error.js';
|
|
5
5
|
/** session response type guards */
|
|
6
6
|
export { isConnectedSessionResponse, isConnectedSessionWithUserIdResponse, isSessionFailureResponse, isSessionSuccessResponse, } from './session-response.js';
|
|
7
|
-
export type { AccountConfig, AccountEventListener, AccountEventName, } from './types/account.js';
|
|
7
|
+
export type { AccountConfig, AccountEventListener, AccountEventMap, AccountEventName, LoginRequestedEventDetail, LogoutRequestedEventDetail, ResolvedAccountConfig, } from './types/account.js';
|
|
8
8
|
export type { AccountEnvironment, LogFunction } from './types/common.js';
|
|
9
9
|
export type { LoginOptions, SimplifiedLoginData, SimplifiedLoginWidgetLoginOptions, SimplifiedLoginWidgetOptions, } from './types/login.js';
|
|
10
10
|
export type { HasAccessResult } from './types/monetization.js';
|