@salla.sa/twilight-components 1.0.19 → 1.0.21

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.
Files changed (92) hide show
  1. package/dist/{esm → twilight-components}/Helper-d07ebbc7.js +0 -0
  2. package/dist/twilight-components/app-globals-0f993ce5.js +3 -0
  3. package/dist/twilight-components/css-shim-a64b8820.js +4 -0
  4. package/dist/twilight-components/dom-d08ba8aa.js +73 -0
  5. package/dist/twilight-components/index-9c087700.js +3010 -0
  6. package/dist/twilight-components/index.esm.js +4 -1
  7. package/dist/{esm → twilight-components}/salla-branches.entry.js +1 -1
  8. package/dist/twilight-components/salla-button.entry.js +75 -0
  9. package/dist/{esm → twilight-components}/salla-localization.entry.js +1 -1
  10. package/dist/{esm/salla-login-38586400.js → twilight-components/salla-login-57b18c2c.js} +1 -1
  11. package/dist/twilight-components/salla-login.entry.js +3 -0
  12. package/dist/twilight-components/salla-modal.entry.js +113 -0
  13. package/dist/twilight-components/salla-offer.entry.js +75 -0
  14. package/dist/{esm → twilight-components}/salla-product-availability.entry.js +1 -1
  15. package/dist/twilight-components/salla-rating.entry.js +228 -0
  16. package/dist/{esm/salla-search-ca856aab.js → twilight-components/salla-search-30fec1e8.js} +1 -1
  17. package/dist/twilight-components/salla-search.entry.js +3 -0
  18. package/dist/{esm/salla-button_5.entry.js → twilight-components/salla-tel-input.entry.js} +33 -294
  19. package/dist/twilight-components/salla-verify.entry.js +114 -0
  20. package/dist/twilight-components/shadow-css-bc14d9fd.js +389 -0
  21. package/dist/twilight-components/twilight-components.css +3 -1
  22. package/dist/twilight-components/twilight-components.esm.js +125 -1
  23. package/dist/types/components/salla-offer/offer-schema.d.ts +47 -0
  24. package/dist/types/components/salla-offer/salla-offer.d.ts +13 -48
  25. package/dist/types/components/salla-rating/order-feedback-response.d.ts +62 -0
  26. package/dist/types/components/salla-rating/salla-rating.d.ts +25 -23
  27. package/dist/types/components.d.ts +2 -10
  28. package/package.json +1 -1
  29. package/dist/cjs/Helper-fcea994c.js +0 -23
  30. package/dist/cjs/index-4b8b3ffe.js +0 -1696
  31. package/dist/cjs/index.cjs.js +0 -13
  32. package/dist/cjs/loader.cjs.js +0 -21
  33. package/dist/cjs/salla-branches.cjs.entry.js +0 -92
  34. package/dist/cjs/salla-button_5.cjs.entry.js +0 -1686
  35. package/dist/cjs/salla-localization.cjs.entry.js +0 -82
  36. package/dist/cjs/salla-login-008cc893.js +0 -125
  37. package/dist/cjs/salla-offer.cjs.entry.js +0 -50
  38. package/dist/cjs/salla-product-availability.cjs.entry.js +0 -75
  39. package/dist/cjs/salla-rating.cjs.entry.js +0 -300
  40. package/dist/cjs/salla-search-c7aad59a.js +0 -81
  41. package/dist/cjs/salla-search.cjs.entry.js +0 -11
  42. package/dist/cjs/twilight-components.cjs.js +0 -19
  43. package/dist/collection/Helpers/Helper.js +0 -19
  44. package/dist/collection/collection-manifest.json +0 -22
  45. package/dist/collection/components/generate-summary.js +0 -35
  46. package/dist/collection/components/salla-branches/salla-branches.css +0 -12
  47. package/dist/collection/components/salla-branches/salla-branches.js +0 -233
  48. package/dist/collection/components/salla-button/salla-button.css +0 -3
  49. package/dist/collection/components/salla-button/salla-button.js +0 -246
  50. package/dist/collection/components/salla-localization/salla-localization.js +0 -208
  51. package/dist/collection/components/salla-login/salla-login.css +0 -3
  52. package/dist/collection/components/salla-login/salla-login.js +0 -378
  53. package/dist/collection/components/salla-modal/salla-modal.js +0 -459
  54. package/dist/collection/components/salla-offer/salla-offer.js +0 -81
  55. package/dist/collection/components/salla-product-availability/salla-product-availability.js +0 -331
  56. package/dist/collection/components/salla-rating/salla-rating.css +0 -7
  57. package/dist/collection/components/salla-rating/salla-rating.js +0 -483
  58. package/dist/collection/components/salla-search/salla-search.js +0 -132
  59. package/dist/collection/components/salla-tel-input/salla-tel-input.js +0 -14
  60. package/dist/collection/components/salla-verify/salla-verify.js +0 -273
  61. package/dist/collection/index.js +0 -2
  62. package/dist/collection/interfaces/colors.js +0 -1
  63. package/dist/collection/interfaces/index.js +0 -2
  64. package/dist/collection/interfaces/ratio.js +0 -1
  65. package/dist/collection/plugins/tailwind-theme/generator.js +0 -62
  66. package/dist/collection/plugins/tailwind-theme/index.js +0 -26
  67. package/dist/esm/index-092659c7.js +0 -1668
  68. package/dist/esm/index.js +0 -4
  69. package/dist/esm/loader.js +0 -17
  70. package/dist/esm/polyfills/core-js.js +0 -11
  71. package/dist/esm/polyfills/css-shim.js +0 -1
  72. package/dist/esm/polyfills/dom.js +0 -79
  73. package/dist/esm/polyfills/es5-html-element.js +0 -1
  74. package/dist/esm/polyfills/index.js +0 -34
  75. package/dist/esm/polyfills/system.js +0 -6
  76. package/dist/esm/salla-offer.entry.js +0 -46
  77. package/dist/esm/salla-rating.entry.js +0 -296
  78. package/dist/esm/salla-search.entry.js +0 -3
  79. package/dist/esm/twilight-components.js +0 -17
  80. package/dist/index.cjs.js +0 -1
  81. package/dist/index.js +0 -1
  82. package/dist/twilight-components/p-03d0ec44.entry.js +0 -1
  83. package/dist/twilight-components/p-13a55257.entry.js +0 -1
  84. package/dist/twilight-components/p-160062c6.js +0 -1
  85. package/dist/twilight-components/p-47f17d3b.js +0 -1
  86. package/dist/twilight-components/p-5307c7b5.entry.js +0 -1
  87. package/dist/twilight-components/p-6a1f43c6.entry.js +0 -1
  88. package/dist/twilight-components/p-7088e517.entry.js +0 -1
  89. package/dist/twilight-components/p-924e3c88.js +0 -1
  90. package/dist/twilight-components/p-e8965b01.js +0 -1
  91. package/dist/twilight-components/p-ecb1b6cc.entry.js +0 -1
  92. package/dist/twilight-components/p-f11b401a.entry.js +0 -1
@@ -1,1686 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-4b8b3ffe.js');
6
- const Helper = require('./Helper-fcea994c.js');
7
- const sallaLogin = require('./salla-login-008cc893.js');
8
-
9
- const sallaButtonCss = ":host{display:block}";
10
-
11
- const SallaButton = class {
12
- constructor(hostRef) {
13
- index.registerInstance(this, hostRef);
14
- this.btnStyle = 'primary';
15
- this.loading = false;
16
- this.disabled = false;
17
- this.loaderPosition = 'before';
18
- this.wide = false;
19
- this.hostAttributes = {};
20
- //============= Initiate Button Attributes =============//
21
- for (let i = 0; i < this.host.attributes.length; i++) {
22
- this.hostAttributes[this.host.attributes[i].name] = this.host.attributes[i].value;
23
- }
24
- this.hostAttributes.type = this.hostAttributes.type || 'button';
25
- this.hostAttributes.class += ' s-button-btn btn--has-loading'
26
- + ' s-button-' + this.btnStyle
27
- + (this.wide ? ' s-button-wide ' : '')
28
- + ' loader-' + this.loaderPosition
29
- + (this.loaderPosition == 'before' ? ' s-button-loader-after' : '');
30
- delete this.hostAttributes['btn-style'];
31
- delete this.hostAttributes['id'];
32
- if (this.wide) {
33
- this.host.classList.add('s-button-wide');
34
- }
35
- }
36
- async load() {
37
- if (this.loaderPosition == 'center')
38
- this.text.classList.add('s-button-hide');
39
- this.host.setAttribute('loading', '');
40
- return this.host;
41
- }
42
- async stop() {
43
- this.host.removeAttribute('loading');
44
- return this.host;
45
- }
46
- async disable() {
47
- this.host.setAttribute('disabled', '');
48
- }
49
- async enable() {
50
- this.host.removeAttribute('disabled');
51
- }
52
- handleVisible(newKind, oldKind) {
53
- //todo::use united styles
54
- this.btn.classList.remove('btn-' + oldKind);
55
- this.btn.classList.add('btn-' + newKind);
56
- }
57
- handleLoading(newVal) {
58
- //todo::use united styles
59
- Helper.Helper.toggleElement(this.btn, 'btn--is-loading', 'btn--no-loading', () => newVal);
60
- }
61
- render() {
62
- return (
63
- //TODO:: use HOST then fake button behaviours
64
- index.h(index.Host, { class: "s-button-host-tag" }, index.h("button", Object.assign({ ref: btn => this.btn = btn, disabled: this.disabled }, this.hostAttributes), index.h("span", { class: "s-button-text", ref: el => this.text = el }, index.h("slot", null)), this.loading ? index.h("span", { class: {
65
- //todo::use united styles
66
- 's-button-loader': true,
67
- 's-button-loader-start': this.loaderPosition === 'start',
68
- 's-button-loader-end': this.loaderPosition === 'end',
69
- 's-button-loader-center': this.loaderPosition === 'center',
70
- } }) : '')));
71
- }
72
- get host() { return index.getElement(this); }
73
- static get watchers() { return {
74
- "btnStyle": ["handleVisible"],
75
- "loading": ["handleLoading"]
76
- }; }
77
- };
78
- SallaButton.style = sallaButtonCss;
79
-
80
- const SallaModal = class {
81
- constructor(hostRef) {
82
- index.registerInstance(this, hostRef);
83
- this.modalOpened = index.createEvent(this, "modalOpened", 7);
84
- this.modalClosed = index.createEvent(this, "modalClosed", 7);
85
- var _a;
86
- //todo:: unite three colors (error, success, primary) in one prop
87
- this.error = false;
88
- this.success = false;
89
- this.primary = false;
90
- this.isClosable = true;
91
- this.width = 'md';
92
- this.visible = false;
93
- this.isLoading = false;
94
- this.subTitleFirst = false;
95
- this.subTitle = '';
96
- this.icon = '';
97
- this.imageIcon = '';
98
- Helper.Helper.setHost(this.host);
99
- salla.event.on('modal::open', btn => btn.dataset.target == this.host.id && this.show());
100
- salla.event.on('modal::close', btn => btn.dataset.target == this.host.id && this.hide());
101
- this.title = this.host.title;
102
- this.host.removeAttribute('title');
103
- (_a = Helper.Helper.getElement('[slot=body]')) === null || _a === void 0 ? void 0 : _a.classList.add('s-modal-body', 's-modal-' + this.width);
104
- }
105
- handleVisible(newValue) {
106
- if (!newValue) {
107
- this.toggleModal(false);
108
- this.modalClosed.emit();
109
- return;
110
- }
111
- this.host.classList.remove('hidden');
112
- setTimeout(() => this.toggleModal(true)); //small amont of time to running toggle After adding hidden
113
- this.modalOpened.emit();
114
- }
115
- async show() {
116
- this.host.setAttribute('visible', '');
117
- return this.host;
118
- }
119
- async hide() {
120
- this.host.removeAttribute('visible');
121
- return this.host;
122
- }
123
- async setTitle(title) {
124
- this.title = title;
125
- return this.host;
126
- }
127
- async loading() {
128
- this.isLoading = true;
129
- return this.host;
130
- }
131
- async stopLoading() {
132
- this.isLoading = false;
133
- return this.host;
134
- }
135
- toggleModal(isOpen) {
136
- Helper.Helper
137
- // .toggleElement(this.host.querySelector('.s-modal-body'), 's-modal-entering', 's-modal-leaving', () => isOpen)
138
- .toggleElement(this.host.querySelector('[slot=body]') || this.host, 's-modal-entering', 's-modal-leaving', () => isOpen)
139
- .toggleElement(this.overlay, 's-modal-entering', 's-modal-overlay-leaving', () => isOpen)
140
- //todo:: use united class names
141
- .toggleElement(document.body, 'modal-is-open', 'modal-is-closed', () => isOpen);
142
- if (!isOpen) {
143
- setTimeout(() => this.host.classList.add('hidden'), 350);
144
- }
145
- }
146
- closeModal() {
147
- if (!this.isClosable) {
148
- return;
149
- }
150
- this.host.removeAttribute('visible');
151
- }
152
- //todo:: pref for each modal
153
- render() {
154
- this.host.id = this.host.id || 'salla-modal';
155
- return (
156
- //todo:: use suitable class name instead of hidden
157
- index.h(index.Host, { class: 's-modal-container hidden', "aria-modal": "true", role: "dialog" }, index.h("div", { class: "s-modal-wrapper" }, index.h("div", { class: "s-modal-overlay", ref: el => this.overlay = el, onClick: () => this.closeModal() }), index.h("span", { class: "s-modal-spacer" }, "\u200B"), index.h("slot", { name: "body" }, index.h("div", { class: 's-modal-body ' + 's-modal-' + this.width, slot: "body" }, this.isLoading
158
- ? index.h("span", null, "Loading...")
159
- : [index.h("div", { class: { 's-modal-header': true, 's-modal-is-center': this.icon != '' || this.imageIcon != '' } }, this.isClosable ?
160
- //todo:: remove cursor-pointer
161
- index.h("button", { class: "s-modal-close cursor-pointer", onClick: () => this.closeModal(), type: "button" }, index.h("span", { class: "sicon-cancel" }))
162
- : '', this.error || this.success || this.icon
163
- ? index.h("div", { class: {
164
- 's-modal-icon': true,
165
- 's-modal-bg-error': this.error,
166
- 's-modal-bg-success': this.success,
167
- 's-modal-bg-normal': !this.error && !this.success,
168
- 's-modal-bg-primary': this.primary
169
- } }, index.h("i", { class: {
170
- [this.icon]: true,
171
- 's-modal-text-error': this.error,
172
- 's-modal-text-success': this.success,
173
- } }))
174
- : this.imageIcon ?
175
- index.h("img", { class: "s-modal-header-img", src: this.imageIcon })
176
- : '', this.title || this.subTitle ?
177
- index.h("div", { class: "s-modal-header-content" }, index.h("div", { class: { 's-modal-title': true, 's-modal-title-below': this.subTitleFirst }, innerHTML: this.title }), index.h("p", { class: { 's-modal-sub-title': true }, innerHTML: this.subTitle }))
178
- : ''),
179
- index.h("slot", null),
180
- index.h("slot", { name: "footer" })
181
- ])))));
182
- }
183
- get host() { return index.getElement(this); }
184
- static get watchers() { return {
185
- "visible": ["handleVisible"]
186
- }; }
187
- };
188
-
189
- function createCommonjsModule(fn, basedir, module) {
190
- return module = {
191
- path: basedir,
192
- exports: {},
193
- require: function (path, base) {
194
- return commonjsRequire();
195
- }
196
- }, fn(module, module.exports), module.exports;
197
- }
198
-
199
- function commonjsRequire () {
200
- throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
201
- }
202
-
203
- var intlTelInput$1 = createCommonjsModule(function (module) {
204
- /*
205
- * International Telephone Input v17.0.15
206
- * https://github.com/jackocnr/intl-tel-input.git
207
- * Licensed under the MIT license
208
- */
209
-
210
- // wrap in UMD
211
- (function(factory) {
212
- if (module.exports) module.exports = factory(); else window.intlTelInput = factory();
213
- })(function(undefined$1) {
214
- return function() {
215
- // Array of country objects for the flag dropdown.
216
- // Here is the criteria for the plugin to support a given country/territory
217
- // - It has an iso2 code: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
218
- // - It has it's own country calling code (it is not a sub-region of another country): https://en.wikipedia.org/wiki/List_of_country_calling_codes
219
- // - It has a flag in the region-flags project: https://github.com/behdad/region-flags/tree/gh-pages/png
220
- // - It is supported by libphonenumber (it must be listed on this page): https://github.com/googlei18n/libphonenumber/blob/master/resources/ShortNumberMetadata.xml
221
- // Each country array has the following information:
222
- // [
223
- // Country name,
224
- // iso2 code,
225
- // International dial code,
226
- // Order (if >1 country with same dial code),
227
- // Area codes
228
- // ]
229
- var allCountries = [ [ "Afghanistan (‫افغانستان‬‎)", "af", "93" ], [ "Albania (Shqipëri)", "al", "355" ], [ "Algeria (‫الجزائر‬‎)", "dz", "213" ], [ "American Samoa", "as", "1", 5, [ "684" ] ], [ "Andorra", "ad", "376" ], [ "Angola", "ao", "244" ], [ "Anguilla", "ai", "1", 6, [ "264" ] ], [ "Antigua and Barbuda", "ag", "1", 7, [ "268" ] ], [ "Argentina", "ar", "54" ], [ "Armenia (Հայաստան)", "am", "374" ], [ "Aruba", "aw", "297" ], [ "Ascension Island", "ac", "247" ], [ "Australia", "au", "61", 0 ], [ "Austria (Österreich)", "at", "43" ], [ "Azerbaijan (Azərbaycan)", "az", "994" ], [ "Bahamas", "bs", "1", 8, [ "242" ] ], [ "Bahrain (‫البحرين‬‎)", "bh", "973" ], [ "Bangladesh (বাংলাদেশ)", "bd", "880" ], [ "Barbados", "bb", "1", 9, [ "246" ] ], [ "Belarus (Беларусь)", "by", "375" ], [ "Belgium (België)", "be", "32" ], [ "Belize", "bz", "501" ], [ "Benin (Bénin)", "bj", "229" ], [ "Bermuda", "bm", "1", 10, [ "441" ] ], [ "Bhutan (འབྲུག)", "bt", "975" ], [ "Bolivia", "bo", "591" ], [ "Bosnia and Herzegovina (Босна и Херцеговина)", "ba", "387" ], [ "Botswana", "bw", "267" ], [ "Brazil (Brasil)", "br", "55" ], [ "British Indian Ocean Territory", "io", "246" ], [ "British Virgin Islands", "vg", "1", 11, [ "284" ] ], [ "Brunei", "bn", "673" ], [ "Bulgaria (България)", "bg", "359" ], [ "Burkina Faso", "bf", "226" ], [ "Burundi (Uburundi)", "bi", "257" ], [ "Cambodia (កម្ពុជា)", "kh", "855" ], [ "Cameroon (Cameroun)", "cm", "237" ], [ "Canada", "ca", "1", 1, [ "204", "226", "236", "249", "250", "289", "306", "343", "365", "387", "403", "416", "418", "431", "437", "438", "450", "506", "514", "519", "548", "579", "581", "587", "604", "613", "639", "647", "672", "705", "709", "742", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905" ] ], [ "Cape Verde (Kabu Verdi)", "cv", "238" ], [ "Caribbean Netherlands", "bq", "599", 1, [ "3", "4", "7" ] ], [ "Cayman Islands", "ky", "1", 12, [ "345" ] ], [ "Central African Republic (République centrafricaine)", "cf", "236" ], [ "Chad (Tchad)", "td", "235" ], [ "Chile", "cl", "56" ], [ "China (中国)", "cn", "86" ], [ "Christmas Island", "cx", "61", 2, [ "89164" ] ], [ "Cocos (Keeling) Islands", "cc", "61", 1, [ "89162" ] ], [ "Colombia", "co", "57" ], [ "Comoros (‫جزر القمر‬‎)", "km", "269" ], [ "Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)", "cd", "243" ], [ "Congo (Republic) (Congo-Brazzaville)", "cg", "242" ], [ "Cook Islands", "ck", "682" ], [ "Costa Rica", "cr", "506" ], [ "Côte d’Ivoire", "ci", "225" ], [ "Croatia (Hrvatska)", "hr", "385" ], [ "Cuba", "cu", "53" ], [ "Curaçao", "cw", "599", 0 ], [ "Cyprus (Κύπρος)", "cy", "357" ], [ "Czech Republic (Česká republika)", "cz", "420" ], [ "Denmark (Danmark)", "dk", "45" ], [ "Djibouti", "dj", "253" ], [ "Dominica", "dm", "1", 13, [ "767" ] ], [ "Dominican Republic (República Dominicana)", "do", "1", 2, [ "809", "829", "849" ] ], [ "Ecuador", "ec", "593" ], [ "Egypt (‫مصر‬‎)", "eg", "20" ], [ "El Salvador", "sv", "503" ], [ "Equatorial Guinea (Guinea Ecuatorial)", "gq", "240" ], [ "Eritrea", "er", "291" ], [ "Estonia (Eesti)", "ee", "372" ], [ "Eswatini", "sz", "268" ], [ "Ethiopia", "et", "251" ], [ "Falkland Islands (Islas Malvinas)", "fk", "500" ], [ "Faroe Islands (Føroyar)", "fo", "298" ], [ "Fiji", "fj", "679" ], [ "Finland (Suomi)", "fi", "358", 0 ], [ "France", "fr", "33" ], [ "French Guiana (Guyane française)", "gf", "594" ], [ "French Polynesia (Polynésie française)", "pf", "689" ], [ "Gabon", "ga", "241" ], [ "Gambia", "gm", "220" ], [ "Georgia (საქართველო)", "ge", "995" ], [ "Germany (Deutschland)", "de", "49" ], [ "Ghana (Gaana)", "gh", "233" ], [ "Gibraltar", "gi", "350" ], [ "Greece (Ελλάδα)", "gr", "30" ], [ "Greenland (Kalaallit Nunaat)", "gl", "299" ], [ "Grenada", "gd", "1", 14, [ "473" ] ], [ "Guadeloupe", "gp", "590", 0 ], [ "Guam", "gu", "1", 15, [ "671" ] ], [ "Guatemala", "gt", "502" ], [ "Guernsey", "gg", "44", 1, [ "1481", "7781", "7839", "7911" ] ], [ "Guinea (Guinée)", "gn", "224" ], [ "Guinea-Bissau (Guiné Bissau)", "gw", "245" ], [ "Guyana", "gy", "592" ], [ "Haiti", "ht", "509" ], [ "Honduras", "hn", "504" ], [ "Hong Kong (香港)", "hk", "852" ], [ "Hungary (Magyarország)", "hu", "36" ], [ "Iceland (Ísland)", "is", "354" ], [ "India (भारत)", "in", "91" ], [ "Indonesia", "id", "62" ], [ "Iran (‫ایران‬‎)", "ir", "98" ], [ "Iraq (‫العراق‬‎)", "iq", "964" ], [ "Ireland", "ie", "353" ], [ "Isle of Man", "im", "44", 2, [ "1624", "74576", "7524", "7924", "7624" ] ], [ "Israel (‫ישראל‬‎)", "il", "972" ], [ "Italy (Italia)", "it", "39", 0 ], [ "Jamaica", "jm", "1", 4, [ "876", "658" ] ], [ "Japan (日本)", "jp", "81" ], [ "Jersey", "je", "44", 3, [ "1534", "7509", "7700", "7797", "7829", "7937" ] ], [ "Jordan (‫الأردن‬‎)", "jo", "962" ], [ "Kazakhstan (Казахстан)", "kz", "7", 1, [ "33", "7" ] ], [ "Kenya", "ke", "254" ], [ "Kiribati", "ki", "686" ], [ "Kosovo", "xk", "383" ], [ "Kuwait (‫الكويت‬‎)", "kw", "965" ], [ "Kyrgyzstan (Кыргызстан)", "kg", "996" ], [ "Laos (ລາວ)", "la", "856" ], [ "Latvia (Latvija)", "lv", "371" ], [ "Lebanon (‫لبنان‬‎)", "lb", "961" ], [ "Lesotho", "ls", "266" ], [ "Liberia", "lr", "231" ], [ "Libya (‫ليبيا‬‎)", "ly", "218" ], [ "Liechtenstein", "li", "423" ], [ "Lithuania (Lietuva)", "lt", "370" ], [ "Luxembourg", "lu", "352" ], [ "Macau (澳門)", "mo", "853" ], [ "North Macedonia (Македонија)", "mk", "389" ], [ "Madagascar (Madagasikara)", "mg", "261" ], [ "Malawi", "mw", "265" ], [ "Malaysia", "my", "60" ], [ "Maldives", "mv", "960" ], [ "Mali", "ml", "223" ], [ "Malta", "mt", "356" ], [ "Marshall Islands", "mh", "692" ], [ "Martinique", "mq", "596" ], [ "Mauritania (‫موريتانيا‬‎)", "mr", "222" ], [ "Mauritius (Moris)", "mu", "230" ], [ "Mayotte", "yt", "262", 1, [ "269", "639" ] ], [ "Mexico (México)", "mx", "52" ], [ "Micronesia", "fm", "691" ], [ "Moldova (Republica Moldova)", "md", "373" ], [ "Monaco", "mc", "377" ], [ "Mongolia (Монгол)", "mn", "976" ], [ "Montenegro (Crna Gora)", "me", "382" ], [ "Montserrat", "ms", "1", 16, [ "664" ] ], [ "Morocco (‫المغرب‬‎)", "ma", "212", 0 ], [ "Mozambique (Moçambique)", "mz", "258" ], [ "Myanmar (Burma) (မြန်မာ)", "mm", "95" ], [ "Namibia (Namibië)", "na", "264" ], [ "Nauru", "nr", "674" ], [ "Nepal (नेपाल)", "np", "977" ], [ "Netherlands (Nederland)", "nl", "31" ], [ "New Caledonia (Nouvelle-Calédonie)", "nc", "687" ], [ "New Zealand", "nz", "64" ], [ "Nicaragua", "ni", "505" ], [ "Niger (Nijar)", "ne", "227" ], [ "Nigeria", "ng", "234" ], [ "Niue", "nu", "683" ], [ "Norfolk Island", "nf", "672" ], [ "North Korea (조선 민주주의 인민 공화국)", "kp", "850" ], [ "Northern Mariana Islands", "mp", "1", 17, [ "670" ] ], [ "Norway (Norge)", "no", "47", 0 ], [ "Oman (‫عُمان‬‎)", "om", "968" ], [ "Pakistan (‫پاکستان‬‎)", "pk", "92" ], [ "Palau", "pw", "680" ], [ "Palestine (‫فلسطين‬‎)", "ps", "970" ], [ "Panama (Panamá)", "pa", "507" ], [ "Papua New Guinea", "pg", "675" ], [ "Paraguay", "py", "595" ], [ "Peru (Perú)", "pe", "51" ], [ "Philippines", "ph", "63" ], [ "Poland (Polska)", "pl", "48" ], [ "Portugal", "pt", "351" ], [ "Puerto Rico", "pr", "1", 3, [ "787", "939" ] ], [ "Qatar (‫قطر‬‎)", "qa", "974" ], [ "Réunion (La Réunion)", "re", "262", 0 ], [ "Romania (România)", "ro", "40" ], [ "Russia (Россия)", "ru", "7", 0 ], [ "Rwanda", "rw", "250" ], [ "Saint Barthélemy", "bl", "590", 1 ], [ "Saint Helena", "sh", "290" ], [ "Saint Kitts and Nevis", "kn", "1", 18, [ "869" ] ], [ "Saint Lucia", "lc", "1", 19, [ "758" ] ], [ "Saint Martin (Saint-Martin (partie française))", "mf", "590", 2 ], [ "Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)", "pm", "508" ], [ "Saint Vincent and the Grenadines", "vc", "1", 20, [ "784" ] ], [ "Samoa", "ws", "685" ], [ "San Marino", "sm", "378" ], [ "São Tomé and Príncipe (São Tomé e Príncipe)", "st", "239" ], [ "Saudi Arabia (‫المملكة العربية السعودية‬‎)", "sa", "966" ], [ "Senegal (Sénégal)", "sn", "221" ], [ "Serbia (Србија)", "rs", "381" ], [ "Seychelles", "sc", "248" ], [ "Sierra Leone", "sl", "232" ], [ "Singapore", "sg", "65" ], [ "Sint Maarten", "sx", "1", 21, [ "721" ] ], [ "Slovakia (Slovensko)", "sk", "421" ], [ "Slovenia (Slovenija)", "si", "386" ], [ "Solomon Islands", "sb", "677" ], [ "Somalia (Soomaaliya)", "so", "252" ], [ "South Africa", "za", "27" ], [ "South Korea (대한민국)", "kr", "82" ], [ "South Sudan (‫جنوب السودان‬‎)", "ss", "211" ], [ "Spain (España)", "es", "34" ], [ "Sri Lanka (ශ්‍රී ලංකාව)", "lk", "94" ], [ "Sudan (‫السودان‬‎)", "sd", "249" ], [ "Suriname", "sr", "597" ], [ "Svalbard and Jan Mayen", "sj", "47", 1, [ "79" ] ], [ "Sweden (Sverige)", "se", "46" ], [ "Switzerland (Schweiz)", "ch", "41" ], [ "Syria (‫سوريا‬‎)", "sy", "963" ], [ "Taiwan (台灣)", "tw", "886" ], [ "Tajikistan", "tj", "992" ], [ "Tanzania", "tz", "255" ], [ "Thailand (ไทย)", "th", "66" ], [ "Timor-Leste", "tl", "670" ], [ "Togo", "tg", "228" ], [ "Tokelau", "tk", "690" ], [ "Tonga", "to", "676" ], [ "Trinidad and Tobago", "tt", "1", 22, [ "868" ] ], [ "Tunisia (‫تونس‬‎)", "tn", "216" ], [ "Turkey (Türkiye)", "tr", "90" ], [ "Turkmenistan", "tm", "993" ], [ "Turks and Caicos Islands", "tc", "1", 23, [ "649" ] ], [ "Tuvalu", "tv", "688" ], [ "U.S. Virgin Islands", "vi", "1", 24, [ "340" ] ], [ "Uganda", "ug", "256" ], [ "Ukraine (Україна)", "ua", "380" ], [ "United Arab Emirates (‫الإمارات العربية المتحدة‬‎)", "ae", "971" ], [ "United Kingdom", "gb", "44", 0 ], [ "United States", "us", "1", 0 ], [ "Uruguay", "uy", "598" ], [ "Uzbekistan (Oʻzbekiston)", "uz", "998" ], [ "Vanuatu", "vu", "678" ], [ "Vatican City (Città del Vaticano)", "va", "39", 1, [ "06698" ] ], [ "Venezuela", "ve", "58" ], [ "Vietnam (Việt Nam)", "vn", "84" ], [ "Wallis and Futuna (Wallis-et-Futuna)", "wf", "681" ], [ "Western Sahara (‫الصحراء الغربية‬‎)", "eh", "212", 1, [ "5288", "5289" ] ], [ "Yemen (‫اليمن‬‎)", "ye", "967" ], [ "Zambia", "zm", "260" ], [ "Zimbabwe", "zw", "263" ], [ "Åland Islands", "ax", "358", 1, [ "18" ] ] ];
230
- // loop over all of the countries above, restructuring the data to be objects with named keys
231
- for (var i = 0; i < allCountries.length; i++) {
232
- var c = allCountries[i];
233
- allCountries[i] = {
234
- name: c[0],
235
- iso2: c[1],
236
- dialCode: c[2],
237
- priority: c[3] || 0,
238
- areaCodes: c[4] || null
239
- };
240
- }
241
- function _classCallCheck(instance, Constructor) {
242
- if (!(instance instanceof Constructor)) {
243
- throw new TypeError("Cannot call a class as a function");
244
- }
245
- }
246
- function _defineProperties(target, props) {
247
- for (var i = 0; i < props.length; i++) {
248
- var descriptor = props[i];
249
- descriptor.enumerable = descriptor.enumerable || false;
250
- descriptor.configurable = true;
251
- if ("value" in descriptor) descriptor.writable = true;
252
- Object.defineProperty(target, descriptor.key, descriptor);
253
- }
254
- }
255
- function _createClass(Constructor, protoProps, staticProps) {
256
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
257
- if (staticProps) _defineProperties(Constructor, staticProps);
258
- return Constructor;
259
- }
260
- var intlTelInputGlobals = {
261
- getInstance: function getInstance(input) {
262
- var id = input.getAttribute("data-intl-tel-input-id");
263
- return window.intlTelInputGlobals.instances[id];
264
- },
265
- instances: {},
266
- // using a global like this allows us to mock it in the tests
267
- documentReady: function documentReady() {
268
- return document.readyState === "complete";
269
- }
270
- };
271
- if (typeof window === "object") window.intlTelInputGlobals = intlTelInputGlobals;
272
- // these vars persist through all instances of the plugin
273
- var id = 0;
274
- var defaults = {
275
- // whether or not to allow the dropdown
276
- allowDropdown: true,
277
- // if there is just a dial code in the input: remove it on blur
278
- autoHideDialCode: true,
279
- // add a placeholder in the input with an example number for the selected country
280
- autoPlaceholder: "polite",
281
- // modify the parentClass
282
- customContainer: "",
283
- // modify the auto placeholder
284
- customPlaceholder: null,
285
- // append menu to specified element
286
- dropdownContainer: null,
287
- // don't display these countries
288
- excludeCountries: [],
289
- // format the input value during initialisation and on setNumber
290
- formatOnDisplay: true,
291
- // geoIp lookup function
292
- geoIpLookup: null,
293
- // inject a hidden input with this name, and on submit, populate it with the result of getNumber
294
- hiddenInput: "",
295
- // initial country
296
- initialCountry: "",
297
- // localized country names e.g. { 'de': 'Deutschland' }
298
- localizedCountries: null,
299
- // don't insert international dial codes
300
- nationalMode: true,
301
- // display only these countries
302
- onlyCountries: [],
303
- // number type to use for placeholders
304
- placeholderNumberType: "MOBILE",
305
- // the countries at the top of the list. defaults to united states and united kingdom
306
- preferredCountries: [ "us", "gb" ],
307
- // display the country dial code next to the selected flag so it's not part of the typed number
308
- separateDialCode: false,
309
- // specify the path to the libphonenumber script to enable validation/formatting
310
- utilsScript: ""
311
- };
312
- // https://en.wikipedia.org/wiki/List_of_North_American_Numbering_Plan_area_codes#Non-geographic_area_codes
313
- var regionlessNanpNumbers = [ "800", "822", "833", "844", "855", "866", "877", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889" ];
314
- // utility function to iterate over an object. can't use Object.entries or native forEach because
315
- // of IE11
316
- var forEachProp = function forEachProp(obj, callback) {
317
- var keys = Object.keys(obj);
318
- for (var i = 0; i < keys.length; i++) {
319
- callback(keys[i], obj[keys[i]]);
320
- }
321
- };
322
- // run a method on each instance of the plugin
323
- var forEachInstance = function forEachInstance(method) {
324
- forEachProp(window.intlTelInputGlobals.instances, function(key) {
325
- window.intlTelInputGlobals.instances[key][method]();
326
- });
327
- };
328
- // this is our plugin class that we will create an instance of
329
- // eslint-disable-next-line no-unused-vars
330
- var Iti = /*#__PURE__*/
331
- function() {
332
- function Iti(input, options) {
333
- var _this = this;
334
- _classCallCheck(this, Iti);
335
- this.id = id++;
336
- this.telInput = input;
337
- this.activeItem = null;
338
- this.highlightedItem = null;
339
- // process specified options / defaults
340
- // alternative to Object.assign, which isn't supported by IE11
341
- var customOptions = options || {};
342
- this.options = {};
343
- forEachProp(defaults, function(key, value) {
344
- _this.options[key] = customOptions.hasOwnProperty(key) ? customOptions[key] : value;
345
- });
346
- this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder"));
347
- }
348
- _createClass(Iti, [ {
349
- key: "_init",
350
- value: function _init() {
351
- var _this2 = this;
352
- // if in nationalMode, disable options relating to dial codes
353
- if (this.options.nationalMode) this.options.autoHideDialCode = false;
354
- // if separateDialCode then doesn't make sense to A) insert dial code into input
355
- // (autoHideDialCode), and B) display national numbers (because we're displaying the country
356
- // dial code next to them)
357
- if (this.options.separateDialCode) {
358
- this.options.autoHideDialCode = this.options.nationalMode = false;
359
- }
360
- // we cannot just test screen size as some smartphones/website meta tags will report desktop
361
- // resolutions
362
- // Note: for some reason jasmine breaks if you put this in the main Plugin function with the
363
- // rest of these declarations
364
- // Note: to target Android Mobiles (and not Tablets), we must find 'Android' and 'Mobile'
365
- this.isMobile = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
366
- if (this.isMobile) {
367
- // trigger the mobile dropdown css
368
- document.body.classList.add("iti-mobile");
369
- // on mobile, we want a full screen dropdown, so we must append it to the body
370
- if (!this.options.dropdownContainer) this.options.dropdownContainer = document.body;
371
- }
372
- // these promises get resolved when their individual requests complete
373
- // this way the dev can do something like iti.promise.then(...) to know when all requests are
374
- // complete
375
- if (typeof Promise !== "undefined") {
376
- var autoCountryPromise = new Promise(function(resolve, reject) {
377
- _this2.resolveAutoCountryPromise = resolve;
378
- _this2.rejectAutoCountryPromise = reject;
379
- });
380
- var utilsScriptPromise = new Promise(function(resolve, reject) {
381
- _this2.resolveUtilsScriptPromise = resolve;
382
- _this2.rejectUtilsScriptPromise = reject;
383
- });
384
- this.promise = Promise.all([ autoCountryPromise, utilsScriptPromise ]);
385
- } else {
386
- // prevent errors when Promise doesn't exist
387
- this.resolveAutoCountryPromise = this.rejectAutoCountryPromise = function() {};
388
- this.resolveUtilsScriptPromise = this.rejectUtilsScriptPromise = function() {};
389
- }
390
- // in various situations there could be no country selected initially, but we need to be able
391
- // to assume this variable exists
392
- this.selectedCountryData = {};
393
- // process all the data: onlyCountries, excludeCountries, preferredCountries etc
394
- this._processCountryData();
395
- // generate the markup
396
- this._generateMarkup();
397
- // set the initial state of the input value and the selected flag
398
- this._setInitialState();
399
- // start all of the event listeners: autoHideDialCode, input keydown, selectedFlag click
400
- this._initListeners();
401
- // utils script, and auto country
402
- this._initRequests();
403
- }
404
- }, {
405
- key: "_processCountryData",
406
- value: function _processCountryData() {
407
- // process onlyCountries or excludeCountries array if present
408
- this._processAllCountries();
409
- // process the countryCodes map
410
- this._processCountryCodes();
411
- // process the preferredCountries
412
- this._processPreferredCountries();
413
- // translate countries according to localizedCountries option
414
- if (this.options.localizedCountries) this._translateCountriesByLocale();
415
- // sort countries by name
416
- if (this.options.onlyCountries.length || this.options.localizedCountries) {
417
- this.countries.sort(this._countryNameSort);
418
- }
419
- }
420
- }, {
421
- key: "_addCountryCode",
422
- value: function _addCountryCode(iso2, countryCode, priority) {
423
- if (countryCode.length > this.countryCodeMaxLen) {
424
- this.countryCodeMaxLen = countryCode.length;
425
- }
426
- if (!this.countryCodes.hasOwnProperty(countryCode)) {
427
- this.countryCodes[countryCode] = [];
428
- }
429
- // bail if we already have this country for this countryCode
430
- for (var i = 0; i < this.countryCodes[countryCode].length; i++) {
431
- if (this.countryCodes[countryCode][i] === iso2) return;
432
- }
433
- // check for undefined as 0 is falsy
434
- var index = priority !== undefined$1 ? priority : this.countryCodes[countryCode].length;
435
- this.countryCodes[countryCode][index] = iso2;
436
- }
437
- }, {
438
- key: "_processAllCountries",
439
- value: function _processAllCountries() {
440
- if (this.options.onlyCountries.length) {
441
- var lowerCaseOnlyCountries = this.options.onlyCountries.map(function(country) {
442
- return country.toLowerCase();
443
- });
444
- this.countries = allCountries.filter(function(country) {
445
- return lowerCaseOnlyCountries.indexOf(country.iso2) > -1;
446
- });
447
- } else if (this.options.excludeCountries.length) {
448
- var lowerCaseExcludeCountries = this.options.excludeCountries.map(function(country) {
449
- return country.toLowerCase();
450
- });
451
- this.countries = allCountries.filter(function(country) {
452
- return lowerCaseExcludeCountries.indexOf(country.iso2) === -1;
453
- });
454
- } else {
455
- this.countries = allCountries;
456
- }
457
- }
458
- }, {
459
- key: "_translateCountriesByLocale",
460
- value: function _translateCountriesByLocale() {
461
- for (var i = 0; i < this.countries.length; i++) {
462
- var iso = this.countries[i].iso2.toLowerCase();
463
- if (this.options.localizedCountries.hasOwnProperty(iso)) {
464
- this.countries[i].name = this.options.localizedCountries[iso];
465
- }
466
- }
467
- }
468
- }, {
469
- key: "_countryNameSort",
470
- value: function _countryNameSort(a, b) {
471
- return a.name.localeCompare(b.name);
472
- }
473
- }, {
474
- key: "_processCountryCodes",
475
- value: function _processCountryCodes() {
476
- this.countryCodeMaxLen = 0;
477
- // here we store just dial codes
478
- this.dialCodes = {};
479
- // here we store "country codes" (both dial codes and their area codes)
480
- this.countryCodes = {};
481
- // first: add dial codes
482
- for (var i = 0; i < this.countries.length; i++) {
483
- var c = this.countries[i];
484
- if (!this.dialCodes[c.dialCode]) this.dialCodes[c.dialCode] = true;
485
- this._addCountryCode(c.iso2, c.dialCode, c.priority);
486
- }
487
- // next: add area codes
488
- // this is a second loop over countries, to make sure we have all of the "root" countries
489
- // already in the map, so that we can access them, as each time we add an area code substring
490
- // to the map, we also need to include the "root" country's code, as that also matches
491
- for (var _i = 0; _i < this.countries.length; _i++) {
492
- var _c = this.countries[_i];
493
- // area codes
494
- if (_c.areaCodes) {
495
- var rootCountryCode = this.countryCodes[_c.dialCode][0];
496
- // for each area code
497
- for (var j = 0; j < _c.areaCodes.length; j++) {
498
- var areaCode = _c.areaCodes[j];
499
- // for each digit in the area code to add all partial matches as well
500
- for (var k = 1; k < areaCode.length; k++) {
501
- var partialDialCode = _c.dialCode + areaCode.substr(0, k);
502
- // start with the root country, as that also matches this dial code
503
- this._addCountryCode(rootCountryCode, partialDialCode);
504
- this._addCountryCode(_c.iso2, partialDialCode);
505
- }
506
- // add the full area code
507
- this._addCountryCode(_c.iso2, _c.dialCode + areaCode);
508
- }
509
- }
510
- }
511
- }
512
- }, {
513
- key: "_processPreferredCountries",
514
- value: function _processPreferredCountries() {
515
- this.preferredCountries = [];
516
- for (var i = 0; i < this.options.preferredCountries.length; i++) {
517
- var countryCode = this.options.preferredCountries[i].toLowerCase();
518
- var countryData = this._getCountryData(countryCode, false, true);
519
- if (countryData) this.preferredCountries.push(countryData);
520
- }
521
- }
522
- }, {
523
- key: "_createEl",
524
- value: function _createEl(name, attrs, container) {
525
- var el = document.createElement(name);
526
- if (attrs) forEachProp(attrs, function(key, value) {
527
- return el.setAttribute(key, value);
528
- });
529
- if (container) container.appendChild(el);
530
- return el;
531
- }
532
- }, {
533
- key: "_generateMarkup",
534
- value: function _generateMarkup() {
535
- // if autocomplete does not exist on the element and its form, then
536
- // prevent autocomplete as there's no safe, cross-browser event we can react to, so it can
537
- // easily put the plugin in an inconsistent state e.g. the wrong flag selected for the
538
- // autocompleted number, which on submit could mean wrong number is saved (esp in nationalMode)
539
- if (!this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete"))) {
540
- this.telInput.setAttribute("autocomplete", "off");
541
- }
542
- // containers (mostly for positioning)
543
- var parentClass = "iti";
544
- if (this.options.allowDropdown) parentClass += " iti--allow-dropdown";
545
- if (this.options.separateDialCode) parentClass += " iti--separate-dial-code";
546
- if (this.options.customContainer) {
547
- parentClass += " ";
548
- parentClass += this.options.customContainer;
549
- }
550
- var wrapper = this._createEl("div", {
551
- "class": parentClass
552
- });
553
- this.telInput.parentNode.insertBefore(wrapper, this.telInput);
554
- this.flagsContainer = this._createEl("div", {
555
- "class": "iti__flag-container"
556
- }, wrapper);
557
- wrapper.appendChild(this.telInput);
558
- // selected flag (displayed to left of input)
559
- this.selectedFlag = this._createEl("div", {
560
- "class": "iti__selected-flag",
561
- role: "combobox",
562
- "aria-controls": "iti-".concat(this.id, "__country-listbox"),
563
- "aria-owns": "iti-".concat(this.id, "__country-listbox"),
564
- "aria-expanded": "false"
565
- }, this.flagsContainer);
566
- this.selectedFlagInner = this._createEl("div", {
567
- "class": "iti__flag"
568
- }, this.selectedFlag);
569
- if (this.options.separateDialCode) {
570
- this.selectedDialCode = this._createEl("div", {
571
- "class": "iti__selected-dial-code"
572
- }, this.selectedFlag);
573
- }
574
- if (this.options.allowDropdown) {
575
- // make element focusable and tab navigable
576
- this.selectedFlag.setAttribute("tabindex", "0");
577
- this.dropdownArrow = this._createEl("div", {
578
- "class": "iti__arrow"
579
- }, this.selectedFlag);
580
- // country dropdown: preferred countries, then divider, then all countries
581
- this.countryList = this._createEl("ul", {
582
- "class": "iti__country-list iti__hide",
583
- id: "iti-".concat(this.id, "__country-listbox"),
584
- role: "listbox",
585
- "aria-label": "List of countries"
586
- });
587
- if (this.preferredCountries.length) {
588
- this._appendListItems(this.preferredCountries, "iti__preferred", true);
589
- this._createEl("li", {
590
- "class": "iti__divider",
591
- role: "separator",
592
- "aria-disabled": "true"
593
- }, this.countryList);
594
- }
595
- this._appendListItems(this.countries, "iti__standard");
596
- // create dropdownContainer markup
597
- if (this.options.dropdownContainer) {
598
- this.dropdown = this._createEl("div", {
599
- "class": "iti iti--container"
600
- });
601
- this.dropdown.appendChild(this.countryList);
602
- } else {
603
- this.flagsContainer.appendChild(this.countryList);
604
- }
605
- }
606
- if (this.options.hiddenInput) {
607
- var hiddenInputName = this.options.hiddenInput;
608
- var name = this.telInput.getAttribute("name");
609
- if (name) {
610
- var i = name.lastIndexOf("[");
611
- // if input name contains square brackets, then give the hidden input the same name,
612
- // replacing the contents of the last set of brackets with the given hiddenInput name
613
- if (i !== -1) hiddenInputName = "".concat(name.substr(0, i), "[").concat(hiddenInputName, "]");
614
- }
615
- this.hiddenInput = this._createEl("input", {
616
- type: "hidden",
617
- name: hiddenInputName
618
- });
619
- wrapper.appendChild(this.hiddenInput);
620
- }
621
- }
622
- }, {
623
- key: "_appendListItems",
624
- value: function _appendListItems(countries, className, preferred) {
625
- // we create so many DOM elements, it is faster to build a temp string
626
- // and then add everything to the DOM in one go at the end
627
- var tmp = "";
628
- // for each country
629
- for (var i = 0; i < countries.length; i++) {
630
- var c = countries[i];
631
- var idSuffix = preferred ? "-preferred" : "";
632
- // open the list item
633
- tmp += "<li class='iti__country ".concat(className, "' tabIndex='-1' id='iti-").concat(this.id, "__item-").concat(c.iso2).concat(idSuffix, "' role='option' data-dial-code='").concat(c.dialCode, "' data-country-code='").concat(c.iso2, "' aria-selected='false'>");
634
- // add the flag
635
- tmp += "<div class='iti__flag-box'><div class='iti__flag iti__".concat(c.iso2, "'></div></div>");
636
- // and the country name and dial code
637
- tmp += "<span class='iti__country-name'>".concat(c.name, "</span>");
638
- tmp += "<span class='iti__dial-code'>+".concat(c.dialCode, "</span>");
639
- // close the list item
640
- tmp += "</li>";
641
- }
642
- this.countryList.insertAdjacentHTML("beforeend", tmp);
643
- }
644
- }, {
645
- key: "_setInitialState",
646
- value: function _setInitialState() {
647
- // fix firefox bug: when first load page (with input with value set to number with intl dial
648
- // code) and initialising plugin removes the dial code from the input, then refresh page,
649
- // and we try to init plugin again but this time on number without dial code so get grey flag
650
- var attributeValue = this.telInput.getAttribute("value");
651
- var inputValue = this.telInput.value;
652
- var useAttribute = attributeValue && attributeValue.charAt(0) === "+" && (!inputValue || inputValue.charAt(0) !== "+");
653
- var val = useAttribute ? attributeValue : inputValue;
654
- var dialCode = this._getDialCode(val);
655
- var isRegionlessNanp = this._isRegionlessNanp(val);
656
- var _this$options = this.options, initialCountry = _this$options.initialCountry, nationalMode = _this$options.nationalMode, autoHideDialCode = _this$options.autoHideDialCode, separateDialCode = _this$options.separateDialCode;
657
- // if we already have a dial code, and it's not a regionlessNanp, we can go ahead and set the
658
- // flag, else fall back to the default country
659
- if (dialCode && !isRegionlessNanp) {
660
- this._updateFlagFromNumber(val);
661
- } else if (initialCountry !== "auto") {
662
- // see if we should select a flag
663
- if (initialCountry) {
664
- this._setFlag(initialCountry.toLowerCase());
665
- } else {
666
- if (dialCode && isRegionlessNanp) {
667
- // has intl dial code, is regionless nanp, and no initialCountry, so default to US
668
- this._setFlag("us");
669
- } else {
670
- // no dial code and no initialCountry, so default to first in list
671
- this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2;
672
- if (!val) {
673
- this._setFlag(this.defaultCountry);
674
- }
675
- }
676
- }
677
- // if empty and no nationalMode and no autoHideDialCode then insert the default dial code
678
- if (!val && !nationalMode && !autoHideDialCode && !separateDialCode) {
679
- this.telInput.value = "+".concat(this.selectedCountryData.dialCode);
680
- }
681
- }
682
- // NOTE: if initialCountry is set to auto, that will be handled separately
683
- // format - note this wont be run after _updateDialCode as that's only called if no val
684
- if (val) this._updateValFromNumber(val);
685
- }
686
- }, {
687
- key: "_initListeners",
688
- value: function _initListeners() {
689
- this._initKeyListeners();
690
- if (this.options.autoHideDialCode) this._initBlurListeners();
691
- if (this.options.allowDropdown) this._initDropdownListeners();
692
- if (this.hiddenInput) this._initHiddenInputListener();
693
- }
694
- }, {
695
- key: "_initHiddenInputListener",
696
- value: function _initHiddenInputListener() {
697
- var _this3 = this;
698
- this._handleHiddenInputSubmit = function() {
699
- _this3.hiddenInput.value = _this3.getNumber();
700
- };
701
- if (this.telInput.form) this.telInput.form.addEventListener("submit", this._handleHiddenInputSubmit);
702
- }
703
- }, {
704
- key: "_getClosestLabel",
705
- value: function _getClosestLabel() {
706
- var el = this.telInput;
707
- while (el && el.tagName !== "LABEL") {
708
- el = el.parentNode;
709
- }
710
- return el;
711
- }
712
- }, {
713
- key: "_initDropdownListeners",
714
- value: function _initDropdownListeners() {
715
- var _this4 = this;
716
- // hack for input nested inside label (which is valid markup): clicking the selected-flag to
717
- // open the dropdown would then automatically trigger a 2nd click on the input which would
718
- // close it again
719
- this._handleLabelClick = function(e) {
720
- // if the dropdown is closed, then focus the input, else ignore the click
721
- if (_this4.countryList.classList.contains("iti__hide")) _this4.telInput.focus(); else e.preventDefault();
722
- };
723
- var label = this._getClosestLabel();
724
- if (label) label.addEventListener("click", this._handleLabelClick);
725
- // toggle country dropdown on click
726
- this._handleClickSelectedFlag = function() {
727
- // only intercept this event if we're opening the dropdown
728
- // else let it bubble up to the top ("click-off-to-close" listener)
729
- // we cannot just stopPropagation as it may be needed to close another instance
730
- if (_this4.countryList.classList.contains("iti__hide") && !_this4.telInput.disabled && !_this4.telInput.readOnly) {
731
- _this4._showDropdown();
732
- }
733
- };
734
- this.selectedFlag.addEventListener("click", this._handleClickSelectedFlag);
735
- // open dropdown list if currently focused
736
- this._handleFlagsContainerKeydown = function(e) {
737
- var isDropdownHidden = _this4.countryList.classList.contains("iti__hide");
738
- if (isDropdownHidden && [ "ArrowUp", "Up", "ArrowDown", "Down", " ", "Enter" ].indexOf(e.key) !== -1) {
739
- // prevent form from being submitted if "ENTER" was pressed
740
- e.preventDefault();
741
- // prevent event from being handled again by document
742
- e.stopPropagation();
743
- _this4._showDropdown();
744
- }
745
- // allow navigation from dropdown to input on TAB
746
- if (e.key === "Tab") _this4._closeDropdown();
747
- };
748
- this.flagsContainer.addEventListener("keydown", this._handleFlagsContainerKeydown);
749
- }
750
- }, {
751
- key: "_initRequests",
752
- value: function _initRequests() {
753
- var _this5 = this;
754
- // if the user has specified the path to the utils script, fetch it on window.load, else resolve
755
- if (this.options.utilsScript && !window.intlTelInputUtils) {
756
- // if the plugin is being initialised after the window.load event has already been fired
757
- if (window.intlTelInputGlobals.documentReady()) {
758
- window.intlTelInputGlobals.loadUtils(this.options.utilsScript);
759
- } else {
760
- // wait until the load event so we don't block any other requests e.g. the flags image
761
- window.addEventListener("load", function() {
762
- window.intlTelInputGlobals.loadUtils(_this5.options.utilsScript);
763
- });
764
- }
765
- } else this.resolveUtilsScriptPromise();
766
- if (this.options.initialCountry === "auto") this._loadAutoCountry(); else this.resolveAutoCountryPromise();
767
- }
768
- }, {
769
- key: "_loadAutoCountry",
770
- value: function _loadAutoCountry() {
771
- // 3 options:
772
- // 1) already loaded (we're done)
773
- // 2) not already started loading (start)
774
- // 3) already started loading (do nothing - just wait for loading callback to fire)
775
- if (window.intlTelInputGlobals.autoCountry) {
776
- this.handleAutoCountry();
777
- } else if (!window.intlTelInputGlobals.startedLoadingAutoCountry) {
778
- // don't do this twice!
779
- window.intlTelInputGlobals.startedLoadingAutoCountry = true;
780
- if (typeof this.options.geoIpLookup === "function") {
781
- this.options.geoIpLookup(function(countryCode) {
782
- window.intlTelInputGlobals.autoCountry = countryCode.toLowerCase();
783
- // tell all instances the auto country is ready
784
- // TODO: this should just be the current instances
785
- // UPDATE: use setTimeout in case their geoIpLookup function calls this callback straight
786
- // away (e.g. if they have already done the geo ip lookup somewhere else). Using
787
- // setTimeout means that the current thread of execution will finish before executing
788
- // this, which allows the plugin to finish initialising.
789
- setTimeout(function() {
790
- return forEachInstance("handleAutoCountry");
791
- });
792
- }, function() {
793
- return forEachInstance("rejectAutoCountryPromise");
794
- });
795
- }
796
- }
797
- }
798
- }, {
799
- key: "_initKeyListeners",
800
- value: function _initKeyListeners() {
801
- var _this6 = this;
802
- // update flag on keyup
803
- this._handleKeyupEvent = function() {
804
- if (_this6._updateFlagFromNumber(_this6.telInput.value)) {
805
- _this6._triggerCountryChange();
806
- }
807
- };
808
- this.telInput.addEventListener("keyup", this._handleKeyupEvent);
809
- // update flag on cut/paste events (now supported in all major browsers)
810
- this._handleClipboardEvent = function() {
811
- // hack because "paste" event is fired before input is updated
812
- setTimeout(_this6._handleKeyupEvent);
813
- };
814
- this.telInput.addEventListener("cut", this._handleClipboardEvent);
815
- this.telInput.addEventListener("paste", this._handleClipboardEvent);
816
- }
817
- }, {
818
- key: "_cap",
819
- value: function _cap(number) {
820
- var max = this.telInput.getAttribute("maxlength");
821
- return max && number.length > max ? number.substr(0, max) : number;
822
- }
823
- }, {
824
- key: "_initBlurListeners",
825
- value: function _initBlurListeners() {
826
- var _this7 = this;
827
- // on blur or form submit: if just a dial code then remove it
828
- this._handleSubmitOrBlurEvent = function() {
829
- _this7._removeEmptyDialCode();
830
- };
831
- if (this.telInput.form) this.telInput.form.addEventListener("submit", this._handleSubmitOrBlurEvent);
832
- this.telInput.addEventListener("blur", this._handleSubmitOrBlurEvent);
833
- }
834
- }, {
835
- key: "_removeEmptyDialCode",
836
- value: function _removeEmptyDialCode() {
837
- if (this.telInput.value.charAt(0) === "+") {
838
- var numeric = this._getNumeric(this.telInput.value);
839
- // if just a plus, or if just a dial code
840
- if (!numeric || this.selectedCountryData.dialCode === numeric) {
841
- this.telInput.value = "";
842
- }
843
- }
844
- }
845
- }, {
846
- key: "_getNumeric",
847
- value: function _getNumeric(s) {
848
- return s.replace(/\D/g, "");
849
- }
850
- }, {
851
- key: "_trigger",
852
- value: function _trigger(name) {
853
- // have to use old school document.createEvent as IE11 doesn't support `new Event()` syntax
854
- var e = document.createEvent("Event");
855
- e.initEvent(name, true, true);
856
- // can bubble, and is cancellable
857
- this.telInput.dispatchEvent(e);
858
- }
859
- }, {
860
- key: "_showDropdown",
861
- value: function _showDropdown() {
862
- this.countryList.classList.remove("iti__hide");
863
- this.selectedFlag.setAttribute("aria-expanded", "true");
864
- this._setDropdownPosition();
865
- // update highlighting and scroll to active list item
866
- if (this.activeItem) {
867
- this._highlightListItem(this.activeItem, false);
868
- this._scrollTo(this.activeItem, true);
869
- }
870
- // bind all the dropdown-related listeners: mouseover, click, click-off, keydown
871
- this._bindDropdownListeners();
872
- // update the arrow
873
- this.dropdownArrow.classList.add("iti__arrow--up");
874
- this._trigger("open:countrydropdown");
875
- }
876
- }, {
877
- key: "_toggleClass",
878
- value: function _toggleClass(el, className, shouldHaveClass) {
879
- if (shouldHaveClass && !el.classList.contains(className)) el.classList.add(className); else if (!shouldHaveClass && el.classList.contains(className)) el.classList.remove(className);
880
- }
881
- }, {
882
- key: "_setDropdownPosition",
883
- value: function _setDropdownPosition() {
884
- var _this8 = this;
885
- if (this.options.dropdownContainer) {
886
- this.options.dropdownContainer.appendChild(this.dropdown);
887
- }
888
- if (!this.isMobile) {
889
- var pos = this.telInput.getBoundingClientRect();
890
- // windowTop from https://stackoverflow.com/a/14384091/217866
891
- var windowTop = window.pageYOffset || document.documentElement.scrollTop;
892
- var inputTop = pos.top + windowTop;
893
- var dropdownHeight = this.countryList.offsetHeight;
894
- // dropdownFitsBelow = (dropdownBottom < windowBottom)
895
- var dropdownFitsBelow = inputTop + this.telInput.offsetHeight + dropdownHeight < windowTop + window.innerHeight;
896
- var dropdownFitsAbove = inputTop - dropdownHeight > windowTop;
897
- // by default, the dropdown will be below the input. If we want to position it above the
898
- // input, we add the dropup class.
899
- this._toggleClass(this.countryList, "iti__country-list--dropup", !dropdownFitsBelow && dropdownFitsAbove);
900
- // if dropdownContainer is enabled, calculate postion
901
- if (this.options.dropdownContainer) {
902
- // by default the dropdown will be directly over the input because it's not in the flow.
903
- // If we want to position it below, we need to add some extra top value.
904
- var extraTop = !dropdownFitsBelow && dropdownFitsAbove ? 0 : this.telInput.offsetHeight;
905
- // calculate placement
906
- this.dropdown.style.top = "".concat(inputTop + extraTop, "px");
907
- this.dropdown.style.left = "".concat(pos.left + document.body.scrollLeft, "px");
908
- // close menu on window scroll
909
- this._handleWindowScroll = function() {
910
- return _this8._closeDropdown();
911
- };
912
- window.addEventListener("scroll", this._handleWindowScroll);
913
- }
914
- }
915
- }
916
- }, {
917
- key: "_getClosestListItem",
918
- value: function _getClosestListItem(target) {
919
- var el = target;
920
- while (el && el !== this.countryList && !el.classList.contains("iti__country")) {
921
- el = el.parentNode;
922
- }
923
- // if we reached the countryList element, then return null
924
- return el === this.countryList ? null : el;
925
- }
926
- }, {
927
- key: "_bindDropdownListeners",
928
- value: function _bindDropdownListeners() {
929
- var _this9 = this;
930
- // when mouse over a list item, just highlight that one
931
- // we add the class "highlight", so if they hit "enter" we know which one to select
932
- this._handleMouseoverCountryList = function(e) {
933
- // handle event delegation, as we're listening for this event on the countryList
934
- var listItem = _this9._getClosestListItem(e.target);
935
- if (listItem) _this9._highlightListItem(listItem, false);
936
- };
937
- this.countryList.addEventListener("mouseover", this._handleMouseoverCountryList);
938
- // listen for country selection
939
- this._handleClickCountryList = function(e) {
940
- var listItem = _this9._getClosestListItem(e.target);
941
- if (listItem) _this9._selectListItem(listItem);
942
- };
943
- this.countryList.addEventListener("click", this._handleClickCountryList);
944
- // click off to close
945
- // (except when this initial opening click is bubbling up)
946
- // we cannot just stopPropagation as it may be needed to close another instance
947
- var isOpening = true;
948
- this._handleClickOffToClose = function() {
949
- if (!isOpening) _this9._closeDropdown();
950
- isOpening = false;
951
- };
952
- document.documentElement.addEventListener("click", this._handleClickOffToClose);
953
- // listen for up/down scrolling, enter to select, or letters to jump to country name.
954
- // use keydown as keypress doesn't fire for non-char keys and we want to catch if they
955
- // just hit down and hold it to scroll down (no keyup event).
956
- // listen on the document because that's where key events are triggered if no input has focus
957
- var query = "";
958
- var queryTimer = null;
959
- this._handleKeydownOnDropdown = function(e) {
960
- // prevent down key from scrolling the whole page,
961
- // and enter key from submitting a form etc
962
- e.preventDefault();
963
- // up and down to navigate
964
- if (e.key === "ArrowUp" || e.key === "Up" || e.key === "ArrowDown" || e.key === "Down") _this9._handleUpDownKey(e.key); else if (e.key === "Enter") _this9._handleEnterKey(); else if (e.key === "Escape") _this9._closeDropdown(); else if (/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(e.key)) {
965
- // jump to countries that start with the query string
966
- if (queryTimer) clearTimeout(queryTimer);
967
- query += e.key.toLowerCase();
968
- _this9._searchForCountry(query);
969
- // if the timer hits 1 second, reset the query
970
- queryTimer = setTimeout(function() {
971
- query = "";
972
- }, 1e3);
973
- }
974
- };
975
- document.addEventListener("keydown", this._handleKeydownOnDropdown);
976
- }
977
- }, {
978
- key: "_handleUpDownKey",
979
- value: function _handleUpDownKey(key) {
980
- var next = key === "ArrowUp" || key === "Up" ? this.highlightedItem.previousElementSibling : this.highlightedItem.nextElementSibling;
981
- if (next) {
982
- // skip the divider
983
- if (next.classList.contains("iti__divider")) {
984
- next = key === "ArrowUp" || key === "Up" ? next.previousElementSibling : next.nextElementSibling;
985
- }
986
- this._highlightListItem(next, true);
987
- }
988
- }
989
- }, {
990
- key: "_handleEnterKey",
991
- value: function _handleEnterKey() {
992
- if (this.highlightedItem) this._selectListItem(this.highlightedItem);
993
- }
994
- }, {
995
- key: "_searchForCountry",
996
- value: function _searchForCountry(query) {
997
- for (var i = 0; i < this.countries.length; i++) {
998
- if (this._startsWith(this.countries[i].name, query)) {
999
- var listItem = this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(this.countries[i].iso2));
1000
- // update highlighting and scroll
1001
- this._highlightListItem(listItem, false);
1002
- this._scrollTo(listItem, true);
1003
- break;
1004
- }
1005
- }
1006
- }
1007
- }, {
1008
- key: "_startsWith",
1009
- value: function _startsWith(a, b) {
1010
- return a.substr(0, b.length).toLowerCase() === b;
1011
- }
1012
- }, {
1013
- key: "_updateValFromNumber",
1014
- value: function _updateValFromNumber(originalNumber) {
1015
- var number = originalNumber;
1016
- if (this.options.formatOnDisplay && window.intlTelInputUtils && this.selectedCountryData) {
1017
- var useNational = !this.options.separateDialCode && (this.options.nationalMode || number.charAt(0) !== "+");
1018
- var _intlTelInputUtils$nu = intlTelInputUtils.numberFormat, NATIONAL = _intlTelInputUtils$nu.NATIONAL, INTERNATIONAL = _intlTelInputUtils$nu.INTERNATIONAL;
1019
- var format = useNational ? NATIONAL : INTERNATIONAL;
1020
- number = intlTelInputUtils.formatNumber(number, this.selectedCountryData.iso2, format);
1021
- }
1022
- number = this._beforeSetNumber(number);
1023
- this.telInput.value = number;
1024
- }
1025
- }, {
1026
- key: "_updateFlagFromNumber",
1027
- value: function _updateFlagFromNumber(originalNumber) {
1028
- // if we're in nationalMode and we already have US/Canada selected, make sure the number starts
1029
- // with a +1 so _getDialCode will be able to extract the area code
1030
- // update: if we dont yet have selectedCountryData, but we're here (trying to update the flag
1031
- // from the number), that means we're initialising the plugin with a number that already has a
1032
- // dial code, so fine to ignore this bit
1033
- var number = originalNumber;
1034
- var selectedDialCode = this.selectedCountryData.dialCode;
1035
- var isNanp = selectedDialCode === "1";
1036
- if (number && this.options.nationalMode && isNanp && number.charAt(0) !== "+") {
1037
- if (number.charAt(0) !== "1") number = "1".concat(number);
1038
- number = "+".concat(number);
1039
- }
1040
- // update flag if user types area code for another country
1041
- if (this.options.separateDialCode && selectedDialCode && number.charAt(0) !== "+") {
1042
- number = "+".concat(selectedDialCode).concat(number);
1043
- }
1044
- // try and extract valid dial code from input
1045
- var dialCode = this._getDialCode(number, true);
1046
- var numeric = this._getNumeric(number);
1047
- var countryCode = null;
1048
- if (dialCode) {
1049
- var countryCodes = this.countryCodes[this._getNumeric(dialCode)];
1050
- // check if the right country is already selected. this should be false if the number is
1051
- // longer than the matched dial code because in this case we need to make sure that if
1052
- // there are multiple country matches, that the first one is selected (note: we could
1053
- // just check that here, but it requires the same loop that we already have later)
1054
- var alreadySelected = countryCodes.indexOf(this.selectedCountryData.iso2) !== -1 && numeric.length <= dialCode.length - 1;
1055
- var isRegionlessNanpNumber = selectedDialCode === "1" && this._isRegionlessNanp(numeric);
1056
- // only update the flag if:
1057
- // A) NOT (we currently have a NANP flag selected, and the number is a regionlessNanp)
1058
- // AND
1059
- // B) the right country is not already selected
1060
- if (!isRegionlessNanpNumber && !alreadySelected) {
1061
- // if using onlyCountries option, countryCodes[0] may be empty, so we must find the first
1062
- // non-empty index
1063
- for (var j = 0; j < countryCodes.length; j++) {
1064
- if (countryCodes[j]) {
1065
- countryCode = countryCodes[j];
1066
- break;
1067
- }
1068
- }
1069
- }
1070
- } else if (number.charAt(0) === "+" && numeric.length) {
1071
- // invalid dial code, so empty
1072
- // Note: use getNumeric here because the number has not been formatted yet, so could contain
1073
- // bad chars
1074
- countryCode = "";
1075
- } else if (!number || number === "+") {
1076
- // empty, or just a plus, so default
1077
- countryCode = this.defaultCountry;
1078
- }
1079
- if (countryCode !== null) {
1080
- return this._setFlag(countryCode);
1081
- }
1082
- return false;
1083
- }
1084
- }, {
1085
- key: "_isRegionlessNanp",
1086
- value: function _isRegionlessNanp(number) {
1087
- var numeric = this._getNumeric(number);
1088
- if (numeric.charAt(0) === "1") {
1089
- var areaCode = numeric.substr(1, 3);
1090
- return regionlessNanpNumbers.indexOf(areaCode) !== -1;
1091
- }
1092
- return false;
1093
- }
1094
- }, {
1095
- key: "_highlightListItem",
1096
- value: function _highlightListItem(listItem, shouldFocus) {
1097
- var prevItem = this.highlightedItem;
1098
- if (prevItem) prevItem.classList.remove("iti__highlight");
1099
- this.highlightedItem = listItem;
1100
- this.highlightedItem.classList.add("iti__highlight");
1101
- if (shouldFocus) this.highlightedItem.focus();
1102
- }
1103
- }, {
1104
- key: "_getCountryData",
1105
- value: function _getCountryData(countryCode, ignoreOnlyCountriesOption, allowFail) {
1106
- var countryList = ignoreOnlyCountriesOption ? allCountries : this.countries;
1107
- for (var i = 0; i < countryList.length; i++) {
1108
- if (countryList[i].iso2 === countryCode) {
1109
- return countryList[i];
1110
- }
1111
- }
1112
- if (allowFail) {
1113
- return null;
1114
- }
1115
- throw new Error("No country data for '".concat(countryCode, "'"));
1116
- }
1117
- }, {
1118
- key: "_setFlag",
1119
- value: function _setFlag(countryCode) {
1120
- var prevCountry = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
1121
- // do this first as it will throw an error and stop if countryCode is invalid
1122
- this.selectedCountryData = countryCode ? this._getCountryData(countryCode, false, false) : {};
1123
- // update the defaultCountry - we only need the iso2 from now on, so just store that
1124
- if (this.selectedCountryData.iso2) {
1125
- this.defaultCountry = this.selectedCountryData.iso2;
1126
- }
1127
- this.selectedFlagInner.setAttribute("class", "iti__flag iti__".concat(countryCode));
1128
- // update the selected country's title attribute
1129
- var title = countryCode ? "".concat(this.selectedCountryData.name, ": +").concat(this.selectedCountryData.dialCode) : "Unknown";
1130
- this.selectedFlag.setAttribute("title", title);
1131
- if (this.options.separateDialCode) {
1132
- var dialCode = this.selectedCountryData.dialCode ? "+".concat(this.selectedCountryData.dialCode) : "";
1133
- this.selectedDialCode.innerHTML = dialCode;
1134
- // offsetWidth is zero if input is in a hidden container during initialisation
1135
- var selectedFlagWidth = this.selectedFlag.offsetWidth || this._getHiddenSelectedFlagWidth();
1136
- // add 6px of padding after the grey selected-dial-code box, as this is what we use in the css
1137
- this.telInput.style.paddingLeft = "".concat(selectedFlagWidth + 6, "px");
1138
- }
1139
- // and the input's placeholder
1140
- this._updatePlaceholder();
1141
- // update the active list item
1142
- if (this.options.allowDropdown) {
1143
- var prevItem = this.activeItem;
1144
- if (prevItem) {
1145
- prevItem.classList.remove("iti__active");
1146
- prevItem.setAttribute("aria-selected", "false");
1147
- }
1148
- if (countryCode) {
1149
- // check if there is a preferred item first, else fall back to standard
1150
- var nextItem = this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(countryCode, "-preferred")) || this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(countryCode));
1151
- nextItem.setAttribute("aria-selected", "true");
1152
- nextItem.classList.add("iti__active");
1153
- this.activeItem = nextItem;
1154
- this.selectedFlag.setAttribute("aria-activedescendant", nextItem.getAttribute("id"));
1155
- }
1156
- }
1157
- // return if the flag has changed or not
1158
- return prevCountry.iso2 !== countryCode;
1159
- }
1160
- }, {
1161
- key: "_getHiddenSelectedFlagWidth",
1162
- value: function _getHiddenSelectedFlagWidth() {
1163
- // to get the right styling to apply, all we need is a shallow clone of the container,
1164
- // and then to inject a deep clone of the selectedFlag element
1165
- var containerClone = this.telInput.parentNode.cloneNode();
1166
- containerClone.style.visibility = "hidden";
1167
- document.body.appendChild(containerClone);
1168
- var flagsContainerClone = this.flagsContainer.cloneNode();
1169
- containerClone.appendChild(flagsContainerClone);
1170
- var selectedFlagClone = this.selectedFlag.cloneNode(true);
1171
- flagsContainerClone.appendChild(selectedFlagClone);
1172
- var width = selectedFlagClone.offsetWidth;
1173
- containerClone.parentNode.removeChild(containerClone);
1174
- return width;
1175
- }
1176
- }, {
1177
- key: "_updatePlaceholder",
1178
- value: function _updatePlaceholder() {
1179
- var shouldSetPlaceholder = this.options.autoPlaceholder === "aggressive" || !this.hadInitialPlaceholder && this.options.autoPlaceholder === "polite";
1180
- if (window.intlTelInputUtils && shouldSetPlaceholder) {
1181
- var numberType = intlTelInputUtils.numberType[this.options.placeholderNumberType];
1182
- var placeholder = this.selectedCountryData.iso2 ? intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2, this.options.nationalMode, numberType) : "";
1183
- placeholder = this._beforeSetNumber(placeholder);
1184
- if (typeof this.options.customPlaceholder === "function") {
1185
- placeholder = this.options.customPlaceholder(placeholder, this.selectedCountryData);
1186
- }
1187
- this.telInput.setAttribute("placeholder", placeholder);
1188
- }
1189
- }
1190
- }, {
1191
- key: "_selectListItem",
1192
- value: function _selectListItem(listItem) {
1193
- // update selected flag and active list item
1194
- var flagChanged = this._setFlag(listItem.getAttribute("data-country-code"));
1195
- this._closeDropdown();
1196
- this._updateDialCode(listItem.getAttribute("data-dial-code"), true);
1197
- // focus the input
1198
- this.telInput.focus();
1199
- // put cursor at end - this fix is required for FF and IE11 (with nationalMode=false i.e. auto
1200
- // inserting dial code), who try to put the cursor at the beginning the first time
1201
- var len = this.telInput.value.length;
1202
- this.telInput.setSelectionRange(len, len);
1203
- if (flagChanged) {
1204
- this._triggerCountryChange();
1205
- }
1206
- }
1207
- }, {
1208
- key: "_closeDropdown",
1209
- value: function _closeDropdown() {
1210
- this.countryList.classList.add("iti__hide");
1211
- this.selectedFlag.setAttribute("aria-expanded", "false");
1212
- // update the arrow
1213
- this.dropdownArrow.classList.remove("iti__arrow--up");
1214
- // unbind key events
1215
- document.removeEventListener("keydown", this._handleKeydownOnDropdown);
1216
- document.documentElement.removeEventListener("click", this._handleClickOffToClose);
1217
- this.countryList.removeEventListener("mouseover", this._handleMouseoverCountryList);
1218
- this.countryList.removeEventListener("click", this._handleClickCountryList);
1219
- // remove menu from container
1220
- if (this.options.dropdownContainer) {
1221
- if (!this.isMobile) window.removeEventListener("scroll", this._handleWindowScroll);
1222
- if (this.dropdown.parentNode) this.dropdown.parentNode.removeChild(this.dropdown);
1223
- }
1224
- this._trigger("close:countrydropdown");
1225
- }
1226
- }, {
1227
- key: "_scrollTo",
1228
- value: function _scrollTo(element, middle) {
1229
- var container = this.countryList;
1230
- // windowTop from https://stackoverflow.com/a/14384091/217866
1231
- var windowTop = window.pageYOffset || document.documentElement.scrollTop;
1232
- var containerHeight = container.offsetHeight;
1233
- var containerTop = container.getBoundingClientRect().top + windowTop;
1234
- var containerBottom = containerTop + containerHeight;
1235
- var elementHeight = element.offsetHeight;
1236
- var elementTop = element.getBoundingClientRect().top + windowTop;
1237
- var elementBottom = elementTop + elementHeight;
1238
- var newScrollTop = elementTop - containerTop + container.scrollTop;
1239
- var middleOffset = containerHeight / 2 - elementHeight / 2;
1240
- if (elementTop < containerTop) {
1241
- // scroll up
1242
- if (middle) newScrollTop -= middleOffset;
1243
- container.scrollTop = newScrollTop;
1244
- } else if (elementBottom > containerBottom) {
1245
- // scroll down
1246
- if (middle) newScrollTop += middleOffset;
1247
- var heightDifference = containerHeight - elementHeight;
1248
- container.scrollTop = newScrollTop - heightDifference;
1249
- }
1250
- }
1251
- }, {
1252
- key: "_updateDialCode",
1253
- value: function _updateDialCode(newDialCodeBare, hasSelectedListItem) {
1254
- var inputVal = this.telInput.value;
1255
- // save having to pass this every time
1256
- var newDialCode = "+".concat(newDialCodeBare);
1257
- var newNumber;
1258
- if (inputVal.charAt(0) === "+") {
1259
- // there's a plus so we're dealing with a replacement (doesn't matter if nationalMode or not)
1260
- var prevDialCode = this._getDialCode(inputVal);
1261
- if (prevDialCode) {
1262
- // current number contains a valid dial code, so replace it
1263
- newNumber = inputVal.replace(prevDialCode, newDialCode);
1264
- } else {
1265
- // current number contains an invalid dial code, so ditch it
1266
- // (no way to determine where the invalid dial code ends and the rest of the number begins)
1267
- newNumber = newDialCode;
1268
- }
1269
- } else if (this.options.nationalMode || this.options.separateDialCode) {
1270
- // don't do anything
1271
- return;
1272
- } else {
1273
- // nationalMode is disabled
1274
- if (inputVal) {
1275
- // there is an existing value with no dial code: prefix the new dial code
1276
- newNumber = newDialCode + inputVal;
1277
- } else if (hasSelectedListItem || !this.options.autoHideDialCode) {
1278
- // no existing value and either they've just selected a list item, or autoHideDialCode is
1279
- // disabled: insert new dial code
1280
- newNumber = newDialCode;
1281
- } else {
1282
- return;
1283
- }
1284
- }
1285
- this.telInput.value = newNumber;
1286
- }
1287
- }, {
1288
- key: "_getDialCode",
1289
- value: function _getDialCode(number, includeAreaCode) {
1290
- var dialCode = "";
1291
- // only interested in international numbers (starting with a plus)
1292
- if (number.charAt(0) === "+") {
1293
- var numericChars = "";
1294
- // iterate over chars
1295
- for (var i = 0; i < number.length; i++) {
1296
- var c = number.charAt(i);
1297
- // if char is number (https://stackoverflow.com/a/8935649/217866)
1298
- if (!isNaN(parseInt(c, 10))) {
1299
- numericChars += c;
1300
- // if current numericChars make a valid dial code
1301
- if (includeAreaCode) {
1302
- if (this.countryCodes[numericChars]) {
1303
- // store the actual raw string (useful for matching later)
1304
- dialCode = number.substr(0, i + 1);
1305
- }
1306
- } else {
1307
- if (this.dialCodes[numericChars]) {
1308
- dialCode = number.substr(0, i + 1);
1309
- // if we're just looking for a dial code, we can break as soon as we find one
1310
- break;
1311
- }
1312
- }
1313
- // stop searching as soon as we can - in this case when we hit max len
1314
- if (numericChars.length === this.countryCodeMaxLen) {
1315
- break;
1316
- }
1317
- }
1318
- }
1319
- }
1320
- return dialCode;
1321
- }
1322
- }, {
1323
- key: "_getFullNumber",
1324
- value: function _getFullNumber() {
1325
- var val = this.telInput.value.trim();
1326
- var dialCode = this.selectedCountryData.dialCode;
1327
- var prefix;
1328
- var numericVal = this._getNumeric(val);
1329
- if (this.options.separateDialCode && val.charAt(0) !== "+" && dialCode && numericVal) {
1330
- // when using separateDialCode, it is visible so is effectively part of the typed number
1331
- prefix = "+".concat(dialCode);
1332
- } else {
1333
- prefix = "";
1334
- }
1335
- return prefix + val;
1336
- }
1337
- }, {
1338
- key: "_beforeSetNumber",
1339
- value: function _beforeSetNumber(originalNumber) {
1340
- var number = originalNumber;
1341
- if (this.options.separateDialCode) {
1342
- var dialCode = this._getDialCode(number);
1343
- // if there is a valid dial code
1344
- if (dialCode) {
1345
- // in case _getDialCode returned an area code as well
1346
- dialCode = "+".concat(this.selectedCountryData.dialCode);
1347
- // a lot of numbers will have a space separating the dial code and the main number, and
1348
- // some NANP numbers will have a hyphen e.g. +1 684-733-1234 - in both cases we want to get
1349
- // rid of it
1350
- // NOTE: don't just trim all non-numerics as may want to preserve an open parenthesis etc
1351
- var start = number[dialCode.length] === " " || number[dialCode.length] === "-" ? dialCode.length + 1 : dialCode.length;
1352
- number = number.substr(start);
1353
- }
1354
- }
1355
- return this._cap(number);
1356
- }
1357
- }, {
1358
- key: "_triggerCountryChange",
1359
- value: function _triggerCountryChange() {
1360
- this._trigger("countrychange");
1361
- }
1362
- }, {
1363
- key: "handleAutoCountry",
1364
- value: function handleAutoCountry() {
1365
- if (this.options.initialCountry === "auto") {
1366
- // we must set this even if there is an initial val in the input: in case the initial val is
1367
- // invalid and they delete it - they should see their auto country
1368
- this.defaultCountry = window.intlTelInputGlobals.autoCountry;
1369
- // if there's no initial value in the input, then update the flag
1370
- if (!this.telInput.value) {
1371
- this.setCountry(this.defaultCountry);
1372
- }
1373
- this.resolveAutoCountryPromise();
1374
- }
1375
- }
1376
- }, {
1377
- key: "handleUtils",
1378
- value: function handleUtils() {
1379
- // if the request was successful
1380
- if (window.intlTelInputUtils) {
1381
- // if there's an initial value in the input, then format it
1382
- if (this.telInput.value) {
1383
- this._updateValFromNumber(this.telInput.value);
1384
- }
1385
- this._updatePlaceholder();
1386
- }
1387
- this.resolveUtilsScriptPromise();
1388
- }
1389
- }, {
1390
- key: "destroy",
1391
- value: function destroy() {
1392
- var form = this.telInput.form;
1393
- if (this.options.allowDropdown) {
1394
- // make sure the dropdown is closed (and unbind listeners)
1395
- this._closeDropdown();
1396
- this.selectedFlag.removeEventListener("click", this._handleClickSelectedFlag);
1397
- this.flagsContainer.removeEventListener("keydown", this._handleFlagsContainerKeydown);
1398
- // label click hack
1399
- var label = this._getClosestLabel();
1400
- if (label) label.removeEventListener("click", this._handleLabelClick);
1401
- }
1402
- // unbind hiddenInput listeners
1403
- if (this.hiddenInput && form) form.removeEventListener("submit", this._handleHiddenInputSubmit);
1404
- // unbind autoHideDialCode listeners
1405
- if (this.options.autoHideDialCode) {
1406
- if (form) form.removeEventListener("submit", this._handleSubmitOrBlurEvent);
1407
- this.telInput.removeEventListener("blur", this._handleSubmitOrBlurEvent);
1408
- }
1409
- // unbind key events, and cut/paste events
1410
- this.telInput.removeEventListener("keyup", this._handleKeyupEvent);
1411
- this.telInput.removeEventListener("cut", this._handleClipboardEvent);
1412
- this.telInput.removeEventListener("paste", this._handleClipboardEvent);
1413
- // remove attribute of id instance: data-intl-tel-input-id
1414
- this.telInput.removeAttribute("data-intl-tel-input-id");
1415
- // remove markup (but leave the original input)
1416
- var wrapper = this.telInput.parentNode;
1417
- wrapper.parentNode.insertBefore(this.telInput, wrapper);
1418
- wrapper.parentNode.removeChild(wrapper);
1419
- delete window.intlTelInputGlobals.instances[this.id];
1420
- }
1421
- }, {
1422
- key: "getExtension",
1423
- value: function getExtension() {
1424
- if (window.intlTelInputUtils) {
1425
- return intlTelInputUtils.getExtension(this._getFullNumber(), this.selectedCountryData.iso2);
1426
- }
1427
- return "";
1428
- }
1429
- }, {
1430
- key: "getNumber",
1431
- value: function getNumber(format) {
1432
- if (window.intlTelInputUtils) {
1433
- var iso2 = this.selectedCountryData.iso2;
1434
- return intlTelInputUtils.formatNumber(this._getFullNumber(), iso2, format);
1435
- }
1436
- return "";
1437
- }
1438
- }, {
1439
- key: "getNumberType",
1440
- value: function getNumberType() {
1441
- if (window.intlTelInputUtils) {
1442
- return intlTelInputUtils.getNumberType(this._getFullNumber(), this.selectedCountryData.iso2);
1443
- }
1444
- return -99;
1445
- }
1446
- }, {
1447
- key: "getSelectedCountryData",
1448
- value: function getSelectedCountryData() {
1449
- return this.selectedCountryData;
1450
- }
1451
- }, {
1452
- key: "getValidationError",
1453
- value: function getValidationError() {
1454
- if (window.intlTelInputUtils) {
1455
- var iso2 = this.selectedCountryData.iso2;
1456
- return intlTelInputUtils.getValidationError(this._getFullNumber(), iso2);
1457
- }
1458
- return -99;
1459
- }
1460
- }, {
1461
- key: "isValidNumber",
1462
- value: function isValidNumber() {
1463
- var val = this._getFullNumber().trim();
1464
- var countryCode = this.options.nationalMode ? this.selectedCountryData.iso2 : "";
1465
- return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(val, countryCode) : null;
1466
- }
1467
- }, {
1468
- key: "setCountry",
1469
- value: function setCountry(originalCountryCode) {
1470
- var countryCode = originalCountryCode.toLowerCase();
1471
- // check if already selected
1472
- if (!this.selectedFlagInner.classList.contains("iti__".concat(countryCode))) {
1473
- this._setFlag(countryCode);
1474
- this._updateDialCode(this.selectedCountryData.dialCode, false);
1475
- this._triggerCountryChange();
1476
- }
1477
- }
1478
- }, {
1479
- key: "setNumber",
1480
- value: function setNumber(number) {
1481
- // we must update the flag first, which updates this.selectedCountryData, which is used for
1482
- // formatting the number before displaying it
1483
- var flagChanged = this._updateFlagFromNumber(number);
1484
- this._updateValFromNumber(number);
1485
- if (flagChanged) {
1486
- this._triggerCountryChange();
1487
- }
1488
- }
1489
- }, {
1490
- key: "setPlaceholderNumberType",
1491
- value: function setPlaceholderNumberType(type) {
1492
- this.options.placeholderNumberType = type;
1493
- this._updatePlaceholder();
1494
- }
1495
- } ]);
1496
- return Iti;
1497
- }();
1498
- /********************
1499
- * STATIC METHODS
1500
- ********************/
1501
- // get the country data object
1502
- intlTelInputGlobals.getCountryData = function() {
1503
- return allCountries;
1504
- };
1505
- // inject a <script> element to load utils.js
1506
- var injectScript = function injectScript(path, handleSuccess, handleFailure) {
1507
- // inject a new script element into the page
1508
- var script = document.createElement("script");
1509
- script.onload = function() {
1510
- forEachInstance("handleUtils");
1511
- if (handleSuccess) handleSuccess();
1512
- };
1513
- script.onerror = function() {
1514
- forEachInstance("rejectUtilsScriptPromise");
1515
- if (handleFailure) handleFailure();
1516
- };
1517
- script.className = "iti-load-utils";
1518
- script.async = true;
1519
- script.src = path;
1520
- document.body.appendChild(script);
1521
- };
1522
- // load the utils script
1523
- intlTelInputGlobals.loadUtils = function(path) {
1524
- // 2 options:
1525
- // 1) not already started loading (start)
1526
- // 2) already started loading (do nothing - just wait for the onload callback to fire, which will
1527
- // trigger handleUtils on all instances, invoking their resolveUtilsScriptPromise functions)
1528
- if (!window.intlTelInputUtils && !window.intlTelInputGlobals.startedLoadingUtilsScript) {
1529
- // only do this once
1530
- window.intlTelInputGlobals.startedLoadingUtilsScript = true;
1531
- // if we have promises, then return a promise
1532
- if (typeof Promise !== "undefined") {
1533
- return new Promise(function(resolve, reject) {
1534
- return injectScript(path, resolve, reject);
1535
- });
1536
- }
1537
- injectScript(path);
1538
- }
1539
- return null;
1540
- };
1541
- // default options
1542
- intlTelInputGlobals.defaults = defaults;
1543
- // version
1544
- intlTelInputGlobals.version = "17.0.15";
1545
- // convenience wrapper
1546
- return function(input, options) {
1547
- var iti = new Iti(input, options);
1548
- iti._init();
1549
- input.setAttribute("data-intl-tel-input-id", iti.id);
1550
- window.intlTelInputGlobals.instances[iti.id] = iti;
1551
- return iti;
1552
- };
1553
- }();
1554
- });
1555
- });
1556
-
1557
- /**
1558
- * Exposing intl-tel-input as a component
1559
- */
1560
- var intlTelInput = intlTelInput$1;
1561
-
1562
- const SallaTelInput = class {
1563
- constructor(hostRef) {
1564
- index.registerInstance(this, hostRef);
1565
- console.log(intlTelInput);
1566
- }
1567
- render() {
1568
- return (index.h(index.Host, null, index.h("slot", null, index.h("h1", null, "Test Tel Input"))));
1569
- }
1570
- };
1571
-
1572
- const SallaVerify = class {
1573
- constructor(hostRef) {
1574
- index.registerInstance(this, hostRef);
1575
- this.verified = index.createEvent(this, "verified", 7);
1576
- this.backClicked = index.createEvent(this, "backClicked", 7);
1577
- this.url = 'profile/verify-mobile';
1578
- this.by = 'sms';
1579
- this.autoReload = true;
1580
- Helper.Helper.setHost(this.host);
1581
- if (this.withoutModal) {
1582
- this.modal = { show: () => '', hide: () => '' };
1583
- }
1584
- else {
1585
- salla.event.on('profile::verify.mobile', data => this.show(data));
1586
- }
1587
- }
1588
- async getCode() {
1589
- return this.code.value;
1590
- }
1591
- async show(data) {
1592
- this.data = data;
1593
- this.resendTimer();
1594
- this.otpInputs = document.querySelectorAll('.s-verify-input');
1595
- this.otpInputs[0].focus();
1596
- Helper.Helper.on('input', '.s-verify-input', e => salla.helpers.digitsOnly(e.target));
1597
- Helper.Helper.onKeyUp('.s-verify-input', event => {
1598
- var _a, _b, _c, _d;
1599
- let key = event.keyCode || event.charCode;
1600
- if (event.target.value) {
1601
- (_a = event.target.nextElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
1602
- (_b = event.target.nextElementSibling) === null || _b === void 0 ? void 0 : _b.select();
1603
- }
1604
- else if ([8, 46].includes(key)) {
1605
- (_c = event.target.previousElementSibling) === null || _c === void 0 ? void 0 : _c.focus();
1606
- (_d = event.target.previousElementSibling) === null || _d === void 0 ? void 0 : _d.select();
1607
- }
1608
- this.toggleOTPSubmit();
1609
- });
1610
- Helper.Helper.on('paste', '.s-verify-input', event => {
1611
- let text = event.clipboardData.getData('text').toArabicDigits().replace(/[^0-9.]/g, '').replace('..', '.');
1612
- this.otpInputs.forEach((input, i) => input.value = text[i] || '');
1613
- this.toggleOTPSubmit();
1614
- setTimeout(() => this.otpInputs[3].focus(), 100);
1615
- });
1616
- return this.modal.show();
1617
- }
1618
- toggleOTPSubmit() {
1619
- let otp = [];
1620
- this.otpInputs.forEach(input => input.value && otp.push(input.value));
1621
- this.code.value = otp.join('');
1622
- if (otp.length === 4) {
1623
- this.btn.removeAttribute('disabled');
1624
- this.btn.click();
1625
- return;
1626
- }
1627
- this.btn.setAttribute('disabled', '');
1628
- }
1629
- resendTimer() {
1630
- Helper.Helper.showElement(this.resendMessage).hideElement(this.resend);
1631
- let resendAfter = 30;
1632
- let timerId = setInterval(() => {
1633
- if (resendAfter === -1) {
1634
- clearTimeout(timerId);
1635
- Helper.Helper.hideElement(this.resendMessage).showElement(this.resend);
1636
- }
1637
- else {
1638
- this.timer.innerHTML = `${resendAfter >= 10 ? resendAfter : '0' + resendAfter} : 00`;
1639
- resendAfter--;
1640
- }
1641
- }, 1000);
1642
- }
1643
- resendCode() {
1644
- return this.btn.stop()
1645
- .then(() => this.btn.disable())
1646
- .then(() => {
1647
- this.otpInputs.forEach(input => input.value = '');
1648
- this.otpInputs[0].focus();
1649
- })
1650
- .then(() => salla.api.auth.resend(Object.assign({ resend_by: this.by }, this.data)))
1651
- .then(() => this.resendTimer())
1652
- .catch(() => this.resendTimer());
1653
- }
1654
- submit() {
1655
- return this.btn.load()
1656
- .then(() => this.btn.disable())
1657
- .then(() => salla.document.api.request(this.url, Object.assign({ code: this.code.value }, this.data)))
1658
- .then(response => this.verified.emit(response))
1659
- .then(() => this.btn.stop() && this.btn.disable())
1660
- .then(() => this.modal.hide())
1661
- .then(() => this.autoReload && window.location.reload())
1662
- .catch(() => this.btn.stop() && this.btn.enable());
1663
- }
1664
- render() {
1665
- return this.withoutModal ? this.myBody() :
1666
- index.h("salla-modal", { id: "s-verify", ref: modal => this.modal = modal, title: salla.lang.get('pages.profile.verify_title') }, this.myBody());
1667
- }
1668
- myBody() {
1669
- return [
1670
- index.h("div", { class: "s-verify-message", innerHTML: salla.lang.get('pages.profile.verify_message') }),
1671
- // <label class="s-verify-label">{salla.lang.get('pages.profile.verify_placeholder')}</label>,
1672
- index.h("input", { type: "hidden", name: "code", maxlength: "4", required: true, ref: code => this.code = code }),
1673
- index.h("div", { class: "s-verify-codes", dir: "ltr" }, [1, 2, 3, 4].map(() => index.h("input", { type: "text", maxlength: "1", class: "s-verify-input", required: true }))),
1674
- index.h("div", { slot: "footer", class: "s-verify-footer" }, index.h("salla-button", { class: "s-verify-submit", disabled: true, onClick: () => this.submit(), ref: b => this.btn = b }, salla.lang.get('pages.profile.verify')), index.h("p", { class: "s-verify-resend-message", ref: el => this.resendMessage = el }, salla.lang.get('blocks.header.resend_after'), index.h("b", { class: "s-verify-timer", ref: el => this.timer = el })), index.h("a", { href: "#", class: "s-verify-resend", onClick: () => this.resendCode(), ref: el => this.resend = el }, salla.lang.get('blocks.comments.submit')), this.backText ?
1675
- index.h("a", { href: "#", class: "s-verify-resend", onClick: () => this.backClicked.emit() }, this.backText)
1676
- : '')
1677
- ];
1678
- }
1679
- get host() { return index.getElement(this); }
1680
- };
1681
-
1682
- exports.salla_login = sallaLogin.SallaLogin;
1683
- exports.salla_button = SallaButton;
1684
- exports.salla_modal = SallaModal;
1685
- exports.salla_tel_input = SallaTelInput;
1686
- exports.salla_verify = SallaVerify;