@wix/redirects 1.0.49 → 1.0.50

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/redirects",
3
- "version": "1.0.49",
3
+ "version": "1.0.50",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -18,10 +18,9 @@
18
18
  "type-bundles"
19
19
  ],
20
20
  "dependencies": {
21
- "@wix/redirects_redirects": "1.0.19"
21
+ "@wix/redirects_redirects": "1.0.20"
22
22
  },
23
23
  "devDependencies": {
24
- "@wix/sdk": "https://cdn.dev.wixpress.com/@wix/sdk/02e8069ab2fd783e0e6a080fc7d590e76cb26ab93c8389574286305b.tar.gz",
25
24
  "glob": "^10.4.1",
26
25
  "rollup": "^4.18.0",
27
26
  "rollup-plugin-dts": "^6.1.1",
@@ -43,5 +42,5 @@
43
42
  "fqdn": ""
44
43
  }
45
44
  },
46
- "falconPackageHash": "325b79f215dc88084bbdd4a81eb81c93bbea50822d77f7bcfd865b08"
45
+ "falconPackageHash": "1ccc9a9ddd03c35b832b522d21ba8a105700a099ec9353232a199a1a"
47
46
  }
@@ -1,491 +1,8 @@
1
- /** Information for redirecting a visitor from an external Wix Headless client site to a Wix page for Wix-managed functionality. */
2
- interface RedirectSession {
3
- /** ID of the redirect session created. */
4
- _id?: string;
5
- /**
6
- * The full URL of the Wix page to redirect the visitor to. This URL includes query parameters informing Wix where to redirect the visitor back to on the Wix Headless client site.
7
- * @readonly
8
- */
9
- fullUrl?: string;
10
- /** Details about the URL of the RedirectSession */
11
- urlDetails?: URLDetails;
12
- /**
13
- * The session token to pass to the Wix page to maintain the visitor's identity.
14
- * @readonly
15
- */
16
- sessionToken?: string | null;
17
- /**
18
- * The short URL of the Wix page to redirect the visitor to. This URL includes query parameters informing Wix where to redirect the visitor back to on the Wix Headless client site.
19
- * @readonly
20
- */
21
- shortUrl?: string;
22
- }
23
- interface URLDetails {
24
- /**
25
- * The endpoint of the url (includes the base url and the path to the endpoint, without the query parameters)
26
- * For example: `https://mysite.com/_api/oauth2/authorize`
27
- * @readonly
28
- */
29
- endpoint?: string;
30
- /** The query parameters of the url */
31
- searchParams?: Record<string, string>;
32
- }
33
- /** @oneof */
34
- interface CreateRedirectSessionRequestIntentOneOf {
35
- /** Information required for generating a custom URL for a Wix Bookings checkout. */
36
- bookingsCheckout?: RedirectSessionBookingsCheckoutParams;
37
- /** Information required for generating a custom URL for a Wix eCommerce checkout. */
38
- ecomCheckout?: RedirectSessionEcomCheckoutParams;
39
- /** Information required for generating a custom URL for a Wix Events checkout. */
40
- eventsCheckout?: RedirectSessionEventsCheckoutParams;
41
- /** Information required for generating a custom URL for a Wix Paid Plans checkout. */
42
- paidPlansCheckout?: RedirectSessionPaidPlansCheckoutParams;
43
- /** Pass an empty object in this parameter to generate a URL for Wix login without first checking whether the visitor is authenticated. */
44
- login?: RedirectSessionLoginParams;
45
- /** Information required for generating a custom URL to log out from a Wix account. This process invalidates the visitor or member token and clears cookies associated with the Wix domain from their browser. */
46
- logout?: RedirectSessionLogoutParams;
47
- /** Information required for generating a custom URL for Wix authentication. */
48
- auth?: RedirectSessionAuthParams;
49
- /** Information required for generating a custom URL for a Wix stores product page. */
50
- storesProduct?: RedirectSessionStoresProductParams;
51
- /** Information required for generating a custom URL for Wix bookings book page. */
52
- bookingsBook?: RedirectSessionBookingsBookParams;
53
- }
54
- interface RedirectSessionBookingsCheckoutParams {
55
- /**
56
- * The timezone to use when presenting the selected slot to users, in [tz database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) format. For example, `America/Santiago`.
57
- *
58
- * Default: If you don't specify a timezone, the timezone in `slotAvailability.slot.timezone` is used.
59
- */
60
- timezone?: string;
61
- /** __Required.__ The calendar slot to check out. */
62
- slotAvailability?: SlotAvailability;
63
- }
64
- interface SlotAvailability {
65
- /**
66
- * The slot for the corresponding session, when the session is either a single session
67
- * or a specific session generated from a recurring session.
68
- */
69
- slot?: Slot;
70
- /**
71
- * Whether the slot is bookable. Bookability is determined by checking a
72
- * session's open slots and booking policies. Locks are not taken into
73
- * account.
74
- */
75
- bookable?: boolean;
76
- /**
77
- * Total number of spots for this slot.
78
- * For example, if a session has a total of 10 spots and 3 spots are booked,
79
- * `spotsTotal` is 10 and `openSpots` is 7.
80
- */
81
- totalSpots?: number | null;
82
- /** Number of open spots for this slot. */
83
- openSpots?: number | null;
84
- /** An object describing the slot's waitlist and its occupancy. */
85
- waitingList?: WaitingList;
86
- /** Booking policy violations for the slot. */
87
- bookingPolicyViolations?: BookingPolicyViolations;
88
- /**
89
- * Indicates whether the slot is locked because a waitlist exists.
90
- * When a slot frees up, the slot is offered to the next customer on the waitlist. Read-only.
91
- */
92
- locked?: boolean | null;
93
- isFromV2?: boolean;
94
- }
95
- interface Slot {
96
- /**
97
- * ID for the slot's corresponding session, when the session is either a single session
98
- * or a specific session generated from a recurring session.
99
- */
100
- sessionId?: string | null;
101
- /** Service ID. */
102
- serviceId?: string;
103
- /** Schedule ID. */
104
- scheduleId?: string;
105
- /**
106
- * The start time of this slot in [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339)
107
- * format.
108
- *
109
- * If `timezone` is specified,
110
- * dates are based on the local date/time. This means that the timezone offset
111
- * in the `startDate` is ignored.
112
- */
113
- startDate?: string | null;
114
- /**
115
- * The end time of this slot in
116
- * [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339) format.
117
- *
118
- * If `timezone` is specified,
119
- * dates are based on the local date/time. This means that the timezone offset
120
- * in the `endDate` is ignored.
121
- */
122
- endDate?: string | null;
123
- /**
124
- * The timezone for which slot availability is to be calculated.
125
- *
126
- * Learn more about [handling Daylight Savings Time (DST) for local time zones](https://dev.wix.com/api/sdk/bookings/availabilitycalendar/queryavailability#bookings_availabilitycalendar_queryavailability_handling-daylight-savings-time-dst-for-local-time-zones)
127
- * when calculating availability.
128
- */
129
- timezone?: string | null;
130
- /**
131
- * The resource required for this slot. Currently, the only supported resource
132
- * is the relevant staff member for the slot.
133
- */
134
- resource?: SlotResource;
135
- /** Geographic location of the slot. */
136
- location?: Location;
137
- }
138
- interface SlotResource {
139
- /**
140
- * Resource ID.
141
- * @readonly
142
- */
143
- _id?: string | null;
144
- /** Resource name. Read only. */
145
- name?: string | null;
146
- }
147
- interface Location {
148
- /**
149
- * Business location ID. Available only for locations that are business locations,
150
- * meaning the `location_type` is `"OWNER_BUSINESS"`.
151
- */
152
- _id?: string | null;
153
- /** Location name. */
154
- name?: string | null;
155
- /** The full address of this location. */
156
- formattedAddress?: string | null;
157
- /**
158
- * Location type.
159
- *
160
- * - `"OWNER_BUSINESS"`: The business address, as set in the site’s general settings.
161
- * - `"OWNER_CUSTOM"`: The address as set when creating the service.
162
- * - `"CUSTOM"`: The address as set for the individual session.
163
- */
164
- locationType?: LocationType;
165
- }
166
- declare enum LocationType {
167
- UNDEFINED = "UNDEFINED",
168
- OWNER_BUSINESS = "OWNER_BUSINESS",
169
- OWNER_CUSTOM = "OWNER_CUSTOM",
170
- CUSTOM = "CUSTOM"
171
- }
172
- interface WaitingList {
173
- /**
174
- * Total number of spots and open spots for this waitlist.
175
- * For example, a Yoga class with 10 waitlist spots and 3 registered
176
- * on the waitlist has 10 `total_spots` and 7 `open_spots`.
177
- */
178
- totalSpots?: number | null;
179
- /** Number of open spots for this waitlist. */
180
- openSpots?: number | null;
181
- }
182
- interface BookingPolicyViolations {
183
- /** Bookings policy violation. Too early to book this slot. */
184
- tooEarlyToBook?: boolean | null;
185
- /** Bookings policy violation. Too late to book this slot. */
186
- tooLateToBook?: boolean | null;
187
- /** Bookings policy violation. Online booking is disabled for this slot. */
188
- bookOnlineDisabled?: boolean | null;
189
- }
190
- interface RedirectSessionEcomCheckoutParams {
191
- /** __Required.__ ID of the checkout to process. Use [`createCheckout()`](https://dev.wix.com/api/sdk/ecom/checkout/createcheckout) or [`createCheckoutFromCurrentCart()`](https://dev.wix.com/api/sdk/ecom/currentcart/createcheckoutfromcurrentcart) to create a checkout and obtain an ID. */
192
- checkoutId?: string;
193
- }
194
- interface RedirectSessionEventsCheckoutParams {
195
- /** __Required.__ ID of the temporary event reservation. Use [`createReservation()`](https://dev.wix.com/api/sdk/events/checkout/createreservation) to reserve a ticket temporarily and obtain a reservation ID. */
196
- reservationId?: string;
197
- /** __Required.__ URL-friendly event slug, generated from the event title of the event. For example, `my-event-4`. Use [`listEvents()`](https://dev.wix.com/api/sdk/events/wixevents/listevents) to obtain an event slug. */
198
- eventSlug?: string;
199
- }
200
- interface RedirectSessionPaidPlansCheckoutParams {
201
- /** __Required.__ ID of the paid plan selected. Use [`queryPublicPlans()`](https://dev.wix.com/api/sdk/pricing-plans/plans/querypublicplans) to obtain a paid plan ID. */
202
- planId?: string;
203
- /**
204
- * For use when pricing plan selection is part of a checkout flow, only if the paid plan selection page is implemented on an external Wix Headless client site.
205
- * In this case, a string is received by the external pricing plans page as a `checkoutData` query parameter. Pass this string back here when redirecting back to Wix for checkout.
206
- */
207
- checkoutData?: string | null;
208
- }
209
- interface RedirectSessionLoginParams {
210
- }
211
- interface RedirectSessionLogoutParams {
212
- /** __Required.__ ID of the OAuth app authorizing the client. */
213
- clientId?: string;
214
- }
215
- interface RedirectSessionAuthParams {
216
- /** __Required.__ The authorization request to send to the authorization server. */
217
- authRequest?: AuthorizeRequest;
218
- prompt?: Prompt;
219
- }
220
- /**
221
- * AuthorizeRequest is sent by the client to the authorization server to initiate
222
- * the authorization process.
223
- */
224
- interface AuthorizeRequest {
225
- /** ID of the Wix OAuth app requesting authorization. */
226
- clientId?: string;
227
- /**
228
- * Desired authorization [grant type](https://auth0.com/docs/authenticate/protocols/oauth#grant-types).
229
- *
230
- * Supported values:
231
- * + `code`: The endpoint returns an authorization code that can be used to obtain an access token.
232
- */
233
- responseType?: string;
234
- /** URI to redirect the browser to after authentication and authorization. The browser is redirected to this URI whether the authentication and authorization process is successful or not. */
235
- redirectUri?: string | null;
236
- /**
237
- * Desired scope of access. If this field is left empty, only an access token is granted.
238
- * To received a refresh token, pass `offline_access` as the value of this field.
239
- */
240
- scope?: string | null;
241
- /**
242
- * A value used to confirm the state of an application before and after it makes an authorization
243
- * request. If a value for this field is set in the request, it's added to the `redirectUri` when the browser
244
- * is redirected there.
245
- * Learn more about [using the state parameter](https://auth0.com/docs/secure/attack-protection/state-parameters).
246
- */
247
- state?: string;
248
- /**
249
- * esired response format.
250
- *
251
- * Supported values:
252
- * + `query`: The response parameters are encoded as query string parameters and added to the `redirectUri` when redirecting.
253
- * + `fragment`: The response parameters are encoded as URI fragment parameters and added to the `redirectUri` when redirecting.
254
- * + `web_message`: The response parameters are encoded as a JSON object and added to the body of a [web message response](https://datatracker.ietf.org/doc/html/draft-sakimura-oauth-wmrm-00).
255
- *
256
- * Default value: `query`
257
- */
258
- responseMode?: string | null;
259
- /**
260
- * Code challenge to use for PKCE verification.
261
- * This field is only used if `responseType` is set to `code`.
262
- */
263
- codeChallenge?: string | null;
264
- /**
265
- * Code challenge method to use for PKCE verification.
266
- * This field is only used if `responseType` is set to `code`.
267
- *
268
- * Supported values:
269
- * + `S256`: The code challenge is transformed using SHA-256 encyption.
270
- * + `S512`: The code challenge is transformed using SHA-512 encyption.
271
- */
272
- codeChallengeMethod?: string | null;
273
- /** Session token of the site visitor to authorize. */
274
- sessionToken?: string | null;
275
- }
276
- /** Currently only `none` and `login` are supported. */
277
- declare enum Prompt {
278
- login = "login",
279
- none = "none",
280
- consent = "consent",
281
- select_account = "select_account"
282
- }
283
- interface RedirectSessionStoresProductParams {
284
- /** *Required.** Slug of the product to navigate to. */
285
- productSlug?: string;
286
- }
287
- interface RedirectSessionBookingsBookParams {
288
- /** For use when filtering the bookings page by a specific resource. */
289
- resourceId?: string;
290
- }
291
- interface CallbackParams {
292
- /**
293
- * The URL for a custom thank you page implemented on a site outside of Wix. The visitor is directed to this page after the Wix-managed process is completed.
294
- * When redirecting to this URL, Wix passes different query parameters depending on the preceding transaction:
295
- *
296
- * After a pricing plans checkout:
297
- * + `planOrderId`: ID of a pricing plan order.
298
- *
299
- * After an eCommerce checkout:
300
- * + `orderId`: ID of an eCommerce order.
301
- *
302
- * After an Events checkout
303
- * + `orderNumber`: Unique order number for the transaction.
304
- * + `eventId`: ID of the event.
305
- *
306
- * If the process is abandoned or interrupted, the visitor is redirected to the URL specified in `postFlowUrl` instead.
307
- *
308
- * Default: If you don't pass a URL, the visitor is redirected to a Wix thank you page, and from there to the URL specified in `postFlowUrl`.
309
- */
310
- thankYouPageUrl?: string | null;
311
- /**
312
- * The URL Wix should redirect the visitor to when the Wix-managed process is completed, abandoned, or interrupted.
313
- *
314
- * **Note**: For an authentication redirect, don't pass a URL here. Instead, pass one in `options.auth.authRequest.redirectUri`.
315
- */
316
- postFlowUrl?: string | null;
317
- /**
318
- * The URL for a custom login page implemented outside of Wix.
319
- *
320
- * Default: If you don't pass a URL, a Wix login page is used.
321
- */
322
- loginUrl?: string | null;
323
- /**
324
- * The URL for a custom bookings services page implemented outside of Wix.
325
- *
326
- * Default: If you don't pass a URL, a Wix bookings services page is used.
327
- */
328
- bookingsServiceListUrl?: string | null;
329
- /**
330
- * The URL for a custom eCommerce cart page implemented outside of Wix.
331
- *
332
- * Default: If you don't pass a URL, a Wix cart page is used.
333
- */
334
- cartPageUrl?: string | null;
335
- /**
336
- * The URL for a custom pricing plans page implemented outside of Wix. When redirecting to this URL, Wix passes the following query parameters:
337
- * + `planIds`: IDs of the pricing plans on the custom page.
338
- * + `checkoutData`: Pass this string back in `options.paidPlansCheckout.checkoutData` when redirecting back to Wix for checkout.
339
- *
340
- * Default: If you don't pass a URL, a Wix pricing plans page is used.
341
- */
342
- planListUrl?: string | null;
343
- }
344
- interface RedirectSessionPreferences {
345
- /**
346
- * Whether to use a standard Wix template for Wix-managed pages the visitor is redirected to. Set to `false` only if your client site connects with a Wix site that has custom pages.
347
- *
348
- * Default: `true`
349
- */
350
- useGenericWixPages?: boolean | null;
351
- /**
352
- * Whether to maintain the identity used in the redirect to wix (not relevant for "logout" and "auth" intents), or to use a new visitor identity.
353
- *
354
- * Default: `true`
355
- */
356
- maintainIdentity?: boolean | null;
357
- /**
358
- * A map of additional query parameters to pass to the created Wix URL.
359
- * Global query parameters to be passed to Wix, for example campaign parameters (UTM params).
360
- */
361
- additionalQueryParameters?: Record<string, string>;
362
- }
363
- interface CreateRedirectSessionResponse {
364
- /** Details for redirecting the visitor to a Wix page. */
365
- redirectSession?: RedirectSession;
366
- }
367
- interface IdentificationData extends IdentificationDataIdOneOf {
368
- /** ID of a site visitor that has not logged in to the site. */
369
- anonymousVisitorId?: string;
370
- /** ID of a site visitor that has logged in to the site. */
371
- memberId?: string;
372
- /** ID of a Wix user (site owner, contributor, etc.). */
373
- wixUserId?: string;
374
- /** ID of an app. */
375
- appId?: string;
376
- /** @readonly */
377
- identityType?: WebhookIdentityType;
378
- }
379
- /** @oneof */
380
- interface IdentificationDataIdOneOf {
381
- /** ID of a site visitor that has not logged in to the site. */
382
- anonymousVisitorId?: string;
383
- /** ID of a site visitor that has logged in to the site. */
384
- memberId?: string;
385
- /** ID of a Wix user (site owner, contributor, etc.). */
386
- wixUserId?: string;
387
- /** ID of an app. */
388
- appId?: string;
389
- }
390
- declare enum WebhookIdentityType {
391
- UNKNOWN = "UNKNOWN",
392
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
393
- MEMBER = "MEMBER",
394
- WIX_USER = "WIX_USER",
395
- APP = "APP"
396
- }
397
- interface CreateRedirectSessionResponseNonNullableFields {
398
- redirectSession?: {
399
- _id: string;
400
- fullUrl: string;
401
- urlDetails?: {
402
- endpoint: string;
403
- };
404
- shortUrl: string;
405
- };
406
- }
407
- interface BaseEventMetadata {
408
- /** App instance ID. */
409
- instanceId?: string | null;
410
- /** Event type. */
411
- eventType?: string;
412
- /** The identification type and identity data. */
413
- identity?: IdentificationData;
414
- }
415
- interface EventMetadata extends BaseEventMetadata {
416
- /**
417
- * Unique event ID.
418
- * Allows clients to ignore duplicate webhooks.
419
- */
420
- _id?: string;
421
- /**
422
- * Assumes actions are also always typed to an entity_type
423
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
424
- */
425
- entityFqdn?: string;
426
- /**
427
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
428
- * This is although the created/updated/deleted notion is duplication of the oneof types
429
- * Example: created/updated/deleted/started/completed/email_opened
430
- */
431
- slug?: string;
432
- /** ID of the entity associated with the event. */
433
- entityId?: string;
434
- /** Event timestamp. */
435
- eventTime?: Date;
436
- /**
437
- * Whether the event was triggered as a result of a privacy regulation application
438
- * (for example, GDPR).
439
- */
440
- triggeredByAnonymizeRequest?: boolean | null;
441
- /** If present, indicates the action that triggered the event. */
442
- originatedFrom?: string | null;
443
- /**
444
- * A sequence number defining the order of updates to the underlying entity.
445
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
446
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
447
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
448
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
449
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
450
- */
451
- entityEventSequence?: string | null;
452
- }
453
- interface RedirectSessionCreatedEnvelope {
454
- entity: RedirectSession;
455
- metadata: EventMetadata;
456
- }
457
- interface CreateRedirectSessionOptions extends CreateRedirectSessionRequestIntentOneOf {
458
- /** Information required for generating a custom URL for a Wix Bookings checkout. */
459
- bookingsCheckout?: RedirectSessionBookingsCheckoutParams;
460
- /** Information required for generating a custom URL for a Wix eCommerce checkout. */
461
- ecomCheckout?: RedirectSessionEcomCheckoutParams;
462
- /** Information required for generating a custom URL for a Wix Events checkout. */
463
- eventsCheckout?: RedirectSessionEventsCheckoutParams;
464
- /** Information required for generating a custom URL for a Wix Paid Plans checkout. */
465
- paidPlansCheckout?: RedirectSessionPaidPlansCheckoutParams;
466
- /** Pass an empty object in this parameter to generate a URL for Wix login without first checking whether the visitor is authenticated. */
467
- login?: RedirectSessionLoginParams;
468
- /** Information required for generating a custom URL to log out from a Wix account. This process invalidates the visitor or member token and clears cookies associated with the Wix domain from their browser. */
469
- logout?: RedirectSessionLogoutParams;
470
- /** Information required for generating a custom URL for Wix authentication. */
471
- auth?: RedirectSessionAuthParams;
472
- /** Information required for generating a custom URL for a Wix stores product page. */
473
- storesProduct?: RedirectSessionStoresProductParams;
474
- /** Information required for generating a custom URL for Wix bookings book page. */
475
- bookingsBook?: RedirectSessionBookingsBookParams;
476
- /**
477
- * Details of pages to redirect the visitor back to on the Wix Headless client site.
478
- *
479
- * **Note**: For an authentication redirect, don't pass a post-flow URL here. Instead, pass one in `options.auth.authRequest.redirectUri`.
480
- */
481
- callbacks?: CallbackParams;
482
- /** Optional preferences for customizing redirection to Wix pages. */
483
- preferences?: RedirectSessionPreferences;
484
- }
485
-
486
1
  type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
487
2
  interface HttpClient {
488
3
  request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
4
+ fetchWithAuth: typeof fetch;
5
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
489
6
  }
490
7
  type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
491
8
  type HttpResponse<T = any> = {
@@ -511,18 +28,26 @@ type EventDefinition<Payload = unknown, Type extends string = string> = {
511
28
  __type: 'event-definition';
512
29
  type: Type;
513
30
  isDomainEvent?: boolean;
514
- transformations?: unknown;
31
+ transformations?: (envelope: unknown) => Payload;
515
32
  __payload: Payload;
516
33
  };
517
- declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, _transformations?: unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
34
+ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
518
35
  type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
519
36
  type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
520
37
 
521
- declare function createRedirectSession$1(httpClient: HttpClient): (options?: CreateRedirectSessionOptions) => Promise<CreateRedirectSessionResponse & CreateRedirectSessionResponseNonNullableFields>;
522
- declare const onRedirectSessionCreated$1: EventDefinition<RedirectSessionCreatedEnvelope, "wix.headless.v1.redirect_session_created">;
38
+ declare global {
39
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
40
+ interface SymbolConstructor {
41
+ readonly observable: symbol;
42
+ }
43
+ }
44
+
45
+ declare function createRESTModule<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
46
+
47
+ declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
523
48
 
524
- declare const createRedirectSession: BuildRESTFunction<typeof createRedirectSession$1>;
525
- declare const onRedirectSessionCreated: BuildEventDefinition<typeof onRedirectSessionCreated$1>;
49
+ declare const createRedirectSession: ReturnType<typeof createRESTModule<typeof publicCreateRedirectSession>>;
50
+ declare const onRedirectSessionCreated: ReturnType<typeof createEventModule<typeof publicOnRedirectSessionCreated>>;
526
51
 
527
52
  declare const context_createRedirectSession: typeof createRedirectSession;
528
53
  declare const context_onRedirectSessionCreated: typeof onRedirectSessionCreated;
@@ -689,6 +689,8 @@ interface CreateRedirectSessionOptions extends CreateRedirectSessionRequestInten
689
689
 
690
690
  interface HttpClient {
691
691
  request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
692
+ fetchWithAuth: typeof fetch;
693
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
692
694
  }
693
695
  type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
694
696
  type HttpResponse<T = any> = {
@@ -713,10 +715,17 @@ type EventDefinition<Payload = unknown, Type extends string = string> = {
713
715
  __type: 'event-definition';
714
716
  type: Type;
715
717
  isDomainEvent?: boolean;
716
- transformations?: unknown;
718
+ transformations?: (envelope: unknown) => Payload;
717
719
  __payload: Payload;
718
720
  };
719
- declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, _transformations?: unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
721
+ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
722
+
723
+ declare global {
724
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
725
+ interface SymbolConstructor {
726
+ readonly observable: symbol;
727
+ }
728
+ }
720
729
 
721
730
  declare const __metadata: {
722
731
  PACKAGE_NAME: string;