Skip to content

Commit 15b7be2

Browse files
committed
chore(country): support only jp
1 parent 72c1e71 commit 15b7be2

File tree

9 files changed

+4
-47
lines changed

9 files changed

+4
-47
lines changed

docs/README.md

-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ mtLinkSdk.authorize(options);
9090
| options.codeChallenge | string | false | | We only support SHA256 as code challenge method, therefore please ensure the `code_challenge` was generated using the SHA256 hash algorithm. [Click here](https://auth0.com/docs/api-auth/tutorials/authorization-code-grant-pkce) for more details.</p><strong>NOTE:</strong> Set this value only if your server wish to use PKCE flow. |
9191
| options.pkce | boolean | false | false | Set to `true` if you wish to use PKCE flow on the client side, SDK will automatically generate the code challenge from a locally generated code verifier and use the code verifier in [exchangeToken](#exchangetoken). |
9292
| <span id="authorize_option_force_logout">options.forceLogout</span> | boolean | false | `false` | Force existing guest session to logout and call authorize with a clean state. |
93-
| options.country | `AU`, `JP` | false | Value set during `init`. | Server location for the guest to login or sign up. If you wish to restrict your guest to only one country, make sure to set this value.<br /><br /><strong>NOTE:</strong> For apps created after 2020-07-08, the sign up form will display a country selection dropdown for the guest to select a country when this value is undefined or invalid. |
9493

9594
### onboard
9695

@@ -113,7 +112,6 @@ mtLinkSdk.onboard(options)
113112
| Parameter | Type | Required | Default Value | Description |
114113
| - | - | - | - | - |
115114
| options | object | false | Value set during `init`. | Optional parameters.<br /><br />Most options are the same as the [authorize method](#authorize) options and [common options](#common-api-options) with a few exceptions.<br /><br />Unsupported options from [authorize](#authorize) and [common options](#common-api-options) are:<li>forceLogout</li><li>authAction</li><li>showAuthToggle</li><li>showRememberMe</li> |
116-
| options.country | `AU`, `JP` | true | Value set during `init`. | Server location for the guest to login or sign up.<br /><br /><strong>NOTE:</strong> SDK will throw an error if both values here and from the [init options](?id=api-init_options) are undefined. |
117115
| options.email | string | true | Value set during `init`. | A new Moneytree account will be created with this email address. If an existing account with this email exists, the guest will be redirected to the login screen.<br /><br /><strong>NOTE:</strong> SDK will throw an error if both values here and from the [init options](?id=api-init_options) are undefined. |
118116

119117
### exchangeToken

sample/src/elements.ts

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export default {
1313
onboardOptionsElms: {
1414
email: document.getElementById('onboard-options-email') as HTMLSelectElement,
1515
scopes: document.getElementById('onboard-options-scopes') as HTMLSelectElement,
16-
country: document.getElementById('onboard-options-country') as HTMLSelectElement,
1716
},
1817
openServiceOptionsElms: {
1918
serviceId: document.getElementById('open-service-options-serviceId') as HTMLSelectElement,

sample/src/index.html

-8
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,6 @@ <h3>Authorization</h3>
121121

122122
<section id="onboard-section">
123123
<h3>Onboard</h3>
124-
<p>
125-
<span style="color: red;">*</span>Country, <small>Server location for the guest to login or sign up. </small>
126-
<div>
127-
<select id="onboard-options-country">
128-
<option value="JP" default>JP</option>
129-
</select>
130-
</div>
131-
</p>
132124
<p>
133125
<span style="color: red;">*</span>Email, <small>A new Moneytree account will be created with this email address. If an existing account with this email exists, the guest will be redirected to the login screen.</small>
134126
<div>

sample/src/index.ts

-3
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@ elements.doOnboardBtn.onclick = async () => {
7878
}
7979

8080
onBoardOptions.email = onboardOptionsElms.email.value;
81-
onBoardOptions.country =
82-
onboardOptionsElms.country.options[onboardOptionsElms.country.selectedIndex].value;
83-
8481
onBoardOptions.pkce = true;
8582

8683
await mtLinkSdk.onboard(onBoardOptions);

src/api/__tests__/authorize.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ describe('api', () => {
4747
const mtLinkSdk = new MtLinkSdk();
4848
mtLinkSdk.init(clientId, {
4949
redirectUri,
50-
country,
5150
scopes,
5251
locale,
5352
cobrandClientId,
@@ -85,7 +84,6 @@ describe('api', () => {
8584
authorize(mtLinkSdk.storedOptions, {
8685
state,
8786
redirectUri,
88-
country,
8987
scopes,
9088
});
9189

src/api/__tests__/onboard.test.ts

-16
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,6 @@ describe('api', () => {
4949
);
5050
});
5151

52-
test('country is required', () => {
53-
const mtLinkSdk = new MtLinkSdk();
54-
mtLinkSdk.init(clientId, {
55-
redirectUri,
56-
email,
57-
});
58-
59-
expect(() => {
60-
onboard(mtLinkSdk.storedOptions);
61-
}).toThrow(
62-
'[mt-link-sdk] Missing option `country` in `onboard`, make sure to pass one via `onboard` options or `init` options.'
63-
);
64-
});
65-
6652
test('method call without options use default init value', () => {
6753
mockedStorage.set.mockClear();
6854
open.mockClear();
@@ -75,7 +61,6 @@ describe('api', () => {
7561
const mtLinkSdk = new MtLinkSdk();
7662
mtLinkSdk.init(clientId, {
7763
redirectUri,
78-
country,
7964
scopes,
8065
email,
8166
locale,
@@ -114,7 +99,6 @@ describe('api', () => {
11499
onboard(mtLinkSdk.storedOptions, {
115100
state,
116101
redirectUri,
117-
country,
118102
scopes,
119103
email,
120104
});

src/api/authorize.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ export default function authorize(
2626
cobrandClientId,
2727
locale,
2828
scopes: defaultScopes,
29-
redirectUri: defaultRedirectUri,
30-
country: defaultCountry,
29+
redirectUri: defaultRedirectUri
3130
} = storedOptions;
3231

3332
if (!clientId) {
@@ -37,7 +36,6 @@ export default function authorize(
3736
const {
3837
scopes = defaultScopes,
3938
redirectUri = defaultRedirectUri,
40-
country = defaultCountry,
4139
pkce = false,
4240
codeChallenge,
4341
isNewTab,
@@ -64,7 +62,7 @@ export default function authorize(
6462
code_challenge: cc || undefined,
6563
code_challenge_method: cc ? 'S256' : undefined,
6664
state,
67-
country,
65+
country: 'JP',
6866
locale,
6967
configs: generateConfigs(mergeConfigs(storedOptions, rest)),
7068
});

src/api/onboard.ts

+2-10
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ export default function onboard(storedOptions: StoredOptions, options: OnboardOp
2323
cobrandClientId,
2424
locale,
2525
scopes: defaultScopes,
26-
redirectUri: defaultRedirectUri,
27-
country: defaultCountry,
26+
redirectUri: defaultRedirectUri
2827
} = storedOptions;
2928

3029
if (!clientId) {
@@ -34,7 +33,6 @@ export default function onboard(storedOptions: StoredOptions, options: OnboardOp
3433
const {
3534
scopes = defaultScopes,
3635
redirectUri = defaultRedirectUri,
37-
country = defaultCountry,
3836
pkce = false,
3937
codeChallenge,
4038
isNewTab,
@@ -63,12 +61,6 @@ export default function onboard(storedOptions: StoredOptions, options: OnboardOp
6361
);
6462
}
6563

66-
if (!country) {
67-
throw new Error(
68-
'[mt-link-sdk] Missing option `country` in `onboard`, make sure to pass one via `onboard` options or `init` options.'
69-
);
70-
}
71-
7264
storage.del('cv');
7365

7466
const cc = codeChallenge || (pkce && generateCodeChallenge());
@@ -82,7 +74,7 @@ export default function onboard(storedOptions: StoredOptions, options: OnboardOp
8274
code_challenge: cc || undefined,
8375
code_challenge_method: cc ? 'S256' : undefined,
8476
state,
85-
country,
77+
country: 'JP',
8678
locale,
8779
configs: generateConfigs(configs),
8880
});

src/typings.ts

-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ export interface AuthorizeOptions
8282
extends OAuthSharedParams,
8383
ConfigsOptions,
8484
AuthorizeConfigsOptions {
85-
country?: string;
8685
scopes?: Scopes;
8786
codeChallenge?: string;
8887
pkce?: boolean;

0 commit comments

Comments
 (0)