@wix/auto_sdk_vod_purchases 0.0.0-stage → 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 +229 -0
- package/build/cjs/index.js +207 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/index.typings.d.ts +1 -0
- package/build/cjs/index.typings.js +194 -0
- package/build/cjs/index.typings.js.map +1 -0
- package/build/cjs/meta.d.ts +214 -0
- package/build/cjs/meta.js +179 -0
- package/build/cjs/meta.js.map +1 -0
- package/build/es/index.d.mts +229 -0
- package/build/es/index.mjs +181 -0
- package/build/es/index.mjs.map +1 -0
- package/build/es/index.typings.d.mts +1 -0
- package/build/es/index.typings.mjs +168 -0
- package/build/es/index.typings.mjs.map +1 -0
- package/build/es/meta.d.mts +214 -0
- package/build/es/meta.mjs +150 -0
- package/build/es/meta.mjs.map +1 -0
- package/build/es/package.json +3 -0
- package/build/internal/cjs/index.d.ts +20 -0
- package/build/internal/cjs/index.typings.d.ts +249 -0
- package/build/internal/cjs/meta.d.ts +222 -0
- package/build/internal/es/index.d.mts +20 -0
- package/build/internal/es/index.typings.d.mts +249 -0
- package/build/internal/es/meta.d.mts +222 -0
- package/meta/package.json +3 -0
- package/package.json +51 -3
- package/README.md +0 -3
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Something the calling site member has bought: a video bought or rented, or a legacy channel subscription. Only
|
|
3
|
+
* purchases that currently grant access are returned.
|
|
4
|
+
*/
|
|
5
|
+
interface Purchase extends PurchaseTargetOneOf {
|
|
6
|
+
/**
|
|
7
|
+
* The subscribed channel. Set for SUBSCRIPTION (legacy). A video purchase has no channel: it is valid wherever
|
|
8
|
+
* the video plays.
|
|
9
|
+
* @format GUID
|
|
10
|
+
*/
|
|
11
|
+
channelId?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The bought or rented video. Set for SALE and RENT.
|
|
14
|
+
* @format GUID
|
|
15
|
+
*/
|
|
16
|
+
videoId?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Purchase ID. Unlike most IDs in this API, it isn't a GUID: treat it as an opaque string of up to 24 characters,
|
|
19
|
+
* and don't parse or validate its format.
|
|
20
|
+
* @readonly
|
|
21
|
+
* @maxLength 24
|
|
22
|
+
*/
|
|
23
|
+
_id?: string;
|
|
24
|
+
/** What was bought. Selects which `target` member is set. */
|
|
25
|
+
type?: TypeWithLiterals;
|
|
26
|
+
/**
|
|
27
|
+
* The amount paid.
|
|
28
|
+
* @readonly
|
|
29
|
+
*/
|
|
30
|
+
price?: Money;
|
|
31
|
+
/** The purchase's payment state. */
|
|
32
|
+
status?: StatusWithLiterals;
|
|
33
|
+
/** When the payment was made, which starts access. A rental's `expiration_date` is counted from it. */
|
|
34
|
+
startedDate?: Date | null;
|
|
35
|
+
/** When access ends. Set for RENT, and for a CANCELED legacy subscription. */
|
|
36
|
+
expirationDate?: Date | null;
|
|
37
|
+
/**
|
|
38
|
+
* When the member started checkout. Checking out again for the same video or channel resets it.
|
|
39
|
+
* @readonly
|
|
40
|
+
*/
|
|
41
|
+
_createdDate?: Date | null;
|
|
42
|
+
/**
|
|
43
|
+
* When `status` last changed.
|
|
44
|
+
* @readonly
|
|
45
|
+
*/
|
|
46
|
+
_updatedDate?: Date | null;
|
|
47
|
+
}
|
|
48
|
+
/** @oneof */
|
|
49
|
+
interface PurchaseTargetOneOf {
|
|
50
|
+
/**
|
|
51
|
+
* The subscribed channel. Set for SUBSCRIPTION (legacy). A video purchase has no channel: it is valid wherever
|
|
52
|
+
* the video plays.
|
|
53
|
+
* @format GUID
|
|
54
|
+
*/
|
|
55
|
+
channelId?: string;
|
|
56
|
+
/**
|
|
57
|
+
* The bought or rented video. Set for SALE and RENT.
|
|
58
|
+
* @format GUID
|
|
59
|
+
*/
|
|
60
|
+
videoId?: string;
|
|
61
|
+
}
|
|
62
|
+
/** What was bought. */
|
|
63
|
+
declare enum Type {
|
|
64
|
+
/**
|
|
65
|
+
* Legacy channel subscription; existing ones are returned until they end. `channel_id` is set. Deprecated. Use
|
|
66
|
+
* pricing plans (`Channel.pricing.pricing_plans_enabled`).
|
|
67
|
+
*/
|
|
68
|
+
SUBSCRIPTION = "SUBSCRIPTION",
|
|
69
|
+
/** Per-video purchase; `video_id` is set. */
|
|
70
|
+
SALE = "SALE",
|
|
71
|
+
/** Per-video purchase that lapses at `expiration_date`; `video_id` is set. */
|
|
72
|
+
RENT = "RENT"
|
|
73
|
+
}
|
|
74
|
+
/** @enumType */
|
|
75
|
+
type TypeWithLiterals = Type | 'SUBSCRIPTION' | 'SALE' | 'RENT';
|
|
76
|
+
/**
|
|
77
|
+
* Money.
|
|
78
|
+
* Default format to use. Sufficiently compliant with majority of standards: w3c, ISO 4217, ISO 20022, ISO 8583:2003.
|
|
79
|
+
*/
|
|
80
|
+
interface Money {
|
|
81
|
+
/**
|
|
82
|
+
* Monetary amount. Decimal string with a period as a decimal separator (e.g., 3.99). Optionally, a single (-), to indicate that the amount is negative.
|
|
83
|
+
* @decimalValue options { gte:0.00, maxScale:2 }
|
|
84
|
+
*/
|
|
85
|
+
value?: string;
|
|
86
|
+
/**
|
|
87
|
+
* Currency code. Must be valid ISO 4217 currency code (e.g., USD).
|
|
88
|
+
* @format CURRENCY
|
|
89
|
+
*/
|
|
90
|
+
currency?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Monetary amount. Decimal string in local format (e.g., 1 000,30). Optionally, a single (-), to indicate that the amount is negative.
|
|
93
|
+
* @readonly
|
|
94
|
+
* @maxLength 100
|
|
95
|
+
*/
|
|
96
|
+
formattedValue?: string | null;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The purchase's payment state. `ListPurchases` returns only ACTIVE and CANCELED; the other values are for a
|
|
100
|
+
* back-office.
|
|
101
|
+
*/
|
|
102
|
+
declare enum Status {
|
|
103
|
+
/** Checkout started; nothing paid yet. */
|
|
104
|
+
INITIALIZED = "INITIALIZED",
|
|
105
|
+
/** Payment submitted but not confirmed yet. */
|
|
106
|
+
PENDING = "PENDING",
|
|
107
|
+
/** Paid. Grants access. A partial refund keeps the purchase ACTIVE. */
|
|
108
|
+
ACTIVE = "ACTIVE",
|
|
109
|
+
/** Canceled. It still grants access until `expiration_date`, and is returned until then. */
|
|
110
|
+
CANCELED = "CANCELED",
|
|
111
|
+
/** Past `expiration_date`; reported even if the stored status has not been updated yet. */
|
|
112
|
+
EXPIRED = "EXPIRED",
|
|
113
|
+
/** The payment was declined. */
|
|
114
|
+
DECLINED = "DECLINED",
|
|
115
|
+
/** The payment was fully refunded. No longer grants access. */
|
|
116
|
+
REFUNDED = "REFUNDED",
|
|
117
|
+
/** The legacy subscription's recurring payments are suspended. No longer grants access. */
|
|
118
|
+
SUSPENDED = "SUSPENDED",
|
|
119
|
+
/** The payment failed. Set only by the legacy payment flow. */
|
|
120
|
+
FAILED = "FAILED"
|
|
121
|
+
}
|
|
122
|
+
/** @enumType */
|
|
123
|
+
type StatusWithLiterals = Status | 'INITIALIZED' | 'PENDING' | 'ACTIVE' | 'CANCELED' | 'EXPIRED' | 'DECLINED' | 'REFUNDED' | 'SUSPENDED' | 'FAILED';
|
|
124
|
+
interface ListPurchasesRequest extends ListPurchasesRequestScopeOneOf {
|
|
125
|
+
/**
|
|
126
|
+
* A channel: returns the caller's purchases of videos in the channel, and their legacy subscription to it.
|
|
127
|
+
* @format GUID
|
|
128
|
+
*/
|
|
129
|
+
channelId?: string;
|
|
130
|
+
/**
|
|
131
|
+
* A single video: returns the caller's purchases of that video, at most one SALE and one RENT. Use it for a
|
|
132
|
+
* single-video player.
|
|
133
|
+
* @format GUID
|
|
134
|
+
*/
|
|
135
|
+
videoId?: string;
|
|
136
|
+
/** Paging. Limit defaults to 100, max 100. */
|
|
137
|
+
paging?: CursorPaging;
|
|
138
|
+
}
|
|
139
|
+
/** @oneof */
|
|
140
|
+
interface ListPurchasesRequestScopeOneOf {
|
|
141
|
+
/**
|
|
142
|
+
* A channel: returns the caller's purchases of videos in the channel, and their legacy subscription to it.
|
|
143
|
+
* @format GUID
|
|
144
|
+
*/
|
|
145
|
+
channelId?: string;
|
|
146
|
+
/**
|
|
147
|
+
* A single video: returns the caller's purchases of that video, at most one SALE and one RENT. Use it for a
|
|
148
|
+
* single-video player.
|
|
149
|
+
* @format GUID
|
|
150
|
+
*/
|
|
151
|
+
videoId?: string;
|
|
152
|
+
}
|
|
153
|
+
interface CursorPaging {
|
|
154
|
+
/**
|
|
155
|
+
* Maximum number of items to return in the results.
|
|
156
|
+
* @max 100
|
|
157
|
+
*/
|
|
158
|
+
limit?: number | null;
|
|
159
|
+
/**
|
|
160
|
+
* Pointer to the next or previous page in the list of results.
|
|
161
|
+
*
|
|
162
|
+
* Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.
|
|
163
|
+
* Not relevant for the first request.
|
|
164
|
+
* @maxLength 16000
|
|
165
|
+
*/
|
|
166
|
+
cursor?: string | null;
|
|
167
|
+
}
|
|
168
|
+
interface ListPurchasesResponse {
|
|
169
|
+
/** The caller's purchases that currently grant access. */
|
|
170
|
+
purchases?: Purchase[];
|
|
171
|
+
/** Cursors for the next and previous pages. */
|
|
172
|
+
pagingMetadata?: CursorPagingMetadata;
|
|
173
|
+
}
|
|
174
|
+
interface CursorPagingMetadata {
|
|
175
|
+
/** Number of items returned in current page. */
|
|
176
|
+
count?: number | null;
|
|
177
|
+
/** Cursor strings that point to the next page, previous page, or both. */
|
|
178
|
+
cursors?: Cursors;
|
|
179
|
+
/**
|
|
180
|
+
* Whether there are more pages to retrieve following the current page.
|
|
181
|
+
*
|
|
182
|
+
* + `true`: Another page of results can be retrieved.
|
|
183
|
+
* + `false`: This is the last page.
|
|
184
|
+
*/
|
|
185
|
+
hasNext?: boolean | null;
|
|
186
|
+
}
|
|
187
|
+
interface Cursors {
|
|
188
|
+
/**
|
|
189
|
+
* Cursor string pointing to the next page in the list of results.
|
|
190
|
+
* @maxLength 16000
|
|
191
|
+
*/
|
|
192
|
+
next?: string | null;
|
|
193
|
+
/**
|
|
194
|
+
* Cursor pointing to the previous page in the list of results.
|
|
195
|
+
* @maxLength 16000
|
|
196
|
+
*/
|
|
197
|
+
prev?: string | null;
|
|
198
|
+
}
|
|
199
|
+
interface ListPurchasesOptions extends ListPurchasesOptionsScopeOneOf {
|
|
200
|
+
/**
|
|
201
|
+
* A channel: returns the caller's purchases of videos in the channel, and their legacy subscription to it.
|
|
202
|
+
* @format GUID
|
|
203
|
+
*/
|
|
204
|
+
channelId?: string;
|
|
205
|
+
/**
|
|
206
|
+
* A single video: returns the caller's purchases of that video, at most one SALE and one RENT. Use it for a
|
|
207
|
+
* single-video player.
|
|
208
|
+
* @format GUID
|
|
209
|
+
*/
|
|
210
|
+
videoId?: string;
|
|
211
|
+
/** Paging. Limit defaults to 100, max 100. */
|
|
212
|
+
paging?: CursorPaging;
|
|
213
|
+
}
|
|
214
|
+
/** @oneof */
|
|
215
|
+
interface ListPurchasesOptionsScopeOneOf {
|
|
216
|
+
/**
|
|
217
|
+
* A channel: returns the caller's purchases of videos in the channel, and their legacy subscription to it.
|
|
218
|
+
* @format GUID
|
|
219
|
+
*/
|
|
220
|
+
channelId?: string;
|
|
221
|
+
/**
|
|
222
|
+
* A single video: returns the caller's purchases of that video, at most one SALE and one RENT. Use it for a
|
|
223
|
+
* single-video player.
|
|
224
|
+
* @format GUID
|
|
225
|
+
*/
|
|
226
|
+
videoId?: string;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export { type CursorPaging, type CursorPagingMetadata, type Cursors, type ListPurchasesOptions, type ListPurchasesOptionsScopeOneOf, type ListPurchasesRequest, type ListPurchasesRequestScopeOneOf, type ListPurchasesResponse, type Money, type Purchase, type PurchaseTargetOneOf, Status, type StatusWithLiterals, Type, type TypeWithLiterals };
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
Status: () => Status,
|
|
24
|
+
Type: () => Type,
|
|
25
|
+
listPurchases: () => listPurchases4
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(index_exports);
|
|
28
|
+
|
|
29
|
+
// src/video-v4-purchase-purchases.universal.ts
|
|
30
|
+
var import_transform_error = require("@wix/sdk-runtime/transform-error");
|
|
31
|
+
var import_rename_all_nested_keys = require("@wix/sdk-runtime/rename-all-nested-keys");
|
|
32
|
+
|
|
33
|
+
// src/video-v4-purchase-purchases.http.ts
|
|
34
|
+
var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
|
|
35
|
+
var import_timestamp = require("@wix/sdk-runtime/transformations/timestamp");
|
|
36
|
+
var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
|
|
37
|
+
var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
|
|
38
|
+
var TRANSFORM_PATHS_0 = [
|
|
39
|
+
{ path: "purchases.startedDate" },
|
|
40
|
+
{ path: "purchases.expirationDate" },
|
|
41
|
+
{ path: "purchases.createdDate" },
|
|
42
|
+
{ path: "purchases.updatedDate" }
|
|
43
|
+
];
|
|
44
|
+
function resolveWixVideoV4PurchasesServiceUrl(opts) {
|
|
45
|
+
const domainToMappings = {
|
|
46
|
+
"manage._base_domain_": [
|
|
47
|
+
{
|
|
48
|
+
srcPath: "/_api/vod/public",
|
|
49
|
+
destPath: "/_api/vod/public"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
_: [
|
|
53
|
+
{
|
|
54
|
+
srcPath: "/_api/vod/public",
|
|
55
|
+
destPath: "/_api/vod/public"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"www._base_domain_": [
|
|
59
|
+
{
|
|
60
|
+
srcPath: "/_api/vod/public",
|
|
61
|
+
destPath: "/_api/vod/public"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"api._api_base_domain_": [
|
|
65
|
+
{
|
|
66
|
+
srcPath: "/wix-vod-backend-public",
|
|
67
|
+
destPath: ""
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
"editor.wixapps.net": [
|
|
71
|
+
{
|
|
72
|
+
srcPath: "/_api/vod/public",
|
|
73
|
+
destPath: "/_api/vod/public"
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"bo._base_domain_": [
|
|
77
|
+
{
|
|
78
|
+
srcPath: "/_api/vod/public",
|
|
79
|
+
destPath: "/_api/vod/public"
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
"wixbo.ai": [
|
|
83
|
+
{
|
|
84
|
+
srcPath: "/_api/vod/public",
|
|
85
|
+
destPath: "/_api/vod/public"
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"wix-bo.com": [
|
|
89
|
+
{
|
|
90
|
+
srcPath: "/_api/vod/public",
|
|
91
|
+
destPath: "/_api/vod/public"
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
"wix-vod-embed-video.wixapps.net": [
|
|
95
|
+
{
|
|
96
|
+
srcPath: "/_api/vod/public",
|
|
97
|
+
destPath: "/_api/vod/public"
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
"embed._base_domain_": [
|
|
101
|
+
{
|
|
102
|
+
srcPath: "/_api/vod/public",
|
|
103
|
+
destPath: "/_api/vod/public"
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
};
|
|
107
|
+
return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
108
|
+
}
|
|
109
|
+
var PACKAGE_NAME = "@wix/auto_sdk_vod_purchases";
|
|
110
|
+
function listPurchases(payload) {
|
|
111
|
+
function __listPurchases({ host }) {
|
|
112
|
+
const metadata = {
|
|
113
|
+
entityFqdn: "wix.video.v4.purchase",
|
|
114
|
+
method: "GET",
|
|
115
|
+
methodFqn: "wix.video.v4.PurchasesService.ListPurchases",
|
|
116
|
+
packageName: PACKAGE_NAME,
|
|
117
|
+
migrationOptions: {
|
|
118
|
+
optInTransformResponse: true
|
|
119
|
+
},
|
|
120
|
+
url: resolveWixVideoV4PurchasesServiceUrl({
|
|
121
|
+
protoPath: "/v4/purchases",
|
|
122
|
+
data: payload,
|
|
123
|
+
host
|
|
124
|
+
}),
|
|
125
|
+
params: (0, import_rest_modules.toURLSearchParams)(payload),
|
|
126
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
127
|
+
{
|
|
128
|
+
transformFn: import_timestamp.transformRESTTimestampToSDKTimestamp,
|
|
129
|
+
paths: TRANSFORM_PATHS_0
|
|
130
|
+
}
|
|
131
|
+
])
|
|
132
|
+
};
|
|
133
|
+
return metadata;
|
|
134
|
+
}
|
|
135
|
+
return __listPurchases;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// src/video-v4-purchase-purchases.universal.ts
|
|
139
|
+
var Type = /* @__PURE__ */ ((Type2) => {
|
|
140
|
+
Type2["SUBSCRIPTION"] = "SUBSCRIPTION";
|
|
141
|
+
Type2["SALE"] = "SALE";
|
|
142
|
+
Type2["RENT"] = "RENT";
|
|
143
|
+
return Type2;
|
|
144
|
+
})(Type || {});
|
|
145
|
+
var Status = /* @__PURE__ */ ((Status2) => {
|
|
146
|
+
Status2["INITIALIZED"] = "INITIALIZED";
|
|
147
|
+
Status2["PENDING"] = "PENDING";
|
|
148
|
+
Status2["ACTIVE"] = "ACTIVE";
|
|
149
|
+
Status2["CANCELED"] = "CANCELED";
|
|
150
|
+
Status2["EXPIRED"] = "EXPIRED";
|
|
151
|
+
Status2["DECLINED"] = "DECLINED";
|
|
152
|
+
Status2["REFUNDED"] = "REFUNDED";
|
|
153
|
+
Status2["SUSPENDED"] = "SUSPENDED";
|
|
154
|
+
Status2["FAILED"] = "FAILED";
|
|
155
|
+
return Status2;
|
|
156
|
+
})(Status || {});
|
|
157
|
+
async function listPurchases2(options) {
|
|
158
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
159
|
+
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
160
|
+
channelId: options?.channelId,
|
|
161
|
+
videoId: options?.videoId,
|
|
162
|
+
paging: options?.paging
|
|
163
|
+
});
|
|
164
|
+
const reqOpts = listPurchases(payload);
|
|
165
|
+
sideEffects?.onSiteCall?.();
|
|
166
|
+
try {
|
|
167
|
+
const result = await httpClient.request(reqOpts);
|
|
168
|
+
sideEffects?.onSuccess?.(result);
|
|
169
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
170
|
+
} catch (err) {
|
|
171
|
+
const transformedError = (0, import_transform_error.transformError)(
|
|
172
|
+
err,
|
|
173
|
+
{
|
|
174
|
+
spreadPathsToArguments: {},
|
|
175
|
+
explicitPathsToArguments: {
|
|
176
|
+
channelId: "$[0].channelId",
|
|
177
|
+
videoId: "$[0].videoId",
|
|
178
|
+
paging: "$[0].paging"
|
|
179
|
+
},
|
|
180
|
+
singleArgumentUnchanged: false
|
|
181
|
+
},
|
|
182
|
+
["options"]
|
|
183
|
+
);
|
|
184
|
+
sideEffects?.onError?.(err);
|
|
185
|
+
throw transformedError;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// src/video-v4-purchase-purchases.public.ts
|
|
190
|
+
function listPurchases3(httpClient) {
|
|
191
|
+
return (options) => listPurchases2(
|
|
192
|
+
options,
|
|
193
|
+
// @ts-ignore
|
|
194
|
+
{ httpClient }
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// src/video-v4-purchase-purchases.context.ts
|
|
199
|
+
var import_rest_modules3 = require("@wix/sdk-runtime/rest-modules");
|
|
200
|
+
var listPurchases4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(listPurchases3);
|
|
201
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
202
|
+
0 && (module.exports = {
|
|
203
|
+
Status,
|
|
204
|
+
Type,
|
|
205
|
+
listPurchases
|
|
206
|
+
});
|
|
207
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../index.ts","../../src/video-v4-purchase-purchases.universal.ts","../../src/video-v4-purchase-purchases.http.ts","../../src/video-v4-purchase-purchases.public.ts","../../src/video-v4-purchase-purchases.context.ts"],"sourcesContent":["export * from './src/video-v4-purchase-purchases.context.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixVideoV4Purchase from './video-v4-purchase-purchases.http.js';\n\n/**\n * Something the calling site member has bought: a video bought or rented, or a legacy channel subscription. Only\n * purchases that currently grant access are returned.\n */\nexport interface Purchase extends PurchaseTargetOneOf {\n /**\n * The subscribed channel. Set for SUBSCRIPTION (legacy). A video purchase has no channel: it is valid wherever\n * the video plays.\n * @format GUID\n */\n channelId?: string;\n /**\n * The bought or rented video. Set for SALE and RENT.\n * @format GUID\n */\n videoId?: string;\n /**\n * Purchase ID. Unlike most IDs in this API, it isn't a GUID: treat it as an opaque string of up to 24 characters,\n * and don't parse or validate its format.\n * @readonly\n * @maxLength 24\n */\n _id?: string;\n /** What was bought. Selects which `target` member is set. */\n type?: TypeWithLiterals;\n /**\n * The amount paid.\n * @readonly\n */\n price?: Money;\n /** The purchase's payment state. */\n status?: StatusWithLiterals;\n /** When the payment was made, which starts access. A rental's `expiration_date` is counted from it. */\n startedDate?: Date | null;\n /** When access ends. Set for RENT, and for a CANCELED legacy subscription. */\n expirationDate?: Date | null;\n /**\n * When the member started checkout. Checking out again for the same video or channel resets it.\n * @readonly\n */\n _createdDate?: Date | null;\n /**\n * When `status` last changed.\n * @readonly\n */\n _updatedDate?: Date | null;\n}\n\n/** @oneof */\nexport interface PurchaseTargetOneOf {\n /**\n * The subscribed channel. Set for SUBSCRIPTION (legacy). A video purchase has no channel: it is valid wherever\n * the video plays.\n * @format GUID\n */\n channelId?: string;\n /**\n * The bought or rented video. Set for SALE and RENT.\n * @format GUID\n */\n videoId?: string;\n}\n\n/** What was bought. */\nexport enum Type {\n /**\n * Legacy channel subscription; existing ones are returned until they end. `channel_id` is set. Deprecated. Use\n * pricing plans (`Channel.pricing.pricing_plans_enabled`).\n */\n SUBSCRIPTION = 'SUBSCRIPTION',\n /** Per-video purchase; `video_id` is set. */\n SALE = 'SALE',\n /** Per-video purchase that lapses at `expiration_date`; `video_id` is set. */\n RENT = 'RENT',\n}\n\n/** @enumType */\nexport type TypeWithLiterals = Type | 'SUBSCRIPTION' | 'SALE' | 'RENT';\n\n/**\n * Money.\n * Default format to use. Sufficiently compliant with majority of standards: w3c, ISO 4217, ISO 20022, ISO 8583:2003.\n */\nexport interface Money {\n /**\n * Monetary amount. Decimal string with a period as a decimal separator (e.g., 3.99). Optionally, a single (-), to indicate that the amount is negative.\n * @decimalValue options { gte:0.00, maxScale:2 }\n */\n value?: string;\n /**\n * Currency code. Must be valid ISO 4217 currency code (e.g., USD).\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Monetary amount. Decimal string in local format (e.g., 1 000,30). Optionally, a single (-), to indicate that the amount is negative.\n * @readonly\n * @maxLength 100\n */\n formattedValue?: string | null;\n}\n\n/**\n * The purchase's payment state. `ListPurchases` returns only ACTIVE and CANCELED; the other values are for a\n * back-office.\n */\nexport enum Status {\n /** Checkout started; nothing paid yet. */\n INITIALIZED = 'INITIALIZED',\n /** Payment submitted but not confirmed yet. */\n PENDING = 'PENDING',\n /** Paid. Grants access. A partial refund keeps the purchase ACTIVE. */\n ACTIVE = 'ACTIVE',\n /** Canceled. It still grants access until `expiration_date`, and is returned until then. */\n CANCELED = 'CANCELED',\n /** Past `expiration_date`; reported even if the stored status has not been updated yet. */\n EXPIRED = 'EXPIRED',\n /** The payment was declined. */\n DECLINED = 'DECLINED',\n /** The payment was fully refunded. No longer grants access. */\n REFUNDED = 'REFUNDED',\n /** The legacy subscription's recurring payments are suspended. No longer grants access. */\n SUSPENDED = 'SUSPENDED',\n /** The payment failed. Set only by the legacy payment flow. */\n FAILED = 'FAILED',\n}\n\n/** @enumType */\nexport type StatusWithLiterals =\n | Status\n | 'INITIALIZED'\n | 'PENDING'\n | 'ACTIVE'\n | 'CANCELED'\n | 'EXPIRED'\n | 'DECLINED'\n | 'REFUNDED'\n | 'SUSPENDED'\n | 'FAILED';\n\nexport interface ListPurchasesRequest extends ListPurchasesRequestScopeOneOf {\n /**\n * A channel: returns the caller's purchases of videos in the channel, and their legacy subscription to it.\n * @format GUID\n */\n channelId?: string;\n /**\n * A single video: returns the caller's purchases of that video, at most one SALE and one RENT. Use it for a\n * single-video player.\n * @format GUID\n */\n videoId?: string;\n /** Paging. Limit defaults to 100, max 100. */\n paging?: CursorPaging;\n}\n\n/** @oneof */\nexport interface ListPurchasesRequestScopeOneOf {\n /**\n * A channel: returns the caller's purchases of videos in the channel, and their legacy subscription to it.\n * @format GUID\n */\n channelId?: string;\n /**\n * A single video: returns the caller's purchases of that video, at most one SALE and one RENT. Use it for a\n * single-video player.\n * @format GUID\n */\n videoId?: string;\n}\n\nexport interface CursorPaging {\n /**\n * Maximum number of items to return in the results.\n * @max 100\n */\n limit?: number | null;\n /**\n * Pointer to the next or previous page in the list of results.\n *\n * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.\n * Not relevant for the first request.\n * @maxLength 16000\n */\n cursor?: string | null;\n}\n\nexport interface ListPurchasesResponse {\n /** The caller's purchases that currently grant access. */\n purchases?: Purchase[];\n /** Cursors for the next and previous pages. */\n pagingMetadata?: CursorPagingMetadata;\n}\n\nexport interface CursorPagingMetadata {\n /** Number of items returned in current page. */\n count?: number | null;\n /** Cursor strings that point to the next page, previous page, or both. */\n cursors?: Cursors;\n /**\n * Whether there are more pages to retrieve following the current page.\n *\n * + `true`: Another page of results can be retrieved.\n * + `false`: This is the last page.\n */\n hasNext?: boolean | null;\n /**\n * Total number of items matching the filter.\n * Available only on the first page of *Search* results, not included in *Query* or *List* results.\n * If the Search results span multiple pages, the value of `total` will exceed the number of items returned on the first page.\n * @internal\n */\n total?: number | null;\n}\n\nexport interface Cursors {\n /**\n * Cursor string pointing to the next page in the list of results.\n * @maxLength 16000\n */\n next?: string | null;\n /**\n * Cursor pointing to the previous page in the list of results.\n * @maxLength 16000\n */\n prev?: string | null;\n}\n\n/**\n * Lists the caller's purchases that currently grant access: ACTIVE, and CANCELED until `expiration_date`, the same\n * rule playback applies. Other statuses are never returned. Pricing-plan access is not a purchase and isn't\n * returned; check it with Wix Pricing Plans. Only site members and visitors can call it. A visitor\n * who isn't a site member gets an empty list, not an error.\n * @internal\n * @documentationMaturity preview\n * @permissionId video:v4:purchase:list_purchases\n * @fqn wix.video.v4.PurchasesService.ListPurchases\n */\nexport async function listPurchases(\n options?: ListPurchasesOptions\n): Promise<\n NonNullablePaths<\n ListPurchasesResponse,\n | `purchases`\n | `purchases.${number}.channelId`\n | `purchases.${number}.videoId`\n | `purchases.${number}._id`\n | `purchases.${number}.type`\n | `purchases.${number}.price.value`\n | `purchases.${number}.price.currency`\n | `purchases.${number}.status`,\n 3\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n channelId: options?.channelId,\n videoId: options?.videoId,\n paging: options?.paging,\n });\n\n const reqOpts = ambassadorWixVideoV4Purchase.listPurchases(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n channelId: '$[0].channelId',\n videoId: '$[0].videoId',\n paging: '$[0].paging',\n },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface ListPurchasesOptions extends ListPurchasesOptionsScopeOneOf {\n /**\n * A channel: returns the caller's purchases of videos in the channel, and their legacy subscription to it.\n * @format GUID\n */\n channelId?: string;\n /**\n * A single video: returns the caller's purchases of that video, at most one SALE and one RENT. Use it for a\n * single-video player.\n * @format GUID\n */\n videoId?: string;\n /** Paging. Limit defaults to 100, max 100. */\n paging?: CursorPaging;\n}\n\n/** @oneof */\nexport interface ListPurchasesOptionsScopeOneOf {\n /**\n * A channel: returns the caller's purchases of videos in the channel, and their legacy subscription to it.\n * @format GUID\n */\n channelId?: string;\n /**\n * A single video: returns the caller's purchases of that video, at most one SALE and one RENT. Use it for a\n * single-video player.\n * @format GUID\n */\n videoId?: string;\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nconst TRANSFORM_PATHS_0 = [\n { path: 'purchases.startedDate' },\n { path: 'purchases.expirationDate' },\n { path: 'purchases.createdDate' },\n { path: 'purchases.updatedDate' },\n];\n\nfunction resolveWixVideoV4PurchasesServiceUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'manage._base_domain_': [\n {\n srcPath: '/_api/vod/public',\n destPath: '/_api/vod/public',\n },\n ],\n _: [\n {\n srcPath: '/_api/vod/public',\n destPath: '/_api/vod/public',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/vod/public',\n destPath: '/_api/vod/public',\n },\n ],\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-vod-backend-public',\n destPath: '',\n },\n ],\n 'editor.wixapps.net': [\n {\n srcPath: '/_api/vod/public',\n destPath: '/_api/vod/public',\n },\n ],\n 'bo._base_domain_': [\n {\n srcPath: '/_api/vod/public',\n destPath: '/_api/vod/public',\n },\n ],\n 'wixbo.ai': [\n {\n srcPath: '/_api/vod/public',\n destPath: '/_api/vod/public',\n },\n ],\n 'wix-bo.com': [\n {\n srcPath: '/_api/vod/public',\n destPath: '/_api/vod/public',\n },\n ],\n 'wix-vod-embed-video.wixapps.net': [\n {\n srcPath: '/_api/vod/public',\n destPath: '/_api/vod/public',\n },\n ],\n 'embed._base_domain_': [\n {\n srcPath: '/_api/vod/public',\n destPath: '/_api/vod/public',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_vod_purchases';\n\n/**\n * Lists the caller's purchases that currently grant access: ACTIVE, and CANCELED until `expiration_date`, the same\n * rule playback applies. Other statuses are never returned. Pricing-plan access is not a purchase and isn't\n * returned; check it with Wix Pricing Plans. Only site members and visitors can call it. A visitor\n * who isn't a site member gets an empty list, not an error.\n */\nexport function listPurchases(payload: object): RequestOptionsFactory<any> {\n function __listPurchases({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.video.v4.purchase',\n method: 'GET' as any,\n methodFqn: 'wix.video.v4.PurchasesService.ListPurchases',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixVideoV4PurchasesServiceUrl({\n protoPath: '/v4/purchases',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: TRANSFORM_PATHS_0,\n },\n ]),\n };\n\n return metadata;\n }\n\n return __listPurchases;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n ListPurchasesOptions,\n ListPurchasesResponse,\n listPurchases as universalListPurchases,\n} from './video-v4-purchase-purchases.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/vod' };\n\n/** @internal */\nexport function listPurchases(httpClient: HttpClient): ListPurchasesSignature {\n return (options?: ListPurchasesOptions) =>\n universalListPurchases(\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ListPurchasesSignature {\n /**\n * Lists the caller's purchases that currently grant access: ACTIVE, and CANCELED until `expiration_date`, the same\n * rule playback applies. Other statuses are never returned. Pricing-plan access is not a purchase and isn't\n * returned; check it with Wix Pricing Plans. Only site members and visitors can call it. A visitor\n * who isn't a site member gets an empty list, not an error.\n */\n (options?: ListPurchasesOptions): Promise<\n NonNullablePaths<\n ListPurchasesResponse,\n | `purchases`\n | `purchases.${number}.channelId`\n | `purchases.${number}.videoId`\n | `purchases.${number}._id`\n | `purchases.${number}.type`\n | `purchases.${number}.price.value`\n | `purchases.${number}.price.currency`\n | `purchases.${number}.status`,\n 3\n >\n >;\n}\n\nexport {\n CursorPaging,\n CursorPagingMetadata,\n Cursors,\n ListPurchasesOptions,\n ListPurchasesOptionsScopeOneOf,\n ListPurchasesRequest,\n ListPurchasesRequestScopeOneOf,\n ListPurchasesResponse,\n Money,\n Purchase,\n PurchaseTargetOneOf,\n Status,\n Type,\n} from './video-v4-purchase-purchases.universal.js';\n","import { listPurchases as publicListPurchases } from './video-v4-purchase-purchases.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\n/** @internal */\nexport const listPurchases: MaybeContext<\n BuildRESTFunction<typeof publicListPurchases> & typeof publicListPurchases\n> = /*#__PURE__*/ createRESTModule(publicListPurchases);\n\nexport { Type, Status } from './video-v4-purchase-purchases.universal.js';\nexport {\n Purchase,\n PurchaseTargetOneOf,\n Money,\n ListPurchasesRequest,\n ListPurchasesRequestScopeOneOf,\n CursorPaging,\n ListPurchasesResponse,\n CursorPagingMetadata,\n Cursors,\n ListPurchasesOptions,\n ListPurchasesOptionsScopeOneOf,\n} from './video-v4-purchase-purchases.universal.js';\nexport {\n TypeWithLiterals,\n StatusWithLiterals,\n} from './video-v4-purchase-purchases.universal.js';\n"],"mappings":"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","names":["listPurchases","import_rest_modules","payload","Type","Status","listPurchases","sdkTransformError","listPurchases","import_rest_modules","listPurchases"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CursorPaging, CursorPagingMetadata, Cursors, ListPurchasesOptions, ListPurchasesOptionsScopeOneOf, ListPurchasesRequest, ListPurchasesRequestScopeOneOf, ListPurchasesResponse, Money, Purchase, PurchaseTargetOneOf, Status, StatusWithLiterals, Type, TypeWithLiterals } from './index.js';
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// index.typings.ts
|
|
21
|
+
var index_typings_exports = {};
|
|
22
|
+
__export(index_typings_exports, {
|
|
23
|
+
Status: () => Status,
|
|
24
|
+
Type: () => Type,
|
|
25
|
+
listPurchases: () => listPurchases2
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(index_typings_exports);
|
|
28
|
+
|
|
29
|
+
// src/video-v4-purchase-purchases.universal.ts
|
|
30
|
+
var import_transform_error = require("@wix/sdk-runtime/transform-error");
|
|
31
|
+
var import_rename_all_nested_keys = require("@wix/sdk-runtime/rename-all-nested-keys");
|
|
32
|
+
|
|
33
|
+
// src/video-v4-purchase-purchases.http.ts
|
|
34
|
+
var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
|
|
35
|
+
var import_timestamp = require("@wix/sdk-runtime/transformations/timestamp");
|
|
36
|
+
var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
|
|
37
|
+
var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
|
|
38
|
+
var TRANSFORM_PATHS_0 = [
|
|
39
|
+
{ path: "purchases.startedDate" },
|
|
40
|
+
{ path: "purchases.expirationDate" },
|
|
41
|
+
{ path: "purchases.createdDate" },
|
|
42
|
+
{ path: "purchases.updatedDate" }
|
|
43
|
+
];
|
|
44
|
+
function resolveWixVideoV4PurchasesServiceUrl(opts) {
|
|
45
|
+
const domainToMappings = {
|
|
46
|
+
"manage._base_domain_": [
|
|
47
|
+
{
|
|
48
|
+
srcPath: "/_api/vod/public",
|
|
49
|
+
destPath: "/_api/vod/public"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
_: [
|
|
53
|
+
{
|
|
54
|
+
srcPath: "/_api/vod/public",
|
|
55
|
+
destPath: "/_api/vod/public"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"www._base_domain_": [
|
|
59
|
+
{
|
|
60
|
+
srcPath: "/_api/vod/public",
|
|
61
|
+
destPath: "/_api/vod/public"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"api._api_base_domain_": [
|
|
65
|
+
{
|
|
66
|
+
srcPath: "/wix-vod-backend-public",
|
|
67
|
+
destPath: ""
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
"editor.wixapps.net": [
|
|
71
|
+
{
|
|
72
|
+
srcPath: "/_api/vod/public",
|
|
73
|
+
destPath: "/_api/vod/public"
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"bo._base_domain_": [
|
|
77
|
+
{
|
|
78
|
+
srcPath: "/_api/vod/public",
|
|
79
|
+
destPath: "/_api/vod/public"
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
"wixbo.ai": [
|
|
83
|
+
{
|
|
84
|
+
srcPath: "/_api/vod/public",
|
|
85
|
+
destPath: "/_api/vod/public"
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"wix-bo.com": [
|
|
89
|
+
{
|
|
90
|
+
srcPath: "/_api/vod/public",
|
|
91
|
+
destPath: "/_api/vod/public"
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
"wix-vod-embed-video.wixapps.net": [
|
|
95
|
+
{
|
|
96
|
+
srcPath: "/_api/vod/public",
|
|
97
|
+
destPath: "/_api/vod/public"
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
"embed._base_domain_": [
|
|
101
|
+
{
|
|
102
|
+
srcPath: "/_api/vod/public",
|
|
103
|
+
destPath: "/_api/vod/public"
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
};
|
|
107
|
+
return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
108
|
+
}
|
|
109
|
+
var PACKAGE_NAME = "@wix/auto_sdk_vod_purchases";
|
|
110
|
+
function listPurchases(payload) {
|
|
111
|
+
function __listPurchases({ host }) {
|
|
112
|
+
const metadata = {
|
|
113
|
+
entityFqdn: "wix.video.v4.purchase",
|
|
114
|
+
method: "GET",
|
|
115
|
+
methodFqn: "wix.video.v4.PurchasesService.ListPurchases",
|
|
116
|
+
packageName: PACKAGE_NAME,
|
|
117
|
+
migrationOptions: {
|
|
118
|
+
optInTransformResponse: true
|
|
119
|
+
},
|
|
120
|
+
url: resolveWixVideoV4PurchasesServiceUrl({
|
|
121
|
+
protoPath: "/v4/purchases",
|
|
122
|
+
data: payload,
|
|
123
|
+
host
|
|
124
|
+
}),
|
|
125
|
+
params: (0, import_rest_modules.toURLSearchParams)(payload),
|
|
126
|
+
transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
|
|
127
|
+
{
|
|
128
|
+
transformFn: import_timestamp.transformRESTTimestampToSDKTimestamp,
|
|
129
|
+
paths: TRANSFORM_PATHS_0
|
|
130
|
+
}
|
|
131
|
+
])
|
|
132
|
+
};
|
|
133
|
+
return metadata;
|
|
134
|
+
}
|
|
135
|
+
return __listPurchases;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// src/video-v4-purchase-purchases.universal.ts
|
|
139
|
+
var Type = /* @__PURE__ */ ((Type2) => {
|
|
140
|
+
Type2["SUBSCRIPTION"] = "SUBSCRIPTION";
|
|
141
|
+
Type2["SALE"] = "SALE";
|
|
142
|
+
Type2["RENT"] = "RENT";
|
|
143
|
+
return Type2;
|
|
144
|
+
})(Type || {});
|
|
145
|
+
var Status = /* @__PURE__ */ ((Status2) => {
|
|
146
|
+
Status2["INITIALIZED"] = "INITIALIZED";
|
|
147
|
+
Status2["PENDING"] = "PENDING";
|
|
148
|
+
Status2["ACTIVE"] = "ACTIVE";
|
|
149
|
+
Status2["CANCELED"] = "CANCELED";
|
|
150
|
+
Status2["EXPIRED"] = "EXPIRED";
|
|
151
|
+
Status2["DECLINED"] = "DECLINED";
|
|
152
|
+
Status2["REFUNDED"] = "REFUNDED";
|
|
153
|
+
Status2["SUSPENDED"] = "SUSPENDED";
|
|
154
|
+
Status2["FAILED"] = "FAILED";
|
|
155
|
+
return Status2;
|
|
156
|
+
})(Status || {});
|
|
157
|
+
async function listPurchases2(options) {
|
|
158
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
159
|
+
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
160
|
+
channelId: options?.channelId,
|
|
161
|
+
videoId: options?.videoId,
|
|
162
|
+
paging: options?.paging
|
|
163
|
+
});
|
|
164
|
+
const reqOpts = listPurchases(payload);
|
|
165
|
+
sideEffects?.onSiteCall?.();
|
|
166
|
+
try {
|
|
167
|
+
const result = await httpClient.request(reqOpts);
|
|
168
|
+
sideEffects?.onSuccess?.(result);
|
|
169
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
170
|
+
} catch (err) {
|
|
171
|
+
const transformedError = (0, import_transform_error.transformError)(
|
|
172
|
+
err,
|
|
173
|
+
{
|
|
174
|
+
spreadPathsToArguments: {},
|
|
175
|
+
explicitPathsToArguments: {
|
|
176
|
+
channelId: "$[0].channelId",
|
|
177
|
+
videoId: "$[0].videoId",
|
|
178
|
+
paging: "$[0].paging"
|
|
179
|
+
},
|
|
180
|
+
singleArgumentUnchanged: false
|
|
181
|
+
},
|
|
182
|
+
["options"]
|
|
183
|
+
);
|
|
184
|
+
sideEffects?.onError?.(err);
|
|
185
|
+
throw transformedError;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
189
|
+
0 && (module.exports = {
|
|
190
|
+
Status,
|
|
191
|
+
Type,
|
|
192
|
+
listPurchases
|
|
193
|
+
});
|
|
194
|
+
//# sourceMappingURL=index.typings.js.map
|