@tridion-sites/extensions 1.0.0 → 1.0.2

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/README.md ADDED
@@ -0,0 +1,155 @@
1
+ # Tridion Sites Extensions API
2
+
3
+ `@tridion-sites/extensions` provides an API for frontend extensions for Tridion Sites.
4
+
5
+ ## Getting Started
6
+
7
+ All extensions export an [`ExtensionModule`](https://developers.rws.com/tridion-sites-extensions-api-docs/extensions.extensionmodule.html) object. The `initialize` function on this object receives an [`ExtensionBuilder`](https://developers.rws.com/tridion-sites-extensions-api-docs/extensions.extensionbuilder.html) from Tridion Sites as its argument, which gives a developer access to the extensions API.
8
+
9
+ ## Common functionality
10
+
11
+ This functionality can be used in any extension point and is available throughout the application.
12
+
13
+ ### Hooks
14
+
15
+ | Name | Description | Example |
16
+ | ------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
17
+ | [useConfirmation](https://developers.rws.com/tridion-sites-extensions-api-docs/extensions.confirmationhook.html) | Allows to add a confirmation dialog to an operation | [Hello action](https://github.com/RWS/tridion-sites-extensions-examples/blob/main/activities-explorer/simple-action-addon/hello-action/src/helloAction/useHelloAction.ts#L24) |
18
+ | [useNotifications](https://developers.rws.com/tridion-sites-extensions-api-docs/extensions.notificationshook.html) | Provides ability to show notifications and save them in Message Center | [Hello action](https://github.com/RWS/tridion-sites-extensions-examples/blob/main/activities-explorer/simple-action-addon/hello-action/src/helloAction/useHelloAction.ts#L16) |
19
+ | [useUserProfile](https://developers.rws.com/tridion-sites-extensions-api-docs/extensions.userprofilehook.html) | Provides access to the current user profile information | [Hello action](https://github.com/RWS/tridion-sites-extensions-examples/blob/main/activities-explorer/simple-action-addon/hello-action/src/helloAction/useHelloAction.ts#L12) |
20
+
21
+ ### Components and styling
22
+
23
+ Components and style constants are provided so extensions can maintain a consistent look & feel with Tridion Sites.
24
+
25
+ #### Layout
26
+
27
+ | Name | Description | Example |
28
+ | ---------- | ----------- | ------- |
29
+ | [Block]() | | |
30
+ | [Center]() | | |
31
+ | [Flex]() | | |
32
+ | [Stack]() | | |
33
+
34
+ #### Other components
35
+
36
+ | Name | Description | Example |
37
+ | ------------ | ----------- | ------- |
38
+ | [Button]() | | |
39
+ | [Icon]() | | |
40
+ | [Link]() | | |
41
+ | [Text]() | | |
42
+ | [TextLink]() | | |
43
+
44
+ #### Style constants
45
+
46
+ | Name | Description | Example |
47
+ | ------------------------- | ----------- | ------- |
48
+ | [getBorderRadius]() | | |
49
+ | [getColorPalette]() | | |
50
+ | [getOpacityLevel]() | | |
51
+ | [getSpacing]() | | |
52
+ | [getTransitionDuration]() | | |
53
+ | [getZIndex]() | | |
54
+
55
+ ## Data loading
56
+
57
+ Mutations and queries provide a way to requires Tridion Sites data. They operate with model instances of [`@tridion-sites/models`](https://www.npmjs.com/package/@tridion-sites/models) package rather than simple objects of [`@tridion-sites/open-api-client`](https://www.npmjs.com/package/@tridion-sites/open-api-client).
58
+
59
+ _💡 **Tip:** Mutations and queries share cached data between the host application and extensions. This means that if provided request was already loaded somewhere else - it is going to be retrieved from the cache if applicable._
60
+
61
+ ### Queries
62
+
63
+ Queries provide a way of retrieving data from the backend as well as managing its loading and reloading.
64
+
65
+ | Name | Description | Example |
66
+ | ----------------------------------------- | ----------- | ------- |
67
+ | [useActivityInstancesQuery]() | | |
68
+ | [useDefaultTranslationJobQuery]() | | |
69
+ | [useFavoritesQuery]() | | |
70
+ | [useItemBlueprintHierarchyQuery]() | | |
71
+ | [useItemChildrenQuery]() | | |
72
+ | [useItemClassifiedItemsQuery]() | | |
73
+ | [useItemDefaultDataQuery]() | | |
74
+ | [useItemHistoryQuery]() | | |
75
+ | [useItemPublishedPagesQuery]() | | |
76
+ | [useItemPublishedToQuery]() | | |
77
+ | [useItemPublishUrlsQuery]() | | |
78
+ | [useItemQuery]() | | |
79
+ | [useItemsInProgressQuery]() | | |
80
+ | [useItemsQuery]() | | |
81
+ | [useItemsToPublishQuery]() | | |
82
+ | [useItemsToUnpublishQuery]() | | |
83
+ | [useItemTranslationInfoQuery]() | | |
84
+ | [useItemUsedByQuery]() | | |
85
+ | [useItemUsesQuery]() | | |
86
+ | [usePublicationBlueprintHierarchyQuery]() | | |
87
+ | [usePublicationsQuery]() | | |
88
+ | [usePublishableTargetTypesQuery]() | | |
89
+ | [useSearchInContainerQuery]() | | |
90
+ | [useSystemSearchQuery]() | | |
91
+ | [useUserGroupsQuery]() | | |
92
+ | [useUserProfileQuery]() | | |
93
+ | [useUsersQuery]() | | |
94
+
95
+ ### Mutations
96
+
97
+ Mutations provide a way of changing data on the backend as well as handling request execution.
98
+
99
+ | Name | Description | Example |
100
+ | ----------------------------------- | ----------- | ------- |
101
+ | [useAddToBundleMutation]() | | |
102
+ | [useAssignActivitiesMutation]() | | |
103
+ | [useAssignActivityMutation]() | | |
104
+ | [useAutoClassifyItemMutation]() | | |
105
+ | [useAutoClassifyItemsMutation]() | | |
106
+ | [useChangeUserLanguageMutation]() | | |
107
+ | [useChangeUserLocaleMutation]() | | |
108
+ | [useCopyItemMutation]() | | |
109
+ | [useCopyItemsMutation]() | | |
110
+ | [useCreateTranslationJobMutation]() | | |
111
+ | [useDeleteItemMutation]() | | |
112
+ | [useDeleteItemsMutation]() | | |
113
+ | [useFinishActivitiesMutation]() | | |
114
+ | [useFinishActivityMutation]() | | |
115
+ | [useFinishEditingItemMutation]() | | |
116
+ | [useFinishEditingItemsMutation]() | | |
117
+ | [useLocalizeItemMutation]() | | |
118
+ | [useLocalizeItemsMutation]() | | |
119
+ | [useMoveItemMutation]() | | |
120
+ | [useMoveItemsMutation]() | | |
121
+ | [usePublishItemsMutation]() | | |
122
+ | [useRemoveFromBundleMutation]() | | |
123
+ | [useRestartActivitiesMutation]() | | |
124
+ | [useRestartActivityMutation]() | | |
125
+ | [useRevertItemMutation]() | | |
126
+ | [useRevertItemsMutation]() | | |
127
+ | [useRollbackItemMutation]() | | |
128
+ | [useStartActivitiesMutation]() | | |
129
+ | [useStartActivityMutation]() | | |
130
+ | [useStartWorkflowMutation]() | | |
131
+ | [useUnlocalizeItemMutation]() | | |
132
+ | [useUnlocalizeItemsMutation]() | | |
133
+ | [useUnpublishItemsMutation]() | | |
134
+ | [useUpdateItemMutation]() | | |
135
+ | [useUploadMultimediaMutation]() | | |
136
+
137
+ ## Data Contexts
138
+
139
+ Tridion Sites contains nested data contexts. All extension points and hooks exist within a data context. Within any given data context, one can access both the data in that context and any parent data contexts. It is important to note where an extension is located to determine what data it can access.
140
+
141
+ _💡 **Tip:** Some extensions might appear in multiple places. Hooks with optional contexts are provided for this purpose._
142
+
143
+ - Activities Explorer
144
+ - Activities Explorer Table
145
+ - Content Explorer
146
+ - Content Explorer Table
147
+ - Content Explorer Tree
148
+ - Content editors
149
+ - Bundle editor
150
+ - Category editor
151
+ - Component editor
152
+ - Folder editor
153
+ - Keyword editor
154
+ - Page editor
155
+ - Structure group editor
package/dist/index.d.ts CHANGED
@@ -348,7 +348,7 @@ export declare type AddToBundleMutationHook = (options?: MutationOptions<Mutatio
348
348
  export declare interface AddToBundleRequest {
349
349
  bundleId: ItemUri;
350
350
  itemsToAdd: ReadonlyArray<IdentifiableObject>;
351
- contextItem?: IdentifiableObject;
351
+ containerItem?: IdentifiableObject;
352
352
  }
353
353
 
354
354
  /**
@@ -436,7 +436,7 @@ export declare type AutoClassifyItemMutationHook = (options?: MutationOptions<Cl
436
436
  */
437
437
  export declare interface AutoClassifyItemRequest {
438
438
  itemId: ItemUri;
439
- contextItem?: IdentifiableObject;
439
+ containerItem?: IdentifiableObject;
440
440
  }
441
441
 
442
442
  /**
@@ -477,7 +477,7 @@ declare type BatchMutationOptions<TVariables> = MutationOptions<Batch, ApiError,
477
477
  * including the className and cssStyle props for custom styling.
478
478
  *
479
479
  * It should rarely be used directly as preference should be given to the more specialized child components.
480
- * @internal
480
+ * @public
481
481
  */
482
482
  export declare const Block: BlockComponent;
483
483
 
@@ -571,7 +571,7 @@ export declare interface BundleEditorHooksApiStorage {
571
571
 
572
572
  /**
573
573
  * A component that has standard button functionality.
574
- * @internal
574
+ * @public
575
575
  */
576
576
  export declare const Button: ButtonComponent;
577
577
 
@@ -640,7 +640,7 @@ export declare interface CategoryEditorHooksApiStorage {
640
640
  *
641
641
  * It is advisable to construct most of the layout using this component as it allows to freely utilize
642
642
  * "shouldFill" and similar props that rely on the parent being a Flex component.
643
- * @internal
643
+ * @public
644
644
  */
645
645
  export declare const Center: CenterComponent;
646
646
 
@@ -1321,7 +1321,7 @@ export declare type DeleteItemMutationHook = (options?: MutationOptions<void, Ap
1321
1321
  */
1322
1322
  export declare interface DeleteItemRequest {
1323
1323
  item: IdentifiableObject;
1324
- contextItem?: IdentifiableObject;
1324
+ containerItem?: IdentifiableObject;
1325
1325
  }
1326
1326
 
1327
1327
  /**
@@ -1498,7 +1498,7 @@ export declare type FinishEditingItemMutationHook = (options?: MutationOptions<R
1498
1498
  */
1499
1499
  export declare interface FinishEditingItemRequest {
1500
1500
  item: VersionedItem;
1501
- contextItem?: IdentifiableObject;
1501
+ containerItem?: IdentifiableObject;
1502
1502
  }
1503
1503
 
1504
1504
  /**
@@ -1520,7 +1520,7 @@ export declare interface FinishItemsRequest {
1520
1520
  *
1521
1521
  * It is advisable to construct most of the layout using this component as it allows to freely utilize
1522
1522
  * "shouldFill" and similar props that rely on the parent being a Flex component.
1523
- * @internal
1523
+ * @public
1524
1524
  */
1525
1525
  export declare const Flex: FlexComponent;
1526
1526
 
@@ -1755,7 +1755,7 @@ export declare type GetBorderRadius = () => BorderRadius;
1755
1755
 
1756
1756
  /**
1757
1757
  * System-predefined border radiuses.
1758
- * @internal
1758
+ * @public
1759
1759
  */
1760
1760
  export declare const getBorderRadius: GetBorderRadius;
1761
1761
 
@@ -1766,7 +1766,7 @@ export declare type GetColorPalette = () => ColorPalette;
1766
1766
 
1767
1767
  /**
1768
1768
  * System-predefined color palette.
1769
- * @internal
1769
+ * @public
1770
1770
  */
1771
1771
  export declare const getColorPalette: GetColorPalette;
1772
1772
 
@@ -1779,7 +1779,7 @@ export declare type GetOpacityLevel = () => OpacityLevel;
1779
1779
 
1780
1780
  /**
1781
1781
  * System-predefined opacity levels.
1782
- * @internal
1782
+ * @public
1783
1783
  */
1784
1784
  export declare const getOpacityLevel: GetOpacityLevel;
1785
1785
 
@@ -1790,7 +1790,7 @@ export declare type GetSpacing = () => Spacing;
1790
1790
 
1791
1791
  /**
1792
1792
  * System-predefined spacings.
1793
- * @internal
1793
+ * @public
1794
1794
  */
1795
1795
  export declare const getSpacing: GetSpacing;
1796
1796
 
@@ -1801,7 +1801,7 @@ export declare type GetTransitionDuration = () => TransitionDuration;
1801
1801
 
1802
1802
  /**
1803
1803
  * System-predefined transition duration.
1804
- * @internal
1804
+ * @public
1805
1805
  */
1806
1806
  export declare const getTransitionDuration: GetTransitionDuration;
1807
1807
 
@@ -1812,7 +1812,7 @@ export declare type GetZIndex = () => ZIndex;
1812
1812
 
1813
1813
  /**
1814
1814
  * System-predefined z-index values.
1815
- * @internal
1815
+ * @public
1816
1816
  */
1817
1817
  export declare const getZIndex: GetZIndex;
1818
1818
 
@@ -1833,7 +1833,7 @@ export declare class HeaderExtensionsBuilder {
1833
1833
 
1834
1834
  /**
1835
1835
  * A component used for rendering SVG icons.
1836
- * @internal
1836
+ * @public
1837
1837
  */
1838
1838
  export declare const Icon: IconComponent;
1839
1839
 
@@ -2156,7 +2156,7 @@ export declare type LanguageCode = 'de' | 'en' | 'es' | 'fr' | 'nl' | 'zh' | 'ja
2156
2156
 
2157
2157
  /**
2158
2158
  * A component to wrap any custom view with Link for navigation
2159
- * @internal
2159
+ * @public
2160
2160
  */
2161
2161
  export declare const Link: LinkComponent;
2162
2162
 
@@ -2215,7 +2215,7 @@ export declare type LocalizeItemMutationHook = (options?: MutationOptions<Reposi
2215
2215
  */
2216
2216
  export declare interface LocalizeItemRequest {
2217
2217
  itemId: ItemUri;
2218
- contextItem?: IdentifiableObject;
2218
+ containerItem?: IdentifiableObject;
2219
2219
  }
2220
2220
 
2221
2221
  /**
@@ -2387,10 +2387,6 @@ export declare type NavigationItemHook = () => {
2387
2387
  * If `true`, navigation menu item and its corresponding page are available.
2388
2388
  */
2389
2389
  readonly isAvailable: boolean;
2390
- /**
2391
- * If `true`, navigation item has enough information to determine its availability.
2392
- */
2393
- readonly isInitialized: boolean;
2394
2390
  /**
2395
2391
  * Navigation item label.
2396
2392
  */
@@ -2918,7 +2914,7 @@ export declare type RevertItemMutationHook = (options?: MutationOptions<Reposito
2918
2914
  */
2919
2915
  export declare interface RevertItemRequest {
2920
2916
  item: IdentifiableObject;
2921
- contextItem?: IdentifiableObject;
2917
+ containerItem?: IdentifiableObject;
2922
2918
  }
2923
2919
 
2924
2920
  /**
@@ -3022,7 +3018,7 @@ export declare type RollbackItemMutationHook = (options?: MutationOptions<Reposi
3022
3018
  */
3023
3019
  export declare interface RollbackItemRequest {
3024
3020
  itemId: ItemUri;
3025
- contextItem?: IdentifiableObject;
3021
+ containerItem?: IdentifiableObject;
3026
3022
  deleteNewerVersions: boolean;
3027
3023
  }
3028
3024
 
@@ -3175,7 +3171,7 @@ declare type SpacingUnit_2 = keyof typeof spacing;
3175
3171
  *
3176
3172
  * Items can't have size that depends on Stack's size. This means that it is impossible to make item take available space or
3177
3173
  * have size in percentage of Stack's size.
3178
- * @internal
3174
+ * @public
3179
3175
  */
3180
3176
  export declare const Stack: StackComponent;
3181
3177
 
@@ -3412,7 +3408,7 @@ export declare type TextDirection = 'leftToRight' | 'rightToLeft';
3412
3408
 
3413
3409
  /**
3414
3410
  * A component to render Text Link for navigation
3415
- * @internal
3411
+ * @public
3416
3412
  */
3417
3413
  export declare const TextLink: TextLinkComponent;
3418
3414
 
@@ -3535,7 +3531,7 @@ export declare type UnlocalizeItemMutationHook = (options?: MutationOptions<Repo
3535
3531
  */
3536
3532
  export declare interface UnlocalizeItemRequest {
3537
3533
  itemId: ItemUri;
3538
- contextItem?: IdentifiableObject;
3534
+ containerItem?: IdentifiableObject;
3539
3535
  useDynamicVersion?: boolean;
3540
3536
  }
3541
3537
 
package/dist/index.js CHANGED
@@ -1122,7 +1122,7 @@ const useOptionalStructureGroupEditor = () => {
1122
1122
  * including the className and cssStyle props for custom styling.
1123
1123
  *
1124
1124
  * It should rarely be used directly as preference should be given to the more specialized child components.
1125
- * @internal
1125
+ * @public
1126
1126
  */
1127
1127
  const Block = memo(props => {
1128
1128
  const Block = extensionApiBridge.get().general.components.Block;
@@ -1131,7 +1131,7 @@ const Block = memo(props => {
1131
1131
  Block.displayName = 'Block';
1132
1132
  /**
1133
1133
  * A component that has standard button functionality.
1134
- * @internal
1134
+ * @public
1135
1135
  */
1136
1136
  const Button = memo(props => {
1137
1137
  const Button = extensionApiBridge.get().general.components.Button;
@@ -1145,7 +1145,7 @@ Button.displayName = 'Button';
1145
1145
  *
1146
1146
  * It is advisable to construct most of the layout using this component as it allows to freely utilize
1147
1147
  * "shouldFill" and similar props that rely on the parent being a Flex component.
1148
- * @internal
1148
+ * @public
1149
1149
  */
1150
1150
  const Center = memo(props => {
1151
1151
  const Center = extensionApiBridge.get().general.components.Center;
@@ -1158,7 +1158,7 @@ Center.displayName = 'Center';
1158
1158
  *
1159
1159
  * It is advisable to construct most of the layout using this component as it allows to freely utilize
1160
1160
  * "shouldFill" and similar props that rely on the parent being a Flex component.
1161
- * @internal
1161
+ * @public
1162
1162
  */
1163
1163
  const Flex = memo(props => {
1164
1164
  const Flex = extensionApiBridge.get().general.components.Flex;
@@ -1167,7 +1167,7 @@ const Flex = memo(props => {
1167
1167
  Flex.displayName = 'Flex';
1168
1168
  /**
1169
1169
  * A component used for rendering SVG icons.
1170
- * @internal
1170
+ * @public
1171
1171
  */
1172
1172
  const Icon = memo(props => {
1173
1173
  const Icon = extensionApiBridge.get().general.components.Icon;
@@ -1176,7 +1176,7 @@ const Icon = memo(props => {
1176
1176
  Icon.displayName = 'Icon';
1177
1177
  /**
1178
1178
  * A component to wrap any custom view with Link for navigation
1179
- * @internal
1179
+ * @public
1180
1180
  */
1181
1181
  const Link = memo(props => {
1182
1182
  const Link = extensionApiBridge.get().general.components.Link;
@@ -1188,7 +1188,7 @@ Link.displayName = 'Link';
1188
1188
  *
1189
1189
  * Items can't have size that depends on Stack's size. This means that it is impossible to make item take available space or
1190
1190
  * have size in percentage of Stack's size.
1191
- * @internal
1191
+ * @public
1192
1192
  */
1193
1193
  const Stack = memo(props => {
1194
1194
  const Stack = extensionApiBridge.get().general.components.Stack;
@@ -1205,7 +1205,7 @@ const Text = memo(props => {
1205
1205
  Text.displayName = 'Text';
1206
1206
  /**
1207
1207
  * A component to render Text Link for navigation
1208
- * @internal
1208
+ * @public
1209
1209
  */
1210
1210
  const TextLink = memo(props => {
1211
1211
  const TextLink = extensionApiBridge.get().general.components.TextLink;
@@ -1215,32 +1215,32 @@ TextLink.displayName = 'TextLink';
1215
1215
 
1216
1216
  /**
1217
1217
  * System-predefined border radiuses.
1218
- * @internal
1218
+ * @public
1219
1219
  */
1220
1220
  const getBorderRadius = () => extensionApiBridge.get().general.globals.getBorderRadius();
1221
1221
  /**
1222
1222
  * System-predefined color palette.
1223
- * @internal
1223
+ * @public
1224
1224
  */
1225
1225
  const getColorPalette = () => extensionApiBridge.get().general.globals.getColorPalette();
1226
1226
  /**
1227
1227
  * System-predefined opacity levels.
1228
- * @internal
1228
+ * @public
1229
1229
  */
1230
1230
  const getOpacityLevel = () => extensionApiBridge.get().general.globals.getOpacityLevel();
1231
1231
  /**
1232
1232
  * System-predefined spacings.
1233
- * @internal
1233
+ * @public
1234
1234
  */
1235
1235
  const getSpacing = () => extensionApiBridge.get().general.globals.getSpacing();
1236
1236
  /**
1237
1237
  * System-predefined transition duration.
1238
- * @internal
1238
+ * @public
1239
1239
  */
1240
1240
  const getTransitionDuration = () => extensionApiBridge.get().general.globals.getTransitionDuration();
1241
1241
  /**
1242
1242
  * System-predefined z-index values.
1243
- * @internal
1243
+ * @public
1244
1244
  */
1245
1245
  const getZIndex = () => extensionApiBridge.get().general.globals.getZIndex();
1246
1246
 
@@ -1729,7 +1729,7 @@ const createExtensionGlobals = () => {
1729
1729
  };
1730
1730
  };
1731
1731
 
1732
- const version = "1.0.0";
1732
+ const version = "1.0.2";
1733
1733
  const peerDependencies = {
1734
1734
  "@tridion-sites/models": "workspace:*",
1735
1735
  "@tridion-sites/open-api-client": "workspace:*",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tridion-sites/extensions",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Tridion Sites Extensions API",
5
5
  "author": "RWS",
6
6
  "homepage": "https://www.rws.com",