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

Update prism-react-render & webpack config #1039

Merged
merged 1 commit into from Mar 2, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 deletions contents/docs/integrations/android-integration.mdx
Expand Up @@ -27,7 +27,7 @@ dependencies {

The best place to initialize the client is in your `Application` subclass.

```java
```js
public class SampleApp extends Application {
private static final String POSTHOG_API_KEY = "<ph_project_api_key>";
private static final String POSTHOG_HOST = "<ph_instance_address>";
Expand Down Expand Up @@ -64,7 +64,7 @@ An identify call requires:
* `distinctId` which uniquely identifies your user in your database
* `userProperties` with a dictionary of key:value pairs

```java
```js
PostHog.with(this)
.identify(distinctID, new Properties()
.putValue("name", "My Name")
Expand All @@ -91,7 +91,7 @@ Optionally you can submit:

For example:

```java
```js
PostHog.with(this)
.capture("Button B Clicked", new Properties()
.putValue("color", "blue")
Expand All @@ -106,7 +106,7 @@ Setting this to `1` will send events immediately and will use more battery. The
You can also configure the flush interval. By default we flush all events after `30` seconds,
no matter how many events have been gathered.

```java
```js
PostHog posthog = new PostHog.Builder(this, POSTHOG_API_KEY, POSTHOG_HOST)
.flushQueueSize(20)
.flushInterval(30, TimeUnit.SECONDS)
Expand All @@ -116,7 +116,7 @@ PostHog posthog = new PostHog.Builder(this, POSTHOG_API_KEY, POSTHOG_HOST)

You can also manually flush the queue:

```java
```js
PostHog.with(this)
.flush();
```
Expand All @@ -125,7 +125,7 @@ PostHog.with(this)

To reset the user's ID and anonymous ID, call `reset`. Usually you would do this right after the user logs out.

```java
```js
PostHog.with(this)
.reset();
```
Expand All @@ -138,7 +138,7 @@ If you want to manually send a new screen capture event, use the `screen` functi

This function requires a `name`. You may also pass in an optional `properties` object.

```java
```js
PostHog.with(this)
.screen("Dashboard", new Properties()
.putValue("background", "blue")
Expand All @@ -150,7 +150,7 @@ PostHog.with(this)

When creating the PostHog client, there are many options you can set:

```java
```js
PostHog posthog = new PostHog.Builder(this, POSTHOG_API_KEY, POSTHOG_HOST)
// Record certain application events automatically! (off/false by default)
.captureApplicationLifecycleEvents()
Expand Down
2 changes: 1 addition & 1 deletion contents/docs/integrations/flutter-integration.mdx
Expand Up @@ -40,7 +40,7 @@ To use this plugin, add `posthog_flutter` as a [dependency in your pubspec.yaml

### Example

```java
```js
import 'package:flutter/material.dart';
import 'package:posthog_flutter/posthog_flutter.dart';

Expand Down
12 changes: 6 additions & 6 deletions contents/docs/integrations/ios-integration.mdx
Expand Up @@ -49,7 +49,7 @@ configuration.recordScreenViews = YES; // Record screen views automatically!

### With Swift

```swift
```js
import PostHog

// `host` is optional if you use PostHog Cloud (app.posthog.com)
Expand Down Expand Up @@ -86,7 +86,7 @@ For example:
@"email": @"peter@familyguy.com" }];
```

```swift
```js
// in swift
posthog.identify("user_id_from_your_database",
properties: ["name": "Peter Griffin", "email": "peter@familyguy.com"])
Expand Down Expand Up @@ -117,7 +117,7 @@ For example:
[[PHGPostHog sharedPostHog] capture:@"Signed Up" properties:@{ @"plan": @"Pro++" }];
```

```swift
```js
// in swift
posthog.capture("Signed Up", properties: ["plan": "Pro++"])
```
Expand All @@ -139,7 +139,7 @@ You can also manually flush the queue:
[[PHGPostHog sharedPostHog] flush]
```

```swift
```js
// in swift
posthog.capture("Logged Out")
posthog.flush()
Expand All @@ -154,7 +154,7 @@ To reset the user's ID and anonymous ID, call `reset`. Usually you would do this
[[PHGPostHog sharedPostHog] reset]
```

```swift
```js
// in swift
posthog.reset()
```
Expand All @@ -170,7 +170,7 @@ If you want to manually send a new screen capture event, use the `screen` functi
[[PHGPostHog sharedPostHog] screen:@"Dashboard" properties:@{ @"fromIcon": @"bottom" }];
```

```swift
```js
// in swift
posthog.capture("Dashboard", properties: ["fromIcon": "bottom"])
```
Expand Down
11 changes: 6 additions & 5 deletions contents/docs/integrations/php-integration.mdx
Expand Up @@ -24,7 +24,7 @@ And then install the dependencies with the command: `php composer.phar install`

In your app, set your API key before making any calls.

```php
```js
PostHog::init("<ph_project_api_key>",
array('host' => '<ph_instance_address>') // You can remove this line if you're using app.posthog.com
);
Expand All @@ -49,7 +49,8 @@ Optionally you can submit:
- `properties`, which is an array with any information you'd like to add

For example:
```php

```js
PostHog::capture(array(
'distinctId' => 'user:123',
'event' => 'movie played',
Expand All @@ -73,7 +74,7 @@ An `identify` call requires:

For example:

```
```js
PostHog::identify(array(
'distinctId' => 'user:123',
'properties' => array(
Expand Down Expand Up @@ -101,7 +102,7 @@ An alias call requires:

For example:

```
```js
PostHog::alias(array(
'distinctId' => 'user:123',
'alias' => 'user:12345'
Expand All @@ -112,7 +113,7 @@ PostHog::alias(array(

If you're aiming for a full back-end implementation of PostHog, you can send pageviews from your backend

```php
```js
PostHog::capture(array(
'distinctId' => 'user:123',
'event' => '$pageview',
Expand Down
17 changes: 17 additions & 0 deletions gatsby-node.js
@@ -1,3 +1,5 @@
const path = require('path')

exports.createPages = require('./gatsby/createPages')
exports.onCreateNode = require('./gatsby/onCreateNode')

Expand All @@ -14,3 +16,18 @@ exports.onCreatePage = async ({ page, actions }) => {
createPage(page)
}
}

exports.onCreateWebpackConfig = ({ stage, actions }) => {
actions.setWebpackConfig({
resolve: {
extensions: ['.js', '.ts', '.tsx'],
alias: {
'~': path.resolve(__dirname, 'src'),
lib: path.resolve(__dirname, 'src', 'lib'),
types: path.resolve(__dirname, 'src', 'types'),
images: path.resolve(__dirname, 'src', 'images'),
components: path.resolve(__dirname, 'src', 'components'),
},
},
})
}
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -55,7 +55,7 @@
"node-fetch": "^2.6.1",
"node-sass": "^4.14.1",
"postcss": "^8.2.6",
"prism-react-renderer": "^1.1.1",
"prism-react-renderer": "^1.2.0",
"prismjs": "^1.23.0",
"query-string": "^6.13.1",
"react": "^16.13.1",
Expand Down
4 changes: 2 additions & 2 deletions src/components/CodeBlock/index.tsx
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react'
import Highlight, { defaultProps, Language } from 'prism-react-renderer'
import { OkaidiaTheme } from '../../lib/okaidia'
import theme from 'prism-react-renderer/themes/okaidia'
import { getCookie, generateRandomHtmlId } from '../../lib/utils'
import { useValues } from 'kea'
import { posthogAnalyticsLogic } from '../../logic/posthogAnalyticsLogic'
Expand Down Expand Up @@ -76,7 +76,7 @@ export const CodeBlock = (props: CodeBlockProps) => {
{...defaultProps}
code={code || props.children.props.children.trim()}
language={language as Language}
theme={OkaidiaTheme}
theme={theme}
>
{({ className, style, tokens, getLineProps, getTokenProps }) => (
<pre className={className} style={{ ...style, padding: '20px' }} id={codeBlockId}>
Expand Down
118 changes: 0 additions & 118 deletions src/lib/okaidia/index.ts

This file was deleted.

14 changes: 7 additions & 7 deletions src/pages/index.js
Expand Up @@ -16,13 +16,13 @@ import visualizeTrends from '../images/retro-product-trends.svg'
import retroFlagsImg from '../images/retro-feature-flags.svg'
import selfHostedImg from '../images/self-host.svg'
import sessionRecordingImg from '../images/session-recording-3.svg'
import { SEO } from '../components/seo'
import Layout from '../components/Layout'
import { FeaturedSectionTextLeft } from '../components/Sections/FeaturedSectionTextLeft'
import { FeaturedSectionTextRight } from '../components/Sections/FeaturedSectionTextRight'
import { FeaturedSectionTripleImage } from '../components/Sections/FeaturedSectionTripleImage'
import { Spacer } from '../components/Spacer'
import { DesignedForYourStackBlock } from '../components/Sections/DesignedForYourStackBlock'
import { SEO } from 'components/seo'
import Layout from 'components/Layout'
import { FeaturedSectionTextLeft } from 'components/Sections/FeaturedSectionTextLeft'
import { FeaturedSectionTextRight } from 'components/Sections/FeaturedSectionTextRight'
import { FeaturedSectionTripleImage } from 'components/Sections/FeaturedSectionTripleImage'
import { Spacer } from 'components/Spacer'
import { DesignedForYourStackBlock } from 'components/Sections/DesignedForYourStackBlock'
import { useActions } from 'kea'
import { layoutLogic } from '../logic/layoutLogic'

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -12870,10 +12870,10 @@ pretty-hrtime@^1.0.3:
resolved "https://registry.yarnpkg.com/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz#b7e3ea42435a4c9b2759d99e0f201eb195802ee1"
integrity sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=

prism-react-renderer@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/prism-react-renderer/-/prism-react-renderer-1.1.1.tgz#1c1be61b1eb9446a146ca7a50b7bcf36f2a70a44"
integrity sha512-MgMhSdHuHymNRqD6KM3eGS0PNqgK9q4QF5P0yoQQvpB6jNjeSAi3jcSAz0Sua/t9fa4xDOMar9HJbLa08gl9ug==
prism-react-renderer@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/prism-react-renderer/-/prism-react-renderer-1.2.0.tgz#5ad4f90c3e447069426c8a53a0eafde60909cdf4"
integrity sha512-GHqzxLYImx1iKN1jJURcuRoA/0ygCcNhfGw1IT8nPIMzarmKQ3Nc+JcG0gi8JXQzuh0C5ShE4npMIoqNin40hg==

prismjs@^1.23.0:
version "1.23.0"
Expand Down