14.0.14 • Published 8 months ago

@forge/ui-confluence v14.0.14

Weekly downloads
26
License
UNLICENSED
Repository
bitbucket
Last release
8 months ago

forge-ui-confluence

A package of helpers for interacting with Confluence

content-properties

Allows interacting with Confluence content properties.

Note permissions apply to interacting with content properties, for the page being accessed. So it is impacted by the user being used to interact with Confluence (is app or request user).

Example usage:

import Forge, { render, Fragment, Text, Button, useAction, useProductContext } from "@forge/ui";
import { contentProperties } from '@atlasian/forge-ui-confluence';

export type AppState = {
    count: number;
}

const KEY_PREFIX = 'counter';

const App = () => {
    const { contentId, localId } = useProductContext(); 
    const contentProps = contentProperties(contentId, api.asApp().requestConfluence);

    const key = `${KEY_PREFIX}-${localId}`;

    const initialAppState = async (): Promise<AppState> => {
        const countProp = await contentProps.read(key);
        const count: number = countProp && (countProp.value as number) || 0;
        return {
            count,
        };
    }

    const updateCount = async (oldState: AppState, action: string): Promise<AppState> => {
        switch (action) {
            case 'modify':
                await contentProps.modify(key, (prev) => ((prev as number || 0) + 1));
                return initialAppState();
            case 'replace':
                await contentProps.replace(key, oldState.count + 1);
                return initialAppState();
            case 'delete':
                await contentProps.delete(key);
                return initialAppState();
            case 'refresh':
                return initialAppState();
        }
        return oldState;
    }

    const [appState, doAction] = useAction<AppState, string>(updateCount, initialAppState);
    
    return (
        <Fragment>
            <Text>Current value {appState.count}</Text>
            <Button text="Add one (modify)" onClick={() => { doAction('modify'); }} />
            <Button text="Add one (replace)" onClick={() => { doAction('replace'); }} />
            <Button text="Reset data (delete)" onClick={() => { doAction('delete'); }} />
            <Button text="Refresh (read)" onClick={() => { doAction('refresh'); }} />
        </Fragment>
    );
};

export const run = render(<App />);
14.0.14

8 months ago

14.0.14-next.0

8 months ago

14.0.13

8 months ago

14.0.12

9 months ago

14.0.13-next.0

9 months ago

14.0.13-next.2

8 months ago

14.0.13-next.1

8 months ago

14.0.12-next.2

9 months ago

14.0.12-next.0

9 months ago

14.0.12-next.1

9 months ago

14.0.11

9 months ago

14.0.11-next.0

10 months ago

14.0.9-next.0

11 months ago

14.0.9-next.1

11 months ago

14.0.6-next.0

1 year ago

14.0.7-next.0

12 months ago

14.0.9

11 months ago

14.0.6

1 year ago

14.0.7

12 months ago

14.0.8

12 months ago

14.0.10

10 months ago

14.0.10-next.0

10 months ago

14.0.10-next.1

10 months ago

14.0.8-next.0

12 months ago

14.0.5

1 year ago

14.0.5-next.0

1 year ago

14.0.4

1 year ago

14.0.4-next.1

1 year ago

14.0.4-next.0

1 year ago

14.0.3

1 year ago

14.0.3-next.0

1 year ago

14.0.2

1 year ago

14.0.2-next.1

1 year ago

14.0.2-next.0

1 year ago

14.0.1

1 year ago

14.0.1-next.2

1 year ago

14.0.1-next.3

1 year ago

14.0.1-next.1

1 year ago

14.0.1-next.0

1 year ago

14.0.0

1 year ago

14.0.0-next.8

1 year ago

14.0.0-next.7

1 year ago

14.0.0-next.6

1 year ago

14.0.0-next.5

1 year ago

13.0.5-next.3

1 year ago

13.0.5-next.2

1 year ago

14.0.0-next.4

1 year ago

13.0.5-next.1

1 year ago

13.0.5-next.0

1 year ago

13.0.4

1 year ago

13.0.4-next.2

1 year ago

13.0.4-next.1

1 year ago

13.0.4-next.0

1 year ago

13.0.3

1 year ago

13.0.3-next.0

1 year ago

13.0.2

1 year ago

13.0.2-next.8

1 year ago

13.0.2-next.7

1 year ago

13.0.2-next.6

1 year ago

13.0.2-next.4

1 year ago

13.0.2-next.5

1 year ago

13.0.2-next.2

1 year ago

13.0.2-next.3

1 year ago

13.0.2-next.0

1 year ago

13.0.2-next.1

1 year ago

13.0.1-next.0

1 year ago

13.0.1

1 year ago

13.0.0

2 years ago

13.0.0-next.4

2 years ago

12.0.2-next.3

2 years ago

12.0.2-next.2

2 years ago

11.0.15

2 years ago

11.0.16

2 years ago

11.0.10

2 years ago

11.0.13

2 years ago

11.0.14

2 years ago

11.0.11

2 years ago

11.0.12

2 years ago

11.0.8-next.2

2 years ago

11.0.8-next.3

2 years ago

11.0.8-next.0

2 years ago

11.0.8-next.1

2 years ago

11.0.10-next.0

2 years ago

11.0.10-next.2

2 years ago

11.0.10-next.1

2 years ago

11.0.10-next.4

2 years ago

11.0.10-next.3

2 years ago

11.0.10-next.6

2 years ago

11.0.10-next.5

2 years ago

11.0.10-next.7

2 years ago

11.0.12-next.4

2 years ago

11.0.12-next.3

2 years ago

11.0.15-next.2

2 years ago

11.0.12-next.2

2 years ago

11.0.15-next.3

2 years ago

11.0.12-next.1

2 years ago

11.0.15-next.4

2 years ago

11.0.13-next.0

2 years ago

11.0.12-next.0

2 years ago

11.0.15-next.5

2 years ago

11.0.15-next.0

2 years ago

11.0.15-next.1

2 years ago

11.0.6

2 years ago

11.0.6-next.5

2 years ago

11.0.7

2 years ago

11.0.6-next.4

2 years ago

11.0.6-next.6

2 years ago

11.0.6-next.1

2 years ago

11.0.6-next.0

2 years ago

11.0.8

2 years ago

11.0.6-next.3

2 years ago

11.0.9

2 years ago

11.0.6-next.2

2 years ago

12.0.0-next.5

2 years ago

12.0.0-next.6

2 years ago

12.0.0-next.3

2 years ago

12.0.0-next.4

2 years ago

12.0.2-next.0

2 years ago

12.0.2-next.1

2 years ago

12.0.0-next.1

2 years ago

12.0.0-next.2

2 years ago

12.0.0

2 years ago

12.0.1

2 years ago

11.0.9-next.0

2 years ago

11.0.9-next.2

2 years ago

11.0.9-next.1

2 years ago

11.0.11-next.0

2 years ago

11.0.11-next.1

2 years ago

11.0.11-next.2

2 years ago

11.0.11-next.3

2 years ago

11.0.14-next.5

2 years ago

11.0.16-next.1

2 years ago

11.0.14-next.2

2 years ago

11.0.17-next.0

2 years ago

11.0.16-next.2

2 years ago

11.0.14-next.1

2 years ago

11.0.14-next.4

2 years ago

11.0.16-next.0

2 years ago

11.0.14-next.3

2 years ago

11.0.16-next.5

2 years ago

11.0.16-next.6

2 years ago

11.0.16-next.3

2 years ago

11.0.14-next.0

2 years ago

11.0.16-next.4

2 years ago

11.0.7-next.1

2 years ago

11.0.7-next.2

2 years ago

11.0.7-next.3

2 years ago

11.0.7-next.4

2 years ago

11.0.7-next.0

2 years ago

12.0.1-next.1

2 years ago

12.0.1-next.0

2 years ago

11.0.5

2 years ago

11.0.5-next.1

2 years ago

11.0.5-next.0

2 years ago

11.0.4

2 years ago

11.0.3

2 years ago

11.0.4-next.0

2 years ago

11.0.3-next.0

2 years ago

11.0.3-next.1

2 years ago

11.0.3-next.2

2 years ago

11.0.3-next.3

2 years ago

10.0.5

2 years ago

11.0.0-next.0

2 years ago

11.0.1-next.1

2 years ago

11.0.1-next.0

2 years ago

10.0.5-next.0

2 years ago

10.0.5-next.1

2 years ago

10.0.5-next.2

2 years ago

10.0.5-next.3

2 years ago

11.0.2-next.2

2 years ago

11.0.2-next.0

2 years ago

11.0.2-next.1

2 years ago

11.0.2

2 years ago

11.0.0

2 years ago

11.0.1

2 years ago

10.0.0

2 years ago

10.0.1

2 years ago

10.0.2

2 years ago

10.0.3

2 years ago

10.0.4

2 years ago

10.0.0-next.0

2 years ago

10.0.4-next.0

2 years ago

10.0.4-next.1

2 years ago

10.0.1-next.2

2 years ago

10.0.0-next.3

2 years ago

10.0.0-next.4

2 years ago

10.0.0-next.1

2 years ago

10.0.0-next.2

2 years ago

10.0.1-next.0

2 years ago

10.0.1-next.1

2 years ago

10.0.3-next.0

2 years ago

10.0.2-next.1

2 years ago

10.0.2-next.0

2 years ago

9.0.0

2 years ago

9.0.0-next.9

2 years ago

9.0.0-next.6

2 years ago

9.0.0-next.5

2 years ago

9.0.0-next.4

2 years ago

9.0.0-next.3

2 years ago

9.0.0-next.8

2 years ago

9.0.0-next.7

2 years ago

9.0.0-next.2

2 years ago

9.0.0-next.1

2 years ago

9.0.0-next.0

2 years ago

8.0.1

2 years ago

8.0.1-next.4

2 years ago

8.0.1-next.3

2 years ago

8.0.0-next.3

2 years ago

8.0.0-next.2

2 years ago

8.0.1-next.2

2 years ago

8.0.1-next.1

2 years ago

8.0.1-next.0

2 years ago

8.0.0

2 years ago

7.0.0-next.1

3 years ago

7.0.0

3 years ago

7.0.2

2 years ago

7.0.1

3 years ago

8.0.0-next.1

2 years ago

8.0.0-next.0

2 years ago

6.0.1-next.0

3 years ago

7.0.2-next.0

3 years ago

7.0.2-next.1

3 years ago

7.0.2-next.2

2 years ago

7.0.1-next.0

3 years ago

6.0.2-next.0

3 years ago

6.0.1

3 years ago

5.0.0

3 years ago

5.0.0-next.0

3 years ago

6.0.0

3 years ago

6.0.0-next.0

3 years ago

4.0.1

3 years ago

4.0.0

3 years ago

4.0.1-next.1

3 years ago

4.0.1-next.0

3 years ago

3.0.2-next.0

3 years ago

4.0.0-next.1

3 years ago

3.0.1

3 years ago

3.0.0-next.0

3 years ago

2.0.0-next.0

3 years ago

2.0.0

3 years ago

3.0.0

3 years ago

0.7.8-next.0

3 years ago

0.7.8

3 years ago

3.0.1-next.0

3 years ago

0.7.7

4 years ago

0.7.7-next.1

4 years ago

0.7.7-next.0

4 years ago

0.7.6

4 years ago

0.7.6-next.0

4 years ago

0.7.5

4 years ago

0.7.5-next.1

4 years ago

0.7.5-next.0

4 years ago

0.7.4

4 years ago

0.7.4-next.1

4 years ago

0.7.4-next.0

4 years ago

0.7.3

4 years ago

0.7.3-next.1

4 years ago

0.7.3-next.0

4 years ago

0.7.2

4 years ago

0.7.2-next.4

4 years ago

0.7.2-next.3

4 years ago

0.7.2-next.2

4 years ago

0.7.2-next.1

4 years ago

0.7.1-next.0

4 years ago

0.7.1

4 years ago

0.7.2-next.0

4 years ago

0.7.0

4 years ago

0.6.3-next.3

4 years ago

0.6.3

4 years ago

0.6.3-next.1

4 years ago

0.6.3-next.2

4 years ago

0.6.3-next.0

4 years ago

0.6.2

4 years ago

0.6.2-next.2

4 years ago

0.6.2-next.1

4 years ago

0.6.2-next.0

4 years ago

0.6.1

4 years ago

0.6.1-next.0

4 years ago

0.6.0

4 years ago

0.6.0-next.1

4 years ago

0.6.0-next.0

4 years ago

0.5.2

4 years ago

0.5.2-next.0

4 years ago

0.5.1-next.1

4 years ago

0.5.1

4 years ago

0.5.1-next.0

4 years ago

0.5.0

4 years ago

0.5.0-next.2

4 years ago

0.4.2-next.1

4 years ago

0.4.2-next.0

4 years ago

0.4.1

5 years ago

1.0.0

5 years ago

0.4.0

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.4-rc.1

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.2-rc.2

5 years ago

0.2.2-rc.1

5 years ago

0.2.2-rc.0

5 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago