@djust-b2b/djust-front-sdk 2.12.0 → 2.14.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/lib/index.d.ts CHANGED
@@ -20,6 +20,7 @@ export declare const DjustSDK: {
20
20
  getPaymentDetails({ details, }: import("./services/payment/definitions").GetPaymentDetailsRequest): Promise<import("./services/payment/definitions").GetPaymentDetailsResponse>;
21
21
  getPaymentMethods({ reference, countryCode, referenceType, locale, }: import("./services/payment/definitions").GetPaymentMethodsRequest): Promise<import("./services/payment/definitions").GetPaymentMethodsResponse>;
22
22
  deleteStoredPaymentMethodById({ storedPaymentMethodId, }: import("./services/payment/definitions").DeleteStoredPaymentMethodByIdRequest): Promise<void>;
23
+ precheckPurchaseCardL3({ reference, referenceType, }: import("./services/payment/definitions").PrecheckPurchaseCardL3Request): Promise<import("./services/payment/definitions").PrecheckPurchaseCardL3Response>;
23
24
  getCustomFields(params: import("./services/custom-field/definitions").GetCustomFieldParameters): Promise<import("./services/custom-field/definitions").GetCustomFieldResponse>;
24
25
  postMediaCustomField(params: import("./services/custom-field/definitions").PostMediaCustomFieldParameters): Promise<string>;
25
26
  getMediaUrl(params: import("./services/custom-field/definitions").GetMediaUrlParameters): Promise<string>;
@@ -63,3 +63,16 @@ export interface GetPaymentMethodsResponse {
63
63
  export interface DeleteStoredPaymentMethodByIdRequest {
64
64
  storedPaymentMethodId: string;
65
65
  }
66
+ export interface PrecheckPurchaseCardL3Request {
67
+ reference: string;
68
+ referenceType?: PaymentReferenceType;
69
+ }
70
+ export interface PrecheckPurchaseCardL3Response {
71
+ ready: boolean;
72
+ missingFields?: {
73
+ scope: string;
74
+ field: string;
75
+ path: string;
76
+ source: string;
77
+ }[];
78
+ }
@@ -1,4 +1,4 @@
1
- import { GetPaymentDetailsRequest, GetPaymentDetailsResponse, DeleteStoredPaymentMethodByIdRequest, GetPaymentMethodsRequest, GetPaymentMethodsResponse, InitPaymentRequest, InitPaymentResponse } from "./definitions";
1
+ import { GetPaymentDetailsRequest, GetPaymentDetailsResponse, DeleteStoredPaymentMethodByIdRequest, GetPaymentMethodsRequest, GetPaymentMethodsResponse, InitPaymentRequest, InitPaymentResponse, PrecheckPurchaseCardL3Request, PrecheckPurchaseCardL3Response } from "./definitions";
2
2
  /**
3
3
  * 💳 Initializes a payment transaction.
4
4
  *
@@ -126,3 +126,24 @@ export declare function getPaymentMethods({ reference, countryCode, referenceTyp
126
126
  * @returns {Promise<void>} A promise resolving when the stored payment method is successfully deleted
127
127
  */
128
128
  export declare function deleteStoredPaymentMethodById({ storedPaymentMethodId, }: DeleteStoredPaymentMethodByIdRequest): Promise<void>;
129
+ /**
130
+ * 💳 Prechecks a purchase card L3.
131
+ *
132
+ * This endpoint prechecks a purchase card L3.
133
+ * The `reference` parameter is mandatory and validated before the request is executed.
134
+ *
135
+ * 🛠 **Endpoint**: `GET /v1/shop/payments/precheck` [PAY-502]
136
+ *
137
+ * | Parameter | Type | Required | Description |
138
+ * |----------------|----------|----------|------------------------------------------------|
139
+ * | `reference` | `string` | ✅ | The payment reference identifier. |
140
+ * | `referenceType`| `string` | ❌ | The type of reference. |
141
+ *
142
+ * 📤 **Returns**:
143
+ * A `Promise` resolving to a `PrecheckPurchaseCardL3Response` containing the result of the precheck.
144
+ *
145
+ * @param {PrecheckPurchaseCardL3Request} params - The parameters for the precheck
146
+ * @throws {Error} If `reference` is missing
147
+ * @returns {Promise<PrecheckPurchaseCardL3Response>} A promise resolving to the response containing the result of the precheck
148
+ */
149
+ export declare function precheckPurchaseCardL3({ reference, referenceType, }: PrecheckPurchaseCardL3Request): Promise<PrecheckPurchaseCardL3Response>;
@@ -4,6 +4,7 @@ exports.initPayment = initPayment;
4
4
  exports.getPaymentDetails = getPaymentDetails;
5
5
  exports.getPaymentMethods = getPaymentMethods;
6
6
  exports.deleteStoredPaymentMethodById = deleteStoredPaymentMethodById;
7
+ exports.precheckPurchaseCardL3 = precheckPurchaseCardL3;
7
8
  const parameters_validation_1 = require("../../helpers/parameters-validation");
8
9
  const fetch_instance_1 = require("../../settings/fetch-instance");
9
10
  /**
@@ -184,3 +185,35 @@ async function deleteStoredPaymentMethodById({ storedPaymentMethodId, }) {
184
185
  path: `/v1/shop/payments/stored-payment-methods/${storedPaymentMethodId}`,
185
186
  });
186
187
  }
188
+ /**
189
+ * 💳 Prechecks a purchase card L3.
190
+ *
191
+ * This endpoint prechecks a purchase card L3.
192
+ * The `reference` parameter is mandatory and validated before the request is executed.
193
+ *
194
+ * 🛠 **Endpoint**: `GET /v1/shop/payments/precheck` [PAY-502]
195
+ *
196
+ * | Parameter | Type | Required | Description |
197
+ * |----------------|----------|----------|------------------------------------------------|
198
+ * | `reference` | `string` | ✅ | The payment reference identifier. |
199
+ * | `referenceType`| `string` | ❌ | The type of reference. |
200
+ *
201
+ * 📤 **Returns**:
202
+ * A `Promise` resolving to a `PrecheckPurchaseCardL3Response` containing the result of the precheck.
203
+ *
204
+ * @param {PrecheckPurchaseCardL3Request} params - The parameters for the precheck
205
+ * @throws {Error} If `reference` is missing
206
+ * @returns {Promise<PrecheckPurchaseCardL3Response>} A promise resolving to the response containing the result of the precheck
207
+ */
208
+ async function precheckPurchaseCardL3({ reference, referenceType, }) {
209
+ (0, parameters_validation_1.required)({ reference });
210
+ const { data } = await (0, fetch_instance_1.enhancedFetch)({
211
+ method: "GET",
212
+ path: `/v1/shop/payments/precheck`,
213
+ params: {
214
+ reference,
215
+ referenceType,
216
+ },
217
+ });
218
+ return data;
219
+ }
@@ -13,6 +13,7 @@ export type ClientConfig = {
13
13
  clientName?: string;
14
14
  env?: string;
15
15
  dsn?: string;
16
+ logLevels?: ("log" | "info" | "warn" | "error")[];
16
17
  };
17
18
  export declare const initialize: (initConfig: ClientConfig) => void;
18
19
  export declare const updateConfiguration: (newConfig: Partial<ClientConfig>) => void;
@@ -45,8 +45,10 @@ let clientConfig = {
45
45
  dsn: "https://39ef5198e24fa0ec7b743c460bd1ca63@o1191347.ingest.us.sentry.io/4508879498575872",
46
46
  env: "development",
47
47
  clientName: "Djust",
48
+ logLevels: ["log", "info", "warn", "error"],
48
49
  };
49
50
  const initialize = (initConfig) => {
51
+ var _a;
50
52
  clientConfig = {
51
53
  ...initConfig,
52
54
  };
@@ -81,7 +83,9 @@ const initialize = (initConfig) => {
81
83
  profilesSampleRate: 1.0,
82
84
  sendDefaultPii: true,
83
85
  });
84
- console.log(`[Djust SDK] Sentry initialized in ${clientConfig.clientName || "unknown"} environment: ${clientConfig.env || "unknown"}.`);
86
+ if ((_a = clientConfig.logLevels) === null || _a === void 0 ? void 0 : _a.includes("info")) {
87
+ console.info(`[Djust SDK] Sentry initialized in ${clientConfig.clientName || "unknown"} environment: ${clientConfig.env || "unknown"}.`);
88
+ }
85
89
  }
86
90
  };
87
91
  exports.initialize = initialize;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djust-b2b/djust-front-sdk",
3
- "version": "2.12.0",
3
+ "version": "2.14.0",
4
4
  "description": "DJUST Front SDK is a versatile JavaScript Software Development Kit (SDK)",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",