@atlassian/clientside-extensions-components 5.1.6-eadeedb5-mltiipai → 6.0.0-m001
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/dist/cjs/ExtensionPointInfo.js +1 -4
- package/dist/cjs/ExtensionPointInfo.js.map +1 -1
- package/dist/cjs/ExtensionsObservable.js +0 -1
- package/dist/cjs/ExtensionsObservable.js.map +1 -1
- package/dist/cjs/handlers/AsyncPanelHandler.js +1 -1
- package/dist/cjs/handlers/AsyncPanelHandler.js.map +1 -1
- package/dist/cjs/handlers/ModalHandler.js +1 -3
- package/dist/cjs/handlers/ModalHandler.js.map +1 -1
- package/dist/cjs/handlers/PanelHandler.js.map +1 -1
- package/dist/cjs/handlers/SectionHandler.js +2 -2
- package/dist/cjs/handlers/SectionHandler.js.map +1 -1
- package/dist/cjs/handlers/index.js.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/renderElementAsReact.js +8 -5
- package/dist/cjs/renderElementAsReact.js.map +1 -1
- package/dist/cjs/useExtensions.js +2 -2
- package/dist/cjs/useExtensions.js.map +1 -1
- package/dist/esm/ExtensionPointInfo.js +1 -4
- package/dist/esm/ExtensionPointInfo.js.map +1 -1
- package/dist/esm/ExtensionsObservable.js +0 -1
- package/dist/esm/ExtensionsObservable.js.map +1 -1
- package/dist/esm/handlers/AsyncPanelHandler.js +1 -1
- package/dist/esm/handlers/AsyncPanelHandler.js.map +1 -1
- package/dist/esm/handlers/ModalHandler.js +1 -3
- package/dist/esm/handlers/ModalHandler.js.map +1 -1
- package/dist/esm/handlers/PanelHandler.js.map +1 -1
- package/dist/esm/handlers/SectionHandler.js +1 -1
- package/dist/esm/handlers/SectionHandler.js.map +1 -1
- package/dist/esm/handlers/index.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/renderElementAsReact.js +8 -5
- package/dist/esm/renderElementAsReact.js.map +1 -1
- package/dist/esm/useExtensions.js +1 -1
- package/dist/esm/useExtensions.js.map +1 -1
- package/dist/types/ExtensionsObservable.d.ts.map +1 -1
- package/dist/types/handlers/AsyncPanelHandler.d.ts +2 -1
- package/dist/types/handlers/AsyncPanelHandler.d.ts.map +1 -1
- package/dist/types/handlers/PanelHandler.d.ts.map +1 -1
- package/dist/types/handlers/SectionHandler.d.ts +2 -3
- package/dist/types/handlers/SectionHandler.d.ts.map +1 -1
- package/dist/types/handlers/index.d.ts +10 -5
- package/dist/types/handlers/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/renderElementAsReact.d.ts +1 -2
- package/dist/types/renderElementAsReact.d.ts.map +1 -1
- package/dist/types/styled.d.ts.map +1 -1
- package/dist/types/useExtensions.d.ts.map +1 -1
- package/dist/types/useWebPanelRenderer.d.ts.map +1 -1
- package/lib/ExtensionPointInfo.test.tsx +3 -6
- package/lib/ExtensionsObservable.ts +0 -2
- package/lib/__snapshots__/ExtensionPointInfo.test.tsx.snap +14 -14
- package/lib/handlers/AsyncPanelHandler.test.tsx +27 -12
- package/lib/handlers/AsyncPanelHandler.tsx +2 -2
- package/lib/handlers/ModalHandler.test.tsx +1 -6
- package/lib/handlers/ModalHandler.tsx +1 -1
- package/lib/handlers/PanelHandler.tsx +3 -3
- package/lib/handlers/SectionHandler.tsx +3 -5
- package/lib/handlers/index.ts +10 -5
- package/lib/index.ts +2 -1
- package/lib/renderElementAsReact.test.tsx +11 -5
- package/lib/renderElementAsReact.tsx +9 -7
- package/lib/useExtensions.ts +1 -1
- package/package.json +23 -23
|
@@ -12,10 +12,7 @@ const LinkToElement = ({ to }) => {
|
|
|
12
12
|
// TODO: is there a way to get the clean type from the schema?
|
|
13
13
|
// We are removing the e.g. "!" required syntax that is a suffix of the schema type
|
|
14
14
|
const cleanTo = to.replace(/[^a-zA-Z0-9]/g, '');
|
|
15
|
-
return (
|
|
16
|
-
// eslint-disable-next-line jsx-a11y/anchor-is-valid, @typescript-eslint/ban-ts-comment
|
|
17
|
-
// @ts-ignore: react-scroll types are not up to date with the latest react version
|
|
18
|
-
react_1.default.createElement(react_scroll_1.Link, { to: cleanTo, href: "", containerId: "___cse_info_container", offset: -20, smooth: true }, to));
|
|
15
|
+
return (react_1.default.createElement(react_scroll_1.Link, { to: cleanTo, href: "", containerId: "___cse_info_container", offset: -20, smooth: true }, to));
|
|
19
16
|
};
|
|
20
17
|
const TypeRenderer = ({ objectType }) => (react_1.default.createElement(react_1.default.Fragment, null,
|
|
21
18
|
react_1.default.createElement("p", null, objectType.description),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtensionPointInfo.js","sourceRoot":"","sources":["../../lib/ExtensionPointInfo.tsx"],"names":[],"mappings":";;;AAAA,uEAA0C;AAC1C,wEAAwC;AACxC,+EAAsG;AAEtG,uDAA8C;AAC9C,+CAA6C;AAW7C,gFAAgD;AAChD,qCAA+H;AAO/H,MAAM,aAAa,GAAG,CAAC,EAAE,EAAE,EAAkB,EAAE,EAAE;IAC7C,8DAA8D;IAC9D,mFAAmF;IACnF,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAEhD,OAAO;IACH,uFAAuF;IACvF,kFAAkF;IAClF,8BAAC,mBAAI,IAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAC,EAAE,EAAC,WAAW,EAAC,uBAAuB,EAAC,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,UAC7E,EAAE,CACA,CACV,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,YAAY,GAA4D,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAC9F;IACI,yCAAI,UAAU,CAAC,WAAW,CAAK;IAC/B,8BAAC,cAAK;QACF;YACI,8BAAC,gBAAO;gBACJ,8BAAC,iBAAQ,eAAgB;gBACzB,8BAAC,iBAAQ,eAAgB;gBACzB,8BAAC,iBAAQ,mBAAoB;gBAC7B,8BAAC,iB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AAC,CAAC;AAEF,MAAM,kBAAkB,GAAsC,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE,EAAE;IACxF,MAAM,CAAC,sBAAsB,CAAC,GAAG,IAAA,sBAAY,GAAE,CAAC;IAChD,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAErD,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAChD,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACpC,8BAAC,yBAAgB;QACb,8BAAC,gBAAO,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,GAAI;QAC9D,8BAAC,8BAAe,QACX,UAAU,IAAI,CACX,8BAAC,sBAAK,IAAC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAC,SAAS;YACxC,8BAAC,0BAAW,IAAC,cAAc;gBACvB,8BAAC,yBAAU,QAAE,oBAAoB,IAAI,EAAE,CAAc,CAC3C;YAEd,8BAAC,eAAe;gBACZ,8BAAC,eAAe,IAAC,eAAe,EAAE,eAAe,GAAI,CACvC;YAElB,8BAAC,0BAAW;gBAER,8BAAC,aAAM,IAAC,UAAU,EAAC,SAAS,EAAC,SAAS,QAAC,OAAO,EAAE,WAAW,YAElD,CACC,CACV,CACX,CACa,CACH,CACtB,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,IAAA,YAAI,EAAC,kBAAkB,CAAC,CAAC","sourcesContent":["import Button from '@atlaskit/button/new';\nimport Heading from '@atlaskit/heading';\nimport Modal, { ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';\nimport type { FunctionComponent } from 'react';\nimport React, { memo, useState } from 'react';\nimport { Element, Link } from 'react-scroll';\n\nimport type {\n SerializedDocument,\n SerializedEnumType,\n SerializedObjectType,\n SerializedScalar,\n SerializedUnionType,\n // We only import types here\n // eslint-disable-next-line node/no-unpublished-import\n} from '@atlassian/clientside-extensions-schema';\nimport useDiscovery from './debug/useDiscovery';\nimport { Blinker, BlinkerContainer, GRID_SIZE, HeadCell, HeadingWrapper, HeadRow, Table, TableCell, TableRow } from './styled';\n\nexport type ExtensionPointInfoProps = {\n name: string;\n schemaDocuments: { schema: SerializedDocument; contextSchema: SerializedDocument };\n};\n\nconst LinkToElement = ({ to }: { to: string }) => {\n // TODO: is there a way to get the clean type from the schema?\n // We are removing the e.g. \"!\" required syntax that is a suffix of the schema type\n const cleanTo = to.replace(/[^a-zA-Z0-9]/g, '');\n\n return (\n // eslint-disable-next-line jsx-a11y/anchor-is-valid, @typescript-eslint/ban-ts-comment\n // @ts-ignore: react-scroll types are not up to date with the latest react version\n <Link to={cleanTo} href=\"\" containerId=\"___cse_info_container\" offset={-20} smooth>\n {to}\n </Link>\n );\n};\n\nconst TypeRenderer: FunctionComponent<{ objectType: SerializedObjectType }> = ({ objectType }) => (\n <>\n <p>{objectType.description}</p>\n <Table>\n <thead>\n <HeadRow>\n <HeadCell>Name</HeadCell>\n <HeadCell>Type</HeadCell>\n <HeadCell>Required</HeadCell>\n <HeadCell>Description</HeadCell>\n </HeadRow>\n </thead>\n <tbody>\n {objectType.descriptors.map((descriptor) => (\n <TableRow key={descriptor.name}>\n <TableCell width=\"15%\"> {descriptor.name}</TableCell>\n <TableCell width=\"15%\">\n <LinkToElement to={descriptor.type} />\n </TableCell>\n <TableCell width=\"10%\">{descriptor.required ? 'true' : 'false'}</TableCell>\n <TableCell>{descriptor.description}</TableCell>\n </TableRow>\n ))}\n </tbody>\n </Table>\n </>\n);\n\nconst EnumTypeRenderer = ({ enumType }: { enumType: SerializedEnumType }) => (\n <>\n <HeadingWrapper>\n <Heading size=\"small\" as=\"h3\">\n {/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}\n {/* @ts-ignore: react-scroll types are not up to date with the latest react version*/}\n <Element id={enumType.name}>{enumType.name}</Element>\n </Heading>\n </HeadingWrapper>\n {enumType.description ? (\n <p>{enumType.description}</p>\n ) : (\n <p>\n Enum type with the following values: <b>{enumType.values.join(', ')}</b>\n </p>\n )}\n </>\n);\n\nconst UnionTypeRenderer = ({ unionType }: { unionType: SerializedUnionType }) => (\n <>\n <HeadingWrapper>\n <Heading size=\"small\" as=\"h3\">\n {/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}\n {/* @ts-ignore: react-scroll types are not up to date with the latest react version*/}\n <Element id={unionType.name}>{unionType.name}</Element>\n </Heading>\n </HeadingWrapper>\n {unionType.description ? (\n <p>{unionType.description}</p>\n ) : (\n <p>\n Union of the following types:{' '}\n {unionType.types.map((_type, i) => (\n <React.Fragment key={`${_type}-link`}>\n {i === 0 ? '' : ', '}\n <LinkToElement to={_type} />\n </React.Fragment>\n ))}\n </p>\n )}\n </>\n);\n\nconst ScalarRenderer = ({ scalar }: { scalar: SerializedScalar }) => (\n <>\n <HeadingWrapper>\n <Heading size=\"small\" as=\"h3\">\n {/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}\n {/* @ts-ignore: react-scroll types are not up to date with the latest react version*/}\n <Element id={scalar.name}>{scalar.name}</Element>\n </Heading>\n </HeadingWrapper>\n <p>{scalar.description}</p>\n </>\n);\n\nconst SchemasRenderer = ({ schemaDocuments: { schema, contextSchema } }: Omit<ExtensionPointInfoProps, 'name'>) => {\n const {\n objectTypes: { Schema: attributesDocument, ...attributeObjectTypes } = { Schema: null },\n scalars: attributeScalars,\n enumTypes: attributesEnumTypes,\n unionTypes: attributesUnionTypes,\n } = schema || {};\n\n const {\n objectTypes: { ContextSchema: contextDocument, ...contextObjectTypes } = { ContextSchema: null },\n scalars: contextScalars,\n enumTypes: contextEnumTypes,\n unionTypes: contextUnionTypes,\n } = contextSchema || {};\n\n const objectTypeEntries: SerializedObjectType[] = Object.values({ ...attributeObjectTypes, ...contextObjectTypes });\n const scalars: SerializedScalar[] = Object.values({ ...attributeScalars, ...contextScalars });\n const enumTypes: SerializedEnumType[] = Object.values({ ...attributesEnumTypes, ...contextEnumTypes });\n const unionTypes: SerializedUnionType[] = Object.values({ ...attributesUnionTypes, ...contextUnionTypes });\n\n return (\n <>\n <Heading size=\"medium\" as=\"h2\">\n Attributes\n </Heading>\n {attributesDocument ? (\n <>\n <p>List of attributes supported by this extension point.</p>\n <TypeRenderer objectType={attributesDocument} />\n </>\n ) : (\n <p>No attributes information provided for this extension point.</p>\n )}\n\n <HeadingWrapper>\n <Heading size=\"medium\" as=\"h2\">\n Context\n </Heading>\n </HeadingWrapper>\n {contextDocument ? (\n <>\n <p>List of values provided by this extension point as context.</p>\n <TypeRenderer objectType={contextDocument} />\n </>\n ) : (\n <p>No context information provided for this extension point.</p>\n )}\n\n <HeadingWrapper>\n <Heading size=\"medium\" as=\"h2\">\n Types reference\n </Heading>\n </HeadingWrapper>\n {objectTypeEntries &&\n objectTypeEntries.map((objectType) => (\n <React.Fragment key={objectType.name}>\n <HeadingWrapper>\n <Heading size=\"small\" as=\"h3\">\n {/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}\n {/* @ts-ignore: react-scroll types are not up to date with the latest react version*/}\n <Element id={objectType.name}>{objectType.name}</Element>\n </Heading>\n </HeadingWrapper>\n <TypeRenderer objectType={objectType} />\n </React.Fragment>\n ))}\n\n {enumTypes && enumTypes.map((enumType) => <EnumTypeRenderer key={enumType.name} enumType={enumType} />)}\n\n {unionTypes && unionTypes.map((unionType) => <UnionTypeRenderer key={unionType.name} unionType={unionType} />)}\n\n {scalars && scalars.map((scalar) => <ScalarRenderer key={scalar.name} scalar={scalar} />)}\n </>\n );\n};\n\nconst bodyStyles: React.CSSProperties = {\n // Styles required for the react-scroll to work when scrolling is animated\n overflowY: 'auto',\n overflowX: 'hidden',\n // The rest of the styles are copied from the @atlaskit/modal-dialog/dist/esm/modal-body.js\n padding: GRID_SIZE * 3,\n flex: '1 1 auto',\n};\n\nconst CustomModalBody: React.FC<{ children: React.ReactNode }> = ({ children }) => {\n return (\n <div id=\"___cse_info_container\" style={bodyStyles}>\n {children}\n </div>\n );\n};\n\nconst ExtensionPointInfo: React.FC<ExtensionPointInfoProps> = ({ name, schemaDocuments }) => {\n const [showExtensionPointInfo] = useDiscovery();\n const [dialogOpen, setDialogState] = useState(false);\n\n const closeDialog = () => setDialogState(false);\n return !showExtensionPointInfo ? null : (\n <BlinkerContainer>\n <Blinker type=\"button\" onClick={() => setDialogState(true)} />\n <ModalTransition>\n {dialogOpen && (\n <Modal onClose={closeDialog} width=\"x-large\">\n <ModalHeader hasCloseButton>\n <ModalTitle>{`Extension point: ${name}`}</ModalTitle>\n </ModalHeader>\n\n <CustomModalBody>\n <SchemasRenderer schemaDocuments={schemaDocuments} />\n </CustomModalBody>\n\n <ModalFooter>\n {/* eslint-disable-next-line jsx-a11y/no-autofocus */}\n <Button appearance=\"primary\" autoFocus onClick={closeDialog}>\n Close\n </Button>\n </ModalFooter>\n </Modal>\n )}\n </ModalTransition>\n </BlinkerContainer>\n );\n};\n\nexport default memo(ExtensionPointInfo);\n"]}
|
|
1
|
+
{"version":3,"file":"ExtensionPointInfo.js","sourceRoot":"","sources":["../../lib/ExtensionPointInfo.tsx"],"names":[],"mappings":";;;AAAA,uEAA0C;AAC1C,wEAAwC;AACxC,+EAAsG;AAEtG,uDAA8C;AAC9C,+CAA6C;AAW7C,gFAAgD;AAChD,qCAA+H;AAO/H,MAAM,aAAa,GAAG,CAAC,EAAE,EAAE,EAAkB,EAAE,EAAE;IAC7C,8DAA8D;IAC9D,mFAAmF;IACnF,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAEhD,OAAO,CAGH,8BAAC,mBAAI,IAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAC,EAAE,EAAC,WAAW,EAAC,uBAAuB,EAAC,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,UAC7E,EAAE,CACA,CACV,CAAC;AACN,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e,IAAA,YAAI,EAAC,kBAAkB,CAAC,CAAC","sourcesContent":["import Button from '@atlaskit/button/new';\nimport Heading from '@atlaskit/heading';\nimport Modal, { ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';\nimport type { FunctionComponent } from 'react';\nimport React, { memo, useState } from 'react';\nimport { Element, Link } from 'react-scroll';\n\nimport type {\n SerializedDocument,\n SerializedEnumType,\n SerializedObjectType,\n SerializedScalar,\n SerializedUnionType,\n // We only import types here\n // eslint-disable-next-line node/no-unpublished-import\n} from '@atlassian/clientside-extensions-schema';\nimport useDiscovery from './debug/useDiscovery';\nimport { Blinker, BlinkerContainer, GRID_SIZE, HeadCell, HeadingWrapper, HeadRow, Table, TableCell, TableRow } from './styled';\n\nexport type ExtensionPointInfoProps = {\n name: string;\n schemaDocuments: { schema: SerializedDocument; contextSchema: SerializedDocument };\n};\n\nconst LinkToElement = ({ to }: { to: string }) => {\n // TODO: is there a way to get the clean type from the schema?\n // We are removing the e.g. \"!\" required syntax that is a suffix of the schema type\n const cleanTo = to.replace(/[^a-zA-Z0-9]/g, '');\n\n return (\n // eslint-disable-next-line jsx-a11y/anchor-is-valid, @typescript-eslint/ban-ts-comment\n // @ts-ignore: react-scroll types are not up to date with the latest react version\n <Link to={cleanTo} href=\"\" containerId=\"___cse_info_container\" offset={-20} smooth>\n {to}\n </Link>\n );\n};\n\nconst TypeRenderer: FunctionComponent<{ objectType: SerializedObjectType }> = ({ objectType }) => (\n <>\n <p>{objectType.description}</p>\n <Table>\n <thead>\n <HeadRow>\n <HeadCell>Name</HeadCell>\n <HeadCell>Type</HeadCell>\n <HeadCell>Required</HeadCell>\n <HeadCell>Description</HeadCell>\n </HeadRow>\n </thead>\n <tbody>\n {objectType.descriptors.map((descriptor) => (\n <TableRow key={descriptor.name}>\n <TableCell width=\"15%\"> {descriptor.name}</TableCell>\n <TableCell width=\"15%\">\n <LinkToElement to={descriptor.type} />\n </TableCell>\n <TableCell width=\"10%\">{descriptor.required ? 'true' : 'false'}</TableCell>\n <TableCell>{descriptor.description}</TableCell>\n </TableRow>\n ))}\n </tbody>\n </Table>\n </>\n);\n\nconst EnumTypeRenderer = ({ enumType }: { enumType: SerializedEnumType }) => (\n <>\n <HeadingWrapper>\n <Heading size=\"small\" as=\"h3\">\n {/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}\n {/* @ts-ignore: react-scroll types are not up to date with the latest react version*/}\n <Element id={enumType.name}>{enumType.name}</Element>\n </Heading>\n </HeadingWrapper>\n {enumType.description ? (\n <p>{enumType.description}</p>\n ) : (\n <p>\n Enum type with the following values: <b>{enumType.values.join(', ')}</b>\n </p>\n )}\n </>\n);\n\nconst UnionTypeRenderer = ({ unionType }: { unionType: SerializedUnionType }) => (\n <>\n <HeadingWrapper>\n <Heading size=\"small\" as=\"h3\">\n {/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}\n {/* @ts-ignore: react-scroll types are not up to date with the latest react version*/}\n <Element id={unionType.name}>{unionType.name}</Element>\n </Heading>\n </HeadingWrapper>\n {unionType.description ? (\n <p>{unionType.description}</p>\n ) : (\n <p>\n Union of the following types:{' '}\n {unionType.types.map((_type, i) => (\n <React.Fragment key={`${_type}-link`}>\n {i === 0 ? '' : ', '}\n <LinkToElement to={_type} />\n </React.Fragment>\n ))}\n </p>\n )}\n </>\n);\n\nconst ScalarRenderer = ({ scalar }: { scalar: SerializedScalar }) => (\n <>\n <HeadingWrapper>\n <Heading size=\"small\" as=\"h3\">\n {/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}\n {/* @ts-ignore: react-scroll types are not up to date with the latest react version*/}\n <Element id={scalar.name}>{scalar.name}</Element>\n </Heading>\n </HeadingWrapper>\n <p>{scalar.description}</p>\n </>\n);\n\nconst SchemasRenderer = ({ schemaDocuments: { schema, contextSchema } }: Omit<ExtensionPointInfoProps, 'name'>) => {\n const {\n objectTypes: { Schema: attributesDocument, ...attributeObjectTypes } = { Schema: null },\n scalars: attributeScalars,\n enumTypes: attributesEnumTypes,\n unionTypes: attributesUnionTypes,\n } = schema || {};\n\n const {\n objectTypes: { ContextSchema: contextDocument, ...contextObjectTypes } = { ContextSchema: null },\n scalars: contextScalars,\n enumTypes: contextEnumTypes,\n unionTypes: contextUnionTypes,\n } = contextSchema || {};\n\n const objectTypeEntries: SerializedObjectType[] = Object.values({ ...attributeObjectTypes, ...contextObjectTypes });\n const scalars: SerializedScalar[] = Object.values({ ...attributeScalars, ...contextScalars });\n const enumTypes: SerializedEnumType[] = Object.values({ ...attributesEnumTypes, ...contextEnumTypes });\n const unionTypes: SerializedUnionType[] = Object.values({ ...attributesUnionTypes, ...contextUnionTypes });\n\n return (\n <>\n <Heading size=\"medium\" as=\"h2\">\n Attributes\n </Heading>\n {attributesDocument ? (\n <>\n <p>List of attributes supported by this extension point.</p>\n <TypeRenderer objectType={attributesDocument} />\n </>\n ) : (\n <p>No attributes information provided for this extension point.</p>\n )}\n\n <HeadingWrapper>\n <Heading size=\"medium\" as=\"h2\">\n Context\n </Heading>\n </HeadingWrapper>\n {contextDocument ? (\n <>\n <p>List of values provided by this extension point as context.</p>\n <TypeRenderer objectType={contextDocument} />\n </>\n ) : (\n <p>No context information provided for this extension point.</p>\n )}\n\n <HeadingWrapper>\n <Heading size=\"medium\" as=\"h2\">\n Types reference\n </Heading>\n </HeadingWrapper>\n {objectTypeEntries &&\n objectTypeEntries.map((objectType) => (\n <React.Fragment key={objectType.name}>\n <HeadingWrapper>\n <Heading size=\"small\" as=\"h3\">\n {/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}\n {/* @ts-ignore: react-scroll types are not up to date with the latest react version*/}\n <Element id={objectType.name}>{objectType.name}</Element>\n </Heading>\n </HeadingWrapper>\n <TypeRenderer objectType={objectType} />\n </React.Fragment>\n ))}\n\n {enumTypes && enumTypes.map((enumType) => <EnumTypeRenderer key={enumType.name} enumType={enumType} />)}\n\n {unionTypes && unionTypes.map((unionType) => <UnionTypeRenderer key={unionType.name} unionType={unionType} />)}\n\n {scalars && scalars.map((scalar) => <ScalarRenderer key={scalar.name} scalar={scalar} />)}\n </>\n );\n};\n\nconst bodyStyles: React.CSSProperties = {\n // Styles required for the react-scroll to work when scrolling is animated\n overflowY: 'auto',\n overflowX: 'hidden',\n // The rest of the styles are copied from the @atlaskit/modal-dialog/dist/esm/modal-body.js\n padding: GRID_SIZE * 3,\n flex: '1 1 auto',\n};\n\nconst CustomModalBody: React.FC<{ children: React.ReactNode }> = ({ children }) => {\n return (\n <div id=\"___cse_info_container\" style={bodyStyles}>\n {children}\n </div>\n );\n};\n\nconst ExtensionPointInfo: React.FC<ExtensionPointInfoProps> = ({ name, schemaDocuments }) => {\n const [showExtensionPointInfo] = useDiscovery();\n const [dialogOpen, setDialogState] = useState(false);\n\n const closeDialog = () => setDialogState(false);\n return !showExtensionPointInfo ? null : (\n <BlinkerContainer>\n <Blinker type=\"button\" onClick={() => setDialogState(true)} />\n <ModalTransition>\n {dialogOpen && (\n <Modal onClose={closeDialog} width=\"x-large\">\n <ModalHeader hasCloseButton>\n <ModalTitle>{`Extension point: ${name}`}</ModalTitle>\n </ModalHeader>\n\n <CustomModalBody>\n <SchemasRenderer schemaDocuments={schemaDocuments} />\n </CustomModalBody>\n\n <ModalFooter>\n {/* eslint-disable-next-line jsx-a11y/no-autofocus */}\n <Button appearance=\"primary\" autoFocus onClick={closeDialog}>\n Close\n </Button>\n </ModalFooter>\n </Modal>\n )}\n </ModalTransition>\n </BlinkerContainer>\n );\n};\n\nexport default memo(ExtensionPointInfo);\n"]}
|
|
@@ -179,7 +179,6 @@ See passed callback for reference: ${callback}`,
|
|
|
179
179
|
};
|
|
180
180
|
};
|
|
181
181
|
const EMPTY_PAYLOAD = { state: { descriptors: [], loadingState: true }, update: [] };
|
|
182
|
-
// eslint-disable-next-line import/prefer-default-export
|
|
183
182
|
const getExtensionPointSubscription = (extensionPoint, context) => {
|
|
184
183
|
let singletonObserver;
|
|
185
184
|
let currentState = [];
|
|
@@ -1 +1 @@
|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AAC;oBAC1D,YAAY,CAAC,WAAW,EAAE,CAAC;gBAC/B,CAAC;aACJ,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC,CAAC;AAvDW,QAAA,sBAAsB,0BAuDjC","sourcesContent":["import type {\n Context,\n ExtensionAPI,\n ExtensionAttributes,\n ExtensionAttributesProvider,\n ExtensionCleanupCallback,\n ExtensionDescriptor,\n MaybeOnAction,\n OnAction,\n} from '@atlassian/clientside-extensions-registry';\nimport registry from '@atlassian/clientside-extensions-registry';\nimport { onDebug } from '@atlassian/clientside-extensions-debug';\nimport type { Observable, Observer } from '@atlassian/clientside-extensions-base';\nimport { ReplaySubject } from '@atlassian/clientside-extensions-base';\n// We only import types here\n// eslint-disable-next-line node/no-unpublished-import\nimport type { Validator, ValidationError, ValidationWarning } from '@atlassian/clientside-extensions-schema';\nimport type { ExtensionPointUpdate, ExtensionState, Options } from './types';\nimport { isNotNullOrUndefined } from './types';\n\nconst safeguardAction = (action: OnAction, descriptorKey: string, location: string): OnAction => {\n return (...args: unknown[]) => {\n try {\n return action(...args);\n } catch (e) {\n onDebug(({ error }) => ({\n level: error,\n message: `Failed to execute onAction callback for extension \"${descriptorKey}\" at extension: ${location}.\n Error: ${e}`,\n meta: {\n extension: descriptorKey,\n location,\n },\n }));\n return undefined;\n }\n };\n};\n\nconst actionsCache = new Map<OnAction, OnAction>();\nconst cachedSafeguardAction = (maybeAction: MaybeOnAction, descriptorKey: string, location: string): OnAction | undefined => {\n if (!maybeAction) {\n return undefined;\n }\n\n const action = maybeAction as OnAction;\n\n if (actionsCache.has(action)) {\n return actionsCache.get(action);\n }\n\n const guardedAction = safeguardAction(action, descriptorKey, location);\n\n actionsCache.set(action, guardedAction);\n\n return guardedAction;\n};\n\nconst mergeAttributes = (\n base: ExtensionAttributes,\n provided: ExtensionAttributes,\n onAction?: ExtensionAttributes['onAction'],\n): ExtensionAttributes => {\n if (!onAction) {\n return {\n ...base,\n ...provided,\n };\n }\n\n return {\n ...base,\n ...provided,\n onAction,\n };\n};\n\nconst getExtensionApi = (\n key: string,\n extensionPoint: string,\n attributeMap: Map<string, ExtensionAttributes>,\n queueUpdate: ReturnType<typeof createAnimationFrameQueue>,\n cleanupCallbackQueue: ReturnType<typeof createCleanupCallbackQueue>['queue'],\n) => {\n const extensionAPI: ExtensionAPI = {\n updateAttributes(fnOrAttributes) {\n const currentAttributes = (attributeMap.has(key) && attributeMap.get(key)) || {};\n\n try {\n const updatedAttributes = typeof fnOrAttributes === 'function' ? fnOrAttributes(currentAttributes) : fnOrAttributes;\n const attributes = { ...currentAttributes, ...updatedAttributes };\n attributeMap.set(key, attributes);\n queueUpdate(key);\n } catch (e) {\n onDebug(({ error }) => ({\n level: error,\n message: `Updating attributes for extension ${key} failed:\n${e}`,\n meta: {\n extension: key,\n location: extensionPoint,\n },\n }));\n }\n },\n onCleanup(cleanupCallback) {\n cleanupCallbackQueue.push([key, cleanupCallback]);\n },\n };\n return extensionAPI;\n};\n\nconst getExtensionAttributes = (\n key: string,\n extensionPoint: string,\n attributesProvider: ExtensionAttributesProvider | undefined,\n baseAttributes: ExtensionDescriptor['attributes'],\n extensionAPI: ExtensionAPI,\n context: Context<{}> | null,\n): ExtensionAttributes | undefined => {\n if (!attributesProvider) {\n return baseAttributes;\n }\n\n // Try to get the attributes from the provider\n let providedAttributes: ExtensionAttributes = {};\n\n try {\n const rawProvidedAttributes = attributesProvider(extensionAPI, context);\n\n if (!rawProvidedAttributes || Object.getPrototypeOf(rawProvidedAttributes) !== Object.prototype) {\n throw new TypeError('The attributes provider functions should return attributes object');\n }\n\n providedAttributes = rawProvidedAttributes;\n } catch (e) {\n onDebug(({ error }) => ({\n level: error,\n message: `Calling the attributes provider for extension ${key} failed:\n ${e}`,\n meta: {\n extension: key,\n location: extensionPoint,\n },\n }));\n\n return undefined;\n }\n\n // Cache the onAction if present\n const onAction = providedAttributes.onAction && cachedSafeguardAction(providedAttributes.onAction, key, extensionPoint);\n\n return mergeAttributes(baseAttributes, providedAttributes, onAction);\n};\n\nconst sortDescriptorsByWeight = <T extends ExtensionAttributes>(extensionDescriptors: ExtensionDescriptor<T>[]) => {\n return extensionDescriptors.sort((a: ExtensionDescriptor<T>, b: ExtensionDescriptor<T>) => {\n const aWeight = a?.attributes?.weight ?? Infinity;\n const bWeight = b?.attributes?.weight ?? Infinity;\n\n return aWeight - bWeight;\n });\n};\n\ntype DescriptorUpdateBatch<T extends ExtensionAttributes> = {\n descriptors: ExtensionDescriptor<T>[];\n updatedDescriptors: ExtensionDescriptor<T>[];\n};\nconst inlineUpdateAttributes = <T extends ExtensionAttributes>(\n keys: Set<string>,\n attributeMap: Map<string, ExtensionAttributes>,\n descriptors: ExtensionDescriptor<T>[],\n): DescriptorUpdateBatch<T> => {\n const updated: ExtensionDescriptor<T>[] = [];\n descriptors\n .filter((descriptor) => keys.has(descriptor.key))\n .forEach((descriptor) => {\n descriptor.attributes = {\n ...descriptor.attributes,\n ...attributeMap.get(descriptor.key),\n };\n updated.push(descriptor);\n });\n\n return {\n descriptors: sortDescriptorsByWeight<T>(descriptors),\n updatedDescriptors: updated,\n };\n};\n\nconst createAnimationFrameQueue = (callback: (params: Set<string>) => void) => {\n let queue = new Set<string>();\n let requestIsQueued = false;\n const flushUpdate = () => {\n requestIsQueued = false;\n callback(queue);\n queue = new Set();\n };\n\n return (key: string) => {\n queue.add(key);\n\n if (!requestIsQueued) {\n requestIsQueued = true;\n requestAnimationFrame(flushUpdate);\n }\n };\n};\n\nconst createCleanupCallbackQueue = () => {\n const queue: [string, ExtensionCleanupCallback][] = [];\n const cleanUp = () => {\n while (queue.length) {\n const result = queue.shift();\n\n if (!result) {\n break;\n }\n\n const [descriptorKey, callback] = result;\n\n try {\n callback();\n } catch (e) {\n onDebug(({ error }) => ({\n level: error,\n message: `Failed to execute cleanup callback registered for \"${descriptorKey}\".\nSee passed callback for reference: ${callback}`,\n meta: {\n extension: descriptorKey,\n callback,\n },\n }));\n }\n }\n };\n\n return {\n queue,\n cleanUp,\n };\n};\n\nconst EMPTY_PAYLOAD: ExtensionPointUpdate = { state: { descriptors: [], loadingState: true }, update: [] };\n\n// eslint-disable-next-line import/prefer-default-export\nexport const getExtensionPointSubscription = <ContextT extends Context<{}> | null, AttributesT extends ExtensionAttributes>(\n extensionPoint: string,\n context: ContextT,\n): Observable<ExtensionPointUpdate<AttributesT>> => {\n let singletonObserver: Observer<ExtensionPointUpdate<AttributesT>>;\n let currentState: ExtensionDescriptor<AttributesT>[] = [];\n let currentLoadingState: boolean = true;\n\n const updateSubject = new ReplaySubject<ExtensionPointUpdate<AttributesT>>(1);\n const cleanupCallbackQueue = createCleanupCallbackQueue();\n const descriptorAttributeMap = new Map<string, ExtensionAttributes>();\n\n const animationFrameQueue = createAnimationFrameQueue((updatedKeys) => {\n const { descriptors, updatedDescriptors } = inlineUpdateAttributes(updatedKeys, descriptorAttributeMap, currentState);\n currentState = descriptors;\n updateSubject.notify({ state: { descriptors: currentState, loadingState: currentLoadingState }, update: updatedDescriptors });\n });\n\n const subscription = registry.getLocation(extensionPoint).subscribe(({ descriptors, loadingState }) => {\n // no need to validate while we are still loading.\n if (loadingState) {\n // @ts-expect-error Some issues with generics\n updateSubject.notify(EMPTY_PAYLOAD);\n return;\n }\n\n /*\n * TODO\n * - do we need to remove descriptors from the `descriptorMap` if they are no longer within the listed descriptors?\n * - do we need to override descriptors everytime they get \"re-registered\" or is that a `dev-mode` only feature?\n */\n const extensionDescriptors = descriptors\n .map((rawDescriptor): ExtensionDescriptor<AttributesT> | undefined => {\n const { attributesProvider, attributes: baseAttributes, key, ...descriptor } = rawDescriptor;\n\n const extensionAPI = getExtensionApi(\n key,\n extensionPoint,\n descriptorAttributeMap,\n animationFrameQueue,\n cleanupCallbackQueue.queue,\n );\n\n const maybeAttributes = getExtensionAttributes(\n key,\n extensionPoint,\n attributesProvider,\n baseAttributes,\n extensionAPI,\n context,\n );\n\n if (maybeAttributes === undefined) {\n return undefined;\n }\n\n const attributes: ExtensionAttributes = maybeAttributes;\n\n descriptorAttributeMap.set(key, attributes);\n\n const fullDescriptor: ExtensionDescriptor<AttributesT> = {\n ...descriptor,\n key,\n attributes: attributes as AttributesT,\n };\n\n return fullDescriptor;\n })\n .filter(isNotNullOrUndefined);\n\n currentState = sortDescriptorsByWeight<AttributesT>(extensionDescriptors);\n currentLoadingState = loadingState;\n\n updateSubject.notify({ state: { descriptors: currentState, loadingState }, update: currentState });\n });\n\n return {\n subscribe: (observer: Observer<ExtensionPointUpdate<AttributesT>>) => {\n if (singletonObserver !== undefined) {\n throw new Error('Only one observer is allowed to be registered on this Observable.');\n }\n\n singletonObserver = observer;\n updateSubject.subscribe(observer);\n return {\n unsubscribe: () => {\n updateSubject.unsubscribe(singletonObserver);\n subscription.unsubscribe();\n cleanupCallbackQueue.cleanUp();\n },\n };\n },\n };\n};\n\nconst componentDebugName = 'Schema Validation';\n\nconst gerErrorMessages = (errors: ValidationError[]): string[] => errors.map(({ error }) => error);\nconst getWarningMessages = (errors: ValidationWarning[]): string[] => errors.map(({ warning }) => warning);\n\n/**\n * Validates the attributes against the schema. Returns true if the attributes are valid.\n */\nconst runValidation = (validator: Validator, payload: unknown, extensionPoint: string, extensionKey: string): boolean => {\n if (!validator) {\n throw new Error(`No validator specified to validate extension point \"${extensionPoint}\"`);\n }\n\n const { errors, warnings } = validator(payload);\n\n if (errors.length !== 0) {\n const errorMessages = gerErrorMessages(errors);\n\n onDebug(({ error }) => ({\n level: error,\n message: `Schema validation for extension \"${extensionKey}\" returned errors.`,\n components: componentDebugName,\n meta: {\n location: extensionPoint,\n extension: extensionKey,\n errors: errorMessages,\n },\n }));\n }\n\n if (warnings.length !== 0) {\n const warningMessages = getWarningMessages(warnings);\n\n onDebug(({ warn }) => ({\n level: warn,\n message: `Schema validator for extension \"${extensionKey}\" returned warnings.`,\n components: componentDebugName,\n meta: {\n location: extensionPoint,\n extension: extensionKey,\n warnings: warningMessages,\n },\n }));\n }\n\n return errors.length === 0;\n};\n\n/**\n * Validates the context against the context schema. Returns true if the context is valid.\n */\nconst runContextValidation = (extensionPoint: string, validator: Validator | undefined, context: Context<{}> | null): boolean => {\n // This is a feedback for product developers and should not run in production\n if (process.env.NODE_ENV === 'production') {\n return true;\n }\n\n let errors: ValidationError[] = [];\n let warnings: ValidationWarning[] = [];\n\n if (context) {\n if (!validator) {\n throw new Error(`No context validator specified for extension point \"${extensionPoint}\"`);\n }\n\n ({ errors, warnings } = validator(context));\n\n if (errors.length) {\n const errorMessages = gerErrorMessages(errors);\n\n onDebug(({ error }) => ({\n level: error,\n message: `The context validation for extension-location \"${extensionPoint}\" returned errors.`,\n components: componentDebugName,\n meta: {\n extensionPoint,\n context,\n errors: errorMessages,\n },\n }));\n }\n if (warnings.length) {\n const warningMessages = getWarningMessages(warnings);\n\n onDebug(({ warn }) => ({\n level: warn,\n message: `The context validation for extension-location \"${extensionPoint}\" returned warnings.`,\n components: componentDebugName,\n meta: {\n extensionPoint,\n context,\n warnings: warningMessages,\n },\n }));\n }\n }\n\n return errors.length === 0;\n};\n\ntype DescriptorMap<T extends ExtensionAttributes = ExtensionAttributes> = Map<string, ExtensionDescriptor<T>>;\n\nconst transferDescriptorBetweenMaps = <T extends ExtensionAttributes>(\n descriptor: ExtensionDescriptor<T>,\n addToMap: DescriptorMap<T>,\n removeFromMap: DescriptorMap<T>,\n) => {\n if (removeFromMap.has(descriptor.key)) {\n removeFromMap.delete(descriptor.key);\n }\n addToMap.set(descriptor.key, descriptor);\n};\n\nexport const getValidatedExtensions = <ContextT extends Context<{}> | null, AttributesU extends ExtensionAttributes>(\n extensionPointName: string,\n context: ContextT,\n options: Options,\n): Observable<ExtensionState<AttributesU>> => {\n const { contextValidator, attributeValidator } = options;\n\n const isContextValid = runContextValidation(extensionPointName, contextValidator, context);\n\n if (!isContextValid) {\n throw new Error(`The context provided for extension-location \"${extensionPointName}\" does not match the schema`);\n }\n\n const validatedExtensionsSubject = new ReplaySubject<ExtensionState<AttributesU>>(1);\n let singletonObserver: Observer<ExtensionState<AttributesU>>;\n const supportedDescriptors: DescriptorMap<AttributesU> = new Map<string, ExtensionDescriptor<AttributesU>>();\n const unsupportedDescriptors: DescriptorMap<AttributesU> = new Map<string, ExtensionDescriptor<AttributesU>>();\n\n const subscription = getExtensionPointSubscription<ContextT, AttributesU>(extensionPointName, context).subscribe(\n ({ state, update }) => {\n const { loadingState } = state;\n\n // only reevaluate the updated descriptors\n update.forEach((descriptor) => {\n if (!runValidation(attributeValidator, descriptor.attributes, extensionPointName, descriptor.key)) {\n transferDescriptorBetweenMaps<AttributesU>(descriptor, unsupportedDescriptors, supportedDescriptors);\n } else {\n transferDescriptorBetweenMaps<AttributesU>(descriptor, supportedDescriptors, unsupportedDescriptors);\n }\n });\n\n validatedExtensionsSubject.notify([\n Array.from(supportedDescriptors.values()),\n Array.from(unsupportedDescriptors.values()),\n loadingState,\n ]);\n },\n );\n\n return {\n subscribe: (observer: Observer<ExtensionState<AttributesU>>) => {\n if (singletonObserver !== undefined) {\n throw new Error('Only one observer is allowed to be registered on this Observable.');\n }\n\n singletonObserver = observer;\n validatedExtensionsSubject.subscribe(observer);\n return {\n unsubscribe: () => {\n validatedExtensionsSubject.unsubscribe(singletonObserver);\n subscription.unsubscribe();\n },\n };\n },\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"ExtensionsObservable.js","sourceRoot":"","sources":["../../lib/ExtensionsObservable.ts"],"names":[],"mappings":";;;;AAUA,uHAAiE;AACjE,wFAAiE;AAEjE,sFAAsE;AAKtE,mCAA+C;AAE/C,MAAM,eAAe,GAAG,CAAC,MAAgB,EAAE,aAAqB,EAAE,QAAgB,EAAY,EAAE;IAC5F,OAAO,CAAC,GAAG,IAAe,EAAE,EAAE;QAC1B,IAAI,CAAC;YACD,OAAO,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;QAC3B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,IAAA,qCAAO,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;gBAC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CAAC;gBAChG,6BAA6B,CAAc,UAAU,EAAE,sBAAsB,EAAE,oBAAoB,CAAC,CAAC;YACzG,CAAC;iBAAM,CAAC;gBACJ,6BAA6B,CAAc,UAAU,EAAE,oBAAoB,EAAE,sBAAsB,CAAC,CAAC;YACzG,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,0BAA0B,CAAC,MAAM,CAAC;YAC9B,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,CAAC;YACzC,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,MAAM,EAAE,CAAC;YAC3C,YAAY;SACf,CAAC,CAAC;IACP,CAAC,CACJ,CAAC;IAEF,OAAO;QACH,SAAS,EAAE,CAAC,QAA+C,EAAE,EAAE;YAC3D,IAAI,iBAAiB,KAAK,SAAS,EAAE,CAAC;gBAClC,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;YACzF,CAAC;YAED,iBAAiB,GAAG,QAAQ,CAAC;YAC7B,0BAA0B,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YAC/C,OAAO;gBACH,WAAW,EAAE,GAAG,EAAE;oBACd,0BAA0B,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;oBAC1D,YAAY,CAAC,WAAW,EAAE,CAAC;gBAC/B,CAAC;aACJ,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC,CAAC;AAvDW,QAAA,sBAAsB,0BAuDjC","sourcesContent":["import type {\n Context,\n ExtensionAPI,\n ExtensionAttributes,\n ExtensionAttributesProvider,\n ExtensionCleanupCallback,\n ExtensionDescriptor,\n MaybeOnAction,\n OnAction,\n} from '@atlassian/clientside-extensions-registry';\nimport registry from '@atlassian/clientside-extensions-registry';\nimport { onDebug } from '@atlassian/clientside-extensions-debug';\nimport type { Observable, Observer } from '@atlassian/clientside-extensions-base';\nimport { ReplaySubject } from '@atlassian/clientside-extensions-base';\n// We only import types here\n// eslint-disable-next-line node/no-unpublished-import\nimport type { Validator, ValidationError, ValidationWarning } from '@atlassian/clientside-extensions-schema';\nimport type { ExtensionPointUpdate, ExtensionState, Options } from './types';\nimport { isNotNullOrUndefined } from './types';\n\nconst safeguardAction = (action: OnAction, descriptorKey: string, location: string): OnAction => {\n return (...args: unknown[]) => {\n try {\n return action(...args);\n } catch (e) {\n onDebug(({ error }) => ({\n level: error,\n message: `Failed to execute onAction callback for extension \"${descriptorKey}\" at extension: ${location}.\n Error: ${e}`,\n meta: {\n extension: descriptorKey,\n location,\n },\n }));\n return undefined;\n }\n };\n};\n\nconst actionsCache = new Map<OnAction, OnAction>();\nconst cachedSafeguardAction = (maybeAction: MaybeOnAction, descriptorKey: string, location: string): OnAction | undefined => {\n if (!maybeAction) {\n return undefined;\n }\n\n const action = maybeAction as OnAction;\n\n if (actionsCache.has(action)) {\n return actionsCache.get(action);\n }\n\n const guardedAction = safeguardAction(action, descriptorKey, location);\n\n actionsCache.set(action, guardedAction);\n\n return guardedAction;\n};\n\nconst mergeAttributes = (\n base: ExtensionAttributes,\n provided: ExtensionAttributes,\n onAction?: ExtensionAttributes['onAction'],\n): ExtensionAttributes => {\n if (!onAction) {\n return {\n ...base,\n ...provided,\n };\n }\n\n return {\n ...base,\n ...provided,\n onAction,\n };\n};\n\nconst getExtensionApi = (\n key: string,\n extensionPoint: string,\n attributeMap: Map<string, ExtensionAttributes>,\n queueUpdate: ReturnType<typeof createAnimationFrameQueue>,\n cleanupCallbackQueue: ReturnType<typeof createCleanupCallbackQueue>['queue'],\n) => {\n const extensionAPI: ExtensionAPI = {\n updateAttributes(fnOrAttributes) {\n const currentAttributes = (attributeMap.has(key) && attributeMap.get(key)) || {};\n\n try {\n const updatedAttributes = typeof fnOrAttributes === 'function' ? fnOrAttributes(currentAttributes) : fnOrAttributes;\n const attributes = { ...currentAttributes, ...updatedAttributes };\n attributeMap.set(key, attributes);\n queueUpdate(key);\n } catch (e) {\n onDebug(({ error }) => ({\n level: error,\n message: `Updating attributes for extension ${key} failed:\n${e}`,\n meta: {\n extension: key,\n location: extensionPoint,\n },\n }));\n }\n },\n onCleanup(cleanupCallback) {\n cleanupCallbackQueue.push([key, cleanupCallback]);\n },\n };\n return extensionAPI;\n};\n\nconst getExtensionAttributes = (\n key: string,\n extensionPoint: string,\n attributesProvider: ExtensionAttributesProvider | undefined,\n baseAttributes: ExtensionDescriptor['attributes'],\n extensionAPI: ExtensionAPI,\n context: Context<{}> | null,\n): ExtensionAttributes | undefined => {\n if (!attributesProvider) {\n return baseAttributes;\n }\n\n // Try to get the attributes from the provider\n let providedAttributes: ExtensionAttributes = {};\n\n try {\n const rawProvidedAttributes = attributesProvider(extensionAPI, context);\n\n if (!rawProvidedAttributes || Object.getPrototypeOf(rawProvidedAttributes) !== Object.prototype) {\n throw new TypeError('The attributes provider functions should return attributes object');\n }\n\n providedAttributes = rawProvidedAttributes;\n } catch (e) {\n onDebug(({ error }) => ({\n level: error,\n message: `Calling the attributes provider for extension ${key} failed:\n ${e}`,\n meta: {\n extension: key,\n location: extensionPoint,\n },\n }));\n\n return undefined;\n }\n\n // Cache the onAction if present\n const onAction = providedAttributes.onAction && cachedSafeguardAction(providedAttributes.onAction, key, extensionPoint);\n\n return mergeAttributes(baseAttributes, providedAttributes, onAction);\n};\n\nconst sortDescriptorsByWeight = <T extends ExtensionAttributes>(extensionDescriptors: ExtensionDescriptor<T>[]) => {\n return extensionDescriptors.sort((a: ExtensionDescriptor<T>, b: ExtensionDescriptor<T>) => {\n const aWeight = a?.attributes?.weight ?? Infinity;\n const bWeight = b?.attributes?.weight ?? Infinity;\n\n return aWeight - bWeight;\n });\n};\n\ntype DescriptorUpdateBatch<T extends ExtensionAttributes> = {\n descriptors: ExtensionDescriptor<T>[];\n updatedDescriptors: ExtensionDescriptor<T>[];\n};\nconst inlineUpdateAttributes = <T extends ExtensionAttributes>(\n keys: Set<string>,\n attributeMap: Map<string, ExtensionAttributes>,\n descriptors: ExtensionDescriptor<T>[],\n): DescriptorUpdateBatch<T> => {\n const updated: ExtensionDescriptor<T>[] = [];\n descriptors\n .filter((descriptor) => keys.has(descriptor.key))\n .forEach((descriptor) => {\n descriptor.attributes = {\n ...descriptor.attributes,\n ...attributeMap.get(descriptor.key),\n };\n updated.push(descriptor);\n });\n\n return {\n descriptors: sortDescriptorsByWeight<T>(descriptors),\n updatedDescriptors: updated,\n };\n};\n\nconst createAnimationFrameQueue = (callback: (params: Set<string>) => void) => {\n let queue = new Set<string>();\n let requestIsQueued = false;\n const flushUpdate = () => {\n requestIsQueued = false;\n callback(queue);\n queue = new Set();\n };\n\n return (key: string) => {\n queue.add(key);\n\n if (!requestIsQueued) {\n requestIsQueued = true;\n requestAnimationFrame(flushUpdate);\n }\n };\n};\n\nconst createCleanupCallbackQueue = () => {\n const queue: [string, ExtensionCleanupCallback][] = [];\n const cleanUp = () => {\n while (queue.length) {\n const result = queue.shift();\n\n if (!result) {\n break;\n }\n\n const [descriptorKey, callback] = result;\n\n try {\n callback();\n } catch (e) {\n onDebug(({ error }) => ({\n level: error,\n message: `Failed to execute cleanup callback registered for \"${descriptorKey}\".\nSee passed callback for reference: ${callback}`,\n meta: {\n extension: descriptorKey,\n callback,\n },\n }));\n }\n }\n };\n\n return {\n queue,\n cleanUp,\n };\n};\n\nconst EMPTY_PAYLOAD: ExtensionPointUpdate = { state: { descriptors: [], loadingState: true }, update: [] };\nexport const getExtensionPointSubscription = <ContextT extends Context<{}> | null, AttributesT extends ExtensionAttributes>(\n extensionPoint: string,\n context: ContextT,\n): Observable<ExtensionPointUpdate<AttributesT>> => {\n let singletonObserver: Observer<ExtensionPointUpdate<AttributesT>>;\n let currentState: ExtensionDescriptor<AttributesT>[] = [];\n let currentLoadingState: boolean = true;\n\n const updateSubject = new ReplaySubject<ExtensionPointUpdate<AttributesT>>(1);\n const cleanupCallbackQueue = createCleanupCallbackQueue();\n const descriptorAttributeMap = new Map<string, ExtensionAttributes>();\n\n const animationFrameQueue = createAnimationFrameQueue((updatedKeys) => {\n const { descriptors, updatedDescriptors } = inlineUpdateAttributes(updatedKeys, descriptorAttributeMap, currentState);\n currentState = descriptors;\n updateSubject.notify({ state: { descriptors: currentState, loadingState: currentLoadingState }, update: updatedDescriptors });\n });\n\n const subscription = registry.getLocation(extensionPoint).subscribe(({ descriptors, loadingState }) => {\n // no need to validate while we are still loading.\n if (loadingState) {\n // @ts-expect-error Some issues with generics\n updateSubject.notify(EMPTY_PAYLOAD);\n return;\n }\n\n /*\n * TODO\n * - do we need to remove descriptors from the `descriptorMap` if they are no longer within the listed descriptors?\n * - do we need to override descriptors everytime they get \"re-registered\" or is that a `dev-mode` only feature?\n */\n const extensionDescriptors = descriptors\n .map((rawDescriptor): ExtensionDescriptor<AttributesT> | undefined => {\n const { attributesProvider, attributes: baseAttributes, key, ...descriptor } = rawDescriptor;\n\n const extensionAPI = getExtensionApi(\n key,\n extensionPoint,\n descriptorAttributeMap,\n animationFrameQueue,\n cleanupCallbackQueue.queue,\n );\n\n const maybeAttributes = getExtensionAttributes(\n key,\n extensionPoint,\n attributesProvider,\n baseAttributes,\n extensionAPI,\n context,\n );\n\n if (maybeAttributes === undefined) {\n return undefined;\n }\n\n const attributes: ExtensionAttributes = maybeAttributes;\n\n descriptorAttributeMap.set(key, attributes);\n\n const fullDescriptor: ExtensionDescriptor<AttributesT> = {\n ...descriptor,\n key,\n attributes: attributes as AttributesT,\n };\n\n return fullDescriptor;\n })\n .filter(isNotNullOrUndefined);\n\n currentState = sortDescriptorsByWeight<AttributesT>(extensionDescriptors);\n currentLoadingState = loadingState;\n\n updateSubject.notify({ state: { descriptors: currentState, loadingState }, update: currentState });\n });\n\n return {\n subscribe: (observer: Observer<ExtensionPointUpdate<AttributesT>>) => {\n if (singletonObserver !== undefined) {\n throw new Error('Only one observer is allowed to be registered on this Observable.');\n }\n\n singletonObserver = observer;\n updateSubject.subscribe(observer);\n return {\n unsubscribe: () => {\n updateSubject.unsubscribe(singletonObserver);\n subscription.unsubscribe();\n cleanupCallbackQueue.cleanUp();\n },\n };\n },\n };\n};\n\nconst componentDebugName = 'Schema Validation';\n\nconst gerErrorMessages = (errors: ValidationError[]): string[] => errors.map(({ error }) => error);\nconst getWarningMessages = (errors: ValidationWarning[]): string[] => errors.map(({ warning }) => warning);\n\n/**\n * Validates the attributes against the schema. Returns true if the attributes are valid.\n */\nconst runValidation = (validator: Validator, payload: unknown, extensionPoint: string, extensionKey: string): boolean => {\n if (!validator) {\n throw new Error(`No validator specified to validate extension point \"${extensionPoint}\"`);\n }\n\n const { errors, warnings } = validator(payload);\n\n if (errors.length !== 0) {\n const errorMessages = gerErrorMessages(errors);\n\n onDebug(({ error }) => ({\n level: error,\n message: `Schema validation for extension \"${extensionKey}\" returned errors.`,\n components: componentDebugName,\n meta: {\n location: extensionPoint,\n extension: extensionKey,\n errors: errorMessages,\n },\n }));\n }\n\n if (warnings.length !== 0) {\n const warningMessages = getWarningMessages(warnings);\n\n onDebug(({ warn }) => ({\n level: warn,\n message: `Schema validator for extension \"${extensionKey}\" returned warnings.`,\n components: componentDebugName,\n meta: {\n location: extensionPoint,\n extension: extensionKey,\n warnings: warningMessages,\n },\n }));\n }\n\n return errors.length === 0;\n};\n\n/**\n * Validates the context against the context schema. Returns true if the context is valid.\n */\nconst runContextValidation = (extensionPoint: string, validator: Validator | undefined, context: Context<{}> | null): boolean => {\n // This is a feedback for product developers and should not run in production\n if (process.env.NODE_ENV === 'production') {\n return true;\n }\n\n let errors: ValidationError[] = [];\n let warnings: ValidationWarning[] = [];\n\n if (context) {\n if (!validator) {\n throw new Error(`No context validator specified for extension point \"${extensionPoint}\"`);\n }\n\n ({ errors, warnings } = validator(context));\n\n if (errors.length) {\n const errorMessages = gerErrorMessages(errors);\n\n onDebug(({ error }) => ({\n level: error,\n message: `The context validation for extension-location \"${extensionPoint}\" returned errors.`,\n components: componentDebugName,\n meta: {\n extensionPoint,\n context,\n errors: errorMessages,\n },\n }));\n }\n if (warnings.length) {\n const warningMessages = getWarningMessages(warnings);\n\n onDebug(({ warn }) => ({\n level: warn,\n message: `The context validation for extension-location \"${extensionPoint}\" returned warnings.`,\n components: componentDebugName,\n meta: {\n extensionPoint,\n context,\n warnings: warningMessages,\n },\n }));\n }\n }\n\n return errors.length === 0;\n};\n\ntype DescriptorMap<T extends ExtensionAttributes = ExtensionAttributes> = Map<string, ExtensionDescriptor<T>>;\n\nconst transferDescriptorBetweenMaps = <T extends ExtensionAttributes>(\n descriptor: ExtensionDescriptor<T>,\n addToMap: DescriptorMap<T>,\n removeFromMap: DescriptorMap<T>,\n) => {\n if (removeFromMap.has(descriptor.key)) {\n removeFromMap.delete(descriptor.key);\n }\n addToMap.set(descriptor.key, descriptor);\n};\n\nexport const getValidatedExtensions = <ContextT extends Context<{}> | null, AttributesU extends ExtensionAttributes>(\n extensionPointName: string,\n context: ContextT,\n options: Options,\n): Observable<ExtensionState<AttributesU>> => {\n const { contextValidator, attributeValidator } = options;\n\n const isContextValid = runContextValidation(extensionPointName, contextValidator, context);\n\n if (!isContextValid) {\n throw new Error(`The context provided for extension-location \"${extensionPointName}\" does not match the schema`);\n }\n\n const validatedExtensionsSubject = new ReplaySubject<ExtensionState<AttributesU>>(1);\n let singletonObserver: Observer<ExtensionState<AttributesU>>;\n const supportedDescriptors: DescriptorMap<AttributesU> = new Map<string, ExtensionDescriptor<AttributesU>>();\n const unsupportedDescriptors: DescriptorMap<AttributesU> = new Map<string, ExtensionDescriptor<AttributesU>>();\n\n const subscription = getExtensionPointSubscription<ContextT, AttributesU>(extensionPointName, context).subscribe(\n ({ state, update }) => {\n const { loadingState } = state;\n\n // only reevaluate the updated descriptors\n update.forEach((descriptor) => {\n if (!runValidation(attributeValidator, descriptor.attributes, extensionPointName, descriptor.key)) {\n transferDescriptorBetweenMaps<AttributesU>(descriptor, unsupportedDescriptors, supportedDescriptors);\n } else {\n transferDescriptorBetweenMaps<AttributesU>(descriptor, supportedDescriptors, unsupportedDescriptors);\n }\n });\n\n validatedExtensionsSubject.notify([\n Array.from(supportedDescriptors.values()),\n Array.from(unsupportedDescriptors.values()),\n loadingState,\n ]);\n },\n );\n\n return {\n subscribe: (observer: Observer<ExtensionState<AttributesU>>) => {\n if (singletonObserver !== undefined) {\n throw new Error('Only one observer is allowed to be registered on this Observable.');\n }\n\n singletonObserver = observer;\n validatedExtensionsSubject.subscribe(observer);\n return {\n unsubscribe: () => {\n validatedExtensionsSubject.unsubscribe(singletonObserver);\n subscription.unsubscribe();\n },\n };\n },\n };\n};\n"]}
|
|
@@ -39,7 +39,7 @@ const loadModule = async (moduleProvider, extensionKey, location) => {
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
const AsyncPanelHandler = ({ contextProvider, fallback, location, pluginKey, extensionKey = pluginKey, renderProvider, RootType, }) => {
|
|
42
|
-
const rendererRef = (0, react_1.useRef)();
|
|
42
|
+
const rendererRef = (0, react_1.useRef)(undefined);
|
|
43
43
|
const [isModuleLoaded, setIsModuleLoaded] = (0, react_1.useState)(false);
|
|
44
44
|
const context = (0, react_1.useMemo)(() => {
|
|
45
45
|
let contextValue = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsyncPanelHandler.js","sourceRoot":"","sources":["../../../lib/handlers/AsyncPanelHandler.tsx"],"names":[],"mappings":";;;;AACA,uDAAoE;AAEpE,wFAAiE;AAGjE,iDAA8C;AAc9C,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEtB,MAAM,UAAU,GAAG,KAAK,EACpB,cAA8G,EAC9G,YAAoB,EACpB,QAAgB,EACsC,EAAE;IACxD,IAAI,CAAC;QACD,MAAM,cAAc,GAAG,MAAM,cAAc,EAAE,CAAC;QAC9C,gDAAgD;QAChD,IAAI,CAAC,cAAc,IAAI,CAAC,cAAc,CAAC,UAAU,IAAI,OAAO,cAAc,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;YAChG,IAAA,qCAAO,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;gBACpB,KAAK,EAAE,KAAK;gBAE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C,CAAC,CAAC,8DAAG,QAAQ,CAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7C,CAAC;IAED,OAAO,8BAAC,2BAAY,IAAC,MAAM,EAAE,WAAW,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAI,CAAC;AAC/F,CAAC,CAAC;AAnEW,QAAA,iBAAiB,qBAmE5B","sourcesContent":["import type { FunctionComponent } from 'react';\nimport React, { useEffect, useRef, useState, useMemo } from 'react';\nimport type { AsyncPanelExtension } from '@atlassian/clientside-extensions';\nimport { onDebug } from '@atlassian/clientside-extensions-debug';\nimport type { Context } from '@atlassian/clientside-extensions-registry';\nimport type { PanelHandlerProps } from './PanelHandler';\nimport { PanelHandler } from './PanelHandler';\n\nexport type AsyncPanelRenderExtension = () => Promise<{ default: AsyncPanelExtension.AsyncPanelRenderExtension; __esModule: boolean }>;\n\nexport interface AsyncPanelHandlerProps {\n fallback?: React.JSX.Element | string;\n location: string;\n pluginKey: string;\n extensionKey?: string;\n renderProvider: AsyncPanelRenderExtension;\n contextProvider?: () => Context<{}>;\n RootType?: PanelHandlerProps['RootType'];\n}\n\nconst noop = () => {};\n\nconst loadModule = async (\n moduleProvider: () => Promise<{ default: AsyncPanelExtension.AsyncPanelRenderExtension; __esModule: boolean }>,\n extensionKey: string,\n location: string,\n): Promise<AsyncPanelExtension.AsyncPanelRenderExtension> => {\n try {\n const resolvedModule = await moduleProvider();\n // eslint-disable-next-line no-underscore-dangle\n if (!resolvedModule || !resolvedModule.__esModule || typeof resolvedModule.default !== 'function') {\n onDebug(({ error }) => ({\n level: error,\n\n message: `The provided dynamic import of extension \"${extensionKey}\" at location \"${location}\" does not look like a module that can be asynchronously loaded.`,\n components: ['AsyncPanelHandler'],\n meta: {\n location,\n extension: extensionKey,\n },\n }));\n\n return noop;\n }\n\n return resolvedModule.default;\n } catch (e) {\n onDebug(({ error }) => ({\n level: error,\n\n message: `Failed trying to execute the dynamic import from extension \"${extensionKey}\" for the async panel at location \"${location}\"`,\n components: ['AsyncPanelHandler'],\n meta: {\n location,\n extension: extensionKey,\n error: e,\n },\n }));\n\n return noop;\n }\n};\n\nexport const AsyncPanelHandler: FunctionComponent<AsyncPanelHandlerProps> = ({\n contextProvider,\n fallback,\n location,\n pluginKey,\n extensionKey = pluginKey,\n renderProvider,\n RootType,\n}) => {\n const rendererRef = useRef<AsyncPanelExtension.AsyncPanelRenderExtension | undefined>(undefined);\n const [isModuleLoaded, setIsModuleLoaded] = useState(false);\n\n const context = useMemo<Context<{}>>(() => {\n let contextValue: Context<{}> = {};\n\n if (typeof contextProvider === 'function') {\n try {\n contextValue = contextProvider();\n } catch (e) {\n onDebug(({ error }) => ({\n level: error,\n\n message: `Failed to invoke \"contextProvider\" function for extension \"${extensionKey}\" at location \"${location}\".\\nError: ${e}`,\n components: ['AsyncPanelHandler'],\n meta: {\n location,\n extension: extensionKey,\n },\n }));\n }\n }\n\n return contextValue;\n }, [contextProvider, location, extensionKey]);\n\n useEffect(\n function asyncLoadRendererModule() {\n let didCancel = false;\n\n async function loadRendererModule() {\n setIsModuleLoaded(false);\n rendererRef.current = undefined;\n\n const resolvedRenderer = await loadModule(renderProvider, extensionKey, location);\n\n if (didCancel) {\n return;\n }\n\n rendererRef.current = resolvedRenderer;\n setIsModuleLoaded(true);\n }\n\n loadRendererModule();\n\n return () => {\n didCancel = true;\n };\n },\n [renderProvider, extensionKey, location],\n );\n\n if (!isModuleLoaded || !rendererRef.current) {\n return fallback ? <>{fallback}</> : null;\n }\n\n return <PanelHandler render={rendererRef.current} RootType={RootType} context={context} />;\n};\n"]}
|
|
@@ -41,9 +41,7 @@ const ModalHandler = ({ render, isOpen, onClose, __withoutTransition = false, __
|
|
|
41
41
|
onClose();
|
|
42
42
|
}
|
|
43
43
|
}, [modalApi, onClose]);
|
|
44
|
-
const actionsAsButtons = (0, react_1.useMemo)(() => actions.map(({ testId, isLoading, text, onClick, isDisabled }, index) => (
|
|
45
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
46
|
-
react_1.default.createElement(new_1.default, { key: index, isLoading: isLoading, testId: testId, isDisabled: isDisabled, onClick: onClick }, text))), [actions]);
|
|
44
|
+
const actionsAsButtons = (0, react_1.useMemo)(() => actions.map(({ testId, isLoading, text, onClick, isDisabled }, index) => (react_1.default.createElement(new_1.default, { key: index, isLoading: isLoading, testId: testId, isDisabled: isDisabled, onClick: onClick }, text))), [actions]);
|
|
47
45
|
return (react_1.default.createElement(Wrapper, null, isOpen && (react_1.default.createElement(modal_dialog_1.default, { testId: "client-extensions-modal", width: modalApi.getWidth(), onClose: onCloseHandler, stackIndex: stackIndex },
|
|
48
46
|
react_1.default.createElement(modal_dialog_1.ModalHeader, { hasCloseButton: true },
|
|
49
47
|
react_1.default.createElement(modal_dialog_1.ModalTitle, { appearance: modalApi.getAppearance() }, modalApi.getTitle())),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalHandler.js","sourceRoot":"","sources":["../../../lib/handlers/ModalHandler.tsx"],"names":[],"mappings":";;;;AAAA,uEAA0C;AAE1C,+EAAuH;AACvH,4EAAkE;AAElE,uDAA2F;AAC3F,mDAAgD;AAGhD,MAAM,cAAc,GAAwD,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACzF,MAAM,GAAG,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IAEzC,IAAA,iBAAS,EAAC,GAAG,EAAE;QACX,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC;QAEzB,IAAI,IAAI,EAAE,CAAC;YACP,QAAQ,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,CAAC;QACvC,CAAC;QAED,OAAO,GAAG,EAAE;YACR,IAAI,IAAI,EAAE,CAAC;gBACP,QAAQ,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC;YACxC,CAAC;QACL,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;I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,CAAC;AACN,CAAC,CAAC;AA1DW,QAAA,YAAY,gBA0DvB;AASK,MAAM,sBAAsB,GAAmD,CAAC;AACnF,4BAA4B;AAC5B,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,SAAS,EACT,UAAU,EACV,OAAO;AAEP,2BAA2B;AAC3B,MAAM,EACN,mBAAmB,EACnB,kBAAkB,GACrB,EAAE,EAAE;IACD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAE5C,MAAM,SAAS,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QAC/B,SAAS,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,UAAU,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QAChC,SAAS,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,MAAM,EAAE,CAAC;QACT,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,CACH;QACI,8BAAC,6BAAa,IACV,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,SAAS,EACnB,OAAO,EAAE,OAAO,IAEf,QAAQ,CACG;QAChB,8BAAC,oBAAY,IACT,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,MAAM,EACd,kBAAkB,EAAE,kBAAkB,EACtC,mBAAmB,EAAE,mBAAmB,GAC1C,CACH,CACN,CAAC;AACN,CAAC,CAAC;AAnDW,QAAA,sBAAsB,0BAmDjC","sourcesContent":["import Button from '@atlaskit/button/new';\nimport type { KeyboardOrMouseEvent } from '@atlaskit/modal-dialog';\nimport ModalDialog, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';\nimport { ModalExtension } from '@atlassian/clientside-extensions';\nimport type { FunctionComponent, ReactNode } from 'react';\nimport React, { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { ButtonHandler } from './ButtonHandler';\nimport type { OnClickHandler } from './types';\n\nconst ModalInnerBody: FunctionComponent<{ modalApi: ModalExtension.Api }> = ({ modalApi }) => {\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const node = ref.current;\n\n if (node) {\n modalApi.getRenderCallback()(node);\n }\n\n return () => {\n if (node) {\n modalApi.getCleanupCallback()(node);\n }\n };\n }, [modalApi]);\n\n return <div ref={ref} />;\n};\n\nexport interface ModalHandlerProps {\n render: ModalExtension.ModalRenderExtension;\n isOpen: boolean;\n onClose: () => void;\n __withoutTransition?: boolean;\n __disableFocusLock?: boolean;\n}\n\nexport const ModalHandler: FunctionComponent<ModalHandlerProps> = ({\n render,\n isOpen,\n onClose,\n __withoutTransition = false,\n __disableFocusLock = false,\n}) => {\n const [actions, setActions] = useState<ModalExtension.ModalAction[]>([]);\n const modalApi = useMemo(() => {\n const api = new ModalExtension.Api(onClose, setActions);\n render(api);\n return api;\n }, [render, onClose]);\n\n const Wrapper = __withoutTransition ? Fragment : ModalTransition;\n\n // Here will be dragons. That's a fishy solution for programmatically disabling the focus lock of the Atlaskit Modal component.\n // When the stackIndex > 0 this will disable the focus lock of the Modal. That's quite naive implementation since we are abusing\n // the Atlaskit stacking mechanism.\n const stackIndex = __disableFocusLock ? 1 : 0;\n\n const onCloseHandler = useCallback(\n (e: KeyboardOrMouseEvent) => {\n const closeResult = modalApi.getOnCloseCallback()(e);\n // prevent closing of modal if \"closeRequest\" is \"false\"\n if (closeResult !== false) {\n onClose();\n }\n },\n [modalApi, onClose],\n );\n\n const actionsAsButtons: React.JSX.Element[] = useMemo<React.JSX.Element[]>(\n () =>\n actions.map(({ testId, isLoading, text, onClick, isDisabled }, index) => (\n // eslint-disable-next-line react/no-array-index-key\n <Button key={index} isLoading={isLoading} testId={testId} isDisabled={isDisabled} onClick={onClick}>\n {text}\n </Button>\n )),\n [actions],\n );\n\n return (\n <Wrapper>\n {isOpen && (\n <ModalDialog testId=\"client-extensions-modal\" width={modalApi.getWidth()} onClose={onCloseHandler} stackIndex={stackIndex}>\n <ModalHeader hasCloseButton>\n <ModalTitle appearance={modalApi.getAppearance()}>{modalApi.getTitle()}</ModalTitle>\n </ModalHeader>\n <ModalBody>\n <ModalInnerBody modalApi={modalApi} />\n </ModalBody>\n <ModalFooter>{actionsAsButtons}</ModalFooter>\n </ModalDialog>\n )}\n </Wrapper>\n );\n};\n\nexport interface ModalWithActionHandlerProps extends Omit<OnClickHandler, 'onAction'> {\n children?: ReactNode;\n render: ModalExtension.ModalRenderExtension;\n __withoutTransition?: boolean;\n __disableFocusLock?: boolean;\n}\n\nexport const ModalWithActionHandler: FunctionComponent<ModalWithActionHandlerProps> = ({\n // Action Handler Properties\n appearance,\n children,\n disabled,\n hidden,\n iconAfter,\n iconBefore,\n spacing,\n\n // Modal Handler Properties\n render,\n __withoutTransition,\n __disableFocusLock,\n}) => {\n const [isOpen, setIsOpen] = useState(false);\n\n const openModal = useCallback(() => {\n setIsOpen(true);\n }, []);\n\n const closeModal = useCallback(() => {\n setIsOpen(false);\n }, []);\n\n if (hidden) {\n return null;\n }\n\n return (\n <>\n <ButtonHandler\n appearance={appearance}\n iconAfter={iconAfter}\n iconBefore={iconBefore}\n disabled={disabled}\n hidden={hidden}\n onAction={openModal}\n spacing={spacing}\n >\n {children}\n </ButtonHandler>\n <ModalHandler\n isOpen={isOpen}\n onClose={closeModal}\n render={render}\n __disableFocusLock={__disableFocusLock}\n __withoutTransition={__withoutTransition}\n />\n </>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PanelHandler.js","sourceRoot":"","sources":["../../../lib/handlers/PanelHandler.tsx"],"names":[],"mappings":";;;;AACA,uDAA0D;AAE1D,4EAAkE;AAelE,MAAM,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;IACxG,MAAM,QAAQ,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,IAAI,sCAAc,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7D,MAAM,GAAG,GAAG,IAAA,cAAM,EAAmC,IAAI,CAAC,CAAC;IAE3D,IAAA,iBAAS,EACL,SAAS,qCAAqC;QAC1C,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC;QAEzB,IAAI,MAAM,EAAE,CAAC;YACT,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC9B,CAAC;QAED,IAAI,IAAI,EAAE,CAAC;YACP,QAAQ,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,CAAC;QACvC,CAAC;QAED,OAAO,GAAG,EAAE;YACR,IAAI,IAAI,EAAE,CAAC;gBACP,QAAQ,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC;YACxC,CAAC;QACL,CAAC,CAAC;IACN,CAAC,EACD,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAC9B,CAAC;IAEF,IAAI,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QAClB,OAAO,8BAAC,QAAQ,IAAC,GAAG,EAAE,GAAsC,GAAI,CAAC;IACrE,CAAC;IAED,OAAO,8BAAC,QAAQ,IAAC,GAAG,EAAE,GAAuC,GAAI,CAAC;AACtE,CAAC,CAAC;AA9BW,QAAA,YAAY,gBA8BvB","sourcesContent":["import type { FunctionComponent, Ref } from 'react';\nimport React, { useEffect, useMemo, useRef } from 'react';\nimport type { Context } from '@atlassian/clientside-extensions-registry';\nimport { PanelExtension } from '@atlassian/clientside-extensions';\n\nexport interface PanelHandlerProps {\n render: PanelExtension.PanelRenderExtension;\n RootType?: 'div' | 'span';\n /*\n Hello dear reader of inline comments. You might rightfully ask: what the hell is \"context\" doing here.\n Well turns out you are not the first.\n The reason is, that async-panel is reusing the panel handler under the hood. And the only way to let the panel have\n access to the context is by passing it through via a \"contextProvider\" (check the AsyncPanelExtension).\n So yeah, that is why we are here. And that is why \"context\" has to stay.\n */\n context?: Context<{}>;\n}\n\nconst isDiv = (RooType: string): RooType is 'div' => RooType === 'div';\n\nexport const PanelHandler: FunctionComponent<PanelHandlerProps> = ({ render, RootType = 'div', context }) => {\n const panelApi = useMemo(() => new PanelExtension.Api(), []);\n const ref = useRef<HTMLDivElement | HTMLSpanElement>(null);\n\n useEffect(\n function callMountAndUnmountLifecycleCallbacks() {\n const node = ref.current;\n\n if (render) {\n render(panelApi, context);\n }\n\n if (node) {\n panelApi.getRenderCallback()(node);\n }\n\n return () => {\n if (node) {\n panelApi.getCleanupCallback()(node);\n }\n };\n },\n [panelApi, render, context],\n );\n\n if (isDiv(RootType)) {\n return <RootType ref={ref as Ref<HTMLDivElement> | undefined} />;\n }\n\n return <RootType ref={ref as Ref<HTMLSpanElement> | undefined} />;\n};\n"]}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SectionHandler = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const SectionHandler = ({ children }) => {
|
|
7
|
-
return
|
|
7
|
+
return React.createElement(React.Fragment, null, children);
|
|
8
8
|
};
|
|
9
9
|
exports.SectionHandler = SectionHandler;
|
|
10
10
|
//# sourceMappingURL=SectionHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionHandler.js","sourceRoot":"","sources":["../../../lib/handlers/SectionHandler.tsx"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"SectionHandler.js","sourceRoot":"","sources":["../../../lib/handlers/SectionHandler.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAMxB,MAAM,cAAc,GAA2C,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACnF,OAAO,0CAAG,QAAQ,CAAI,CAAC;AAC3B,CAAC,CAAC;AAFW,QAAA,cAAc,kBAEzB","sourcesContent":["import * as React from 'react';\nimport type { FunctionComponent, ReactNode } from 'react';\ninterface SectionHandlerProps {\n children: ReactNode;\n}\n\nexport const SectionHandler: FunctionComponent<SectionHandlerProps> = ({ children }) => {\n return <>{children}</>;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/handlers/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/handlers/index.ts"],"names":[],"mappings":";;;AAAA,yDAAwD;AAA/C,sHAAA,iBAAiB,OAAA;AAE1B,+CAAsE;AAA7D,4GAAA,YAAY,OAAA;AAAE,sHAAA,sBAAsB,OAAA;AAE7C,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AAEtB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AAEpB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAErB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AAEvB,0EAAiE;AAAxD,sHAAA,aAAa,OAAA","sourcesContent":["export { AsyncPanelHandler } from './AsyncPanelHandler';\nexport type { AsyncPanelHandlerProps, AsyncPanelRenderExtension } from './AsyncPanelHandler';\nexport { ModalHandler, ModalWithActionHandler } from './ModalHandler';\nexport type { ModalHandlerProps, ModalWithActionHandlerProps } from './ModalHandler';\nexport { ButtonHandler } from './ButtonHandler';\nexport type { ButtonHandlerProps } from './ButtonHandler';\nexport { LinkHandler } from './LinkHandler';\nexport type { LinkHandlerProps } from './LinkHandler';\nexport { PanelHandler } from './PanelHandler';\nexport type { PanelHandlerProps } from './PanelHandler';\nexport { SectionHandler } from './SectionHandler';\n\nexport { ExtensionType } from '@atlassian/clientside-extensions';\n"]}
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":";;;;AAAA,mDAA6D;AAApD,yIAAA,OAAO,OAAkB;AAElC,2DAAqE;AAA5D,iJAAA,OAAO,OAAsB;AACtC,+DAAyE;AAAhE,qJAAA,OAAO,OAAwB;AACxC,+DAAgE;AAAvD,8HAAA,sBAAsB,OAAA;AAE/B,0DAAgC;AAChC,qDAA2B;AAE3B,6DAAuE;AAA9D,mJAAA,OAAO,OAAuB;AAIvC,6CAAuD;AAA9C,6HAAA,OAAO,OAAY;AAC5B,iDAA2D;AAAlD,iIAAA,OAAO,OAAc;AAC9B,uDAAiE;AAAxD,uIAAA,OAAO,OAAiB;AACjC,qDAA+D;AAAtD,qIAAA,OAAO,OAAgB","sourcesContent":["export { default as ExtensionPoint } from './ExtensionPoint';\nexport type { ExtensionPointProps } from './ExtensionPoint';\nexport { default as ExtensionPointInfo } from './ExtensionPointInfo';\nexport { default as renderElementAsReact } from './renderElementAsReact';\nexport { getValidatedExtensions } from './ExtensionsObservable';\n\nexport * from './useExtensions';\nexport * from './handlers';\n\nexport { default as useWebPanelRenderer } from './useWebPanelRenderer';\n\nexport type { Options, ExtensionState } from './types';\n\nexport { default as useDebug } from './debug/useDebug';\nexport { default as useLogging } from './debug/useLogging';\nexport { default as useValidation } from './debug/useValidation';\nexport { default as useDiscovery } from './debug/useDiscovery';\n"]}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
4
|
+
const client_1 = require("react-dom/client");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
function renderElementAsReact(renderApi, RenderElement, additionalProps) {
|
|
7
|
+
let root = null;
|
|
7
8
|
renderApi
|
|
8
9
|
.onMount((element) => {
|
|
10
|
+
root = (0, client_1.createRoot)(element);
|
|
9
11
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
10
|
-
|
|
11
|
-
react_1.default.createElement(RenderElement, { ...additionalProps }))
|
|
12
|
+
root.render(react_1.default.createElement(react_1.StrictMode, null,
|
|
13
|
+
react_1.default.createElement(RenderElement, { ...additionalProps })));
|
|
12
14
|
})
|
|
13
|
-
.onUnmount((
|
|
14
|
-
|
|
15
|
+
.onUnmount(() => {
|
|
16
|
+
root === null || root === void 0 ? void 0 : root.unmount();
|
|
17
|
+
root = null;
|
|
15
18
|
});
|
|
16
19
|
}
|
|
17
20
|
exports.default = renderElementAsReact;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderElementAsReact.js","sourceRoot":"","sources":["../../lib/renderElementAsReact.tsx"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"renderElementAsReact.js","sourceRoot":"","sources":["../../lib/renderElementAsReact.tsx"],"names":[],"mappings":";;;AAAA,6CAAyD;AACzD,uDAA8D;AAG9D,SAAS,oBAAoB,CACzB,SAA6B,EAC7B,aAAoC,EACpC,eAAyB;IAEzB,IAAI,IAAI,GAAgB,IAAI,CAAC;IAE7B,SAAS;SACJ,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACjB,IAAI,GAAG,IAAA,mBAAU,EAAC,OAAO,CAAC,CAAC;QAC3B,wDAAwD;QACxD,IAAI,CAAC,MAAM,CACP,8BAAC,kBAAU;YACP,8BAAC,aAAa,OAAM,eAA0B,GAAI,CACzC,CAChB,CAAC;IACN,CAAC,CAAC;SACD,SAAS,CAAC,GAAG,EAAE;QACZ,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,EAAE,CAAC;QAChB,IAAI,GAAG,IAAI,CAAC;IAChB,CAAC,CAAC,CAAC;AACX,CAAC;AAED,kBAAe,oBAAoB,CAAC","sourcesContent":["import { createRoot, type Root } from 'react-dom/client';\nimport React, { StrictMode, type ComponentType } from 'react';\nimport type { MountableExtension } from '@atlassian/clientside-extensions';\n\nfunction renderElementAsReact<PropsT extends React.JSX.IntrinsicAttributes>(\n renderApi: MountableExtension,\n RenderElement: ComponentType<PropsT>,\n additionalProps?: unknown,\n) {\n let root: Root | null = null;\n\n renderApi\n .onMount((element) => {\n root = createRoot(element);\n // eslint-disable-next-line react/jsx-props-no-spreading\n root.render(\n <StrictMode>\n <RenderElement {...(additionalProps as PropsT)} />\n </StrictMode>,\n );\n })\n .onUnmount(() => {\n root?.unmount();\n root = null;\n });\n}\n\nexport default renderElementAsReact;\n"]}
|
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useExtensionsLoadingState = exports.useExtensionsUnsupported = exports.useExtensions = exports.useExtensionsAll = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
6
|
+
const isEqual_1 = tslib_1.__importDefault(require("lodash/isEqual"));
|
|
7
7
|
const clientside_extensions_debug_1 = require("@atlassian/clientside-extensions-debug");
|
|
8
8
|
const ExtensionsObservable_1 = require("./ExtensionsObservable");
|
|
9
9
|
const useDeepCompareMemoize = (value) => {
|
|
10
10
|
const ref = (0, react_1.useRef)({});
|
|
11
|
-
if (!(0,
|
|
11
|
+
if (!(0, isEqual_1.default)(value, ref.current)) {
|
|
12
12
|
ref.current = value;
|
|
13
13
|
}
|
|
14
14
|
return ref.current;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExtensions.js","sourceRoot":"","sources":["../../lib/useExtensions.ts"],"names":[],"mappings":";;;;AAAA,iCAAoD;AACpD,
|
|
1
|
+
{"version":3,"file":"useExtensions.js","sourceRoot":"","sources":["../../lib/useExtensions.ts"],"names":[],"mappings":";;;;AAAA,iCAAoD;AACpD,qEAAqC;AAErC,wFAAiE;AACjE,iEAAgE;AAGhE,MAAM,qBAAqB,GAAG,CAAI,KAAQ,EAAK,EA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,CAAC;AA/BW,QAAA,gBAAgB,oBA+B3B;AAEK,MAAM,aAAa,GAAG,CACzB,cAAsB,EACtB,OAAiB,EACjB,OAAgB,EAClB,EAAE;IACA,MAAM,iBAAiB,GAAG,IAAA,wBAAgB,EAAwB,cAAc,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACpG,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAChC,CAAC,CAAC;AAPW,QAAA,aAAa,iBAOxB;AAEK,MAAM,wBAAwB,GAAG,CAIpC,IAAY,EACZ,OAAiB,EACjB,OAAgB,EAClB,EAAE;IACA,MAAM,iBAAiB,GAAG,IAAA,wBAAgB,EAAwB,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1F,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAChC,CAAC,CAAC;AAVW,QAAA,wBAAwB,4BAUnC;AAEK,MAAM,yBAAyB,GAAG,CAIrC,IAAY,EACZ,OAAiB,EACjB,OAAgB,EAClB,EAAE;IACA,MAAM,iBAAiB,GAAG,IAAA,wBAAgB,EAAwB,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1F,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAChC,CAAC,CAAC;AAVW,QAAA,yBAAyB,6BAUpC","sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport isEqual from 'lodash/isEqual';\nimport type { ExtensionAttributes, Context } from '@atlassian/clientside-extensions-registry';\nimport { onDebug } from '@atlassian/clientside-extensions-debug';\nimport { getValidatedExtensions } from './ExtensionsObservable';\nimport type { ExtensionState, Options } from './types';\n\nconst useDeepCompareMemoize = <T>(value: T): T => {\n const ref = useRef<T>({} as T);\n\n if (!isEqual(value, ref.current)) {\n ref.current = value;\n }\n\n return ref.current;\n};\n\nexport const useExtensionsAll = <ContextT extends Context<{}> | null = null, AttributesT extends ExtensionAttributes = ExtensionAttributes>(\n extensionPoint: string,\n context: ContextT,\n options: Options,\n): ExtensionState<AttributesT> => {\n const [descriptorsState, setDescriptorsState] = useState<ExtensionState<AttributesT>>([[], [], true]);\n const cachedContext = useDeepCompareMemoize(context);\n const cachedOptions = useDeepCompareMemoize(options);\n\n useEffect(() => {\n const subscription = getValidatedExtensions<ContextT, AttributesT>(extensionPoint, cachedContext, cachedOptions).subscribe(\n (update) => {\n onDebug(({ debug }) => ({\n level: debug,\n message: `useExtensionsAll React hook received a new state`,\n components: 'useExtensionsAll',\n meta: {\n extensionPoint,\n context: cachedContext,\n update,\n },\n }));\n\n setDescriptorsState(update);\n },\n );\n\n return () => subscription.unsubscribe();\n }, [extensionPoint, cachedContext, cachedOptions]);\n\n return descriptorsState;\n};\n\nexport const useExtensions = <ContextT extends Context<{}> | null = null, AttributesT extends ExtensionAttributes = ExtensionAttributes>(\n extensionPoint: string,\n context: ContextT,\n options: Options,\n) => {\n const extensionsPayload = useExtensionsAll<ContextT, AttributesT>(extensionPoint, context, options);\n return extensionsPayload[0];\n};\n\nexport const useExtensionsUnsupported = <\n ContextT extends Context<{}> | null = null,\n AttributesU extends ExtensionAttributes = ExtensionAttributes,\n>(\n name: string,\n context: ContextT,\n options: Options,\n) => {\n const extensionsPayload = useExtensionsAll<ContextT, AttributesU>(name, context, options);\n return extensionsPayload[1];\n};\n\nexport const useExtensionsLoadingState = <\n ContextT extends Context<{}> | null = null,\n AttributesU extends ExtensionAttributes = ExtensionAttributes,\n>(\n name: string,\n context: ContextT,\n options: Options,\n) => {\n const extensionsPayload = useExtensionsAll<ContextT, AttributesU>(name, context, options);\n return extensionsPayload[2];\n};\n"]}
|
|
@@ -9,10 +9,7 @@ const LinkToElement = ({ to }) => {
|
|
|
9
9
|
// TODO: is there a way to get the clean type from the schema?
|
|
10
10
|
// We are removing the e.g. "!" required syntax that is a suffix of the schema type
|
|
11
11
|
const cleanTo = to.replace(/[^a-zA-Z0-9]/g, '');
|
|
12
|
-
return (
|
|
13
|
-
// eslint-disable-next-line jsx-a11y/anchor-is-valid, @typescript-eslint/ban-ts-comment
|
|
14
|
-
// @ts-ignore: react-scroll types are not up to date with the latest react version
|
|
15
|
-
React.createElement(Link, { to: cleanTo, href: "", containerId: "___cse_info_container", offset: -20, smooth: true }, to));
|
|
12
|
+
return (React.createElement(Link, { to: cleanTo, href: "", containerId: "___cse_info_container", offset: -20, smooth: true }, to));
|
|
16
13
|
};
|
|
17
14
|
const TypeRenderer = ({ objectType }) => (React.createElement(React.Fragment, null,
|
|
18
15
|
React.createElement("p", null, objectType.description),
|