-
Notifications
You must be signed in to change notification settings - Fork 1
/
bundle.js
94 lines (83 loc) · 2.47 KB
/
bundle.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import Promise from 'promise-polyfill';
import merge from 'lodash.merge';
import EnderecoIntegrator from './modules/integrator';
import css from './themes/default-theme.scss';
if ('NodeList' in window && !NodeList.prototype.forEach) {
NodeList.prototype.forEach = function (callback, thisArg) {
thisArg = thisArg || window;
for (var i = 0; i < this.length; i++) {
callback.call(thisArg, this[i], i, this);
}
};
}
if (!window.Promise) {
window.Promise = Promise;
}
EnderecoIntegrator.postfix = {
ams: {
countryCode: '',
postalCode: '',
locality: '',
streetFull: '',
streetName: '',
buildingNumber: '',
addressStatus: '',
addressTimestamp: '',
addressPredictions: '',
additionalInfo: '',
},
personServices: {
salutation: '',
firstName: ''
},
emailServices: {
email: ''
}
};
if (css) {
EnderecoIntegrator.css = css[0][1];
}
EnderecoIntegrator.resolvers.countryCodeWrite = function (value, subscriber) {
return new Promise(function (resolve, reject) {
resolve(value);
});
}
EnderecoIntegrator.resolvers.countryCodeRead = function(value, subscriber) {
return new Promise(function(resolve, reject) {
resolve(value);
});
}
EnderecoIntegrator.resolvers.salutationWrite = function(value, subscriber) {
return new Promise(function(resolve, reject) {
resolve(value);
});
}
EnderecoIntegrator.resolvers.salutationRead = function(value, subscriber) {
return new Promise(function(resolve, reject) {
resolve(value);
});
}
EnderecoIntegrator.amsFilters.isAddressMetaStillRelevant.push((isStillRelevant, EAO) => {
const invalidateAddressForm = document.querySelector('#invalidate-address-form');
if (invalidateAddressForm && invalidateAddressForm.checked) {
isStillRelevant = false;
}
return isStillRelevant;
});
if (window.EnderecoIntegrator) {
window.EnderecoIntegrator = merge(window.EnderecoIntegrator, EnderecoIntegrator);
} else {
window.EnderecoIntegrator = EnderecoIntegrator;
}
window.EnderecoIntegrator.asyncCallbacks.forEach(function(cb) {
cb();
});
window.EnderecoIntegrator.asyncCallbacks = [];
window.EnderecoIntegrator.waitUntilReady().then( function() {
});
var $waitForConfig = setInterval( function() {
if(typeof enderecoLoadAMSConfig === 'function'){
enderecoLoadAMSConfig();
clearInterval($waitForConfig);
}
}, 1);