@kard-financial/sdk 5.0.0 → 5.2.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/README.md +1 -1
- package/dist/cjs/BaseClient.d.ts +4 -0
- package/dist/cjs/BaseClient.js +3 -2
- package/dist/cjs/api/resources/auth/client/Client.js +8 -6
- package/dist/cjs/api/resources/files/client/Client.js +8 -6
- package/dist/cjs/api/resources/notifications/resources/subscriptions/client/Client.js +24 -18
- package/dist/cjs/api/resources/ping/client/Client.js +8 -6
- package/dist/cjs/api/resources/transactions/client/Client.js +40 -30
- package/dist/cjs/api/resources/users/client/Client.js +32 -24
- package/dist/cjs/api/resources/users/resources/attributions/client/Client.js +24 -18
- package/dist/cjs/api/resources/users/resources/auth/client/Client.js +8 -6
- package/dist/cjs/api/resources/users/resources/rewards/client/Client.js +16 -12
- package/dist/cjs/api/resources/users/resources/rewards/types/ComponentType.d.ts +1 -0
- package/dist/cjs/api/resources/users/resources/rewards/types/ComponentType.js +1 -0
- package/dist/cjs/api/resources/users/resources/rewards/types/OfferComponents.d.ts +2 -0
- package/dist/cjs/api/resources/users/resources/rewards/types/ProgressBar.d.ts +13 -0
- package/dist/cjs/api/resources/users/resources/rewards/types/ProgressBar.js +3 -0
- package/dist/cjs/api/resources/users/resources/rewards/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/users/resources/rewards/types/index.js +1 -0
- package/dist/cjs/api/resources/users/resources/uploads/client/Client.js +24 -18
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +4 -0
- package/dist/esm/BaseClient.mjs +3 -2
- package/dist/esm/api/resources/auth/client/Client.mjs +9 -7
- package/dist/esm/api/resources/files/client/Client.mjs +9 -7
- package/dist/esm/api/resources/notifications/resources/subscriptions/client/Client.mjs +25 -19
- package/dist/esm/api/resources/ping/client/Client.mjs +9 -7
- package/dist/esm/api/resources/transactions/client/Client.mjs +41 -31
- package/dist/esm/api/resources/users/client/Client.mjs +33 -25
- package/dist/esm/api/resources/users/resources/attributions/client/Client.mjs +25 -19
- package/dist/esm/api/resources/users/resources/auth/client/Client.mjs +9 -7
- package/dist/esm/api/resources/users/resources/rewards/client/Client.mjs +17 -13
- package/dist/esm/api/resources/users/resources/rewards/types/ComponentType.d.mts +1 -0
- package/dist/esm/api/resources/users/resources/rewards/types/ComponentType.mjs +1 -0
- package/dist/esm/api/resources/users/resources/rewards/types/OfferComponents.d.mts +2 -0
- package/dist/esm/api/resources/users/resources/rewards/types/ProgressBar.d.mts +13 -0
- package/dist/esm/api/resources/users/resources/rewards/types/ProgressBar.mjs +2 -0
- package/dist/esm/api/resources/users/resources/rewards/types/index.d.mts +1 -0
- package/dist/esm/api/resources/users/resources/rewards/types/index.mjs +1 -0
- package/dist/esm/api/resources/users/resources/uploads/client/Client.mjs +25 -19
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
|
@@ -102,21 +102,23 @@ class AttributionsClient {
|
|
|
102
102
|
}
|
|
103
103
|
__create(organizationId, userId, request, requestOptions) {
|
|
104
104
|
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
105
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
106
106
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
107
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
107
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
108
|
+
"X-Kard-Target-Issuer": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.xKardTargetIssuer) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.xKardTargetIssuer,
|
|
109
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
108
110
|
const _response = yield core.fetcher({
|
|
109
|
-
url: core.url.join((
|
|
111
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.KardApiEnvironment.Production, `/v2/issuers/${core.url.encodePathParam(organizationId)}/users/${core.url.encodePathParam(userId)}/attributions`),
|
|
110
112
|
method: "POST",
|
|
111
113
|
headers: _headers,
|
|
112
114
|
contentType: "application/json",
|
|
113
115
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
114
116
|
requestType: "json",
|
|
115
117
|
body: request,
|
|
116
|
-
timeoutMs: ((
|
|
117
|
-
maxRetries: (
|
|
118
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
119
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
118
120
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
119
|
-
fetchFn: (
|
|
121
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
120
122
|
logging: this._options.logging,
|
|
121
123
|
});
|
|
122
124
|
if (_response.ok) {
|
|
@@ -185,7 +187,7 @@ class AttributionsClient {
|
|
|
185
187
|
}
|
|
186
188
|
__activate(organizationId_1, userId_1, offerId_1) {
|
|
187
189
|
return __awaiter(this, arguments, void 0, function* (organizationId, userId, offerId, request = {}, requestOptions) {
|
|
188
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
190
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
189
191
|
const { supportedComponents, include } = request;
|
|
190
192
|
const _queryParams = {};
|
|
191
193
|
if (supportedComponents != null) {
|
|
@@ -205,16 +207,18 @@ class AttributionsClient {
|
|
|
205
207
|
}
|
|
206
208
|
}
|
|
207
209
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
208
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
210
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
211
|
+
"X-Kard-Target-Issuer": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.xKardTargetIssuer) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.xKardTargetIssuer,
|
|
212
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
209
213
|
const _response = yield core.fetcher({
|
|
210
|
-
url: core.url.join((
|
|
214
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.KardApiEnvironment.Production, `/v2/issuers/${core.url.encodePathParam(organizationId)}/users/${core.url.encodePathParam(userId)}/offers/${core.url.encodePathParam(offerId)}/activate`),
|
|
211
215
|
method: "POST",
|
|
212
216
|
headers: _headers,
|
|
213
217
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
214
|
-
timeoutMs: ((
|
|
215
|
-
maxRetries: (
|
|
218
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
219
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
216
220
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
217
|
-
fetchFn: (
|
|
221
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
218
222
|
logging: this._options.logging,
|
|
219
223
|
});
|
|
220
224
|
if (_response.ok) {
|
|
@@ -280,7 +284,7 @@ class AttributionsClient {
|
|
|
280
284
|
}
|
|
281
285
|
__boost(organizationId_1, userId_1, offerId_1) {
|
|
282
286
|
return __awaiter(this, arguments, void 0, function* (organizationId, userId, offerId, request = {}, requestOptions) {
|
|
283
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
287
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
284
288
|
const { supportedComponents, include } = request;
|
|
285
289
|
const _queryParams = {};
|
|
286
290
|
if (supportedComponents != null) {
|
|
@@ -300,16 +304,18 @@ class AttributionsClient {
|
|
|
300
304
|
}
|
|
301
305
|
}
|
|
302
306
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
303
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
307
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
308
|
+
"X-Kard-Target-Issuer": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.xKardTargetIssuer) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.xKardTargetIssuer,
|
|
309
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
304
310
|
const _response = yield core.fetcher({
|
|
305
|
-
url: core.url.join((
|
|
311
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.KardApiEnvironment.Production, `/v2/issuers/${core.url.encodePathParam(organizationId)}/users/${core.url.encodePathParam(userId)}/offers/${core.url.encodePathParam(offerId)}/boost`),
|
|
306
312
|
method: "POST",
|
|
307
313
|
headers: _headers,
|
|
308
314
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
309
|
-
timeoutMs: ((
|
|
310
|
-
maxRetries: (
|
|
315
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
316
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
311
317
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
312
|
-
fetchFn: (
|
|
318
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
313
319
|
logging: this._options.logging,
|
|
314
320
|
});
|
|
315
321
|
if (_response.ok) {
|
|
@@ -72,18 +72,20 @@ class AuthClient {
|
|
|
72
72
|
}
|
|
73
73
|
__getWebViewToken(organizationId, userId, requestOptions) {
|
|
74
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
75
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
76
76
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
77
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
77
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
78
|
+
"X-Kard-Target-Issuer": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.xKardTargetIssuer) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.xKardTargetIssuer,
|
|
79
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
78
80
|
const _response = yield core.fetcher({
|
|
79
|
-
url: core.url.join((
|
|
81
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.KardApiEnvironment.Production, `/v2/auth/issuers/${core.url.encodePathParam(organizationId)}/users/${core.url.encodePathParam(userId)}/token`),
|
|
80
82
|
method: "POST",
|
|
81
83
|
headers: _headers,
|
|
82
84
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
83
|
-
timeoutMs: ((
|
|
84
|
-
maxRetries: (
|
|
85
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
86
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
85
87
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
86
|
-
fetchFn: (
|
|
88
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
87
89
|
logging: this._options.logging,
|
|
88
90
|
});
|
|
89
91
|
if (_response.ok) {
|
|
@@ -83,7 +83,7 @@ class RewardsClient {
|
|
|
83
83
|
}
|
|
84
84
|
__offers(organizationId_1, userId_1) {
|
|
85
85
|
return __awaiter(this, arguments, void 0, function* (organizationId, userId, request = {}, requestOptions) {
|
|
86
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
86
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
87
87
|
const { "page[size]": pageSize, "page[after]": pageAfter, "page[before]": pageBefore, "filter[search]": filterSearch, "filter[purchaseChannel]": filterPurchaseChannel, "filter[category]": filterCategory, "filter[isTargeted]": filterIsTargeted, sort, include, supportedComponents, } = request;
|
|
88
88
|
const _queryParams = {};
|
|
89
89
|
if (pageSize != null) {
|
|
@@ -132,16 +132,18 @@ class RewardsClient {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
135
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
135
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
136
|
+
"X-Kard-Target-Issuer": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.xKardTargetIssuer) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.xKardTargetIssuer,
|
|
137
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
136
138
|
const _response = yield core.fetcher({
|
|
137
|
-
url: core.url.join((
|
|
139
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.KardApiEnvironment.Production, `/v2/issuers/${core.url.encodePathParam(organizationId)}/users/${core.url.encodePathParam(userId)}/offers`),
|
|
138
140
|
method: "GET",
|
|
139
141
|
headers: _headers,
|
|
140
142
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
141
|
-
timeoutMs: ((
|
|
142
|
-
maxRetries: (
|
|
143
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
144
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
143
145
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
144
|
-
fetchFn: (
|
|
146
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
145
147
|
logging: this._options.logging,
|
|
146
148
|
});
|
|
147
149
|
if (_response.ok) {
|
|
@@ -219,7 +221,7 @@ class RewardsClient {
|
|
|
219
221
|
}
|
|
220
222
|
__locations(organizationId_1, userId_1) {
|
|
221
223
|
return __awaiter(this, arguments, void 0, function* (organizationId, userId, request = {}, requestOptions) {
|
|
222
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
224
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
223
225
|
const { "page[size]": pageSize, "page[after]": pageAfter, "page[before]": pageBefore, "filter[name]": filterName, "filter[city]": filterCity, "filter[zipCode]": filterZipCode, "filter[state]": filterState, "filter[category]": filterCategory, "filter[longitude]": filterLongitude, "filter[latitude]": filterLatitude, "filter[radius]": filterRadius, sort, include, supportedComponents, } = request;
|
|
224
226
|
const _queryParams = {};
|
|
225
227
|
if (pageSize != null) {
|
|
@@ -280,16 +282,18 @@ class RewardsClient {
|
|
|
280
282
|
}
|
|
281
283
|
}
|
|
282
284
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
283
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
285
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
286
|
+
"X-Kard-Target-Issuer": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.xKardTargetIssuer) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.xKardTargetIssuer,
|
|
287
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
284
288
|
const _response = yield core.fetcher({
|
|
285
|
-
url: core.url.join((
|
|
289
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.KardApiEnvironment.Production, `/v2/issuers/${core.url.encodePathParam(organizationId)}/users/${core.url.encodePathParam(userId)}/locations`),
|
|
286
290
|
method: "GET",
|
|
287
291
|
headers: _headers,
|
|
288
292
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
289
|
-
timeoutMs: ((
|
|
290
|
-
maxRetries: (
|
|
293
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
294
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
291
295
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
292
|
-
fetchFn: (
|
|
296
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
293
297
|
logging: this._options.logging,
|
|
294
298
|
});
|
|
295
299
|
if (_response.ok) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Progress bar component for tracking offer redemption progress
|
|
3
|
+
*/
|
|
4
|
+
export interface ProgressBar {
|
|
5
|
+
/** Total number of redemptions allowed */
|
|
6
|
+
total: number;
|
|
7
|
+
/** Number of redemptions the user has completed */
|
|
8
|
+
currentProgress: number;
|
|
9
|
+
/** Formatted label for the progress bar */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Whether the progress bar should be displayed as segmented */
|
|
12
|
+
segmented: boolean;
|
|
13
|
+
}
|
|
@@ -36,6 +36,7 @@ export * from "./OffersResponseObject.js";
|
|
|
36
36
|
export * from "./OperationHours.js";
|
|
37
37
|
export * from "./OperationPeriod.js";
|
|
38
38
|
export * from "./OperationTime.js";
|
|
39
|
+
export * from "./ProgressBar.js";
|
|
39
40
|
export * from "./StandardOffer.js";
|
|
40
41
|
export * from "./StandardOfferCore.js";
|
|
41
42
|
export * from "./StandardOfferFields.js";
|
|
@@ -52,6 +52,7 @@ __exportStar(require("./OffersResponseObject.js"), exports);
|
|
|
52
52
|
__exportStar(require("./OperationHours.js"), exports);
|
|
53
53
|
__exportStar(require("./OperationPeriod.js"), exports);
|
|
54
54
|
__exportStar(require("./OperationTime.js"), exports);
|
|
55
|
+
__exportStar(require("./ProgressBar.js"), exports);
|
|
55
56
|
__exportStar(require("./StandardOffer.js"), exports);
|
|
56
57
|
__exportStar(require("./StandardOfferCore.js"), exports);
|
|
57
58
|
__exportStar(require("./StandardOfferFields.js"), exports);
|
|
@@ -81,21 +81,23 @@ class UploadsClient {
|
|
|
81
81
|
}
|
|
82
82
|
__create(organizationId, userId, request, requestOptions) {
|
|
83
83
|
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
84
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
85
85
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
86
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
86
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
87
|
+
"X-Kard-Target-Issuer": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.xKardTargetIssuer) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.xKardTargetIssuer,
|
|
88
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
87
89
|
const _response = yield core.fetcher({
|
|
88
|
-
url: core.url.join((
|
|
90
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.KardApiEnvironment.Production, `/v2/issuers/${core.url.encodePathParam(organizationId)}/users/${core.url.encodePathParam(userId)}/uploads`),
|
|
89
91
|
method: "POST",
|
|
90
92
|
headers: _headers,
|
|
91
93
|
contentType: "application/json",
|
|
92
94
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
93
95
|
requestType: "json",
|
|
94
96
|
body: request,
|
|
95
|
-
timeoutMs: ((
|
|
96
|
-
maxRetries: (
|
|
97
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
98
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
97
99
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
98
|
-
fetchFn: (
|
|
100
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
99
101
|
logging: this._options.logging,
|
|
100
102
|
});
|
|
101
103
|
if (_response.ok) {
|
|
@@ -203,21 +205,23 @@ class UploadsClient {
|
|
|
203
205
|
}
|
|
204
206
|
__createPart(organizationId, userId, uploadId, request, requestOptions) {
|
|
205
207
|
return __awaiter(this, void 0, void 0, function* () {
|
|
206
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
208
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
207
209
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
208
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
210
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
211
|
+
"X-Kard-Target-Issuer": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.xKardTargetIssuer) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.xKardTargetIssuer,
|
|
212
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
209
213
|
const _response = yield core.fetcher({
|
|
210
|
-
url: core.url.join((
|
|
214
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.KardApiEnvironment.Production, `/v2/issuers/${core.url.encodePathParam(organizationId)}/users/${core.url.encodePathParam(userId)}/uploads/${core.url.encodePathParam(uploadId)}/parts`),
|
|
211
215
|
method: "PUT",
|
|
212
216
|
headers: _headers,
|
|
213
217
|
contentType: "application/json",
|
|
214
218
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
215
219
|
requestType: "json",
|
|
216
220
|
body: request,
|
|
217
|
-
timeoutMs: ((
|
|
218
|
-
maxRetries: (
|
|
221
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
222
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
219
223
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
220
|
-
fetchFn: (
|
|
224
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
221
225
|
logging: this._options.logging,
|
|
222
226
|
});
|
|
223
227
|
if (_response.ok) {
|
|
@@ -295,21 +299,23 @@ class UploadsClient {
|
|
|
295
299
|
}
|
|
296
300
|
__update(organizationId, userId, uploadId, request, requestOptions) {
|
|
297
301
|
return __awaiter(this, void 0, void 0, function* () {
|
|
298
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
302
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
299
303
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
300
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
304
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
305
|
+
"X-Kard-Target-Issuer": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.xKardTargetIssuer) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.xKardTargetIssuer,
|
|
306
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
301
307
|
const _response = yield core.fetcher({
|
|
302
|
-
url: core.url.join((
|
|
308
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.KardApiEnvironment.Production, `/v2/issuers/${core.url.encodePathParam(organizationId)}/users/${core.url.encodePathParam(userId)}/uploads/${core.url.encodePathParam(uploadId)}`),
|
|
303
309
|
method: "PUT",
|
|
304
310
|
headers: _headers,
|
|
305
311
|
contentType: "application/json",
|
|
306
312
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
307
313
|
requestType: "json",
|
|
308
314
|
body: request,
|
|
309
|
-
timeoutMs: ((
|
|
310
|
-
maxRetries: (
|
|
315
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
316
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
311
317
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
312
|
-
fetchFn: (
|
|
318
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
313
319
|
logging: this._options.logging,
|
|
314
320
|
});
|
|
315
321
|
if (_response.ok) {
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "5.
|
|
1
|
+
export declare const SDK_VERSION = "5.2.0";
|
package/dist/cjs/version.js
CHANGED
|
@@ -6,6 +6,8 @@ export interface BaseClientOptions {
|
|
|
6
6
|
baseUrl?: core.Supplier<string>;
|
|
7
7
|
clientId?: core.Supplier<string>;
|
|
8
8
|
clientSecret?: core.Supplier<string>;
|
|
9
|
+
/** Override the X-Kard-Target-Issuer header */
|
|
10
|
+
xKardTargetIssuer?: core.Supplier<string | undefined>;
|
|
9
11
|
/** Additional headers to include in requests. */
|
|
10
12
|
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
11
13
|
/** The default maximum time to wait for a response in seconds. */
|
|
@@ -24,6 +26,8 @@ export interface BaseRequestOptions {
|
|
|
24
26
|
maxRetries?: number;
|
|
25
27
|
/** A hook to abort the request. */
|
|
26
28
|
abortSignal?: AbortSignal;
|
|
29
|
+
/** Override the X-Kard-Target-Issuer header */
|
|
30
|
+
xKardTargetIssuer?: string | undefined;
|
|
27
31
|
/** Additional query string parameters to include in the request. */
|
|
28
32
|
queryParams?: Record<string, unknown>;
|
|
29
33
|
/** Additional headers to include in the request. */
|
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,10 +6,11 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "@kard-financial/sdk",
|
|
9
|
-
"X-Fern-SDK-Version": "5.
|
|
10
|
-
"User-Agent": "@kard-financial/sdk/5.
|
|
9
|
+
"X-Fern-SDK-Version": "5.2.0",
|
|
10
|
+
"User-Agent": "@kard-financial/sdk/5.2.0",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
|
+
"X-Kard-Target-Issuer": options === null || options === void 0 ? void 0 : options.xKardTargetIssuer,
|
|
13
14
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
14
15
|
return Object.assign(Object.assign({}, options), { logging: core.logging.createLogger(options === null || options === void 0 ? void 0 : options.logging), headers });
|
|
15
16
|
}
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
import { normalizeClientOptions } from "../../../../BaseClient.mjs";
|
|
12
|
-
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
12
|
+
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
|
|
13
13
|
import * as core from "../../../../core/index.mjs";
|
|
14
14
|
import * as environments from "../../../../environments.mjs";
|
|
15
15
|
import * as errors from "../../../../errors/index.mjs";
|
|
@@ -32,20 +32,22 @@ export class AuthClient {
|
|
|
32
32
|
}
|
|
33
33
|
__getToken(request, requestOptions) {
|
|
34
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
36
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
35
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
36
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
37
|
+
"X-Kard-Target-Issuer": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.xKardTargetIssuer) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.xKardTargetIssuer,
|
|
38
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
37
39
|
const _response = yield core.fetcher({
|
|
38
|
-
url: core.url.join((
|
|
40
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.KardApiEnvironment.Production, "/v2/auth/token"),
|
|
39
41
|
method: "POST",
|
|
40
42
|
headers: _headers,
|
|
41
43
|
contentType: "application/json",
|
|
42
44
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
43
45
|
requestType: "json",
|
|
44
46
|
body: request,
|
|
45
|
-
timeoutMs: ((
|
|
46
|
-
maxRetries: (
|
|
47
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
48
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
47
49
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
48
|
-
fetchFn: (
|
|
50
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
49
51
|
logging: this._options.logging,
|
|
50
52
|
});
|
|
51
53
|
if (_response.ok) {
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
12
|
-
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
12
|
+
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
|
|
13
13
|
import * as core from "../../../../core/index.mjs";
|
|
14
14
|
import * as environments from "../../../../environments.mjs";
|
|
15
15
|
import * as errors from "../../../../errors/index.mjs";
|
|
@@ -47,7 +47,7 @@ export class FilesClient {
|
|
|
47
47
|
}
|
|
48
48
|
__getMetadata(organizationId_1) {
|
|
49
49
|
return __awaiter(this, arguments, void 0, function* (organizationId, request = {}, requestOptions) {
|
|
50
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
50
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
51
51
|
const { "filter[dateFrom]": filterDateFrom, "filter[dateTo]": filterDateTo, "filter[fileType]": filterFileType, "page[size]": pageSize, "page[after]": pageAfter, "page[before]": pageBefore, sort, } = request;
|
|
52
52
|
const _queryParams = {};
|
|
53
53
|
if (filterDateFrom != null) {
|
|
@@ -77,16 +77,18 @@ export class FilesClient {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
80
|
-
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
80
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
81
|
+
"X-Kard-Target-Issuer": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.xKardTargetIssuer) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.xKardTargetIssuer,
|
|
82
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
81
83
|
const _response = yield core.fetcher({
|
|
82
|
-
url: core.url.join((
|
|
84
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.KardApiEnvironment.Production, `v2/issuers/${core.url.encodePathParam(organizationId)}/files/metadata`),
|
|
83
85
|
method: "GET",
|
|
84
86
|
headers: _headers,
|
|
85
87
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
86
|
-
timeoutMs: ((
|
|
87
|
-
maxRetries: (
|
|
88
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
89
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
88
90
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
89
|
-
fetchFn: (
|
|
91
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
90
92
|
logging: this._options.logging,
|
|
91
93
|
});
|
|
92
94
|
if (_response.ok) {
|