Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,6 @@ workflows:
<<: *pull_request_filter
requires:
- build-prerelease
- sdk-on-cdn:
filters:
<<: *pull_request_filter
- security/scan:
name: "Gitleaks secrets scan"
filters:
Expand Down Expand Up @@ -293,6 +290,9 @@ workflows:
<<: *release_filter
requires:
- build
- sdk-on-cdn:
filters:
<<: *release_filter
- security/scan:
name: "Gitleaks secrets scan"
filters:
Expand All @@ -309,6 +309,7 @@ workflows:
- lint
- build
- e2e
- sdk-on-cdn
- "Gitleaks secrets scan"
- upload_to_sentry:
filters:
Expand Down
24 changes: 23 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@
"fixStyle": "inline-type-imports",
"disallowTypeAnnotations": false
}
],
"@typescript-eslint/no-restricted-imports": [
"error",
{
"paths": [
{
"name": "@bigcommerce/checkout-sdk",
"message": "Direct imports from '@bigcommerce/checkout-sdk' are not allowed. Use type-only imports (import type { ... }) or import from subpaths like '@bigcommerce/checkout-sdk/essential' or '@bigcommerce/checkout-sdk/integrations'.",
"allowTypeImports": true
}
]
}
]
}
},
Expand Down Expand Up @@ -138,7 +150,17 @@
"plugin:jest-dom/recommended"
],
"rules": {
"@typescript-eslint/consistent-type-assertions": "off"
"@typescript-eslint/consistent-type-assertions": "off",
"@typescript-eslint/no-restricted-imports": "off"
}
},
{
"files": [
"*.mock.ts",
"*.mock.tsx"
],
"rules": {
"@typescript-eslint/no-restricted-imports": "off"
}
}
]
Expand Down
70 changes: 39 additions & 31 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"prettier": "@bigcommerce/eslint-config/prettier",
"homepage": "https://github.com/bigcommerce/checkout-js#readme",
"dependencies": {
"@bigcommerce/checkout-sdk": "^1.799.0",
"@bigcommerce/checkout-sdk": "github:bigcommerce/checkout-sdk-js#f6997b7c3962192541e2dc281a84dde6c28d4d04",
"@bigcommerce/citadel": "^2.15.1",
"@bigcommerce/form-poster": "^1.2.2",
"@bigcommerce/memoize": "^1.0.0",
Expand Down Expand Up @@ -101,7 +101,7 @@
"@babel/preset-env": "^7.9.0",
"@bigcommerce/eslint-config": "^2.6.1",
"@bigcommerce/eslint-plugin": "^1.4.0",
"@faker-js/faker": "^6.3.1",
"@faker-js/faker": "^7.6.0",
"@nx/devkit": "19.8.9",
"@nx/eslint": "19.8.9",
"@nx/eslint-plugin": "19.8.9",
Expand Down Expand Up @@ -183,7 +183,7 @@
"ts-loader": "^9.3.0",
"tslib": "^2.5.3",
"typescript": "^5.6.2",
"webpack": "^5.94.0",
"webpack": "^5.101.3",
"webpack-assets-manifest": "^5.1.0",
"webpack-cli": "^4.9.2",
"webpack-inject-plugin": "^1.5.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
type PaymentInitializeOptions,
type PaymentMethod,
} from '@bigcommerce/checkout-sdk';
import { createAdyenV2PaymentStrategy } from '@bigcommerce/checkout-sdk/integrations/adyen';
import { act, fireEvent, render, screen } from '@testing-library/react';
import { Formik } from 'formik';
import { noop } from 'lodash';
Expand Down Expand Up @@ -98,6 +99,7 @@ describe('when using Adyen V2 payment', () => {

expect(initializePayment).toHaveBeenCalledWith(
expect.objectContaining({
integrations: [createAdyenV2PaymentStrategy],
adyenv2: {
additionalActionOptions: {
containerId: 'adyen-scheme-additional-action-component-field',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
type CardInstrument,
type PaymentInitializeOptions,
} from '@bigcommerce/checkout-sdk';
import { createAdyenV2PaymentStrategy } from '@bigcommerce/checkout-sdk/integrations/adyen';
import React, { type FunctionComponent, useCallback, useRef, useState } from 'react';

import { type HostedWidgetComponentProps } from '@bigcommerce/checkout/hosted-widget-integration';
Expand Down Expand Up @@ -107,6 +108,7 @@ const AdyenV2PaymentMethod: FunctionComponent<PaymentMethodProps> = ({

return checkoutService.initializePayment({
...options,
integrations: [createAdyenV2PaymentStrategy],
adyenv2: {
cardVerificationContainerId:
selectedInstrumentId && cardVerificationContainerId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
type PaymentInitializeOptions,
type PaymentMethod,
} from '@bigcommerce/checkout-sdk';
import { createAdyenV3PaymentStrategy } from '@bigcommerce/checkout-sdk/integrations/adyen';
import { act, fireEvent, render, screen } from '@testing-library/react';
import { Formik } from 'formik';
import { noop } from 'lodash';
Expand Down Expand Up @@ -95,6 +96,7 @@ describe('when using AdyenV3 payment', () => {

expect(initializePayment).toHaveBeenCalledWith(
expect.objectContaining({
integrations: [createAdyenV3PaymentStrategy],
adyenv3: {
cardVerificationContainerId: undefined,
containerId: 'adyen-scheme-component-field',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
type CardInstrument,
type PaymentInitializeOptions,
} from '@bigcommerce/checkout-sdk';
import { createAdyenV3PaymentStrategy } from '@bigcommerce/checkout-sdk/integrations/adyen';
import React, { type FunctionComponent, useCallback, useRef, useState } from 'react';

import { type HostedWidgetComponentProps } from '@bigcommerce/checkout/hosted-widget-integration';
Expand Down Expand Up @@ -105,6 +106,7 @@ const AdyenV3PaymentMethod: FunctionComponent<PaymentMethodProps> = ({

return checkoutService.initializePayment({
...options,
integrations: [createAdyenV3PaymentStrategy],
adyenv3: {
cardVerificationContainerId:
selectedInstrumentId && cardVerificationContainerId,
Expand Down
16 changes: 14 additions & 2 deletions packages/affirm-integration/src/AffirmPaymentMethod.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import React, { type FunctionComponent, useMemo } from 'react';
import { type PaymentInitializeOptions } from '@bigcommerce/checkout-sdk';
import { createAffirmPaymentStrategy } from '@bigcommerce/checkout-sdk/integrations/affirm';
import React, { type FunctionComponent, useCallback, useMemo } from 'react';

import { HostedPaymentComponent } from '@bigcommerce/checkout/hosted-payment-integration';
import { TranslatedString } from '@bigcommerce/checkout/locale';
Expand All @@ -14,13 +16,23 @@ const AffirmPaymentMethod: FunctionComponent<PaymentMethodProps> = ({
}) => {
const description = useMemo(() => <TranslatedString id="payment.affirm_body_text" />, []);

const initializeAffirmPayment = useCallback(
(options: PaymentInitializeOptions) => {
return checkoutService.initializePayment({
...options,
integrations: [createAffirmPaymentStrategy],
});
},
[checkoutService],
);

return (
<HostedPaymentComponent
{...rest}
checkoutService={checkoutService}
deinitializePayment={checkoutService.deinitializePayment}
description={description}
initializePayment={checkoutService.initializePayment}
initializePayment={initializeAffirmPayment}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
type PaymentInitializeOptions,
type PaymentMethod,
} from '@bigcommerce/checkout-sdk';
import { createAmazonPayV2PaymentStrategy } from '@bigcommerce/checkout-sdk/integrations/amazon-pay';
import { render } from '@testing-library/react';
import { Formik } from 'formik';
import { noop } from 'lodash';
Expand Down Expand Up @@ -90,6 +91,7 @@ describe('when using AmazonPay payment', () => {
expect.objectContaining({
gatewayId: method.gateway,
methodId: 'amazonpay',
integrations: [createAmazonPayV2PaymentStrategy],
amazonpay: {
editButtonId: 'editButtonId',
},
Expand All @@ -106,6 +108,7 @@ describe('when using AmazonPay payment', () => {
expect.objectContaining({
methodId: method.id,
gatewayId: method.gateway,
integrations: [createAmazonPayV2PaymentStrategy],
[method.id]: {
editButtonId: 'editButtonId',
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { type PaymentInitializeOptions } from '@bigcommerce/checkout-sdk';
import { createAmazonPayV2PaymentStrategy } from '@bigcommerce/checkout-sdk/integrations/amazon-pay';
import { some } from 'lodash';
import React, { type FunctionComponent, useCallback } from 'react';

Expand Down Expand Up @@ -27,6 +28,7 @@ const AmazonPayV2PaymentMethod: FunctionComponent<PaymentMethodProps> = ({
(options: PaymentInitializeOptions) =>
checkoutService.initializePayment({
...options,
integrations: [createAmazonPayV2PaymentStrategy],
amazonpay: {
editButtonId: 'editButtonId',
},
Expand Down
Loading