@wix/himalaya-cli 0.1673.0 → 0.1675.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.
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/serve-runtime/src/wix-bridge.d.ts +13 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/online-programs/src/index.d.ts +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-online-programs.mjs +25 -1
- package/dist/browser-plane/sw.js +5 -5
- package/dist/cli.mjs +473 -86
- package/guides/himi-json-output.md +22 -1
- package/guides/one-app-to-himi-app.md +18 -3
- package/guides/qa-builds.md +8 -2
- package/guides/releasing-with-himi-serve.md +10 -2
- package/guides/sdk-reference.json +2 -2
- package/guides/skill.md +1 -0
- package/package.json +2 -2
- package/templates/branded-lite/tier5-src/_shared/program-standing.ts +6 -0
- package/templates/branded-lite/tier5-src/himi-branded-lite-member-programs/index.ts +36 -7
- package/templates/branded-lite/tier5-src/himi-branded-lite-program/index.ts +30 -17
- package/templates/yoga-studio/tier5-src/_shared/program-standing.ts +6 -0
- package/templates/yoga-studio/tier5-src/himi-branded-lite-member-programs/index.ts +36 -7
- package/templates/yoga-studio/tier5-src/himi-branded-lite-program/index.ts +30 -17
|
@@ -119,6 +119,19 @@ export declare class OwnerInstanceCache {
|
|
|
119
119
|
}
|
|
120
120
|
export declare const OWNER_SITES_QUERY_PATH = "/site-list/v2/sites/query";
|
|
121
121
|
export declare const OWNER_SITES_COUNT_PATH = "/site-list/v2/sites/count";
|
|
122
|
+
/** The Site List filter for ONE site by id. Without a namespace filter Site List answers only its
|
|
123
|
+
* default namespaces (measured: a HEADLESS site's id alone answers `sites: []`), so an ownership
|
|
124
|
+
* check read the owner of a headless site as "not the owner". Naming a namespace REPLACES that
|
|
125
|
+
* default, so the list keeps WIX_STUDIO too: the unfiltered listing returns Studio sites. */
|
|
126
|
+
export declare const OWNER_SITE_NAMESPACES: readonly ["WIX", "WIX_STUDIO", "HEADLESS"];
|
|
127
|
+
export declare function siteIdFilter(siteId: string): {
|
|
128
|
+
id: {
|
|
129
|
+
$in: string[];
|
|
130
|
+
};
|
|
131
|
+
namespace: {
|
|
132
|
+
$in: ("WIX" | "WIX_STUDIO" | "HEADLESS")[];
|
|
133
|
+
};
|
|
134
|
+
};
|
|
122
135
|
/** True for the ONLY two paths the account-level owner-sites rung may reach. */
|
|
123
136
|
export declare function isOwnerSitesPath(path: string): boolean;
|
|
124
137
|
/**
|
|
@@ -207,11 +207,15 @@ export interface WixJoinProgramResponse {
|
|
|
207
207
|
* SINGLE_PAYMENT and return the Wix Payments order as paymentPendingOptions.orderId.
|
|
208
208
|
* mayPreparePayment rechecks the caller's checkout guard before creating that order.
|
|
209
209
|
* beforeWrite lets a resumed caller revalidate its confirmed member after asynchronous reads.
|
|
210
|
+
* withdrawnParticipantId names a participation the caller freshly verified as withdrawn.
|
|
211
|
+
* Only its matching historical application is replaced; another current participant is resumed.
|
|
210
212
|
* @scope member
|
|
211
213
|
*/
|
|
212
214
|
export declare function joinProgram(programId: string, options?: {
|
|
213
215
|
mayPreparePayment?: () => boolean;
|
|
214
216
|
beforeWrite?: () => Promise<void>;
|
|
217
|
+
withdrawnParticipantId?: string;
|
|
218
|
+
resumeExistingParticipant?: boolean;
|
|
215
219
|
}): Promise<WixJoinProgramResponse>;
|
|
216
220
|
/** The cashier handle to settle, or "" when no payable order is available. */
|
|
217
221
|
export declare function payableIdOf(participant?: WixJoinedParticipant): string;
|
|
@@ -52,18 +52,42 @@ async function joinProgram(programId, options) {
|
|
|
52
52
|
currentReadSucceeded = true;
|
|
53
53
|
} catch {
|
|
54
54
|
}
|
|
55
|
-
if (!currentReadSucceeded) {
|
|
55
|
+
if (!currentReadSucceeded && options?.resumeExistingParticipant === false) {
|
|
56
|
+
try {
|
|
57
|
+
const member = await wixCall("GET", "/members/v1/members/my");
|
|
58
|
+
if (!member?.member?.id) throw new Error("Current member unavailable");
|
|
59
|
+
const found = await queryJoinApplications({ memberId: member.member.id, programIds: [programId] });
|
|
60
|
+
const paging = found?.pagingMetadata;
|
|
61
|
+
if (!Array.isArray(found?.joinApplications) || found.joinApplications.length || paging?.hasNext === true || paging?.hasNext !== false && paging?.cursors?.next) {
|
|
62
|
+
throw new Error("Application absence is unknown");
|
|
63
|
+
}
|
|
64
|
+
} catch {
|
|
65
|
+
throw joinProgramError("join_application_unavailable", "current join application must be verified before creating enrollment");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const noCurrentApplication = currentReadSucceeded && !!response && typeof response === "object" && !Array.isArray(response) && response.joinApplication === void 0;
|
|
69
|
+
const historical = !!options?.withdrawnParticipantId && !!response?.joinApplication?.id && response.joinApplication.programId === programId && response.joinApplication.status === "APPROVED" && response.joinApplication.participantId === options.withdrawnParticipantId;
|
|
70
|
+
if (currentReadSucceeded && !historical && response?.joinApplication?.participantId && options?.resumeExistingParticipant === false) {
|
|
71
|
+
throw joinProgramError("invalid_join_application", "existing participation must be verified before resuming enrollment");
|
|
72
|
+
}
|
|
73
|
+
if (!currentReadSucceeded || noCurrentApplication || historical) {
|
|
56
74
|
await options?.beforeWrite?.();
|
|
57
75
|
response = await wixCall("POST", JOIN_APPLICATIONS, { joinApplication: { programId } });
|
|
58
76
|
}
|
|
59
77
|
let application = response?.joinApplication;
|
|
60
78
|
if (!application?.id || application.programId !== programId) throw joinProgramError("invalid_join_application", "invalid join application");
|
|
79
|
+
if (options?.withdrawnParticipantId && application.participantId === options.withdrawnParticipantId) {
|
|
80
|
+
throw joinProgramError("invalid_join_application", "a withdrawn participant cannot confirm a new enrollment");
|
|
81
|
+
}
|
|
61
82
|
if (application.status === "APPROVED" && ["PAYMENT_PENDING", "PAYMENT_FAILED", "PAYMENT_CANCELED"].includes(application.paymentStatus ?? "")) {
|
|
62
83
|
if (options?.mayPreparePayment && !options.mayPreparePayment()) throw joinProgramError("payment_preparation_withdrawn", "payment preparation withdrawn");
|
|
63
84
|
await options?.beforeWrite?.();
|
|
64
85
|
const prepared = await wixCall("POST", `${JOIN_APPLICATIONS}/${encodeURIComponent(application.id)}/prepare-payment`, { paymentType: "SINGLE_PAYMENT" });
|
|
65
86
|
if (prepared?.joinApplication?.id !== application.id || prepared.joinApplication.programId !== programId) throw joinProgramError("invalid_prepared_application", "invalid prepared application");
|
|
66
87
|
application = prepared.joinApplication;
|
|
88
|
+
if (options?.withdrawnParticipantId && application.participantId === options.withdrawnParticipantId) {
|
|
89
|
+
throw joinProgramError("invalid_join_application", "a withdrawn participant cannot confirm a new enrollment");
|
|
90
|
+
}
|
|
67
91
|
}
|
|
68
92
|
const participant = { programId, memberId: application.memberId };
|
|
69
93
|
if (application.status === "APPROVAL_PENDING") return { participant: { ...participant, state: "APPROVAL_PENDING" } };
|