Skip to content

Commit ba9a3a1

Browse files
docs: update spectrum-ts documentation for v1.18.0 (#79)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 47854c8 commit ba9a3a1

3 files changed

Lines changed: 121 additions & 19 deletions

File tree

docs-src/spectrum-ts/providers/imessage.mdx.vel

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,60 @@ Background UI may not appear in these cases:
258258
The string `"clear"` is a reserved sentinel. If you have a file literally named `clear` with no extension, pass `"./clear"` or load it as a `Buffer`.
259259
</Note>
260260

261+
## Mini-app cards
262+
263+
Send a customized iMessage mini-app card — a remote-only rich bubble that shows app metadata, a deep link, and a visual layout. Import `customizedMiniApp` from the iMessage provider:
264+
265+
```ts
266+
import { customizedMiniApp } from "spectrum-ts/providers/imessage";
267+
268+
const sent = await space.send(customizedMiniApp({
269+
appName: "My App",
270+
extensionBundleId: "com.example.myapp.imessage",
271+
teamId: "ABCDE12345",
272+
url: "https://example.com/deep-link",
273+
layout: {
274+
caption: "Check this out",
275+
subcaption: "Tap to open",
276+
},
277+
}));
278+
```
279+
280+
`space.send(customizedMiniApp(...))` returns the sent message record — unlike `background` and `read`, mini-app cards are real outbound messages.
281+
282+
`appStoreId` is optional. Omit it to send a card whose extension isn't published on the App Store; when set, recipients without the extension are directed to its App Store entry.
283+
284+
<AccordionGroup>
285+
<Accordion title="CustomizedMiniAppInput" description="Fields for building a mini-app card.">
286+
| Field | Type | Description |
287+
|---|---|---|
288+
| `appName` | `string` | Display name of the owning app, shown by Messages fallback UI. |
289+
| `appStoreId` | `number` (optional) | Apple App Store numeric ID. Omit for unpublished extensions. |
290+
| `extensionBundleId` | `string` | Bundle identifier of the iMessage extension target. |
291+
| `layout` | `CustomizedMiniAppLayout` | Visible card layout — see below. |
292+
| `teamId` | `string` | 10-character uppercase alphanumeric Apple Team ID. |
293+
| `url` | `string` | Absolute URL delivered to the installed extension on tap. |
294+
</Accordion>
295+
<Accordion title="CustomizedMiniAppLayout" description="Visible layout of a mini-app card. Mirrors Apple's MSMessageTemplateLayout.">
296+
| Field | Type | Description |
297+
|---|---|---|
298+
| `caption` | `string` (optional) | Primary caption text. |
299+
| `subcaption` | `string` (optional) | Secondary caption text. |
300+
| `trailingCaption` | `string` (optional) | Right-aligned primary text. |
301+
| `trailingSubcaption` | `string` (optional) | Right-aligned secondary text. |
302+
| `image` | `Uint8Array` (optional) | Image data for the card. Must be set with `imageTitle`. |
303+
| `imageTitle` | `string` (optional) | Title for the image. Must be set with `image`. |
304+
| `imageSubtitle` | `string` (optional) | Subtitle for the image. Requires `image`. |
305+
| `summary` | `string` (optional) | Fallback text for surfaces that can't render the card (notifications, lock screen). |
306+
307+
At least one of `caption`, `subcaption`, `trailingCaption`, `trailingSubcaption`, or `image` must be set.
308+
</Accordion>
309+
</AccordionGroup>
310+
311+
<Note>
312+
Mini-app cards require cloud or dedicated mode. In local mode, `customizedMiniApp()` throws an `UnsupportedError`.
313+
</Note>
314+
261315
## Fetching attachments
262316

263317
Retrieve an attachment by its iMessage GUID using `getAttachment` on the narrowed platform instance. The returned `Attachment` is lazy — `.read()` and `.stream()` each trigger an independent download, so cache `.read()` if you need the bytes more than once.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"devDependencies": {
1515
"@antfu/eslint-config": "^4.19.0",
16-
"@photon-ai/advanced-imessage": "^0.10.1",
16+
"@photon-ai/advanced-imessage": "^0.11.0",
1717
"@photon-ai/advanced-imessage-kit": "^1.14.3",
1818
"@photon-ai/imessage-kit": "^2.1.2",
1919
"@photon-ai/whatsapp-business": "^0.1.1",
@@ -28,7 +28,7 @@
2828
"eslint-plugin-format": "^2.0.1",
2929
"husky": "^9.1.7",
3030
"oxfmt": "^0.44.0",
31-
"spectrum-ts": "1.16.1",
31+
"spectrum-ts": "1.18.0",
3232
"tsx": "^4.21.0",
3333
"typescript": "^5.9.3"
3434
}

pnpm-lock.yaml

Lines changed: 65 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)