Skip to content

Commit 1dd6589

Browse files
committed
fix accelerated checkouts test failure
1 parent c3ebc88 commit 1dd6589

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ export interface ShopifyCheckoutSheetKit {
308308
/**
309309
* Configure the checkout. See README.md for more details.
310310
*/
311-
setConfig(config: Configuration): void;
311+
setConfig(config: Configuration): Promise<void>;
312312
/**
313313
* Return the current config for the checkout. See README.md for more details.
314314
*/

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ class ShopifyCheckoutSheet implements ShopifyCheckoutSheetKit {
8787
private features: Features;
8888
private geolocationCallback: Maybe<EventSubscription>;
8989

90+
private _acceleratedCheckoutsReady = false;
91+
92+
get acceleratedCheckoutsReady(): boolean {
93+
return this._acceleratedCheckoutsReady;
94+
}
95+
9096
/**
9197
* Initializes a new ShopifyCheckoutSheet instance
9298
* @param configuration Optional configuration settings for the checkout
@@ -156,7 +162,13 @@ class ShopifyCheckoutSheet implements ShopifyCheckoutSheetKit {
156162
* Updates the checkout configuration
157163
* @param configuration New configuration settings to apply
158164
*/
159-
public setConfig(configuration: Configuration): void {
165+
public async setConfig(configuration: Configuration): Promise<void> {
166+
if (configuration.acceleratedCheckouts) {
167+
this._acceleratedCheckoutsReady =
168+
await this.configureAcceleratedCheckouts(
169+
configuration.acceleratedCheckouts,
170+
);
171+
}
160172
RNShopifyCheckoutSheetKit.setConfig(configuration);
161173
}
162174

0 commit comments

Comments
 (0)