@startsimpli/integrations 0.2.135 → 0.2.136

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startsimpli/integrations",
3
- "version": "0.2.135",
3
+ "version": "0.2.136",
4
4
  "description": "Provider-agnostic types, API clients, hooks, and UI primitives for email + calendar integrations across StartSimpli apps, plus foundry customer email (subpath ./comms).",
5
5
  "license": "MIT",
6
6
  "homepage": "https://startsimpli.com",
@@ -50,9 +50,9 @@
50
50
  "react-native": ">=0.74.0",
51
51
  "@startsimpli/ui-native": ">=0.1.12",
52
52
  "react-native-safe-area-context": ">=4.0.0",
53
+ "@startsimpli/ui": "^0.4.171",
53
54
  "@startsimpli/auth": "^0.4.50",
54
- "@startsimpli/utils": "^0.4.17",
55
- "@startsimpli/ui": "^0.4.171"
55
+ "@startsimpli/utils": "^0.4.17"
56
56
  },
57
57
  "peerDependenciesMeta": {
58
58
  "react": {
@@ -11,7 +11,7 @@
11
11
  * - with a host-provided link target, "Preview as inbox" / step "Preview" are links to it.
12
12
  */
13
13
  import * as React from 'react';
14
- import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from 'vitest';
14
+ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
15
15
  import { render, screen, within } from '@testing-library/react';
16
16
  import userEvent from '@testing-library/user-event';
17
17
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
@@ -87,6 +87,15 @@ describe('EmailPreview (the viewer itself)', () => {
87
87
  expect(pre.textContent).toContain('\nLine two');
88
88
  });
89
89
 
90
+ it('has a Copy link button that puts this page\'s address on the clipboard', async () => {
91
+ const writeText = vi.fn().mockResolvedValue(undefined);
92
+ Object.defineProperty(navigator, 'clipboard', { value: { writeText }, configurable: true });
93
+ view();
94
+ await userEvent.click(screen.getByRole('button', { name: /copy link/i }));
95
+ expect(writeText).toHaveBeenCalledWith(window.location.href);
96
+ expect(await screen.findByRole('button', { name: /link copied/i })).toBeInTheDocument();
97
+ });
98
+
90
99
  it('calls onBack from the back link when given, without following the href', async () => {
91
100
  let back = 0;
92
101
  view({ onBack: () => { back += 1; } });
@@ -106,6 +106,13 @@ export function EmailPreview({
106
106
  }: EmailPreviewProps): ReactElement {
107
107
  const [width, setWidth] = useState<Width>('desktop');
108
108
  const [part, setPart] = useState<Part>('email');
109
+ const [copied, setCopied] = useState(false);
110
+ const copyLink = useCallback(() => {
111
+ void navigator.clipboard?.writeText(window.location.href).then(() => {
112
+ setCopied(true);
113
+ window.setTimeout(() => setCopied(false), 2000);
114
+ });
115
+ }, []);
109
116
  const px = WIDTH_PX[width];
110
117
  const device = width === 'mobile' ? 'rounded-[28px] border-8 border-neutral-800' : 'shadow-sm';
111
118
 
@@ -136,6 +143,9 @@ export function EmailPreview({
136
143
  options={[['email', 'Email'], ['text', 'Plain text']] as const}
137
144
  onChange={setPart}
138
145
  />
146
+ <Button type="button" variant="outline" size="sm" onClick={copyLink}>
147
+ {copied ? 'Link copied' : 'Copy link'}
148
+ </Button>
139
149
  </div>
140
150
  </div>
141
151
 
@@ -264,6 +264,8 @@ export type SendMode = 'fixed' | 'recipient_local';
264
264
 
265
265
  export interface Draft {
266
266
  id: string;
267
+ /** The foundry command-center page that shows this draft (the viewer route). */
268
+ view_url?: string;
267
269
  program_key: string;
268
270
  subject: string;
269
271
  preheader: string;