@atlaskit/editor-plugin-mentions 15.1.0 → 15.2.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.
@@ -1,91 +0,0 @@
1
- /* InlineInviteRecaptchaContainer.tsx generated by @compiled/babel-plugin v2.0.0 */
2
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- import { ax, ix } from "@compiled/react/runtime";
4
- import React, { useCallback, useEffect, useState } from 'react';
5
- import { mentionPlaceholderPluginKey, MENTION_PLACEHOLDER_ACTIONS } from '../pm-plugins/mentionPlaceholder';
6
- import { MENTION_SOURCE } from '../ui/type-ahead/analytics';
7
- /**
8
- * Container that renders the recaptcha component from the mention provider and manages handleSuccess.
9
- * Does NOT pass email - the provider's component uses useInlineInviteRecaptcha hook internally
10
- * and wires showRecaptcha to the provider. When user clicks invite item, type-ahead calls
11
- * mentionProvider.showInlineInviteRecaptcha(email) which passes email to the component.
12
- */
13
- export var InlineInviteRecaptchaContainer = function InlineInviteRecaptchaContainer(_ref) {
14
- var _api$mention2, _api$core3;
15
- var mentionProvider = _ref.mentionProvider,
16
- api = _ref.api;
17
- var _useState = useState(null),
18
- _useState2 = _slicedToArray(_useState, 2),
19
- provider = _useState2[0],
20
- setProvider = _useState2[1];
21
- useEffect(function () {
22
- if (!mentionProvider) {
23
- return;
24
- }
25
- var isMounted = true;
26
- mentionProvider.then(function (resolvedProvider) {
27
- if (!isMounted) {
28
- return;
29
- }
30
- setProvider(resolvedProvider);
31
- }).catch(function () {
32
- // Silently handle promise rejection
33
- });
34
- return function () {
35
- isMounted = false;
36
- setProvider(null);
37
- };
38
- }, [mentionProvider]);
39
- var handleSuccess = useCallback(function (userId, email) {
40
- var _api$mention, _api$core;
41
- if (!(api !== null && api !== void 0 && (_api$mention = api.mention) !== null && _api$mention !== void 0 && (_api$mention = _api$mention.commands) !== null && _api$mention !== void 0 && _api$mention.insertMention) || !(api !== null && api !== void 0 && (_api$core = api.core) !== null && _api$core !== void 0 && (_api$core = _api$core.actions) !== null && _api$core !== void 0 && _api$core.execute)) {
42
- return;
43
- }
44
- var name = email.split('@')[0] || email;
45
- api.core.actions.execute(api.mention.commands.insertMention({
46
- id: userId,
47
- name: name,
48
- userType: 'DEFAULT',
49
- accessLevel: 'CONTAINER'
50
- }));
51
- api.core.actions.execute(function (_ref2) {
52
- var tr = _ref2.tr;
53
- tr.setMeta(mentionPlaceholderPluginKey, {
54
- action: MENTION_PLACEHOLDER_ACTIONS.HIDE_PLACEHOLDER
55
- });
56
- return tr;
57
- });
58
- }, [api]);
59
- var handleClose = useCallback(function () {
60
- var _api$core2;
61
- if (!(api !== null && api !== void 0 && (_api$core2 = api.core) !== null && _api$core2 !== void 0 && (_api$core2 = _api$core2.actions) !== null && _api$core2 !== void 0 && _api$core2.execute)) {
62
- return;
63
- }
64
- api.core.actions.execute(function (_ref3) {
65
- var tr = _ref3.tr;
66
- tr.setMeta(mentionPlaceholderPluginKey, {
67
- action: MENTION_PLACEHOLDER_ACTIONS.HIDE_PLACEHOLDER
68
- });
69
- return tr;
70
- });
71
- }, [api]);
72
- var handleReady = useCallback(function (showRecaptcha) {
73
- if (provider) {
74
- if (showRecaptcha) {
75
- provider.showInlineInviteRecaptcha = showRecaptcha;
76
- } else {
77
- delete provider.showInlineInviteRecaptcha;
78
- }
79
- }
80
- }, [provider]);
81
- if (!(provider !== null && provider !== void 0 && provider.InlineInviteRecaptcha) || !(api !== null && api !== void 0 && (_api$mention2 = api.mention) !== null && _api$mention2 !== void 0 && (_api$mention2 = _api$mention2.commands) !== null && _api$mention2 !== void 0 && _api$mention2.insertMention) || !(api !== null && api !== void 0 && (_api$core3 = api.core) !== null && _api$core3 !== void 0 && (_api$core3 = _api$core3.actions) !== null && _api$core3 !== void 0 && _api$core3.execute)) {
82
- return null;
83
- }
84
- var RecaptchaComponent = provider.InlineInviteRecaptcha;
85
- return /*#__PURE__*/React.createElement(RecaptchaComponent, {
86
- analyticsSource: MENTION_SOURCE,
87
- onSuccess: handleSuccess,
88
- onClose: handleClose,
89
- onReady: handleReady
90
- });
91
- };
@@ -1,11 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- export declare const mentionPlaceholderPluginKey: PluginKey;
4
- export declare const MENTION_PLACEHOLDER_ACTIONS: {
5
- SHOW_PLACEHOLDER: string;
6
- HIDE_PLACEHOLDER: string;
7
- };
8
- export type MentionPlaceholderPluginState = {
9
- placeholder?: string;
10
- };
11
- export declare function createMentionPlaceholderPlugin(): SafePlugin<{}>;
@@ -1,15 +0,0 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { MentionProvider } from '@atlaskit/mention/resource';
3
- import type { MentionsPlugin } from '../mentionsPluginType';
4
- interface Props {
5
- api: ExtractInjectionAPI<MentionsPlugin> | undefined;
6
- mentionProvider: Promise<MentionProvider> | undefined;
7
- }
8
- /**
9
- * Container that renders the recaptcha component from the mention provider and manages handleSuccess.
10
- * Does NOT pass email - the provider's component uses useInlineInviteRecaptcha hook internally
11
- * and wires showRecaptcha to the provider. When user clicks invite item, type-ahead calls
12
- * mentionProvider.showInlineInviteRecaptcha(email) which passes email to the component.
13
- */
14
- export declare const InlineInviteRecaptchaContainer: ({ mentionProvider, api, }: Props) => JSX.Element | null;
15
- export {};