@wix/himalaya-cli 0.1345.0 → 0.1348.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 (23) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/presigned-upload/src/index.d.ts +5 -12
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/checkout/src/index.d.ts +7 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/checkout.mjs +7 -2
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +7 -2
  5. package/dist/cli.mjs +102 -47
  6. package/dist/preview-assets.generated.bin +0 -0
  7. package/guides/sdk-reference.json +1 -1
  8. package/package.json +2 -2
  9. package/templates/beauty-salon/tier5-src/_shared/hosted-checkout.ts +42 -0
  10. package/templates/beauty-salon/tier5-src/himi-booking-time/index.ts +9 -3
  11. package/templates/beauty-salon/tier5-src/himi-branded-lite-cart/index.ts +11 -3
  12. package/templates/branded-lite/tier5-src/_shared/hosted-checkout.ts +42 -0
  13. package/templates/branded-lite/tier5-src/himi-booking-time/index.ts +9 -3
  14. package/templates/branded-lite/tier5-src/himi-branded-lite-cart/index.ts +11 -3
  15. package/templates/gym-fitness/tier5-src/_shared/hosted-checkout.ts +42 -0
  16. package/templates/gym-fitness/tier5-src/himi-booking-time/index.ts +9 -3
  17. package/templates/gym-fitness/tier5-src/himi-branded-lite-cart/index.ts +11 -3
  18. package/templates/portfolio-creative/tier5-src/_shared/hosted-checkout.ts +42 -0
  19. package/templates/portfolio-creative/tier5-src/himi-branded-lite-cart/index.ts +11 -3
  20. package/templates/retail-store/tier5-src/_shared/hosted-checkout.ts +42 -0
  21. package/templates/retail-store/tier5-src/himi-branded-lite-cart/index.ts +11 -3
  22. package/templates/yoga-studio/tier5-src/_shared/hosted-checkout.ts +42 -0
  23. package/templates/yoga-studio/tier5-src/himi-booking-time/index.ts +9 -3
@@ -54,18 +54,11 @@ export declare function put(url: string, bytes: {
54
54
  * `@himalaya/files` substrate — the bytes never cross the worker bridge, so this is
55
55
  * the path for photos and voice notes.
56
56
  *
57
- * DECLARE "files" TOO. This verb reads the app's document substrate, so a bundle that
58
- * uses it is doing file access and its declared list should say so — the privacy
59
- * manifest and the generated native config are built from that list.
60
- *
61
- * Be aware of what is and is not enforced. The runtime gate keys on the capability id in
62
- * the action name, so `capability.presigned_upload.putFile` is admitted by declaring
63
- * `presigned_upload` alone: today a bundle can reach a substrate path without declaring
64
- * `files`. That is a gap in the gate, not a licence — and it is deliberately NOT closed
65
- * by adding `presigned_upload → files` to CAPABILITY_IMPLIES, because that table grants
66
- * supersets, and granting the WHOLE files capability (write, remove, list) to anything
67
- * that can upload would be a wider hole than the one it patched. Closing it properly
68
- * needs a requires-relation the gate does not have yet.
57
+ * DECLARE "files" TOO — it is REQUIRED. This verb reads the app's document substrate, so
58
+ * the worker gate on every runtime (iOS, macOS, Android, web) refuses
59
+ * `capability.presigned_upload.putFile` to a bundle that does not also declare `files`.
60
+ * Deliberately a requirement and NOT a `presigned_upload → files` implication:
61
+ * declaring `presigned_upload` grants none of the files surface (write, remove, list).
69
62
  */
70
63
  export declare function putFile(url: string, ref: FileHandle | string, opts?: UploadOptions): Promise<UploadResult>;
71
64
  /** Capability version, for bundles that gate on min binary version. */
@@ -62,6 +62,13 @@ export interface PayRequest {
62
62
  currency?: string;
63
63
  /** Mints the in-app cashier URL. Called ONLY when the wallet rail cannot settle. */
64
64
  cashierUrl?: () => Promise<string | undefined>;
65
+ /** Opens the cashier ITSELF, in place of `cashierUrl` + an in-app browser: a host that must sign
66
+ * the member in on the site first (a hosted app's checkout, RFC 0071 §4 Step 4b) owns the URL,
67
+ * which carries a session token no worker may see. Resolves whether the cashier opened, or
68
+ * "withdrawn" when [stillMayCharge] — the caller's `mayCharge`, re-read — said no once the host had
69
+ * prepared it: preparing takes network round trips, during which the caller's route can change, so
70
+ * the host asks again right before it opens. */
71
+ openCashier?: (stillMayCharge: () => Promise<boolean>) => Promise<boolean | "withdrawn">;
65
72
  /** Re-read immediately before money moves (the wallet charge, the cashier opening). The caller's
66
73
  * own route can change while a rail is being chosen; false stops the flow with nothing charged. */
67
74
  mayCharge?: () => boolean | Promise<boolean>;
@@ -140,7 +140,7 @@ async function isEntitled() {
140
140
  }
141
141
  var WITHDRAWN = { kind: "failed", reason: "the caller withdrew the charge" };
142
142
  async function payOrder(req) {
143
- if (!req.snapshotId && !req.cashierUrl) {
143
+ if (!req.snapshotId && !req.cashierUrl && !req.openCashier) {
144
144
  return { kind: "failed", reason: "no order to settle" };
145
145
  }
146
146
  const availability = await isAvailable().catch(() => "unavailable");
@@ -163,7 +163,12 @@ async function payOrder(req) {
163
163
  }
164
164
  if (r.status === "cancelled") return { kind: "cancelled" };
165
165
  }
166
- if (req.cashierUrl) {
166
+ if (req.openCashier) {
167
+ if (await req.mayCharge?.() === false) return WITHDRAWN;
168
+ const opened = await req.openCashier(async () => await req.mayCharge?.() !== false).catch(() => false);
169
+ if (opened === "withdrawn") return WITHDRAWN;
170
+ if (opened === true) return { kind: "handoff" };
171
+ } else if (req.cashierUrl) {
167
172
  const url = await req.cashierUrl().catch(() => void 0);
168
173
  if (url) {
169
174
  if (await req.mayCharge?.() === false) return WITHDRAWN;
@@ -224,7 +224,7 @@ async function entitlement(planId) {
224
224
  }
225
225
  var WITHDRAWN = { kind: "failed", reason: "the caller withdrew the charge" };
226
226
  async function payOrder(req) {
227
- if (!req.snapshotId && !req.cashierUrl) {
227
+ if (!req.snapshotId && !req.cashierUrl && !req.openCashier) {
228
228
  return { kind: "failed", reason: "no order to settle" };
229
229
  }
230
230
  const availability = await isAvailable().catch(() => "unavailable");
@@ -247,7 +247,12 @@ async function payOrder(req) {
247
247
  }
248
248
  if (r.status === "cancelled") return { kind: "cancelled" };
249
249
  }
250
- if (req.cashierUrl) {
250
+ if (req.openCashier) {
251
+ if (await req.mayCharge?.() === false) return WITHDRAWN;
252
+ const opened = await req.openCashier(async () => await req.mayCharge?.() !== false).catch(() => false);
253
+ if (opened === "withdrawn") return WITHDRAWN;
254
+ if (opened === true) return { kind: "handoff" };
255
+ } else if (req.cashierUrl) {
251
256
  const url = await req.cashierUrl().catch(() => void 0);
252
257
  if (url) {
253
258
  if (await req.mayCharge?.() === false) return WITHDRAWN;