Skip to content

Commit c5de18a

Browse files
committed
fix(checkout-widgets): Fix colour of Buy button
1 parent 8015ff7 commit c5de18a

File tree

4 files changed

+22
-34
lines changed

4 files changed

+22
-34
lines changed

packages/checkout/sdk/src/fiatRamp/fiatRamp.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ describe('FiatRampService', () => {
106106

107107
it(`should return widget url with non-configurable query params when onRampProvider is Transak' +
108108
'and default to IMX`, async () => {
109-
const params: FiatRampWidgetParams = {
109+
const params = {
110110
exchangeType: ExchangeType.ONRAMP,
111111
isPassport: false,
112-
};
112+
} as FiatRampWidgetParams;
113113
const result = await fiatRampService.createWidgetUrl(params, mockedHttpClient);
114114
expect(result).toContain('https://global-stg.transak.com');
115115
expect(mockedHttpClient.post).toHaveBeenCalledWith(
@@ -123,11 +123,11 @@ describe('FiatRampService', () => {
123123

124124
it(`should return widget url with encoded email, isAutoFillUserData and disableWalletAddressForm query params
125125
for passport users`, async () => {
126-
const params: FiatRampWidgetParams = {
126+
const params = {
127127
exchangeType: ExchangeType.ONRAMP,
128128
isPassport: true,
129129
130-
};
130+
} as FiatRampWidgetParams;
131131
const result = await fiatRampService.createWidgetUrl(params, mockedHttpClient);
132132
expect(result).toContain('https://global-stg.transak.com');
133133
expect(mockedHttpClient.post).toHaveBeenCalledWith(
@@ -143,10 +143,10 @@ describe('FiatRampService', () => {
143143

144144
it(`should return widget url with defaultFiatAmount and defaultCryptoCurrency query params when tokenAmount and
145145
tokenSymbol are not present`, async () => {
146-
const params: FiatRampWidgetParams = {
146+
const params = {
147147
exchangeType: ExchangeType.ONRAMP,
148148
isPassport: false,
149-
};
149+
} as FiatRampWidgetParams;
150150
const result = await fiatRampService.createWidgetUrl(params, mockedHttpClient);
151151
expect(result).toContain('https://global-stg.transak.com');
152152
expect(mockedHttpClient.post).toHaveBeenCalledWith(
@@ -161,12 +161,12 @@ describe('FiatRampService', () => {
161161

162162
it(`should return widget url with defaultCryptoAmount and cryptoCurrencyCode query params when tokenAmount and
163163
tokenSymbol is present`, async () => {
164-
const params: FiatRampWidgetParams = {
164+
const params = {
165165
exchangeType: ExchangeType.ONRAMP,
166166
isPassport: false,
167167
tokenAmount: '100',
168168
tokenSymbol: 'ETH',
169-
};
169+
} as FiatRampWidgetParams;
170170
const result = await fiatRampService.createWidgetUrl(params, mockedHttpClient);
171171
expect(result).toContain('https://global-stg.transak.com');
172172
expect(mockedHttpClient.post).toHaveBeenCalledWith(
@@ -180,11 +180,11 @@ describe('FiatRampService', () => {
180180
});
181181

182182
it('should return widget url with walletAddress query params when walletAddress is present', async () => {
183-
const params: FiatRampWidgetParams = {
183+
const params = {
184184
exchangeType: ExchangeType.ONRAMP,
185185
isPassport: false,
186186
walletAddress: '0x1234567890',
187-
};
187+
} as FiatRampWidgetParams;
188188
const result = await fiatRampService.createWidgetUrl(params, mockedHttpClient);
189189
expect(result).toContain('https://global-stg.transak.com');
190190
expect(mockedHttpClient.post).toHaveBeenCalledWith(
@@ -197,11 +197,11 @@ describe('FiatRampService', () => {
197197
});
198198

199199
it('should return widget url with allowed crypto tokens in query params when allowed list is present', async () => {
200-
const params: FiatRampWidgetParams = {
200+
const params = {
201201
exchangeType: ExchangeType.ONRAMP,
202202
isPassport: false,
203203
allowedTokens: ['ETH', 'IMX'],
204-
};
204+
} as FiatRampWidgetParams;
205205
const result = await fiatRampService.createWidgetUrl(params, mockedHttpClient);
206206
expect(result).toContain('https://global-stg.transak.com');
207207
expect(mockedHttpClient.post).toHaveBeenCalledWith(

packages/checkout/sdk/src/fiatRamp/fiatRamp.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ import { HttpClient } from '../api/http';
77
export interface FiatRampWidgetParams {
88
exchangeType: ExchangeType;
99
isPassport: boolean;
10-
walletAddress?: string;
11-
tokenAmount?: string;
12-
tokenSymbol?: string;
13-
email?: string;
14-
allowedTokens?: string[];
15-
showMenu?: boolean;
16-
customSubTitle?: string;
10+
walletAddress: string | undefined;
11+
tokenAmount: string | undefined;
12+
tokenSymbol: string | undefined;
13+
email: string | undefined;
14+
allowedTokens: string[] | undefined;
15+
showMenu: boolean | undefined;
16+
customSubTitle: string | undefined;
1717
}
1818

1919
export class FiatRampService {
@@ -57,7 +57,7 @@ export class FiatRampService {
5757
disable_payment_methods: '',
5858
products_availed: 'buy',
5959
exchange_screen_title: params.customSubTitle === '' ? ' ' : (params.customSubTitle ?? 'Buy'),
60-
theme_color: '0D0D0D',
60+
theme_color: 'FFFFFF', // this only controls the background colour of the Buy button
6161
default_crypto_currency: params.tokenSymbol || 'IMX',
6262
hide_menu: !(params.showMenu ?? true),
6363
};

packages/checkout/sdk/src/sdk.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as balances from './balances';
88
import { CheckoutConfiguration } from './config';
99
import * as connect from './connect';
1010
import { CheckoutError, CheckoutErrorType } from './errors';
11-
import { FiatRampService, FiatRampWidgetParams } from './fiatRamp';
11+
import { FiatRampService } from './fiatRamp';
1212
import * as gasEstimatorService from './gasEstimate';
1313
import * as network from './network';
1414
import * as provider from './provider';
@@ -671,7 +671,7 @@ export class Checkout {
671671
allowedTokens,
672672
showMenu: params.showMenu,
673673
customSubTitle: params.customSubTitle,
674-
} as FiatRampWidgetParams);
674+
});
675675
}
676676

677677
/**

packages/checkout/widgets-lib/src/components/Transak/useTransakIframe.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,11 @@ type UseTransakIframeProps = {
2929

3030
const MAX_GAS_LIMIT = '30000000';
3131

32-
// TODO: Move to common config file inside Checkout SDK while refactoring onRamp
33-
// TODO: Get transak config from checkout SDK
34-
export const TRANSAK_WIDGET_BASE_URL = {
35-
[Environment.SANDBOX]: 'https://global-stg.transak.com',
36-
[Environment.PRODUCTION]: 'https://global.transak.com/',
37-
};
38-
3932
export const TRANSAK_API_BASE_URL = {
4033
[Environment.SANDBOX]: 'https://api-stg.transak.com',
4134
[Environment.PRODUCTION]: 'https://api.transak.com',
4235
};
4336

44-
export const TRANSAK_ENVIRONMENT = {
45-
[Environment.SANDBOX]: 'STAGING',
46-
[Environment.PRODUCTION]: 'PRODUCTION',
47-
};
48-
4937
export const TRANSAK_API_KEY = {
5038
[Environment.SANDBOX]: 'd14b44fb-0f84-4db5-affb-e044040d724b',
5139
[Environment.PRODUCTION]: 'ad1bca70-d917-4628-bb0f-5609537498bc',

0 commit comments

Comments
 (0)