@atlaskit/share 3.2.5 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/share
2
2
 
3
+ ## 3.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`575b4888124`](https://bitbucket.org/atlassian/atlassian-frontend/commits/575b4888124) - Removed internal test/demo usages of setSmartUserPickerEnv
8
+ - Updated dependencies
9
+
10
+ ## 3.3.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [`3f35716fe41`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3f35716fe41) - [ux] changed share dialogue button to 'share' from 'send'
15
+
16
+ ## 3.2.6
17
+
18
+ ### Patch Changes
19
+
20
+ - [`c58555a28e7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c58555a28e7) - Make the share component a functional component to work with storybook
21
+
3
22
  ## 3.2.5
4
23
 
5
24
  ### Patch Changes
@@ -195,7 +195,7 @@ var InternalForm = /*#__PURE__*/function (_React$PureComponent) {
195
195
  var buttonAppearance = !shouldShowWarning ? 'primary' : 'warning';
196
196
  var tabMode = integrationMode === 'tabs';
197
197
  var formPublicLabel = tabMode ? _i18n.messages.formSharePublic : _i18n.messages.formSendPublic;
198
- var formSendLabel = tabMode ? _i18n.messages.formShare : _i18n.messages.formSend;
198
+ var formSendLabel = _i18n.messages.formShare;
199
199
  var sendLabel = isPublicLink ? formPublicLabel : formSendLabel;
200
200
  var buttonLabel = shareError ? _i18n.messages.formRetry : sendLabel;
201
201
  var ButtonLabelWrapper = buttonAppearance === 'warning' ? 'strong' : _react.default.Fragment;
@@ -19,7 +19,7 @@ var buildAttributes = function buildAttributes() {
19
19
  var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
20
20
  return _objectSpread({
21
21
  packageName: "@atlaskit/share",
22
- packageVersion: "3.2.5"
22
+ packageVersion: "3.3.1"
23
23
  }, attributes);
24
24
  };
25
25
 
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/share",
3
- "version": "3.2.5"
3
+ "version": "3.3.1"
4
4
  }
@@ -147,7 +147,7 @@ class InternalForm extends React.PureComponent {
147
147
  const buttonAppearance = !shouldShowWarning ? 'primary' : 'warning';
148
148
  const tabMode = integrationMode === 'tabs';
149
149
  const formPublicLabel = tabMode ? messages.formSharePublic : messages.formSendPublic;
150
- const formSendLabel = tabMode ? messages.formShare : messages.formSend;
150
+ const formSendLabel = messages.formShare;
151
151
  const sendLabel = isPublicLink ? formPublicLabel : formSendLabel;
152
152
  const buttonLabel = shareError ? messages.formRetry : sendLabel;
153
153
  const ButtonLabelWrapper = buttonAppearance === 'warning' ? 'strong' : React.Fragment;
@@ -2,7 +2,7 @@ import { isEmail, isTeam, isUser } from '@atlaskit/smart-user-picker';
2
2
 
3
3
  const buildAttributes = (attributes = {}) => ({
4
4
  packageName: "@atlaskit/share",
5
- packageVersion: "3.2.5",
5
+ packageVersion: "3.3.1",
6
6
  ...attributes
7
7
  });
8
8
 
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/share",
3
- "version": "3.2.5"
3
+ "version": "3.3.1"
4
4
  }
@@ -145,7 +145,7 @@ var InternalForm = /*#__PURE__*/function (_React$PureComponent) {
145
145
  var buttonAppearance = !shouldShowWarning ? 'primary' : 'warning';
146
146
  var tabMode = integrationMode === 'tabs';
147
147
  var formPublicLabel = tabMode ? messages.formSharePublic : messages.formSendPublic;
148
- var formSendLabel = tabMode ? messages.formShare : messages.formSend;
148
+ var formSendLabel = messages.formShare;
149
149
  var sendLabel = isPublicLink ? formPublicLabel : formSendLabel;
150
150
  var buttonLabel = shareError ? messages.formRetry : sendLabel;
151
151
  var ButtonLabelWrapper = buttonAppearance === 'warning' ? 'strong' : React.Fragment;
@@ -10,7 +10,7 @@ var buildAttributes = function buildAttributes() {
10
10
  var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
11
11
  return _objectSpread({
12
12
  packageName: "@atlaskit/share",
13
- packageVersion: "3.2.5"
13
+ packageVersion: "3.3.1"
14
14
  }, attributes);
15
15
  };
16
16
 
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/share",
3
- "version": "3.2.5"
3
+ "version": "3.3.1"
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/share",
3
- "version": "3.2.5",
3
+ "version": "3.3.1",
4
4
  "description": "Fabric Share Element",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -32,12 +32,12 @@
32
32
  "dependencies": {
33
33
  "@atlaskit/analytics-next": "^8.2.0",
34
34
  "@atlaskit/button": "^16.3.0",
35
- "@atlaskit/dropdown-menu": "^11.2.0",
35
+ "@atlaskit/dropdown-menu": "^11.3.0",
36
36
  "@atlaskit/form": "^8.5.0",
37
37
  "@atlaskit/icon": "^21.10.0",
38
- "@atlaskit/popup": "^1.3.0",
38
+ "@atlaskit/popup": "^1.4.0",
39
39
  "@atlaskit/portal": "^4.0.0",
40
- "@atlaskit/smart-user-picker": "^5.1.2",
40
+ "@atlaskit/smart-user-picker": "^6.0.0",
41
41
  "@atlaskit/spinner": "^15.1.4",
42
42
  "@atlaskit/tabs": "^13.2.3",
43
43
  "@atlaskit/textarea": "^4.3.0",
@@ -45,7 +45,7 @@
45
45
  "@atlaskit/tokens": "^0.10.0",
46
46
  "@atlaskit/tooltip": "^17.5.0",
47
47
  "@atlaskit/ufo": "^0.1.0",
48
- "@atlaskit/user-picker": "^9.2.0",
48
+ "@atlaskit/user-picker": "^9.3.0",
49
49
  "@atlaskit/util-service-support": "^6.1.0",
50
50
  "@babel/runtime": "^7.0.0",
51
51
  "fast-deep-equal": "^3.1.1",
@@ -60,12 +60,12 @@
60
60
  },
61
61
  "devDependencies": {
62
62
  "@atlaskit/docs": "^9.0.0",
63
- "@atlaskit/editor-test-helpers": "^17.0.0",
63
+ "@atlaskit/editor-test-helpers": "^17.1.0",
64
64
  "@atlaskit/flag": "^14.6.0",
65
65
  "@atlaskit/section-message": "^6.0.0",
66
- "@atlaskit/select": "^15.3.0",
66
+ "@atlaskit/select": "^15.5.0",
67
67
  "@atlaskit/toggle": "^12.4.0",
68
- "@atlaskit/util-data-test": "^17.3.0",
68
+ "@atlaskit/util-data-test": "^17.5.0",
69
69
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
70
70
  "enzyme": "^3.10.0",
71
71
  "enzyme-adapter-react-16": "^1.15.1",
package/report.api.md CHANGED
@@ -1,6 +1,8 @@
1
- ## API Report File for "@atlaskit/share"
1
+ ## API Report File for "@atlaskit/share".
2
2
 
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
3
+ > Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
4
6
 
5
7
  ```ts
6
8
  /// <reference types="react" />
@@ -15,50 +17,41 @@ import type { TriggerProps } from '@atlaskit/popup';
15
17
  import type { Value } from '@atlaskit/smart-user-picker';
16
18
  import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
17
19
 
18
- // @public (undocumented)
19
- export const ADMIN_NOTIFIED = 'admin-notified';
20
+ export declare const ADMIN_NOTIFIED = 'admin-notified';
20
21
 
21
- // @public (undocumented)
22
- type Comment_2 = {
22
+ declare type Comment_2 = {
23
23
  format: 'plain_text' | 'adf';
24
24
  value: string;
25
25
  };
26
26
  export { Comment_2 as Comment };
27
27
 
28
- // @public (undocumented)
29
- export type ConfigResponse = {
28
+ export declare type ConfigResponse = {
30
29
  disableSharingToEmails?: boolean;
31
30
  };
32
31
 
33
- // @public (undocumented)
34
- export type Content = {
32
+ export declare type Content = {
35
33
  ari: string;
36
34
  link: string;
37
35
  title: string;
38
36
  type: string;
39
37
  };
40
38
 
41
- // @public (undocumented)
42
- export type DialogContentState = {
39
+ export declare type DialogContentState = {
43
40
  users: OptionData[];
44
41
  comment: Comment_2;
45
42
  };
46
43
 
47
- // @public (undocumented)
48
- export type DialogPlacement = Placement;
44
+ export declare type DialogPlacement = Placement;
49
45
 
50
- // @public (undocumented)
51
- export type Flag = {
46
+ export declare type Flag = {
52
47
  appearance: 'success';
53
48
  title: MessageDescriptor;
54
49
  type: FlagType;
55
50
  };
56
51
 
57
- // @public (undocumented)
58
- export type FlagType = 'object-shared' | 'admin-notified';
52
+ export declare type FlagType = 'object-shared' | 'admin-notified';
59
53
 
60
- // @public (undocumented)
61
- export type FormChildrenArgs<T> = {
54
+ export declare type FormChildrenArgs<T> = {
62
55
  formProps: React.DetailedHTMLProps<
63
56
  React.FormHTMLAttributes<HTMLFormElement>,
64
57
  HTMLFormElement
@@ -66,35 +59,42 @@ export type FormChildrenArgs<T> = {
66
59
  getValues: () => T;
67
60
  };
68
61
 
69
- // @public (undocumented)
70
- export type KeysOfType<T, TProp> = {
62
+ declare type Integration = {
63
+ type: string;
64
+ Icon: React.ComponentType;
65
+ Content: React.ComponentType<IntegrationContentProps>;
66
+ };
67
+
68
+ declare type IntegrationContentProps = {
69
+ onClose: () => void;
70
+ changeTab?: (index: TabType) => void;
71
+ };
72
+
73
+ declare type IntegrationMode = 'tabs' | 'split' | 'off';
74
+
75
+ export declare type KeysOfType<T, TProp> = {
71
76
  [P in keyof T]: T[P] extends TProp ? P : never;
72
77
  }[keyof T];
73
78
 
74
- // @public (undocumented)
75
- export type MessageDescriptor = {
79
+ export declare type MessageDescriptor = {
76
80
  id: string;
77
81
  description: string;
78
82
  defaultMessage: string;
79
83
  };
80
84
 
81
- // @public (undocumented)
82
- export type MetaData = {
85
+ export declare type MetaData = {
83
86
  productId: string;
84
87
  atlOriginId: string;
85
88
  shareeAction?: 'view' | 'edit';
86
89
  };
87
90
 
88
- // @public (undocumented)
89
- export const OBJECT_SHARED = 'object-shared';
91
+ export declare const OBJECT_SHARED = 'object-shared';
90
92
 
91
- // @public (undocumented)
92
- export type OriginAnalyticAttributes = {
93
+ export declare type OriginAnalyticAttributes = {
93
94
  hasGeneratedId: boolean;
94
95
  };
95
96
 
96
- // @public (undocumented)
97
- export type OriginTracing = {
97
+ export declare type OriginTracing = {
98
98
  id: string;
99
99
  addToUrl: (link: string) => string;
100
100
  toAnalyticsAttributes: (
@@ -102,23 +102,20 @@ export type OriginTracing = {
102
102
  ) => OriginTracingWithIdGenerated | OriginTracingForSubSequentEvents;
103
103
  };
104
104
 
105
- // @public (undocumented)
106
- export type OriginTracingFactory = () => OriginTracing;
105
+ export declare type OriginTracingFactory = () => OriginTracing;
107
106
 
108
- // @public (undocumented)
109
- export type OriginTracingForSubSequentEvents = {
107
+ export declare type OriginTracingForSubSequentEvents = {
110
108
  originId: string;
111
109
  originProduct: string;
112
110
  };
113
111
 
114
- // @public (undocumented)
115
- export type OriginTracingWithIdGenerated = {
112
+ export declare type OriginTracingWithIdGenerated = {
116
113
  originIdGenerated: string;
117
114
  originProduct: string;
118
115
  };
119
116
 
120
- // @public
121
- export type ProductId =
117
+ /** Product ID (Canonical ID) in ARI of the share request */
118
+ export declare type ProductId =
122
119
  | 'bitbucket'
123
120
  | 'confluence'
124
121
  | 'jira-addon'
@@ -131,11 +128,9 @@ export type ProductId =
131
128
  | 'jira-unknown'
132
129
  | 'trello';
133
130
 
134
- // @public (undocumented)
135
- export type ProductName = 'jira' | 'confluence';
131
+ export declare type ProductName = 'jira' | 'confluence';
136
132
 
137
- // @public (undocumented)
138
- export type RenderCustomTriggerButton = (
133
+ export declare type RenderCustomTriggerButton = (
139
134
  args: {
140
135
  error?: ShareError;
141
136
  isDisabled?: boolean;
@@ -145,17 +140,27 @@ export type RenderCustomTriggerButton = (
145
140
  triggerProps: TriggerProps,
146
141
  ) => React.ReactNode;
147
142
 
148
- // @public (undocumented)
149
- export type ShareButtonStyle = 'icon-only' | 'icon-with-text' | 'text-only';
150
-
151
- // @public (undocumented)
152
- export type ShareContentState = {
143
+ export declare type ShareButtonStyle =
144
+ | 'icon-only'
145
+ | 'icon-with-text'
146
+ | 'text-only';
147
+
148
+ declare interface ShareClient {
149
+ share(
150
+ content: Content,
151
+ recipients: User[],
152
+ metadata: MetaData,
153
+ comment?: Comment_2,
154
+ ): Promise<ShareResponse>;
155
+ getConfig(cloudId: string): Promise<ConfigResponse>;
156
+ }
157
+
158
+ export declare type ShareContentState = {
153
159
  users: User[];
154
160
  comment?: Comment_2;
155
161
  };
156
162
 
157
- // @public (undocumented)
158
- export const ShareDialogContainer: React_2.ForwardRefExoticComponent<
163
+ export declare const ShareDialogContainer: React_2.ForwardRefExoticComponent<
159
164
  Pick<
160
165
  Omit<
161
166
  WithAnalyticsEventsProps & ShareDialogContainerProps,
@@ -225,43 +230,125 @@ export const ShareDialogContainer: React_2.ForwardRefExoticComponent<
225
230
  React_2.RefAttributes<any>
226
231
  >;
227
232
 
228
- // @public (undocumented)
229
- export type ShareDialogContainerProps = {
233
+ export declare type ShareDialogContainerProps = {
230
234
  onTriggerButtonClick?: () => void;
231
235
  onDialogOpen?: () => void;
232
236
  onDialogClose?: () => void;
233
237
  isAutoOpenDialog?: boolean;
238
+ /** Share service client implementation that gets share configs and performs share.
239
+ * Optional, a default one is provided. */
234
240
  shareClient?: ShareClient;
241
+ /** URL Shortener service client implementation that may shorten links for copy.
242
+ * Optional, a default one is provided. */
235
243
  urlShortenerClient?: UrlShortenerClient;
244
+ /** Data provided to the `urlShortenerClient` to shorten the shared URL.
245
+ * If it is not provided, the link will not be shortened.
246
+ * If link shortening fails, the full URL will be shared instead. */
236
247
  shortLinkData?: ShortenRequest;
248
+ /** Cloud ID of the instance.
249
+ * Note: we assume this props is stable. */
237
250
  cloudId: string;
251
+ /** Organisation ID of the instance. */
238
252
  orgId?: string;
253
+ /** Placement of the modal to the trigger button. */
239
254
  dialogPlacement?: DialogPlacement;
255
+ /**
256
+ * Z-index that the popup should be displayed in.
257
+ * This is passed to the portal component.
258
+ * Defaults to `layers.modal()` from `@atlaskit/theme`.
259
+ */
240
260
  dialogZIndex?: number;
261
+ /** Transform function to provide custom formatted copy link.
262
+ * Optional, a default one is provided. */
241
263
  formatCopyLink?: (origin: OriginTracing, link: string) => string;
264
+ /** Function used to load users options asynchronously. Not needed if smart user picker is enabled. */
242
265
  loadUserOptions?: LoadOptions;
266
+ /** Factory function to generate new Origin Tracing instance. */
243
267
  originTracingFactory: OriginTracingFactory;
268
+ /** Product ID (Canonical ID) in ARI of the share request.
269
+ * Note: we assume this props is stable. */
244
270
  productId: ProductId;
271
+ /** Render function for a custom Share Dialog Trigger Button. */
245
272
  renderCustomTriggerButton?: RenderCustomTriggerButton;
273
+ /** Atlassian Resource Identifier of a Site resource to be shared. */
246
274
  shareAri: string;
275
+ /** Content Type of the resource to be shared. It will also affect on the successful share message in the flag. A pre-defined list as follows:*/
276
+ /** blogpost */
277
+ /** board */
278
+ /** calendar */
279
+ /** draft */
280
+ /** filter */
281
+ /** issue */
282
+ /** media */
283
+ /** page */
284
+ /** project */
285
+ /** pullrequest */
286
+ /** question */
287
+ /** report */
288
+ /** repository */
289
+ /** request */
290
+ /** roadmap */
291
+ /** site */
292
+ /** space */
293
+ /** Any other unlisted type will have a default message of "Link shared". */
247
294
  shareContentType: string;
295
+ /** Link of the resource to be shared (should NOT includes origin tracing).
296
+ * Optional, the current page URL is used by default. */
248
297
  shareLink?: string;
298
+ /** Title of the resource to be shared that will be sent in notifications. */
249
299
  shareTitle: string;
300
+ /** Title of the share modal. */
250
301
  shareFormTitle?: React.ReactNode;
302
+ /** Copy for helper message to be displayed under share form input box. */
251
303
  shareFormHelperMessage?: string;
304
+ /** To enable closing the modal on escape key press. */
252
305
  shouldCloseOnEscapePress?: boolean;
306
+ /**
307
+ * Callback function for showing successful share flag(s) with a parameter providing details of the flag, including the type of the message with a localized default title
308
+ * This package has an opinion on showing flag(s) upon successful share, and Flag system is NOT provided. Instead, showFlag prop is available for this purpose.
309
+ */
253
310
  showFlags: (flags: Array<Flag>) => void;
311
+ /**
312
+ * Power the user picker with smarts. To enable smart user picker, the following props are used:
313
+ * - `product`: 'jira' or 'confluence'
314
+ * - `loggedInAccountId`: if not provided, defaults to obtaining from request context
315
+ * - `cloudId`
316
+ */
254
317
  enableSmartUserPicker?: boolean;
318
+ /**
319
+ * The userId of the sharer. If not provided, smart user picker
320
+ * defaults it to the value 'Context'
321
+ * which will tell the recommendation service to extract the
322
+ * value from the request context.
323
+ */
255
324
  loggedInAccountId?: string;
325
+ /** Appearance of the share modal trigger button */
256
326
  triggerButtonAppearance?: Appearance;
327
+ /** Share button Icon */
257
328
  triggerButtonIcon?: React.ComponentType<IconProps>;
329
+ /** Style of the share modal trigger button. */
258
330
  triggerButtonStyle?: ShareButtonStyle;
331
+ /** Position of the tooltip on share modal trigger button. */
259
332
  triggerButtonTooltipPosition?: TooltipPosition;
333
+ /** Custom text of the tooltip on share modal trigger button. */
260
334
  triggerButtonTooltipText?: React.ReactNode;
335
+ /** Message to be appended to the modal. */
261
336
  bottomMessage?: React.ReactNode;
337
+ /** @deprecated Use the `shortLinkData` prop instead.
338
+ *
339
+ * Whether we should use the Atlassian Url Shortener or not.
340
+ * Note that all products may not be supported. */
262
341
  useUrlShortener?: boolean;
342
+ /** Action that will be performed by the recipient when he/she receives the notification. */
263
343
  shareeAction?: 'view' | 'edit';
344
+ /**
345
+ * Optional, this prop can be `jira` or `confluence`. Default value is `confluence`.
346
+ * We use this prop to control different text messages in UI.
347
+ */
264
348
  product?: ProductName;
349
+ /**
350
+ * Footer for the share dialog.
351
+ */
265
352
  customFooter?: React.ReactNode;
266
353
  onUserSelectionChange?: (value: Value) => void;
267
354
  shareFieldsFooter?: React.ReactNode;
@@ -269,45 +356,67 @@ export type ShareDialogContainerProps = {
269
356
  isPublicLink?: boolean;
270
357
  integrationMode?: IntegrationMode;
271
358
  shareIntegrations?: Array<Integration>;
359
+ /**
360
+ * Optionally sets a tabIndex value if you need to set focus
361
+ */
272
362
  tabIndex?: number;
273
363
  copyTooltipText?: string;
274
364
  };
275
365
 
276
- // @public (undocumented)
277
- export type ShareError = {
366
+ export declare type ShareError = {
278
367
  message: string;
279
368
  };
280
369
 
281
- // @public (undocumented)
282
- export type ShareRequest = (
370
+ export declare type ShareRequest = (
283
371
  content: Content,
284
372
  recipients: User[],
285
373
  metadata: MetaData,
286
374
  comment?: Comment_2,
287
375
  ) => Promise<ShareResponse>;
288
376
 
289
- // @public (undocumented)
290
- export type ShareResponse = {
377
+ export declare type ShareResponse = {
291
378
  shareRequestId: string;
292
379
  };
293
380
 
294
- // @public (undocumented)
295
- export type TooltipPosition = 'top' | 'right' | 'bottom' | 'left' | 'mouse';
381
+ declare interface ShortenRequest {
382
+ cloudId?: string;
383
+ product: string;
384
+ type: string;
385
+ params: Record<string, string>;
386
+ query?: string;
387
+ }
388
+
389
+ declare interface ShortenResponse {
390
+ shortUrl: string;
391
+ }
392
+
393
+ declare enum TabType {
394
+ default = 0,
395
+ Slack = 1,
396
+ }
397
+
398
+ export declare type TooltipPosition =
399
+ | 'top'
400
+ | 'right'
401
+ | 'bottom'
402
+ | 'left'
403
+ | 'mouse';
404
+
405
+ declare interface UrlShortenerClient {
406
+ shorten(data: ShortenRequest): Promise<ShortenResponse>;
407
+ }
296
408
 
297
- // @public (undocumented)
298
- export type User = UserWithId | UserWithEmail;
409
+ export declare type User = UserWithId | UserWithEmail;
299
410
 
300
- // @public (undocumented)
301
- export type UserWithEmail = {
411
+ export declare type UserWithEmail = {
302
412
  type: 'user';
303
413
  email: string;
304
414
  };
305
415
 
306
- // @public (undocumented)
307
- export type UserWithId = {
416
+ export declare type UserWithId = {
308
417
  type: 'user' | 'group' | 'team';
309
418
  id: string;
310
419
  };
311
420
 
312
- // (No @packageDocumentation comment for this package)
421
+ export {};
313
422
  ```