crmbonus-component-wake 2.1.32-ngrok → 2.1.33-ngrok

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.
Files changed (29) hide show
  1. package/dist/cjs/{build.payload.helper-b93f7ea5.js → build.payload.helper-cfd3173e.js} +4 -1
  2. package/dist/cjs/build.payload.helper-cfd3173e.js.map +1 -0
  3. package/dist/cjs/crm-bonus-note.cjs.entry.js +1 -1
  4. package/dist/cjs/crm-bonus.cjs.entry.js +1 -1
  5. package/dist/collection/dto/validate.pin.bonus.js.map +1 -1
  6. package/dist/collection/helpers/build.payload.helper.js +3 -0
  7. package/dist/collection/helpers/build.payload.helper.js.map +1 -1
  8. package/dist/components/crm-bonus-note.js +1 -1
  9. package/dist/components/crm-bonus.js +1 -1
  10. package/dist/{esm/build.payload.helper-caf0a82b.js → components/p-b0ef2c0b.js} +4 -1
  11. package/dist/components/p-b0ef2c0b.js.map +1 -0
  12. package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js +1 -1
  13. package/dist/crmbonus-component-wake/{p-3e87e176.entry.js → p-22dc17d2.entry.js} +2 -2
  14. package/dist/crmbonus-component-wake/{p-a0d73d77.entry.js → p-7d608b81.entry.js} +2 -2
  15. package/dist/crmbonus-component-wake/p-b0ef2c0b.js +2 -0
  16. package/dist/crmbonus-component-wake/p-b0ef2c0b.js.map +1 -0
  17. package/dist/{components/p-4c7e066c.js → esm/build.payload.helper-699a48ca.js} +4 -1
  18. package/dist/esm/build.payload.helper-699a48ca.js.map +1 -0
  19. package/dist/esm/crm-bonus-note.entry.js +1 -1
  20. package/dist/esm/crm-bonus.entry.js +1 -1
  21. package/dist/types/dto/validate.pin.bonus.d.ts +1 -0
  22. package/package.json +1 -1
  23. package/dist/cjs/build.payload.helper-b93f7ea5.js.map +0 -1
  24. package/dist/components/p-4c7e066c.js.map +0 -1
  25. package/dist/crmbonus-component-wake/p-4c7e066c.js +0 -2
  26. package/dist/crmbonus-component-wake/p-4c7e066c.js.map +0 -1
  27. package/dist/esm/build.payload.helper-caf0a82b.js.map +0 -1
  28. /package/dist/crmbonus-component-wake/{p-3e87e176.entry.js.map → p-22dc17d2.entry.js.map} +0 -0
  29. /package/dist/crmbonus-component-wake/{p-a0d73d77.entry.js.map → p-7d608b81.entry.js.map} +0 -0
@@ -16,6 +16,8 @@ function buildProductsByWake(productsWake = []) {
16
16
  var value = (pw.PrecoDe * pw.Quantidade);
17
17
  var originalValue = (pw.PrecoDe * pw.Quantidade);
18
18
  var discounts_value = (discounts * -1);
19
+ const existsPromotionProduct = pw.Ajustes.filter(adj => [AjustesTipoEnum.PP].includes(adj.Tipo));
20
+ const promotion_product = (existsPromotionProduct.length > 0);
19
21
  products.push({
20
22
  sku: pw.SKU,
21
23
  value: value,
@@ -23,6 +25,7 @@ function buildProductsByWake(productsWake = []) {
23
25
  productVariantId: pw.ProdutoVarianteId.toString(),
24
26
  quantity: pw.Quantidade,
25
27
  discount: value < discounts_value ? value : discounts_value,
28
+ promotion_product
26
29
  });
27
30
  }
28
31
  return products;
@@ -48,4 +51,4 @@ function getDiscount(ajustes = []) {
48
51
 
49
52
  exports.buildProductsByWake = buildProductsByWake;
50
53
 
51
- //# sourceMappingURL=build.payload.helper-b93f7ea5.js.map
54
+ //# sourceMappingURL=build.payload.helper-cfd3173e.js.map
@@ -0,0 +1 @@
1
+ {"file":"build.payload.helper-cfd3173e.js","mappings":";;AAUA,IAAY,eAKX;AALD,WAAY,eAAe;IACvB,iCAAc,CAAA;IACd,uCAAoB,CAAA;IACpB,yCAAsB,CAAA;IACtB,gCAAa,CAAA;AACjB,CAAC,EALW,eAAe,KAAf,eAAe;;SCRX,mBAAmB,CAAC,eAAoC,EAAE;IAEtE,MAAM,QAAQ,GAAoB,EAAE,CAAC;IAErC,KAAM,MAAM,EAAE,IAAI,YAAY,EAAG;QAC7B,IAAI,SAAS,GAAG,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC,CAAA;;QAGvC,IAAI,KAAK,IAAI,EAAE,CAAC,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;QACzC,IAAI,aAAa,IAAI,EAAE,CAAC,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;QAEjD,IAAI,eAAe,IAAI,SAAS,GAAG,CAAC,CAAC,CAAC,CAAA;QAEtC,MAAM,sBAAsB,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;QAEhG,MAAM,iBAAiB,IAAI,sBAAsB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;QAE7D,QAAQ,CAAC,IAAI,CACT;YACI,GAAG,EAAE,EAAE,CAAC,GAAG;YACX,KAAK,EAAE,KAAK;YACZ,aAAa,EAAE,aAAa;YAC5B,gBAAgB,EAAE,EAAE,CAAC,iBAAiB,CAAC,QAAQ,EAAE;YACjD,QAAQ,EAAE,EAAE,CAAC,UAAU;YACvB,QAAQ,EAAE,KAAK,GAAG,eAAe,GAAG,KAAK,GAAG,eAAe;YAC3D,iBAAiB;SACpB,CACJ,CAAA;KACJ;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,SAAS,WAAW,CAAC,UAAsB,EAAE;IAEzC,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB,KAAI,MAAM,QAAQ,IAAI,OAAO,EAAE;QAC3B,IAAG,CAAC,eAAe,CAAC,CAAC,EAAE,eAAe,CAAC,EAAE,EAAE,eAAe,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YACpF,SAAS,IAAI,QAAQ,CAAC,KAAK,CAAC;SAC/B;KACJ;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAED;AAEA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;;;;","names":[],"sources":["src/dto/validate.pin.bonus.ts","src/helpers/build.payload.helper.ts"],"sourcesContent":["export interface IProduct {\r\n productVariantId: string;\r\n sku: string;\r\n value: number;\r\n originalValue: number;\r\n quantity: number;\r\n discount: number;\r\n promotion_product: boolean;\r\n}\r\n\r\nexport enum AjustesTipoEnum {\r\n P = \"Promocao\",\r\n CC = \"ContaCorrente\",\r\n PP = \"PromocaoProduto\",\r\n F = \"Formula\"\r\n}\r\n\r\nexport interface IAjustes {\r\n Tipo: AjustesTipoEnum;\r\n Valor: number;\r\n}\r\n\r\nexport interface IUser {\r\n id: number;\r\n}\r\n\r\nexport interface IStore {\r\n name: string;\r\n}\r\n\r\nexport interface IProductWake {\r\n ProdutoVarianteId: number;\r\n SKU: string;\r\n PrecoPor: number;\r\n PrecoDe: number;\r\n Quantidade: number;\r\n Ajustes: IAjustes[];\r\n}\r\n\r\nexport interface ICustomer {\r\n birthDate: string;\r\n document: string;\r\n name: string;\r\n phone: string;\r\n}\r\n\r\nexport interface IProccesPinBonusDto {\r\n storeName: string;\r\n name: string;\r\n checkoutId: string;\r\n checkoutProducts: Array<IProduct>;\r\n storeId: string;\r\n userId: string;\r\n cellphone: number;\r\n pin: string;\r\n\r\n}\r\n\r\nexport interface IBonus {\r\n hasBonus: boolean;\r\n bonusBalance: number;\r\n totalBonus: number;\r\n minimumPurchase: number;\r\n bonusIds: string;\r\n firstValidityDate: string\r\n history: [\r\n {\r\n validityStart: string;\r\n validityEnd: string;\r\n value: number\r\n },\r\n {\r\n validityStart: string;\r\n validityEnd: string\r\n value: number\r\n }\r\n ]\r\n storeId: number;\r\n userId: number;\r\n cartId: string\r\n calculatedValue: number;\r\n totalValue: number\r\n}\r\n\r\n\r\nexport interface IReserveDTO {\r\n storeName: string;\r\n cartId: string;\r\n grossValue: number;\r\n redeemedBonus: number;\r\n ticket: string;\r\n storeId: string;\r\n userId: number;\r\n}","import { AjustesTipoEnum, IAjustes, IProduct, IProductWake } from \"../dto/validate.pin.bonus\";\r\n\r\nexport function buildProductsByWake(productsWake: Array<IProductWake> = []): Array<IProduct> {\r\n\r\n const products: Array<IProduct> = [];\r\n\r\n for ( const pw of productsWake ) {\r\n let discounts = getDiscount(pw.Ajustes)\r\n // let discounts_formula = getDiscountFormula(pw.Ajustes);\r\n\r\n var value = (pw.PrecoDe * pw.Quantidade);\r\n var originalValue = (pw.PrecoDe * pw.Quantidade);\r\n\r\n var discounts_value = (discounts * -1)\r\n\r\n const existsPromotionProduct = pw.Ajustes.filter(adj => [AjustesTipoEnum.PP].includes(adj.Tipo))\r\n\r\n const promotion_product = (existsPromotionProduct.length > 0)\r\n\r\n products.push(\r\n {\r\n sku: pw.SKU,\r\n value: value,\r\n originalValue: originalValue,\r\n productVariantId: pw.ProdutoVarianteId.toString(),\r\n quantity: pw.Quantidade,\r\n discount: value < discounts_value ? value : discounts_value,\r\n promotion_product\r\n }\r\n )\r\n }\r\n\r\n return products;\r\n}\r\n\r\nfunction getDiscount(ajustes: IAjustes[] = []) {\r\n \r\n let discounts = 0;\r\n \r\n for(const discount of ajustes) {\r\n if([AjustesTipoEnum.P, AjustesTipoEnum.CC, AjustesTipoEnum.PP].includes(discount.Tipo)) {\r\n discounts += discount.Valor;\r\n }\r\n }\r\n\r\n return discounts;\r\n}\r\n\r\n// function getDiscountFormula(ajustes: IAjustes[] = []) {\r\n \r\n// let discounts = 0;\r\n \r\n// for(const discount of ajustes) {\r\n// if([AjustesTipoEnum.F].includes(discount.Tipo)) {\r\n// discounts += (discount.Valor * -1);\r\n// }\r\n// }\r\n\r\n// return discounts;\r\n// }"],"version":3}
@@ -6,7 +6,7 @@ const index = require('./index-a7537457.js');
6
6
  const info_config_helper = require('./info.config.helper-e35e6e20.js');
7
7
  const cart_helper = require('./cart.helper-b08a12b2.js');
8
8
  const i18n = require('./i18n-1ce6cb94.js');
9
- const build_payload_helper = require('./build.payload.helper-b93f7ea5.js');
9
+ const build_payload_helper = require('./build.payload.helper-cfd3173e.js');
10
10
 
11
11
  const moneyDollarsSvgrepoComSvg = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPg0KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxjaXJjbGUgY3g9IjEyIiBjeT0iMTIiIHI9IjEwIiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS13aWR0aD0iMiIvPg0KPHBhdGggZD0iTTE1IDkuOTQ3MjhDMTQuNSA5LjMgMTMuOCA4LjUgMTIgOC41QzEwLjIgOC41IDkgOS41MTM5MyA5IDkuOTQ3MjhDOSAxMC4zODA2IDkuMDY3ODYgMTAuOTI3NyAxMCAxMS41QzEwLjc1MjIgMTEuOTYxOCAxMi42Njg0IDEyLjA0MzkgMTMuNSAxMi41QzE0LjY3OSAxMy4xNDY3IDE0Ljg0OTcgMTMuODIwMiAxNC44NDk3IDE0LjA1MjJDMTQuODQ5NyAxNC42ODM3IDEzLjQxNzUgMTUuNDg1MiAxMiAxNS41QzEwLjUzNiAxNS41MTUzIDkuNSAxNC43IDkgMTQuMDUyMiIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPg0KPHBhdGggZD0iTTEyIDdWMTciIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPg0KPC9zdmc+';
12
12
 
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-a7537457.js');
6
6
  const cart_helper = require('./cart.helper-b08a12b2.js');
7
7
  const i18n = require('./i18n-1ce6cb94.js');
8
- const build_payload_helper = require('./build.payload.helper-b93f7ea5.js');
8
+ const build_payload_helper = require('./build.payload.helper-cfd3173e.js');
9
9
 
10
10
  const crmBonusCss = ".container-button{cursor:pointer;padding:5px 5px 5px 14px;}.section-crm{border:1px solid #dbd4d4;text-align:-webkit-center;margin-bottom:20px}.section-cart-crm{margin-top:10px}.section-cart-crm p{padding:0;margin:0px 0px 0px 15px}.button{top:50%;background-color:#6c6c7e;color:#fff;border:none;padding:15px;min-height:30px;min-width:120px;cursor:pointer;margin-left:10px;height:70px}.form-container{width:97%;display:flex;justify-content:space-around}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:0px}.form-container .btnCrm{background:#00162e;border-color:#00162e;width:30%;color:#fff}.message-alert{color:#df4d4d;margin-top:5px}";
11
11
  const CrmBonusStyle0 = crmBonusCss;
@@ -1 +1 @@
1
- {"version":3,"file":"validate.pin.bonus.js","sourceRoot":"","sources":["../../../src/dto/validate.pin.bonus.ts"],"names":[],"mappings":"AASA,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACvB,iCAAc,CAAA;IACd,uCAAoB,CAAA;IACpB,yCAAsB,CAAA;IACtB,gCAAa,CAAA;AACjB,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B","sourcesContent":["export interface IProduct {\r\n productVariantId: string;\r\n sku: string;\r\n value: number;\r\n originalValue: number;\r\n quantity: number;\r\n discount: number;\r\n}\r\n\r\nexport enum AjustesTipoEnum {\r\n P = \"Promocao\",\r\n CC = \"ContaCorrente\",\r\n PP = \"PromocaoProduto\",\r\n F = \"Formula\"\r\n}\r\n\r\nexport interface IAjustes {\r\n Tipo: AjustesTipoEnum;\r\n Valor: number;\r\n}\r\n\r\nexport interface IUser {\r\n id: number;\r\n}\r\n\r\nexport interface IStore {\r\n name: string;\r\n}\r\n\r\nexport interface IProductWake {\r\n ProdutoVarianteId: number;\r\n SKU: string;\r\n PrecoPor: number;\r\n PrecoDe: number;\r\n Quantidade: number;\r\n Ajustes: IAjustes[];\r\n}\r\n\r\nexport interface ICustomer {\r\n birthDate: string;\r\n document: string;\r\n name: string;\r\n phone: string;\r\n}\r\n\r\nexport interface IProccesPinBonusDto {\r\n storeName: string;\r\n name: string;\r\n checkoutId: string;\r\n checkoutProducts: Array<IProduct>;\r\n storeId: string;\r\n userId: string;\r\n cellphone: number;\r\n pin: string;\r\n\r\n}\r\n\r\nexport interface IBonus {\r\n hasBonus: boolean;\r\n bonusBalance: number;\r\n totalBonus: number;\r\n minimumPurchase: number;\r\n bonusIds: string;\r\n firstValidityDate: string\r\n history: [\r\n {\r\n validityStart: string;\r\n validityEnd: string;\r\n value: number\r\n },\r\n {\r\n validityStart: string;\r\n validityEnd: string\r\n value: number\r\n }\r\n ]\r\n storeId: number;\r\n userId: number;\r\n cartId: string\r\n calculatedValue: number;\r\n totalValue: number\r\n}\r\n\r\n\r\nexport interface IReserveDTO {\r\n storeName: string;\r\n cartId: string;\r\n grossValue: number;\r\n redeemedBonus: number;\r\n ticket: string;\r\n storeId: string;\r\n userId: number;\r\n}"]}
1
+ {"version":3,"file":"validate.pin.bonus.js","sourceRoot":"","sources":["../../../src/dto/validate.pin.bonus.ts"],"names":[],"mappings":"AAUA,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACvB,iCAAc,CAAA;IACd,uCAAoB,CAAA;IACpB,yCAAsB,CAAA;IACtB,gCAAa,CAAA;AACjB,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B","sourcesContent":["export interface IProduct {\r\n productVariantId: string;\r\n sku: string;\r\n value: number;\r\n originalValue: number;\r\n quantity: number;\r\n discount: number;\r\n promotion_product: boolean;\r\n}\r\n\r\nexport enum AjustesTipoEnum {\r\n P = \"Promocao\",\r\n CC = \"ContaCorrente\",\r\n PP = \"PromocaoProduto\",\r\n F = \"Formula\"\r\n}\r\n\r\nexport interface IAjustes {\r\n Tipo: AjustesTipoEnum;\r\n Valor: number;\r\n}\r\n\r\nexport interface IUser {\r\n id: number;\r\n}\r\n\r\nexport interface IStore {\r\n name: string;\r\n}\r\n\r\nexport interface IProductWake {\r\n ProdutoVarianteId: number;\r\n SKU: string;\r\n PrecoPor: number;\r\n PrecoDe: number;\r\n Quantidade: number;\r\n Ajustes: IAjustes[];\r\n}\r\n\r\nexport interface ICustomer {\r\n birthDate: string;\r\n document: string;\r\n name: string;\r\n phone: string;\r\n}\r\n\r\nexport interface IProccesPinBonusDto {\r\n storeName: string;\r\n name: string;\r\n checkoutId: string;\r\n checkoutProducts: Array<IProduct>;\r\n storeId: string;\r\n userId: string;\r\n cellphone: number;\r\n pin: string;\r\n\r\n}\r\n\r\nexport interface IBonus {\r\n hasBonus: boolean;\r\n bonusBalance: number;\r\n totalBonus: number;\r\n minimumPurchase: number;\r\n bonusIds: string;\r\n firstValidityDate: string\r\n history: [\r\n {\r\n validityStart: string;\r\n validityEnd: string;\r\n value: number\r\n },\r\n {\r\n validityStart: string;\r\n validityEnd: string\r\n value: number\r\n }\r\n ]\r\n storeId: number;\r\n userId: number;\r\n cartId: string\r\n calculatedValue: number;\r\n totalValue: number\r\n}\r\n\r\n\r\nexport interface IReserveDTO {\r\n storeName: string;\r\n cartId: string;\r\n grossValue: number;\r\n redeemedBonus: number;\r\n ticket: string;\r\n storeId: string;\r\n userId: number;\r\n}"]}
@@ -7,6 +7,8 @@ export function buildProductsByWake(productsWake = []) {
7
7
  var value = (pw.PrecoDe * pw.Quantidade);
8
8
  var originalValue = (pw.PrecoDe * pw.Quantidade);
9
9
  var discounts_value = (discounts * -1);
10
+ const existsPromotionProduct = pw.Ajustes.filter(adj => [AjustesTipoEnum.PP].includes(adj.Tipo));
11
+ const promotion_product = (existsPromotionProduct.length > 0);
10
12
  products.push({
11
13
  sku: pw.SKU,
12
14
  value: value,
@@ -14,6 +16,7 @@ export function buildProductsByWake(productsWake = []) {
14
16
  productVariantId: pw.ProdutoVarianteId.toString(),
15
17
  quantity: pw.Quantidade,
16
18
  discount: value < discounts_value ? value : discounts_value,
19
+ promotion_product
17
20
  });
18
21
  }
19
22
  return products;
@@ -1 +1 @@
1
- {"version":3,"file":"build.payload.helper.js","sourceRoot":"","sources":["../../../src/helpers/build.payload.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAoC,MAAM,2BAA2B,CAAC;AAE9F,MAAM,UAAU,mBAAmB,CAAC,eAAoC,EAAE;IAEtE,MAAM,QAAQ,GAAoB,EAAE,CAAC;IAErC,KAAM,MAAM,EAAE,IAAI,YAAY,EAAG,CAAC;QAC9B,IAAI,SAAS,GAAG,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC,CAAA;QACvC,0DAA0D;QAE1D,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;QACzC,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;QAEjD,IAAI,eAAe,GAAG,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAA;QAEtC,QAAQ,CAAC,IAAI,CACT;YACI,GAAG,EAAE,EAAE,CAAC,GAAG;YACX,KAAK,EAAE,KAAK;YACZ,aAAa,EAAE,aAAa;YAC5B,gBAAgB,EAAE,EAAE,CAAC,iBAAiB,CAAC,QAAQ,EAAE;YACjD,QAAQ,EAAE,EAAE,CAAC,UAAU;YACvB,QAAQ,EAAE,KAAK,GAAG,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,eAAe;SAC9D,CACJ,CAAA;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,SAAS,WAAW,CAAC,UAAsB,EAAE;IAEzC,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB,KAAI,MAAM,QAAQ,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAG,CAAC,eAAe,CAAC,CAAC,EAAE,eAAe,CAAC,EAAE,EAAE,eAAe,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACrF,SAAS,IAAI,QAAQ,CAAC,KAAK,CAAC;QAChC,CAAC;IACL,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,0DAA0D;AAE1D,yBAAyB;AAEzB,uCAAuC;AACvC,4DAA4D;AAC5D,kDAAkD;AAClD,YAAY;AACZ,QAAQ;AAER,wBAAwB;AACxB,IAAI","sourcesContent":["import { AjustesTipoEnum, IAjustes, IProduct, IProductWake } from \"../dto/validate.pin.bonus\";\r\n\r\nexport function buildProductsByWake(productsWake: Array<IProductWake> = []): Array<IProduct> {\r\n\r\n const products: Array<IProduct> = [];\r\n\r\n for ( const pw of productsWake ) {\r\n let discounts = getDiscount(pw.Ajustes)\r\n // let discounts_formula = getDiscountFormula(pw.Ajustes);\r\n\r\n var value = (pw.PrecoDe * pw.Quantidade);\r\n var originalValue = (pw.PrecoDe * pw.Quantidade);\r\n\r\n var discounts_value = (discounts * -1)\r\n\r\n products.push(\r\n {\r\n sku: pw.SKU,\r\n value: value,\r\n originalValue: originalValue,\r\n productVariantId: pw.ProdutoVarianteId.toString(),\r\n quantity: pw.Quantidade,\r\n discount: value < discounts_value ? value : discounts_value,\r\n }\r\n )\r\n }\r\n\r\n return products;\r\n}\r\n\r\nfunction getDiscount(ajustes: IAjustes[] = []) {\r\n \r\n let discounts = 0;\r\n \r\n for(const discount of ajustes) {\r\n if([AjustesTipoEnum.P, AjustesTipoEnum.CC, AjustesTipoEnum.PP].includes(discount.Tipo)) {\r\n discounts += discount.Valor;\r\n }\r\n }\r\n\r\n return discounts;\r\n}\r\n\r\n// function getDiscountFormula(ajustes: IAjustes[] = []) {\r\n \r\n// let discounts = 0;\r\n \r\n// for(const discount of ajustes) {\r\n// if([AjustesTipoEnum.F].includes(discount.Tipo)) {\r\n// discounts += (discount.Valor * -1);\r\n// }\r\n// }\r\n\r\n// return discounts;\r\n// }"]}
1
+ {"version":3,"file":"build.payload.helper.js","sourceRoot":"","sources":["../../../src/helpers/build.payload.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAoC,MAAM,2BAA2B,CAAC;AAE9F,MAAM,UAAU,mBAAmB,CAAC,eAAoC,EAAE;IAEtE,MAAM,QAAQ,GAAoB,EAAE,CAAC;IAErC,KAAM,MAAM,EAAE,IAAI,YAAY,EAAG,CAAC;QAC9B,IAAI,SAAS,GAAG,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC,CAAA;QACvC,0DAA0D;QAE1D,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;QACzC,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;QAEjD,IAAI,eAAe,GAAG,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAA;QAEtC,MAAM,sBAAsB,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;QAEhG,MAAM,iBAAiB,GAAG,CAAC,sBAAsB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;QAE7D,QAAQ,CAAC,IAAI,CACT;YACI,GAAG,EAAE,EAAE,CAAC,GAAG;YACX,KAAK,EAAE,KAAK;YACZ,aAAa,EAAE,aAAa;YAC5B,gBAAgB,EAAE,EAAE,CAAC,iBAAiB,CAAC,QAAQ,EAAE;YACjD,QAAQ,EAAE,EAAE,CAAC,UAAU;YACvB,QAAQ,EAAE,KAAK,GAAG,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,eAAe;YAC3D,iBAAiB;SACpB,CACJ,CAAA;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,SAAS,WAAW,CAAC,UAAsB,EAAE;IAEzC,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB,KAAI,MAAM,QAAQ,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAG,CAAC,eAAe,CAAC,CAAC,EAAE,eAAe,CAAC,EAAE,EAAE,eAAe,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACrF,SAAS,IAAI,QAAQ,CAAC,KAAK,CAAC;QAChC,CAAC;IACL,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,0DAA0D;AAE1D,yBAAyB;AAEzB,uCAAuC;AACvC,4DAA4D;AAC5D,kDAAkD;AAClD,YAAY;AACZ,QAAQ;AAER,wBAAwB;AACxB,IAAI","sourcesContent":["import { AjustesTipoEnum, IAjustes, IProduct, IProductWake } from \"../dto/validate.pin.bonus\";\r\n\r\nexport function buildProductsByWake(productsWake: Array<IProductWake> = []): Array<IProduct> {\r\n\r\n const products: Array<IProduct> = [];\r\n\r\n for ( const pw of productsWake ) {\r\n let discounts = getDiscount(pw.Ajustes)\r\n // let discounts_formula = getDiscountFormula(pw.Ajustes);\r\n\r\n var value = (pw.PrecoDe * pw.Quantidade);\r\n var originalValue = (pw.PrecoDe * pw.Quantidade);\r\n\r\n var discounts_value = (discounts * -1)\r\n\r\n const existsPromotionProduct = pw.Ajustes.filter(adj => [AjustesTipoEnum.PP].includes(adj.Tipo))\r\n\r\n const promotion_product = (existsPromotionProduct.length > 0)\r\n\r\n products.push(\r\n {\r\n sku: pw.SKU,\r\n value: value,\r\n originalValue: originalValue,\r\n productVariantId: pw.ProdutoVarianteId.toString(),\r\n quantity: pw.Quantidade,\r\n discount: value < discounts_value ? value : discounts_value,\r\n promotion_product\r\n }\r\n )\r\n }\r\n\r\n return products;\r\n}\r\n\r\nfunction getDiscount(ajustes: IAjustes[] = []) {\r\n \r\n let discounts = 0;\r\n \r\n for(const discount of ajustes) {\r\n if([AjustesTipoEnum.P, AjustesTipoEnum.CC, AjustesTipoEnum.PP].includes(discount.Tipo)) {\r\n discounts += discount.Valor;\r\n }\r\n }\r\n\r\n return discounts;\r\n}\r\n\r\n// function getDiscountFormula(ajustes: IAjustes[] = []) {\r\n \r\n// let discounts = 0;\r\n \r\n// for(const discount of ajustes) {\r\n// if([AjustesTipoEnum.F].includes(discount.Tipo)) {\r\n// discounts += (discount.Valor * -1);\r\n// }\r\n// }\r\n\r\n// return discounts;\r\n// }"]}
@@ -3,7 +3,7 @@ import { g as getInfoCustomization } from './p-1b441909.js';
3
3
  import { C as CrmBonusService, b as CartWake, g as getCart, a as getInfoBonusByCartIdAndStoreName, c as getKeyReserveByCartId } from './p-c90ea2e9.js';
4
4
  import { i as instance } from './p-c53241bf.js';
5
5
  import { d as defaultStyles } from './p-ecc51430.js';
6
- import { b as buildProductsByWake } from './p-4c7e066c.js';
6
+ import { b as buildProductsByWake } from './p-b0ef2c0b.js';
7
7
  import { d as defineCustomElement$2 } from './p-c5be72a0.js';
8
8
 
9
9
  const moneyDollarsSvgrepoComSvg = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPg0KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxjaXJjbGUgY3g9IjEyIiBjeT0iMTIiIHI9IjEwIiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS13aWR0aD0iMiIvPg0KPHBhdGggZD0iTTE1IDkuOTQ3MjhDMTQuNSA5LjMgMTMuOCA4LjUgMTIgOC41QzEwLjIgOC41IDkgOS41MTM5MyA5IDkuOTQ3MjhDOSAxMC4zODA2IDkuMDY3ODYgMTAuOTI3NyAxMCAxMS41QzEwLjc1MjIgMTEuOTYxOCAxMi42Njg0IDEyLjA0MzkgMTMuNSAxMi41QzE0LjY3OSAxMy4xNDY3IDE0Ljg0OTcgMTMuODIwMiAxNC44NDk3IDE0LjA1MjJDMTQuODQ5NyAxNC42ODM3IDEzLjQxNzUgMTUuNDg1MiAxMiAxNS41QzEwLjUzNiAxNS41MTUzIDkuNSAxNC43IDkgMTQuMDUyMiIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPg0KPHBhdGggZD0iTTEyIDdWMTciIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPg0KPC9zdmc+';
@@ -2,7 +2,7 @@ import { p as proxyCustomElement, H, h } from './p-9d950d25.js';
2
2
  import { C as CrmBonusService, U as USED_KEY, g as getCart, a as getInfoBonusByCartIdAndStoreName, b as CartWake } from './p-c90ea2e9.js';
3
3
  import { d as defaultStyles, S as StepFormEnum } from './p-ecc51430.js';
4
4
  import { i as instance } from './p-c53241bf.js';
5
- import { b as buildProductsByWake } from './p-4c7e066c.js';
5
+ import { b as buildProductsByWake } from './p-b0ef2c0b.js';
6
6
  import { d as defineCustomElement$b } from './p-11520f0f.js';
7
7
  import { d as defineCustomElement$a } from './p-bc930dfe.js';
8
8
  import { d as defineCustomElement$9 } from './p-0bb6b0e5.js';
@@ -14,6 +14,8 @@ function buildProductsByWake(productsWake = []) {
14
14
  var value = (pw.PrecoDe * pw.Quantidade);
15
15
  var originalValue = (pw.PrecoDe * pw.Quantidade);
16
16
  var discounts_value = (discounts * -1);
17
+ const existsPromotionProduct = pw.Ajustes.filter(adj => [AjustesTipoEnum.PP].includes(adj.Tipo));
18
+ const promotion_product = (existsPromotionProduct.length > 0);
17
19
  products.push({
18
20
  sku: pw.SKU,
19
21
  value: value,
@@ -21,6 +23,7 @@ function buildProductsByWake(productsWake = []) {
21
23
  productVariantId: pw.ProdutoVarianteId.toString(),
22
24
  quantity: pw.Quantidade,
23
25
  discount: value < discounts_value ? value : discounts_value,
26
+ promotion_product
24
27
  });
25
28
  }
26
29
  return products;
@@ -46,4 +49,4 @@ function getDiscount(ajustes = []) {
46
49
 
47
50
  export { buildProductsByWake as b };
48
51
 
49
- //# sourceMappingURL=build.payload.helper-caf0a82b.js.map
52
+ //# sourceMappingURL=p-b0ef2c0b.js.map
@@ -0,0 +1 @@
1
+ {"file":"p-b0ef2c0b.js","mappings":"AAUA,IAAY,eAKX;AALD,WAAY,eAAe;IACvB,iCAAc,CAAA;IACd,uCAAoB,CAAA;IACpB,yCAAsB,CAAA;IACtB,gCAAa,CAAA;AACjB,CAAC,EALW,eAAe,KAAf,eAAe;;SCRX,mBAAmB,CAAC,eAAoC,EAAE;IAEtE,MAAM,QAAQ,GAAoB,EAAE,CAAC;IAErC,KAAM,MAAM,EAAE,IAAI,YAAY,EAAG;QAC7B,IAAI,SAAS,GAAG,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC,CAAA;;QAGvC,IAAI,KAAK,IAAI,EAAE,CAAC,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;QACzC,IAAI,aAAa,IAAI,EAAE,CAAC,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;QAEjD,IAAI,eAAe,IAAI,SAAS,GAAG,CAAC,CAAC,CAAC,CAAA;QAEtC,MAAM,sBAAsB,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;QAEhG,MAAM,iBAAiB,IAAI,sBAAsB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;QAE7D,QAAQ,CAAC,IAAI,CACT;YACI,GAAG,EAAE,EAAE,CAAC,GAAG;YACX,KAAK,EAAE,KAAK;YACZ,aAAa,EAAE,aAAa;YAC5B,gBAAgB,EAAE,EAAE,CAAC,iBAAiB,CAAC,QAAQ,EAAE;YACjD,QAAQ,EAAE,EAAE,CAAC,UAAU;YACvB,QAAQ,EAAE,KAAK,GAAG,eAAe,GAAG,KAAK,GAAG,eAAe;YAC3D,iBAAiB;SACpB,CACJ,CAAA;KACJ;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,SAAS,WAAW,CAAC,UAAsB,EAAE;IAEzC,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB,KAAI,MAAM,QAAQ,IAAI,OAAO,EAAE;QAC3B,IAAG,CAAC,eAAe,CAAC,CAAC,EAAE,eAAe,CAAC,EAAE,EAAE,eAAe,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YACpF,SAAS,IAAI,QAAQ,CAAC,KAAK,CAAC;SAC/B;KACJ;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAED;AAEA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;;;;","names":[],"sources":["src/dto/validate.pin.bonus.ts","src/helpers/build.payload.helper.ts"],"sourcesContent":["export interface IProduct {\r\n productVariantId: string;\r\n sku: string;\r\n value: number;\r\n originalValue: number;\r\n quantity: number;\r\n discount: number;\r\n promotion_product: boolean;\r\n}\r\n\r\nexport enum AjustesTipoEnum {\r\n P = \"Promocao\",\r\n CC = \"ContaCorrente\",\r\n PP = \"PromocaoProduto\",\r\n F = \"Formula\"\r\n}\r\n\r\nexport interface IAjustes {\r\n Tipo: AjustesTipoEnum;\r\n Valor: number;\r\n}\r\n\r\nexport interface IUser {\r\n id: number;\r\n}\r\n\r\nexport interface IStore {\r\n name: string;\r\n}\r\n\r\nexport interface IProductWake {\r\n ProdutoVarianteId: number;\r\n SKU: string;\r\n PrecoPor: number;\r\n PrecoDe: number;\r\n Quantidade: number;\r\n Ajustes: IAjustes[];\r\n}\r\n\r\nexport interface ICustomer {\r\n birthDate: string;\r\n document: string;\r\n name: string;\r\n phone: string;\r\n}\r\n\r\nexport interface IProccesPinBonusDto {\r\n storeName: string;\r\n name: string;\r\n checkoutId: string;\r\n checkoutProducts: Array<IProduct>;\r\n storeId: string;\r\n userId: string;\r\n cellphone: number;\r\n pin: string;\r\n\r\n}\r\n\r\nexport interface IBonus {\r\n hasBonus: boolean;\r\n bonusBalance: number;\r\n totalBonus: number;\r\n minimumPurchase: number;\r\n bonusIds: string;\r\n firstValidityDate: string\r\n history: [\r\n {\r\n validityStart: string;\r\n validityEnd: string;\r\n value: number\r\n },\r\n {\r\n validityStart: string;\r\n validityEnd: string\r\n value: number\r\n }\r\n ]\r\n storeId: number;\r\n userId: number;\r\n cartId: string\r\n calculatedValue: number;\r\n totalValue: number\r\n}\r\n\r\n\r\nexport interface IReserveDTO {\r\n storeName: string;\r\n cartId: string;\r\n grossValue: number;\r\n redeemedBonus: number;\r\n ticket: string;\r\n storeId: string;\r\n userId: number;\r\n}","import { AjustesTipoEnum, IAjustes, IProduct, IProductWake } from \"../dto/validate.pin.bonus\";\r\n\r\nexport function buildProductsByWake(productsWake: Array<IProductWake> = []): Array<IProduct> {\r\n\r\n const products: Array<IProduct> = [];\r\n\r\n for ( const pw of productsWake ) {\r\n let discounts = getDiscount(pw.Ajustes)\r\n // let discounts_formula = getDiscountFormula(pw.Ajustes);\r\n\r\n var value = (pw.PrecoDe * pw.Quantidade);\r\n var originalValue = (pw.PrecoDe * pw.Quantidade);\r\n\r\n var discounts_value = (discounts * -1)\r\n\r\n const existsPromotionProduct = pw.Ajustes.filter(adj => [AjustesTipoEnum.PP].includes(adj.Tipo))\r\n\r\n const promotion_product = (existsPromotionProduct.length > 0)\r\n\r\n products.push(\r\n {\r\n sku: pw.SKU,\r\n value: value,\r\n originalValue: originalValue,\r\n productVariantId: pw.ProdutoVarianteId.toString(),\r\n quantity: pw.Quantidade,\r\n discount: value < discounts_value ? value : discounts_value,\r\n promotion_product\r\n }\r\n )\r\n }\r\n\r\n return products;\r\n}\r\n\r\nfunction getDiscount(ajustes: IAjustes[] = []) {\r\n \r\n let discounts = 0;\r\n \r\n for(const discount of ajustes) {\r\n if([AjustesTipoEnum.P, AjustesTipoEnum.CC, AjustesTipoEnum.PP].includes(discount.Tipo)) {\r\n discounts += discount.Valor;\r\n }\r\n }\r\n\r\n return discounts;\r\n}\r\n\r\n// function getDiscountFormula(ajustes: IAjustes[] = []) {\r\n \r\n// let discounts = 0;\r\n \r\n// for(const discount of ajustes) {\r\n// if([AjustesTipoEnum.F].includes(discount.Tipo)) {\r\n// discounts += (discount.Valor * -1);\r\n// }\r\n// }\r\n\r\n// return discounts;\r\n// }"],"version":3}
@@ -1,2 +1,2 @@
1
- import{p as e,b as o}from"./p-8c362346.js";export{s as setNonce}from"./p-8c362346.js";import{g as n}from"./p-e1255160.js";var a=()=>{const o=import.meta.url;const n={};if(o!==""){n.resourcesUrl=new URL(".",o).href}return e(n)};a().then((async e=>{await n();return o([["p-a0d73d77",[[1,"crm-bonus",{cart:[8],canhidden:[4],showModal:[32],cartWake:[32],customer:[32],loading:[32],message:[32],phone:[32],canCancel:[32],amountCancel:[32],sent:[32],session:[32],loading_reprocess:[32],styles:[32],reservedInfo:[32],resetBonus:[64],setloading:[64],reprocess:[64]}]]],["p-4ed412c2",[[1,"crm-bonus-2",{loading:[32],cartWake:[32]}]]],["p-3e87e176",[[0,"crm-bonus-note",{cart:[8],cartWake:[32],url:[32],config:[32],bonus:[32],showEdit:[32],styles:[32],infoBonus:[32],loading:[32],info:[32]}]]],["p-61ea41c9",[[1,"app-modal",{isOpen:[516,"is-open"],modalTitle:[1,"modal-title"]}]]],["p-ac027576",[[1,"countdown-timer-v2",{downtime:[16],reload:[4],dates:[16],seconds:[32],minutes:[32]}]]],["p-6532623f",[[0,"crm-bonus-tray"]]],["p-9b7bd1e1",[[0,"pedido-finalizado",{cart:[8]}]]],["p-9d926857",[[4,"loading-container",{loading:[4]}]]],["p-ce2819cc",[[1,"loading-spinner",{size:[1],color:[1]}]]],["p-54b8f32b",[[0,"crm-button",{txtBtn:[1,"txt-btn"],loading:[4],handleClick:[16]}],[0,"countdown-timer",{downtime:[16],dataCriacao:[1,"data-criacao"],minutos:[2],segundos:[2],tempoRestante:[32]}]]],["p-558202ef",[[0,"phone-form",{value:[1],loading:[4],handlerSubmit:[16],config:[16]}],[1,"pin-form",{validate:[16],cancel:[16],resend:[16],sent:[16],loading:[4],phone:[1],config:[16],pin:[32],isVerified:[32],canResend:[32]}],[0,"giftback-info",{cartId:[8,"cart-id"],loading:[4],bonus:[16],reserve:[16],cancel:[16],config:[16],infoBonus:[16],storeName:[1,"store-name"],usedValue:[32],selectedOption:[32],sliderPosition:[32],sliderValuePosition:[32],loadingTime:[32]},null,{bonus:["changedBonus"]}],[0,"crm-tooltip",{text:[1],identity:[1]}],[1,"phone-input-mask",{initialValue:[1,"initial-value"],disabled:[4],phone:[32],message:[32],getPhone:[64]}]]],["p-f37f3f3f",[[0,"crm-giftback-form",{storeName:[8,"storename"],cartId:[8,"cart-id"],products:[16],customer:[16],loadProducts:[16],loadAll:[16],customStyles:[8,"custom-styles"],reservedInfo:[16],value:[32],loading:[32],message:[32],phone:[32],pinInfo:[32],step:[32],bonus:[32],sucess:[32],error:[32],config:[32],hasApplyBonus:[32],loadingAllComponent:[32],setStep:[64],processBonus:[64]}]]]],e)}));
1
+ import{p as e,b as o}from"./p-8c362346.js";export{s as setNonce}from"./p-8c362346.js";import{g as n}from"./p-e1255160.js";var a=()=>{const o=import.meta.url;const n={};if(o!==""){n.resourcesUrl=new URL(".",o).href}return e(n)};a().then((async e=>{await n();return o([["p-7d608b81",[[1,"crm-bonus",{cart:[8],canhidden:[4],showModal:[32],cartWake:[32],customer:[32],loading:[32],message:[32],phone:[32],canCancel:[32],amountCancel:[32],sent:[32],session:[32],loading_reprocess:[32],styles:[32],reservedInfo:[32],resetBonus:[64],setloading:[64],reprocess:[64]}]]],["p-4ed412c2",[[1,"crm-bonus-2",{loading:[32],cartWake:[32]}]]],["p-22dc17d2",[[0,"crm-bonus-note",{cart:[8],cartWake:[32],url:[32],config:[32],bonus:[32],showEdit:[32],styles:[32],infoBonus:[32],loading:[32],info:[32]}]]],["p-61ea41c9",[[1,"app-modal",{isOpen:[516,"is-open"],modalTitle:[1,"modal-title"]}]]],["p-ac027576",[[1,"countdown-timer-v2",{downtime:[16],reload:[4],dates:[16],seconds:[32],minutes:[32]}]]],["p-6532623f",[[0,"crm-bonus-tray"]]],["p-9b7bd1e1",[[0,"pedido-finalizado",{cart:[8]}]]],["p-9d926857",[[4,"loading-container",{loading:[4]}]]],["p-ce2819cc",[[1,"loading-spinner",{size:[1],color:[1]}]]],["p-54b8f32b",[[0,"crm-button",{txtBtn:[1,"txt-btn"],loading:[4],handleClick:[16]}],[0,"countdown-timer",{downtime:[16],dataCriacao:[1,"data-criacao"],minutos:[2],segundos:[2],tempoRestante:[32]}]]],["p-558202ef",[[0,"phone-form",{value:[1],loading:[4],handlerSubmit:[16],config:[16]}],[1,"pin-form",{validate:[16],cancel:[16],resend:[16],sent:[16],loading:[4],phone:[1],config:[16],pin:[32],isVerified:[32],canResend:[32]}],[0,"giftback-info",{cartId:[8,"cart-id"],loading:[4],bonus:[16],reserve:[16],cancel:[16],config:[16],infoBonus:[16],storeName:[1,"store-name"],usedValue:[32],selectedOption:[32],sliderPosition:[32],sliderValuePosition:[32],loadingTime:[32]},null,{bonus:["changedBonus"]}],[0,"crm-tooltip",{text:[1],identity:[1]}],[1,"phone-input-mask",{initialValue:[1,"initial-value"],disabled:[4],phone:[32],message:[32],getPhone:[64]}]]],["p-f37f3f3f",[[0,"crm-giftback-form",{storeName:[8,"storename"],cartId:[8,"cart-id"],products:[16],customer:[16],loadProducts:[16],loadAll:[16],customStyles:[8,"custom-styles"],reservedInfo:[16],value:[32],loading:[32],message:[32],phone:[32],pinInfo:[32],step:[32],bonus:[32],sucess:[32],error:[32],config:[32],hasApplyBonus:[32],loadingAllComponent:[32],setStep:[64],processBonus:[64]}]]]],e)}));
2
2
  //# sourceMappingURL=crmbonus-component-wake.esm.js.map
@@ -1,2 +1,2 @@
1
- import{r as n,h as t}from"./p-8c362346.js";import{g as i}from"./p-1b441909.js";import{a as e,C as o,g as r,b as s,c as a}from"./p-c74567c6.js";import{d as c,i as l}from"./p-702d5a6f.js";import{b as d}from"./p-4c7e066c.js";const g="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPg0KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxjaXJjbGUgY3g9IjEyIiBjeT0iMTIiIHI9IjEwIiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS13aWR0aD0iMiIvPg0KPHBhdGggZD0iTTE1IDkuOTQ3MjhDMTQuNSA5LjMgMTMuOCA4LjUgMTIgOC41QzEwLjIgOC41IDkgOS41MTM5MyA5IDkuOTQ3MjhDOSAxMC4zODA2IDkuMDY3ODYgMTAuOTI3NyAxMCAxMS41QzEwLjc1MjIgMTEuOTYxOCAxMi42Njg0IDEyLjA0MzkgMTMuNSAxMi41QzE0LjY3OSAxMy4xNDY3IDE0Ljg0OTcgMTMuODIwMiAxNC44NDk3IDE0LjA1MjJDMTQuODQ5NyAxNC42ODM3IDEzLjQxNzUgMTUuNDg1MiAxMiAxNS41QzEwLjUzNiAxNS41MTUzIDkuNSAxNC43IDkgMTQuMDUyMiIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPg0KPHBhdGggZD0iTTEyIDdWMTciIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPg0KPC9zdmc+";function h(){if(localStorage.getItem("bc:time-allow")){return}const n=localStorage.getItem("bc:time");if(!n){localStorage.setItem("bc:time","360");localStorage.setItem("bc:time-allow","true");return}}const u=".note-container {\r\n border: 1px solid #dddddd;\r\n padding: 0 15px 15px;\r\n margin: 0 0 26px 0px;\r\n display: flex;\r\n flex-direction: column;\r\n gap: 13px;\r\n\r\n\r\n & .description {\r\n display: flex;\r\n flex-direction: column;\r\n gap: 13px;\r\n }\r\n}\r\n\r\n.note-container hr {\r\n border: 1px solid #CCC;\r\n}\r\n\r\n.note-container .back-cart {\r\n display: flex;\r\n text-align: center;\r\n}\r\n\r\n.note-header {\r\n display: flex;\r\n align-items: baseline;\r\n justify-content: space-between;\r\n}\r\n\r\n.note-title {\r\n font-weight: 700;\r\n text-align: left;\r\n display: flex;\r\n gap: 6px;\r\n align-items: center;\r\n margin-top: 11px;\r\n color: #000;\r\n}\r\n\r\n.note-description {\r\n color: #6d6d5f;\r\n padding: 0;\r\n margin: 0 auto;\r\n}\r\n\r\n.back-cart {\r\n /* font-size: .9em; */\r\n color: #27272A;\r\n text-decoration: none;\r\n cursor: pointer;\r\n margin-top: 11px;\r\n}\r\n\r\n.note-description-2 {\r\n color: var(--crm-scheme-fg-main-inverse, #262626);\r\n /* font-size: var(--crm-font-size-body-lg, 16px); */\r\n font-style: normal;\r\n font-weight: var(--crm-font-weight-body-bold, 400);\r\n line-height: var(--crm-line-height-body-md, 20px);\r\n letter-spacing: var(--crm-letter-spacing-title-md, 0px);\r\n margin-top: 11px;\r\n color: #000;\r\n}\r\n\r\n.note-description-not {\r\n /* font-size: 16px; */\r\n}";const f=u;const p=class{constructor(t){n(this,t);this.crmBonusService=e.getInstance();this.cart=undefined;this.cartWake=undefined;this.url=undefined;this.config=undefined;this.bonus=undefined;this.showEdit=false;this.styles=c;this.infoBonus=undefined;this.loading=false;this.info=undefined}async componentWillLoad(){console.log("[CRM-BONUS-NOTE]");await this.upadateCheckToFreteAndGetUrl()}async upadateCheckToFreteAndGetUrl(){var n,t,e;this.cartWake=this.cart?new o(JSON.parse(this.cart)):await r();const c=a(this.cartWake.id);try{const i=await s(this.cartWake.id,this.cartWake.store.name);if(i.bonusBalance){localStorage.setItem(this.cartWake.id,i.bonusBalance);localStorage.setItem(c,JSON.stringify({hasBonus:true}))}if(i.isBonusProcessed){this.startTime()}if((n=i===null||i===void 0?void 0:i.metadata)===null||n===void 0?void 0:n.url){this.url=(t=i===null||i===void 0?void 0:i.metadata)===null||t===void 0?void 0:t.url}this.infoBonus={storeId:i===null||i===void 0?void 0:i.metadata.storeId,userId:i===null||i===void 0?void 0:i.metadata.userId,cellphone:(e=i===null||i===void 0?void 0:i.metadata)===null||e===void 0?void 0:e.cellphone};console.log("info",i);this.info=i}catch(n){localStorage.removeItem(c);localStorage.removeItem(this.cartWake.id)}this.config=i(this.cartWake.store.name);if(this.config.keepStoreFrontStyle){this.styles=null}const l=document.getElementsByName("forma-envio");l.forEach((n=>{n.checked=false}))}async processBonus(){var n,t;this.loading=true;try{const i=await r();console.log("[cart-note]",i);const e=d(i.products);const o={pin:"2018",cellphone:this.infoBonus.cellphone,storeId:(n=this.infoBonus)===null||n===void 0?void 0:n.storeId.toString(),userId:(t=this.infoBonus)===null||t===void 0?void 0:t.userId.toString(),checkoutId:this.cartWake.id,checkoutProducts:e,name:"",storeName:this.cartWake.store.name};this.bonus=await this.crmBonusService.validatePinBonus(o)}catch(n){console.error("Error processing bonus:",n)}finally{this.loading=false;await this.upadateCheckToFreteAndGetUrl()}}handleHide(){const n=localStorage.getItem(this.cartWake.id);return!!n}getAmount(){const n=localStorage.getItem(this.cartWake.id);return n?Number(n).toFixed(2).replace(".",",")||"0,00":"0,00"}async backCart(){window.location.href=this.url}startTime(){if(!localStorage.getItem("bc:time-allow")){localStorage.removeItem("bc:time")}h()}hasBonus(){const n=localStorage.getItem(a(this.cartWake.id));const t={hasBonus:false,requestBonus:false};if(n){this.bonus=JSON.parse(n);t.hasBonus=this.bonus.hasBonus;t.requestBonus=true}return t}getTime(){const n=localStorage.getItem("bc:time");return n?Number(n):0}render(){var n;const i=((n=this.config)===null||n===void 0?void 0:n.giftbackTitle)||"Giftback";const e=this.hasBonus();return t("loading-container",{key:"6d63bd700570c1ea4ff26ea3981fe29db74064b3",loading:this.loading},t("div",{key:"4f9d29d777846491d8d0d5e4ec553b5967d3bfc7",class:"note-container",style:this.styles},t("div",{key:"804b2e9f8daa4e29b77ef36151eaecf7316770a6",class:"note-header"},t("p",{key:"da3521e39d7af05f4dca38757eb207a1fbd2d401",class:"note-title"},t("img",{key:"9f5fd7958280dc8015db1156b19cadf58127be94",src:g,width:23}),this.config.giftbackTitle),e.hasBonus&&t("div",{key:"4359d1b99fd29487d6a484ff5f72f3c8083d68c7"},this.showEdit&&t("p",{key:"ce4073d6704ccd331c15fe3cc7573333fe1eb541",class:"back-cart",onClick:()=>this.backCart()},l.t("edit")))),e.hasBonus?t("p",{class:"note-description-2"},l.t("withApplyBonus",{giftbackname:i})," ",t("strong",null,"R$ ",this.getAmount(),".")):e.requestBonus?t("p",{class:"note-description-not"},l.t("noBonus",{giftbackname:i})):t("div",{class:"description"},t("p",{class:"note-description-not"},l.t("noBonus",{giftbackname:i})))))}};p.style=f;export{p as crm_bonus_note};
2
- //# sourceMappingURL=p-3e87e176.entry.js.map
1
+ import{r as n,h as t}from"./p-8c362346.js";import{g as i}from"./p-1b441909.js";import{a as e,C as o,g as r,b as s,c as a}from"./p-c74567c6.js";import{d as c,i as l}from"./p-702d5a6f.js";import{b as d}from"./p-b0ef2c0b.js";const g="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPg0KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxjaXJjbGUgY3g9IjEyIiBjeT0iMTIiIHI9IjEwIiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS13aWR0aD0iMiIvPg0KPHBhdGggZD0iTTE1IDkuOTQ3MjhDMTQuNSA5LjMgMTMuOCA4LjUgMTIgOC41QzEwLjIgOC41IDkgOS41MTM5MyA5IDkuOTQ3MjhDOSAxMC4zODA2IDkuMDY3ODYgMTAuOTI3NyAxMCAxMS41QzEwLjc1MjIgMTEuOTYxOCAxMi42Njg0IDEyLjA0MzkgMTMuNSAxMi41QzE0LjY3OSAxMy4xNDY3IDE0Ljg0OTcgMTMuODIwMiAxNC44NDk3IDE0LjA1MjJDMTQuODQ5NyAxNC42ODM3IDEzLjQxNzUgMTUuNDg1MiAxMiAxNS41QzEwLjUzNiAxNS41MTUzIDkuNSAxNC43IDkgMTQuMDUyMiIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPg0KPHBhdGggZD0iTTEyIDdWMTciIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPg0KPC9zdmc+";function h(){if(localStorage.getItem("bc:time-allow")){return}const n=localStorage.getItem("bc:time");if(!n){localStorage.setItem("bc:time","360");localStorage.setItem("bc:time-allow","true");return}}const u=".note-container {\r\n border: 1px solid #dddddd;\r\n padding: 0 15px 15px;\r\n margin: 0 0 26px 0px;\r\n display: flex;\r\n flex-direction: column;\r\n gap: 13px;\r\n\r\n\r\n & .description {\r\n display: flex;\r\n flex-direction: column;\r\n gap: 13px;\r\n }\r\n}\r\n\r\n.note-container hr {\r\n border: 1px solid #CCC;\r\n}\r\n\r\n.note-container .back-cart {\r\n display: flex;\r\n text-align: center;\r\n}\r\n\r\n.note-header {\r\n display: flex;\r\n align-items: baseline;\r\n justify-content: space-between;\r\n}\r\n\r\n.note-title {\r\n font-weight: 700;\r\n text-align: left;\r\n display: flex;\r\n gap: 6px;\r\n align-items: center;\r\n margin-top: 11px;\r\n color: #000;\r\n}\r\n\r\n.note-description {\r\n color: #6d6d5f;\r\n padding: 0;\r\n margin: 0 auto;\r\n}\r\n\r\n.back-cart {\r\n /* font-size: .9em; */\r\n color: #27272A;\r\n text-decoration: none;\r\n cursor: pointer;\r\n margin-top: 11px;\r\n}\r\n\r\n.note-description-2 {\r\n color: var(--crm-scheme-fg-main-inverse, #262626);\r\n /* font-size: var(--crm-font-size-body-lg, 16px); */\r\n font-style: normal;\r\n font-weight: var(--crm-font-weight-body-bold, 400);\r\n line-height: var(--crm-line-height-body-md, 20px);\r\n letter-spacing: var(--crm-letter-spacing-title-md, 0px);\r\n margin-top: 11px;\r\n color: #000;\r\n}\r\n\r\n.note-description-not {\r\n /* font-size: 16px; */\r\n}";const f=u;const b=class{constructor(t){n(this,t);this.crmBonusService=e.getInstance();this.cart=undefined;this.cartWake=undefined;this.url=undefined;this.config=undefined;this.bonus=undefined;this.showEdit=false;this.styles=c;this.infoBonus=undefined;this.loading=false;this.info=undefined}async componentWillLoad(){console.log("[CRM-BONUS-NOTE]");await this.upadateCheckToFreteAndGetUrl()}async upadateCheckToFreteAndGetUrl(){var n,t,e;this.cartWake=this.cart?new o(JSON.parse(this.cart)):await r();const c=a(this.cartWake.id);try{const i=await s(this.cartWake.id,this.cartWake.store.name);if(i.bonusBalance){localStorage.setItem(this.cartWake.id,i.bonusBalance);localStorage.setItem(c,JSON.stringify({hasBonus:true}))}if(i.isBonusProcessed){this.startTime()}if((n=i===null||i===void 0?void 0:i.metadata)===null||n===void 0?void 0:n.url){this.url=(t=i===null||i===void 0?void 0:i.metadata)===null||t===void 0?void 0:t.url}this.infoBonus={storeId:i===null||i===void 0?void 0:i.metadata.storeId,userId:i===null||i===void 0?void 0:i.metadata.userId,cellphone:(e=i===null||i===void 0?void 0:i.metadata)===null||e===void 0?void 0:e.cellphone};console.log("info",i);this.info=i}catch(n){localStorage.removeItem(c);localStorage.removeItem(this.cartWake.id)}this.config=i(this.cartWake.store.name);if(this.config.keepStoreFrontStyle){this.styles=null}const l=document.getElementsByName("forma-envio");l.forEach((n=>{n.checked=false}))}async processBonus(){var n,t;this.loading=true;try{const i=await r();console.log("[cart-note]",i);const e=d(i.products);const o={pin:"2018",cellphone:this.infoBonus.cellphone,storeId:(n=this.infoBonus)===null||n===void 0?void 0:n.storeId.toString(),userId:(t=this.infoBonus)===null||t===void 0?void 0:t.userId.toString(),checkoutId:this.cartWake.id,checkoutProducts:e,name:"",storeName:this.cartWake.store.name};this.bonus=await this.crmBonusService.validatePinBonus(o)}catch(n){console.error("Error processing bonus:",n)}finally{this.loading=false;await this.upadateCheckToFreteAndGetUrl()}}handleHide(){const n=localStorage.getItem(this.cartWake.id);return!!n}getAmount(){const n=localStorage.getItem(this.cartWake.id);return n?Number(n).toFixed(2).replace(".",",")||"0,00":"0,00"}async backCart(){window.location.href=this.url}startTime(){if(!localStorage.getItem("bc:time-allow")){localStorage.removeItem("bc:time")}h()}hasBonus(){const n=localStorage.getItem(a(this.cartWake.id));const t={hasBonus:false,requestBonus:false};if(n){this.bonus=JSON.parse(n);t.hasBonus=this.bonus.hasBonus;t.requestBonus=true}return t}getTime(){const n=localStorage.getItem("bc:time");return n?Number(n):0}render(){var n;const i=((n=this.config)===null||n===void 0?void 0:n.giftbackTitle)||"Giftback";const e=this.hasBonus();return t("loading-container",{key:"6d63bd700570c1ea4ff26ea3981fe29db74064b3",loading:this.loading},t("div",{key:"4f9d29d777846491d8d0d5e4ec553b5967d3bfc7",class:"note-container",style:this.styles},t("div",{key:"804b2e9f8daa4e29b77ef36151eaecf7316770a6",class:"note-header"},t("p",{key:"da3521e39d7af05f4dca38757eb207a1fbd2d401",class:"note-title"},t("img",{key:"9f5fd7958280dc8015db1156b19cadf58127be94",src:g,width:23}),this.config.giftbackTitle),e.hasBonus&&t("div",{key:"4359d1b99fd29487d6a484ff5f72f3c8083d68c7"},this.showEdit&&t("p",{key:"ce4073d6704ccd331c15fe3cc7573333fe1eb541",class:"back-cart",onClick:()=>this.backCart()},l.t("edit")))),e.hasBonus?t("p",{class:"note-description-2"},l.t("withApplyBonus",{giftbackname:i})," ",t("strong",null,"R$ ",this.getAmount(),".")):e.requestBonus?t("p",{class:"note-description-not"},l.t("noBonus",{giftbackname:i})):t("div",{class:"description"},t("p",{class:"note-description-not"},l.t("noBonus",{giftbackname:i})))))}};b.style=f;export{b as crm_bonus_note};
2
+ //# sourceMappingURL=p-22dc17d2.entry.js.map
@@ -1,2 +1,2 @@
1
- import{r as t,h as s}from"./p-8c362346.js";import{a as i,U as o,g as e,b as n,C as a}from"./p-c74567c6.js";import{d as r,S as c,i as h}from"./p-702d5a6f.js";import{b as l}from"./p-4c7e066c.js";const d=".container-button{cursor:pointer;padding:5px 5px 5px 14px;}.section-crm{border:1px solid #dbd4d4;text-align:-webkit-center;margin-bottom:20px}.section-cart-crm{margin-top:10px}.section-cart-crm p{padding:0;margin:0px 0px 0px 15px}.button{top:50%;background-color:#6c6c7e;color:#fff;border:none;padding:15px;min-height:30px;min-width:120px;cursor:pointer;margin-left:10px;height:70px}.form-container{width:97%;display:flex;justify-content:space-around}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:0px}.form-container .btnCrm{background:#00162e;border-color:#00162e;width:30%;color:#fff}.message-alert{color:#df4d4d;margin-top:5px}";const u=d;const f=class{constructor(s){t(this,s);this.crmBonusService=i.getInstance();this.cart=undefined;this.canhidden=false;this.showModal=false;this.cartWake=undefined;this.customer={birthDate:"",document:"",name:"",phone:""};this.loading=false;this.message=undefined;this.phone=undefined;this.canCancel=false;this.amountCancel=undefined;this.sent=undefined;this.session=undefined;this.loading_reprocess=false;this.styles=r;this.reservedInfo=undefined}async resetBonus(){console.log("[START RESET BONUS]!!!!!");try{await this.crmBonusRef.processBonus(this.buildProducts(),true);console.log("[BONUS RESETADO]!!!!!")}catch(t){this.loading=false;console.log("[error ao reprocessar bonous]");await this.crmBonusRef.setStep(c.STEP_PHONE)}finally{this.loading=false}}async setloading(){this.loading_reprocess=!this.loading_reprocess}async reprocess(){console.log("[CRMBONUS] - reprocess");this.loading_reprocess=true;try{const t=localStorage.getItem(o);if(!t)return;this.cartWake=await e();await this.resetBonus()}catch(t){console.debug("[watchProducts]",t.message)}finally{this.loading_reprocess=false}}async componentWillLoad(){window.addEventListener("productRemovedFromCart",(async()=>{console.log("[CRMBONUS] - productRemovedFromCart");await this.reprocess()}));window.addEventListener("productAddedToCart",(async()=>{console.log("[CRMBONUS] - productAddedToCart");await this.reprocess()}));document.querySelectorAll("form").forEach((t=>{t.addEventListener("submit",(()=>{console.log("[CRMBONUS] - Formulário está sendo submetido!");setTimeout((async()=>{await this.reprocess()}))}))}));await this.observerHandle();h.changeLanguage(h.language);await this.loadSession();this.handleLoad();await this.loadConfigStore()}async componentDidLoad(){console.log("[did load]")}async observerHandle(){const t=document.getElementsByTagName("a");for(let s of t){console.log("[el.href]",s.href);if(s.href.includes("Produto/Delete")){s.addEventListener("click",(async()=>{console.log("[CRMBONUS] - Produto removido do carrinho");setTimeout((async()=>{await this.reprocess();this.observerHandle()}),2e3)}))}if(s.href.includes("Produto/Add")){s.addEventListener("click",(async()=>{console.log("[CRMBONUS] - Produto adicionado ao carrinho");setTimeout((async()=>{await this.reprocess();this.observerHandle()}),2e3)}))}}}async loadConfigStore(){const[t,s]=await Promise.all([this.crmBonusService.getCustomization(this.cartWake.store.name),n(this.cartWake.id,this.cartWake.store.name)]);console.log("[infoBonus]",s);this.reservedInfo=s;if(t.keepStoreFrontStyle){console.log("[bc:usar estilo da loja]");this.styles=null}}async fetchCustomer(t,s){try{return await this.crmBonusService.getCustomer(t,s)}catch(t){console.error("[fetchCustomer] Error fetching customer:",t);return null}}async handleLoad(){try{if(this.cartWake.user.id){this.fetchCustomer(this.cartWake.user.id,this.cartWake.store.name).then((t=>{console.log("[bc:loading customer]");if(t){this.customer=t;console.log("customer",this.customer)}}))}const t=localStorage.getItem(this.cartWake.id);if(t){this.canCancel=true;this.amountCancel=t}await this.buildAndGetProducts(this.cartWake.products)}catch(t){console.log("info customer")}}async loadSession(){this.cartWake=this.cart?new a(JSON.parse(this.cart)):await e();console.log("[bc:carregou carrinho]");this.session=await this.crmBonusService.getToken(this.cartWake.store.name);console.log("[bc:carregou session]");setTimeout((()=>{this.loadSession()}),15e5)}async buildAndGetProducts(t){console.log();const s=`bc-products:${this.cartWake.id}`;const i=JSON.stringify(t);localStorage.setItem(s,i);const o=JSON.parse(localStorage.getItem(s));const e=[];for(const s of t){const[t]=o.filter((t=>t.ProdutoVarianteId==s.ProdutoVarianteId));if(t){e.push(Object.assign(Object.assign({},s),{PrecoPor:t.PrecoPor,PrecoDe:t.PrecoDe,Quantidade:t.Quantidade,Ajustes:t.Ajustes}))}else{e.push(s)}}this.cartWake.products=e}async sendPin(t){var s,i;this.loading=true;this.message="";try{const s=t.replace(/\D/g,"");this.phone=Number(s);this.sent=await this.crmBonusService.sendPin(this.phone,this.customer.name,this.cartWake.store.name);await this.crmBonusRef.setStep(c.STEP_PIN);this.showModal=true}catch(t){this.message=(i=(s=t===null||t===void 0?void 0:t.response)===null||s===void 0?void 0:s.data)===null||i===void 0?void 0:i.message}finally{this.loading=false}}async sendPinName(t){var s,i;this.loading=true;this.message="";try{this.customer.name=t;this.sent=await this.crmBonusService.sendPin(this.phone,this.customer.name,this.cartWake.store.name);await this.crmBonusRef.setStep(c.STEP_PIN);this.showModal=true}catch(t){this.message=(i=(s=t===null||t===void 0?void 0:t.response)===null||s===void 0?void 0:s.data)===null||i===void 0?void 0:i.message}finally{this.loading=false}}buildProducts(){return l(this.cartWake.products)}handleCloseModal(){this.showModal=false}save(t){localStorage.setItem(this.cartWake.id,t.toString());this.canCancel=true;this.amountCancel=t.toString()}async cancel(){this.message="";this.loading=true;try{await this.crmBonusService.cancel(this.cartWake.id);this.canCancel=false;localStorage.removeItem(this.cartWake.id)}catch(t){this.message="Não consegui cancelar o bônus, tente novamente!"}finally{this.loading=false}}async handleSendPin(t){this.message="";if(!t){this.message="Informe seu telefone";return}this.customer.phone=t;const s=t.replace(/\D/g,"");this.phone=Number(s);if(this.customer.name){return this.sendPin(t)}await this.crmBonusRef.setStep(c.STEP_NAME);this.showModal=true}render(){if(this.canhidden){return null}return s("loading-container",{loading:this.loading_reprocess},s("crm-giftback-form",{customStyles:this.styles,style:{position:"relative"},ref:t=>this.crmBonusRef=t,storeName:this.cartWake.store.name,products:this.buildProducts(),cartId:this.cartWake.id,customer:this.customer,loadProducts:()=>this.buildProducts(),loadAll:()=>this.handleLoad(),reservedInfo:this.reservedInfo}))}static get assetsDirs(){return["assets"]}};f.style=u;export{f as crm_bonus};
2
- //# sourceMappingURL=p-a0d73d77.entry.js.map
1
+ import{r as t,h as s}from"./p-8c362346.js";import{a as i,U as o,g as e,b as n,C as a}from"./p-c74567c6.js";import{d as r,S as c,i as h}from"./p-702d5a6f.js";import{b as l}from"./p-b0ef2c0b.js";const d=".container-button{cursor:pointer;padding:5px 5px 5px 14px;}.section-crm{border:1px solid #dbd4d4;text-align:-webkit-center;margin-bottom:20px}.section-cart-crm{margin-top:10px}.section-cart-crm p{padding:0;margin:0px 0px 0px 15px}.button{top:50%;background-color:#6c6c7e;color:#fff;border:none;padding:15px;min-height:30px;min-width:120px;cursor:pointer;margin-left:10px;height:70px}.form-container{width:97%;display:flex;justify-content:space-around}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:0px}.form-container .btnCrm{background:#00162e;border-color:#00162e;width:30%;color:#fff}.message-alert{color:#df4d4d;margin-top:5px}";const u=d;const f=class{constructor(s){t(this,s);this.crmBonusService=i.getInstance();this.cart=undefined;this.canhidden=false;this.showModal=false;this.cartWake=undefined;this.customer={birthDate:"",document:"",name:"",phone:""};this.loading=false;this.message=undefined;this.phone=undefined;this.canCancel=false;this.amountCancel=undefined;this.sent=undefined;this.session=undefined;this.loading_reprocess=false;this.styles=r;this.reservedInfo=undefined}async resetBonus(){console.log("[START RESET BONUS]!!!!!");try{await this.crmBonusRef.processBonus(this.buildProducts(),true);console.log("[BONUS RESETADO]!!!!!")}catch(t){this.loading=false;console.log("[error ao reprocessar bonous]");await this.crmBonusRef.setStep(c.STEP_PHONE)}finally{this.loading=false}}async setloading(){this.loading_reprocess=!this.loading_reprocess}async reprocess(){console.log("[CRMBONUS] - reprocess");this.loading_reprocess=true;try{const t=localStorage.getItem(o);if(!t)return;this.cartWake=await e();await this.resetBonus()}catch(t){console.debug("[watchProducts]",t.message)}finally{this.loading_reprocess=false}}async componentWillLoad(){window.addEventListener("productRemovedFromCart",(async()=>{console.log("[CRMBONUS] - productRemovedFromCart");await this.reprocess()}));window.addEventListener("productAddedToCart",(async()=>{console.log("[CRMBONUS] - productAddedToCart");await this.reprocess()}));document.querySelectorAll("form").forEach((t=>{t.addEventListener("submit",(()=>{console.log("[CRMBONUS] - Formulário está sendo submetido!");setTimeout((async()=>{await this.reprocess()}))}))}));await this.observerHandle();h.changeLanguage(h.language);await this.loadSession();this.handleLoad();await this.loadConfigStore()}async componentDidLoad(){console.log("[did load]")}async observerHandle(){const t=document.getElementsByTagName("a");for(let s of t){console.log("[el.href]",s.href);if(s.href.includes("Produto/Delete")){s.addEventListener("click",(async()=>{console.log("[CRMBONUS] - Produto removido do carrinho");setTimeout((async()=>{await this.reprocess();this.observerHandle()}),2e3)}))}if(s.href.includes("Produto/Add")){s.addEventListener("click",(async()=>{console.log("[CRMBONUS] - Produto adicionado ao carrinho");setTimeout((async()=>{await this.reprocess();this.observerHandle()}),2e3)}))}}}async loadConfigStore(){const[t,s]=await Promise.all([this.crmBonusService.getCustomization(this.cartWake.store.name),n(this.cartWake.id,this.cartWake.store.name)]);console.log("[infoBonus]",s);this.reservedInfo=s;if(t.keepStoreFrontStyle){console.log("[bc:usar estilo da loja]");this.styles=null}}async fetchCustomer(t,s){try{return await this.crmBonusService.getCustomer(t,s)}catch(t){console.error("[fetchCustomer] Error fetching customer:",t);return null}}async handleLoad(){try{if(this.cartWake.user.id){this.fetchCustomer(this.cartWake.user.id,this.cartWake.store.name).then((t=>{console.log("[bc:loading customer]");if(t){this.customer=t;console.log("customer",this.customer)}}))}const t=localStorage.getItem(this.cartWake.id);if(t){this.canCancel=true;this.amountCancel=t}await this.buildAndGetProducts(this.cartWake.products)}catch(t){console.log("info customer")}}async loadSession(){this.cartWake=this.cart?new a(JSON.parse(this.cart)):await e();console.log("[bc:carregou carrinho]");this.session=await this.crmBonusService.getToken(this.cartWake.store.name);console.log("[bc:carregou session]");setTimeout((()=>{this.loadSession()}),15e5)}async buildAndGetProducts(t){console.log();const s=`bc-products:${this.cartWake.id}`;const i=JSON.stringify(t);localStorage.setItem(s,i);const o=JSON.parse(localStorage.getItem(s));const e=[];for(const s of t){const[t]=o.filter((t=>t.ProdutoVarianteId==s.ProdutoVarianteId));if(t){e.push(Object.assign(Object.assign({},s),{PrecoPor:t.PrecoPor,PrecoDe:t.PrecoDe,Quantidade:t.Quantidade,Ajustes:t.Ajustes}))}else{e.push(s)}}this.cartWake.products=e}async sendPin(t){var s,i;this.loading=true;this.message="";try{const s=t.replace(/\D/g,"");this.phone=Number(s);this.sent=await this.crmBonusService.sendPin(this.phone,this.customer.name,this.cartWake.store.name);await this.crmBonusRef.setStep(c.STEP_PIN);this.showModal=true}catch(t){this.message=(i=(s=t===null||t===void 0?void 0:t.response)===null||s===void 0?void 0:s.data)===null||i===void 0?void 0:i.message}finally{this.loading=false}}async sendPinName(t){var s,i;this.loading=true;this.message="";try{this.customer.name=t;this.sent=await this.crmBonusService.sendPin(this.phone,this.customer.name,this.cartWake.store.name);await this.crmBonusRef.setStep(c.STEP_PIN);this.showModal=true}catch(t){this.message=(i=(s=t===null||t===void 0?void 0:t.response)===null||s===void 0?void 0:s.data)===null||i===void 0?void 0:i.message}finally{this.loading=false}}buildProducts(){return l(this.cartWake.products)}handleCloseModal(){this.showModal=false}save(t){localStorage.setItem(this.cartWake.id,t.toString());this.canCancel=true;this.amountCancel=t.toString()}async cancel(){this.message="";this.loading=true;try{await this.crmBonusService.cancel(this.cartWake.id);this.canCancel=false;localStorage.removeItem(this.cartWake.id)}catch(t){this.message="Não consegui cancelar o bônus, tente novamente!"}finally{this.loading=false}}async handleSendPin(t){this.message="";if(!t){this.message="Informe seu telefone";return}this.customer.phone=t;const s=t.replace(/\D/g,"");this.phone=Number(s);if(this.customer.name){return this.sendPin(t)}await this.crmBonusRef.setStep(c.STEP_NAME);this.showModal=true}render(){if(this.canhidden){return null}return s("loading-container",{loading:this.loading_reprocess},s("crm-giftback-form",{customStyles:this.styles,style:{position:"relative"},ref:t=>this.crmBonusRef=t,storeName:this.cartWake.store.name,products:this.buildProducts(),cartId:this.cartWake.id,customer:this.customer,loadProducts:()=>this.buildProducts(),loadAll:()=>this.handleLoad(),reservedInfo:this.reservedInfo}))}static get assetsDirs(){return["assets"]}};f.style=u;export{f as crm_bonus};
2
+ //# sourceMappingURL=p-7d608b81.entry.js.map
@@ -0,0 +1,2 @@
1
+ var o;(function(o){o["P"]="Promocao";o["CC"]="ContaCorrente";o["PP"]="PromocaoProduto";o["F"]="Formula"})(o||(o={}));function t(t=[]){const n=[];for(const i of t){let t=r(i.Ajustes);var a=i.PrecoDe*i.Quantidade;var u=i.PrecoDe*i.Quantidade;var c=t*-1;const e=i.Ajustes.filter((t=>[o.PP].includes(t.Tipo)));const f=e.length>0;n.push({sku:i.SKU,value:a,originalValue:u,productVariantId:i.ProdutoVarianteId.toString(),quantity:i.Quantidade,discount:a<c?a:c,promotion_product:f})}return n}function r(t=[]){let r=0;for(const n of t){if([o.P,o.CC,o.PP].includes(n.Tipo)){r+=n.Valor}}return r}export{t as b};
2
+ //# sourceMappingURL=p-b0ef2c0b.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AjustesTipoEnum","buildProductsByWake","productsWake","products","pw","discounts","getDiscount","Ajustes","value","PrecoDe","Quantidade","originalValue","discounts_value","existsPromotionProduct","filter","adj","PP","includes","Tipo","promotion_product","length","push","sku","SKU","productVariantId","ProdutoVarianteId","toString","quantity","discount","ajustes","P","CC","Valor"],"sources":["src/dto/validate.pin.bonus.ts","src/helpers/build.payload.helper.ts"],"sourcesContent":["export interface IProduct {\r\n productVariantId: string;\r\n sku: string;\r\n value: number;\r\n originalValue: number;\r\n quantity: number;\r\n discount: number;\r\n promotion_product: boolean;\r\n}\r\n\r\nexport enum AjustesTipoEnum {\r\n P = \"Promocao\",\r\n CC = \"ContaCorrente\",\r\n PP = \"PromocaoProduto\",\r\n F = \"Formula\"\r\n}\r\n\r\nexport interface IAjustes {\r\n Tipo: AjustesTipoEnum;\r\n Valor: number;\r\n}\r\n\r\nexport interface IUser {\r\n id: number;\r\n}\r\n\r\nexport interface IStore {\r\n name: string;\r\n}\r\n\r\nexport interface IProductWake {\r\n ProdutoVarianteId: number;\r\n SKU: string;\r\n PrecoPor: number;\r\n PrecoDe: number;\r\n Quantidade: number;\r\n Ajustes: IAjustes[];\r\n}\r\n\r\nexport interface ICustomer {\r\n birthDate: string;\r\n document: string;\r\n name: string;\r\n phone: string;\r\n}\r\n\r\nexport interface IProccesPinBonusDto {\r\n storeName: string;\r\n name: string;\r\n checkoutId: string;\r\n checkoutProducts: Array<IProduct>;\r\n storeId: string;\r\n userId: string;\r\n cellphone: number;\r\n pin: string;\r\n\r\n}\r\n\r\nexport interface IBonus {\r\n hasBonus: boolean;\r\n bonusBalance: number;\r\n totalBonus: number;\r\n minimumPurchase: number;\r\n bonusIds: string;\r\n firstValidityDate: string\r\n history: [\r\n {\r\n validityStart: string;\r\n validityEnd: string;\r\n value: number\r\n },\r\n {\r\n validityStart: string;\r\n validityEnd: string\r\n value: number\r\n }\r\n ]\r\n storeId: number;\r\n userId: number;\r\n cartId: string\r\n calculatedValue: number;\r\n totalValue: number\r\n}\r\n\r\n\r\nexport interface IReserveDTO {\r\n storeName: string;\r\n cartId: string;\r\n grossValue: number;\r\n redeemedBonus: number;\r\n ticket: string;\r\n storeId: string;\r\n userId: number;\r\n}","import { AjustesTipoEnum, IAjustes, IProduct, IProductWake } from \"../dto/validate.pin.bonus\";\r\n\r\nexport function buildProductsByWake(productsWake: Array<IProductWake> = []): Array<IProduct> {\r\n\r\n const products: Array<IProduct> = [];\r\n\r\n for ( const pw of productsWake ) {\r\n let discounts = getDiscount(pw.Ajustes)\r\n // let discounts_formula = getDiscountFormula(pw.Ajustes);\r\n\r\n var value = (pw.PrecoDe * pw.Quantidade);\r\n var originalValue = (pw.PrecoDe * pw.Quantidade);\r\n\r\n var discounts_value = (discounts * -1)\r\n\r\n const existsPromotionProduct = pw.Ajustes.filter(adj => [AjustesTipoEnum.PP].includes(adj.Tipo))\r\n\r\n const promotion_product = (existsPromotionProduct.length > 0)\r\n\r\n products.push(\r\n {\r\n sku: pw.SKU,\r\n value: value,\r\n originalValue: originalValue,\r\n productVariantId: pw.ProdutoVarianteId.toString(),\r\n quantity: pw.Quantidade,\r\n discount: value < discounts_value ? value : discounts_value,\r\n promotion_product\r\n }\r\n )\r\n }\r\n\r\n return products;\r\n}\r\n\r\nfunction getDiscount(ajustes: IAjustes[] = []) {\r\n \r\n let discounts = 0;\r\n \r\n for(const discount of ajustes) {\r\n if([AjustesTipoEnum.P, AjustesTipoEnum.CC, AjustesTipoEnum.PP].includes(discount.Tipo)) {\r\n discounts += discount.Valor;\r\n }\r\n }\r\n\r\n return discounts;\r\n}\r\n\r\n// function getDiscountFormula(ajustes: IAjustes[] = []) {\r\n \r\n// let discounts = 0;\r\n \r\n// for(const discount of ajustes) {\r\n// if([AjustesTipoEnum.F].includes(discount.Tipo)) {\r\n// discounts += (discount.Valor * -1);\r\n// }\r\n// }\r\n\r\n// return discounts;\r\n// }"],"mappings":"AAUA,IAAYA,GAAZ,SAAYA,GACRA,EAAA,gBACAA,EAAA,sBACAA,EAAA,wBACAA,EAAA,cACH,EALD,CAAYA,MAAe,K,SCRXC,EAAoBC,EAAoC,IAEpE,MAAMC,EAA4B,GAElC,IAAM,MAAMC,KAAMF,EAAe,CAC7B,IAAIG,EAAYC,EAAYF,EAAGG,SAG/B,IAAIC,EAASJ,EAAGK,QAAUL,EAAGM,WAC7B,IAAIC,EAAiBP,EAAGK,QAAUL,EAAGM,WAErC,IAAIE,EAAmBP,GAAa,EAEpC,MAAMQ,EAAyBT,EAAGG,QAAQO,QAAOC,GAAO,CAACf,EAAgBgB,IAAIC,SAASF,EAAIG,QAE1F,MAAMC,EAAqBN,EAAuBO,OAAS,EAE3DjB,EAASkB,KACL,CACIC,IAAKlB,EAAGmB,IACRf,MAAOA,EACPG,cAAeA,EACfa,iBAAkBpB,EAAGqB,kBAAkBC,WACvCC,SAAUvB,EAAGM,WACbkB,SAAUpB,EAAQI,EAAkBJ,EAAQI,EAC5CO,qB,CAKZ,OAAOhB,CACX,CAEA,SAASG,EAAYuB,EAAsB,IAEvC,IAAIxB,EAAY,EAEhB,IAAI,MAAMuB,KAAYC,EAAS,CAC3B,GAAG,CAAC7B,EAAgB8B,EAAG9B,EAAgB+B,GAAI/B,EAAgBgB,IAAIC,SAASW,EAASV,MAAO,CACpFb,GAAauB,EAASI,K,EAI9B,OAAO3B,CACX,Q","ignoreList":[]}
@@ -14,6 +14,8 @@ function buildProductsByWake(productsWake = []) {
14
14
  var value = (pw.PrecoDe * pw.Quantidade);
15
15
  var originalValue = (pw.PrecoDe * pw.Quantidade);
16
16
  var discounts_value = (discounts * -1);
17
+ const existsPromotionProduct = pw.Ajustes.filter(adj => [AjustesTipoEnum.PP].includes(adj.Tipo));
18
+ const promotion_product = (existsPromotionProduct.length > 0);
17
19
  products.push({
18
20
  sku: pw.SKU,
19
21
  value: value,
@@ -21,6 +23,7 @@ function buildProductsByWake(productsWake = []) {
21
23
  productVariantId: pw.ProdutoVarianteId.toString(),
22
24
  quantity: pw.Quantidade,
23
25
  discount: value < discounts_value ? value : discounts_value,
26
+ promotion_product
24
27
  });
25
28
  }
26
29
  return products;
@@ -46,4 +49,4 @@ function getDiscount(ajustes = []) {
46
49
 
47
50
  export { buildProductsByWake as b };
48
51
 
49
- //# sourceMappingURL=p-4c7e066c.js.map
52
+ //# sourceMappingURL=build.payload.helper-699a48ca.js.map
@@ -0,0 +1 @@
1
+ {"file":"build.payload.helper-699a48ca.js","mappings":"AAUA,IAAY,eAKX;AALD,WAAY,eAAe;IACvB,iCAAc,CAAA;IACd,uCAAoB,CAAA;IACpB,yCAAsB,CAAA;IACtB,gCAAa,CAAA;AACjB,CAAC,EALW,eAAe,KAAf,eAAe;;SCRX,mBAAmB,CAAC,eAAoC,EAAE;IAEtE,MAAM,QAAQ,GAAoB,EAAE,CAAC;IAErC,KAAM,MAAM,EAAE,IAAI,YAAY,EAAG;QAC7B,IAAI,SAAS,GAAG,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC,CAAA;;QAGvC,IAAI,KAAK,IAAI,EAAE,CAAC,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;QACzC,IAAI,aAAa,IAAI,EAAE,CAAC,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;QAEjD,IAAI,eAAe,IAAI,SAAS,GAAG,CAAC,CAAC,CAAC,CAAA;QAEtC,MAAM,sBAAsB,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;QAEhG,MAAM,iBAAiB,IAAI,sBAAsB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;QAE7D,QAAQ,CAAC,IAAI,CACT;YACI,GAAG,EAAE,EAAE,CAAC,GAAG;YACX,KAAK,EAAE,KAAK;YACZ,aAAa,EAAE,aAAa;YAC5B,gBAAgB,EAAE,EAAE,CAAC,iBAAiB,CAAC,QAAQ,EAAE;YACjD,QAAQ,EAAE,EAAE,CAAC,UAAU;YACvB,QAAQ,EAAE,KAAK,GAAG,eAAe,GAAG,KAAK,GAAG,eAAe;YAC3D,iBAAiB;SACpB,CACJ,CAAA;KACJ;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,SAAS,WAAW,CAAC,UAAsB,EAAE;IAEzC,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB,KAAI,MAAM,QAAQ,IAAI,OAAO,EAAE;QAC3B,IAAG,CAAC,eAAe,CAAC,CAAC,EAAE,eAAe,CAAC,EAAE,EAAE,eAAe,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YACpF,SAAS,IAAI,QAAQ,CAAC,KAAK,CAAC;SAC/B;KACJ;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAED;AAEA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;;;;","names":[],"sources":["src/dto/validate.pin.bonus.ts","src/helpers/build.payload.helper.ts"],"sourcesContent":["export interface IProduct {\r\n productVariantId: string;\r\n sku: string;\r\n value: number;\r\n originalValue: number;\r\n quantity: number;\r\n discount: number;\r\n promotion_product: boolean;\r\n}\r\n\r\nexport enum AjustesTipoEnum {\r\n P = \"Promocao\",\r\n CC = \"ContaCorrente\",\r\n PP = \"PromocaoProduto\",\r\n F = \"Formula\"\r\n}\r\n\r\nexport interface IAjustes {\r\n Tipo: AjustesTipoEnum;\r\n Valor: number;\r\n}\r\n\r\nexport interface IUser {\r\n id: number;\r\n}\r\n\r\nexport interface IStore {\r\n name: string;\r\n}\r\n\r\nexport interface IProductWake {\r\n ProdutoVarianteId: number;\r\n SKU: string;\r\n PrecoPor: number;\r\n PrecoDe: number;\r\n Quantidade: number;\r\n Ajustes: IAjustes[];\r\n}\r\n\r\nexport interface ICustomer {\r\n birthDate: string;\r\n document: string;\r\n name: string;\r\n phone: string;\r\n}\r\n\r\nexport interface IProccesPinBonusDto {\r\n storeName: string;\r\n name: string;\r\n checkoutId: string;\r\n checkoutProducts: Array<IProduct>;\r\n storeId: string;\r\n userId: string;\r\n cellphone: number;\r\n pin: string;\r\n\r\n}\r\n\r\nexport interface IBonus {\r\n hasBonus: boolean;\r\n bonusBalance: number;\r\n totalBonus: number;\r\n minimumPurchase: number;\r\n bonusIds: string;\r\n firstValidityDate: string\r\n history: [\r\n {\r\n validityStart: string;\r\n validityEnd: string;\r\n value: number\r\n },\r\n {\r\n validityStart: string;\r\n validityEnd: string\r\n value: number\r\n }\r\n ]\r\n storeId: number;\r\n userId: number;\r\n cartId: string\r\n calculatedValue: number;\r\n totalValue: number\r\n}\r\n\r\n\r\nexport interface IReserveDTO {\r\n storeName: string;\r\n cartId: string;\r\n grossValue: number;\r\n redeemedBonus: number;\r\n ticket: string;\r\n storeId: string;\r\n userId: number;\r\n}","import { AjustesTipoEnum, IAjustes, IProduct, IProductWake } from \"../dto/validate.pin.bonus\";\r\n\r\nexport function buildProductsByWake(productsWake: Array<IProductWake> = []): Array<IProduct> {\r\n\r\n const products: Array<IProduct> = [];\r\n\r\n for ( const pw of productsWake ) {\r\n let discounts = getDiscount(pw.Ajustes)\r\n // let discounts_formula = getDiscountFormula(pw.Ajustes);\r\n\r\n var value = (pw.PrecoDe * pw.Quantidade);\r\n var originalValue = (pw.PrecoDe * pw.Quantidade);\r\n\r\n var discounts_value = (discounts * -1)\r\n\r\n const existsPromotionProduct = pw.Ajustes.filter(adj => [AjustesTipoEnum.PP].includes(adj.Tipo))\r\n\r\n const promotion_product = (existsPromotionProduct.length > 0)\r\n\r\n products.push(\r\n {\r\n sku: pw.SKU,\r\n value: value,\r\n originalValue: originalValue,\r\n productVariantId: pw.ProdutoVarianteId.toString(),\r\n quantity: pw.Quantidade,\r\n discount: value < discounts_value ? value : discounts_value,\r\n promotion_product\r\n }\r\n )\r\n }\r\n\r\n return products;\r\n}\r\n\r\nfunction getDiscount(ajustes: IAjustes[] = []) {\r\n \r\n let discounts = 0;\r\n \r\n for(const discount of ajustes) {\r\n if([AjustesTipoEnum.P, AjustesTipoEnum.CC, AjustesTipoEnum.PP].includes(discount.Tipo)) {\r\n discounts += discount.Valor;\r\n }\r\n }\r\n\r\n return discounts;\r\n}\r\n\r\n// function getDiscountFormula(ajustes: IAjustes[] = []) {\r\n \r\n// let discounts = 0;\r\n \r\n// for(const discount of ajustes) {\r\n// if([AjustesTipoEnum.F].includes(discount.Tipo)) {\r\n// discounts += (discount.Valor * -1);\r\n// }\r\n// }\r\n\r\n// return discounts;\r\n// }"],"version":3}
@@ -2,7 +2,7 @@ import { r as registerInstance, h } from './index-bdb70d5a.js';
2
2
  import { g as getInfoCustomization } from './info.config.helper-7cad7a9c.js';
3
3
  import { a as CrmBonusService, C as CartWake, g as getCart, b as getInfoBonusByCartIdAndStoreName, c as getKeyReserveByCartId } from './cart.helper-7101c047.js';
4
4
  import { d as defaultStyles, i as instance } from './i18n-7938fb86.js';
5
- import { b as buildProductsByWake } from './build.payload.helper-caf0a82b.js';
5
+ import { b as buildProductsByWake } from './build.payload.helper-699a48ca.js';
6
6
 
7
7
  const moneyDollarsSvgrepoComSvg = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPg0KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxjaXJjbGUgY3g9IjEyIiBjeT0iMTIiIHI9IjEwIiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS13aWR0aD0iMiIvPg0KPHBhdGggZD0iTTE1IDkuOTQ3MjhDMTQuNSA5LjMgMTMuOCA4LjUgMTIgOC41QzEwLjIgOC41IDkgOS41MTM5MyA5IDkuOTQ3MjhDOSAxMC4zODA2IDkuMDY3ODYgMTAuOTI3NyAxMCAxMS41QzEwLjc1MjIgMTEuOTYxOCAxMi42Njg0IDEyLjA0MzkgMTMuNSAxMi41QzE0LjY3OSAxMy4xNDY3IDE0Ljg0OTcgMTMuODIwMiAxNC44NDk3IDE0LjA1MjJDMTQuODQ5NyAxNC42ODM3IDEzLjQxNzUgMTUuNDg1MiAxMiAxNS41QzEwLjUzNiAxNS41MTUzIDkuNSAxNC43IDkgMTQuMDUyMiIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPg0KPHBhdGggZD0iTTEyIDdWMTciIHN0cm9rZT0iIzAwMDAwMCIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPg0KPC9zdmc+';
8
8
 
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, h } from './index-bdb70d5a.js';
2
2
  import { a as CrmBonusService, U as USED_KEY, g as getCart, b as getInfoBonusByCartIdAndStoreName, C as CartWake } from './cart.helper-7101c047.js';
3
3
  import { d as defaultStyles, S as StepFormEnum, i as instance } from './i18n-7938fb86.js';
4
- import { b as buildProductsByWake } from './build.payload.helper-caf0a82b.js';
4
+ import { b as buildProductsByWake } from './build.payload.helper-699a48ca.js';
5
5
 
6
6
  const crmBonusCss = ".container-button{cursor:pointer;padding:5px 5px 5px 14px;}.section-crm{border:1px solid #dbd4d4;text-align:-webkit-center;margin-bottom:20px}.section-cart-crm{margin-top:10px}.section-cart-crm p{padding:0;margin:0px 0px 0px 15px}.button{top:50%;background-color:#6c6c7e;color:#fff;border:none;padding:15px;min-height:30px;min-width:120px;cursor:pointer;margin-left:10px;height:70px}.form-container{width:97%;display:flex;justify-content:space-around}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:0px}.form-container .btnCrm{background:#00162e;border-color:#00162e;width:30%;color:#fff}.message-alert{color:#df4d4d;margin-top:5px}";
7
7
  const CrmBonusStyle0 = crmBonusCss;
@@ -5,6 +5,7 @@ export interface IProduct {
5
5
  originalValue: number;
6
6
  quantity: number;
7
7
  discount: number;
8
+ promotion_product: boolean;
8
9
  }
9
10
  export declare enum AjustesTipoEnum {
10
11
  P = "Promocao",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crmbonus-component-wake",
3
- "version": "2.1.32-ngrok",
3
+ "version": "2.1.33-ngrok",
4
4
  "description": "Stencil Component Starter",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -1 +0,0 @@
1
- {"file":"build.payload.helper-b93f7ea5.js","mappings":";;AASA,IAAY,eAKX;AALD,WAAY,eAAe;IACvB,iCAAc,CAAA;IACd,uCAAoB,CAAA;IACpB,yCAAsB,CAAA;IACtB,gCAAa,CAAA;AACjB,CAAC,EALW,eAAe,KAAf,eAAe;;SCPX,mBAAmB,CAAC,eAAoC,EAAE;IAEtE,MAAM,QAAQ,GAAoB,EAAE,CAAC;IAErC,KAAM,MAAM,EAAE,IAAI,YAAY,EAAG;QAC7B,IAAI,SAAS,GAAG,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC,CAAA;;QAGvC,IAAI,KAAK,IAAI,EAAE,CAAC,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;QACzC,IAAI,aAAa,IAAI,EAAE,CAAC,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;QAEjD,IAAI,eAAe,IAAI,SAAS,GAAG,CAAC,CAAC,CAAC,CAAA;QAEtC,QAAQ,CAAC,IAAI,CACT;YACI,GAAG,EAAE,EAAE,CAAC,GAAG;YACX,KAAK,EAAE,KAAK;YACZ,aAAa,EAAE,aAAa;YAC5B,gBAAgB,EAAE,EAAE,CAAC,iBAAiB,CAAC,QAAQ,EAAE;YACjD,QAAQ,EAAE,EAAE,CAAC,UAAU;YACvB,QAAQ,EAAE,KAAK,GAAG,eAAe,GAAG,KAAK,GAAG,eAAe;SAC9D,CACJ,CAAA;KACJ;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,SAAS,WAAW,CAAC,UAAsB,EAAE;IAEzC,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB,KAAI,MAAM,QAAQ,IAAI,OAAO,EAAE;QAC3B,IAAG,CAAC,eAAe,CAAC,CAAC,EAAE,eAAe,CAAC,EAAE,EAAE,eAAe,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YACpF,SAAS,IAAI,QAAQ,CAAC,KAAK,CAAC;SAC/B;KACJ;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAED;AAEA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;;;;","names":[],"sources":["src/dto/validate.pin.bonus.ts","src/helpers/build.payload.helper.ts"],"sourcesContent":["export interface IProduct {\r\n productVariantId: string;\r\n sku: string;\r\n value: number;\r\n originalValue: number;\r\n quantity: number;\r\n discount: number;\r\n}\r\n\r\nexport enum AjustesTipoEnum {\r\n P = \"Promocao\",\r\n CC = \"ContaCorrente\",\r\n PP = \"PromocaoProduto\",\r\n F = \"Formula\"\r\n}\r\n\r\nexport interface IAjustes {\r\n Tipo: AjustesTipoEnum;\r\n Valor: number;\r\n}\r\n\r\nexport interface IUser {\r\n id: number;\r\n}\r\n\r\nexport interface IStore {\r\n name: string;\r\n}\r\n\r\nexport interface IProductWake {\r\n ProdutoVarianteId: number;\r\n SKU: string;\r\n PrecoPor: number;\r\n PrecoDe: number;\r\n Quantidade: number;\r\n Ajustes: IAjustes[];\r\n}\r\n\r\nexport interface ICustomer {\r\n birthDate: string;\r\n document: string;\r\n name: string;\r\n phone: string;\r\n}\r\n\r\nexport interface IProccesPinBonusDto {\r\n storeName: string;\r\n name: string;\r\n checkoutId: string;\r\n checkoutProducts: Array<IProduct>;\r\n storeId: string;\r\n userId: string;\r\n cellphone: number;\r\n pin: string;\r\n\r\n}\r\n\r\nexport interface IBonus {\r\n hasBonus: boolean;\r\n bonusBalance: number;\r\n totalBonus: number;\r\n minimumPurchase: number;\r\n bonusIds: string;\r\n firstValidityDate: string\r\n history: [\r\n {\r\n validityStart: string;\r\n validityEnd: string;\r\n value: number\r\n },\r\n {\r\n validityStart: string;\r\n validityEnd: string\r\n value: number\r\n }\r\n ]\r\n storeId: number;\r\n userId: number;\r\n cartId: string\r\n calculatedValue: number;\r\n totalValue: number\r\n}\r\n\r\n\r\nexport interface IReserveDTO {\r\n storeName: string;\r\n cartId: string;\r\n grossValue: number;\r\n redeemedBonus: number;\r\n ticket: string;\r\n storeId: string;\r\n userId: number;\r\n}","import { AjustesTipoEnum, IAjustes, IProduct, IProductWake } from \"../dto/validate.pin.bonus\";\r\n\r\nexport function buildProductsByWake(productsWake: Array<IProductWake> = []): Array<IProduct> {\r\n\r\n const products: Array<IProduct> = [];\r\n\r\n for ( const pw of productsWake ) {\r\n let discounts = getDiscount(pw.Ajustes)\r\n // let discounts_formula = getDiscountFormula(pw.Ajustes);\r\n\r\n var value = (pw.PrecoDe * pw.Quantidade);\r\n var originalValue = (pw.PrecoDe * pw.Quantidade);\r\n\r\n var discounts_value = (discounts * -1)\r\n\r\n products.push(\r\n {\r\n sku: pw.SKU,\r\n value: value,\r\n originalValue: originalValue,\r\n productVariantId: pw.ProdutoVarianteId.toString(),\r\n quantity: pw.Quantidade,\r\n discount: value < discounts_value ? value : discounts_value,\r\n }\r\n )\r\n }\r\n\r\n return products;\r\n}\r\n\r\nfunction getDiscount(ajustes: IAjustes[] = []) {\r\n \r\n let discounts = 0;\r\n \r\n for(const discount of ajustes) {\r\n if([AjustesTipoEnum.P, AjustesTipoEnum.CC, AjustesTipoEnum.PP].includes(discount.Tipo)) {\r\n discounts += discount.Valor;\r\n }\r\n }\r\n\r\n return discounts;\r\n}\r\n\r\n// function getDiscountFormula(ajustes: IAjustes[] = []) {\r\n \r\n// let discounts = 0;\r\n \r\n// for(const discount of ajustes) {\r\n// if([AjustesTipoEnum.F].includes(discount.Tipo)) {\r\n// discounts += (discount.Valor * -1);\r\n// }\r\n// }\r\n\r\n// return discounts;\r\n// }"],"version":3}
@@ -1 +0,0 @@
1
- {"file":"p-4c7e066c.js","mappings":"AASA,IAAY,eAKX;AALD,WAAY,eAAe;IACvB,iCAAc,CAAA;IACd,uCAAoB,CAAA;IACpB,yCAAsB,CAAA;IACtB,gCAAa,CAAA;AACjB,CAAC,EALW,eAAe,KAAf,eAAe;;SCPX,mBAAmB,CAAC,eAAoC,EAAE;IAEtE,MAAM,QAAQ,GAAoB,EAAE,CAAC;IAErC,KAAM,MAAM,EAAE,IAAI,YAAY,EAAG;QAC7B,IAAI,SAAS,GAAG,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC,CAAA;;QAGvC,IAAI,KAAK,IAAI,EAAE,CAAC,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;QACzC,IAAI,aAAa,IAAI,EAAE,CAAC,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;QAEjD,IAAI,eAAe,IAAI,SAAS,GAAG,CAAC,CAAC,CAAC,CAAA;QAEtC,QAAQ,CAAC,IAAI,CACT;YACI,GAAG,EAAE,EAAE,CAAC,GAAG;YACX,KAAK,EAAE,KAAK;YACZ,aAAa,EAAE,aAAa;YAC5B,gBAAgB,EAAE,EAAE,CAAC,iBAAiB,CAAC,QAAQ,EAAE;YACjD,QAAQ,EAAE,EAAE,CAAC,UAAU;YACvB,QAAQ,EAAE,KAAK,GAAG,eAAe,GAAG,KAAK,GAAG,eAAe;SAC9D,CACJ,CAAA;KACJ;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,SAAS,WAAW,CAAC,UAAsB,EAAE;IAEzC,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB,KAAI,MAAM,QAAQ,IAAI,OAAO,EAAE;QAC3B,IAAG,CAAC,eAAe,CAAC,CAAC,EAAE,eAAe,CAAC,EAAE,EAAE,eAAe,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YACpF,SAAS,IAAI,QAAQ,CAAC,KAAK,CAAC;SAC/B;KACJ;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAED;AAEA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;;;;","names":[],"sources":["src/dto/validate.pin.bonus.ts","src/helpers/build.payload.helper.ts"],"sourcesContent":["export interface IProduct {\r\n productVariantId: string;\r\n sku: string;\r\n value: number;\r\n originalValue: number;\r\n quantity: number;\r\n discount: number;\r\n}\r\n\r\nexport enum AjustesTipoEnum {\r\n P = \"Promocao\",\r\n CC = \"ContaCorrente\",\r\n PP = \"PromocaoProduto\",\r\n F = \"Formula\"\r\n}\r\n\r\nexport interface IAjustes {\r\n Tipo: AjustesTipoEnum;\r\n Valor: number;\r\n}\r\n\r\nexport interface IUser {\r\n id: number;\r\n}\r\n\r\nexport interface IStore {\r\n name: string;\r\n}\r\n\r\nexport interface IProductWake {\r\n ProdutoVarianteId: number;\r\n SKU: string;\r\n PrecoPor: number;\r\n PrecoDe: number;\r\n Quantidade: number;\r\n Ajustes: IAjustes[];\r\n}\r\n\r\nexport interface ICustomer {\r\n birthDate: string;\r\n document: string;\r\n name: string;\r\n phone: string;\r\n}\r\n\r\nexport interface IProccesPinBonusDto {\r\n storeName: string;\r\n name: string;\r\n checkoutId: string;\r\n checkoutProducts: Array<IProduct>;\r\n storeId: string;\r\n userId: string;\r\n cellphone: number;\r\n pin: string;\r\n\r\n}\r\n\r\nexport interface IBonus {\r\n hasBonus: boolean;\r\n bonusBalance: number;\r\n totalBonus: number;\r\n minimumPurchase: number;\r\n bonusIds: string;\r\n firstValidityDate: string\r\n history: [\r\n {\r\n validityStart: string;\r\n validityEnd: string;\r\n value: number\r\n },\r\n {\r\n validityStart: string;\r\n validityEnd: string\r\n value: number\r\n }\r\n ]\r\n storeId: number;\r\n userId: number;\r\n cartId: string\r\n calculatedValue: number;\r\n totalValue: number\r\n}\r\n\r\n\r\nexport interface IReserveDTO {\r\n storeName: string;\r\n cartId: string;\r\n grossValue: number;\r\n redeemedBonus: number;\r\n ticket: string;\r\n storeId: string;\r\n userId: number;\r\n}","import { AjustesTipoEnum, IAjustes, IProduct, IProductWake } from \"../dto/validate.pin.bonus\";\r\n\r\nexport function buildProductsByWake(productsWake: Array<IProductWake> = []): Array<IProduct> {\r\n\r\n const products: Array<IProduct> = [];\r\n\r\n for ( const pw of productsWake ) {\r\n let discounts = getDiscount(pw.Ajustes)\r\n // let discounts_formula = getDiscountFormula(pw.Ajustes);\r\n\r\n var value = (pw.PrecoDe * pw.Quantidade);\r\n var originalValue = (pw.PrecoDe * pw.Quantidade);\r\n\r\n var discounts_value = (discounts * -1)\r\n\r\n products.push(\r\n {\r\n sku: pw.SKU,\r\n value: value,\r\n originalValue: originalValue,\r\n productVariantId: pw.ProdutoVarianteId.toString(),\r\n quantity: pw.Quantidade,\r\n discount: value < discounts_value ? value : discounts_value,\r\n }\r\n )\r\n }\r\n\r\n return products;\r\n}\r\n\r\nfunction getDiscount(ajustes: IAjustes[] = []) {\r\n \r\n let discounts = 0;\r\n \r\n for(const discount of ajustes) {\r\n if([AjustesTipoEnum.P, AjustesTipoEnum.CC, AjustesTipoEnum.PP].includes(discount.Tipo)) {\r\n discounts += discount.Valor;\r\n }\r\n }\r\n\r\n return discounts;\r\n}\r\n\r\n// function getDiscountFormula(ajustes: IAjustes[] = []) {\r\n \r\n// let discounts = 0;\r\n \r\n// for(const discount of ajustes) {\r\n// if([AjustesTipoEnum.F].includes(discount.Tipo)) {\r\n// discounts += (discount.Valor * -1);\r\n// }\r\n// }\r\n\r\n// return discounts;\r\n// }"],"version":3}
@@ -1,2 +0,0 @@
1
- var o;(function(o){o["P"]="Promocao";o["CC"]="ContaCorrente";o["PP"]="PromocaoProduto";o["F"]="Formula"})(o||(o={}));function r(o=[]){const r=[];for(const c of o){let o=t(c.Ajustes);var n=c.PrecoDe*c.Quantidade;var a=c.PrecoDe*c.Quantidade;var u=o*-1;r.push({sku:c.SKU,value:n,originalValue:a,productVariantId:c.ProdutoVarianteId.toString(),quantity:c.Quantidade,discount:n<u?n:u})}return r}function t(r=[]){let t=0;for(const n of r){if([o.P,o.CC,o.PP].includes(n.Tipo)){t+=n.Valor}}return t}export{r as b};
2
- //# sourceMappingURL=p-4c7e066c.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["AjustesTipoEnum","buildProductsByWake","productsWake","products","pw","discounts","getDiscount","Ajustes","value","PrecoDe","Quantidade","originalValue","discounts_value","push","sku","SKU","productVariantId","ProdutoVarianteId","toString","quantity","discount","ajustes","P","CC","PP","includes","Tipo","Valor"],"sources":["src/dto/validate.pin.bonus.ts","src/helpers/build.payload.helper.ts"],"sourcesContent":["export interface IProduct {\r\n productVariantId: string;\r\n sku: string;\r\n value: number;\r\n originalValue: number;\r\n quantity: number;\r\n discount: number;\r\n}\r\n\r\nexport enum AjustesTipoEnum {\r\n P = \"Promocao\",\r\n CC = \"ContaCorrente\",\r\n PP = \"PromocaoProduto\",\r\n F = \"Formula\"\r\n}\r\n\r\nexport interface IAjustes {\r\n Tipo: AjustesTipoEnum;\r\n Valor: number;\r\n}\r\n\r\nexport interface IUser {\r\n id: number;\r\n}\r\n\r\nexport interface IStore {\r\n name: string;\r\n}\r\n\r\nexport interface IProductWake {\r\n ProdutoVarianteId: number;\r\n SKU: string;\r\n PrecoPor: number;\r\n PrecoDe: number;\r\n Quantidade: number;\r\n Ajustes: IAjustes[];\r\n}\r\n\r\nexport interface ICustomer {\r\n birthDate: string;\r\n document: string;\r\n name: string;\r\n phone: string;\r\n}\r\n\r\nexport interface IProccesPinBonusDto {\r\n storeName: string;\r\n name: string;\r\n checkoutId: string;\r\n checkoutProducts: Array<IProduct>;\r\n storeId: string;\r\n userId: string;\r\n cellphone: number;\r\n pin: string;\r\n\r\n}\r\n\r\nexport interface IBonus {\r\n hasBonus: boolean;\r\n bonusBalance: number;\r\n totalBonus: number;\r\n minimumPurchase: number;\r\n bonusIds: string;\r\n firstValidityDate: string\r\n history: [\r\n {\r\n validityStart: string;\r\n validityEnd: string;\r\n value: number\r\n },\r\n {\r\n validityStart: string;\r\n validityEnd: string\r\n value: number\r\n }\r\n ]\r\n storeId: number;\r\n userId: number;\r\n cartId: string\r\n calculatedValue: number;\r\n totalValue: number\r\n}\r\n\r\n\r\nexport interface IReserveDTO {\r\n storeName: string;\r\n cartId: string;\r\n grossValue: number;\r\n redeemedBonus: number;\r\n ticket: string;\r\n storeId: string;\r\n userId: number;\r\n}","import { AjustesTipoEnum, IAjustes, IProduct, IProductWake } from \"../dto/validate.pin.bonus\";\r\n\r\nexport function buildProductsByWake(productsWake: Array<IProductWake> = []): Array<IProduct> {\r\n\r\n const products: Array<IProduct> = [];\r\n\r\n for ( const pw of productsWake ) {\r\n let discounts = getDiscount(pw.Ajustes)\r\n // let discounts_formula = getDiscountFormula(pw.Ajustes);\r\n\r\n var value = (pw.PrecoDe * pw.Quantidade);\r\n var originalValue = (pw.PrecoDe * pw.Quantidade);\r\n\r\n var discounts_value = (discounts * -1)\r\n\r\n products.push(\r\n {\r\n sku: pw.SKU,\r\n value: value,\r\n originalValue: originalValue,\r\n productVariantId: pw.ProdutoVarianteId.toString(),\r\n quantity: pw.Quantidade,\r\n discount: value < discounts_value ? value : discounts_value,\r\n }\r\n )\r\n }\r\n\r\n return products;\r\n}\r\n\r\nfunction getDiscount(ajustes: IAjustes[] = []) {\r\n \r\n let discounts = 0;\r\n \r\n for(const discount of ajustes) {\r\n if([AjustesTipoEnum.P, AjustesTipoEnum.CC, AjustesTipoEnum.PP].includes(discount.Tipo)) {\r\n discounts += discount.Valor;\r\n }\r\n }\r\n\r\n return discounts;\r\n}\r\n\r\n// function getDiscountFormula(ajustes: IAjustes[] = []) {\r\n \r\n// let discounts = 0;\r\n \r\n// for(const discount of ajustes) {\r\n// if([AjustesTipoEnum.F].includes(discount.Tipo)) {\r\n// discounts += (discount.Valor * -1);\r\n// }\r\n// }\r\n\r\n// return discounts;\r\n// }"],"mappings":"AASA,IAAYA,GAAZ,SAAYA,GACRA,EAAA,gBACAA,EAAA,sBACAA,EAAA,wBACAA,EAAA,cACH,EALD,CAAYA,MAAe,K,SCPXC,EAAoBC,EAAoC,IAEpE,MAAMC,EAA4B,GAElC,IAAM,MAAMC,KAAMF,EAAe,CAC7B,IAAIG,EAAYC,EAAYF,EAAGG,SAG/B,IAAIC,EAASJ,EAAGK,QAAUL,EAAGM,WAC7B,IAAIC,EAAiBP,EAAGK,QAAUL,EAAGM,WAErC,IAAIE,EAAmBP,GAAa,EAEpCF,EAASU,KACL,CACIC,IAAKV,EAAGW,IACRP,MAAOA,EACPG,cAAeA,EACfK,iBAAkBZ,EAAGa,kBAAkBC,WACvCC,SAAUf,EAAGM,WACbU,SAAUZ,EAAQI,EAAkBJ,EAAQI,G,CAKxD,OAAOT,CACX,CAEA,SAASG,EAAYe,EAAsB,IAEvC,IAAIhB,EAAY,EAEhB,IAAI,MAAMe,KAAYC,EAAS,CAC3B,GAAG,CAACrB,EAAgBsB,EAAGtB,EAAgBuB,GAAIvB,EAAgBwB,IAAIC,SAASL,EAASM,MAAO,CACpFrB,GAAae,EAASO,K,EAI9B,OAAOtB,CACX,Q","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"file":"build.payload.helper-caf0a82b.js","mappings":"AASA,IAAY,eAKX;AALD,WAAY,eAAe;IACvB,iCAAc,CAAA;IACd,uCAAoB,CAAA;IACpB,yCAAsB,CAAA;IACtB,gCAAa,CAAA;AACjB,CAAC,EALW,eAAe,KAAf,eAAe;;SCPX,mBAAmB,CAAC,eAAoC,EAAE;IAEtE,MAAM,QAAQ,GAAoB,EAAE,CAAC;IAErC,KAAM,MAAM,EAAE,IAAI,YAAY,EAAG;QAC7B,IAAI,SAAS,GAAG,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC,CAAA;;QAGvC,IAAI,KAAK,IAAI,EAAE,CAAC,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;QACzC,IAAI,aAAa,IAAI,EAAE,CAAC,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;QAEjD,IAAI,eAAe,IAAI,SAAS,GAAG,CAAC,CAAC,CAAC,CAAA;QAEtC,QAAQ,CAAC,IAAI,CACT;YACI,GAAG,EAAE,EAAE,CAAC,GAAG;YACX,KAAK,EAAE,KAAK;YACZ,aAAa,EAAE,aAAa;YAC5B,gBAAgB,EAAE,EAAE,CAAC,iBAAiB,CAAC,QAAQ,EAAE;YACjD,QAAQ,EAAE,EAAE,CAAC,UAAU;YACvB,QAAQ,EAAE,KAAK,GAAG,eAAe,GAAG,KAAK,GAAG,eAAe;SAC9D,CACJ,CAAA;KACJ;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,SAAS,WAAW,CAAC,UAAsB,EAAE;IAEzC,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB,KAAI,MAAM,QAAQ,IAAI,OAAO,EAAE;QAC3B,IAAG,CAAC,eAAe,CAAC,CAAC,EAAE,eAAe,CAAC,EAAE,EAAE,eAAe,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YACpF,SAAS,IAAI,QAAQ,CAAC,KAAK,CAAC;SAC/B;KACJ;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAED;AAEA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;;;;","names":[],"sources":["src/dto/validate.pin.bonus.ts","src/helpers/build.payload.helper.ts"],"sourcesContent":["export interface IProduct {\r\n productVariantId: string;\r\n sku: string;\r\n value: number;\r\n originalValue: number;\r\n quantity: number;\r\n discount: number;\r\n}\r\n\r\nexport enum AjustesTipoEnum {\r\n P = \"Promocao\",\r\n CC = \"ContaCorrente\",\r\n PP = \"PromocaoProduto\",\r\n F = \"Formula\"\r\n}\r\n\r\nexport interface IAjustes {\r\n Tipo: AjustesTipoEnum;\r\n Valor: number;\r\n}\r\n\r\nexport interface IUser {\r\n id: number;\r\n}\r\n\r\nexport interface IStore {\r\n name: string;\r\n}\r\n\r\nexport interface IProductWake {\r\n ProdutoVarianteId: number;\r\n SKU: string;\r\n PrecoPor: number;\r\n PrecoDe: number;\r\n Quantidade: number;\r\n Ajustes: IAjustes[];\r\n}\r\n\r\nexport interface ICustomer {\r\n birthDate: string;\r\n document: string;\r\n name: string;\r\n phone: string;\r\n}\r\n\r\nexport interface IProccesPinBonusDto {\r\n storeName: string;\r\n name: string;\r\n checkoutId: string;\r\n checkoutProducts: Array<IProduct>;\r\n storeId: string;\r\n userId: string;\r\n cellphone: number;\r\n pin: string;\r\n\r\n}\r\n\r\nexport interface IBonus {\r\n hasBonus: boolean;\r\n bonusBalance: number;\r\n totalBonus: number;\r\n minimumPurchase: number;\r\n bonusIds: string;\r\n firstValidityDate: string\r\n history: [\r\n {\r\n validityStart: string;\r\n validityEnd: string;\r\n value: number\r\n },\r\n {\r\n validityStart: string;\r\n validityEnd: string\r\n value: number\r\n }\r\n ]\r\n storeId: number;\r\n userId: number;\r\n cartId: string\r\n calculatedValue: number;\r\n totalValue: number\r\n}\r\n\r\n\r\nexport interface IReserveDTO {\r\n storeName: string;\r\n cartId: string;\r\n grossValue: number;\r\n redeemedBonus: number;\r\n ticket: string;\r\n storeId: string;\r\n userId: number;\r\n}","import { AjustesTipoEnum, IAjustes, IProduct, IProductWake } from \"../dto/validate.pin.bonus\";\r\n\r\nexport function buildProductsByWake(productsWake: Array<IProductWake> = []): Array<IProduct> {\r\n\r\n const products: Array<IProduct> = [];\r\n\r\n for ( const pw of productsWake ) {\r\n let discounts = getDiscount(pw.Ajustes)\r\n // let discounts_formula = getDiscountFormula(pw.Ajustes);\r\n\r\n var value = (pw.PrecoDe * pw.Quantidade);\r\n var originalValue = (pw.PrecoDe * pw.Quantidade);\r\n\r\n var discounts_value = (discounts * -1)\r\n\r\n products.push(\r\n {\r\n sku: pw.SKU,\r\n value: value,\r\n originalValue: originalValue,\r\n productVariantId: pw.ProdutoVarianteId.toString(),\r\n quantity: pw.Quantidade,\r\n discount: value < discounts_value ? value : discounts_value,\r\n }\r\n )\r\n }\r\n\r\n return products;\r\n}\r\n\r\nfunction getDiscount(ajustes: IAjustes[] = []) {\r\n \r\n let discounts = 0;\r\n \r\n for(const discount of ajustes) {\r\n if([AjustesTipoEnum.P, AjustesTipoEnum.CC, AjustesTipoEnum.PP].includes(discount.Tipo)) {\r\n discounts += discount.Valor;\r\n }\r\n }\r\n\r\n return discounts;\r\n}\r\n\r\n// function getDiscountFormula(ajustes: IAjustes[] = []) {\r\n \r\n// let discounts = 0;\r\n \r\n// for(const discount of ajustes) {\r\n// if([AjustesTipoEnum.F].includes(discount.Tipo)) {\r\n// discounts += (discount.Valor * -1);\r\n// }\r\n// }\r\n\r\n// return discounts;\r\n// }"],"version":3}