@wix/redirects 1.0.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/build/cjs/index.d.ts +1 -0
- package/build/cjs/index.js +24 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/src/headless-v1-redirect-session.http.d.ts +4 -0
- package/build/cjs/src/headless-v1-redirect-session.http.js +49 -0
- package/build/cjs/src/headless-v1-redirect-session.http.js.map +1 -0
- package/build/cjs/src/headless-v1-redirect-session.public.d.ts +8 -0
- package/build/cjs/src/headless-v1-redirect-session.public.js +15 -0
- package/build/cjs/src/headless-v1-redirect-session.public.js.map +1 -0
- package/build/cjs/src/headless-v1-redirect-session.types.d.ts +312 -0
- package/build/cjs/src/headless-v1-redirect-session.types.js +22 -0
- package/build/cjs/src/headless-v1-redirect-session.types.js.map +1 -0
- package/build/cjs/src/headless-v1-redirect-session.universal.d.ts +345 -0
- package/build/cjs/src/headless-v1-redirect-session.universal.js +129 -0
- package/build/cjs/src/headless-v1-redirect-session.universal.js.map +1 -0
- package/build/es/index.d.ts +1 -0
- package/build/es/index.js +2 -0
- package/build/es/index.js.map +1 -0
- package/build/es/src/headless-v1-redirect-session.http.d.ts +4 -0
- package/build/es/src/headless-v1-redirect-session.http.js +45 -0
- package/build/es/src/headless-v1-redirect-session.http.js.map +1 -0
- package/build/es/src/headless-v1-redirect-session.public.d.ts +8 -0
- package/build/es/src/headless-v1-redirect-session.public.js +9 -0
- package/build/es/src/headless-v1-redirect-session.public.js.map +1 -0
- package/build/es/src/headless-v1-redirect-session.types.d.ts +312 -0
- package/build/es/src/headless-v1-redirect-session.types.js +19 -0
- package/build/es/src/headless-v1-redirect-session.types.js.map +1 -0
- package/build/es/src/headless-v1-redirect-session.universal.d.ts +345 -0
- package/build/es/src/headless-v1-redirect-session.universal.js +106 -0
- package/build/es/src/headless-v1-redirect-session.universal.js.map +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
export declare const __debug: {
|
|
2
|
+
verboseLogging: {
|
|
3
|
+
on: () => boolean;
|
|
4
|
+
off: () => boolean;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
/** WixUrl is the main entity of WixUrlService that can be used for lorem ipsum dolor */
|
|
8
|
+
export interface RedirectSession {
|
|
9
|
+
/** A guid representing the redirect session (for future use) */
|
|
10
|
+
_id?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The Wix URL to redirect into
|
|
13
|
+
* @readonly
|
|
14
|
+
*/
|
|
15
|
+
fullUrl?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface CreateRedirectSessionRequest extends CreateRedirectSessionRequestIntentOneOf {
|
|
18
|
+
/** The parameters used in order to generate the URL into the Bookings checkout flow */
|
|
19
|
+
bookingsCheckout?: RedirectSessionBookingsCheckoutParams;
|
|
20
|
+
/** The parameters used in order to generate the URL into the Ecom checkout flow */
|
|
21
|
+
ecomCheckout?: RedirectSessionEcomCheckoutParams;
|
|
22
|
+
/** The parameters used in order to generate the URL into the events checkout flow */
|
|
23
|
+
eventsCheckout?: RedirectSessionEventsCheckoutParams;
|
|
24
|
+
/** The parameters used in order to generate the URL into the paid plans checkout flow */
|
|
25
|
+
paidPlansCheckout?: RedirectSessionPaidPlansCheckoutParams;
|
|
26
|
+
/** The parameters used in order to generate the URL into the Wix login page */
|
|
27
|
+
login?: RedirectSessionLoginParams;
|
|
28
|
+
/** The parameters used in order to generate the URL to logout from Wix (invalidate token and clear cookies on wix domain) */
|
|
29
|
+
logout?: RedirectSessionLogoutParams;
|
|
30
|
+
/** The parameters used in order to generate the URL into the authorize page */
|
|
31
|
+
auth?: RedirectSessionAuthParams;
|
|
32
|
+
/** The callbacks (URL) allowing the definition of the pages which should be redirected back to the original site during the flow initiated in Wix */
|
|
33
|
+
callbacks?: CallbackParams;
|
|
34
|
+
/** Redirect sessions options */
|
|
35
|
+
preferences?: RedirectSessionPreferences;
|
|
36
|
+
}
|
|
37
|
+
/** @oneof */
|
|
38
|
+
export interface CreateRedirectSessionRequestIntentOneOf {
|
|
39
|
+
/** The parameters used in order to generate the URL into the Bookings checkout flow */
|
|
40
|
+
bookingsCheckout?: RedirectSessionBookingsCheckoutParams;
|
|
41
|
+
/** The parameters used in order to generate the URL into the Ecom checkout flow */
|
|
42
|
+
ecomCheckout?: RedirectSessionEcomCheckoutParams;
|
|
43
|
+
/** The parameters used in order to generate the URL into the events checkout flow */
|
|
44
|
+
eventsCheckout?: RedirectSessionEventsCheckoutParams;
|
|
45
|
+
/** The parameters used in order to generate the URL into the paid plans checkout flow */
|
|
46
|
+
paidPlansCheckout?: RedirectSessionPaidPlansCheckoutParams;
|
|
47
|
+
/** The parameters used in order to generate the URL into the Wix login page */
|
|
48
|
+
login?: RedirectSessionLoginParams;
|
|
49
|
+
/** The parameters used in order to generate the URL to logout from Wix (invalidate token and clear cookies on wix domain) */
|
|
50
|
+
logout?: RedirectSessionLogoutParams;
|
|
51
|
+
/** The parameters used in order to generate the URL into the authorize page */
|
|
52
|
+
auth?: RedirectSessionAuthParams;
|
|
53
|
+
}
|
|
54
|
+
export interface RedirectSessionBookingsCheckoutParams {
|
|
55
|
+
/** The timezone used for presentation and formatting when presenting the selected slot in a human readable format */
|
|
56
|
+
timezone?: string;
|
|
57
|
+
/** (Required) The ID of the service used in order to select the slot */
|
|
58
|
+
serviceId?: string;
|
|
59
|
+
/** (Required) The selected calendar slots to checkout */
|
|
60
|
+
slotAvailability?: SlotAvailability;
|
|
61
|
+
}
|
|
62
|
+
export interface SlotAvailability {
|
|
63
|
+
/**
|
|
64
|
+
* The slot for the corresponding session, when the session is either a single session
|
|
65
|
+
* or a specific session generated from a recurring session.
|
|
66
|
+
*/
|
|
67
|
+
slot?: Slot;
|
|
68
|
+
/**
|
|
69
|
+
* Whether the slot is bookable. Bookability is determined by checking a
|
|
70
|
+
* session's open slots and booking policies. Locks are not taken into
|
|
71
|
+
* account.
|
|
72
|
+
*/
|
|
73
|
+
bookable?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Total number of spots for this slot.
|
|
76
|
+
* For example, if a session has a total of 10 spots and 3 spots are booked,
|
|
77
|
+
* `spotsTotal` is 10 and `openSpots` is 7.
|
|
78
|
+
*/
|
|
79
|
+
totalSpots?: number | null;
|
|
80
|
+
/** Number of open spots for this slot. */
|
|
81
|
+
openSpots?: number | null;
|
|
82
|
+
/** An object describing the slot's waitlist and its occupancy. */
|
|
83
|
+
waitingList?: WaitingList;
|
|
84
|
+
/** Booking policy violations for the slot. */
|
|
85
|
+
bookingPolicyViolations?: BookingPolicyViolations;
|
|
86
|
+
/**
|
|
87
|
+
* Indicates whether the slot is locked because a waitlist exists.
|
|
88
|
+
* When a slot frees up, the slot is offered to the next customer on the waitlist. Read-only.
|
|
89
|
+
*/
|
|
90
|
+
locked?: boolean | null;
|
|
91
|
+
}
|
|
92
|
+
export interface Slot {
|
|
93
|
+
/**
|
|
94
|
+
* ID for the slot's corresponding session, when the session is either a single session
|
|
95
|
+
* or a specific session generated from a recurring session.
|
|
96
|
+
*/
|
|
97
|
+
sessionId?: string | null;
|
|
98
|
+
/** Service ID. */
|
|
99
|
+
serviceId?: string;
|
|
100
|
+
/** Schedule ID. */
|
|
101
|
+
scheduleId?: string;
|
|
102
|
+
/**
|
|
103
|
+
* The start time of this slot in [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339)
|
|
104
|
+
* format.
|
|
105
|
+
*
|
|
106
|
+
* If `timezone` is specified,
|
|
107
|
+
* dates are based on the local date/time. This means that the timezone offset
|
|
108
|
+
* in the `start_date` is ignored.
|
|
109
|
+
*/
|
|
110
|
+
startDate?: string | null;
|
|
111
|
+
/**
|
|
112
|
+
* The end time of this slot in
|
|
113
|
+
* [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339) format.
|
|
114
|
+
*
|
|
115
|
+
* If `timezone` is specified,
|
|
116
|
+
* dates are based on the local date/time. This means that the timezone offset
|
|
117
|
+
* in the `end_date` is ignored.
|
|
118
|
+
*/
|
|
119
|
+
endDate?: string | null;
|
|
120
|
+
/**
|
|
121
|
+
* The timezone for which slot availability is to be calculated.
|
|
122
|
+
*
|
|
123
|
+
* Learn more about [handling Daylight Savings Time (DST) for local time zones](https://dev.wix.com/api/rest/wix-bookings/availability-calendar/query-availability#wix-bookings_availability-calendar_query-availability_handling-daylight-savings-time-dst-for-local-time-zones)
|
|
124
|
+
* when calculating availability.
|
|
125
|
+
*/
|
|
126
|
+
timezone?: string | null;
|
|
127
|
+
/**
|
|
128
|
+
* The resource required for this slot. Currently, the only supported resource
|
|
129
|
+
* is the relevant staff member for the slot.
|
|
130
|
+
*/
|
|
131
|
+
resource?: SlotResource;
|
|
132
|
+
/** Geographic location of the slot. */
|
|
133
|
+
location?: Location;
|
|
134
|
+
}
|
|
135
|
+
export interface SlotResource {
|
|
136
|
+
/**
|
|
137
|
+
* Resource ID.
|
|
138
|
+
* @readonly
|
|
139
|
+
*/
|
|
140
|
+
_id?: string | null;
|
|
141
|
+
/** Resource name. Read only. */
|
|
142
|
+
name?: string | null;
|
|
143
|
+
}
|
|
144
|
+
export interface Location {
|
|
145
|
+
/**
|
|
146
|
+
* Business location ID. Available only for locations that are business locations,
|
|
147
|
+
* meaning the `location_type` is `"OWNER_BUSINESS"`.
|
|
148
|
+
*/
|
|
149
|
+
_id?: string | null;
|
|
150
|
+
/** Location name. */
|
|
151
|
+
name?: string | null;
|
|
152
|
+
/** The full address of this location. */
|
|
153
|
+
formattedAddress?: string | null;
|
|
154
|
+
/**
|
|
155
|
+
* Location type.
|
|
156
|
+
*
|
|
157
|
+
* - `"OWNER_BUSINESS"`: The business address, as set in the site’s general settings.
|
|
158
|
+
* - `"OWNER_CUSTOM"`: The address as set when creating the service.
|
|
159
|
+
* - `"CUSTOM"`: The address as set for the individual session.
|
|
160
|
+
*/
|
|
161
|
+
locationType?: LocationType;
|
|
162
|
+
}
|
|
163
|
+
export declare enum LocationType {
|
|
164
|
+
UNDEFINED = "UNDEFINED",
|
|
165
|
+
OWNER_BUSINESS = "OWNER_BUSINESS",
|
|
166
|
+
OWNER_CUSTOM = "OWNER_CUSTOM",
|
|
167
|
+
CUSTOM = "CUSTOM"
|
|
168
|
+
}
|
|
169
|
+
export interface WaitingList {
|
|
170
|
+
/**
|
|
171
|
+
* Total number of spots and open spots for this waitlist.
|
|
172
|
+
* For example, a Yoga class with 10 waitlist spots and 3 registered
|
|
173
|
+
* on the waitlist has 10 `total_spots` and 7 `open_spots`.
|
|
174
|
+
*/
|
|
175
|
+
totalSpots?: number | null;
|
|
176
|
+
/** Number of open spots for this waitlist. */
|
|
177
|
+
openSpots?: number | null;
|
|
178
|
+
}
|
|
179
|
+
export interface BookingPolicyViolations {
|
|
180
|
+
/** Bookings policy violation. Too early to book this slot. */
|
|
181
|
+
tooEarlyToBook?: boolean | null;
|
|
182
|
+
/** Bookings policy violation. Too late to book this slot. */
|
|
183
|
+
tooLateToBook?: boolean | null;
|
|
184
|
+
/** Bookings policy violation. Online booking is disabled for this slot. */
|
|
185
|
+
bookOnlineDisabled?: boolean | null;
|
|
186
|
+
}
|
|
187
|
+
export interface RedirectSessionEcomCheckoutParams {
|
|
188
|
+
/** (Required) The ID of the checkout entity used in order to start the checkout with */
|
|
189
|
+
checkoutId?: string;
|
|
190
|
+
}
|
|
191
|
+
export interface RedirectSessionEventsCheckoutParams {
|
|
192
|
+
/** (Required) The ID of the selected event */
|
|
193
|
+
reservationId?: string;
|
|
194
|
+
/** (Required) The slug of the selected event (url friendly name) */
|
|
195
|
+
eventSlug?: string;
|
|
196
|
+
}
|
|
197
|
+
export interface RedirectSessionPaidPlansCheckoutParams {
|
|
198
|
+
/** (Required) The ID of the selected paid plan */
|
|
199
|
+
planId?: string;
|
|
200
|
+
/** The encoded string representing the navigation defined for the end of the flow, probably received by wix site when navigating to headless */
|
|
201
|
+
checkoutData?: string | null;
|
|
202
|
+
}
|
|
203
|
+
export interface RedirectSessionLoginParams {
|
|
204
|
+
}
|
|
205
|
+
/** Deprecated - replaced by RedirectSessionAuthParams */
|
|
206
|
+
export interface RedirectSessionAuthorizeParams {
|
|
207
|
+
/** (Required) The authorization request to be sent to the authorization server */
|
|
208
|
+
auth?: AuthorizeRequest;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* AuthorizeRequest is sent by the client to the authorization server to initiate
|
|
212
|
+
* the authorization process.
|
|
213
|
+
*/
|
|
214
|
+
export interface AuthorizeRequest {
|
|
215
|
+
/** client_id is the unique identifier of the client application. */
|
|
216
|
+
clientId?: string;
|
|
217
|
+
/**
|
|
218
|
+
* response_type specifies the desired authorization grant type.
|
|
219
|
+
* This can be "code" for the authorization code.
|
|
220
|
+
*/
|
|
221
|
+
responseType?: string;
|
|
222
|
+
/**
|
|
223
|
+
* redirect_uri is the URI to which the authorization server will redirect the
|
|
224
|
+
* user-agent after the user grants/denies permission.
|
|
225
|
+
*/
|
|
226
|
+
redirectUri?: string;
|
|
227
|
+
/**
|
|
228
|
+
* scope is a space-delimited string that specifies the requested scope of the
|
|
229
|
+
* access request.
|
|
230
|
+
*/
|
|
231
|
+
scope?: string | null;
|
|
232
|
+
/**
|
|
233
|
+
* An opaque value, used for security purposes. If this request parameter is set
|
|
234
|
+
* in the request, then it is returned to the application as part of the redirect_uri.
|
|
235
|
+
*/
|
|
236
|
+
state?: string;
|
|
237
|
+
/** (Optional) How the result of the authorization request is formatted */
|
|
238
|
+
responseMode?: string | null;
|
|
239
|
+
/**
|
|
240
|
+
* code_challenge is the code challenge sent by the client as part of the PKCE
|
|
241
|
+
* process. This field is only used if response_type is "code".
|
|
242
|
+
*/
|
|
243
|
+
codeChallenge?: string | null;
|
|
244
|
+
/**
|
|
245
|
+
* code_challenge_method is the code challenge method sent by the client as part
|
|
246
|
+
* of the PKCE process. This field is only used if response_type is "code".
|
|
247
|
+
*/
|
|
248
|
+
codeChallengeMethod?: string | null;
|
|
249
|
+
/** Current client session */
|
|
250
|
+
sessionToken?: string | null;
|
|
251
|
+
/**
|
|
252
|
+
* Optional fields for errors
|
|
253
|
+
* A short error code that describes the type of error that occurred (e.g. "invalid_request")
|
|
254
|
+
*/
|
|
255
|
+
error?: string | null;
|
|
256
|
+
/** A human-readable description of the error that occurred */
|
|
257
|
+
errorDescription?: string | null;
|
|
258
|
+
}
|
|
259
|
+
export interface RedirectSessionLogoutParams {
|
|
260
|
+
/** (Required) The oauth app id used */
|
|
261
|
+
clientId?: string;
|
|
262
|
+
}
|
|
263
|
+
export interface RedirectSessionAuthParams {
|
|
264
|
+
/** (Required) The authorization request to be sent to the authorization server */
|
|
265
|
+
authRequest?: AuthorizeRequest;
|
|
266
|
+
}
|
|
267
|
+
export interface CallbackParams {
|
|
268
|
+
/** An external thank you page URL, used when the thank you page is implemented outside of Wix */
|
|
269
|
+
thankYouPageUrl?: string | null;
|
|
270
|
+
/** The external home page URL, used in order to indicate where to redirect to at the end of the flow (after thank you page/error) */
|
|
271
|
+
postFlowUrl?: string | null;
|
|
272
|
+
/** An external pricing plans page URL, used in case the checkout allows payment with a paid plans */
|
|
273
|
+
plansListUrl?: string | null;
|
|
274
|
+
/** An external login page in case login form is implemented outside Wix */
|
|
275
|
+
loginUrl?: string | null;
|
|
276
|
+
/** An external service list page URL (Bookings Services), used when the services page is implemented outside of Wix */
|
|
277
|
+
bookingsServiceListUrl?: string | null;
|
|
278
|
+
/** An external cart page URL, used when the cart page is implemented outside of Wix */
|
|
279
|
+
cartPageUrl?: string | null;
|
|
280
|
+
}
|
|
281
|
+
export interface RedirectSessionPreferences {
|
|
282
|
+
/** (Default: true) - Define whether the base wix site should be used or the template site for all checkouts */
|
|
283
|
+
useGenericWixPages?: boolean | null;
|
|
284
|
+
}
|
|
285
|
+
export interface CreateRedirectSessionResponse {
|
|
286
|
+
/** The Wix URL details to redirect into */
|
|
287
|
+
redirectSession?: RedirectSession;
|
|
288
|
+
}
|
|
289
|
+
export interface ValidateCallbackURLRequest {
|
|
290
|
+
/** An external URL to validate */
|
|
291
|
+
callbackUrl?: string;
|
|
292
|
+
/** The type of the callback URL */
|
|
293
|
+
callbackType?: CallbackType;
|
|
294
|
+
/** The oauth app id used in order to pull the allowed domains from, has to correspond to the same metasite as the site in context */
|
|
295
|
+
clientId?: string;
|
|
296
|
+
}
|
|
297
|
+
export declare enum CallbackType {
|
|
298
|
+
/** Invalid value - default */
|
|
299
|
+
UNKNOWN = "UNKNOWN",
|
|
300
|
+
/** The callback URL is used for the logout flow */
|
|
301
|
+
LOGOUT = "LOGOUT",
|
|
302
|
+
/** The callback URL is used for a checkout flow */
|
|
303
|
+
CHECKOUT = "CHECKOUT",
|
|
304
|
+
/** The callback URL is used for the authorize flow */
|
|
305
|
+
AUTHORIZE = "AUTHORIZE"
|
|
306
|
+
}
|
|
307
|
+
export interface ValidateCallbackURLResponse {
|
|
308
|
+
/** is the provided url allowed for the given client id */
|
|
309
|
+
isValid?: boolean;
|
|
310
|
+
}
|
|
311
|
+
export interface SignInURLRequest {
|
|
312
|
+
/** The oauth app id used in order to pull the allowed domains from, has to correspond to the same metasite as the site in context */
|
|
313
|
+
clientId?: string;
|
|
314
|
+
}
|
|
315
|
+
export interface SignInURLResponse {
|
|
316
|
+
/** The Wix URL details to redirect into */
|
|
317
|
+
redirectSession?: RedirectSession;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Creates a new WixUrl
|
|
321
|
+
* @public
|
|
322
|
+
* @documentationMaturity preview
|
|
323
|
+
* @requiredField CreateRedirectSessionRequest
|
|
324
|
+
*/
|
|
325
|
+
export declare function createRedirectSession(options?: CreateRedirectSessionOptions): Promise<CreateRedirectSessionResponse>;
|
|
326
|
+
export interface CreateRedirectSessionOptions extends CreateRedirectSessionRequestIntentOneOf {
|
|
327
|
+
/** The parameters used in order to generate the URL into the Bookings checkout flow */
|
|
328
|
+
bookingsCheckout?: RedirectSessionBookingsCheckoutParams;
|
|
329
|
+
/** The parameters used in order to generate the URL into the Ecom checkout flow */
|
|
330
|
+
ecomCheckout?: RedirectSessionEcomCheckoutParams;
|
|
331
|
+
/** The parameters used in order to generate the URL into the events checkout flow */
|
|
332
|
+
eventsCheckout?: RedirectSessionEventsCheckoutParams;
|
|
333
|
+
/** The parameters used in order to generate the URL into the paid plans checkout flow */
|
|
334
|
+
paidPlansCheckout?: RedirectSessionPaidPlansCheckoutParams;
|
|
335
|
+
/** The parameters used in order to generate the URL into the Wix login page */
|
|
336
|
+
login?: RedirectSessionLoginParams;
|
|
337
|
+
/** The parameters used in order to generate the URL to logout from Wix (invalidate token and clear cookies on wix domain) */
|
|
338
|
+
logout?: RedirectSessionLogoutParams;
|
|
339
|
+
/** The parameters used in order to generate the URL into the authorize page */
|
|
340
|
+
auth?: RedirectSessionAuthParams;
|
|
341
|
+
/** The callbacks (URL) allowing the definition of the pages which should be redirected back to the original site during the flow initiated in Wix */
|
|
342
|
+
callbacks?: CallbackParams;
|
|
343
|
+
/** Redirect sessions options */
|
|
344
|
+
preferences?: RedirectSessionPreferences;
|
|
345
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.createRedirectSession = exports.CallbackType = exports.LocationType = exports.__debug = void 0;
|
|
32
|
+
const velo_1 = require("@wix/metro-runtime/velo");
|
|
33
|
+
const ambassadorWixHeadlessV1RedirectSession = __importStar(require("./headless-v1-redirect-session.http"));
|
|
34
|
+
let __verbose = false;
|
|
35
|
+
function __log(...args) {
|
|
36
|
+
__verbose && console.log(...args);
|
|
37
|
+
}
|
|
38
|
+
function __inspect(obj) {
|
|
39
|
+
return obj;
|
|
40
|
+
}
|
|
41
|
+
exports.__debug = {
|
|
42
|
+
verboseLogging: {
|
|
43
|
+
on: () => (__verbose = true),
|
|
44
|
+
off: () => (__verbose = false),
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
const _toVeloEntity = '$';
|
|
48
|
+
const _fromVeloEntity = '$';
|
|
49
|
+
var LocationType;
|
|
50
|
+
(function (LocationType) {
|
|
51
|
+
LocationType["UNDEFINED"] = "UNDEFINED";
|
|
52
|
+
LocationType["OWNER_BUSINESS"] = "OWNER_BUSINESS";
|
|
53
|
+
LocationType["OWNER_CUSTOM"] = "OWNER_CUSTOM";
|
|
54
|
+
LocationType["CUSTOM"] = "CUSTOM";
|
|
55
|
+
})(LocationType = exports.LocationType || (exports.LocationType = {}));
|
|
56
|
+
var CallbackType;
|
|
57
|
+
(function (CallbackType) {
|
|
58
|
+
/** Invalid value - default */
|
|
59
|
+
CallbackType["UNKNOWN"] = "UNKNOWN";
|
|
60
|
+
/** The callback URL is used for the logout flow */
|
|
61
|
+
CallbackType["LOGOUT"] = "LOGOUT";
|
|
62
|
+
/** The callback URL is used for a checkout flow */
|
|
63
|
+
CallbackType["CHECKOUT"] = "CHECKOUT";
|
|
64
|
+
/** The callback URL is used for the authorize flow */
|
|
65
|
+
CallbackType["AUTHORIZE"] = "AUTHORIZE";
|
|
66
|
+
})(CallbackType = exports.CallbackType || (exports.CallbackType = {}));
|
|
67
|
+
const _createRedirectSessionRequest = {};
|
|
68
|
+
const _createRedirectSessionResponse = {};
|
|
69
|
+
/**
|
|
70
|
+
* Creates a new WixUrl
|
|
71
|
+
* @public
|
|
72
|
+
* @documentationMaturity preview
|
|
73
|
+
* @requiredField CreateRedirectSessionRequest
|
|
74
|
+
*/
|
|
75
|
+
function createRedirectSession(options) {
|
|
76
|
+
var _a, _b, _c;
|
|
77
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
78
|
+
const requestTransformation = {
|
|
79
|
+
bookingsCheckout: '$[0].bookingsCheckout',
|
|
80
|
+
ecomCheckout: '$[0].ecomCheckout',
|
|
81
|
+
eventsCheckout: '$[0].eventsCheckout',
|
|
82
|
+
paidPlansCheckout: '$[0].paidPlansCheckout',
|
|
83
|
+
login: '$[0].login',
|
|
84
|
+
logout: '$[0].logout',
|
|
85
|
+
auth: '$[0].auth',
|
|
86
|
+
callbacks: '$[0].callbacks',
|
|
87
|
+
preferences: '$[0].preferences',
|
|
88
|
+
};
|
|
89
|
+
const responseTransformation = '$';
|
|
90
|
+
// @ts-ignore
|
|
91
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
92
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
93
|
+
rootSchema: _createRedirectSessionRequest,
|
|
94
|
+
depSchemas: {},
|
|
95
|
+
fqdnTransformation: {
|
|
96
|
+
paths: [],
|
|
97
|
+
transformation: _fromVeloEntity,
|
|
98
|
+
},
|
|
99
|
+
customTransformation: requestTransformation,
|
|
100
|
+
});
|
|
101
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
|
102
|
+
rootSchema: _createRedirectSessionResponse,
|
|
103
|
+
depSchemas: {},
|
|
104
|
+
fqdnTransformation: {
|
|
105
|
+
paths: [...['redirectSession']],
|
|
106
|
+
transformation: _toVeloEntity,
|
|
107
|
+
},
|
|
108
|
+
customTransformation: responseTransformation,
|
|
109
|
+
});
|
|
110
|
+
const payload = toAmbassadorRequest([options]);
|
|
111
|
+
const reqOpts = ambassadorWixHeadlessV1RedirectSession.createRedirectSession(payload);
|
|
112
|
+
__log(`"CreateRedirectSession" sending request with: ${__inspect(reqOpts)}`);
|
|
113
|
+
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
114
|
+
try {
|
|
115
|
+
const result = yield httpClient.request(reqOpts);
|
|
116
|
+
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
117
|
+
return fromJSON(result.data);
|
|
118
|
+
}
|
|
119
|
+
catch (err) {
|
|
120
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
121
|
+
'options',
|
|
122
|
+
]);
|
|
123
|
+
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
124
|
+
throw transformedError;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
exports.createRedirectSession = createRedirectSession;
|
|
129
|
+
//# sourceMappingURL=headless-v1-redirect-session.universal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headless-v1-redirect-session.universal.js","sourceRoot":"","sources":["../../../src/headless-v1-redirect-session.universal.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAqE;AAErE,4GAA8F;AAE9F,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB,SAAS,KAAK,CAAC,GAAG,IAAW;IAC3B,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,SAAS,CAAC,GAAQ;IACzB,OAAO,GAAG,CAAC;AACb,CAAC;AAEY,QAAA,OAAO,GAAG;IACrB,cAAc,EAAE;QACd,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC;QAC5B,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS,GAAG,KAAK,CAAC;KAC/B;CACF,CAAC;AACF,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,eAAe,GAAG,GAAG,CAAC;AAuK5B,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,uCAAuB,CAAA;IACvB,iDAAiC,CAAA;IACjC,6CAA6B,CAAA;IAC7B,iCAAiB,CAAA;AACnB,CAAC,EALW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAKvB;AA+ID,IAAY,YASX;AATD,WAAY,YAAY;IACtB,8BAA8B;IAC9B,mCAAmB,CAAA;IACnB,mDAAmD;IACnD,iCAAiB,CAAA;IACjB,mDAAmD;IACnD,qCAAqB,CAAA;IACrB,sDAAsD;IACtD,uCAAuB,CAAA;AACzB,CAAC,EATW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QASvB;AAiBD,MAAM,6BAA6B,GAAG,EAAE,CAAC;AACzC,MAAM,8BAA8B,GAAG,EAAE,CAAC;AAE1C;;;;;GAKG;AACH,SAAsB,qBAAqB,CACzC,OAAsC;;;QAEtC,MAAM,qBAAqB,GAAG;YAC5B,gBAAgB,EAAE,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YACjD,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,SAAS,+CAAtB,WAAW,EAAc,MAAM,CAAC,CAAC;YAEjC,OAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAQ,CAAC;SACrC;QAAC,OAAO,GAAQ,EAAE;YACjB,MAAM,gBAAgB,GAAG,IAAA,qBAAc,EAAC,GAAG,EAAE,qBAAqB,EAAE;gBAClE,SAAS;aACV,CAAC,CAAC;YACH,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,+CAApB,WAAW,EAAY,GAAG,CAAC,CAAC;YAE5B,MAAM,gBAAgB,CAAC;SACxB;;CACF;AA/DD,sDA+DC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as redirects from './src/headless-v1-redirect-session.public';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,2CAA2C,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RequestOptionsFactory } from '@wix/sdk-types';
|
|
2
|
+
import { CreateRedirectSessionRequest, CreateRedirectSessionResponse } from './headless-v1-redirect-session.types';
|
|
3
|
+
/** Creates a new WixUrl */
|
|
4
|
+
export declare function createRedirectSession(payload: CreateRedirectSessionRequest): RequestOptionsFactory<CreateRedirectSessionResponse>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { serializer } from '@wix/metro-runtime/ambassador';
|
|
2
|
+
import { resolveUrl } from '@wix/metro-runtime';
|
|
3
|
+
const _createRedirectSessionRequest = {};
|
|
4
|
+
const _createRedirectSessionResponse = {};
|
|
5
|
+
function resolveWixHeadlessV1RedirectSessionServiceUrl(opts) {
|
|
6
|
+
const domainToMappings = {
|
|
7
|
+
'www._base_domain_': [
|
|
8
|
+
{
|
|
9
|
+
srcPath: '/_api/redirects-api',
|
|
10
|
+
destPath: '',
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
'www.wixapis.com': [
|
|
14
|
+
{
|
|
15
|
+
srcPath: '/_api/redirects-api',
|
|
16
|
+
destPath: '',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
};
|
|
20
|
+
return resolveUrl(Object.assign(opts, { domainToMappings }));
|
|
21
|
+
}
|
|
22
|
+
/** Creates a new WixUrl */
|
|
23
|
+
export function createRedirectSession(payload) {
|
|
24
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_createRedirectSessionRequest, {});
|
|
25
|
+
const { fromJSON: fromRes } = serializer(_createRedirectSessionResponse, {});
|
|
26
|
+
function __createRedirectSession({ host }) {
|
|
27
|
+
const serializedData = toReq(payload);
|
|
28
|
+
const metadata = {
|
|
29
|
+
entityFqdn: 'wix.headless.v1.redirect_session',
|
|
30
|
+
method: 'POST',
|
|
31
|
+
methodFqn: 'wix.headless.v1.RedirectSessionService.CreateRedirectSession',
|
|
32
|
+
url: resolveWixHeadlessV1RedirectSessionServiceUrl({
|
|
33
|
+
protoPath: '/v1/redirect-session',
|
|
34
|
+
data: serializedData,
|
|
35
|
+
host,
|
|
36
|
+
}),
|
|
37
|
+
data: serializedData,
|
|
38
|
+
transformResponse: fromRes,
|
|
39
|
+
};
|
|
40
|
+
return metadata;
|
|
41
|
+
}
|
|
42
|
+
__createRedirectSession.fromReq = fromReq;
|
|
43
|
+
return __createRedirectSession;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=headless-v1-redirect-session.http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headless-v1-redirect-session.http.js","sourceRoot":"","sources":["../../../src/headless-v1-redirect-session.http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAQhD,MAAM,6BAA6B,GAAG,EAAE,CAAC;AACzC,MAAM,8BAA8B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ectSessionOptions } from './headless-v1-redirect-session.universal';
|
|
3
|
+
export declare const __metadata: {
|
|
4
|
+
PACKAGE_NAME: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function createRedirectSession(httpClient: HttpClient): (options?: CreateRedirectSessionOptions | undefined) => Promise<import("./headless-v1-redirect-session.universal").CreateRedirectSessionResponse>;
|
|
7
|
+
export { LocationType, CallbackType, } from './headless-v1-redirect-session.universal';
|
|
8
|
+
export { RedirectSession, CreateRedirectSessionRequest, CreateRedirectSessionRequestIntentOneOf, RedirectSessionBookingsCheckoutParams, SlotAvailability, Slot, SlotResource, Location, WaitingList, BookingPolicyViolations, RedirectSessionEcomCheckoutParams, RedirectSessionEventsCheckoutParams, RedirectSessionPaidPlansCheckoutParams, RedirectSessionLoginParams, RedirectSessionAuthorizeParams, AuthorizeRequest, RedirectSessionLogoutParams, RedirectSessionAuthParams, CallbackParams, RedirectSessionPreferences, CreateRedirectSessionResponse, ValidateCallbackURLRequest, ValidateCallbackURLResponse, SignInURLRequest, SignInURLResponse, CreateRedirectSessionOptions, } from './headless-v1-redirect-session.universal';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createRedirectSession as universalCreateRedirectSession, } from './headless-v1-redirect-session.universal';
|
|
2
|
+
export const __metadata = { PACKAGE_NAME: '@wix/redirects' };
|
|
3
|
+
export function createRedirectSession(httpClient) {
|
|
4
|
+
return (options) => universalCreateRedirectSession(options,
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
{ httpClient });
|
|
7
|
+
}
|
|
8
|
+
export { LocationType, CallbackType, } from './headless-v1-redirect-session.universal';
|
|
9
|
+
//# sourceMappingURL=headless-v1-redirect-session.public.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headless-v1-redirect-session.public.js","sourceRoot":"","sources":["../../../src/headless-v1-redirect-session.public.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,IAAI,8BAA8B,GAExD,MAAM,0CAA0C,CAAC;AAElD,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC;AAE7D,MAAM,UAAU,qBAAqB,CAAC,UAAsB;IAC1D,OAAO,CAAC,OAAsC,EAAE,EAAE,CAChD,8BAA8B,CAC5B,OAAO;IACP,aAAa;IACb,EAAE,UAAU,EAAE,CACf,CAAC;AACN,CAAC;AAED,OAAO,EACL,YAAY,EACZ,YAAY,GACb,MAAM,0CAA0C,CAAC"}
|