Skip to content

Commit dddbeea

Browse files
committed
Release Version - 0.49.6
1 parent 70ac9cb commit dddbeea

File tree

6 files changed

+27
-23
lines changed

6 files changed

+27
-23
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@boldcommerce/checkout-frontend-library",
3-
"version": "0.49.5",
3+
"version": "0.49.6",
44
"main": "lib/index.js",
55
"types": "lib/index.d.ts",
66
"license": "MIT",

src/state/setDisplayCurrency.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {ICurrency} from 'src';
2-
import {display_currency} from 'src/variables';
2+
import {applicationState} from 'src/variables';
33

44
export function setDisplayCurrency({
55
iso_code,
@@ -9,10 +9,12 @@ export function setDisplayCurrency({
99
has_decimal,
1010
show_iso_code
1111
}: ICurrency): void {
12-
display_currency.symbol = symbol;
13-
display_currency.format = format;
14-
display_currency.has_decimal = has_decimal;
15-
display_currency.iso_code = iso_code;
16-
display_currency.show_iso_code = show_iso_code;
17-
display_currency.iso_numeric_code = iso_numeric_code;
12+
applicationState.display_currency = {
13+
iso_code,
14+
iso_numeric_code,
15+
symbol,
16+
format,
17+
has_decimal,
18+
show_iso_code
19+
};
1820
}

src/types/apiInterfaces.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,8 @@ export interface IApplicationState {
492492
order_total: number;
493493
order_meta_data: IOrderMetaData;
494494
currency: ICurrency;
495-
display_currency: ICurrency | undefined;
496-
display_exchange_rate: number | undefined;
495+
display_currency: ICurrency | null;
496+
display_exchange_rate: number | null;
497497
resumable_link: string | null;
498498
link_to_cart: string | null;
499499
is_processed: boolean;

src/variables/variables.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,7 @@ export const currency: ICurrency = {
127127
show_iso_code: true
128128
};
129129

130-
export const display_currency: ICurrency = {
131-
iso_code: 'cad',
132-
iso_numeric_code: 124,
133-
symbol: '$',
134-
format: '${amount}',
135-
has_decimal: false,
136-
show_iso_code: true
137-
};
130+
export const display_currency: ICurrency | null = null;
138131

139132
export const countryInfo: ICountryInformation = {
140133
iso_code: 'CA',
@@ -193,7 +186,7 @@ export const applicationState: IApplicationState = {
193186
link_to_cart: null,
194187
currency,
195188
display_currency,
196-
display_exchange_rate: 1,
189+
display_exchange_rate: null,
197190
created_via: '',
198191
is_processed: false,
199192
fees,

tests/state/setApplicationState.test.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ describe('setApplicationState', () => {
4545
});
4646

4747
test('Set application state', () => {
48+
applicationStateMock.display_currency = {
49+
iso_code: 'cad',
50+
iso_numeric_code: 124,
51+
symbol: '$',
52+
format: '${amount}',
53+
has_decimal: false,
54+
show_iso_code: true
55+
};
56+
applicationStateMock.display_exchange_rate = 1;
4857

4958
setApplicationState(applicationStateMock);
5059

@@ -79,11 +88,11 @@ describe('setApplicationState', () => {
7988
expect(applicationState).toStrictEqual(applicationStateMock);
8089
});
8190

82-
test('Set application state no display currency', () => {
91+
test('Set application state with no display currency', () => {
8392

8493
const applicationStateMock2 = applicationState;
85-
delete applicationStateMock2.display_currency;
86-
delete applicationStateMock2.display_exchange_rate;
94+
applicationStateMock2.display_exchange_rate = null;
95+
applicationStateMock2.display_currency = null;
8796
setApplicationState(applicationStateMock2);
8897

8998
expect(setCustomerSpy).toHaveBeenCalledTimes(1);

0 commit comments

Comments
 (0)