@wix/himalaya-cli 0.1886.0 → 0.1888.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 (51) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/app-info/src/index.d.ts +4 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/app-info.mjs +1 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap-checkout.mjs +1 -0
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +1 -0
  5. package/dist/browser-plane/assets.json +5 -5
  6. package/dist/browser-plane/preview-deferred/{3c60676d1298b453781d40ec97d5ab59bdc85b33b983653e9c5fd750ac11c8a0.bin → d4250730f37a006c948187a7640453097348fa24695586a3d0014c041511c896.bin} +1 -1
  7. package/dist/browser-plane/sw.js +8 -8
  8. package/dist/cli.mjs +58393 -58217
  9. package/dist/preview-assets.generated.bin +0 -0
  10. package/guides/himi-json-output.md +23 -0
  11. package/package.json +2 -2
  12. package/templates/bare-fashion/tier5-src/_shared/member-account-routes.ts +26 -3
  13. package/templates/bare-fashion/tier5-src/himi-branded-lite-account-settings/personal-info.ts +21 -7
  14. package/templates/beauty-salon/tier5-src/_shared/member-account-routes.ts +26 -3
  15. package/templates/beauty-salon/tier5-src/himi-branded-lite-account-settings/personal-info.ts +21 -7
  16. package/templates/branded-lite/tier5-src/_shared/member-account-routes.ts +26 -3
  17. package/templates/branded-lite/tier5-src/himi-branded-lite-account-settings/personal-info.ts +21 -7
  18. package/templates/brandy/tier5-src/_shared/member-account-routes.ts +26 -3
  19. package/templates/brandy/tier5-src/himi-branded-lite-account-settings/personal-info.ts +21 -7
  20. package/templates/community-club/tier5-src/_shared/member-account-routes.ts +26 -3
  21. package/templates/community-club/tier5-src/himi-branded-lite-account-settings/personal-info.ts +21 -7
  22. package/templates/conference/tier5-src/_shared/member-account-routes.ts +26 -3
  23. package/templates/conference/tier5-src/himi-branded-lite-account-settings/personal-info.ts +21 -7
  24. package/templates/events-meetups/tier5-src/_shared/member-account-routes.ts +26 -3
  25. package/templates/events-meetups/tier5-src/himi-branded-lite-account-settings/personal-info.ts +21 -7
  26. package/templates/fitness-gym/tier5-src/_shared/member-account-routes.ts +26 -3
  27. package/templates/fitness-gym/tier5-src/himi-branded-lite-account-settings/personal-info.ts +21 -7
  28. package/templates/gym-fitness/tier5-src/_shared/member-account-routes.ts +26 -3
  29. package/templates/gym-fitness/tier5-src/himi-branded-lite-account-settings/personal-info.ts +21 -7
  30. package/templates/medical-services/tier5-src/_shared/member-account-routes.ts +26 -3
  31. package/templates/medical-services/tier5-src/himi-branded-lite-account-settings/personal-info.ts +21 -7
  32. package/templates/nonprofit-cause/tier5-src/_shared/member-account-routes.ts +26 -3
  33. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-account-settings/personal-info.ts +21 -7
  34. package/templates/personal-fitness-trainer/tier5-src/_shared/member-account-routes.ts +26 -3
  35. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-account-settings/personal-info.ts +21 -7
  36. package/templates/podcast-creator/tier5-src/_shared/member-account-routes.ts +26 -3
  37. package/templates/podcast-creator/tier5-src/himi-branded-lite-account-settings/personal-info.ts +21 -7
  38. package/templates/portfolio-creative/tier5-src/_shared/member-account-routes.ts +26 -3
  39. package/templates/portfolio-creative/tier5-src/himi-branded-lite-account-settings/personal-info.ts +21 -7
  40. package/templates/professional-services/tier5-src/_shared/member-account-routes.ts +26 -3
  41. package/templates/professional-services/tier5-src/himi-branded-lite-account-settings/personal-info.ts +21 -7
  42. package/templates/restaurant/tier5-src/_shared/member-account-routes.ts +26 -3
  43. package/templates/restaurant/tier5-src/himi-branded-lite-account-settings/personal-info.ts +21 -7
  44. package/templates/retail-store/tier5-src/_shared/member-account-routes.ts +26 -3
  45. package/templates/retail-store/tier5-src/himi-branded-lite-account-settings/personal-info.ts +21 -7
  46. package/templates/salon-spa/tier5-src/_shared/member-account-routes.ts +26 -3
  47. package/templates/salon-spa/tier5-src/himi-branded-lite-account-settings/personal-info.ts +21 -7
  48. package/templates/wholesale-store/tier5-src/_shared/member-account-routes.ts +26 -3
  49. package/templates/wholesale-store/tier5-src/himi-branded-lite-account-settings/personal-info.ts +21 -7
  50. package/templates/yoga-studio/tier5-src/_shared/member-account-routes.ts +26 -3
  51. package/templates/yoga-studio/tier5-src/himi-branded-lite-account-settings/personal-info.ts +21 -7
@@ -13,7 +13,7 @@ import { snackbar } from "@himalaya/ui";
13
13
  import { deleteMemberPhones, getMyMember, listCustomFields, updateMember } from "@himalaya/wix-members";
14
14
  import { generateMemberPhotoUploadUrl } from "@himalaya/wix-site-media";
15
15
  import { memberAccess } from "../_shared/member-access.js";
16
- import { memberAccountRoutes } from "../_shared/member-account-routes.js";
16
+ import { MEMBER_PHOTO_UPLOAD_TARGET, isMemberPhotoUploadTarget, memberAccountRoutes } from "../_shared/member-account-routes.js";
17
17
  import { copyParam, stashCopy } from "../_shared/himi-copy.js";
18
18
  import {
19
19
  clean, currentMemberRecordMatches, fetchMember, isSignedOut, loadErrorVariant, memberInitials, rawText,
@@ -84,6 +84,8 @@ interface S extends ProfileValues {
84
84
  photoUploadAvailable: boolean;
85
85
  noPhotoUploadAvailable: boolean;
86
86
  photoUploadFunctionName: string;
87
+ /** The photo goes to the app's member-photo route as the member (no site function): the host answers the placeholder target. */
88
+ photoUploadViaRoute: boolean;
87
89
  photoDisplayUrl: string;
88
90
  uploadUrl: string;
89
91
  photoDraftUrl: string;
@@ -132,6 +134,7 @@ const EMPTY: S = {
132
134
  photoUploadAvailable: false,
133
135
  noPhotoUploadAvailable: true,
134
136
  photoUploadFunctionName: "",
137
+ photoUploadViaRoute: false,
135
138
  photoDisplayUrl: "",
136
139
  uploadUrl: "",
137
140
  photoDraftUrl: "",
@@ -373,9 +376,12 @@ function photoUploadFunctionName(value: unknown): string {
373
376
  const name = clean(value);
374
377
  return /^[A-Za-z][A-Za-z0-9_]{0,63}$/.test(name) ? name : "";
375
378
  }
376
- function validUploadUrl(value: unknown): string {
379
+ function validUploadUrl(value: unknown, viaRoute: boolean): string {
377
380
  if (typeof value !== "string") return "";
378
381
  // Hand-parsed: JSC (iOS) has no `URL` global. Host is plain letters/digits/dots, so userinfo and ports never match.
382
+ // The member-photo placeholder is the host's to answer with the member's credential; it names no host at all. Only the worker's own
383
+ // route path may publish it: a site function that returns it must not steer the host off the function's Wix Media upload.
384
+ if (isMemberPhotoUploadTarget(value)) return viaRoute && /^[A-Za-z0-9?=&.-]{0,64}$/.test(value.slice(MEMBER_PHOTO_UPLOAD_TARGET.length)) ? value : "";
379
385
  const m = /^https:\/\/([A-Za-z0-9.-]+)(?:[/?][^#\s\\]*)?$/.exec(value);
380
386
  const host = m ? m[1].toLowerCase() : "";
381
387
  return host === "wixmp.com" || host.endsWith(".wixmp.com") ? value : "";
@@ -401,6 +407,8 @@ function canonicalPhotoMediaId(value: unknown): string {
401
407
  let profileMutationInFlight = false;
402
408
  let photoUploadMintInFlight = false;
403
409
  let photoUploadVersion = 0;
410
+ /** Makes each pick's placeholder differ from the last (a retry must not look like the value left from a failed pick). */
411
+ let photoRouteNonce = 0;
404
412
  let loadVersion = 0;
405
413
  // The native picker uploads the file itself and never reports a failed PUT back to the worker, so a minted
406
414
  // upload URL counts as "upload in progress" only for a bounded window. Save waits inside it, then recovers.
@@ -570,8 +578,11 @@ const svc = defineService<S, {
570
578
  if (!(await currentMemberRecordMatches(email, scope, clean(member.id)))) throw signedOutError();
571
579
  if (version !== loadVersion) return svc.getState() as S;
572
580
  const functionName = photoUploadFunctionName((arg as { photoUploadFunctionName?: unknown } | undefined)?.photoUploadFunctionName);
573
- const available = !!functionName && routes.mediaField;
574
- return derive({ ...loaded(member, email, scope, site.fields, site.hasPhone), photoUploadFunctionName: functionName, photoUploadAvailable: available });
581
+ // The site's own upload function wins (it works on every binary that has MediaField). Without one, a host that sends the photo
582
+ // to the app's member-photo route as the member does the upload, with no site code: migrated apps have none.
583
+ const viaRoute = !functionName && routes.memberPhotoRoute;
584
+ const available = (!!functionName && routes.mediaField) || viaRoute;
585
+ return derive({ ...loaded(member, email, scope, site.fields, site.hasPhone), photoUploadFunctionName: functionName, photoUploadViaRoute: viaRoute, photoUploadAvailable: available });
575
586
  } catch (error) {
576
587
  if (version !== loadVersion) return svc.getState() as S;
577
588
  return loadFailed(error);
@@ -607,7 +618,7 @@ const svc = defineService<S, {
607
618
  return derive({ ...s, custom: { ...s.custom, [id]: value }, customErrors: { ...s.customErrors, [id]: "" }, saveError: "" });
608
619
  },
609
620
  genUpload: async (s, arg): Promise<Polled> => {
610
- if (photoUploadMintInFlight || s.phase !== "ready" || !s.memberId || !s.photoUploadAvailable || !s.photoUploadFunctionName) {
621
+ if (photoUploadMintInFlight || s.phase !== "ready" || !s.memberId || !s.photoUploadAvailable || (!s.photoUploadFunctionName && !s.photoUploadViaRoute)) {
611
622
  return derive({ ...s, uploadUrl: "", photoUploadError: copyParam("accountSettings.profilePhotoUnavailable", "Profile photo changes are not available in this session."), photoUploading: false });
612
623
  }
613
624
  photoUploadMintInFlight = true;
@@ -628,7 +639,10 @@ const svc = defineService<S, {
628
639
  if (version !== photoUploadVersion) return latest;
629
640
  return derive(clearPhotoUploadAttempt(latest, copyParam("accountSettings.profilePhotoUploadError", "The photo could not be prepared. Choose another image.")));
630
641
  }
631
- const minted = await generateMemberPhotoUploadUrl(s.photoUploadFunctionName, mimeType, fileName);
642
+ // Through the member-photo route there is nothing to mint: the placeholder says "send it as the member", and the host does.
643
+ const minted = s.photoUploadViaRoute
644
+ ? { uploadUrl: `${MEMBER_PHOTO_UPLOAD_TARGET}?n=${++photoRouteNonce}` }
645
+ : await generateMemberPhotoUploadUrl(s.photoUploadFunctionName, mimeType, fileName);
632
646
  if (version !== photoUploadVersion) return svc.getState() as S;
633
647
  if (!(await currentMemberRecordMatches(s.memberEmail, s.memberScope, s.memberId))) {
634
648
  const latest = svc.getState() as S;
@@ -636,7 +650,7 @@ const svc = defineService<S, {
636
650
  return derive(clearPhotoUploadAttempt(latest, accountChanged()));
637
651
  }
638
652
  if (version !== photoUploadVersion) return svc.getState() as S;
639
- const uploadUrl = validUploadUrl(minted.uploadUrl);
653
+ const uploadUrl = validUploadUrl(minted.uploadUrl, s.photoUploadViaRoute);
640
654
  if (!uploadUrl) return derive(clearPhotoUploadAttempt(svc.getState() as S, copyParam("accountSettings.profilePhotoUploadError", "The photo could not be prepared. Choose another image.")));
641
655
  const latest = svc.getState() as S;
642
656
  if (!sameMember(latest)) return latest;