@zauru-sdk/graphql 2.0.59 → 2.0.64

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.
@@ -104,7 +104,9 @@ export declare const getSuggestedPricesStringQuery: (config?: {
104
104
  item_super_category_id?: number;
105
105
  }) => string;
106
106
  export declare const getPaymentTermsStringQuery: (config?: {
107
- includeDiscounts: boolean;
107
+ includeAllowedDiscounts: boolean;
108
+ includeAllowedPaymentTerms: boolean;
109
+ onlyActives: boolean;
108
110
  }) => string;
109
111
  export declare const getPaymentMethodsStringQuery: (config: {
110
112
  onlyActives: boolean;
@@ -1248,15 +1248,20 @@ const getSuggestedPricesStringQuery = (config = {
1248
1248
  `;
1249
1249
  };
1250
1250
  exports.getSuggestedPricesStringQuery = getSuggestedPricesStringQuery;
1251
- const getPaymentTermsStringQuery = (config = { includeDiscounts: false }) => `
1252
- query getPaymentTerms {
1253
- payment_terms {
1254
- active
1255
- id
1256
- memo
1257
- name
1258
- ${config.includeDiscounts
1259
- ? `allowed_discounts {
1251
+ const getPaymentTermsStringQuery = (config = {
1252
+ includeAllowedDiscounts: false,
1253
+ includeAllowedPaymentTerms: false,
1254
+ onlyActives: true,
1255
+ }) => {
1256
+ const conditions = [];
1257
+ if (config.onlyActives) {
1258
+ conditions.push(`active: { _eq: true}`);
1259
+ }
1260
+ const whereClause = conditions.length
1261
+ ? `where: { ${conditions.join(", ")} }`
1262
+ : "";
1263
+ const allowedDiscounts = config.includeAllowedDiscounts
1264
+ ? `allowed_discounts {
1260
1265
  discount {
1261
1266
  id
1262
1267
  name
@@ -1264,10 +1269,26 @@ query getPaymentTerms {
1264
1269
  amount
1265
1270
  }
1266
1271
  }`
1267
- : ""}
1272
+ : "";
1273
+ const allowedPaymentTerms = config.includeAllowedPaymentTerms
1274
+ ? `allowed_payment_terms {
1275
+ payment_term_id
1276
+ }`
1277
+ : "";
1278
+ return `query getPaymentTerms {
1279
+ payment_terms (
1280
+ ${whereClause}
1281
+ ) {
1282
+ active
1283
+ id
1284
+ memo
1285
+ name
1286
+ ${allowedDiscounts}
1287
+ ${allowedPaymentTerms}
1288
+ }
1268
1289
  }
1269
- }
1270
1290
  `;
1291
+ };
1271
1292
  exports.getPaymentTermsStringQuery = getPaymentTermsStringQuery;
1272
1293
  const getPaymentMethodsStringQuery = (config) => {
1273
1294
  const conditions = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/graphql",
3
- "version": "2.0.59",
3
+ "version": "2.0.64",
4
4
  "description": "Queries de uso común para las aplicación de Zauru.",
5
5
  "main": "./dist/esm/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -21,5 +21,5 @@
21
21
  "devDependencies": {
22
22
  "typescript": "^5.1.6"
23
23
  },
24
- "gitHead": "af9f6f6e6e78e9effa761dd0afe9608996777344"
24
+ "gitHead": "bc674a76dc43a806132167b53287e02ca3d5a8fc"
25
25
  }