@wix/himalaya-cli 0.1608.0 → 0.1610.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 (36) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-config.d.ts +7 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/catalog-adapters/wix-video.d.ts +20 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/catalog-pricing-contract.d.ts +1 -1
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/index.d.ts +1 -0
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/mapping-source.d.ts +1 -1
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/wix-payments-contract.d.ts +11 -0
  7. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/wix-platform/src/index.d.ts +14 -0
  8. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/wix-platform/src/user-props.d.ts +8 -0
  9. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/index.d.ts +1 -0
  10. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/videos.d.ts +5 -0
  11. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/index.d.ts +1 -1
  12. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/online-programs/src/index.d.ts +122 -1
  13. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/video/src/index.d.ts +6 -5
  14. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap-checkout.mjs +25 -4
  15. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap.mjs +25 -5
  16. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +8 -3
  17. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-online-programs.mjs +118 -0
  18. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-platform.mjs +65 -0
  19. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-video.mjs +3 -3
  20. package/dist/cli.mjs +157 -46
  21. package/dist/preview-assets.generated.bin +0 -0
  22. package/guides/form-submit.service.ts +22 -2
  23. package/guides/iap-pricing.md +1 -0
  24. package/guides/iap-products.md +18 -7
  25. package/guides/iap-screen-adoption.md +2 -1
  26. package/guides/qa-builds.md +14 -1
  27. package/guides/recipe-dynamic-list.md +16 -0
  28. package/guides/recipe-form-submit.md +32 -2
  29. package/guides/recipe-four-state.md +2 -1
  30. package/guides/sdk-reference.json +144 -10
  31. package/guides/web-page-sdk-reference.md +1 -1
  32. package/guides/wix-platform-usage.md +38 -0
  33. package/package.json +2 -2
  34. package/templates/branded-lite/dev/index.ts +107 -3
  35. package/templates/branded-lite/tier5-src/himi-branded-lite-video/index.ts +62 -7
  36. package/templates/branded-lite/tier5-src/himi-branded-lite-videos/index.ts +82 -26
@@ -29,6 +29,56 @@ function dispatch(handlerId, params, _options) {
29
29
  return himalaya.dispatch(handlerId, stringParams);
30
30
  }
31
31
 
32
+ // ../../core/sdk/wix-platform/src/user-props.ts
33
+ var CODES = /* @__PURE__ */ new Set(["not_signed_in", "not_configured", "too_large", "invalid_patch", "unavailable", "request_failed"]);
34
+ var USER_PROPS_RESERVED_KEY = "platform";
35
+ var USER_PROPS_MAX_BYTES = 64 * 1024;
36
+ function refusal(code) {
37
+ return Object.assign(new Error(code), { code });
38
+ }
39
+ function isPlainObject(v) {
40
+ return typeof v === "object" && v !== null && !Array.isArray(v);
41
+ }
42
+ function utf8Length(s) {
43
+ let n = 0;
44
+ for (let i = 0; i < s.length; i++) {
45
+ const c = s.charCodeAt(i);
46
+ if (c < 128) n += 1;
47
+ else if (c < 2048) n += 2;
48
+ else if (c >= 55296 && c <= 56319 && i + 1 < s.length && (s.charCodeAt(i + 1) & 64512) === 56320) {
49
+ n += 4;
50
+ i++;
51
+ } else n += 3;
52
+ }
53
+ return n;
54
+ }
55
+ async function run(id, params) {
56
+ const r = await dispatch(id, params).catch((e) => {
57
+ const message = e instanceof Error ? e.message : String(e);
58
+ throw CODES.has(message) ? refusal(message) : e;
59
+ });
60
+ if (typeof r?.error === "string" && r.error.length > 0) throw refusal(r.error);
61
+ if (!r || !isPlainObject(r.props)) throw refusal("unavailable");
62
+ return r.props;
63
+ }
64
+ function userPropsGet() {
65
+ return run("capability.wix_platform.userPropsGet");
66
+ }
67
+ function userPropsSet(patch) {
68
+ if (!isPlainObject(patch) || Object.prototype.hasOwnProperty.call(patch, USER_PROPS_RESERVED_KEY)) {
69
+ return Promise.reject(refusal("invalid_patch"));
70
+ }
71
+ let json;
72
+ try {
73
+ json = JSON.stringify(patch);
74
+ } catch {
75
+ return Promise.reject(refusal("invalid_patch"));
76
+ }
77
+ if (typeof json !== "string") return Promise.reject(refusal("invalid_patch"));
78
+ if (utf8Length(json) > USER_PROPS_MAX_BYTES) return Promise.reject(refusal("too_large"));
79
+ return run("capability.wix_platform.userPropsSet", { patch: json });
80
+ }
81
+
32
82
  // ../../core/sdk/wix-platform/src/offline.ts
33
83
  function bridge() {
34
84
  const himalaya = globalThis.himalaya;
@@ -418,8 +468,22 @@ var monitoring = {
418
468
  }
419
469
  };
420
470
  var version = 2;
471
+ var userProps = {
472
+ /** The signed-in Wix user's props for the app named by `wixPlatform.userProps.app`. */
473
+ get() {
474
+ return userPropsGet();
475
+ },
476
+ /** Deep-merge `patch` into a FRESH server read and write the result back; resolves with it.
477
+ * The patch wins, objects merge recursively, arrays are replaced. Writes are serialized per
478
+ * process natively, so concurrent writers (two workers, or an app service and a screen) never
479
+ * lose each other's keys. Values must be JSON; a result over 64 KB rejects `too_large`. */
480
+ set(patch) {
481
+ return userPropsSet(patch);
482
+ }
483
+ };
421
484
  export {
422
485
  IDENTITY_CHANGE_ACTION,
486
+ USER_PROPS_MAX_BYTES,
423
487
  auth,
424
488
  bi,
425
489
  deeplink,
@@ -434,6 +498,7 @@ export {
434
498
  ping,
435
499
  session,
436
500
  site,
501
+ userProps,
437
502
  version
438
503
  };
439
504
  //# sourceMappingURL=wix-platform.mjs.map
@@ -236,10 +236,10 @@ async function wixVideoPages(fetchPage) {
236
236
  }
237
237
  throw wixVideoError("Wix Video pagination limit exceeded");
238
238
  }
239
- var CHANNEL_FIELDS = "id title description source featuredVideoId hasPaidVideos cover { selected } videos { total }";
239
+ var CHANNEL_FIELDS = "id title description source featuredVideoId hasPaidVideos cover { selected } pricing { type enabled required } purchase(filter: {type: SUBSCRIPTION}) { status expiresAt } videos { total }";
240
240
  var CHANNEL_ACCESS_FIELDS = "id title pricing { type enabled required } purchase(filter: {type: SUBSCRIPTION}) { status expiresAt }";
241
- var VIDEO_CARD_FIELDS = "id title source status cover { selected } poster { selected } content { status duration thumbnailUrl externalUrl externalId } pricing { type enabled }";
242
- var VIDEO_FIELDS = "id title description source status cover { selected } poster { selected } content { status duration thumbnailUrl externalUrl externalId } pricing { type enabled } purchase(filter: {type: SALE}) { status } rent_purchase: purchase(filter: {type: RENT}) { status }";
241
+ var VIDEO_CARD_FIELDS = "id title source status cover { selected } poster { selected } content { status duration thumbnailUrl externalUrl externalId } pricing { type enabled price currency } purchase(filter: {type: SALE}) { status } rent_purchase: purchase(filter: {type: RENT}) { status }";
242
+ var VIDEO_FIELDS = "id title description source status cover { selected } poster { selected } content { status duration thumbnailUrl externalUrl externalId } pricing { type enabled price currency } purchase(filter: {type: SALE}) { status } rent_purchase: purchase(filter: {type: RENT}) { status }";
243
243
  function channelsQuery(videosPerChannel) {
244
244
  const preview = videosPerChannel > 0 ? ` preview: videos(sort: CUSTOM_DESC, limit: ${Math.floor(videosPerChannel)}) { entities { ${VIDEO_CARD_FIELDS} } }` : "";
245
245
  return `query WixVideoChannels($cursor: String) {