@ecomplus/widget-ebit 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,150 +3,96 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- # [1.2.0](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.13...@ecomplus/widget-ebit@1.2.0) (2022-02-06)
6
+ ## [1.2.2](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.2.1...@ecomplus/widget-ebit@1.2.2) (2023-08-24)
7
7
 
8
+ ### Bug Fixes
8
9
 
9
- ### Features
10
+ - **widget-ebit:** set birthdate params if day & month & year set only ([#939](https://github.com/ecomplus/storefront/issues/939)) ([cb10377](https://github.com/ecomplus/storefront/commit/cb1037717d31f4abd21f66fb39f8e08376a04011))
10
11
 
11
- * **template/cms:** using @ecomplus/storefront-cms in place of raw netlify cms ([#596](https://github.com/ecomplus/storefront/issues/596)) ([95c8d3a](https://github.com/ecomplus/storefront/commit/95c8d3ab3f73b0b1dff0a1f5f45b5abfb6dddafa)), closes [#issuecomment-1006566949](https://github.com/ecomplus/storefront/issues/issuecomment-1006566949) [#issuecomment-1003380562](https://github.com/ecomplus/storefront/issues/issuecomment-1003380562)
12
+ ## [1.2.1](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.2.0...@ecomplus/widget-ebit@1.2.1) (2023-01-09)
12
13
 
14
+ ### Bug Fixes
13
15
 
16
+ - **deps:** bump @ecomplus/passport-client and @ecomplus/shopping-cart ([3b60f09](https://github.com/ecomplus/storefront/commit/3b60f098f3fef0621fd045afea47ded663c69967))
14
17
 
18
+ # [1.2.0](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.13...@ecomplus/widget-ebit@1.2.0) (2022-02-06)
15
19
 
20
+ ### Features
16
21
 
17
- ## [1.1.13](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.12...@ecomplus/widget-ebit@1.1.13) (2021-09-17)
22
+ - **template/cms:** using @ecomplus/storefront-cms in place of raw netlify cms ([#596](https://github.com/ecomplus/storefront/issues/596)) ([95c8d3a](https://github.com/ecomplus/storefront/commit/95c8d3ab3f73b0b1dff0a1f5f45b5abfb6dddafa)), closes [#issuecomment-1006566949](https://github.com/ecomplus/storefront/issues/issuecomment-1006566949) [#issuecomment-1003380562](https://github.com/ecomplus/storefront/issues/issuecomment-1003380562)
18
23
 
24
+ ## [1.1.13](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.12...@ecomplus/widget-ebit@1.1.13) (2021-09-17)
19
25
 
20
26
  ### Bug Fixes
21
27
 
22
- * **deps:** update @ecomplus/passport-client to v1.1.0 ([e43a2c0](https://github.com/ecomplus/storefront/commit/e43a2c09cb059ecb1a14b532ab5251be86739008))
23
- * **deps:** update @ecomplus/passport-client to v1.1.1 ([b713159](https://github.com/ecomplus/storefront/commit/b7131596a14556ca53c4608a234ace3b12b39943))
24
-
25
-
26
-
27
-
28
+ - **deps:** update @ecomplus/passport-client to v1.1.0 ([e43a2c0](https://github.com/ecomplus/storefront/commit/e43a2c09cb059ecb1a14b532ab5251be86739008))
29
+ - **deps:** update @ecomplus/passport-client to v1.1.1 ([b713159](https://github.com/ecomplus/storefront/commit/b7131596a14556ca53c4608a234ace3b12b39943))
28
30
 
29
31
  ## [1.1.12](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.11...@ecomplus/widget-ebit@1.1.12) (2021-07-24)
30
32
 
31
33
  **Note:** Version bump only for package @ecomplus/widget-ebit
32
34
 
33
-
34
-
35
-
36
-
37
-
38
35
  ## [1.1.11](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.10...@ecomplus/widget-ebit@1.1.11) (2020-12-16)
39
36
 
40
37
  **Note:** Version bump only for package @ecomplus/widget-ebit
41
38
 
42
-
43
-
44
-
45
-
46
39
  ## [1.1.10](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.9...@ecomplus/widget-ebit@1.1.10) (2020-12-15)
47
40
 
48
41
  **Note:** Version bump only for package @ecomplus/widget-ebit
49
42
 
50
-
51
-
52
-
53
-
54
43
  ## [1.1.9](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.8...@ecomplus/widget-ebit@1.1.9) (2020-12-15)
55
44
 
56
45
  **Note:** Version bump only for package @ecomplus/widget-ebit
57
46
 
58
-
59
-
60
-
61
-
62
47
  ## [1.1.8](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.7...@ecomplus/widget-ebit@1.1.8) (2020-10-26)
63
48
 
64
49
  **Note:** Version bump only for package @ecomplus/widget-ebit
65
50
 
66
-
67
-
68
-
69
-
70
51
  ## [1.1.7](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.6...@ecomplus/widget-ebit@1.1.7) (2020-07-17)
71
52
 
72
-
73
53
  ### Bug Fixes
74
54
 
75
- * **pkg:** fix direct js dependencies ([f1d29cf](https://github.com/ecomplus/storefront/commit/f1d29cfb90df8393c5ff2f82e74f043594e3f08f))
76
-
77
-
78
-
79
-
55
+ - **pkg:** fix direct js dependencies ([f1d29cf](https://github.com/ecomplus/storefront/commit/f1d29cfb90df8393c5ff2f82e74f043594e3f08f))
80
56
 
81
57
  ## [1.1.6](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.5...@ecomplus/widget-ebit@1.1.6) (2020-06-30)
82
58
 
83
-
84
59
  ### Bug Fixes
85
60
 
86
- * **ebit-banner:** fix duplicated lightbox error ([#259](https://github.com/ecomplus/storefront/issues/259)) ([cfaccbf](https://github.com/ecomplus/storefront/commit/cfaccbf105ef37d11f08832c562f5d655fc0797b))
87
-
88
-
89
-
90
-
61
+ - **ebit-banner:** fix duplicated lightbox error ([#259](https://github.com/ecomplus/storefront/issues/259)) ([cfaccbf](https://github.com/ecomplus/storefront/commit/cfaccbf105ef37d11f08832c562f5d655fc0797b))
91
62
 
92
63
  ## [1.1.5](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.4...@ecomplus/widget-ebit@1.1.5) (2020-06-19)
93
64
 
94
65
  **Note:** Version bump only for package @ecomplus/widget-ebit
95
66
 
96
-
97
-
98
-
99
-
100
67
  ## [1.1.4](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.3...@ecomplus/widget-ebit@1.1.4) (2020-05-29)
101
68
 
102
-
103
69
  ### Bug Fixes
104
70
 
105
- * **ebit-lightbox:** fix loading ebit script dynamically ([0fb0d51](https://github.com/ecomplus/storefront/commit/0fb0d51b64cdf17d469488b0404e77b6b8635c08))
106
-
107
-
108
-
109
-
71
+ - **ebit-lightbox:** fix loading ebit script dynamically ([0fb0d51](https://github.com/ecomplus/storefront/commit/0fb0d51b64cdf17d469488b0404e77b6b8635c08))
110
72
 
111
73
  ## [1.1.3](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.2...@ecomplus/widget-ebit@1.1.3) (2020-05-26)
112
74
 
113
75
  **Note:** Version bump only for package @ecomplus/widget-ebit
114
76
 
115
-
116
-
117
-
118
-
119
77
  ## [1.1.2](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.1...@ecomplus/widget-ebit@1.1.2) (2020-05-22)
120
78
 
121
-
122
79
  ### Bug Fixes
123
80
 
124
- * **deps:** update @ecomplus/utils to v1.4.0 ([551e02e](https://github.com/ecomplus/storefront/commit/551e02e0e1e3bee6ce7002fd84d0c91f9cb8fb08))
125
-
126
-
127
-
128
-
81
+ - **deps:** update @ecomplus/utils to v1.4.0 ([551e02e](https://github.com/ecomplus/storefront/commit/551e02e0e1e3bee6ce7002fd84d0c91f9cb8fb08))
129
82
 
130
83
  ## [1.1.1](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.0...@ecomplus/widget-ebit@1.1.1) (2020-05-21)
131
84
 
132
-
133
85
  ### Bug Fixes
134
86
 
135
- * **widget-ebit:** fix formatting bith date to ebit param ([9affd68](https://github.com/ecomplus/storefront/commit/9affd68e0c392e6edda48b6fec65c3b13f3032ac))
136
-
137
-
138
-
139
-
87
+ - **widget-ebit:** fix formatting bith date to ebit param ([9affd68](https://github.com/ecomplus/storefront/commit/9affd68e0c392e6edda48b6fec65c3b13f3032ac))
140
88
 
141
89
  # 1.1.0 (2020-05-21)
142
90
 
143
-
144
91
  ### Bug Fixes
145
92
 
146
- * **cms:** ebit widget disabled by for pages ([db67a0e](https://github.com/ecomplus/storefront/commit/db67a0e7c7ca399ca439e5704e34aa55006deb16))
147
- * **widget-ebit:** append confirmation banner to #confirmation el ([a27e985](https://github.com/ecomplus/storefront/commit/a27e9858e485b3a75da68e2e7cf94e7b28453df2))
148
-
93
+ - **cms:** ebit widget disabled by for pages ([db67a0e](https://github.com/ecomplus/storefront/commit/db67a0e7c7ca399ca439e5704e34aa55006deb16))
94
+ - **widget-ebit:** append confirmation banner to #confirmation el ([a27e985](https://github.com/ecomplus/storefront/commit/a27e9858e485b3a75da68e2e7cf94e7b28453df2))
149
95
 
150
96
  ### Features
151
97
 
152
- * **ebit:** storefront plugin for ebit reviews ([#234](https://github.com/ecomplus/storefront/issues/234)) ([fc356aa](https://github.com/ecomplus/storefront/commit/fc356aadd7fbf1c653525ab9ebbb06df183eddfa))
98
+ - **ebit:** storefront plugin for ebit reviews ([#234](https://github.com/ecomplus/storefront/issues/234)) ([fc356aa](https://github.com/ecomplus/storefront/commit/fc356aadd7fbf1c653525ab9ebbb06df183eddfa))
@@ -1,2 +1,2 @@
1
- var widgetEbit=function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/assets/vendor/",r(r.s=2)}([function(e,t){e.exports=void 0},function(e,t){e.exports=void 0},function(e,t,r){"use strict";r.r(t);var n=r(0),a=r(1),o=r.n(a);t.default=(e={})=>{const{ebitStoreId:t}=e;if(t){const e=window.storefrontApp&&window.storefrontApp.router;if(e){let r=0;const a=({name:e,params:a})=>{"confirmation"===e&&0===r&&(r++,o.a.fetchOrder(a.id).then(e=>{const r=o.a.getCustomer();let a=`storeId=${t}&mktSaleId=0&platform=ecomplus&totalSpent=`+e.amount.total+"&deliveryTax="+(e.amount.freight||0)+"&transactionId="+(e.number||e._id)+"&email="+r.main_email;if(r.gender&&(a+="&gender="+r.gender.toUpperCase()),r.birth_date){const{day:e,month:t,year:n}=r.birth_date;a+="&birthday="+e.toString().padStart(2,"0")+`-${t.toString().padStart(2,"0")}-${n}`}const{items:i}=e;if(i&&i.length){let e=i[0].sku,t=Object(n.price)(i[0]),r=i[0].quantity,o=encodeURIComponent(i[0].name);for(let a=1;a<i.length;a++)e+="|"+i[a].sku,t+="|"+Object(n.price)(i[a]),r+="|"+i[a].quantity,o+="|"+encodeURIComponent(i[a].name);a+=`&sku=${e}&value=${t}&quantity=${r}&productName=${o}`}if(e.shipping_lines&&e.shipping_lines[0]){const t=e.shipping_lines[0];a+="&deliveryTime="+(t.delivery_time.days||0)+"&zipCode="+t.to.zip}if(e.transactions&&e.transactions[0]){const t=e.transactions[0];switch(a+="&parcels="+(t.installments&&t.installments.number||1),a+="&paymentType=",t.payment_method.code){case"credit_card":a+="05";break;case"banking_billet":a+="08";break;case"debit_card":case"online_debit":case"account_deposit":a+="28";break;case"loyalty_points":a+="24";break;default:a+="14"}if(t.credit_card&&t.credit_card.company)switch(a+="&cardFlag=",t.credit_card.company.toLowerCase()){case"visa":a+=6;break;case"mastercard":a+=5;break;case"american express":case"amex":a+=1;break;case"elo":a+=8;break;case"aura":a+=2;break;case"hipercard":a+=4;break;case"diners club":a+=3;break;default:a+=7}}const c=setInterval(()=>{const e=document.getElementById("confirmation");if(e){e.insertAdjacentHTML("beforeend",`<div> <param id="ebitParam" value="${a}"> <a id="bannerEbit"></a> </div>`);const r=document.createElement("script");r.id="getSelo",r.type="text/javascript",r.src=`https://imgs.ebit.com.br/ebitBR/selo-ebit/js/getSelo.js?${t}&lightbox=true`,document.body.appendChild(r),clearInterval(c)}},200)}).catch(console.error))};e.currentRoute&&a(e.currentRoute),e.afterEach(a)}}else console.error(new Error("Can't show lightbox without `ebitStoreId` option"))}}]).default;
1
+ var widgetEbit=function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/assets/vendor/",r(r.s=2)}([function(e,t){e.exports=void 0},function(e,t){e.exports=void 0},function(e,t,r){"use strict";r.r(t);var n=r(0),a=r(1),o=r.n(a);t.default=(e={})=>{const{ebitStoreId:t}=e;if(t){const e=window.storefrontApp&&window.storefrontApp.router;if(e){let r=0;const a=({name:e,params:a})=>{"confirmation"===e&&0===r&&(r++,o.a.fetchOrder(a.id).then(e=>{const r=o.a.getCustomer();let a=`storeId=${t}&mktSaleId=0&platform=ecomplus&totalSpent=`+e.amount.total+"&deliveryTax="+(e.amount.freight||0)+"&transactionId="+(e.number||e._id)+"&email="+r.main_email;if(r.gender&&(a+="&gender="+r.gender.toUpperCase()),r.birth_date){const{day:e,month:t,year:n}=r.birth_date;e&&t&&n&&(a+="&birthday="+e.toString().padStart(2,"0")+`-${t.toString().padStart(2,"0")}-${n}`)}const{items:i}=e;if(i&&i.length){let e=i[0].sku,t=Object(n.price)(i[0]),r=i[0].quantity,o=encodeURIComponent(i[0].name);for(let a=1;a<i.length;a++)e+="|"+i[a].sku,t+="|"+Object(n.price)(i[a]),r+="|"+i[a].quantity,o+="|"+encodeURIComponent(i[a].name);a+=`&sku=${e}&value=${t}&quantity=${r}&productName=${o}`}if(e.shipping_lines&&e.shipping_lines[0]){const t=e.shipping_lines[0];a+="&deliveryTime="+(t.delivery_time.days||0)+"&zipCode="+t.to.zip}if(e.transactions&&e.transactions[0]){const t=e.transactions[0];switch(a+="&parcels="+(t.installments&&t.installments.number||1),a+="&paymentType=",t.payment_method.code){case"credit_card":a+="05";break;case"banking_billet":a+="08";break;case"debit_card":case"online_debit":case"account_deposit":a+="28";break;case"loyalty_points":a+="24";break;default:a+="14"}if(t.credit_card&&t.credit_card.company)switch(a+="&cardFlag=",t.credit_card.company.toLowerCase()){case"visa":a+=6;break;case"mastercard":a+=5;break;case"american express":case"amex":a+=1;break;case"elo":a+=8;break;case"aura":a+=2;break;case"hipercard":a+=4;break;case"diners club":a+=3;break;default:a+=7}}const c=setInterval(()=>{const e=document.getElementById("confirmation");if(e){e.insertAdjacentHTML("beforeend",`<div> <param id="ebitParam" value="${a}"> <a id="bannerEbit"></a> </div>`);const r=document.createElement("script");r.id="getSelo",r.type="text/javascript",r.src=`https://imgs.ebit.com.br/ebitBR/selo-ebit/js/getSelo.js?${t}&lightbox=true`,document.body.appendChild(r),clearInterval(c)}},200)}).catch(console.error))};e.currentRoute&&a(e.currentRoute),e.afterEach(a)}}else console.error(new Error("Can't show lightbox without `ebitStoreId` option"))}}]).default;
2
2
  //# sourceMappingURL=widget-ebit.var.min.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack://widgetEbit/webpack/bootstrap","webpack://widgetEbit/external {\"commonjs\":\"@ecomplus/utils\",\"commonjs2\":\"@ecomplus/utils\",\"root\":\"ecomUtils\"}","webpack://widgetEbit/external {\"commonjs\":\"@ecomplus/passport-client\",\"commonjs2\":\"@ecomplus/passport-client\",\"root\":\"EcomPassport\"}","webpack://widgetEbit/./src/index.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","undefined","options","ebitStoreId","router","window","storefrontApp","countConfirmation","addConfirmationBanner","params","ecomPassport","fetchOrder","id","then","order","customer","getCustomer","ebitParam","amount","total","freight","number","_id","main_email","gender","toUpperCase","birth_date","day","month","year","toString","padStart","items","length","skus","sku","values","getPrice","quantities","quantity","names","encodeURIComponent","shipping_lines","shippingLine","delivery_time","days","to","zip","transactions","transaction","installments","payment_method","code","credit_card","company","toLowerCase","tryAppendInterval","setInterval","$confirmation","document","getElementById","insertAdjacentHTML","$script","createElement","type","src","body","appendChild","clearInterval","catch","console","error","currentRoute","afterEach","Error"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAi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E,EAAOoE,cACThE,EAAsBJ,EAAOoE,cAE/BpE,EAAOqE,UAAUjE,SAGnB8D,QAAQC,MAAM,IAAIG,MAAM,yD","file":"widget-ebit.var.min.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/assets/vendor/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n","module.exports = undefined;","module.exports = undefined;","import { price as getPrice } from '@ecomplus/utils'\nimport ecomPassport from '@ecomplus/passport-client'\n\nexport default (options = {}) => {\n const { ebitStoreId } = options\n if (ebitStoreId) {\n const router = window.storefrontApp && window.storefrontApp.router\n if (router) {\n let countConfirmation = 0\n const addConfirmationBanner = ({ name, params }) => {\n if (name === 'confirmation' && countConfirmation === 0) {\n countConfirmation++\n ecomPassport.fetchOrder(params.id)\n .then(order => {\n const customer = ecomPassport.getCustomer()\n let ebitParam = `storeId=${ebitStoreId}&mktSaleId=0&platform=ecomplus` +\n `&totalSpent=${order.amount.total}` +\n `&deliveryTax=${(order.amount.freight || 0)}` +\n `&transactionId=${(order.number || order._id)}` +\n `&email=${customer.main_email}`\n\n if (customer.gender) {\n ebitParam += `&gender=${customer.gender.toUpperCase()}`\n }\n if (customer.birth_date) {\n const { day, month, year } = customer.birth_date\n ebitParam += `&birthday=${day.toString().padStart(2, '0')}` +\n `-${month.toString().padStart(2, '0')}-${year}`\n }\n\n const { items } = order\n if (items && items.length) {\n let skus = items[0].sku\n let values = getPrice(items[0])\n let quantities = items[0].quantity\n let names = encodeURIComponent(items[0].name)\n for (let i = 1; i < items.length; i++) {\n skus += `|${items[i].sku}`\n values += `|${getPrice(items[i])}`\n quantities += `|${items[i].quantity}`\n names += `|${encodeURIComponent(items[i].name)}`\n }\n ebitParam += `&sku=${skus}&value=${values}&quantity=${quantities}&productName=${names}`\n }\n\n if (order.shipping_lines && order.shipping_lines[0]) {\n const shippingLine = order.shipping_lines[0]\n ebitParam += `&deliveryTime=${(shippingLine.delivery_time.days || 0)}` +\n `&zipCode=${shippingLine.to.zip}`\n }\n\n if (order.transactions && order.transactions[0]) {\n const transaction = order.transactions[0]\n ebitParam += `&parcels=${((transaction.installments && transaction.installments.number) || 1)}`\n ebitParam += '&paymentType='\n switch (transaction.payment_method.code) {\n case 'credit_card':\n ebitParam += '05'\n break\n case 'banking_billet':\n ebitParam += '08'\n break\n case 'debit_card':\n case 'online_debit':\n case 'account_deposit':\n ebitParam += '28'\n break\n case 'loyalty_points':\n ebitParam += '24'\n break\n default:\n ebitParam += '14'\n }\n\n if (transaction.credit_card && transaction.credit_card.company) {\n ebitParam += '&cardFlag='\n switch (transaction.credit_card.company.toLowerCase()) {\n case 'visa':\n ebitParam += 6\n break\n case 'mastercard':\n ebitParam += 5\n break\n case 'american express':\n case 'amex':\n ebitParam += 1\n break\n case 'elo':\n ebitParam += 8\n break\n case 'aura':\n ebitParam += 2\n break\n case 'hipercard':\n ebitParam += 4\n break\n case 'diners club':\n ebitParam += 3\n break\n default:\n ebitParam += 7\n }\n }\n }\n\n const appendBanner = () => {\n const $confirmation = document.getElementById('confirmation')\n if ($confirmation) {\n $confirmation.insertAdjacentHTML(\n 'beforeend',\n `<div> <param id=\"ebitParam\" value=\"${ebitParam}\"> <a id=\"bannerEbit\"></a> </div>`\n )\n const $script = document.createElement('script')\n $script.id = 'getSelo'\n $script.type = 'text/javascript'\n $script.src = 'https://imgs.ebit.com.br/ebitBR/selo-ebit/js/getSelo.js' +\n `?${ebitStoreId}&lightbox=true`\n document.body.appendChild($script)\n clearInterval(tryAppendInterval)\n }\n }\n const tryAppendInterval = setInterval(appendBanner, 200)\n })\n .catch(console.error)\n }\n }\n\n if (router.currentRoute) {\n addConfirmationBanner(router.currentRoute)\n }\n router.afterEach(addConfirmationBanner)\n }\n } else {\n console.error(new Error('Can\\'t show lightbox without `ebitStoreId` option'))\n }\n}\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack://widgetEbit/webpack/bootstrap","webpack://widgetEbit/external {\"commonjs\":\"@ecomplus/utils\",\"commonjs2\":\"@ecomplus/utils\",\"root\":\"ecomUtils\"}","webpack://widgetEbit/external {\"commonjs\":\"@ecomplus/passport-client\",\"commonjs2\":\"@ecomplus/passport-client\",\"root\":\"EcomPassport\"}","webpack://widgetEbit/./src/index.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","undefined","options","ebitStoreId","router","window","storefrontApp","countConfirmation","addConfirmationBanner","params","ecomPassport","fetchOrder","id","then","order","customer","getCustomer","ebitParam","amount","total","freight","number","_id","main_email","gender","toUpperCase","birth_date","day","month","year","toString","padStart","items","length","skus","sku","values","getPrice","quantities","quantity","names","encodeURIComponent","shipping_lines","shippingLine","delivery_time","days","to","zip","transactions","transaction","installments","payment_method","code","credit_card","company","toLowerCase","tryAppendInterval","setInterval","appendBanner","$confirmation","document","getElementById","insertAdjacentHTML","$script","createElement","type","src","body","appendChild","clearInterval","catch","console","error","currentRoute","afterEach","Error"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAA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Ac,kBAAiB0B,EAAaC,cAAcC,MAAQ,GAC/D,YAAWF,EAAaG,GAAGC,IAGhC,GAAIjC,EAAMkC,cAAgBlC,EAAMkC,aAAa,GAAI,CAC/C,MAAMC,EAAcnC,EAAMkC,aAAa,GAGvC,OAFA/B,GAAc,aAAagC,EAAYC,cAAgBD,EAAYC,aAAa7B,QAAW,GAC3FJ,GAAa,gBACLgC,EAAYE,eAAeC,MACjC,IAAK,cACHnC,GAAa,KACb,MACF,IAAK,iBACHA,GAAa,KACb,MACF,IAAK,aACL,IAAK,eACL,IAAK,kBACHA,GAAa,KACb,MACF,IAAK,iBACHA,GAAa,KACb,MACF,QACEA,GAAa,KAGjB,GAAIgC,EAAYI,aAAeJ,EAAYI,YAAYC,QAErD,OADArC,GAAa,aACLgC,EAAYI,YAAYC,QAAQC,eACtC,IAAK,OACHtC,GAAa,EACb,MACF,IAAK,aACHA,GAAa,EACb,MACF,IAAK,mBACL,IAAK,OACHA,GAAa,EACb,MACF,IAAK,MACHA,GAAa,EACb,MACF,IAAK,OACHA,GAAa,EACb,MACF,IAAK,YACHA,GAAa,EACb,MACF,IAAK,cACHA,GAAa,EACb,MACF,QACEA,GAAa,GAKrB,MAgBMuC,EAAoBC,YAhBLC,KACnB,MAAMC,EAAgBC,SAASC,eAAe,gBAC9C,GAAIF,EAAe,CACjBA,EAAcG,mBACZ,YACC,sCAAqC7C,sCAExC,MAAM8C,EAAUH,SAASI,cAAc,UACvCD,EAAQnD,GAAK,UACbmD,EAAQE,KAAO,kBACfF,EAAQG,IACL,2DAAG/D,kBACNyD,SAASO,KAAKC,YAAYL,GAC1BM,cAAcb,KAGkC,OAErDc,MAAMC,QAAQC,SAIjBpE,EAAOqE,cACTjE,EAAsBJ,EAAOqE,cAE/BrE,EAAOsE,UAAUlE,SAGnB+D,QAAQC,MAAM,IAAIG,MAAM,yD","file":"widget-ebit.var.min.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/assets/vendor/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n","module.exports = undefined;","module.exports = undefined;","import { price as getPrice } from '@ecomplus/utils'\nimport ecomPassport from '@ecomplus/passport-client'\n\nexport default (options = {}) => {\n const { ebitStoreId } = options\n if (ebitStoreId) {\n const router = window.storefrontApp && window.storefrontApp.router\n if (router) {\n let countConfirmation = 0\n const addConfirmationBanner = ({ name, params }) => {\n if (name === 'confirmation' && countConfirmation === 0) {\n countConfirmation++\n ecomPassport.fetchOrder(params.id)\n .then(order => {\n const customer = ecomPassport.getCustomer()\n let ebitParam = `storeId=${ebitStoreId}&mktSaleId=0&platform=ecomplus` +\n `&totalSpent=${order.amount.total}` +\n `&deliveryTax=${(order.amount.freight || 0)}` +\n `&transactionId=${(order.number || order._id)}` +\n `&email=${customer.main_email}`\n\n if (customer.gender) {\n ebitParam += `&gender=${customer.gender.toUpperCase()}`\n }\n if (customer.birth_date) {\n const { day, month, year } = customer.birth_date\n if (day && month && year) {\n ebitParam += `&birthday=${day.toString().padStart(2, '0')}` +\n `-${month.toString().padStart(2, '0')}-${year}`\n }\n }\n\n const { items } = order\n if (items && items.length) {\n let skus = items[0].sku\n let values = getPrice(items[0])\n let quantities = items[0].quantity\n let names = encodeURIComponent(items[0].name)\n for (let i = 1; i < items.length; i++) {\n skus += `|${items[i].sku}`\n values += `|${getPrice(items[i])}`\n quantities += `|${items[i].quantity}`\n names += `|${encodeURIComponent(items[i].name)}`\n }\n ebitParam += `&sku=${skus}&value=${values}&quantity=${quantities}&productName=${names}`\n }\n\n if (order.shipping_lines && order.shipping_lines[0]) {\n const shippingLine = order.shipping_lines[0]\n ebitParam += `&deliveryTime=${(shippingLine.delivery_time.days || 0)}` +\n `&zipCode=${shippingLine.to.zip}`\n }\n\n if (order.transactions && order.transactions[0]) {\n const transaction = order.transactions[0]\n ebitParam += `&parcels=${((transaction.installments && transaction.installments.number) || 1)}`\n ebitParam += '&paymentType='\n switch (transaction.payment_method.code) {\n case 'credit_card':\n ebitParam += '05'\n break\n case 'banking_billet':\n ebitParam += '08'\n break\n case 'debit_card':\n case 'online_debit':\n case 'account_deposit':\n ebitParam += '28'\n break\n case 'loyalty_points':\n ebitParam += '24'\n break\n default:\n ebitParam += '14'\n }\n\n if (transaction.credit_card && transaction.credit_card.company) {\n ebitParam += '&cardFlag='\n switch (transaction.credit_card.company.toLowerCase()) {\n case 'visa':\n ebitParam += 6\n break\n case 'mastercard':\n ebitParam += 5\n break\n case 'american express':\n case 'amex':\n ebitParam += 1\n break\n case 'elo':\n ebitParam += 8\n break\n case 'aura':\n ebitParam += 2\n break\n case 'hipercard':\n ebitParam += 4\n break\n case 'diners club':\n ebitParam += 3\n break\n default:\n ebitParam += 7\n }\n }\n }\n\n const appendBanner = () => {\n const $confirmation = document.getElementById('confirmation')\n if ($confirmation) {\n $confirmation.insertAdjacentHTML(\n 'beforeend',\n `<div> <param id=\"ebitParam\" value=\"${ebitParam}\"> <a id=\"bannerEbit\"></a> </div>`\n )\n const $script = document.createElement('script')\n $script.id = 'getSelo'\n $script.type = 'text/javascript'\n $script.src = 'https://imgs.ebit.com.br/ebitBR/selo-ebit/js/getSelo.js' +\n `?${ebitStoreId}&lightbox=true`\n document.body.appendChild($script)\n clearInterval(tryAppendInterval)\n }\n }\n const tryAppendInterval = setInterval(appendBanner, 200)\n })\n .catch(console.error)\n }\n }\n\n if (router.currentRoute) {\n addConfirmationBanner(router.currentRoute)\n }\n router.afterEach(addConfirmationBanner)\n }\n } else {\n console.error(new Error('Can\\'t show lightbox without `ebitStoreId` option'))\n }\n}\n"],"sourceRoot":""}
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@ecomplus/utils"),require("@ecomplus/passport-client")):"function"==typeof define&&define.amd?define([,],t):"object"==typeof exports?exports.widgetEbit=t(require("@ecomplus/utils"),require("@ecomplus/passport-client")):e.widgetEbit=t(e.ecomUtils,e.EcomPassport)}(window,(function(e,t){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/assets/vendor/",r(r.s=2)}([function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t,r){"use strict";r.r(t);var n=r(0),o=r(1),a=r.n(o);t.default=(e={})=>{const{ebitStoreId:t}=e;if(t){const e=window.storefrontApp&&window.storefrontApp.router;if(e){let r=0;const o=({name:e,params:o})=>{"confirmation"===e&&0===r&&(r++,a.a.fetchOrder(o.id).then(e=>{const r=a.a.getCustomer();let o=`storeId=${t}&mktSaleId=0&platform=ecomplus&totalSpent=`+e.amount.total+"&deliveryTax="+(e.amount.freight||0)+"&transactionId="+(e.number||e._id)+"&email="+r.main_email;if(r.gender&&(o+="&gender="+r.gender.toUpperCase()),r.birth_date){const{day:e,month:t,year:n}=r.birth_date;o+="&birthday="+e.toString().padStart(2,"0")+`-${t.toString().padStart(2,"0")}-${n}`}const{items:i}=e;if(i&&i.length){let e=i[0].sku,t=Object(n.price)(i[0]),r=i[0].quantity,a=encodeURIComponent(i[0].name);for(let o=1;o<i.length;o++)e+="|"+i[o].sku,t+="|"+Object(n.price)(i[o]),r+="|"+i[o].quantity,a+="|"+encodeURIComponent(i[o].name);o+=`&sku=${e}&value=${t}&quantity=${r}&productName=${a}`}if(e.shipping_lines&&e.shipping_lines[0]){const t=e.shipping_lines[0];o+="&deliveryTime="+(t.delivery_time.days||0)+"&zipCode="+t.to.zip}if(e.transactions&&e.transactions[0]){const t=e.transactions[0];switch(o+="&parcels="+(t.installments&&t.installments.number||1),o+="&paymentType=",t.payment_method.code){case"credit_card":o+="05";break;case"banking_billet":o+="08";break;case"debit_card":case"online_debit":case"account_deposit":o+="28";break;case"loyalty_points":o+="24";break;default:o+="14"}if(t.credit_card&&t.credit_card.company)switch(o+="&cardFlag=",t.credit_card.company.toLowerCase()){case"visa":o+=6;break;case"mastercard":o+=5;break;case"american express":case"amex":o+=1;break;case"elo":o+=8;break;case"aura":o+=2;break;case"hipercard":o+=4;break;case"diners club":o+=3;break;default:o+=7}}const c=setInterval(()=>{const e=document.getElementById("confirmation");if(e){e.insertAdjacentHTML("beforeend",`<div> <param id="ebitParam" value="${o}"> <a id="bannerEbit"></a> </div>`);const r=document.createElement("script");r.id="getSelo",r.type="text/javascript",r.src=`https://imgs.ebit.com.br/ebitBR/selo-ebit/js/getSelo.js?${t}&lightbox=true`,document.body.appendChild(r),clearInterval(c)}},200)}).catch(console.error))};e.currentRoute&&o(e.currentRoute),e.afterEach(o)}}else console.error(new Error("Can't show lightbox without `ebitStoreId` option"))}}]).default}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@ecomplus/utils"),require("@ecomplus/passport-client")):"function"==typeof define&&define.amd?define([,],t):"object"==typeof exports?exports.widgetEbit=t(require("@ecomplus/utils"),require("@ecomplus/passport-client")):e.widgetEbit=t(e.ecomUtils,e.EcomPassport)}(window,(function(e,t){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/assets/vendor/",r(r.s=2)}([function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t,r){"use strict";r.r(t);var n=r(0),o=r(1),a=r.n(o);t.default=(e={})=>{const{ebitStoreId:t}=e;if(t){const e=window.storefrontApp&&window.storefrontApp.router;if(e){let r=0;const o=({name:e,params:o})=>{"confirmation"===e&&0===r&&(r++,a.a.fetchOrder(o.id).then(e=>{const r=a.a.getCustomer();let o=`storeId=${t}&mktSaleId=0&platform=ecomplus&totalSpent=`+e.amount.total+"&deliveryTax="+(e.amount.freight||0)+"&transactionId="+(e.number||e._id)+"&email="+r.main_email;if(r.gender&&(o+="&gender="+r.gender.toUpperCase()),r.birth_date){const{day:e,month:t,year:n}=r.birth_date;e&&t&&n&&(o+="&birthday="+e.toString().padStart(2,"0")+`-${t.toString().padStart(2,"0")}-${n}`)}const{items:i}=e;if(i&&i.length){let e=i[0].sku,t=Object(n.price)(i[0]),r=i[0].quantity,a=encodeURIComponent(i[0].name);for(let o=1;o<i.length;o++)e+="|"+i[o].sku,t+="|"+Object(n.price)(i[o]),r+="|"+i[o].quantity,a+="|"+encodeURIComponent(i[o].name);o+=`&sku=${e}&value=${t}&quantity=${r}&productName=${a}`}if(e.shipping_lines&&e.shipping_lines[0]){const t=e.shipping_lines[0];o+="&deliveryTime="+(t.delivery_time.days||0)+"&zipCode="+t.to.zip}if(e.transactions&&e.transactions[0]){const t=e.transactions[0];switch(o+="&parcels="+(t.installments&&t.installments.number||1),o+="&paymentType=",t.payment_method.code){case"credit_card":o+="05";break;case"banking_billet":o+="08";break;case"debit_card":case"online_debit":case"account_deposit":o+="28";break;case"loyalty_points":o+="24";break;default:o+="14"}if(t.credit_card&&t.credit_card.company)switch(o+="&cardFlag=",t.credit_card.company.toLowerCase()){case"visa":o+=6;break;case"mastercard":o+=5;break;case"american express":case"amex":o+=1;break;case"elo":o+=8;break;case"aura":o+=2;break;case"hipercard":o+=4;break;case"diners club":o+=3;break;default:o+=7}}const c=setInterval(()=>{const e=document.getElementById("confirmation");if(e){e.insertAdjacentHTML("beforeend",`<div> <param id="ebitParam" value="${o}"> <a id="bannerEbit"></a> </div>`);const r=document.createElement("script");r.id="getSelo",r.type="text/javascript",r.src=`https://imgs.ebit.com.br/ebitBR/selo-ebit/js/getSelo.js?${t}&lightbox=true`,document.body.appendChild(r),clearInterval(c)}},200)}).catch(console.error))};e.currentRoute&&o(e.currentRoute),e.afterEach(o)}}else console.error(new Error("Can't show lightbox without `ebitStoreId` option"))}}]).default}));
2
2
  //# sourceMappingURL=widget-ebit.min.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack://widgetEbit/webpack/universalModuleDefinition","webpack://widgetEbit/webpack/bootstrap","webpack://widgetEbit/external {\"commonjs\":\"@ecomplus/utils\",\"commonjs2\":\"@ecomplus/utils\",\"root\":\"ecomUtils\"}","webpack://widgetEbit/external {\"commonjs\":\"@ecomplus/passport-client\",\"commonjs2\":\"@ecomplus/passport-client\",\"root\":\"EcomPassport\"}","webpack://widgetEbit/./src/index.js"],"names":["root","factory","exports","module","require","define","amd","window","__WEBPACK_EXTERNAL_MODULE__0__","__WEBPACK_EXTERNAL_MODULE__1__","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","options","ebitStoreId","router","storefrontApp","countConfirmation","addConfirmationBanner","params","ecomPassport","fetchOrder","id","then","order","customer","getCustomer","ebitParam","amount","total","freight","number","_id","main_email","gender","toUpperCase","birth_date","day","month","year","toString","padStart","items","length","skus","sku","values","getPrice","quantities","quantity","names","encodeURIComponent","shipping_lines","shippingLine","delivery_time","days","to","zip","transactions","transaction","installments","payment_method","code","credit_card","company","toLowerCase","tryAppendInterval","setInterval","$confirmation","document","getElementById","insertAdjacentHTML","$script","createElement","type","src","body","appendChild","clearInterval","catch","console","error","currentRoute","afterEach","Error"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,mBAAoBA,QAAQ,8BACpC,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,CAAC,GAAKJ,GACa,iBAAZC,QACdA,QAAoB,WAAID,EAAQG,QAAQ,mBAAoBA,QAAQ,8BAEpEJ,EAAiB,WAAIC,EAAQD,EAAgB,UAAGA,EAAmB,cARrE,CASGO,QAAQ,SAASC,EAAgCC,GACpD,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUV,QAGnC,IAAIC,EAASO,EAAiBE,GAAY,CACzCC,EAAGD,EACHE,GAAG,EACHZ,QAAS,IAUV,OANAa,EAAQH,GAAUI,KAAKb,EAAOD,QAASC,EAAQA,EAAOD,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7B,EAAM4B,eAAe,GAC1CzB,GAAc,kBAAiB0B,EAAaC,cAAcC,MAAQ,GAC/D,YAAWF,EAAaG,GAAGC,IAGhC,GAAIjC,EAAMkC,cAAgBlC,EAAMkC,aAAa,GAAI,CAC/C,MAAMC,EAAcnC,EAAMkC,aAAa,GAGvC,OAFA/B,GAAc,aAAagC,EAAYC,cAAgBD,EAAYC,aAAa7B,QAAW,GAC3FJ,GAAa,gBACLgC,EAAYE,eAAeC,MACjC,IAAK,cACHnC,GAAa,KACb,MACF,IAAK,iBACHA,GAAa,KACb,MACF,IAAK,aACL,IAAK,eACL,IAAK,kBACHA,GAAa,KACb,MACF,IAAK,iBACHA,GAAa,KACb,MACF,QACEA,GAAa,KAGjB,GAAIgC,EAAYI,aAAeJ,EAAYI,YAAYC,QAErD,OADArC,GAAa,aACLgC,EAAYI,YAAYC,QAAQC,eACtC,IAAK,OACHtC,GAAa,EACb,MACF,IAAK,aACHA,GAAa,EACb,MACF,IAAK,mBACL,IAAK,OACHA,GAAa,EACb,MACF,IAAK,MACHA,GAAa,EACb,MACF,IAAK,OACHA,GAAa,EACb,MACF,IAAK,YACHA,GAAa,EACb,MACF,IAAK,cACHA,GAAa,EACb,MACF,QACEA,GAAa,GAKrB,MAgBMuC,EAAoBC,YAhBL,KACnB,MAAMC,EAAgBC,SAASC,eAAe,gBAC9C,GAAIF,EAAe,CACjBA,EAAcG,mBACZ,YACC,sCAAqC5C,sCAExC,MAAM6C,EAAUH,SAASI,cAAc,UACvCD,EAAQlD,GAAK,UACbkD,EAAQE,KAAO,kBACfF,EAAQG,IACL,2DAAG7D,kBACNuD,SAASO,KAAKC,YAAYL,GAC1BM,cAAcZ,KAGkC,OAErDa,MAAMC,QAAQC,SAIjBlE,EAAOmE,cACThE,EAAsBH,EAAOmE,cAE/BnE,EAAOoE,UAAUjE,SAGnB8D,QAAQC,MAAM,IAAIG,MAAM,yD","file":"widget-ebit.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"@ecomplus/utils\"), require(\"@ecomplus/passport-client\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([, ], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"widgetEbit\"] = factory(require(\"@ecomplus/utils\"), require(\"@ecomplus/passport-client\"));\n\telse\n\t\troot[\"widgetEbit\"] = factory(root[\"ecomUtils\"], root[\"EcomPassport\"]);\n})(window, function(__WEBPACK_EXTERNAL_MODULE__0__, __WEBPACK_EXTERNAL_MODULE__1__) {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/assets/vendor/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n","module.exports = __WEBPACK_EXTERNAL_MODULE__0__;","module.exports = __WEBPACK_EXTERNAL_MODULE__1__;","import { price as getPrice } from '@ecomplus/utils'\nimport ecomPassport from '@ecomplus/passport-client'\n\nexport default (options = {}) => {\n const { ebitStoreId } = options\n if (ebitStoreId) {\n const router = window.storefrontApp && window.storefrontApp.router\n if (router) {\n let countConfirmation = 0\n const addConfirmationBanner = ({ name, params }) => {\n if (name === 'confirmation' && countConfirmation === 0) {\n countConfirmation++\n ecomPassport.fetchOrder(params.id)\n .then(order => {\n const customer = ecomPassport.getCustomer()\n let ebitParam = `storeId=${ebitStoreId}&mktSaleId=0&platform=ecomplus` +\n `&totalSpent=${order.amount.total}` +\n `&deliveryTax=${(order.amount.freight || 0)}` +\n `&transactionId=${(order.number || order._id)}` +\n `&email=${customer.main_email}`\n\n if (customer.gender) {\n ebitParam += `&gender=${customer.gender.toUpperCase()}`\n }\n if (customer.birth_date) {\n const { day, month, year } = customer.birth_date\n ebitParam += `&birthday=${day.toString().padStart(2, '0')}` +\n `-${month.toString().padStart(2, '0')}-${year}`\n }\n\n const { items } = order\n if (items && items.length) {\n let skus = items[0].sku\n let values = getPrice(items[0])\n let quantities = items[0].quantity\n let names = encodeURIComponent(items[0].name)\n for (let i = 1; i < items.length; i++) {\n skus += `|${items[i].sku}`\n values += `|${getPrice(items[i])}`\n quantities += `|${items[i].quantity}`\n names += `|${encodeURIComponent(items[i].name)}`\n }\n ebitParam += `&sku=${skus}&value=${values}&quantity=${quantities}&productName=${names}`\n }\n\n if (order.shipping_lines && order.shipping_lines[0]) {\n const shippingLine = order.shipping_lines[0]\n ebitParam += `&deliveryTime=${(shippingLine.delivery_time.days || 0)}` +\n `&zipCode=${shippingLine.to.zip}`\n }\n\n if (order.transactions && order.transactions[0]) {\n const transaction = order.transactions[0]\n ebitParam += `&parcels=${((transaction.installments && transaction.installments.number) || 1)}`\n ebitParam += '&paymentType='\n switch (transaction.payment_method.code) {\n case 'credit_card':\n ebitParam += '05'\n break\n case 'banking_billet':\n ebitParam += '08'\n break\n case 'debit_card':\n case 'online_debit':\n case 'account_deposit':\n ebitParam += '28'\n break\n case 'loyalty_points':\n ebitParam += '24'\n break\n default:\n ebitParam += '14'\n }\n\n if (transaction.credit_card && transaction.credit_card.company) {\n ebitParam += '&cardFlag='\n switch (transaction.credit_card.company.toLowerCase()) {\n case 'visa':\n ebitParam += 6\n break\n case 'mastercard':\n ebitParam += 5\n break\n case 'american express':\n case 'amex':\n ebitParam += 1\n break\n case 'elo':\n ebitParam += 8\n break\n case 'aura':\n ebitParam += 2\n break\n case 'hipercard':\n ebitParam += 4\n break\n case 'diners club':\n ebitParam += 3\n break\n default:\n ebitParam += 7\n }\n }\n }\n\n const appendBanner = () => {\n const $confirmation = document.getElementById('confirmation')\n if ($confirmation) {\n $confirmation.insertAdjacentHTML(\n 'beforeend',\n `<div> <param id=\"ebitParam\" value=\"${ebitParam}\"> <a id=\"bannerEbit\"></a> </div>`\n )\n const $script = document.createElement('script')\n $script.id = 'getSelo'\n $script.type = 'text/javascript'\n $script.src = 'https://imgs.ebit.com.br/ebitBR/selo-ebit/js/getSelo.js' +\n `?${ebitStoreId}&lightbox=true`\n document.body.appendChild($script)\n clearInterval(tryAppendInterval)\n }\n }\n const tryAppendInterval = setInterval(appendBanner, 200)\n })\n .catch(console.error)\n }\n }\n\n if (router.currentRoute) {\n addConfirmationBanner(router.currentRoute)\n }\n router.afterEach(addConfirmationBanner)\n }\n } else {\n console.error(new Error('Can\\'t show lightbox without `ebitStoreId` option'))\n }\n}\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack://widgetEbit/webpack/universalModuleDefinition","webpack://widgetEbit/webpack/bootstrap","webpack://widgetEbit/external {\"commonjs\":\"@ecomplus/utils\",\"commonjs2\":\"@ecomplus/utils\",\"root\":\"ecomUtils\"}","webpack://widgetEbit/external {\"commonjs\":\"@ecomplus/passport-client\",\"commonjs2\":\"@ecomplus/passport-client\",\"root\":\"EcomPassport\"}","webpack://widgetEbit/./src/index.js"],"names":["root","factory","exports","module","require","define","amd","window","__WEBPACK_EXTERNAL_MODULE__0__","__WEBPACK_EXTERNAL_MODULE__1__","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","options","ebitStoreId","router","storefrontApp","countConfirmation","addConfirmationBanner","params","ecomPassport","fetchOrder","id","then","order","customer","getCustomer","ebitParam","amount","total","freight","number","_id","main_email","gender","toUpperCase","birth_date","day","month","year","toString","padStart","items","length","skus","sku","values","getPrice","quantities","quantity","names","encodeURIComponent","shipping_lines","shippingLine","delivery_time","days","to","zip","transactions","transaction","installments","payment_method","code","credit_card","company","toLowerCase","tryAppendInterval","setInterval","appendBanner","$confirmation","document","getElementById","insertAdjacentHTML","$script","createElement","type","src","body","appendChild","clearInterval","catch","console","error","currentRoute","afterEach","Error"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,mBAAoBA,QAAQ,8BACpC,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,CAAC,GAAKJ,GACa,iBAAZC,QACdA,QAAoB,WAAID,EAAQG,QAAQ,mBAAoBA,QAAQ,8BAEpEJ,EAAiB,WAAIC,EAAQD,EAAgB,UAAGA,EAAmB,cARrE,CASGO,QAAQ,SAASC,EAAgCC,GACpD,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUV,QAGnC,IAAIC,EAASO,EAAiBE,GAAY,CACzCC,EAAGD,EACHE,GAAG,EACHZ,QAAS,IAUV,OANAa,EAAQH,GAAUI,KAAKb,EAAOD,QAASC,EAAQA,EAAOD,QAASS,GAG/DR,EAAOW,GAAI,EAGJX,EAAOD,QA0Df,OArDAS,EAAoBM,EAAIF,EAGxBJ,EAAoBO,EAAIR,EAGxBC,EAAoBQ,EAAI,SAASjB,EAASkB,EAAMC,GAC3CV,EAAoBW,EAAEpB,EAASkB,IAClCG,OAAOC,eAAetB,EAASkB,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEV,EAAoBgB,EAAI,SAASzB,GACX,oBAAX0B,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAetB,EAAS0B,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAetB,EAAS,aAAc,CAAE4B,OAAO,KAQvDnB,EAAoBoB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQnB,EAAoBmB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GA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ACtC,IAAK,OACHtC,GAAa,EACb,MACF,IAAK,aACHA,GAAa,EACb,MACF,IAAK,mBACL,IAAK,OACHA,GAAa,EACb,MACF,IAAK,MACHA,GAAa,EACb,MACF,IAAK,OACHA,GAAa,EACb,MACF,IAAK,YACHA,GAAa,EACb,MACF,IAAK,cACHA,GAAa,EACb,MACF,QACEA,GAAa,GAKrB,MAgBMuC,EAAoBC,YAhBLC,KACnB,MAAMC,EAAgBC,SAASC,eAAe,gBAC9C,GAAIF,EAAe,CACjBA,EAAcG,mBACZ,YACC,sCAAqC7C,sCAExC,MAAM8C,EAAUH,SAASI,cAAc,UACvCD,EAAQnD,GAAK,UACbmD,EAAQE,KAAO,kBACfF,EAAQG,IACL,2DAAG9D,kBACNwD,SAASO,KAAKC,YAAYL,GAC1BM,cAAcb,KAGkC,OAErDc,MAAMC,QAAQC,SAIjBnE,EAAOoE,cACTjE,EAAsBH,EAAOoE,cAE/BpE,EAAOqE,UAAUlE,SAGnB+D,QAAQC,MAAM,IAAIG,MAAM,yD","file":"widget-ebit.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"@ecomplus/utils\"), require(\"@ecomplus/passport-client\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([, ], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"widgetEbit\"] = factory(require(\"@ecomplus/utils\"), require(\"@ecomplus/passport-client\"));\n\telse\n\t\troot[\"widgetEbit\"] = factory(root[\"ecomUtils\"], root[\"EcomPassport\"]);\n})(window, function(__WEBPACK_EXTERNAL_MODULE__0__, __WEBPACK_EXTERNAL_MODULE__1__) {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/assets/vendor/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n","module.exports = __WEBPACK_EXTERNAL_MODULE__0__;","module.exports = __WEBPACK_EXTERNAL_MODULE__1__;","import { price as getPrice } from '@ecomplus/utils'\nimport ecomPassport from '@ecomplus/passport-client'\n\nexport default (options = {}) => {\n const { ebitStoreId } = options\n if (ebitStoreId) {\n const router = window.storefrontApp && window.storefrontApp.router\n if (router) {\n let countConfirmation = 0\n const addConfirmationBanner = ({ name, params }) => {\n if (name === 'confirmation' && countConfirmation === 0) {\n countConfirmation++\n ecomPassport.fetchOrder(params.id)\n .then(order => {\n const customer = ecomPassport.getCustomer()\n let ebitParam = `storeId=${ebitStoreId}&mktSaleId=0&platform=ecomplus` +\n `&totalSpent=${order.amount.total}` +\n `&deliveryTax=${(order.amount.freight || 0)}` +\n `&transactionId=${(order.number || order._id)}` +\n `&email=${customer.main_email}`\n\n if (customer.gender) {\n ebitParam += `&gender=${customer.gender.toUpperCase()}`\n }\n if (customer.birth_date) {\n const { day, month, year } = customer.birth_date\n if (day && month && year) {\n ebitParam += `&birthday=${day.toString().padStart(2, '0')}` +\n `-${month.toString().padStart(2, '0')}-${year}`\n }\n }\n\n const { items } = order\n if (items && items.length) {\n let skus = items[0].sku\n let values = getPrice(items[0])\n let quantities = items[0].quantity\n let names = encodeURIComponent(items[0].name)\n for (let i = 1; i < items.length; i++) {\n skus += `|${items[i].sku}`\n values += `|${getPrice(items[i])}`\n quantities += `|${items[i].quantity}`\n names += `|${encodeURIComponent(items[i].name)}`\n }\n ebitParam += `&sku=${skus}&value=${values}&quantity=${quantities}&productName=${names}`\n }\n\n if (order.shipping_lines && order.shipping_lines[0]) {\n const shippingLine = order.shipping_lines[0]\n ebitParam += `&deliveryTime=${(shippingLine.delivery_time.days || 0)}` +\n `&zipCode=${shippingLine.to.zip}`\n }\n\n if (order.transactions && order.transactions[0]) {\n const transaction = order.transactions[0]\n ebitParam += `&parcels=${((transaction.installments && transaction.installments.number) || 1)}`\n ebitParam += '&paymentType='\n switch (transaction.payment_method.code) {\n case 'credit_card':\n ebitParam += '05'\n break\n case 'banking_billet':\n ebitParam += '08'\n break\n case 'debit_card':\n case 'online_debit':\n case 'account_deposit':\n ebitParam += '28'\n break\n case 'loyalty_points':\n ebitParam += '24'\n break\n default:\n ebitParam += '14'\n }\n\n if (transaction.credit_card && transaction.credit_card.company) {\n ebitParam += '&cardFlag='\n switch (transaction.credit_card.company.toLowerCase()) {\n case 'visa':\n ebitParam += 6\n break\n case 'mastercard':\n ebitParam += 5\n break\n case 'american express':\n case 'amex':\n ebitParam += 1\n break\n case 'elo':\n ebitParam += 8\n break\n case 'aura':\n ebitParam += 2\n break\n case 'hipercard':\n ebitParam += 4\n break\n case 'diners club':\n ebitParam += 3\n break\n default:\n ebitParam += 7\n }\n }\n }\n\n const appendBanner = () => {\n const $confirmation = document.getElementById('confirmation')\n if ($confirmation) {\n $confirmation.insertAdjacentHTML(\n 'beforeend',\n `<div> <param id=\"ebitParam\" value=\"${ebitParam}\"> <a id=\"bannerEbit\"></a> </div>`\n )\n const $script = document.createElement('script')\n $script.id = 'getSelo'\n $script.type = 'text/javascript'\n $script.src = 'https://imgs.ebit.com.br/ebitBR/selo-ebit/js/getSelo.js' +\n `?${ebitStoreId}&lightbox=true`\n document.body.appendChild($script)\n clearInterval(tryAppendInterval)\n }\n }\n const tryAppendInterval = setInterval(appendBanner, 200)\n })\n .catch(console.error)\n }\n }\n\n if (router.currentRoute) {\n addConfirmationBanner(router.currentRoute)\n }\n router.afterEach(addConfirmationBanner)\n }\n } else {\n console.error(new Error('Can\\'t show lightbox without `ebitStoreId` option'))\n }\n}\n"],"sourceRoot":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecomplus/widget-ebit",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Storefront plugin for Ebit",
5
5
  "main": "dist/widget-ebit.min.js",
6
6
  "module": "src/index.js",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "homepage": "https://github.com/ecomplus/storefront/tree/master/@ecomplus/widget-ebit#readme",
32
32
  "peerDependencies": {
33
- "@ecomplus/passport-client": "^1.1.1",
33
+ "@ecomplus/passport-client": "^1.1.2",
34
34
  "@ecomplus/utils": "^1.4.1",
35
35
  "core-js": "3.x"
36
36
  },
package/src/index.js CHANGED
@@ -24,8 +24,10 @@ export default (options = {}) => {
24
24
  }
25
25
  if (customer.birth_date) {
26
26
  const { day, month, year } = customer.birth_date
27
- ebitParam += `&birthday=${day.toString().padStart(2, '0')}` +
28
- `-${month.toString().padStart(2, '0')}-${year}`
27
+ if (day && month && year) {
28
+ ebitParam += `&birthday=${day.toString().padStart(2, '0')}` +
29
+ `-${month.toString().padStart(2, '0')}-${year}`
30
+ }
29
31
  }
30
32
 
31
33
  const { items } = order