Skip to content

Commit e70b7a7

Browse files
committed
Release v1.1.0
1 parent 83e28f9 commit e70b7a7

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

dist/js/whatsapp-widget.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* WhatsApp Widget v1.0.2 (c) 2020 - Fajar Setya Budi
2+
* WhatsApp Widget v1.1.0 (c) 2020 - Fajar Setya Budi
33
* Contributors (https://github.com/agraris/whatsapp-widget/graphs/contributors)
44
* Licensed under MIT (https://github.com/agraris/whatsapp-widget/blob/master/LICENSE)
55
* WhatsApp Widget does not affiliate with WhatsApp Inc. in any way.
@@ -153,8 +153,6 @@
153153
}, {
154154
key: "_sendMessage",
155155
value: function _sendMessage() {
156-
var _this = this;
157-
158156
if (!/^\d+$/.test(this._phoneNumber)) {
159157
throw new Error('Phone number (' + this._phoneNumber + ') is invalid.');
160158
}
@@ -165,11 +163,14 @@
165163

166164
var parameters = send_url + this._phoneNumber + '?text=';
167165
var valid = true;
168-
inputs.forEach(function (item) {
169-
if (!_this._formValidation(item)) return valid = false;
166+
167+
for (var i = 0; i < inputs.length; i++) {
168+
var item = inputs[i];
169+
if (!this._formValidation(item)) valid = false;
170170
var title = item.getAttribute('data-message');
171171
parameters += title.replace(/^./, title[0].toUpperCase()) + ': ' + item.value + '%0A';
172-
});
172+
}
173+
173174
if (valid) window.open(parameters, '_blank');
174175
}
175176
}, {
@@ -189,7 +190,7 @@
189190
}, {
190191
key: "_cacheElements",
191192
value: function _cacheElements() {
192-
var _this2 = this;
193+
var _this = this;
193194

194195
this._toggleChat = document.querySelector("".concat(SELECTOR_DATA_TOGGLE_CHAT, "[data-target=\"#").concat(this._element.id, "\"]"));
195196
this._contentElement = this._element.getElementsByClassName(CLASS_NAME_WIDGET_CONTENT).item(0);
@@ -199,22 +200,22 @@
199200
this._toggleChat.addEventListener("click", function (e) {
200201
e.preventDefault();
201202

202-
_this2.toggle();
203+
_this.toggle();
203204
});
204205
}
205206

206207
if (this._toggleSend) {
207208
this._toggleSend.addEventListener('click', function (e) {
208209
e.preventDefault();
209210

210-
_this2._sendMessage();
211+
_this._sendMessage();
211212
});
212213
}
213214
}
214215
}, {
215216
key: "_show",
216217
value: function _show() {
217-
var _this3 = this;
218+
var _this2 = this;
218219

219220
this._element.classList.add(CLASS_NAME_WIDGET_EXPANDED);
220221

@@ -224,7 +225,7 @@
224225

225226
this._isShown = true;
226227
Object.keys(ChatData).forEach(function (key) {
227-
if (key !== _this3._element.id && ChatData[key]._isShown) ChatData[key].toggle();
228+
if (key !== _this2._element.id && ChatData[key]._isShown) ChatData[key].toggle();
228229
});
229230
}
230231
}, {
@@ -276,12 +277,12 @@
276277
}, {
277278
key: "_typeCheckConfig",
278279
value: function _typeCheckConfig(componentName, config, configTypes) {
279-
var _this4 = this;
280+
var _this3 = this;
280281

281282
Object.keys(configTypes).forEach(function (property) {
282283
var expectedTypes = configTypes[property];
283284
var value = config[property];
284-
var valueType = value && _this4._isElement(value) ? 'element' : _this4._toType(value);
285+
var valueType = value && _this3._isElement(value) ? 'element' : _this3._toType(value);
285286

286287
if (!new RegExp(expectedTypes).test(valueType)) {
287288
throw new Error("".concat(componentName.toUpperCase(), ": ") + "Option \"".concat(property, "\" provided type \"").concat(valueType, "\" ") + "but expected type \"".concat(expectedTypes, "\"."));

dist/js/whatsapp-widget.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "whatsapp-widget",
3-
"version": "1.0.2",
3+
"version": "1.1.0",
44
"description": "A simple WhatsApp live chat widget for your website.",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)