From bc6f467351fe8de5ccbbd411cc94206d850af1e1 Mon Sep 17 00:00:00 2001 From: Jeff Held Date: Tue, 22 Oct 2019 20:03:33 +0200 Subject: [PATCH] [login-with-amazon] Add scope_data to AuthorizeOptions (#39287) * Add generous overload for authorize * Add scope_data field --- types/login-with-amazon-sdk-browser/index.d.ts | 11 +++++++++++ .../login-with-amazon-sdk-browser-tests.ts | 3 +++ 2 files changed, 14 insertions(+) diff --git a/types/login-with-amazon-sdk-browser/index.d.ts b/types/login-with-amazon-sdk-browser/index.d.ts index 10fab8dfcb..56dfac1a4a 100644 --- a/types/login-with-amazon-sdk-browser/index.d.ts +++ b/types/login-with-amazon-sdk-browser/index.d.ts @@ -49,8 +49,15 @@ interface AuthorizeOptions { * */ state?: string; + scope_data?: AuthorizeScopeData; } +type AuthorizeScopeData = { + [scope in AuthorizationScopeOptions]?: { + essential: boolean; + } +}; + /** * * Accepted values for `scope` member of `authorize` options. @@ -213,6 +220,10 @@ declare namespace amazon { options: CodeAuthorizeOptions, next?: string | NextCallback ): CodeRequest; + function authorize( + options: AuthorizeOptions, + next?: string | NextCallback + ): AuthorizeRequest; /** * Retrieves the customer profile and passes it to a callback function. diff --git a/types/login-with-amazon-sdk-browser/login-with-amazon-sdk-browser-tests.ts b/types/login-with-amazon-sdk-browser/login-with-amazon-sdk-browser-tests.ts index b89e775877..f413589ae9 100644 --- a/types/login-with-amazon-sdk-browser/login-with-amazon-sdk-browser-tests.ts +++ b/types/login-with-amazon-sdk-browser/login-with-amazon-sdk-browser-tests.ts @@ -28,6 +28,9 @@ const request = amazon.Login.authorize({ response_type: "code", state: "my-state", scope: "profile", + scope_data: { + postal_code: { essential: true }, + }, }); request.onComplete("my://redirect.url");