@wix/himalaya-cli 0.1634.0 → 0.1636.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 (54) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-config.d.ts +1 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-module.d.ts +2 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/wix-payments-contract.d.ts +22 -10
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/wix-payments-wire.d.ts +16 -6
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/wix-payments.d.ts +11 -4
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +6 -0
  7. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/apple-iap-contract.d.ts +10 -4
  8. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap-checkout.mjs +84 -16
  9. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap.mjs +67 -10
  10. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +83 -15
  11. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +1 -0
  12. package/dist/browser-plane/assets.json +5 -5
  13. package/dist/browser-plane/preview-deferred/{c3457ce58c96b65f303fec0ddf5f06733004eaf9e21e62302b155ec63a7765f7.bin → 67feb362281a3040ee05592769227c58a98ec3c8073dac95ecb5629141c67061.bin} +1 -1
  14. package/dist/browser-plane/sw.js +7 -7
  15. package/dist/cli.mjs +241 -57
  16. package/dist/preview-assets.generated.bin +0 -0
  17. package/fixtures/wix-canned.json +3 -0
  18. package/guides/designing-himi-screens.md +5 -1
  19. package/guides/himi-json-output.md +14 -1
  20. package/guides/himi-mcp.md +5 -3
  21. package/guides/iap-products.md +8 -0
  22. package/guides/sdk-reference.json +22 -8
  23. package/guides/skill.md +1 -0
  24. package/package.json +2 -2
  25. package/templates/beauty-salon/tier5-src/_shared/collection-contract.ts +0 -1
  26. package/templates/beauty-salon-owner/tier5-src/_shared/collection-contract.ts +0 -1
  27. package/templates/branded-lite/dev/index.ts +226 -2060
  28. package/templates/branded-lite/l10n/en.json +3 -5
  29. package/templates/branded-lite/tier5-src/_shared/collection-contract.ts +0 -1
  30. package/templates/branded-lite/tier5-src/_shared/himi-cms.ts +2 -1
  31. package/templates/branded-lite/tier5-src/himi-branded-lite-cms/index.ts +160 -39
  32. package/templates/community-club/dev/index.ts +210 -2044
  33. package/templates/community-club/tier5-src/_shared/collection-contract.ts +0 -1
  34. package/templates/community-club/tier5-src/_shared/himi-cms.ts +2 -1
  35. package/templates/community-club/tier5-src/himi-branded-lite-cms/index.ts +160 -39
  36. package/templates/community-club-owner/tier5-src/_shared/collection-contract.ts +0 -1
  37. package/templates/events-meetups/tier5-src/_shared/collection-contract.ts +0 -1
  38. package/templates/events-meetups-owner/tier5-src/_shared/collection-contract.ts +0 -1
  39. package/templates/gym-fitness/tier5-src/_shared/collection-contract.ts +0 -1
  40. package/templates/gym-fitness-owner/tier5-src/_shared/collection-contract.ts +0 -1
  41. package/templates/nonprofit-cause/tier5-src/_shared/collection-contract.ts +0 -1
  42. package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-contract.ts +0 -1
  43. package/templates/owner-lite/tier5-src/_shared/collection-contract.ts +0 -1
  44. package/templates/podcast-creator/tier5-src/_shared/collection-contract.ts +0 -1
  45. package/templates/podcast-creator-owner/tier5-src/_shared/collection-contract.ts +0 -1
  46. package/templates/portfolio-creative/tier5-src/_shared/collection-contract.ts +0 -1
  47. package/templates/portfolio-creative-owner/tier5-src/_shared/collection-contract.ts +0 -1
  48. package/templates/restaurant/tier5-src/_shared/collection-contract.ts +0 -1
  49. package/templates/restaurant-owner/tier5-src/_shared/collection-contract.ts +0 -1
  50. package/templates/retail-store/tier5-src/_shared/collection-contract.ts +0 -1
  51. package/templates/retail-store-owner/tier5-src/_shared/collection-contract.ts +0 -1
  52. package/templates/salon-spa/tier5-src/_shared/collection-contract.ts +0 -1
  53. package/templates/yoga-studio/tier5-src/_shared/collection-contract.ts +0 -1
  54. package/templates/yoga-studio-owner/tier5-src/_shared/collection-contract.ts +0 -1
@@ -2734,18 +2734,45 @@ function wixApiGlobal() {
2734
2734
  function startPaymentCall(scope, wixTransactionId) {
2735
2735
  return post(scope, "/payments/start", { appleBundleId: scope.binding.bundleId, wixTransactionId });
2736
2736
  }
2737
- function startItemPaymentCall(scope, item) {
2738
- return post(scope, "/payments/start-item", { appleBundleId: scope.binding.bundleId, item: { catalogItemId: item.catalogItemId, catalogAppId: item.catalogAppId } });
2737
+ function startItemPaymentCall(scope, item, storeCountryCode) {
2738
+ const { catalogItemId, catalogAppId, options } = item;
2739
+ return post(scope, "/payments/start-item", {
2740
+ appleBundleId: scope.binding.bundleId,
2741
+ item: { catalogItemId, catalogAppId, ...options ? { options } : {} },
2742
+ ...storeCountryCode ? { storeCountryCode } : {}
2743
+ });
2739
2744
  }
2740
2745
  function catalogItemOf(raw) {
2741
2746
  const item = isObject3(raw) ? raw : {};
2742
- const { catalogItemId, catalogAppId } = item;
2747
+ const { catalogItemId, catalogAppId, options } = item;
2743
2748
  const valid = typeof catalogItemId === "string" && catalogItemId.length > 0 && catalogItemId.length <= 36 && isUUID(catalogAppId);
2744
- return valid ? { catalogItemId, catalogAppId } : null;
2749
+ if (!valid || options !== void 0 && !isJsonObject(options)) return null;
2750
+ return options && Object.keys(options).length > 0 ? { catalogItemId, catalogAppId, options } : { catalogItemId, catalogAppId };
2751
+ }
2752
+ function isStoreCountryCode(value) {
2753
+ return typeof value === "string" && /^[A-Z]{3}$/.test(value);
2754
+ }
2755
+ var MAX_JSON_DEPTH = 32;
2756
+ function isJsonObject(value, depth = 0) {
2757
+ return depth < MAX_JSON_DEPTH && isPlainObject(value) && Object.values(value).every((v) => isJsonValue(v, depth + 1));
2758
+ }
2759
+ function isJsonValue(value, depth) {
2760
+ if (value === null || typeof value === "string" || typeof value === "boolean") return true;
2761
+ if (typeof value === "number") return Number.isFinite(value);
2762
+ if (Array.isArray(value)) return depth < MAX_JSON_DEPTH && value.every((v) => isJsonValue(v, depth + 1));
2763
+ return isJsonObject(value, depth);
2764
+ }
2765
+ function isPlainObject(value) {
2766
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
2767
+ const proto = Object.getPrototypeOf(value);
2768
+ return proto === Object.prototype || proto === null;
2745
2769
  }
2746
2770
  function completePaymentCall(scope, signedTransaction) {
2747
2771
  return post(scope, "/payments/complete", { appleBundleId: scope.binding.bundleId, apple: { signedTransaction } });
2748
2772
  }
2773
+ function cancelPaymentCall(scope, paymentId) {
2774
+ return post(scope, `/payments/${encodeURIComponent(paymentId)}/cancel`, { appleBundleId: scope.binding.bundleId });
2775
+ }
2749
2776
  function paymentCall(scope, paymentId) {
2750
2777
  return get2(scope, `/payments/${encodeURIComponent(paymentId)}`);
2751
2778
  }
@@ -2758,10 +2785,17 @@ function decodeStarted(raw, expected) {
2758
2785
  return payment && { payment, storeProductId: raw.storeProductId, appAccountToken: raw.appAccountToken };
2759
2786
  }
2760
2787
  function decodeStartedItem(raw, expected) {
2761
- if (!isObject3(raw) || !isUUID(raw.ecomOrderId)) return null;
2788
+ if (!isObject3(raw)) return null;
2789
+ const ecomOrderId = optionalId(raw.ecomOrderId);
2790
+ const joinApplicationId = optionalId(raw.joinApplicationId);
2791
+ if (ecomOrderId === null || joinApplicationId === null || !ecomOrderId && !joinApplicationId) return null;
2762
2792
  const started = decodeStarted(raw, expected);
2763
2793
  if (!started || started.payment.appProductId !== expected.catalogItemId) return null;
2764
- return { ...started, ecomOrderId: raw.ecomOrderId };
2794
+ return { ...started, ...ecomOrderId ? { ecomOrderId } : {}, ...joinApplicationId ? { joinApplicationId } : {} };
2795
+ }
2796
+ function optionalId(value) {
2797
+ if (value === void 0 || value === "") return void 0;
2798
+ return isUUID(value) ? value : null;
2765
2799
  }
2766
2800
  function decodePaymentAnswer(raw, expected) {
2767
2801
  return isObject3(raw) ? decodePayment(raw.payment, expected) : null;
@@ -2887,11 +2921,12 @@ function createWixIapClient(deps) {
2887
2921
  }
2888
2922
  function startItemPayment(input) {
2889
2923
  const item = catalogItemOf(input.item);
2890
- if (!item) return Promise.resolve(failure2("startItemPayment", "invalidArgument"));
2924
+ const country = input.storeCountryCode;
2925
+ if (!item || country !== void 0 && !isStoreCountryCode(country)) return Promise.resolve(failure2("startItemPayment", "invalidArgument"));
2891
2926
  return runUnrepeatable({
2892
2927
  operation: "startItemPayment",
2893
2928
  codes: START_ITEM_PAYMENT_CODES,
2894
- request: (scope) => startItemPaymentCall(scope, item),
2929
+ request: (scope) => startItemPaymentCall(scope, item, country),
2895
2930
  decode: (raw, scope) => {
2896
2931
  const started = decodeStartedItem(raw, { ...expectationOf2(scope), catalogItemId: item.catalogItemId });
2897
2932
  return started && { status: "started", ...started };
@@ -2923,6 +2958,18 @@ function createWixIapClient(deps) {
2923
2958
  }
2924
2959
  });
2925
2960
  }
2961
+ function cancelPayment(input) {
2962
+ if (!isUUID(input.paymentId)) return Promise.resolve(failure2("cancelPayment", "invalidArgument"));
2963
+ return run({
2964
+ operation: "cancelPayment",
2965
+ codes: CANCEL_PAYMENT_CODES,
2966
+ request: (scope) => cancelPaymentCall(scope, input.paymentId),
2967
+ decode: (raw, scope) => {
2968
+ const payment = decodePaymentAnswer(raw, { ...expectationOf2(scope), paymentId: input.paymentId });
2969
+ return payment && { status: "answered", payment };
2970
+ }
2971
+ });
2972
+ }
2926
2973
  async function run(spec) {
2927
2974
  return (await execute(spec)).result;
2928
2975
  }
@@ -2972,7 +3019,7 @@ function createWixIapClient(deps) {
2972
3019
  function isCurrent(session) {
2973
3020
  return deps.session.current().generation === session.generation;
2974
3021
  }
2975
- return { startPayment, startItemPayment, completePayment, getPayment };
3022
+ return { startPayment, startItemPayment, completePayment, getPayment, cancelPayment };
2976
3023
  }
2977
3024
  async function attempt2(transport, call, spec, expectation) {
2978
3025
  try {
@@ -3036,8 +3083,18 @@ var START_ITEM_PAYMENT_CODES = [
3036
3083
  "ALREADY_OWNED",
3037
3084
  "ITEM_NOT_AVAILABLE",
3038
3085
  "SITE_NOT_ACCEPTING_PAYMENTS",
3039
- "UNSUPPORTED_ORDER"
3086
+ "UNSUPPORTED_ORDER",
3087
+ "CATALOG_NOT_SUPPORTED",
3088
+ "VERTICAL_ACCESS_DENIED",
3089
+ "EVENT_CHECKOUT_NOT_ECOM",
3090
+ "ALREADY_SUBSCRIBED",
3091
+ "SUBSCRIPTION_NOT_IN_APP",
3092
+ "BILLING_COUNTRY_REQUIRED",
3093
+ "APP_NOT_CONFIGURED",
3094
+ "NOT_BOOKING_OWNER",
3095
+ "BOOKING_PAYMENT_PENDING"
3040
3096
  ];
3097
+ var CANCEL_PAYMENT_CODES = ["NOT_PENDING", "APP_NOT_CONFIGURED", "NOT_FOUND"];
3041
3098
  var UNDECIDED = /* @__PURE__ */ new Set(["unavailable", "sessionChanged", "invalidResponse"]);
3042
3099
  var COMPLETE_PAYMENT_CODES = [
3043
3100
  "INVALID_PURCHASE",
@@ -3727,7 +3784,7 @@ function createWixOrderBackend(deps) {
3727
3784
  const attempt4 = existing?.cashierOrderId && existing.verticalRef ? await reopenOrOpen(sale, { cashierOrderId: existing.cashierOrderId, verticalRef: existing.verticalRef }) : await sale.adapter.openOrder(sale.item, sale.bridge, beforeCreate, afterCreate);
3728
3785
  if (prevented) return prevented;
3729
3786
  if (guarded !== void 0 && attempt4.status === "open" && !stillGuarded(sale, guarded)) return retry("unavailable");
3730
- const ref = recordOrder(sale, existing, attempt4);
3787
+ const ref = recordOrder(sale, existing, attempt4, guarded);
3731
3788
  return isStop(ref) ? ref : { ref, placed: isPlaced(attempt4) };
3732
3789
  }
3733
3790
  function stillGuarded(sale, guarded) {
@@ -3739,8 +3796,8 @@ function createWixOrderBackend(deps) {
3739
3796
  const closed = reopened.status === "refused" && reopened.reason === "orderClosed";
3740
3797
  return closed && !sale.adapter.repeatable ? sale.adapter.openOrder(sale.item, sale.bridge) : reopened;
3741
3798
  }
3742
- function recordOrder(sale, existing, attempt4) {
3743
- if (attempt4.noOrderCreated && refAt(sale.partition, sale.catalogRef)?.stage === "openingOrder" && !sale.partition.remove(sale.catalogRef)) {
3799
+ function recordOrder(sale, existing, attempt4, guarded) {
3800
+ if (attempt4.noOrderCreated && guarded !== void 0 && stillGuarded(sale, guarded) && !sale.partition.remove(sale.catalogRef)) {
3744
3801
  return stopWith("rejected", "storageUnavailable");
3745
3802
  }
3746
3803
  if (attempt4.status === "granted") return alreadyOwned(sale);
@@ -3821,12 +3878,14 @@ function createWixOrderBackend(deps) {
3821
3878
  }
3822
3879
  function startedItem(sale, itemPayment, started) {
3823
3880
  if (started.storeProductId !== sale.appleProduct.productId) return contextResult(sale.catalogRef, stopWith("rejected", "productChanged"));
3881
+ const verticalRef = itemPayment.verticalRefOf(started);
3882
+ if (!verticalRef) return contextResult(sale.catalogRef, OUTCOME_UNKNOWN);
3824
3883
  const { payment, storeProductId, appAccountToken } = started;
3825
3884
  const recorded = persist(sale, {
3826
3885
  key: sale.catalogRef,
3827
3886
  stage: "started",
3828
3887
  kind: sale.adapter.kind,
3829
- verticalRef: itemPayment.verticalRefOf(started.ecomOrderId),
3888
+ verticalRef,
3830
3889
  wixTransactionId: payment.wixTransactionId,
3831
3890
  paymentId: payment.paymentId,
3832
3891
  storeProductId,
@@ -3991,7 +4050,16 @@ var ITEM_REFUSALS = {
3991
4050
  ALREADY_OWNED: "paymentRefused",
3992
4051
  ITEM_NOT_AVAILABLE: "orderRefused",
3993
4052
  SITE_NOT_ACCEPTING_PAYMENTS: "sitePaymentUnavailable",
3994
- UNSUPPORTED_ORDER: "orderRefused"
4053
+ UNSUPPORTED_ORDER: "orderRefused",
4054
+ CATALOG_NOT_SUPPORTED: "unsupportedItem",
4055
+ EVENT_CHECKOUT_NOT_ECOM: "unsupportedItem",
4056
+ VERTICAL_ACCESS_DENIED: "notConfigured",
4057
+ APP_NOT_CONFIGURED: "notConfigured",
4058
+ ALREADY_SUBSCRIBED: "paymentRefused",
4059
+ SUBSCRIPTION_NOT_IN_APP: "paymentRefused",
4060
+ BILLING_COUNTRY_REQUIRED: "orderRefused",
4061
+ NOT_BOOKING_OWNER: "orderRefused",
4062
+ BOOKING_PAYMENT_PENDING: "paymentInProgress"
3995
4063
  };
3996
4064
  var KIND_STOPS = {
3997
4065
  authRequired: SIGN_IN,
@@ -9425,6 +9425,7 @@ function deriveAppMeta(name, m, platforms = {}, provisioning = {}) {
9425
9425
  site: config.navigation?.site,
9426
9426
  streamPolicy: config.navigation?.streamPolicy,
9427
9427
  topBarLogo: config.navigation?.topBarLogo,
9428
+ presentationQueue: config.navigation?.presentationQueue,
9428
9429
  splash: config.splash,
9429
9430
  locale: config.locale,
9430
9431
  deepLinkPatterns: config.navigation?.deepLinkPatterns,
@@ -2,7 +2,7 @@
2
2
  "files": [
3
3
  {
4
4
  "name": "sw.js",
5
- "bytes": 2452155
5
+ "bytes": 2455277
6
6
  },
7
7
  {
8
8
  "name": "host.html",
@@ -21,7 +21,7 @@
21
21
  "bytes": 23064
22
22
  },
23
23
  {
24
- "name": "preview-deferred/c3457ce58c96b65f303fec0ddf5f06733004eaf9e21e62302b155ec63a7765f7.bin",
24
+ "name": "preview-deferred/67feb362281a3040ee05592769227c58a98ec3c8073dac95ecb5629141c67061.bin",
25
25
  "bytes": 488215
26
26
  },
27
27
  {
@@ -79,10 +79,10 @@
79
79
  ],
80
80
  "deferred": [
81
81
  {
82
- "key": "assets/pdf-m0Fd7UDI.js",
82
+ "key": "assets/pdf-CDxdgL1u.js",
83
83
  "contentType": "application/javascript; charset=utf-8",
84
- "sha256": "c3457ce58c96b65f303fec0ddf5f06733004eaf9e21e62302b155ec63a7765f7",
85
- "file": "preview-deferred/c3457ce58c96b65f303fec0ddf5f06733004eaf9e21e62302b155ec63a7765f7.bin"
84
+ "sha256": "67feb362281a3040ee05592769227c58a98ec3c8073dac95ecb5629141c67061",
85
+ "file": "preview-deferred/67feb362281a3040ee05592769227c58a98ec3c8073dac95ecb5629141c67061.bin"
86
86
  },
87
87
  {
88
88
  "key": "assets/pdf.worker.min-BGnVRhRG.js",