@punks/cli 2.3.2 → 2.4.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.
Files changed (129) hide show
  1. package/dist/BASELINE_CHANGELOG.md +50 -0
  2. package/dist/CHANGELOG.md +50 -0
  3. package/dist/index.js +216 -221
  4. package/dist/skills/agnostic/cli/dp-cli/SKILL.md +1 -12
  5. package/dist/skills/agnostic/cli/dp-cli/references/commands.md +22 -18
  6. package/dist/skills/agnostic/cli/dp-cli/references/post-command-flow.md +15 -19
  7. package/dist/skills/agnostic/planning/wayfinder/SKILL.md +42 -0
  8. package/dist/skills/agnostic/quality/review/SKILL.md +89 -0
  9. package/dist/skills/agnostic/requirements/write-backlog/EXAMPLES.md +22 -0
  10. package/dist/skills/agnostic/requirements/write-backlog/REFERENCE.md +110 -23
  11. package/dist/skills/agnostic/requirements/write-backlog/SKILL.md +30 -14
  12. package/dist/skills/agnostic/requirements/write-backlog/assets/concepts/backlog-model.md +74 -7
  13. package/dist/skills/agnostic/requirements/write-backlog/assets/concepts/story-shape.md +108 -2
  14. package/dist/skills/agnostic/requirements/write-backlog/assets/providers/azure-devops-create-payload.md +29 -3
  15. package/dist/skills/agnostic/requirements/write-backlog/assets/providers/github-projects-create-payload.md +43 -7
  16. package/dist/skills/agnostic/requirements/write-backlog/assets/providers/linear-create-payload.md +25 -3
  17. package/dist/skills/agnostic/requirements/write-backlog/assets/providers/monday-create-payload.md +63 -14
  18. package/dist/skills/agnostic/research/parallel-research/SKILL.md +5 -2
  19. package/dist/skills/frameworks/expo/add-app-clip/SKILL.md +280 -0
  20. package/dist/skills/frameworks/expo/add-app-clip/agents/openai.yaml +4 -0
  21. package/dist/skills/frameworks/expo/add-app-clip/references/native-module.md +96 -0
  22. package/dist/skills/frameworks/expo/building-native-ui/SKILL.md +377 -0
  23. package/dist/skills/frameworks/expo/building-native-ui/agents/openai.yaml +4 -0
  24. package/dist/skills/frameworks/expo/building-native-ui/references/animations.md +220 -0
  25. package/dist/skills/frameworks/expo/building-native-ui/references/controls.md +270 -0
  26. package/dist/skills/frameworks/expo/building-native-ui/references/form-sheet.md +253 -0
  27. package/dist/skills/frameworks/expo/building-native-ui/references/gradients.md +106 -0
  28. package/dist/skills/frameworks/expo/building-native-ui/references/icons.md +213 -0
  29. package/dist/skills/frameworks/expo/building-native-ui/references/media.md +198 -0
  30. package/dist/skills/frameworks/expo/building-native-ui/references/route-structure.md +229 -0
  31. package/dist/skills/frameworks/expo/building-native-ui/references/search.md +248 -0
  32. package/dist/skills/frameworks/expo/building-native-ui/references/storage.md +121 -0
  33. package/dist/skills/frameworks/expo/building-native-ui/references/tabs.md +433 -0
  34. package/dist/skills/frameworks/expo/building-native-ui/references/toolbar-and-headers.md +284 -0
  35. package/dist/skills/frameworks/expo/building-native-ui/references/visual-effects.md +197 -0
  36. package/dist/skills/frameworks/expo/building-native-ui/references/webgpu-three.md +605 -0
  37. package/dist/skills/frameworks/expo/building-native-ui/references/zoom-transitions.md +158 -0
  38. package/dist/skills/frameworks/expo/eas-simulator/SKILL.md +154 -0
  39. package/dist/skills/frameworks/expo/eas-simulator/references/controllers.md +67 -0
  40. package/dist/skills/frameworks/expo/eas-simulator/references/run-your-app.md +185 -0
  41. package/dist/skills/frameworks/expo/eas-simulator/references/troubleshooting.md +38 -0
  42. package/dist/skills/frameworks/expo/eas-update-insights/SKILL.md +228 -0
  43. package/dist/skills/frameworks/expo/eas-update-insights/agents/openai.yaml +4 -0
  44. package/dist/skills/frameworks/expo/eas-update-insights/references/channel-insights-schema.md +47 -0
  45. package/dist/skills/frameworks/expo/eas-update-insights/references/update-insights-schema.md +69 -0
  46. package/dist/skills/frameworks/expo/expo-api-routes/SKILL.md +368 -0
  47. package/dist/skills/frameworks/expo/expo-api-routes/agents/openai.yaml +4 -0
  48. package/dist/skills/frameworks/expo/expo-brownfield/SKILL.md +54 -0
  49. package/dist/skills/frameworks/expo/expo-brownfield/agents/openai.yaml +4 -0
  50. package/dist/skills/frameworks/expo/expo-brownfield/references/brownfield-integrated.md +526 -0
  51. package/dist/skills/frameworks/expo/expo-brownfield/references/brownfield-isolated.md +402 -0
  52. package/dist/skills/frameworks/expo/expo-brownfield/references/comparison.md +63 -0
  53. package/dist/skills/frameworks/expo/expo-brownfield/references/troubleshooting.md +88 -0
  54. package/dist/skills/frameworks/expo/expo-cicd-workflows/SKILL.md +92 -0
  55. package/dist/skills/frameworks/expo/expo-cicd-workflows/agents/openai.yaml +4 -0
  56. package/dist/skills/frameworks/expo/expo-cicd-workflows/scripts/fetch.js +109 -0
  57. package/dist/skills/frameworks/expo/expo-cicd-workflows/scripts/package.json +11 -0
  58. package/dist/skills/frameworks/expo/expo-cicd-workflows/scripts/validate.js +84 -0
  59. package/dist/skills/frameworks/expo/expo-deployment/SKILL.md +167 -0
  60. package/dist/skills/frameworks/expo/expo-deployment/agents/openai.yaml +4 -0
  61. package/dist/skills/frameworks/expo/expo-deployment/references/app-store-metadata.md +497 -0
  62. package/dist/skills/frameworks/expo/expo-deployment/references/ios-app-store.md +371 -0
  63. package/dist/skills/frameworks/expo/expo-deployment/references/play-store.md +246 -0
  64. package/dist/skills/frameworks/expo/expo-deployment/references/testflight.md +58 -0
  65. package/dist/skills/frameworks/expo/expo-deployment/references/workflows.md +160 -0
  66. package/dist/skills/frameworks/expo/expo-dev-client/SKILL.md +172 -0
  67. package/dist/skills/frameworks/expo/expo-dev-client/agents/openai.yaml +4 -0
  68. package/dist/skills/frameworks/expo/expo-examples/SKILL.md +97 -0
  69. package/dist/skills/frameworks/expo/expo-examples/references/catalog.md +105 -0
  70. package/dist/skills/frameworks/expo/expo-module/SKILL.md +141 -0
  71. package/dist/skills/frameworks/expo/expo-module/agents/openai.yaml +4 -0
  72. package/dist/skills/frameworks/expo/expo-module/references/config-plugin.md +90 -0
  73. package/dist/skills/frameworks/expo/expo-module/references/create-expo-module.md +206 -0
  74. package/dist/skills/frameworks/expo/expo-module/references/lifecycle.md +127 -0
  75. package/dist/skills/frameworks/expo/expo-module/references/module-config.md +48 -0
  76. package/dist/skills/frameworks/expo/expo-module/references/native-module.md +286 -0
  77. package/dist/skills/frameworks/expo/expo-module/references/native-view.md +171 -0
  78. package/dist/skills/frameworks/expo/expo-observe/SKILL.md +29 -0
  79. package/dist/skills/frameworks/expo/expo-observe/references/metrics.md +47 -0
  80. package/dist/skills/frameworks/expo/expo-observe/references/queries.md +342 -0
  81. package/dist/skills/frameworks/expo/expo-observe/references/setup.md +255 -0
  82. package/dist/skills/frameworks/expo/expo-skill-eval/SKILL.md +314 -0
  83. package/dist/skills/frameworks/expo/expo-skill-eval/agents/visual-grader.md +52 -0
  84. package/dist/skills/frameworks/expo/expo-skill-eval/references/design-rubric.md +45 -0
  85. package/dist/skills/frameworks/expo/expo-skill-eval/references/runtime-matrix.md +33 -0
  86. package/dist/skills/frameworks/expo/expo-skill-eval/scripts/check-static.sh +64 -0
  87. package/dist/skills/frameworks/expo/expo-skill-eval/scripts/clean-fixture.sh +56 -0
  88. package/dist/skills/frameworks/expo/expo-skill-eval/scripts/generate_viewer.py +450 -0
  89. package/dist/skills/frameworks/expo/expo-skill-eval/scripts/latest-sdk.sh +46 -0
  90. package/dist/skills/frameworks/expo/expo-skill-eval/scripts/make-fixture.sh +95 -0
  91. package/dist/skills/frameworks/expo/expo-skill-eval/scripts/make-workspace.sh +31 -0
  92. package/dist/skills/frameworks/expo/expo-skill-eval/scripts/snapshot-android.sh +284 -0
  93. package/dist/skills/frameworks/expo/expo-skill-eval/scripts/snapshot-ios.sh +132 -0
  94. package/dist/skills/frameworks/expo/expo-skill-eval/scripts/snapshot-web.sh +61 -0
  95. package/dist/skills/frameworks/expo/expo-tailwind-setup/SKILL.md +480 -0
  96. package/dist/skills/frameworks/expo/expo-tailwind-setup/agents/openai.yaml +4 -0
  97. package/dist/skills/frameworks/expo/expo-ui/SKILL.md +47 -0
  98. package/dist/skills/frameworks/expo/expo-ui/agents/openai.yaml +4 -0
  99. package/dist/skills/frameworks/expo/expo-ui/references/drop-in-replacements.md +27 -0
  100. package/dist/skills/frameworks/expo/expo-ui/references/jetpack-compose.md +73 -0
  101. package/dist/skills/frameworks/expo/expo-ui/references/swift-ui.md +73 -0
  102. package/dist/skills/frameworks/expo/expo-ui/references/universal.md +73 -0
  103. package/dist/skills/frameworks/expo/expo-ui/scripts/list-components.js +193 -0
  104. package/dist/skills/frameworks/expo/native-data-fetching/SKILL.md +505 -0
  105. package/dist/skills/frameworks/expo/native-data-fetching/agents/openai.yaml +4 -0
  106. package/dist/skills/frameworks/expo/native-data-fetching/references/expo-router-loaders.md +341 -0
  107. package/dist/skills/frameworks/expo/upgrading-expo/SKILL.md +134 -0
  108. package/dist/skills/frameworks/expo/upgrading-expo/agents/openai.yaml +4 -0
  109. package/dist/skills/frameworks/expo/upgrading-expo/references/expo-av-to-audio.md +132 -0
  110. package/dist/skills/frameworks/expo/upgrading-expo/references/expo-av-to-video.md +160 -0
  111. package/dist/skills/frameworks/expo/upgrading-expo/references/native-tabs.md +124 -0
  112. package/dist/skills/frameworks/expo/upgrading-expo/references/new-architecture.md +79 -0
  113. package/dist/skills/frameworks/expo/upgrading-expo/references/react-19.md +79 -0
  114. package/dist/skills/frameworks/expo/upgrading-expo/references/react-compiler.md +59 -0
  115. package/dist/skills/frameworks/expo/upgrading-expo/references/react-navigation-to-expo-router.md +61 -0
  116. package/dist/skills/frameworks/expo/use-dom/SKILL.md +417 -0
  117. package/dist/skills/frameworks/expo/use-dom/agents/openai.yaml +4 -0
  118. package/dist/skills/frameworks/expo/web-to-native/SKILL.md +83 -0
  119. package/dist/skills/frameworks/expo/web-to-native/references/false-friends.md +119 -0
  120. package/dist/skills/frameworks/expo/web-to-native/references/native-patterns.md +39 -0
  121. package/dist/skills/frameworks/expo/web-to-native/references/run-as-goal.md +48 -0
  122. package/dist/skills/frameworks/expo/web-to-native/references/verify-on-device.md +45 -0
  123. package/dist/skills/phases/finder-phase/SKILL.md +52 -0
  124. package/dist/skills/phases/finder-phase/references/frontier-lifecycle.md +70 -0
  125. package/dist/skills/phases/finder-phase/references/root-routing.md +29 -0
  126. package/dist/skills/phases/goalify/SKILL.md +10 -7
  127. package/dist/skills/phases/review-phase/REFERENCE.md +36 -3
  128. package/dist/skills/phases/review-phase/SKILL.md +18 -11
  129. package/package.json +1 -1
@@ -0,0 +1,280 @@
1
+ ---
2
+ name: add-app-clip
3
+ description: Add an iOS App Clip target to an Expo app. Use when the user mentions App Clip, AASA, apple-app-site-association, appclips, smart app banner, or wants to ship a lightweight iOS Clip invoked from a URL alongside their parent app.
4
+ ---
5
+
6
+ # Add an App Clip to an Expo App
7
+
8
+ Adds an iOS App Clip target to an Expo project. The Clip lives in `targets/clip/`, ships alongside the parent app, and is invoked from a URL on the app's domain via an Apple App Site Association (AASA) file.
9
+
10
+ The parent app's bundle ID becomes `com.<username>.<app-name>` and the Clip's is automatically derived as `<parent>.clip` (e.g. `com.bacon.may20.clip`).
11
+
12
+ ## 1. Set `bundleIdentifier` and `appleTeamId`
13
+
14
+ `bun create target` warns if these are missing. Add to `app.json`:
15
+
16
+ ```json
17
+ {
18
+ "expo": {
19
+ "ios": {
20
+ "bundleIdentifier": "com.<username>.<app-name>",
21
+ "appleTeamId": "XX57RJ5UTD"
22
+ }
23
+ }
24
+ }
25
+ ```
26
+
27
+ ## 2. Add the App Clip target
28
+
29
+ ```sh
30
+ bun create target clip
31
+ ```
32
+
33
+ This installs [`@bacons/apple-targets`](https://github.com/EvanBacon/expo-apple-targets), adds it to the `plugins` array in `app.json`, and writes:
34
+
35
+ - `targets/clip/expo-target.config.js` — the target's config plugin
36
+ - `targets/clip/Info.plist` — Clip Info.plist
37
+ - `targets/clip/AppDelegate.swift`, `Assets.xcassets`, etc.
38
+
39
+ Pick a good icon or reuse the existing one defined in the app — check it with `bunx expo config` under the `icon` or `ios.icon` key.
40
+
41
+ ## 3. Wire up associated domains
42
+
43
+ The parent app and the Clip each need the Associated Domains entitlement pointing at the domain that hosts the AASA file.
44
+
45
+ In `app.json`, add both `applinks:` (parent) and `appclips:` (Clip invocation) entries:
46
+
47
+ ```json
48
+ {
49
+ "expo": {
50
+ "ios": {
51
+ "associatedDomains": [
52
+ "applinks:may20.expo.app",
53
+ "appclips:may20.expo.app"
54
+ ]
55
+ }
56
+ }
57
+ }
58
+ ```
59
+
60
+ In `targets/clip/expo-target.config.js`, declare the Clip's entitlement:
61
+
62
+ ```js
63
+ /** @type {import('@bacons/apple-targets/app.plugin').ConfigFunction} */
64
+ module.exports = (config) => ({
65
+ type: "clip",
66
+ icon: "https://github.com/expo.png",
67
+ entitlements: {
68
+ "com.apple.developer.associated-domains": ["appclips:may20.expo.app"],
69
+ },
70
+ });
71
+ ```
72
+
73
+ > If you skip this, `expo prebuild` will print: `Apple App Clip may require the associated domains entitlement but none were found`.
74
+
75
+ ## 4. Register bundle IDs and create the App Store entry
76
+
77
+ ```sh
78
+ bunx setup-safari
79
+ ```
80
+
81
+ This logs in to the Apple Developer account, registers `com.bacon.may20`, creates the App Store Connect entry, and prints:
82
+
83
+ - A starter `apple-app-site-association` JSON
84
+ - A `<meta name="apple-itunes-app">` tag with the iTunes app id
85
+ - Team ID, iTunes ID, and Bundle ID
86
+
87
+ ## 5. Host the AASA file
88
+
89
+ App Clips are invoked when iOS fetches `https://<your-domain>/.well-known/apple-app-site-association` and finds a matching `appclips` entry.
90
+
91
+ ```sh
92
+ mkdir -p public/.well-known
93
+ touch public/.well-known/apple-app-site-association
94
+ ```
95
+
96
+ Paste the JSON `setup-safari` printed, but **add an `appclips` block** for the Clip's full app ID (`<TeamID>.<ClipBundleID>`). The output of `setup-safari` only covers the parent app:
97
+
98
+ ```json
99
+ {
100
+ "applinks": {
101
+ "details": [
102
+ {
103
+ "appIDs": ["XX57RJ5UTD.com.bacon.may20"],
104
+ "components": [{ "/": "*", "comment": "Matches all routes" }]
105
+ }
106
+ ]
107
+ },
108
+ "appclips": {
109
+ "apps": ["XX57RJ5UTD.com.bacon.may20.clip"]
110
+ },
111
+ "activitycontinuation": {
112
+ "apps": ["XX57RJ5UTD.com.bacon.may20"]
113
+ },
114
+ "webcredentials": {
115
+ "apps": ["XX57RJ5UTD.com.bacon.may20"]
116
+ }
117
+ }
118
+ ```
119
+
120
+ Notes:
121
+
122
+ - The file has **no extension** and **no `Content-Type` requirements** beyond being served as-is. Expo Router static export serves files in `public/` verbatim.
123
+ - The `appclips` block is what lets a URL on the domain launch the Clip.
124
+ - `webcredentials` is used for sharing credentials between the website, parent app, and the App Clip.
125
+ - `activitycontinuation` is optional and used for sharing the link between mobile and desktop. Must be used with `Head` from expo-router — see https://docs.expo.dev/router/advanced/apple-handoff/
126
+ - Notation and route-disabling details: https://sosumi.ai/documentation/xcode/supporting-associated-domains
127
+
128
+ ## 6. Add the Smart App Banner meta tag
129
+
130
+ Create `src/app/+html.tsx` (Expo Router's HTML shell) and add the tag from `setup-safari`. Create the versioned template if it doesn't exist:
131
+
132
+ ```sh
133
+ bunx expo customize src/app/+html.tsx
134
+ ```
135
+
136
+ Add the meta tag to the `<head>`:
137
+
138
+ ```tsx
139
+ import { ScrollViewStyleReset } from "expo-router/html";
140
+
141
+ export default function Root({ children }: { children: React.ReactNode }) {
142
+ return (
143
+ <html lang="en">
144
+ <head>
145
+ <meta charSet="utf-8" />
146
+ <meta httpEquiv="X-UA-Compatible" content="IE=edge" />
147
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
148
+ <meta name="apple-itunes-app" content="app-id=6771566491" />
149
+ <ScrollViewStyleReset />
150
+ </head>
151
+ <body>{children}</body>
152
+ </html>
153
+ );
154
+ }
155
+ ```
156
+
157
+ To make the website show the App Clip card instead of the install card, use:
158
+
159
+ ```html
160
+ <meta
161
+ name="apple-itunes-app"
162
+ content="app-id=6771566491, app-clip-bundle-id=com.bacon.may20.clip, app-clip-display=card"
163
+ />
164
+ ```
165
+
166
+ ## 7. Deploy the website
167
+
168
+ The AASA file must be live before iOS will trust the association. Use [EAS Hosting](https://docs.expo.dev/eas/hosting/):
169
+
170
+ ```sh
171
+ bunx expo export -p web
172
+ eas deploy --prod
173
+ ```
174
+
175
+ This publishes the site (including `/.well-known/apple-app-site-association`) at `https://<slug>.expo.app`. Verify:
176
+
177
+ ```sh
178
+ curl https://may20.expo.app/.well-known/apple-app-site-association
179
+ ```
180
+
181
+ ## 8. Mirror permissions
182
+
183
+ Inspect the parent app's permissions after prebuild:
184
+
185
+ ```sh
186
+ npx expo config --type introspect
187
+ ```
188
+
189
+ Look at the `infoPlist` object — mirror the permission keys in the App Clip's `Info.plist` so matching APIs can be used from the Clip.
190
+
191
+ Set `deploymentTarget: "17.6"` in the Clip's target config — App Clips have a higher minimum size limit in iOS 17.6.
192
+
193
+ If the app uses push notifications or location services, add to the App Clip's `Info.plist` to request the necessary permissions:
194
+
195
+ ```xml
196
+ <key>NSAppClip</key>
197
+ <dict>
198
+ <key>NSAppClipRequestEphemeralUserNotification</key>
199
+ <false/>
200
+ <key>NSAppClipRequestLocationConfirmation</key>
201
+ <true/>
202
+ </dict>
203
+ ```
204
+
205
+ ## 9. Build and submit to TestFlight
206
+
207
+ ```sh
208
+ bunx testflight
209
+ ```
210
+
211
+ This will:
212
+
213
+ 1. Generate an `eas.json` if missing.
214
+ 2. Set up credentials for **both** targets (parent + Clip). Each gets its own provisioning profile but can share a single Distribution Certificate.
215
+ 3. Sync capabilities — note `Enabled: Associated Domains` for the Clip target.
216
+ 4. Build, upload, and schedule a TestFlight submission.
217
+
218
+ ## 10. Configure App Clip metadata
219
+
220
+ Pull existing App Store metadata to local:
221
+
222
+ ```sh
223
+ eas metadata:pull
224
+ ```
225
+
226
+ Add `apple.appClip` to `store.config.json`. Up to 3 invocation URLs can launch the Clip from a web page:
227
+
228
+ ```json
229
+ {
230
+ "configVersion": 0,
231
+ "apple": {
232
+ "appClip": {
233
+ "defaultExperience": {
234
+ "action": "PLAY",
235
+ "releaseWithAppStoreVersion": true,
236
+ "reviewDetail": {
237
+ "invocationUrls": ["https://may20.expo.app/", null, null]
238
+ },
239
+ "info": {
240
+ "en-US": {
241
+ "subtitle": "Instantly native with Expo",
242
+ "headerImage": "store/apple/app-clip/en-US/asc-app-clip.png"
243
+ }
244
+ }
245
+ }
246
+ }
247
+ }
248
+ }
249
+ ```
250
+
251
+ The `headerImage` must be a 1800x1200 PNG with no opacity.
252
+
253
+ Push back to the store:
254
+
255
+ ```sh
256
+ eas metadata:push
257
+ ```
258
+
259
+ Apple's recommended App Clip metadata guidelines: https://sosumi.ai/documentation/appclip/configuring-the-launch-experience-of-your-app-clip
260
+
261
+ ## What you get
262
+
263
+ - Parent app target: `com.bacon.may20`
264
+ - App Clip target: `com.bacon.may20.clip`, lives in `targets/clip/`
265
+ - AASA hosted at `https://may20.expo.app/.well-known/apple-app-site-association`
266
+ - Smart App Banner meta tag on every web route
267
+ - Every route linked to its native counterpart
268
+ - TestFlight build of the parent app with the Clip embedded
269
+
270
+ Once Apple invokes the Clip from a URL on the domain, iOS opens `targets/clip/`'s entry point which loads the React Native app.
271
+
272
+ ## Native detection (optional)
273
+
274
+ To let JS detect when it's running inside an App Clip and present an install prompt for the full app, create a local Expo module (`bunx create-expo-module --local`) that exposes `navigator.appClip.prompt()`.
275
+
276
+ See [./references/native-module.md](./references/native-module.md) for the Swift module, TypeScript interface, and usage.
277
+
278
+ ## References
279
+
280
+ - ./references/native-module.md — Local Expo module to detect App Clip context and present the SKOverlay install prompt
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Add App Clip"
3
+ short_description: "Add an iOS App Clip target to an Expo app with AASA, associated domains, and TestFlight setup"
4
+ default_prompt: "Use $add-app-clip when adding or reviewing an iOS App Clip target for an Expo app, including bundle IDs, associated domains, AASA files, smart app banners, App Store Connect setup, and TestFlight verification."
@@ -0,0 +1,96 @@
1
+ # Native App Clip detection
2
+
3
+ Create a local Expo module so JS can detect when the app is running inside an App Clip and present the install prompt for the full app.
4
+
5
+ ```sh
6
+ bunx create-expo-module --local
7
+ ```
8
+
9
+ ## Swift module
10
+
11
+ ```swift
12
+ import ExpoModulesCore
13
+ import StoreKit
14
+
15
+ internal class MissingCurrentWindowSceneException: Exception {
16
+ override var reason: String {
17
+ "Cannot determine the current window scene in which to present the modal for requesting a review."
18
+ }
19
+ }
20
+
21
+ internal class MissingContainerURLException: Exception {
22
+ override var reason: String {
23
+ "Cannot determine the container URL."
24
+ }
25
+ }
26
+
27
+ public class AppClipModule: Module {
28
+ private static let isAppClip: Bool = {
29
+ if let infoPlist = Bundle.main.infoDictionary, let _ = infoPlist["NSAppClip"] as? [String: Any] {
30
+ return true
31
+ }
32
+ return false
33
+ }()
34
+
35
+ public func definition() -> ModuleDefinition {
36
+ Name("AppClip")
37
+
38
+ Constant("isAppClip") {
39
+ AppClipModule.isAppClip
40
+ }
41
+
42
+ // Display overlay to advertise full app.
43
+ // https://developer.apple.com/documentation/app_clips/recommending_your_app_to_app_clip_users
44
+ AsyncFunction("prompt") {
45
+ if #available(iOS 16, *) {
46
+ guard let currentScene = UIApplication.shared.connectedScenes.first as? UIWindowScene else {
47
+ throw MissingCurrentWindowSceneException()
48
+ }
49
+
50
+ let config = SKOverlay.AppClipConfiguration(position: .bottom)
51
+ let overlay = SKOverlay(configuration: config)
52
+ overlay.present(in: currentScene)
53
+ }
54
+ }.runOnQueue(DispatchQueue.main)
55
+ }
56
+ }
57
+ ```
58
+
59
+ ## TypeScript interface
60
+
61
+ ```ts
62
+ import { NativeModule, requireOptionalNativeModule } from "expo";
63
+
64
+ declare class AppClipModule extends NativeModule<{}> {
65
+ prompt(): void;
66
+ isAppClip?: boolean;
67
+ }
68
+
69
+ const AppClipNative = requireOptionalNativeModule<AppClipModule>("AppClip");
70
+
71
+ if (AppClipNative?.isAppClip) {
72
+ navigator.appClip = {
73
+ prompt: AppClipNative.prompt,
74
+ };
75
+ }
76
+
77
+ declare global {
78
+ interface Navigator {
79
+ /**
80
+ * Only available in an App Clip context.
81
+ * @expo
82
+ */
83
+ appClip?: {
84
+ /** Open the SKOverlay */
85
+ prompt: () => void;
86
+ };
87
+ }
88
+ }
89
+
90
+ export {};
91
+ ```
92
+
93
+ ## Usage
94
+
95
+ - Detect App Clip context: `if (navigator.appClip) { ... }`
96
+ - Prompt to install the full app: `navigator.appClip?.prompt()`