@doshi/sdk 0.3.4 → 0.3.5

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/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- /** Where Learn opens. A course or lesson the member cannot open falls back to the Learn home. */
1
+ /** Where Learn opens. What each target opens when the member cannot open it, or when the client
2
+ * has no Learn: developers.doshi.app/parameters/#start. */
2
3
  export type StartTarget = {
3
4
  view: "learning";
4
5
  } | {
@@ -10,13 +11,12 @@ export type StartTarget = {
10
11
  };
11
12
  /**
12
13
  * Base-URL overrides, for a host that proxies our traffic through its own origin. Each
13
- * replaces the host the member's token would otherwise pick (`getToken`); images load from
14
- * `data` too.
14
+ * replaces the host the member's token would otherwise pick (`getToken`).
15
15
  */
16
16
  export type HostUrls = {
17
- /** Where the member's data and images are read from. */
17
+ /** Where images and fonts are loaded from. */
18
18
  data?: string;
19
- /** Where lesson completions and rewards are written. */
19
+ /** Where the member's data is read and written: every request but an image's or a font's. */
20
20
  api?: string;
21
21
  };
22
22
  /**
@@ -29,6 +29,12 @@ export type SdkError = {
29
29
  code: "unavailable" | "auth_expired";
30
30
  during: "load" | "session";
31
31
  };
32
+ /**
33
+ * A haptic the member's tap would play, named by what it means. What each one means, and what a
34
+ * native app plays for it: developers.doshi.app/haptics/. A minor version may add a pattern, so
35
+ * ignore a name you do not know.
36
+ */
37
+ export type HapticPattern = "tap" | "tapLight" | "selection" | "success" | "warning" | "error";
32
38
  export type MountOptions = {
33
39
  /**
34
40
  * The member's token, from the host's own backend. Asked for before the first render and
@@ -47,11 +53,18 @@ export type MountOptions = {
47
53
  /** Told once per code (`SdkError`). */
48
54
  onError?: (error: SdkError) => void;
49
55
  /**
50
- * Handed the URL of every outside link the member follows. Today's Learn screens have none.
51
- * When set, the SDK never opens a link itself; unset, it opens one in a new window with
52
- * `noopener`. It never navigates the host's page either way.
56
+ * Handed the URL of every outside link the member follows, which is always `https:`, `tel:` or
57
+ * `mailto:`. When set, the SDK never opens a link itself; unset, it opens one in a new window
58
+ * with `noopener`. It never navigates the host's page either way. Required in a WebView, whose
59
+ * host opens an `https:` URL in the system browser.
53
60
  */
54
61
  onOpenLink?: (url: string) => void;
62
+ /**
63
+ * Handed every haptic the member's taps would play, for the host to play itself. When set, the
64
+ * SDK plays none of its own, so a function that does nothing turns them off. Never called for a
65
+ * member who turned tap feedback off or prefers reduced motion.
66
+ */
67
+ onHaptic?: (pattern: HapticPattern) => void;
55
68
  };
56
69
  export type Mounted = {
57
70
  /** The logout: removes everything the mount drew and forgets the member's token. */