crmbonus-component-wake 2.0.114-custom.1 → 2.0.115

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 (91) hide show
  1. package/dist/cjs/cart.helper-6a0021b4.js +49 -0
  2. package/dist/cjs/cart.helper-6a0021b4.js.map +1 -0
  3. package/dist/cjs/crm-bonus-form.cjs.entry.js +1 -1
  4. package/dist/cjs/crm-bonus-note.cjs.entry.js +13 -11
  5. package/dist/cjs/crm-bonus-note.cjs.entry.js.map +1 -1
  6. package/dist/cjs/crm-bonus.cjs.entry.js +40 -50
  7. package/dist/cjs/crm-bonus.cjs.entry.js.map +1 -1
  8. package/dist/cjs/crm-giftback-form_2.cjs.entry.js +1 -1
  9. package/dist/cjs/crmbonus-component-wake.cjs.js +1 -1
  10. package/dist/cjs/{crmbonus.service-c3953094.js → crmbonus.service-a4a07c28.js} +3 -2
  11. package/dist/cjs/crmbonus.service-a4a07c28.js.map +1 -0
  12. package/dist/cjs/loader.cjs.js +1 -1
  13. package/dist/cjs/pedido-finalizado.cjs.entry.js +13 -12
  14. package/dist/cjs/pedido-finalizado.cjs.entry.js.map +1 -1
  15. package/dist/collection/components/crm-bonus/crm-bonus.js +42 -136
  16. package/dist/collection/components/crm-bonus/crm-bonus.js.map +1 -1
  17. package/dist/collection/components/note/crm-bonus-note.js +13 -49
  18. package/dist/collection/components/note/crm-bonus-note.js.map +1 -1
  19. package/dist/collection/components/pedido/pedido.js +12 -68
  20. package/dist/collection/components/pedido/pedido.js.map +1 -1
  21. package/dist/collection/dto/validate.pin.bonus.js.map +1 -1
  22. package/dist/collection/helpers/cart.helper.js +20 -0
  23. package/dist/collection/helpers/cart.helper.js.map +1 -0
  24. package/dist/collection/objectvalues/cart.wake.js +24 -0
  25. package/dist/collection/objectvalues/cart.wake.js.map +1 -0
  26. package/dist/collection/services/crmbonus.service.js +1 -0
  27. package/dist/collection/services/crmbonus.service.js.map +1 -1
  28. package/dist/components/crm-bonus-form.js +1 -1
  29. package/dist/components/crm-bonus-note.js +13 -13
  30. package/dist/components/crm-bonus-note.js.map +1 -1
  31. package/dist/components/crm-bonus.js +42 -58
  32. package/dist/components/crm-bonus.js.map +1 -1
  33. package/dist/components/crm-giftback-form.js +1 -1
  34. package/dist/components/{p-f9c5e669.js → p-7f0cb052.js} +2 -2
  35. package/dist/components/{p-f9c5e669.js.map → p-7f0cb052.js.map} +1 -1
  36. package/dist/components/p-8179aaa5.js +47 -0
  37. package/dist/components/p-8179aaa5.js.map +1 -0
  38. package/dist/components/{p-e16ea64c.js → p-fd62879e.js} +3 -2
  39. package/dist/components/p-fd62879e.js.map +1 -0
  40. package/dist/components/pedido-finalizado.js +14 -17
  41. package/dist/components/pedido-finalizado.js.map +1 -1
  42. package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js +1 -1
  43. package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js.map +1 -1
  44. package/dist/crmbonus-component-wake/p-289a892a.entry.js +2 -0
  45. package/dist/crmbonus-component-wake/p-289a892a.entry.js.map +1 -0
  46. package/dist/crmbonus-component-wake/{p-b8376e7a.entry.js → p-4f47b32c.entry.js} +2 -2
  47. package/dist/crmbonus-component-wake/{p-57eff4fa.entry.js → p-51a4fdbf.entry.js} +2 -2
  48. package/dist/crmbonus-component-wake/p-8179aaa5.js +2 -0
  49. package/dist/crmbonus-component-wake/p-8179aaa5.js.map +1 -0
  50. package/dist/crmbonus-component-wake/p-a11e6510.entry.js +2 -0
  51. package/dist/crmbonus-component-wake/p-a11e6510.entry.js.map +1 -0
  52. package/dist/crmbonus-component-wake/p-e85698cd.entry.js +2 -0
  53. package/dist/crmbonus-component-wake/p-e85698cd.entry.js.map +1 -0
  54. package/dist/crmbonus-component-wake/{p-e16ea64c.js → p-fd62879e.js} +2 -2
  55. package/dist/crmbonus-component-wake/{p-e16ea64c.js.map → p-fd62879e.js.map} +1 -1
  56. package/dist/env.js +1 -1
  57. package/dist/env.js.map +1 -1
  58. package/dist/esm/cart.helper-dfef7b74.js +47 -0
  59. package/dist/esm/cart.helper-dfef7b74.js.map +1 -0
  60. package/dist/esm/crm-bonus-form.entry.js +1 -1
  61. package/dist/esm/crm-bonus-note.entry.js +13 -11
  62. package/dist/esm/crm-bonus-note.entry.js.map +1 -1
  63. package/dist/esm/crm-bonus.entry.js +40 -50
  64. package/dist/esm/crm-bonus.entry.js.map +1 -1
  65. package/dist/esm/crm-giftback-form_2.entry.js +1 -1
  66. package/dist/esm/crmbonus-component-wake.js +1 -1
  67. package/dist/esm/{crmbonus.service-fc7d9fdc.js → crmbonus.service-31fd796c.js} +3 -2
  68. package/dist/esm/crmbonus.service-31fd796c.js.map +1 -0
  69. package/dist/esm/loader.js +1 -1
  70. package/dist/esm/pedido-finalizado.entry.js +13 -12
  71. package/dist/esm/pedido-finalizado.entry.js.map +1 -1
  72. package/dist/types/components/crm-bonus/crm-bonus.d.ts +4 -8
  73. package/dist/types/components/note/crm-bonus-note.d.ts +3 -3
  74. package/dist/types/components/pedido/pedido.d.ts +1 -3
  75. package/dist/types/components.d.ts +1 -19
  76. package/dist/types/dto/validate.pin.bonus.d.ts +6 -0
  77. package/dist/types/helpers/cart.helper.d.ts +2 -0
  78. package/dist/types/home/darlison/Projects/Bycoders/crmbonus/crmbonus-component/.stencil/env.d.ts +1 -1
  79. package/dist/types/objectvalues/cart.wake.d.ts +12 -0
  80. package/package.json +1 -1
  81. package/dist/cjs/crmbonus.service-c3953094.js.map +0 -1
  82. package/dist/components/p-e16ea64c.js.map +0 -1
  83. package/dist/crmbonus-component-wake/p-27a96c29.entry.js +0 -2
  84. package/dist/crmbonus-component-wake/p-27a96c29.entry.js.map +0 -1
  85. package/dist/crmbonus-component-wake/p-3646705b.entry.js +0 -2
  86. package/dist/crmbonus-component-wake/p-3646705b.entry.js.map +0 -1
  87. package/dist/crmbonus-component-wake/p-7751b4be.entry.js +0 -2
  88. package/dist/crmbonus-component-wake/p-7751b4be.entry.js.map +0 -1
  89. package/dist/esm/crmbonus.service-fc7d9fdc.js.map +0 -1
  90. /package/dist/crmbonus-component-wake/{p-b8376e7a.entry.js.map → p-4f47b32c.entry.js.map} +0 -0
  91. /package/dist/crmbonus-component-wake/{p-57eff4fa.entry.js.map → p-51a4fdbf.entry.js.map} +0 -0
@@ -1,82 +1,26 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { CrmBonusService } from "../../services/crmbonus.service";
3
+ import { getCart } from "../../helpers/cart.helper";
3
4
  export class Pedido {
4
- constructor() {
5
- this.cartId = undefined;
6
- this.orderId = undefined;
7
- this.metadadoString = undefined;
8
- }
9
5
  async componentWillLoad() {
10
- const metadado = this.metadadoString ? JSON.parse(this.metadadoString) : { id: null };
11
- if (this.cartId && this.orderId) {
6
+ await this.handleOrder();
7
+ }
8
+ async handleOrder() {
9
+ const cart = await getCart();
10
+ if (cart.id && cart.orderId) {
12
11
  CrmBonusService.getInstance().updateOrder({
13
- cartId: this.cartId,
14
- orderId: this.orderId,
15
- cartIdCrm: metadado.id
12
+ cartId: cart.id,
13
+ orderId: cart.orderId,
14
+ cartIdCrm: cart.middlewareId
16
15
  });
17
- const key = `bc-products:${this.cartId}`;
16
+ const key = `bc-products:${cart.id}`;
18
17
  localStorage.removeItem(key);
19
- localStorage.removeItem(this.cartId);
18
+ localStorage.removeItem(cart.id);
20
19
  }
21
20
  }
22
21
  render() {
23
- return (h("div", { key: '6796f6e91c7e0ca6ea1d6c6bb4dc8297c531988b' }));
22
+ return (h("div", { key: 'b5d23baa12ed65a426ff01a351aa43559c30bc81' }));
24
23
  }
25
24
  static get is() { return "pedido-finalizado"; }
26
- static get properties() {
27
- return {
28
- "cartId": {
29
- "type": "string",
30
- "mutable": false,
31
- "complexType": {
32
- "original": "string",
33
- "resolved": "string",
34
- "references": {}
35
- },
36
- "required": false,
37
- "optional": false,
38
- "docs": {
39
- "tags": [],
40
- "text": ""
41
- },
42
- "attribute": "cartid",
43
- "reflect": false
44
- },
45
- "orderId": {
46
- "type": "number",
47
- "mutable": false,
48
- "complexType": {
49
- "original": "number",
50
- "resolved": "number",
51
- "references": {}
52
- },
53
- "required": false,
54
- "optional": false,
55
- "docs": {
56
- "tags": [],
57
- "text": ""
58
- },
59
- "attribute": "orderid",
60
- "reflect": false
61
- },
62
- "metadadoString": {
63
- "type": "string",
64
- "mutable": false,
65
- "complexType": {
66
- "original": "string",
67
- "resolved": "string",
68
- "references": {}
69
- },
70
- "required": false,
71
- "optional": false,
72
- "docs": {
73
- "tags": [],
74
- "text": ""
75
- },
76
- "attribute": "metadado",
77
- "reflect": false
78
- }
79
- };
80
- }
81
25
  }
82
26
  //# sourceMappingURL=pedido.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pedido.js","sourceRoot":"","sources":["../../../../src/components/pedido/pedido.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAKlE,MAAM,OAAO,MAAM;;;;;;IAMf,KAAK,CAAC,iBAAiB;QACnB,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;QAGtF,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAC9B,eAAe,CAAC,WAAW,EAAE,CAAC,WAAW,CAAC;gBACtC,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,OAAO,EAAG,IAAI,CAAC,OAAO;gBACtB,SAAS,EAAE,QAAQ,CAAC,EAAE;aACzB,CAAC,CAAC;YAEH,MAAM,GAAG,GAAG,eAAe,IAAI,CAAC,MAAM,EAAE,CAAC;YACzC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;YAC7B,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzC,CAAC;IACL,CAAC;IAED,MAAM;QACF,OAAO,CACH,6DAAW,CACd,CAAA;IACL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { Component, Prop, h } from \"@stencil/core\";\nimport { CrmBonusService } from \"../../services/crmbonus.service\";\n\n@Component({\n tag: \"pedido-finalizado\"\n})\nexport class Pedido {\n\n @Prop({ attribute: \"cartid\" }) cartId: string;\n @Prop({ attribute: \"orderid\" }) orderId: number;\n @Prop({ attribute: \"metadado\" }) metadadoString: string;\n\n async componentWillLoad() {\n const metadado = this.metadadoString ? JSON.parse(this.metadadoString) : { id: null };\n\n\n if (this.cartId && this.orderId) {\n CrmBonusService.getInstance().updateOrder({\n cartId: this.cartId,\n orderId: this.orderId,\n cartIdCrm: metadado.id\n });\n\n const key = `bc-products:${this.cartId}`;\n localStorage.removeItem(key);\n localStorage.removeItem(this.cartId);\n }\n }\n\n render() {\n return (\n <div></div>\n )\n }\n}"]}
1
+ {"version":3,"file":"pedido.js","sourceRoot":"","sources":["../../../../src/components/pedido/pedido.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAKpD,MAAM,OAAO,MAAM;IAEf,KAAK,CAAC,iBAAiB;QACnB,MAAM,IAAI,CAAC,WAAW,EAAE,CAAA;IAC5B,CAAC;IAED,KAAK,CAAC,WAAW;QACb,MAAM,IAAI,GAAG,MAAM,OAAO,EAAE,CAAC;QAE7B,IAAI,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAC1B,eAAe,CAAC,WAAW,EAAE,CAAC,WAAW,CAAC;gBACtC,MAAM,EAAE,IAAI,CAAC,EAAE;gBACf,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,SAAS,EAAE,IAAI,CAAC,YAAY;aAC/B,CAAC,CAAC;YAEH,MAAM,GAAG,GAAG,eAAe,IAAI,CAAC,EAAE,EAAE,CAAC;YACrC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;YAC7B,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACrC,CAAC;IACL,CAAC;IAED,MAAM;QACF,OAAO,CACH,6DAAW,CACd,CAAA;IACL,CAAC;;CACJ","sourcesContent":["import { Component, h } from \"@stencil/core\";\nimport { CrmBonusService } from \"../../services/crmbonus.service\";\nimport { getCart } from \"../../helpers/cart.helper\";\n\n@Component({\n tag: \"pedido-finalizado\"\n})\nexport class Pedido {\n\n async componentWillLoad() {\n await this.handleOrder()\n }\n\n async handleOrder() {\n const cart = await getCart();\n\n if (cart.id && cart.orderId) {\n CrmBonusService.getInstance().updateOrder({\n cartId: cart.id,\n orderId: cart.orderId,\n cartIdCrm: cart.middlewareId\n });\n\n const key = `bc-products:${cart.id}`;\n localStorage.removeItem(key);\n localStorage.removeItem(cart.id);\n }\n }\n\n render() {\n return (\n <div></div>\n )\n }\n}"]}
@@ -1 +1 @@
1
- {"version":3,"file":"validate.pin.bonus.js","sourceRoot":"","sources":["../../../src/dto/validate.pin.bonus.ts"],"names":[],"mappings":"AAQA,MAAM,CAAN,IAAY,eAEX;AAFD,WAAY,eAAe;IACvB,iCAAc,CAAA;AAClB,CAAC,EAFW,eAAe,KAAf,eAAe,QAE1B","sourcesContent":["export interface IProduct {\n productVariantId: string;\n sku: string;\n value: number;\n quantity: number;\n discount: number;\n}\n\nexport enum AjustesTipoEnum {\n P = \"Promocao\" \n}\n\nexport interface IAjustes {\n Tipo: AjustesTipoEnum;\n Valor: number;\n}\n\nexport interface IProductWake {\n ProdutoVarianteId: number;\n SKU: string;\n PrecoPor: number;\n Quantidade: number;\n Ajustes: IAjustes[];\n}\n\nexport interface ICustomer {\n birthDate: string;\n document: string;\n name: string;\n phone: string;\n}\n\nexport interface IProccesPinBonusDto {\n storeName: string;\n name: string;\n checkoutId: string;\n checkoutProducts: Array<IProduct>;\n storeId: string;\n userId: string;\n cellphone: number;\n pin: string;\n\n}\n\nexport interface IBonus {\n hasBonus: boolean;\n bonusBalance: number;\n totalBonus: number;\n minimumPurchase: number;\n bonusIds: string;\n firstValidityDate: string\n history: [\n {\n validityStart: string;\n validityEnd: string;\n value: number\n },\n {\n validityStart: string;\n validityEnd: string\n value: number\n }\n ]\n storeId: number;\n userId: number;\n cartId: string\n calculatedValue: number;\n totalValue: number\n}\n\n\nexport interface IReserveDTO {\n storeName: string;\n cartId: string;\n grossValue: number;\n redeemedBonus: number;\n ticket: string;\n storeId: string;\n userId: number;\n}"]}
1
+ {"version":3,"file":"validate.pin.bonus.js","sourceRoot":"","sources":["../../../src/dto/validate.pin.bonus.ts"],"names":[],"mappings":"AAQA,MAAM,CAAN,IAAY,eAEX;AAFD,WAAY,eAAe;IACvB,iCAAc,CAAA;AAClB,CAAC,EAFW,eAAe,KAAf,eAAe,QAE1B","sourcesContent":["export interface IProduct {\n productVariantId: string;\n sku: string;\n value: number;\n quantity: number;\n discount: number;\n}\n\nexport enum AjustesTipoEnum {\n P = \"Promocao\" \n}\n\nexport interface IAjustes {\n Tipo: AjustesTipoEnum;\n Valor: number;\n}\n\nexport interface IUser {\n id: number;\n}\n\nexport interface IStore {\n name: string;\n}\n\nexport interface IProductWake {\n ProdutoVarianteId: number;\n SKU: string;\n PrecoPor: number;\n Quantidade: number;\n Ajustes: IAjustes[];\n}\n\nexport interface ICustomer {\n birthDate: string;\n document: string;\n name: string;\n phone: string;\n}\n\nexport interface IProccesPinBonusDto {\n storeName: string;\n name: string;\n checkoutId: string;\n checkoutProducts: Array<IProduct>;\n storeId: string;\n userId: string;\n cellphone: number;\n pin: string;\n\n}\n\nexport interface IBonus {\n hasBonus: boolean;\n bonusBalance: number;\n totalBonus: number;\n minimumPurchase: number;\n bonusIds: string;\n firstValidityDate: string\n history: [\n {\n validityStart: string;\n validityEnd: string;\n value: number\n },\n {\n validityStart: string;\n validityEnd: string\n value: number\n }\n ]\n storeId: number;\n userId: number;\n cartId: string\n calculatedValue: number;\n totalValue: number\n}\n\n\nexport interface IReserveDTO {\n storeName: string;\n cartId: string;\n grossValue: number;\n redeemedBonus: number;\n ticket: string;\n storeId: string;\n userId: number;\n}"]}
@@ -0,0 +1,20 @@
1
+ import { CartWake } from "../objectvalues/cart.wake";
2
+ import { CrmBonusService } from "../services/crmbonus.service";
3
+ const crmBonusService = CrmBonusService.getInstance();
4
+ export const getCart = async () => {
5
+ const baseUrl = buildUrlBase(); // window.location.origin; //"https://bycoders.fbits.store" //window.location.origin;
6
+ console.log('[URL STORE]: ', baseUrl);
7
+ const cart = await crmBonusService.getInfoCart(baseUrl);
8
+ return new CartWake(cart);
9
+ };
10
+ const buildUrlBase = () => {
11
+ const url = window.location.origin; //"https://bycoders.checkout.fbits.store" //
12
+ if (url.includes('checkout')) {
13
+ return url;
14
+ }
15
+ if (url.includes('fbits')) {
16
+ return url;
17
+ }
18
+ return `${window.location.protocol}//checkout.${window.location.host}`;
19
+ };
20
+ //# sourceMappingURL=cart.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart.helper.js","sourceRoot":"","sources":["../../../src/helpers/cart.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,MAAM,eAAe,GAAoB,eAAe,CAAC,WAAW,EAAE,CAAC;AAEvE,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,IAAuB,EAAE;IACjD,MAAM,OAAO,GAAG,YAAY,EAAE,CAAC,CAAC,qFAAqF;IAErH,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAA;IAErC,MAAM,IAAI,GAAG,MAAM,eAAe,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAExD,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAA;AAC7B,CAAC,CAAA;AAED,MAAM,YAAY,GAAG,GAAG,EAAE;IAEtB,MAAM,GAAG,GAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,4CAA4C;IAEjF,IAAG,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QAC1B,OAAO,GAAG,CAAC;IACf,CAAC;IAED,IAAG,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACvB,OAAO,GAAG,CAAC;IACf,CAAC;IAED,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,cAAc,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAE3E,CAAC,CAAA","sourcesContent":["import { CartWake } from \"../objectvalues/cart.wake\";\nimport { CrmBonusService } from \"../services/crmbonus.service\";\n\nconst crmBonusService: CrmBonusService = CrmBonusService.getInstance();\n\nexport const getCart = async (): Promise<CartWake> => {\n const baseUrl = buildUrlBase(); // window.location.origin; //\"https://bycoders.fbits.store\" //window.location.origin;\n \n console.log('[URL STORE]: ', baseUrl)\n\n const cart = await crmBonusService.getInfoCart(baseUrl);\n\n return new CartWake(cart)\n}\n\nconst buildUrlBase = () => {\n\n const url = window.location.origin; //\"https://bycoders.checkout.fbits.store\" //\n\n if(url.includes('checkout')) {\n return url;\n }\n\n if(url.includes('fbits')) {\n return url;\n }\n\n return `${window.location.protocol}//checkout.${window.location.host}`;\n\n}"]}
@@ -0,0 +1,24 @@
1
+ export class CartWake {
2
+ constructor(cart) {
3
+ var _a;
4
+ this.products = [];
5
+ this.id = cart.Metadados.id || cart.Id;
6
+ this.middlewareId = (_a = cart.Metadados) === null || _a === void 0 ? void 0 : _a.id;
7
+ this.orderId = cart.PedidoId;
8
+ this.buildUserInfo(cart);
9
+ this.buildStoreInfo(cart);
10
+ this.products = cart.Produtos;
11
+ }
12
+ buildUserInfo(cart) {
13
+ this.user = {
14
+ id: cart.Usuario ? cart.Usuario.Id : null
15
+ };
16
+ }
17
+ buildStoreInfo(cart) {
18
+ var _a;
19
+ this.store = {
20
+ name: (_a = cart.Loja) === null || _a === void 0 ? void 0 : _a.Nome
21
+ };
22
+ }
23
+ }
24
+ //# sourceMappingURL=cart.wake.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart.wake.js","sourceRoot":"","sources":["../../../src/objectvalues/cart.wake.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,QAAQ;IAQjB,YAAY,IAAI;;QAJhB,aAAQ,GAAmB,EAAE,CAAC;QAK1B,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,CAAC;QACvC,IAAI,CAAC,YAAY,GAAG,MAAA,IAAI,CAAC,SAAS,0CAAE,EAAE,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC7B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;IACjC,CAAC;IAEO,aAAa,CAAC,IAAI;QACtB,IAAI,CAAC,IAAI,GAAG;YACR,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI;SAC5C,CAAA;IACL,CAAC;IAEO,cAAc,CAAC,IAAI;;QACvB,IAAI,CAAC,KAAK,GAAG;YACT,IAAI,EAAE,MAAA,IAAI,CAAC,IAAI,0CAAE,IAAI;SACxB,CAAA;IACL,CAAC;CACJ","sourcesContent":["import { IProductWake, IStore, IUser } from \"../dto/validate.pin.bonus\";\n\nexport class CartWake {\n id: string;\n middlewareId: string;\n orderId: number;\n products: IProductWake[] = [];\n user: IUser;\n store: IStore;\n\n constructor(cart) {\n this.id = cart.Metadados.id || cart.Id;\n this.middlewareId = cart.Metadados?.id;\n this.orderId = cart.PedidoId;\n this.buildUserInfo(cart);\n this.buildStoreInfo(cart);\n this.products = cart.Produtos\n }\n\n private buildUserInfo(cart) {\n this.user = {\n id: cart.Usuario ? cart.Usuario.Id : null\n }\n }\n\n private buildStoreInfo(cart) {\n this.store = {\n name: cart.Loja?.Nome\n }\n }\n}"]}
@@ -109,6 +109,7 @@ export class CrmBonusService {
109
109
  localStorage.removeItem(USED_KEY);
110
110
  }
111
111
  async getInfoCart(checkoutBase) {
112
+ // return {"CEP":null,"Usuario":null,"Loja":{"Nome":"bycoders","IsInternacional":false,"MoedaPagamento":"R$","Google":{"Analytics":{"Ativo":true,"Ids":["G-B0F0CP55V0","G-B0F0CP55V0"]},"TagManager":{"Ativo":true,"Id":"GTM-P2XLDJGF"}},"Ebit":{"Modal":false,"Id":""},"AlliNSDK":{"Id":null},"AlliNBTG":{"Id":null},"Buscape":{"Id":""},"Modulos":["Pricing","Orders","Formula"]},"Produtos":[{"ProdutoVarianteId":336660,"ProdutoId":150142,"Nome":"Teste roupa 2","UrlImagem":"https://bycoders.fbitsstatic.net/img/p/sem-foto.jpg","Quantidade":1,"PrecoDe":10.0000,"PrecoPor":10.00,"Brinde":false,"IsDigital":false,"PrecoPorComAjustesProduto":0.0,"SKU":"233445","Categoria":"Masculino","CategoriasGoogle":[],"Fabricante":"","PrazoEntrega":{"Titulo":"","Descricao":"","SegundoTitulo":"","SegundaDescricao":"","PrazoProduto":0},"Atributos":[],"Metadados":{},"Informacoes":[],"Recorrencia":null,"Url":"https://bycoders.fbits.store/produto/150142","ParcelamentoQuantidade":0,"ParcelamentoValor":0.0,"ParcelamentoJuro":false,"Valores":[],"Ajustes":[]},{"ProdutoVarianteId":256639,"ProdutoId":70129,"Nome":"Mochila Nike Classic","UrlImagem":"https://bycoders.fbitsstatic.net/img/p/256639/256639-1.jpg?w=100&h=100&v=no-change&qs=ignore","Quantidade":1,"PrecoDe":319.0000,"PrecoPor":219.00,"Brinde":false,"IsDigital":false,"PrecoPorComAjustesProduto":0.0,"SKU":"Moc7101","Categoria":"Acessórios","CategoriasGoogle":[],"Fabricante":"Nike","PrazoEntrega":{"Titulo":"","Descricao":"","SegundoTitulo":"","SegundaDescricao":"","PrazoProduto":5},"Atributos":[],"Metadados":{},"Informacoes":[],"Recorrencia":null,"Url":"https://bycoders.fbits.store/produto/70129","ParcelamentoQuantidade":0,"ParcelamentoValor":0.0,"ParcelamentoJuro":false,"Valores":[],"Ajustes":[]}],"Metadados":{},"Login":"","ValorFrete":0.0,"SubTotal":229.00,"ValorTotal":229.00,"Cupom":"","Pedido":null,"Pedidos":null,"Frete":null,"DataAlteracao":"2025-03-10T11:55:58.327","Id":"31daeac1-9283-44dc-bc4c-ee02892cf3f0","Origem":null,"AllDigital":false,"QuantidadeMinimaProdutos":{"Ativo":false,"Mensagem":"","QuantidadeMinima":0},"ValorMinimoPedido":{"ValorMinimo":0.0,"Mensagem":"Faltam [valor] para atingir o valor mínimo do pedido"},"CookieOnly":false}
112
113
  const response = await this.axiosInstance.get(`${checkoutBase}/api/carrinho`);
113
114
  return response.data;
114
115
  }
@@ -1 +1 @@
1
- {"version":3,"file":"crmbonus.service.js","sourceRoot":"","sources":["../../../src/services/crmbonus.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAI7C,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE/G,MAAM,OAAO,eAAe;IAMxB;QACI,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC;YAC9B,OAAO,EAAE,iBAAiB;YAC1B,OAAO,EAAE;gBACL,cAAc,EAAE,kBAAkB;gBAClC,QAAQ,EAAE,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AI,CAAC,CAAC,CAAA;IAC3F,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,MAAc,EAAE,SAAiB;QAC/C,MAAM,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAEjD,MAAM,OAAO,GAAG;YACZ,cAAc,EAAE,kBAAkB;YAClC,eAAe,EAAE,UAAU,KAAK,EAAE;SACrC,CAAA;QAED,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,wBAAwB,EAClD;YACI,MAAM;YACN,SAAS,EAAE,IAAI;YACf,SAAS,EAAE,SAAS;SACvB,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAA;QAE5B,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAElC,YAAY,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;IACrC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,YAAoB;QAClC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,YAAY,eAAe,CAAC,CAAA;QAC7E,OAAO,QAAQ,CAAC,IAAI,CAAC;IACzB,CAAC;;AAtJc,yBAAS,GAAoB,IAAI,CAAC","sourcesContent":["import axios, { AxiosInstance } from 'axios';\nimport { CRM_BONUS_API_URL } from '../../env'\nimport { IPinSent } from '../dto/pin.sent';\nimport { IBonus, IProccesPinBonusDto, IReserveDTO } from '../dto/validate.pin.bonus';\nimport { UpdateOrderDTO } from '../dto/update.order.dto';\nimport { BYCODERS_KEY, USED_KEY, getKeyConfigByStoreName, getKeyReserveByCartId } from '../utils/keys.storage';\n\nexport class CrmBonusService {\n private axiosInstance: AxiosInstance;\n private token: string;\n\n private static _instance: CrmBonusService = null;\n\n constructor() {\n this.axiosInstance = axios.create({\n baseURL: CRM_BONUS_API_URL,\n headers: {\n 'Content-Type': 'application/json',\n 'accept': 'application/json',\n },\n });\n }\n\n public static getInstance(): CrmBonusService {\n if (this._instance) {\n return this._instance;\n }\n\n this._instance = new CrmBonusService()\n\n return this._instance;\n }\n\n async getCustomer(userId: number, store: string) {\n\n const headers = {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${this.token}`\n }\n\n const response = await this.axiosInstance.get(`/store/${store}/customer/${userId}`, { headers: headers })\n\n this.token = response?.data?.token\n\n return response?.data?.customer\n }\n\n async updateOrder(updateOrderDTO: UpdateOrderDTO) {\n\n const token = localStorage.getItem(\"@BYCODERS_KEY\");\n\n const headers = {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${token}`\n }\n\n await this.axiosInstance.patch(`/checkouts/${updateOrderDTO.cartId}/updateOrder`,\n {\n orderId: updateOrderDTO.orderId,\n externalId: updateOrderDTO.cartIdCrm\n }, { headers: headers })\n\n localStorage.removeItem(\"@BYCODERS_KEY\");\n localStorage.removeItem(USED_KEY);\n localStorage.removeItem(getKeyReserveByCartId(updateOrderDTO.cartId))\n }\n\n async sendPin(phone: number, name: string, store: string): Promise<IPinSent> {\n\n const headers = {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${this.token}`\n }\n\n\n const response = await this.axiosInstance.post(\"/crmbonus/send-pin\", { cellphone: phone, name: name, storeName: store }, { headers: headers });\n return {\n storeId: response.data.storeId,\n userId: response.data.userId\n }\n }\n\n async validatePinBonus(payload: IProccesPinBonusDto): Promise<IBonus> {\n\n const headers = {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${this.token}`\n }\n\n const response = await this.axiosInstance.post(\"/crmbonus/process-pin-bonus\", payload, { headers })\n\n return response.data;\n }\n\n async reserve(payload: IReserveDTO) {\n\n const headers = {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${this.token}`\n }\n const response = await this.axiosInstance.post(\"/crmbonus/redeem-bonus\", payload, { headers });\n return response.data;\n }\n\n async cancel(cartId: string) {\n\n const headers = {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${this.token}`\n }\n\n const response = await this.axiosInstance.post(\"/crmbonus/cancel-apply-bonus\", {\n ticket: cartId\n }, { headers });\n return response.data;\n }\n\n async getToken(store: string): Promise<string> {\n const response = await this.axiosInstance.post(\"/wake/requestToken\", { storeName: store })\n this.token = response?.data?.token;\n\n localStorage.setItem(BYCODERS_KEY, this.token);\n\n return response?.data?.token;\n }\n\n async getCustomization(storeName: string) {\n\n const headers = {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${this.token}`\n }\n\n const response = await this.axiosInstance.get(`/stores/${storeName}/customizations`, { headers });\n\n localStorage.setItem(getKeyConfigByStoreName(storeName), JSON.stringify(response.data))\n }\n\n async cancelBonus(cartId: string, storeName: string) {\n const token = localStorage.getItem(BYCODERS_KEY);\n\n const headers = {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${token}`\n }\n\n await this.axiosInstance.post(`/crmbonus/cancel-bonus`,\n {\n cartId,\n usedBonus: true,\n storeName: storeName\n }, { headers: headers })\n\n localStorage.setItem(cartId, \"0\");\n\n localStorage.removeItem(USED_KEY)\n }\n\n async getInfoCart(checkoutBase: string) {\n const response = await this.axiosInstance.get(`${checkoutBase}/api/carrinho`)\n return response.data;\n }\n}"]}
1
+ {"version":3,"file":"crmbonus.service.js","sourceRoot":"","sources":["../../../src/services/crmbonus.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAI7C,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE/G,MAAM,OAAO,eAAe;IAMxB;QACI,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC;YAC9B,OAAO,EAAE,iBAAiB;YAC1B,OAAO,EAAE;gBACL,cAAc,EAAE,kBAAkB;gBAClC,QAAQ,EAAE,kBAAkB;aAC/B;SACJ,CAAC,CAAC;IACP,CAAC;IAEM,MAAM,CAAC,WAAW;QACr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AE,SAAiB;QAC/C,MAAM,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAEjD,MAAM,OAAO,GAAG;YACZ,cAAc,EAAE,kBAAkB;YAClC,eAAe,EAAE,UAAU,KAAK,EAAE;SACrC,CAAA;QAED,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,wBAAwB,EAClD;YACI,MAAM;YACN,SAAS,EAAE,IAAI;YACf,SAAS,EAAE,SAAS;SACvB,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAA;QAE5B,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAElC,YAAY,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;IACrC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,YAAoB;QAElC,qpEAAqpE;QACrpE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,YAAY,eAAe,CAAC,CAAA;QAC7E,OAAO,QAAQ,CAAC,IAAI,CAAC;IACzB,CAAC;;AAxJc,yBAAS,GAAoB,IAAI,CAAC","sourcesContent":["import axios, { AxiosInstance } from 'axios';\nimport { CRM_BONUS_API_URL } from '../../env'\nimport { IPinSent } from '../dto/pin.sent';\nimport { IBonus, IProccesPinBonusDto, IReserveDTO } from '../dto/validate.pin.bonus';\nimport { UpdateOrderDTO } from '../dto/update.order.dto';\nimport { BYCODERS_KEY, USED_KEY, getKeyConfigByStoreName, getKeyReserveByCartId } from '../utils/keys.storage';\n\nexport class CrmBonusService {\n private axiosInstance: AxiosInstance;\n private token: string;\n\n private static _instance: CrmBonusService = null;\n\n constructor() {\n this.axiosInstance = axios.create({\n baseURL: CRM_BONUS_API_URL,\n headers: {\n 'Content-Type': 'application/json',\n 'accept': 'application/json',\n },\n });\n }\n\n public static getInstance(): CrmBonusService {\n if (this._instance) {\n return this._instance;\n }\n\n this._instance = new CrmBonusService()\n\n return this._instance;\n }\n\n async getCustomer(userId: number, store: string) {\n\n const headers = {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${this.token}`\n }\n\n const response = await this.axiosInstance.get(`/store/${store}/customer/${userId}`, { headers: headers })\n\n this.token = response?.data?.token\n\n return response?.data?.customer\n }\n\n async updateOrder(updateOrderDTO: UpdateOrderDTO) {\n\n const token = localStorage.getItem(\"@BYCODERS_KEY\");\n\n const headers = {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${token}`\n }\n\n await this.axiosInstance.patch(`/checkouts/${updateOrderDTO.cartId}/updateOrder`,\n {\n orderId: updateOrderDTO.orderId,\n externalId: updateOrderDTO.cartIdCrm\n }, { headers: headers })\n\n localStorage.removeItem(\"@BYCODERS_KEY\");\n localStorage.removeItem(USED_KEY);\n localStorage.removeItem(getKeyReserveByCartId(updateOrderDTO.cartId))\n }\n\n async sendPin(phone: number, name: string, store: string): Promise<IPinSent> {\n\n const headers = {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${this.token}`\n }\n\n\n const response = await this.axiosInstance.post(\"/crmbonus/send-pin\", { cellphone: phone, name: name, storeName: store }, { headers: headers });\n return {\n storeId: response.data.storeId,\n userId: response.data.userId\n }\n }\n\n async validatePinBonus(payload: IProccesPinBonusDto): Promise<IBonus> {\n\n const headers = {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${this.token}`\n }\n\n const response = await this.axiosInstance.post(\"/crmbonus/process-pin-bonus\", payload, { headers })\n\n return response.data;\n }\n\n async reserve(payload: IReserveDTO) {\n\n const headers = {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${this.token}`\n }\n const response = await this.axiosInstance.post(\"/crmbonus/redeem-bonus\", payload, { headers });\n return response.data;\n }\n\n async cancel(cartId: string) {\n\n const headers = {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${this.token}`\n }\n\n const response = await this.axiosInstance.post(\"/crmbonus/cancel-apply-bonus\", {\n ticket: cartId\n }, { headers });\n return response.data;\n }\n\n async getToken(store: string): Promise<string> {\n const response = await this.axiosInstance.post(\"/wake/requestToken\", { storeName: store })\n this.token = response?.data?.token;\n\n localStorage.setItem(BYCODERS_KEY, this.token);\n\n return response?.data?.token;\n }\n\n async getCustomization(storeName: string) {\n\n const headers = {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${this.token}`\n }\n\n const response = await this.axiosInstance.get(`/stores/${storeName}/customizations`, { headers });\n\n localStorage.setItem(getKeyConfigByStoreName(storeName), JSON.stringify(response.data))\n }\n\n async cancelBonus(cartId: string, storeName: string) {\n const token = localStorage.getItem(BYCODERS_KEY);\n\n const headers = {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${token}`\n }\n\n await this.axiosInstance.post(`/crmbonus/cancel-bonus`,\n {\n cartId,\n usedBonus: true,\n storeName: storeName\n }, { headers: headers })\n\n localStorage.setItem(cartId, \"0\");\n\n localStorage.removeItem(USED_KEY)\n }\n\n async getInfoCart(checkoutBase: string) {\n\n // return {\"CEP\":null,\"Usuario\":null,\"Loja\":{\"Nome\":\"bycoders\",\"IsInternacional\":false,\"MoedaPagamento\":\"R$\",\"Google\":{\"Analytics\":{\"Ativo\":true,\"Ids\":[\"G-B0F0CP55V0\",\"G-B0F0CP55V0\"]},\"TagManager\":{\"Ativo\":true,\"Id\":\"GTM-P2XLDJGF\"}},\"Ebit\":{\"Modal\":false,\"Id\":\"\"},\"AlliNSDK\":{\"Id\":null},\"AlliNBTG\":{\"Id\":null},\"Buscape\":{\"Id\":\"\"},\"Modulos\":[\"Pricing\",\"Orders\",\"Formula\"]},\"Produtos\":[{\"ProdutoVarianteId\":336660,\"ProdutoId\":150142,\"Nome\":\"Teste roupa 2\",\"UrlImagem\":\"https://bycoders.fbitsstatic.net/img/p/sem-foto.jpg\",\"Quantidade\":1,\"PrecoDe\":10.0000,\"PrecoPor\":10.00,\"Brinde\":false,\"IsDigital\":false,\"PrecoPorComAjustesProduto\":0.0,\"SKU\":\"233445\",\"Categoria\":\"Masculino\",\"CategoriasGoogle\":[],\"Fabricante\":\"\",\"PrazoEntrega\":{\"Titulo\":\"\",\"Descricao\":\"\",\"SegundoTitulo\":\"\",\"SegundaDescricao\":\"\",\"PrazoProduto\":0},\"Atributos\":[],\"Metadados\":{},\"Informacoes\":[],\"Recorrencia\":null,\"Url\":\"https://bycoders.fbits.store/produto/150142\",\"ParcelamentoQuantidade\":0,\"ParcelamentoValor\":0.0,\"ParcelamentoJuro\":false,\"Valores\":[],\"Ajustes\":[]},{\"ProdutoVarianteId\":256639,\"ProdutoId\":70129,\"Nome\":\"Mochila Nike Classic\",\"UrlImagem\":\"https://bycoders.fbitsstatic.net/img/p/256639/256639-1.jpg?w=100&h=100&v=no-change&qs=ignore\",\"Quantidade\":1,\"PrecoDe\":319.0000,\"PrecoPor\":219.00,\"Brinde\":false,\"IsDigital\":false,\"PrecoPorComAjustesProduto\":0.0,\"SKU\":\"Moc7101\",\"Categoria\":\"Acessórios\",\"CategoriasGoogle\":[],\"Fabricante\":\"Nike\",\"PrazoEntrega\":{\"Titulo\":\"\",\"Descricao\":\"\",\"SegundoTitulo\":\"\",\"SegundaDescricao\":\"\",\"PrazoProduto\":5},\"Atributos\":[],\"Metadados\":{},\"Informacoes\":[],\"Recorrencia\":null,\"Url\":\"https://bycoders.fbits.store/produto/70129\",\"ParcelamentoQuantidade\":0,\"ParcelamentoValor\":0.0,\"ParcelamentoJuro\":false,\"Valores\":[],\"Ajustes\":[]}],\"Metadados\":{},\"Login\":\"\",\"ValorFrete\":0.0,\"SubTotal\":229.00,\"ValorTotal\":229.00,\"Cupom\":\"\",\"Pedido\":null,\"Pedidos\":null,\"Frete\":null,\"DataAlteracao\":\"2025-03-10T11:55:58.327\",\"Id\":\"31daeac1-9283-44dc-bc4c-ee02892cf3f0\",\"Origem\":null,\"AllDigital\":false,\"QuantidadeMinimaProdutos\":{\"Ativo\":false,\"Mensagem\":\"\",\"QuantidadeMinima\":0},\"ValorMinimoPedido\":{\"ValorMinimo\":0.0,\"Mensagem\":\"Faltam [valor] para atingir o valor mínimo do pedido\"},\"CookieOnly\":false}\n const response = await this.axiosInstance.get(`${checkoutBase}/api/carrinho`)\n return response.data;\n }\n}"]}
@@ -1,5 +1,5 @@
1
1
  import { p as proxyCustomElement, H, h, d as Host } from './p-3e84f78c.js';
2
- import { C as CrmBonusService } from './p-e16ea64c.js';
2
+ import { C as CrmBonusService } from './p-fd62879e.js';
3
3
  import { S as StepFormEnum } from './p-7cfea8fe.js';
4
4
  import { d as defineCustomElement$6 } from './p-b79c86a8.js';
5
5
  import { d as defineCustomElement$5 } from './p-6186ddcc.js';
@@ -2,6 +2,7 @@ import { p as proxyCustomElement, H, h } from './p-3e84f78c.js';
2
2
  import { g as getInfoCustomization } from './p-75ba7b9a.js';
3
3
  import { g as getKeyReserveByCartId } from './p-f9aeffc1.js';
4
4
  import { i as instance } from './p-e8c19a64.js';
5
+ import { g as getCart } from './p-8179aaa5.js';
5
6
  import { d as defineCustomElement$4 } from './p-2b3b8d6b.js';
6
7
  import { d as defineCustomElement$3 } from './p-47f9da55.js';
7
8
  import { d as defineCustomElement$2 } from './p-fe9c3966.js';
@@ -27,8 +28,7 @@ const CrmBonusNote$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonusNote exten
27
28
  constructor() {
28
29
  super();
29
30
  this.__registerHost();
30
- this.cartId = undefined;
31
- this.storename = undefined;
31
+ this.cartWake = undefined;
32
32
  this.url = undefined;
33
33
  this.config = undefined;
34
34
  this.bonus = undefined;
@@ -38,8 +38,9 @@ const CrmBonusNote$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonusNote exten
38
38
  this.upadateCheckToFreteAndGetUrl();
39
39
  this.startTime();
40
40
  }
41
- upadateCheckToFreteAndGetUrl() {
42
- this.config = getInfoCustomization(this.storename);
41
+ async upadateCheckToFreteAndGetUrl() {
42
+ this.cartWake = await getCart();
43
+ this.config = getInfoCustomization(this.cartWake.store.name);
43
44
  const envios = document.getElementsByName('forma-envio');
44
45
  envios.forEach((envio) => {
45
46
  envio.checked = false;
@@ -47,11 +48,11 @@ const CrmBonusNote$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonusNote exten
47
48
  this.url = window.location.origin;
48
49
  }
49
50
  handleHide() {
50
- const amount = localStorage.getItem(this.cartId);
51
+ const amount = localStorage.getItem(this.cartWake.id);
51
52
  return !!amount;
52
53
  }
53
54
  getAmount() {
54
- const amount = localStorage.getItem(this.cartId);
55
+ const amount = localStorage.getItem(this.cartWake.id);
55
56
  return amount ? Number(amount).toFixed(2).replace(".", ",") || "0,00" : "0,00";
56
57
  }
57
58
  async backCart() {
@@ -66,7 +67,7 @@ const CrmBonusNote$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonusNote exten
66
67
  }
67
68
  }
68
69
  hasBonus() {
69
- const _bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));
70
+ const _bonus = localStorage.getItem(getKeyReserveByCartId(this.cartWake.id));
70
71
  const info = {
71
72
  hasBonus: false,
72
73
  requestBonus: false
@@ -85,15 +86,14 @@ const CrmBonusNote$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonusNote exten
85
86
  render() {
86
87
  const giftbackname = this.config.giftbackTitle || "Giftback";
87
88
  const infobonus = this.hasBonus();
88
- return (h("div", { key: '5e6af682c8a1d449c7b44372cc8392c23d3b8c37' }, h("div", { key: 'fdaac56b3f905ccd34ac19f8d26472d13f2e6060', class: "note-container" }, h("div", { key: '532921493fa0e6d84628ce344a04c7f3e4c1188b', class: "note-header" }, h("p", { key: '09fb8be7eb83b7e5a2cad2a6c8e4ac42bcc8843f', class: "note-title" }, h("img", { key: 'b50b4bb1d2b087fdf51d94b66a7618156f4e02b8', src: moneyDollarsSvgrepoComSvg, width: 23 }), this.config.giftbackTitle), infobonus.hasBonus && (h("div", { key: 'c4bbcfac356814745248ca0e03b31691dbbfc68e' }, this.showEdit && (h("p", { key: '8139ff2556944583c367106d205de783a68793d8', class: "back-cart", onClick: () => this.backCart() }, instance.t("edit"))), !this.showEdit && h("countdown-timer", { key: '9720653f739eadc70b4f44c44f9c10c215350fe4', initialValue: this.getTime(), downtime: () => { this.showEdit = true; } })))), infobonus.hasBonus &&
89
- (h("p", { key: 'e0a6d0b9aa09699aeaf86633d9a24fe7550ffbe6', class: "note-description-2" }, instance.t("withApplyBonus", { giftbackname: giftbackname }), " ", h("strong", { key: '39728d345ed3cbcf76be108e894095bc0b6f844c' }, "R$ ", this.getAmount(), "."))), (infobonus.requestBonus && !infobonus.hasBonus) &&
90
- (h("p", { key: 'a92ac10c9e2db555a0244497c5be9654f17cb53b', class: "note-description-not" }, instance.t("noBonus", { giftbackname: giftbackname }))), !infobonus.requestBonus &&
91
- (h("div", { key: 'fe95768f91165bd89f4eed467f69122e1c0a2d49', class: "description" }, h("p", { key: 'fe0360269c159032c1b8cab772b4613900dd6ce3', class: "note-description-not" }, instance.t("backCart")), h("crm-button", { key: 'da883a2fc5bb08f0435ce4493619c6a9952e6391', txtBtn: "VOLTAR AO CARRINHO", handleClick: () => this.backCart() }))))));
89
+ return (h("div", { key: '03718ce8adc7ff0e5db68dfe7a47e504e4da501c' }, h("div", { key: '152dfe88a0f532efdf57fbf72788a7ac1ab4f94a', class: "note-container" }, h("div", { key: '4c7f76fb6086b04efbc566247f33ac6f4420e6f5', class: "note-header" }, h("p", { key: 'cc62523e813d228025a78ca494cea0d8421a5fdc', class: "note-title" }, h("img", { key: '2b0ed0424cf21da3d5844b76834041d9450a7eb8', src: moneyDollarsSvgrepoComSvg, width: 23 }), this.config.giftbackTitle), infobonus.hasBonus && (h("div", { key: '471194982ce8d9aa88a2651120519a090c54e79d' }, this.showEdit && (h("p", { key: '0121fe033d2e5ab0582d04c2c3b9d146bb16cb50', class: "back-cart", onClick: () => this.backCart() }, instance.t("edit"))), !this.showEdit && h("countdown-timer", { key: 'fb07477025913752e56178b0f30efdf3e64ff553', initialValue: this.getTime(), downtime: () => { this.showEdit = true; } })))), infobonus.hasBonus &&
90
+ (h("p", { key: '2cbf881eed3bf44dd5ef8a3196cbee23ae8757a3', class: "note-description-2" }, instance.t("withApplyBonus", { giftbackname: giftbackname }), " ", h("strong", { key: 'be66439d229a2d9c653b6c8326bc8439e25a0add' }, "R$ ", this.getAmount(), "."))), (infobonus.requestBonus && !infobonus.hasBonus) &&
91
+ (h("p", { key: '1305b882c7adba7d58834d8f287b0a1ae6e79841', class: "note-description-not" }, instance.t("noBonus", { giftbackname: giftbackname }))), !infobonus.requestBonus &&
92
+ (h("div", { key: '0c14d537a581d8692e76e9400b86f6bc336126ec', class: "description" }, h("p", { key: '42560579e7f3b379df64bb1262f3cf35166e969a', class: "note-description-not" }, instance.t("backCart")), h("crm-button", { key: '64d3ee4b62bac23186e97778e8644c65ac6e06c6', txtBtn: "VOLTAR AO CARRINHO", handleClick: () => this.backCart() }))))));
92
93
  }
93
94
  static get style() { return CrmBonusNoteStyle0; }
94
95
  }, [0, "crm-bonus-note", {
95
- "cartId": [8, "cartid"],
96
- "storename": [8],
96
+ "cartWake": [32],
97
97
  "url": [32],
98
98
  "config": [32],
99
99
  "bonus": [32],
@@ -1 +1 @@
1
- {"file":"crm-bonus-note.js","mappings":";;;;;;;;AAAA,MAAM,yBAAyB,GAAG,4gCAA4gC;;SCA9hC,OAAO;IAEnB,IAAG,YAAY,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE;QACtC,OAAM;KACT;IAED,MAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAE7C,IAAG,CAAC,IAAI,EAAE;QACN,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QACvC,YAAY,CAAC,OAAO,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;QAC9C,OAAM;KACT;AACL;;ACbA,MAAM,eAAe,GAAG,i3CAAi3C,CAAC;AAC14C,2BAAe,eAAe;;MCYjBA,cAAY;;;;;;;;;wBAUQ,KAAK;;IAElC,iBAAiB;QACb,IAAI,CAAC,4BAA4B,EAAE,CAAC;QAC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gB,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,OAAE,wEAAY,IAAI,CAAC,SAAS,EAAE,MAAW,CACrG,CACP,EAID,CAAC,SAAS,CAAC,YAAY,IAAI,CAAC,SAAS,CAAC,QAAQ;aAE1C,0DAAG,KAAK,EAAC,sBAAsB,IAC1BA,QAAO,CAAC,CAAC,CAAC,SAAS,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CACrD,CACP,EAID,CAAC,SAAS,CAAC,YAAY;aAEnB,4DAAK,KAAK,EAAC,aAAa,IACpB,0DAAG,KAAK,EAAC,sBAAsB,IAC1BA,QAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CACtB,EACJ,mEAAY,MAAM,EAAC,oBAAoB,EAAC,WAAW,EAAE,MAAM,IAAI,CAAC,QAAQ,EAAE,GAAI,CAC5E,CACT,CAMH,CACJ,EACT;KACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CrmBonusNote","money","i18next"],"sources":["src/assets/svg/money-dollars-svgrepo-com.svg","src/helpers/time.helper.ts","src/components/note/crm-bonus-note.css?tag=crm-bonus-note","src/components/note/crm-bonus-note.tsx"],"sourcesContent":["<?xml version=\"1.0\" encoding=\"utf-8\"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->\n<svg width=\"800px\" height=\"800px\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<circle cx=\"12\" cy=\"12\" r=\"10\" stroke=\"#000000\" stroke-width=\"2\"/>\n<path d=\"M15 9.94728C14.5 9.3 13.8 8.5 12 8.5C10.2 8.5 9 9.51393 9 9.94728C9 10.3806 9.06786 10.9277 10 11.5C10.7522 11.9618 12.6684 12.0439 13.5 12.5C14.679 13.1467 14.8497 13.8202 14.8497 14.0522C14.8497 14.6837 13.4175 15.4852 12 15.5C10.536 15.5153 9.5 14.7 9 14.0522\" stroke=\"#000000\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 7V17\" stroke=\"#000000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>","export function setTime() {\n\n if(localStorage.getItem(\"bc:time-allow\")) {\n return\n }\n\n const time = localStorage.getItem(\"bc:time\");\n\n if(!time) {\n localStorage.setItem(\"bc:time\", \"360\");\n localStorage.setItem(\"bc:time-allow\", \"true\");\n return\n } \n}",".note-container {\n border: 1px solid #dddddd;\n padding: 0 15px 15px;\n margin: 0 0 26px 0px;\n display: flex;\n flex-direction: column;\n gap: 13px;\n\n\n & .description {\n display: flex;\n flex-direction: column;\n gap: 13px;\n }\n}\n\n.note-container hr {\n border: 1px solid #CCC;\n}\n\n.note-container .back-cart {\n display: flex;\n text-align: center;\n}\n\n.note-header {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n}\n\n.note-title {\n font-weight: 700;\n text-align: left;\n display: flex;\n gap: 6px;\n align-items: center;\n margin-top: 11px;\n color: #000;\n}\n\n.note-description {\n font-family: Arial;\n color: #6d6d5f;\n padding: 0;\n margin: 0 auto;\n}\n\n.back-cart {\n font-size: .9em;\n color: #27272A;\n text-decoration: none;\n cursor: pointer;\n margin-top: 11px;\n}\n\n.note-description-2 {\n color: var(--crm-scheme-fg-main-inverse, #262626);\n font-family: Roboto;\n font-size: var(--crm-font-size-body-lg, 16px);\n font-style: normal;\n font-weight: var(--crm-font-weight-body-bold, 400);\n line-height: var(--crm-line-height-body-md, 20px);\n letter-spacing: var(--crm-letter-spacing-title-md, 0px);\n margin-top: 11px;\n color: #000;\n}\n\n.note-description-not {\n font-size: 16px;\n}","import { Component, Prop, State, h } from \"@stencil/core\";\nimport { IInfoStore, getInfoCustomization } from \"../../helpers/info.config.helper\";\n\nimport money from '../../assets/svg/money-dollars-svgrepo-com.svg'\nimport { getKeyReserveByCartId } from \"../../utils/keys.storage\";\nimport i18next from \"../../i18n/i18n\"\nimport { IBonus } from \"../../components\";\nimport { setTime } from \"../../helpers/time.helper\";\n\n@Component({\n tag: 'crm-bonus-note',\n styleUrl: 'crm-bonus-note.css'\n})\nexport class CrmBonusNote {\n\n @Prop({ attribute: 'cartid' }) cartId;\n @Prop({ attribute: \"storename\" }) storename;\n\n @State() url: string;\n @State() config: IInfoStore;\n\n @State() bonus: IBonus;\n\n @State() showEdit: boolean = false;\n\n componentWillLoad() {\n this.upadateCheckToFreteAndGetUrl();\n this.startTime();\n }\n\n upadateCheckToFreteAndGetUrl() {\n\n this.config = getInfoCustomization(this.storename);\n const envios = document.getElementsByName('forma-envio');\n envios.forEach((envio: any) => {\n envio.checked = false;\n });\n\n this.url = window.location.origin;\n }\n\n handleHide() {\n const amount = localStorage.getItem(this.cartId);\n return !!amount;\n }\n\n getAmount() {\n const amount = localStorage.getItem(this.cartId);\n\n return amount ? Number(amount).toFixed(2).replace(\".\", \",\") || \"0,00\" : \"0,00\";\n }\n\n async backCart() {\n window.location.href = this.url;\n }\n\n\n private startTime() {\n if(document.location.pathname == '/Fechamento') {\n\n if(!localStorage.getItem(\"bc:time-allow\")) {\n localStorage.removeItem(\"bc:time\")\n }\n\n setTime();\n }\n }\n\n\n hasBonus() {\n const _bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));\n\n const info = {\n hasBonus: false,\n requestBonus: false\n }\n\n if (_bonus) {\n this.bonus = JSON.parse(_bonus);\n info.hasBonus = this.bonus.hasBonus;\n info.requestBonus = true;\n }\n\n return info;\n }\n\n getTime() {\n const time = localStorage.getItem(\"bc:time\")\n \n return time ? Number(time) : 0;\n }\n\n render() {\n\n const giftbackname = this.config.giftbackTitle || \"Giftback\";\n\n const infobonus = this.hasBonus()\n\n return (\n <div>\n <div class=\"note-container\">\n <div class=\"note-header\">\n\n <p class=\"note-title\">\n <img src={money} width={23} />\n {this.config.giftbackTitle}\n </p>\n {\n infobonus.hasBonus && (\n <div>\n {this.showEdit && (\n <p class=\"back-cart\" onClick={() => this.backCart()}>\n {i18next.t(\"edit\")}\n </p>\n )}\n {!this.showEdit && <countdown-timer initialValue={this.getTime()} downtime={() => { this.showEdit = true }} />}\n </div>\n )\n }\n </div>\n\n {\n infobonus.hasBonus &&\n (\n <p class=\"note-description-2\">\n {i18next.t(\"withApplyBonus\", { giftbackname: giftbackname })} <strong>R$ {this.getAmount()}.</strong>\n </p>\n )\n }\n\n {\n (infobonus.requestBonus && !infobonus.hasBonus) &&\n (\n <p class=\"note-description-not\">\n {i18next.t(\"noBonus\", { giftbackname: giftbackname })}\n </p>\n )\n }\n\n {\n !infobonus.requestBonus &&\n (\n <div class=\"description\">\n <p class=\"note-description-not\">\n {i18next.t(\"backCart\")}\n </p>\n <crm-button txtBtn=\"VOLTAR AO CARRINHO\" handleClick={() => this.backCart()} />\n </div>\n )\n }\n\n {/* <a class=\"back-cart\" href={this.url}>\n Voltar ao carrinho\n </a> */}\n </div>\n </div>\n )\n }\n}"],"version":3}
1
+ {"file":"crm-bonus-note.js","mappings":";;;;;;;;;AAAA,MAAM,yBAAyB,GAAG,4gCAA4gC;;SCA9hC,OAAO;IAEnB,IAAG,YAAY,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE;QACtC,OAAM;KACT;IAED,MAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAE7C,IAAG,CAAC,IAAI,EAAE;QACN,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QACvC,YAAY,CAAC,OAAO,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;QAC9C,OAAM;KACT;AACL;;ACbA,MAAM,eAAe,GAAG,i3CAAi3C,CAAC;AAC14C,2BAAe,eAAe;;MCcjBA,cAAY;;;;;;;;wBASQ,KAAK;;IAElC,iBAAiB;QACb,IAAI,CAAC,4BAA4B,EAAE,CAAC;QACpC,IAAI,CAAC,SAAS,EAAE,CAAC;KACpB;IAED,MAAM,4BAA4B;QAE9B,IAAI,CAAC,QAAQ,GAAG,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oB,IACxBA,QAAO,CAAC,CAAC,CAAC,gBAAgB,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,OAAE,wEAAY,IAAI,CAAC,SAAS,EAAE,MAAW,CACrG,CACP,EAID,CAAC,SAAS,CAAC,YAAY,IAAI,CAAC,SAAS,CAAC,QAAQ;aAE1C,0DAAG,KAAK,EAAC,sBAAsB,IAC1BA,QAAO,CAAC,CAAC,CAAC,SAAS,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CACrD,CACP,EAID,CAAC,SAAS,CAAC,YAAY;aAEnB,4DAAK,KAAK,EAAC,aAAa,IACpB,0DAAG,KAAK,EAAC,sBAAsB,IAC1BA,QAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CACtB,EACJ,mEAAY,MAAM,EAAC,oBAAoB,EAAC,WAAW,EAAE,MAAM,IAAI,CAAC,QAAQ,EAAE,GAAI,CAC5E,CACT,CAMH,CACJ,EACT;KACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CrmBonusNote","money","i18next"],"sources":["src/assets/svg/money-dollars-svgrepo-com.svg","src/helpers/time.helper.ts","src/components/note/crm-bonus-note.css?tag=crm-bonus-note","src/components/note/crm-bonus-note.tsx"],"sourcesContent":["<?xml version=\"1.0\" encoding=\"utf-8\"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->\n<svg width=\"800px\" height=\"800px\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<circle cx=\"12\" cy=\"12\" r=\"10\" stroke=\"#000000\" stroke-width=\"2\"/>\n<path d=\"M15 9.94728C14.5 9.3 13.8 8.5 12 8.5C10.2 8.5 9 9.51393 9 9.94728C9 10.3806 9.06786 10.9277 10 11.5C10.7522 11.9618 12.6684 12.0439 13.5 12.5C14.679 13.1467 14.8497 13.8202 14.8497 14.0522C14.8497 14.6837 13.4175 15.4852 12 15.5C10.536 15.5153 9.5 14.7 9 14.0522\" stroke=\"#000000\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 7V17\" stroke=\"#000000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>","export function setTime() {\n\n if(localStorage.getItem(\"bc:time-allow\")) {\n return\n }\n\n const time = localStorage.getItem(\"bc:time\");\n\n if(!time) {\n localStorage.setItem(\"bc:time\", \"360\");\n localStorage.setItem(\"bc:time-allow\", \"true\");\n return\n } \n}",".note-container {\n border: 1px solid #dddddd;\n padding: 0 15px 15px;\n margin: 0 0 26px 0px;\n display: flex;\n flex-direction: column;\n gap: 13px;\n\n\n & .description {\n display: flex;\n flex-direction: column;\n gap: 13px;\n }\n}\n\n.note-container hr {\n border: 1px solid #CCC;\n}\n\n.note-container .back-cart {\n display: flex;\n text-align: center;\n}\n\n.note-header {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n}\n\n.note-title {\n font-weight: 700;\n text-align: left;\n display: flex;\n gap: 6px;\n align-items: center;\n margin-top: 11px;\n color: #000;\n}\n\n.note-description {\n font-family: Arial;\n color: #6d6d5f;\n padding: 0;\n margin: 0 auto;\n}\n\n.back-cart {\n font-size: .9em;\n color: #27272A;\n text-decoration: none;\n cursor: pointer;\n margin-top: 11px;\n}\n\n.note-description-2 {\n color: var(--crm-scheme-fg-main-inverse, #262626);\n font-family: Roboto;\n font-size: var(--crm-font-size-body-lg, 16px);\n font-style: normal;\n font-weight: var(--crm-font-weight-body-bold, 400);\n line-height: var(--crm-line-height-body-md, 20px);\n letter-spacing: var(--crm-letter-spacing-title-md, 0px);\n margin-top: 11px;\n color: #000;\n}\n\n.note-description-not {\n font-size: 16px;\n}","import { Component, Prop, State, h } from \"@stencil/core\";\nimport { IInfoStore, getInfoCustomization } from \"../../helpers/info.config.helper\";\n\nimport money from '../../assets/svg/money-dollars-svgrepo-com.svg'\nimport { getKeyReserveByCartId } from \"../../utils/keys.storage\";\nimport i18next from \"../../i18n/i18n\"\nimport { IBonus } from \"../../components\";\nimport { setTime } from \"../../helpers/time.helper\";\nimport { CartWake } from \"../../objectvalues/cart.wake\";\nimport { getCart } from \"../../helpers/cart.helper\";\n\n@Component({\n tag: 'crm-bonus-note',\n styleUrl: 'crm-bonus-note.css'\n})\nexport class CrmBonusNote {\n\n @State() cartWake: CartWake;\n\n @State() url: string;\n @State() config: IInfoStore;\n\n @State() bonus: IBonus;\n\n @State() showEdit: boolean = false;\n\n componentWillLoad() {\n this.upadateCheckToFreteAndGetUrl();\n this.startTime();\n }\n\n async upadateCheckToFreteAndGetUrl() {\n\n this.cartWake = await getCart();\n\n this.config = getInfoCustomization(this.cartWake.store.name);\n\n const envios = document.getElementsByName('forma-envio');\n envios.forEach((envio: any) => {\n envio.checked = false;\n });\n\n this.url = window.location.origin;\n }\n\n handleHide() {\n const amount = localStorage.getItem(this.cartWake.id);\n return !!amount;\n }\n\n getAmount() {\n const amount = localStorage.getItem(this.cartWake.id);\n\n return amount ? Number(amount).toFixed(2).replace(\".\", \",\") || \"0,00\" : \"0,00\";\n }\n\n async backCart() {\n window.location.href = this.url;\n }\n\n\n private startTime() {\n if(document.location.pathname == '/Fechamento') {\n\n if(!localStorage.getItem(\"bc:time-allow\")) {\n localStorage.removeItem(\"bc:time\")\n }\n\n setTime();\n }\n }\n\n\n hasBonus() {\n const _bonus = localStorage.getItem(getKeyReserveByCartId(this.cartWake.id));\n\n const info = {\n hasBonus: false,\n requestBonus: false\n }\n\n if (_bonus) {\n this.bonus = JSON.parse(_bonus);\n info.hasBonus = this.bonus.hasBonus;\n info.requestBonus = true;\n }\n\n return info;\n }\n\n getTime() {\n const time = localStorage.getItem(\"bc:time\")\n \n return time ? Number(time) : 0;\n }\n\n render() {\n\n const giftbackname = this.config.giftbackTitle || \"Giftback\";\n\n const infobonus = this.hasBonus()\n\n return (\n <div>\n <div class=\"note-container\">\n <div class=\"note-header\">\n\n <p class=\"note-title\">\n <img src={money} width={23} />\n {this.config.giftbackTitle}\n </p>\n {\n infobonus.hasBonus && (\n <div>\n {this.showEdit && (\n <p class=\"back-cart\" onClick={() => this.backCart()}>\n {i18next.t(\"edit\")}\n </p>\n )}\n {!this.showEdit && <countdown-timer initialValue={this.getTime()} downtime={() => { this.showEdit = true }} />}\n </div>\n )\n }\n </div>\n\n {\n infobonus.hasBonus &&\n (\n <p class=\"note-description-2\">\n {i18next.t(\"withApplyBonus\", { giftbackname: giftbackname })} <strong>R$ {this.getAmount()}.</strong>\n </p>\n )\n }\n\n {\n (infobonus.requestBonus && !infobonus.hasBonus) &&\n (\n <p class=\"note-description-not\">\n {i18next.t(\"noBonus\", { giftbackname: giftbackname })}\n </p>\n )\n }\n\n {\n !infobonus.requestBonus &&\n (\n <div class=\"description\">\n <p class=\"note-description-not\">\n {i18next.t(\"backCart\")}\n </p>\n <crm-button txtBtn=\"VOLTAR AO CARRINHO\" handleClick={() => this.backCart()} />\n </div>\n )\n }\n\n {/* <a class=\"back-cart\" href={this.url}>\n Voltar ao carrinho\n </a> */}\n </div>\n </div>\n )\n }\n}"],"version":3}
@@ -1,10 +1,11 @@
1
1
  import { p as proxyCustomElement, H, h } from './p-3e84f78c.js';
2
- import { C as CrmBonusService } from './p-e16ea64c.js';
2
+ import { C as CrmBonusService } from './p-fd62879e.js';
3
3
  import { S as StepFormEnum } from './p-7cfea8fe.js';
4
4
  import { i as instance } from './p-e8c19a64.js';
5
+ import { g as getCart } from './p-8179aaa5.js';
5
6
  import { d as defineCustomElement$b } from './p-2b3b8d6b.js';
6
7
  import { d as defineCustomElement$a } from './p-47f9da55.js';
7
- import { d as defineCustomElement$9 } from './p-f9c5e669.js';
8
+ import { d as defineCustomElement$9 } from './p-7f0cb052.js';
8
9
  import { d as defineCustomElement$8 } from './p-58b97429.js';
9
10
  import { d as defineCustomElement$7 } from './p-2671d669.js';
10
11
  import { d as defineCustomElement$6 } from './p-cc1ea33f.js';
@@ -51,11 +52,7 @@ const CrmBonus$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
51
52
  this.__registerHost();
52
53
  this.crmBonusService = CrmBonusService.getInstance();
53
54
  this.showModal = false;
54
- this.userId = undefined;
55
- this.storeName = undefined;
56
- this.productsInString = undefined;
57
- this.cartId = undefined;
58
- this.products = undefined;
55
+ this.cartWake = undefined;
59
56
  this.customer = {
60
57
  birthDate: "",
61
58
  document: "",
@@ -73,10 +70,6 @@ const CrmBonus$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
73
70
  }
74
71
  async resetBonus() {
75
72
  console.log('[START RESET BONUS]!!!!!');
76
- // const used = localStorage.getItem("bc:used");
77
- // if (used == "use") {
78
- // await this.crmBonusService.cancelBonus(this.cartId, this.storeName);
79
- // }
80
73
  try {
81
74
  await this.crmBonusRef.processBonus(this.buildProducts(), true);
82
75
  console.log('[BONUS RESETADO]!!!!!');
@@ -90,11 +83,11 @@ const CrmBonus$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
90
83
  this.loading = false;
91
84
  }
92
85
  }
93
- async reprocess(products) {
86
+ async reprocess() {
94
87
  this.loading_reprocess = true;
95
88
  try {
96
- this.productsInString = JSON.stringify(products);
97
- await this.handleLoad();
89
+ this.cartWake = await getCart();
90
+ console.log('cart', this.cartWake);
98
91
  await this.resetBonus();
99
92
  }
100
93
  catch (err) {
@@ -104,59 +97,59 @@ const CrmBonus$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
104
97
  this.loading_reprocess = false;
105
98
  }
106
99
  }
107
- async watchProducts(newValue) {
108
- try {
109
- console.log('[update products list]');
110
- this.productsInString = newValue;
111
- await this.handleLoad();
112
- await this.resetBonus();
113
- }
114
- catch (err) {
115
- console.debug('[watchProducts]', err.message);
116
- }
117
- }
100
+ // @Watch("productsInString")
101
+ // async watchProducts(newValue: string) {
102
+ // try {
103
+ // console.log('[update products list]');
104
+ // this.productsInString = newValue;
105
+ // await this.handleLoad();
106
+ // await this.resetBonus();
107
+ // } catch (err) {
108
+ // console.debug('[watchProducts]', err.message);
109
+ // }
110
+ // }
118
111
  async componentWillLoad() {
119
112
  instance.changeLanguage(instance.language);
113
+ await this.handleLoad();
120
114
  await this.loadSession();
121
115
  await this.loadConfigStore();
122
- await this.handleLoad();
123
116
  }
124
117
  async loadConfigStore() {
125
- await this.crmBonusService.getCustomization(this.storeName);
118
+ await this.crmBonusService.getCustomization(this.cartWake.store.name);
126
119
  }
127
120
  async handleLoad() {
128
121
  try {
129
- if (this.userId) {
130
- this.customer = await this.crmBonusService.getCustomer(this.userId, this.storeName);
122
+ this.cartWake = await getCart();
123
+ console.log('cart', this.cartWake);
124
+ if (this.cartWake.user.id) {
125
+ this.customer = await this.crmBonusService.getCustomer(this.cartWake.user.id, this.cartWake.store.name);
131
126
  console.log('customer', this.customer);
132
127
  }
133
- const amount = localStorage.getItem(this.cartId);
128
+ const amount = localStorage.getItem(this.cartWake.id);
134
129
  if (amount) {
135
130
  this.canCancel = true;
136
131
  this.amountCancel = amount;
137
132
  }
133
+ await this.buildAndGetProducts(this.cartWake.products);
138
134
  }
139
135
  catch (error) {
140
136
  console.log('info customer');
141
137
  }
142
- await this.buildAndGetProducts();
143
138
  }
144
139
  async loadSession() {
145
- this.session = await this.crmBonusService.getToken(this.storeName);
140
+ console.log('this.storeName', this.cartWake.store.name);
141
+ this.session = await this.crmBonusService.getToken(this.cartWake.store.name);
146
142
  setTimeout(() => {
147
143
  this.loadSession();
148
144
  }, 1500000);
149
145
  }
150
- async buildAndGetProducts() {
151
- const key = `bc-products:${this.cartId}`;
152
- const baseUrl = window.location.origin; //"https://bycoders.fbits.store" //window.location.origin;
153
- const cart = await this.crmBonusService.getInfoCart(baseUrl);
154
- this.productsInString = JSON.stringify(cart.Produtos);
155
- localStorage.setItem(key, this.productsInString);
156
- const productsInCart = JSON.parse(this.productsInString);
146
+ async buildAndGetProducts(productsWake) {
147
+ const key = `bc-products:${this.cartWake.id}`;
148
+ const productsString = JSON.stringify(productsWake);
149
+ localStorage.setItem(key, productsString);
157
150
  const products_in_cache = JSON.parse(localStorage.getItem(key));
158
151
  const products = [];
159
- for (const product_cart of productsInCart) {
152
+ for (const product_cart of productsWake) {
160
153
  const [pro] = products_in_cache.filter(p => p.ProdutoVarianteId == product_cart.ProdutoVarianteId);
161
154
  const [ajuste = { Valor: 0 }] = pro.Ajustes.filter(aj => aj.Tipo === "Formula");
162
155
  if (pro) {
@@ -166,7 +159,7 @@ const CrmBonus$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
166
159
  products.push(product_cart);
167
160
  }
168
161
  }
169
- this.products = products; //cache_products ? JSON.parse(cache_products) : JSON.parse(this.productsInString);
162
+ this.cartWake.products = products; //cache_products ? JSON.parse(cache_products) : JSON.parse(this.productsInString);
170
163
  }
171
164
  async sendPin(phone) {
172
165
  var _a, _b;
@@ -175,7 +168,7 @@ const CrmBonus$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
175
168
  try {
176
169
  const _phone = phone.replace(/\D/g, '');
177
170
  this.phone = Number(_phone);
178
- this.sent = await this.crmBonusService.sendPin(this.phone, this.customer.name, this.storeName);
171
+ this.sent = await this.crmBonusService.sendPin(this.phone, this.customer.name, this.cartWake.store.name);
179
172
  await this.crmBonusRef.setStep(StepFormEnum.STEP_PIN);
180
173
  this.showModal = true;
181
174
  }
@@ -192,7 +185,7 @@ const CrmBonus$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
192
185
  this.message = "";
193
186
  try {
194
187
  this.customer.name = customerName;
195
- this.sent = await this.crmBonusService.sendPin(this.phone, this.customer.name, this.storeName);
188
+ this.sent = await this.crmBonusService.sendPin(this.phone, this.customer.name, this.cartWake.store.name);
196
189
  await this.crmBonusRef.setStep(StepFormEnum.STEP_PIN);
197
190
  this.showModal = true;
198
191
  }
@@ -204,13 +197,13 @@ const CrmBonus$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
204
197
  }
205
198
  }
206
199
  buildProducts() {
207
- return buildProductsByWake(this.products);
200
+ return buildProductsByWake(this.cartWake.products);
208
201
  }
209
202
  handleCloseModal() {
210
203
  this.showModal = false;
211
204
  }
212
205
  save(amount) {
213
- localStorage.setItem(this.cartId, amount.toString());
206
+ localStorage.setItem(this.cartWake.id, amount.toString());
214
207
  this.canCancel = true;
215
208
  this.amountCancel = amount.toString();
216
209
  }
@@ -218,9 +211,9 @@ const CrmBonus$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
218
211
  this.message = "";
219
212
  this.loading = true;
220
213
  try {
221
- await this.crmBonusService.cancel(this.cartId);
214
+ await this.crmBonusService.cancel(this.cartWake.id);
222
215
  this.canCancel = false;
223
- localStorage.removeItem(this.cartId);
216
+ localStorage.removeItem(this.cartWake.id);
224
217
  }
225
218
  catch (error) {
226
219
  this.message = "Não consegui cancelar o bônus, tente novamente!";
@@ -245,20 +238,13 @@ const CrmBonus$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
245
238
  this.showModal = true;
246
239
  }
247
240
  render() {
248
- return (h("loading-container", { key: '7d2a096146b448080fe2e164db1db21bbee5aacf', loading: this.loading_reprocess }, h("crm-giftback-form", { key: 'ab3712c2dd84227ebba4458ee513c0292deef850', style: { position: "relative" }, ref: ref => this.crmBonusRef = ref, storeName: this.storeName, products: this.buildProducts(), cartId: this.cartId, customer: this.customer, loadProducts: () => this.buildProducts() })));
241
+ return (h("loading-container", { key: '67b0c86da1b59ec891a48bfcd4d7b0572c322cee', loading: this.loading_reprocess }, h("crm-giftback-form", { key: '59cddeaba1f47ea10aaa20371b33892b9b555304', style: { position: "relative" }, ref: ref => this.crmBonusRef = ref, storeName: this.cartWake.store.name, products: this.buildProducts(), cartId: this.cartWake.id, customer: this.customer, loadProducts: () => this.buildProducts() })));
249
242
  }
250
243
  static get assetsDirs() { return ["assets"]; }
251
- static get watchers() { return {
252
- "productsInString": ["watchProducts"]
253
- }; }
254
244
  static get style() { return CrmBonusStyle0; }
255
245
  }, [2, "crm-bonus", {
256
- "userId": [2, "userid"],
257
- "storeName": [8, "storename"],
258
- "productsInString": [1, "products"],
259
- "cartId": [8, "cartid"],
260
246
  "showModal": [32],
261
- "products": [32],
247
+ "cartWake": [32],
262
248
  "customer": [32],
263
249
  "loading": [32],
264
250
  "message": [32],
@@ -270,8 +256,6 @@ const CrmBonus$1 = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
270
256
  "loading_reprocess": [32],
271
257
  "resetBonus": [64],
272
258
  "reprocess": [64]
273
- }, undefined, {
274
- "productsInString": ["watchProducts"]
275
259
  }]);
276
260
  function defineCustomElement$1() {
277
261
  if (typeof customElements === "undefined") {