oneentry 1.0.134 → 1.0.135

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.
@@ -1,7 +1,7 @@
1
1
  import AsyncModules from '../base/asyncModules';
2
2
  import type StateModule from '../base/stateModule';
3
3
  import type { IError } from '../base/utils';
4
- import type { IBodyPostFormData, IFormsByMarkerDataEntity, IFormsData, IPostFormResponse } from './formsDataInterfaces';
4
+ import type { IBodyPostFormData, IFormsByMarkerDataEntity, IFormsData, IPostFormResponse, IUpdateFormsData } from './formsDataInterfaces';
5
5
  /**
6
6
  * Controllers for working with form data
7
7
  * @handle /api/content/form-data
@@ -81,4 +81,26 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
81
81
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
82
82
  */
83
83
  getFormsDataByMarker(marker: string, formModuleConfigId: number, body?: object, isExtended?: number, langCode?: string, offset?: number, limit?: number): Promise<IFormsByMarkerDataEntity | IError>;
84
+ /**
85
+ * Update one object of form data by id.
86
+ * @handleName updateFormsDataByid
87
+ * @param {number} id - ID of the form data. Example: 1.
88
+ * @returns {IUpdateFormsData | IError} Returns an object containing the updated form data or an error object if there was an issue.
89
+ */
90
+ updateFormsDataByid(id: number, body?: object): Promise<IUpdateFormsData | IError>;
91
+ /**
92
+ * Update form data status by id.
93
+ * @handleName updateFormsDataStatusByid
94
+ * @param {number} id - ID of the form data. Example: 1.
95
+ * @param {object} body - Request body.
96
+ * @returns {boolean | IError} Returns an object containing the updated form data or an error object if there was an issue.
97
+ */
98
+ updateFormsDataStatusByid(id: number, body?: object): Promise<boolean | IError>;
99
+ /**
100
+ * Delete one object of form data by id.
101
+ * @handleName deleteFormsDataByid
102
+ * @param {number} id - ID of the form data. Example: 1.
103
+ * @returns {boolean | IError} Returns an object containing the deleted form data or an error object if there was an issue.
104
+ */
105
+ deleteFormsDataByid(id: number): Promise<boolean | IError>;
84
106
  }
@@ -147,5 +147,36 @@ class FormsDataApi extends asyncModules_1.default {
147
147
  const result = await this._fetchPost(`/marker/${marker}?formModuleConfigId=${formModuleConfigId}&isExtended=${isExtended}&langCode=${langCode}&offset=${offset}&limit=${limit}`, body);
148
148
  return this._dataPostProcess(result, langCode);
149
149
  }
150
+ /**
151
+ * Update one object of form data by id.
152
+ * @handleName updateFormsDataByid
153
+ * @param {number} id - ID of the form data. Example: 1.
154
+ * @returns {IUpdateFormsData | IError} Returns an object containing the updated form data or an error object if there was an issue.
155
+ */
156
+ async updateFormsDataByid(id, body = {}) {
157
+ const result = await this._fetchPut(`/${id}`, body);
158
+ return result;
159
+ }
160
+ /**
161
+ * Update form data status by id.
162
+ * @handleName updateFormsDataStatusByid
163
+ * @param {number} id - ID of the form data. Example: 1.
164
+ * @param {object} body - Request body.
165
+ * @returns {boolean | IError} Returns an object containing the updated form data or an error object if there was an issue.
166
+ */
167
+ async updateFormsDataStatusByid(id, body = {}) {
168
+ const result = await this._fetchPut(`/${id}/update-status`, body);
169
+ return result;
170
+ }
171
+ /**
172
+ * Delete one object of form data by id.
173
+ * @handleName deleteFormsDataByid
174
+ * @param {number} id - ID of the form data. Example: 1.
175
+ * @returns {boolean | IError} Returns an object containing the deleted form data or an error object if there was an issue.
176
+ */
177
+ async deleteFormsDataByid(id) {
178
+ const result = await this._fetchDelete(`/${id}`);
179
+ return result;
180
+ }
150
181
  }
151
182
  exports.default = FormsDataApi;
@@ -72,7 +72,7 @@ interface IFormsData {
72
72
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
73
73
  * @description This method retrieves form data by its marker.
74
74
  */
75
- getFormsDataByMarker(marker: string, formModuleConfigId: number, body?: object, isNested?: number, langCode?: string, offset?: number, limit?: number): Promise<IFormsDataEntity | IError>;
75
+ getFormsDataByMarker(marker: string, formModuleConfigId: number, body?: object, isNested?: number, langCode?: string, offset?: number, limit?: number): Promise<IFormsByMarkerDataEntity | IError>;
76
76
  }
77
77
  /**
78
78
  * Represents the structure of a form data entity.
@@ -130,9 +130,10 @@ interface IFormsDataEntity {
130
130
  * @property {null | number} parentId - The unique identifier of the parent form page. Example: 123.
131
131
  * @property {string} formIdentifier - The identifier of the page. Example: "contact_form".
132
132
  * @property {number} depth - Example: 1.
133
- * @property {string | null} [ip] - Ip. Example: '127.0.0.1'.
134
- * @property {string | null} [status] - Status. Example: 'approved'.
135
- * @property {string | null} [userIdentifier] - Text identifier (marker) of the user. Example: "admin".
133
+ * @property {string | null} ip - Ip. Example: '127.0.0.1'.
134
+ * @property {string | null} fingerprint - Fingerprint. Example: 'fingerprint'.
135
+ * @property {string | null} status - Status. Example: 'approved'.
136
+ * @property {string | null} userIdentifier - Text identifier (marker) of the user. Example: "admin".
136
137
  * @property {FormDataType[]} formData - Form data.
137
138
  * @example
138
139
  [
@@ -142,11 +143,13 @@ interface IFormsDataEntity {
142
143
  "value": "Test"
143
144
  }
144
145
  ]
145
- * @property {string | null} [attributeSetIdentifier] - Text identifier (marker) of the used attribute set. Example: "product_attributes".
146
+ * @property {string | null} attributeSetIdentifier - Text identifier (marker) of the used attribute set. Example: "product_attributes".
146
147
  * @property {Date | string} time - The identifier of the form. Example: "2023-10-01T12:00:00Z".
147
- * @property {string} [entityIdentifier] - Text identifier (marker) of the entity. Example: "test".
148
- * @property {boolean} [isUserAdmin] - Is user admin. Example: true.
149
- * @property {number} [formModuleConfigId] - Form module config Id. Example: 2.
148
+ * @property {string} entityIdentifier - Text identifier (marker) of the entity. Example: "test".
149
+ * @property {boolean} isUserAdmin - Is user admin. Example: true.
150
+ * @property {number} formModuleConfigId - Form module config Id. Example: 2.
151
+ * @property {number} moduleIdentifier - Form module config Id. Example: 2.
152
+ * @property {number} entityId - Form module config Id. Example: 2.
150
153
  * @description This interface defines the structure of a form data entity, including its identifiers, form data, and optional attributes.
151
154
  */
152
155
  interface IFormByMarkerDataEntity {
@@ -154,15 +157,18 @@ interface IFormByMarkerDataEntity {
154
157
  parentId: null | number;
155
158
  formIdentifier: string;
156
159
  depth: number;
157
- ip?: string | null;
158
- status?: string | null;
159
- userIdentifier?: string | null;
160
+ ip: string | null;
161
+ fingerprint: string | null;
162
+ status: string | null;
163
+ userIdentifier: string | null;
160
164
  formData: FormDataType[];
161
- attributeSetIdentifier?: string | null;
165
+ attributeSetIdentifier: string | null;
162
166
  time: Date | string;
163
167
  entityIdentifier: string;
164
168
  isUserAdmin: boolean;
165
169
  formModuleConfigId: number;
170
+ moduleIdentifier: string;
171
+ entityId: number;
166
172
  }
167
173
  /**
168
174
  * Represents a collection of form data entities.
@@ -255,6 +261,32 @@ interface IPostFormResponse {
255
261
  formData: FormDataType[];
256
262
  };
257
263
  }
264
+ /**
265
+ * Represents the structure of the response after updating form data.
266
+ * @interface IUpdateFormsData
267
+ * @property {number} id - The unique identifier of the form page. Example: 12345.
268
+ * @property {string} formIdentifier - The identifier of the form. Example: "contact_form".
269
+ * @property {string} time - The time of the form submit. Example: "2023-10-01T12:00:00Z".
270
+ * @property {FormDataType[]} formData - Form fields data.
271
+ * @property {string} userIdentifier - The user identifier. Example: null.
272
+ * @property {string} entityIdentifier - The entity identifier. Example: "blog".
273
+ * @property {any} parentId - The parent identifier. Example: null.
274
+ * @property {string} fingerprint - The fingerprint of the form. Example: null.
275
+ * @property {boolean} isUserAdmin - Is user admin. Example: false.
276
+ * @property {number} formModuleId - The form module identifier. Example: 2.
277
+ */
278
+ interface IUpdateFormsData {
279
+ id: number;
280
+ formIdentifier: string;
281
+ time: string;
282
+ formData: FormDataType[];
283
+ userIdentifier: string;
284
+ entityIdentifier: string;
285
+ parentId: null | number;
286
+ fingerprint: null | string;
287
+ isUserAdmin: boolean;
288
+ formModuleId: number;
289
+ }
258
290
  /**
259
291
  * Contains an array of data form objects with the following values
260
292
  */
@@ -490,4 +522,4 @@ interface IBodyTypeRadioButtonList {
490
522
  };
491
523
  }>;
492
524
  }
493
- export type { FormDataType, IBodyPostFormData, IBodyTypeFile, IBodyTypeImageGroupOfImages, IBodyTypeRadioButtonList, IBodyTypeStringNumberFloat, IBodyTypeText, IBodyTypeTextWithHeader, IBodyTypeTimeDate, IFormByMarkerDataEntity, IFormDataEntity, IFormsByMarkerDataEntity, IFormsData, IFormsDataEntity, IPostFormResponse, };
525
+ export type { FormDataType, IBodyPostFormData, IBodyTypeFile, IBodyTypeImageGroupOfImages, IBodyTypeRadioButtonList, IBodyTypeStringNumberFloat, IBodyTypeText, IBodyTypeTextWithHeader, IBodyTypeTimeDate, IFormByMarkerDataEntity, IFormDataEntity, IFormsByMarkerDataEntity, IFormsData, IFormsDataEntity, IPostFormResponse, IUpdateFormsData, };
@@ -419,7 +419,8 @@ interface IOrderByMarkerEntity {
419
419
  currency: string;
420
420
  paymentAccountIdentifier?: string;
421
421
  paymentAccountLocalizeInfos?: Record<string, any>;
422
+ paymentUrl: null | string;
422
423
  products: IOrderProducts[];
423
- isCompleted: boolean;
424
+ isCompleted: null | boolean;
424
425
  }
425
426
  export type { IBaseOrdersEntity, IBaseOrdersEntityResponse, IOrderByMarkerEntity, IOrderData, IOrderProductData, IOrderProducts, IOrdersApi, IOrdersByMarkerEntity, IOrdersEntity, IOrdersFormData, IPaymentAccountIdentifiers, IPicture, };
@@ -79,14 +79,4 @@ export default class PaymentsApi extends AsyncModules implements IPaymentsApi {
79
79
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
80
80
  */
81
81
  getAccountById(id: number): Promise<IAccountsEntity | IError>;
82
- /**
83
- * Webhook for payment account.
84
- * @handleName webhookByMarker
85
- * @param {string} marker - marker. Example: "stripe".
86
- * @returns {boolean} Returns true if the webhook was processed successfully.
87
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
88
- * @description This method requires user authorization.
89
- * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
90
- */
91
- webhookByMarker(marker: string): Promise<boolean | IError>;
92
82
  }
@@ -108,18 +108,5 @@ class PaymentsApi extends asyncModules_1.default {
108
108
  const result = await this._fetchGet(`/accounts/${id}`);
109
109
  return this._normalizeData(result);
110
110
  }
111
- /**
112
- * Webhook for payment account.
113
- * @handleName webhookByMarker
114
- * @param {string} marker - marker. Example: "stripe".
115
- * @returns {boolean} Returns true if the webhook was processed successfully.
116
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
117
- * @description This method requires user authorization.
118
- * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
119
- */
120
- async webhookByMarker(marker) {
121
- const result = await this._fetchPost(`/webhook/${marker}`, {});
122
- return result;
123
- }
124
111
  }
125
112
  exports.default = PaymentsApi;
@@ -72,16 +72,6 @@ interface IPaymentsApi {
72
72
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
73
73
  */
74
74
  getAccountById(id: number): Promise<IAccountsEntity | IError>;
75
- /**
76
- * Webhook for payment account.
77
- * @handleName webhookByMarker
78
- * @param {string} marker - marker. Example: "stripe".
79
- * @returns {boolean} Returns true if the webhook was processed successfully.
80
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
81
- * @description This method requires user authorization.
82
- * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
83
- */
84
- webhookByMarker(marker: string): Promise<boolean | IError>;
85
75
  }
86
76
  /**
87
77
  * @interface ISessionsEntity
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oneentry",
3
- "version": "1.0.134",
3
+ "version": "1.0.135",
4
4
  "description": "OneEntry NPM package",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -48,7 +48,7 @@
48
48
  "@jest/globals": "^30.2.0",
49
49
  "@types/eslint-config-prettier": "^6.11.3",
50
50
  "@types/jest": "^30.0.0",
51
- "@types/node": "^25.0.2",
51
+ "@types/node": "^25.0.3",
52
52
  "@typescript-eslint/eslint-plugin": "^8.50.0",
53
53
  "@typescript-eslint/parser": "^8.50.0",
54
54
  "eslint": "^9.39.2",