ng-easycommerce 0.0.404 → 0.0.407

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/README.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Ultimas Modificaciones
2
2
 
3
+ ### version: 0.0.407
4
+
5
+ - - Ajustes en decidir envio de tipos de tarjeta (WIP).
6
+
7
+ ### version: 0.0.406
8
+
9
+ - Ajustes en decidir parametros de entorno backoffice (FIX).
10
+
11
+ - Metodo para verificar si un producto tiene todas sus variantes sin segumiento en seleccion multiple de items (FIX).
12
+
13
+ ### version: 0.0.405
14
+
15
+ - Ajustes en decidir parametros de entorno backoffice.
16
+
17
+ - Metodo para verificar si un producto tiene todas sus variantes sin segumiento en seleccion multiple de items.
18
+
3
19
  ### version: 0.0.404
4
20
 
5
21
  - Ajustes en el componente SellerDashboardContainer para compatibilidad con Bs4
@@ -7,7 +7,42 @@
7
7
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
8
8
  integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
9
9
  <title>Decidir</title>
10
- <script src="https://live.decidir.com/static/v2.5/decidir.js"></script>
10
+
11
+ <!-- <script src="https://live.decidir.com/static/v2.5/decidir.js"></script> -->
12
+
13
+ <script defer>
14
+
15
+ const dataDecidirHead = localStorage.getItem('dataDecidir')
16
+ && JSON.parse(localStorage.getItem('dataDecidir'))
17
+
18
+
19
+ console.log("dataDecidirHead", dataDecidirHead);
20
+ console.log("dataDecidirHead.config", dataDecidirHead.config);
21
+ console.log("dataDecidirHead.config.public_environment", dataDecidirHead.config.public_environment);
22
+
23
+ let modoHead = dataDecidirHead?.config?.public_environment || null
24
+ console.log("modoHead 1", modoHead);
25
+
26
+ modoHead && (modoHead == 'prod' && (modoHead = false) || modoHead == 'test' && (modoHead = true))
27
+
28
+ console.log("modoHead 2", modoHead);
29
+
30
+ !modoHead && (modoHead = window.location.host.includes('easycommerce'))
31
+
32
+ console.log('modoHead 3-> ', modoHead);
33
+
34
+ let my_awesome_script = document.createElement('script');
35
+
36
+ my_awesome_script.setAttribute('defer', 'defer')
37
+
38
+ my_awesome_script.setAttribute('src',
39
+ modoHead && 'https://developers.decidir.com/static/v2.5/decidir.js'
40
+ || 'https://live.decidir.com/static/v2.5/decidir.js'
41
+ );
42
+
43
+ document.head.appendChild(my_awesome_script);
44
+
45
+ </script>
11
46
  </head>
12
47
 
13
48
  <body>
@@ -48,91 +83,97 @@
48
83
  <div class="container-fluid">
49
84
  <div class="row mt-3">
50
85
  <div class="col-12">
51
- <div class="card" >
86
+ <div class="card">
52
87
  <div class="w-100 text-center">
53
- <img src="../assets/images/decidir-logo.png" class="card-img-top w-50" alt="...">
88
+ <img src="../assets/images/decidir-logo.png" class="card-img-top w-50" alt="...">
54
89
  </div>
55
90
  <div class="card-body">
56
- <!-- <h5 class="card-title">Decidir</h5> -->
57
- <!-- <p class="card-text">Ingrese sus datos para continuar con el pago.</p> -->
58
- <form action="" method="post" id="formulario">
59
- <fieldset>
60
-
61
- <div class="row">
62
- <div class="col-md-8 col-12">
63
-
64
- <div class="form-floating mb-3">
65
- <input class="form-control" type="text" data-decidir="card_number"
66
- placeholder="XXXXXXXXXXXXXXXX" maxlength="16" value="">
67
- <label for="card_number">Numero de tarjeta:</label>
68
- </div>
69
-
70
- </div>
71
- <div class="col-md-4 col-12">
72
-
73
- <div class="form-floating mb-3">
74
- <input class="form-control" type="text" data-decidir="security_code"
75
- placeholder="XXX" maxlength="3" value="" />
76
- <label for="security_code">Codigo de seguridad:</label>
77
- </div>
78
-
79
- </div>
80
- </div>
81
- <div class="row">
82
-
83
- <div class="col-md-6 col-12">
84
- <div class="form-floating mb-3">
85
- <input class="form-control" type="text" data-decidir="card_expiration_month"
86
- placeholder="MM" maxlength="2" value="" />
87
- <label for="card_expiration_month">Mes de vencimiento:</label>
88
- </div>
89
- </div>
90
-
91
- <div class="col-md-6 col-12">
92
- <div class="form-floating mb-3">
93
- <input class="form-control" type="text" data-decidir="card_expiration_year"
94
- placeholder="AA" maxlength="2" value="" />
95
- <label for="card_expiration_year">Año de vencimiento:</label>
96
- </div>
97
- </div>
98
- </div>
99
- <div class="form-floating mb-3">
100
- <input class="form-control" type="text" data-decidir="card_holder_name"
101
- placeholder="TITULAR" value="" />
102
- <label for="card_holder_name">Nombre del titular:</label>
103
- </div>
104
- <div class="row">
105
- <div class="col-md-6 col-12">
106
- <div class="form-floating mb-3">
107
- <select class="form-select" data-decidir="card_holder_doc_type">
108
- <option value="dni">DNI</option>
109
- </select>
110
- <label for="card_holder_doc_type">Tipo de documento:</label>
111
- </div>
112
- </div>
113
- <div class="col-md-6 col-12">
114
- <div class="form-floating mb-3">
115
- <input class="form-control" data-decidir="card_holder_doc_number"
116
- placeholder="XXXXXXXXXX" maxlength="9" value="">
117
- <label for="card_holder_doc_type">Numero de documento:</label>
118
- </div>
119
- </div>
120
- </div>
121
-
122
- <div class="w-100 text-center">
123
- <div id="loadTokenBtn">
124
- <input type="submit" value="Generar Token" class="btn btn-outline-success mt-3" />
125
- </div>
126
- <div id="loadToken" class="text-center mt-4">
127
- <div class="spinner-border" role="status">
128
- <span class="visually-hidden">Cargando...</span>
91
+ <!-- <h5 class="card-title">Decidir</h5> -->
92
+ <!-- <p class="card-text">Ingrese sus datos para continuar con el pago.</p> -->
93
+ <form action="" method="post" id="formulario">
94
+ <fieldset>
95
+
96
+ <div class="row">
97
+ <div class="col-md-8 col-12">
98
+
99
+ <div class="form-floating mb-3">
100
+ <input class="form-control" type="text" data-decidir="card_number"
101
+ placeholder="XXXXXXXXXXXXXXXX" maxlength="16" value=""
102
+ oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');">
103
+ <label for="card_number">Numero de tarjeta:</label>
104
+ </div>
105
+
106
+ </div>
107
+ <div class="col-md-4 col-12">
108
+
109
+ <div class="form-floating mb-3">
110
+ <input class="form-control" type="text" data-decidir="security_code"
111
+ placeholder="XXX" maxlength="3" value=""
112
+ oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');" />
113
+ <label for="security_code">Codigo de seguridad:</label>
114
+ </div>
115
+
116
+ </div>
117
+ </div>
118
+ <div class="row">
119
+
120
+ <div class="col-md-6 col-12">
121
+ <div class="form-floating mb-3">
122
+ <input class="form-control" type="text" data-decidir="card_expiration_month"
123
+ placeholder="MM" maxlength="2" value=""
124
+ oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');" />
125
+ <label for="card_expiration_month">Mes de vencimiento:</label>
126
+ </div>
127
+ </div>
128
+
129
+ <div class="col-md-6 col-12">
130
+ <div class="form-floating mb-3">
131
+ <input class="form-control" type="text" data-decidir="card_expiration_year"
132
+ placeholder="AA" maxlength="2" value=""
133
+ oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');" />
134
+ <label for="card_expiration_year">Año de vencimiento:</label>
135
+ </div>
129
136
  </div>
130
- </div>
131
- </div>
132
- </fieldset>
133
- </form>
137
+ </div>
138
+ <div class="form-floating mb-3">
139
+ <input class="form-control" type="text" data-decidir="card_holder_name"
140
+ placeholder="TITULAR" value="" />
141
+ <label for="card_holder_name">Nombre del titular:</label>
142
+ </div>
143
+ <div class="row">
144
+ <div class="col-md-6 col-12">
145
+ <div class="form-floating mb-3">
146
+ <select class="form-select" data-decidir="card_holder_doc_type">
147
+ <option value="dni">DNI</option>
148
+ </select>
149
+ <label for="card_holder_doc_type">Tipo de documento:</label>
150
+ </div>
151
+ </div>
152
+ <div class="col-md-6 col-12">
153
+ <div class="form-floating mb-3">
154
+ <input class="form-control" data-decidir="card_holder_doc_number"
155
+ placeholder="XXXXXXXXXX" maxlength="9" value=""
156
+ oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');">
157
+ <label for="card_holder_doc_type">Numero de documento:</label>
158
+ </div>
159
+ </div>
160
+ </div>
161
+
162
+ <div class="w-100 text-center">
163
+ <div id="loadTokenBtn">
164
+ <input type="submit" value="Generar Token"
165
+ class="btn btn-outline-success mt-3" />
166
+ </div>
167
+ <div id="loadToken" class="text-center mt-4">
168
+ <div class="spinner-border" role="status">
169
+ <span class="visually-hidden">Cargando...</span>
170
+ </div>
171
+ </div>
172
+ </div>
173
+ </fieldset>
174
+ </form>
134
175
  </div>
135
- </div>
176
+ </div>
136
177
 
137
178
  </div>
138
179
  </div>
@@ -141,97 +182,127 @@
141
182
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
142
183
  integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
143
184
 
185
+ <script src="https://sdk.mercadopago.com/js/v2"></script>
144
186
 
145
- <script>
146
- let loadToken = document.querySelector('#loadToken');
147
- let loadTokenBtn = document.querySelector('#loadTokenBtn');
148
-
149
- const isLoad = (state) => {
150
- loadToken.style.display = !state && 'none' || 'block';
151
- loadTokenBtn.style.display = state && 'none' || 'block';
152
- }
153
-
154
- isLoad(false)
155
-
156
-
157
- const urlSandbox = "https://developers.decidir.com/api/v2";
158
- const urlProduccion = "https://live.decidir.com/api/v2";
159
- const dataRedirect = localStorage.getItem('dataRedirect')
160
- const dataDecidir = localStorage.getItem('dataDecidir')
161
- && JSON.parse(localStorage.getItem('dataDecidir'))
187
+ <script defer>
162
188
 
163
- const publicApiKey = dataDecidir?.config?.public_key
164
- const cybersource = dataDecidir?.config?.public_cybersource || true
165
- let modo = dataDecidir?.config?.public_enviroment || null
189
+ const mp = new MercadoPago('APP_USR-d8364d3f-b9fb-4c11-9e47-aa437fc58a8d', {
190
+ locale: 'en-US'
191
+ });
166
192
 
167
- modo && (modo == 'prod' && (modo = false) || modo == 'test' && (modo = true))
168
- !modo && (modo = window.location.host.includes('easycommercetech'))
193
+ window.onload = function () {
169
194
 
170
- console.log(modo);
195
+ let loadToken = document.querySelector('#loadToken');
196
+ let loadTokenBtn = document.querySelector('#loadTokenBtn');
171
197
 
172
- const decidir = new Decidir( modo && urlSandbox || urlProduccion, cybersource);
173
- decidir.setPublishableKey(publicApiKey);
174
- decidir.setTimeout(5000);
198
+ const isLoad = (state) => {
199
+ loadToken.style.display = !state && 'none' || 'block';
200
+ loadTokenBtn.style.display = state && 'none' || 'block';
201
+ }
175
202
 
176
- let form = document.querySelector('#formulario');
203
+ isLoad(false)
177
204
 
178
- const sendToken = (data) => {
179
- fetch(dataRedirect, {
180
- method: 'POST',
181
- body: JSON.stringify(data),
182
- headers: {
183
- 'Content-Type': 'application/json'
184
- }
185
- }).then(res => res.json())
186
- .catch(error => {
187
- console.error('Error:', error)
188
- processError(response)
189
- })
190
- .then(response => {
191
- console.log('Success:', response)
192
- if (response.hasOwnProperty('status')) {
193
- if (response.status == 'success') {
194
- processResponse(response)
205
+ const urlSandbox = "https://developers.decidir.com/api/v2";
206
+ const urlProduccion = "https://live.decidir.com/api/v2";
207
+ const dataRedirect = localStorage.getItem('dataRedirect')
208
+ const dataDecidir = localStorage.getItem('dataDecidir')
209
+ && JSON.parse(localStorage.getItem('dataDecidir'))
210
+
211
+ const publicApiKey = dataDecidir?.config?.public_key
212
+ const cybersource = dataDecidir?.config?.public_cybersource || true
213
+ let modo = dataDecidir?.config?.public_environment || null
214
+
215
+ modo && (modo == 'prod' && (modo = false) || modo == 'test' && (modo = true))
216
+ !modo && (modo = window.location.host.includes('easycommerce'))
217
+
218
+ console.log(modo);
219
+
220
+ const decidir = new Decidir(modo && urlSandbox || urlProduccion, cybersource);
221
+ decidir.setPublishableKey(publicApiKey);
222
+ decidir.setTimeout(5000);
223
+
224
+ console.log("decidir", decidir);
225
+
226
+ let form = document.querySelector('#formulario');
227
+
228
+ const sendToken = (data) => {
229
+
230
+ fetch(dataRedirect, {
231
+ method: 'POST',
232
+ body: JSON.stringify(data),
233
+ headers: {
234
+ 'Content-Type': 'application/json'
235
+ }
236
+ }).then(res => res.json())
237
+ .catch(error => {
238
+ console.error('Error:', error)
239
+ processError(response)
240
+ })
241
+ .then(response => {
242
+ console.log('Success:', response)
243
+ if (response.hasOwnProperty('status')) {
244
+ if (response.status == 'success') {
245
+ processResponse(response)
246
+ } else {
247
+ processError(response)
248
+ }
195
249
  } else {
196
- processError(response)
250
+ processResponse(response)
197
251
  }
198
- } else {
199
- processResponse(response)
252
+ });
253
+ localStorage.removeItem('dataRedirect')
254
+ localStorage.removeItem('dataDecidir')
255
+ }
256
+
257
+ const getAsBin = (data) => {
258
+ // console.log('validateCreditCardNumber',decidir.validateCreditCardNumber(decidir.collectFormData(form).card_number));
259
+ // console.log('cardType',decidir.cardType(decidir.collectFormData(form).card_number));
260
+ // console.log('collectFormData', decidir.collectFormData(form));
261
+ // console.log('getBin',JSON.stringify(decidir.getBin(decidir.collectFormData(form))));
262
+ // console.log('getHttp',decidir.getHttp(form));
263
+ mp.getPaymentMethods({ bin: data.bin }).then(
264
+ t => {
265
+ let resultmp = t.results[0]
266
+ let asBin = { tipo_tarjeta_decidir: decidir.cardType(decidir.collectFormData(form).card_number) ,as_bin: resultmp.id , issuer: resultmp.issuer.name , name:resultmp.name , payment_type: resultmp.payment_type_id ,resultmp }
267
+ sendToken({ ...data , ...asBin})
200
268
  }
201
- });
202
- localStorage.removeItem('dataRedirect')
203
- localStorage.removeItem('dataDecidir')
204
- }
269
+ )
270
+ }
205
271
 
206
- const sdkResponseHandler = (status, response) => {
207
- if (status != 200 && status != 201) {
208
- //Manejo de error: Ver Respuesta de Error
209
- processError(response)
210
- } else {
211
- //Manejo de respuesta donde response = {token: "99ab0740-4ef9-4b38-bdf9-c4c963459b22"}
212
- sendToken(response)
272
+ const sdkResponseHandler = (status, response) => {
273
+ if (status != 200 && status != 201) {
274
+ //Manejo de error: Ver Respuesta de Error
275
+ processError(response)
276
+ } else {
277
+ //Manejo de respuesta donde response = {token: "99ab0740-4ef9-4b38-bdf9-c4c963459b22"}
278
+ getAsBin(response)
279
+ }
213
280
  }
214
- }
215
- const sendForm = (event) => {
216
- isLoad(true)
217
- event.preventDefault();
218
- decidir.createToken(form, sdkResponseHandler);
219
- return false;
220
- }
221
281
 
222
- const processError = (error) => {
223
- console.log("ERROR ENVIO BACK ", error);
224
- isLoad(false)
225
- localStorage.setItem('state', 'failure')
226
- }
282
+ const sendForm = (event) => {
283
+ isLoad(true)
284
+ event.preventDefault();
285
+ decidir.createToken(form, sdkResponseHandler);
286
+ return false;
287
+ }
288
+
289
+ const processError = (error) => {
290
+ console.log("ERROR ENVIO BACK ", error);
291
+ isLoad(false)
292
+ localStorage.setItem('state', 'failure')
293
+ }
294
+
295
+ const processResponse = (response) => {
296
+ console.log("ENVIO BACK ", response);
297
+ isLoad(false)
298
+ localStorage.setItem('state', 'success')
299
+ }
300
+
301
+ form.addEventListener('submit', sendForm);
302
+
303
+ };
304
+
227
305
 
228
- const processResponse = (response) => {
229
- console.log("ENVIO BACK ", response);
230
- isLoad(false)
231
- localStorage.setItem('state', 'success')
232
- }
233
-
234
- form.addEventListener('submit', sendForm);
235
306
  </script>
236
307
  </body>
237
308
 
@@ -12830,6 +12830,7 @@
12830
12830
  }
12831
12831
  return true;
12832
12832
  };
12833
+ _this.allWithoutTracking = function () { return _this.optionsProductForVariant().some(function (item) { var _a; return ((_a = item.currentOption) === null || _a === void 0 ? void 0 : _a.stock) != 9999; }); };
12833
12834
  _this.getObjectParamsWithVariant = function () {
12834
12835
  return _this.objectWithVariant || _this.getObjectWithVariant();
12835
12836
  };
@@ -12863,7 +12864,7 @@
12863
12864
  MultipleItemsToCartEcComponent = __decorate$1z([
12864
12865
  core.Component({
12865
12866
  selector: 'app-multiple-items-to-cart-ec',
12866
- template: "<table class=\"table table-hover tablas tabla-curva\">\n <thead>\n <tr>\n <th scope=\"col\">Curva</th>\n <th *ngFor=\"let item of optionsProductForVariant()\" scope=\"col\">{{item.currentOption?.code}}</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>Stock</td>\n <th *ngFor=\"let item of optionsProductForVariant()\" scope=\"col\">{{item.currentOption?.stock}}</th>\n </tr>\n <tr>\n <td></td>\n <td *ngFor=\"let item of optionsProductForVariant()\">\n <div class=\"text-center\">\n <input class=\"form-control form-control-sm in-curva\"\n (keypress)=\"consts.inputValidationByExpressions($event,'[0-9]{1,9}', condition(inputValue.value,item) )\" #inputValue \n (keyup)=\"setQuantity(inputValue.value,item)\" [max]=\"item.currentOption?.stock\" min=\"0\" type=\"text\"\n [value]=\"item?.productToCartItem?.quantity || 0\" id=\"\">\n </div>\n </td>\n </tr>\n </tbody>\n</table>\n<ng-template #loading>\n <div class=\"col-12 align-items-center\">\n <div class=\"d-flex flex-column jusitfy-content-center align-items-center my-5\">\n <app-loading-full-ec></app-loading-full-ec>\n </div>\n </div>\n</ng-template>",
12867
+ template: "<table class=\"table table-hover tablas tabla-curva\">\n <thead>\n <tr>\n <th scope=\"col\">Curva</th>\n <th *ngFor=\"let item of optionsProductForVariant()\" scope=\"col\">{{item.currentOption?.code}}</th>\n </tr>\n </thead>\n <tbody>\n <ng-container *ngIf=\"allWithoutTracking()\">\n <tr>\n <td>Stock</td>\n <th *ngFor=\"let item of optionsProductForVariant()\" scope=\"col\">{{(item.currentOption?.stock == 9999)? 'N/A' : item.currentOption?.stock }}</th>\n </tr>\n </ng-container>\n <tr>\n <td></td>\n <td *ngFor=\"let item of optionsProductForVariant()\">\n <div class=\"text-center\">\n <input class=\"form-control form-control-sm in-curva\"\n (keypress)=\"consts.inputValidationByExpressions($event,'[0-9]{1,9}', condition(inputValue.value,item) )\" #inputValue \n (keyup)=\"setQuantity(inputValue.value,item)\" [max]=\"item.currentOption?.stock\" min=\"0\" type=\"text\"\n [value]=\"item?.productToCartItem?.quantity || 0\" id=\"\">\n </div>\n </td>\n </tr>\n </tbody>\n</table>\n<ng-template #loading>\n <div class=\"col-12 align-items-center\">\n <div class=\"d-flex flex-column jusitfy-content-center align-items-center my-5\">\n <app-loading-full-ec></app-loading-full-ec>\n </div>\n </div>\n</ng-template>",
12867
12868
  styles: [".tabla-curva th{background-color:var(--color-section)}.tabla-curva td,.tabla-curva th{text-align:center}.tabla-curva .form-check .form-check-input{float:none}.tabla-curva input.in-curva{font-size:.7rem;font-weight:700;display:inline-block;width:55px}.table.tabla-curva>:not(caption)>*>*{padding:.5rem .2rem}"]
12868
12869
  })
12869
12870
  ], MultipleItemsToCartEcComponent);