Skip to content

Commit

Permalink
@shopify/checkout-sheet-kit
Browse files Browse the repository at this point in the history
  • Loading branch information
markmur committed Dec 20, 2023
1 parent 81fcf95 commit 0b258f2
Show file tree
Hide file tree
Showing 44 changed files with 88 additions and 98 deletions.
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ dist
.turbo

# Module
modules/react-native-shopify-checkout-kit/android/gradle/wrapper/gradle-wrapper.jar
modules/react-native-shopify-checkout-kit/android/gradle/wrapper/gradle-wrapper.properties
modules/react-native-shopify-checkout-kit/android/gradlew
modules/react-native-shopify-checkout-kit/android/gradlew.bat
modules/@shopify/checkout-sheet-kit/android/gradle/wrapper/gradle-wrapper.jar
modules/@shopify/checkout-sheet-kit/android/gradle/wrapper/gradle-wrapper.properties
modules/@shopify/checkout-sheet-kit/android/gradlew
modules/@shopify/checkout-sheet-kit/android/gradlew.bat

# Sample bundle
**/index.android.bundle
12 changes: 5 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
This repo is subdivided into 3 parts using yarn workspaces:

- The base repo (workspace name = `checkout-kit-react-native`)
- The `react-native-shopify-checkout-kit` Native Module (workspace name =
`module`)
- The `@shopify/checkout-sheet-kit` Native Module (workspace name = `module`)
- The sample application (workspace name = `sample`)

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

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

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

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

# Run swift tests for the Native Module
Expand Down
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@

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


**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
provide the world’s highest converting, customizable, one-page checkout within
the app. The presented experience is a fully-featured checkout that preserves
all of the store customizations: Checkout UI extensions, Functions, branding,
and more. It also provides platform idiomatic defaults such as support for light
and dark mode, and convenient developer APIs to embed, customize, and follow the
lifecycle of the checkout experience.
**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 provide the world’s highest converting,
customizable, one-page checkout within the app. The presented experience is a
fully-featured checkout that preserves all of the store customizations: Checkout
UI extensions, Functions, branding, and more. It also provides platform
idiomatic defaults such as support for light and dark mode, and convenient
developer APIs to embed, customize, and follow the lifecycle of the checkout
experience.

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

```sh
yarn add react-native-shopify-checkout-kit
yarn add @shopify/checkout-sheet-kit

# or using npm
npm install react-native-shopify-checkout-kit
npm install @shopify/checkout-sheet-kit
```

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

```tsx
import {ShopifyCheckoutKitProvider} from 'react-native-shopify-checkout-kit';
import {ShopifyCheckoutKitProvider} from '@shopify/checkout-sheet-kit';

function AppWithContext() {
return (
Expand All @@ -98,7 +99,7 @@ Doing so will now allow you to access the ShopifyCheckoutKit Native Module
anywhere in your application using React hooks:

```tsx
import {useShopifyCheckoutKit} from 'react-native-shopify-checkout-kit';
import {useShopifyCheckoutKit} from '@shopify/checkout-sheet-kit';

function App() {
const shopifyCheckout = useShopifyCheckoutKit();
Expand All @@ -123,7 +124,7 @@ from the package and instantiate it. We recommend to instantiating the class at
a high level in your application, and exporting it for use throughout your app.

```tsx
import {ShopifyCheckoutKit} from 'react-native-shopify-checkout-kit';
import {ShopifyCheckoutKit} from '@shopify/checkout-sheet-kit';

export const shopifyCheckout = new ShopifyCheckoutKit({
// optional configuration
Expand Down Expand Up @@ -282,7 +283,7 @@ import {
ColorScheme,
Configuration,
ShopifyCheckoutKitProvider,
} from 'react-native-shopify-checkout-kit';
} from '@shopify/checkout-sheet-kit';

const config: Configuration = {
colorScheme: ColorScheme.web,
Expand Down Expand Up @@ -359,7 +360,7 @@ import {
ColorScheme,
Configuration,
ShopifyCheckoutKitProvider,
} from 'react-native-shopify-checkout-kit';
} from '@shopify/checkout-sheet-kit';

const config: Configuration = {
colorScheme: ColorScheme.automatic,
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
preset: 'react-native',
modulePathIgnorePatterns: ['modules/react-native-shopify-checkout-kit/lib'],
modulePathIgnorePatterns: ['modules/@shopify/checkout-sheet-kit/lib'],
transform: {
'\\.[jt]sx?$': 'babel-jest',
},
Expand Down
4 changes: 2 additions & 2 deletions metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ const config = mergeConfig(getDefaultConfig(__dirname), {
extraNodeModules: {
react: path.resolve(sample, 'node_modules', 'react'),
'react-native': path.resolve(sample, 'node_modules', 'react-native'),
'react-native-shopify-checkout-kit': path.resolve(
'@shopify/checkout-sheet-kit': path.resolve(
root,
'modules',
'react-native-shopify-checkout-kit',
'@shopify/checkout-sheet-kit',
),
},
},
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1
fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'

Pod::Spec.new do |s|
s.name = package["name"]
s.name = "RNShopifyCheckoutSheetKit"
s.version = package["version"]
s.summary = package["description"]
s.homepage = package["homepage"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "react-native-shopify-checkout-kit",
"name": "@shopify/checkout-sheet-kit",
"license": "MIT",
"version": "0.1.0",
"main": "lib/commonjs/index.js",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
"LICENSE",
"README.md",
"RNShopifyCheckoutSheetKit.podspec",
"android/build.gradle",
"android/gradle.properties",
"android/src/main/AndroidManifest.xml",
Expand Down Expand Up @@ -28,7 +28,6 @@
"lib/typescript/src/index.d.ts",
"lib/typescript/src/index.d.ts.map",
"package.json",
"react-native-shopify-checkout-kit.podspec",
"src/context.tsx",
"src/index.d.ts",
"src/index.ts"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ import {
NativeEventEmitter,
EmitterSubscription,
} from 'react-native';
import type {ShopifyCheckoutKit as ShopifyCheckout} from '.';
import {ColorScheme} from './index.d';
import {ShopifyCheckoutKitProvider, useShopifyCheckoutKit} from './context';
import type {
CheckoutEvent,
CheckoutEventCallback,
Configuration,
import {
ColorScheme,
type CheckoutEvent,
type CheckoutEventCallback,
type Configuration,
type ShopifyCheckoutKit as ShopifyCheckout,
} from './index.d';

const RNShopifyCheckoutKit = NativeModules.ShopifyCheckoutKit;

if (!('ShopifyCheckoutKit' in NativeModules)) {
throw new Error(`
"react-native-shopify-checkout-kit" is not correctly linked.
"@shopify/checkout-sheet-kit" is not correctly linked.
If you are building for iOS, make sure to run "pod install" first and restart the metro server.`);
}
Expand Down
3 changes: 0 additions & 3 deletions modules/react-native-shopify-checkout-kit/README.md

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
"homepage": "https://github.com/Shopify/checkout-kit-react-native",
"workspaces": [
"sample",
"modules/*"
"modules/**/*"
],
"scripts": {
"clean": "watchman watch-del .",
"sample": "yarn workspace sample",
"module": "yarn workspace react-native-shopify-checkout-kit",
"module": "yarn workspace @shopify/checkout-sheet-kit",
"pod-install": "NO_FLIPPER=1 pod-install",
"snapshot": "./scripts/create_snapshot",
"turbo": "turbo",
Expand Down
2 changes: 1 addition & 1 deletion sample/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ end

pod 'SwiftLint'

pod "react-native-shopify-checkout-kit", :path => "../../modules/react-native-shopify-checkout-kit"
pod "RNShopifyCheckoutSheetKit", :path => "../../modules/@shopify/checkout-sheet-kit"
16 changes: 8 additions & 8 deletions sample/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,6 @@ PODS:
- glog
- react-native-safe-area-context (4.7.4):
- React-Core
- react-native-shopify-checkout-kit (0.1.0):
- React-Core
- ShopifyCheckoutKit (~> 0.8.0)
- React-NativeModulesApple (0.72.7):
- hermes-engine
- React-callinvoker
Expand Down Expand Up @@ -464,6 +461,9 @@ PODS:
- RNScreens (3.27.0):
- RCT-Folly (= 2021.07.22.00)
- React-Core
- RNShopifyCheckoutSheetKit (0.1.0):
- React-Core
- ShopifyCheckoutKit (~> 0.8.0)
- RNVectorIcons (10.0.2):
- RCT-Folly (= 2021.07.22.00)
- React-Core
Expand Down Expand Up @@ -497,7 +497,6 @@ DEPENDENCIES:
- React-jsinspector (from `../../node_modules/react-native/ReactCommon/jsinspector`)
- React-logger (from `../../node_modules/react-native/ReactCommon/logger`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- react-native-shopify-checkout-kit (from `../../modules/react-native-shopify-checkout-kit`)
- React-NativeModulesApple (from `../../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`)
- React-perflogger (from `../../node_modules/react-native/ReactCommon/reactperflogger`)
- React-RCTActionSheet (from `../../node_modules/react-native/Libraries/ActionSheetIOS`)
Expand All @@ -518,6 +517,7 @@ DEPENDENCIES:
- "RNCMaskedView (from `../node_modules/@react-native-community/masked-view`)"
- RNReanimated (from `../node_modules/react-native-reanimated`)
- RNScreens (from `../node_modules/react-native-screens`)
- "RNShopifyCheckoutSheetKit (from `../../modules/@shopify/checkout-sheet-kit`)"
- RNVectorIcons (from `../node_modules/react-native-vector-icons`)
- SwiftLint
- Yoga (from `../../node_modules/react-native/ReactCommon/yoga`)
Expand Down Expand Up @@ -576,8 +576,6 @@ EXTERNAL SOURCES:
:path: "../../node_modules/react-native/ReactCommon/logger"
react-native-safe-area-context:
:path: "../node_modules/react-native-safe-area-context"
react-native-shopify-checkout-kit:
:path: "../../modules/react-native-shopify-checkout-kit"
React-NativeModulesApple:
:path: "../../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios"
React-perflogger:
Expand Down Expand Up @@ -618,6 +616,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-reanimated"
RNScreens:
:path: "../node_modules/react-native-screens"
RNShopifyCheckoutSheetKit:
:path: "../../modules/@shopify/checkout-sheet-kit"
RNVectorIcons:
:path: "../node_modules/react-native-vector-icons"
Yoga:
Expand Down Expand Up @@ -648,7 +648,6 @@ SPEC CHECKSUMS:
React-jsinspector: 8baadae51f01d867c3921213a25ab78ab4fbcd91
React-logger: 8edc785c47c8686c7962199a307015e2ce9a0e4f
react-native-safe-area-context: 2cd91d532de12acdb0a9cbc8d43ac72a8e4c897c
react-native-shopify-checkout-kit: 1be7cb61bb6858c1d757d5f1360a2f914e327d3c
React-NativeModulesApple: b6868ee904013a7923128892ee4a032498a1024a
React-perflogger: 31ea61077185eb1428baf60c0db6e2886f141a5a
React-RCTActionSheet: 392090a3abc8992eb269ef0eaa561750588fc39d
Expand All @@ -669,12 +668,13 @@ SPEC CHECKSUMS:
RNCMaskedView: 0e1bc4bfa8365eba5fbbb71e07fbdc0555249489
RNReanimated: b3fe5092e7c7da790180e28c48f31e6b2bd3bfec
RNScreens: 3c2d122f5e08c192e254c510b212306da97d2581
RNShopifyCheckoutSheetKit: 6cc2bc557b090de1e82f22f5df42c54dc93e0a8f
RNVectorIcons: 23b6e11af4aaf104d169b1b0afa7e5cf96c676ce
ShopifyCheckoutKit: bc3965f57c8efb4436c38b919be144faca71d508
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
SwiftLint: c1de071d9d08c8aba837545f6254315bc900e211
Yoga: 4c3aa327e4a6a23eeacd71f61c81df1bcdf677d5

PODFILE CHECKSUM: 2fac0a2970da51a4ec464974ea24d63658e85748
PODFILE CHECKSUM: 501ff3bc049a7b8b50204bc9220ab4e2b9c6138b

COCOAPODS: 1.14.3
Loading

0 comments on commit 0b258f2

Please sign in to comment.