@kard-financial/sdk 22.2.0 → 22.4.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.
Files changed (66) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/users/resources/attributions/client/Client.d.ts +25 -0
  3. package/dist/cjs/api/resources/users/resources/attributions/client/Client.js +67 -0
  4. package/dist/cjs/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponse.d.ts +23 -0
  5. package/dist/cjs/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponse.js +3 -0
  6. package/dist/cjs/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponseAttributes.d.ts +15 -0
  7. package/dist/cjs/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponseAttributes.js +3 -0
  8. package/dist/cjs/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponseData.d.ts +7 -0
  9. package/dist/cjs/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponseData.js +3 -0
  10. package/dist/cjs/api/resources/users/resources/attributions/types/AttributionState.d.ts +4 -0
  11. package/dist/cjs/api/resources/users/resources/attributions/types/CreateAttributionRequestUnion.d.ts +4 -1
  12. package/dist/cjs/api/resources/users/resources/attributions/types/PlacementSlotAttributionAttributes.d.ts +19 -0
  13. package/dist/cjs/api/resources/users/resources/attributions/types/PlacementSlotAttributionAttributes.js +3 -0
  14. package/dist/cjs/api/resources/users/resources/attributions/types/PlacementSlotAttributionRequest.d.ts +4 -0
  15. package/dist/cjs/api/resources/users/resources/attributions/types/PlacementSlotAttributionRequest.js +3 -0
  16. package/dist/cjs/api/resources/users/resources/attributions/types/PlacementSlotMedium.d.ts +5 -0
  17. package/dist/cjs/api/resources/users/resources/attributions/types/PlacementSlotMedium.js +8 -0
  18. package/dist/cjs/api/resources/users/resources/attributions/types/index.d.ts +6 -0
  19. package/dist/cjs/api/resources/users/resources/attributions/types/index.js +6 -0
  20. package/dist/cjs/api/resources/users/resources/rewards/client/Client.d.ts +27 -0
  21. package/dist/cjs/api/resources/users/resources/rewards/client/Client.js +76 -0
  22. package/dist/cjs/api/resources/users/resources/rewards/client/requests/GetBatchesByPlacementRequest.d.ts +9 -0
  23. package/dist/cjs/api/resources/users/resources/rewards/client/requests/GetBatchesByPlacementRequest.js +3 -0
  24. package/dist/cjs/api/resources/users/resources/rewards/client/requests/index.d.ts +1 -0
  25. package/dist/cjs/api/resources/users/resources/rewards/types/BatchSlotData.d.ts +18 -0
  26. package/dist/cjs/api/resources/users/resources/rewards/types/BatchSlotData.js +3 -0
  27. package/dist/cjs/api/resources/users/resources/rewards/types/BatchesResponseObject.d.ts +7 -0
  28. package/dist/cjs/api/resources/users/resources/rewards/types/BatchesResponseObject.js +3 -0
  29. package/dist/cjs/api/resources/users/resources/rewards/types/index.d.ts +2 -0
  30. package/dist/cjs/api/resources/users/resources/rewards/types/index.js +2 -0
  31. package/dist/cjs/version.d.ts +1 -1
  32. package/dist/cjs/version.js +1 -1
  33. package/dist/esm/BaseClient.mjs +2 -2
  34. package/dist/esm/api/resources/users/resources/attributions/client/Client.d.mts +25 -0
  35. package/dist/esm/api/resources/users/resources/attributions/client/Client.mjs +67 -0
  36. package/dist/esm/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponse.d.mts +23 -0
  37. package/dist/esm/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponse.mjs +2 -0
  38. package/dist/esm/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponseAttributes.d.mts +15 -0
  39. package/dist/esm/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponseAttributes.mjs +2 -0
  40. package/dist/esm/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponseData.d.mts +7 -0
  41. package/dist/esm/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponseData.mjs +2 -0
  42. package/dist/esm/api/resources/users/resources/attributions/types/AttributionState.d.mts +4 -0
  43. package/dist/esm/api/resources/users/resources/attributions/types/CreateAttributionRequestUnion.d.mts +4 -1
  44. package/dist/esm/api/resources/users/resources/attributions/types/PlacementSlotAttributionAttributes.d.mts +19 -0
  45. package/dist/esm/api/resources/users/resources/attributions/types/PlacementSlotAttributionAttributes.mjs +2 -0
  46. package/dist/esm/api/resources/users/resources/attributions/types/PlacementSlotAttributionRequest.d.mts +4 -0
  47. package/dist/esm/api/resources/users/resources/attributions/types/PlacementSlotAttributionRequest.mjs +2 -0
  48. package/dist/esm/api/resources/users/resources/attributions/types/PlacementSlotMedium.d.mts +5 -0
  49. package/dist/esm/api/resources/users/resources/attributions/types/PlacementSlotMedium.mjs +5 -0
  50. package/dist/esm/api/resources/users/resources/attributions/types/index.d.mts +6 -0
  51. package/dist/esm/api/resources/users/resources/attributions/types/index.mjs +6 -0
  52. package/dist/esm/api/resources/users/resources/rewards/client/Client.d.mts +27 -0
  53. package/dist/esm/api/resources/users/resources/rewards/client/Client.mjs +76 -0
  54. package/dist/esm/api/resources/users/resources/rewards/client/requests/GetBatchesByPlacementRequest.d.mts +9 -0
  55. package/dist/esm/api/resources/users/resources/rewards/client/requests/GetBatchesByPlacementRequest.mjs +2 -0
  56. package/dist/esm/api/resources/users/resources/rewards/client/requests/index.d.mts +1 -0
  57. package/dist/esm/api/resources/users/resources/rewards/types/BatchSlotData.d.mts +18 -0
  58. package/dist/esm/api/resources/users/resources/rewards/types/BatchSlotData.mjs +2 -0
  59. package/dist/esm/api/resources/users/resources/rewards/types/BatchesResponseObject.d.mts +7 -0
  60. package/dist/esm/api/resources/users/resources/rewards/types/BatchesResponseObject.mjs +2 -0
  61. package/dist/esm/api/resources/users/resources/rewards/types/index.d.mts +2 -0
  62. package/dist/esm/api/resources/users/resources/rewards/types/index.mjs +2 -0
  63. package/dist/esm/version.d.mts +1 -1
  64. package/dist/esm/version.mjs +1 -1
  65. package/package.json +1 -1
  66. package/reference.md +189 -0
@@ -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": "22.2.0",
47
- "User-Agent": "@kard-financial/sdk/22.2.0",
46
+ "X-Fern-SDK-Version": "22.4.0",
47
+ "User-Agent": "@kard-financial/sdk/22.4.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);
@@ -93,4 +93,29 @@ export declare class AttributionsClient {
93
93
  */
94
94
  boost(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, offerId: string, request?: KardApi.users.BoostOfferRequest, requestOptions?: AttributionsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.BoostOfferResponse>;
95
95
  private __boost;
96
+ /**
97
+ * Record when a user activates a batch-activation placement slot. Writes a slot-level
98
+ * `placementSlotAttribution` ACTIVATE event and fans out a per-offer
99
+ * `offerAttribution` ACTIVATE event for every offer resolved by the slot's content
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 `getBatchesByPlacement`
102
+ * round-trip.
103
+ *
104
+ * <b>Required scopes:</b> `attributions:write`
105
+ *
106
+ * @param {KardApi.OrganizationId} organizationId
107
+ * @param {KardApi.UserId} userId
108
+ * @param {string} placementId - Unique identifier of the placement (UUID v7)
109
+ * @param {string} slotId - Stable identifier for the slot within the placement
110
+ * @param {AttributionsClient.RequestOptions} requestOptions - Request-specific configuration.
111
+ *
112
+ * @throws {@link KardApi.UnauthorizedError}
113
+ * @throws {@link KardApi.InternalServerError}
114
+ * @throws {@link KardApi.InvalidRequest}
115
+ *
116
+ * @example
117
+ * await client.users.attributions.activatePlacementSlot("organization-123", "user-123", "018f8d6b-1abc-7def-9012-345678901234", "slot-a")
118
+ */
119
+ activatePlacementSlot(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, placementId: string, slotId: string, requestOptions?: AttributionsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.ActivatePlacementSlotResponse>;
120
+ private __activatePlacementSlot;
96
121
  }
@@ -279,5 +279,72 @@ class AttributionsClient {
279
279
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v2/issuers/{organizationId}/users/{userId}/offers/{offerId}/boost");
280
280
  });
281
281
  }
282
+ /**
283
+ * Record when a user activates a batch-activation placement slot. Writes a slot-level
284
+ * `placementSlotAttribution` ACTIVATE event and fans out a per-offer
285
+ * `offerAttribution` ACTIVATE event for every offer resolved by the slot's content
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 `getBatchesByPlacement`
288
+ * round-trip.
289
+ *
290
+ * <b>Required scopes:</b> `attributions:write`
291
+ *
292
+ * @param {KardApi.OrganizationId} organizationId
293
+ * @param {KardApi.UserId} userId
294
+ * @param {string} placementId - Unique identifier of the placement (UUID v7)
295
+ * @param {string} slotId - Stable identifier for the slot within the placement
296
+ * @param {AttributionsClient.RequestOptions} requestOptions - Request-specific configuration.
297
+ *
298
+ * @throws {@link KardApi.UnauthorizedError}
299
+ * @throws {@link KardApi.InternalServerError}
300
+ * @throws {@link KardApi.InvalidRequest}
301
+ *
302
+ * @example
303
+ * await client.users.attributions.activatePlacementSlot("organization-123", "user-123", "018f8d6b-1abc-7def-9012-345678901234", "slot-a")
304
+ */
305
+ activatePlacementSlot(organizationId, userId, placementId, slotId, requestOptions) {
306
+ return core.HttpResponsePromise.fromPromise(this.__activatePlacementSlot(organizationId, userId, placementId, slotId, requestOptions));
307
+ }
308
+ __activatePlacementSlot(organizationId, userId, placementId, slotId, requestOptions) {
309
+ return __awaiter(this, void 0, void 0, function* () {
310
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
311
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
312
+ 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);
313
+ const _response = yield core.fetcher({
314
+ 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)}/slot/${core.url.encodePathParam(slotId)}/activate`),
315
+ method: "POST",
316
+ headers: _headers,
317
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
318
+ 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,
319
+ 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,
320
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
321
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
322
+ logging: this._options.logging,
323
+ });
324
+ if (_response.ok) {
325
+ return {
326
+ data: _response.body,
327
+ rawResponse: _response.rawResponse,
328
+ };
329
+ }
330
+ if (_response.error.reason === "status-code") {
331
+ switch (_response.error.statusCode) {
332
+ case 401:
333
+ throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
334
+ case 500:
335
+ throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
336
+ case 400:
337
+ throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
338
+ default:
339
+ throw new errors.KardApiError({
340
+ statusCode: _response.error.statusCode,
341
+ body: _response.error.body,
342
+ rawResponse: _response.rawResponse,
343
+ });
344
+ }
345
+ }
346
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/slot/{slotId}/activate");
347
+ });
348
+ }
282
349
  }
283
350
  exports.AttributionsClient = AttributionsClient;
@@ -0,0 +1,23 @@
1
+ import type * as KardApi from "../../../../../index.js";
2
+ /**
3
+ * Ack payload for a slot activation request.
4
+ *
5
+ * @example
6
+ * {
7
+ * data: {
8
+ * type: "placementSlotAttribution",
9
+ * id: "c94a93a7-beb9-4e58-960c-2c812f849398",
10
+ * attributes: {
11
+ * placementId: "018f8d6b-1abc-7def-9012-345678901234",
12
+ * slotId: "slot-a",
13
+ * eventCode: "ACTIVATE",
14
+ * medium: "CTA",
15
+ * eventDate: "2025-01-01T00:00:00Z",
16
+ * offerIds: ["offer-1", "offer-2", "offer-3"]
17
+ * }
18
+ * }
19
+ * }
20
+ */
21
+ export interface ActivatePlacementSlotResponse {
22
+ data: KardApi.users.ActivatePlacementSlotResponseData;
23
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ export interface ActivatePlacementSlotResponseAttributes {
2
+ /** Unique identifier of the placement */
3
+ placementId: string;
4
+ /** Stable identifier for the slot within the placement */
5
+ slotId: string;
6
+ eventCode: string;
7
+ medium: string;
8
+ eventDate: string;
9
+ /**
10
+ * All offer IDs that resolved under the slot's content strategy and had
11
+ * per-offer `offerAttribution` ACTIVATE events written. The partner can use
12
+ * this to render the batch immediately without an extra round-trip.
13
+ */
14
+ offerIds: string[];
15
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import type * as KardApi from "../../../../../index.js";
2
+ export interface ActivatePlacementSlotResponseData {
3
+ type: string;
4
+ /** The slot-level attribution event id */
5
+ id: string;
6
+ attributes: KardApi.users.ActivatePlacementSlotResponseAttributes;
7
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -4,4 +4,8 @@ export interface AttributionState {
4
4
  rank?: number | undefined;
5
5
  /** The active filters when the user saw the offer */
6
6
  filters?: KardApi.users.AttributionFilter[] | undefined;
7
+ /** Unique identifier of the placement the attribution event originated from */
8
+ placementId?: string | undefined;
9
+ /** Stable identifier for the slot within the placement */
10
+ slotId?: string | undefined;
7
11
  }
@@ -1,5 +1,5 @@
1
1
  import type * as KardApi from "../../../../../index.js";
2
- export type CreateAttributionRequestUnion = KardApi.users.CreateAttributionRequestUnion.OfferAttribution | KardApi.users.CreateAttributionRequestUnion.NotificationAttribution;
2
+ export type CreateAttributionRequestUnion = KardApi.users.CreateAttributionRequestUnion.OfferAttribution | KardApi.users.CreateAttributionRequestUnion.NotificationAttribution | KardApi.users.CreateAttributionRequestUnion.PlacementSlotAttribution;
3
3
  export declare namespace CreateAttributionRequestUnion {
4
4
  interface OfferAttribution extends KardApi.users.OfferAttributionRequest {
5
5
  type: "offerAttribution";
@@ -7,4 +7,7 @@ export declare namespace CreateAttributionRequestUnion {
7
7
  interface NotificationAttribution extends KardApi.users.NotificationAttributionRequest {
8
8
  type: "notificationAttribution";
9
9
  }
10
+ interface PlacementSlotAttribution extends KardApi.users.PlacementSlotAttributionRequest {
11
+ type: "placementSlotAttribution";
12
+ }
10
13
  }
@@ -0,0 +1,19 @@
1
+ import type * as KardApi from "../../../../../index.js";
2
+ /**
3
+ * Attributes for a slot-level activation event on a batch-activation placement.
4
+ * A slot activation also writes per-offer `offerAttribution` ACTIVATE events for
5
+ * every offer resolved by the slot's content strategy (see `ActivatePlacementSlot`).
6
+ */
7
+ export interface PlacementSlotAttributionAttributes {
8
+ /** The slot ID (matches `state.slotId`) */
9
+ entityId: string;
10
+ eventCode: KardApi.users.EventCode;
11
+ medium: KardApi.users.PlacementSlotMedium;
12
+ /**
13
+ * The timestamp of the attribution event.
14
+ * Must be in ISO 8601 format (e.g., "2025-01-01T00:00:00Z").
15
+ */
16
+ eventDate: string;
17
+ /** Placement context for the attribution event */
18
+ state?: KardApi.users.AttributionState | undefined;
19
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import type * as KardApi from "../../../../../index.js";
2
+ export interface PlacementSlotAttributionRequest {
3
+ attributes: KardApi.users.PlacementSlotAttributionAttributes;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ /** Where the placement-slot attribution event is taking place in your rewards experience. */
2
+ export declare const PlacementSlotMedium: {
3
+ readonly Cta: "CTA";
4
+ };
5
+ export type PlacementSlotMedium = (typeof PlacementSlotMedium)[keyof typeof PlacementSlotMedium];
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.PlacementSlotMedium = void 0;
5
+ /** Where the placement-slot attribution event is taking place in your rewards experience. */
6
+ exports.PlacementSlotMedium = {
7
+ Cta: "CTA",
8
+ };
@@ -3,6 +3,9 @@ export * from "./ActivateOfferIncludeOption.js";
3
3
  export * from "./ActivateOfferResponse.js";
4
4
  export * from "./ActivateOfferResponseAttributes.js";
5
5
  export * from "./ActivateOfferResponseData.js";
6
+ export * from "./ActivatePlacementSlotResponse.js";
7
+ export * from "./ActivatePlacementSlotResponseAttributes.js";
8
+ export * from "./ActivatePlacementSlotResponseData.js";
6
9
  export * from "./AttributionFilter.js";
7
10
  export * from "./AttributionState.js";
8
11
  export * from "./BoostOfferIncluded.js";
@@ -20,3 +23,6 @@ export * from "./NotificationMedium.js";
20
23
  export * from "./OfferAttributionAttributes.js";
21
24
  export * from "./OfferAttributionRequest.js";
22
25
  export * from "./OfferMedium.js";
26
+ export * from "./PlacementSlotAttributionAttributes.js";
27
+ export * from "./PlacementSlotAttributionRequest.js";
28
+ export * from "./PlacementSlotMedium.js";
@@ -19,6 +19,9 @@ __exportStar(require("./ActivateOfferIncludeOption.js"), exports);
19
19
  __exportStar(require("./ActivateOfferResponse.js"), exports);
20
20
  __exportStar(require("./ActivateOfferResponseAttributes.js"), exports);
21
21
  __exportStar(require("./ActivateOfferResponseData.js"), exports);
22
+ __exportStar(require("./ActivatePlacementSlotResponse.js"), exports);
23
+ __exportStar(require("./ActivatePlacementSlotResponseAttributes.js"), exports);
24
+ __exportStar(require("./ActivatePlacementSlotResponseData.js"), exports);
22
25
  __exportStar(require("./AttributionFilter.js"), exports);
23
26
  __exportStar(require("./AttributionState.js"), exports);
24
27
  __exportStar(require("./BoostOfferIncluded.js"), exports);
@@ -36,3 +39,6 @@ __exportStar(require("./NotificationMedium.js"), exports);
36
39
  __exportStar(require("./OfferAttributionAttributes.js"), exports);
37
40
  __exportStar(require("./OfferAttributionRequest.js"), exports);
38
41
  __exportStar(require("./OfferMedium.js"), exports);
42
+ __exportStar(require("./PlacementSlotAttributionAttributes.js"), exports);
43
+ __exportStar(require("./PlacementSlotAttributionRequest.js"), exports);
44
+ __exportStar(require("./PlacementSlotMedium.js"), exports);
@@ -56,6 +56,33 @@ export declare class RewardsClient {
56
56
  */
57
57
  placementOffers(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, placementId: string, request?: KardApi.users.GetOffersByPlacementRequest, requestOptions?: RewardsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.OffersResponseObject>;
58
58
  private __placementOffers;
59
+ /**
60
+ * Retrieve batches for a batch-activation placement. Returns each slot in slot
61
+ * order with its current offer set, alias, and freshness fields (`isActive`,
62
+ * `lastActivatedAt`, `expiresAt`). Applies the same per-user eligibility and
63
+ * per-slot content-strategy filter as Get Offers By Placement, independently
64
+ * per slot. A slot only flips to `isActive: false` when its refresh interval
65
+ * has elapsed AND its post-eligibility `offers[]` is non-empty; otherwise the
66
+ * slot is still returned and stays active so the partner UI does not promote
67
+ * "refresh" with nothing to show.<br/>
68
+ * <b>Required scopes:</b> `rewards:read`
69
+ *
70
+ * @param {KardApi.OrganizationId} organizationId
71
+ * @param {KardApi.UserId} userId
72
+ * @param {string} placementId
73
+ * @param {KardApi.users.GetBatchesByPlacementRequest} request
74
+ * @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
75
+ *
76
+ * @throws {@link KardApi.InternalServerError}
77
+ * @throws {@link KardApi.InvalidRequest}
78
+ * @throws {@link KardApi.DoesNotExistError}
79
+ * @throws {@link KardApi.UnauthorizedError}
80
+ *
81
+ * @example
82
+ * await client.users.rewards.placementBatches("organizationId", "userId", "placementId")
83
+ */
84
+ placementBatches(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, placementId: string, request?: KardApi.users.GetBatchesByPlacementRequest, requestOptions?: RewardsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.BatchesResponseObject>;
85
+ private __placementBatches;
59
86
  /**
60
87
  * Retrieve national and local geographic locations that a specified user has eligible in-store offers at. Use this endpoint to build
61
88
  * out your [map-specific UX experiences](/2024-10-01/api/getting-started#c-discover-clos-near-you-map-view). Please note
@@ -214,6 +214,82 @@ class RewardsClient {
214
214
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/offers");
215
215
  });
216
216
  }
217
+ /**
218
+ * Retrieve batches for a batch-activation placement. Returns each slot in slot
219
+ * order with its current offer set, alias, and freshness fields (`isActive`,
220
+ * `lastActivatedAt`, `expiresAt`). Applies the same per-user eligibility and
221
+ * per-slot content-strategy filter as Get Offers By Placement, independently
222
+ * per slot. A slot only flips to `isActive: false` when its refresh interval
223
+ * has elapsed AND its post-eligibility `offers[]` is non-empty; otherwise the
224
+ * slot is still returned and stays active so the partner UI does not promote
225
+ * "refresh" with nothing to show.<br/>
226
+ * <b>Required scopes:</b> `rewards:read`
227
+ *
228
+ * @param {KardApi.OrganizationId} organizationId
229
+ * @param {KardApi.UserId} userId
230
+ * @param {string} placementId
231
+ * @param {KardApi.users.GetBatchesByPlacementRequest} request
232
+ * @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
233
+ *
234
+ * @throws {@link KardApi.InternalServerError}
235
+ * @throws {@link KardApi.InvalidRequest}
236
+ * @throws {@link KardApi.DoesNotExistError}
237
+ * @throws {@link KardApi.UnauthorizedError}
238
+ *
239
+ * @example
240
+ * await client.users.rewards.placementBatches("organizationId", "userId", "placementId")
241
+ */
242
+ placementBatches(organizationId, userId, placementId, request = {}, requestOptions) {
243
+ return core.HttpResponsePromise.fromPromise(this.__placementBatches(organizationId, userId, placementId, request, requestOptions));
244
+ }
245
+ __placementBatches(organizationId_1, userId_1, placementId_1) {
246
+ return __awaiter(this, arguments, void 0, function* (organizationId, userId, placementId, request = {}, requestOptions) {
247
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
248
+ const { supportedComponents } = request;
249
+ const _queryParams = {
250
+ supportedComponents: Array.isArray(supportedComponents)
251
+ ? supportedComponents.map((item) => item)
252
+ : supportedComponents != null
253
+ ? supportedComponents
254
+ : undefined,
255
+ };
256
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
257
+ 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);
258
+ const _response = yield core.fetcher({
259
+ 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)}/batches`),
260
+ method: "GET",
261
+ headers: _headers,
262
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
263
+ 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,
264
+ 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,
265
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
266
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
267
+ logging: this._options.logging,
268
+ });
269
+ if (_response.ok) {
270
+ return { data: _response.body, rawResponse: _response.rawResponse };
271
+ }
272
+ if (_response.error.reason === "status-code") {
273
+ switch (_response.error.statusCode) {
274
+ case 500:
275
+ throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
276
+ case 400:
277
+ throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
278
+ case 404:
279
+ throw new KardApi.DoesNotExistError(_response.error.body, _response.rawResponse);
280
+ case 401:
281
+ throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
282
+ default:
283
+ throw new errors.KardApiError({
284
+ statusCode: _response.error.statusCode,
285
+ body: _response.error.body,
286
+ rawResponse: _response.rawResponse,
287
+ });
288
+ }
289
+ }
290
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/batches");
291
+ });
292
+ }
217
293
  /**
218
294
  * Retrieve national and local geographic locations that a specified user has eligible in-store offers at. Use this endpoint to build
219
295
  * out your [map-specific UX experiences](/2024-10-01/api/getting-started#c-discover-clos-near-you-map-view). Please note
@@ -0,0 +1,9 @@
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
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,4 @@
1
+ export type { GetBatchesByPlacementRequest } from "./GetBatchesByPlacementRequest.js";
1
2
  export type { GetLocationsByUserRequest } from "./GetLocationsByUserRequest.js";
2
3
  export type { GetOffersByPlacementRequest } from "./GetOffersByPlacementRequest.js";
3
4
  export type { GetOffersByUserRequest } from "./GetOffersByUserRequest.js";
@@ -0,0 +1,18 @@
1
+ import type * as KardApi from "../../../../../index.js";
2
+ /**
3
+ * One slot in a batch-activation placement, with freshness fields and the offers that resolve under the slot's content strategy.
4
+ */
5
+ export interface BatchSlotData {
6
+ /** Stable identifier for the slot within the placement */
7
+ slotId: string;
8
+ /** Customer-defined alias for the slot, unique within the placement */
9
+ alias: string;
10
+ /** Whether the slot is still considered "fresh" for the user. Set to false only when the slot's `expiresAt` is in the past AND the slot resolves to a non-empty offer set; an empty offer set keeps the slot active so partner UIs do not promote "tap to refresh" with nothing to show. */
11
+ isActive: boolean;
12
+ /** Timestamp of the most recent placementSlotAttribution ACTIVATE event for this (user, placement, slot). Absent for cold slots that have never been activated. */
13
+ lastActivatedAt?: string | undefined;
14
+ /** Computed as `lastActivatedAt + placement.refreshInterval`. Absent for cold slots that have never been activated. */
15
+ expiresAt?: string | undefined;
16
+ /** The set of offers eligible for the user under this slot's content strategy. */
17
+ offers: KardApi.users.OfferDataUnion[];
18
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import type * as KardApi from "../../../../../index.js";
2
+ /**
3
+ * Ordered list of slots for a batch-activation placement, with freshness fields and per-slot offer sets.
4
+ */
5
+ export interface BatchesResponseObject {
6
+ data: KardApi.users.BatchSlotData[];
7
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,8 @@
1
1
  export * from "./Amount.js";
2
2
  export * from "./AmountType.js";
3
3
  export * from "./Asset.js";
4
+ export * from "./BatchesResponseObject.js";
5
+ export * from "./BatchSlotData.js";
4
6
  export * from "./ButtonStyle.js";
5
7
  export * from "./CategoryData.js";
6
8
  export * from "./CategoryFields.js";
@@ -17,6 +17,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Amount.js"), exports);
18
18
  __exportStar(require("./AmountType.js"), exports);
19
19
  __exportStar(require("./Asset.js"), exports);
20
+ __exportStar(require("./BatchesResponseObject.js"), exports);
21
+ __exportStar(require("./BatchSlotData.js"), exports);
20
22
  __exportStar(require("./ButtonStyle.js"), exports);
21
23
  __exportStar(require("./CategoryData.js"), exports);
22
24
  __exportStar(require("./CategoryFields.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "22.2.0";
1
+ export declare const SDK_VERSION = "22.4.0";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "22.2.0";
4
+ exports.SDK_VERSION = "22.4.0";
@@ -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": "22.2.0",
10
- "User-Agent": "@kard-financial/sdk/22.2.0",
9
+ "X-Fern-SDK-Version": "22.4.0",
10
+ "User-Agent": "@kard-financial/sdk/22.4.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);
@@ -93,4 +93,29 @@ export declare class AttributionsClient {
93
93
  */
94
94
  boost(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, offerId: string, request?: KardApi.users.BoostOfferRequest, requestOptions?: AttributionsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.BoostOfferResponse>;
95
95
  private __boost;
96
+ /**
97
+ * Record when a user activates a batch-activation placement slot. Writes a slot-level
98
+ * `placementSlotAttribution` ACTIVATE event and fans out a per-offer
99
+ * `offerAttribution` ACTIVATE event for every offer resolved by the slot's content
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 `getBatchesByPlacement`
102
+ * round-trip.
103
+ *
104
+ * <b>Required scopes:</b> `attributions:write`
105
+ *
106
+ * @param {KardApi.OrganizationId} organizationId
107
+ * @param {KardApi.UserId} userId
108
+ * @param {string} placementId - Unique identifier of the placement (UUID v7)
109
+ * @param {string} slotId - Stable identifier for the slot within the placement
110
+ * @param {AttributionsClient.RequestOptions} requestOptions - Request-specific configuration.
111
+ *
112
+ * @throws {@link KardApi.UnauthorizedError}
113
+ * @throws {@link KardApi.InternalServerError}
114
+ * @throws {@link KardApi.InvalidRequest}
115
+ *
116
+ * @example
117
+ * await client.users.attributions.activatePlacementSlot("organization-123", "user-123", "018f8d6b-1abc-7def-9012-345678901234", "slot-a")
118
+ */
119
+ activatePlacementSlot(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, placementId: string, slotId: string, requestOptions?: AttributionsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.ActivatePlacementSlotResponse>;
120
+ private __activatePlacementSlot;
96
121
  }
@@ -243,4 +243,71 @@ export class AttributionsClient {
243
243
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v2/issuers/{organizationId}/users/{userId}/offers/{offerId}/boost");
244
244
  });
245
245
  }
246
+ /**
247
+ * Record when a user activates a batch-activation placement slot. Writes a slot-level
248
+ * `placementSlotAttribution` ACTIVATE event and fans out a per-offer
249
+ * `offerAttribution` ACTIVATE event for every offer resolved by the slot's content
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 `getBatchesByPlacement`
252
+ * round-trip.
253
+ *
254
+ * <b>Required scopes:</b> `attributions:write`
255
+ *
256
+ * @param {KardApi.OrganizationId} organizationId
257
+ * @param {KardApi.UserId} userId
258
+ * @param {string} placementId - Unique identifier of the placement (UUID v7)
259
+ * @param {string} slotId - Stable identifier for the slot within the placement
260
+ * @param {AttributionsClient.RequestOptions} requestOptions - Request-specific configuration.
261
+ *
262
+ * @throws {@link KardApi.UnauthorizedError}
263
+ * @throws {@link KardApi.InternalServerError}
264
+ * @throws {@link KardApi.InvalidRequest}
265
+ *
266
+ * @example
267
+ * await client.users.attributions.activatePlacementSlot("organization-123", "user-123", "018f8d6b-1abc-7def-9012-345678901234", "slot-a")
268
+ */
269
+ activatePlacementSlot(organizationId, userId, placementId, slotId, requestOptions) {
270
+ return core.HttpResponsePromise.fromPromise(this.__activatePlacementSlot(organizationId, userId, placementId, slotId, requestOptions));
271
+ }
272
+ __activatePlacementSlot(organizationId, userId, placementId, slotId, requestOptions) {
273
+ return __awaiter(this, void 0, void 0, function* () {
274
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
275
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
276
+ 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);
277
+ const _response = yield core.fetcher({
278
+ 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)}/slot/${core.url.encodePathParam(slotId)}/activate`),
279
+ method: "POST",
280
+ headers: _headers,
281
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
282
+ 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,
283
+ 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,
284
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
285
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
286
+ logging: this._options.logging,
287
+ });
288
+ if (_response.ok) {
289
+ return {
290
+ data: _response.body,
291
+ rawResponse: _response.rawResponse,
292
+ };
293
+ }
294
+ if (_response.error.reason === "status-code") {
295
+ switch (_response.error.statusCode) {
296
+ case 401:
297
+ throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
298
+ case 500:
299
+ throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
300
+ case 400:
301
+ throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
302
+ default:
303
+ throw new errors.KardApiError({
304
+ statusCode: _response.error.statusCode,
305
+ body: _response.error.body,
306
+ rawResponse: _response.rawResponse,
307
+ });
308
+ }
309
+ }
310
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/slot/{slotId}/activate");
311
+ });
312
+ }
246
313
  }