rapida-partner 2.4.0 → 3.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rapida-partner",
3
- "version": "2.4.0",
3
+ "version": "3.1.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "index.ts",
6
6
  "files": [
@@ -213,7 +213,7 @@ export const companyForm: IForm = {
213
213
  name: "addressOneZipCode",
214
214
  type: "input",
215
215
  dataType: EDataType.NVARCHAR,
216
- apiRequest: {
216
+ apiRequest: [{
217
217
  endpoint: "https://brasilapi.com.br/api/cep/v1/",
218
218
  paramType: "path",
219
219
  formFieldsFilledByApiResponse: [
@@ -234,7 +234,7 @@ export const companyForm: IForm = {
234
234
  propertiesFromApiToFillFormField: ["state"],
235
235
  },
236
236
  ],
237
- },
237
+ }],
238
238
  validators: ["cep"],
239
239
  },
240
240
  {
@@ -297,7 +297,7 @@ export const companyForm: IForm = {
297
297
  name: "addressTwoZipCode",
298
298
  type: "input",
299
299
  dataType: EDataType.NVARCHAR,
300
- apiRequest: {
300
+ apiRequest: [{
301
301
  endpoint: "https://brasilapi.com.br/api/cep/v1/",
302
302
  paramType: "path",
303
303
  formFieldsFilledByApiResponse: [
@@ -318,7 +318,7 @@ export const companyForm: IForm = {
318
318
  propertiesFromApiToFillFormField: ["state"],
319
319
  },
320
320
  ],
321
- },
321
+ }],
322
322
  validators: ["cep"],
323
323
  },
324
324
  {
@@ -162,7 +162,7 @@ export const personForm: IForm = {
162
162
  type: "input",
163
163
  dataType: EDataType.NVARCHAR,
164
164
  name: "mainAddressZipCode",
165
- apiRequest: {
165
+ apiRequest: [{
166
166
  endpoint: "https://brasilapi.com.br/api/cep/v1/",
167
167
  paramType: "path",
168
168
  formFieldsFilledByApiResponse: [
@@ -194,7 +194,7 @@ export const personForm: IForm = {
194
194
  ],
195
195
  },
196
196
  },
197
- },
197
+ }],
198
198
  validators: ["cep"],
199
199
  space: 1,
200
200
  },
@@ -266,7 +266,7 @@ export const personForm: IForm = {
266
266
  type: "input",
267
267
  dataType: EDataType.NVARCHAR,
268
268
  name: "otherAddressZipCode",
269
- apiRequest: {
269
+ apiRequest: [{
270
270
  endpoint: "https://brasilapi.com.br/api/cep/v1/",
271
271
  paramType: "path",
272
272
  formFieldsFilledByApiResponse: [
@@ -287,7 +287,7 @@ export const personForm: IForm = {
287
287
  propertiesFromApiToFillFormField: ["state"],
288
288
  },
289
289
  ],
290
- },
290
+ }],
291
291
  validators: ["cep"],
292
292
  space: 1,
293
293
  },
@@ -15,7 +15,8 @@ export interface IFormButton {
15
15
  isDisabledOnUpdate?: boolean;
16
16
  isHidden?: boolean;
17
17
  conditions?: IFormCondition;
18
- apiRequest?: IApiRequest;
18
+ /** Chamadas em ordem: a seguinte só é tentada se a anterior falhar (chamada reserva). */
19
+ apiRequest?: IApiRequest[];
19
20
  onSuccessRedirect?: {
20
21
  url: string;
21
22
  openIn: "sameTab" | "newTab" | "newWindow";
@@ -32,7 +33,7 @@ export interface IFormButton {
32
33
  closeButtonLabel?: string;
33
34
  actionButtonLabel?: string;
34
35
  actionButtonType?: "submit" | "reset" | "link" | "apiRequest" | "modal";
35
- actionButtonApiRequest?: IApiRequest;
36
+ actionButtonApiRequest?: IApiRequest[];
36
37
  actionButtonBusinessRules?: IBusinessRule[];
37
38
  conditions?: IFormCondition;
38
39
  },
@@ -25,7 +25,11 @@ interface IFormInputBase {
25
25
  todo?: string;
26
26
  maxLength?: number;
27
27
  minLength?: number;
28
- apiRequest?: IApiRequest;
28
+ /**
29
+ * Chamadas feitas ao preencher o campo, em ordem: a seguinte só é tentada se a anterior falhar ou não
30
+ * preencher nenhum campo (chamada reserva). Cada item segue IApiRequest.
31
+ */
32
+ apiRequest?: IApiRequest[];
29
33
  businessRules?: IBusinessRule[];
30
34
  mask?: string | string[];
31
35
  suffix?: string;
@@ -56,6 +56,10 @@ interface IMarketplace {
56
56
  stockInEndpoint: string;
57
57
  stockOutEndpoint: string;
58
58
  productBaseUrl: string;
59
+ // Endpoint, na mesma base de productBaseUrl, das configurações de venda dos
60
+ // produtos (productId, price, isActive). Quando presente, o preço de venda
61
+ // vem daqui e o backend calcula o valor do pedido; sem ele, usa product.price.
62
+ productSellingSettingsEndpoint?: string;
59
63
  }
60
64
 
61
65
  interface IService {
@@ -104,7 +104,8 @@
104
104
  "productsAutocomplete": { "$ref": "form-autocomplete.ref.json" },
105
105
  "stockInEndpoint": { "type": "string" },
106
106
  "stockOutEndpoint": { "type": "string" },
107
- "productBaseUrl": { "type": "string" }
107
+ "productBaseUrl": { "type": "string" },
108
+ "productSellingSettingsEndpoint": { "type": "string" }
108
109
  },
109
110
  "required": ["paymentGateways", "productsAutocomplete", "stockInEndpoint", "stockOutEndpoint", "productBaseUrl"]
110
111
  },
@@ -45,7 +45,10 @@
45
45
  "$ref": "condition.ref.json"
46
46
  },
47
47
  "apiRequest": {
48
- "$ref": "form-common-api-request.ref.json"
48
+ "type": "array",
49
+ "minItems": 1,
50
+ "description": "Chamadas em ordem; a seguinte só é tentada se a anterior falhar ou não preencher nenhum campo (chamada reserva).",
51
+ "items": { "$ref": "form-common-api-request.ref.json" }
49
52
  },
50
53
  "onSuccessRedirect": {
51
54
  "type": "object",
@@ -125,8 +128,11 @@
125
128
  "enum": ["submit", "reset", "link", "apiRequest", "modal"]
126
129
  },
127
130
  "actionButtonApiRequest": {
128
- "$ref": "form-common-api-request.ref.json"
129
- },
131
+ "type": "array",
132
+ "minItems": 1,
133
+ "description": "Chamadas em ordem; a seguinte só é tentada se a anterior falhar ou não preencher nenhum campo (chamada reserva).",
134
+ "items": { "$ref": "form-common-api-request.ref.json" }
135
+ },
130
136
  "actionButtonBusinessRules": { "$ref": "business-rules.ref.json" },
131
137
  "conditions": { "$ref": "condition.ref.json" }
132
138
  },
@@ -69,7 +69,10 @@
69
69
  "type": "number"
70
70
  },
71
71
  "apiRequest": {
72
- "$ref": "form-common-api-request.ref.json"
72
+ "type": "array",
73
+ "minItems": 1,
74
+ "description": "Chamadas em ordem; a seguinte só é tentada se a anterior falhar ou não preencher nenhum campo (chamada reserva).",
75
+ "items": { "$ref": "form-common-api-request.ref.json" }
73
76
  },
74
77
  "mask": {
75
78
  "type": [