@kard-financial/sdk 29.1.0 → 30.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/LICENSE +21 -0
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/users/resources/attributions/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/users/resources/attributions/client/Client.js +2 -2
- package/dist/cjs/api/resources/users/resources/rewards/client/Client.d.ts +18 -35
- package/dist/cjs/api/resources/users/resources/rewards/client/Client.js +27 -94
- package/dist/cjs/api/resources/users/resources/rewards/client/requests/GetPlacementContentRequest.d.ts +18 -0
- package/dist/cjs/api/resources/users/resources/rewards/client/requests/index.d.ts +1 -2
- package/dist/cjs/api/resources/users/resources/rewards/types/PlacementContentResponse.d.ts +5 -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/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/users/resources/attributions/client/Client.d.mts +2 -2
- package/dist/esm/api/resources/users/resources/attributions/client/Client.mjs +2 -2
- package/dist/esm/api/resources/users/resources/rewards/client/Client.d.mts +18 -35
- package/dist/esm/api/resources/users/resources/rewards/client/Client.mjs +27 -94
- package/dist/esm/api/resources/users/resources/rewards/client/requests/GetPlacementContentRequest.d.mts +18 -0
- package/dist/esm/api/resources/users/resources/rewards/client/requests/index.d.mts +1 -2
- package/dist/esm/api/resources/users/resources/rewards/types/PlacementContentResponse.d.mts +5 -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/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +16 -106
- package/dist/cjs/api/resources/users/resources/rewards/client/requests/GetBatchesByPlacementRequest.d.ts +0 -9
- package/dist/cjs/api/resources/users/resources/rewards/client/requests/GetOffersByPlacementRequest.d.ts +0 -16
- package/dist/esm/api/resources/users/resources/rewards/client/requests/GetBatchesByPlacementRequest.d.mts +0 -9
- package/dist/esm/api/resources/users/resources/rewards/client/requests/GetOffersByPlacementRequest.d.mts +0 -16
- /package/dist/cjs/api/resources/users/resources/rewards/client/requests/{GetBatchesByPlacementRequest.js → GetPlacementContentRequest.js} +0 -0
- /package/dist/cjs/api/resources/users/resources/rewards/{client/requests/GetOffersByPlacementRequest.js → types/PlacementContentResponse.js} +0 -0
- /package/dist/esm/api/resources/users/resources/rewards/client/requests/{GetBatchesByPlacementRequest.mjs → GetPlacementContentRequest.mjs} +0 -0
- /package/dist/esm/api/resources/users/resources/rewards/{client/requests/GetOffersByPlacementRequest.mjs → types/PlacementContentResponse.mjs} +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kard Financial
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "@kard-financial/sdk",
|
|
46
|
-
"X-Fern-SDK-Version": "
|
|
47
|
-
"User-Agent": "@kard-financial/sdk/
|
|
46
|
+
"X-Fern-SDK-Version": "30.0.0",
|
|
47
|
+
"User-Agent": "@kard-financial/sdk/30.0.0",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -98,8 +98,8 @@ export declare class AttributionsClient {
|
|
|
98
98
|
* `placementSlotAttribution` ACTIVATE event and fans out a per-offer
|
|
99
99
|
* `offerAttribution` ACTIVATE event for every offer resolved by the slot's content
|
|
100
100
|
* strategy. The slot-level event id and the resolved `offerIds` are returned so the
|
|
101
|
-
* partner can render the batch immediately without an extra
|
|
102
|
-
*
|
|
101
|
+
* partner can render the batch immediately without an extra round-trip to re-fetch
|
|
102
|
+
* the placement content.
|
|
103
103
|
*
|
|
104
104
|
* <b>Required scopes:</b> `attributions:write`
|
|
105
105
|
*
|
|
@@ -284,8 +284,8 @@ class AttributionsClient {
|
|
|
284
284
|
* `placementSlotAttribution` ACTIVATE event and fans out a per-offer
|
|
285
285
|
* `offerAttribution` ACTIVATE event for every offer resolved by the slot's content
|
|
286
286
|
* strategy. The slot-level event id and the resolved `offerIds` are returned so the
|
|
287
|
-
* partner can render the batch immediately without an extra
|
|
288
|
-
*
|
|
287
|
+
* partner can render the batch immediately without an extra round-trip to re-fetch
|
|
288
|
+
* the placement content.
|
|
289
289
|
*
|
|
290
290
|
* <b>Required scopes:</b> `attributions:write`
|
|
291
291
|
*
|
|
@@ -36,14 +36,21 @@ export declare class RewardsClient {
|
|
|
36
36
|
offers(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, request?: KardApi.users.GetOffersByUserRequest, requestOptions?: RewardsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.OffersResponseObject>;
|
|
37
37
|
private __offers;
|
|
38
38
|
/**
|
|
39
|
-
* Retrieve
|
|
40
|
-
*
|
|
39
|
+
* Retrieve the content for a placement. The placement type is resolved
|
|
40
|
+
* server-side so callers no longer pick an endpoint by placement type.
|
|
41
|
+
* Returns a JSON:API document whose `data` resources are self-describing
|
|
42
|
+
* by `type`: a standard placement returns `standardOffer` resources (with
|
|
43
|
+
* `links`, optional `included` categories, and `meta`); a batch-activation
|
|
44
|
+
* or group placement returns `placementBatch` slot resources. Distinguish
|
|
45
|
+
* the two by each resource's `type`. Email and push-notification
|
|
46
|
+
* placements are not servable through this endpoint and respond with a
|
|
47
|
+
* `400`.<br/>
|
|
41
48
|
* <b>Required scopes:</b> `rewards:read`
|
|
42
49
|
*
|
|
43
50
|
* @param {KardApi.OrganizationId} organizationId
|
|
44
51
|
* @param {KardApi.UserId} userId
|
|
45
52
|
* @param {string} placementId
|
|
46
|
-
* @param {KardApi.users.
|
|
53
|
+
* @param {KardApi.users.GetPlacementContentRequest} request
|
|
47
54
|
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
48
55
|
*
|
|
49
56
|
* @throws {@link KardApi.InternalServerError}
|
|
@@ -52,41 +59,17 @@ export declare class RewardsClient {
|
|
|
52
59
|
* @throws {@link KardApi.UnauthorizedError}
|
|
53
60
|
*
|
|
54
61
|
* @example
|
|
55
|
-
* await client.users.rewards.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
private __placementOffers;
|
|
59
|
-
/**
|
|
60
|
-
* Retrieve batches for a batch-activation or group placement. Returns each
|
|
61
|
-
* slot in slot order with its current offer set, alias, and freshness fields
|
|
62
|
-
* (`isActive`, `lastActivatedAt`, `expiresAt`). Applies the same per-user
|
|
63
|
-
* eligibility and per-slot content-strategy filter as Get Offers By
|
|
64
|
-
* Placement, independently per slot. For a batch-activation placement, a
|
|
65
|
-
* slot only flips to `isActive: false` when its refresh interval has elapsed
|
|
66
|
-
* AND its post-eligibility `offers[]` is non-empty; otherwise the slot is
|
|
67
|
-
* still returned and stays active so the partner UI does not promote
|
|
68
|
-
* "refresh" with nothing to show. For a group placement, slots are always
|
|
69
|
-
* active and each slot returns its offers regardless of activation state,
|
|
70
|
-
* hiding only offers that require activation (`requiredInBatch`) and have
|
|
71
|
-
* no activation record.<br/>
|
|
72
|
-
* <b>Required scopes:</b> `rewards:read`
|
|
73
|
-
*
|
|
74
|
-
* @param {KardApi.OrganizationId} organizationId
|
|
75
|
-
* @param {KardApi.UserId} userId
|
|
76
|
-
* @param {string} placementId
|
|
77
|
-
* @param {KardApi.users.GetBatchesByPlacementRequest} request
|
|
78
|
-
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
79
|
-
*
|
|
80
|
-
* @throws {@link KardApi.InternalServerError}
|
|
81
|
-
* @throws {@link KardApi.InvalidRequest}
|
|
82
|
-
* @throws {@link KardApi.DoesNotExistError}
|
|
83
|
-
* @throws {@link KardApi.UnauthorizedError}
|
|
62
|
+
* await client.users.rewards.placementContent("organization-123", "user-123", "placement-homepage-banner", {
|
|
63
|
+
* include: "categories"
|
|
64
|
+
* })
|
|
84
65
|
*
|
|
85
66
|
* @example
|
|
86
|
-
* await client.users.rewards.
|
|
67
|
+
* await client.users.rewards.placementContent("organization-123", "user-123", "placement-weekly-bundles", {
|
|
68
|
+
* supportedComponents: "baseReward"
|
|
69
|
+
* })
|
|
87
70
|
*/
|
|
88
|
-
|
|
89
|
-
private
|
|
71
|
+
placementContent(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, placementId: string, request?: KardApi.users.GetPlacementContentRequest, requestOptions?: RewardsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.PlacementContentResponse>;
|
|
72
|
+
private __placementContent;
|
|
90
73
|
/**
|
|
91
74
|
* Retrieve national and local geographic locations that a specified user has eligible in-store offers at. Use this endpoint to build
|
|
92
75
|
* out your [map-specific UX experiences](/2024-10-01/api/getting-started#c-discover-clos-near-you-map-view). Please note
|
|
@@ -140,14 +140,21 @@ class RewardsClient {
|
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
142
|
/**
|
|
143
|
-
* Retrieve
|
|
144
|
-
*
|
|
143
|
+
* Retrieve the content for a placement. The placement type is resolved
|
|
144
|
+
* server-side so callers no longer pick an endpoint by placement type.
|
|
145
|
+
* Returns a JSON:API document whose `data` resources are self-describing
|
|
146
|
+
* by `type`: a standard placement returns `standardOffer` resources (with
|
|
147
|
+
* `links`, optional `included` categories, and `meta`); a batch-activation
|
|
148
|
+
* or group placement returns `placementBatch` slot resources. Distinguish
|
|
149
|
+
* the two by each resource's `type`. Email and push-notification
|
|
150
|
+
* placements are not servable through this endpoint and respond with a
|
|
151
|
+
* `400`.<br/>
|
|
145
152
|
* <b>Required scopes:</b> `rewards:read`
|
|
146
153
|
*
|
|
147
154
|
* @param {KardApi.OrganizationId} organizationId
|
|
148
155
|
* @param {KardApi.UserId} userId
|
|
149
156
|
* @param {string} placementId
|
|
150
|
-
* @param {KardApi.users.
|
|
157
|
+
* @param {KardApi.users.GetPlacementContentRequest} request
|
|
151
158
|
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
152
159
|
*
|
|
153
160
|
* @throws {@link KardApi.InternalServerError}
|
|
@@ -156,101 +163,24 @@ class RewardsClient {
|
|
|
156
163
|
* @throws {@link KardApi.UnauthorizedError}
|
|
157
164
|
*
|
|
158
165
|
* @example
|
|
159
|
-
* await client.users.rewards.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
return core.HttpResponsePromise.fromPromise(this.__placementOffers(organizationId, userId, placementId, request, requestOptions));
|
|
163
|
-
}
|
|
164
|
-
__placementOffers(organizationId_1, userId_1, placementId_1) {
|
|
165
|
-
return __awaiter(this, arguments, void 0, function* (organizationId, userId, placementId, request = {}, requestOptions) {
|
|
166
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
167
|
-
const { "filter[search]": filterSearch, "filter[purchaseChannel]": filterPurchaseChannel, "filter[category]": filterCategory, "filter[isTargeted]": filterIsTargeted, include, supportedComponents, } = request;
|
|
168
|
-
const _queryParams = {
|
|
169
|
-
"filter[search]": filterSearch,
|
|
170
|
-
"filter[purchaseChannel]": filterPurchaseChannel != null ? (0, json_js_1.toJson)(filterPurchaseChannel) : undefined,
|
|
171
|
-
"filter[category]": filterCategory != null ? filterCategory : undefined,
|
|
172
|
-
"filter[isTargeted]": filterIsTargeted,
|
|
173
|
-
include,
|
|
174
|
-
supportedComponents: Array.isArray(supportedComponents)
|
|
175
|
-
? supportedComponents.map((item) => item)
|
|
176
|
-
: supportedComponents != null
|
|
177
|
-
? supportedComponents
|
|
178
|
-
: undefined,
|
|
179
|
-
};
|
|
180
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
181
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
182
|
-
const _response = yield core.fetcher({
|
|
183
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.KardApiEnvironment.Production, `/v2/issuers/${core.url.encodePathParam(organizationId)}/users/${core.url.encodePathParam(userId)}/placements/${core.url.encodePathParam(placementId)}/offers`),
|
|
184
|
-
method: "GET",
|
|
185
|
-
headers: _headers,
|
|
186
|
-
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
187
|
-
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
188
|
-
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
189
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
190
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
191
|
-
logging: this._options.logging,
|
|
192
|
-
});
|
|
193
|
-
if (_response.ok) {
|
|
194
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
195
|
-
}
|
|
196
|
-
if (_response.error.reason === "status-code") {
|
|
197
|
-
switch (_response.error.statusCode) {
|
|
198
|
-
case 500:
|
|
199
|
-
throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
|
|
200
|
-
case 400:
|
|
201
|
-
throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
|
|
202
|
-
case 404:
|
|
203
|
-
throw new KardApi.DoesNotExistError(_response.error.body, _response.rawResponse);
|
|
204
|
-
case 401:
|
|
205
|
-
throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
206
|
-
default:
|
|
207
|
-
throw new errors.KardApiError({
|
|
208
|
-
statusCode: _response.error.statusCode,
|
|
209
|
-
body: _response.error.body,
|
|
210
|
-
rawResponse: _response.rawResponse,
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/offers");
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Retrieve batches for a batch-activation or group placement. Returns each
|
|
219
|
-
* slot in slot order with its current offer set, alias, and freshness fields
|
|
220
|
-
* (`isActive`, `lastActivatedAt`, `expiresAt`). Applies the same per-user
|
|
221
|
-
* eligibility and per-slot content-strategy filter as Get Offers By
|
|
222
|
-
* Placement, independently per slot. For a batch-activation placement, a
|
|
223
|
-
* slot only flips to `isActive: false` when its refresh interval has elapsed
|
|
224
|
-
* AND its post-eligibility `offers[]` is non-empty; otherwise the slot is
|
|
225
|
-
* still returned and stays active so the partner UI does not promote
|
|
226
|
-
* "refresh" with nothing to show. For a group placement, slots are always
|
|
227
|
-
* active and each slot returns its offers regardless of activation state,
|
|
228
|
-
* hiding only offers that require activation (`requiredInBatch`) and have
|
|
229
|
-
* no activation record.<br/>
|
|
230
|
-
* <b>Required scopes:</b> `rewards:read`
|
|
231
|
-
*
|
|
232
|
-
* @param {KardApi.OrganizationId} organizationId
|
|
233
|
-
* @param {KardApi.UserId} userId
|
|
234
|
-
* @param {string} placementId
|
|
235
|
-
* @param {KardApi.users.GetBatchesByPlacementRequest} request
|
|
236
|
-
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
237
|
-
*
|
|
238
|
-
* @throws {@link KardApi.InternalServerError}
|
|
239
|
-
* @throws {@link KardApi.InvalidRequest}
|
|
240
|
-
* @throws {@link KardApi.DoesNotExistError}
|
|
241
|
-
* @throws {@link KardApi.UnauthorizedError}
|
|
166
|
+
* await client.users.rewards.placementContent("organization-123", "user-123", "placement-homepage-banner", {
|
|
167
|
+
* include: "categories"
|
|
168
|
+
* })
|
|
242
169
|
*
|
|
243
170
|
* @example
|
|
244
|
-
* await client.users.rewards.
|
|
171
|
+
* await client.users.rewards.placementContent("organization-123", "user-123", "placement-weekly-bundles", {
|
|
172
|
+
* supportedComponents: "baseReward"
|
|
173
|
+
* })
|
|
245
174
|
*/
|
|
246
|
-
|
|
247
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
175
|
+
placementContent(organizationId, userId, placementId, request = {}, requestOptions) {
|
|
176
|
+
return core.HttpResponsePromise.fromPromise(this.__placementContent(organizationId, userId, placementId, request, requestOptions));
|
|
248
177
|
}
|
|
249
|
-
|
|
178
|
+
__placementContent(organizationId_1, userId_1, placementId_1) {
|
|
250
179
|
return __awaiter(this, arguments, void 0, function* (organizationId, userId, placementId, request = {}, requestOptions) {
|
|
251
180
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
252
|
-
const { supportedComponents } = request;
|
|
181
|
+
const { include, supportedComponents } = request;
|
|
253
182
|
const _queryParams = {
|
|
183
|
+
include,
|
|
254
184
|
supportedComponents: Array.isArray(supportedComponents)
|
|
255
185
|
? supportedComponents.map((item) => item)
|
|
256
186
|
: supportedComponents != null
|
|
@@ -260,7 +190,7 @@ class RewardsClient {
|
|
|
260
190
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
261
191
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
262
192
|
const _response = yield core.fetcher({
|
|
263
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.KardApiEnvironment.Production, `/v2/issuers/${core.url.encodePathParam(organizationId)}/users/${core.url.encodePathParam(userId)}/placements/${core.url.encodePathParam(placementId)}/
|
|
193
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.KardApiEnvironment.Production, `/v2/issuers/${core.url.encodePathParam(organizationId)}/users/${core.url.encodePathParam(userId)}/placements/${core.url.encodePathParam(placementId)}/content`),
|
|
264
194
|
method: "GET",
|
|
265
195
|
headers: _headers,
|
|
266
196
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
@@ -271,7 +201,10 @@ class RewardsClient {
|
|
|
271
201
|
logging: this._options.logging,
|
|
272
202
|
});
|
|
273
203
|
if (_response.ok) {
|
|
274
|
-
return {
|
|
204
|
+
return {
|
|
205
|
+
data: _response.body,
|
|
206
|
+
rawResponse: _response.rawResponse,
|
|
207
|
+
};
|
|
275
208
|
}
|
|
276
209
|
if (_response.error.reason === "status-code") {
|
|
277
210
|
switch (_response.error.statusCode) {
|
|
@@ -291,7 +224,7 @@ class RewardsClient {
|
|
|
291
224
|
});
|
|
292
225
|
}
|
|
293
226
|
}
|
|
294
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/
|
|
227
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/content");
|
|
295
228
|
});
|
|
296
229
|
}
|
|
297
230
|
/**
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type * as KardApi from "../../../../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* include: "categories"
|
|
6
|
+
* }
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* {
|
|
10
|
+
* supportedComponents: "baseReward"
|
|
11
|
+
* }
|
|
12
|
+
*/
|
|
13
|
+
export interface GetPlacementContentRequest {
|
|
14
|
+
/** CSV list of included resources in the response (e.g "categories"). Allowed value is `categories`. Only applies to standard placements (those returning `standardOffer` resources). */
|
|
15
|
+
include?: string | string[];
|
|
16
|
+
/** UI component types to include in the response. */
|
|
17
|
+
supportedComponents?: KardApi.users.ComponentType | KardApi.users.ComponentType[];
|
|
18
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export type { GetBatchesByPlacementRequest } from "./GetBatchesByPlacementRequest.js";
|
|
2
1
|
export type { GetLocationsByUserRequest } from "./GetLocationsByUserRequest.js";
|
|
3
|
-
export type { GetOffersByPlacementRequest } from "./GetOffersByPlacementRequest.js";
|
|
4
2
|
export type { GetOffersByUserRequest } from "./GetOffersByUserRequest.js";
|
|
3
|
+
export type { GetPlacementContentRequest } from "./GetPlacementContentRequest.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type * as KardApi from "../../../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Combined placement-content response. The placement is resolved server-side and the response is returned verbatim as one of two variants: a standard placement yields the offers response (`standardOffer` resources with `links`, optional `included` categories, and `meta`), while a batch-activation or group placement yields the batches response (`placementBatch` slot resources). Callers distinguish the two by each resource's `type` rather than a separate discriminator.
|
|
4
|
+
*/
|
|
5
|
+
export type PlacementContentResponse = KardApi.users.OffersResponseObject | KardApi.users.BatchesResponseObject;
|
|
@@ -41,6 +41,7 @@ export * from "./OperationPeriod.js";
|
|
|
41
41
|
export * from "./OperationTime.js";
|
|
42
42
|
export * from "./PlacementBatchAttributes.js";
|
|
43
43
|
export * from "./PlacementBatchData.js";
|
|
44
|
+
export * from "./PlacementContentResponse.js";
|
|
44
45
|
export * from "./ProgressBar.js";
|
|
45
46
|
export * from "./ProgressBarLabelPair.js";
|
|
46
47
|
export * from "./ProgressBarLabels.js";
|
|
@@ -57,6 +57,7 @@ __exportStar(require("./OperationPeriod.js"), exports);
|
|
|
57
57
|
__exportStar(require("./OperationTime.js"), exports);
|
|
58
58
|
__exportStar(require("./PlacementBatchAttributes.js"), exports);
|
|
59
59
|
__exportStar(require("./PlacementBatchData.js"), exports);
|
|
60
|
+
__exportStar(require("./PlacementContentResponse.js"), exports);
|
|
60
61
|
__exportStar(require("./ProgressBar.js"), exports);
|
|
61
62
|
__exportStar(require("./ProgressBarLabelPair.js"), exports);
|
|
62
63
|
__exportStar(require("./ProgressBarLabels.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "
|
|
1
|
+
export declare const SDK_VERSION = "30.0.0";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ 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": "
|
|
10
|
-
"User-Agent": "@kard-financial/sdk/
|
|
9
|
+
"X-Fern-SDK-Version": "30.0.0",
|
|
10
|
+
"User-Agent": "@kard-financial/sdk/30.0.0",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -98,8 +98,8 @@ export declare class AttributionsClient {
|
|
|
98
98
|
* `placementSlotAttribution` ACTIVATE event and fans out a per-offer
|
|
99
99
|
* `offerAttribution` ACTIVATE event for every offer resolved by the slot's content
|
|
100
100
|
* strategy. The slot-level event id and the resolved `offerIds` are returned so the
|
|
101
|
-
* partner can render the batch immediately without an extra
|
|
102
|
-
*
|
|
101
|
+
* partner can render the batch immediately without an extra round-trip to re-fetch
|
|
102
|
+
* the placement content.
|
|
103
103
|
*
|
|
104
104
|
* <b>Required scopes:</b> `attributions:write`
|
|
105
105
|
*
|
|
@@ -248,8 +248,8 @@ export class AttributionsClient {
|
|
|
248
248
|
* `placementSlotAttribution` ACTIVATE event and fans out a per-offer
|
|
249
249
|
* `offerAttribution` ACTIVATE event for every offer resolved by the slot's content
|
|
250
250
|
* strategy. The slot-level event id and the resolved `offerIds` are returned so the
|
|
251
|
-
* partner can render the batch immediately without an extra
|
|
252
|
-
*
|
|
251
|
+
* partner can render the batch immediately without an extra round-trip to re-fetch
|
|
252
|
+
* the placement content.
|
|
253
253
|
*
|
|
254
254
|
* <b>Required scopes:</b> `attributions:write`
|
|
255
255
|
*
|
|
@@ -36,14 +36,21 @@ export declare class RewardsClient {
|
|
|
36
36
|
offers(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, request?: KardApi.users.GetOffersByUserRequest, requestOptions?: RewardsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.OffersResponseObject>;
|
|
37
37
|
private __offers;
|
|
38
38
|
/**
|
|
39
|
-
* Retrieve
|
|
40
|
-
*
|
|
39
|
+
* Retrieve the content for a placement. The placement type is resolved
|
|
40
|
+
* server-side so callers no longer pick an endpoint by placement type.
|
|
41
|
+
* Returns a JSON:API document whose `data` resources are self-describing
|
|
42
|
+
* by `type`: a standard placement returns `standardOffer` resources (with
|
|
43
|
+
* `links`, optional `included` categories, and `meta`); a batch-activation
|
|
44
|
+
* or group placement returns `placementBatch` slot resources. Distinguish
|
|
45
|
+
* the two by each resource's `type`. Email and push-notification
|
|
46
|
+
* placements are not servable through this endpoint and respond with a
|
|
47
|
+
* `400`.<br/>
|
|
41
48
|
* <b>Required scopes:</b> `rewards:read`
|
|
42
49
|
*
|
|
43
50
|
* @param {KardApi.OrganizationId} organizationId
|
|
44
51
|
* @param {KardApi.UserId} userId
|
|
45
52
|
* @param {string} placementId
|
|
46
|
-
* @param {KardApi.users.
|
|
53
|
+
* @param {KardApi.users.GetPlacementContentRequest} request
|
|
47
54
|
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
48
55
|
*
|
|
49
56
|
* @throws {@link KardApi.InternalServerError}
|
|
@@ -52,41 +59,17 @@ export declare class RewardsClient {
|
|
|
52
59
|
* @throws {@link KardApi.UnauthorizedError}
|
|
53
60
|
*
|
|
54
61
|
* @example
|
|
55
|
-
* await client.users.rewards.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
private __placementOffers;
|
|
59
|
-
/**
|
|
60
|
-
* Retrieve batches for a batch-activation or group placement. Returns each
|
|
61
|
-
* slot in slot order with its current offer set, alias, and freshness fields
|
|
62
|
-
* (`isActive`, `lastActivatedAt`, `expiresAt`). Applies the same per-user
|
|
63
|
-
* eligibility and per-slot content-strategy filter as Get Offers By
|
|
64
|
-
* Placement, independently per slot. For a batch-activation placement, a
|
|
65
|
-
* slot only flips to `isActive: false` when its refresh interval has elapsed
|
|
66
|
-
* AND its post-eligibility `offers[]` is non-empty; otherwise the slot is
|
|
67
|
-
* still returned and stays active so the partner UI does not promote
|
|
68
|
-
* "refresh" with nothing to show. For a group placement, slots are always
|
|
69
|
-
* active and each slot returns its offers regardless of activation state,
|
|
70
|
-
* hiding only offers that require activation (`requiredInBatch`) and have
|
|
71
|
-
* no activation record.<br/>
|
|
72
|
-
* <b>Required scopes:</b> `rewards:read`
|
|
73
|
-
*
|
|
74
|
-
* @param {KardApi.OrganizationId} organizationId
|
|
75
|
-
* @param {KardApi.UserId} userId
|
|
76
|
-
* @param {string} placementId
|
|
77
|
-
* @param {KardApi.users.GetBatchesByPlacementRequest} request
|
|
78
|
-
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
79
|
-
*
|
|
80
|
-
* @throws {@link KardApi.InternalServerError}
|
|
81
|
-
* @throws {@link KardApi.InvalidRequest}
|
|
82
|
-
* @throws {@link KardApi.DoesNotExistError}
|
|
83
|
-
* @throws {@link KardApi.UnauthorizedError}
|
|
62
|
+
* await client.users.rewards.placementContent("organization-123", "user-123", "placement-homepage-banner", {
|
|
63
|
+
* include: "categories"
|
|
64
|
+
* })
|
|
84
65
|
*
|
|
85
66
|
* @example
|
|
86
|
-
* await client.users.rewards.
|
|
67
|
+
* await client.users.rewards.placementContent("organization-123", "user-123", "placement-weekly-bundles", {
|
|
68
|
+
* supportedComponents: "baseReward"
|
|
69
|
+
* })
|
|
87
70
|
*/
|
|
88
|
-
|
|
89
|
-
private
|
|
71
|
+
placementContent(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, placementId: string, request?: KardApi.users.GetPlacementContentRequest, requestOptions?: RewardsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.PlacementContentResponse>;
|
|
72
|
+
private __placementContent;
|
|
90
73
|
/**
|
|
91
74
|
* Retrieve national and local geographic locations that a specified user has eligible in-store offers at. Use this endpoint to build
|
|
92
75
|
* out your [map-specific UX experiences](/2024-10-01/api/getting-started#c-discover-clos-near-you-map-view). Please note
|
|
@@ -104,14 +104,21 @@ export class RewardsClient {
|
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
|
-
* Retrieve
|
|
108
|
-
*
|
|
107
|
+
* Retrieve the content for a placement. The placement type is resolved
|
|
108
|
+
* server-side so callers no longer pick an endpoint by placement type.
|
|
109
|
+
* Returns a JSON:API document whose `data` resources are self-describing
|
|
110
|
+
* by `type`: a standard placement returns `standardOffer` resources (with
|
|
111
|
+
* `links`, optional `included` categories, and `meta`); a batch-activation
|
|
112
|
+
* or group placement returns `placementBatch` slot resources. Distinguish
|
|
113
|
+
* the two by each resource's `type`. Email and push-notification
|
|
114
|
+
* placements are not servable through this endpoint and respond with a
|
|
115
|
+
* `400`.<br/>
|
|
109
116
|
* <b>Required scopes:</b> `rewards:read`
|
|
110
117
|
*
|
|
111
118
|
* @param {KardApi.OrganizationId} organizationId
|
|
112
119
|
* @param {KardApi.UserId} userId
|
|
113
120
|
* @param {string} placementId
|
|
114
|
-
* @param {KardApi.users.
|
|
121
|
+
* @param {KardApi.users.GetPlacementContentRequest} request
|
|
115
122
|
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
116
123
|
*
|
|
117
124
|
* @throws {@link KardApi.InternalServerError}
|
|
@@ -120,101 +127,24 @@ export class RewardsClient {
|
|
|
120
127
|
* @throws {@link KardApi.UnauthorizedError}
|
|
121
128
|
*
|
|
122
129
|
* @example
|
|
123
|
-
* await client.users.rewards.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return core.HttpResponsePromise.fromPromise(this.__placementOffers(organizationId, userId, placementId, request, requestOptions));
|
|
127
|
-
}
|
|
128
|
-
__placementOffers(organizationId_1, userId_1, placementId_1) {
|
|
129
|
-
return __awaiter(this, arguments, void 0, function* (organizationId, userId, placementId, request = {}, requestOptions) {
|
|
130
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
131
|
-
const { "filter[search]": filterSearch, "filter[purchaseChannel]": filterPurchaseChannel, "filter[category]": filterCategory, "filter[isTargeted]": filterIsTargeted, include, supportedComponents, } = request;
|
|
132
|
-
const _queryParams = {
|
|
133
|
-
"filter[search]": filterSearch,
|
|
134
|
-
"filter[purchaseChannel]": filterPurchaseChannel != null ? toJson(filterPurchaseChannel) : undefined,
|
|
135
|
-
"filter[category]": filterCategory != null ? filterCategory : undefined,
|
|
136
|
-
"filter[isTargeted]": filterIsTargeted,
|
|
137
|
-
include,
|
|
138
|
-
supportedComponents: Array.isArray(supportedComponents)
|
|
139
|
-
? supportedComponents.map((item) => item)
|
|
140
|
-
: supportedComponents != null
|
|
141
|
-
? supportedComponents
|
|
142
|
-
: undefined,
|
|
143
|
-
};
|
|
144
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
145
|
-
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
146
|
-
const _response = yield core.fetcher({
|
|
147
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.KardApiEnvironment.Production, `/v2/issuers/${core.url.encodePathParam(organizationId)}/users/${core.url.encodePathParam(userId)}/placements/${core.url.encodePathParam(placementId)}/offers`),
|
|
148
|
-
method: "GET",
|
|
149
|
-
headers: _headers,
|
|
150
|
-
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
151
|
-
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
152
|
-
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
153
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
154
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
155
|
-
logging: this._options.logging,
|
|
156
|
-
});
|
|
157
|
-
if (_response.ok) {
|
|
158
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
159
|
-
}
|
|
160
|
-
if (_response.error.reason === "status-code") {
|
|
161
|
-
switch (_response.error.statusCode) {
|
|
162
|
-
case 500:
|
|
163
|
-
throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
|
|
164
|
-
case 400:
|
|
165
|
-
throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
|
|
166
|
-
case 404:
|
|
167
|
-
throw new KardApi.DoesNotExistError(_response.error.body, _response.rawResponse);
|
|
168
|
-
case 401:
|
|
169
|
-
throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
170
|
-
default:
|
|
171
|
-
throw new errors.KardApiError({
|
|
172
|
-
statusCode: _response.error.statusCode,
|
|
173
|
-
body: _response.error.body,
|
|
174
|
-
rawResponse: _response.rawResponse,
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/offers");
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Retrieve batches for a batch-activation or group placement. Returns each
|
|
183
|
-
* slot in slot order with its current offer set, alias, and freshness fields
|
|
184
|
-
* (`isActive`, `lastActivatedAt`, `expiresAt`). Applies the same per-user
|
|
185
|
-
* eligibility and per-slot content-strategy filter as Get Offers By
|
|
186
|
-
* Placement, independently per slot. For a batch-activation placement, a
|
|
187
|
-
* slot only flips to `isActive: false` when its refresh interval has elapsed
|
|
188
|
-
* AND its post-eligibility `offers[]` is non-empty; otherwise the slot is
|
|
189
|
-
* still returned and stays active so the partner UI does not promote
|
|
190
|
-
* "refresh" with nothing to show. For a group placement, slots are always
|
|
191
|
-
* active and each slot returns its offers regardless of activation state,
|
|
192
|
-
* hiding only offers that require activation (`requiredInBatch`) and have
|
|
193
|
-
* no activation record.<br/>
|
|
194
|
-
* <b>Required scopes:</b> `rewards:read`
|
|
195
|
-
*
|
|
196
|
-
* @param {KardApi.OrganizationId} organizationId
|
|
197
|
-
* @param {KardApi.UserId} userId
|
|
198
|
-
* @param {string} placementId
|
|
199
|
-
* @param {KardApi.users.GetBatchesByPlacementRequest} request
|
|
200
|
-
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
201
|
-
*
|
|
202
|
-
* @throws {@link KardApi.InternalServerError}
|
|
203
|
-
* @throws {@link KardApi.InvalidRequest}
|
|
204
|
-
* @throws {@link KardApi.DoesNotExistError}
|
|
205
|
-
* @throws {@link KardApi.UnauthorizedError}
|
|
130
|
+
* await client.users.rewards.placementContent("organization-123", "user-123", "placement-homepage-banner", {
|
|
131
|
+
* include: "categories"
|
|
132
|
+
* })
|
|
206
133
|
*
|
|
207
134
|
* @example
|
|
208
|
-
* await client.users.rewards.
|
|
135
|
+
* await client.users.rewards.placementContent("organization-123", "user-123", "placement-weekly-bundles", {
|
|
136
|
+
* supportedComponents: "baseReward"
|
|
137
|
+
* })
|
|
209
138
|
*/
|
|
210
|
-
|
|
211
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
139
|
+
placementContent(organizationId, userId, placementId, request = {}, requestOptions) {
|
|
140
|
+
return core.HttpResponsePromise.fromPromise(this.__placementContent(organizationId, userId, placementId, request, requestOptions));
|
|
212
141
|
}
|
|
213
|
-
|
|
142
|
+
__placementContent(organizationId_1, userId_1, placementId_1) {
|
|
214
143
|
return __awaiter(this, arguments, void 0, function* (organizationId, userId, placementId, request = {}, requestOptions) {
|
|
215
144
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
216
|
-
const { supportedComponents } = request;
|
|
145
|
+
const { include, supportedComponents } = request;
|
|
217
146
|
const _queryParams = {
|
|
147
|
+
include,
|
|
218
148
|
supportedComponents: Array.isArray(supportedComponents)
|
|
219
149
|
? supportedComponents.map((item) => item)
|
|
220
150
|
: supportedComponents != null
|
|
@@ -224,7 +154,7 @@ export class RewardsClient {
|
|
|
224
154
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
225
155
|
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
226
156
|
const _response = yield core.fetcher({
|
|
227
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.KardApiEnvironment.Production, `/v2/issuers/${core.url.encodePathParam(organizationId)}/users/${core.url.encodePathParam(userId)}/placements/${core.url.encodePathParam(placementId)}/
|
|
157
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.KardApiEnvironment.Production, `/v2/issuers/${core.url.encodePathParam(organizationId)}/users/${core.url.encodePathParam(userId)}/placements/${core.url.encodePathParam(placementId)}/content`),
|
|
228
158
|
method: "GET",
|
|
229
159
|
headers: _headers,
|
|
230
160
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
@@ -235,7 +165,10 @@ export class RewardsClient {
|
|
|
235
165
|
logging: this._options.logging,
|
|
236
166
|
});
|
|
237
167
|
if (_response.ok) {
|
|
238
|
-
return {
|
|
168
|
+
return {
|
|
169
|
+
data: _response.body,
|
|
170
|
+
rawResponse: _response.rawResponse,
|
|
171
|
+
};
|
|
239
172
|
}
|
|
240
173
|
if (_response.error.reason === "status-code") {
|
|
241
174
|
switch (_response.error.statusCode) {
|
|
@@ -255,7 +188,7 @@ export class RewardsClient {
|
|
|
255
188
|
});
|
|
256
189
|
}
|
|
257
190
|
}
|
|
258
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/
|
|
191
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/content");
|
|
259
192
|
});
|
|
260
193
|
}
|
|
261
194
|
/**
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type * as KardApi from "../../../../../../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* include: "categories"
|
|
6
|
+
* }
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* {
|
|
10
|
+
* supportedComponents: "baseReward"
|
|
11
|
+
* }
|
|
12
|
+
*/
|
|
13
|
+
export interface GetPlacementContentRequest {
|
|
14
|
+
/** CSV list of included resources in the response (e.g "categories"). Allowed value is `categories`. Only applies to standard placements (those returning `standardOffer` resources). */
|
|
15
|
+
include?: string | string[];
|
|
16
|
+
/** UI component types to include in the response. */
|
|
17
|
+
supportedComponents?: KardApi.users.ComponentType | KardApi.users.ComponentType[];
|
|
18
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export type { GetBatchesByPlacementRequest } from "./GetBatchesByPlacementRequest.mjs";
|
|
2
1
|
export type { GetLocationsByUserRequest } from "./GetLocationsByUserRequest.mjs";
|
|
3
|
-
export type { GetOffersByPlacementRequest } from "./GetOffersByPlacementRequest.mjs";
|
|
4
2
|
export type { GetOffersByUserRequest } from "./GetOffersByUserRequest.mjs";
|
|
3
|
+
export type { GetPlacementContentRequest } from "./GetPlacementContentRequest.mjs";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type * as KardApi from "../../../../../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Combined placement-content response. The placement is resolved server-side and the response is returned verbatim as one of two variants: a standard placement yields the offers response (`standardOffer` resources with `links`, optional `included` categories, and `meta`), while a batch-activation or group placement yields the batches response (`placementBatch` slot resources). Callers distinguish the two by each resource's `type` rather than a separate discriminator.
|
|
4
|
+
*/
|
|
5
|
+
export type PlacementContentResponse = KardApi.users.OffersResponseObject | KardApi.users.BatchesResponseObject;
|
|
@@ -41,6 +41,7 @@ export * from "./OperationPeriod.mjs";
|
|
|
41
41
|
export * from "./OperationTime.mjs";
|
|
42
42
|
export * from "./PlacementBatchAttributes.mjs";
|
|
43
43
|
export * from "./PlacementBatchData.mjs";
|
|
44
|
+
export * from "./PlacementContentResponse.mjs";
|
|
44
45
|
export * from "./ProgressBar.mjs";
|
|
45
46
|
export * from "./ProgressBarLabelPair.mjs";
|
|
46
47
|
export * from "./ProgressBarLabels.mjs";
|
|
@@ -41,6 +41,7 @@ export * from "./OperationPeriod.mjs";
|
|
|
41
41
|
export * from "./OperationTime.mjs";
|
|
42
42
|
export * from "./PlacementBatchAttributes.mjs";
|
|
43
43
|
export * from "./PlacementBatchData.mjs";
|
|
44
|
+
export * from "./PlacementContentResponse.mjs";
|
|
44
45
|
export * from "./ProgressBar.mjs";
|
|
45
46
|
export * from "./ProgressBarLabelPair.mjs";
|
|
46
47
|
export * from "./ProgressBarLabels.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "
|
|
1
|
+
export declare const SDK_VERSION = "30.0.0";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "
|
|
1
|
+
export const SDK_VERSION = "30.0.0";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -2737,8 +2737,8 @@ Record when a user activates a batch-activation placement slot. Writes a slot-le
|
|
|
2737
2737
|
`placementSlotAttribution` ACTIVATE event and fans out a per-offer
|
|
2738
2738
|
`offerAttribution` ACTIVATE event for every offer resolved by the slot's content
|
|
2739
2739
|
strategy. The slot-level event id and the resolved `offerIds` are returned so the
|
|
2740
|
-
partner can render the batch immediately without an extra
|
|
2741
|
-
|
|
2740
|
+
partner can render the batch immediately without an extra round-trip to re-fetch
|
|
2741
|
+
the placement content.
|
|
2742
2742
|
|
|
2743
2743
|
<b>Required scopes:</b> `attributions:write`
|
|
2744
2744
|
</dd>
|
|
@@ -2974,7 +2974,7 @@ await client.users.rewards.offers("organization-123", "user-123", {
|
|
|
2974
2974
|
</dl>
|
|
2975
2975
|
</details>
|
|
2976
2976
|
|
|
2977
|
-
<details><summary><code>client.users.rewards.<a href="/src/api/resources/users/resources/rewards/client/Client.ts">
|
|
2977
|
+
<details><summary><code>client.users.rewards.<a href="/src/api/resources/users/resources/rewards/client/Client.ts">placementContent</a>(organizationId, userId, placementId, { ...params }) -> KardApi.PlacementContentResponse</code></summary>
|
|
2978
2978
|
<dl>
|
|
2979
2979
|
<dd>
|
|
2980
2980
|
|
|
@@ -2986,8 +2986,15 @@ await client.users.rewards.offers("organization-123", "user-123", {
|
|
|
2986
2986
|
<dl>
|
|
2987
2987
|
<dd>
|
|
2988
2988
|
|
|
2989
|
-
Retrieve
|
|
2990
|
-
|
|
2989
|
+
Retrieve the content for a placement. The placement type is resolved
|
|
2990
|
+
server-side so callers no longer pick an endpoint by placement type.
|
|
2991
|
+
Returns a JSON:API document whose `data` resources are self-describing
|
|
2992
|
+
by `type`: a standard placement returns `standardOffer` resources (with
|
|
2993
|
+
`links`, optional `included` categories, and `meta`); a batch-activation
|
|
2994
|
+
or group placement returns `placementBatch` slot resources. Distinguish
|
|
2995
|
+
the two by each resource's `type`. Email and push-notification
|
|
2996
|
+
placements are not servable through this endpoint and respond with a
|
|
2997
|
+
`400`.<br/>
|
|
2991
2998
|
<b>Required scopes:</b> `rewards:read`
|
|
2992
2999
|
</dd>
|
|
2993
3000
|
</dl>
|
|
@@ -3003,106 +3010,9 @@ limited by the placement's available slots.<br/>
|
|
|
3003
3010
|
<dd>
|
|
3004
3011
|
|
|
3005
3012
|
```typescript
|
|
3006
|
-
await client.users.rewards.
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
</dd>
|
|
3010
|
-
</dl>
|
|
3011
|
-
</dd>
|
|
3012
|
-
</dl>
|
|
3013
|
-
|
|
3014
|
-
#### ⚙️ Parameters
|
|
3015
|
-
|
|
3016
|
-
<dl>
|
|
3017
|
-
<dd>
|
|
3018
|
-
|
|
3019
|
-
<dl>
|
|
3020
|
-
<dd>
|
|
3021
|
-
|
|
3022
|
-
**organizationId:** `KardApi.OrganizationId`
|
|
3023
|
-
|
|
3024
|
-
</dd>
|
|
3025
|
-
</dl>
|
|
3026
|
-
|
|
3027
|
-
<dl>
|
|
3028
|
-
<dd>
|
|
3029
|
-
|
|
3030
|
-
**userId:** `KardApi.UserId`
|
|
3031
|
-
|
|
3032
|
-
</dd>
|
|
3033
|
-
</dl>
|
|
3034
|
-
|
|
3035
|
-
<dl>
|
|
3036
|
-
<dd>
|
|
3037
|
-
|
|
3038
|
-
**placementId:** `string`
|
|
3039
|
-
|
|
3040
|
-
</dd>
|
|
3041
|
-
</dl>
|
|
3042
|
-
|
|
3043
|
-
<dl>
|
|
3044
|
-
<dd>
|
|
3045
|
-
|
|
3046
|
-
**request:** `KardApi.users.GetOffersByPlacementRequest`
|
|
3047
|
-
|
|
3048
|
-
</dd>
|
|
3049
|
-
</dl>
|
|
3050
|
-
|
|
3051
|
-
<dl>
|
|
3052
|
-
<dd>
|
|
3053
|
-
|
|
3054
|
-
**requestOptions:** `RewardsClient.RequestOptions`
|
|
3055
|
-
|
|
3056
|
-
</dd>
|
|
3057
|
-
</dl>
|
|
3058
|
-
</dd>
|
|
3059
|
-
</dl>
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
</dd>
|
|
3063
|
-
</dl>
|
|
3064
|
-
</details>
|
|
3065
|
-
|
|
3066
|
-
<details><summary><code>client.users.rewards.<a href="/src/api/resources/users/resources/rewards/client/Client.ts">placementBatches</a>(organizationId, userId, placementId, { ...params }) -> KardApi.BatchesResponseObject</code></summary>
|
|
3067
|
-
<dl>
|
|
3068
|
-
<dd>
|
|
3069
|
-
|
|
3070
|
-
#### 📝 Description
|
|
3071
|
-
|
|
3072
|
-
<dl>
|
|
3073
|
-
<dd>
|
|
3074
|
-
|
|
3075
|
-
<dl>
|
|
3076
|
-
<dd>
|
|
3077
|
-
|
|
3078
|
-
Retrieve batches for a batch-activation or group placement. Returns each
|
|
3079
|
-
slot in slot order with its current offer set, alias, and freshness fields
|
|
3080
|
-
(`isActive`, `lastActivatedAt`, `expiresAt`). Applies the same per-user
|
|
3081
|
-
eligibility and per-slot content-strategy filter as Get Offers By
|
|
3082
|
-
Placement, independently per slot. For a batch-activation placement, a
|
|
3083
|
-
slot only flips to `isActive: false` when its refresh interval has elapsed
|
|
3084
|
-
AND its post-eligibility `offers[]` is non-empty; otherwise the slot is
|
|
3085
|
-
still returned and stays active so the partner UI does not promote
|
|
3086
|
-
"refresh" with nothing to show. For a group placement, slots are always
|
|
3087
|
-
active and each slot returns its offers regardless of activation state,
|
|
3088
|
-
hiding only offers that require activation (`requiredInBatch`) and have
|
|
3089
|
-
no activation record.<br/>
|
|
3090
|
-
<b>Required scopes:</b> `rewards:read`
|
|
3091
|
-
</dd>
|
|
3092
|
-
</dl>
|
|
3093
|
-
</dd>
|
|
3094
|
-
</dl>
|
|
3095
|
-
|
|
3096
|
-
#### 🔌 Usage
|
|
3097
|
-
|
|
3098
|
-
<dl>
|
|
3099
|
-
<dd>
|
|
3100
|
-
|
|
3101
|
-
<dl>
|
|
3102
|
-
<dd>
|
|
3103
|
-
|
|
3104
|
-
```typescript
|
|
3105
|
-
await client.users.rewards.placementBatches("organizationId", "userId", "placementId");
|
|
3013
|
+
await client.users.rewards.placementContent("organization-123", "user-123", "placement-homepage-banner", {
|
|
3014
|
+
include: "categories"
|
|
3015
|
+
});
|
|
3106
3016
|
|
|
3107
3017
|
```
|
|
3108
3018
|
</dd>
|
|
@@ -3142,7 +3052,7 @@ await client.users.rewards.placementBatches("organizationId", "userId", "placeme
|
|
|
3142
3052
|
<dl>
|
|
3143
3053
|
<dd>
|
|
3144
3054
|
|
|
3145
|
-
**request:** `KardApi.users.
|
|
3055
|
+
**request:** `KardApi.users.GetPlacementContentRequest`
|
|
3146
3056
|
|
|
3147
3057
|
</dd>
|
|
3148
3058
|
</dl>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type * as KardApi from "../../../../../../index.js";
|
|
2
|
-
/**
|
|
3
|
-
* @example
|
|
4
|
-
* {}
|
|
5
|
-
*/
|
|
6
|
-
export interface GetBatchesByPlacementRequest {
|
|
7
|
-
/** UI component types to include in the response. */
|
|
8
|
-
supportedComponents?: KardApi.users.ComponentType | KardApi.users.ComponentType[];
|
|
9
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type * as KardApi from "../../../../../../index.js";
|
|
2
|
-
/**
|
|
3
|
-
* @example
|
|
4
|
-
* {}
|
|
5
|
-
*/
|
|
6
|
-
export interface GetOffersByPlacementRequest {
|
|
7
|
-
/** Case-insensitive search string to filter offers by merchant name */
|
|
8
|
-
"filter[search]"?: string;
|
|
9
|
-
"filter[purchaseChannel]"?: KardApi.PurchaseChannel[];
|
|
10
|
-
"filter[category]"?: KardApi.CategoryOption;
|
|
11
|
-
"filter[isTargeted]"?: boolean;
|
|
12
|
-
/** CSV list of included resources in the response (e.g "categories"). Allowed value is `categories`. */
|
|
13
|
-
include?: string | string[];
|
|
14
|
-
/** UI component types to include in the response. */
|
|
15
|
-
supportedComponents?: KardApi.users.ComponentType | KardApi.users.ComponentType[];
|
|
16
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type * as KardApi from "../../../../../../index.mjs";
|
|
2
|
-
/**
|
|
3
|
-
* @example
|
|
4
|
-
* {}
|
|
5
|
-
*/
|
|
6
|
-
export interface GetBatchesByPlacementRequest {
|
|
7
|
-
/** UI component types to include in the response. */
|
|
8
|
-
supportedComponents?: KardApi.users.ComponentType | KardApi.users.ComponentType[];
|
|
9
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type * as KardApi from "../../../../../../index.mjs";
|
|
2
|
-
/**
|
|
3
|
-
* @example
|
|
4
|
-
* {}
|
|
5
|
-
*/
|
|
6
|
-
export interface GetOffersByPlacementRequest {
|
|
7
|
-
/** Case-insensitive search string to filter offers by merchant name */
|
|
8
|
-
"filter[search]"?: string;
|
|
9
|
-
"filter[purchaseChannel]"?: KardApi.PurchaseChannel[];
|
|
10
|
-
"filter[category]"?: KardApi.CategoryOption;
|
|
11
|
-
"filter[isTargeted]"?: boolean;
|
|
12
|
-
/** CSV list of included resources in the response (e.g "categories"). Allowed value is `categories`. */
|
|
13
|
-
include?: string | string[];
|
|
14
|
-
/** UI component types to include in the response. */
|
|
15
|
-
supportedComponents?: KardApi.users.ComponentType | KardApi.users.ComponentType[];
|
|
16
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|