Skip to content

Commit afc9a90

Browse files
authored
@shopify/checkout-sheet-kit (#44)
* @shopify/checkout-sheet-kit * Update exports + file names * Fix reference in module package script * Update README
1 parent 81fcf95 commit afc9a90

Some content is hidden

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

48 files changed

+256
-267
lines changed

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ dist
8484
.turbo
8585

8686
# Module
87-
modules/react-native-shopify-checkout-kit/android/gradle/wrapper/gradle-wrapper.jar
88-
modules/react-native-shopify-checkout-kit/android/gradle/wrapper/gradle-wrapper.properties
89-
modules/react-native-shopify-checkout-kit/android/gradlew
90-
modules/react-native-shopify-checkout-kit/android/gradlew.bat
87+
modules/@shopify/checkout-sheet-kit/android/gradle/wrapper/gradle-wrapper.jar
88+
modules/@shopify/checkout-sheet-kit/android/gradle/wrapper/gradle-wrapper.properties
89+
modules/@shopify/checkout-sheet-kit/android/gradlew
90+
modules/@shopify/checkout-sheet-kit/android/gradlew.bat
9191

9292
# Sample bundle
9393
**/index.android.bundle

CONTRIBUTING.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
This repo is subdivided into 3 parts using yarn workspaces:
44

55
- The base repo (workspace name = `checkout-kit-react-native`)
6-
- The `react-native-shopify-checkout-kit` Native Module (workspace name =
7-
`module`)
6+
- The `@shopify/checkout-sheet-kit` Native Module (workspace name = `module`)
87
- The sample application (workspace name = `sample`)
98

109
Each of the worksapces contains a separate `package.json` to manage tasks
@@ -43,10 +42,9 @@ open both the iOS and Android simulators/emulators respectively.
4342
## Making changes to the Native Module
4443

4544
If your intentions are to modify the TS code for the Native Module under
46-
`modules/react-native-shopify-checkout-kit`, note that you will not need to
47-
rebuild to observe your changes in the sample app. This is because the sample
48-
app is importing the TS files directly from the module directory (through
49-
symlinking).
45+
`modules/@shopify/checkout-sheet-kit`, note that you will not need to rebuild to
46+
observe your changes in the sample app. This is because the sample app is
47+
importing the TS files directly from the module directory (through symlinking).
5048

5149
However, if you're running the iOS/Android tests against the module, you will
5250
first need to run `yarn module build` each time you change the TS code.
@@ -87,7 +85,7 @@ There are 3 types of tests in this repo: Typescript, Swift and Java - each for
8785
testing the Native Module.
8886

8987
```sh
90-
# Run Jest tests for "modules/react-native-shopify-checkout-kit/src/**/*.tsx"
88+
# Run Jest tests for "modules/@shopify/checkout-sheet-kit/src/**/*.tsx"
9189
yarn test
9290

9391
# Run swift tests for the Native Module

README.md

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44

55
![image](https://github.com/Shopify/checkout-kit-react-native/assets/2034704/107fbeb8-50be-43ac-8837-33d576cac9ab)
66

7-
8-
**Shopify Checkout Kit** is a Native Module (currently in [Developer Preview](https://shopify.dev/docs/api/release-notes/developer-previews)) that enables React Native apps to
9-
provide the world’s highest converting, customizable, one-page checkout within
10-
the app. The presented experience is a fully-featured checkout that preserves
11-
all of the store customizations: Checkout UI extensions, Functions, branding,
12-
and more. It also provides platform idiomatic defaults such as support for light
13-
and dark mode, and convenient developer APIs to embed, customize, and follow the
14-
lifecycle of the checkout experience.
7+
**Shopify Checkout Kit** is a Native Module (currently in
8+
[Developer Preview](https://shopify.dev/docs/api/release-notes/developer-previews))
9+
that enables React Native apps to provide the world’s highest converting,
10+
customizable, one-page checkout within the app. The presented experience is a
11+
fully-featured checkout that preserves all of the store customizations: Checkout
12+
UI extensions, Functions, branding, and more. It also provides platform
13+
idiomatic defaults such as support for light and dark mode, and convenient
14+
developer APIs to embed, customize, and follow the lifecycle of the checkout
15+
experience.
1516

1617
Check out our blog to
1718
[learn how and why we built Checkout Kit](https://www.shopify.com/partners/blog/mobile-checkout-sdks-for-ios-and-android).
@@ -40,10 +41,10 @@ started:
4041
Install the Shopify Checkout Kit package dependency:
4142

4243
```sh
43-
yarn add react-native-shopify-checkout-kit
44+
yarn add @shopify/checkout-sheet-kit
4445

4546
# or using npm
46-
npm install react-native-shopify-checkout-kit
47+
npm install @shopify/checkout-sheet-kit
4748
```
4849

4950
#### 2. Ensure your app meets the minimum Android SDK version requirement
@@ -83,25 +84,25 @@ requirements have been checked, you can begin by importing the library in your
8384
application code:
8485

8586
```tsx
86-
import {ShopifyCheckoutKitProvider} from 'react-native-shopify-checkout-kit';
87+
import {ShopifyCheckoutSheetProvider} from '@shopify/checkout-sheet-kit';
8788

8889
function AppWithContext() {
8990
return (
90-
<ShopifyCheckoutKitProvider>
91+
<ShopifyCheckoutSheetProvider>
9192
<App />
92-
</ShopifyCheckoutKitProvider>
93+
</ShopifyCheckoutSheetProvider>
9394
);
9495
}
9596
```
9697

97-
Doing so will now allow you to access the ShopifyCheckoutKit Native Module
98-
anywhere in your application using React hooks:
98+
Doing so will now allow you to access the Native Module anywhere in your
99+
application using React hooks:
99100

100101
```tsx
101-
import {useShopifyCheckoutKit} from 'react-native-shopify-checkout-kit';
102+
import {useShopifyCheckoutSheet} from '@shopify/checkout-sheet-kit';
102103

103104
function App() {
104-
const shopifyCheckout = useShopifyCheckoutKit();
105+
const shopifyCheckout = useShopifyCheckoutSheet();
105106

106107
// Present the checkout
107108
shopifyCheckout.present(checkoutUrl);
@@ -112,20 +113,21 @@ See [Usage with the Storefront API](#usage-with-the-storefront-api) below on how
112113
to get a checkoutUrl to pass to the SDK.
113114

114115
> Note: The recommended usage of the library is through a
115-
> `ShopifyCheckoutKitProvider` Context provider, but see
116+
> `ShopifyCheckoutSheetProvider` Context provider, but see
116117
> [Programmatic usage](#programamatic-usage) below for details on how to use the
117118
> library without React context.
118119
119120
### Programmatic Usage
120121

121-
To use the library without React context, import the `ShopifyCheckoutKit` class
122-
from the package and instantiate it. We recommend to instantiating the class at
123-
a high level in your application, and exporting it for use throughout your app.
122+
To use the library without React context, import the `ShopifyCheckoutSheet`
123+
class from the package and instantiate it. We recommend to instantiating the
124+
class at a high level in your application, and exporting it for use throughout
125+
your app.
124126

125127
```tsx
126-
import {ShopifyCheckoutKit} from 'react-native-shopify-checkout-kit';
128+
import {ShopifyCheckoutSheet} from '@shopify/checkout-sheet-kit';
127129

128-
export const shopifyCheckout = new ShopifyCheckoutKit({
130+
export const shopifyCheckout = new ShopifyCheckoutSheet({
129131
// optional configuration
130132
});
131133
```
@@ -219,7 +221,7 @@ browser. To present a native checkout sheet in your application, provide the
219221

220222
```tsx
221223
function App() {
222-
const shopifyCheckout = useShopifyCheckoutKit()
224+
const shopifyCheckout = useShopifyCheckoutSheet()
223225
const checkoutUrl = useRef<string>(null)
224226
const [createCart] = useMutation(createCartMutation)
225227
const [addToCart] = useMutation(addToCartMutation)
@@ -267,7 +269,7 @@ session in the background and ahead of time.
267269

268270
The SDK provides a way to customize the presented checkout experience through a
269271
`configuration` object in the Context Provider or a `setConfig` method on an
270-
instance of the `ShopifyCheckoutKit` class.
272+
instance of the `ShopifyCheckoutSheet` class.
271273

272274
| Name | Required | Default | Description |
273275
| ------------- | -------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -281,8 +283,8 @@ Here's an example of how a fully customized configuration object might look:
281283
import {
282284
ColorScheme,
283285
Configuration,
284-
ShopifyCheckoutKitProvider,
285-
} from 'react-native-shopify-checkout-kit';
286+
ShopifyCheckoutSheetProvider,
287+
} from '@shopify/checkout-sheet-kit';
286288

287289
const config: Configuration = {
288290
colorScheme: ColorScheme.web,
@@ -304,14 +306,14 @@ const config: Configuration = {
304306
// If using React Context
305307
function AppWithContext() {
306308
return (
307-
<ShopifyCheckoutKitProvider configuration={config}>
309+
<ShopifyCheckoutSheetProvider configuration={config}>
308310
<App />
309-
</ShopifyCheckoutKitProvider>
311+
</ShopifyCheckoutSheetProvider>
310312
);
311313
}
312314

313-
// If using ShopifyCheckoutKit directly
314-
const shopifyCheckout = new ShopifyCheckoutKit(config);
315+
// If using ShopifyCheckoutSheet directly
316+
const shopifyCheckout = new ShopifyCheckoutSheet(config);
315317
```
316318

317319
#### `colorScheme`
@@ -358,8 +360,8 @@ slightly different, as you can specify different overrides for `light` and
358360
import {
359361
ColorScheme,
360362
Configuration,
361-
ShopifyCheckoutKitProvider,
362-
} from 'react-native-shopify-checkout-kit';
363+
ShopifyCheckoutSheetProvider,
364+
} from '@shopify/checkout-sheet-kit';
363365

364366
const config: Configuration = {
365367
colorScheme: ColorScheme.automatic,
@@ -384,9 +386,9 @@ const config: Configuration = {
384386

385387
function AppWithContext() {
386388
return (
387-
<ShopifyCheckoutKitProvider configuration={config}>
389+
<ShopifyCheckoutSheetProvider configuration={config}>
388390
<App />
389-
</ShopifyCheckoutKitProvider>
391+
</ShopifyCheckoutSheetProvider>
390392
);
391393
}
392394
```
@@ -408,11 +410,11 @@ Once enabled, preloading a checkout is as simple as calling
408410

409411
```tsx
410412
// using hooks
411-
const shopifyCheckout = useShopifyCheckoutKit();
413+
const shopifyCheckout = useShopifyCheckoutSheet();
412414
ShopifyCheckout.preload(checkoutUrl);
413415

414416
// using a class instance
415-
const shopifyCheckout = new ShopifyCheckoutKit();
417+
const shopifyCheckout = new ShopifyCheckoutSheet();
416418
shopifyCheckout.preload(checkoutUrl);
417419
```
418420

@@ -452,7 +454,7 @@ an event listener in a React `useEffect`, ensuring to remove it on unmount.
452454

453455
```tsx
454456
// Using hooks
455-
const shopifyCheckout = useShopifyCheckoutKit();
457+
const shopifyCheckout = useShopifyCheckoutSheet();
456458

457459
useEffect(() => {
458460
const close = shopifyCheckout.addEventListener('close', () => {

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
preset: 'react-native',
3-
modulePathIgnorePatterns: ['modules/react-native-shopify-checkout-kit/lib'],
3+
modulePathIgnorePatterns: ['modules/@shopify/checkout-sheet-kit/lib'],
44
transform: {
55
'\\.[jt]sx?$': 'babel-jest',
66
},

metro.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ const config = mergeConfig(getDefaultConfig(__dirname), {
3131
extraNodeModules: {
3232
react: path.resolve(sample, 'node_modules', 'react'),
3333
'react-native': path.resolve(sample, 'node_modules', 'react-native'),
34-
'react-native-shopify-checkout-kit': path.resolve(
34+
'@shopify/checkout-sheet-kit': path.resolve(
3535
root,
3636
'modules',
37-
'react-native-shopify-checkout-kit',
37+
'@shopify/checkout-sheet-kit',
3838
),
3939
},
4040
},
File renamed without changes.
File renamed without changes.

modules/react-native-shopify-checkout-kit/react-native-shopify-checkout-kit.podspec renamed to modules/@shopify/checkout-sheet-kit/RNShopifyCheckoutSheetKit.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1
77
fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
88

99
Pod::Spec.new do |s|
10-
s.name = package["name"]
10+
s.name = "RNShopifyCheckoutSheetKit"
1111
s.version = package["version"]
1212
s.summary = package["description"]
1313
s.homepage = package["homepage"]

modules/react-native-shopify-checkout-kit/android/build.gradle renamed to modules/@shopify/checkout-sheet-kit/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ ndkVersion = "23.1.7779620"
4646

4747
android {
4848
if (supportsNamespace()) {
49-
namespace "com.shopify.reactnative.checkoutkit"
49+
namespace "com.shopify.reactnative.checkoutsheetkit"
5050

5151
sourceSets {
5252
main {

modules/react-native-shopify-checkout-kit/android/gradle.properties renamed to modules/@shopify/checkout-sheet-kit/android/gradle.properties

File renamed without changes.

0 commit comments

Comments
 (0)