@wix/himalaya-cli 0.1728.0 → 0.1730.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 (71) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/entity-extraction/src/index.d.ts +34 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/catalog-pricing-contract.d.ts +4 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/pricing-contract.d.ts +6 -1
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/wix-payments-contract.d.ts +10 -0
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/sdk-types/src/capabilities.generated.d.ts +4 -1
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/text-embedding/src/index.d.ts +37 -0
  7. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/translation/src/index.d.ts +51 -0
  8. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/webview-page/src/capabilities.generated.d.ts +6 -0
  9. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/define-app.d.ts +1 -1
  10. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/index.d.ts +1 -0
  11. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/pricing-plans.d.ts +20 -0
  12. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/index.d.ts +1 -1
  13. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/index.d.ts +2 -0
  14. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/audio-record.mjs +3 -0
  15. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calendar.mjs +3 -0
  16. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calls.mjs +3 -0
  17. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/contacts.mjs +3 -0
  18. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +3 -0
  19. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/entity-extraction.mjs +38 -0
  20. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap-checkout.mjs +49 -8
  21. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap.mjs +35 -9
  22. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/location.mjs +3 -0
  23. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/motion.mjs +3 -0
  24. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/photos.mjs +3 -0
  25. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +57 -14
  26. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdk-types.mjs +3 -0
  27. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/tasks.mjs +3 -0
  28. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/text-embedding.mjs +76 -0
  29. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/translation.mjs +66 -0
  30. package/dist/authoring-runtime/node_modules/@wix/himalaya/package.json +12 -0
  31. package/dist/browser-plane/assets.json +5 -5
  32. package/dist/browser-plane/preview-deferred/{ec5d778f3e7ecbc2351ab7a8f3509483b798094de9f889fe8b03447db1413cb6.bin → 9c4b4a8e0772f247f08e61b35d51b0bd2574408381cab23ec88cad1c7df68177.bin} +1 -1
  33. package/dist/browser-plane/sw.js +8 -8
  34. package/dist/cli.mjs +514 -315
  35. package/dist/preview-assets.generated.bin +0 -0
  36. package/guides/app-config.md +1 -1
  37. package/guides/capabilities.md +3 -0
  38. package/guides/iap-pricing.md +2 -2
  39. package/guides/iap-screen-adoption.md +1 -1
  40. package/guides/importable-sdks.md +3 -0
  41. package/guides/release-notes.md +30 -0
  42. package/guides/sdk-reference.json +252 -7
  43. package/guides/web-page-sdk-reference.md +3 -0
  44. package/package.json +2 -2
  45. package/templates/beauty-salon/tier5-src/himi-branded-lite-plans/index.ts +16 -7
  46. package/templates/beauty-salon-owner/dev/index.ts +35 -0
  47. package/templates/branded-lite/dev/index.ts +16 -0
  48. package/templates/branded-lite/tier5-src/himi-branded-lite-plans/index.ts +16 -7
  49. package/templates/community-club/dev/index.ts +2 -0
  50. package/templates/community-club-owner/dev/index.ts +35 -0
  51. package/templates/conference/dev/index.ts +1 -0
  52. package/templates/events-meetups/dev/index.ts +2 -0
  53. package/templates/events-meetups-owner/dev/index.ts +31 -0
  54. package/templates/gym-fitness/dev/index.ts +1 -0
  55. package/templates/gym-fitness/tier5-src/himi-branded-lite-plans/index.ts +16 -7
  56. package/templates/gym-fitness-owner/dev/index.ts +37 -0
  57. package/templates/nonprofit-cause/dev/index.ts +2 -0
  58. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-plans/index.ts +16 -7
  59. package/templates/nonprofit-cause-owner/dev/index.ts +33 -0
  60. package/templates/owner-lite/dev/index.ts +37 -0
  61. package/templates/podcast-creator/dev/index.ts +2 -0
  62. package/templates/podcast-creator/tier5-src/himi-branded-lite-plans/index.ts +16 -7
  63. package/templates/podcast-creator-owner/dev/index.ts +35 -0
  64. package/templates/portfolio-creative/dev/index.ts +2 -0
  65. package/templates/portfolio-creative-owner/dev/index.ts +35 -0
  66. package/templates/restaurant/dev/index.ts +2 -0
  67. package/templates/restaurant-owner/dev/index.ts +37 -0
  68. package/templates/retail-store-owner/dev/index.ts +33 -0
  69. package/templates/yoga-studio/dev/index.ts +2 -0
  70. package/templates/yoga-studio/tier5-src/himi-branded-lite-plans/index.ts +16 -7
  71. package/templates/yoga-studio-owner/dev/index.ts +33 -0
@@ -641,7 +641,13 @@ function resolveRoute(item, mappings, platform) {
641
641
  return unavailable(item.reference, "mappingUnresolved");
642
642
  }
643
643
  if (platform !== "ios") return unavailable(item.reference, "unsupportedPlatform");
644
- return { status: "loading", mapping: { reference: item.reference, route: "appleIap", productId: mapping.productId, mappingRevision: mapping.mappingRevision } };
644
+ return { status: "loading", mapping: {
645
+ reference: item.reference,
646
+ route: "appleIap",
647
+ productId: mapping.productId,
648
+ mappingRevision: mapping.mappingRevision,
649
+ ...mapping.renews === true ? { renews: true } : {}
650
+ } };
645
651
  }
646
652
  function regularPrice(item) {
647
653
  return nonempty(item.commerceDisplayPrice) ? { reference: item.reference, status: "ready", source: "regular", displayPrice: item.commerceDisplayPrice } : unavailable(item.reference, "commercePriceUnavailable");
@@ -650,17 +656,21 @@ function applePrice(mapping, products) {
650
656
  const matches = products.filter((value) => isObject2(value) && value.id === mapping.productId);
651
657
  const product = matches[0];
652
658
  if (matches.length !== 1 || !nonempty(product?.displayPrice)) return unavailable(mapping.reference, "priceUnavailable");
653
- const attendance = mapping.reference.kind === "bookingsService" || mapping.reference.kind === "eventsTicket";
654
- if (product?.type !== (attendance ? "consumable" : "nonConsumable")) return unavailable(mapping.reference, "unsupportedProductType");
659
+ if (product?.type !== expectedType(mapping) || mapping.renews && !nonempty(product.subscriptionPeriod)) return unavailable(mapping.reference, "unsupportedProductType");
655
660
  return {
656
661
  reference: mapping.reference,
657
662
  status: "ready",
658
663
  source: "appleIap",
659
664
  productId: mapping.productId,
660
665
  mappingRevision: mapping.mappingRevision,
661
- displayPrice: product.displayPrice
666
+ displayPrice: product.displayPrice,
667
+ ...mapping.renews ? { renews: true, subscriptionPeriod: product.subscriptionPeriod } : {}
662
668
  };
663
669
  }
670
+ function expectedType(mapping) {
671
+ if (mapping.renews) return "subscription";
672
+ return mapping.reference.kind === "bookingsService" || mapping.reference.kind === "eventsTicket" ? "consumable" : "nonConsumable";
673
+ }
664
674
  function unavailable(reference, reason) {
665
675
  return { reference, status: "unavailable", reason, retryable: !["invalidInput", "unsupportedPlatform", "unsupportedProductType", "commercePriceUnavailable"].includes(reason) };
666
676
  }
@@ -677,13 +687,14 @@ var ATTENDANCE_SALE_RULE = { appProductId: (id) => id, productType: "CONSUMABLE"
677
687
  var STORES_PRODUCT_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
678
688
  var ONLINE_PROGRAM_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
679
689
  var PRICING_PLAN_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
690
+ var PLAN_SUBSCRIPTIONS_APPLE_SALES_ENABLED = false;
680
691
  var VIDEOS_APPLE_SALES_ENABLED = false;
681
692
  var VIDEO_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
682
693
  function appleSaleRules(options = {}) {
683
694
  return {
684
695
  onlineProgram: ONLINE_PROGRAM_SALE_RULE,
685
696
  storesProduct: STORES_PRODUCT_SALE_RULE,
686
- pricingPlan: PRICING_PLAN_SALE_RULE,
697
+ pricingPlan: options.planSubscriptionsAppleSalesEnabled ?? PLAN_SUBSCRIPTIONS_APPLE_SALES_ENABLED ? { ...PRICING_PLAN_SALE_RULE, renews: true } : PRICING_PLAN_SALE_RULE,
687
698
  bookingsService: ATTENDANCE_SALE_RULE,
688
699
  eventsTicket: ATTENDANCE_SALE_RULE,
689
700
  ...options.videosAppleSalesEnabled ?? VIDEOS_APPLE_SALES_ENABLED ? { wixVideo: VIDEO_SALE_RULE } : {}
@@ -743,8 +754,18 @@ function decodeMappings(reply) {
743
754
  }
744
755
  function decide(reference, binding, mapping, rule) {
745
756
  if (!mapping || !rule) return { reference, route: "regular" };
746
- if (!mapping.active || mapping.type !== rule.productType) return { reference, route: "unavailable" };
747
- return { reference, route: "appleIap", productId: mapping.storeProductId, mappingRevision: `${binding.purchasesAppId}:${mapping.storeProductId}` };
757
+ if (!mapping.active || !sellsAs(rule, mapping.type)) return { reference, route: "unavailable" };
758
+ return {
759
+ reference,
760
+ route: "appleIap",
761
+ productId: mapping.storeProductId,
762
+ mappingRevision: `${binding.purchasesAppId}:${mapping.storeProductId}`,
763
+ ...mapping.type === RENEWING ? { renews: true } : {}
764
+ };
765
+ }
766
+ var RENEWING = "AUTO_RENEWING_SUBSCRIPTION";
767
+ function sellsAs(rule, type) {
768
+ return type === rule.productType || rule.renews === true && type === RENEWING;
748
769
  }
749
770
  function sameId(a, b) {
750
771
  return a.toLowerCase() === b.toLowerCase();
@@ -908,7 +929,11 @@ function viewOf(reference, item) {
908
929
  return unavailableView(reference, item);
909
930
  }
910
931
  function readyView(reference, item) {
911
- return item.source === "appleIap" ? { ...blockedView(reference, "appleIap"), displayPrice: item.displayPrice } : { ...regularView(reference), displayPrice: item.displayPrice };
932
+ return item.source === "appleIap" ? {
933
+ ...blockedView(reference, "appleIap"),
934
+ displayPrice: item.displayPrice,
935
+ ...item.renews ? { renews: true, subscriptionPeriod: item.subscriptionPeriod } : {}
936
+ } : { ...regularView(reference), displayPrice: item.displayPrice };
912
937
  }
913
938
  function unavailableView(reference, item) {
914
939
  if (item.reason === "commercePriceUnavailable") return regularView(reference);
@@ -949,7 +974,7 @@ function iapPriceFields(view, copy) {
949
974
  case "resolving":
950
975
  return { ...fields, priceText: copy.loading, priceLoading: true };
951
976
  case "appleIap":
952
- return { ...fields, priceText: view.displayPrice, priceNote: copy.oneTimePurchase, actionNote: copy.purchaseUnavailable };
977
+ return { ...fields, priceText: view.displayPrice, priceNote: view.renews ? "" : copy.oneTimePurchase, actionNote: copy.purchaseUnavailable };
953
978
  case "unavailable":
954
979
  return { ...fields, priceText: copy.unavailable, hidePriceRetry: !view.retryable };
955
980
  case "regular":
@@ -1736,6 +1761,7 @@ export {
1736
1761
  IAP_CATALOG_KINDS,
1737
1762
  MAX_AUTOMATIC_ATTEMPTS,
1738
1763
  MAX_RETRY_DELAY_MS,
1764
+ PLAN_SUBSCRIPTIONS_APPLE_SALES_ENABLED,
1739
1765
  STORES_PRODUCT_SALE_RULE,
1740
1766
  VIDEOS_APPLE_SALES_ENABLED,
1741
1767
  appleManagedStore,
@@ -26,6 +26,7 @@ var CAPABILITY_REGISTRY = {
26
26
  "camera": ["capture", "pickDocument", "prepareImage", "scanQR"],
27
27
  "clipboard": ["hasImage", "hasText", "readText", "writeImage", "writeText"],
28
28
  "contacts": ["add", "getPermissionStatus", "pick", "presentNewContact", "requestPermission", "search"],
29
+ "entity_extraction": ["availability", "extract"],
29
30
  "file_picker": ["pick", "pickDirectoryForExport"],
30
31
  "files": ["download", "export", "list", "readText", "remove", "stat", "storageInfo", "write"],
31
32
  "godot": ["loadPack", "release", "send"],
@@ -55,9 +56,11 @@ var CAPABILITY_REGISTRY = {
55
56
  "speech": ["availability", "recognizeOnce", "speak", "stop", "streamNext", "streamStart", "streamStop", "transcribeFile"],
56
57
  "system_intents": ["donate", "refreshShortcuts"],
57
58
  "tasks": ["backend", "create", "getPermissionStatus", "list", "remove", "requestPermission", "setCompleted"],
59
+ "text_embedding": ["availability", "embed"],
58
60
  "text_recognition": ["availability", "recognize"],
59
61
  "theme": ["applyOverlay", "clearOverlay", "surfaces"],
60
62
  "torch": ["off", "on", "status", "toggle"],
63
+ "translation": ["availability", "identifyLanguage", "prepare", "translate"],
61
64
  "ui": ["alert", "snackbar"],
62
65
  "wix_cashier": ["isAvailable", "proceedToPayment"],
63
66
  "wix_chat": ["getRealtimeStatus", "subscribeRealtime", "unsubscribeRealtime"]
@@ -26,6 +26,7 @@ var CAPABILITY_REGISTRY = {
26
26
  "camera": ["capture", "pickDocument", "prepareImage", "scanQR"],
27
27
  "clipboard": ["hasImage", "hasText", "readText", "writeImage", "writeText"],
28
28
  "contacts": ["add", "getPermissionStatus", "pick", "presentNewContact", "requestPermission", "search"],
29
+ "entity_extraction": ["availability", "extract"],
29
30
  "file_picker": ["pick", "pickDirectoryForExport"],
30
31
  "files": ["download", "export", "list", "readText", "remove", "stat", "storageInfo", "write"],
31
32
  "godot": ["loadPack", "release", "send"],
@@ -55,9 +56,11 @@ var CAPABILITY_REGISTRY = {
55
56
  "speech": ["availability", "recognizeOnce", "speak", "stop", "streamNext", "streamStart", "streamStop", "transcribeFile"],
56
57
  "system_intents": ["donate", "refreshShortcuts"],
57
58
  "tasks": ["backend", "create", "getPermissionStatus", "list", "remove", "requestPermission", "setCompleted"],
59
+ "text_embedding": ["availability", "embed"],
58
60
  "text_recognition": ["availability", "recognize"],
59
61
  "theme": ["applyOverlay", "clearOverlay", "surfaces"],
60
62
  "torch": ["off", "on", "status", "toggle"],
63
+ "translation": ["availability", "identifyLanguage", "prepare", "translate"],
61
64
  "ui": ["alert", "snackbar"],
62
65
  "wix_cashier": ["isAvailable", "proceedToPayment"],
63
66
  "wix_chat": ["getRealtimeStatus", "subscribeRealtime", "unsubscribeRealtime"]
@@ -26,6 +26,7 @@ var CAPABILITY_REGISTRY = {
26
26
  "camera": ["capture", "pickDocument", "prepareImage", "scanQR"],
27
27
  "clipboard": ["hasImage", "hasText", "readText", "writeImage", "writeText"],
28
28
  "contacts": ["add", "getPermissionStatus", "pick", "presentNewContact", "requestPermission", "search"],
29
+ "entity_extraction": ["availability", "extract"],
29
30
  "file_picker": ["pick", "pickDirectoryForExport"],
30
31
  "files": ["download", "export", "list", "readText", "remove", "stat", "storageInfo", "write"],
31
32
  "godot": ["loadPack", "release", "send"],
@@ -55,9 +56,11 @@ var CAPABILITY_REGISTRY = {
55
56
  "speech": ["availability", "recognizeOnce", "speak", "stop", "streamNext", "streamStart", "streamStop", "transcribeFile"],
56
57
  "system_intents": ["donate", "refreshShortcuts"],
57
58
  "tasks": ["backend", "create", "getPermissionStatus", "list", "remove", "requestPermission", "setCompleted"],
59
+ "text_embedding": ["availability", "embed"],
58
60
  "text_recognition": ["availability", "recognize"],
59
61
  "theme": ["applyOverlay", "clearOverlay", "surfaces"],
60
62
  "torch": ["off", "on", "status", "toggle"],
63
+ "translation": ["availability", "identifyLanguage", "prepare", "translate"],
61
64
  "ui": ["alert", "snackbar"],
62
65
  "wix_cashier": ["isAvailable", "proceedToPayment"],
63
66
  "wix_chat": ["getRealtimeStatus", "subscribeRealtime", "unsubscribeRealtime"]
@@ -2333,7 +2333,13 @@ function resolveRoute(item, mappings, platform) {
2333
2333
  return unavailable(item.reference, "mappingUnresolved");
2334
2334
  }
2335
2335
  if (platform !== "ios") return unavailable(item.reference, "unsupportedPlatform");
2336
- return { status: "loading", mapping: { reference: item.reference, route: "appleIap", productId: mapping.productId, mappingRevision: mapping.mappingRevision } };
2336
+ return { status: "loading", mapping: {
2337
+ reference: item.reference,
2338
+ route: "appleIap",
2339
+ productId: mapping.productId,
2340
+ mappingRevision: mapping.mappingRevision,
2341
+ ...mapping.renews === true ? { renews: true } : {}
2342
+ } };
2337
2343
  }
2338
2344
  function regularPrice(item) {
2339
2345
  return nonempty(item.commerceDisplayPrice) ? { reference: item.reference, status: "ready", source: "regular", displayPrice: item.commerceDisplayPrice } : unavailable(item.reference, "commercePriceUnavailable");
@@ -2342,17 +2348,21 @@ function applePrice(mapping, products) {
2342
2348
  const matches = products.filter((value) => isObject2(value) && value.id === mapping.productId);
2343
2349
  const product = matches[0];
2344
2350
  if (matches.length !== 1 || !nonempty(product?.displayPrice)) return unavailable(mapping.reference, "priceUnavailable");
2345
- const attendance = mapping.reference.kind === "bookingsService" || mapping.reference.kind === "eventsTicket";
2346
- if (product?.type !== (attendance ? "consumable" : "nonConsumable")) return unavailable(mapping.reference, "unsupportedProductType");
2351
+ if (product?.type !== expectedType(mapping) || mapping.renews && !nonempty(product.subscriptionPeriod)) return unavailable(mapping.reference, "unsupportedProductType");
2347
2352
  return {
2348
2353
  reference: mapping.reference,
2349
2354
  status: "ready",
2350
2355
  source: "appleIap",
2351
2356
  productId: mapping.productId,
2352
2357
  mappingRevision: mapping.mappingRevision,
2353
- displayPrice: product.displayPrice
2358
+ displayPrice: product.displayPrice,
2359
+ ...mapping.renews ? { renews: true, subscriptionPeriod: product.subscriptionPeriod } : {}
2354
2360
  };
2355
2361
  }
2362
+ function expectedType(mapping) {
2363
+ if (mapping.renews) return "subscription";
2364
+ return mapping.reference.kind === "bookingsService" || mapping.reference.kind === "eventsTicket" ? "consumable" : "nonConsumable";
2365
+ }
2356
2366
  function unavailable(reference, reason) {
2357
2367
  return { reference, status: "unavailable", reason, retryable: !["invalidInput", "unsupportedPlatform", "unsupportedProductType", "commercePriceUnavailable"].includes(reason) };
2358
2368
  }
@@ -2366,13 +2376,14 @@ var ATTENDANCE_SALE_RULE = { appProductId: (id2) => id2, productType: "CONSUMABL
2366
2376
  var STORES_PRODUCT_SALE_RULE = { appProductId: (id2) => id2, productType: "NON_CONSUMABLE" };
2367
2377
  var ONLINE_PROGRAM_SALE_RULE = { appProductId: (id2) => id2, productType: "NON_CONSUMABLE" };
2368
2378
  var PRICING_PLAN_SALE_RULE = { appProductId: (id2) => id2, productType: "NON_CONSUMABLE" };
2379
+ var PLAN_SUBSCRIPTIONS_APPLE_SALES_ENABLED = false;
2369
2380
  var VIDEOS_APPLE_SALES_ENABLED = false;
2370
2381
  var VIDEO_SALE_RULE = { appProductId: (id2) => id2, productType: "NON_CONSUMABLE" };
2371
2382
  function appleSaleRules(options = {}) {
2372
2383
  return {
2373
2384
  onlineProgram: ONLINE_PROGRAM_SALE_RULE,
2374
2385
  storesProduct: STORES_PRODUCT_SALE_RULE,
2375
- pricingPlan: PRICING_PLAN_SALE_RULE,
2386
+ pricingPlan: options.planSubscriptionsAppleSalesEnabled ?? PLAN_SUBSCRIPTIONS_APPLE_SALES_ENABLED ? { ...PRICING_PLAN_SALE_RULE, renews: true } : PRICING_PLAN_SALE_RULE,
2376
2387
  bookingsService: ATTENDANCE_SALE_RULE,
2377
2388
  eventsTicket: ATTENDANCE_SALE_RULE,
2378
2389
  ...options.videosAppleSalesEnabled ?? VIDEOS_APPLE_SALES_ENABLED ? { wixVideo: VIDEO_SALE_RULE } : {}
@@ -2432,8 +2443,18 @@ function decodeMappings(reply) {
2432
2443
  }
2433
2444
  function decide(reference, binding, mapping, rule) {
2434
2445
  if (!mapping || !rule) return { reference, route: "regular" };
2435
- if (!mapping.active || mapping.type !== rule.productType) return { reference, route: "unavailable" };
2436
- return { reference, route: "appleIap", productId: mapping.storeProductId, mappingRevision: `${binding.purchasesAppId}:${mapping.storeProductId}` };
2446
+ if (!mapping.active || !sellsAs(rule, mapping.type)) return { reference, route: "unavailable" };
2447
+ return {
2448
+ reference,
2449
+ route: "appleIap",
2450
+ productId: mapping.storeProductId,
2451
+ mappingRevision: `${binding.purchasesAppId}:${mapping.storeProductId}`,
2452
+ ...mapping.type === RENEWING ? { renews: true } : {}
2453
+ };
2454
+ }
2455
+ var RENEWING = "AUTO_RENEWING_SUBSCRIPTION";
2456
+ function sellsAs(rule, type) {
2457
+ return type === rule.productType || rule.renews === true && type === RENEWING;
2437
2458
  }
2438
2459
  function sameId(a, b) {
2439
2460
  return a.toLowerCase() === b.toLowerCase();
@@ -2597,7 +2618,11 @@ function viewOf(reference, item) {
2597
2618
  return unavailableView(reference, item);
2598
2619
  }
2599
2620
  function readyView(reference, item) {
2600
- return item.source === "appleIap" ? { ...blockedView(reference, "appleIap"), displayPrice: item.displayPrice } : { ...regularView(reference), displayPrice: item.displayPrice };
2621
+ return item.source === "appleIap" ? {
2622
+ ...blockedView(reference, "appleIap"),
2623
+ displayPrice: item.displayPrice,
2624
+ ...item.renews ? { renews: true, subscriptionPeriod: item.subscriptionPeriod } : {}
2625
+ } : { ...regularView(reference), displayPrice: item.displayPrice };
2601
2626
  }
2602
2627
  function unavailableView(reference, item) {
2603
2628
  if (item.reason === "commercePriceUnavailable") return regularView(reference);
@@ -2638,7 +2663,7 @@ function iapPriceFields(view, copy) {
2638
2663
  case "resolving":
2639
2664
  return { ...fields, priceText: copy.loading, priceLoading: true };
2640
2665
  case "appleIap":
2641
- return { ...fields, priceText: view.displayPrice, priceNote: copy.oneTimePurchase, actionNote: copy.purchaseUnavailable };
2666
+ return { ...fields, priceText: view.displayPrice, priceNote: view.renews ? "" : copy.oneTimePurchase, actionNote: copy.purchaseUnavailable };
2642
2667
  case "unavailable":
2643
2668
  return { ...fields, priceText: copy.unavailable, hidePriceRetry: !view.retryable };
2644
2669
  case "regular":
@@ -4939,6 +4964,20 @@ var pricingPlanItemPayments = {
4939
4964
  readAccess: (verticalRef, bridge) => isNonEmpty3(verticalRef.planId) ? planAccess(verticalRef.planId, bridge) : Promise.resolve("unavailable"),
4940
4965
  currentAccess: (item, bridge) => planAccess(item.reference.id, bridge)
4941
4966
  };
4967
+ function isAppleSellablePlan(pricing) {
4968
+ return pricing?.singlePaymentUnlimited === true || isOpenEndedRecurrence(pricing);
4969
+ }
4970
+ var ISO_UNIT = { DAY: "D", WEEK: "W", MONTH: "M", YEAR: "Y" };
4971
+ function applePlanPeriod(pricing) {
4972
+ return isOpenEndedRecurrence(pricing) ? `P${pricing?.subscription?.cycleDuration?.count}${isoUnit(pricing)}` : "";
4973
+ }
4974
+ function isOpenEndedRecurrence(pricing) {
4975
+ const cycle = pricing?.subscription;
4976
+ return (cycle?.cycleDuration?.count ?? 0) > 0 && isoUnit(pricing) !== void 0 && !cycle?.cycleCount && !pricing?.freeTrialDays;
4977
+ }
4978
+ function isoUnit(pricing) {
4979
+ return ISO_UNIT[String(pricing?.subscription?.cycleDuration?.unit ?? "").toUpperCase().replace(/S$/, "")];
4980
+ }
4942
4981
  async function itemPayment(item, bridge) {
4943
4982
  const planId = item.reference.id;
4944
4983
  const read2 = await bridge.call("GET", `/pricing-plans/v3/plans/${encodeURIComponent(planId)}`);
@@ -5386,6 +5425,9 @@ function period(pricing) {
5386
5425
  if (pricing?.singlePaymentUnlimited) return "one-time, no expiry";
5387
5426
  return "";
5388
5427
  }
5428
+ function appleOffered(row, view) {
5429
+ return row.appleSupported && (view.route !== "appleIap" || row.applePeriod === (view.renews ? view.subscriptionPeriod ?? "" : ""));
5430
+ }
5389
5431
  function createCheckoutService(opts = {}) {
5390
5432
  const c = opts.copy ?? {};
5391
5433
  const name = opts.service ?? "plans";
@@ -5415,10 +5457,10 @@ function createCheckoutService(opts = {}) {
5415
5457
  notJoined: !joined,
5416
5458
  joinedLabel: joined ? c.joinedLabel ?? "Current plan" : "",
5417
5459
  priceLine: view.route === "disabled" ? row.priceLine : price.priceText,
5418
- periodLine: purchase.appleRoute ? price.priceNote : price.actionDisabled ? "" : row.periodLine,
5460
+ periodLine: purchase.appleRoute ? view.renews ? row.periodLine : price.priceNote : price.actionDisabled ? "" : row.periodLine,
5419
5461
  cta: joined ? c.joinedLabel ?? "Current plan" : purchase.appleRoute ? purchase.buyLabel : row.cta,
5420
- joinDisabled: joined || (purchase.appleRoute ? purchase.buyDisabled || !row.appleSupported : price.actionDisabled || memberSession.current().generation !== offerGeneration),
5421
- joinNote: purchase.appleRoute ? row.appleSupported ? purchase.buyNote : purchaseCopy.unavailable : price.actionNote
5462
+ joinDisabled: joined || (purchase.appleRoute ? purchase.buyDisabled || !appleOffered(row, view) : price.actionDisabled || memberSession.current().generation !== offerGeneration),
5463
+ joinNote: purchase.appleRoute ? appleOffered(row, view) ? purchase.buyNote : purchaseCopy.unavailable : price.actionNote
5422
5464
  };
5423
5465
  });
5424
5466
  const visibleAppleOwner = catalogRows.some((row) => row.id === existingAccess.planId && commerce.purchaseFields({ kind: "pricingPlan", id: row.id }, purchaseCopy).appleRoute);
@@ -5480,7 +5522,8 @@ function createCheckoutService(opts = {}) {
5480
5522
  notJoined: !joined,
5481
5523
  joinedLabel: joined ? c.joinedLabel ?? "Current plan" : "",
5482
5524
  cta: joined ? c.joinedLabel ?? "Current plan" : c.joinCta ?? "Join",
5483
- appleSupported: p?.pricing?.singlePaymentUnlimited === true,
5525
+ appleSupported: isAppleSellablePlan(p?.pricing),
5526
+ applePeriod: applePlanPeriod(p?.pricing),
5484
5527
  joinDisabled: false,
5485
5528
  joinNote: ""
5486
5529
  };
@@ -5576,7 +5619,7 @@ function createCheckoutService(opts = {}) {
5576
5619
  const reference = { kind: "pricingPlan", id: id2 };
5577
5620
  const purchase = commerce.purchaseFields(reference, purchaseCopy);
5578
5621
  if (purchase.appleRoute) {
5579
- if (!row.appleSupported) return project(s2);
5622
+ if (!appleOffered(row, commerce.pricing.view(reference))) return project(s2);
5580
5623
  await commerce.buy({ reference });
5581
5624
  void svc.pricingPublish();
5582
5625
  return void 0;
@@ -11,6 +11,7 @@ var CAPABILITY_REGISTRY = {
11
11
  "camera": ["capture", "pickDocument", "prepareImage", "scanQR"],
12
12
  "clipboard": ["hasImage", "hasText", "readText", "writeImage", "writeText"],
13
13
  "contacts": ["add", "getPermissionStatus", "pick", "presentNewContact", "requestPermission", "search"],
14
+ "entity_extraction": ["availability", "extract"],
14
15
  "file_picker": ["pick", "pickDirectoryForExport"],
15
16
  "files": ["download", "export", "list", "readText", "remove", "stat", "storageInfo", "write"],
16
17
  "godot": ["loadPack", "release", "send"],
@@ -40,9 +41,11 @@ var CAPABILITY_REGISTRY = {
40
41
  "speech": ["availability", "recognizeOnce", "speak", "stop", "streamNext", "streamStart", "streamStop", "transcribeFile"],
41
42
  "system_intents": ["donate", "refreshShortcuts"],
42
43
  "tasks": ["backend", "create", "getPermissionStatus", "list", "remove", "requestPermission", "setCompleted"],
44
+ "text_embedding": ["availability", "embed"],
43
45
  "text_recognition": ["availability", "recognize"],
44
46
  "theme": ["applyOverlay", "clearOverlay", "surfaces"],
45
47
  "torch": ["off", "on", "status", "toggle"],
48
+ "translation": ["availability", "identifyLanguage", "prepare", "translate"],
46
49
  "ui": ["alert", "snackbar"],
47
50
  "wix_cashier": ["isAvailable", "proceedToPayment"],
48
51
  "wix_chat": ["getRealtimeStatus", "subscribeRealtime", "unsubscribeRealtime"]
@@ -26,6 +26,7 @@ var CAPABILITY_REGISTRY = {
26
26
  "camera": ["capture", "pickDocument", "prepareImage", "scanQR"],
27
27
  "clipboard": ["hasImage", "hasText", "readText", "writeImage", "writeText"],
28
28
  "contacts": ["add", "getPermissionStatus", "pick", "presentNewContact", "requestPermission", "search"],
29
+ "entity_extraction": ["availability", "extract"],
29
30
  "file_picker": ["pick", "pickDirectoryForExport"],
30
31
  "files": ["download", "export", "list", "readText", "remove", "stat", "storageInfo", "write"],
31
32
  "godot": ["loadPack", "release", "send"],
@@ -55,9 +56,11 @@ var CAPABILITY_REGISTRY = {
55
56
  "speech": ["availability", "recognizeOnce", "speak", "stop", "streamNext", "streamStart", "streamStop", "transcribeFile"],
56
57
  "system_intents": ["donate", "refreshShortcuts"],
57
58
  "tasks": ["backend", "create", "getPermissionStatus", "list", "remove", "requestPermission", "setCompleted"],
59
+ "text_embedding": ["availability", "embed"],
58
60
  "text_recognition": ["availability", "recognize"],
59
61
  "theme": ["applyOverlay", "clearOverlay", "surfaces"],
60
62
  "torch": ["off", "on", "status", "toggle"],
63
+ "translation": ["availability", "identifyLanguage", "prepare", "translate"],
61
64
  "ui": ["alert", "snackbar"],
62
65
  "wix_cashier": ["isAvailable", "proceedToPayment"],
63
66
  "wix_chat": ["getRealtimeStatus", "subscribeRealtime", "unsubscribeRealtime"]
@@ -0,0 +1,76 @@
1
+ // ../../core/sdk/dispatch/src/index.ts
2
+ function dispatch(handlerId, params, _options) {
3
+ const himalaya = globalThis.himalaya;
4
+ if (!himalaya) {
5
+ return Promise.reject(
6
+ new Error("@himalaya/dispatch: called outside a Himalaya runtime. This bundle must run inside a JSWorker (Tier 5).")
7
+ );
8
+ }
9
+ const stringParams = {};
10
+ if (params) {
11
+ for (const [k, v] of Object.entries(params)) stringParams[k] = String(v);
12
+ }
13
+ return himalaya.dispatch(handlerId, stringParams);
14
+ }
15
+
16
+ // ../../core/sdk/text-embedding/src/index.ts
17
+ var MAX_TEXTS_PER_CALL = 64;
18
+ async function availability(language) {
19
+ const r = await dispatch("capability.text_embedding.availability", language ? { language } : {});
20
+ return {
21
+ available: r?.available === true,
22
+ engine: r?.engine,
23
+ dimensions: typeof r?.dimensions === "number" ? r.dimensions : void 0,
24
+ reason: r?.reason
25
+ };
26
+ }
27
+ async function embed(texts, opts = {}) {
28
+ if (!Array.isArray(texts) || texts.length === 0) throw new Error("text-embedding.embed: at least one text is required");
29
+ if (texts.length > MAX_TEXTS_PER_CALL) {
30
+ throw new Error(`text-embedding.embed: at most ${MAX_TEXTS_PER_CALL} texts per call (got ${texts.length})`);
31
+ }
32
+ const r = await dispatch("capability.text_embedding.embed", {
33
+ texts: JSON.stringify(texts),
34
+ ...opts.language ? { language: opts.language } : {}
35
+ });
36
+ const vectors = Array.isArray(r?.vectors) ? r.vectors : [];
37
+ return {
38
+ vectors,
39
+ dimensions: typeof r?.dimensions === "number" ? r.dimensions : vectors[0]?.length ?? 0,
40
+ engine: r?.engine ?? ""
41
+ };
42
+ }
43
+ function cosineSimilarity(a, b) {
44
+ if (a.length === 0 || a.length !== b.length) return 0;
45
+ let dot = 0;
46
+ let na = 0;
47
+ let nb = 0;
48
+ for (let i = 0; i < a.length; i++) {
49
+ dot += a[i] * b[i];
50
+ na += a[i] * a[i];
51
+ nb += b[i] * b[i];
52
+ }
53
+ if (na === 0 || nb === 0) return 0;
54
+ return dot / Math.sqrt(na * nb);
55
+ }
56
+ async function rank(query, candidates, opts = {}) {
57
+ if (candidates.length === 0) return [];
58
+ const [q] = (await embed([query], opts)).vectors;
59
+ const scored = [];
60
+ for (let start = 0; start < candidates.length; start += MAX_TEXTS_PER_CALL) {
61
+ const batch = candidates.slice(start, start + MAX_TEXTS_PER_CALL);
62
+ const { vectors } = await embed(batch, opts);
63
+ batch.forEach((text, i) => scored.push({ text, index: start + i, score: cosineSimilarity(q ?? [], vectors[i] ?? []) }));
64
+ }
65
+ return scored.sort((x, y) => y.score - x.score);
66
+ }
67
+ var version = 1;
68
+ export {
69
+ MAX_TEXTS_PER_CALL,
70
+ availability,
71
+ cosineSimilarity,
72
+ embed,
73
+ rank,
74
+ version
75
+ };
76
+ //# sourceMappingURL=text-embedding.mjs.map
@@ -0,0 +1,66 @@
1
+ // ../../core/sdk/dispatch/src/index.ts
2
+ function dispatch(handlerId, params, _options) {
3
+ const himalaya = globalThis.himalaya;
4
+ if (!himalaya) {
5
+ return Promise.reject(
6
+ new Error("@himalaya/dispatch: called outside a Himalaya runtime. This bundle must run inside a JSWorker (Tier 5).")
7
+ );
8
+ }
9
+ const stringParams = {};
10
+ if (params) {
11
+ for (const [k, v] of Object.entries(params)) stringParams[k] = String(v);
12
+ }
13
+ return himalaya.dispatch(handlerId, stringParams);
14
+ }
15
+
16
+ // ../../core/sdk/translation/src/index.ts
17
+ function asStatus(s) {
18
+ return s === "installed" || s === "downloadable" ? s : "unsupported";
19
+ }
20
+ async function availability() {
21
+ const r = await dispatch("capability.translation.availability");
22
+ return { available: r?.available === true, engine: r?.engine, reason: r?.reason };
23
+ }
24
+ async function pairAvailability(source, target) {
25
+ const r = await dispatch("capability.translation.availability", { source, target });
26
+ return { available: r?.available === true, engine: r?.engine, reason: r?.reason, status: asStatus(r?.status) };
27
+ }
28
+ async function identifyLanguage(text) {
29
+ if (!text) throw new Error("translation.identifyLanguage: text is required");
30
+ const r = await dispatch("capability.translation.identifyLanguage", { text });
31
+ return {
32
+ language: r?.language || "und",
33
+ confidence: typeof r?.confidence === "number" ? r.confidence : 0,
34
+ candidates: Array.isArray(r?.candidates) ? r.candidates : [],
35
+ engine: r?.engine ?? ""
36
+ };
37
+ }
38
+ async function prepare(source, target) {
39
+ const r = await dispatch("capability.translation.prepare", { source, target });
40
+ return { status: asStatus(r?.status), engine: r?.engine ?? "", reason: r?.reason };
41
+ }
42
+ async function translate(input) {
43
+ if (!input.text) throw new Error("translation.translate: text is required");
44
+ if (!input.target) throw new Error("translation.translate: target is required");
45
+ const r = await dispatch("capability.translation.translate", {
46
+ text: input.text,
47
+ target: input.target,
48
+ ...input.source ? { source: input.source } : {}
49
+ });
50
+ return {
51
+ text: r?.text ?? "",
52
+ source: r?.source ?? input.source ?? "und",
53
+ target: r?.target ?? input.target,
54
+ engine: r?.engine ?? ""
55
+ };
56
+ }
57
+ var version = 1;
58
+ export {
59
+ availability,
60
+ identifyLanguage,
61
+ pairAvailability,
62
+ prepare,
63
+ translate,
64
+ version
65
+ };
66
+ //# sourceMappingURL=translation.mjs.map
@@ -102,6 +102,10 @@
102
102
  "types": "./dist/_types/core/sdk/dispatch/src/index.d.ts",
103
103
  "import": "./dist/dispatch.mjs"
104
104
  },
105
+ "./entity-extraction": {
106
+ "types": "./dist/_types/core/sdk/entity-extraction/src/index.d.ts",
107
+ "import": "./dist/entity-extraction.mjs"
108
+ },
105
109
  "./file-picker": {
106
110
  "types": "./dist/_types/core/sdk/file-picker/src/index.d.ts",
107
111
  "import": "./dist/file-picker.mjs"
@@ -262,6 +266,10 @@
262
266
  "types": "./dist/_types/stdlib/telemetry/console/src/index.d.ts",
263
267
  "import": "./dist/telemetry-console.mjs"
264
268
  },
269
+ "./text-embedding": {
270
+ "types": "./dist/_types/core/sdk/text-embedding/src/index.d.ts",
271
+ "import": "./dist/text-embedding.mjs"
272
+ },
265
273
  "./text-recognition": {
266
274
  "types": "./dist/_types/core/sdk/text-recognition/src/index.d.ts",
267
275
  "import": "./dist/text-recognition.mjs"
@@ -278,6 +286,10 @@
278
286
  "types": "./dist/_types/core/sdk/torch/src/index.d.ts",
279
287
  "import": "./dist/torch.mjs"
280
288
  },
289
+ "./translation": {
290
+ "types": "./dist/_types/core/sdk/translation/src/index.d.ts",
291
+ "import": "./dist/translation.mjs"
292
+ },
281
293
  "./ui": {
282
294
  "types": "./dist/_types/core/sdk/ui/src/index.d.ts",
283
295
  "import": "./dist/ui.mjs"
@@ -2,7 +2,7 @@
2
2
  "files": [
3
3
  {
4
4
  "name": "sw.js",
5
- "bytes": 2542279
5
+ "bytes": 2556772
6
6
  },
7
7
  {
8
8
  "name": "host.html",
@@ -21,7 +21,7 @@
21
21
  "bytes": 24256
22
22
  },
23
23
  {
24
- "name": "preview-deferred/ec5d778f3e7ecbc2351ab7a8f3509483b798094de9f889fe8b03447db1413cb6.bin",
24
+ "name": "preview-deferred/9c4b4a8e0772f247f08e61b35d51b0bd2574408381cab23ec88cad1c7df68177.bin",
25
25
  "bytes": 488215
26
26
  },
27
27
  {
@@ -79,10 +79,10 @@
79
79
  ],
80
80
  "deferred": [
81
81
  {
82
- "key": "assets/pdf-xPk78ZZE.js",
82
+ "key": "assets/pdf-CfHYR48U.js",
83
83
  "contentType": "application/javascript; charset=utf-8",
84
- "sha256": "ec5d778f3e7ecbc2351ab7a8f3509483b798094de9f889fe8b03447db1413cb6",
85
- "file": "preview-deferred/ec5d778f3e7ecbc2351ab7a8f3509483b798094de9f889fe8b03447db1413cb6.bin"
84
+ "sha256": "9c4b4a8e0772f247f08e61b35d51b0bd2574408381cab23ec88cad1c7df68177",
85
+ "file": "preview-deferred/9c4b4a8e0772f247f08e61b35d51b0bd2574408381cab23ec88cad1c7df68177.bin"
86
86
  },
87
87
  {
88
88
  "key": "assets/pdf.worker.min-BGnVRhRG.js",