@wix/himalaya-cli 0.1576.0 → 0.1578.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/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/clipboard/src/index.d.ts +32 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/haptic/src/index.d.ts +69 -5
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/sdk-types/src/capabilities.generated.d.ts +2 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/ui/src/index.d.ts +19 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/define-app.d.ts +6 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/loyalty/src/index.d.ts +64 -6
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/online-programs/src/index.d.ts +87 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/audio-record.mjs +2 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calendar.mjs +2 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calls.mjs +2 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/clipboard.mjs +58 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/contacts.mjs +2 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/haptic.mjs +73 -4
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/location.mjs +2 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/motion.mjs +2 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/photos.mjs +2 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdk-types.mjs +2 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/tasks.mjs +2 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/ui.mjs +5 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-loyalty.mjs +15 -3
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-online-programs.mjs +42 -0
- package/dist/cli.mjs +7245 -6889
- package/dist/preview-assets.generated.bin +0 -0
- package/fixtures/wix-canned.json +56 -3
- package/guides/one-app-section-mappings.md +1 -1
- package/guides/one-app-to-himi-app.md +50 -1
- package/guides/qa-builds.md +14 -6
- package/guides/sdk-reference.json +249 -17
- package/guides/web-page-sdk-reference.md +2 -2
- package/package.json +2 -2
- package/templates/beauty-salon/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/beauty-salon/tier5-src/_shared/owner-load-error.ts +8 -0
- package/templates/beauty-salon-owner/dev/index.ts +52 -27
- package/templates/beauty-salon-owner/tier5-src/_shared/owner-load-error.ts +8 -0
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-post/index.ts +20 -8
- package/templates/branded-lite/config.ts +7 -0
- package/templates/branded-lite/dev/index.ts +833 -0
- package/templates/branded-lite/himalaya.content.json +3 -0
- package/templates/branded-lite/l10n/en.json +4 -2
- package/templates/branded-lite/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/branded-lite/tier5-src/_shared/owner-load-error.ts +8 -0
- package/templates/branded-lite/tier5-src/himi-branded-lite-member-programs/index.ts +658 -0
- package/templates/community-club/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/community-club/tier5-src/_shared/owner-load-error.ts +8 -0
- package/templates/community-club-owner/dev/index.ts +52 -27
- package/templates/community-club-owner/tier5-src/_shared/owner-load-error.ts +8 -0
- package/templates/community-club-owner/tier5-src/himi-owner-lite-post/index.ts +20 -8
- package/templates/events-meetups/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/events-meetups/tier5-src/_shared/owner-load-error.ts +8 -0
- package/templates/events-meetups-owner/dev/index.ts +52 -27
- package/templates/events-meetups-owner/tier5-src/_shared/owner-load-error.ts +8 -0
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-post/index.ts +20 -8
- package/templates/gym-fitness/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/gym-fitness/tier5-src/_shared/owner-load-error.ts +8 -0
- package/templates/gym-fitness-owner/dev/index.ts +52 -27
- package/templates/gym-fitness-owner/tier5-src/_shared/owner-load-error.ts +8 -0
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-post/index.ts +20 -8
- package/templates/himi-chat/tier5-src/_shared/owner-load-error.ts +8 -0
- package/templates/nonprofit-cause/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/nonprofit-cause/tier5-src/_shared/owner-load-error.ts +8 -0
- package/templates/nonprofit-cause-owner/dev/index.ts +52 -27
- package/templates/nonprofit-cause-owner/tier5-src/_shared/owner-load-error.ts +8 -0
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-post/index.ts +20 -8
- package/templates/owner-lite/dev/index.ts +52 -27
- package/templates/owner-lite/tier5-src/_shared/owner-load-error.ts +8 -0
- package/templates/owner-lite/tier5-src/himi-owner-lite-post/index.ts +20 -8
- package/templates/podcast-creator/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/podcast-creator/tier5-src/_shared/owner-load-error.ts +8 -0
- package/templates/podcast-creator-owner/dev/index.ts +52 -27
- package/templates/podcast-creator-owner/tier5-src/_shared/owner-load-error.ts +8 -0
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-post/index.ts +20 -8
- package/templates/portfolio-creative/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/portfolio-creative/tier5-src/_shared/owner-load-error.ts +8 -0
- package/templates/portfolio-creative-owner/dev/index.ts +52 -27
- package/templates/portfolio-creative-owner/tier5-src/_shared/owner-load-error.ts +8 -0
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-post/index.ts +20 -8
- package/templates/restaurant/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/restaurant/tier5-src/_shared/owner-load-error.ts +8 -0
- package/templates/restaurant-owner/dev/index.ts +52 -27
- package/templates/restaurant-owner/tier5-src/_shared/owner-load-error.ts +8 -0
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-post/index.ts +20 -8
- package/templates/retail-store/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/retail-store/tier5-src/_shared/owner-load-error.ts +8 -0
- package/templates/retail-store-owner/dev/index.ts +52 -27
- package/templates/retail-store-owner/tier5-src/_shared/owner-load-error.ts +8 -0
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-post/index.ts +20 -8
- package/templates/yoga-studio/config.ts +7 -0
- package/templates/yoga-studio/dev/index.ts +833 -0
- package/templates/yoga-studio/himalaya.content.json +3 -0
- package/templates/yoga-studio/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/yoga-studio/tier5-src/_shared/owner-load-error.ts +8 -0
- package/templates/yoga-studio/tier5-src/himi-branded-lite-member-programs/index.ts +658 -0
- package/templates/yoga-studio-owner/dev/index.ts +52 -27
- package/templates/yoga-studio-owner/tier5-src/_shared/owner-load-error.ts +8 -0
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-post/index.ts +20 -8
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { FileHandle } from "@wix/himalaya/sdk-types";
|
|
2
|
+
export type { FileHandle } from "@wix/himalaya/sdk-types";
|
|
1
3
|
/** Copy `text` to the clipboard. */
|
|
2
4
|
export declare function writeText(text: string): Promise<void>;
|
|
3
5
|
/** Read the clipboard's text, or null if empty / the read was blocked (no focus,
|
|
@@ -7,5 +9,34 @@ export declare function readText(): Promise<string | null>;
|
|
|
7
9
|
* web this can't be known without reading, so it returns true pessimistically;
|
|
8
10
|
* treat it as a hint, not a guarantee. */
|
|
9
11
|
export declare function hasText(): Promise<boolean>;
|
|
12
|
+
/** Largest image writeImage accepts (20 MB). Hosts enforce it too. */
|
|
13
|
+
export declare const MAX_IMAGE_BYTES: number;
|
|
14
|
+
/** Image MIME types writeImage copies. HEIC is iOS/macOS only (Android and web
|
|
15
|
+
* reject it `unsupported_type`); web accepts PNG only. The host sniffs the file's
|
|
16
|
+
* bytes, so a handle is judged by its content, not its `mimeType` — the binding only
|
|
17
|
+
* refuses up front a handle whose type is plainly not an image (e.g. application/pdf). */
|
|
18
|
+
export declare const IMAGE_MIME_TYPES: readonly string[];
|
|
19
|
+
/** Why writeImage rejected. */
|
|
20
|
+
export type ClipboardImageErrorCode = "unsupported_type" | "too_large" | "not_allowed" | "not_found" | "unavailable";
|
|
21
|
+
/** A writeImage rejection: an `Error` named "ClipboardImageError" carrying a stable
|
|
22
|
+
* `code`. (A plain Error, not a subclass — Tier-5 bundles target an engine without
|
|
23
|
+
* class syntax.) Branch on `isClipboardImageError(e) && e.code === "too_large"`. */
|
|
24
|
+
export interface ClipboardImageError extends Error {
|
|
25
|
+
name: "ClipboardImageError";
|
|
26
|
+
code: ClipboardImageErrorCode;
|
|
27
|
+
}
|
|
28
|
+
/** Build a coded writeImage rejection. */
|
|
29
|
+
export declare function clipboardImageError(code: ClipboardImageErrorCode, message?: string): ClipboardImageError;
|
|
30
|
+
/** Whether `e` is a coded writeImage rejection. */
|
|
31
|
+
export declare function isClipboardImageError(e: unknown): e is ClipboardImageError;
|
|
32
|
+
/** Copy an image file the worker already holds to the clipboard. Accepts a
|
|
33
|
+
* `FileHandle` (from files / camera / photos) or its substrate `uri`. Rejects with a
|
|
34
|
+
* `ClipboardImageError` (see `isClipboardImageError`) whose `code` is `unsupported_type` (not PNG/JPEG/WebP/HEIC, or
|
|
35
|
+
* not supported on this host), `too_large` (over 20 MB), `not_allowed` (outside the
|
|
36
|
+
* app's files substrate), `not_found`, or `unavailable` (no image clipboard here). */
|
|
37
|
+
export declare function writeImage(file: FileHandle | string): Promise<void>;
|
|
38
|
+
/** Whether the clipboard currently holds an image — without reading it (no iOS paste
|
|
39
|
+
* banner). Web cannot know without a permission-gated read, so it answers false. */
|
|
40
|
+
export declare function hasImage(): Promise<boolean>;
|
|
10
41
|
/** Capability version, for bundles that gate on min binary version. */
|
|
11
|
-
export declare const version =
|
|
42
|
+
export declare const version = 2;
|
package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/haptic/src/index.d.ts
CHANGED
|
@@ -1,9 +1,73 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Maps to a native impact/notification/selection generator.
|
|
3
|
+
*
|
|
4
|
+
* - `rigid` / `soft` — iOS `UIImpactFeedbackGenerator.FeedbackStyle.rigid` / `.soft`.
|
|
5
|
+
* Android: `rigid` is a short full-amplitude click (`VibrationEffect.EFFECT_CLICK`-like),
|
|
6
|
+
* `soft` a longer low-amplitude tick (`PRIMITIVE_LOW_TICK`-like); on a device without
|
|
7
|
+
* amplitude control both are plain one-shots of different length.
|
|
8
|
+
*/
|
|
9
|
+
export type HapticPattern = "selection" | "light" | "medium" | "heavy" | "rigid" | "soft" | "success" | "warning" | "error";
|
|
10
|
+
export interface PlayOptions {
|
|
11
|
+
/**
|
|
12
|
+
* 0..1, clamped. Scales the strength of an IMPACT style (`light`, `medium`, `heavy`,
|
|
13
|
+
* `rigid`, `soft`): iOS `impactOccurred(intensity:)`, Android amplitude where the
|
|
14
|
+
* vibrator has amplitude control. Ignored for `selection` and the notification styles
|
|
15
|
+
* (`success`, `warning`, `error`) — those have a fixed system strength — and on web.
|
|
16
|
+
*/
|
|
17
|
+
intensity?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface HapticStep {
|
|
20
|
+
pattern: HapticPattern;
|
|
21
|
+
/** Milliseconds to wait BEFORE this step plays (≥ 0). */
|
|
22
|
+
delayMs: number;
|
|
23
|
+
/** Same meaning as {@link PlayOptions.intensity}. */
|
|
24
|
+
intensity?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* What a verb reports. `ok: false` is honest: `unavailable` (this surface has no haptic
|
|
28
|
+
* hardware/API — web without `navigator.vibrate`, macOS) or `unsupported_binary` (the
|
|
29
|
+
* native app predates the verb; nothing played, nothing broke).
|
|
30
|
+
*/
|
|
31
|
+
export type HapticResult = {
|
|
32
|
+
ok: true;
|
|
33
|
+
} | {
|
|
34
|
+
ok: false;
|
|
35
|
+
reason: "unavailable" | "unsupported_binary";
|
|
36
|
+
};
|
|
37
|
+
/** Most steps one {@link sequence} may carry. */
|
|
38
|
+
export declare const MAX_SEQUENCE_STEPS = 32;
|
|
39
|
+
/** Longest a {@link sequence} or {@link vibrate} pattern may run, in milliseconds. */
|
|
40
|
+
export declare const MAX_DURATION_MS = 10000;
|
|
41
|
+
/** Clamp an intensity into 0..1; `undefined` / non-finite → `undefined` (system default). */
|
|
42
|
+
export declare function clampIntensity(intensity: number | undefined): number | undefined;
|
|
3
43
|
/**
|
|
4
44
|
* Play a haptic feedback pattern. Fire-and-forget; resolves once handed to the
|
|
5
|
-
* platform.
|
|
45
|
+
* platform. Unknown pattern names keep their historical behaviour (the platform's
|
|
46
|
+
* default tap). `intensity` applies to impact styles only — see {@link PlayOptions}.
|
|
47
|
+
*/
|
|
48
|
+
export declare function play(pattern?: HapticPattern, options?: PlayOptions): Promise<HapticResult>;
|
|
49
|
+
/**
|
|
50
|
+
* Play `steps` in order, waiting each step's `delayMs` before it plays. Runs natively
|
|
51
|
+
* as ONE bridge call (the timing does not depend on the worker), so a drum roll or a
|
|
52
|
+
* countdown keeps its rhythm. A new `sequence` cancels one still running. Resolves once
|
|
53
|
+
* the sequence has been scheduled.
|
|
54
|
+
*
|
|
55
|
+
* Rejects (`RangeError`) with more than {@link MAX_SEQUENCE_STEPS} steps, a negative or
|
|
56
|
+
* non-finite delay, or delays totalling over {@link MAX_DURATION_MS}. An empty list just
|
|
57
|
+
* cancels a running sequence.
|
|
58
|
+
*/
|
|
59
|
+
export declare function sequence(steps: HapticStep[]): Promise<HapticResult>;
|
|
60
|
+
/**
|
|
61
|
+
* Raw vibration: `patternMs` alternates OFF / ON durations in milliseconds, starting
|
|
62
|
+
* with an off gap (`[0, 200, 100, 400]` = buzz 200, pause 100, buzz 400).
|
|
63
|
+
*
|
|
64
|
+
* Android plays it as `VibrationEffect.createWaveform`. iOS approximates: with Core
|
|
65
|
+
* Haptics each ON span is a continuous event (a transient one under 30 ms); without it,
|
|
66
|
+
* each ON span becomes one `heavy` impact at its start. Web uses `navigator.vibrate`.
|
|
67
|
+
*
|
|
68
|
+
* Rejects (`RangeError`) on an empty list, a negative or non-finite duration, or a
|
|
69
|
+
* pattern totalling over {@link MAX_DURATION_MS}.
|
|
6
70
|
*/
|
|
7
|
-
export declare function
|
|
71
|
+
export declare function vibrate(patternMs: number[]): Promise<HapticResult>;
|
|
8
72
|
/** Capability version, for bundles that gate on a min binary version. */
|
|
9
|
-
export declare const version =
|
|
73
|
+
export declare const version = 2;
|
|
@@ -8,12 +8,12 @@ export declare const CAPABILITY_REGISTRY: {
|
|
|
8
8
|
readonly calendar: readonly ["createEvent", "deleteEvent", "getPermissionStatus", "listEvents", "requestPermission", "updateEvent"];
|
|
9
9
|
readonly calls: readonly ["answer", "availability", "getPermissionStatus", "getState", "hangup", "listCalls", "offer", "receiveSignal", "reject", "requestPermission", "setMuted", "setRingback", "setSpeaker", "signalNext", "signalStart", "signalStop", "start", "subscribeEvents"];
|
|
10
10
|
readonly camera: readonly ["capture", "pickDocument", "prepareImage", "scanQR"];
|
|
11
|
-
readonly clipboard: readonly ["hasText", "readText", "writeText"];
|
|
11
|
+
readonly clipboard: readonly ["hasImage", "hasText", "readText", "writeImage", "writeText"];
|
|
12
12
|
readonly contacts: readonly ["getPermissionStatus", "pick", "requestPermission", "search"];
|
|
13
13
|
readonly file_picker: readonly ["pick", "pickDirectoryForExport"];
|
|
14
14
|
readonly files: readonly ["list", "readText", "remove", "stat", "write"];
|
|
15
15
|
readonly godot: readonly ["loadPack", "release", "send"];
|
|
16
|
-
readonly haptic: readonly ["play"];
|
|
16
|
+
readonly haptic: readonly ["play", "sequence", "vibrate"];
|
|
17
17
|
readonly health: readonly ["availability", "getPermissionStatus", "query", "requestPermission", "saveWorkout"];
|
|
18
18
|
readonly himi_apps: readonly ["canOpen", "current", "hostInfo", "open"];
|
|
19
19
|
readonly iap: readonly ["appBinding", "consume", "entitlements", "finishTransaction", "getPaywallConfig", "getProducts", "getUnfinishedTransactions", "purchase", "purchaseForVerification", "restore"];
|
package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/ui/src/index.d.ts
CHANGED
|
@@ -6,8 +6,23 @@ export interface AlertOptions {
|
|
|
6
6
|
confirmLabel?: string;
|
|
7
7
|
/** Cancel button label. OMIT for a single-button alert (no cancel button). */
|
|
8
8
|
cancelLabel?: string;
|
|
9
|
-
/** Style the confirm button with the `danger` token.
|
|
9
|
+
/** Style the confirm button with the `danger` token. A destructive confirm is not the
|
|
10
|
+
* affirmative button: its `confirm.actionId` still runs, but without gesture credit. */
|
|
10
11
|
destructive?: boolean;
|
|
12
|
+
/** The affirmative button's ACTION. Pressing it runs `actionId` as a NEW invocation
|
|
13
|
+
* with user-gesture origin (so an app service's `app.<svc>.<action>` may return `_nav` and
|
|
14
|
+
* navigate — the "Ready — View" alert). `label` replaces `confirmLabel`. The id is checked when
|
|
15
|
+
* you set it, against this worker: a `capability.<id>.*` needs `<id>` allowed, an `app.*` from a
|
|
16
|
+
* screen worker needs `app_services` and an exported action, a `tier5.*` must be this worker's
|
|
17
|
+
* own; anything else rejects (`action_not_allowed`). Cancel and dismissal run nothing. */
|
|
18
|
+
confirm?: AlertConfirm;
|
|
19
|
+
}
|
|
20
|
+
/** The affirmative button of an `alert()`: its label and the action its press runs. */
|
|
21
|
+
export interface AlertConfirm {
|
|
22
|
+
label: string;
|
|
23
|
+
actionId: string;
|
|
24
|
+
/** Passed to the action (JSON types kept). */
|
|
25
|
+
args?: Record<string, unknown>;
|
|
11
26
|
}
|
|
12
27
|
export interface AlertResult {
|
|
13
28
|
/** true ⇒ the user tapped confirm; false ⇒ cancel or the alert was dismissed
|
|
@@ -16,7 +31,9 @@ export interface AlertResult {
|
|
|
16
31
|
}
|
|
17
32
|
/** Present a modal alert on the current screen. Resolves when the user picks a
|
|
18
33
|
* button. Rejects with `ui_busy` while another alert() is pending, and with
|
|
19
|
-
* `no_ui_host` if the app has no presenter attached
|
|
34
|
+
* `no_ui_host` if the app has no presenter attached — or, from an APP SERVICE, when no
|
|
35
|
+
* shell is in the foreground (re-show it from `onForeground`). An app service's alert shows on
|
|
36
|
+
* whatever screen is open. */
|
|
20
37
|
export declare function alert(options: AlertOptions): Promise<AlertResult>;
|
|
21
38
|
/** Snackbar tone — maps to the app's tone background tokens (`info` → textPrimary, `success`,
|
|
22
39
|
* `warning`, `danger`). Use `danger` for errors; the hosts also accept `error` as an alias of it. */
|
package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/define-app.d.ts
CHANGED
|
@@ -561,6 +561,12 @@ export interface RichTemplate {
|
|
|
561
561
|
export interface PushConfig {
|
|
562
562
|
/** Ping base family, without an APNs environment suffix. */
|
|
563
563
|
pingAppName?: string;
|
|
564
|
+
/** Wix Ping registration scope (#4708). "site" (default) filters delivery to the
|
|
565
|
+
* session's metasite and refuses to register without one; "user" registers the
|
|
566
|
+
* device for the signed-in Wix user with NO metasite filter — for an
|
|
567
|
+
* account-level app that is not about any single site. Only the "wix-ping"
|
|
568
|
+
* registrar reads it. */
|
|
569
|
+
pingScope?: "site" | "user";
|
|
564
570
|
/** Token registrar. "generic" ⇒ POST the token to `registerUrl`; "wix-ping"
|
|
565
571
|
* ⇒ the native Wix Ping registrar. */
|
|
566
572
|
registrar: PushRegistrar;
|
|
@@ -30,6 +30,20 @@ export interface WixCallOptions {
|
|
|
30
30
|
/** The per-call header map for `opts`, or undefined when there is nothing to add — so
|
|
31
31
|
* the no-options path calls the bridge with exactly the 3 arguments it always did. */
|
|
32
32
|
export declare function wixCall<T>(method: string, path: string, body?: unknown, readOptions?: WixCallOptions): Promise<T>;
|
|
33
|
+
export interface WixLoyaltyImage {
|
|
34
|
+
id?: string;
|
|
35
|
+
url?: string;
|
|
36
|
+
height?: number;
|
|
37
|
+
width?: number;
|
|
38
|
+
altText?: string;
|
|
39
|
+
filename?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface WixLoyaltyRewardConfig {
|
|
42
|
+
tierId?: string;
|
|
43
|
+
costInPoints?: number;
|
|
44
|
+
amount?: number;
|
|
45
|
+
percentage?: number;
|
|
46
|
+
}
|
|
33
47
|
export interface WixLoyaltyProgram {
|
|
34
48
|
id?: string;
|
|
35
49
|
name?: string;
|
|
@@ -37,14 +51,33 @@ export interface WixLoyaltyProgram {
|
|
|
37
51
|
status?: string;
|
|
38
52
|
pointDefinition?: {
|
|
39
53
|
customName?: string;
|
|
40
|
-
icon?:
|
|
54
|
+
icon?: WixLoyaltyImage;
|
|
41
55
|
};
|
|
42
56
|
}
|
|
43
57
|
export interface WixLoyaltyReward {
|
|
44
58
|
id: string;
|
|
45
59
|
name?: string;
|
|
46
60
|
type?: string;
|
|
61
|
+
/** Legacy adapter field. REST costs live in the reward's tier configurations. */
|
|
47
62
|
requiredPoints?: number;
|
|
63
|
+
discountAmount?: {
|
|
64
|
+
configsByTier?: {
|
|
65
|
+
tierId?: string;
|
|
66
|
+
costInPoints?: number;
|
|
67
|
+
amount?: string;
|
|
68
|
+
}[];
|
|
69
|
+
};
|
|
70
|
+
couponReward?: {
|
|
71
|
+
fixedAmount?: {
|
|
72
|
+
configsByTier?: WixLoyaltyRewardConfig[];
|
|
73
|
+
};
|
|
74
|
+
percentage?: {
|
|
75
|
+
configsByTier?: WixLoyaltyRewardConfig[];
|
|
76
|
+
};
|
|
77
|
+
freeShipping?: {
|
|
78
|
+
configsByTier?: WixLoyaltyRewardConfig[];
|
|
79
|
+
};
|
|
80
|
+
};
|
|
48
81
|
active?: boolean;
|
|
49
82
|
}
|
|
50
83
|
export interface WixLoyaltyTier {
|
|
@@ -52,22 +85,47 @@ export interface WixLoyaltyTier {
|
|
|
52
85
|
id?: string;
|
|
53
86
|
tierDefinition?: {
|
|
54
87
|
name?: string;
|
|
55
|
-
icon?:
|
|
88
|
+
icon?: WixLoyaltyImage;
|
|
56
89
|
};
|
|
57
90
|
requiredPoints?: number;
|
|
58
91
|
}
|
|
59
|
-
|
|
92
|
+
export interface WixLoyaltyEarningRule {
|
|
93
|
+
id?: string;
|
|
94
|
+
title?: string;
|
|
95
|
+
status?: string;
|
|
96
|
+
triggerActivityType?: string;
|
|
97
|
+
fixedAmount?: {
|
|
98
|
+
configs?: {
|
|
99
|
+
tierId?: string;
|
|
100
|
+
points?: number;
|
|
101
|
+
}[];
|
|
102
|
+
};
|
|
103
|
+
conversionRate?: {
|
|
104
|
+
field?: string;
|
|
105
|
+
configs?: {
|
|
106
|
+
tierId?: string;
|
|
107
|
+
moneyAmount?: number;
|
|
108
|
+
points?: number;
|
|
109
|
+
}[];
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
/** GET /loyalty-programs/v1/program → { loyaltyProgram }. */
|
|
60
113
|
export declare function getLoyaltyProgram(readOptions?: WixCallOptions): Promise<{
|
|
61
114
|
loyaltyProgram?: WixLoyaltyProgram;
|
|
62
115
|
program?: WixLoyaltyProgram;
|
|
63
116
|
}>;
|
|
64
|
-
/** GET /loyalty/v1/rewards → { rewards }. */
|
|
117
|
+
/** GET /loyalty-rewards/v1/rewards → { rewards }. */
|
|
65
118
|
export declare function listLoyaltyRewards(readOptions?: WixCallOptions): Promise<{
|
|
66
119
|
rewards?: WixLoyaltyReward[];
|
|
67
120
|
}>;
|
|
68
|
-
/** GET /loyalty/v1/tiers → { tiers }. The
|
|
69
|
-
* (wix.loyalty.v1.tier) — NOT the private per-customer tiers-program dashboard. */
|
|
121
|
+
/** GET /loyalty-tiers/v1/tiers → { tiers }. The program tier ladder. */
|
|
70
122
|
export declare function listLoyaltyTiers(readOptions?: WixCallOptions): Promise<{
|
|
71
123
|
tiers?: WixLoyaltyTier[];
|
|
72
124
|
}>;
|
|
125
|
+
/** Active and inactive earning rules in their raw REST shape; callers choose visibility.
|
|
126
|
+
* @scope visitor
|
|
127
|
+
*/
|
|
128
|
+
export declare function listLoyaltyEarningRules(readOptions?: WixCallOptions): Promise<{
|
|
129
|
+
earningRules?: WixLoyaltyEarningRule[];
|
|
130
|
+
}>;
|
|
73
131
|
export * from "./extensions.js";
|
|
@@ -215,3 +215,90 @@ export declare function joinProgram(programId: string, options?: {
|
|
|
215
215
|
}): Promise<WixJoinProgramResponse>;
|
|
216
216
|
/** The cashier handle to settle, or "" when no payable order is available. */
|
|
217
217
|
export declare function payableIdOf(participant?: WixJoinedParticipant): string;
|
|
218
|
+
/** `Participant.enrollmentStatus` values the member list filters on. */
|
|
219
|
+
export declare const MEMBER_ENROLLMENT_STATUSES: {
|
|
220
|
+
readonly joined: "JOINED";
|
|
221
|
+
readonly suspended: "SUSPENDED";
|
|
222
|
+
readonly unknown: "UNKNOWN_ENROLLMENT_STATUS";
|
|
223
|
+
};
|
|
224
|
+
/** `Participant.progressStatus` values that still count as a membership once the enrollment is over. */
|
|
225
|
+
export declare const MEMBER_FINISHED_PROGRESS_STATUSES: readonly ["COMPLETED", "FAILED"];
|
|
226
|
+
export interface WixMemberParticipantsQuery {
|
|
227
|
+
/** The signed-in member's id (`getMyMember().member.id`). Required: without it the query is the roster of everyone. */
|
|
228
|
+
memberId: string;
|
|
229
|
+
/** The `pagingMetadata.cursors.next` of the previous page; omit for the first page. */
|
|
230
|
+
cursor?: string;
|
|
231
|
+
/** Page size, default 100 (the upstream page cap for this query). */
|
|
232
|
+
limit?: number;
|
|
233
|
+
}
|
|
234
|
+
export interface WixQueryMemberParticipantsResponse extends WixQueryParticipantsResponse {
|
|
235
|
+
pagingMetadata?: WixQueryParticipantsResponse["pagingMetadata"] & {
|
|
236
|
+
cursors?: {
|
|
237
|
+
next?: string | null;
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* POST /online-programs/v3/participants/query — the MEMBER'S participations, cursor-paged, with
|
|
243
|
+
* progress. Joined and suspended enrollments, plus completed/failed ones whose enrollment has
|
|
244
|
+
* ended, so a finished program still shows its outcome; left, removed and auto-removed
|
|
245
|
+
* memberships are excluded. The query language has no `programId: {$in}` on this
|
|
246
|
+
* endpoint, so callers match memberships to displayed programs locally.
|
|
247
|
+
*
|
|
248
|
+
* @scope member — requires the signed-in site member; `memberId` must be that member's own id
|
|
249
|
+
* (`getMyMember().member.id`). An empty `participants` list means the member has no such
|
|
250
|
+
* membership, never that the read failed: a failure rejects.
|
|
251
|
+
*/
|
|
252
|
+
export declare function queryMemberParticipants(opts: WixMemberParticipantsQuery): Promise<WixQueryMemberParticipantsResponse>;
|
|
253
|
+
export interface WixProgramParticipationStats {
|
|
254
|
+
programId?: string;
|
|
255
|
+
participantsCount?: number;
|
|
256
|
+
autoRemovedCount?: number;
|
|
257
|
+
}
|
|
258
|
+
export interface WixGetParticipationStatsResponse {
|
|
259
|
+
participationStats?: WixProgramParticipationStats[];
|
|
260
|
+
}
|
|
261
|
+
/** POST /online-programs/v3/participants/stats — participant counts for a batch of programs (one call per page).
|
|
262
|
+
* `programIds` must be non-empty (an empty batch returns `{ participationStats: [] }` without a call);
|
|
263
|
+
* a program missing from the answer has no count, not zero.
|
|
264
|
+
* @scope visitor — counts are public; an anonymous visitor session is enough. */
|
|
265
|
+
export declare function getParticipationStats(programIds: string[]): Promise<WixGetParticipationStatsResponse>;
|
|
266
|
+
/** `JoinApplication.status` — the member's standing BEFORE a participant exists (a private or paid program). */
|
|
267
|
+
export type WixJoinApplicationStatus = "INVITED" | "APPROVAL_PENDING" | "APPROVED" | "PAYMENT_PENDING" | "SUSPENDED" | "DECLINED" | "CANCELLED" | string;
|
|
268
|
+
export interface WixJoinApplication {
|
|
269
|
+
id?: string;
|
|
270
|
+
programId?: string;
|
|
271
|
+
memberId?: string;
|
|
272
|
+
status?: WixJoinApplicationStatus;
|
|
273
|
+
paymentStatus?: string;
|
|
274
|
+
/** Set once the application became a participant. */
|
|
275
|
+
participantId?: string;
|
|
276
|
+
createdDate?: string;
|
|
277
|
+
updatedDate?: string;
|
|
278
|
+
}
|
|
279
|
+
export interface WixGetCurrentJoinApplicationResponse {
|
|
280
|
+
joinApplication?: WixJoinApplication;
|
|
281
|
+
}
|
|
282
|
+
/** GET /online-programs/participants/v3/join-applications/current/{programId} — the signed-in member's
|
|
283
|
+
* own application to ONE program, or none. Used per card only where an application can exist
|
|
284
|
+
* (a private or a priced program the member has not joined). An answer with no `joinApplication`
|
|
285
|
+
* means the member never applied.
|
|
286
|
+
* @scope member — requires the signed-in site member; a visitor session has no application to read. */
|
|
287
|
+
export declare function getCurrentJoinApplication(programId: string): Promise<WixGetCurrentJoinApplicationResponse>;
|
|
288
|
+
export interface WixProgramCategory {
|
|
289
|
+
id?: string;
|
|
290
|
+
label?: string;
|
|
291
|
+
/** Program ids the category is assigned to. */
|
|
292
|
+
assignedTo?: string[];
|
|
293
|
+
}
|
|
294
|
+
export interface WixListProgramCategoriesResponse {
|
|
295
|
+
categories?: WixProgramCategory[];
|
|
296
|
+
}
|
|
297
|
+
/** GET /_api/program-categories-service/v3/categories — every program category of the site (the
|
|
298
|
+
* category filter's options). `/_api/…` paths ride the same bridge as the public ones (forms,
|
|
299
|
+
* bookings-v2 and ecom already do). An empty `categories` list means the site has none.
|
|
300
|
+
* @scope member — the One App member programs list calls it with the member's identity. NOT verified
|
|
301
|
+
* live here: codegen/wix/auto/lock.json lists only the APP identity (ONLINE_PROGRAMS.CATEGORY_READ), so a
|
|
302
|
+
* visitor or member token can get 403. A caller must treat a rejection as "no category filter", never
|
|
303
|
+
* as an error screen. */
|
|
304
|
+
export declare function listProgramCategories(): Promise<WixListProgramCategoriesResponse>;
|
|
@@ -23,12 +23,12 @@ var CAPABILITY_REGISTRY = {
|
|
|
23
23
|
"calendar": ["createEvent", "deleteEvent", "getPermissionStatus", "listEvents", "requestPermission", "updateEvent"],
|
|
24
24
|
"calls": ["answer", "availability", "getPermissionStatus", "getState", "hangup", "listCalls", "offer", "receiveSignal", "reject", "requestPermission", "setMuted", "setRingback", "setSpeaker", "signalNext", "signalStart", "signalStop", "start", "subscribeEvents"],
|
|
25
25
|
"camera": ["capture", "pickDocument", "prepareImage", "scanQR"],
|
|
26
|
-
"clipboard": ["hasText", "readText", "writeText"],
|
|
26
|
+
"clipboard": ["hasImage", "hasText", "readText", "writeImage", "writeText"],
|
|
27
27
|
"contacts": ["getPermissionStatus", "pick", "requestPermission", "search"],
|
|
28
28
|
"file_picker": ["pick", "pickDirectoryForExport"],
|
|
29
29
|
"files": ["list", "readText", "remove", "stat", "write"],
|
|
30
30
|
"godot": ["loadPack", "release", "send"],
|
|
31
|
-
"haptic": ["play"],
|
|
31
|
+
"haptic": ["play", "sequence", "vibrate"],
|
|
32
32
|
"health": ["availability", "getPermissionStatus", "query", "requestPermission", "saveWorkout"],
|
|
33
33
|
"himi_apps": ["canOpen", "current", "hostInfo", "open"],
|
|
34
34
|
"iap": ["appBinding", "consume", "entitlements", "finishTransaction", "getPaywallConfig", "getProducts", "getUnfinishedTransactions", "purchase", "purchaseForVerification", "restore"],
|
|
@@ -23,12 +23,12 @@ var CAPABILITY_REGISTRY = {
|
|
|
23
23
|
"calendar": ["createEvent", "deleteEvent", "getPermissionStatus", "listEvents", "requestPermission", "updateEvent"],
|
|
24
24
|
"calls": ["answer", "availability", "getPermissionStatus", "getState", "hangup", "listCalls", "offer", "receiveSignal", "reject", "requestPermission", "setMuted", "setRingback", "setSpeaker", "signalNext", "signalStart", "signalStop", "start", "subscribeEvents"],
|
|
25
25
|
"camera": ["capture", "pickDocument", "prepareImage", "scanQR"],
|
|
26
|
-
"clipboard": ["hasText", "readText", "writeText"],
|
|
26
|
+
"clipboard": ["hasImage", "hasText", "readText", "writeImage", "writeText"],
|
|
27
27
|
"contacts": ["getPermissionStatus", "pick", "requestPermission", "search"],
|
|
28
28
|
"file_picker": ["pick", "pickDirectoryForExport"],
|
|
29
29
|
"files": ["list", "readText", "remove", "stat", "write"],
|
|
30
30
|
"godot": ["loadPack", "release", "send"],
|
|
31
|
-
"haptic": ["play"],
|
|
31
|
+
"haptic": ["play", "sequence", "vibrate"],
|
|
32
32
|
"health": ["availability", "getPermissionStatus", "query", "requestPermission", "saveWorkout"],
|
|
33
33
|
"himi_apps": ["canOpen", "current", "hostInfo", "open"],
|
|
34
34
|
"iap": ["appBinding", "consume", "entitlements", "finishTransaction", "getPaywallConfig", "getProducts", "getUnfinishedTransactions", "purchase", "purchaseForVerification", "restore"],
|
|
@@ -23,12 +23,12 @@ var CAPABILITY_REGISTRY = {
|
|
|
23
23
|
"calendar": ["createEvent", "deleteEvent", "getPermissionStatus", "listEvents", "requestPermission", "updateEvent"],
|
|
24
24
|
"calls": ["answer", "availability", "getPermissionStatus", "getState", "hangup", "listCalls", "offer", "receiveSignal", "reject", "requestPermission", "setMuted", "setRingback", "setSpeaker", "signalNext", "signalStart", "signalStop", "start", "subscribeEvents"],
|
|
25
25
|
"camera": ["capture", "pickDocument", "prepareImage", "scanQR"],
|
|
26
|
-
"clipboard": ["hasText", "readText", "writeText"],
|
|
26
|
+
"clipboard": ["hasImage", "hasText", "readText", "writeImage", "writeText"],
|
|
27
27
|
"contacts": ["getPermissionStatus", "pick", "requestPermission", "search"],
|
|
28
28
|
"file_picker": ["pick", "pickDirectoryForExport"],
|
|
29
29
|
"files": ["list", "readText", "remove", "stat", "write"],
|
|
30
30
|
"godot": ["loadPack", "release", "send"],
|
|
31
|
-
"haptic": ["play"],
|
|
31
|
+
"haptic": ["play", "sequence", "vibrate"],
|
|
32
32
|
"health": ["availability", "getPermissionStatus", "query", "requestPermission", "saveWorkout"],
|
|
33
33
|
"himi_apps": ["canOpen", "current", "hostInfo", "open"],
|
|
34
34
|
"iap": ["appBinding", "consume", "entitlements", "finishTransaction", "getPaywallConfig", "getProducts", "getUnfinishedTransactions", "purchase", "purchaseForVerification", "restore"],
|
|
@@ -26,11 +26,68 @@ async function hasText() {
|
|
|
26
26
|
const r = await dispatch("capability.clipboard.hasText");
|
|
27
27
|
return r?.has === true;
|
|
28
28
|
}
|
|
29
|
-
var
|
|
29
|
+
var MAX_IMAGE_BYTES = 20 * 1024 * 1024;
|
|
30
|
+
var IMAGE_MIME_TYPES = ["image/png", "image/jpeg", "image/webp", "image/heic"];
|
|
31
|
+
var CODES = ["unsupported_type", "too_large", "not_allowed", "not_found", "unavailable"];
|
|
32
|
+
function clipboardImageError(code, message) {
|
|
33
|
+
const text = !message ? code : message.startsWith(code) ? message : `${code}: ${message}`;
|
|
34
|
+
const err = new Error(text);
|
|
35
|
+
err.name = "ClipboardImageError";
|
|
36
|
+
err.code = code;
|
|
37
|
+
return err;
|
|
38
|
+
}
|
|
39
|
+
function isClipboardImageError(e) {
|
|
40
|
+
return e instanceof Error && e.name === "ClipboardImageError" && CODES.includes(e.code);
|
|
41
|
+
}
|
|
42
|
+
function codeOf(err) {
|
|
43
|
+
const msg = err instanceof Error ? err.message : String(err ?? "");
|
|
44
|
+
let best = null;
|
|
45
|
+
for (const c of CODES) {
|
|
46
|
+
const m = new RegExp(`(^|[^a-z_])${c}([^a-z_]|$)`).exec(msg);
|
|
47
|
+
if (!m) continue;
|
|
48
|
+
const at = m.index + m[1].length;
|
|
49
|
+
if (!best || at < best.at) best = { code: c, at };
|
|
50
|
+
}
|
|
51
|
+
return best?.code ?? null;
|
|
52
|
+
}
|
|
53
|
+
function plainlyNotAnImage(mimeType) {
|
|
54
|
+
const mime = (mimeType ?? "").toLowerCase().trim();
|
|
55
|
+
return mime !== "" && mime !== "application/octet-stream" && !mime.startsWith("image/");
|
|
56
|
+
}
|
|
57
|
+
async function writeImage(file) {
|
|
58
|
+
const handle = typeof file === "string" ? null : file;
|
|
59
|
+
const uri = typeof file === "string" ? file : file?.uri;
|
|
60
|
+
if (typeof uri !== "string" || uri.length === 0) throw clipboardImageError("not_allowed", "no file uri");
|
|
61
|
+
if (handle) {
|
|
62
|
+
if (plainlyNotAnImage(handle.mimeType)) throw clipboardImageError("unsupported_type", String(handle.mimeType));
|
|
63
|
+
if (typeof handle.sizeBytes === "number" && handle.sizeBytes > MAX_IMAGE_BYTES) throw clipboardImageError("too_large", `${handle.sizeBytes} bytes`);
|
|
64
|
+
}
|
|
65
|
+
const params = { uri };
|
|
66
|
+
if (handle?.mimeType) params.mimeType = handle.mimeType;
|
|
67
|
+
if (handle?.ownerScope) params.ownerScope = handle.ownerScope;
|
|
68
|
+
try {
|
|
69
|
+
await dispatch("capability.clipboard.writeImage", params);
|
|
70
|
+
} catch (err) {
|
|
71
|
+
const code = codeOf(err);
|
|
72
|
+
if (code) throw clipboardImageError(code, err instanceof Error ? err.message : String(err));
|
|
73
|
+
throw err;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async function hasImage() {
|
|
77
|
+
const r = await dispatch("capability.clipboard.hasImage");
|
|
78
|
+
return r?.has === true;
|
|
79
|
+
}
|
|
80
|
+
var version = 2;
|
|
30
81
|
export {
|
|
82
|
+
IMAGE_MIME_TYPES,
|
|
83
|
+
MAX_IMAGE_BYTES,
|
|
84
|
+
clipboardImageError,
|
|
85
|
+
hasImage,
|
|
31
86
|
hasText,
|
|
87
|
+
isClipboardImageError,
|
|
32
88
|
readText,
|
|
33
89
|
version,
|
|
90
|
+
writeImage,
|
|
34
91
|
writeText
|
|
35
92
|
};
|
|
36
93
|
//# sourceMappingURL=clipboard.mjs.map
|
|
@@ -23,12 +23,12 @@ var CAPABILITY_REGISTRY = {
|
|
|
23
23
|
"calendar": ["createEvent", "deleteEvent", "getPermissionStatus", "listEvents", "requestPermission", "updateEvent"],
|
|
24
24
|
"calls": ["answer", "availability", "getPermissionStatus", "getState", "hangup", "listCalls", "offer", "receiveSignal", "reject", "requestPermission", "setMuted", "setRingback", "setSpeaker", "signalNext", "signalStart", "signalStop", "start", "subscribeEvents"],
|
|
25
25
|
"camera": ["capture", "pickDocument", "prepareImage", "scanQR"],
|
|
26
|
-
"clipboard": ["hasText", "readText", "writeText"],
|
|
26
|
+
"clipboard": ["hasImage", "hasText", "readText", "writeImage", "writeText"],
|
|
27
27
|
"contacts": ["getPermissionStatus", "pick", "requestPermission", "search"],
|
|
28
28
|
"file_picker": ["pick", "pickDirectoryForExport"],
|
|
29
29
|
"files": ["list", "readText", "remove", "stat", "write"],
|
|
30
30
|
"godot": ["loadPack", "release", "send"],
|
|
31
|
-
"haptic": ["play"],
|
|
31
|
+
"haptic": ["play", "sequence", "vibrate"],
|
|
32
32
|
"health": ["availability", "getPermissionStatus", "query", "requestPermission", "saveWorkout"],
|
|
33
33
|
"himi_apps": ["canOpen", "current", "hostInfo", "open"],
|
|
34
34
|
"iap": ["appBinding", "consume", "entitlements", "finishTransaction", "getPaywallConfig", "getProducts", "getUnfinishedTransactions", "purchase", "purchaseForVerification", "restore"],
|
|
@@ -14,12 +14,81 @@ function dispatch(handlerId, params, _options) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
// ../../core/sdk/haptic/src/index.ts
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
var MAX_SEQUENCE_STEPS = 32;
|
|
18
|
+
var MAX_DURATION_MS = 1e4;
|
|
19
|
+
function clampIntensity(intensity) {
|
|
20
|
+
if (intensity === void 0 || typeof intensity !== "number" || !Number.isFinite(intensity)) return void 0;
|
|
21
|
+
return Math.min(1, Math.max(0, intensity));
|
|
19
22
|
}
|
|
20
|
-
var
|
|
23
|
+
var UNKNOWN_ACTION = /unknown[_ ]?(action|handler)|ActionError\.unknown|^unknown\(|no handler/i;
|
|
24
|
+
function toResult(payload) {
|
|
25
|
+
const p = payload;
|
|
26
|
+
if (p && p.ok === false) {
|
|
27
|
+
return { ok: false, reason: p.reason === "unsupported_binary" ? "unsupported_binary" : "unavailable" };
|
|
28
|
+
}
|
|
29
|
+
return { ok: true };
|
|
30
|
+
}
|
|
31
|
+
async function settle(pending) {
|
|
32
|
+
try {
|
|
33
|
+
return toResult(await pending);
|
|
34
|
+
} catch (e) {
|
|
35
|
+
if (UNKNOWN_ACTION.test(String(e?.message ?? e))) return { ok: false, reason: "unsupported_binary" };
|
|
36
|
+
throw e;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async function play(pattern = "light", options = {}) {
|
|
40
|
+
const params = { pattern };
|
|
41
|
+
const intensity = clampIntensity(options.intensity);
|
|
42
|
+
if (intensity !== void 0) params.intensity = intensity;
|
|
43
|
+
return toResult(await dispatch("capability.haptic.play", params));
|
|
44
|
+
}
|
|
45
|
+
async function sequence(steps) {
|
|
46
|
+
if (!Array.isArray(steps)) throw new TypeError("sequence: steps must be an array");
|
|
47
|
+
if (steps.length > MAX_SEQUENCE_STEPS) {
|
|
48
|
+
throw new RangeError(`sequence: at most ${MAX_SEQUENCE_STEPS} steps (got ${steps.length})`);
|
|
49
|
+
}
|
|
50
|
+
let total = 0;
|
|
51
|
+
const wire = steps.map((s, i) => {
|
|
52
|
+
const delayMs = Number(s?.delayMs ?? 0);
|
|
53
|
+
if (!Number.isFinite(delayMs) || delayMs < 0) throw new RangeError(`sequence: step ${i} has an invalid delayMs`);
|
|
54
|
+
total += delayMs;
|
|
55
|
+
const out = {
|
|
56
|
+
pattern: String(s?.pattern ?? "light"),
|
|
57
|
+
delayMs: Math.round(delayMs)
|
|
58
|
+
};
|
|
59
|
+
const intensity = clampIntensity(s?.intensity);
|
|
60
|
+
if (intensity !== void 0) out.intensity = intensity;
|
|
61
|
+
return out;
|
|
62
|
+
});
|
|
63
|
+
if (total > MAX_DURATION_MS) {
|
|
64
|
+
throw new RangeError(`sequence: total delay ${total}ms exceeds ${MAX_DURATION_MS}ms`);
|
|
65
|
+
}
|
|
66
|
+
return settle(dispatch("capability.haptic.sequence", { steps: JSON.stringify(wire) }));
|
|
67
|
+
}
|
|
68
|
+
async function vibrate(patternMs) {
|
|
69
|
+
if (!Array.isArray(patternMs) || patternMs.length === 0) {
|
|
70
|
+
throw new RangeError("vibrate: patternMs must be a non-empty array");
|
|
71
|
+
}
|
|
72
|
+
let total = 0;
|
|
73
|
+
const wire = patternMs.map((ms, i) => {
|
|
74
|
+
const n = Number(ms);
|
|
75
|
+
if (!Number.isFinite(n) || n < 0) throw new RangeError(`vibrate: duration ${i} is invalid`);
|
|
76
|
+
total += n;
|
|
77
|
+
return Math.round(n);
|
|
78
|
+
});
|
|
79
|
+
if (total > MAX_DURATION_MS) {
|
|
80
|
+
throw new RangeError(`vibrate: pattern totals ${total}ms, over ${MAX_DURATION_MS}ms`);
|
|
81
|
+
}
|
|
82
|
+
return settle(dispatch("capability.haptic.vibrate", { pattern: wire.join(",") }));
|
|
83
|
+
}
|
|
84
|
+
var version = 2;
|
|
21
85
|
export {
|
|
86
|
+
MAX_DURATION_MS,
|
|
87
|
+
MAX_SEQUENCE_STEPS,
|
|
88
|
+
clampIntensity,
|
|
22
89
|
play,
|
|
23
|
-
|
|
90
|
+
sequence,
|
|
91
|
+
version,
|
|
92
|
+
vibrate
|
|
24
93
|
};
|
|
25
94
|
//# sourceMappingURL=haptic.mjs.map
|
|
@@ -23,12 +23,12 @@ var CAPABILITY_REGISTRY = {
|
|
|
23
23
|
"calendar": ["createEvent", "deleteEvent", "getPermissionStatus", "listEvents", "requestPermission", "updateEvent"],
|
|
24
24
|
"calls": ["answer", "availability", "getPermissionStatus", "getState", "hangup", "listCalls", "offer", "receiveSignal", "reject", "requestPermission", "setMuted", "setRingback", "setSpeaker", "signalNext", "signalStart", "signalStop", "start", "subscribeEvents"],
|
|
25
25
|
"camera": ["capture", "pickDocument", "prepareImage", "scanQR"],
|
|
26
|
-
"clipboard": ["hasText", "readText", "writeText"],
|
|
26
|
+
"clipboard": ["hasImage", "hasText", "readText", "writeImage", "writeText"],
|
|
27
27
|
"contacts": ["getPermissionStatus", "pick", "requestPermission", "search"],
|
|
28
28
|
"file_picker": ["pick", "pickDirectoryForExport"],
|
|
29
29
|
"files": ["list", "readText", "remove", "stat", "write"],
|
|
30
30
|
"godot": ["loadPack", "release", "send"],
|
|
31
|
-
"haptic": ["play"],
|
|
31
|
+
"haptic": ["play", "sequence", "vibrate"],
|
|
32
32
|
"health": ["availability", "getPermissionStatus", "query", "requestPermission", "saveWorkout"],
|
|
33
33
|
"himi_apps": ["canOpen", "current", "hostInfo", "open"],
|
|
34
34
|
"iap": ["appBinding", "consume", "entitlements", "finishTransaction", "getPaywallConfig", "getProducts", "getUnfinishedTransactions", "purchase", "purchaseForVerification", "restore"],
|