@zauru-sdk/graphql 2.0.58 → 2.0.62

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.
@@ -101,9 +101,12 @@ export declare const getSuggestedPricesStringQuery: (config?: {
101
101
  withItems: boolean;
102
102
  withItemCategories: boolean;
103
103
  onlyCurrent: boolean;
104
+ item_super_category_id?: number;
104
105
  }) => string;
105
106
  export declare const getPaymentTermsStringQuery: (config?: {
106
- includeDiscounts: boolean;
107
+ includeAllowedDiscounts: boolean;
108
+ includeAllowedPaymentTerms: boolean;
109
+ onlyActives: boolean;
107
110
  }) => string;
108
111
  export declare const getPaymentMethodsStringQuery: (config: {
109
112
  onlyActives: boolean;
@@ -1195,6 +1195,9 @@ const getSuggestedPricesStringQuery = (config = {
1195
1195
  onlyCurrent: false,
1196
1196
  }) => {
1197
1197
  const conditions = [];
1198
+ if (config.item_super_category_id) {
1199
+ conditions.push(`item: { item_category: { item_super_category_id: { _eq: ${config.item_super_category_id} } } }`);
1200
+ }
1198
1201
  if (config.onlyCurrent) {
1199
1202
  conditions.push("current: { _eq: true }");
1200
1203
  }
@@ -1245,15 +1248,20 @@ const getSuggestedPricesStringQuery = (config = {
1245
1248
  `;
1246
1249
  };
1247
1250
  exports.getSuggestedPricesStringQuery = getSuggestedPricesStringQuery;
1248
- const getPaymentTermsStringQuery = (config = { includeDiscounts: false }) => `
1249
- query getPaymentTerms {
1250
- payment_terms {
1251
- active
1252
- id
1253
- memo
1254
- name
1255
- ${config.includeDiscounts
1256
- ? `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 {
1257
1265
  discount {
1258
1266
  id
1259
1267
  name
@@ -1261,10 +1269,25 @@ query getPaymentTerms {
1261
1269
  amount
1262
1270
  }
1263
1271
  }`
1264
- : ""}
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}
1265
1288
  }
1266
- }
1267
- `;
1289
+ `;
1290
+ };
1268
1291
  exports.getPaymentTermsStringQuery = getPaymentTermsStringQuery;
1269
1292
  const getPaymentMethodsStringQuery = (config) => {
1270
1293
  const conditions = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/graphql",
3
- "version": "2.0.58",
3
+ "version": "2.0.62",
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": "43724125bceb5eb92c786f9673a62ee0849d5901"
24
+ "gitHead": "54574ba8e5fa86be3b372d5803f228e95ee53c27"
25
25
  }