@ecomplus/widget-ebit 1.1.13 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +19 -68
- package/cms.config.js +1 -0
- package/dist/public/widget-ebit.var.min.js.map +1 -1
- package/dist/widget-ebit.min.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -3,139 +3,90 @@
|
|
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.1
|
7
|
-
|
6
|
+
## [1.2.1](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.2.0...@ecomplus/widget-ebit@1.2.1) (2023-01-09)
|
8
7
|
|
9
8
|
### Bug Fixes
|
10
9
|
|
11
|
-
|
12
|
-
* **deps:** update @ecomplus/passport-client to v1.1.1 ([b713159](https://github.com/ecomplus/storefront/commit/b7131596a14556ca53c4608a234ace3b12b39943))
|
13
|
-
|
14
|
-
|
10
|
+
- **deps:** bump @ecomplus/passport-client and @ecomplus/shopping-cart ([3b60f09](https://github.com/ecomplus/storefront/commit/3b60f098f3fef0621fd045afea47ded663c69967))
|
15
11
|
|
12
|
+
# [1.2.0](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.13...@ecomplus/widget-ebit@1.2.0) (2022-02-06)
|
16
13
|
|
14
|
+
### Features
|
17
15
|
|
18
|
-
|
19
|
-
|
20
|
-
**Note:** Version bump only for package @ecomplus/widget-ebit
|
16
|
+
- **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)
|
21
17
|
|
18
|
+
## [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
19
|
|
20
|
+
### Bug Fixes
|
23
21
|
|
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
24
|
|
25
|
+
## [1.1.12](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.11...@ecomplus/widget-ebit@1.1.12) (2021-07-24)
|
25
26
|
|
27
|
+
**Note:** Version bump only for package @ecomplus/widget-ebit
|
26
28
|
|
27
29
|
## [1.1.11](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.10...@ecomplus/widget-ebit@1.1.11) (2020-12-16)
|
28
30
|
|
29
31
|
**Note:** Version bump only for package @ecomplus/widget-ebit
|
30
32
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
33
|
## [1.1.10](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.9...@ecomplus/widget-ebit@1.1.10) (2020-12-15)
|
36
34
|
|
37
35
|
**Note:** Version bump only for package @ecomplus/widget-ebit
|
38
36
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
37
|
## [1.1.9](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.8...@ecomplus/widget-ebit@1.1.9) (2020-12-15)
|
44
38
|
|
45
39
|
**Note:** Version bump only for package @ecomplus/widget-ebit
|
46
40
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
41
|
## [1.1.8](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.7...@ecomplus/widget-ebit@1.1.8) (2020-10-26)
|
52
42
|
|
53
43
|
**Note:** Version bump only for package @ecomplus/widget-ebit
|
54
44
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
45
|
## [1.1.7](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.6...@ecomplus/widget-ebit@1.1.7) (2020-07-17)
|
60
46
|
|
61
|
-
|
62
47
|
### Bug Fixes
|
63
48
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
49
|
+
- **pkg:** fix direct js dependencies ([f1d29cf](https://github.com/ecomplus/storefront/commit/f1d29cfb90df8393c5ff2f82e74f043594e3f08f))
|
69
50
|
|
70
51
|
## [1.1.6](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.5...@ecomplus/widget-ebit@1.1.6) (2020-06-30)
|
71
52
|
|
72
|
-
|
73
53
|
### Bug Fixes
|
74
54
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
55
|
+
- **ebit-banner:** fix duplicated lightbox error ([#259](https://github.com/ecomplus/storefront/issues/259)) ([cfaccbf](https://github.com/ecomplus/storefront/commit/cfaccbf105ef37d11f08832c562f5d655fc0797b))
|
80
56
|
|
81
57
|
## [1.1.5](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.4...@ecomplus/widget-ebit@1.1.5) (2020-06-19)
|
82
58
|
|
83
59
|
**Note:** Version bump only for package @ecomplus/widget-ebit
|
84
60
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
61
|
## [1.1.4](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.3...@ecomplus/widget-ebit@1.1.4) (2020-05-29)
|
90
62
|
|
91
|
-
|
92
63
|
### Bug Fixes
|
93
64
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
65
|
+
- **ebit-lightbox:** fix loading ebit script dynamically ([0fb0d51](https://github.com/ecomplus/storefront/commit/0fb0d51b64cdf17d469488b0404e77b6b8635c08))
|
99
66
|
|
100
67
|
## [1.1.3](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.2...@ecomplus/widget-ebit@1.1.3) (2020-05-26)
|
101
68
|
|
102
69
|
**Note:** Version bump only for package @ecomplus/widget-ebit
|
103
70
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
71
|
## [1.1.2](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.1...@ecomplus/widget-ebit@1.1.2) (2020-05-22)
|
109
72
|
|
110
|
-
|
111
73
|
### Bug Fixes
|
112
74
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
75
|
+
- **deps:** update @ecomplus/utils to v1.4.0 ([551e02e](https://github.com/ecomplus/storefront/commit/551e02e0e1e3bee6ce7002fd84d0c91f9cb8fb08))
|
118
76
|
|
119
77
|
## [1.1.1](https://github.com/ecomplus/storefront/compare/@ecomplus/widget-ebit@1.1.0...@ecomplus/widget-ebit@1.1.1) (2020-05-21)
|
120
78
|
|
121
|
-
|
122
79
|
### Bug Fixes
|
123
80
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
81
|
+
- **widget-ebit:** fix formatting bith date to ebit param ([9affd68](https://github.com/ecomplus/storefront/commit/9affd68e0c392e6edda48b6fec65c3b13f3032ac))
|
129
82
|
|
130
83
|
# 1.1.0 (2020-05-21)
|
131
84
|
|
132
|
-
|
133
85
|
### Bug Fixes
|
134
86
|
|
135
|
-
|
136
|
-
|
137
|
-
|
87
|
+
- **cms:** ebit widget disabled by for pages ([db67a0e](https://github.com/ecomplus/storefront/commit/db67a0e7c7ca399ca439e5704e34aa55006deb16))
|
88
|
+
- **widget-ebit:** append confirmation banner to #confirmation el ([a27e985](https://github.com/ecomplus/storefront/commit/a27e9858e485b3a75da68e2e7cf94e7b28453df2))
|
138
89
|
|
139
90
|
### Features
|
140
91
|
|
141
|
-
|
92
|
+
- **ebit:** storefront plugin for ebit reviews ([#234](https://github.com/ecomplus/storefront/issues/234)) ([fc356aa](https://github.com/ecomplus/storefront/commit/fc356aadd7fbf1c653525ab9ebbb06df183eddfa))
|
package/cms.config.js
CHANGED
@@ -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,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,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,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a,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,2DAAG9D,kBACNwD,SAASO,KAAKC,YAAYL,GAC1BM,cAAcZ,KAGkC,OAErDa,MAAMC,QAAQC,SAIjBnE,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","$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,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa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ACF,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,2DAAG9D,kBACNwD,SAASO,KAAKC,YAAYL,GAC1BM,cAAcZ,KAGkC,OAErDa,MAAMC,QAAQC,SAIjBnE,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 +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,QAASS,GAG/DR,EAAOW,GAAI,EAGJX,EAAOD,QA0Df,OArDAS,EAAoBM,EAAIF,EAGxBJ,EAAoBO,EAAIR,EAGxBC,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IjC,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","$confirmation","document","getElementById","insertAdjacentHTML","$script","createElement","type","src","body","appendChild","clearInterval","catch","console","error","currentRoute","afterEach","Error"],"m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AK,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":""}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ecomplus/widget-ebit",
|
3
|
-
"version": "1.1
|
3
|
+
"version": "1.2.1",
|
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.
|
33
|
+
"@ecomplus/passport-client": "^1.1.2",
|
34
34
|
"@ecomplus/utils": "^1.4.1",
|
35
35
|
"core-js": "3.x"
|
36
36
|
},
|