@atlaskit/share 3.2.6 → 3.3.0

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