@schibsted/account-sdk-browser 4.5.0 → 4.6.0
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/CHANGELOG.md +20 -0
- package/README.md +3 -1
- package/es5/global.js +41 -4
- package/es5/global.js.map +1 -1
- package/es5/global.min.js +1 -1
- package/es5/global.min.js.map +1 -1
- package/es5/identity.js +40 -4
- package/es5/identity.js.map +1 -1
- package/es5/identity.min.js +1 -1
- package/es5/identity.min.js.map +1 -1
- package/es5/index.js +41 -4
- package/es5/index.js.map +1 -1
- package/es5/index.min.js +1 -1
- package/es5/index.min.js.map +1 -1
- package/es5/monetization.js +1 -1
- package/es5/monetization.min.js +1 -1
- package/es5/payment.js +1 -0
- package/es5/payment.js.map +1 -1
- package/es5/payment.min.js.map +1 -1
- package/identity.d.ts +1 -0
- package/index.d.ts +1 -0
- package/monetization.d.ts +1 -0
- package/package.json +1 -1
- package/payment.d.ts +1 -0
- package/src/identity.d.ts +73 -3
- package/src/identity.js +38 -3
- package/src/payment.d.ts +1 -0
- package/src/payment.js +1 -0
package/identity.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/identity.js";
|
package/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/monetization.js";
|
package/package.json
CHANGED
package/payment.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/payment.js";
|
package/src/identity.d.ts
CHANGED
|
@@ -297,12 +297,12 @@ export class Identity {
|
|
|
297
297
|
* and store that info in localStorage. Widget will be display only if user is logged in to SSO.
|
|
298
298
|
*
|
|
299
299
|
* @async
|
|
300
|
-
* @param {
|
|
300
|
+
* @param {SimplifiedLoginWidgetLoginOptions} loginParams - the same as `options` param for login function. Login will be called on user
|
|
301
301
|
* continue action. `state` might be string or async function.
|
|
302
302
|
* @param {SimplifiedLoginWidgetOptions} [options] - additional configuration of Simplified Login Widget
|
|
303
303
|
* @return {Promise<boolean|SDKError>} - will resolve to true if widget will be display. Otherwise will throw SDKError
|
|
304
304
|
*/
|
|
305
|
-
showSimplifiedLoginWidget(loginParams:
|
|
305
|
+
showSimplifiedLoginWidget(loginParams: SimplifiedLoginWidgetLoginOptions, options?: SimplifiedLoginWidgetOptions): Promise<boolean | SDKError>;
|
|
306
306
|
}
|
|
307
307
|
export default Identity;
|
|
308
308
|
export type LoginOptions = {
|
|
@@ -311,6 +311,76 @@ export type LoginOptions = {
|
|
|
311
311
|
* the request and callback. It's also recommended to prevent CSRF {@link https://tools.ietf.org/html/rfc6749#section-10.12}
|
|
312
312
|
*/
|
|
313
313
|
state: string;
|
|
314
|
+
/**
|
|
315
|
+
* - Authentication Context Class Reference Values. If
|
|
316
|
+
* omitted, the user will be asked to authenticate using username+password.
|
|
317
|
+
* For 2FA (Two-Factor Authentication) possible values are `sms`, `otp` (one time password),
|
|
318
|
+
* `password` (will force password confirmation, even if user is already logged in), `eid`. Those values might
|
|
319
|
+
* be mixed as space-separated string. To make sure that user has authenticated with 2FA you need
|
|
320
|
+
* to verify AMR (Authentication Methods References) claim in ID token.
|
|
321
|
+
* Might also be used to ensure additional acr (sms, otp, eid) for already logged in users.
|
|
322
|
+
* Supported values are also 'otp-email' means one time password using email, and 'otp-sms' means
|
|
323
|
+
* one time password using sms.
|
|
324
|
+
*/
|
|
325
|
+
acrValues?: string;
|
|
326
|
+
/**
|
|
327
|
+
* - The OAuth scopes for the tokens. This is a list of
|
|
328
|
+
* scopes, separated by space. If the list of scopes contains `openid`, the generated tokens
|
|
329
|
+
* includes the id token which can be useful for getting information about the user. Omitting
|
|
330
|
+
* scope is allowed, while `invalid_scope` is returned when the client asks for a scope you
|
|
331
|
+
* aren’t allowed to request. {@link https://tools.ietf.org/html/rfc6749#section-3.3}
|
|
332
|
+
*/
|
|
333
|
+
scope?: string;
|
|
334
|
+
/**
|
|
335
|
+
* - Redirect uri that will receive the
|
|
336
|
+
* code. Must exactly match a redirectUri from your client in self-service
|
|
337
|
+
*/
|
|
338
|
+
redirectUri?: string;
|
|
339
|
+
/**
|
|
340
|
+
* - Should we try to open a popup window?
|
|
341
|
+
*/
|
|
342
|
+
preferPopup?: boolean;
|
|
343
|
+
/**
|
|
344
|
+
* - user email or UUID hint
|
|
345
|
+
*/
|
|
346
|
+
loginHint?: string;
|
|
347
|
+
/**
|
|
348
|
+
* - Pulse tag
|
|
349
|
+
*/
|
|
350
|
+
tag?: string;
|
|
351
|
+
/**
|
|
352
|
+
* - Teaser slug. Teaser with given slug will be displayed
|
|
353
|
+
* in place of default teaser
|
|
354
|
+
*/
|
|
355
|
+
teaser?: string;
|
|
356
|
+
/**
|
|
357
|
+
* - Specifies the allowable elapsed time in seconds since
|
|
358
|
+
* the last time the End-User was actively authenticated. If last authentication time is more
|
|
359
|
+
* than maxAge seconds in the past, re-authentication will be required. See the OpenID Connect
|
|
360
|
+
* spec section 3.1.2.1 for more information
|
|
361
|
+
*/
|
|
362
|
+
maxAge?: number | string;
|
|
363
|
+
/**
|
|
364
|
+
* - Optional parameter to overwrite client locale setting.
|
|
365
|
+
* New flows supports nb_NO, fi_FI, sv_SE, en_US
|
|
366
|
+
*/
|
|
367
|
+
locale?: string;
|
|
368
|
+
/**
|
|
369
|
+
* - display username and password on one screen
|
|
370
|
+
*/
|
|
371
|
+
oneStepLogin?: boolean;
|
|
372
|
+
/**
|
|
373
|
+
* - String that specifies whether the Authorization Server prompts the
|
|
374
|
+
* End-User for reauthentication or confirm account screen. Supported values: `select_account` or `login`
|
|
375
|
+
*/
|
|
376
|
+
prompt?: string;
|
|
377
|
+
};
|
|
378
|
+
export type SimplifiedLoginWidgetLoginOptions = {
|
|
379
|
+
/**
|
|
380
|
+
* - An opaque value used by the client to maintain state between
|
|
381
|
+
* the request and callback. It's also recommended to prevent CSRF {@link https://tools.ietf.org/html/rfc6749#section-10.12}
|
|
382
|
+
*/
|
|
383
|
+
state: string | (() => (string | Promise<string>));
|
|
314
384
|
/**
|
|
315
385
|
* - Authentication Context Class Reference Values. If
|
|
316
386
|
* omitted, the user will be asked to authenticate using username+password.
|
|
@@ -328,7 +398,7 @@ export type LoginOptions = {
|
|
|
328
398
|
* scopes, separated by space. If the list of scopes contains `openid`, the generated tokens
|
|
329
399
|
* includes the id token which can be useful for getting information about the user. Omitting
|
|
330
400
|
* scope is allowed, while `invalid_scope` is returned when the client asks for a scope you
|
|
331
|
-
* aren’t allowed to request. {@link https://tools.ietf.org/html/rfc6749#section-3.3}
|
|
401
|
+
* aren’t allowed to request. {@link https ://tools.ietf.org/html/rfc6749#section-3.3}
|
|
332
402
|
*/
|
|
333
403
|
scope?: string;
|
|
334
404
|
/**
|
package/src/identity.js
CHANGED
|
@@ -22,6 +22,41 @@ const { version } = require('../package.json');
|
|
|
22
22
|
* the request and callback. It's also recommended to prevent CSRF {@link https://tools.ietf.org/html/rfc6749#section-10.12}
|
|
23
23
|
* @property {string} [acrValues] - Authentication Context Class Reference Values. If
|
|
24
24
|
* omitted, the user will be asked to authenticate using username+password.
|
|
25
|
+
* For 2FA (Two-Factor Authentication) possible values are `sms`, `otp` (one time password),
|
|
26
|
+
* `password` (will force password confirmation, even if user is already logged in), `eid`. Those values might
|
|
27
|
+
* be mixed as space-separated string. To make sure that user has authenticated with 2FA you need
|
|
28
|
+
* to verify AMR (Authentication Methods References) claim in ID token.
|
|
29
|
+
* Might also be used to ensure additional acr (sms, otp) for already logged in users.
|
|
30
|
+
* Supported values are also 'otp-email' means one time password using email, and 'otp-sms' means
|
|
31
|
+
* one time password using sms.
|
|
32
|
+
* @property {string} [scope] - The OAuth scopes for the tokens. This is a list of
|
|
33
|
+
* scopes, separated by space. If the list of scopes contains `openid`, the generated tokens
|
|
34
|
+
* includes the id token which can be useful for getting information about the user. Omitting
|
|
35
|
+
* scope is allowed, while `invalid_scope` is returned when the client asks for a scope you
|
|
36
|
+
* aren’t allowed to request. {@link https://tools.ietf.org/html/rfc6749#section-3.3}
|
|
37
|
+
* @property {string} [redirectUri] - Redirect uri that will receive the
|
|
38
|
+
* code. Must exactly match a redirectUri from your client in self-service
|
|
39
|
+
* @property {boolean} [preferPopup] - Should we try to open a popup window?
|
|
40
|
+
* @property {string} [loginHint] - user email or UUID hint
|
|
41
|
+
* @property {string} [tag] - Pulse tag
|
|
42
|
+
* @property {string} [teaser] - Teaser slug. Teaser with given slug will be displayed
|
|
43
|
+
* in place of default teaser
|
|
44
|
+
* @property {number|string} [maxAge] - Specifies the allowable elapsed time in seconds since
|
|
45
|
+
* the last time the End-User was actively authenticated. If last authentication time is more
|
|
46
|
+
* than maxAge seconds in the past, re-authentication will be required. See the OpenID Connect
|
|
47
|
+
* spec section 3.1.2.1 for more information
|
|
48
|
+
* @property {string} [locale] - Optional parameter to overwrite client locale setting.
|
|
49
|
+
* New flows supports nb_NO, fi_FI, sv_SE, en_US
|
|
50
|
+
* @property {boolean} [oneStepLogin] - display username and password on one screen
|
|
51
|
+
* @property {string} [prompt] - String that specifies whether the Authorization Server prompts the
|
|
52
|
+
* End-User for reauthentication or confirm account screen. Supported values: `select_account` or `login`
|
|
53
|
+
*/
|
|
54
|
+
/**
|
|
55
|
+
* @typedef {object} SimplifiedLoginWidgetLoginOptions
|
|
56
|
+
* @property {string|function(): (string|Promise<string>)} state - An opaque value used by the client to maintain state between
|
|
57
|
+
* the request and callback. It's also recommended to prevent CSRF {@link https://tools.ietf.org/html/rfc6749#section-10.12}
|
|
58
|
+
* @property {string} [acrValues] - Authentication Context Class Reference Values. If
|
|
59
|
+
* omitted, the user will be asked to authenticate using username+password.
|
|
25
60
|
* For 2FA (Two-Factor Authentication) possible values are `sms`, `otp` (one time password) and
|
|
26
61
|
* `password` (will force password confirmation, even if user is already logged in). Those values might
|
|
27
62
|
* be mixed as space-separated string. To make sure that user has authenticated with 2FA you need
|
|
@@ -48,7 +83,7 @@ const { version } = require('../package.json');
|
|
|
48
83
|
* @property {string} [locale] - Optional parameter to overwrite client locale setting.
|
|
49
84
|
* New flows supports nb_NO, fi_FI, sv_SE, en_US
|
|
50
85
|
* @property {boolean} [oneStepLogin] - display username and password on one screen
|
|
51
|
-
* @property {string} [prompt] - String that specifies whether the Authorization Server prompts the
|
|
86
|
+
* @property {string} [prompt] - String that specifies whether the Authorization Server prompts the
|
|
52
87
|
* End-User for reauthentication or confirm account screen. Supported values: `select_account` or `login`
|
|
53
88
|
*/
|
|
54
89
|
|
|
@@ -748,7 +783,7 @@ export class Identity extends EventEmitter {
|
|
|
748
783
|
teaser = arguments[6] || teaser;
|
|
749
784
|
maxAge = isNaN(arguments[7]) ? maxAge : arguments[7];
|
|
750
785
|
}
|
|
751
|
-
const isValidAcrValue = (acrValue) => isStrIn(acrValue, ['password', 'otp', 'sms'], true);
|
|
786
|
+
const isValidAcrValue = (acrValue) => isStrIn(acrValue, ['password', 'otp', 'sms', 'eid-no', 'eid-se', 'eid'], true);
|
|
752
787
|
assert(!acrValues || isStrIn(acrValues, ['', 'otp-email', 'otp-sms'], true) || acrValues.split(' ').every(isValidAcrValue),
|
|
753
788
|
`The acrValues parameter is not acceptable: ${acrValues}`);
|
|
754
789
|
assert(isUrl(redirectUri),
|
|
@@ -813,7 +848,7 @@ export class Identity extends EventEmitter {
|
|
|
813
848
|
* and store that info in localStorage. Widget will be display only if user is logged in to SSO.
|
|
814
849
|
*
|
|
815
850
|
* @async
|
|
816
|
-
* @param {
|
|
851
|
+
* @param {SimplifiedLoginWidgetLoginOptions} loginParams - the same as `options` param for login function. Login will be called on user
|
|
817
852
|
* continue action. `state` might be string or async function.
|
|
818
853
|
* @param {SimplifiedLoginWidgetOptions} [options] - additional configuration of Simplified Login Widget
|
|
819
854
|
* @return {Promise<boolean|SDKError>} - will resolve to true if widget will be display. Otherwise will throw SDKError
|
package/src/payment.d.ts
CHANGED
|
@@ -101,6 +101,7 @@ export class Payment {
|
|
|
101
101
|
*/
|
|
102
102
|
purchaseCampaignFlowUrl(campaignId: string, productId: string, voucherCode?: string, redirectUri?: string): string;
|
|
103
103
|
/**
|
|
104
|
+
* @deprecated
|
|
104
105
|
* Get the url for flow to purchase a promo code product with ZUORA
|
|
105
106
|
* @param {string} code - promocode product code
|
|
106
107
|
* @param {string} [state=''] - An opaque value used by the client to maintain state between
|
package/src/payment.js
CHANGED
|
@@ -185,6 +185,7 @@ export class Payment {
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
/**
|
|
188
|
+
* @deprecated
|
|
188
189
|
* Get the url for flow to purchase a promo code product with ZUORA
|
|
189
190
|
* @param {string} code - promocode product code
|
|
190
191
|
* @param {string} [state=''] - An opaque value used by the client to maintain state between
|