Skip to content

Commit 7ade4a7

Browse files
committed
chore: remove old sdk dependency add device info header
1 parent b9bc3c8 commit 7ade4a7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1668
-156
lines changed

demo/Collect.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,13 @@ import {
1010
TextInput,
1111
View,
1212
} from 'react-native';
13-
import type { BTRef, BTDateRef, ElementEvent } from '../src';
13+
import type { BTRef, BTDateRef, ElementEvent, Token, TokenizeData } from '../src';
1414
import {
1515
CardExpirationDateElement,
1616
CardNumberElement,
1717
CardVerificationCodeElement,
1818
useBasisTheory,
1919
} from '../src';
20-
import type {
21-
Token,
22-
TokenizeData,
23-
} from '@basis-theory/basis-theory-js/types/models';
2420
import { styles } from './styles';
2521
import type { ElementEvents } from '../App';
2622
import { EncryptedToken, EncryptToken } from '../src/model/EncryptTokenData';
@@ -314,3 +310,4 @@ export const Collect = () => {
314310
</View>
315311
);
316312
};
313+

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"test": "jest"
1818
},
1919
"dependencies": {
20-
"@basis-theory/basis-theory-js": "^4.28.2",
2120
"@noble/ciphers": "^1.3.0",
2221
"@noble/curves": "^1.9.2",
2322
"@noble/hashes": "^1.8.0",

src/components/CardNumberElement.hook.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { CreditCardType } from '@basis-theory/basis-theory-js/types/elements';
1+
import type { CreditCardType } from '../types';
22
import type { ForwardedRef } from 'react';
33
import { useId, useRef, useState } from 'react';
44
import type { TextInput } from 'react-native';

src/components/useCustomBin.hook.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { CreditCardType } from '@basis-theory/basis-theory-js/types/elements';
1+
import type { CreditCardType } from '../types';
22
import { creditCardType } from 'card-validator';
33
import { always, compose, groupBy, ifElse, isEmpty } from 'ramda';
44
import { useEffect, useState } from 'react';

src/index.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,28 @@ export { TextElement } from './components/TextElement';
77
export { BasisTheoryProvider } from './BasisTheoryProvider';
88
export { useBasisTheory } from './useBasisTheory';
99
export type { BTRef, BTDateRef, ElementEvent } from './BaseElementTypes';
10-
export type { Token } from '@basis-theory/basis-theory-js/types/models';
10+
export type {
11+
Token,
12+
CreateToken,
13+
UpdateToken,
14+
TokenizeData,
15+
CreateSessionResponse,
16+
CreateTokenIntent,
17+
TokenIntent,
18+
RequestOptions,
19+
DeviceInfo,
20+
BasisTheoryInstance,
21+
CreditCardType,
22+
VISA,
23+
MASTERCARD,
24+
AMERICAN_EXPRESS,
25+
DINERS_CLUB,
26+
DISCOVER,
27+
JCB,
28+
UNIONPAY,
29+
MAESTRO,
30+
ELO,
31+
MIR,
32+
HIPER,
33+
HIPERCARD,
34+
} from './types';

src/model/EncryptTokenData.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
// TODO: Migrate to web-elements when we completely drop basis-theory-js
2-
import {
3-
CreateToken,
4-
Primitive,
5-
TokenBase,
6-
} from '@basis-theory/basis-theory-js/types/models';
1+
import type { CreateToken } from '../types';
72
import { BTRef, InputBTRefWithDatepart } from '../BaseElementTypes';
83

94
/**
105
* Represents token data with element references for secure input handling.
116
* Used when creating tokens that contain form element references instead of raw values.
127
*/
8+
// Primitive types
9+
type Primitive = string | number | boolean | null | undefined;
10+
1311
type TokenDataWithRef = {
1412
/** Key-value pairs where values are element references or date part references */
1513
data: Record<string, BTRef | InputBTRefWithDatepart | null | undefined | Primitive>;
16-
type: TokenBase['type'];
14+
type: string;
1715
};
1816

1917
type TokenData = Pick<CreateToken, 'type' | 'data'>;
@@ -44,7 +42,7 @@ type EncryptedSingleToken = {
4442
encrypted: string;
4543

4644
/** Original token type before encryption */
47-
type: TokenBase['type'];
45+
type: string;
4846
};
4947

5048
type EncryptedToken = EncryptedSingleToken | Record<string, EncryptedSingleToken>;

src/modules/proxy.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1-
import type { BasisTheory } from '@basis-theory/basis-theory-js';
2-
import type {
3-
ProxyRequestOptions,
4-
BasisTheory as BasisTheoryType,
5-
} from '@basis-theory/basis-theory-js/types/sdk';
1+
import type { ProxyRequestOptions, BasisTheoryInstance } from '../types';
62

73
import { replaceSensitiveData } from '../utils/dataManipulationUtils';
84

9-
export const Proxy = (bt: BasisTheoryType) => {
5+
export const Proxy = (bt: BasisTheoryInstance) => {
106
const proxy = async (
117
{
128
method,
139
...proxyRequest
1410
}: Omit<ProxyRequestOptions, 'includeResponseHeaders'> & {
15-
method: keyof BasisTheory['proxy'];
11+
method: keyof BasisTheoryInstance['proxy'];
1612
},
1713
apiKey?: string
1814
): Promise<unknown> => {

src/modules/sessions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { BasisTheory as BasisTheoryType } from '@basis-theory/basis-theory-js/types/sdk';
1+
import type { BasisTheoryInstance } from '../types';
22

3-
export const Sessions = (bt: BasisTheoryType) => {
3+
export const Sessions = (bt: BasisTheoryInstance) => {
44
const create = async () => {
55
try {
66
const session = await bt.sessions.create();

src/modules/tokenIntents.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import type {
22
CreateTokenIntent,
33
TokenIntent,
4-
} from '@basis-theory/basis-theory-js/types/models';
5-
import type {
6-
BasisTheory as BasisTheoryType,
74
RequestOptions,
8-
} from '@basis-theory/basis-theory-js/types/sdk';
5+
BasisTheoryInstance,
6+
} from '../types';
97
import type {
108
BTRef,
119
InputBTRefWithDatepart,
@@ -23,7 +21,7 @@ export type TokenIntentData = TokenIntent<
2321
BTRef | InputBTRefWithDatepart | PrimitiveType
2422
>;
2523

26-
export const TokenIntents = (bt: BasisTheoryType) => {
24+
export const TokenIntents = (bt: BasisTheoryInstance) => {
2725
const create = async (
2826
tokenIntentWithRef: CreateTokenIntentWithBtRef,
2927
requestOptions?: RequestOptions

src/modules/tokens.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@ import type {
33
UpdateToken,
44
Token,
55
TokenizeData as _TokenizeData,
6-
} from '@basis-theory/basis-theory-js/types/models';
7-
import type {
8-
BasisTheory as BasisTheoryType,
96
RequestOptions,
10-
} from '@basis-theory/basis-theory-js/types/sdk';
7+
BasisTheoryInstance,
8+
} from '../types';
119
import type {
1210
BTRef,
1311
InputBTRefWithDatepart,
@@ -37,7 +35,7 @@ export type TokenizeData = _TokenizeData<
3735
BTRef | InputBTRefWithDatepart | PrimitiveType
3836
>;
3937

40-
export const Tokens = (bt: BasisTheoryType) => {
38+
export const Tokens = (bt: BasisTheoryInstance) => {
4139
setupEncryption();
4240

4341
const getTokenById = async <T>(id: string, apiKey?: string) => {

0 commit comments

Comments
 (0)