Skip to content

Commit

Permalink
feat!: ts migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Xuan committed Oct 17, 2022
1 parent 3c3ddf1 commit 0f8277e
Show file tree
Hide file tree
Showing 68 changed files with 3,869 additions and 1,159 deletions.
29 changes: 24 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
/* @flow */

module.exports = {
extends: require.resolve(
"@krakenjs/grumbler-scripts/config/.eslintrc-browser"
),
extends:
"./node_modules/@krakenjs/grumbler-scripts/config/.eslintrc-typescript.js",

globals: {
__TEST__: true,
},

rules: {
"no-mixed-operators": "off",
// off for initial ts conversion
"@typescript-eslint/no-implicit-any-catch": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-base-to-string": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/prefer-for-of": "off",

"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
},
};
15 changes: 0 additions & 15 deletions .flowconfig

This file was deleted.

4 changes: 4 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
extends: "@krakenjs/grumbler-scripts/config/.babelrc-browser",
presets: ["@krakenjs/grumbler-scripts/config/flow-ts-babel-preset"],
};
3 changes: 0 additions & 3 deletions babel.config.json

This file was deleted.

1 change: 1 addition & 0 deletions dist/esm/apm.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare const APM_LIST: ("ideal" | "bancontact" | "giropay" | "sofort" | "eps" | "mybank" | "p24" | "payu" | "blik" | "trustly" | "zimpler" | "maxima" | "oxxo" | "boleto" | "boletobancario" | "wechatpay" | "mercadopago" | "multibanco")[];
2 changes: 2 additions & 0 deletions dist/esm/apm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions dist/esm/apm.js.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Flowtype definitions for apm
* Generated by Flowgen from a Typescript Definition
* Flowgen v1.20.1
* @flow
*/

declare export var APM_LIST: (
| "ideal"
| "bancontact"
| "giropay"
| "sofort"
| "eps"
| "mybank"
| "p24"
| "payu"
| "blik"
| "trustly"
| "zimpler"
| "maxima"
| "oxxo"
| "boleto"
| "boletobancario"
| "wechatpay"
| "mercadopago"
| "multibanco"
)[];
9 changes: 9 additions & 0 deletions dist/esm/defaults.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export declare const DEFAULT_COUNTRY: "US";
export declare const DEFAULT_CURRENCY: "USD";
export declare const DEFAULT_INTENT: "capture";
export declare const DEFAULT_COMMIT: true;
export declare const DEFAULT_SALE_COMMIT: true;
export declare const DEFAULT_NONSALE_COMMIT: true;
export declare const DEFAULT_VAULT: false;
export declare const DEFAULT_COMPONENTS: "buttons";
export declare const DEFAULT_DEBUG: false;
12 changes: 12 additions & 0 deletions dist/esm/defaults.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { COUNTRY } from "./locale";
import { CURRENCY, INTENT, COMMIT, VAULT } from "./order";
import { COMPONENTS, DEBUG } from "./params";
export var DEFAULT_COUNTRY = COUNTRY.US;
export var DEFAULT_CURRENCY = CURRENCY.USD;
export var DEFAULT_INTENT = INTENT.CAPTURE;
export var DEFAULT_COMMIT = COMMIT.TRUE;
export var DEFAULT_SALE_COMMIT = COMMIT.TRUE;
export var DEFAULT_NONSALE_COMMIT = COMMIT.TRUE;
export var DEFAULT_VAULT = VAULT.FALSE;
export var DEFAULT_COMPONENTS = COMPONENTS.BUTTONS;
export var DEFAULT_DEBUG = DEBUG.FALSE;
16 changes: 16 additions & 0 deletions dist/esm/defaults.js.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Flowtype definitions for defaults
* Generated by Flowgen from a Typescript Definition
* Flowgen v1.20.1
* @flow
*/

declare export var DEFAULT_COUNTRY: "US";
declare export var DEFAULT_CURRENCY: "USD";
declare export var DEFAULT_INTENT: "capture";
declare export var DEFAULT_COMMIT: true;
declare export var DEFAULT_SALE_COMMIT: true;
declare export var DEFAULT_NONSALE_COMMIT: true;
declare export var DEFAULT_VAULT: false;
declare export var DEFAULT_COMPONENTS: "buttons";
declare export var DEFAULT_DEBUG: false;
11 changes: 11 additions & 0 deletions dist/esm/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export declare const ENV: {
LOCAL: "local";
STAGE: "stage";
SANDBOX: "sandbox";
PRODUCTION: "production";
TEST: "test";
};
export declare const MOBILE_ENV: {
ANDROID: "android";
IOS: "iOS";
};
11 changes: 11 additions & 0 deletions dist/esm/env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export var ENV = {
LOCAL: "local",
STAGE: "stage",
SANDBOX: "sandbox",
PRODUCTION: "production",
TEST: "test"
};
export var MOBILE_ENV = {
ANDROID: "android",
IOS: "iOS"
};
20 changes: 20 additions & 0 deletions dist/esm/env.js.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Flowtype definitions for env
* Generated by Flowgen from a Typescript Definition
* Flowgen v1.20.1
* @flow
*/

declare export var ENV: {
LOCAL: "local",
STAGE: "stage",
SANDBOX: "sandbox",
PRODUCTION: "production",
TEST: "test",
...
};
declare export var MOBILE_ENV: {
ANDROID: "android",
IOS: "iOS",
...
};
3 changes: 3 additions & 0 deletions dist/esm/error.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export declare const ERROR_CODE: {
VALIDATION_ERROR: "validation_error";
};
3 changes: 3 additions & 0 deletions dist/esm/error.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export var ERROR_CODE = {
VALIDATION_ERROR: "validation_error"
};
11 changes: 11 additions & 0 deletions dist/esm/error.js.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Flowtype definitions for error
* Generated by Flowgen from a Typescript Definition
* Flowgen v1.20.1
* @flow
*/

declare export var ERROR_CODE: {
VALIDATION_ERROR: "validation_error",
...
};
79 changes: 79 additions & 0 deletions dist/esm/fpti.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
export declare const FPTI_KEY: {
FEED: "feed_name";
STATE: "state_name";
EVENT_NAME: "event_name";
TRANSITION: "transition_name";
PAGE: "page_name";
BUTTON_TYPE: "button_type";
SESSION_UID: "page_session_id";
BUTTON_SESSION_UID: "button_session_id";
TOKEN: "token";
CONTEXT_ID: "context_id";
CONTEXT_TYPE: "context_type";
REFERER: "referer_url";
MERCHANT_DOMAIN: "merchant_domain";
PAY_ID: "pay_id";
SELLER_ID: "seller_id";
CLIENT_ID: "client_id";
DATA_SOURCE: "serverside_data_source";
BUTTON_SOURCE: "button_source";
ERROR_CODE: "ext_error_code";
ERROR_DESC: "ext_error_desc";
PAGE_LOAD_TIME: "page_load_time";
EXPERIMENT_NAME: "pxp_exp_id";
TREATMENT_NAME: "pxp_trtmnt_id";
TRANSITION_TIME: "transition_time";
FUNDING_LIST: "eligible_payment_methods";
FUNDING_COUNT: "eligible_payment_count";
CHOSEN_FUNDING: "selected_payment_method";
BUTTON_LAYOUT: "button_layout";
VERSION: "checkoutjs_version";
LOCALE: "locale";
BUYER_COUNTRY: "buyer_cntry";
INTEGRATION_IDENTIFIER: "integration_identifier";
PARTNER_ATTRIBUTION_ID: "bn_code";
PAGE_TYPE: "pp_placement";
SDK_NAME: "sdk_name";
SDK_VERSION: "sdk_version";
SDK_ENVIRONMENT: "sdk_environment";
MOBILE_APP_VERSION: "mobile_app_version";
MOBILE_BUNDLE_IDENTIFIER: "mapv";
USER_AGENT: "user_agent";
USER_ACTION: "user_action";
CONTEXT_CORRID: "context_correlation_id";
SDK_CACHE: "sdk_cache";
SDK_LOAD_TIME: "sdk_load_time";
IS_VAULT: "is_vault";
DISABLE_FUNDING: "disable_funding";
DISABLE_CARD: "disable_card";
RESPONSE_DURATION: "response_duration";
SDK_INTEGRATION_SOURCE: "sdk_integration_source";
PAYMENT_FLOW: "payment_flow";
BUTTON_VERSION: "button_version";
FI_LIST: "fi_list";
CHOSEN_FI_TYPE: "chosen_fi_type";
SELECTED_FI: "merchant_selected_funding_source";
POTENTIAL_PAYMENT_METHODS: "potential_payment_methods";
PAY_NOW: "pay_now";
STICKINESS_ID: "stickiness_id";
TIMESTAMP: "t";
OPTION_SELECTED: "optsel";
USER_IDENTITY_METHOD: "user_identity_method";
FIELDS_COMPONENT_SESSION_ID: "fields_component_session_id";
CPL_COMP_METRICS: "cpl_comp_metrics";
CPL_CHUNK_METRICS: "cpl_chunk_metrics";
CPL_QUERY_METRICS: "cpl_query_metrics";
};
export declare const FPTI_USER_ACTION: {
COMMIT: "commit";
CONTINUE: "continue";
};
export declare const FPTI_DATA_SOURCE: {
PAYMENTS_SDK: "checkout";
};
export declare const FPTI_FEED: {
PAYMENTS_SDK: "payments_sdk";
};
export declare const FPTI_SDK_NAME: {
PAYMENTS_SDK: "payments_sdk";
};
79 changes: 79 additions & 0 deletions dist/esm/fpti.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
export var FPTI_KEY = {
FEED: "feed_name",
STATE: "state_name",
EVENT_NAME: "event_name",
TRANSITION: "transition_name",
PAGE: "page_name",
BUTTON_TYPE: "button_type",
SESSION_UID: "page_session_id",
BUTTON_SESSION_UID: "button_session_id",
TOKEN: "token",
CONTEXT_ID: "context_id",
CONTEXT_TYPE: "context_type",
REFERER: "referer_url",
MERCHANT_DOMAIN: "merchant_domain",
PAY_ID: "pay_id",
SELLER_ID: "seller_id",
CLIENT_ID: "client_id",
DATA_SOURCE: "serverside_data_source",
BUTTON_SOURCE: "button_source",
ERROR_CODE: "ext_error_code",
ERROR_DESC: "ext_error_desc",
PAGE_LOAD_TIME: "page_load_time",
EXPERIMENT_NAME: "pxp_exp_id",
TREATMENT_NAME: "pxp_trtmnt_id",
TRANSITION_TIME: "transition_time",
FUNDING_LIST: "eligible_payment_methods",
FUNDING_COUNT: "eligible_payment_count",
CHOSEN_FUNDING: "selected_payment_method",
BUTTON_LAYOUT: "button_layout",
VERSION: "checkoutjs_version",
LOCALE: "locale",
BUYER_COUNTRY: "buyer_cntry",
INTEGRATION_IDENTIFIER: "integration_identifier",
PARTNER_ATTRIBUTION_ID: "bn_code",
PAGE_TYPE: "pp_placement",
SDK_NAME: "sdk_name",
SDK_VERSION: "sdk_version",
SDK_ENVIRONMENT: "sdk_environment",
MOBILE_APP_VERSION: "mobile_app_version",
MOBILE_BUNDLE_IDENTIFIER: "mapv",
USER_AGENT: "user_agent",
USER_ACTION: "user_action",
CONTEXT_CORRID: "context_correlation_id",
SDK_CACHE: "sdk_cache",
SDK_LOAD_TIME: "sdk_load_time",
IS_VAULT: "is_vault",
DISABLE_FUNDING: "disable_funding",
DISABLE_CARD: "disable_card",
RESPONSE_DURATION: "response_duration",
SDK_INTEGRATION_SOURCE: "sdk_integration_source",
PAYMENT_FLOW: "payment_flow",
BUTTON_VERSION: "button_version",
FI_LIST: "fi_list",
CHOSEN_FI_TYPE: "chosen_fi_type",
SELECTED_FI: "merchant_selected_funding_source",
POTENTIAL_PAYMENT_METHODS: "potential_payment_methods",
PAY_NOW: "pay_now",
STICKINESS_ID: "stickiness_id",
TIMESTAMP: "t",
OPTION_SELECTED: "optsel",
USER_IDENTITY_METHOD: "user_identity_method",
FIELDS_COMPONENT_SESSION_ID: "fields_component_session_id",
CPL_COMP_METRICS: "cpl_comp_metrics",
CPL_CHUNK_METRICS: "cpl_chunk_metrics",
CPL_QUERY_METRICS: "cpl_query_metrics"
};
export var FPTI_USER_ACTION = {
COMMIT: "commit",
CONTINUE: "continue"
};
export var FPTI_DATA_SOURCE = {
PAYMENTS_SDK: "checkout"
};
export var FPTI_FEED = {
PAYMENTS_SDK: "payments_sdk"
};
export var FPTI_SDK_NAME = {
PAYMENTS_SDK: "payments_sdk"
};
Loading

0 comments on commit 0f8277e

Please sign in to comment.