@duffel/components 3.0.6-canary → 3.0.7-canary
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +6 -1
- package/.github/workflows/release.yml +1 -1
- package/CONTRIBUTING.md +6 -54
- package/README.md +24 -1
- package/config/esbuild.dev.config.js +1 -1
- package/package.json +1 -1
- package/react-dist/custom-elements.js +3 -3
- package/react-dist/custom-elements.js.map +1 -1
- package/react-dist/index.js +3 -3
- package/react-dist/index.js.map +1 -1
- package/src/examples/client-side/README.md +30 -0
- package/src/examples/full-stack/README.md +34 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# duffel-components client-side example
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
# .env.local
|
|
7
|
+
|
|
8
|
+
# The Duffel API environment we want to make requests to.
|
|
9
|
+
# Remember to update the key below if this value changes.
|
|
10
|
+
# DUFFEL_API_URL=https://api.duffel.com # production
|
|
11
|
+
DUFFEL_API_URL=https://localhost:4000 # development (for Duffel engineers only)
|
|
12
|
+
|
|
13
|
+
# Used to authenticate our
|
|
14
|
+
# example server to talk to Duffel
|
|
15
|
+
# DUFFEL_API_TOKEN=duffel_test_**** # production
|
|
16
|
+
DUFFEL_API_TOKEN=test_duffel_dev_rw # development (for Duffel engineers only)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# The url for the component CDN.
|
|
20
|
+
# This is used to load both the styles an
|
|
21
|
+
# COMPONENT_CDN=https://assets.duffel.com/components/ancillaries/VERSION # production
|
|
22
|
+
COMPONENT_CDN=http://localhost:8000 # development
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Run the example
|
|
26
|
+
|
|
27
|
+
This is a basic example that doesn't rely on the Duffel API, from the root of the repository run `yarn run-example:client-side`. This command will:
|
|
28
|
+
|
|
29
|
+
1. Serve the Duffel component bundle and watch for changes to rebuild on port `8000`. This can also be done with `yarn dev`
|
|
30
|
+
2. Host a basic `index.html` with `http-server`. The example page will be ready on port `6262`. This can be done with `yarn run-client-side-server`
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# duffel-components full-stack example
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
# .env.local
|
|
7
|
+
|
|
8
|
+
# The Duffel API environment we want to make requests to.
|
|
9
|
+
# Remember to update the key below if this value changes.
|
|
10
|
+
# DUFFEL_API_URL=https://api.duffel.com # production
|
|
11
|
+
DUFFEL_API_URL=https://localhost:4000 # development (for Duffel engineers only)
|
|
12
|
+
|
|
13
|
+
# Used to authenticate our
|
|
14
|
+
# example server to talk to Duffel
|
|
15
|
+
# DUFFEL_API_TOKEN=duffel_test_**** # production (find it on https://app.duffel.com/YOUR_ORG/test/developers/tokens)
|
|
16
|
+
DUFFEL_API_TOKEN=test_duffel_dev_rw # development (for Duffel engineers only)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# The url for the component CDN.
|
|
20
|
+
# This is used to load both the styles an
|
|
21
|
+
# COMPONENT_CDN=https://assets.duffel.com/components/ancillaries/VERSION # production
|
|
22
|
+
COMPONENT_CDN=http://localhost:8000 # development
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Run the example
|
|
26
|
+
|
|
27
|
+
This example has a server that will reach out to the Duffel API to search and retrieve an offer.
|
|
28
|
+
To talk to the API we'll define the url to the API environment we want and .
|
|
29
|
+
Please add the following to `.env.local`:
|
|
30
|
+
|
|
31
|
+
This is a 'real life' example, where it uses a real offer ID and client key retrieved from the Duffel API. To run this, use `yarn run-example:full-stack`. This command will:
|
|
32
|
+
|
|
33
|
+
1. Serve the Duffel component bundle and watch for changes to rebuild on port `8000`. This can also be done with `yarn dev`
|
|
34
|
+
2. Run the full stack server using node. The example page will be ready on port `6262`. This can be done with `yarn run-full-stack-server`
|