Skip to content

Commit 1c47bd6

Browse files
authored
3.1.0 (#131)
* Upgrade swift dependency, add support for invalidate function * Upgrade Android dependency, add support for invalidate function * Minor bump * Add changelog entry * Add test for invalidate
1 parent f5e67e5 commit 1c47bd6

File tree

14 files changed

+75
-15
lines changed

14 files changed

+75
-15
lines changed

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# Changelog
22

3+
## 3.1.0 - October 25, 2024
4+
5+
Upgrades Swift dependency to
6+
[3.1.1](https://github.com/Shopify/checkout-sheet-kit-swift/releases/tag/3.1.1)
7+
and Android to
8+
[3.2.0](https://github.com/Shopify/checkout-sheet-kit-android/releases/tag/3.2.0).
9+
10+
### Updates
11+
12+
#### Both platforms
13+
14+
- New `invalidate()` function to manually clear the preload cache
15+
- Prevent recovery flow for multipass URLs containing one-time tokens
16+
- Open deep links externally
17+
18+
#### iOS
19+
20+
- Ignore cancelled redirects, add OS debug logging
21+
22+
### Android
23+
24+
- Implement `onShowFileChooser`, calling delegate
25+
- Ensure no existing parent is present before adding to container
26+
327
## 3.0.4 - October 14, 2024
428

529
- Fixes type imports/exports when `verbatimModuleSyntax` TS rule is enabled

modules/@shopify/checkout-sheet-kit/RNShopifyCheckoutSheetKit.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Pod::Spec.new do |s|
2020
s.source_files = "ios/*.{h,m,mm,swift}"
2121

2222
s.dependency "React-Core"
23-
s.dependency "ShopifyCheckoutSheetKit", "~> 3.0.4"
23+
s.dependency "ShopifyCheckoutSheetKit", "~> 3.1.1"
2424

2525
if fabric_enabled
2626
install_modules_dependencies(s)

modules/@shopify/checkout-sheet-kit/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ ndkVersion=23.1.7779620
55
buildToolsVersion = "33.0.0"
66

77
# Version of Shopify Checkout SDK to use with React Native
8-
SHOPIFY_CHECKOUT_SDK_VERSION=3.0.4
8+
SHOPIFY_CHECKOUT_SDK_VERSION=3.2.0

modules/@shopify/checkout-sheet-kit/android/src/main/java/com/shopify/reactnative/checkoutsheetkit/ShopifyCheckoutSheetKitModule.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ public void preload(String checkoutURL) {
112112
}
113113
}
114114

115+
@ReactMethod
116+
public void invalidateCache() {
117+
ShopifyCheckoutSheetKit.invalidate();
118+
}
119+
115120
private ColorScheme getColorScheme(String colorScheme) {
116121
switch (colorScheme) {
117122
case "web_default":

modules/@shopify/checkout-sheet-kit/ios/ShopifyCheckoutSheetKit.mm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ @interface RCT_EXTERN_MODULE(RCTShopifyCheckoutSheetKit, NSObject)
3434
/// Dismiss checkout
3535
RCT_EXTERN_METHOD(dismiss);
3636

37+
/// Invalidate preload cache
38+
RCT_EXTERN_METHOD(invalidateCache);
39+
3740
/// Set configuration for checkout
3841
RCT_EXTERN_METHOD(setConfig:(NSDictionary *)configuration);
3942

modules/@shopify/checkout-sheet-kit/ios/ShopifyCheckoutSheetKit.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ class RCTShopifyCheckoutSheetKit: RCTEventEmitter, CheckoutDelegate {
182182
}
183183
}
184184

185+
@objc func invalidateCache() {
186+
ShopifyCheckoutSheetKit.invalidate()
187+
}
188+
185189
@objc func present(_ checkoutURL: String) {
186190
DispatchQueue.main.async {
187191
if let url = URL(string: checkoutURL), let viewController = self.getCurrentViewController() {

modules/@shopify/checkout-sheet-kit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@shopify/checkout-sheet-kit",
33
"license": "MIT",
4-
"version": "3.0.4",
4+
"version": "3.1.0",
55
"main": "lib/commonjs/index.js",
66
"types": "src/index.ts",
77
"source": "src/index.ts",

modules/@shopify/checkout-sheet-kit/src/context.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ interface Context {
4242
preload: (checkoutUrl: string) => void;
4343
present: (checkoutUrl: string) => void;
4444
dismiss: () => void;
45+
invalidate: () => void;
4546
version: Maybe<string>;
4647
}
4748

@@ -54,6 +55,7 @@ const ShopifyCheckoutSheetContext = React.createContext<Context>({
5455
getConfig: async () => undefined,
5556
preload: noop,
5657
present: noop,
58+
invalidate: noop,
5759
dismiss: noop,
5860
version: undefined,
5961
});
@@ -95,6 +97,10 @@ export function ShopifyCheckoutSheetProvider({
9597
}
9698
}, []);
9799

100+
const invalidate = useCallback(() => {
101+
instance.current?.invalidate();
102+
}, []);
103+
98104
const dismiss = useCallback(() => {
99105
instance.current?.dismiss();
100106
}, []);
@@ -115,6 +121,7 @@ export function ShopifyCheckoutSheetProvider({
115121
getConfig,
116122
preload,
117123
present,
124+
invalidate,
118125
removeEventListeners,
119126
version: instance.current?.version,
120127
};
@@ -126,6 +133,7 @@ export function ShopifyCheckoutSheetProvider({
126133
setConfig,
127134
preload,
128135
present,
136+
invalidate,
129137
]);
130138

131139
return (

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,11 @@ export interface ShopifyCheckoutSheetKit {
176176
* Preload the checkout for faster presentation.
177177
*/
178178
preload(checkoutURL: string): void;
179+
180+
/**
181+
* Invalidate preload cache.
182+
*/
183+
invalidate(): void;
179184
/**
180185
* Present the checkout.
181186
*/

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ class ShopifyCheckoutSheet implements ShopifyCheckoutSheetKit {
7171
RNShopifyCheckoutSheetKit.dismiss();
7272
}
7373

74+
public invalidate(): void {
75+
RNShopifyCheckoutSheetKit.invalidateCache();
76+
}
77+
7478
public preload(checkoutUrl: string): void {
7579
RNShopifyCheckoutSheetKit.preload(checkoutUrl);
7680
}

0 commit comments

Comments
 (0)