@ingridab/sdk 0.2.0 → 0.4.0
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/README.md +5 -3
- package/dist/index.d.ts +995 -1055
- package/dist/index.js +714 -4257
- package/dist/internal.d.ts +85 -2
- package/dist/internal.js +17 -13
- package/package.json +10 -9
- package/dist/LICENSES.md +0 -37
package/README.md
CHANGED
|
@@ -22,6 +22,7 @@ import ingrid, { createAddressMolecule } from '@ingridab/sdk';
|
|
|
22
22
|
|
|
23
23
|
const instance = await ingrid.init({
|
|
24
24
|
token: 'your-auth-token',
|
|
25
|
+
refreshToken: () => fetch('/your-backend/ingrid-token').then(r => r.json()),
|
|
25
26
|
siteId: 'your-site-id',
|
|
26
27
|
locale: 'en-US',
|
|
27
28
|
countryCode: 'US',
|
|
@@ -34,9 +35,10 @@ await instance.compound.mount('#ingrid-container');
|
|
|
34
35
|
|
|
35
36
|
### Auth
|
|
36
37
|
|
|
37
|
-
`refreshToken` is optional. Use it with
|
|
38
|
-
preferred. The callback should call
|
|
39
|
-
|
|
38
|
+
The `refreshToken` parameter on `ingrid.init` is optional. Use it with
|
|
39
|
+
short-lived Ingrid API tokens, which are preferred. The callback should call
|
|
40
|
+
your backend, fetch a fresh Ingrid API token
|
|
41
|
+
server-side, and return it with its expiration timestamp: `{ accessToken, expiresAt }`.
|
|
40
42
|
|
|
41
43
|
### Listening to events
|
|
42
44
|
|