Skip to content

Commit 985db04

Browse files
refactor: checkout.id -> sessionId
1 parent 2da304f commit 985db04

File tree

4 files changed

+6
-35
lines changed

4 files changed

+6
-35
lines changed

modules/@shopify/checkout-sheet-kit/src/events.d.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -636,14 +636,6 @@ export interface CheckoutPaymentMethodChangeStartResponse {
636636
errors?: CheckoutResponseError[];
637637
}
638638

639-
/**
640-
* Checkout session information.
641-
*/
642-
export interface CheckoutSession {
643-
/** Globally unique identifier for the checkout session */
644-
id: string;
645-
}
646-
647639
/**
648640
* Event emitted when the buyer attempts to submit the checkout.
649641
*
@@ -670,7 +662,7 @@ export interface CheckoutSubmitStart {
670662
/**
671663
* The checkout session information.
672664
*/
673-
checkout: CheckoutSession;
665+
sessionId: string;
674666
}
675667

676668
/**

modules/@shopify/checkout-sheet-kit/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,6 @@ export type {
511511
CartPaymentInstrumentDisplayInput,
512512
CartPaymentInstrumentInput,
513513
PaymentTokenInput,
514-
CheckoutSession,
515514
CheckoutAddressChangeStart,
516515
CheckoutAddressChangeStartResponse,
517516
CheckoutCompleteEvent,

modules/@shopify/checkout-sheet-kit/tests/CheckoutSubmitStart.test.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jest.mock('react-native', () => {
2323
import React from 'react';
2424
import {render, act} from '@testing-library/react-native';
2525
import {ShopifyCheckout} from '../src/components/Checkout';
26-
import {createTestCart, createTestCheckout} from './testFixtures';
26+
import {createTestCart } from './testFixtures';
2727

2828
describe('Checkout Component - Submit Start Events', () => {
2929
const mockCheckoutUrl = 'https://example.myshopify.com/checkout';
@@ -41,15 +41,14 @@ describe('Checkout Component - Submit Start Events', () => {
4141

4242
const nativeComponent = getByTestId('checkout-webview');
4343
const testCart = createTestCart();
44-
const testCheckout = createTestCheckout();
4544

4645
act(() => {
4746
nativeComponent.props.onSubmitStart({
4847
nativeEvent: {
4948
id: 'test-event-123',
5049
method: 'checkout.submitStart',
5150
cart: testCart,
52-
checkout: testCheckout,
51+
sessionId: "checkout-session-123",
5352
},
5453
});
5554
});
@@ -59,7 +58,7 @@ describe('Checkout Component - Submit Start Events', () => {
5958
id: 'test-event-123',
6059
method: 'checkout.submitStart',
6160
cart: testCart,
62-
checkout: testCheckout,
61+
sessionId: "checkout-session-123",
6362
});
6463
});
6564

@@ -77,7 +76,7 @@ describe('Checkout Component - Submit Start Events', () => {
7776
id: 'test-event',
7877
method: 'checkout.submitStart',
7978
cart: createTestCart(),
80-
checkout: createTestCheckout(),
79+
sessionId: "checkout-session-123",
8180
},
8281
});
8382
});

modules/@shopify/checkout-sheet-kit/tests/testFixtures.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2121
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2222
*/
2323

24-
import type {Cart, CheckoutSession} from '../src/events.d';
24+
import type {Cart} from '../src/events.d';
2525

2626
/**
2727
* Shared test fixtures for creating test objects.
@@ -76,22 +76,3 @@ export function createTestCart(overrides?: Partial<Cart>): Cart {
7676
};
7777
}
7878

79-
/**
80-
* Creates a test CheckoutSession instance with sensible defaults.
81-
*
82-
* @param overrides - Optional partial CheckoutSession object to override defaults
83-
* @returns A CheckoutSession instance suitable for testing
84-
*
85-
* @example
86-
* ```typescript
87-
* const checkout = createTestCheckout();
88-
* const checkoutWithCustomId = createTestCheckout({ id: 'custom-session-id' });
89-
* ```
90-
*/
91-
export function createTestCheckout(overrides?: Partial<CheckoutSession>): CheckoutSession {
92-
return {
93-
id: 'checkout-session-123',
94-
...overrides,
95-
};
96-
}
97-

0 commit comments

Comments
 (0)