@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.
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-config.d.ts +7 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/catalog-adapters/wix-video.d.ts +20 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/catalog-pricing-contract.d.ts +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/index.d.ts +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/mapping-source.d.ts +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/wix-payments-contract.d.ts +11 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/wix-platform/src/index.d.ts +14 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/wix-platform/src/user-props.d.ts +8 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/index.d.ts +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/videos.d.ts +5 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/index.d.ts +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/online-programs/src/index.d.ts +122 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/video/src/index.d.ts +6 -5
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap-checkout.mjs +25 -4
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap.mjs +25 -5
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +8 -3
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-online-programs.mjs +118 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-platform.mjs +65 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-video.mjs +3 -3
- package/dist/cli.mjs +157 -46
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/form-submit.service.ts +22 -2
- package/guides/iap-pricing.md +1 -0
- package/guides/iap-products.md +18 -7
- package/guides/iap-screen-adoption.md +2 -1
- package/guides/qa-builds.md +14 -1
- package/guides/recipe-dynamic-list.md +16 -0
- package/guides/recipe-form-submit.md +32 -2
- package/guides/recipe-four-state.md +2 -1
- package/guides/sdk-reference.json +144 -10
- package/guides/web-page-sdk-reference.md +1 -1
- package/guides/wix-platform-usage.md +38 -0
- package/package.json +2 -2
- package/templates/branded-lite/dev/index.ts +107 -3
- package/templates/branded-lite/tier5-src/himi-branded-lite-video/index.ts +62 -7
- package/templates/branded-lite/tier5-src/himi-branded-lite-videos/index.ts +82 -26
|
@@ -153,6 +153,13 @@ export interface WixPlatformConfig {
|
|
|
153
153
|
appType?: string;
|
|
154
154
|
dsn?: string;
|
|
155
155
|
};
|
|
156
|
+
/** `wixPlatform.userProps` (#4704): the signed-in Wix user's server-side per-app preferences.
|
|
157
|
+
* `app` names the record set (the `<app>` in `app-state/v1/user/<app>/state`); required to
|
|
158
|
+
* enable the member — without it `userProps.get/set` reject `not_configured`. Owner/user
|
|
159
|
+
* auth only; web answers `unavailable`. */
|
|
160
|
+
userProps?: {
|
|
161
|
+
app: string;
|
|
162
|
+
};
|
|
156
163
|
}
|
|
157
164
|
/** The shared Wix "one-app" Sentry project DSN (engine `WIX_ONE_APP_PROJECT_DSN`)
|
|
158
165
|
* — one public client DSN for all Wix apps/platforms, segmented by the
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { IapCatalogItem } from "../catalog-pricing-contract.js";
|
|
2
|
+
/** The pricing a Wix Video query returns (`pricing { type enabled required price }`), structurally. */
|
|
3
|
+
interface VideoPricingOption {
|
|
4
|
+
type?: string;
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
price?: unknown;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A Wix video as a shared IAP catalog item, only when the App Store may sell it: an enabled one-time
|
|
11
|
+
* `SALE` price above zero, in a channel whose pricing was read and that requires neither a subscription
|
|
12
|
+
* nor a pricing plan (a bought video stays locked there). Rental and subscription access are never sold.
|
|
13
|
+
*/
|
|
14
|
+
export declare function wixVideoItem(channel: {
|
|
15
|
+
pricing?: VideoPricingOption[] | null;
|
|
16
|
+
}, video: {
|
|
17
|
+
id?: string | null;
|
|
18
|
+
pricing?: VideoPricingOption[] | null;
|
|
19
|
+
}, commerceDisplayPrice?: string): IapCatalogItem | undefined;
|
|
20
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CatalogReference, PricingMappingProvider, PricingUnavailableReason } from "./pricing-contract.js";
|
|
2
2
|
/** The Wix entity types `himi store iap` writes into its Wix→Apple mapping, so a mapping
|
|
3
3
|
* backend can serve that export without translating kinds. */
|
|
4
|
-
export declare const IAP_CATALOG_KINDS: readonly ["onlineProgram", "storesProduct", "pricingPlan", "bookingsService", "eventsTicket"];
|
|
4
|
+
export declare const IAP_CATALOG_KINDS: readonly ["onlineProgram", "storesProduct", "pricingPlan", "bookingsService", "eventsTicket", "wixVideo"];
|
|
5
5
|
export type IapCatalogKind = typeof IAP_CATALOG_KINDS[number];
|
|
6
6
|
export interface IapCatalogItem {
|
|
7
7
|
reference: CatalogReference;
|
package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./catalog-pricing-contract.js";
|
|
|
8
8
|
export * from "./catalog-pricing.js";
|
|
9
9
|
export * from "./catalog-price-fields.js";
|
|
10
10
|
export * from "./catalog-adapters/online-programs.js";
|
|
11
|
+
export * from "./catalog-adapters/wix-video.js";
|
|
11
12
|
export * from "./wix-payments-contract.js";
|
|
12
13
|
export * from "./wix-payments.js";
|
|
13
14
|
export * from "./host-session.js";
|
|
@@ -4,7 +4,7 @@ export type WixBridgeCall = (method: string, path: string, body: unknown, header
|
|
|
4
4
|
export interface WixIapMappingSourceDependencies {
|
|
5
5
|
binding: AppBindingSource;
|
|
6
6
|
call: WixBridgeCall;
|
|
7
|
-
/** The verticals the App Store
|
|
7
|
+
/** The verticals the App Store prices; the shipped `APPLE_PRICING_RULES` unless given. */
|
|
8
8
|
rules?: Readonly<Record<string, AppleSaleRule>>;
|
|
9
9
|
}
|
|
10
10
|
/** The connected source. Tests substitute this module at bundle-build time (`mappingSourceSeam`). */
|
|
@@ -63,6 +63,13 @@ export declare const STORES_PRODUCT_SALE_RULE: AppleSaleRule;
|
|
|
63
63
|
* plan's Apple product, and the order reads ACTIVE and PAID. Recurring and time-limited plans stay outside
|
|
64
64
|
* this rule; their Billing lifecycle is unfinished. */
|
|
65
65
|
export declare const PRICING_PLAN_APPLE_SALES_ENABLED = true;
|
|
66
|
+
/**
|
|
67
|
+
* Whether Wix Video videos sell through the App Store. OFF: prices only. A video with a one-time Sale
|
|
68
|
+
* price above zero is mapped under its video id as a one-time unlock (`wixVideoItem`), and screens show
|
|
69
|
+
* its App Store price, but no purchase path exists yet: Wix Video has no public order API, and the
|
|
70
|
+
* Videos order adapter refuses every sale until this is on.
|
|
71
|
+
*/
|
|
72
|
+
export declare const VIDEOS_APPLE_SALES_ENABLED = false;
|
|
66
73
|
/**
|
|
67
74
|
* The one definition `himi store iap connect` writes mappings by and the mapping source reads them by,
|
|
68
75
|
* keyed by catalog kind. wix-iap StartPayment maps the cashier order's single item id, and Online
|
|
@@ -75,12 +82,16 @@ export interface AppleSaleOptions {
|
|
|
75
82
|
pricingPlanAppleSalesEnabled?: boolean;
|
|
76
83
|
bookingsAppleSalesEnabled?: boolean;
|
|
77
84
|
eventsAppleSalesEnabled?: boolean;
|
|
85
|
+
videosAppleSalesEnabled?: boolean;
|
|
78
86
|
}
|
|
79
87
|
/** Resolves runtime sale eligibility independently from the catalog's provisioning support. */
|
|
80
88
|
export declare function appleSaleRules(options?: AppleSaleOptions): Readonly<Record<string, AppleSaleRule>>;
|
|
81
89
|
export declare const APPLE_SALE_RULES: Readonly<Record<string, AppleSaleRule>>;
|
|
82
90
|
/** Catalog setup may precede activation; purchases still require the independent sales switches. */
|
|
83
91
|
export declare const APPLE_PROVISIONING_RULES: Readonly<Record<string, AppleSaleRule>>;
|
|
92
|
+
/** What the mapping source prices by: every sale rule, plus the verticals whose App Store prices show
|
|
93
|
+
* before their purchase is on (Wix Video). A priced item with no sale rule has no checkout adapter. */
|
|
94
|
+
export declare const APPLE_PRICING_RULES: Readonly<Record<string, AppleSaleRule>>;
|
|
84
95
|
/** Captured when a protected call starts. The native bridge checks it and never puts it on
|
|
85
96
|
* the HTTP request. */
|
|
86
97
|
export interface HostCallExpectation {
|
|
@@ -222,4 +222,18 @@ export declare const monitoring: {
|
|
|
222
222
|
};
|
|
223
223
|
/** Capability version, for bundles that gate on min binary version. */
|
|
224
224
|
export declare const version = 2;
|
|
225
|
+
export { USER_PROPS_MAX_BYTES, type UserPropsErrorCode } from "./user-props.js";
|
|
226
|
+
/** The signed-in Wix user's small server-side per-app preference records. Enable with
|
|
227
|
+
* `wixPlatform: { userProps: { app: "<name>" } }` in `config.ts`. Rejects with `err.code`:
|
|
228
|
+
* `not_signed_in` (no Wix user — a member or visitor session counts as none), `not_configured`,
|
|
229
|
+
* `too_large`, `invalid_patch`, `request_failed`, or `unavailable` (web). */
|
|
230
|
+
export declare const userProps: {
|
|
231
|
+
/** The signed-in Wix user's props for the app named by `wixPlatform.userProps.app`. */
|
|
232
|
+
get(): Promise<Record<string, unknown>>;
|
|
233
|
+
/** Deep-merge `patch` into a FRESH server read and write the result back; resolves with it.
|
|
234
|
+
* The patch wins, objects merge recursively, arrays are replaced. Writes are serialized per
|
|
235
|
+
* process natively, so concurrent writers (two workers, or an app service and a screen) never
|
|
236
|
+
* lose each other's keys. Values must be JSON; a result over 64 KB rejects `too_large`. */
|
|
237
|
+
set(patch: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
238
|
+
};
|
|
225
239
|
export { offline, isOfflineWriteBlocked, isOfflineWriteOutcomeUnknown, type Sent, type Queued, type OfflineResult, type OfflineEvent, type OfflineEventType, type PendingWrite, type RejectedWrite, } from "./offline.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** The coded refusals a `userProps` call rejects with (`err.code`). */
|
|
2
|
+
export type UserPropsErrorCode = "not_signed_in" | "not_configured" | "too_large" | "invalid_patch" | "unavailable" | "request_failed";
|
|
3
|
+
/** Largest serialized props object (UTF-8 bytes) a write may produce. */
|
|
4
|
+
export declare const USER_PROPS_MAX_BYTES: number;
|
|
5
|
+
/** `userProps.get()` — see the facade in `index.ts`. */
|
|
6
|
+
export declare function userPropsGet(): Promise<Record<string, unknown>>;
|
|
7
|
+
/** `userProps.set(patch)` — see the facade in `index.ts`. */
|
|
8
|
+
export declare function userPropsSet(patch: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
@@ -2,3 +2,4 @@ export { onlineProgramOrders } from "./online-programs.js";
|
|
|
2
2
|
export { pricingPlanOrders } from "./pricing-plans.js";
|
|
3
3
|
export { storesProductOrders, classifyCart } from "./stores.js";
|
|
4
4
|
export { bookingOrders, eventTicketOrders } from "./attendance.js";
|
|
5
|
+
export { wixVideoOrders } from "./videos.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { createIapCommerce } from "./commerce.js";
|
|
2
2
|
export { iapPurchaseFields } from "./purchase-fields.js";
|
|
3
3
|
export { createAppleIapCheckout } from "./apple-iap.js";
|
|
4
|
-
export { onlineProgramOrders, pricingPlanOrders, storesProductOrders, bookingOrders, eventTicketOrders, classifyCart } from "./iap-verticals/index.js";
|
|
4
|
+
export { onlineProgramOrders, pricingPlanOrders, storesProductOrders, bookingOrders, eventTicketOrders, wixVideoOrders, classifyCart } from "./iap-verticals/index.js";
|
|
5
5
|
export { createWorkerOrderRefStore } from "./order-refs.js";
|
|
6
6
|
export { itemPaymentEnabled, storesAppleSalesEnabled } from "./checkout-source.js";
|
|
7
7
|
export type { AccessRead, AppleIapCheckout, AppleIapCheckoutDependencies, AppleIapCheckoutPhase, AppleIapCheckoutState, BridgeOutcome, BridgeRefusal, CashierRoute, IapEligibility, IapOrderAdapter, IapOrderItem, OrderAttempt, OrderFailureCode, OrderPartitionKey, OrderRef, OrderRefPartition, OrderRefStage, OrderRefStore, PaymentAccess, PaymentProgress, SessionBoundBridge, VerticalRef, WixBridge, } from "./apple-iap-contract.js";
|
|
@@ -263,14 +263,24 @@ export interface WixGetParticipationStatsResponse {
|
|
|
263
263
|
* a program missing from the answer has no count, not zero.
|
|
264
264
|
* @scope visitor — counts are public; an anonymous visitor session is enough. */
|
|
265
265
|
export declare function getParticipationStats(programIds: string[]): Promise<WixGetParticipationStatsResponse>;
|
|
266
|
+
/** `JoinApplication.paymentStatus` (Join Applications v3). */
|
|
267
|
+
export type WixJoinApplicationPaymentStatus = "NO_PAYMENT_REQUIRED" | "PAYMENT_PENDING" | "PAYMENT_IN_PROGRESS" | "PENDING_OWNER_APPROVAL" | "PAYMENT_SUCCESSFUL" | "PAYMENT_FAILED" | "PAYMENT_CANCELED" | string;
|
|
266
268
|
/** `JoinApplication.status` — the member's standing BEFORE a participant exists (a private or paid program). */
|
|
267
269
|
export type WixJoinApplicationStatus = "INVITED" | "APPROVAL_PENDING" | "APPROVED" | "PAYMENT_PENDING" | "SUSPENDED" | "DECLINED" | "CANCELLED" | string;
|
|
268
270
|
export interface WixJoinApplication {
|
|
269
271
|
id?: string;
|
|
272
|
+
revision?: string;
|
|
270
273
|
programId?: string;
|
|
271
274
|
memberId?: string;
|
|
272
275
|
status?: WixJoinApplicationStatus;
|
|
273
|
-
paymentStatus?:
|
|
276
|
+
paymentStatus?: WixJoinApplicationPaymentStatus;
|
|
277
|
+
/** Wix Payments / Pricing Plans data behind `paymentStatus` (order, offline transaction, plan ids, coupon). */
|
|
278
|
+
paymentInfo?: {
|
|
279
|
+
paymentOrderId?: string;
|
|
280
|
+
offlineTransactionId?: string;
|
|
281
|
+
paidPlanIds?: string[];
|
|
282
|
+
couponId?: string;
|
|
283
|
+
};
|
|
274
284
|
/** Set once the application became a participant. */
|
|
275
285
|
participantId?: string;
|
|
276
286
|
createdDate?: string;
|
|
@@ -302,3 +312,114 @@ export interface WixListProgramCategoriesResponse {
|
|
|
302
312
|
* visitor or member token can get 403. A caller must treat a rejection as "no category filter", never
|
|
303
313
|
* as an error screen. */
|
|
304
314
|
export declare function listProgramCategories(): Promise<WixListProgramCategoriesResponse>;
|
|
315
|
+
/** Participant `enrollmentStatus` (Participants v3). */
|
|
316
|
+
export type WixEnrollmentStatus = "JOINED" | "SUSPENDED" | "AUTO_REMOVED" | "REMOVED" | "LEFT" | string;
|
|
317
|
+
/** Participant `progressStatus` (Participants v3). */
|
|
318
|
+
export type WixProgressStatus = "NOT_STARTED" | "IN_PROGRESS" | "COMPLETED" | "FAILED" | "NOT_APPLICABLE" | string;
|
|
319
|
+
/**
|
|
320
|
+
* Every page of `queryMemberParticipants`, concatenated — the member's whole membership snapshot,
|
|
321
|
+
* which `participationsByProgram` then matches to the programs on screen. Bounded by `maxPages`
|
|
322
|
+
* (default 10; at the upstream page cap of 100 that is at most 1,000 rows) so a runaway cursor
|
|
323
|
+
* can never spin a worker forever. The server filter of `queryMemberParticipants` already leaves
|
|
324
|
+
* out enrollments the member left or was removed from, so a program the member left and never
|
|
325
|
+
* re-joined simply has no row here; this walk adds no filter of its own.
|
|
326
|
+
*
|
|
327
|
+
* @scope member — requires the signed-in site member; `memberId` must be that member's own id.
|
|
328
|
+
*/
|
|
329
|
+
export declare function listMyParticipations(memberId: string, opts?: {
|
|
330
|
+
maxPages?: number;
|
|
331
|
+
}): Promise<WixParticipant[]>;
|
|
332
|
+
/**
|
|
333
|
+
* The participation to show per program when a member has several rows for one program: the
|
|
334
|
+
* NEWEST by `createdDate` wins — the One App member-list rule. Participants without a `programId`
|
|
335
|
+
* are skipped. Defensive, for a caller that feeds a BROADER read than `listMyParticipations`
|
|
336
|
+
* (whose server filter already omits them): a withdrawn enrollment (LEFT / REMOVED / AUTO_REMOVED)
|
|
337
|
+
* is dropped only AFTER the newest row is chosen, so a newer withdrawal can never resurrect an
|
|
338
|
+
* older joined row, and a re-join after a leave is the standing.
|
|
339
|
+
*/
|
|
340
|
+
export declare function participationsByProgram(participants: readonly WixParticipant[]): Map<string, WixParticipant>;
|
|
341
|
+
export interface WixQueryJoinApplicationsResponse {
|
|
342
|
+
joinApplications?: WixJoinApplication[];
|
|
343
|
+
pagingMetadata?: {
|
|
344
|
+
count?: number;
|
|
345
|
+
total?: number;
|
|
346
|
+
hasNext?: boolean;
|
|
347
|
+
cursors?: {
|
|
348
|
+
next?: string | null;
|
|
349
|
+
prev?: string | null;
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
/** `JoinApplication.status` values that describe a member BEFORE they are a participant — the ones a
|
|
354
|
+
* card shows. Payment is NOT a status: an approved-but-unpaid application stays `APPROVED` with
|
|
355
|
+
* `paymentStatus` PAYMENT_PENDING (what `joinProgram` above reads), so `APPROVED` covers it and the
|
|
356
|
+
* caller reads `paymentStatus` to tell "pay to join" from "joined, participant pending". An
|
|
357
|
+
* application that already became a participant keeps its status and carries `participantId`:
|
|
358
|
+
* callers prefer the participation and ignore such rows. */
|
|
359
|
+
export declare const PENDING_JOIN_APPLICATION_STATUSES: readonly WixJoinApplicationStatus[];
|
|
360
|
+
export interface JoinApplicationsQuery {
|
|
361
|
+
memberId: string;
|
|
362
|
+
/** Programs to look at; omitted reads the member's open applications across every program. An empty list makes no call. */
|
|
363
|
+
programIds?: readonly string[];
|
|
364
|
+
/** Defaults to the pre-participant statuses (`PENDING_JOIN_APPLICATION_STATUSES`). */
|
|
365
|
+
statuses?: readonly WixJoinApplicationStatus[];
|
|
366
|
+
/** Page size, 1..100; defaults to the cap (100). A member can hold several applications to one program
|
|
367
|
+
* (an old approved one that became a participant, a new pending re-application), so the page is never
|
|
368
|
+
* sized to the program count. */
|
|
369
|
+
limit?: number;
|
|
370
|
+
/** `pagingMetadata.cursors.next` of the previous page. A cursor page carries NO filter, per the API. */
|
|
371
|
+
cursor?: string;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* The member's open join applications for a set of programs in ONE call — what says "pending
|
|
375
|
+
* request", "request approved, pay to join" or "invited" before any participant exists. The
|
|
376
|
+
* per-program `getCurrentJoinApplication` above answers one program; this answers a page.
|
|
377
|
+
*
|
|
378
|
+
* `POST /online-programs/participants/v3/join-applications/query`.
|
|
379
|
+
*
|
|
380
|
+
* @scope member — requires the signed-in site member; the reference states a member may read their own applications.
|
|
381
|
+
*/
|
|
382
|
+
export declare function queryJoinApplications(query: JoinApplicationsQuery): Promise<WixQueryJoinApplicationsResponse>;
|
|
383
|
+
/**
|
|
384
|
+
* Every page of `queryJoinApplications`, concatenated, bounded by `maxPages` (default 5 → at most
|
|
385
|
+
* 500 applications). What a page of program cards reads when the member's applications may exceed
|
|
386
|
+
* one page; the single-page call is enough for one program.
|
|
387
|
+
*
|
|
388
|
+
* @scope member — requires the signed-in site member; reads that member's own applications.
|
|
389
|
+
*/
|
|
390
|
+
export declare function listJoinApplications(query: Omit<JoinApplicationsQuery, "cursor">, opts?: {
|
|
391
|
+
maxPages?: number;
|
|
392
|
+
}): Promise<WixJoinApplication[]>;
|
|
393
|
+
export interface WixCancelJoinApplicationResponse {
|
|
394
|
+
joinApplication?: WixJoinApplication;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Withdraw the member's own pending request — the "Cancel request" action on a card whose
|
|
398
|
+
* application is `APPROVAL_PENDING`. This is request withdrawal ONLY: an invitation (`INVITED`)
|
|
399
|
+
* is answered with the separate `…/{id}/decline` operation, which this SDK does not bind, and
|
|
400
|
+
* the cancel route rejects it with an invalid-status error. The application moves to `CANCELLED`
|
|
401
|
+
* and is removed asynchronously, so a list read right after may still show it — re-read, do not
|
|
402
|
+
* assume.
|
|
403
|
+
*
|
|
404
|
+
* `POST /online-programs/participants/v3/join-applications/{id}/cancel`.
|
|
405
|
+
*
|
|
406
|
+
* @scope member — requires the signed-in site member withdrawing their own application.
|
|
407
|
+
*/
|
|
408
|
+
export declare function cancelJoinApplication(joinApplicationId: string): Promise<WixCancelJoinApplicationResponse>;
|
|
409
|
+
/** `participantsCount + autoRemovedCount` per program — the number the One App card prints as "N participants". */
|
|
410
|
+
export declare function participantsShownByProgram(response: WixGetParticipationStatsResponse): Map<string, number>;
|
|
411
|
+
export interface WixGetPremiumStatsResponse {
|
|
412
|
+
premiumEnabled?: boolean;
|
|
413
|
+
activeParticipantsCount?: number;
|
|
414
|
+
activeParticipantsLimit?: number;
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Whether the site's Online Programs are over the free-tier participant cap — the One App hides a
|
|
418
|
+
* joined card's progress and price while this holds.
|
|
419
|
+
* `GET /online-programs/participants/v3/stats/premium`.
|
|
420
|
+
*
|
|
421
|
+
* @scope member — exercised with a signed-in member session; the reference lists only the Manage scope (see the section note).
|
|
422
|
+
*/
|
|
423
|
+
export declare function getPremiumStats(): Promise<WixGetPremiumStatsResponse>;
|
|
424
|
+
/** True when participation is blocked by the free-tier cap (no premium, count over limit). */
|
|
425
|
+
export declare function isParticipationBlocked(stats: WixGetPremiumStatsResponse | undefined): boolean;
|
|
@@ -138,14 +138,15 @@ export declare function wixVideoQuery<T>(query: string, variables?: Record<strin
|
|
|
138
138
|
export declare function wixVideoPages<T extends {
|
|
139
139
|
id: string;
|
|
140
140
|
}>(fetchPage: (cursor: string | null) => Promise<WixVideoPage<T> | null | undefined>): Promise<T[]>;
|
|
141
|
-
/** The channel fields a list or card needs. */
|
|
142
|
-
export declare const CHANNEL_FIELDS = "id title description source featuredVideoId hasPaidVideos cover { selected } videos { total }";
|
|
141
|
+
/** The channel fields a list or card needs, including the viewer's subscription (`canWatchVideo`). */
|
|
142
|
+
export declare const CHANNEL_FIELDS = "id title description source featuredVideoId hasPaidVideos cover { selected } pricing { type enabled required } purchase(filter: {type: SUBSCRIPTION}) { status expiresAt } videos { total }";
|
|
143
143
|
/** The channel fields an access decision needs (`canWatchVideo`). */
|
|
144
144
|
export declare const CHANNEL_ACCESS_FIELDS = "id title pricing { type enabled required } purchase(filter: {type: SUBSCRIPTION}) { status expiresAt }";
|
|
145
|
-
/** The video fields a card needs: title, images, length
|
|
146
|
-
|
|
145
|
+
/** The video fields a card needs: title, images, length, processing state, and the pricing and the
|
|
146
|
+
* viewer's purchases an access decision needs (`canWatchVideo`). */
|
|
147
|
+
export declare const 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 }";
|
|
147
148
|
/** The video fields playback and an access decision need. */
|
|
148
|
-
export declare const 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 }";
|
|
149
|
+
export declare const 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 }";
|
|
149
150
|
export interface ListChannelsOptions extends WixCallOptions {
|
|
150
151
|
/** Also read the first N videos of each channel (owner's order). 0 (default) reads none. */
|
|
151
152
|
videosPerChannel?: number;
|
|
@@ -713,28 +713,33 @@ var STORES_PRODUCT_SALE_RULE = { appProductId: (id) => id, productType: "NON_CON
|
|
|
713
713
|
var ONLINE_PROGRAM_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
|
|
714
714
|
var PRICING_PLAN_APPLE_SALES_ENABLED = true;
|
|
715
715
|
var PRICING_PLAN_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
|
|
716
|
+
var VIDEOS_APPLE_SALES_ENABLED = false;
|
|
717
|
+
var VIDEO_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
|
|
716
718
|
function appleSaleRules(options = {}) {
|
|
717
719
|
return {
|
|
718
720
|
onlineProgram: ONLINE_PROGRAM_SALE_RULE,
|
|
719
721
|
...(options.storesAppleSalesEnabled ?? STORES_APPLE_SALES_ENABLED) || (options.storesItemPaymentEnabled ?? STORES_ITEM_PAYMENT_ENABLED) ? { storesProduct: STORES_PRODUCT_SALE_RULE } : {},
|
|
720
722
|
...options.pricingPlanAppleSalesEnabled ?? PRICING_PLAN_APPLE_SALES_ENABLED ? { pricingPlan: PRICING_PLAN_SALE_RULE } : {},
|
|
721
723
|
...options.bookingsAppleSalesEnabled ?? BOOKINGS_APPLE_SALES_ENABLED ? { bookingsService: ATTENDANCE_SALE_RULE } : {},
|
|
722
|
-
...options.eventsAppleSalesEnabled ?? EVENTS_APPLE_SALES_ENABLED ? { eventsTicket: ATTENDANCE_SALE_RULE } : {}
|
|
724
|
+
...options.eventsAppleSalesEnabled ?? EVENTS_APPLE_SALES_ENABLED ? { eventsTicket: ATTENDANCE_SALE_RULE } : {},
|
|
725
|
+
...options.videosAppleSalesEnabled ?? VIDEOS_APPLE_SALES_ENABLED ? { wixVideo: VIDEO_SALE_RULE } : {}
|
|
723
726
|
};
|
|
724
727
|
}
|
|
725
728
|
var APPLE_SALE_RULES = appleSaleRules();
|
|
726
729
|
var APPLE_PROVISIONING_RULES = {
|
|
727
730
|
...APPLE_SALE_RULES,
|
|
728
731
|
bookingsService: ATTENDANCE_SALE_RULE,
|
|
729
|
-
eventsTicket: ATTENDANCE_SALE_RULE
|
|
732
|
+
eventsTicket: ATTENDANCE_SALE_RULE,
|
|
733
|
+
wixVideo: VIDEO_SALE_RULE
|
|
730
734
|
};
|
|
735
|
+
var APPLE_PRICING_RULES = { ...APPLE_SALE_RULES, wixVideo: VIDEO_SALE_RULE };
|
|
731
736
|
|
|
732
737
|
// ../../core/sdk/iap/src/mapping-source.ts
|
|
733
738
|
function iapMappingSource() {
|
|
734
739
|
return createWixIapMappingSource({ binding: sharedHostAppBindingSource(), call: hostWixCall });
|
|
735
740
|
}
|
|
736
741
|
function createWixIapMappingSource(deps) {
|
|
737
|
-
const rules = deps.rules ??
|
|
742
|
+
const rules = deps.rules ?? APPLE_PRICING_RULES;
|
|
738
743
|
const appProductIdOf = (reference) => reference.id ? rules[reference.kind]?.appProductId(reference.id) : void 0;
|
|
739
744
|
return {
|
|
740
745
|
// Only a binding the host actually returned: a read that failed is re-asked on the next load.
|
|
@@ -3611,6 +3616,21 @@ function creationRefused(refusal) {
|
|
|
3611
3616
|
function notCreated(attempt3) {
|
|
3612
3617
|
return { ...attempt3, noOrderCreated: true };
|
|
3613
3618
|
}
|
|
3619
|
+
|
|
3620
|
+
// ../../stdlib/flows/iap-checkout/src/iap-verticals/videos.ts
|
|
3621
|
+
var KIND4 = "wixVideo";
|
|
3622
|
+
var NOT_ENABLED2 = { status: "refused", reason: "notEnabled" };
|
|
3623
|
+
var NO_ORDER_STEP = { status: "refused", reason: "notConfigured" };
|
|
3624
|
+
function videoOrdersWith(options) {
|
|
3625
|
+
return {
|
|
3626
|
+
kind: KIND4,
|
|
3627
|
+
eligibility: (item) => options.enabled ? singleUnitOf(KIND4, item) : { eligible: false, reason: "notEnabled" },
|
|
3628
|
+
openOrder: async () => options.enabled ? NO_ORDER_STEP : NOT_ENABLED2,
|
|
3629
|
+
reopenOrder: async () => ORDER_CLOSED,
|
|
3630
|
+
readAccess: async () => "unavailable"
|
|
3631
|
+
};
|
|
3632
|
+
}
|
|
3633
|
+
var wixVideoOrders = /* @__PURE__ */ videoOrdersWith({ enabled: VIDEOS_APPLE_SALES_ENABLED });
|
|
3614
3634
|
export {
|
|
3615
3635
|
bookingOrders,
|
|
3616
3636
|
classifyCart,
|
|
@@ -3623,6 +3643,7 @@ export {
|
|
|
3623
3643
|
onlineProgramOrders,
|
|
3624
3644
|
pricingPlanOrders,
|
|
3625
3645
|
storesAppleSalesEnabled,
|
|
3626
|
-
storesProductOrders
|
|
3646
|
+
storesProductOrders,
|
|
3647
|
+
wixVideoOrders
|
|
3627
3648
|
};
|
|
3628
3649
|
//# sourceMappingURL=iap-checkout.mjs.map
|
|
@@ -660,7 +660,7 @@ var nonempty = (value) => typeof value === "string" && value.trim().length > 0;
|
|
|
660
660
|
var sameReference = (value, reference) => isObject2(value) && value.kind === reference.kind && value.id === reference.id;
|
|
661
661
|
|
|
662
662
|
// ../../core/sdk/iap/src/catalog-pricing-contract.ts
|
|
663
|
-
var IAP_CATALOG_KINDS = ["onlineProgram", "storesProduct", "pricingPlan", "bookingsService", "eventsTicket"];
|
|
663
|
+
var IAP_CATALOG_KINDS = ["onlineProgram", "storesProduct", "pricingPlan", "bookingsService", "eventsTicket", "wixVideo"];
|
|
664
664
|
|
|
665
665
|
// ../../core/sdk/iap/src/wix-payments-contract.ts
|
|
666
666
|
var HIMALAYA_SERVE_IAP_ROUTE = { prefix: "/himalaya-serve/v1/iap" };
|
|
@@ -673,28 +673,33 @@ var STORES_PRODUCT_SALE_RULE = { appProductId: (id) => id, productType: "NON_CON
|
|
|
673
673
|
var ONLINE_PROGRAM_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
|
|
674
674
|
var PRICING_PLAN_APPLE_SALES_ENABLED = true;
|
|
675
675
|
var PRICING_PLAN_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
|
|
676
|
+
var VIDEOS_APPLE_SALES_ENABLED = false;
|
|
677
|
+
var VIDEO_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
|
|
676
678
|
function appleSaleRules(options = {}) {
|
|
677
679
|
return {
|
|
678
680
|
onlineProgram: ONLINE_PROGRAM_SALE_RULE,
|
|
679
681
|
...(options.storesAppleSalesEnabled ?? STORES_APPLE_SALES_ENABLED) || (options.storesItemPaymentEnabled ?? STORES_ITEM_PAYMENT_ENABLED) ? { storesProduct: STORES_PRODUCT_SALE_RULE } : {},
|
|
680
682
|
...options.pricingPlanAppleSalesEnabled ?? PRICING_PLAN_APPLE_SALES_ENABLED ? { pricingPlan: PRICING_PLAN_SALE_RULE } : {},
|
|
681
683
|
...options.bookingsAppleSalesEnabled ?? BOOKINGS_APPLE_SALES_ENABLED ? { bookingsService: ATTENDANCE_SALE_RULE } : {},
|
|
682
|
-
...options.eventsAppleSalesEnabled ?? EVENTS_APPLE_SALES_ENABLED ? { eventsTicket: ATTENDANCE_SALE_RULE } : {}
|
|
684
|
+
...options.eventsAppleSalesEnabled ?? EVENTS_APPLE_SALES_ENABLED ? { eventsTicket: ATTENDANCE_SALE_RULE } : {},
|
|
685
|
+
...options.videosAppleSalesEnabled ?? VIDEOS_APPLE_SALES_ENABLED ? { wixVideo: VIDEO_SALE_RULE } : {}
|
|
683
686
|
};
|
|
684
687
|
}
|
|
685
688
|
var APPLE_SALE_RULES = appleSaleRules();
|
|
686
689
|
var APPLE_PROVISIONING_RULES = {
|
|
687
690
|
...APPLE_SALE_RULES,
|
|
688
691
|
bookingsService: ATTENDANCE_SALE_RULE,
|
|
689
|
-
eventsTicket: ATTENDANCE_SALE_RULE
|
|
692
|
+
eventsTicket: ATTENDANCE_SALE_RULE,
|
|
693
|
+
wixVideo: VIDEO_SALE_RULE
|
|
690
694
|
};
|
|
695
|
+
var APPLE_PRICING_RULES = { ...APPLE_SALE_RULES, wixVideo: VIDEO_SALE_RULE };
|
|
691
696
|
|
|
692
697
|
// ../../core/sdk/iap/src/mapping-source.ts
|
|
693
698
|
function iapMappingSource() {
|
|
694
699
|
return createWixIapMappingSource({ binding: sharedHostAppBindingSource(), call: hostWixCall });
|
|
695
700
|
}
|
|
696
701
|
function createWixIapMappingSource(deps) {
|
|
697
|
-
const rules = deps.rules ??
|
|
702
|
+
const rules = deps.rules ?? APPLE_PRICING_RULES;
|
|
698
703
|
const appProductIdOf = (reference) => reference.id ? rules[reference.kind]?.appProductId(reference.id) : void 0;
|
|
699
704
|
return {
|
|
700
705
|
// Only a binding the host actually returned: a read that failed is re-asked on the next load.
|
|
@@ -960,6 +965,18 @@ function onlineProgramItem(program, commerceDisplayPrice) {
|
|
|
960
965
|
return { reference: { kind: ONLINE_PROGRAM, id }, ...commerceDisplayPrice ? { commerceDisplayPrice } : {} };
|
|
961
966
|
}
|
|
962
967
|
|
|
968
|
+
// ../../core/sdk/iap/src/catalog-adapters/wix-video.ts
|
|
969
|
+
var WIX_VIDEO = "wixVideo";
|
|
970
|
+
function wixVideoItem(channel, video, commerceDisplayPrice) {
|
|
971
|
+
const id = video.id;
|
|
972
|
+
if (typeof id !== "string" || !id.trim()) return void 0;
|
|
973
|
+
if (!Array.isArray(channel.pricing) || !Array.isArray(video.pricing)) return void 0;
|
|
974
|
+
if (channel.pricing.some((p) => p.enabled && (p.required || p.type === "PRICING_PLAN"))) return void 0;
|
|
975
|
+
const sold = video.pricing.some((p) => p.enabled && p.type === "SALE" && typeof p.price === "number" && Number.isFinite(p.price) && p.price > 0);
|
|
976
|
+
if (!sold) return void 0;
|
|
977
|
+
return { reference: { kind: WIX_VIDEO, id }, ...commerceDisplayPrice ? { commerceDisplayPrice } : {} };
|
|
978
|
+
}
|
|
979
|
+
|
|
963
980
|
// ../../core/sdk/iap/src/host-session.ts
|
|
964
981
|
var SIGNED_OUT = {
|
|
965
982
|
generation: 0,
|
|
@@ -1630,6 +1647,7 @@ function decodeTransaction(value) {
|
|
|
1630
1647
|
return { store, signedTransaction, transactionId, originalTransactionId, productId, appAccountToken, environment };
|
|
1631
1648
|
}
|
|
1632
1649
|
export {
|
|
1650
|
+
APPLE_PRICING_RULES,
|
|
1633
1651
|
APPLE_PROVISIONING_RULES,
|
|
1634
1652
|
APPLE_SALE_RULES,
|
|
1635
1653
|
BOOKINGS_APPLE_SALES_ENABLED,
|
|
@@ -1642,6 +1660,7 @@ export {
|
|
|
1642
1660
|
STORES_APPLE_SALES_ENABLED,
|
|
1643
1661
|
STORES_ITEM_PAYMENT_ENABLED,
|
|
1644
1662
|
STORES_PRODUCT_SALE_RULE,
|
|
1663
|
+
VIDEOS_APPLE_SALES_ENABLED,
|
|
1645
1664
|
appleManagedStore,
|
|
1646
1665
|
appleSaleRules,
|
|
1647
1666
|
attendanceCheckoutRoute,
|
|
@@ -1670,6 +1689,7 @@ export {
|
|
|
1670
1689
|
restore,
|
|
1671
1690
|
sharedHostAppBindingSource,
|
|
1672
1691
|
ticketAttendanceOf,
|
|
1673
|
-
version
|
|
1692
|
+
version,
|
|
1693
|
+
wixVideoItem
|
|
1674
1694
|
};
|
|
1675
1695
|
//# sourceMappingURL=iap.mjs.map
|
|
@@ -2235,28 +2235,33 @@ var STORES_PRODUCT_SALE_RULE = { appProductId: (id2) => id2, productType: "NON_C
|
|
|
2235
2235
|
var ONLINE_PROGRAM_SALE_RULE = { appProductId: (id2) => id2, productType: "NON_CONSUMABLE" };
|
|
2236
2236
|
var PRICING_PLAN_APPLE_SALES_ENABLED = true;
|
|
2237
2237
|
var PRICING_PLAN_SALE_RULE = { appProductId: (id2) => id2, productType: "NON_CONSUMABLE" };
|
|
2238
|
+
var VIDEOS_APPLE_SALES_ENABLED = false;
|
|
2239
|
+
var VIDEO_SALE_RULE = { appProductId: (id2) => id2, productType: "NON_CONSUMABLE" };
|
|
2238
2240
|
function appleSaleRules(options = {}) {
|
|
2239
2241
|
return {
|
|
2240
2242
|
onlineProgram: ONLINE_PROGRAM_SALE_RULE,
|
|
2241
2243
|
...(options.storesAppleSalesEnabled ?? STORES_APPLE_SALES_ENABLED) || (options.storesItemPaymentEnabled ?? STORES_ITEM_PAYMENT_ENABLED) ? { storesProduct: STORES_PRODUCT_SALE_RULE } : {},
|
|
2242
2244
|
...options.pricingPlanAppleSalesEnabled ?? PRICING_PLAN_APPLE_SALES_ENABLED ? { pricingPlan: PRICING_PLAN_SALE_RULE } : {},
|
|
2243
2245
|
...options.bookingsAppleSalesEnabled ?? BOOKINGS_APPLE_SALES_ENABLED ? { bookingsService: ATTENDANCE_SALE_RULE } : {},
|
|
2244
|
-
...options.eventsAppleSalesEnabled ?? EVENTS_APPLE_SALES_ENABLED ? { eventsTicket: ATTENDANCE_SALE_RULE } : {}
|
|
2246
|
+
...options.eventsAppleSalesEnabled ?? EVENTS_APPLE_SALES_ENABLED ? { eventsTicket: ATTENDANCE_SALE_RULE } : {},
|
|
2247
|
+
...options.videosAppleSalesEnabled ?? VIDEOS_APPLE_SALES_ENABLED ? { wixVideo: VIDEO_SALE_RULE } : {}
|
|
2245
2248
|
};
|
|
2246
2249
|
}
|
|
2247
2250
|
var APPLE_SALE_RULES = appleSaleRules();
|
|
2248
2251
|
var APPLE_PROVISIONING_RULES = {
|
|
2249
2252
|
...APPLE_SALE_RULES,
|
|
2250
2253
|
bookingsService: ATTENDANCE_SALE_RULE,
|
|
2251
|
-
eventsTicket: ATTENDANCE_SALE_RULE
|
|
2254
|
+
eventsTicket: ATTENDANCE_SALE_RULE,
|
|
2255
|
+
wixVideo: VIDEO_SALE_RULE
|
|
2252
2256
|
};
|
|
2257
|
+
var APPLE_PRICING_RULES = { ...APPLE_SALE_RULES, wixVideo: VIDEO_SALE_RULE };
|
|
2253
2258
|
|
|
2254
2259
|
// ../../core/sdk/iap/src/mapping-source.ts
|
|
2255
2260
|
function iapMappingSource() {
|
|
2256
2261
|
return createWixIapMappingSource({ binding: sharedHostAppBindingSource(), call: hostWixCall });
|
|
2257
2262
|
}
|
|
2258
2263
|
function createWixIapMappingSource(deps) {
|
|
2259
|
-
const rules = deps.rules ??
|
|
2264
|
+
const rules = deps.rules ?? APPLE_PRICING_RULES;
|
|
2260
2265
|
const appProductIdOf = (reference) => reference.id ? rules[reference.kind]?.appProductId(reference.id) : void 0;
|
|
2261
2266
|
return {
|
|
2262
2267
|
// Only a binding the host actually returned: a read that failed is re-asked on the next load.
|
|
@@ -117,15 +117,133 @@ function getCurrentJoinApplication(programId) {
|
|
|
117
117
|
function listProgramCategories() {
|
|
118
118
|
return wixCall("GET", "/_api/program-categories-service/v3/categories");
|
|
119
119
|
}
|
|
120
|
+
var WITHDRAWN_ENROLLMENTS = /* @__PURE__ */ new Set(["LEFT", "REMOVED", "AUTO_REMOVED"]);
|
|
121
|
+
async function listMyParticipations(memberId, opts = {}) {
|
|
122
|
+
if (!memberId) throw new Error("listMyParticipations: memberId is required");
|
|
123
|
+
const maxPages = Math.max(1, Math.floor(opts.maxPages ?? 10));
|
|
124
|
+
const out = [];
|
|
125
|
+
let cursor;
|
|
126
|
+
for (let page = 0; page < maxPages; page++) {
|
|
127
|
+
const response = await queryMemberParticipants(cursor ? { memberId, cursor } : { memberId });
|
|
128
|
+
out.push(...response.participants ?? []);
|
|
129
|
+
if (response.pagingMetadata?.hasNext === false) break;
|
|
130
|
+
cursor = response.pagingMetadata?.cursors?.next || void 0;
|
|
131
|
+
if (!cursor) break;
|
|
132
|
+
}
|
|
133
|
+
return out;
|
|
134
|
+
}
|
|
135
|
+
function participationsByProgram(participants) {
|
|
136
|
+
const byProgram = /* @__PURE__ */ new Map();
|
|
137
|
+
for (const participant of participants) {
|
|
138
|
+
const programId = participant.programId;
|
|
139
|
+
if (!programId) continue;
|
|
140
|
+
const current = byProgram.get(programId);
|
|
141
|
+
if (!current || compareIsoDesc(participant.createdDate, current.createdDate) < 0) byProgram.set(programId, participant);
|
|
142
|
+
}
|
|
143
|
+
for (const [programId, participant] of byProgram) {
|
|
144
|
+
if (WITHDRAWN_ENROLLMENTS.has(String(participant.enrollmentStatus ?? "").toUpperCase())) byProgram.delete(programId);
|
|
145
|
+
}
|
|
146
|
+
return byProgram;
|
|
147
|
+
}
|
|
148
|
+
var PENDING_JOIN_APPLICATION_STATUSES = Object.freeze([
|
|
149
|
+
"INVITED",
|
|
150
|
+
"APPROVAL_PENDING",
|
|
151
|
+
"APPROVED",
|
|
152
|
+
"SUSPENDED"
|
|
153
|
+
]);
|
|
154
|
+
var JOIN_APPLICATIONS_PAGE_LIMIT = 100;
|
|
155
|
+
function queryJoinApplications(query) {
|
|
156
|
+
if (!query.memberId) throw new Error("queryJoinApplications: memberId is required");
|
|
157
|
+
const programIds = query.programIds === void 0 ? void 0 : Array.from(new Set(query.programIds.filter(Boolean)));
|
|
158
|
+
if (programIds?.length === 0) return Promise.resolve({ joinApplications: [] });
|
|
159
|
+
const limit = clampPageLimit(query.limit, JOIN_APPLICATIONS_PAGE_LIMIT);
|
|
160
|
+
if (query.cursor) {
|
|
161
|
+
return wixCall("POST", "/online-programs/participants/v3/join-applications/query", {
|
|
162
|
+
query: { cursorPaging: { limit, cursor: query.cursor } }
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
const statuses = (query.statuses ?? PENDING_JOIN_APPLICATION_STATUSES).slice();
|
|
166
|
+
return wixCall("POST", "/online-programs/participants/v3/join-applications/query", {
|
|
167
|
+
query: {
|
|
168
|
+
filter: {
|
|
169
|
+
memberId: { $eq: query.memberId },
|
|
170
|
+
...programIds ? { programId: { $in: programIds } } : {},
|
|
171
|
+
status: { $in: statuses }
|
|
172
|
+
},
|
|
173
|
+
sort: [{ fieldName: "createdDate", order: "DESC" }],
|
|
174
|
+
cursorPaging: { limit }
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
async function listJoinApplications(query, opts = {}) {
|
|
179
|
+
const maxPages = Math.max(1, Math.floor(opts.maxPages ?? 5));
|
|
180
|
+
const out = [];
|
|
181
|
+
let cursor;
|
|
182
|
+
for (let page = 0; page < maxPages; page++) {
|
|
183
|
+
const response = await queryJoinApplications(cursor ? { ...query, cursor } : query);
|
|
184
|
+
out.push(...response.joinApplications ?? []);
|
|
185
|
+
if (response.pagingMetadata?.hasNext === false) break;
|
|
186
|
+
cursor = response.pagingMetadata?.cursors?.next || void 0;
|
|
187
|
+
if (!cursor) break;
|
|
188
|
+
}
|
|
189
|
+
return out;
|
|
190
|
+
}
|
|
191
|
+
function cancelJoinApplication(joinApplicationId) {
|
|
192
|
+
if (!joinApplicationId) throw new Error("cancelJoinApplication: joinApplicationId is required");
|
|
193
|
+
return wixCall(
|
|
194
|
+
"POST",
|
|
195
|
+
`/online-programs/participants/v3/join-applications/${encodeURIComponent(joinApplicationId)}/cancel`,
|
|
196
|
+
{}
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
function participantsShownByProgram(response) {
|
|
200
|
+
const out = /* @__PURE__ */ new Map();
|
|
201
|
+
for (const row of response.participationStats ?? []) {
|
|
202
|
+
if (!row.programId) continue;
|
|
203
|
+
out.set(row.programId, (row.participantsCount ?? 0) + (row.autoRemovedCount ?? 0));
|
|
204
|
+
}
|
|
205
|
+
return out;
|
|
206
|
+
}
|
|
207
|
+
function getPremiumStats() {
|
|
208
|
+
return wixCall("GET", "/online-programs/participants/v3/stats/premium");
|
|
209
|
+
}
|
|
210
|
+
function isParticipationBlocked(stats) {
|
|
211
|
+
if (!stats || stats.premiumEnabled) return false;
|
|
212
|
+
const count = stats.activeParticipantsCount ?? 0;
|
|
213
|
+
const limit = stats.activeParticipantsLimit;
|
|
214
|
+
return typeof limit === "number" && count > limit;
|
|
215
|
+
}
|
|
216
|
+
function clampPageLimit(limit, max) {
|
|
217
|
+
const n = Math.floor(limit ?? max);
|
|
218
|
+
if (!Number.isFinite(n) || n < 1) return 1;
|
|
219
|
+
return Math.min(max, n);
|
|
220
|
+
}
|
|
221
|
+
function compareIsoDesc(a, b) {
|
|
222
|
+
const ta = a ? Date.parse(a) : NaN;
|
|
223
|
+
const tb = b ? Date.parse(b) : NaN;
|
|
224
|
+
if (Number.isNaN(ta) && Number.isNaN(tb)) return 0;
|
|
225
|
+
if (Number.isNaN(ta)) return 1;
|
|
226
|
+
if (Number.isNaN(tb)) return -1;
|
|
227
|
+
return tb - ta;
|
|
228
|
+
}
|
|
120
229
|
export {
|
|
121
230
|
MEMBER_ENROLLMENT_STATUSES,
|
|
122
231
|
MEMBER_FINISHED_PROGRESS_STATUSES,
|
|
232
|
+
PENDING_JOIN_APPLICATION_STATUSES,
|
|
233
|
+
cancelJoinApplication,
|
|
123
234
|
getCurrentJoinApplication,
|
|
124
235
|
getParticipationStats,
|
|
236
|
+
getPremiumStats,
|
|
125
237
|
getProgram,
|
|
238
|
+
isParticipationBlocked,
|
|
126
239
|
joinProgram,
|
|
240
|
+
listJoinApplications,
|
|
241
|
+
listMyParticipations,
|
|
127
242
|
listProgramCategories,
|
|
243
|
+
participantsShownByProgram,
|
|
244
|
+
participationsByProgram,
|
|
128
245
|
payableIdOf,
|
|
246
|
+
queryJoinApplications,
|
|
129
247
|
queryMemberParticipants,
|
|
130
248
|
queryParticipants,
|
|
131
249
|
queryPrograms,
|