Skip to content

Commit

Permalink
Removes deprecation warnings for @magic-ext/auth methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Ariflo committed Sep 20, 2023
1 parent 8ea8cdb commit 8d700da
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 38 deletions.
36 changes: 0 additions & 36 deletions packages/@magic-sdk/provider/src/modules/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,8 @@ import { BaseModule } from './base-module';
import { createJsonRpcRequestPayload } from '../core/json-rpc';
import { SDKEnvironment } from '../core/sdk-environment';
import { UpdateEmailEvents } from './user';
import { createDeprecationWarning } from '../core/sdk-exceptions';
import { isMajorVersionAtLeast } from '../util/version-check';

export const ProductConsolidationMethodRemovalVersions = {
'magic-sdk': 'v18.0.0',
'@magic-sdk/react-native': 'v14.0.0',
'@magic-sdk/react-native-bare': 'v19.0.0',
'@magic-sdk/react-native-expo': 'v19.0.0',
};

export class AuthModule extends BaseModule {
/**
* Initiate the "magic link" login flow for a user. If the flow is successful,
Expand All @@ -41,14 +33,6 @@ export class AuthModule extends BaseModule {
);
}

createDeprecationWarning({
method: 'auth.loginWithMagicLink()',
removalVersions: ProductConsolidationMethodRemovalVersions,
useInstead: isRNMobilePackage
? '@magic-ext/auth auth.loginWithEmailOTP()'
: '@magic-ext/auth auth.loginWithMagicLink()',
}).log();

const { email, showUI = true, redirectURI } = configuration;

const requestPayload = createJsonRpcRequestPayload(
Expand All @@ -64,11 +48,6 @@ export class AuthModule extends BaseModule {
* of 15 minutes)
*/
public loginWithSMS(configuration: LoginWithSmsConfiguration) {
createDeprecationWarning({
method: 'auth.loginWithSMS()',
removalVersions: ProductConsolidationMethodRemovalVersions,
useInstead: '@magic-ext/auth auth.loginWithSMS()',
}).log();
const { phoneNumber } = configuration;
const requestPayload = createJsonRpcRequestPayload(
this.sdk.testMode ? MagicPayloadMethod.LoginWithSmsTestMode : MagicPayloadMethod.LoginWithSms,
Expand Down Expand Up @@ -116,11 +95,6 @@ export class AuthModule extends BaseModule {
* `window.location.search`.
*/
public loginWithCredential(credentialOrQueryString?: string) {
createDeprecationWarning({
method: 'auth.loginWithCredential()',
removalVersions: ProductConsolidationMethodRemovalVersions,
useInstead: '@magic-ext/auth auth.loginWithCredential()',
}).log();
let credentialResolved = credentialOrQueryString ?? '';

if (!credentialOrQueryString && SDKEnvironment.platform === 'web') {
Expand All @@ -141,21 +115,11 @@ export class AuthModule extends BaseModule {

// Custom Auth
public setAuthorizationToken(jwt: string) {
createDeprecationWarning({
method: 'auth.setAuthorizationToken()',
removalVersions: ProductConsolidationMethodRemovalVersions,
useInstead: '@magic-ext/auth auth.setAuthorizationToken()',
}).log();
const requestPayload = createJsonRpcRequestPayload(MagicPayloadMethod.SetAuthorizationToken, [{ jwt }]);
return this.request<boolean>(requestPayload);
}

public updateEmailWithUI(configuration: UpdateEmailConfiguration) {
createDeprecationWarning({
method: 'auth.updateEmailWithUI()',
removalVersions: ProductConsolidationMethodRemovalVersions,
useInstead: '@magic-ext/auth auth.updateEmailWithUI()',
}).log();
const { email, showUI = true } = configuration;
const requestPayload = createJsonRpcRequestPayload(
this.sdk.testMode ? MagicPayloadMethod.UpdateEmailTestMode : MagicPayloadMethod.UpdateEmail,
Expand Down
8 changes: 7 additions & 1 deletion packages/@magic-sdk/provider/src/modules/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ import { getItem, removeItem } from '../util/storage';
import { BaseModule } from './base-module';
import { createJsonRpcRequestPayload } from '../core/json-rpc';
import { createDeprecationWarning } from '../core/sdk-exceptions';
import { ProductConsolidationMethodRemovalVersions } from './auth';

export const ProductConsolidationMethodRemovalVersions = {
'magic-sdk': 'v18.0.0',
'@magic-sdk/react-native': 'v14.0.0',
'@magic-sdk/react-native-bare': 'v19.0.0',
'@magic-sdk/react-native-expo': 'v19.0.0',
};

export type UpdateEmailEvents = {
'email-sent': () => void;
Expand Down
2 changes: 1 addition & 1 deletion packages/@magic-sdk/provider/src/modules/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { BaseModule } from './base-module';
import { createJsonRpcRequestPayload } from '../core/json-rpc';
import { createDeprecationWarning } from '../core/sdk-exceptions';
import { setItem, getItem, removeItem } from '../util/storage';
import { ProductConsolidationMethodRemovalVersions } from './auth';
import { ProductConsolidationMethodRemovalVersions } from './user';
import { createPromiEvent } from '../util';

export type ConnectWithUiEvents = {
Expand Down

0 comments on commit 8d700da

Please sign in to comment.