Skip to content

Commit 6cd4a0c

Browse files
authored
chore(common): CHECKOUT-6440 Add hosted widget component package (#1087)
1 parent 682d61b commit 6cd4a0c

File tree

81 files changed

+3393
-10
lines changed

Some content is hidden

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

81 files changed

+3393
-10
lines changed

jest.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { getJestProjects } = require('@nrwl/jest');
22

33
module.exports = {
4-
projects: getJestProjects()
5-
};
4+
projects: getJestProjects(),
5+
};

packages/core/src/app/payment/createPaymentFormService.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import {
44
PaymentFormService,
55
PaymentFormValues,
66
} from '@bigcommerce/checkout/payment-integration-api';
7-
8-
import { FormContextType } from '../ui/form';
7+
import { FormContextType } from '@bigcommerce/checkout/ui';
98

109
import { PaymentContextProps } from './PaymentContext';
1110

@@ -14,15 +13,18 @@ export default function createPaymentFormService(
1413
formContext: FormContextType,
1514
paymentContext: PaymentContextProps,
1615
): PaymentFormService {
17-
const { setFieldTouched, setFieldValue, submitForm, validateForm } = formikContext;
16+
const { setFieldTouched, setFieldValue, submitForm, validateForm, values } = formikContext;
1817

1918
const { isSubmitted, setSubmitted } = formContext;
2019

2120
const { disableSubmit, setSubmit, setValidationSchema, hidePaymentSubmitButton } =
2221
paymentContext;
2322

23+
const getFieldValue = <T>(key: string): T | unknown => values[key];
24+
2425
return {
2526
disableSubmit,
27+
getFieldValue,
2628
hidePaymentSubmitButton,
2729
isSubmitted: () => isSubmitted,
2830
setFieldTouched,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["../../.eslintrc.json"]
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# hosted-widget-integration
2+
3+
This library was generated with [Nx](https://nx.dev).
4+
5+
## Running unit tests
6+
7+
Run `nx test hosted-widget-integration` to execute the unit tests via [Jest](https://jestjs.io).
8+
9+
## Running lint
10+
11+
Run `nx lint hosted-widget-integration` to execute the lint via [ESLint](https://eslint.org/).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
displayName: 'hosted-widget-integration',
3+
preset: '../../jest.preset.js',
4+
globals: {
5+
'ts-jest': {
6+
tsconfig: '<rootDir>/tsconfig.spec.json',
7+
diagnostics: false,
8+
},
9+
},
10+
setupFilesAfterEnv: ['../../jest-setup.ts'],
11+
coverageDirectory: '../../coverage/packages/hosted-widget-integration',
12+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"root": "packages/hosted-widget-integration",
3+
"sourceRoot": "packages/hosted-widget-integration/src",
4+
"projectType": "library",
5+
"targets": {
6+
"lint": {
7+
"executor": "@nrwl/linter:eslint",
8+
"outputs": ["{options.outputFile}"],
9+
"options": {
10+
"lintFilePatterns": ["packages/hosted-widget-integration/**/*.{ts,tsx}"]
11+
}
12+
},
13+
"test": {
14+
"executor": "@nrwl/jest:jest",
15+
"outputs": ["coverage/packages/hosted-widget-integration"],
16+
"options": {
17+
"jestConfig": "packages/hosted-widget-integration/jest.config.js",
18+
"passWithNoTests": true
19+
}
20+
}
21+
},
22+
"tags": ["scope:shared"]
23+
}

0 commit comments

Comments
 (0)