|
2 | 2 |
|
3 | 3 | - [Getting Started](#getting-started)
|
4 | 4 | - [Environment Variables](#environment-variables)
|
| 5 | + - [Creating the marketplace app](#creating-the-marketplace-app) |
| 6 | + - [Provider ID](#provider-id) |
5 | 7 | - [Authentication](#authentication)
|
6 | 8 | - [User Credentials](#user-credentials)
|
7 | 9 | - [Provider Credentials](#provider-credentials)
|
8 | 10 | - [Webstore Component Library](#webstore-component-library)
|
9 | 11 | - [Upgrading To The Latest Version](#upgrading-to-the-latest-version)
|
10 | 12 | - [Component Library Dev Mode](#component-library-dev-mode)
|
| 13 | +- [Exception Handling](#exception-handling) |
11 | 14 | - [Linting](#linting)
|
12 | 15 | - [Testing](#testing)
|
13 | 16 | - [Jest](#jest)
|
|
31 | 34 |
|
32 | 35 | The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. -->
|
33 | 36 |
|
34 |
| -## Webstore Component Library |
35 |
| -The webstore requires a [React component library](https://reactjs.org/docs/react-component.html) of view components. That dependency is packaged and released independently. |
36 |
| - |
37 |
| -#### Upgrading To The Latest Version |
38 |
| -In the terminal: |
39 |
| -``` bash |
40 |
| -# first check for whether there is an updated version |
41 |
| -yarn outdated @scientist-softserv/webstore-component-library # check the values under "current" and "latest" |
42 |
| - |
43 |
| -# if there's an updated version |
44 |
| -yarn upgrade @scientist-softserv/webstore-component-library --latest |
45 |
| -``` |
46 |
| - |
47 |
| -#### Component Library Dev Mode |
48 |
| -Using the local github repository requires you to manually clone the component library to your computer, build, and link it: |
49 |
| - |
50 |
| -Preparing your local copy of the component library: |
51 |
| - |
52 |
| - git clone https://github.com/scientist-softserv/webstore-component-library.git |
53 |
| - cd webstore-component-library |
54 |
| - npm install |
55 |
| - yarn link # now there is a magic symlink in `~/.config/yarn/link` usable by the webstore app |
56 |
| - |
57 |
| -If there are changes to the component library, you will need to rebuild in order to get the newest changes. You can either rebuild manually after changes are made, or have the webstore continually "watch" for changes: |
58 |
| - |
59 |
| - npm run build-lib # for a onetime build |
60 |
| - npm run watch-lib # for a continuous build |
61 |
| - |
62 |
| -Back in your webstore checkout: |
63 |
| - |
64 |
| - yarn link "@scientist-softserv/webstore-component-library" |
65 |
| - |
66 |
| -and your `webstore` will start using the local component build. |
67 |
| - |
68 |
| -If you are using a local version of the component library, you will need to temporarily delete the line `"@scientist-softserv/webstore-component-library": "VERSION_HERE",` from the `package.json` file in order to see your local changes as opposed to pulling from the github package. |
69 |
| - |
70 | 37 | ### Environment Variables
|
71 |
| -Configure the environment variables below in your local and published application to ensure that it works. |
| 38 | +The following variables can be found in the `.env` and `.env.local` files. |
| 39 | + |
| 40 | +| Name | Description | Required | |
| 41 | +| ------------- | ------------- | ------------- | |
| 42 | +| NEXT_PUBLIC_PROVIDER_NAME | The subdomain of the `marketplace-domain` | Yes | |
| 43 | +| NEXT_PUBLIC_PROVIDER_ID | TODO | Yes | |
| 44 | +| NEXT_PUBLIC_APP_BASE_URL | TODO | Yes | |
| 45 | +| NEXT_PUBLIC_SCIENTIST_API_VERSION | TODO | Yes | |
| 46 | +| NEXT_PUBLIC_WEBHOOK_URL | TODO | Yes | |
| 47 | +| NEXTAUTH_SECRET | TODO | Yes | |
| 48 | +| NEXTAUTH_URL | TODO | Yes | |
| 49 | +| CLIENT_ID | TODO | Yes | |
| 50 | +| CLIENT_SECRET | TODO | Yes | |
| 51 | +| NEXT_PUBLIC_TOKEN | TODO | Yes | |
| 52 | +| SENTRY_DSN | TODO | No | |
| 53 | +| NEXT_PUBLIC_SENTRY_DSN | TODO | No | |
| 54 | +| SENTRY_URL | TODO | No | |
| 55 | +| SENTRY_ORG | TODO | No | |
| 56 | +| SENTRY_PROJECT | TODO | No | |
| 57 | +| SENTRY_AUTH_TOKEN | TODO | No | |
| 58 | + |
| 59 | +#### Creating the marketplace app |
| 60 | +Ensure that a marketplace, e.g. client-name.scientist.com, has been created by the Scientist.com Professional Services team. Once that exists, an app needs to be created on it by a developer with the proper permissions. This will allow for the environment variables in the `.env` and `.env.local` files to be set. You'll know if you have the proper developer permissions if once logged in on the client marketplace you can hover over your avatar and see "Applications" underneath the "Developer" settings. |
| 61 | +- Once you've clicked the "Applications" link mentioned above, press "New Application" |
| 62 | + - Only the application name is required for the moment |
| 63 | +- Save and you should be redirected to the "Developer Details" page |
| 64 | +- There will be a button that says "Reveal Token" |
| 65 | +- Click it. You'll need that token in the next step. |
| 66 | + |
| 67 | +#### Provider ID |
| 68 | +In an API GUI (e.g. Postman) make a GET request for `<marketplace-domain>/api/v2/providers.json?q=${YOUR_PROVIDER_NAME}`, e.g. `webstore.scientist.com/api/v2/providers.json?q=webstore`. Your authorization needs to be your token from the step above, formatted as a Bearer Token. Scroll to the `provider_refs` array and use the `provider_id` value to fill in the `NEXT_PUBLIC_PROVIDER_ID` variable below. |
| 69 | + |
| 70 | +The `NEXT_PUBLIC_PROVIDER_NAME` needs to exactly match the subdomain of the `marketplace-domain`. |
72 | 71 |
|
73 |
| -#### Provider |
74 |
| -Someone with access to the api needs to visit `/providers.json?q=${YOUR_PROVIDER_NAME}` to find your provider object and id. Once found, update the variable below. |
75 | 72 |
|
76 | 73 | ``` bash
|
77 | 74 | # .env
|
78 |
| -NEXT_PUBLIC_PROVIDER_NAME # e.g.: acme |
| 75 | +NEXT_PUBLIC_PROVIDER_NAME # e.g.: webstore |
79 | 76 | NEXT_PUBLIC_PROVIDER_ID # e.g.: 500
|
80 | 77 | ```
|
81 | 78 |
|
@@ -108,6 +105,45 @@ The curl command will return a JSON object that has an `access_token` property.
|
108 | 105 | NEXT_PUBLIC_TOKEN
|
109 | 106 | ```
|
110 | 107 |
|
| 108 | +## Webstore Component Library |
| 109 | +The webstore requires a [React component library](https://reactjs.org/docs/react-component.html) of view components. That dependency is packaged and released independently. |
| 110 | + |
| 111 | +#### Upgrading To The Latest Version |
| 112 | +In the terminal: |
| 113 | +``` bash |
| 114 | +# first check for whether there is an updated version |
| 115 | +yarn outdated @scientist-softserv/webstore-component-library # check the values under "current" and "latest" |
| 116 | + |
| 117 | +# if there's an updated version |
| 118 | +yarn upgrade @scientist-softserv/webstore-component-library --latest |
| 119 | +``` |
| 120 | + |
| 121 | +#### Component Library Dev Mode |
| 122 | +Using the local github repository requires you to manually clone the component library to your computer, build, and link it: |
| 123 | + |
| 124 | +Preparing your local copy of the component library: |
| 125 | + |
| 126 | + git clone https://github.com/scientist-softserv/webstore-component-library.git |
| 127 | + cd webstore-component-library |
| 128 | + npm install |
| 129 | + yarn link # now there is a magic symlink in `~/.config/yarn/link` usable by the webstore app |
| 130 | + |
| 131 | +If there are changes to the component library, you will need to rebuild in order to get the newest changes. You can either rebuild manually after changes are made, or have the webstore continually "watch" for changes: |
| 132 | + |
| 133 | + npm run build-lib # for a onetime build |
| 134 | + npm run watch-lib # for a continuous build |
| 135 | + |
| 136 | +Back in your webstore checkout: |
| 137 | + |
| 138 | + yarn link "@scientist-softserv/webstore-component-library" |
| 139 | + |
| 140 | +and your `webstore` will start using the local component build. |
| 141 | + |
| 142 | +If you are using a local version of the component library, you will need to temporarily delete the line `"@scientist-softserv/webstore-component-library": "VERSION_HERE",` from the `package.json` file in order to see your local changes as opposed to pulling from the github package. |
| 143 | + |
| 144 | +## Exception Handling |
| 145 | +<!-- TODO: add sentry details --> |
| 146 | + |
111 | 147 | ## Linting
|
112 | 148 | ``` bash
|
113 | 149 | # lint all files
|
|
0 commit comments