Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prettier, dependencies and various other clean-up #1

Merged
merged 3 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Lint

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v3
with:
node-version: '18'

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install

- name: Install deps
run: pnpm i

- name: Lint
run: pnpm run lint
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
node_modules

# Misc
.DS_Store

# Debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log

# We use pnpm and not npm
package-lock.json
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"printWidth": 100,
"trailingComma": "es5",
"singleQuote": true,
"tabWidth": 2
}
6 changes: 5 additions & 1 deletion _snippets/typescript-sdk/create-attachment-url-response.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
"__typename": "Attachment",
"id": "att_01H3970W7XG1716AVNGQ6FWYGD",
"fileName": "the-filename.jpeg",
"fileSize": { "__typename": "FileSize", "kiloBytes": 32.32, "megaBytes": 0.03 },
"fileSize": {
"__typename": "FileSize",
"kiloBytes": 32.32,
"megaBytes": 0.03
},
"fileExtension": null,
"updatedAt": {
"__typename": "DateTime",
Expand Down
4 changes: 3 additions & 1 deletion _snippets/typescript-sdk/get-customer-by-id.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ const client = new PlainClient({
apiKey: 'XXX',
});

const res = await client.getCustomerById({ customerId: 'c_01H14DFQ4PDYBH398J1E99TWSS' });
const res = await client.getCustomerById({
customerId: 'c_01H14DFQ4PDYBH398J1E99TWSS',
});

if (res.error) {
console.error(res.error);
Expand Down
5 changes: 4 additions & 1 deletion _snippets/typescript-sdk/page-info-after.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ if (firstPage.error) {
console.error(firstPage.error);
} else {
const { pageInfo } = firstPage.data;
const secondPage = await client.getCustomers({ after: pageInfo.endCursor, first: 50 });
const secondPage = await client.getCustomers({
after: pageInfo.endCursor,
first: 50,
});
}
```
4 changes: 3 additions & 1 deletion _snippets/typescript-sdk/remove-labels.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { PlainClient } from '@team-plain/typescript-sdk';

const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });

const res = await client.removeLabels({ labelIds: ['l_01HD428Y1TREH5KTXP019K6FPK'] });
const res = await client.removeLabels({
labelIds: ['l_01HD428Y1TREH5KTXP019K6FPK'],
});

if (res.error) {
console.error(res.error);
Expand Down
6 changes: 5 additions & 1 deletion _snippets/typescript-sdk/upsert-customer-response.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
"fullName": "Donald Duck",
"shortName": "Donald",
"externalId": "c_123",
"email": { "email": "[email protected]", "isVerified": false, "verifiedAt": null },
"email": {
"email": "[email protected]",
"isVerified": false,
"verifiedAt": null
},
"status": "IDLE",
"statusChangedAt": {
"__typename": "DateTime",
Expand Down
18 changes: 18 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "@team-plain/docs-mintlify",
"version": "1.0.0",
"description": "Documentation for plain.com",
"main": "index.js",
"engines": {
"node": "18.x",
"pnpm": "8.x"
},
"scripts": {
"dev": "mintlify dev",
"lint": "prettier --check './**/*.{js,ts,tsx,md,mdx}'"
},
"dependencies": {
"mintlify": "^4.0.58",
"prettier": "^3.1.0"
}
}
38 changes: 25 additions & 13 deletions pages/attachments.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "File Attachments"
title: 'File Attachments'
description: "When using Plain's API to send emails or [create threads](/graphql/threads/create), you can add file attachments."
---

Expand All @@ -25,18 +25,19 @@ To try this, you will need an [API key](/graphql/authentication/) with the follo

<Tabs>
<Tab title="Typescript SDK">

```typescript
import { AttachmentType, PlainClient } from '@team-plain/typescript-sdk';

const client = new PlainClient({ apiKey: 'XXX' });

const res = await client.createAttachmentUploadUrl({
customerId: 'c_XXXXXXXXXXXXXXXXXXXXXXXXXX',
fileName: 'the-filename.jpeg',
fileSizeBytes: 32318,
attachmentType: AttachmentType.CustomTimelineEntry,
});

if (res.error) {
console.error(res.error);
} else {
Expand All @@ -54,7 +55,11 @@ if (res.error) {
"__typename": "Attachment",
"id": "att_01H3970W7XG1716AVNGQ6FWYGD",
"fileName": "the-filename.jpeg",
"fileSize": { "__typename": "FileSize", "kiloBytes": 32.32, "megaBytes": 0.03 },
"fileSize": {
"__typename": "FileSize",
"kiloBytes": 32.32,
"megaBytes": 0.03
},
"fileExtension": null,
"updatedAt": {
"__typename": "DateTime",
Expand Down Expand Up @@ -101,6 +106,7 @@ if (res.error) {
}
}
```

</Tab>

<Tab title="GraphQL">
Expand Down Expand Up @@ -144,6 +150,7 @@ Variables
}
}
```

```json Response
{
"data": {
Expand Down Expand Up @@ -193,6 +200,7 @@ Variables

</Tab>
</Tabs>

</Step>
<Step title="Uploading the attachment">
In the `AttachmentUploadUrl` we created in the previous step we get back 2 fields which are needed to actually upload our attachment:
Expand All @@ -206,6 +214,7 @@ Variables

<Tabs>
<Tab title="Browser">

```typescript
/**
* Upload an attachment.
Expand All @@ -219,12 +228,12 @@ function uploadAttachment(fileBlob, uploadFormUrl, uploadFormData) {
uploadFormData.forEach(({ key, value }) => {
form.append(key, value);
});

const file = new File([fileBlob], 'file');
form.append('file', file);

console.log(`Uploading attachment to ${uploadFormUrl}`);

fetch(uploadFormUrl, {
method: 'POST',
body: form,
Expand All @@ -240,12 +249,14 @@ function uploadAttachment(fileBlob, uploadFormUrl, uploadFormData) {
});
}
```

</Tab>
<Tab title="Node">

```typescript
const axios = require('axios');
const FormData = require('form-data');

/**
* Upload an attachment.
*
Expand All @@ -258,11 +269,11 @@ function uploadAttachment(fileBuffer, uploadFormUrl, uploadFormData) {
uploadFormData.forEach(({ key, value }) => {
form.append(key, value);
});

form.append('file', fileBuffer, { filename: 'file' });

console.log(`Uploading attachment to ${uploadFormUrl}`);

axios
.post(uploadFormUrl, form, {
headers: {
Expand All @@ -281,12 +292,13 @@ function uploadAttachment(fileBuffer, uploadFormUrl, uploadFormData) {
});
}
```

</Tab>
</Tabs>

</Step>
</Steps>


## Limitations

- On emails and custom timeline entries:
Expand Down
4 changes: 2 additions & 2 deletions pages/contact-forms-setup.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Contact forms"
description: "Contact forms are the best way to offer support at scale. With contact forms, you can pre-triage every support request so that when you know exactly what to prioritize in Plain."
title: 'Contact forms'
description: 'Contact forms are the best way to offer support at scale. With contact forms, you can pre-triage every support request so that when you know exactly what to prioritize in Plain.'
---

Plain **does not** provide any UI components or a drop-in script tag. Instead, you use your own UI components and then use Plain's API.
Expand Down
4 changes: 2 additions & 2 deletions pages/customer-cards-setup.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Customer Cards"
description: "Customer Cards are a powerful feature in Plain that let you show information from your own systems while looking at a customer in Plain. This makes sure you always have important context when helping customers."
title: 'Customer Cards'
description: 'Customer Cards are a powerful feature in Plain that let you show information from your own systems while looking at a customer in Plain. This makes sure you always have important context when helping customers.'
---

<Frame>
Expand Down
6 changes: 3 additions & 3 deletions pages/customer-cards.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Customer Cards"
sidebarTitle: "Overview"
description: "Customer Cards are a powerful feature in Plain that let you show information from your own systems while looking at a customer in Plain. This makes sure you always have important context when helping customers."
title: 'Customer Cards'
sidebarTitle: 'Overview'
description: 'Customer Cards are a powerful feature in Plain that let you show information from your own systems while looking at a customer in Plain. This makes sure you always have important context when helping customers.'
---

## How it works
Expand Down
4 changes: 2 additions & 2 deletions pages/customer-cards/documentation.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Customer Cards Documentation"
description: "This page is intended for a technical audience that will be implementing a Customer Card API."
title: 'Customer Cards Documentation'
description: 'This page is intended for a technical audience that will be implementing a Customer Card API.'
---

Check out the [Customer Cards](/pages/customer-cards) page for an overview.
Expand Down
8 changes: 4 additions & 4 deletions pages/customer-cards/examples.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "Examples"
icon: "link"
url: "https://github.com/team-plain/example-customer-cards"
---
title: 'Examples'
icon: 'link'
url: 'https://github.com/team-plain/example-customer-cards'
---
6 changes: 3 additions & 3 deletions pages/customer-cards/playground.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "Playground"
icon: "link"
url: "https://app.plain.com/developer/customer-cards-playground/"
title: 'Playground'
icon: 'link'
url: 'https://app.plain.com/developer/customer-cards-playground/'
---
18 changes: 13 additions & 5 deletions pages/email-setup.mdx
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
---
title: "Setting up email"
title: 'Setting up email'
---

Setting up email requires you to complete two steps:

<CardGroup cols={2}>
<Card title="Receiving emails in Plain" icon="inbox-in" iconType="duotone" href="/pages/email-setup/receiving-emails">
</Card>
<Card title="Sending emails from Plain" icon="paper-plane-top" iconType="duotone" href="/pages/email-setup/sending-emails">
</Card>
<Card
title="Receiving emails in Plain"
icon="inbox-in"
iconType="duotone"
href="/pages/email-setup/receiving-emails"
></Card>
<Card
title="Sending emails from Plain"
icon="paper-plane-top"
iconType="duotone"
href="/pages/email-setup/sending-emails"
></Card>
</CardGroup>

If you follow this guide, bear in mind that:
Expand Down
Loading
Loading