Skip to content

Commit

Permalink
Changes function to accept overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdakin-magic committed Oct 17, 2023
1 parent 3210b74 commit 86ced51
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 4 additions & 5 deletions packages/@magic-sdk/provider/src/modules/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,11 @@ export class AuthModule extends BaseModule {
}).log();
}

console.log(configuration);
const { email, showUI = true, redirectURI, variation } = configuration;
const { email, showUI = true, redirectURI, overrides } = configuration;

const requestPayload = createJsonRpcRequestPayload(
this.sdk.testMode ? MagicPayloadMethod.LoginWithMagicLinkTestMode : MagicPayloadMethod.LoginWithMagicLink,
[{ email, showUI, redirectURI, variation }],
[{ email, showUI, redirectURI, overrides }],
);
return this.request<string | null, LoginWithMagicLinkEventHandlers>(requestPayload);
}
Expand All @@ -79,10 +78,10 @@ export class AuthModule extends BaseModule {
* of 15 minutes)
*/
public loginWithEmailOTP(configuration: LoginWithEmailOTPConfiguration) {
const { email, showUI, deviceCheckUI, variation } = configuration;
const { email, showUI, deviceCheckUI, overrides } = configuration;
const requestPayload = createJsonRpcRequestPayload(
this.sdk.testMode ? MagicPayloadMethod.LoginWithEmailOTPTestMode : MagicPayloadMethod.LoginWithEmailOTP,
[{ email, showUI, deviceCheckUI, variation }],
[{ email, showUI, deviceCheckUI, overrides }],
);
const handle = this.request<string | null, LoginWithEmailOTPEventHandlers>(requestPayload);
if (!deviceCheckUI && handle) {
Expand Down
8 changes: 6 additions & 2 deletions packages/@magic-sdk/types/src/modules/auth-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ export interface LoginWithMagicLinkConfiguration {
* from their dashboard. The default Magic loginWithMagicLink email will be
* overriden when a variation is passed here.
*/
variation?: string;
overrides?: {
variation?: string;
};
}

export interface LoginWithSmsConfiguration {
Expand Down Expand Up @@ -67,7 +69,9 @@ export interface LoginWithEmailOTPConfiguration {
* from their dashboard. The default Magic loginWithOTP email will be
* overriden when a variation is passed here.
*/
variation?: string;
overrides?: {
variation?: string;
};
}

/**
Expand Down

0 comments on commit 86ced51

Please sign in to comment.