@schibsted/account-sdk-browser 6.0.0-alpha.3 → 6.0.0-alpha.5
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/account.d.ts +2 -0
- package/dist/globals.d.ts +0 -4
- package/dist/identity.d.ts +1 -43
- package/dist/index.d.ts +2 -1
- package/dist/index.js +220 -249
- package/dist/index.js.map +1 -1
- package/dist/monetization.d.ts +2 -15
- package/dist/types/account.d.ts +10 -2
- package/dist/types/identity.d.ts +0 -18
- package/dist/types/session.d.ts +3 -3
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/account.ts +14 -12
- package/src/globals.ts +0 -4
- package/src/identity.ts +1 -164
- package/src/index.ts +1 -1
- package/src/monetization.ts +3 -27
- package/src/session-response.ts +1 -7
- package/src/types/account.ts +10 -9
- package/src/types/identity.ts +0 -29
- package/src/types/session.ts +3 -3
- package/src/version.ts +1 -1
- package/dist/get-account-sdk.d.ts +0 -3
- package/dist/global-registry.d.ts +0 -23
- package/dist/types/monetization-guards.d.ts +0 -2
- package/dist/types/session-guards.d.ts +0 -36
- package/src/get-account-sdk.ts +0 -94
- package/src/global-registry.ts +0 -39
- package/src/types/monetization-guards.ts +0 -35
- package/src/types/session-guards.ts +0 -89
package/dist/account.d.ts
CHANGED
|
@@ -13,12 +13,14 @@ export declare class Account {
|
|
|
13
13
|
isConnected(): Promise<boolean>;
|
|
14
14
|
getUser(): Promise<ConnectedSessionResponse>;
|
|
15
15
|
getUserId(): Promise<string>;
|
|
16
|
+
getUserUuid(): Promise<string>;
|
|
16
17
|
getUserSDRN(): Promise<string>;
|
|
17
18
|
getUserContextData(): Promise<SimplifiedLoginData | null>;
|
|
18
19
|
getSpId(): Promise<string | null>;
|
|
19
20
|
login(options: LoginOptions): Window | null;
|
|
20
21
|
logout(redirectUri?: string): void;
|
|
21
22
|
loginUrl(options: LoginOptions): string;
|
|
23
|
+
accountUrl(redirectUri?: string): string;
|
|
22
24
|
showSimplifiedLoginWidget(loginParams: SimplifiedLoginWidgetLoginOptions, options?: SimplifiedLoginWidgetOptions): Promise<boolean>;
|
|
23
25
|
clearCachedUserSession(): void;
|
|
24
26
|
hasAccess(productIds: string[], userId: SessionUserId): Promise<HasAccessResult | null>;
|
package/dist/globals.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { Account } from './account.js';
|
|
2
|
-
import { Identity } from './identity.js';
|
|
3
|
-
import { Monetization } from './monetization.js';
|
|
4
2
|
declare global {
|
|
5
3
|
interface Window {
|
|
6
4
|
schAccount?: Account;
|
|
7
|
-
schIdentity?: Identity;
|
|
8
|
-
schMonetization?: Monetization;
|
|
9
5
|
SPiD?: {
|
|
10
6
|
Talk?: {
|
|
11
7
|
response?: (callbackName: string, data: unknown) => unknown;
|
package/dist/identity.d.ts
CHANGED
|
@@ -5,8 +5,6 @@ import { LogFunction } from './types/common.js';
|
|
|
5
5
|
import { IdentityBeforeRedirectCallback, IdentityOptions, VarnishCookieOptions } from './types/identity.js';
|
|
6
6
|
import { LoginOptions, OpenSimplifiedLoginWidget, SimplifiedLoginData, SimplifiedLoginWidgetLoginOptions, SimplifiedLoginWidgetOptions } from './types/login.js';
|
|
7
7
|
import { ConnectedSessionResponse, SessionObjectResponse, SessionResponse } from './types/session.js';
|
|
8
|
-
export { isConnectedSessionResponse, isSessionSuccessResponse } from './session-response.js';
|
|
9
|
-
export type { ConnectedSessionResponse, SessionFailureResponse, SessionObjectResponse, SessionResponse, SessionSuccessResponse, SessionUserId, } from './types/session.js';
|
|
10
8
|
declare global {
|
|
11
9
|
interface Window {
|
|
12
10
|
openSimplifiedLoginWidget?: OpenSimplifiedLoginWidget;
|
|
@@ -16,7 +14,6 @@ declare global {
|
|
|
16
14
|
* Provides Identity functionalty to a web page
|
|
17
15
|
*/
|
|
18
16
|
export declare class Identity extends TinyEmitter {
|
|
19
|
-
_sessionInitiatedSent: boolean;
|
|
20
17
|
window: Window;
|
|
21
18
|
clientId: string;
|
|
22
19
|
sessionStorageCache: Cache;
|
|
@@ -116,11 +113,6 @@ export declare class Identity extends TinyEmitter {
|
|
|
116
113
|
* @private
|
|
117
114
|
*/
|
|
118
115
|
_clearVarnishCookie(): void;
|
|
119
|
-
/**
|
|
120
|
-
* Log used settings and version
|
|
121
|
-
* @throws {SDKError} - If log method is not provided
|
|
122
|
-
*/
|
|
123
|
-
logSettings(): void;
|
|
124
116
|
/**
|
|
125
117
|
* @summary Queries the hassession endpoint and returns information about the status of the user
|
|
126
118
|
* @remarks When we send a request to this endpoint, cookies sent along with the request
|
|
@@ -129,12 +121,6 @@ export declare class Identity extends TinyEmitter {
|
|
|
129
121
|
* if, say, the user is not logged in)
|
|
130
122
|
* @fires Identity#login
|
|
131
123
|
* @fires Identity#logout
|
|
132
|
-
* @fires Identity#userChange
|
|
133
|
-
* @fires Identity#sessionChange
|
|
134
|
-
* @fires Identity#notLoggedin
|
|
135
|
-
* @fires Identity#sessionInit
|
|
136
|
-
* @fires Identity#statusChange
|
|
137
|
-
* @fires Identity#error
|
|
138
124
|
*/
|
|
139
125
|
hasSession(): Promise<SessionResponse>;
|
|
140
126
|
/**
|
|
@@ -166,8 +152,7 @@ export declare class Identity extends TinyEmitter {
|
|
|
166
152
|
getUser(): Promise<ConnectedSessionResponse>;
|
|
167
153
|
/**
|
|
168
154
|
* @summary
|
|
169
|
-
* In Schibsted account, there are multiple ways of identifying a user; the `userId
|
|
170
|
-
* `uuid` and `externalId` used for identifying a user-merchant pair (see {@link Identity#getExternalId}).
|
|
155
|
+
* In Schibsted account, there are multiple ways of identifying a user; the `userId` or `uuid`.
|
|
171
156
|
* There are reasons for them all to exist. The `userId` is a numeric identifier, but
|
|
172
157
|
* since Schibsted account is deployed separately in Norway and Sweden, there are a lot of
|
|
173
158
|
* duplicates. The `userId` was introduced early, so many sites still need to use them for
|
|
@@ -179,28 +164,6 @@ export declare class Identity extends TinyEmitter {
|
|
|
179
164
|
* @return The `userId` field (not to be confused with the `uuid`)
|
|
180
165
|
*/
|
|
181
166
|
getUserId(): Promise<string>;
|
|
182
|
-
/**
|
|
183
|
-
* @function
|
|
184
|
-
* @summary
|
|
185
|
-
* Retrieves the external identifier (`externalId`) for the authenticated user.
|
|
186
|
-
*
|
|
187
|
-
* In Schibsted Account there are multiple ways of identifying users, however for integrations with
|
|
188
|
-
* third-parties it's recommended to use `externalId` as it does not disclose
|
|
189
|
-
* any critical data whilst allowing for user identification.
|
|
190
|
-
*
|
|
191
|
-
* `externalId` is merchant-scoped using a pairwise identifier (`pairId`),
|
|
192
|
-
* meaning the same user's ID will differ between merchants.
|
|
193
|
-
* Additionally, this identifier is bound to the external party provided as argument.
|
|
194
|
-
*
|
|
195
|
-
* @param externalParty
|
|
196
|
-
* @param optionalSuffix
|
|
197
|
-
* @remarks This function calls {@link Identity#hasSession} internally and thus has the side
|
|
198
|
-
* effect that it might perform an auto-login on the user
|
|
199
|
-
* @throws {SDKError} If the `pairId` is missing in user session.
|
|
200
|
-
* @throws {SDKError} If the `externalParty` is not defined
|
|
201
|
-
* @return The merchant- and 3rd-party-specific `externalId`
|
|
202
|
-
*/
|
|
203
|
-
getExternalId(externalParty: string, optionalSuffix?: string): Promise<string>;
|
|
204
167
|
/**
|
|
205
168
|
* @summary Enables brands to programmatically get the current the SDRN based on the user's session.
|
|
206
169
|
* @remarks This function calls {@link Identity#hasSession} internally and thus has the side
|
|
@@ -300,11 +263,6 @@ export declare class Identity extends TinyEmitter {
|
|
|
300
263
|
* @param redirectUri
|
|
301
264
|
*/
|
|
302
265
|
accountUrl(redirectUri?: string): string;
|
|
303
|
-
/**
|
|
304
|
-
* The phone editing page url
|
|
305
|
-
* @param redirectUri
|
|
306
|
-
*/
|
|
307
|
-
phonesUrl(redirectUri?: string): string;
|
|
308
266
|
/**
|
|
309
267
|
* Function responsible for loading and displaying simplified login widget. How often
|
|
310
268
|
* widget will be display is up to you. Preferred way would be to show it once per user,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { Account } from './account.js';
|
|
2
2
|
export { createAccountSdk, getAccountSdk } from './account-sdk.js';
|
|
3
|
+
export * from './globals.js';
|
|
3
4
|
export { default as SDKError } from './sdk-error.js';
|
|
4
|
-
export type { AccountConfig, AccountEventHandler, AccountEventName,
|
|
5
|
+
export type { AccountConfig, AccountEventHandler, AccountEventName, } from './types/account.js';
|
|
5
6
|
export type { AccountEnvironment, LogFunction } from './types/common.js';
|
|
6
7
|
export type { LoginOptions, SimplifiedLoginData, SimplifiedLoginWidgetLoginOptions, SimplifiedLoginWidgetOptions, } from './types/login.js';
|
|
7
8
|
export type { HasAccessResult } from './types/monetization.js';
|