crmbonus-component-wake 2.1.31-ngrok → 2.1.33-ngrok
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{build.payload.helper-b93f7ea5.js → build.payload.helper-cfd3173e.js} +4 -1
- package/dist/cjs/build.payload.helper-cfd3173e.js.map +1 -0
- package/dist/cjs/crm-bonus-2.cjs.entry.js +6 -257
- package/dist/cjs/crm-bonus-2.cjs.entry.js.map +1 -1
- package/dist/cjs/crm-bonus-note.cjs.entry.js +1 -1
- package/dist/cjs/crm-bonus.cjs.entry.js +257 -6
- package/dist/cjs/crm-bonus.cjs.entry.js.map +1 -1
- package/dist/cjs/crmbonus-component-wake.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/crm-bonus/crm-bonus.js +1 -1
- package/dist/collection/components/crm-bonus/crm-bonus.js.map +1 -1
- package/dist/collection/components/crm-bonus/crmbonus.js +2 -2
- package/dist/collection/components/crm-bonus/crmbonus.js.map +1 -1
- package/dist/collection/dto/validate.pin.bonus.js.map +1 -1
- package/dist/collection/helpers/build.payload.helper.js +3 -0
- package/dist/collection/helpers/build.payload.helper.js.map +1 -1
- package/dist/components/crm-bonus-2.js +10 -332
- package/dist/components/crm-bonus-2.js.map +1 -1
- package/dist/components/crm-bonus-note.js +2 -2
- package/dist/components/crm-bonus.js +332 -10
- package/dist/components/crm-bonus.js.map +1 -1
- package/dist/components/crm-giftback-form.js +1 -1
- package/dist/components/giftback-info.js +1 -1
- package/dist/components/{p-fedabc25.js → p-028f43a1.js} +2 -2
- package/dist/components/{p-fedabc25.js.map → p-028f43a1.js.map} +1 -1
- package/dist/components/{p-78fbe33d.js → p-0bb6b0e5.js} +3 -3
- package/dist/components/{p-78fbe33d.js.map → p-0bb6b0e5.js.map} +1 -1
- package/dist/components/{p-4c7e066c.js → p-b0ef2c0b.js} +4 -1
- package/dist/components/p-b0ef2c0b.js.map +1 -0
- package/dist/components/{p-0a5e4aca.js → p-c90ea2e9.js} +57 -57
- package/dist/components/p-c90ea2e9.js.map +1 -0
- package/dist/components/pedido-finalizado.js +1 -1
- package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js +1 -1
- package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js.map +1 -1
- package/dist/crmbonus-component-wake/{p-3e87e176.entry.js → p-22dc17d2.entry.js} +2 -2
- package/dist/crmbonus-component-wake/{p-b928333a.entry.js → p-4ed412c2.entry.js} +2 -2
- package/dist/crmbonus-component-wake/p-4ed412c2.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/{p-c54d706c.entry.js → p-7d608b81.entry.js} +2 -2
- package/dist/crmbonus-component-wake/p-7d608b81.entry.js.map +1 -0
- package/dist/crmbonus-component-wake/p-b0ef2c0b.js +2 -0
- package/dist/crmbonus-component-wake/p-b0ef2c0b.js.map +1 -0
- package/dist/esm/{build.payload.helper-caf0a82b.js → build.payload.helper-699a48ca.js} +4 -1
- package/dist/esm/build.payload.helper-699a48ca.js.map +1 -0
- package/dist/esm/crm-bonus-2.entry.js +7 -258
- package/dist/esm/crm-bonus-2.entry.js.map +1 -1
- package/dist/esm/crm-bonus-note.entry.js +1 -1
- package/dist/esm/crm-bonus.entry.js +258 -7
- package/dist/esm/crm-bonus.entry.js.map +1 -1
- package/dist/esm/crmbonus-component-wake.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components.d.ts +4 -4
- package/dist/types/dto/validate.pin.bonus.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/build.payload.helper-b93f7ea5.js.map +0 -1
- package/dist/components/p-0a5e4aca.js.map +0 -1
- package/dist/components/p-4c7e066c.js.map +0 -1
- package/dist/crmbonus-component-wake/p-4c7e066c.js +0 -2
- package/dist/crmbonus-component-wake/p-4c7e066c.js.map +0 -1
- package/dist/crmbonus-component-wake/p-b928333a.entry.js.map +0 -1
- package/dist/crmbonus-component-wake/p-c54d706c.entry.js.map +0 -1
- package/dist/esm/build.payload.helper-caf0a82b.js.map +0 -1
- /package/dist/crmbonus-component-wake/{p-3e87e176.entry.js.map → p-22dc17d2.entry.js.map} +0 -0
@@ -1,18 +1,6 @@
|
|
1
1
|
import { p as proxyCustomElement, H, h } from './p-9d950d25.js';
|
2
|
-
import {
|
3
|
-
import { d as
|
4
|
-
import { i as instance } from './p-c53241bf.js';
|
5
|
-
import { b as buildProductsByWake } from './p-4c7e066c.js';
|
6
|
-
import { d as defineCustomElement$b } from './p-11520f0f.js';
|
7
|
-
import { d as defineCustomElement$a } from './p-bc930dfe.js';
|
8
|
-
import { d as defineCustomElement$9 } from './p-78fbe33d.js';
|
9
|
-
import { d as defineCustomElement$8 } from './p-ce77a841.js';
|
10
|
-
import { d as defineCustomElement$7 } from './p-fedabc25.js';
|
11
|
-
import { d as defineCustomElement$6 } from './p-c5be72a0.js';
|
12
|
-
import { d as defineCustomElement$5 } from './p-f1823a52.js';
|
13
|
-
import { d as defineCustomElement$4 } from './p-ee1c025b.js';
|
14
|
-
import { d as defineCustomElement$3 } from './p-890dc5d5.js';
|
15
|
-
import { d as defineCustomElement$2 } from './p-8fda6382.js';
|
2
|
+
import { g as getCart } from './p-c90ea2e9.js';
|
3
|
+
import { d as defineCustomElement$2 } from './p-c5be72a0.js';
|
16
4
|
|
17
5
|
const crmBonusCss = ".container-button{cursor:pointer;padding:5px 5px 5px 14px;}.section-crm{border:1px solid #dbd4d4;text-align:-webkit-center;margin-bottom:20px}.section-cart-crm{margin-top:10px}.section-cart-crm p{padding:0;margin:0px 0px 0px 15px}.button{top:50%;background-color:#6c6c7e;color:#fff;border:none;padding:15px;min-height:30px;min-width:120px;cursor:pointer;margin-left:10px;height:70px}.form-container{width:97%;display:flex;justify-content:space-around}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:0px}.form-container .btnCrm{background:#00162e;border-color:#00162e;width:30%;color:#fff}.message-alert{color:#df4d4d;margin-top:5px}";
|
18
6
|
const CrmBonus2Style0 = crmBonusCss;
|
@@ -22,347 +10,37 @@ const CrmBonus = /*@__PURE__*/ proxyCustomElement(class CrmBonus extends H {
|
|
22
10
|
super();
|
23
11
|
this.__registerHost();
|
24
12
|
this.__attachShadow();
|
25
|
-
this.crmBonusService = CrmBonusService.getInstance();
|
26
|
-
this.cart = undefined;
|
27
|
-
this.canhidden = false;
|
28
|
-
this.showModal = false;
|
29
|
-
this.cartWake = undefined;
|
30
|
-
this.customer = {
|
31
|
-
birthDate: "",
|
32
|
-
document: "",
|
33
|
-
name: "",
|
34
|
-
phone: ""
|
35
|
-
};
|
36
13
|
this.loading = false;
|
37
|
-
this.
|
38
|
-
this.phone = undefined;
|
39
|
-
this.canCancel = false;
|
40
|
-
this.amountCancel = undefined;
|
41
|
-
this.sent = undefined;
|
42
|
-
this.session = undefined;
|
43
|
-
this.loading_reprocess = false;
|
44
|
-
this.styles = defaultStyles;
|
45
|
-
this.reservedInfo = undefined;
|
46
|
-
}
|
47
|
-
async resetBonus() {
|
48
|
-
console.log('[START RESET BONUS]!!!!!');
|
49
|
-
try {
|
50
|
-
await this.crmBonusRef.processBonus(this.buildProducts(), true);
|
51
|
-
console.log('[BONUS RESETADO]!!!!!');
|
52
|
-
}
|
53
|
-
catch (err) {
|
54
|
-
this.loading = false;
|
55
|
-
console.log('[error ao reprocessar bonous]');
|
56
|
-
await this.crmBonusRef.setStep(StepFormEnum.STEP_PHONE);
|
57
|
-
}
|
58
|
-
finally {
|
59
|
-
this.loading = false;
|
60
|
-
}
|
61
|
-
}
|
62
|
-
async setloading() {
|
63
|
-
this.loading_reprocess = !this.loading_reprocess;
|
64
|
-
}
|
65
|
-
async reprocess() {
|
66
|
-
console.log("[CRMBONUS] - reprocess");
|
67
|
-
this.loading_reprocess = true;
|
68
|
-
try {
|
69
|
-
const isUse = localStorage.getItem(USED_KEY);
|
70
|
-
if (!isUse)
|
71
|
-
return;
|
72
|
-
this.cartWake = await getCart();
|
73
|
-
await this.resetBonus();
|
74
|
-
}
|
75
|
-
catch (err) {
|
76
|
-
console.debug('[watchProducts]', err.message);
|
77
|
-
}
|
78
|
-
finally {
|
79
|
-
this.loading_reprocess = false;
|
80
|
-
}
|
81
|
-
}
|
82
|
-
async componentWillLoad() {
|
83
|
-
window.addEventListener('productRemovedFromCart', async () => {
|
84
|
-
console.log('[CRMBONUS] - productRemovedFromCart');
|
85
|
-
await this.reprocess();
|
86
|
-
});
|
87
|
-
window.addEventListener('productAddedToCart', async () => {
|
88
|
-
console.log('[CRMBONUS] - productAddedToCart');
|
89
|
-
await this.reprocess();
|
90
|
-
});
|
91
|
-
document.querySelectorAll('form').forEach((el) => {
|
92
|
-
el.addEventListener("submit", () => {
|
93
|
-
console.log("[CRMBONUS] - Formulário está sendo submetido!");
|
94
|
-
// você pode marcar como "em submissão" aqui
|
95
|
-
setTimeout(async () => {
|
96
|
-
await this.reprocess();
|
97
|
-
});
|
98
|
-
});
|
99
|
-
});
|
100
|
-
await this.observerHandle();
|
101
|
-
instance.changeLanguage(instance.language);
|
102
|
-
await this.loadSession();
|
103
|
-
this.handleLoad();
|
104
|
-
await this.loadConfigStore();
|
14
|
+
this.cartWake = undefined;
|
105
15
|
}
|
106
16
|
async componentDidLoad() {
|
107
|
-
|
108
|
-
}
|
109
|
-
async observerHandle() {
|
110
|
-
const elements = document.getElementsByTagName('a');
|
111
|
-
//@ts-ignore
|
112
|
-
for (let el of elements) {
|
113
|
-
console.log('[el.href]', el.href);
|
114
|
-
if (el.href.includes('Produto/Delete')) {
|
115
|
-
el.addEventListener('click', async () => {
|
116
|
-
console.log('[CRMBONUS] - Produto removido do carrinho');
|
117
|
-
setTimeout(async () => {
|
118
|
-
await this.reprocess();
|
119
|
-
this.observerHandle();
|
120
|
-
}, 2000);
|
121
|
-
});
|
122
|
-
}
|
123
|
-
if (el.href.includes('Produto/Add')) {
|
124
|
-
el.addEventListener('click', async () => {
|
125
|
-
console.log('[CRMBONUS] - Produto adicionado ao carrinho');
|
126
|
-
setTimeout(async () => {
|
127
|
-
await this.reprocess();
|
128
|
-
this.observerHandle();
|
129
|
-
}, 2000);
|
130
|
-
});
|
131
|
-
}
|
132
|
-
}
|
133
|
-
}
|
134
|
-
async loadConfigStore() {
|
135
|
-
const [customization, infoBonus] = await Promise.all([
|
136
|
-
this.crmBonusService.getCustomization(this.cartWake.store.name),
|
137
|
-
getInfoBonusByCartIdAndStoreName(this.cartWake.id, this.cartWake.store.name)
|
138
|
-
]);
|
139
|
-
console.log('[infoBonus]', infoBonus);
|
140
|
-
this.reservedInfo = infoBonus;
|
141
|
-
if (customization.keepStoreFrontStyle) {
|
142
|
-
console.log('[bc:usar estilo da loja]');
|
143
|
-
this.styles = null;
|
144
|
-
}
|
145
|
-
}
|
146
|
-
async fetchCustomer(userId, storeName) {
|
147
|
-
try {
|
148
|
-
return await this.crmBonusService.getCustomer(userId, storeName);
|
149
|
-
}
|
150
|
-
catch (error) {
|
151
|
-
console.error('[fetchCustomer] Error fetching customer:', error);
|
152
|
-
return null;
|
153
|
-
}
|
154
|
-
}
|
155
|
-
async handleLoad() {
|
156
|
-
try {
|
157
|
-
if (this.cartWake.user.id) {
|
158
|
-
this.fetchCustomer(this.cartWake.user.id, this.cartWake.store.name).then((customer) => {
|
159
|
-
console.log('[bc:loading customer]');
|
160
|
-
if (customer) {
|
161
|
-
this.customer = customer;
|
162
|
-
console.log('customer', this.customer);
|
163
|
-
}
|
164
|
-
});
|
165
|
-
}
|
166
|
-
const amount = localStorage.getItem(this.cartWake.id);
|
167
|
-
if (amount) {
|
168
|
-
this.canCancel = true;
|
169
|
-
this.amountCancel = amount;
|
170
|
-
}
|
171
|
-
await this.buildAndGetProducts(this.cartWake.products);
|
172
|
-
}
|
173
|
-
catch (error) {
|
174
|
-
console.log('info customer');
|
175
|
-
}
|
176
|
-
}
|
177
|
-
async loadSession() {
|
178
|
-
this.cartWake = this.cart ? new CartWake(JSON.parse(this.cart)) : await getCart();
|
179
|
-
console.log('[bc:carregou carrinho]');
|
180
|
-
this.session = await this.crmBonusService.getToken(this.cartWake.store.name);
|
181
|
-
console.log('[bc:carregou session]');
|
182
|
-
setTimeout(() => {
|
183
|
-
this.loadSession();
|
184
|
-
}, 1500000);
|
185
|
-
}
|
186
|
-
async buildAndGetProducts(productsWake) {
|
187
|
-
console.log();
|
188
|
-
const key = `bc-products:${this.cartWake.id}`;
|
189
|
-
const productsString = JSON.stringify(productsWake);
|
190
|
-
localStorage.setItem(key, productsString);
|
191
|
-
const products_in_cache = JSON.parse(localStorage.getItem(key));
|
192
|
-
const products = [];
|
193
|
-
for (const product_cart of productsWake) {
|
194
|
-
const [pro] = products_in_cache.filter(p => p.ProdutoVarianteId == product_cart.ProdutoVarianteId);
|
195
|
-
//const [ajuste = { Valor: 0 }] = pro.Ajustes.filter(aj => aj.Tipo === "Formula")
|
196
|
-
if (pro) {
|
197
|
-
products.push(Object.assign(Object.assign({}, product_cart), { PrecoPor: pro.PrecoPor, PrecoDe: pro.PrecoDe, Quantidade: pro.Quantidade, Ajustes: pro.Ajustes }));
|
198
|
-
}
|
199
|
-
else {
|
200
|
-
products.push(product_cart);
|
201
|
-
}
|
202
|
-
}
|
203
|
-
this.cartWake.products = products; //cache_products ? JSON.parse(cache_products) : JSON.parse(this.productsInString);
|
204
|
-
}
|
205
|
-
async sendPin(phone) {
|
206
|
-
var _a, _b;
|
207
|
-
this.loading = true;
|
208
|
-
this.message = "";
|
209
|
-
try {
|
210
|
-
const _phone = phone.replace(/\D/g, '');
|
211
|
-
this.phone = Number(_phone);
|
212
|
-
this.sent = await this.crmBonusService.sendPin(this.phone, this.customer.name, this.cartWake.store.name);
|
213
|
-
await this.crmBonusRef.setStep(StepFormEnum.STEP_PIN);
|
214
|
-
this.showModal = true;
|
215
|
-
}
|
216
|
-
catch (error) {
|
217
|
-
this.message = (_b = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.message;
|
218
|
-
}
|
219
|
-
finally {
|
220
|
-
this.loading = false;
|
221
|
-
}
|
222
|
-
}
|
223
|
-
async sendPinName(customerName) {
|
224
|
-
var _a, _b;
|
225
|
-
this.loading = true;
|
226
|
-
this.message = "";
|
227
|
-
try {
|
228
|
-
this.customer.name = customerName;
|
229
|
-
this.sent = await this.crmBonusService.sendPin(this.phone, this.customer.name, this.cartWake.store.name);
|
230
|
-
await this.crmBonusRef.setStep(StepFormEnum.STEP_PIN);
|
231
|
-
this.showModal = true;
|
232
|
-
}
|
233
|
-
catch (error) {
|
234
|
-
this.message = (_b = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.message;
|
235
|
-
}
|
236
|
-
finally {
|
237
|
-
this.loading = false;
|
238
|
-
}
|
17
|
+
await this.loadCheckout();
|
239
18
|
}
|
240
|
-
|
241
|
-
|
242
|
-
}
|
243
|
-
handleCloseModal() {
|
244
|
-
this.showModal = false;
|
245
|
-
}
|
246
|
-
save(amount) {
|
247
|
-
localStorage.setItem(this.cartWake.id, amount.toString());
|
248
|
-
this.canCancel = true;
|
249
|
-
this.amountCancel = amount.toString();
|
250
|
-
}
|
251
|
-
async cancel() {
|
252
|
-
this.message = "";
|
253
|
-
this.loading = true;
|
254
|
-
try {
|
255
|
-
await this.crmBonusService.cancel(this.cartWake.id);
|
256
|
-
this.canCancel = false;
|
257
|
-
localStorage.removeItem(this.cartWake.id);
|
258
|
-
}
|
259
|
-
catch (error) {
|
260
|
-
this.message = "Não consegui cancelar o bônus, tente novamente!";
|
261
|
-
}
|
262
|
-
finally {
|
263
|
-
this.loading = false;
|
264
|
-
}
|
265
|
-
}
|
266
|
-
async handleSendPin(phone) {
|
267
|
-
this.message = "";
|
268
|
-
if (!phone) {
|
269
|
-
this.message = "Informe seu telefone";
|
270
|
-
return;
|
271
|
-
}
|
272
|
-
this.customer.phone = phone;
|
273
|
-
const _phone = phone.replace(/\D/g, '');
|
274
|
-
this.phone = Number(_phone);
|
275
|
-
if (this.customer.name) {
|
276
|
-
return this.sendPin(phone);
|
277
|
-
}
|
278
|
-
await this.crmBonusRef.setStep(StepFormEnum.STEP_NAME);
|
279
|
-
this.showModal = true;
|
19
|
+
async loadCheckout() {
|
20
|
+
this.cartWake = await getCart();
|
280
21
|
}
|
281
22
|
render() {
|
282
|
-
|
283
|
-
|
284
|
-
}
|
285
|
-
return (h("loading-container", { loading: this.loading_reprocess }, h("crm-giftback-form", { customStyles: this.styles, style: { position: "relative" }, ref: ref => this.crmBonusRef = ref, storeName: this.cartWake.store.name, products: this.buildProducts(), cartId: this.cartWake.id, customer: this.customer, loadProducts: () => this.buildProducts(), loadAll: () => this.handleLoad(), reservedInfo: this.reservedInfo })));
|
23
|
+
console.log('this.cartWake', this.cartWake);
|
24
|
+
return (h("div", { key: 'cc9dc7fa4262bf6cb5df716164ee9413f9a3bc6f' }, h("loading-container", { key: '4d5ff4d93a3769e609b630cc0760043458990e64', loading: this.loading }, h("h3", { key: 'f7f60857813f42b2735cc3ee6e73523fb4018f2b' }, "CARREGANDO...")), this.cartWake && (h("div", { key: 'bb86c641b03cbf94e50560a3d0d62d022cb80499' }, this.cartWake.id))));
|
286
25
|
}
|
287
26
|
static get assetsDirs() { return ["assets"]; }
|
288
27
|
static get style() { return CrmBonus2Style0; }
|
289
28
|
}, [1, "crm-bonus-2", {
|
290
|
-
"cart": [8],
|
291
|
-
"canhidden": [4],
|
292
|
-
"showModal": [32],
|
293
|
-
"cartWake": [32],
|
294
|
-
"customer": [32],
|
295
29
|
"loading": [32],
|
296
|
-
"
|
297
|
-
"phone": [32],
|
298
|
-
"canCancel": [32],
|
299
|
-
"amountCancel": [32],
|
300
|
-
"sent": [32],
|
301
|
-
"session": [32],
|
302
|
-
"loading_reprocess": [32],
|
303
|
-
"styles": [32],
|
304
|
-
"reservedInfo": [32],
|
305
|
-
"resetBonus": [64],
|
306
|
-
"setloading": [64],
|
307
|
-
"reprocess": [64]
|
30
|
+
"cartWake": [32]
|
308
31
|
}]);
|
309
32
|
function defineCustomElement$1() {
|
310
33
|
if (typeof customElements === "undefined") {
|
311
34
|
return;
|
312
35
|
}
|
313
|
-
const components = ["crm-bonus-2", "
|
36
|
+
const components = ["crm-bonus-2", "loading-container"];
|
314
37
|
components.forEach(tagName => { switch (tagName) {
|
315
38
|
case "crm-bonus-2":
|
316
39
|
if (!customElements.get(tagName)) {
|
317
40
|
customElements.define(tagName, CrmBonus);
|
318
41
|
}
|
319
42
|
break;
|
320
|
-
case "countdown-timer":
|
321
|
-
if (!customElements.get(tagName)) {
|
322
|
-
defineCustomElement$b();
|
323
|
-
}
|
324
|
-
break;
|
325
|
-
case "crm-button":
|
326
|
-
if (!customElements.get(tagName)) {
|
327
|
-
defineCustomElement$a();
|
328
|
-
}
|
329
|
-
break;
|
330
|
-
case "crm-giftback-form":
|
331
|
-
if (!customElements.get(tagName)) {
|
332
|
-
defineCustomElement$9();
|
333
|
-
}
|
334
|
-
break;
|
335
|
-
case "crm-tooltip":
|
336
|
-
if (!customElements.get(tagName)) {
|
337
|
-
defineCustomElement$8();
|
338
|
-
}
|
339
|
-
break;
|
340
|
-
case "giftback-info":
|
341
|
-
if (!customElements.get(tagName)) {
|
342
|
-
defineCustomElement$7();
|
343
|
-
}
|
344
|
-
break;
|
345
43
|
case "loading-container":
|
346
|
-
if (!customElements.get(tagName)) {
|
347
|
-
defineCustomElement$6();
|
348
|
-
}
|
349
|
-
break;
|
350
|
-
case "loading-spinner":
|
351
|
-
if (!customElements.get(tagName)) {
|
352
|
-
defineCustomElement$5();
|
353
|
-
}
|
354
|
-
break;
|
355
|
-
case "phone-form":
|
356
|
-
if (!customElements.get(tagName)) {
|
357
|
-
defineCustomElement$4();
|
358
|
-
}
|
359
|
-
break;
|
360
|
-
case "phone-input-mask":
|
361
|
-
if (!customElements.get(tagName)) {
|
362
|
-
defineCustomElement$3();
|
363
|
-
}
|
364
|
-
break;
|
365
|
-
case "pin-form":
|
366
44
|
if (!customElements.get(tagName)) {
|
367
45
|
defineCustomElement$2();
|
368
46
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"file":"crm-bonus-2.js","mappings":";;;;;;;;;;;;;;;;AAAA,MAAM,WAAW,GAAG,o8BAAo8B,CAAC;AACz9B,wBAAe,WAAW;;MCmBb,QAAQ;;;;;QAEX,oBAAe,GAAoB,eAAe,CAAC,WAAW,EAAE,CAAC;;yBAK5C,KAAK;yBAEJ,KAAK;;wBAIJ;YAC7B,SAAS,EAAE,EAAE;YACb,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,EAAE;YACR,KAAK,EAAE,EAAE;SACV;uBAE2B,KAAK;;;yBAGH,KAAK;;;;iCAKN,KAAK;sBAChB,aAAa;;;IAI/B,MAAM,UAAU;QACd,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;QAExC,IAAI;YACF,MAAM,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,CAAC,CAAC;YAChE,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;SACtC;QAAC,OAAO,GAAG,EAAE;YAEZ,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;YACrB,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;YAC7C,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;SACzD;gBAAS;YACR,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;SACtB;KACF;IAGD,MAAM,UAAU;QACd,IAAI,CAAC,iBAAiB,GAAG,CAAC,IAAI,CAAC,iBAAiB,CAAC;KAClD;IAGD,MAAM,SAAS;QACb,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;QACrC,IAAI,CAA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CAAC,IAAI,EACnC,QAAQ,EAAE,IAAI,CAAC,aAAa,EAAE,EAC9B,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,EACxB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,YAAY,EAAE,MAAM,IAAI,CAAC,aAAa,EAAE,EACxC,OAAO,EAAE,MAAM,IAAI,CAAC,UAAU,EAAE,EAChC,YAAY,EAAE,IAAI,CAAC,YAAY,GAC/B,CACgB,EACrB;KACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["i18next"],"sources":["src/components/crm-bonus/crm-bonus.css?tag=crm-bonus-2&encapsulation=shadow","src/components/crm-bonus/crm-bonus.tsx"],"sourcesContent":["\r\n.container-button {\r\n /* max-width: 100%; */\r\n cursor: pointer;\r\n padding: 5px 5px 5px 14px;\r\n /* display: flex; */\r\n}\r\n\r\n/* padding: 0 15px 15px;\r\nborder: 1px solid #ddd;\r\nmargin-bottom: 20px; */\r\n\r\n.section-crm {\r\n border: 1px solid #dbd4d4;\r\n /* min-height: 50px; */\r\n text-align: -webkit-center;\r\n margin-bottom: 20px;\r\n}\r\n\r\n.section-cart-crm {\r\n margin-top: 10px;\r\n}\r\n\r\n.section-cart-crm p {\r\n padding: 0;\r\n margin: 0px 0px 0px 15px;\r\n}\r\n\r\n.button {\r\n top: 50%;\r\n background-color: #6c6c7e;\r\n color: #fff;\r\n border: none;\r\n /* border-radius: 10px; */\r\n padding: 15px;\r\n min-height: 30px;\r\n min-width: 120px;\r\n /* font-size: 20px; */\r\n cursor: pointer;\r\n margin-left: 10px;\r\n height: 70px;\r\n}\r\n\r\n.form-container {\r\n width: 97%;\r\n display: flex;\r\n justify-content: space-around;\r\n}\r\n\r\n\r\n.btn {\r\n display: inline-block;\r\n padding: 6px 12px;\r\n margin-bottom: 0;\r\n /* font-size: 14px; */\r\n font-weight: 400;\r\n line-height: 1.42857143;\r\n text-align: center;\r\n white-space: nowrap;\r\n vertical-align: middle;\r\n -ms-touch-action: manipulation;\r\n touch-action: manipulation;\r\n cursor: pointer;\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n background-image: none;\r\n border: 1px solid transparent;\r\n border-radius: 0px;\r\n}\r\n\r\n.form-container .btnCrm {\r\n background: #00162e;\r\n border-color: #00162e;\r\n width: 30%;\r\n color: #fff;\r\n}\r\n\r\n.message-alert {\r\n color: #df4d4d;\r\n margin-top: 5px;\r\n}","import { Component, Method, Prop, State, h } from '@stencil/core';\r\nimport { IProduct, IProductWake, ICustomer } from '../../dto/validate.pin.bonus';\r\nimport { CrmBonusService } from '../../services/crmbonus.service';\r\nimport { IPinSent } from '../../components';\r\nimport { defaultStyles, StepFormEnum } from '../../contants';\r\n\r\nimport i18next from '../../i18n/i18n'\r\nimport { buildProductsByWake } from '../../helpers/build.payload.helper';\r\nimport { getCart, getInfoBonusByCartIdAndStoreName } from '../../helpers/cart.helper';\r\nimport { CartWake } from '../../objectvalues/cart.wake';\r\nimport { USED_KEY } from '../../utils/keys.storage';\r\nimport { ReservedInfoDTO } from '../../dto/reserved-info.dto';\r\n\r\n@Component({\r\n tag: 'crm-bonus-2',\r\n styleUrl: 'crm-bonus.css',\r\n assetsDirs: ['assets'],\r\n // scoped: true\r\n shadow: true\r\n})\r\nexport class CrmBonus {\r\n\r\n private crmBonusService: CrmBonusService = CrmBonusService.getInstance();\r\n\r\n private crmBonusRef: HTMLCrmGiftbackFormElement;\r\n\r\n @Prop() cart;\r\n @Prop() canhidden: boolean = false;\r\n\r\n @State() showModal: boolean = false;\r\n\r\n @State() cartWake: CartWake;\r\n\r\n @State() customer: ICustomer = {\r\n birthDate: \"\",\r\n document: \"\",\r\n name: \"\",\r\n phone: \"\"\r\n };\r\n\r\n @State() loading: boolean = false;\r\n @State() message: string;\r\n @State() phone: number;\r\n @State() canCancel: boolean = false;\r\n @State() amountCancel: string;\r\n @State() sent: IPinSent;\r\n\r\n @State() session: string;\r\n @State() loading_reprocess = false;\r\n @State() styles = defaultStyles;\r\n @State() reservedInfo: ReservedInfoDTO;\r\n\r\n @Method()\r\n async resetBonus() {\r\n console.log('[START RESET BONUS]!!!!!');\r\n\r\n try {\r\n await this.crmBonusRef.processBonus(this.buildProducts(), true);\r\n console.log('[BONUS RESETADO]!!!!!');\r\n } catch (err) {\r\n\r\n this.loading = false;\r\n console.log('[error ao reprocessar bonous]');\r\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PHONE);\r\n } finally {\r\n this.loading = false;\r\n }\r\n }\r\n\r\n @Method()\r\n async setloading() {\r\n this.loading_reprocess = !this.loading_reprocess;\r\n }\r\n\r\n @Method()\r\n async reprocess() {\r\n console.log(\"[CRMBONUS] - reprocess\")\r\n this.loading_reprocess = true\r\n\r\n try {\r\n\r\n const isUse = localStorage.getItem(USED_KEY);\r\n\r\n if (!isUse) return;\r\n\r\n this.cartWake = await getCart();\r\n await this.resetBonus();\r\n } catch (err) {\r\n console.debug('[watchProducts]', err.message);\r\n } finally {\r\n this.loading_reprocess = false\r\n }\r\n }\r\n\r\n async componentWillLoad() {\r\n\r\n window.addEventListener('productRemovedFromCart', async () => {\r\n console.log('[CRMBONUS] - productRemovedFromCart');\r\n await this.reprocess()\r\n });\r\n\r\n window.addEventListener('productAddedToCart', async () => {\r\n console.log('[CRMBONUS] - productAddedToCart');\r\n await this.reprocess();\r\n });\r\n\r\n document.querySelectorAll('form').forEach((el) => {\r\n el.addEventListener(\"submit\", () => {\r\n console.log(\"[CRMBONUS] - Formulário está sendo submetido!\");\r\n // você pode marcar como \"em submissão\" aqui\r\n setTimeout(async () => {\r\n await this.reprocess();\r\n })\r\n });\r\n });\r\n\r\n await this.observerHandle();\r\n\r\n i18next.changeLanguage(i18next.language);\r\n\r\n await this.loadSession();\r\n\r\n this.handleLoad();\r\n await this.loadConfigStore()\r\n }\r\n\r\n async componentDidLoad() {\r\n console.log('[did load]');\r\n \r\n }\r\n\r\n private async observerHandle() {\r\n const elements = document.getElementsByTagName('a');\r\n\r\n //@ts-ignore\r\n for (let el of elements) {\r\n console.log('[el.href]', el.href);\r\n if (el.href.includes('Produto/Delete')) {\r\n el.addEventListener('click', async () => {\r\n console.log('[CRMBONUS] - Produto removido do carrinho');\r\n\r\n setTimeout(async () => {\r\n await this.reprocess();\r\n this.observerHandle();\r\n }, 2000);\r\n\r\n });\r\n }\r\n\r\n if (el.href.includes('Produto/Add')) {\r\n el.addEventListener('click', async () => {\r\n console.log('[CRMBONUS] - Produto adicionado ao carrinho');\r\n setTimeout(async () => {\r\n await this.reprocess();\r\n this.observerHandle();\r\n }, 2000);\r\n });\r\n }\r\n }\r\n }\r\n\r\n async loadConfigStore() {\r\n\r\n const [customization, infoBonus] = await Promise.all([\r\n this.crmBonusService.getCustomization(this.cartWake.store.name),\r\n getInfoBonusByCartIdAndStoreName(this.cartWake.id, this.cartWake.store.name)\r\n ]);\r\n\r\n console.log('[infoBonus]', infoBonus);\r\n\r\n this.reservedInfo = infoBonus;\r\n\r\n if (customization.keepStoreFrontStyle) {\r\n console.log('[bc:usar estilo da loja]');\r\n this.styles = null;\r\n }\r\n }\r\n\r\n async fetchCustomer(userId: number, storeName: string) {\r\n try {\r\n return await this.crmBonusService.getCustomer(userId, storeName);\r\n } catch (error) {\r\n console.error('[fetchCustomer] Error fetching customer:', error);\r\n return null;\r\n }\r\n }\r\n\r\n async handleLoad() {\r\n try {\r\n if (this.cartWake.user.id) {\r\n this.fetchCustomer(this.cartWake.user.id, this.cartWake.store.name).then((customer) => {\r\n console.log('[bc:loading customer]');\r\n if (customer) {\r\n this.customer = customer;\r\n console.log('customer', this.customer);\r\n }\r\n });\r\n }\r\n\r\n const amount = localStorage.getItem(this.cartWake.id);\r\n\r\n if (amount) {\r\n this.canCancel = true;\r\n this.amountCancel = amount;\r\n }\r\n\r\n await this.buildAndGetProducts(this.cartWake.products);\r\n } catch (error) {\r\n console.log('info customer')\r\n }\r\n }\r\n\r\n async loadSession() {\r\n this.cartWake = this.cart ? new CartWake(JSON.parse(this.cart)) : await getCart();\r\n console.log('[bc:carregou carrinho]');\r\n\r\n this.session = await this.crmBonusService.getToken(this.cartWake.store.name);\r\n console.log('[bc:carregou session]');\r\n setTimeout(() => {\r\n this.loadSession()\r\n }, 1500000)\r\n }\r\n\r\n async buildAndGetProducts(productsWake: IProductWake[]) {\r\n console.log()\r\n\r\n const key = `bc-products:${this.cartWake.id}`;\r\n\r\n const productsString = JSON.stringify(productsWake)\r\n\r\n localStorage.setItem(key, productsString);\r\n\r\n const products_in_cache = JSON.parse(localStorage.getItem(key));\r\n\r\n const products: Array<IProductWake> = []\r\n\r\n for (const product_cart of productsWake) {\r\n\r\n const [pro] = products_in_cache.filter(p => p.ProdutoVarianteId == product_cart.ProdutoVarianteId)\r\n\r\n //const [ajuste = { Valor: 0 }] = pro.Ajustes.filter(aj => aj.Tipo === \"Formula\")\r\n\r\n if (pro) {\r\n products.push({\r\n ...product_cart,\r\n PrecoPor: pro.PrecoPor,\r\n PrecoDe: pro.PrecoDe,\r\n Quantidade: pro.Quantidade,\r\n Ajustes: pro.Ajustes\r\n })\r\n } else {\r\n products.push(product_cart)\r\n }\r\n\r\n }\r\n\r\n this.cartWake.products = products; //cache_products ? JSON.parse(cache_products) : JSON.parse(this.productsInString);\r\n\r\n }\r\n\r\n public async sendPin(phone: string) {\r\n this.loading = true;\r\n this.message = \"\";\r\n\r\n try {\r\n\r\n const _phone = phone.replace(/\\D/g, '');\r\n this.phone = Number(_phone);\r\n\r\n this.sent = await this.crmBonusService.sendPin(this.phone, this.customer.name, this.cartWake.store.name);;\r\n\r\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PIN);\r\n\r\n this.showModal = true;\r\n } catch (error) {\r\n this.message = error?.response?.data?.message\r\n } finally {\r\n this.loading = false\r\n }\r\n }\r\n\r\n public async sendPinName(customerName: string) {\r\n this.loading = true;\r\n this.message = \"\";\r\n\r\n try {\r\n this.customer.name = customerName;\r\n\r\n this.sent = await this.crmBonusService.sendPin(this.phone, this.customer.name, this.cartWake.store.name);\r\n\r\n await this.crmBonusRef.setStep(StepFormEnum.STEP_PIN);\r\n\r\n this.showModal = true;\r\n } catch (error) {\r\n this.message = error?.response?.data?.message\r\n } finally {\r\n this.loading = false\r\n }\r\n }\r\n\r\n buildProducts(): IProduct[] {\r\n return buildProductsByWake(this.cartWake.products);\r\n }\r\n\r\n handleCloseModal() {\r\n this.showModal = false;\r\n }\r\n\r\n save(amount: number) {\r\n localStorage.setItem(this.cartWake.id, amount.toString());\r\n this.canCancel = true;\r\n this.amountCancel = amount.toString()\r\n }\r\n\r\n async cancel() {\r\n this.message = \"\";\r\n this.loading = true;\r\n try {\r\n await this.crmBonusService.cancel(this.cartWake.id);\r\n this.canCancel = false;\r\n\r\n localStorage.removeItem(this.cartWake.id);\r\n } catch (error) {\r\n this.message = \"Não consegui cancelar o bônus, tente novamente!\"\r\n } finally {\r\n this.loading = false;\r\n }\r\n }\r\n\r\n async handleSendPin(phone: string) {\r\n this.message = \"\"\r\n if (!phone) {\r\n this.message = \"Informe seu telefone\";\r\n return;\r\n }\r\n\r\n this.customer.phone = phone;\r\n const _phone = phone.replace(/\\D/g, '');\r\n this.phone = Number(_phone);\r\n\r\n if (this.customer.name) {\r\n return this.sendPin(phone)\r\n }\r\n\r\n await this.crmBonusRef.setStep(StepFormEnum.STEP_NAME);\r\n this.showModal = true;\r\n }\r\n\r\n render() {\r\n\r\n if (this.canhidden) {\r\n return null;\r\n }\r\n\r\n return (\r\n <loading-container loading={this.loading_reprocess} >\r\n <crm-giftback-form\r\n customStyles={this.styles}\r\n style={{ position: \"relative\" }}\r\n ref={ref => this.crmBonusRef = ref}\r\n storeName={this.cartWake.store.name}\r\n products={this.buildProducts()}\r\n cartId={this.cartWake.id}\r\n customer={this.customer}\r\n loadProducts={() => this.buildProducts()}\r\n loadAll={() => this.handleLoad()}\r\n reservedInfo={this.reservedInfo}\r\n />\r\n </loading-container>\r\n )\r\n }\r\n}\r\n"],"version":3}
|
1
|
+
{"file":"crm-bonus-2.js","mappings":";;;;AAAA,MAAM,WAAW,GAAG,o8BAAo8B,CAAC;AACz9B,wBAAe,WAAW;;MCUb,QAAQ;;;;;uBAEE,KAAK;;;IAIxB,MAAM,gBAAgB;QAClB,MAAM,IAAI,CAAC,YAAY,EAAE,CAAA;KAC5B;IAED,MAAM,YAAY;QACd,IAAI,CAAC,QAAQ,GAAG,MAAM,OAAO,EAAE,CAAC;KACnC;IAED,MAAM;QAEF,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;QAE3C,QACI,8DACI,0EAAmB,OAAO,EAAE,IAAI,CAAC,OAAO,IACpC,6EAAsB,CACN,EAEhB,IAAI,CAAC,QAAQ,KACT,8DACK,IAAI,CAAC,QAAQ,CAAC,EAAE,CACf,CACT,CAEH,EAET;KACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/crm-bonus/crm-bonus.css?tag=crm-bonus-2&encapsulation=shadow","src/components/crm-bonus/crmbonus.tsx"],"sourcesContent":["\r\n.container-button {\r\n /* max-width: 100%; */\r\n cursor: pointer;\r\n padding: 5px 5px 5px 14px;\r\n /* display: flex; */\r\n}\r\n\r\n/* padding: 0 15px 15px;\r\nborder: 1px solid #ddd;\r\nmargin-bottom: 20px; */\r\n\r\n.section-crm {\r\n border: 1px solid #dbd4d4;\r\n /* min-height: 50px; */\r\n text-align: -webkit-center;\r\n margin-bottom: 20px;\r\n}\r\n\r\n.section-cart-crm {\r\n margin-top: 10px;\r\n}\r\n\r\n.section-cart-crm p {\r\n padding: 0;\r\n margin: 0px 0px 0px 15px;\r\n}\r\n\r\n.button {\r\n top: 50%;\r\n background-color: #6c6c7e;\r\n color: #fff;\r\n border: none;\r\n /* border-radius: 10px; */\r\n padding: 15px;\r\n min-height: 30px;\r\n min-width: 120px;\r\n /* font-size: 20px; */\r\n cursor: pointer;\r\n margin-left: 10px;\r\n height: 70px;\r\n}\r\n\r\n.form-container {\r\n width: 97%;\r\n display: flex;\r\n justify-content: space-around;\r\n}\r\n\r\n\r\n.btn {\r\n display: inline-block;\r\n padding: 6px 12px;\r\n margin-bottom: 0;\r\n /* font-size: 14px; */\r\n font-weight: 400;\r\n line-height: 1.42857143;\r\n text-align: center;\r\n white-space: nowrap;\r\n vertical-align: middle;\r\n -ms-touch-action: manipulation;\r\n touch-action: manipulation;\r\n cursor: pointer;\r\n -webkit-user-select: none;\r\n -moz-user-select: none;\r\n -ms-user-select: none;\r\n user-select: none;\r\n background-image: none;\r\n border: 1px solid transparent;\r\n border-radius: 0px;\r\n}\r\n\r\n.form-container .btnCrm {\r\n background: #00162e;\r\n border-color: #00162e;\r\n width: 30%;\r\n color: #fff;\r\n}\r\n\r\n.message-alert {\r\n color: #df4d4d;\r\n margin-top: 5px;\r\n}","import { Component, h, State } from \"@stencil/core\";\r\nimport { CartWake } from \"../../objectvalues/cart.wake\";\r\nimport { getCart } from \"../../helpers/cart.helper\";\r\n\r\n@Component({\r\n tag: 'crm-bonus-2',\r\n styleUrl: 'crm-bonus.css',\r\n assetsDirs: ['assets'],\r\n // scoped: true\r\n shadow: true\r\n})\r\nexport class CrmBonus {\r\n\r\n @State() loading = false;\r\n\r\n @State() cartWake: CartWake;\r\n\r\n async componentDidLoad() {\r\n await this.loadCheckout()\r\n }\r\n\r\n async loadCheckout() {\r\n this.cartWake = await getCart();\r\n }\r\n\r\n render() {\r\n\r\n console.log('this.cartWake', this.cartWake)\r\n\r\n return (\r\n <div>\r\n <loading-container loading={this.loading}>\r\n <h3>CARREGANDO...</h3>\r\n </loading-container>\r\n {\r\n this.cartWake && (\r\n <div>\r\n {this.cartWake.id}\r\n </div>\r\n )\r\n }\r\n </div>\r\n\r\n )\r\n }\r\n}"],"version":3}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { p as proxyCustomElement, H, h } from './p-9d950d25.js';
|
2
2
|
import { g as getInfoCustomization } from './p-1b441909.js';
|
3
|
-
import { C as CrmBonusService, b as CartWake, g as getCart, a as getInfoBonusByCartIdAndStoreName, c as getKeyReserveByCartId } from './p-
|
3
|
+
import { C as CrmBonusService, b as CartWake, g as getCart, a as getInfoBonusByCartIdAndStoreName, c as getKeyReserveByCartId } from './p-c90ea2e9.js';
|
4
4
|
import { i as instance } from './p-c53241bf.js';
|
5
5
|
import { d as defaultStyles } from './p-ecc51430.js';
|
6
|
-
import { b as buildProductsByWake } from './p-
|
6
|
+
import { b as buildProductsByWake } from './p-b0ef2c0b.js';
|
7
7
|
import { d as defineCustomElement$2 } from './p-c5be72a0.js';
|
8
8
|
|
9
9
|
const moneyDollarsSvgrepoComSvg = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPg0KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxjaXJjbGUgY3g9IjEyIiBjeT0iMTIiIHI9IjEwIiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS13aWR0aD0iMiIvPg0KPHBhdGggZD0iTTE1IDkuOTQ3MjhDMTQuNSA5LjMgMTMuOCA4LjUgMTIgOC41QzEwLjIgOC41IDkgOS41MTM5MyA5IDkuOTQ3MjhDOSAxMC4zODA2IDkuMDY3ODYgMTAuOTI3NyAxMCAxMS41QzEwLjc1MjIgMTEuOTYxOCAxMi42Njg0IDEyLjA0MzkgMTMuNSAxMi41QzE0LjY3OSAxMy4xNDY3IDE0Ljg0OTcgMTMuODIwMiAxNC44NDk3IDE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