@atlaskit/editor-plugin-engagement-platform 2.0.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/CHANGELOG.md +1 -0
- package/LICENSE.md +11 -0
- package/README.md +32 -0
- package/dist/cjs/engagementPlatformPlugin.js +27 -0
- package/dist/cjs/engagementPlatformPluginType.js +5 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/pm-plugins/main.js +29 -0
- package/dist/es2019/engagementPlatformPlugin.js +20 -0
- package/dist/es2019/engagementPlatformPluginType.js +1 -0
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/pm-plugins/main.js +23 -0
- package/dist/esm/engagementPlatformPlugin.js +21 -0
- package/dist/esm/engagementPlatformPluginType.js +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/pm-plugins/main.js +23 -0
- package/dist/types/engagementPlatformPlugin.d.ts +2 -0
- package/dist/types/engagementPlatformPluginType.d.ts +38 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/pm-plugins/main.d.ts +9 -0
- package/dist/types-ts4.5/engagementPlatformPlugin.d.ts +2 -0
- package/dist/types-ts4.5/engagementPlatformPluginType.d.ts +42 -0
- package/dist/types-ts4.5/index.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +9 -0
- package/package.json +75 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @atlaskit/editor-plugin-engagement-platform
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Copyright 2023 Atlassian Pty Ltd
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
|
|
4
|
+
compliance with the License. You may obtain a copy of the License at
|
|
5
|
+
|
|
6
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
|
|
8
|
+
Unless required by applicable law or agreed to in writing, software distributed under the License is
|
|
9
|
+
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
10
|
+
implied. See the License for the specific language governing permissions and limitations under the
|
|
11
|
+
License.
|
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# EditorPluginEngagementPlatform
|
|
2
|
+
|
|
3
|
+
Engagement platform plugin for @atlaskit/editor-core“
|
|
4
|
+
|
|
5
|
+
**Note:** This component is designed for internal Atlassian development.
|
|
6
|
+
External contributors will be able to use this component but will not be able to submit issues.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
---
|
|
11
|
+
**Internal use only**
|
|
12
|
+
|
|
13
|
+
@atlaskit/editor-plugin-engagement-platform is intended for internal use by the @atlaskit/editor-core and as a plugin dependency of the Editor within your product.
|
|
14
|
+
|
|
15
|
+
Direct use of this component is not supported.
|
|
16
|
+
|
|
17
|
+
Please see [Atlaskit - Editor Engagement Platform Plugin](https://atlaskit.atlassian.com/packages/editor/editor-plugin-engagement-platform) for documentation and examples for this package.
|
|
18
|
+
|
|
19
|
+
## Support
|
|
20
|
+
---
|
|
21
|
+
For internal Atlassian, visit the slack channel [#help-editor](https://atlassian.slack.com/archives/CFG3PSQ9E) for support or visit [go/editor-help](https://go/editor-help) to submit a bug.
|
|
22
|
+
## License
|
|
23
|
+
---
|
|
24
|
+
Please see [Atlassian Frontend - License](https://hello.atlassian.net/wiki/spaces/AF/pages/2589099144/Documentation#Platform-License) for more licensing information.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
`import EditorPluginEngagementPlatform from '@atlaskit/editor-plugin-engagement-platform';`
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
Detailed docs and example usage can be found [here](https://atlaskit.atlassian.com/packages/editor/editor-plugin-engagement-platform).
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.engagementPlatformPlugin = void 0;
|
|
7
|
+
var _main = require("./pm-plugins/main");
|
|
8
|
+
var engagementPlatformPlugin = exports.engagementPlatformPlugin = function engagementPlatformPlugin(_ref) {
|
|
9
|
+
var config = _ref.config;
|
|
10
|
+
return {
|
|
11
|
+
name: 'engagementPlatform',
|
|
12
|
+
pmPlugins: function pmPlugins() {
|
|
13
|
+
return [{
|
|
14
|
+
name: 'engagementPlatform',
|
|
15
|
+
plugin: function plugin() {
|
|
16
|
+
return (0, _main.createPlugin)(config);
|
|
17
|
+
}
|
|
18
|
+
}];
|
|
19
|
+
},
|
|
20
|
+
getSharedState: function getSharedState(editorState) {
|
|
21
|
+
if (!config || !editorState) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
return _main.engagementPlatformPluginKey.getState(editorState);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "engagementPlatformPlugin", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _engagementPlatformPlugin.engagementPlatformPlugin;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _engagementPlatformPlugin = require("./engagementPlatformPlugin");
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.engagementPlatformPluginKey = exports.createPlugin = void 0;
|
|
7
|
+
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
|
+
var engagementPlatformPluginKey = exports.engagementPlatformPluginKey = new _state.PluginKey('engagementPlatformPlugin');
|
|
10
|
+
var createPlugin = exports.createPlugin = function createPlugin(pluginOptions) {
|
|
11
|
+
return new _safePlugin.SafePlugin({
|
|
12
|
+
key: engagementPlatformPluginKey,
|
|
13
|
+
state: {
|
|
14
|
+
init: function init() {
|
|
15
|
+
if (!pluginOptions) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
epComponents: pluginOptions.epComponents,
|
|
20
|
+
epHooks: pluginOptions.epHooks,
|
|
21
|
+
coordinationClient: pluginOptions.coordinationClient
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
apply: function apply(_tr, pluginState) {
|
|
25
|
+
return pluginState;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createPlugin, engagementPlatformPluginKey } from './pm-plugins/main';
|
|
2
|
+
export const engagementPlatformPlugin = ({
|
|
3
|
+
config
|
|
4
|
+
}) => {
|
|
5
|
+
return {
|
|
6
|
+
name: 'engagementPlatform',
|
|
7
|
+
pmPlugins() {
|
|
8
|
+
return [{
|
|
9
|
+
name: 'engagementPlatform',
|
|
10
|
+
plugin: () => createPlugin(config)
|
|
11
|
+
}];
|
|
12
|
+
},
|
|
13
|
+
getSharedState(editorState) {
|
|
14
|
+
if (!config || !editorState) {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
return engagementPlatformPluginKey.getState(editorState);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { engagementPlatformPlugin } from './engagementPlatformPlugin';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export const engagementPlatformPluginKey = new PluginKey('engagementPlatformPlugin');
|
|
4
|
+
export const createPlugin = pluginOptions => {
|
|
5
|
+
return new SafePlugin({
|
|
6
|
+
key: engagementPlatformPluginKey,
|
|
7
|
+
state: {
|
|
8
|
+
init: () => {
|
|
9
|
+
if (!pluginOptions) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
epComponents: pluginOptions.epComponents,
|
|
14
|
+
epHooks: pluginOptions.epHooks,
|
|
15
|
+
coordinationClient: pluginOptions.coordinationClient
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
apply: (_tr, pluginState) => {
|
|
19
|
+
return pluginState;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createPlugin, engagementPlatformPluginKey } from './pm-plugins/main';
|
|
2
|
+
export var engagementPlatformPlugin = function engagementPlatformPlugin(_ref) {
|
|
3
|
+
var config = _ref.config;
|
|
4
|
+
return {
|
|
5
|
+
name: 'engagementPlatform',
|
|
6
|
+
pmPlugins: function pmPlugins() {
|
|
7
|
+
return [{
|
|
8
|
+
name: 'engagementPlatform',
|
|
9
|
+
plugin: function plugin() {
|
|
10
|
+
return createPlugin(config);
|
|
11
|
+
}
|
|
12
|
+
}];
|
|
13
|
+
},
|
|
14
|
+
getSharedState: function getSharedState(editorState) {
|
|
15
|
+
if (!config || !editorState) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
return engagementPlatformPluginKey.getState(editorState);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { engagementPlatformPlugin } from './engagementPlatformPlugin';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export var engagementPlatformPluginKey = new PluginKey('engagementPlatformPlugin');
|
|
4
|
+
export var createPlugin = function createPlugin(pluginOptions) {
|
|
5
|
+
return new SafePlugin({
|
|
6
|
+
key: engagementPlatformPluginKey,
|
|
7
|
+
state: {
|
|
8
|
+
init: function init() {
|
|
9
|
+
if (!pluginOptions) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
epComponents: pluginOptions.epComponents,
|
|
14
|
+
epHooks: pluginOptions.epHooks,
|
|
15
|
+
coordinationClient: pluginOptions.coordinationClient
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
apply: function apply(_tr, pluginState) {
|
|
19
|
+
return pluginState;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
3
|
+
export type EngagementPlatformPlugin = NextEditorPlugin<'engagementPlatform', {
|
|
4
|
+
pluginConfiguration: EngagementPlatformPluginOptions;
|
|
5
|
+
dependencies: [];
|
|
6
|
+
sharedState: EngagementPlatformPluginState;
|
|
7
|
+
}>;
|
|
8
|
+
export interface CoordinationClient {
|
|
9
|
+
start(messageId: string, variationId?: string): Promise<boolean>;
|
|
10
|
+
stop(messageId: string): Promise<boolean>;
|
|
11
|
+
}
|
|
12
|
+
export type EngagementPlatformPluginOptions = {
|
|
13
|
+
epComponents: EpComponents;
|
|
14
|
+
epHooks: EpHooks;
|
|
15
|
+
coordinationClient: CoordinationClient;
|
|
16
|
+
};
|
|
17
|
+
export type EpComponents = {
|
|
18
|
+
EngagementProvider: React.ComponentType<PropsWithChildren<{}>>;
|
|
19
|
+
EngagementSpotlight: React.ComponentType<{
|
|
20
|
+
engagementId: string;
|
|
21
|
+
}>;
|
|
22
|
+
EngagementInlineDialog: React.ComponentType<PropsWithChildren<{
|
|
23
|
+
engagementId: string;
|
|
24
|
+
}>>;
|
|
25
|
+
Coordination: React.ComponentType<PropsWithChildren<{
|
|
26
|
+
client: CoordinationClient;
|
|
27
|
+
messageId: string;
|
|
28
|
+
fallback: ReactNode;
|
|
29
|
+
}>>;
|
|
30
|
+
};
|
|
31
|
+
export type EpHooks = {
|
|
32
|
+
useCoordination: (client: CoordinationClient, messageId: string) => [boolean, (force?: boolean) => Promise<void>];
|
|
33
|
+
};
|
|
34
|
+
export type EngagementPlatformPluginState = {
|
|
35
|
+
epComponents: EpComponents;
|
|
36
|
+
epHooks: EpHooks;
|
|
37
|
+
coordinationClient: CoordinationClient;
|
|
38
|
+
} | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import type { EngagementPlatformPluginOptions, EngagementPlatformPluginState } from '../engagementPlatformPluginType';
|
|
4
|
+
export declare const engagementPlatformPluginKey: PluginKey<EngagementPlatformPluginState>;
|
|
5
|
+
export declare const createPlugin: (pluginOptions: EngagementPlatformPluginOptions) => SafePlugin<{
|
|
6
|
+
epComponents: import("../engagementPlatformPluginType").EpComponents;
|
|
7
|
+
epHooks: import("../engagementPlatformPluginType").EpHooks;
|
|
8
|
+
coordinationClient: import("../engagementPlatformPluginType").CoordinationClient;
|
|
9
|
+
} | undefined>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
3
|
+
export type EngagementPlatformPlugin = NextEditorPlugin<'engagementPlatform', {
|
|
4
|
+
pluginConfiguration: EngagementPlatformPluginOptions;
|
|
5
|
+
dependencies: [
|
|
6
|
+
];
|
|
7
|
+
sharedState: EngagementPlatformPluginState;
|
|
8
|
+
}>;
|
|
9
|
+
export interface CoordinationClient {
|
|
10
|
+
start(messageId: string, variationId?: string): Promise<boolean>;
|
|
11
|
+
stop(messageId: string): Promise<boolean>;
|
|
12
|
+
}
|
|
13
|
+
export type EngagementPlatformPluginOptions = {
|
|
14
|
+
epComponents: EpComponents;
|
|
15
|
+
epHooks: EpHooks;
|
|
16
|
+
coordinationClient: CoordinationClient;
|
|
17
|
+
};
|
|
18
|
+
export type EpComponents = {
|
|
19
|
+
EngagementProvider: React.ComponentType<PropsWithChildren<{}>>;
|
|
20
|
+
EngagementSpotlight: React.ComponentType<{
|
|
21
|
+
engagementId: string;
|
|
22
|
+
}>;
|
|
23
|
+
EngagementInlineDialog: React.ComponentType<PropsWithChildren<{
|
|
24
|
+
engagementId: string;
|
|
25
|
+
}>>;
|
|
26
|
+
Coordination: React.ComponentType<PropsWithChildren<{
|
|
27
|
+
client: CoordinationClient;
|
|
28
|
+
messageId: string;
|
|
29
|
+
fallback: ReactNode;
|
|
30
|
+
}>>;
|
|
31
|
+
};
|
|
32
|
+
export type EpHooks = {
|
|
33
|
+
useCoordination: (client: CoordinationClient, messageId: string) => [
|
|
34
|
+
boolean,
|
|
35
|
+
(force?: boolean) => Promise<void>
|
|
36
|
+
];
|
|
37
|
+
};
|
|
38
|
+
export type EngagementPlatformPluginState = {
|
|
39
|
+
epComponents: EpComponents;
|
|
40
|
+
epHooks: EpHooks;
|
|
41
|
+
coordinationClient: CoordinationClient;
|
|
42
|
+
} | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import type { EngagementPlatformPluginOptions, EngagementPlatformPluginState } from '../engagementPlatformPluginType';
|
|
4
|
+
export declare const engagementPlatformPluginKey: PluginKey<EngagementPlatformPluginState>;
|
|
5
|
+
export declare const createPlugin: (pluginOptions: EngagementPlatformPluginOptions) => SafePlugin<{
|
|
6
|
+
epComponents: import("../engagementPlatformPluginType").EpComponents;
|
|
7
|
+
epHooks: import("../engagementPlatformPluginType").EpHooks;
|
|
8
|
+
coordinationClient: import("../engagementPlatformPluginType").CoordinationClient;
|
|
9
|
+
} | undefined>;
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-plugin-engagement-platform",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Engagement platform plugin for @atlaskit/editor-core“",
|
|
5
|
+
"author": "Atlassian Pty Ltd",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"registry": "https://registry.npmjs.org/"
|
|
9
|
+
},
|
|
10
|
+
"atlassian": {
|
|
11
|
+
"team": "Editor: Core Experiences",
|
|
12
|
+
"inPublicMirror": false,
|
|
13
|
+
"singleton": true,
|
|
14
|
+
"releaseModel": "continuous",
|
|
15
|
+
"runReact18": false
|
|
16
|
+
},
|
|
17
|
+
"repository": "https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo",
|
|
18
|
+
"main": "dist/cjs/index.js",
|
|
19
|
+
"module": "dist/esm/index.js",
|
|
20
|
+
"module:es2019": "dist/es2019/index.js",
|
|
21
|
+
"types": "dist/types/index.d.ts",
|
|
22
|
+
"typesVersions": {
|
|
23
|
+
">=4.5 <5.4": {
|
|
24
|
+
"*": [
|
|
25
|
+
"dist/types-ts4.5/*",
|
|
26
|
+
"dist/types-ts4.5/index.d.ts"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"sideEffects": false,
|
|
31
|
+
"atlaskit:src": "src/index.ts",
|
|
32
|
+
"af:exports": {
|
|
33
|
+
".": "./src/index.ts"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@atlaskit/editor-common": "^93.1.0",
|
|
37
|
+
"@atlaskit/editor-prosemirror": "6.0.0",
|
|
38
|
+
"@babel/runtime": "^7.0.0"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"react": "^16.8.0"
|
|
42
|
+
},
|
|
43
|
+
"techstack": {
|
|
44
|
+
"@atlassian/frontend": {
|
|
45
|
+
"import-structure": [
|
|
46
|
+
"atlassian-conventions"
|
|
47
|
+
],
|
|
48
|
+
"circular-dependencies": [
|
|
49
|
+
"file-and-folder-level"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"@repo/internal": {
|
|
53
|
+
"dom-events": "use-bind-event-listener",
|
|
54
|
+
"analytics": [
|
|
55
|
+
"analytics-next"
|
|
56
|
+
],
|
|
57
|
+
"design-tokens": [
|
|
58
|
+
"color"
|
|
59
|
+
],
|
|
60
|
+
"theming": [
|
|
61
|
+
"react-context"
|
|
62
|
+
],
|
|
63
|
+
"ui-components": [
|
|
64
|
+
"lite-mode"
|
|
65
|
+
],
|
|
66
|
+
"deprecation": [
|
|
67
|
+
"no-deprecated-imports"
|
|
68
|
+
],
|
|
69
|
+
"styling": [
|
|
70
|
+
"emotion",
|
|
71
|
+
"emotion"
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|