@wix/himalaya-cli 0.1576.0 → 0.1577.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 (76) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/loyalty/src/index.d.ts +64 -6
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/online-programs/src/index.d.ts +87 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-loyalty.mjs +15 -3
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-online-programs.mjs +42 -0
  5. package/dist/cli.mjs +10810 -10592
  6. package/dist/preview-assets.generated.bin +0 -0
  7. package/fixtures/wix-canned.json +56 -3
  8. package/guides/one-app-section-mappings.md +1 -1
  9. package/guides/one-app-to-himi-app.md +50 -1
  10. package/guides/sdk-reference.json +133 -9
  11. package/package.json +2 -2
  12. package/templates/beauty-salon/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  13. package/templates/beauty-salon/tier5-src/_shared/owner-load-error.ts +8 -0
  14. package/templates/beauty-salon-owner/dev/index.ts +52 -27
  15. package/templates/beauty-salon-owner/tier5-src/_shared/owner-load-error.ts +8 -0
  16. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-post/index.ts +20 -8
  17. package/templates/branded-lite/config.ts +7 -0
  18. package/templates/branded-lite/dev/index.ts +833 -0
  19. package/templates/branded-lite/himalaya.content.json +3 -0
  20. package/templates/branded-lite/l10n/en.json +4 -2
  21. package/templates/branded-lite/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  22. package/templates/branded-lite/tier5-src/_shared/owner-load-error.ts +8 -0
  23. package/templates/branded-lite/tier5-src/himi-branded-lite-member-programs/index.ts +658 -0
  24. package/templates/community-club/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  25. package/templates/community-club/tier5-src/_shared/owner-load-error.ts +8 -0
  26. package/templates/community-club-owner/dev/index.ts +52 -27
  27. package/templates/community-club-owner/tier5-src/_shared/owner-load-error.ts +8 -0
  28. package/templates/community-club-owner/tier5-src/himi-owner-lite-post/index.ts +20 -8
  29. package/templates/events-meetups/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  30. package/templates/events-meetups/tier5-src/_shared/owner-load-error.ts +8 -0
  31. package/templates/events-meetups-owner/dev/index.ts +52 -27
  32. package/templates/events-meetups-owner/tier5-src/_shared/owner-load-error.ts +8 -0
  33. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-post/index.ts +20 -8
  34. package/templates/gym-fitness/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  35. package/templates/gym-fitness/tier5-src/_shared/owner-load-error.ts +8 -0
  36. package/templates/gym-fitness-owner/dev/index.ts +52 -27
  37. package/templates/gym-fitness-owner/tier5-src/_shared/owner-load-error.ts +8 -0
  38. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-post/index.ts +20 -8
  39. package/templates/himi-chat/tier5-src/_shared/owner-load-error.ts +8 -0
  40. package/templates/nonprofit-cause/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  41. package/templates/nonprofit-cause/tier5-src/_shared/owner-load-error.ts +8 -0
  42. package/templates/nonprofit-cause-owner/dev/index.ts +52 -27
  43. package/templates/nonprofit-cause-owner/tier5-src/_shared/owner-load-error.ts +8 -0
  44. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-post/index.ts +20 -8
  45. package/templates/owner-lite/dev/index.ts +52 -27
  46. package/templates/owner-lite/tier5-src/_shared/owner-load-error.ts +8 -0
  47. package/templates/owner-lite/tier5-src/himi-owner-lite-post/index.ts +20 -8
  48. package/templates/podcast-creator/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  49. package/templates/podcast-creator/tier5-src/_shared/owner-load-error.ts +8 -0
  50. package/templates/podcast-creator-owner/dev/index.ts +52 -27
  51. package/templates/podcast-creator-owner/tier5-src/_shared/owner-load-error.ts +8 -0
  52. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-post/index.ts +20 -8
  53. package/templates/portfolio-creative/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  54. package/templates/portfolio-creative/tier5-src/_shared/owner-load-error.ts +8 -0
  55. package/templates/portfolio-creative-owner/dev/index.ts +52 -27
  56. package/templates/portfolio-creative-owner/tier5-src/_shared/owner-load-error.ts +8 -0
  57. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-post/index.ts +20 -8
  58. package/templates/restaurant/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  59. package/templates/restaurant/tier5-src/_shared/owner-load-error.ts +8 -0
  60. package/templates/restaurant-owner/dev/index.ts +52 -27
  61. package/templates/restaurant-owner/tier5-src/_shared/owner-load-error.ts +8 -0
  62. package/templates/restaurant-owner/tier5-src/himi-owner-lite-post/index.ts +20 -8
  63. package/templates/retail-store/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  64. package/templates/retail-store/tier5-src/_shared/owner-load-error.ts +8 -0
  65. package/templates/retail-store-owner/dev/index.ts +52 -27
  66. package/templates/retail-store-owner/tier5-src/_shared/owner-load-error.ts +8 -0
  67. package/templates/retail-store-owner/tier5-src/himi-owner-lite-post/index.ts +20 -8
  68. package/templates/yoga-studio/config.ts +7 -0
  69. package/templates/yoga-studio/dev/index.ts +833 -0
  70. package/templates/yoga-studio/himalaya.content.json +3 -0
  71. package/templates/yoga-studio/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  72. package/templates/yoga-studio/tier5-src/_shared/owner-load-error.ts +8 -0
  73. package/templates/yoga-studio/tier5-src/himi-branded-lite-member-programs/index.ts +658 -0
  74. package/templates/yoga-studio-owner/dev/index.ts +52 -27
  75. package/templates/yoga-studio-owner/tier5-src/_shared/owner-load-error.ts +8 -0
  76. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-post/index.ts +20 -8
@@ -30,6 +30,20 @@ export interface WixCallOptions {
30
30
  /** The per-call header map for `opts`, or undefined when there is nothing to add — so
31
31
  * the no-options path calls the bridge with exactly the 3 arguments it always did. */
32
32
  export declare function wixCall<T>(method: string, path: string, body?: unknown, readOptions?: WixCallOptions): Promise<T>;
33
+ export interface WixLoyaltyImage {
34
+ id?: string;
35
+ url?: string;
36
+ height?: number;
37
+ width?: number;
38
+ altText?: string;
39
+ filename?: string;
40
+ }
41
+ export interface WixLoyaltyRewardConfig {
42
+ tierId?: string;
43
+ costInPoints?: number;
44
+ amount?: number;
45
+ percentage?: number;
46
+ }
33
47
  export interface WixLoyaltyProgram {
34
48
  id?: string;
35
49
  name?: string;
@@ -37,14 +51,33 @@ export interface WixLoyaltyProgram {
37
51
  status?: string;
38
52
  pointDefinition?: {
39
53
  customName?: string;
40
- icon?: string;
54
+ icon?: WixLoyaltyImage;
41
55
  };
42
56
  }
43
57
  export interface WixLoyaltyReward {
44
58
  id: string;
45
59
  name?: string;
46
60
  type?: string;
61
+ /** Legacy adapter field. REST costs live in the reward's tier configurations. */
47
62
  requiredPoints?: number;
63
+ discountAmount?: {
64
+ configsByTier?: {
65
+ tierId?: string;
66
+ costInPoints?: number;
67
+ amount?: string;
68
+ }[];
69
+ };
70
+ couponReward?: {
71
+ fixedAmount?: {
72
+ configsByTier?: WixLoyaltyRewardConfig[];
73
+ };
74
+ percentage?: {
75
+ configsByTier?: WixLoyaltyRewardConfig[];
76
+ };
77
+ freeShipping?: {
78
+ configsByTier?: WixLoyaltyRewardConfig[];
79
+ };
80
+ };
48
81
  active?: boolean;
49
82
  }
50
83
  export interface WixLoyaltyTier {
@@ -52,22 +85,47 @@ export interface WixLoyaltyTier {
52
85
  id?: string;
53
86
  tierDefinition?: {
54
87
  name?: string;
55
- icon?: string;
88
+ icon?: WixLoyaltyImage;
56
89
  };
57
90
  requiredPoints?: number;
58
91
  }
59
- /** GET /loyalty/v1/program → { loyaltyProgram }. */
92
+ export interface WixLoyaltyEarningRule {
93
+ id?: string;
94
+ title?: string;
95
+ status?: string;
96
+ triggerActivityType?: string;
97
+ fixedAmount?: {
98
+ configs?: {
99
+ tierId?: string;
100
+ points?: number;
101
+ }[];
102
+ };
103
+ conversionRate?: {
104
+ field?: string;
105
+ configs?: {
106
+ tierId?: string;
107
+ moneyAmount?: number;
108
+ points?: number;
109
+ }[];
110
+ };
111
+ }
112
+ /** GET /loyalty-programs/v1/program → { loyaltyProgram }. */
60
113
  export declare function getLoyaltyProgram(readOptions?: WixCallOptions): Promise<{
61
114
  loyaltyProgram?: WixLoyaltyProgram;
62
115
  program?: WixLoyaltyProgram;
63
116
  }>;
64
- /** GET /loyalty/v1/rewards → { rewards }. */
117
+ /** GET /loyalty-rewards/v1/rewards → { rewards }. */
65
118
  export declare function listLoyaltyRewards(readOptions?: WixCallOptions): Promise<{
66
119
  rewards?: WixLoyaltyReward[];
67
120
  }>;
68
- /** GET /loyalty/v1/tiers → { tiers }. The PUBLIC program tier ladder
69
- * (wix.loyalty.v1.tier) — NOT the private per-customer tiers-program dashboard. */
121
+ /** GET /loyalty-tiers/v1/tiers → { tiers }. The program tier ladder. */
70
122
  export declare function listLoyaltyTiers(readOptions?: WixCallOptions): Promise<{
71
123
  tiers?: WixLoyaltyTier[];
72
124
  }>;
125
+ /** Active and inactive earning rules in their raw REST shape; callers choose visibility.
126
+ * @scope visitor
127
+ */
128
+ export declare function listLoyaltyEarningRules(readOptions?: WixCallOptions): Promise<{
129
+ earningRules?: WixLoyaltyEarningRule[];
130
+ }>;
73
131
  export * from "./extensions.js";
@@ -215,3 +215,90 @@ export declare function joinProgram(programId: string, options?: {
215
215
  }): Promise<WixJoinProgramResponse>;
216
216
  /** The cashier handle to settle, or "" when no payable order is available. */
217
217
  export declare function payableIdOf(participant?: WixJoinedParticipant): string;
218
+ /** `Participant.enrollmentStatus` values the member list filters on. */
219
+ export declare const MEMBER_ENROLLMENT_STATUSES: {
220
+ readonly joined: "JOINED";
221
+ readonly suspended: "SUSPENDED";
222
+ readonly unknown: "UNKNOWN_ENROLLMENT_STATUS";
223
+ };
224
+ /** `Participant.progressStatus` values that still count as a membership once the enrollment is over. */
225
+ export declare const MEMBER_FINISHED_PROGRESS_STATUSES: readonly ["COMPLETED", "FAILED"];
226
+ export interface WixMemberParticipantsQuery {
227
+ /** The signed-in member's id (`getMyMember().member.id`). Required: without it the query is the roster of everyone. */
228
+ memberId: string;
229
+ /** The `pagingMetadata.cursors.next` of the previous page; omit for the first page. */
230
+ cursor?: string;
231
+ /** Page size, default 100 (the upstream page cap for this query). */
232
+ limit?: number;
233
+ }
234
+ export interface WixQueryMemberParticipantsResponse extends WixQueryParticipantsResponse {
235
+ pagingMetadata?: WixQueryParticipantsResponse["pagingMetadata"] & {
236
+ cursors?: {
237
+ next?: string | null;
238
+ };
239
+ };
240
+ }
241
+ /**
242
+ * POST /online-programs/v3/participants/query — the MEMBER'S participations, cursor-paged, with
243
+ * progress. Joined and suspended enrollments, plus completed/failed ones whose enrollment has
244
+ * ended, so a finished program still shows its outcome; left, removed and auto-removed
245
+ * memberships are excluded. The query language has no `programId: {$in}` on this
246
+ * endpoint, so callers match memberships to displayed programs locally.
247
+ *
248
+ * @scope member — requires the signed-in site member; `memberId` must be that member's own id
249
+ * (`getMyMember().member.id`). An empty `participants` list means the member has no such
250
+ * membership, never that the read failed: a failure rejects.
251
+ */
252
+ export declare function queryMemberParticipants(opts: WixMemberParticipantsQuery): Promise<WixQueryMemberParticipantsResponse>;
253
+ export interface WixProgramParticipationStats {
254
+ programId?: string;
255
+ participantsCount?: number;
256
+ autoRemovedCount?: number;
257
+ }
258
+ export interface WixGetParticipationStatsResponse {
259
+ participationStats?: WixProgramParticipationStats[];
260
+ }
261
+ /** POST /online-programs/v3/participants/stats — participant counts for a batch of programs (one call per page).
262
+ * `programIds` must be non-empty (an empty batch returns `{ participationStats: [] }` without a call);
263
+ * a program missing from the answer has no count, not zero.
264
+ * @scope visitor — counts are public; an anonymous visitor session is enough. */
265
+ export declare function getParticipationStats(programIds: string[]): Promise<WixGetParticipationStatsResponse>;
266
+ /** `JoinApplication.status` — the member's standing BEFORE a participant exists (a private or paid program). */
267
+ export type WixJoinApplicationStatus = "INVITED" | "APPROVAL_PENDING" | "APPROVED" | "PAYMENT_PENDING" | "SUSPENDED" | "DECLINED" | "CANCELLED" | string;
268
+ export interface WixJoinApplication {
269
+ id?: string;
270
+ programId?: string;
271
+ memberId?: string;
272
+ status?: WixJoinApplicationStatus;
273
+ paymentStatus?: string;
274
+ /** Set once the application became a participant. */
275
+ participantId?: string;
276
+ createdDate?: string;
277
+ updatedDate?: string;
278
+ }
279
+ export interface WixGetCurrentJoinApplicationResponse {
280
+ joinApplication?: WixJoinApplication;
281
+ }
282
+ /** GET /online-programs/participants/v3/join-applications/current/{programId} — the signed-in member's
283
+ * own application to ONE program, or none. Used per card only where an application can exist
284
+ * (a private or a priced program the member has not joined). An answer with no `joinApplication`
285
+ * means the member never applied.
286
+ * @scope member — requires the signed-in site member; a visitor session has no application to read. */
287
+ export declare function getCurrentJoinApplication(programId: string): Promise<WixGetCurrentJoinApplicationResponse>;
288
+ export interface WixProgramCategory {
289
+ id?: string;
290
+ label?: string;
291
+ /** Program ids the category is assigned to. */
292
+ assignedTo?: string[];
293
+ }
294
+ export interface WixListProgramCategoriesResponse {
295
+ categories?: WixProgramCategory[];
296
+ }
297
+ /** GET /_api/program-categories-service/v3/categories — every program category of the site (the
298
+ * category filter's options). `/_api/…` paths ride the same bridge as the public ones (forms,
299
+ * bookings-v2 and ecom already do). An empty `categories` list means the site has none.
300
+ * @scope member — the One App member programs list calls it with the member's identity. NOT verified
301
+ * live here: codegen/wix/auto/lock.json lists only the APP identity (ONLINE_PROGRAMS.CATEGORY_READ), so a
302
+ * visitor or member token can get 403. A caller must treat a rejection as "no category filter", never
303
+ * as an error screen. */
304
+ export declare function listProgramCategories(): Promise<WixListProgramCategoriesResponse>;
@@ -20,17 +20,29 @@ function wixCall(method, path, body, readOptions) {
20
20
  return readOptions?.site ? api.call(method, path, body, { "wix-site-id": readOptions.site }) : api.call(method, path, body);
21
21
  }
22
22
  function getLoyaltyProgram(readOptions) {
23
- return wixCall("GET", "/loyalty/v1/program", void 0, readOptions);
23
+ return wixCall("GET", "/loyalty-programs/v1/program", void 0, readOptions);
24
+ }
25
+ function withLegacyRewardCost(reward) {
26
+ if (reward.requiredPoints !== void 0) return reward;
27
+ const configs = reward.discountAmount?.configsByTier ?? reward.couponReward?.fixedAmount?.configsByTier ?? reward.couponReward?.percentage?.configsByTier ?? reward.couponReward?.freeShipping?.configsByTier;
28
+ const base = configs?.filter((config) => !config.tierId);
29
+ if (base?.length !== 1) return reward;
30
+ const cost = base[0].costInPoints;
31
+ return typeof cost === "number" && Number.isFinite(cost) && cost >= 0 ? { ...reward, requiredPoints: cost } : reward;
24
32
  }
25
33
  function listLoyaltyRewards(readOptions) {
26
- return wixCall("GET", "/loyalty/v1/rewards", void 0, readOptions);
34
+ return wixCall("GET", "/loyalty-rewards/v1/rewards", void 0, readOptions).then((response) => response.rewards ? { ...response, rewards: response.rewards.map(withLegacyRewardCost) } : response);
27
35
  }
28
36
  function listLoyaltyTiers(readOptions) {
29
- return wixCall("GET", "/loyalty/v1/tiers", void 0, readOptions);
37
+ return wixCall("GET", "/loyalty-tiers/v1/tiers", void 0, readOptions);
38
+ }
39
+ function listLoyaltyEarningRules(readOptions) {
40
+ return wixCall("GET", "/_api/loyalty-earning-rules/v1/earning-rules/rules", void 0, readOptions);
30
41
  }
31
42
  export {
32
43
  getLoyaltyBffDashboard,
33
44
  getLoyaltyProgram,
45
+ listLoyaltyEarningRules,
34
46
  listLoyaltyRewards,
35
47
  listLoyaltyTiers,
36
48
  wixCall
@@ -81,10 +81,52 @@ function payableIdOf(participant) {
81
81
  const pending = participant?.paymentPendingOptions;
82
82
  return pending?.purchaseFlowId || pending?.snapshotId || pending?.orderId || "";
83
83
  }
84
+ var MEMBER_ENROLLMENT_STATUSES = {
85
+ joined: "JOINED",
86
+ suspended: "SUSPENDED",
87
+ unknown: "UNKNOWN_ENROLLMENT_STATUS"
88
+ };
89
+ var MEMBER_FINISHED_PROGRESS_STATUSES = ["COMPLETED", "FAILED"];
90
+ function queryMemberParticipants(opts) {
91
+ if (!opts?.memberId) throw new Error("queryMemberParticipants: memberId is required");
92
+ const limit = opts.limit ?? 100;
93
+ const query = opts.cursor ? { cursorPaging: { limit, cursor: opts.cursor } } : {
94
+ filter: {
95
+ memberId: opts.memberId,
96
+ $or: [
97
+ { enrollmentStatus: { $in: [MEMBER_ENROLLMENT_STATUSES.joined, MEMBER_ENROLLMENT_STATUSES.suspended] } },
98
+ { enrollmentStatus: MEMBER_ENROLLMENT_STATUSES.unknown, progressStatus: { $in: [...MEMBER_FINISHED_PROGRESS_STATUSES] } }
99
+ ]
100
+ },
101
+ cursorPaging: { limit }
102
+ };
103
+ return wixCall("POST", "/online-programs/v3/participants/query", { query, fields: ["PROGRESS"] });
104
+ }
105
+ function getParticipationStats(programIds) {
106
+ const ids = [...new Set((programIds ?? []).filter((id) => typeof id === "string" && id))];
107
+ if (!ids.length) return Promise.resolve({ participationStats: [] });
108
+ return wixCall("POST", "/online-programs/v3/participants/stats", { programIds: ids });
109
+ }
110
+ function getCurrentJoinApplication(programId) {
111
+ if (!programId) throw new Error("getCurrentJoinApplication: programId is required");
112
+ return wixCall(
113
+ "GET",
114
+ `/online-programs/participants/v3/join-applications/current/${encodeURIComponent(programId)}`
115
+ );
116
+ }
117
+ function listProgramCategories() {
118
+ return wixCall("GET", "/_api/program-categories-service/v3/categories");
119
+ }
84
120
  export {
121
+ MEMBER_ENROLLMENT_STATUSES,
122
+ MEMBER_FINISHED_PROGRESS_STATUSES,
123
+ getCurrentJoinApplication,
124
+ getParticipationStats,
85
125
  getProgram,
86
126
  joinProgram,
127
+ listProgramCategories,
87
128
  payableIdOf,
129
+ queryMemberParticipants,
88
130
  queryParticipants,
89
131
  queryPrograms,
90
132
  searchMemberParticipation