LiveChat – WP live chat plugin for WordPress - Version 4.4.4

Version Description

  • asynchronous chat widget loading
  • support for the new admin notices mechanism
  • WordPress 5.7 compatibility check
Download this release

Release Info

Developer livechat
Plugin Icon 128x128 LiveChat – WP live chat plugin for WordPress
Version 4.4.4
Comparing to
See all releases

Code changes from version 4.4.3 to 4.4.4

Files changed (108) hide show
  1. changelog.txt +5 -0
  2. composer.json +17 -1
  3. composer.lock +260 -120
  4. config.php +18 -7
  5. languages/livechat-woocommerce.pot +145 -0
  6. languages/wp-live-chat-software-for-wordpress.pot +42 -61
  7. livechat.php +55 -17
  8. plugin_files/Helpers/ConnectNoticeHelper.class.php +0 -43
  9. plugin_files/Helpers/ConnectServiceHelper.class.php +0 -102
  10. plugin_files/Helpers/DeactivationFeedbackFormHelper.class.php +0 -183
  11. plugin_files/Helpers/LiveChatHelper.class.php +0 -20
  12. plugin_files/Helpers/ResourcesTabHelper.class.php +0 -33
  13. plugin_files/Helpers/ReviewNoticeHelper.class.php +0 -41
  14. plugin_files/Helpers/TrackingCodeHelper.class.php +0 -73
  15. plugin_files/LiveChat.class.php +26 -154
  16. plugin_files/LiveChatAdmin.class.php +23 -490
  17. plugin_files/Services/ApiClient.class.php +16 -6
  18. plugin_files/Services/CertProvider.class.php +24 -10
  19. plugin_files/Services/ConnectTokenProvider.class.php +10 -4
  20. plugin_files/Services/Factories/ApiClientFactory.class.php +56 -0
  21. plugin_files/Services/Factories/ConnectTokenProviderFactory.class.php +42 -0
  22. plugin_files/Services/Factories/UrlProviderFactory.class.php +65 -0
  23. plugin_files/Services/LicenseProvider.class.php +97 -0
  24. plugin_files/Services/MenuProvider.class.php +283 -0
  25. plugin_files/Services/ModuleConfiguration.class.php +16 -23
  26. plugin_files/Services/Notifications/ConfirmIdentityNotice.class.php +38 -0
  27. plugin_files/Services/Notifications/ConnectNotice.class.php +39 -0
  28. plugin_files/Services/Notifications/DeactivationModal.class.php +42 -0
  29. plugin_files/Services/Notifications/Notice.class.php +26 -0
  30. plugin_files/Services/Notifications/Notification.class.php +168 -0
  31. plugin_files/Services/NotificationsRenderer.class.php +63 -0
  32. plugin_files/Services/Options/AuthorizedUsers.class.php +50 -0
  33. plugin_files/Services/Options/Deprecated/DeprecatedLicenseEmail.class.php +22 -0
  34. plugin_files/Services/Options/Deprecated/DeprecatedLicenseNumber.class.php +22 -0
  35. plugin_files/Services/Options/Deprecated/DeprecatedOption.class.php +35 -0
  36. plugin_files/Services/Options/Deprecated/DeprecatedOptions.class.php +60 -0
  37. plugin_files/Services/Options/Deprecated/DeprecatedReviewNoticeDismissed.class.php +22 -0
  38. plugin_files/Services/Options/Deprecated/DeprecatedReviewNoticeOffset.class.php +22 -0
  39. plugin_files/Services/Options/Deprecated/DeprecatedReviewNoticeOptions.class.php +56 -0
  40. plugin_files/Services/Options/Deprecated/DeprecatedReviewNoticeTimestamp.class.php +22 -0
  41. plugin_files/Services/Options/Deprecated/Widget/DeprecatedWidgetSettings.class.php +73 -0
  42. plugin_files/Services/Options/Deprecated/Widget/DeprecatedWidgetWooCommerceSettings.class.php +62 -0
  43. plugin_files/Services/Options/Deprecated/Widget/DeprecatedWidgetWordPressDisableGuestsOption.class.php +24 -0
  44. plugin_files/Services/Options/Deprecated/Widget/DeprecatedWidgetWordPressDisableMobileOption.class.php +24 -0
  45. plugin_files/Services/Options/Deprecated/Widget/DeprecatedWidgetWordPressSettings.class.php +73 -0
  46. plugin_files/Services/Options/Option.class.php +75 -0
  47. plugin_files/Services/Options/OptionsSet.class.php +57 -0
  48. plugin_files/Services/Options/Platform.class.php +23 -0
  49. plugin_files/Services/Options/PublicKey.class.php +22 -0
  50. plugin_files/Services/Options/ReadableOption.class.php +66 -0
  51. plugin_files/Services/Options/ReviewNoticeDismissed.class.php +22 -0
  52. plugin_files/Services/Options/ReviewNoticeOffset.class.php +22 -0
  53. plugin_files/Services/Options/ReviewNoticeOptions.class.php +64 -0
  54. plugin_files/Services/Options/ReviewNoticeTimestamp.class.php +22 -0
  55. plugin_files/Services/Options/SettingsOptions.class.php +54 -0
  56. plugin_files/Services/Options/StoreToken.class.php +22 -0
  57. plugin_files/Services/Options/Synchronized.class.php +43 -0
  58. plugin_files/Services/Options/UserAuthOptions.class.php +41 -0
  59. plugin_files/Services/Options/UserOption.class.php +79 -0
  60. plugin_files/Services/Options/UserToken.class.php +22 -0
  61. plugin_files/Services/Options/WidgetURL.class.php +22 -0
  62. plugin_files/Services/Options/WooCommerce/WooCommerceOption.class.php +31 -0
  63. plugin_files/Services/Options/WooCommerce/WooCommerceUserOption.class.php +31 -0
  64. plugin_files/Services/Options/WritableOption.class.php +26 -0
  65. plugin_files/Services/PlatformProvider.class.php +203 -0
  66. plugin_files/Services/SettingsProvider.class.php +201 -0
  67. plugin_files/Services/SetupProvider.class.php +156 -0
  68. plugin_files/Services/Store.class.php +33 -6
  69. plugin_files/Services/TemplateParser.class.php +2 -4
  70. plugin_files/Services/Templates/ChatWidgetScriptTemplate.class.php +161 -0
  71. plugin_files/{Helpers/ConfirmIdentityNoticeHelper.class.php → Services/Templates/ConfirmIdentityNoticeTemplate.class.php} +7 -10
  72. plugin_files/Services/Templates/ConnectNoticeTemplate.class.php +35 -0
  73. plugin_files/Services/Templates/CustomerTrackingTemplate.class.php +66 -0
  74. plugin_files/Services/Templates/DeactivationModalTemplate.class.php +50 -0
  75. plugin_files/Services/Templates/NoticeTemplate.class.php +124 -0
  76. plugin_files/Services/Templates/ResourcesTabTemplate.class.php +22 -0
  77. plugin_files/Services/Templates/SettingsTemplate.class.php +169 -0
  78. plugin_files/Services/Templates/Template.class.php +49 -0
  79. plugin_files/Services/Templates/TrackingCodeTemplate.class.php +122 -0
  80. plugin_files/Services/TokenValidator.class.php +11 -3
  81. plugin_files/Services/UrlProvider.class.php +43 -19
  82. plugin_files/Services/User.class.php +70 -52
  83. plugin_files/Services/WidgetProvider.class.php +79 -0
  84. plugin_files/Services/WooCommerce/CustomerTrackingProvider.class.php +146 -0
  85. plugin_files/css/livechat-general.css +30 -3
  86. plugin_files/css/livechat-review.css +0 -39
  87. plugin_files/images/livechat-icon.svg +2 -2
  88. plugin_files/images/livechat-logo.svg +1 -1
  89. plugin_files/js/connect.js +13 -7
  90. plugin_files/js/livechat-review.js +0 -52
  91. plugin_files/js/livechat.js +12 -140
  92. plugin_files/templates/chat_widget_script.html.twig +2 -0
  93. plugin_files/templates/connect.html.twig +30 -6
  94. plugin_files/templates/connect_notice.html.twig +22 -0
  95. plugin_files/templates/customer_tracking.html.twig +3 -0
  96. plugin_files/templates/deactivation_modal.html.twig +156 -0
  97. plugin_files/templates/notice.html.twig +81 -0
  98. plugin_files/templates/plugins_conflict_notice.html.twig +22 -0
  99. plugin_files/templates/resources.html.twig +0 -6
  100. plugin_files/templates/tracking_code.html.twig +18 -0
  101. readme.txt +31 -65
  102. vendor/autoload.php +1 -1
  103. vendor/composer/autoload_classmap.php +91 -8
  104. vendor/composer/autoload_real.php +4 -4
  105. vendor/composer/autoload_static.php +95 -12
  106. vendor/composer/installed.json +6 -6
  107. vendor/firebase/php-jwt/README.md +13 -0
  108. vendor/firebase/php-jwt/src/JWK.php +1 -0
changelog.txt CHANGED
@@ -1,5 +1,10 @@
1
  == Changelog ==
2
 
 
 
 
 
 
3
  = 4.4.3 =
4
  * bug fixes
5
 
1
  == Changelog ==
2
 
3
+ = 4.4.4 =
4
+ * asynchronous chat widget loading
5
+ * support for the new admin notices mechanism
6
+ * WordPress 5.7 compatibility check
7
+
8
  = 4.4.3 =
9
  * bug fixes
10
 
composer.json CHANGED
@@ -3,6 +3,12 @@
3
  "description": "LiveChat for WordPress",
4
  "type": "wordpress-module",
5
  "license": "AFL 3.0",
 
 
 
 
 
 
6
  "require": {
7
  "ext-json": "*",
8
  "firebase/php-jwt": "^5.2.0",
@@ -14,7 +20,8 @@
14
  "wp-coding-standards/wpcs": "^2.3.0",
15
  "phpunit/phpunit": "~5.7.27",
16
  "brain/monkey": "^2.4.0",
17
- "mockery/mockery": "^1.3.3"
 
18
  },
19
  "autoload": {
20
  "psr-4": {
@@ -23,5 +30,14 @@
23
  "classmap": [
24
  "plugin_files/"
25
  ]
 
 
 
 
 
 
 
 
 
26
  }
27
  }
3
  "description": "LiveChat for WordPress",
4
  "type": "wordpress-module",
5
  "license": "AFL 3.0",
6
+ "authors": [
7
+ {
8
+ "name": "Livechat",
9
+ "email": "integrations@livechatinc.com"
10
+ }
11
+ ],
12
  "require": {
13
  "ext-json": "*",
14
  "firebase/php-jwt": "^5.2.0",
20
  "wp-coding-standards/wpcs": "^2.3.0",
21
  "phpunit/phpunit": "~5.7.27",
22
  "brain/monkey": "^2.4.0",
23
+ "mockery/mockery": "^1.3.2",
24
+ "phpcompatibility/phpcompatibility-wp": "*"
25
  },
26
  "autoload": {
27
  "psr-4": {
30
  "classmap": [
31
  "plugin_files/"
32
  ]
33
+ },
34
+ "scripts": {
35
+ "test": "phpunit -c phpunit.xml",
36
+ "static-analysis": "phpcs",
37
+ "fix-static-analysis": "phpcbf",
38
+ "bootstrap": "scripts/bootstrap.sh",
39
+ "post-install-cmd": "php composer.phar run-script bootstrap -- wordpress",
40
+ "clear-bootstrap": "rm -f .env changelog.txt config.php readme.txt woocommerce-livechat.php livechat.php",
41
+ "prepare-dist": "scripts/prepare-dist.sh"
42
  }
43
  }
composer.lock CHANGED
@@ -4,20 +4,20 @@
4
  "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
  "This file is @generated automatically"
6
  ],
7
- "content-hash": "ece20f9898d02cdae92704d6c6e7d380",
8
  "packages": [
9
  {
10
  "name": "firebase/php-jwt",
11
- "version": "v5.2.0",
12
  "source": {
13
  "type": "git",
14
  "url": "https://github.com/firebase/php-jwt.git",
15
- "reference": "feb0e820b8436873675fd3aca04f3728eb2185cb"
16
  },
17
  "dist": {
18
  "type": "zip",
19
- "url": "https://api.github.com/repos/firebase/php-jwt/zipball/feb0e820b8436873675fd3aca04f3728eb2185cb",
20
- "reference": "feb0e820b8436873675fd3aca04f3728eb2185cb",
21
  "shasum": ""
22
  },
23
  "require": {
@@ -54,7 +54,7 @@
54
  "jwt",
55
  "php"
56
  ],
57
- "time": "2020-03-25T18:49:23+00:00"
58
  }
59
  ],
60
  "packages-dev": [
@@ -104,16 +104,16 @@
104
  },
105
  {
106
  "name": "brain/monkey",
107
- "version": "2.5.0",
108
  "source": {
109
  "type": "git",
110
  "url": "https://github.com/Brain-WP/BrainMonkey.git",
111
- "reference": "f2295a57da59ff88621cd959dbdb4b288feefd19"
112
  },
113
  "dist": {
114
  "type": "zip",
115
- "url": "https://api.github.com/repos/Brain-WP/BrainMonkey/zipball/f2295a57da59ff88621cd959dbdb4b288feefd19",
116
- "reference": "f2295a57da59ff88621cd959dbdb4b288feefd19",
117
  "shasum": ""
118
  },
119
  "require": {
@@ -166,7 +166,7 @@
166
  "test",
167
  "testing"
168
  ],
169
- "time": "2020-10-09T06:55:33+00:00"
170
  },
171
  {
172
  "name": "dealerdirect/phpcodesniffer-composer-installer",
@@ -236,31 +236,34 @@
236
  },
237
  {
238
  "name": "doctrine/instantiator",
239
- "version": "1.4.0",
240
  "source": {
241
  "type": "git",
242
  "url": "https://github.com/doctrine/instantiator.git",
243
- "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b"
244
  },
245
  "dist": {
246
  "type": "zip",
247
- "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b",
248
- "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b",
249
  "shasum": ""
250
  },
251
  "require": {
252
- "php": "^7.1 || ^8.0"
253
  },
254
  "require-dev": {
255
- "doctrine/coding-standard": "^8.0",
256
  "ext-pdo": "*",
257
  "ext-phar": "*",
258
- "phpbench/phpbench": "^0.13 || 1.0.0-alpha2",
259
- "phpstan/phpstan": "^0.12",
260
- "phpstan/phpstan-phpunit": "^0.12",
261
- "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0"
262
  },
263
  "type": "library",
 
 
 
 
 
264
  "autoload": {
265
  "psr-4": {
266
  "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
@@ -274,30 +277,16 @@
274
  {
275
  "name": "Marco Pivetta",
276
  "email": "ocramius@gmail.com",
277
- "homepage": "https://ocramius.github.io/"
278
  }
279
  ],
280
  "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
281
- "homepage": "https://www.doctrine-project.org/projects/instantiator.html",
282
  "keywords": [
283
  "constructor",
284
  "instantiate"
285
  ],
286
- "funding": [
287
- {
288
- "url": "https://www.doctrine-project.org/sponsorship.html",
289
- "type": "custom"
290
- },
291
- {
292
- "url": "https://www.patreon.com/phpdoctrine",
293
- "type": "patreon"
294
- },
295
- {
296
- "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator",
297
- "type": "tidelift"
298
- }
299
- ],
300
- "time": "2020-11-10T18:47:58+00:00"
301
  },
302
  {
303
  "name": "hamcrest/hamcrest-php",
@@ -348,16 +337,16 @@
348
  },
349
  {
350
  "name": "mockery/mockery",
351
- "version": "1.3.3",
352
  "source": {
353
  "type": "git",
354
  "url": "https://github.com/mockery/mockery.git",
355
- "reference": "60fa2f67f6e4d3634bb4a45ff3171fa52215800d"
356
  },
357
  "dist": {
358
  "type": "zip",
359
- "url": "https://api.github.com/repos/mockery/mockery/zipball/60fa2f67f6e4d3634bb4a45ff3171fa52215800d",
360
- "reference": "60fa2f67f6e4d3634bb4a45ff3171fa52215800d",
361
  "shasum": ""
362
  },
363
  "require": {
@@ -409,32 +398,29 @@
409
  "test double",
410
  "testing"
411
  ],
412
- "time": "2020-08-11T18:10:21+00:00"
413
  },
414
  {
415
  "name": "myclabs/deep-copy",
416
- "version": "1.10.2",
417
  "source": {
418
  "type": "git",
419
  "url": "https://github.com/myclabs/DeepCopy.git",
420
- "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220"
421
  },
422
  "dist": {
423
  "type": "zip",
424
- "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220",
425
- "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220",
426
  "shasum": ""
427
  },
428
  "require": {
429
- "php": "^7.1 || ^8.0"
430
- },
431
- "replace": {
432
- "myclabs/deep-copy": "self.version"
433
  },
434
  "require-dev": {
435
  "doctrine/collections": "^1.0",
436
  "doctrine/common": "^2.6",
437
- "phpunit/phpunit": "^7.1"
438
  },
439
  "type": "library",
440
  "autoload": {
@@ -457,40 +443,199 @@
457
  "object",
458
  "object graph"
459
  ],
460
- "funding": [
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
461
  {
462
- "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy",
463
- "type": "tidelift"
 
 
 
 
 
 
 
 
 
 
464
  }
465
  ],
466
- "time": "2020-11-13T09:40:50+00:00"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
467
  },
468
  {
469
  "name": "phpdocumentor/reflection-common",
470
- "version": "2.2.0",
471
  "source": {
472
  "type": "git",
473
  "url": "https://github.com/phpDocumentor/ReflectionCommon.git",
474
- "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b"
475
  },
476
  "dist": {
477
  "type": "zip",
478
- "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b",
479
- "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b",
480
  "shasum": ""
481
  },
482
  "require": {
483
- "php": "^7.2 || ^8.0"
 
 
 
484
  },
485
  "type": "library",
486
  "extra": {
487
  "branch-alias": {
488
- "dev-2.x": "2.x-dev"
489
  }
490
  },
491
  "autoload": {
492
  "psr-4": {
493
- "phpDocumentor\\Reflection\\": "src/"
 
 
494
  }
495
  },
496
  "notification-url": "https://packagist.org/downloads/",
@@ -512,41 +657,38 @@
512
  "reflection",
513
  "static analysis"
514
  ],
515
- "time": "2020-06-27T09:03:43+00:00"
516
  },
517
  {
518
  "name": "phpdocumentor/reflection-docblock",
519
- "version": "5.2.2",
520
  "source": {
521
  "type": "git",
522
  "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
523
- "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556"
524
  },
525
  "dist": {
526
  "type": "zip",
527
- "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556",
528
- "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556",
529
  "shasum": ""
530
  },
531
  "require": {
532
- "ext-filter": "*",
533
- "php": "^7.2 || ^8.0",
534
- "phpdocumentor/reflection-common": "^2.2",
535
- "phpdocumentor/type-resolver": "^1.3",
536
- "webmozart/assert": "^1.9.1"
537
  },
538
  "require-dev": {
539
- "mockery/mockery": "~1.3.2"
 
540
  },
541
  "type": "library",
542
- "extra": {
543
- "branch-alias": {
544
- "dev-master": "5.x-dev"
545
- }
546
- },
547
  "autoload": {
548
  "psr-4": {
549
- "phpDocumentor\\Reflection\\": "src"
 
 
550
  }
551
  },
552
  "notification-url": "https://packagist.org/downloads/",
@@ -557,45 +699,44 @@
557
  {
558
  "name": "Mike van Riel",
559
  "email": "me@mikevanriel.com"
560
- },
561
- {
562
- "name": "Jaap van Otterdijk",
563
- "email": "account@ijaap.nl"
564
  }
565
  ],
566
  "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
567
- "time": "2020-09-03T19:13:55+00:00"
568
  },
569
  {
570
  "name": "phpdocumentor/type-resolver",
571
- "version": "1.4.0",
572
  "source": {
573
  "type": "git",
574
  "url": "https://github.com/phpDocumentor/TypeResolver.git",
575
- "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0"
576
  },
577
  "dist": {
578
  "type": "zip",
579
- "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0",
580
- "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0",
581
  "shasum": ""
582
  },
583
  "require": {
584
- "php": "^7.2 || ^8.0",
585
- "phpdocumentor/reflection-common": "^2.0"
586
  },
587
  "require-dev": {
588
- "ext-tokenizer": "*"
 
589
  },
590
  "type": "library",
591
  "extra": {
592
  "branch-alias": {
593
- "dev-1.x": "1.x-dev"
594
  }
595
  },
596
  "autoload": {
597
  "psr-4": {
598
- "phpDocumentor\\Reflection\\": "src"
 
 
599
  }
600
  },
601
  "notification-url": "https://packagist.org/downloads/",
@@ -608,8 +749,7 @@
608
  "email": "me@mikevanriel.com"
609
  }
610
  ],
611
- "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
612
- "time": "2020-09-17T18:55:26+00:00"
613
  },
614
  {
615
  "name": "phpspec/prophecy",
@@ -876,29 +1016,29 @@
876
  },
877
  {
878
  "name": "phpunit/php-token-stream",
879
- "version": "2.0.2",
880
  "source": {
881
  "type": "git",
882
  "url": "https://github.com/sebastianbergmann/php-token-stream.git",
883
- "reference": "791198a2c6254db10131eecfe8c06670700904db"
884
  },
885
  "dist": {
886
  "type": "zip",
887
- "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db",
888
- "reference": "791198a2c6254db10131eecfe8c06670700904db",
889
  "shasum": ""
890
  },
891
  "require": {
892
  "ext-tokenizer": "*",
893
- "php": "^7.0"
894
  },
895
  "require-dev": {
896
- "phpunit/phpunit": "^6.2.4"
897
  },
898
  "type": "library",
899
  "extra": {
900
  "branch-alias": {
901
- "dev-master": "2.0-dev"
902
  }
903
  },
904
  "autoload": {
@@ -922,7 +1062,7 @@
922
  "tokenizer"
923
  ],
924
  "abandoned": true,
925
- "time": "2017-11-27T05:48:46+00:00"
926
  },
927
  {
928
  "name": "phpunit/phpunit",
@@ -1638,20 +1778,20 @@
1638
  },
1639
  {
1640
  "name": "symfony/polyfill-ctype",
1641
- "version": "v1.20.0",
1642
  "source": {
1643
  "type": "git",
1644
  "url": "https://github.com/symfony/polyfill-ctype.git",
1645
- "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41"
1646
  },
1647
  "dist": {
1648
  "type": "zip",
1649
- "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f4ba089a5b6366e453971d3aad5fe8e897b37f41",
1650
- "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41",
1651
  "shasum": ""
1652
  },
1653
  "require": {
1654
- "php": ">=7.1"
1655
  },
1656
  "suggest": {
1657
  "ext-ctype": "For best performance"
@@ -1659,7 +1799,7 @@
1659
  "type": "library",
1660
  "extra": {
1661
  "branch-alias": {
1662
- "dev-main": "1.20-dev"
1663
  },
1664
  "thanks": {
1665
  "name": "symfony/polyfill",
@@ -1710,31 +1850,31 @@
1710
  "type": "tidelift"
1711
  }
1712
  ],
1713
- "time": "2020-10-23T14:02:19+00:00"
1714
  },
1715
  {
1716
  "name": "symfony/yaml",
1717
- "version": "v4.4.17",
1718
  "source": {
1719
  "type": "git",
1720
  "url": "https://github.com/symfony/yaml.git",
1721
- "reference": "7531361cf38e4816821b4a12a42542b3c6143ad1"
1722
  },
1723
  "dist": {
1724
  "type": "zip",
1725
- "url": "https://api.github.com/repos/symfony/yaml/zipball/7531361cf38e4816821b4a12a42542b3c6143ad1",
1726
- "reference": "7531361cf38e4816821b4a12a42542b3c6143ad1",
1727
  "shasum": ""
1728
  },
1729
  "require": {
1730
- "php": ">=7.1.3",
1731
  "symfony/polyfill-ctype": "~1.8"
1732
  },
1733
  "conflict": {
1734
  "symfony/console": "<3.4"
1735
  },
1736
  "require-dev": {
1737
- "symfony/console": "^3.4|^4.0|^5.0"
1738
  },
1739
  "suggest": {
1740
  "symfony/console": "For validating YAML files using the lint command"
@@ -1778,19 +1918,19 @@
1778
  "type": "tidelift"
1779
  }
1780
  ],
1781
- "time": "2020-11-24T12:28:30+00:00"
1782
  },
1783
  {
1784
  "name": "webmozart/assert",
1785
  "version": "1.9.1",
1786
  "source": {
1787
  "type": "git",
1788
- "url": "https://github.com/webmozart/assert.git",
1789
  "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389"
1790
  },
1791
  "dist": {
1792
  "type": "zip",
1793
- "url": "https://api.github.com/repos/webmozart/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389",
1794
  "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389",
1795
  "shasum": ""
1796
  },
4
  "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
  "This file is @generated automatically"
6
  ],
7
+ "content-hash": "5ecd6538430bf3f9c48d4a17fb8a0e74",
8
  "packages": [
9
  {
10
  "name": "firebase/php-jwt",
11
+ "version": "v5.2.1",
12
  "source": {
13
  "type": "git",
14
  "url": "https://github.com/firebase/php-jwt.git",
15
+ "reference": "f42c9110abe98dd6cfe9053c49bc86acc70b2d23"
16
  },
17
  "dist": {
18
  "type": "zip",
19
+ "url": "https://api.github.com/repos/firebase/php-jwt/zipball/f42c9110abe98dd6cfe9053c49bc86acc70b2d23",
20
+ "reference": "f42c9110abe98dd6cfe9053c49bc86acc70b2d23",
21
  "shasum": ""
22
  },
23
  "require": {
54
  "jwt",
55
  "php"
56
  ],
57
+ "time": "2021-02-12T00:02:00+00:00"
58
  }
59
  ],
60
  "packages-dev": [
104
  },
105
  {
106
  "name": "brain/monkey",
107
+ "version": "2.6.0",
108
  "source": {
109
  "type": "git",
110
  "url": "https://github.com/Brain-WP/BrainMonkey.git",
111
+ "reference": "7042140000b4b18034c0c0010d86274a00f25442"
112
  },
113
  "dist": {
114
  "type": "zip",
115
+ "url": "https://api.github.com/repos/Brain-WP/BrainMonkey/zipball/7042140000b4b18034c0c0010d86274a00f25442",
116
+ "reference": "7042140000b4b18034c0c0010d86274a00f25442",
117
  "shasum": ""
118
  },
119
  "require": {
166
  "test",
167
  "testing"
168
  ],
169
+ "time": "2020-10-13T17:56:14+00:00"
170
  },
171
  {
172
  "name": "dealerdirect/phpcodesniffer-composer-installer",
236
  },
237
  {
238
  "name": "doctrine/instantiator",
239
+ "version": "1.0.5",
240
  "source": {
241
  "type": "git",
242
  "url": "https://github.com/doctrine/instantiator.git",
243
+ "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
244
  },
245
  "dist": {
246
  "type": "zip",
247
+ "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
248
+ "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
249
  "shasum": ""
250
  },
251
  "require": {
252
+ "php": ">=5.3,<8.0-DEV"
253
  },
254
  "require-dev": {
255
+ "athletic/athletic": "~0.1.8",
256
  "ext-pdo": "*",
257
  "ext-phar": "*",
258
+ "phpunit/phpunit": "~4.0",
259
+ "squizlabs/php_codesniffer": "~2.0"
 
 
260
  },
261
  "type": "library",
262
+ "extra": {
263
+ "branch-alias": {
264
+ "dev-master": "1.0.x-dev"
265
+ }
266
+ },
267
  "autoload": {
268
  "psr-4": {
269
  "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
277
  {
278
  "name": "Marco Pivetta",
279
  "email": "ocramius@gmail.com",
280
+ "homepage": "http://ocramius.github.com/"
281
  }
282
  ],
283
  "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
284
+ "homepage": "https://github.com/doctrine/instantiator",
285
  "keywords": [
286
  "constructor",
287
  "instantiate"
288
  ],
289
+ "time": "2015-06-14T21:17:01+00:00"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
290
  },
291
  {
292
  "name": "hamcrest/hamcrest-php",
337
  },
338
  {
339
  "name": "mockery/mockery",
340
+ "version": "1.3.4",
341
  "source": {
342
  "type": "git",
343
  "url": "https://github.com/mockery/mockery.git",
344
+ "reference": "31467aeb3ca3188158613322d66df81cedd86626"
345
  },
346
  "dist": {
347
  "type": "zip",
348
+ "url": "https://api.github.com/repos/mockery/mockery/zipball/31467aeb3ca3188158613322d66df81cedd86626",
349
+ "reference": "31467aeb3ca3188158613322d66df81cedd86626",
350
  "shasum": ""
351
  },
352
  "require": {
398
  "test double",
399
  "testing"
400
  ],
401
+ "time": "2021-02-24T09:51:00+00:00"
402
  },
403
  {
404
  "name": "myclabs/deep-copy",
405
+ "version": "1.7.0",
406
  "source": {
407
  "type": "git",
408
  "url": "https://github.com/myclabs/DeepCopy.git",
409
+ "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e"
410
  },
411
  "dist": {
412
  "type": "zip",
413
+ "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e",
414
+ "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e",
415
  "shasum": ""
416
  },
417
  "require": {
418
+ "php": "^5.6 || ^7.0"
 
 
 
419
  },
420
  "require-dev": {
421
  "doctrine/collections": "^1.0",
422
  "doctrine/common": "^2.6",
423
+ "phpunit/phpunit": "^4.1"
424
  },
425
  "type": "library",
426
  "autoload": {
443
  "object",
444
  "object graph"
445
  ],
446
+ "time": "2017-10-19T19:58:43+00:00"
447
+ },
448
+ {
449
+ "name": "phpcompatibility/php-compatibility",
450
+ "version": "9.3.5",
451
+ "source": {
452
+ "type": "git",
453
+ "url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
454
+ "reference": "9fb324479acf6f39452e0655d2429cc0d3914243"
455
+ },
456
+ "dist": {
457
+ "type": "zip",
458
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243",
459
+ "reference": "9fb324479acf6f39452e0655d2429cc0d3914243",
460
+ "shasum": ""
461
+ },
462
+ "require": {
463
+ "php": ">=5.3",
464
+ "squizlabs/php_codesniffer": "^2.3 || ^3.0.2"
465
+ },
466
+ "conflict": {
467
+ "squizlabs/php_codesniffer": "2.6.2"
468
+ },
469
+ "require-dev": {
470
+ "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
471
+ },
472
+ "suggest": {
473
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
474
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
475
+ },
476
+ "type": "phpcodesniffer-standard",
477
+ "notification-url": "https://packagist.org/downloads/",
478
+ "license": [
479
+ "LGPL-3.0-or-later"
480
+ ],
481
+ "authors": [
482
  {
483
+ "name": "Wim Godden",
484
+ "homepage": "https://github.com/wimg",
485
+ "role": "lead"
486
+ },
487
+ {
488
+ "name": "Juliette Reinders Folmer",
489
+ "homepage": "https://github.com/jrfnl",
490
+ "role": "lead"
491
+ },
492
+ {
493
+ "name": "Contributors",
494
+ "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors"
495
  }
496
  ],
497
+ "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.",
498
+ "homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
499
+ "keywords": [
500
+ "compatibility",
501
+ "phpcs",
502
+ "standards"
503
+ ],
504
+ "time": "2019-12-27T09:44:58+00:00"
505
+ },
506
+ {
507
+ "name": "phpcompatibility/phpcompatibility-paragonie",
508
+ "version": "1.3.1",
509
+ "source": {
510
+ "type": "git",
511
+ "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git",
512
+ "reference": "ddabec839cc003651f2ce695c938686d1086cf43"
513
+ },
514
+ "dist": {
515
+ "type": "zip",
516
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/ddabec839cc003651f2ce695c938686d1086cf43",
517
+ "reference": "ddabec839cc003651f2ce695c938686d1086cf43",
518
+ "shasum": ""
519
+ },
520
+ "require": {
521
+ "phpcompatibility/php-compatibility": "^9.0"
522
+ },
523
+ "require-dev": {
524
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7",
525
+ "paragonie/random_compat": "dev-master",
526
+ "paragonie/sodium_compat": "dev-master"
527
+ },
528
+ "suggest": {
529
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
530
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
531
+ },
532
+ "type": "phpcodesniffer-standard",
533
+ "notification-url": "https://packagist.org/downloads/",
534
+ "license": [
535
+ "LGPL-3.0-or-later"
536
+ ],
537
+ "authors": [
538
+ {
539
+ "name": "Wim Godden",
540
+ "role": "lead"
541
+ },
542
+ {
543
+ "name": "Juliette Reinders Folmer",
544
+ "role": "lead"
545
+ }
546
+ ],
547
+ "description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.",
548
+ "homepage": "http://phpcompatibility.com/",
549
+ "keywords": [
550
+ "compatibility",
551
+ "paragonie",
552
+ "phpcs",
553
+ "polyfill",
554
+ "standards"
555
+ ],
556
+ "time": "2021-02-15T10:24:51+00:00"
557
+ },
558
+ {
559
+ "name": "phpcompatibility/phpcompatibility-wp",
560
+ "version": "2.1.1",
561
+ "source": {
562
+ "type": "git",
563
+ "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git",
564
+ "reference": "b7dc0cd7a8f767ccac5e7637550ea1c50a67b09e"
565
+ },
566
+ "dist": {
567
+ "type": "zip",
568
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/b7dc0cd7a8f767ccac5e7637550ea1c50a67b09e",
569
+ "reference": "b7dc0cd7a8f767ccac5e7637550ea1c50a67b09e",
570
+ "shasum": ""
571
+ },
572
+ "require": {
573
+ "phpcompatibility/php-compatibility": "^9.0",
574
+ "phpcompatibility/phpcompatibility-paragonie": "^1.0"
575
+ },
576
+ "require-dev": {
577
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7"
578
+ },
579
+ "suggest": {
580
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
581
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
582
+ },
583
+ "type": "phpcodesniffer-standard",
584
+ "notification-url": "https://packagist.org/downloads/",
585
+ "license": [
586
+ "LGPL-3.0-or-later"
587
+ ],
588
+ "authors": [
589
+ {
590
+ "name": "Wim Godden",
591
+ "role": "lead"
592
+ },
593
+ {
594
+ "name": "Juliette Reinders Folmer",
595
+ "role": "lead"
596
+ }
597
+ ],
598
+ "description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.",
599
+ "homepage": "http://phpcompatibility.com/",
600
+ "keywords": [
601
+ "compatibility",
602
+ "phpcs",
603
+ "standards",
604
+ "wordpress"
605
+ ],
606
+ "time": "2021-02-15T12:58:46+00:00"
607
  },
608
  {
609
  "name": "phpdocumentor/reflection-common",
610
+ "version": "1.0.1",
611
  "source": {
612
  "type": "git",
613
  "url": "https://github.com/phpDocumentor/ReflectionCommon.git",
614
+ "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6"
615
  },
616
  "dist": {
617
  "type": "zip",
618
+ "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6",
619
+ "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6",
620
  "shasum": ""
621
  },
622
  "require": {
623
+ "php": ">=5.5"
624
+ },
625
+ "require-dev": {
626
+ "phpunit/phpunit": "^4.6"
627
  },
628
  "type": "library",
629
  "extra": {
630
  "branch-alias": {
631
+ "dev-master": "1.0.x-dev"
632
  }
633
  },
634
  "autoload": {
635
  "psr-4": {
636
+ "phpDocumentor\\Reflection\\": [
637
+ "src"
638
+ ]
639
  }
640
  },
641
  "notification-url": "https://packagist.org/downloads/",
657
  "reflection",
658
  "static analysis"
659
  ],
660
+ "time": "2017-09-11T18:02:19+00:00"
661
  },
662
  {
663
  "name": "phpdocumentor/reflection-docblock",
664
+ "version": "3.3.2",
665
  "source": {
666
  "type": "git",
667
  "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
668
+ "reference": "bf329f6c1aadea3299f08ee804682b7c45b326a2"
669
  },
670
  "dist": {
671
  "type": "zip",
672
+ "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/bf329f6c1aadea3299f08ee804682b7c45b326a2",
673
+ "reference": "bf329f6c1aadea3299f08ee804682b7c45b326a2",
674
  "shasum": ""
675
  },
676
  "require": {
677
+ "php": "^5.6 || ^7.0",
678
+ "phpdocumentor/reflection-common": "^1.0.0",
679
+ "phpdocumentor/type-resolver": "^0.4.0",
680
+ "webmozart/assert": "^1.0"
 
681
  },
682
  "require-dev": {
683
+ "mockery/mockery": "^0.9.4",
684
+ "phpunit/phpunit": "^4.4"
685
  },
686
  "type": "library",
 
 
 
 
 
687
  "autoload": {
688
  "psr-4": {
689
+ "phpDocumentor\\Reflection\\": [
690
+ "src/"
691
+ ]
692
  }
693
  },
694
  "notification-url": "https://packagist.org/downloads/",
699
  {
700
  "name": "Mike van Riel",
701
  "email": "me@mikevanriel.com"
 
 
 
 
702
  }
703
  ],
704
  "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
705
+ "time": "2017-11-10T14:09:06+00:00"
706
  },
707
  {
708
  "name": "phpdocumentor/type-resolver",
709
+ "version": "0.4.0",
710
  "source": {
711
  "type": "git",
712
  "url": "https://github.com/phpDocumentor/TypeResolver.git",
713
+ "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7"
714
  },
715
  "dist": {
716
  "type": "zip",
717
+ "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7",
718
+ "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7",
719
  "shasum": ""
720
  },
721
  "require": {
722
+ "php": "^5.5 || ^7.0",
723
+ "phpdocumentor/reflection-common": "^1.0"
724
  },
725
  "require-dev": {
726
+ "mockery/mockery": "^0.9.4",
727
+ "phpunit/phpunit": "^5.2||^4.8.24"
728
  },
729
  "type": "library",
730
  "extra": {
731
  "branch-alias": {
732
+ "dev-master": "1.0.x-dev"
733
  }
734
  },
735
  "autoload": {
736
  "psr-4": {
737
+ "phpDocumentor\\Reflection\\": [
738
+ "src/"
739
+ ]
740
  }
741
  },
742
  "notification-url": "https://packagist.org/downloads/",
749
  "email": "me@mikevanriel.com"
750
  }
751
  ],
752
+ "time": "2017-07-14T14:27:02+00:00"
 
753
  },
754
  {
755
  "name": "phpspec/prophecy",
1016
  },
1017
  {
1018
  "name": "phpunit/php-token-stream",
1019
+ "version": "1.4.12",
1020
  "source": {
1021
  "type": "git",
1022
  "url": "https://github.com/sebastianbergmann/php-token-stream.git",
1023
+ "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16"
1024
  },
1025
  "dist": {
1026
  "type": "zip",
1027
+ "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16",
1028
+ "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16",
1029
  "shasum": ""
1030
  },
1031
  "require": {
1032
  "ext-tokenizer": "*",
1033
+ "php": ">=5.3.3"
1034
  },
1035
  "require-dev": {
1036
+ "phpunit/phpunit": "~4.2"
1037
  },
1038
  "type": "library",
1039
  "extra": {
1040
  "branch-alias": {
1041
+ "dev-master": "1.4-dev"
1042
  }
1043
  },
1044
  "autoload": {
1062
  "tokenizer"
1063
  ],
1064
  "abandoned": true,
1065
+ "time": "2017-12-04T08:55:13+00:00"
1066
  },
1067
  {
1068
  "name": "phpunit/phpunit",
1778
  },
1779
  {
1780
  "name": "symfony/polyfill-ctype",
1781
+ "version": "v1.19.0",
1782
  "source": {
1783
  "type": "git",
1784
  "url": "https://github.com/symfony/polyfill-ctype.git",
1785
+ "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b"
1786
  },
1787
  "dist": {
1788
  "type": "zip",
1789
+ "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/aed596913b70fae57be53d86faa2e9ef85a2297b",
1790
+ "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b",
1791
  "shasum": ""
1792
  },
1793
  "require": {
1794
+ "php": ">=5.3.3"
1795
  },
1796
  "suggest": {
1797
  "ext-ctype": "For best performance"
1799
  "type": "library",
1800
  "extra": {
1801
  "branch-alias": {
1802
+ "dev-main": "1.19-dev"
1803
  },
1804
  "thanks": {
1805
  "name": "symfony/polyfill",
1850
  "type": "tidelift"
1851
  }
1852
  ],
1853
+ "time": "2020-10-23T09:01:57+00:00"
1854
  },
1855
  {
1856
  "name": "symfony/yaml",
1857
+ "version": "v3.4.47",
1858
  "source": {
1859
  "type": "git",
1860
  "url": "https://github.com/symfony/yaml.git",
1861
+ "reference": "88289caa3c166321883f67fe5130188ebbb47094"
1862
  },
1863
  "dist": {
1864
  "type": "zip",
1865
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/88289caa3c166321883f67fe5130188ebbb47094",
1866
+ "reference": "88289caa3c166321883f67fe5130188ebbb47094",
1867
  "shasum": ""
1868
  },
1869
  "require": {
1870
+ "php": "^5.5.9|>=7.0.8",
1871
  "symfony/polyfill-ctype": "~1.8"
1872
  },
1873
  "conflict": {
1874
  "symfony/console": "<3.4"
1875
  },
1876
  "require-dev": {
1877
+ "symfony/console": "~3.4|~4.0"
1878
  },
1879
  "suggest": {
1880
  "symfony/console": "For validating YAML files using the lint command"
1918
  "type": "tidelift"
1919
  }
1920
  ],
1921
+ "time": "2020-10-24T10:57:07+00:00"
1922
  },
1923
  {
1924
  "name": "webmozart/assert",
1925
  "version": "1.9.1",
1926
  "source": {
1927
  "type": "git",
1928
+ "url": "https://github.com/webmozarts/assert.git",
1929
  "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389"
1930
  },
1931
  "dist": {
1932
  "type": "zip",
1933
+ "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389",
1934
  "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389",
1935
  "shasum": ""
1936
  },
config.php CHANGED
@@ -1,9 +1,20 @@
1
  <?php
2
 
3
- define('PLUGIN_SLUG', 'wp-live-chat-software-for-wordpress');
4
- define('LC_RESOURCES_URL', 'https://www.livechat.com/wp-resources-integration/');
5
- define('LC_APP_URL_PATTERN', 'https://connect.livechatinc.com/%s/wordpress');
6
- define('LC_API_URL_PATTERN', 'https://%s.livechatinc.com');
7
- define('LC_AA_URL', 'https://my.livechatinc.com');
8
- define('LC_PARTNER_ID', '');
9
- define('LC_UTM_CAMPAIGN', '');
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
 
3
+ define( 'PLUGIN_SLUG', 'wp-live-chat-software-for-wordpress' );
4
+ define( 'PLUGIN_MAIN_FILE', PLUGIN_SLUG . '/livechat.php' );
5
+ define( 'OPTION_PREFIX', 'livechat_' );
6
+ define( 'MENU_SLUG', 'livechat' );
7
+ define( 'LC_RESOURCES_URL', 'https://www.livechat.com/wp-resources-integration/' );
8
+ define( 'LC_APP_URL_PATTERN', 'https://connect.livechatinc.com/%s/%s%s' );
9
+ define( 'LC_API_URL_PATTERN', 'https://%s.livechatinc.com' );
10
+ define( 'LC_WIDGET_URL_REGEX', '/^https:\/\/connect(-eu)?\.livechatinc\.com\/api\/v1\/script\/([a-z]|[A-Z]|[0-9]|[-]){36}\/widget\.js(\?lcv=([a-z]|[A-Z]|[0-9]|[-]){36})?$/' );
11
+ define( 'LC_AA_URL', 'https://my.livechatinc.com' );
12
+ define( 'LC_PARTNER_ID', '' );
13
+ define( 'LC_UTM_CAMPAIGN', '' );
14
+
15
+ // Below has to be done this way because of PHP 5.6 limitations for using arrays in define.
16
+ const DEPRECATED_OPTION_PREFIXES = array(
17
+ 'wp-legacy' => 'livechat_',
18
+ 'woo-legacy' => 'wc-lc_',
19
+ 'woo-2.x' => 'woo_livechat_',
20
+ );
languages/livechat-woocommerce.pot ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #, fuzzy
2
+ msgid ""
3
+ msgstr ""
4
+ "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
5
+ "Project-Id-Version: LiveChat WooCommerce\n"
6
+ "POT-Creation-Date: 2021-03-03 13:11+0100\n"
7
+ "PO-Revision-Date: 2020-07-21 11:47+0200\n"
8
+ "Last-Translator: LiveChat, Inc <apps@livechatinc.com>\n"
9
+ "Language-Team: LiveChat, Inc <apps@livechatinc.com>\n"
10
+ "MIME-Version: 1.0\n"
11
+ "Content-Type: text/plain; charset=UTF-8\n"
12
+ "Content-Transfer-Encoding: 8bit\n"
13
+ "X-Generator: Poedit 2.4.2\n"
14
+ "X-Poedit-Basepath: ..\n"
15
+ "X-Poedit-Flags-xgettext: --add-comments=translators:\n"
16
+ "X-Poedit-WPHeader: woocommerce-livechat.php\n"
17
+ "X-Poedit-SourceCharset: UTF-8\n"
18
+ "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
19
+ "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;"
20
+ "_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
21
+ "X-Poedit-SearchPath-0: .\n"
22
+ "X-Poedit-SearchPathExcluded-0: *.min.js\n"
23
+ "X-Poedit-SearchPathExcluded-1: vendor\n"
24
+
25
+ #: plugin_files/Services/MenuProvider.class.php:155
26
+ #: plugin_files/Services/MenuProvider.class.php:156
27
+ #: plugin_files/Services/MenuProvider.class.php:222
28
+ msgid "Settings"
29
+ msgstr ""
30
+
31
+ #: plugin_files/Services/MenuProvider.class.php:164
32
+ #: plugin_files/Services/MenuProvider.class.php:165
33
+ msgid "Resources"
34
+ msgstr ""
35
+
36
+ #: plugin_files/Services/MenuProvider.class.php:182
37
+ #: plugin_files/Services/MenuProvider.class.php:183
38
+ msgid "Go to LiveChat"
39
+ msgstr ""
40
+
41
+ #: plugin_files/Services/Templates/ConfirmIdentityNoticeTemplate.class.php:20
42
+ msgid "Action required - confirm your identity"
43
+ msgstr ""
44
+
45
+ #: plugin_files/Services/Templates/ConfirmIdentityNoticeTemplate.class.php:22
46
+ msgid ""
47
+ "Thank you for updating LiveChat to the latest version. Please click Connect "
48
+ "to confirm your identity and finish the installation."
49
+ msgstr ""
50
+
51
+ #: plugin_files/Services/Templates/ConfirmIdentityNoticeTemplate.class.php:25
52
+ #: plugin_files/Services/Templates/ConnectNoticeTemplate.class.php:31
53
+ msgid "Connect"
54
+ msgstr ""
55
+
56
+ #: plugin_files/Services/Templates/ConnectNoticeTemplate.class.php:27
57
+ msgid "Action required - connect LiveChat"
58
+ msgstr ""
59
+
60
+ #: plugin_files/Services/Templates/ConnectNoticeTemplate.class.php:28
61
+ msgid "Please"
62
+ msgstr ""
63
+
64
+ #: plugin_files/Services/Templates/ConnectNoticeTemplate.class.php:29
65
+ msgid "connect your LiveChat account"
66
+ msgstr ""
67
+
68
+ #: plugin_files/Services/Templates/ConnectNoticeTemplate.class.php:30
69
+ msgid "to start chatting with your customers."
70
+ msgstr ""
71
+
72
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:25
73
+ msgid "Cancel"
74
+ msgstr ""
75
+
76
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:32
77
+ msgid "Quick Feedback"
78
+ msgstr ""
79
+
80
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:33
81
+ msgid ""
82
+ "If you have a moment, please let us know why you are deactivating LiveChat:"
83
+ msgstr ""
84
+
85
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:34
86
+ msgid "I no longer need the plugin."
87
+ msgstr ""
88
+
89
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:35
90
+ msgid "I couldn't get the plugin to work."
91
+ msgstr ""
92
+
93
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:36
94
+ msgid "I found a better plugin."
95
+ msgstr ""
96
+
97
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:37
98
+ msgid "It's a temporary deactivation."
99
+ msgstr ""
100
+
101
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:38
102
+ msgid "Other"
103
+ msgstr ""
104
+
105
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:39
106
+ msgid "Tell us more..."
107
+ msgstr ""
108
+
109
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:40
110
+ msgid "Please choose one of available options."
111
+ msgstr ""
112
+
113
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:41
114
+ msgid "Please provide additional feedback."
115
+ msgstr ""
116
+
117
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:45
118
+ msgid "Skip & continue"
119
+ msgstr ""
120
+
121
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:46
122
+ msgid "Send feedback"
123
+ msgstr ""
124
+
125
+ #. Plugin Name of the plugin/theme
126
+ msgid "LiveChat WooCommerce"
127
+ msgstr ""
128
+
129
+ #. Plugin URI of the plugin/theme
130
+ msgid "https://www.livechat.com/marketplace/apps/woocommerce"
131
+ msgstr ""
132
+
133
+ #. Description of the plugin/theme
134
+ msgid ""
135
+ "Live chat software for live help, online sales and customer support. This "
136
+ "plugin allows to quickly install LiveChat on any WooCommerce website."
137
+ msgstr ""
138
+
139
+ #. Author of the plugin/theme
140
+ msgid "LiveChat"
141
+ msgstr ""
142
+
143
+ #. Author URI of the plugin/theme
144
+ msgid "https://www.livechat.com"
145
+ msgstr ""
languages/wp-live-chat-software-for-wordpress.pot CHANGED
@@ -3,14 +3,14 @@ msgid ""
3
  msgstr ""
4
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
5
  "Project-Id-Version: LiveChat\n"
6
- "POT-Creation-Date: 2019-11-26 16:43+0100\n"
7
- "PO-Revision-Date: 2019-11-12 12:07+0100\n"
8
- "Last-Translator: \n"
9
- "Language-Team: \n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
- "X-Generator: Poedit 2.2.4\n"
14
  "X-Poedit-Basepath: ..\n"
15
  "X-Poedit-Flags-xgettext: --add-comments=translators:\n"
16
  "X-Poedit-WPHeader: livechat.php\n"
@@ -22,125 +22,106 @@ msgstr ""
22
  "X-Poedit-SearchPathExcluded-0: *.min.js\n"
23
  "X-Poedit-SearchPathExcluded-1: vendor\n"
24
 
25
- #: plugin_files/Helpers/ConfirmIdentityNoticeHelper.class.php:23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  msgid "Action required - confirm your identity"
27
  msgstr ""
28
 
29
- #: plugin_files/Helpers/ConfirmIdentityNoticeHelper.class.php:25
30
  msgid ""
31
  "Thank you for updating LiveChat to the latest version. Please click Connect "
32
  "to confirm your identity and finish the installation."
33
  msgstr ""
34
 
35
- #: plugin_files/Helpers/ConfirmIdentityNoticeHelper.class.php:28
36
- #: plugin_files/Helpers/ConnectNoticeHelper.class.php:36
37
  msgid "Connect"
38
  msgstr ""
39
 
40
- #: plugin_files/Helpers/ConnectNoticeHelper.class.php:25
41
  msgid "Action required - connect LiveChat"
42
  msgstr ""
43
 
44
- #: plugin_files/Helpers/ConnectNoticeHelper.class.php:28
45
  msgid "Please"
46
  msgstr ""
47
 
48
- #: plugin_files/Helpers/ConnectNoticeHelper.class.php:29
49
  msgid "connect your LiveChat account"
50
  msgstr ""
51
 
52
- #: plugin_files/Helpers/ConnectNoticeHelper.class.php:30
53
  msgid "to start chatting with your customers."
54
  msgstr ""
55
 
56
- #: plugin_files/Helpers/DeactivationFeedbackFormHelper.class.php:27
57
  msgid "Cancel"
58
  msgstr ""
59
 
60
- #: plugin_files/Helpers/DeactivationFeedbackFormHelper.class.php:47
61
  msgid "Quick Feedback"
62
  msgstr ""
63
 
64
- #: plugin_files/Helpers/DeactivationFeedbackFormHelper.class.php:60
65
  msgid ""
66
  "If you have a moment, please let us know why you are deactivating LiveChat:"
67
  msgstr ""
68
 
69
- #: plugin_files/Helpers/DeactivationFeedbackFormHelper.class.php:76
70
  msgid "I no longer need the plugin."
71
  msgstr ""
72
 
73
- #: plugin_files/Helpers/DeactivationFeedbackFormHelper.class.php:92
74
  msgid "I couldn't get the plugin to work."
75
  msgstr ""
76
 
77
- #: plugin_files/Helpers/DeactivationFeedbackFormHelper.class.php:108
78
  msgid "I found a better plugin."
79
  msgstr ""
80
 
81
- #: plugin_files/Helpers/DeactivationFeedbackFormHelper.class.php:124
82
  msgid "It's a temporary deactivation."
83
  msgstr ""
84
 
85
- #: plugin_files/Helpers/DeactivationFeedbackFormHelper.class.php:141
86
  msgid "Other"
87
  msgstr ""
88
 
89
- #: plugin_files/Helpers/DeactivationFeedbackFormHelper.class.php:149
90
  msgid "Tell us more..."
91
  msgstr ""
92
 
93
- #: plugin_files/Helpers/DeactivationFeedbackFormHelper.class.php:154
94
  msgid "Please choose one of available options."
95
  msgstr ""
96
 
97
- #: plugin_files/Helpers/DeactivationFeedbackFormHelper.class.php:157
98
  msgid "Please provide additional feedback."
99
  msgstr ""
100
 
101
- #: plugin_files/Helpers/DeactivationFeedbackFormHelper.class.php:173
102
  msgid "Skip & continue"
103
  msgstr ""
104
 
105
- #: plugin_files/Helpers/DeactivationFeedbackFormHelper.class.php:176
106
  msgid "Send feedback"
107
  msgstr ""
108
 
109
- #: plugin_files/Helpers/ReviewNoticeHelper.class.php:24
110
- msgid ""
111
- "Hey, you’ve been using <strong>LiveChat</strong> for more than 14 days - "
112
- "that’s awesome! Could you please do us a BIG favour and <strong>give "
113
- "LiveChat a 5-star rating on WordPress</strong>? Just to help us spread the "
114
- "word and boost our motivation."
115
- msgstr ""
116
-
117
- #: plugin_files/Helpers/ReviewNoticeHelper.class.php:25
118
- msgid "<strong>&ndash; The LiveChat Team</strong>"
119
- msgstr ""
120
-
121
- #: plugin_files/Helpers/ReviewNoticeHelper.class.php:28
122
- msgid "Ok, you deserve it"
123
- msgstr ""
124
-
125
- #: plugin_files/Helpers/ReviewNoticeHelper.class.php:31
126
- msgid "Maybe later"
127
- msgstr ""
128
-
129
- #: plugin_files/Helpers/ReviewNoticeHelper.class.php:34
130
- msgid "No, thanks"
131
- msgstr ""
132
-
133
- #: plugin_files/LiveChatAdmin.class.php:248
134
- #: plugin_files/LiveChatAdmin.class.php:249
135
- #: plugin_files/LiveChatAdmin.class.php:309
136
- msgid "Settings"
137
- msgstr ""
138
-
139
- #: plugin_files/LiveChatAdmin.class.php:257
140
- #: plugin_files/LiveChatAdmin.class.php:258
141
- msgid "Resources"
142
- msgstr ""
143
-
144
  #. Plugin Name of the plugin/theme
145
  #. Author of the plugin/theme
146
  msgid "LiveChat"
3
  msgstr ""
4
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
5
  "Project-Id-Version: LiveChat\n"
6
+ "POT-Creation-Date: 2021-03-03 13:12+0100\n"
7
+ "PO-Revision-Date: 2020-07-21 11:47+0200\n"
8
+ "Last-Translator: LiveChat, Inc <apps@livechatinc.com>\n"
9
+ "Language-Team: LiveChat, Inc <apps@livechatinc.com>\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
+ "X-Generator: Poedit 2.4.2\n"
14
  "X-Poedit-Basepath: ..\n"
15
  "X-Poedit-Flags-xgettext: --add-comments=translators:\n"
16
  "X-Poedit-WPHeader: livechat.php\n"
22
  "X-Poedit-SearchPathExcluded-0: *.min.js\n"
23
  "X-Poedit-SearchPathExcluded-1: vendor\n"
24
 
25
+ #: plugin_files/Services/MenuProvider.class.php:155
26
+ #: plugin_files/Services/MenuProvider.class.php:156
27
+ #: plugin_files/Services/MenuProvider.class.php:222
28
+ msgid "Settings"
29
+ msgstr ""
30
+
31
+ #: plugin_files/Services/MenuProvider.class.php:164
32
+ #: plugin_files/Services/MenuProvider.class.php:165
33
+ msgid "Resources"
34
+ msgstr ""
35
+
36
+ #: plugin_files/Services/MenuProvider.class.php:182
37
+ #: plugin_files/Services/MenuProvider.class.php:183
38
+ msgid "Go to LiveChat"
39
+ msgstr ""
40
+
41
+ #: plugin_files/Services/Templates/ConfirmIdentityNoticeTemplate.class.php:20
42
  msgid "Action required - confirm your identity"
43
  msgstr ""
44
 
45
+ #: plugin_files/Services/Templates/ConfirmIdentityNoticeTemplate.class.php:22
46
  msgid ""
47
  "Thank you for updating LiveChat to the latest version. Please click Connect "
48
  "to confirm your identity and finish the installation."
49
  msgstr ""
50
 
51
+ #: plugin_files/Services/Templates/ConfirmIdentityNoticeTemplate.class.php:25
52
+ #: plugin_files/Services/Templates/ConnectNoticeTemplate.class.php:31
53
  msgid "Connect"
54
  msgstr ""
55
 
56
+ #: plugin_files/Services/Templates/ConnectNoticeTemplate.class.php:27
57
  msgid "Action required - connect LiveChat"
58
  msgstr ""
59
 
60
+ #: plugin_files/Services/Templates/ConnectNoticeTemplate.class.php:28
61
  msgid "Please"
62
  msgstr ""
63
 
64
+ #: plugin_files/Services/Templates/ConnectNoticeTemplate.class.php:29
65
  msgid "connect your LiveChat account"
66
  msgstr ""
67
 
68
+ #: plugin_files/Services/Templates/ConnectNoticeTemplate.class.php:30
69
  msgid "to start chatting with your customers."
70
  msgstr ""
71
 
72
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:25
73
  msgid "Cancel"
74
  msgstr ""
75
 
76
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:32
77
  msgid "Quick Feedback"
78
  msgstr ""
79
 
80
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:33
81
  msgid ""
82
  "If you have a moment, please let us know why you are deactivating LiveChat:"
83
  msgstr ""
84
 
85
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:34
86
  msgid "I no longer need the plugin."
87
  msgstr ""
88
 
89
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:35
90
  msgid "I couldn't get the plugin to work."
91
  msgstr ""
92
 
93
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:36
94
  msgid "I found a better plugin."
95
  msgstr ""
96
 
97
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:37
98
  msgid "It's a temporary deactivation."
99
  msgstr ""
100
 
101
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:38
102
  msgid "Other"
103
  msgstr ""
104
 
105
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:39
106
  msgid "Tell us more..."
107
  msgstr ""
108
 
109
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:40
110
  msgid "Please choose one of available options."
111
  msgstr ""
112
 
113
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:41
114
  msgid "Please provide additional feedback."
115
  msgstr ""
116
 
117
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:45
118
  msgid "Skip & continue"
119
  msgstr ""
120
 
121
+ #: plugin_files/Services/Templates/DeactivationModalTemplate.class.php:46
122
  msgid "Send feedback"
123
  msgstr ""
124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  #. Plugin Name of the plugin/theme
126
  #. Author of the plugin/theme
127
  msgid "LiveChat"
livechat.php CHANGED
@@ -1,35 +1,73 @@
1
  <?php
2
- /*
3
- Plugin Name: LiveChat
4
- Plugin URI: https://www.livechat.com/addons/wordpress/
5
- Description: Live chat software for live help, online sales and customer support. This plugin allows to quickly install LiveChat on any WordPress website.
6
- Author: LiveChat
7
- Author URI: https://www.livechat.com
8
- Version: 4.4.3
9
- Text Domain: wp-live-chat-software-for-wordpress
10
- Domain Path: /languages
11
- */
 
 
 
 
 
 
 
 
12
 
13
  require_once dirname( __FILE__ ) . '/vendor/autoload.php';
14
  require_once dirname( __FILE__ ) . '/config.php';
15
 
16
  /**
17
- * Uninstall hook handler.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  *
19
- * @throws \LiveChat\Exceptions\ApiClientException Can be thrown by uninstall_hook_header method.
20
- * @throws \LiveChat\Exceptions\InvalidTokenException Can Can be thrown by uninstall_hook_header method.
21
  */
22
- function uninstall_hook_handler() {
23
- \LiveChat\LiveChatAdmin::uninstall_hook_handler();
 
 
 
 
 
 
 
 
 
 
24
  }
25
 
26
  if ( is_admin() ) {
27
  require_once dirname( __FILE__ ) . '/plugin_files/LiveChatAdmin.class.php';
28
  \LiveChat\LiveChatAdmin::get_instance();
29
 
30
- register_uninstall_hook( __FILE__, 'uninstall_hook_handler' );
31
  } else {
32
  require_once dirname( __FILE__ ) . '/plugin_files/LiveChat.class.php';
33
  \LiveChat\LiveChat::get_instance();
34
  }
35
-
1
  <?php
2
+ /**
3
+ * Plugin Name: LiveChat
4
+ * Plugin URI: https://www.livechat.com/marketplace/apps/wordpress/
5
+ * Description: Live chat software for live help, online sales and customer support. This plugin allows to quickly install LiveChat on any WordPress website.
6
+ * Version: 4.4.4
7
+ * Author: LiveChat
8
+ * Author URI: https://www.livechat.com
9
+ * Text Domain: wp-live-chat-software-for-wordpress
10
+ * Domain Path: /languages
11
+ *
12
+ * Copyright: © 2020 LiveChat.
13
+ * License: GNU General Public License v3.0
14
+ * License URI: https://www.gnu.org/licenses/gpl-3.0.html
15
+ */
16
+
17
+ if ( class_exists( 'LiveChat\LiveChat' ) ) {
18
+ return;
19
+ }
20
 
21
  require_once dirname( __FILE__ ) . '/vendor/autoload.php';
22
  require_once dirname( __FILE__ ) . '/config.php';
23
 
24
  /**
25
+ * Checks if WooCommerce plugin is active.
26
+ *
27
+ * @return bool
28
+ */
29
+ function is_woo_plugin_active() {
30
+ return in_array( 'woocommerce/woocommerce.php', get_option( 'active_plugins', array() ), true );
31
+ }
32
+
33
+ /**
34
+ * Detects platform based on active plugins.
35
+ *
36
+ * @return string
37
+ * @throws Exception
38
+ */
39
+ function get_detected_platform() {
40
+ require_once dirname( __FILE__ ) . '/plugin_files/Services/PlatformProvider.class.php';
41
+ return \LiveChat\Services\PlatformProvider::create()->get();
42
+ }
43
+
44
+ define( 'PLATFORM', get_detected_platform() );
45
+
46
+ /**
47
+ * Returns current platform.
48
  *
49
+ * @return bool
 
50
  */
51
+ function get_platform() {
52
+ // phpcs:ignore WordPress.WP.CapitalPDangit.Misspelled
53
+ return defined( 'PLATFORM' ) ? PLATFORM : 'wordpress';
54
+ }
55
+
56
+ /**
57
+ * Checks if WooCommerce is current platform.
58
+ *
59
+ * @return bool
60
+ */
61
+ function is_woo() {
62
+ return 'woocommerce' === get_platform();
63
  }
64
 
65
  if ( is_admin() ) {
66
  require_once dirname( __FILE__ ) . '/plugin_files/LiveChatAdmin.class.php';
67
  \LiveChat\LiveChatAdmin::get_instance();
68
 
69
+ register_uninstall_hook( __FILE__, 'LiveChat\LiveChatAdmin::uninstall_hook_handler' );
70
  } else {
71
  require_once dirname( __FILE__ ) . '/plugin_files/LiveChat.class.php';
72
  \LiveChat\LiveChat::get_instance();
73
  }
 
plugin_files/Helpers/ConnectNoticeHelper.class.php DELETED
@@ -1,43 +0,0 @@
1
- <?php
2
- /**
3
- * Class ConnectNoticeHelper
4
- *
5
- * @package LiveChat\Helpers
6
- */
7
-
8
- namespace LiveChat\Helpers;
9
-
10
- /**
11
- * Class ConnectNoticeHelper
12
- */
13
- class ConnectNoticeHelper extends LiveChatHelper {
14
- /**
15
- * Renders ConnectNotice in WP dashboard.
16
- */
17
- public function render() {
18
- ?>
19
- <div class="lc-design-system-typography notice notice-info lc-notice" id="lc-connect-notice">
20
- <div class="lc-notice-column">
21
- <img class="lc-notice-logo" src="<?php echo esc_html( plugins_url( 'wp-live-chat-software-for-wordpress' ) . '/plugin_files/images/livechat-logo.svg' ); ?>" alt="LiveChat logo" />
22
- </div>
23
- <div class="lc-notice-column">
24
- <p id="lc-connect-notice-header">
25
- <?php esc_html_e( 'Action required - connect LiveChat', 'wp-live-chat-software-for-wordpress' ); ?>
26
- </p>
27
- <p>
28
- <?php esc_html_e( 'Please' ); ?>
29
- <a href="admin.php?page=livechat_settings"><?php esc_html_e( 'connect your LiveChat account' ); ?></a>
30
- <?php esc_html_e( 'to start chatting with your customers.', 'wp-live-chat-software-for-wordpress' ); ?>
31
- </p>
32
- </div>
33
- <div class="lc-notice-column" id="lc-connect-notice-button-column">
34
- <p>
35
- <button class="lc-btn lc-btn--primary" id="lc-connect-notice-button" type="button">
36
- <?php esc_html_e( 'Connect', 'wp-live-chat-software-for-wordpress' ); ?>
37
- </button>
38
- </p>
39
- </div>
40
- </div>
41
- <?php
42
- }
43
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin_files/Helpers/ConnectServiceHelper.class.php DELETED
@@ -1,102 +0,0 @@
1
- <?php
2
- /**
3
- * Class ConnectServiceHelper
4
- *
5
- * @package LiveChat\Helpers
6
- */
7
-
8
- namespace LiveChat\Helpers;
9
-
10
- use Exception;
11
- use LiveChat\Services\CertProvider;
12
- use LiveChat\Services\ConnectTokenProvider;
13
- use LiveChat\Services\ModuleConfiguration;
14
- use LiveChat\Services\Store;
15
- use LiveChat\Services\UrlProvider;
16
- use LiveChat\Services\User;
17
- use LiveChat\Services\TemplateParser;
18
-
19
- /**
20
- * Class ConnectServiceHelper
21
- */
22
- class ConnectServiceHelper extends LiveChatHelper {
23
- /**
24
- * ModuleConfiguration instance
25
- *
26
- * @var ModuleConfiguration|null
27
- */
28
- private $module = null;
29
-
30
- /**
31
- * Current user instance
32
- *
33
- * @var User|null
34
- */
35
- private $user = null;
36
-
37
- /**
38
- * Current store instance.
39
- *
40
- * @var Store|null
41
- */
42
- private $store = null;
43
-
44
- /**
45
- * ConnectServiceHelper constructor.
46
- *
47
- * @param ModuleConfiguration $module ModuleConfiguration class instance.
48
- * @param User $user User class instance.
49
- * @param Store $store Store class instance.
50
- */
51
- public function __construct( $module, $user, $store ) {
52
- $this->module = $module;
53
- $this->user = $user;
54
- $this->store = $store;
55
- }
56
-
57
- /**
58
- * Returns app url with region from store token.
59
- *
60
- * @return string
61
- */
62
- private function get_app_url() {
63
- try {
64
- $decoded_token = ConnectTokenProvider::create( CertProvider::create() )->get( $this->store->get_store_token(), 'store' );
65
- return UrlProvider::create( $decoded_token )->get_app_url();
66
- } catch ( Exception $exception ) {
67
- return UrlProvider::create()->get_app_url();
68
- }
69
- }
70
-
71
- /**
72
- * Renders iframe with Connect service.
73
- */
74
- public function render() {
75
- $context = array();
76
- $context['appUrl'] = esc_html( $this->get_app_url() );
77
- $context['siteUrl'] = esc_html( $this->module->get_site_url() );
78
- $context['userEmail'] = esc_html( $this->user->get_user_data()['email'] );
79
- $context['userName'] = esc_html( $this->user->get_user_data()['name'] );
80
- $context['wpVer'] = esc_html( $this->module->get_wp_version() );
81
- $context['moduleVer'] = esc_html( $this->module->get_plugin_version() );
82
- $context['lcToken'] = esc_html( $this->user->get_current_user_token() );
83
- $context['storeToken'] = esc_html( $this->store->get_store_token() );
84
- $context['partnerId'] = esc_html( LC_PARTNER_ID );
85
- $context['utmCampaign'] = esc_html( LC_UTM_CAMPAIGN );
86
-
87
- TemplateParser::create( '../templates' )->parse_template( 'connect.html.twig', $context );
88
- }
89
-
90
- /**
91
- * Returns new instance of ConnectServiceHelper.
92
- *
93
- * @return static
94
- */
95
- public static function create() {
96
- return new static(
97
- ModuleConfiguration::get_instance(),
98
- User::get_instance(),
99
- Store::get_instance()
100
- );
101
- }
102
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin_files/Helpers/DeactivationFeedbackFormHelper.class.php DELETED
@@ -1,183 +0,0 @@
1
- <?php
2
- /**
3
- * Class DeactivationFeedbackFormHelper
4
- *
5
- * @package LiveChat\Helpers
6
- */
7
-
8
- namespace LiveChat\Helpers;
9
-
10
- use LiveChat\LiveChat;
11
- use LiveChat\Services\User;
12
-
13
- /**
14
- * Class DeactivationFeedbackFormHelper
15
- */
16
- class DeactivationFeedbackFormHelper extends LiveChatHelper {
17
- /**
18
- * Renders modal with deactivation feedback form.
19
- */
20
- public function render() {
21
- $wp_user = User::get_instance()->get_user_data();
22
- $license_id = LiveChat::get_instance()->get_license_number();
23
-
24
- ?>
25
- <div class="lc-design-system-typography lc-modal-base__overlay" id="lc-deactivation-feedback-modal-overlay" style="display: none">
26
- <div class="lc-modal-base" id="lc-deactivation-feedback-modal-container">
27
- <button title="<?php esc_html_e( 'Cancel', 'wp-live-chat-software-for-wordpress' ); ?>" class="lc-modal-base__close">
28
- <svg
29
- xmlns="http://www.w3.org/2000/svg"
30
- width="24px"
31
- height="24px"
32
- viewBox="0 0 24 24"
33
- fill="#424D57"
34
- class="material material-close-icon undefined"
35
- >
36
- <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" />
37
- </svg>
38
- </button>
39
- <div class="lc-modal__header">
40
- <div class="lc-modal__heading" id="lc-deactivation-feedback-modal-heading">
41
- <img
42
- id="lc-deactivation-feedback-logo"
43
- alt="LiveChat logo"
44
- src="<?php echo esc_html( plugins_url( 'wp-live-chat-software-for-wordpress' ) . '/plugin_files/images/livechat-logo.svg' ); ?>"
45
- />
46
- <h2 id="lc-deactivation-feedback-modal-title">
47
- <?php esc_html_e( 'Quick Feedback', 'wp-live-chat-software-for-wordpress' ); ?>
48
- </h2>
49
- </div>
50
- </div>
51
- <div class="lc-modal__body">
52
- <form
53
- action="#"
54
- method="post"
55
- id="lc-deactivation-feedback-form"
56
- >
57
- <div role="group" class="lc-form-group">
58
- <div class="lc-form-group__header">
59
- <div class="lc-form-group__label">
60
- <?php esc_html_e( 'If you have a moment, please let us know why you are deactivating LiveChat:', 'wp-live-chat-software-for-wordpress' ); ?>
61
- </div>
62
- </div>
63
- <div class="lc-field-group">
64
- <div class="lc-radio">
65
- <label class="lc-radio__label">
66
- <div class="lc-radio__circle">
67
- <span class="lc-radio__inner-circle"></span>
68
- <input
69
- type="radio"
70
- class="lc-radio__input"
71
- value="I no longer need the plugin."
72
- name="lc-deactivation-feedback-option"
73
- />
74
- </div>
75
- <div class="lc-radio__text">
76
- <?php esc_html_e( 'I no longer need the plugin.', 'wp-live-chat-software-for-wordpress' ); ?>
77
- </div>
78
- </label>
79
- </div>
80
- <div class="lc-radio">
81
- <label class="lc-radio__label">
82
- <div class="lc-radio__circle">
83
- <span class="lc-radio__inner-circle"></span>
84
- <input
85
- type="radio"
86
- class="lc-radio__input"
87
- value="I couldn't get the plugin to work."
88
- name="lc-deactivation-feedback-option"
89
- />
90
- </div>
91
- <div class="lc-radio__text">
92
- <?php esc_html_e( "I couldn't get the plugin to work.", 'wp-live-chat-software-for-wordpress' ); ?>
93
- </div>
94
- </label>
95
- </div>
96
- <div class="lc-radio">
97
- <label class="lc-radio__label">
98
- <div class="lc-radio__circle">
99
- <span class="lc-radio__inner-circle"></span>
100
- <input
101
- type="radio"
102
- class="lc-radio__input"
103
- value="I found a better plugin."
104
- name="lc-deactivation-feedback-option"
105
- />
106
- </div>
107
- <div class="lc-radio__text">
108
- <?php esc_html_e( 'I found a better plugin.', 'wp-live-chat-software-for-wordpress' ); ?>
109
- </div>
110
- </label>
111
- </div>
112
- <div class="lc-radio">
113
- <label class="lc-radio__label">
114
- <div class="lc-radio__circle">
115
- <span class="lc-radio__inner-circle"></span>
116
- <input
117
- type="radio"
118
- class="lc-radio__input"
119
- value="It's a temporary deactivation."
120
- name="lc-deactivation-feedback-option"
121
- />
122
- </div>
123
- <div class="lc-radio__text">
124
- <?php esc_html_e( "It's a temporary deactivation.", 'wp-live-chat-software-for-wordpress' ); ?>
125
- </div>
126
- </label>
127
- </div>
128
- <div class="lc-radio">
129
- <label class="lc-radio__label">
130
- <div class="lc-radio__circle">
131
- <span class="lc-radio__inner-circle"></span>
132
- <input
133
- type="radio"
134
- class="lc-radio__input"
135
- value="Other"
136
- name="lc-deactivation-feedback-option"
137
- id="lc-deactivation-feedback-option-other"
138
- />
139
- </div>
140
- <div class="lc-radio__text">
141
- <?php esc_html_e( 'Other', 'wp-live-chat-software-for-wordpress' ); ?>
142
- </div>
143
- </label>
144
- </div>
145
- <div class="lc-text-field" id="lc-deactivation-feedback-other-field">
146
- <div>
147
- <textarea
148
- class="lc-textarea"
149
- placeholder="<?php esc_html_e( 'Tell us more...', 'wp-live-chat-software-for-wordpress' ); ?>"
150
- ></textarea>
151
- </div>
152
- </div>
153
- <span class="lc-field-error" id="lc-deactivation-feedback-form-option-error">
154
- <?php esc_html_e( 'Please choose one of available options.', 'wp-live-chat-software-for-wordpress' ); ?>
155
- </span>
156
- <span class="lc-field-error" id="lc-deactivation-feedback-form-other-error">
157
- <?php esc_html_e( 'Please provide additional feedback.', 'wp-live-chat-software-for-wordpress' ); ?>
158
- </span>
159
- </div>
160
- </div>
161
- </form>
162
- <script>
163
- window.deactivationDetails = window.deactivationDetails || {};
164
- window.deactivationDetails = {
165
- license: <?php echo esc_html( (int) $license_id ); ?>,
166
- name: '<?php echo esc_html( $wp_user['name'] ); ?>',
167
- wpEmail: '<?php echo esc_html( $wp_user['email'] ); ?>'
168
- };
169
- </script>
170
- </div>
171
- <div class="lc-modal__footer">
172
- <button class="lc-btn" id="lc-deactivation-feedback-modal-skip-btn">
173
- <?php esc_html_e( 'Skip & continue', 'wp-live-chat-software-for-wordpress' ); ?>
174
- </button>
175
- <button class="lc-btn lc-btn--primary" id="lc-deactivation-feedback-modal-submit-btn">
176
- <?php esc_html_e( 'Send feedback', 'wp-live-chat-software-for-wordpress' ); ?>
177
- </button>
178
- </div>
179
- </div>
180
- </div>
181
- <?php
182
- }
183
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin_files/Helpers/LiveChatHelper.class.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
- /**
3
- * Class LiveChatHelper
4
- *
5
- * @package LiveChat\Helpers
6
- */
7
-
8
- namespace LiveChat\Helpers;
9
-
10
- /**
11
- * Class LiveChatHelper
12
- */
13
- abstract class LiveChatHelper {
14
- /**
15
- * Renders helper.
16
- *
17
- * @return mixed
18
- */
19
- abstract public function render();
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin_files/Helpers/ResourcesTabHelper.class.php DELETED
@@ -1,33 +0,0 @@
1
- <?php
2
- /**
3
- * Class ResourcesTabHelper
4
- *
5
- * @package LiveChat\Helpers
6
- */
7
-
8
- namespace LiveChat\Helpers;
9
-
10
- use LiveChat\Services\TemplateParser;
11
-
12
- /**
13
- * Class ResourcesTabHelper
14
- */
15
- class ResourcesTabHelper extends LiveChatHelper {
16
- /**
17
- * Renders iframe with Resources page.
18
- */
19
- public function render() {
20
- $context = array();
21
- $context['resourcesUrl'] = esc_html( LC_RESOURCES_URL );
22
- TemplateParser::create( '../templates' )->parse_template( 'resources.html.twig', $context );
23
- }
24
-
25
- /**
26
- * Returns new instance of ResourcesTabHelper.
27
- *
28
- * @return static
29
- */
30
- public static function create() {
31
- return new static();
32
- }
33
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin_files/Helpers/ReviewNoticeHelper.class.php DELETED
@@ -1,41 +0,0 @@
1
- <?php
2
- /**
3
- * Class ReviewNoticeHelper
4
- *
5
- * @package LiveChat\Helpers
6
- */
7
-
8
- namespace LiveChat\Helpers;
9
-
10
- /**
11
- * Class ReviewNoticeHelper
12
- */
13
- class ReviewNoticeHelper extends LiveChatHelper {
14
- /**
15
- * Renders review notice.
16
- */
17
- public function render() {
18
- ?>
19
- <div class="lc-design-system-typography lc-notice notice notice-info is-dismissible" id="lc-review-notice">
20
- <div class="lc-notice-column">
21
- <img class="lc-notice-logo" src="<?php echo esc_html( plugins_url( 'wp-live-chat-software-for-wordpress' ) . '/plugin_files/images/livechat-logo.svg' ); ?>" alt="LiveChat logo" />
22
- </div>
23
- <div class="lc-notice-column">
24
- <p><?php echo wp_kses( __( 'Hey, you’ve been using <strong>LiveChat</strong> for more than 14 days - that’s awesome! Could you please do us a BIG favour and <strong>give LiveChat a 5-star rating on WordPress</strong>? Just to help us spread the word and boost our motivation.', 'wp-live-chat-software-for-wordpress' ), array( 'strong' => array() ) ); ?></p>
25
- <p><?php echo wp_kses( __( '<strong>&ndash; The LiveChat Team</strong>' ), array( 'strong' => array() ) ); ?></p>
26
- <div id="lc-review-notice-actions">
27
- <a href="https://wordpress.org/support/plugin/wp-live-chat-software-for-wordpress/reviews/#new-post" target="_blank" class="lc-review-notice-action lc-btn lc-btn--compact lc-btn--primary" id="lc-review-now">
28
- <i class="material-icons">thumb_up</i> <span><?php esc_html_e( 'Ok, you deserve it', 'wp-live-chat-software-for-wordpress' ); ?></span>
29
- </a>
30
- <a href="#" class="lc-review-notice-action lc-btn lc-btn--compact" id="lc-review-postpone">
31
- <i class="material-icons">schedule</i> <span><?php esc_html_e( 'Maybe later', 'wp-live-chat-software-for-wordpress' ); ?></span>
32
- </a>
33
- <a href="#" class="lc-review-notice-action lc-btn lc-btn--compact" id="lc-review-dismiss">
34
- <i class="material-icons">not_interested</i> <span><?php esc_html_e( 'No, thanks', 'wp-live-chat-software-for-wordpress' ); ?></span>
35
- </a>
36
- </div>
37
- </div>
38
- </div>
39
- <?php
40
- }
41
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin_files/Helpers/TrackingCodeHelper.class.php DELETED
@@ -1,73 +0,0 @@
1
- <?php
2
- /**
3
- * Class TrackingCodeHelper
4
- *
5
- * @package LiveChat\Helpers
6
- */
7
-
8
- namespace LiveChat\Helpers;
9
-
10
- use LiveChat\LiveChat;
11
- use LiveChat\Services\User;
12
-
13
- /**
14
- * Class TrackingCodeHelper
15
- */
16
- class TrackingCodeHelper extends LiveChatHelper {
17
- /**
18
- * Returns tracking code.
19
- *
20
- * @return string
21
- */
22
- public function render() {
23
- $tracking = '';
24
- $livechat = LiveChat::get_instance();
25
-
26
- if ( $livechat->has_license_number() && ! $livechat->is_installed() ) {
27
- $license_number = LiveChat::get_instance()->get_license_number();
28
- $settings = LiveChat::get_instance()->get_settings();
29
- $check_mobile = LiveChat::get_instance()->check_mobile();
30
- $check_logged = User::get_instance()->check_logged();
31
- $visitor = User::get_instance()->get_user_data();
32
-
33
- if ( ! $settings['disableMobile'] || ( $settings['disableMobile'] && ! $check_mobile ) ) {
34
- if ( ! $settings['disableGuests'] || ( $settings['disableGuests'] && $check_logged ) ) {
35
- $tracking = <<<TRACKING_CODE_START
36
- <script type="text/javascript">
37
- window.__lc = window.__lc || {};
38
- window.__lc.license = {$license_number};
39
-
40
- TRACKING_CODE_START;
41
-
42
- $tracking .= <<<VISITOR_DATA
43
- window.__lc.visitor = {
44
- name: '{$visitor['name']}',
45
- email: '{$visitor['email']}'
46
- };
47
-
48
- VISITOR_DATA;
49
-
50
- $tracking .= <<<TRACKING_CODE_END
51
- (function() {
52
- var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
53
- lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js';
54
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);
55
- })();
56
- </script>
57
-
58
- TRACKING_CODE_END;
59
-
60
- $tracking .= <<<NOSCRIPT
61
- <noscript>
62
- <a href="https://www.livechat.com/chat-with/{$license_number}/">Chat with us</a>,
63
- powered by <a href="https://www.livechat.com/?welcome" rel="noopener" target="_blank">LiveChat</a>
64
- </noscript>
65
- NOSCRIPT;
66
-
67
- }
68
- }
69
- }
70
-
71
- return $tracking;
72
- }
73
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin_files/LiveChat.class.php CHANGED
@@ -7,15 +7,11 @@
7
 
8
  namespace LiveChat;
9
 
10
- use Exception;
11
- use LiveChat\Helpers\TrackingCodeHelper;
12
- use LiveChat\Services\ApiClient;
13
- use LiveChat\Services\CertProvider;
14
- use LiveChat\Services\ConnectToken;
15
- use LiveChat\Services\ConnectTokenProvider;
16
  use LiveChat\Services\ModuleConfiguration;
17
- use LiveChat\Services\Store;
18
- use LiveChat\Services\UrlProvider;
 
19
 
20
  /**
21
  * Class LiveChat
@@ -46,13 +42,30 @@ class LiveChat {
46
  * Starts the plugin
47
  */
48
  public function __construct() {
49
- $this->module = ModuleConfiguration::get_instance();
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
- if ( $this->has_license_number() ) {
52
- add_action( 'wp_head', array( $this, 'tracking_code' ) );
53
- } else {
54
- add_action( 'wp_enqueue_scripts', array( $this, 'widget_script' ) );
 
 
 
55
  }
 
 
56
  }
57
 
58
  /**
@@ -67,145 +80,4 @@ class LiveChat {
67
 
68
  return static::$instance;
69
  }
70
-
71
- /**
72
- * Adds chat widget to WP site.
73
- * It is used only for migrated users who are not connected to new integration.
74
- */
75
- public function tracking_code() {
76
- echo wp_kses(
77
- ( new TrackingCodeHelper() )->render(),
78
- array(
79
- 'script' => array(
80
- 'type' => array(),
81
- ),
82
- 'noscript' => array(),
83
- 'a' => array(
84
- 'href' => array(),
85
- 'rel' => array(),
86
- 'target' => array(),
87
- ),
88
- )
89
- );
90
- }
91
-
92
- /**
93
- * Returns true if LiveChat store token is set (not empty string),
94
- * false otherwise
95
- *
96
- * @return bool
97
- */
98
- public function is_installed() {
99
- return ! empty( Store::get_instance()->get_store_token() );
100
- }
101
-
102
- /**
103
- * Returns true number if option exists and is valid,
104
- * false otherwise
105
- *
106
- * @return bool
107
- */
108
- public function has_license_number() {
109
- $license_number = max( 0, get_option( 'livechat_license_number' ) );
110
- return $license_number > 0;
111
- }
112
-
113
- /**
114
- * Returns LiveChat license number
115
- *
116
- * @return int
117
- */
118
- public function get_license_number() {
119
- if ( $this->has_license_number() ) {
120
- return get_option( 'livechat_license_number' );
121
- }
122
-
123
- try {
124
- $store_token = Store::get_instance()->get_store_token();
125
- $connect_token = ConnectTokenProvider::create( CertProvider::create() )->get( $store_token, 'store' );
126
- $response = ApiClient::create( $connect_token )->store_info();
127
- return $response['store']['license'];
128
- } catch ( Exception $exception ) {
129
- return 0;
130
- }
131
- }
132
-
133
- /**
134
- * Returns LiveChat login
135
- */
136
- public function get_login() {
137
- if ( is_null( $this->login ) ) {
138
- $this->login = sanitize_email( get_option( 'livechat_email' ) );
139
- }
140
-
141
- return $this->login;
142
- }
143
-
144
- /**
145
- * Returns LiveChat settings
146
- *
147
- * @return int
148
- */
149
- public function get_settings() {
150
- $settings['disableMobile'] = get_option( 'livechat_disable_mobile' );
151
- $settings['disableGuests'] = get_option( 'livechat_disable_guests' );
152
-
153
- return $settings;
154
- }
155
-
156
- /**
157
- * Returns decoded token.
158
- *
159
- * @return ConnectToken
160
- * @throws Exceptions\ApiClientException Can be thrown when a token is malformed.
161
- */
162
- public function get_connect_token() {
163
- $store_token = Store::get_instance()->get_store_token();
164
-
165
- try {
166
- return ConnectToken::load(
167
- $store_token,
168
- CertProvider::create()->get_stored_cert()
169
- );
170
- } catch ( Exception $exception ) {
171
- if ( 'Expired token' === $exception->getMessage() ) {
172
- return ConnectToken::decode(
173
- $store_token
174
- );
175
- }
176
-
177
- throw $exception;
178
- }
179
- }
180
-
181
- /**
182
- * Injects widget script code
183
- */
184
- public function widget_script() {
185
- try {
186
- $token = $this->get_connect_token();
187
-
188
- wp_register_script(
189
- 'livechat-widget',
190
- UrlProvider::create( $token )->get_widget_url(),
191
- array(),
192
- $this->module->get_plugin_version(),
193
- $in_footer = true
194
- );
195
- wp_enqueue_script( 'livechat-widget' );
196
- } catch ( Exception $exception ) {
197
- $this->tracking_code();
198
- }
199
- }
200
-
201
- /**
202
- * Checks if visitor is on mobile device.
203
- *
204
- * @return boolean
205
- */
206
- public function check_mobile() {
207
- $user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) : '';
208
- $regex = '/((Chrome).*(Mobile))|((Android).*)|((iPhone|iPod).*Apple.*Mobile)|((Android).*(Mobile))/i';
209
- return preg_match( $regex, $user_agent );
210
- }
211
  }
7
 
8
  namespace LiveChat;
9
 
10
+ use LiveChat\Services\LicenseProvider;
 
 
 
 
 
11
  use LiveChat\Services\ModuleConfiguration;
12
+ use LiveChat\Services\Templates\TrackingCodeTemplate;
13
+ use LiveChat\Services\WidgetProvider;
14
+ use LiveChat\Services\WooCommerce\CustomerTrackingProvider;
15
 
16
  /**
17
  * Class LiveChat
42
  * Starts the plugin
43
  */
44
  public function __construct() {
45
+ add_action(
46
+ 'plugins_loaded',
47
+ function () {
48
+ if ( is_woo() ) {
49
+ $customer_tracking = CustomerTrackingProvider::create();
50
+ add_action( 'wp_ajax_lc-refresh-cart', array( $customer_tracking, 'ajax_get_customer_tracking' ) );
51
+ add_action( 'wp_ajax_nopriv_lc-refresh-cart', array( $customer_tracking, 'ajax_get_customer_tracking' ) );
52
+ }
53
+
54
+ $this->init_services();
55
+ }
56
+ );
57
+ }
58
 
59
+ /**
60
+ * Inits basic services.
61
+ */
62
+ public function init_services() {
63
+ if ( LicenseProvider::create()->has_deprecated_license_number() ) {
64
+ add_action( 'wp_head', array( TrackingCodeTemplate::create(), 'render' ) );
65
+ return;
66
  }
67
+
68
+ add_action( 'wp_footer', array( WidgetProvider::get_instance(), 'set_widget' ) );
69
  }
70
 
71
  /**
80
 
81
  return static::$instance;
82
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  }
plugin_files/LiveChatAdmin.class.php CHANGED
@@ -8,19 +8,16 @@
8
  namespace LiveChat;
9
 
10
  use Exception;
11
- use LiveChat\Helpers\ConfirmIdentityNoticeHelper;
12
- use LiveChat\Helpers\ConnectNoticeHelper;
13
- use LiveChat\Helpers\ConnectServiceHelper;
14
- use LiveChat\Helpers\DeactivationFeedbackFormHelper;
15
- use LiveChat\Helpers\ReviewNoticeHelper;
16
- use LiveChat\Helpers\ResourcesTabHelper;
17
  use LiveChat\Services\ApiClient;
18
  use LiveChat\Services\CertProvider;
19
  use LiveChat\Services\ConnectTokenProvider;
 
 
 
 
 
20
  use LiveChat\Services\Store;
21
- use LiveChat\Services\TokenValidator;
22
  use LiveChat\Services\User;
23
- use WP_Error;
24
 
25
  /**
26
  * Class LiveChatAdmin
@@ -28,53 +25,21 @@ use WP_Error;
28
  * @package LiveChat
29
  */
30
  final class LiveChatAdmin extends LiveChat {
31
- /**
32
- * Returns true if "Advanced settings" form has just been submitted,
33
- * false otherwise
34
- *
35
- * @var bool
36
- */
37
- private $changes_saved = false;
38
-
39
- /**
40
- * Timestamp from which review notice timeout count starts from
41
- *
42
- * @var int
43
- */
44
- private $review_notice_start_timestamp = null;
45
-
46
- /**
47
- * Timestamp offset
48
- *
49
- * @var int
50
- */
51
- private $review_notice_start_timestamp_offset = null;
52
-
53
- /**
54
- * Returns true if review notice was dismissed
55
- *
56
- * @var bool
57
- */
58
- private $review_notice_dismissed = false;
59
-
60
  /**
61
  * Starts the plugin
62
  */
63
  public function __construct() {
64
  parent::__construct();
65
 
66
- add_action( 'admin_init', array( $this, 'load_translations' ) );
67
- add_action( 'admin_init', array( $this, 'load_menu_icon_styles' ) );
68
- add_action( 'admin_init', array( $this, 'load_general_scripts_and_styles' ) );
69
- add_action( 'admin_init', array( $this, 'inject_nonce_object' ) );
70
- add_action( 'admin_menu', array( $this, 'register_admin_menu' ) );
71
- add_action( 'current_screen', array( $this, 'show_deactivation_feedback_form' ) );
72
- add_action( 'activated_plugin', array( $this, 'plugin_activated_action_handler' ) );
73
 
74
  add_filter( 'auto_update_plugin', array( $this, 'auto_update' ), 10, 2 );
75
-
76
- $this->register_admin_notices();
77
- $this->register_ajax_actions();
78
  }
79
 
80
  /**
@@ -103,446 +68,17 @@ final class LiveChatAdmin extends LiveChat {
103
  }
104
 
105
  /**
106
- * Make translation ready
107
- */
108
- public function load_translations() {
109
- load_plugin_textdomain(
110
- 'wp-live-chat-software-for-wordpress',
111
- false,
112
- 'wp-live-chat-software-for-wordpress/languages'
113
- );
114
- }
115
-
116
- /**
117
- * Fix CSS for icon in menu
118
- */
119
- public function load_menu_icon_styles() {
120
- wp_enqueue_style( 'livechat-menu', $this->module->get_plugin_url() . 'css/livechat-menu.css', false, $this->module->get_plugin_version() );
121
- }
122
-
123
- /**
124
- * Returns timestamp of review notice first occurrence.
125
- *
126
- * @return int
127
- */
128
- private function get_review_notice_start_timestamp() {
129
- if ( is_null( $this->review_notice_start_timestamp ) ) {
130
- $timestamp = get_option( 'livechat_review_notice_start_timestamp' );
131
- // If timestamp was not set on install.
132
- if ( ! $timestamp ) {
133
- $timestamp = time();
134
- update_option( 'livechat_review_notice_start_timestamp', $timestamp ); // Set timestamp if not set on install.
135
- }
136
-
137
- $this->review_notice_start_timestamp = $timestamp;
138
- }
139
-
140
- return $this->review_notice_start_timestamp;
141
- }
142
-
143
- /**
144
- * Returns timestamp offset of review notice occurrence.
145
- *
146
- * @return int
147
- */
148
- private function get_review_notice_start_timestamp_offset() {
149
- if ( is_null( $this->review_notice_start_timestamp_offset ) ) {
150
- $offset = get_option( 'livechat_review_notice_start_timestamp_offset' );
151
- // If offset was not set on install.
152
- if ( ! $offset ) {
153
- $offset = 16;
154
- update_option( 'livechat_review_notice_start_timestamp_offset', $offset ); // Set shorter offset.
155
- }
156
-
157
- $this->review_notice_start_timestamp_offset = $offset;
158
- }
159
-
160
- return $this->review_notice_start_timestamp_offset;
161
- }
162
-
163
- /**
164
- * Checks if review was dismissed.
165
- *
166
- * @return bool
167
- */
168
- private function check_if_review_notice_was_dismissed() {
169
- if ( ! $this->review_notice_dismissed ) {
170
- $this->review_notice_dismissed = get_option( 'livechat_review_notice_dismissed' );
171
- }
172
-
173
- return $this->review_notice_dismissed;
174
- }
175
-
176
- /**
177
- * Loads CSS.
178
- */
179
- private function load_design_system_styles() {
180
- // phpcs:disable WordPress.WP.EnqueuedResourceParameters.MissingVersion
181
- // Files below don't need to be versioned.
182
- wp_register_style( 'livechat-source-sans-pro-font', 'https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600' );
183
- wp_register_style( 'livechat-material-icons', 'https://fonts.googleapis.com/icon?family=Material+Icons' );
184
- wp_register_style( 'livechat-design-system', 'https://cdn.livechat-static.com/design-system/styles.css' );
185
- wp_enqueue_style( 'livechat-source-sans-pro-font', false, $this->module->get_plugin_version() );
186
- wp_enqueue_style( 'livechat-material-icons', false, $this->module->get_plugin_version() );
187
- wp_enqueue_style( 'livechat-design-system', false, $this->module->get_plugin_version() );
188
- // phpcs:enable
189
- }
190
-
191
- /**
192
- * Loads JS scripts and CSS.
193
- */
194
- public function load_general_scripts_and_styles() {
195
- $this->load_design_system_styles();
196
- wp_enqueue_script( 'livechat', $this->module->get_plugin_url() . 'js/livechat.js', 'jquery', $this->module->get_plugin_version(), true );
197
- wp_enqueue_style( 'livechat', $this->module->get_plugin_url() . 'css/livechat-general.css', false, $this->module->get_plugin_version() );
198
- wp_enqueue_script( 'bridge', $this->module->get_plugin_url() . 'js/connect.js', 'jquery', $this->module->get_plugin_version(), false );
199
-
200
- $config = array(
201
- 'agentAppUrl' => LC_AA_URL,
202
- );
203
-
204
- wp_localize_script( 'livechat', 'config', $config );
205
- }
206
-
207
- /**
208
- * Adds nonce value to AJAX object in JS script.
209
- */
210
- public function inject_nonce_object() {
211
- $nonce = array(
212
- 'value' => wp_create_nonce( 'wp_ajax_lc_connect' ),
213
- );
214
-
215
- wp_localize_script( 'bridge', 'ajax_nonce', $nonce );
216
- }
217
-
218
- /**
219
- * Loads scripts and CSS for review modal.
220
- */
221
- public function load_review_scripts_and_styles() {
222
- wp_enqueue_script( 'livechat-review', $this->module->get_plugin_url() . 'js/livechat-review.js', 'jquery', $this->module->get_plugin_version(), true );
223
- wp_enqueue_style( 'livechat-review', $this->module->get_plugin_url() . 'css/livechat-review.css', false, $this->module->get_plugin_version() );
224
- }
225
-
226
- /**
227
- * Adds LiveChat to WP administrator menu.
228
- */
229
- public function register_admin_menu() {
230
- add_menu_page(
231
- 'LiveChat',
232
- $this->is_installed() ? 'LiveChat' : 'LiveChat <span class="awaiting-mod">!</span>',
233
- 'administrator',
234
- 'livechat',
235
- array( $this, 'livechat_settings_page' ),
236
- $this->module->get_plugin_url() . 'images/livechat-icon.svg'
237
- );
238
-
239
- add_submenu_page(
240
- 'livechat',
241
- __( 'Settings', 'wp-live-chat-software-for-wordpress' ),
242
- __( 'Settings', 'wp-live-chat-software-for-wordpress' ),
243
- 'administrator',
244
- 'livechat_settings',
245
- array( $this, 'livechat_settings_page' )
246
- );
247
-
248
- add_submenu_page(
249
- 'livechat',
250
- __( 'Resources', 'wp-live-chat-software-for-wordpress' ),
251
- __( 'Resources', 'wp-live-chat-software-for-wordpress' ),
252
- 'administrator',
253
- 'livechat_resources',
254
- array( $this, 'livechat_resources_page' )
255
- );
256
-
257
- // Remove the submenu that is automatically added.
258
- if ( function_exists( 'remove_submenu_page' ) ) {
259
- remove_submenu_page( 'livechat', 'livechat' );
260
- }
261
-
262
- // Settings link.
263
- add_filter( 'plugin_action_links', array( $this, 'livechat_settings_link' ), 10, 2 );
264
-
265
- if ( $this->has_user_token() ) {
266
- add_submenu_page(
267
- 'livechat',
268
- __( 'Go to LiveChat', 'wp-live-chat-software-for-wordpress' ),
269
- __( 'Go to LiveChat', 'wp-live-chat-software-for-wordpress' ),
270
- 'administrator',
271
- 'livechat_link',
272
- '__return_false'
273
- );
274
-
275
- add_filter( 'clean_url', array( $this, 'go_to_livechat_link' ), 10, 2 );
276
- }
277
- }
278
-
279
- /**
280
- * Displays settings page
281
- */
282
- public function livechat_settings_page() {
283
- ConnectServiceHelper::create()->render();
284
- }
285
-
286
- /**
287
- * Displays resources page
288
- */
289
- public function livechat_resources_page() {
290
- ResourcesTabHelper::create()->render();
291
- }
292
-
293
- /**
294
- * Opens Agent App in new tab
295
- *
296
- * @param string $current_url URL of current menu page.
297
- *
298
- * @return string
299
- */
300
- public function go_to_livechat_link( $current_url ) {
301
- if ( 'admin.php?page=livechat_link' === $current_url ) {
302
- $current_url = LC_AA_URL;
303
- }
304
-
305
- return $current_url;
306
- }
307
-
308
- /**
309
- * Returns flag changes_saved.
310
- *
311
- * @return bool
312
- */
313
- public function changes_saved() {
314
- return $this->changes_saved;
315
- }
316
-
317
- /**
318
- * Returns link to LiveChat setting page.
319
- *
320
- * @param array $links Array with links.
321
- * @param string $file File name.
322
- *
323
- * @return mixed
324
- */
325
- public function livechat_settings_link( $links, $file ) {
326
- if ( basename( $file ) !== 'livechat.php' ) {
327
- return $links;
328
- }
329
-
330
- $settings_link = sprintf( '<a href="admin.php?page=livechat_settings">%s</a>', __( 'Settings' ) );
331
- array_unshift( $links, $settings_link );
332
- return $links;
333
- }
334
-
335
-
336
- /**
337
- * Checks if review notice should be visible.
338
- *
339
- * @return bool
340
- */
341
- private function check_review_notice_conditions() {
342
- if (
343
- $this->is_installed() &&
344
- ! $this->check_if_review_notice_was_dismissed() &&
345
- $this->get_time_since_connection() >= $this->get_offset_time() &&
346
- $this->check_if_license_is_active()
347
- ) {
348
- return true;
349
- }
350
-
351
- return false;
352
- }
353
-
354
- /**
355
- * Returns offset time in seconds.
356
- *
357
- * @return int
358
- */
359
- private function get_offset_time() {
360
- return 60 * 60 * 24 * $this->get_review_notice_start_timestamp_offset();
361
- }
362
-
363
- /**
364
- * Returns time in seconds since plugin conneciton.
365
- *
366
- * @return int
367
  */
368
- private function get_time_since_connection() {
369
- return time() - $this->get_review_notice_start_timestamp();
370
- }
371
-
372
- /**
373
- * Registers actions required for connect notice
374
- *
375
- * @return void
376
- */
377
- public function register_connect_notice() {
378
- if ( $this->is_installed() || 'livechat_page_livechat_settings' === get_current_screen()->id ) {
379
  return;
380
  }
381
 
382
- if ( $this->has_license_number() ) {
383
- add_action( 'admin_notices', array( $this, 'show_confirm_identity_notice' ) );
384
- return;
385
- }
386
-
387
- add_action( 'admin_notices', array( $this, 'show_connect_notice' ) );
388
- }
389
-
390
- /**
391
- * Checks if any notice should be displayed.
392
- */
393
- private function register_admin_notices() {
394
- if ( $this->check_review_notice_conditions() ) {
395
- add_action( 'admin_init', array( $this, 'load_review_scripts_and_styles' ) );
396
- add_action( 'wp_ajax_lc_review_dismiss', array( $this, 'ajax_review_dismiss' ) );
397
- add_action( 'wp_ajax_lc_review_postpone', array( $this, 'ajax_review_postpone' ) );
398
- add_action( 'admin_notices', array( $this, 'show_review_notice' ) );
399
- }
400
-
401
- add_action( 'current_screen', array( $this, 'register_connect_notice' ) );
402
- }
403
-
404
- /**
405
- * Checks if LiveChat license is active.
406
- *
407
- * @return boolean
408
- */
409
- private function check_if_license_is_active() {
410
- try {
411
- $store = Store::get_instance();
412
- $connect_token = ConnectTokenProvider::create( CertProvider::create() )->get( $store->get_store_token(), 'store' );
413
- $result = ApiClient::create( $connect_token )->license_info();
414
-
415
- return array_key_exists( 'isActive', $result ) ? $result['isActive'] : false;
416
- } catch ( Exception $e ) {
417
- return false;
418
- }
419
- }
420
-
421
- /**
422
- * Checks if current WP user has LC account.
423
- *
424
- * @return bool
425
- */
426
- private function has_user_token() {
427
- return ! empty( User::get_instance()->get_current_user_token() );
428
- }
429
-
430
- /**
431
- * Shows review notice.
432
- */
433
- public function show_review_notice() {
434
- ( new ReviewNoticeHelper() )->render();
435
- }
436
-
437
- /**
438
- * Shows connect notice.
439
- */
440
- public function show_connect_notice() {
441
- ( new ConnectNoticeHelper() )->render();
442
- }
443
-
444
- /**
445
- * Shows confirm identity notice.
446
- */
447
- public function show_confirm_identity_notice() {
448
- ( new ConfirmIdentityNoticeHelper() )->render();
449
- }
450
-
451
- /**
452
- * Shows deactivation feedback form.
453
- *
454
- * @return void;
455
- */
456
- public function show_deactivation_feedback_form() {
457
- if ( get_current_screen()->id !== 'plugins' ) {
458
- return;
459
- }
460
-
461
- add_action( 'in_admin_header', array( new DeactivationFeedbackFormHelper(), 'render' ) );
462
- }
463
-
464
- /**
465
- * Marks review as dismissed in WP options.
466
- */
467
- public function ajax_review_dismiss() {
468
- update_option( 'livechat_review_notice_dismissed', true );
469
- echo 'OK';
470
- wp_die();
471
- }
472
-
473
- /**
474
- * Marks review as postponed in WP options.
475
- */
476
- public function ajax_review_postpone() {
477
- update_option( 'livechat_review_notice_start_timestamp', time() );
478
- update_option( 'livechat_review_notice_start_timestamp_offset', 7 );
479
- echo 'OK';
480
- wp_die();
481
- }
482
-
483
- /**
484
- * Connects WP plugin with LiveChat account.
485
- * Validates tokens and, if they are valid, stores them in WP database.
486
- */
487
- public function ajax_connect() {
488
- $user_token = null;
489
- $store_token = null;
490
-
491
- check_ajax_referer( 'wp_ajax_lc_connect', 'security' );
492
-
493
- if ( isset( $_POST['user_token'] ) && isset( $_POST['store_token'] ) && isset( $_POST['security'] ) ) {
494
- $user_token = sanitize_text_field( wp_unslash( $_POST['user_token'] ) );
495
- $store_token = sanitize_text_field( wp_unslash( $_POST['store_token'] ) );
496
- }
497
-
498
- try {
499
- TokenValidator::create( CertProvider::create() )->validate_tokens( $user_token, $store_token );
500
- User::get_instance()->authorize_current_user( $user_token );
501
- Store::get_instance()->authorize_store( $store_token );
502
- delete_option( 'livechat_license_number' );
503
- delete_option( 'livechat_email' );
504
- delete_option( 'livechat_disable_mobile' );
505
- delete_option( 'livechat_disable_guests' );
506
-
507
- wp_send_json_success( array( 'status' => 'ok' ) );
508
- } catch ( Exception $e ) {
509
- wp_send_json_error(
510
- new WP_Error( $e->getCode(), $e->getMessage() )
511
- );
512
- }
513
- }
514
-
515
- /**
516
- * Disconnects LC plugin from current license.
517
- */
518
- public function ajax_disconnect() {
519
- Store::get_instance()->remove_store_data();
520
- User::get_instance()->remove_authorized_users();
521
- }
522
-
523
- /**
524
- * Removes store token when it was not found in LiveChat service.
525
- */
526
- public function ajax_store_not_found() {
527
- Store::get_instance()->remove_store_data();
528
- User::get_instance()->remove_authorized_users();
529
- }
530
-
531
- /**
532
- * Removes current user token when it was not found in LiveChat service.
533
- */
534
- public function ajax_user_not_found() {
535
- User::get_instance()->remove_current_user_token();
536
- }
537
-
538
- /**
539
- * Registers plugin's AJAX actions
540
- */
541
- public function register_ajax_actions() {
542
- add_action( 'wp_ajax_lc_connect', array( $this, 'ajax_connect' ) );
543
- add_action( 'wp_ajax_lc_disconnect', array( $this, 'ajax_disconnect' ) );
544
- add_action( 'wp_ajax_lc_store_not_found', array( $this, 'ajax_store_not_found' ) );
545
- add_action( 'wp_ajax_lc_user_not_found', array( $this, 'ajax_user_not_found' ) );
546
  }
547
 
548
  /**
@@ -551,11 +87,11 @@ final class LiveChatAdmin extends LiveChat {
551
  * @param string $plugin Plugin slug.
552
  */
553
  public function plugin_activated_action_handler( $plugin ) {
554
- if ( 'wp-live-chat-software-for-wordpress/livechat.php' !== $plugin ) {
555
  return;
556
  }
557
 
558
- wp_safe_redirect( admin_url( 'admin.php?page=livechat_settings' ) );
559
  exit;
560
  }
561
 
@@ -570,19 +106,16 @@ final class LiveChatAdmin extends LiveChat {
570
  try {
571
  $connect_token = ConnectTokenProvider::create( CertProvider::create() )->get( $store->get_store_token(), 'store' );
572
  ApiClient::create( $connect_token )->uninstall();
573
- // phpcs:disable Generic.CodeAnalysis.EmptyStatement.DetectedCatch
574
  } catch ( Exception $exception ) {
575
  // Exception during uninstall request is ignored to not break process of plugin uninstallation.
576
  }
577
- // phpcs:enable
578
 
579
  $store->remove_store_data();
580
  }
581
 
582
  User::get_instance()->remove_authorized_users();
583
  CertProvider::create()->remove_stored_cert();
584
-
585
- delete_option( 'livechat_review_notice_start_timestamp' );
586
- delete_option( 'livechat_review_notice_start_timestamp_offset' );
587
  }
588
  }
8
  namespace LiveChat;
9
 
10
  use Exception;
 
 
 
 
 
 
11
  use LiveChat\Services\ApiClient;
12
  use LiveChat\Services\CertProvider;
13
  use LiveChat\Services\ConnectTokenProvider;
14
+ use LiveChat\Services\MenuProvider;
15
+ use LiveChat\Services\NotificationsRenderer;
16
+ use LiveChat\Services\Options\SettingsOptions;
17
+ use LiveChat\Services\SettingsProvider;
18
+ use LiveChat\Services\SetupProvider;
19
  use LiveChat\Services\Store;
 
20
  use LiveChat\Services\User;
 
21
 
22
  /**
23
  * Class LiveChatAdmin
25
  * @package LiveChat
26
  */
27
  final class LiveChatAdmin extends LiveChat {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  /**
29
  * Starts the plugin
30
  */
31
  public function __construct() {
32
  parent::__construct();
33
 
34
+ add_action(
35
+ 'activated_plugin',
36
+ array(
37
+ $this,
38
+ 'plugin_activated_action_handler',
39
+ )
40
+ );
41
 
42
  add_filter( 'auto_update_plugin', array( $this, 'auto_update' ), 10, 2 );
 
 
 
43
  }
44
 
45
  /**
68
  }
69
 
70
  /**
71
+ * Inits basic services.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  */
73
+ public function init_services() {
74
+ if ( ! is_super_admin() ) {
 
 
 
 
 
 
 
 
 
75
  return;
76
  }
77
 
78
+ SetupProvider::get_instance()->init();
79
+ MenuProvider::get_instance()->init();
80
+ SettingsProvider::get_instance()->init();
81
+ NotificationsRenderer::get_instance()->init();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  }
83
 
84
  /**
87
  * @param string $plugin Plugin slug.
88
  */
89
  public function plugin_activated_action_handler( $plugin ) {
90
+ if ( PLUGIN_MAIN_FILE !== $plugin ) {
91
  return;
92
  }
93
 
94
+ wp_safe_redirect( admin_url( 'admin.php?page=' . MENU_SLUG . '_settings' ) );
95
  exit;
96
  }
97
 
106
  try {
107
  $connect_token = ConnectTokenProvider::create( CertProvider::create() )->get( $store->get_store_token(), 'store' );
108
  ApiClient::create( $connect_token )->uninstall();
109
+ // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
110
  } catch ( Exception $exception ) {
111
  // Exception during uninstall request is ignored to not break process of plugin uninstallation.
112
  }
 
113
 
114
  $store->remove_store_data();
115
  }
116
 
117
  User::get_instance()->remove_authorized_users();
118
  CertProvider::create()->remove_stored_cert();
119
+ SettingsOptions::get_instance()->remove();
 
 
120
  }
121
  }
plugin_files/Services/ApiClient.class.php CHANGED
@@ -62,12 +62,14 @@ class ApiClient {
62
  /**
63
  * Returns default headers
64
  *
 
 
65
  * @return array
66
  */
67
- private function headers() {
68
  return array(
69
  'Accept' => 'application/json',
70
- 'Platform' => 'wordpress',
71
  'Authorization' => sprintf( 'Bearer %s', $this->connect_token->get_token() ),
72
  );
73
  }
@@ -84,7 +86,7 @@ class ApiClient {
84
  return sprintf(
85
  '%s/api/%s/%s',
86
  $this->api_url,
87
- $api_version ?: $this->connect_token->get_api_version(),
88
  $endpoint
89
  );
90
  }
@@ -99,7 +101,7 @@ class ApiClient {
99
  $options = array(
100
  'headers' => array(
101
  'Accept' => 'application/x-pem-file',
102
- 'Platform' => 'wordpress',
103
  ),
104
  );
105
 
@@ -110,11 +112,19 @@ class ApiClient {
110
  /**
111
  * Gets store info.
112
  *
 
 
113
  * @return array
114
  * @throws ApiClientException Can be thrown from make_request method.
115
  */
116
- public function store_info() {
117
- return $this->make_request( 'GET', 'store/info' );
 
 
 
 
 
 
118
  }
119
 
120
  /**
62
  /**
63
  * Returns default headers
64
  *
65
+ * @param string|null $platform Plugin platform.
66
+ *
67
  * @return array
68
  */
69
+ private function headers( $platform = null ) {
70
  return array(
71
  'Accept' => 'application/json',
72
+ 'Platform' => $platform ? $platform : get_platform(),
73
  'Authorization' => sprintf( 'Bearer %s', $this->connect_token->get_token() ),
74
  );
75
  }
86
  return sprintf(
87
  '%s/api/%s/%s',
88
  $this->api_url,
89
+ $api_version ? $api_version : $this->connect_token->get_api_version(),
90
  $endpoint
91
  );
92
  }
101
  $options = array(
102
  'headers' => array(
103
  'Accept' => 'application/x-pem-file',
104
+ 'Platform' => get_platform(),
105
  ),
106
  );
107
 
112
  /**
113
  * Gets store info.
114
  *
115
+ * @param string|null $platform Plugin platform.
116
+ *
117
  * @return array
118
  * @throws ApiClientException Can be thrown from make_request method.
119
  */
120
+ public function store_info( $platform = null ) {
121
+ return $this->make_request(
122
+ 'GET',
123
+ 'store/info',
124
+ array(
125
+ 'headers' => $this->headers( $platform ),
126
+ )
127
+ );
128
  }
129
 
130
  /**
plugin_files/Services/CertProvider.class.php CHANGED
@@ -8,6 +8,7 @@
8
  namespace LiveChat\Services;
9
 
10
  use LiveChat\Exceptions\ApiClientException;
 
11
 
12
  /**
13
  * Class CertProvider
@@ -21,24 +22,33 @@ class CertProvider {
21
  *
22
  * @var string|null
23
  */
24
- private $cert = null;
 
 
 
 
 
 
 
25
 
26
  /**
27
  * Instance of ApiClient class
28
  *
29
- * @var ApiClient|null
30
  */
31
- private $api_client = null;
32
 
33
  /**
34
  * CertProvider constructor.
35
  *
 
36
  * @param ApiClient $api_client ApiClient instance.
37
- * @param string|null $cert RSA public key.
38
  */
39
- public function __construct( $api_client, $cert = null ) {
40
- $this->cert = $cert;
41
  $this->api_client = $api_client;
 
42
  }
43
 
44
  /**
@@ -49,10 +59,10 @@ class CertProvider {
49
  */
50
  public function get_stored_cert() {
51
  if ( is_null( $this->cert ) ) {
52
- $cert = get_option( 'livechat_public_key' );
53
  if ( ! $cert ) {
54
  $cert = $this->api_client->get_cert();
55
- update_option( 'livechat_public_key', $cert );
56
  }
57
 
58
  $this->cert = $cert;
@@ -67,7 +77,7 @@ class CertProvider {
67
  * @return bool
68
  */
69
  public function remove_stored_cert() {
70
- return delete_option( 'livechat_public_key' );
71
  }
72
 
73
  /**
@@ -78,6 +88,10 @@ class CertProvider {
78
  * @return CertProvider
79
  */
80
  public static function create( $cert = null ) {
81
- return new CertProvider( ApiClient::create(), $cert );
 
 
 
 
82
  }
83
  }
8
  namespace LiveChat\Services;
9
 
10
  use LiveChat\Exceptions\ApiClientException;
11
+ use LiveChat\Services\Options\PublicKey;
12
 
13
  /**
14
  * Class CertProvider
22
  *
23
  * @var string|null
24
  */
25
+ private $cert;
26
+
27
+ /**
28
+ * Instance of PublicKey class
29
+ *
30
+ * @var PublicKey
31
+ */
32
+ private $public_key;
33
 
34
  /**
35
  * Instance of ApiClient class
36
  *
37
+ * @var ApiClient
38
  */
39
+ private $api_client;
40
 
41
  /**
42
  * CertProvider constructor.
43
  *
44
+ * @param PublicKey $public_key ApiClient instance.
45
  * @param ApiClient $api_client ApiClient instance.
46
+ * @param string|null $cert JWT public key.
47
  */
48
+ public function __construct( $public_key, $api_client, $cert = null ) {
49
+ $this->public_key = $public_key;
50
  $this->api_client = $api_client;
51
+ $this->cert = $cert;
52
  }
53
 
54
  /**
59
  */
60
  public function get_stored_cert() {
61
  if ( is_null( $this->cert ) ) {
62
+ $cert = $this->public_key->get();
63
  if ( ! $cert ) {
64
  $cert = $this->api_client->get_cert();
65
+ $this->public_key->set( $cert );
66
  }
67
 
68
  $this->cert = $cert;
77
  * @return bool
78
  */
79
  public function remove_stored_cert() {
80
+ return $this->public_key->remove();
81
  }
82
 
83
  /**
88
  * @return CertProvider
89
  */
90
  public static function create( $cert = null ) {
91
+ return new CertProvider(
92
+ PublicKey::get_instance(),
93
+ ApiClient::create(),
94
+ $cert
95
+ );
96
  }
97
  }
plugin_files/Services/ConnectTokenProvider.class.php CHANGED
@@ -1,4 +1,9 @@
1
  <?php
 
 
 
 
 
2
 
3
  namespace LiveChat\Services;
4
 
@@ -39,16 +44,17 @@ class ConnectTokenProvider {
39
  /**
40
  * Returns ConnectToken if user token is valid
41
  *
42
- * @param string $token JWT token.
43
- * @param string $token_type Type of JWT token (could be store or user).
 
44
  *
45
  * @return ConnectToken
46
  * @throws ApiClientException Can be thrown by get_stored_cert method.
47
  * @throws InvalidTokenException Can be thrown by get_stored_cert method.
48
  */
49
- public function get( $token, $token_type = 'user' ) {
50
  if ( 'store' === $token_type ) {
51
- $this->token_validator->validate_store_token( $token );
52
  } else {
53
  $this->token_validator->validate_user_token( $token );
54
  }
1
  <?php
2
+ /**
3
+ * Class ConnectTokenProvider
4
+ *
5
+ * @package LiveChat\Services
6
+ */
7
 
8
  namespace LiveChat\Services;
9
 
44
  /**
45
  * Returns ConnectToken if user token is valid
46
  *
47
+ * @param string $token JWT token.
48
+ * @param string $token_type Type of JWT token (could be store or user).
49
+ * @param bool $allow_expired True if should allow expired tokens.
50
  *
51
  * @return ConnectToken
52
  * @throws ApiClientException Can be thrown by get_stored_cert method.
53
  * @throws InvalidTokenException Can be thrown by get_stored_cert method.
54
  */
55
+ public function get( $token, $token_type = 'user', $allow_expired = false ) {
56
  if ( 'store' === $token_type ) {
57
+ $this->token_validator->validate_store_token( $token, $allow_expired );
58
  } else {
59
  $this->token_validator->validate_user_token( $token );
60
  }
plugin_files/Services/Factories/ApiClientFactory.class.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace LiveChat\Services\Factories;
5
+
6
+ use LiveChat\Exceptions\ApiClientException;
7
+ use LiveChat\Exceptions\InvalidTokenException;
8
+ use LiveChat\Services\ApiClient;
9
+ use LiveChat\Services\ConnectToken;
10
+ use LiveChat\Services\Store;
11
+
12
+ class ApiClientFactory {
13
+ /**
14
+ * Instance of ConnectTokenProviderFactory
15
+ *
16
+ * @var ConnectTokenProviderFactory
17
+ */
18
+ private $connect_token_provider_factory;
19
+
20
+ /**
21
+ * ApiClientFactory constructor.
22
+ *
23
+ * @param ConnectTokenProviderFactory $connect_token_provider_factory Instance of ConnectTokenProviderFactory.
24
+ */
25
+ public function __construct( $connect_token_provider_factory ) {
26
+ $this->connect_token_provider_factory = $connect_token_provider_factory;
27
+ }
28
+
29
+ /**
30
+ * Creates and returns ApiClient instance.
31
+ *
32
+ * @param ConnectToken|null $connect_token ConnectToken instance.
33
+ *
34
+ * @return ApiClient
35
+ * @throws ApiClientException Could be thrown by ConnectTokenProvider.
36
+ * @throws InvalidTokenException Could be thrown by ConnectTokenProvider.
37
+ */
38
+ public function create( $connect_token = null ) {
39
+ if ( ! $connect_token ) {
40
+ $connect_token = $this->connect_token_provider_factory->create()->get(
41
+ Store::get_instance()->get_store_token(),
42
+ 'store'
43
+ );
44
+ }
45
+ return ApiClient::create( $connect_token );
46
+ }
47
+
48
+ /**
49
+ * Returns instance of ApiClientFactory (singleton pattern).
50
+ *
51
+ * @return static
52
+ */
53
+ public static function get_instance() {
54
+ return new static( ConnectTokenProviderFactory::get_instance() );
55
+ }
56
+ }
plugin_files/Services/Factories/ConnectTokenProviderFactory.class.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class ConnectTokenProviderFactory
4
+ *
5
+ * @package LiveChat\Services\Factories
6
+ */
7
+
8
+ namespace LiveChat\Services\Factories;
9
+
10
+ use LiveChat\Services\CertProvider;
11
+ use LiveChat\Services\ConnectTokenProvider;
12
+
13
+ /**
14
+ * Class ConnectTokenProviderFactory
15
+ *
16
+ * @package LiveChat\Services\Factories
17
+ */
18
+ class ConnectTokenProviderFactory {
19
+ /**
20
+ * Returns new instance of ConnectTokenProvider.
21
+ *
22
+ * @param CertProvider|null $cert_provider Instance of CertProvider.
23
+ *
24
+ * @return ConnectTokenProvider
25
+ */
26
+ public function create( $cert_provider = null ) {
27
+ if ( ! $cert_provider ) {
28
+ $cert_provider = CertProvider::create();
29
+ }
30
+
31
+ return ConnectTokenProvider::create( $cert_provider );
32
+ }
33
+
34
+ /**
35
+ * Returns new instance of ConnectTokenProviderFactory.
36
+ *
37
+ * @return static
38
+ */
39
+ public static function get_instance() {
40
+ return new static();
41
+ }
42
+ }
plugin_files/Services/Factories/UrlProviderFactory.class.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class UrlProviderFactory
4
+ *
5
+ * @package LiveChat\Services\Factories
6
+ */
7
+
8
+ namespace LiveChat\Services\Factories;
9
+
10
+ use LiveChat\Exceptions\ApiClientException;
11
+ use LiveChat\Exceptions\InvalidTokenException;
12
+ use LiveChat\Services\Store;
13
+ use LiveChat\Services\UrlProvider;
14
+
15
+ /**
16
+ * Class UrlProviderFactory
17
+ *
18
+ * @package LiveChat\Services\Factories
19
+ */
20
+ class UrlProviderFactory {
21
+ /**
22
+ * Instance of ConnectTokenProviderFactory.
23
+ *
24
+ * @var ConnectTokenProviderFactory
25
+ */
26
+ private $connect_token_provider_factory;
27
+
28
+ /**
29
+ * UrlProviderFactory constructor.
30
+ *
31
+ * @param ConnectTokenProviderFactory $connect_token_provider_factory Instance of ConnectTokenProviderFactory.
32
+ */
33
+ public function __construct( $connect_token_provider_factory ) {
34
+ $this->connect_token_provider_factory = $connect_token_provider_factory;
35
+ }
36
+
37
+ /**
38
+ * Creates and returns UrlProvider instance.
39
+ *
40
+ * @param ConnectToken|null $connect_token Instance of ConnectToken.
41
+ *
42
+ * @return UrlProvider
43
+ * @throws ApiClientException Could be thrown by ConnectTokenProvider.
44
+ * @throws InvalidTokenException Could be thrown by ConnectTokenProvider.
45
+ */
46
+ public function create( $connect_token = null ) {
47
+ if ( ! $connect_token ) {
48
+ $connect_token = $this->connect_token_provider_factory->create()->get(
49
+ Store::get_instance()->get_store_token(),
50
+ 'store'
51
+ );
52
+ }
53
+
54
+ return UrlProvider::create( $connect_token );
55
+ }
56
+
57
+ /**
58
+ * Returns new instance of UrlProviderFactory.
59
+ *
60
+ * @return static
61
+ */
62
+ public static function get_instance() {
63
+ return new static( ConnectTokenProviderFactory::get_instance() );
64
+ }
65
+ }
plugin_files/Services/LicenseProvider.class.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class LicenseProvider
4
+ *
5
+ * @package LiveChat\Services
6
+ */
7
+
8
+ namespace LiveChat\Services;
9
+
10
+ use Exception;
11
+ use LiveChat\Services\Factories\ApiClientFactory;
12
+ use LiveChat\Services\Options\Deprecated\DeprecatedLicenseNumber;
13
+
14
+ /**
15
+ * Class LicenseProvider
16
+ *
17
+ * @package LiveChat\Services
18
+ */
19
+ class LicenseProvider {
20
+ /**
21
+ * Instance of ApiClient.
22
+ *
23
+ * @var ApiClientFactory
24
+ */
25
+ private $api_client_factory;
26
+
27
+ /**
28
+ * Instance of DeprecatedLicenseNumber.
29
+ *
30
+ * @var DeprecatedLicenseNumber
31
+ */
32
+ private $deprecated_license;
33
+
34
+ /**
35
+ * LicenseProvider constructor.
36
+ *
37
+ * @param ApiClientFactory $api_client_factory Instance of ApiClientFactory.
38
+ * @param DeprecatedLicenseNumber $deprecated_license Instance of DeprecatedLicenseNumber.
39
+ */
40
+ public function __construct( $api_client_factory, $deprecated_license ) {
41
+ $this->api_client_factory = $api_client_factory;
42
+ $this->deprecated_license = $deprecated_license;
43
+ }
44
+
45
+ /**
46
+ * Returns true if option containing license number exists and is valid.
47
+ * Otherwise it returns false.
48
+ *
49
+ * @return bool
50
+ */
51
+ public function has_deprecated_license_number() {
52
+ $license_number = max( 0, $this->deprecated_license->get() );
53
+ return $license_number > 0;
54
+ }
55
+
56
+ /**
57
+ * Returns deprecated license number stored in db by plugins in version <= 2.0.0.
58
+ *
59
+ * @return int|mixed
60
+ */
61
+ private function get_deprecated_license_number() {
62
+ if ( $this->has_deprecated_license_number() ) {
63
+ return $this->deprecated_license->get();
64
+ }
65
+ return 0;
66
+ }
67
+
68
+
69
+ /**
70
+ * Returns license number.
71
+ *
72
+ * @return int
73
+ */
74
+ public function get_license_number() {
75
+ try {
76
+ $response = $this->api_client_factory->create()->store_info();
77
+ if ( ! isset( $response['store']['license'] ) ) {
78
+ return $this->get_deprecated_license_number();
79
+ }
80
+ return $response['store']['license'];
81
+ } catch ( Exception $ex ) {
82
+ return $this->get_deprecated_license_number();
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Returns new instance of LicenseProvider.
88
+ *
89
+ * @return static
90
+ */
91
+ public static function create() {
92
+ return new static(
93
+ ApiClientFactory::get_instance(),
94
+ DeprecatedLicenseNumber::get_instance()
95
+ );
96
+ }
97
+ }
plugin_files/Services/MenuProvider.class.php ADDED
@@ -0,0 +1,283 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class MenuProvider
4
+ *
5
+ * @package LiveChat\Services
6
+ */
7
+
8
+ namespace LiveChat\Services;
9
+
10
+ use LiveChat\Services\Templates\ResourcesTabTemplate;
11
+
12
+ /**
13
+ * Class MenuProvider
14
+ *
15
+ * @package LiveChat\Services
16
+ */
17
+ class MenuProvider {
18
+ /**
19
+ * Instance of MenuProvider.
20
+ *
21
+ * @var MenuProvider|null
22
+ */
23
+ private static $instance = null;
24
+
25
+ /**
26
+ * Instance of User.
27
+ *
28
+ * @var User|null
29
+ */
30
+ private $user;
31
+
32
+ /**
33
+ * Instance of Store.
34
+ *
35
+ * @var Store|null
36
+ */
37
+ private $store;
38
+
39
+ /**
40
+ * Instance of SettingsProvider.
41
+ *
42
+ * @var SettingsProvider|null
43
+ */
44
+ private $settings;
45
+
46
+ /**
47
+ * Instance of ResourcesTabTemplate.
48
+ *
49
+ * @var ResourcesTabTemplate|null
50
+ */
51
+ private $resources_tab;
52
+
53
+ /**
54
+ * Plugin URL.
55
+ *
56
+ * @var string
57
+ */
58
+ private $plugin_url;
59
+
60
+ /**
61
+ * Menu slug.
62
+ *
63
+ * @var string
64
+ */
65
+ private $menu_slug;
66
+
67
+ /**
68
+ * Plugin main file.
69
+ *
70
+ * @var string
71
+ */
72
+ private $plugin_main_file;
73
+
74
+ /**
75
+ * LiveChat Agent App URL.
76
+ *
77
+ * @var string
78
+ */
79
+ private $lc_aa_url;
80
+
81
+ /**
82
+ * MenuProvider constructor.
83
+ *
84
+ * @param User $user Instance of User.
85
+ * @param Store $store Instance of Store.
86
+ * @param SettingsProvider $settings Instance of SettingsProvider.
87
+ * @param ResourcesTabTemplate $resources_tab Instance of ResourcesTabTemplate.
88
+ * @param string $plugin_url Plugin URL.
89
+ * @param string $menu_slug Menu slug.
90
+ * @param string $plugin_main_file Plugin main file.
91
+ * @param string $lc_aa_url LiveChat Agent App URL.
92
+ */
93
+ public function __construct(
94
+ $user,
95
+ $store,
96
+ $settings,
97
+ $resources_tab,
98
+ $plugin_url,
99
+ $menu_slug,
100
+ $plugin_main_file,
101
+ $lc_aa_url
102
+ ) {
103
+ $this->user = $user;
104
+ $this->store = $store;
105
+ $this->settings = $settings;
106
+ $this->resources_tab = $resources_tab;
107
+ $this->plugin_url = $plugin_url;
108
+ $this->menu_slug = $menu_slug;
109
+ $this->plugin_main_file = $plugin_main_file;
110
+ $this->lc_aa_url = $lc_aa_url;
111
+ }
112
+
113
+ /**
114
+ * Returns string with menu slug for given suffix.
115
+ *
116
+ * @param string $suffix Resource name.
117
+ * @return string
118
+ */
119
+ private function slugged( $suffix ) {
120
+ return "{$this->menu_slug}_$suffix";
121
+ }
122
+
123
+ /**
124
+ * Returns string with menu slug for given suffix.
125
+ *
126
+ * @param string $suffix Resource name.
127
+ * @return string
128
+ */
129
+ private function get_admin_script( $suffix ) {
130
+ return 'admin.php?page=' . $this->slugged( $suffix );
131
+ }
132
+
133
+ /**
134
+ * Registers admin menu.
135
+ */
136
+ public function init() {
137
+ add_action( 'admin_menu', array( $this, 'register_admin_menu' ) );
138
+ }
139
+
140
+ /**
141
+ * Registers plugin menu in WP menu bar.
142
+ */
143
+ public function register_admin_menu() {
144
+ add_menu_page(
145
+ 'LiveChat',
146
+ $this->is_installed() ? 'LiveChat' : 'LiveChat <span class="awaiting-mod">!</span>',
147
+ 'administrator',
148
+ $this->menu_slug,
149
+ array( $this, 'livechat_settings_page' ),
150
+ $this->plugin_url . 'images/livechat-icon.svg'
151
+ );
152
+
153
+ add_submenu_page(
154
+ $this->menu_slug,
155
+ __( 'Settings', 'livechat' ),
156
+ __( 'Settings', 'livechat' ),
157
+ 'administrator',
158
+ $this->slugged( 'settings' ),
159
+ array( $this, 'livechat_settings_page' )
160
+ );
161
+
162
+ add_submenu_page(
163
+ $this->menu_slug,
164
+ __( 'Resources', 'livechat' ),
165
+ __( 'Resources', 'livechat' ),
166
+ 'administrator',
167
+ $this->slugged( 'resources' ),
168
+ array( $this, 'livechat_resources_page' )
169
+ );
170
+
171
+ // Remove the submenu that is automatically added.
172
+ if ( function_exists( 'remove_submenu_page' ) ) {
173
+ remove_submenu_page( $this->menu_slug, $this->menu_slug );
174
+ }
175
+
176
+ // Settings link.
177
+ add_filter( 'plugin_action_links', array( $this, 'livechat_settings_link' ), 10, 2 );
178
+
179
+ if ( $this->has_user_token() ) {
180
+ add_submenu_page(
181
+ 'livechat',
182
+ __( 'Go to LiveChat', 'livechat' ),
183
+ __( 'Go to LiveChat', 'livechat' ),
184
+ 'administrator',
185
+ $this->slugged( 'link' ),
186
+ '__return_false'
187
+ );
188
+
189
+ add_filter( 'clean_url', array( $this, 'go_to_livechat_link' ), 10, 2 );
190
+ }
191
+ }
192
+
193
+ /**
194
+ * Renders settings page.
195
+ */
196
+ public function livechat_settings_page() {
197
+ $this->settings->render();
198
+ }
199
+
200
+ /**
201
+ * Renders resources page.
202
+ */
203
+ public function livechat_resources_page() {
204
+ $this->resources_tab->render();
205
+ }
206
+
207
+ /**
208
+ * Returns link to LiveChat setting page.
209
+ *
210
+ * @param array $links Array with links.
211
+ * @param string $file File name.
212
+ *
213
+ * @return mixed
214
+ */
215
+ public function livechat_settings_link( $links, $file ) {
216
+ if ( $this->plugin_main_file !== $file ) {
217
+ return $links;
218
+ }
219
+
220
+ $settings_link = sprintf(
221
+ '<a href="' . $this->get_admin_script( 'settings' ) . '">%s</a>',
222
+ __( 'Settings' )
223
+ );
224
+ array_unshift( $links, $settings_link );
225
+ return $links;
226
+ }
227
+
228
+ /**
229
+ * Opens Agent App in new tab
230
+ *
231
+ * @param string $current_url URL of current menu page.
232
+ *
233
+ * @return string
234
+ */
235
+ public function go_to_livechat_link( $current_url ) {
236
+ if ( $this->get_admin_script( 'link' ) === $current_url ) {
237
+ $current_url = $this->lc_aa_url;
238
+ }
239
+
240
+ return $current_url;
241
+ }
242
+
243
+ /**
244
+ * Returns true if LiveChat store token is set (not empty string),
245
+ * false otherwise.
246
+ *
247
+ * @return bool
248
+ */
249
+ private function is_installed() {
250
+ return ! empty( $this->store->get_store_token() );
251
+ }
252
+
253
+ /**
254
+ * Checks if current WP user has LC account.
255
+ *
256
+ * @return bool
257
+ */
258
+ private function has_user_token() {
259
+ return ! empty( $this->user->get_current_user_token() );
260
+ }
261
+
262
+ /**
263
+ * Returns instance of MenuProvider (singleton pattern).
264
+ *
265
+ * @return MenuProvider|null
266
+ */
267
+ public static function get_instance() {
268
+ if ( ! isset( static::$instance ) ) {
269
+ static::$instance = new static(
270
+ User::get_instance(),
271
+ Store::get_instance(),
272
+ SettingsProvider::get_instance(),
273
+ ResourcesTabTemplate::create(),
274
+ ModuleConfiguration::get_instance()->get_plugin_url(),
275
+ MENU_SLUG,
276
+ PLUGIN_MAIN_FILE,
277
+ LC_AA_URL
278
+ );
279
+ }
280
+
281
+ return static::$instance;
282
+ }
283
+ }
plugin_files/Services/ModuleConfiguration.class.php CHANGED
@@ -12,7 +12,7 @@ namespace LiveChat\Services;
12
  *
13
  * @package LiveChat\Services
14
  */
15
- final class ModuleConfiguration {
16
  /**
17
  * Instance of ModuleConfiguration (singleton pattern)
18
  *
@@ -48,13 +48,6 @@ final class ModuleConfiguration {
48
  */
49
  private $plugin_version;
50
 
51
- /**
52
- * RSA public key for tokens validation
53
- *
54
- * @var string
55
- */
56
- private $cert;
57
-
58
  /**
59
  * ModuleConfiguration constructor.
60
  */
@@ -73,6 +66,19 @@ final class ModuleConfiguration {
73
  return $this->wp_version;
74
  }
75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  /**
77
  * Returns plugin files absolute path
78
  *
@@ -106,26 +112,13 @@ final class ModuleConfiguration {
106
  */
107
  public function get_plugin_version() {
108
  if ( is_null( $this->plugin_version ) ) {
109
- $this->plugin_version = get_file_data( __DIR__ . '/../../livechat.php', array( 'Version' ) )[0];
 
110
  }
111
 
112
  return $this->plugin_version;
113
  }
114
 
115
- /**
116
- * Returns frontend url with specified API region.
117
- *
118
- * @param string $region API region.
119
- *
120
- * @return string
121
- */
122
- public function get_app_url( $region = 'us' ) {
123
- return sprintf(
124
- LC_APP_URL_PATTERN,
125
- $region
126
- );
127
- }
128
-
129
  /**
130
  * Returns new instance of ModuleConfiguration class
131
  *
12
  *
13
  * @package LiveChat\Services
14
  */
15
+ class ModuleConfiguration {
16
  /**
17
  * Instance of ModuleConfiguration (singleton pattern)
18
  *
48
  */
49
  private $plugin_version;
50
 
 
 
 
 
 
 
 
51
  /**
52
  * ModuleConfiguration constructor.
53
  */
66
  return $this->wp_version;
67
  }
68
 
69
+ /**
70
+ * Returns WooCommerce version
71
+ *
72
+ * @return string
73
+ */
74
+ public function get_extension_version() {
75
+ if ( ! is_woo() ) {
76
+ return '';
77
+ }
78
+
79
+ return defined( 'WOOCOMMERCE_VERSION' ) ? WOOCOMMERCE_VERSION : 'unknown';
80
+ }
81
+
82
  /**
83
  * Returns plugin files absolute path
84
  *
112
  */
113
  public function get_plugin_version() {
114
  if ( is_null( $this->plugin_version ) ) {
115
+ list(, $file) = explode( '/', PLUGIN_MAIN_FILE );
116
+ $this->plugin_version = get_file_data( __DIR__ . '/../../' . $file, array( 'Version' ) )[0];
117
  }
118
 
119
  return $this->plugin_version;
120
  }
121
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  /**
123
  * Returns new instance of ModuleConfiguration class
124
  *
plugin_files/Services/Notifications/ConfirmIdentityNotice.class.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class ConfirmIdentityNotice
4
+ *
5
+ * @package LiveChat\Services\Notifications
6
+ */
7
+
8
+ namespace LiveChat\Services\Notifications;
9
+
10
+ use LiveChat\Services\Templates\ConfirmIdentityNoticeTemplate;
11
+
12
+ /**
13
+ * Class ConfirmIdentityNotice
14
+ *
15
+ * @package LiveChat\Services\Notifications
16
+ */
17
+ class ConfirmIdentityNotice extends Notification {
18
+ /**
19
+ * ConnectNotice constructor.
20
+ *
21
+ * @inheritDoc
22
+ */
23
+ public function __construct( $store, $options, $menu_slug ) {
24
+ parent::__construct( $store, $options, $menu_slug, ConfirmIdentityNoticeTemplate::create() );
25
+ }
26
+ /**
27
+ * Returns true when plugin is not connected,
28
+ * user is not on plugin's settings page,
29
+ * and plugin was migrated.
30
+ *
31
+ * @inheritDoc
32
+ */
33
+ public function should_render() {
34
+ return ! $this->store->is_connected() &&
35
+ parent::should_render() &&
36
+ $this->was_migrated();
37
+ }
38
+ }
plugin_files/Services/Notifications/ConnectNotice.class.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class ConnectNotice
4
+ *
5
+ * @package LiveChat\Services\Notifications
6
+ */
7
+
8
+ namespace LiveChat\Services\Notifications;
9
+
10
+ use LiveChat\Services\Templates\ConnectNoticeTemplate;
11
+
12
+ /**
13
+ * Class ConnectNotice
14
+ *
15
+ * @package LiveChat\Services\Notifications
16
+ */
17
+ class ConnectNotice extends Notification {
18
+ /**
19
+ * ConnectNotice constructor.
20
+ *
21
+ * @inheritDoc
22
+ */
23
+ public function __construct( $store, $options, $menu_slug ) {
24
+ parent::__construct( $store, $options, $menu_slug, ConnectNoticeTemplate::create() );
25
+ }
26
+
27
+ /**
28
+ * Returns true when plugin is not installed,
29
+ * user is not on plugin's settings page,
30
+ * and plugin wasn't migrated.
31
+ *
32
+ * @inheritDoc
33
+ */
34
+ public function should_render() {
35
+ return ! $this->store->is_connected() &&
36
+ parent::should_render() &&
37
+ ! $this->was_migrated();
38
+ }
39
+ }
plugin_files/Services/Notifications/DeactivationModal.class.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class DeactivationModal
4
+ *
5
+ * @package LiveChat\Services\Notifications
6
+ */
7
+
8
+ namespace LiveChat\Services\Notifications;
9
+
10
+ use LiveChat\Services\Templates\DeactivationModalTemplate;
11
+
12
+ /**
13
+ * Class DeactivationModal
14
+ *
15
+ * @package LiveChat\Services\Notifications
16
+ */
17
+ class DeactivationModal extends Notification {
18
+ /**
19
+ * DeactivationModal constructor.
20
+ *
21
+ * {@inheritDoc}
22
+ */
23
+ public function __construct( $store, $options, $menu_slug ) {
24
+ parent::__construct(
25
+ $store,
26
+ $options,
27
+ $menu_slug,
28
+ DeactivationModalTemplate::create(),
29
+ 'current_screen',
30
+ 'admin_footer'
31
+ );
32
+ }
33
+
34
+ /**
35
+ * Returns true when plugin is connected.
36
+ *
37
+ * @inheritDoc
38
+ */
39
+ public function should_render() {
40
+ return $this->is_user_on_page( 'plugins' );
41
+ }
42
+ }
plugin_files/Services/Notifications/Notice.class.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class Notice
4
+ *
5
+ * @package LiveChat\Services\Notifications
6
+ */
7
+
8
+ namespace LiveChat\Services\Notifications;
9
+
10
+ use LiveChat\Services\Templates\NoticeTemplate;
11
+
12
+ /**
13
+ * Class Notice
14
+ *
15
+ * @package LiveChat\Services\Notifications
16
+ */
17
+ class Notice extends Notification {
18
+ /**
19
+ * Notice constructor.
20
+ *
21
+ * @inheritDoc
22
+ */
23
+ public function __construct( $store, $options, $menu_slug ) {
24
+ parent::__construct( $store, $options, $menu_slug, NoticeTemplate::create() );
25
+ }
26
+ }
plugin_files/Services/Notifications/Notification.class.php ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class Notification
4
+ *
5
+ * @package LiveChat\Services\Notifications
6
+ */
7
+
8
+ namespace LiveChat\Services\Notifications;
9
+
10
+ use LiveChat\Services\Options\Deprecated\DeprecatedOptions;
11
+ use LiveChat\Services\Store;
12
+ use LiveChat\Services\Templates\Template;
13
+
14
+ /**
15
+ * Class Notification
16
+ *
17
+ * @package LiveChat\Services\Notifications
18
+ */
19
+ class Notification {
20
+ /**
21
+ * WP Hook on which a Notification should be registered.
22
+ *
23
+ * @var string
24
+ */
25
+ private $register_hook;
26
+
27
+ /**
28
+ * WP Hook on which a Notification should be rendered.
29
+ *
30
+ * @var string
31
+ */
32
+ private $render_hook;
33
+
34
+ /**
35
+ * Instance of Store.
36
+ *
37
+ * @var Store
38
+ */
39
+ protected $store;
40
+
41
+ /**
42
+ * Instance of DeprecatedOptions.
43
+ *
44
+ * @var DeprecatedOptions|null
45
+ */
46
+ protected $options;
47
+
48
+ /**
49
+ * Menu slug.
50
+ *
51
+ * @var string
52
+ */
53
+ protected $menu_slug;
54
+
55
+ /**
56
+ * Instance of template that should be rendered.
57
+ *
58
+ * @var Template|null
59
+ */
60
+ private $template;
61
+
62
+ /**
63
+ * Notification constructor.
64
+ *
65
+ * @param Store $store Store instance.
66
+ * @param DeprecatedOptions|null $options DeprecatedOptions instance.
67
+ * @param string $menu_slug Menu slug.
68
+ * @param Template|null $template Template instance.
69
+ * @param string $register_hook WP hook used for register.
70
+ * @param string $render_hook WP hook used for render.
71
+ */
72
+ public function __construct(
73
+ $store,
74
+ $options,
75
+ $menu_slug,
76
+ $template = null,
77
+ $register_hook = 'current_screen',
78
+ $render_hook = 'admin_notices'
79
+ ) {
80
+ $this->store = $store;
81
+ $this->options = $options;
82
+ $this->menu_slug = $menu_slug;
83
+ $this->template = $template;
84
+ $this->register_hook = $register_hook;
85
+ $this->render_hook = $render_hook;
86
+ }
87
+
88
+ /**
89
+ * Returns render hook.
90
+ *
91
+ * @return string
92
+ */
93
+ public function get_render_hook() {
94
+ return $this->render_hook;
95
+ }
96
+
97
+ /**
98
+ * Returns register hook.
99
+ *
100
+ * @return string
101
+ */
102
+ public function get_register_hook() {
103
+ return $this->register_hook;
104
+ }
105
+
106
+ /**
107
+ * Allows to perform actions before rendering.
108
+ */
109
+ public function register() {}
110
+
111
+ /**
112
+ * @param string $suffix Menu page suffix.
113
+ *
114
+ * @return string
115
+ */
116
+ protected function slugged_menu_page( $suffix ) {
117
+ return sprintf( '%s_page_%s_%s', $this->menu_slug, $this->menu_slug, $suffix );
118
+ }
119
+
120
+ /**
121
+ * Returns true if user is on given page.
122
+ *
123
+ * @param string $page_id ID of desired page.
124
+ *
125
+ * @return bool
126
+ */
127
+ protected function is_user_on_page( $page_id ) {
128
+ $screen = get_current_screen();
129
+ return ! is_null( $screen ) ? $page_id === $screen->id : false;
130
+ }
131
+
132
+ /**
133
+ * Returns true if plugin was migrated from 3.X version.
134
+ *
135
+ * @return bool
136
+ */
137
+ protected function was_migrated() {
138
+ return max( 0, $this->options->license->get() ) > 0;
139
+ }
140
+
141
+ /**
142
+ * Returns true if a notification should be rendered.
143
+ *
144
+ * @return bool
145
+ */
146
+ public function should_render() {
147
+ return ! $this->is_user_on_page( $this->slugged_menu_page( 'settings' ) ) &&
148
+ ! $this->is_user_on_page( $this->slugged_menu_page( 'resources' ) );
149
+ }
150
+
151
+ /**
152
+ * Registers a notification.
153
+ */
154
+ public function render() {
155
+ if ( $this->should_render() ) {
156
+ $this->template->render();
157
+ }
158
+ }
159
+
160
+ /**
161
+ * Returns instance of Notification (singleton pattern).
162
+ *
163
+ * @return static
164
+ */
165
+ public static function get_instance() {
166
+ return new static( Store::get_instance(), DeprecatedOptions::get_instance(), MENU_SLUG );
167
+ }
168
+ }
plugin_files/Services/NotificationsRenderer.class.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class NotificationsRenderer
4
+ *
5
+ * @package LiveChat\Services
6
+ */
7
+
8
+ namespace LiveChat\Services;
9
+
10
+ use LiveChat\Services\Notifications\ConfirmIdentityNotice;
11
+ use LiveChat\Services\Notifications\ConnectNotice;
12
+ use LiveChat\Services\Notifications\DeactivationModal;
13
+ use LiveChat\Services\Notifications\Notice;
14
+ use LiveChat\Services\Notifications\Notification;
15
+
16
+ /**
17
+ * Class NotificationsRenderer
18
+ *
19
+ * @package LiveChat\Services
20
+ */
21
+ class NotificationsRenderer {
22
+ /**
23
+ * Array of Notifications.
24
+ *
25
+ * @var Notification[]
26
+ */
27
+ private $notifications;
28
+
29
+ /**
30
+ * NotificationsRenderer constructor.
31
+ *
32
+ * @param Notification[] $notifications Array of Notifications.
33
+ */
34
+ public function __construct( $notifications ) {
35
+ $this->notifications = $notifications;
36
+ }
37
+
38
+ /**
39
+ * Initializes modals and notices.
40
+ */
41
+ public function init() {
42
+ foreach ( $this->notifications as $notification ) {
43
+ add_action( $notification->get_register_hook(), array( $notification, 'register' ) );
44
+ add_action( $notification->get_render_hook(), array( $notification, 'render' ) );
45
+ }
46
+ }
47
+
48
+ /**
49
+ * Returns instance of NotificationsRenderer (singleton pattern).
50
+ *
51
+ * @return NotificationsRenderer
52
+ */
53
+ public static function get_instance() {
54
+ return new static(
55
+ array(
56
+ ConnectNotice::get_instance(),
57
+ ConfirmIdentityNotice::get_instance(),
58
+ DeactivationModal::get_instance(),
59
+ Notice::get_instance(),
60
+ )
61
+ );
62
+ }
63
+ }
plugin_files/Services/Options/AuthorizedUsers.class.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class AuthorizedUsers
4
+ *
5
+ * @package LiveChat\Services\Options
6
+ */
7
+
8
+ namespace LiveChat\Services\Options;
9
+
10
+ /**
11
+ * Class AuthorizedUsers
12
+ *
13
+ * @package LiveChat\Services\Options
14
+ */
15
+ class AuthorizedUsers extends WritableOption {
16
+ /**
17
+ * AuthorizedUsers constructor.
18
+ *
19
+ * @inheritDoc
20
+ */
21
+ public function __construct() {
22
+ parent::__construct( 'authorized_users' );
23
+ }
24
+
25
+ /**
26
+ * Gets authorized user IDs.
27
+ *
28
+ * @return string[]|null
29
+ */
30
+ public function get() {
31
+ $stringified = parent::get();
32
+
33
+ if ( ! $stringified ) {
34
+ return null;
35
+ }
36
+
37
+ return explode( ',', $stringified );
38
+ }
39
+
40
+ /**
41
+ * Sets authorized user IDs.
42
+ *
43
+ * @param string[] $authorized_users Array of authorized user IDs.
44
+ *
45
+ * @return bool
46
+ */
47
+ public function set( $authorized_users ) {
48
+ return parent::set( implode( ',', $authorized_users ) );
49
+ }
50
+ }
plugin_files/Services/Options/Deprecated/DeprecatedLicenseEmail.class.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class DeprecatedLicenseEmail
4
+ *
5
+ * @package LiveChat\Services\Options\Deprecated
6
+ */
7
+
8
+ namespace LiveChat\Services\Options\Deprecated;
9
+
10
+ /**
11
+ * Class DeprecatedLicenseEmail
12
+ *
13
+ * @package LiveChat\Services\Options\Deprecated
14
+ */
15
+ class DeprecatedLicenseEmail extends DeprecatedOption {
16
+ /**
17
+ * DeprecatedLicenseEmail constructor.
18
+ */
19
+ public function __construct() {
20
+ parent::__construct( 'email', 'licenseEmail' );
21
+ }
22
+ }
plugin_files/Services/Options/Deprecated/DeprecatedLicenseNumber.class.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class DeprecatedLicenseNumber
4
+ *
5
+ * @package LiveChat\Services\Options\Deprecated
6
+ */
7
+
8
+ namespace LiveChat\Services\Options\Deprecated;
9
+
10
+ /**
11
+ * Class DeprecatedLicenseNumber
12
+ *
13
+ * @package LiveChat\Services\Options\Deprecated
14
+ */
15
+ class DeprecatedLicenseNumber extends DeprecatedOption {
16
+ /**
17
+ * DeprecatedLicenseNumber constructor.
18
+ */
19
+ public function __construct() {
20
+ parent::__construct( 'license_number', 'license' );
21
+ }
22
+ }
plugin_files/Services/Options/Deprecated/DeprecatedOption.class.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class DeprecatedOption
4
+ *
5
+ * @package LiveChat\Services\Options\Deprecated
6
+ */
7
+
8
+ namespace LiveChat\Services\Options\Deprecated;
9
+
10
+ use LiveChat\Services\Options\ReadableOption;
11
+
12
+ /**
13
+ * Class DeprecatedOption
14
+ *
15
+ * @package LiveChat\Services\Options\Deprecated
16
+ */
17
+ class DeprecatedOption extends ReadableOption {
18
+ /**
19
+ * DeprecatedOption constructor.
20
+ *
21
+ * @param string $wp_key WordPress deprecated option key.
22
+ * @param string $woo_key WooCommerce deprecated option key.
23
+ */
24
+ public function __construct( $wp_key, $woo_key = null ) {
25
+ if ( ! $woo_key ) {
26
+ $woo_key = $wp_key;
27
+ }
28
+
29
+ parent::__construct(
30
+ is_woo() ? $woo_key : $wp_key,
31
+ null,
32
+ DEPRECATED_OPTION_PREFIXES[ is_woo() ? 'woo-legacy' : 'wp-legacy' ]
33
+ );
34
+ }
35
+ }
plugin_files/Services/Options/Deprecated/DeprecatedOptions.class.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class DeprecatedOptions
4
+ *
5
+ * @package LiveChat\Services\Options\Deprecated
6
+ */
7
+
8
+ namespace LiveChat\Services\Options\Deprecated;
9
+
10
+ use LiveChat\Services\Options\Deprecated\Widget\DeprecatedWidgetSettings;
11
+ use LiveChat\Services\Options\OptionsSet;
12
+
13
+ /**
14
+ * Class DeprecatedOptions
15
+ *
16
+ * @package LiveChat\Services\Options\Deprecated
17
+ */
18
+ class DeprecatedOptions extends OptionsSet {
19
+ /**
20
+ * Instance of DeprecatedLicenseNumber.
21
+ *
22
+ * @var DeprecatedLicenseNumber
23
+ */
24
+ public $license;
25
+
26
+ /**
27
+ * Instance of DeprecatedLicenseEmail.
28
+ *
29
+ * @var DeprecatedLicenseEmail
30
+ */
31
+ public $license_email;
32
+
33
+ /**
34
+ * Instance of DeprecatedReviewNoticeOptions.
35
+ *
36
+ * @var DeprecatedReviewNoticeOptions
37
+ */
38
+ public $review_notice;
39
+
40
+ /**
41
+ * Instance of DeprecatedWidgetSettings.
42
+ *
43
+ * @var DeprecatedWidgetSettings
44
+ */
45
+ public $widget_settings;
46
+
47
+ /**
48
+ * DeprecatedOptions constructor.
49
+ */
50
+ public function __construct() {
51
+ parent::__construct(
52
+ array(
53
+ 'license' => DeprecatedLicenseNumber::get_instance(),
54
+ 'license_email' => DeprecatedLicenseEmail::get_instance(),
55
+ 'review_notice' => DeprecatedReviewNoticeOptions::get_instance(),
56
+ 'widget_settings' => DeprecatedWidgetSettings::get_instance(),
57
+ )
58
+ );
59
+ }
60
+ }
plugin_files/Services/Options/Deprecated/DeprecatedReviewNoticeDismissed.class.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class DeprecatedReviewNoticeDismissed
4
+ *
5
+ * @package LiveChat\Services\Options\Deprecated
6
+ */
7
+
8
+ namespace LiveChat\Services\Options\Deprecated;
9
+
10
+ /**
11
+ * Class DeprecatedReviewNoticeDismissed
12
+ *
13
+ * @package LiveChat\Services\Options\Deprecated
14
+ */
15
+ class DeprecatedReviewNoticeDismissed extends DeprecatedOption {
16
+ /**
17
+ * DeprecatedReviewNoticeDismissed constructor.
18
+ */
19
+ public function __construct() {
20
+ parent::__construct( 'review_notice_dismissed', false );
21
+ }
22
+ }
plugin_files/Services/Options/Deprecated/DeprecatedReviewNoticeOffset.class.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class DeprecatedReviewNoticeOffset
4
+ *
5
+ * @package LiveChat\Services\Options\Deprecated
6
+ */
7
+
8
+ namespace LiveChat\Services\Options\Deprecated;
9
+
10
+ /**
11
+ * Class DeprecatedReviewNoticeOffset
12
+ *
13
+ * @package LiveChat\Services\Options\Deprecated
14
+ */
15
+ class DeprecatedReviewNoticeOffset extends DeprecatedOption {
16
+ /**
17
+ * DeprecatedReviewNoticeOffset constructor.
18
+ */
19
+ public function __construct() {
20
+ parent::__construct( 'review_notice_start_timestamp_offset', 0 );
21
+ }
22
+ }
plugin_files/Services/Options/Deprecated/DeprecatedReviewNoticeOptions.class.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace LiveChat\Services\Options\Deprecated;
4
+
5
+ use LiveChat\Services\Options\OptionsSet;
6
+
7
+ class DeprecatedReviewNoticeOptions extends OptionsSet {
8
+ /**
9
+ * Instance of DeprecatedReviewNoticeDismissed.
10
+ *
11
+ * @var DeprecatedReviewNoticeDismissed
12
+ */
13
+ public $dismissed;
14
+
15
+ /**
16
+ * Instance of DeprecatedReviewNoticeTimestamp.
17
+ *
18
+ * @var DeprecatedReviewNoticeTimestamp
19
+ */
20
+ public $timestamp;
21
+
22
+ /**
23
+ * Instance of DeprecatedReviewNoticeOffset.
24
+ *
25
+ * @var DeprecatedReviewNoticeOffset
26
+ */
27
+ public $offset;
28
+
29
+ /**
30
+ * DeprecatedReviewNoticeOptions constructor.
31
+ */
32
+ public function __construct() {
33
+ parent::__construct(
34
+ array(
35
+ 'dismissed' => DeprecatedReviewNoticeDismissed::get_instance(),
36
+ 'timestamp' => DeprecatedReviewNoticeTimestamp::get_instance(),
37
+ 'offset' => DeprecatedReviewNoticeOffset::get_instance(),
38
+ )
39
+ );
40
+ }
41
+
42
+ /**
43
+ * Returns an array with all options
44
+ */
45
+ public function get() {
46
+ return array_filter(
47
+ array(
48
+ 'reviewNoticeDismissed' => $this->dismissed->get(),
49
+ 'reviewNoticeTimestamp' => $this->timestamp->get(),
50
+ 'reviewNoticeOffset' => $this->offset->get(),
51
+ ),
52
+ function ( $val ) {
53
+ return ! is_null( $val ); }
54
+ );
55
+ }
56
+ }
plugin_files/Services/Options/Deprecated/DeprecatedReviewNoticeTimestamp.class.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class DeprecatedReviewNoticeTimestamp
4
+ *
5
+ * @package LiveChatServicesOptionsDeprecated
6
+ */
7
+
8
+ namespace LiveChat\Services\Options\Deprecated;
9
+
10
+ /**
11
+ * Class DeprecatedReviewNoticeTimestamp
12
+ *
13
+ * @package LiveChat\Services\Options\Deprecated
14
+ */
15
+ class DeprecatedReviewNoticeTimestamp extends DeprecatedOption {
16
+ /**
17
+ * DeprecatedReviewNoticeTimestamp constructor.
18
+ */
19
+ public function __construct() {
20
+ parent::__construct( 'review_notice_start_timestamp', 0 );
21
+ }
22
+ }
plugin_files/Services/Options/Deprecated/Widget/DeprecatedWidgetSettings.class.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class DeprecatedWidgetSettings
4
+ *
5
+ * @package LiveChat\Services\Options\Deprecated\Widget
6
+ */
7
+
8
+ namespace LiveChat\Services\Options\Deprecated\Widget;
9
+
10
+ use LiveChat\Services\Options\OptionsSet;
11
+
12
+ /**
13
+ * Class DeprecatedWidgetSettings
14
+ *
15
+ * @package LiveChat\Services\Options\Deprecated\Widget
16
+ */
17
+ class DeprecatedWidgetSettings extends OptionsSet {
18
+ /**
19
+ * DeprecatedWidgetWordPressSettings instance.
20
+ *
21
+ * @var DeprecatedWidgetWordPressSettings
22
+ */
23
+ protected $wp;
24
+ /**
25
+ * DeprecatedWidgetWooCommerceSettings instance.
26
+ *
27
+ * @var DeprecatedWidgetWooCommerceSettings
28
+ */
29
+ protected $woo;
30
+
31
+ /**
32
+ * DeprecatedWidgetSettings constructor.
33
+ */
34
+ public function __construct() {
35
+ parent::__construct(
36
+ array(
37
+ 'wp' => DeprecatedWidgetWordPressSettings::get_instance(),
38
+ 'woo' => DeprecatedWidgetWooCommerceSettings::get_instance(),
39
+ )
40
+ );
41
+ }
42
+
43
+ /**
44
+ * Returns array of settings based on current platform.
45
+ *
46
+ * @return DeprecatedWidgetWooCommerceSettings|DeprecatedWidgetWordPressSettings
47
+ */
48
+ private function option() {
49
+ if ( is_woo() ) {
50
+ return $this->woo;
51
+ }
52
+
53
+ return $this->wp;
54
+ }
55
+
56
+ /**
57
+ * Returns array of settings based on current platform.
58
+ *
59
+ * @return bool[]
60
+ */
61
+ public function get() {
62
+ return $this->option()->get();
63
+ }
64
+
65
+ /**
66
+ * Returns array of settings based on current platform.
67
+ *
68
+ * @return bool
69
+ */
70
+ public function remove() {
71
+ return $this->option()->remove();
72
+ }
73
+ }
plugin_files/Services/Options/Deprecated/Widget/DeprecatedWidgetWooCommerceSettings.class.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class DeprecatedWidgetWooCommerceSettings
4
+ *
5
+ * @package LiveChat\Services\Options\Deprecated\Widget
6
+ */
7
+
8
+ namespace LiveChat\Services\Options\Deprecated\Widget;
9
+
10
+ use LiveChat\Services\Options\Deprecated\DeprecatedOption;
11
+
12
+ /**
13
+ * Class DeprecatedWidgetWooCommerceSettings
14
+ *
15
+ * @package LiveChat\Services\Options\Deprecated\Widget
16
+ */
17
+ class DeprecatedWidgetWooCommerceSettings extends DeprecatedOption {
18
+ /**
19
+ * DeprecatedWidgetWooCommerceSettings constructor.
20
+ */
21
+ public function __construct() {
22
+ parent::__construct( 'customDataSettings' );
23
+ }
24
+
25
+ /**
26
+ * Returns array of WooCommerce widget options.
27
+ *
28
+ * @return bool[]
29
+ */
30
+ public function get() {
31
+ $settings = parent::get();
32
+
33
+ if ( ! is_array( $settings ) ) {
34
+ return array();
35
+ }
36
+
37
+ return $this->extract_widget_options( $settings );
38
+ }
39
+
40
+ /**
41
+ * Returns mapped deprecated widget options from plugin settings.
42
+ *
43
+ * @param array $settings Array with legacy settings.
44
+ *
45
+ * @return bool[]
46
+ */
47
+ public function extract_widget_options( $settings ) {
48
+ $options = array();
49
+ $disable_guest_key = $this->prefix . 'disableGuest';
50
+ $disable_mobile_key = $this->prefix . 'disableMobile';
51
+
52
+ if ( array_key_exists( $disable_guest_key, $settings ) ) {
53
+ $options['hideForGuests'] = $settings[ $disable_guest_key ];
54
+ }
55
+
56
+ if ( array_key_exists( $disable_mobile_key, $settings ) ) {
57
+ $options['hideOnMobile'] = $settings[ $disable_mobile_key ];
58
+ }
59
+
60
+ return $options;
61
+ }
62
+ }
plugin_files/Services/Options/Deprecated/Widget/DeprecatedWidgetWordPressDisableGuestsOption.class.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class DeprecatedWidgetWordPressDisableGuestsOption
4
+ *
5
+ * @package LiveChat\Services\Options\Deprecated\Widget
6
+ */
7
+
8
+ namespace LiveChat\Services\Options\Deprecated\Widget;
9
+
10
+ use LiveChat\Services\Options\Deprecated\DeprecatedOption;
11
+
12
+ /**
13
+ * Class DeprecatedWidgetWordPressDisableGuestsOption
14
+ *
15
+ * @package LiveChat\Services\Options\Deprecated\Widget
16
+ */
17
+ class DeprecatedWidgetWordPressDisableGuestsOption extends DeprecatedOption {
18
+ /**
19
+ * DeprecatedWidgetWordPressDisableGuestsOption constructor.
20
+ */
21
+ public function __construct() {
22
+ parent::__construct( 'disable_guests' );
23
+ }
24
+ }
plugin_files/Services/Options/Deprecated/Widget/DeprecatedWidgetWordPressDisableMobileOption.class.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class DeprecatedWidgetWordPressDisableMobileOption
4
+ *
5
+ * @package LiveChat\Services\Options\Deprecated\Widget
6
+ */
7
+
8
+ namespace LiveChat\Services\Options\Deprecated\Widget;
9
+
10
+ use LiveChat\Services\Options\Deprecated\DeprecatedOption;
11
+
12
+ /**
13
+ * Class DeprecatedWidgetWordPressDisableMobileOption
14
+ *
15
+ * @package LiveChat\Services\Options\Deprecated\Widget
16
+ */
17
+ class DeprecatedWidgetWordPressDisableMobileOption extends DeprecatedOption {
18
+ /**
19
+ * DeprecatedWidgetWordPressDisableMobileOption constructor.
20
+ */
21
+ public function __construct() {
22
+ parent::__construct( 'disable_mobile' );
23
+ }
24
+ }
plugin_files/Services/Options/Deprecated/Widget/DeprecatedWidgetWordPressSettings.class.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class DeprecatedWidgetWordPressSettings
4
+ *
5
+ * @package LiveChat\Services\Options\Deprecated\Widget
6
+ */
7
+
8
+ namespace LiveChat\Services\Options\Deprecated\Widget;
9
+
10
+ use LiveChat\Services\Options\OptionsSet;
11
+
12
+ /**
13
+ * Class DeprecatedWidgetWordPressSettings
14
+ *
15
+ * @package LiveChat\Services\Options\Deprecated\Widget
16
+ */
17
+ class DeprecatedWidgetWordPressSettings extends OptionsSet {
18
+ /**
19
+ * DeprecatedWidgetWordPressDisableMobileOption instance.
20
+ *
21
+ * @var DeprecatedWidgetWordPressDisableMobileOption
22
+ */
23
+ protected $disable_mobile;
24
+ /**
25
+ * DeprecatedWidgetWordPressDisableMobileOption instance.
26
+ *
27
+ * @var DeprecatedWidgetWordPressDisableGuestsOption
28
+ */
29
+ protected $disable_guests;
30
+
31
+ /**
32
+ * DeprecatedWidgetWordPressSettings constructor.
33
+ */
34
+ public function __construct() {
35
+ parent::__construct(
36
+ array(
37
+ 'disable_mobile' => DeprecatedWidgetWordPressDisableMobileOption::get_instance(),
38
+ 'disable_guests' => DeprecatedWidgetWordPressDisableGuestsOption::get_instance(),
39
+ )
40
+ );
41
+ }
42
+
43
+ /**
44
+ * Returns array of WordPress widget options.
45
+ *
46
+ * @return bool[]
47
+ */
48
+ public function get() {
49
+ return array_map(
50
+ function ( $val ) {
51
+ return (bool) $val;
52
+ },
53
+ array_filter(
54
+ array(
55
+ 'hideForGuests' => $this->disable_guests->get(),
56
+ 'hideOnMobile' => $this->disable_mobile->get(),
57
+ ),
58
+ function ( $val ) {
59
+ return ! is_null( $val );
60
+ }
61
+ )
62
+ );
63
+ }
64
+
65
+ /**
66
+ * Removes deprecated WordPress widget options.
67
+ *
68
+ * @return bool
69
+ */
70
+ public function remove() {
71
+ return $this->disable_guests->remove() && $this->disable_mobile->remove();
72
+ }
73
+ }
plugin_files/Services/Options/Option.class.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace LiveChat\Services\Options;
4
+
5
+ use Exception;
6
+
7
+ class Option {
8
+ /**
9
+ * Option storage key prefix.
10
+ *
11
+ * @var string
12
+ */
13
+ public $prefix;
14
+
15
+ /**
16
+ * Option storage key name.
17
+ *
18
+ * @var string
19
+ */
20
+ public $name;
21
+
22
+ /**
23
+ * Option storage name with prefix.
24
+ *
25
+ * @var string
26
+ */
27
+ public $key;
28
+
29
+ /**
30
+ * Fallback value.
31
+ *
32
+ * @var mixed
33
+ */
34
+ public $fallback;
35
+
36
+ /**
37
+ * ReadableOption constructor.
38
+ *
39
+ * @param string $name Option storage key name.
40
+ * @param mixed $fallback Fallback value.
41
+ * @param string $prefix Option storage key prefix.
42
+ *
43
+ * @throws Exception Can be thrown when $key is not provided.
44
+ */
45
+ public function __construct( $name, $fallback = null, $prefix = OPTION_PREFIX ) {
46
+ if ( empty( $name ) ) {
47
+ throw new Exception( 'Option cannot be declared without a storage key.' );
48
+ }
49
+
50
+ $this->prefix = $prefix;
51
+ $this->name = $name;
52
+ $this->fallback = $fallback;
53
+ $this->key = $this->prefix . $this->name;
54
+ }
55
+
56
+ /**
57
+ * Returns fallback for option and performs legacy WooCommerce key migration if necessary.
58
+ *
59
+ * @param mixed $id User ID.
60
+ * @return mixed
61
+ */
62
+ public function get_option_fallback( $id ) {
63
+ return $this->fallback;
64
+ }
65
+
66
+ /**
67
+ * Returns instance of ReadableOption (singleton pattern).
68
+ *
69
+ * @return static
70
+ * @throws Exception Can be thrown from ReadableOption constructor.
71
+ */
72
+ public static function get_instance() {
73
+ return new static();
74
+ }
75
+ }
plugin_files/Services/Options/OptionsSet.class.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class OptionsSet
4
+ *
5
+ * @package LiveChat\Services\Options
6
+ */
7
+
8
+ namespace LiveChat\Services\Options;
9
+
10
+ /**
11
+ * Class OptionsSet
12
+ *
13
+ * @package LiveChat\Services\Options
14
+ */
15
+ class OptionsSet {
16
+ /**
17
+ * OptionsSet constructor.
18
+ *
19
+ * @param Option[]|self[] $options Array of Options.
20
+ */
21
+ public function __construct( $options ) {
22
+ foreach ( $options as $key => $option ) {
23
+ $this->{$key} = $option;
24
+ }
25
+ }
26
+
27
+ /**
28
+ * Clears all functions in set.
29
+ *
30
+ * @return bool
31
+ */
32
+ public function remove() {
33
+ $options = array_filter(
34
+ get_object_vars( $this ),
35
+ function ( $var ) {
36
+ return $var instanceof ReadableOption || $var instanceof OptionsSet;
37
+ }
38
+ );
39
+
40
+ return array_reduce(
41
+ $options,
42
+ function ( $acc, $option ) {
43
+ return $option->remove() && $acc;
44
+ },
45
+ true
46
+ );
47
+ }
48
+
49
+ /**
50
+ * Returns instance of OptionsSet (singleton pattern).
51
+ *
52
+ * @return static
53
+ */
54
+ public static function get_instance() {
55
+ return new static();
56
+ }
57
+ }
plugin_files/Services/Options/Platform.class.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class Platform
4
+ *
5
+ * @package LiveChat\Services\Options
6
+ */
7
+
8
+ namespace LiveChat\Services\Options;
9
+
10
+ /**
11
+ * Class Platform
12
+ *
13
+ * @package LiveChat\Services\Options
14
+ */
15
+ class Platform extends WritableOption {
16
+ /**
17
+ * Platform constructor.
18
+ */
19
+ public function __construct() {
20
+ parent::__construct( 'platform' );
21
+ }
22
+ }
23
+
plugin_files/Services/Options/PublicKey.class.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class PublicKey
4
+ *
5
+ * @package LiveChat\Services\Options
6
+ */
7
+
8
+ namespace LiveChat\Services\Options;
9
+
10
+ /**
11
+ * Class PublicKey
12
+ *
13
+ * @package LiveChat\Services\Options
14
+ */
15
+ class PublicKey extends WritableOption {
16
+ /**
17
+ * PublicKey constructor.
18
+ */
19
+ public function __construct() {
20
+ parent::__construct( 'public_key' );
21
+ }
22
+ }
plugin_files/Services/Options/ReadableOption.class.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class ReadableOption
4
+ *
5
+ * @package LiveChat\Services\Options
6
+ */
7
+
8
+ namespace LiveChat\Services\Options;
9
+
10
+ use LiveChat\Services\Options\WooCommerce\WooCommerceOption;
11
+
12
+ /**
13
+ * Class ReadableOption
14
+ *
15
+ * @package LiveChat\Services\Options
16
+ */
17
+ class ReadableOption extends Option {
18
+ /**
19
+ * Fallbacks default value to legacy WooCommerceOption value.
20
+ *
21
+ * @param mixed $id User ID.
22
+ * @return mixed
23
+ */
24
+ public function get_option_fallback( $id = null ) {
25
+ // To prevent fallbacks for WooCommerceOption instances.
26
+ if ( OPTION_PREFIX !== $this->prefix ) {
27
+ return $this->fallback;
28
+ }
29
+
30
+ $woo_option = new WooCommerceOption( $this->name, null );
31
+ $woo_option_value = $woo_option->get();
32
+
33
+ if ( is_null( $woo_option_value ) ) {
34
+ return $this->fallback;
35
+ }
36
+
37
+ update_option( $this->key, $woo_option_value );
38
+ $woo_option->remove();
39
+
40
+ return $woo_option_value;
41
+ }
42
+
43
+ /**
44
+ * Returns option value.
45
+ *
46
+ * @return mixed
47
+ */
48
+ public function get() {
49
+ $option = get_option( $this->key, null );
50
+
51
+ if ( is_null( $option ) ) {
52
+ return $this->get_option_fallback();
53
+ }
54
+
55
+ return $option;
56
+ }
57
+
58
+ /**
59
+ * Removes an option.
60
+ *
61
+ * @return bool
62
+ */
63
+ public function remove() {
64
+ return delete_option( $this->key );
65
+ }
66
+ }
plugin_files/Services/Options/ReviewNoticeDismissed.class.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class ReviewNoticeDismissed
4
+ *
5
+ * @package LiveChat\Services\Options
6
+ */
7
+
8
+ namespace LiveChat\Services\Options;
9
+
10
+ /**
11
+ * Class ReviewNoticeDismissed
12
+ *
13
+ * @package LiveChat\Services\Options
14
+ */
15
+ class ReviewNoticeDismissed extends ReadableOption {
16
+ /**
17
+ * ReviewNoticeDismissed constructor.
18
+ */
19
+ public function __construct() {
20
+ parent::__construct( 'review_notice_dismissed' );
21
+ }
22
+ }
plugin_files/Services/Options/ReviewNoticeOffset.class.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class ReviewNoticeOffset
4
+ *
5
+ * @package LiveChat\Services\Options
6
+ */
7
+
8
+ namespace LiveChat\Services\Options;
9
+
10
+ /**
11
+ * Class ReviewNoticeOffset
12
+ *
13
+ * @package LiveChat\Services\Options
14
+ */
15
+ class ReviewNoticeOffset extends ReadableOption {
16
+ /**
17
+ * ReviewNoticeOffset constructor.
18
+ */
19
+ public function __construct() {
20
+ parent::__construct( 'review_notice_start_timestamp_offset' );
21
+ }
22
+ }
plugin_files/Services/Options/ReviewNoticeOptions.class.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class ReviewNoticeOptions
4
+ *
5
+ * @package LiveChat\Services\Options
6
+ */
7
+
8
+ namespace LiveChat\Services\Options;
9
+
10
+ /**
11
+ * Class ReviewNoticeOptions
12
+ *
13
+ * @package LiveChat\Services\Options
14
+ */
15
+ class ReviewNoticeOptions extends OptionsSet {
16
+ /**
17
+ * ReviewNoticeDismissed instance.
18
+ *
19
+ * @var ReviewNoticeDismissed
20
+ */
21
+ public $dismissed;
22
+
23
+ /**
24
+ * ReviewNoticeTimestamp instance.
25
+ *
26
+ * @var ReviewNoticeTimestamp
27
+ */
28
+ public $timestamp;
29
+
30
+ /**
31
+ * ReviewNoticeOffset instance.
32
+ *
33
+ * @var ReviewNoticeOffset
34
+ */
35
+ public $offset;
36
+
37
+ /**
38
+ * ReviewNoticeOptions constructor.
39
+ */
40
+ public function __construct() {
41
+ parent::__construct(
42
+ array(
43
+ 'dismissed' => ReviewNoticeDismissed::get_instance(),
44
+ 'timestamp' => ReviewNoticeTimestamp::get_instance(),
45
+ 'offset' => ReviewNoticeOffset::get_instance(),
46
+ )
47
+ );
48
+ }
49
+
50
+ /**
51
+ * Returns an array with all options
52
+ */
53
+ public function get() {
54
+ return array_filter(
55
+ array(
56
+ 'reviewNoticeDismissed' => $this->dismissed->get(),
57
+ 'reviewNoticeTimestamp' => $this->timestamp->get(),
58
+ 'reviewNoticeOffset' => $this->offset->get(),
59
+ ),
60
+ function ( $val ) {
61
+ return ! is_null( $val ); }
62
+ );
63
+ }
64
+ }
plugin_files/Services/Options/ReviewNoticeTimestamp.class.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class ReviewNoticeTimestamp
4
+ *
5
+ * @package LiveChat\Services\Options
6
+ */
7
+
8
+ namespace LiveChat\Services\Options;
9
+
10
+ /**
11
+ * Class ReviewNoticeTimestamp
12
+ *
13
+ * @package LiveChat\Services\Options
14
+ */
15
+ class ReviewNoticeTimestamp extends ReadableOption {
16
+ /**
17
+ * ReviewNoticeTimestamp constructor.
18
+ */
19
+ public function __construct() {
20
+ parent::__construct( 'review_notice_start_timestamp' );
21
+ }
22
+ }
plugin_files/Services/Options/SettingsOptions.class.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class SettingsOptions
4
+ *
5
+ * @package LiveChat\Services\Options
6
+ */
7
+
8
+ namespace LiveChat\Services\Options;
9
+
10
+ use LiveChat\Services\Options\Deprecated\DeprecatedOptions;
11
+
12
+ /**
13
+ * Class SettingsOptions
14
+ *
15
+ * @package LiveChat\Services\Options
16
+ */
17
+ class SettingsOptions extends OptionsSet {
18
+ /**
19
+ * ReviewNoticeOptions instance.
20
+ *
21
+ * @var ReviewNoticeOptions
22
+ */
23
+ public $review_notice;
24
+
25
+ /**
26
+ * DeprecatedOptions instance.
27
+ *
28
+ * @var DeprecatedOptions
29
+ */
30
+ public $deprecated;
31
+
32
+ /**
33
+ * WidgetURL instance.
34
+ *
35
+ * @var WidgetURL
36
+ */
37
+ public $widget_url;
38
+
39
+ /**
40
+ * SettingsOptions constructor.
41
+ */
42
+ public function __construct() {
43
+ parent::__construct(
44
+ array(
45
+ 'review_notice' => ReviewNoticeOptions::get_instance(),
46
+ 'deprecated' => DeprecatedOptions::get_instance(),
47
+ 'widget_url' => WidgetURL::get_instance(),
48
+ 'platform' => Platform::get_instance(),
49
+ 'public_key' => PublicKey::get_instance(),
50
+ 'synchronized' => Synchronized::get_instance(),
51
+ )
52
+ );
53
+ }
54
+ }
plugin_files/Services/Options/StoreToken.class.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class StoreToken
4
+ *
5
+ * @package LiveChat\Services\Options
6
+ */
7
+
8
+ namespace LiveChat\Services\Options;
9
+
10
+ /**
11
+ * Class StoreToken
12
+ *
13
+ * @package LiveChat\Services\Options
14
+ */
15
+ class StoreToken extends WritableOption {
16
+ /**
17
+ * StoreToken constructor.
18
+ */
19
+ public function __construct() {
20
+ parent::__construct( 'store_token' );
21
+ }
22
+ }
plugin_files/Services/Options/Synchronized.class.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class OptionsSynchronized
4
+ *
5
+ * @package LiveChat\Services\Options
6
+ */
7
+
8
+ namespace LiveChat\Services\Options;
9
+
10
+ /**
11
+ * Class OptionsSynchronized
12
+ *
13
+ * @package LiveChat\Services\Options
14
+ */
15
+ class Synchronized extends WritableOption {
16
+ /**
17
+ * Class OptionsSynchronized
18
+ *
19
+ * @package LiveChat\Services\Options
20
+ */
21
+ public function __construct() {
22
+ parent::__construct( 'synchronized', false );
23
+ }
24
+
25
+ /**
26
+ * Returns value of option.
27
+ *
28
+ * @return bool
29
+ */
30
+ public function get() {
31
+ return (bool) parent::get();
32
+ }
33
+
34
+ /**
35
+ * Sets option as true.
36
+ *
37
+ * @return bool
38
+ */
39
+ public function yes() {
40
+ return parent::set( true );
41
+ }
42
+ }
43
+
plugin_files/Services/Options/UserAuthOptions.class.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class UserAuthOptions
4
+ *
5
+ * @package LiveChat\Services\Options
6
+ */
7
+
8
+ namespace LiveChat\Services\Options;
9
+
10
+ /**
11
+ * Class UserAuthOptions
12
+ *
13
+ * @package LiveChat\Services\Options
14
+ */
15
+ class UserAuthOptions extends OptionsSet {
16
+ /**
17
+ * UserToken instance.
18
+ *
19
+ * @var UserToken
20
+ */
21
+ public $user_token;
22
+
23
+ /**
24
+ * AuthorizedUsers instance.
25
+ *
26
+ * @var AuthorizedUsers
27
+ */
28
+ public $authorized_users;
29
+
30
+ /**
31
+ * UserAuthOptions constructor.
32
+ */
33
+ public function __construct() {
34
+ parent::__construct(
35
+ array(
36
+ 'user_token' => UserToken::get_instance(),
37
+ 'authorized_users' => AuthorizedUsers::get_instance(),
38
+ )
39
+ );
40
+ }
41
+ }
plugin_files/Services/Options/UserOption.class.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class UserOption
4
+ *
5
+ * @package LiveChat\Services\Options
6
+ */
7
+
8
+ namespace LiveChat\Services\Options;
9
+
10
+ use LiveChat\Services\Options\WooCommerce\WooCommerceUserOption;
11
+
12
+ /**
13
+ * Class UserOption
14
+ *
15
+ * @package LiveChat\Services\Options
16
+ */
17
+ class UserOption extends Option {
18
+ /**
19
+ * Fallbacks default value to legacy WooCommerceOption value.
20
+ *
21
+ * @param mixed $id User ID.
22
+ * @return mixed
23
+ */
24
+ public function get_option_fallback( $id ) {
25
+ // To prevent fallbacks for WooCommerceUserOption instances.
26
+ if ( OPTION_PREFIX !== $this->prefix ) {
27
+ return $this->fallback;
28
+ }
29
+
30
+ $woo_option = new WooCommerceUserOption( $this->name, null );
31
+ $woo_option_value = $woo_option->get( $id );
32
+
33
+ if ( is_null( $woo_option_value ) ) {
34
+ return $this->fallback;
35
+ }
36
+
37
+ $this->set( $id, $woo_option_value );
38
+ $woo_option->remove( $id );
39
+
40
+ return $woo_option_value;
41
+ }
42
+
43
+ /**
44
+ * Returns JWt for given user.
45
+ *
46
+ * @param mixed $id User ID.
47
+ * @return string
48
+ */
49
+ public function get( $id ) {
50
+ $option = get_option( sprintf( $this->key, $id ), null );
51
+
52
+ if ( is_null( $option ) ) {
53
+ return $this->get_option_fallback( $id );
54
+ }
55
+
56
+ return $option;
57
+ }
58
+
59
+ /**
60
+ * Removes JWt for given user.
61
+ *
62
+ * @param mixed $id User ID.
63
+ * @return string
64
+ */
65
+ public function remove( $id ) {
66
+ return delete_option( sprintf( $this->key, $id ) );
67
+ }
68
+
69
+ /**
70
+ * Returns JWt for given user.
71
+ *
72
+ * @param mixed $id User ID.
73
+ * @param string $value JWT.
74
+ * @return string
75
+ */
76
+ public function set( $id, $value ) {
77
+ return update_option( sprintf( $this->key, $id ), $value );
78
+ }
79
+ }
plugin_files/Services/Options/UserToken.class.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class UserToken
4
+ *
5
+ * @package LiveChat\Services\Options
6
+ */
7
+
8
+ namespace LiveChat\Services\Options;
9
+
10
+ /**
11
+ * Class UserToken
12
+ *
13
+ * @package LiveChat\Services\Options
14
+ */
15
+ class UserToken extends UserOption {
16
+ /**
17
+ * UserToken constructor.
18
+ */
19
+ public function __construct() {
20
+ parent::__construct( 'user_%s_token' );
21
+ }
22
+ }
plugin_files/Services/Options/WidgetURL.class.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class WidgetURL
4
+ *
5
+ * @package LiveChat\Services\Options
6
+ */
7
+
8
+ namespace LiveChat\Services\Options;
9
+
10
+ /**
11
+ * Class WidgetURL
12
+ *
13
+ * @package LiveChat\Services\Options
14
+ */
15
+ class WidgetURL extends WritableOption {
16
+ /**
17
+ * WidgetURL constructor.
18
+ */
19
+ public function __construct() {
20
+ parent::__construct( 'widget_url' );
21
+ }
22
+ }
plugin_files/Services/Options/WooCommerce/WooCommerceOption.class.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class WooCommerceOption
4
+ *
5
+ * @package LiveChat\Services\Options\WooCommerce
6
+ */
7
+
8
+ namespace LiveChat\Services\Options\WooCommerce;
9
+
10
+ use LiveChat\Services\Options\ReadableOption;
11
+
12
+ /**
13
+ * Class WooCommerceOption
14
+ *
15
+ * @package LiveChat\Services\Options\WooCommerce
16
+ */
17
+ class WooCommerceOption extends ReadableOption {
18
+ /**
19
+ * WooCommerceOption constructor.
20
+ *
21
+ * @param string $key WooCommerce deprecated option key.
22
+ * @param mixed $fallback Fallback value.
23
+ */
24
+ public function __construct( $key, $fallback = null ) {
25
+ parent::__construct(
26
+ $key,
27
+ $fallback,
28
+ DEPRECATED_OPTION_PREFIXES['woo-2.x']
29
+ );
30
+ }
31
+ }
plugin_files/Services/Options/WooCommerce/WooCommerceUserOption.class.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class WooCommerceUserOption
4
+ *
5
+ * @package LiveChat\Services\Options\WooCommerce
6
+ */
7
+
8
+ namespace LiveChat\Services\Options\WooCommerce;
9
+
10
+ use LiveChat\Services\Options\UserOption;
11
+
12
+ /**
13
+ * Class WooCommerceUserOption
14
+ *
15
+ * @package LiveChat\Services\Options\WooCommerce
16
+ */
17
+ class WooCommerceUserOption extends UserOption {
18
+ /**
19
+ * WooCommerceUserOption constructor.
20
+ *
21
+ * @param string $key WooCommerce deprecated option key.
22
+ * @param mixed $fallback Fallback value.
23
+ */
24
+ public function __construct( $key, $fallback = null ) {
25
+ parent::__construct(
26
+ $key,
27
+ $fallback,
28
+ DEPRECATED_OPTION_PREFIXES['woo-2.x']
29
+ );
30
+ }
31
+ }
plugin_files/Services/Options/WritableOption.class.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class WritableOption
4
+ *
5
+ * @package LiveChat\Services\Options
6
+ */
7
+
8
+ namespace LiveChat\Services\Options;
9
+
10
+ /**
11
+ * Class WritableOption
12
+ *
13
+ * @package LiveChat\Services\Options
14
+ */
15
+ class WritableOption extends ReadableOption {
16
+ /**
17
+ * Sets value for an option.
18
+ *
19
+ * @param mixed $value Option value.
20
+ *
21
+ * @return bool
22
+ */
23
+ public function set( $value ) {
24
+ return update_option( $this->key, $value );
25
+ }
26
+ }
plugin_files/Services/PlatformProvider.class.php ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class PlatformProvider
4
+ *
5
+ * @package LiveChat\Services
6
+ */
7
+
8
+ namespace LiveChat\Services;
9
+
10
+ use Exception;
11
+ use LiveChat\Services\Factories\ApiClientFactory;
12
+ use LiveChat\Services\Factories\ConnectTokenProviderFactory;
13
+ use LiveChat\Services\Options\Platform;
14
+ use LiveChat\Services\Options\StoreToken;
15
+
16
+ /**
17
+ * Class PlatformProvider
18
+ *
19
+ * @package LiveChat\Services
20
+ */
21
+ class PlatformProvider {
22
+ /**
23
+ * String of WordPress platform.
24
+ *
25
+ * @var string
26
+ */
27
+ // phpcs:ignore WordPress.WP.CapitalPDangit.Misspelled
28
+ public static $wordpress_platform = 'wordpress';
29
+
30
+ /**
31
+ * String of WooCommerce platform.
32
+ *
33
+ * @var string
34
+ */
35
+ public static $woocommerce_platform = 'woocommerce';
36
+
37
+ /**
38
+ * Instance of ApiClientFactory.
39
+ *
40
+ * @var ApiClientFactory
41
+ */
42
+ private $api_client_factory;
43
+
44
+ /**
45
+ * Instance of ConnectTokenProviderFactory.
46
+ *
47
+ * @var ConnectTokenProviderFactory
48
+ */
49
+ private $connect_token_provider_factory;
50
+
51
+ /**
52
+ * Instance of Store.
53
+ *
54
+ * @var StoreToken
55
+ */
56
+ private $store_token;
57
+
58
+ /**
59
+ * Instance of Platform.
60
+ *
61
+ * @var Platform
62
+ */
63
+ private $platform;
64
+
65
+ /**
66
+ * PlatformProvider constructor.
67
+ *
68
+ * @param ApiClientFactory $api_client_factory Instance of ApiClientFactory.
69
+ * @param ConnectTokenProviderFactory $connect_token_provider_factory Instance of ConnectTokenProviderFactory.
70
+ * @param StoreToken $store_token Instance of StoreToken.
71
+ * @param Platform $platform Instance of Platform.
72
+ */
73
+ public function __construct(
74
+ $api_client_factory,
75
+ $connect_token_provider_factory,
76
+ $store_token,
77
+ $platform
78
+ ) {
79
+ $this->api_client_factory = $api_client_factory;
80
+ $this->connect_token_provider_factory = $connect_token_provider_factory;
81
+ $this->store_token = $store_token;
82
+ $this->platform = $platform;
83
+ }
84
+
85
+ /**
86
+ * Returns default platform obtained by checking activation state of WooCommerce plugin.
87
+ *
88
+ * @return string
89
+ */
90
+ private function get_default_platform() {
91
+ // phpcs:ignore WordPress.WP.CapitalPDangit.Misspelled
92
+ return is_woo_plugin_active() ? self::$woocommerce_platform : self::$wordpress_platform;
93
+ }
94
+
95
+ /**
96
+ * Returns platform based on plugin slug.
97
+ *
98
+ * @return string
99
+ */
100
+ private function get_platform_from_slug() {
101
+ return 'wp-live-chat-software-for-wordpress' === PLUGIN_SLUG ?
102
+ self::$wordpress_platform :
103
+ self::$woocommerce_platform;
104
+ }
105
+
106
+ /**
107
+ * Checks platform assigned to store on Connect backend.
108
+ *
109
+ * @return string
110
+ */
111
+ private function get_backend_platform() {
112
+ try {
113
+ $api_client = $this->api_client_factory->create();
114
+ $platforms = array( self::$wordpress_platform, self::$woocommerce_platform );
115
+
116
+ foreach ( $platforms as $platform ) {
117
+ $response = $api_client->store_info( $platform );
118
+
119
+ if (
120
+ array_key_exists( 'statusCode', $response ) &&
121
+ 401 === $response['statusCode']
122
+ ) {
123
+ continue;
124
+ }
125
+
126
+ return $response['store']['platform'];
127
+ }
128
+ // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
129
+ } catch ( Exception $exception ) {
130
+ // Exception is ignored and detected platform is returned.
131
+ }
132
+
133
+ return $this->get_platform_from_slug();
134
+ }
135
+
136
+ /**
137
+ * @param string $token Store token string.
138
+ *
139
+ * @return bool
140
+ */
141
+ private function is_token_valid( $token ) {
142
+ try {
143
+ $this->connect_token_provider_factory
144
+ ->create()
145
+ ->get( $token, 'store' );
146
+ return true;
147
+ } catch ( Exception $exception ) {
148
+ return false;
149
+ }
150
+ }
151
+
152
+ /**
153
+ * Detects platform based on store token.
154
+ *
155
+ * @return string
156
+ */
157
+ private function detect_platform() {
158
+ $token = $this->store_token->get();
159
+
160
+ if ( ! $token ) {
161
+ return $this->get_default_platform();
162
+ }
163
+
164
+ if ( ! $this->is_token_valid( $token ) ) {
165
+ return $this->get_platform_from_slug();
166
+ }
167
+
168
+ return $this->get_backend_platform();
169
+ }
170
+
171
+ /**
172
+ * Returns platform name.
173
+ *
174
+ * @return string
175
+ */
176
+ public function get() {
177
+ $platform = $this->platform->get();
178
+
179
+ if ( $platform ) {
180
+ return $platform;
181
+ }
182
+
183
+ $platform = $this->detect_platform();
184
+
185
+ $this->platform->set( $platform );
186
+ return $platform;
187
+ }
188
+
189
+ /**
190
+ * Returns instance of PlatformProvider.
191
+ *
192
+ * @return static
193
+ * @throws Exception
194
+ */
195
+ public static function create() {
196
+ return new static(
197
+ ApiClientFactory::get_instance(),
198
+ ConnectTokenProviderFactory::get_instance(),
199
+ StoreToken::get_instance(),
200
+ Platform::get_instance()
201
+ );
202
+ }
203
+ }
plugin_files/Services/SettingsProvider.class.php ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class SettingsProvider
4
+ *
5
+ * @package LiveChat\Services
6
+ */
7
+
8
+ namespace LiveChat\Services;
9
+
10
+ use Exception;
11
+ use LiveChat\Services\Options\SettingsOptions;
12
+ use LiveChat\Services\Templates\SettingsTemplate;
13
+ use WP_Error;
14
+
15
+ /**
16
+ * Class SettingsProvider
17
+ *
18
+ * @package LiveChat\Services
19
+ */
20
+ class SettingsProvider {
21
+ /**
22
+ * Singleton instance
23
+ *
24
+ * @var SettingsProvider|null
25
+ */
26
+ private static $instance;
27
+
28
+ /**
29
+ * SettingsOptions instance
30
+ *
31
+ * @var SettingsOptions|null
32
+ */
33
+ public $options;
34
+
35
+ /**
36
+ * SettingsTemplate instance
37
+ *
38
+ * @var SettingsTemplate|null
39
+ */
40
+ public $template;
41
+
42
+ /**
43
+ * TokenValidator instance
44
+ *
45
+ * @var TokenValidator|null
46
+ */
47
+ public $token_validator;
48
+
49
+ /**
50
+ * User instance
51
+ *
52
+ * @var User|null
53
+ */
54
+ public $user;
55
+
56
+ /**
57
+ * Store instance
58
+ *
59
+ * @var Store|null
60
+ */
61
+ public $store;
62
+
63
+ /**
64
+ * SettingsProvider constructor.
65
+ *
66
+ * @param SettingsOptions $options SettingsOptions instance.
67
+ * @param SettingsTemplate $template SettingsTemplate instance.
68
+ * @param TokenValidator $token_validator TokenValidator instance.
69
+ * @param User $user User instance.
70
+ * @param Store $store Store instance.
71
+ */
72
+ public function __construct( $options, $template, $token_validator, $user, $store ) {
73
+ $this->options = $options;
74
+ $this->template = $template;
75
+ $this->token_validator = $token_validator;
76
+ $this->user = $user;
77
+ $this->store = $store;
78
+ }
79
+
80
+ /**
81
+ * Initialize ajax actions
82
+ */
83
+ public function init() {
84
+ add_action( 'wp_ajax_lc_connect', array( $this, 'ajax_connect' ) );
85
+ add_action( 'wp_ajax_lc_disconnect', array( $this, 'ajax_disconnect' ) );
86
+ add_action( 'wp_ajax_lc_store_not_found', array( $this, 'ajax_store_not_found' ) );
87
+ add_action( 'wp_ajax_lc_user_not_found', array( $this, 'ajax_user_not_found' ) );
88
+ add_action( 'wp_ajax_lc_widget_script_updated', array( $this, 'ajax_widget_script_updated' ) );
89
+ add_action( 'wp_ajax_lc_review_notice_cleanup', array( $this, 'ajax_review_notice_cleanup' ) );
90
+ }
91
+
92
+ /**
93
+ * Displays settings page
94
+ */
95
+ public function render() {
96
+ $this->template->render();
97
+ }
98
+
99
+ /**
100
+ * Connects WP plugin with LiveChat account.
101
+ * Validates tokens and, if they are valid, stores them in WP database.
102
+ */
103
+ public function ajax_connect() {
104
+ $user_token = null;
105
+ $store_token = null;
106
+
107
+ check_ajax_referer( 'wp_ajax_lc_connect', 'security' );
108
+ if ( isset( $_POST['user_token'] ) && isset( $_POST['store_token'] ) && isset( $_POST['security'] ) ) {
109
+ $user_token = sanitize_text_field( wp_unslash( $_POST['user_token'] ) );
110
+ $store_token = sanitize_text_field( wp_unslash( $_POST['store_token'] ) );
111
+ }
112
+
113
+ try {
114
+ $this->token_validator->validate_tokens( $user_token, $store_token );
115
+ $this->user->authorize_current_user( $user_token );
116
+ $this->store->authorize_store( $store_token );
117
+
118
+ $this->options->review_notice->remove();
119
+ $this->options->deprecated->remove();
120
+ $this->options->synchronized->yes();
121
+
122
+ wp_send_json_success( array( 'status' => 'ok' ) );
123
+ } catch ( Exception $e ) {
124
+ wp_send_json_error(
125
+ new WP_Error( $e->getCode(), $e->getMessage() )
126
+ );
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Removes LiveChat data from database.
132
+ */
133
+ public function ajax_disconnect() {
134
+ $this->store->remove_store_data();
135
+ $this->user->remove_authorized_users();
136
+ $this->options->remove();
137
+ }
138
+
139
+ /**
140
+ * Removes store token when it was not found in LiveChat service.
141
+ */
142
+ public function ajax_store_not_found() {
143
+ $this->store->remove_store_data();
144
+ $this->user->remove_authorized_users();
145
+ $this->options->remove();
146
+ }
147
+
148
+ /**
149
+ * Removes current user token when it was not found in LiveChat service.
150
+ */
151
+ public function ajax_user_not_found() {
152
+ $this->user->remove_current_user_token();
153
+ }
154
+
155
+ /**
156
+ * Updates widget scrip URL.
157
+ */
158
+ public function ajax_widget_script_updated() {
159
+ $widget_url = null;
160
+
161
+ check_ajax_referer( 'wp_ajax_lc_connect', 'security' );
162
+
163
+ if ( isset( $_POST['widget_url'] ) && isset( $_POST['security'] ) ) {
164
+ $widget_url = sanitize_text_field( wp_unslash( $_POST['widget_url'] ) );
165
+ $this->options->widget_url->set( $widget_url );
166
+ return true;
167
+ }
168
+
169
+ return false;
170
+ }
171
+
172
+ /**
173
+ * Remove review notice options.
174
+ */
175
+ public function ajax_review_notice_cleanup() {
176
+ check_ajax_referer( 'wp_ajax_lc_connect', 'security' );
177
+
178
+ if ( $this->options->synchronized->get() ) {
179
+ return;
180
+ }
181
+
182
+ $this->options->review_notice->remove();
183
+ $this->options->synchronized->yes();
184
+ }
185
+
186
+ /**
187
+ * Gets singleton instance
188
+ */
189
+ public static function get_instance() {
190
+ if ( ! self::$instance ) {
191
+ self::$instance = new static(
192
+ SettingsOptions::get_instance(),
193
+ SettingsTemplate::create(),
194
+ TokenValidator::create( CertProvider::create() ),
195
+ User::get_instance(),
196
+ Store::get_instance()
197
+ );
198
+ }
199
+ return self::$instance;
200
+ }
201
+ }
plugin_files/Services/SetupProvider.class.php ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class ScriptsProvider
4
+ *
5
+ * @package LiveChat\Services
6
+ */
7
+
8
+ namespace LiveChat\Services;
9
+
10
+ /**
11
+ * Class ScriptsProvider
12
+ *
13
+ * @package LiveChat\Services
14
+ */
15
+ class SetupProvider {
16
+ /**
17
+ * Instance of SetupProvider.
18
+ *
19
+ * @var SetupProvider|null
20
+ */
21
+ private static $instance = null;
22
+
23
+ /**
24
+ * Plugin URL.
25
+ *
26
+ * @var string
27
+ */
28
+ private $plugin_url;
29
+
30
+ /**
31
+ * Current plugin version.
32
+ *
33
+ * @var string
34
+ */
35
+ private $plugin_version;
36
+
37
+ /**
38
+ * Plugin slug.
39
+ *
40
+ * @var string
41
+ */
42
+ private $plugin_slug;
43
+
44
+ /**
45
+ * LiveChat Agent App URL.
46
+ *
47
+ * @var string
48
+ */
49
+ private $lc_aa_url;
50
+
51
+ /**
52
+ * ScriptsProvider constructor.
53
+ *
54
+ * @param string $plugin_url Plugin URL.
55
+ * @param string $plugin_version Current plugin version.
56
+ * @param string $plugin_slug Plugin slug.
57
+ * @param string $lc_aa_url LiveChat Agent App URL.
58
+ */
59
+ public function __construct( $plugin_url, $plugin_version, $plugin_slug, $lc_aa_url ) {
60
+ $this->plugin_url = $plugin_url;
61
+ $this->plugin_version = $plugin_version;
62
+ $this->plugin_slug = $plugin_slug;
63
+ $this->lc_aa_url = $lc_aa_url;
64
+ }
65
+
66
+ /**
67
+ * Loads all necessary scripts and CSS.
68
+ */
69
+ public function init() {
70
+ add_action( 'admin_init', array( $this, 'load_translations' ) );
71
+ add_action( 'admin_init', array( $this, 'load_menu_icon_styles' ) );
72
+ add_action( 'admin_init', array( $this, 'load_general_scripts_and_styles' ) );
73
+ add_action( 'admin_init', array( $this, 'inject_nonce_object' ) );
74
+ }
75
+
76
+ /**
77
+ * Make translation ready.
78
+ */
79
+ public function load_translations() {
80
+ load_plugin_textdomain(
81
+ /* Should never be taken from the slug */
82
+ 'wp-live-chat-software-for-wordpress',
83
+ false,
84
+ $this->plugin_slug . '/languages'
85
+ );
86
+ }
87
+
88
+ /**
89
+ * Loads JS scripts and CSS.
90
+ */
91
+ public function load_general_scripts_and_styles() {
92
+ $this->load_design_system_styles();
93
+ wp_enqueue_script( 'livechat', $this->plugin_url . 'js/livechat.js', 'jquery', $this->plugin_version, true );
94
+ wp_enqueue_style( 'livechat', $this->plugin_url . 'css/livechat-general.css', false, $this->plugin_version );
95
+ wp_enqueue_script( 'bridge', $this->plugin_url . 'js/connect.js', 'jquery', $this->plugin_version, false );
96
+
97
+ $config = array(
98
+ 'slug' => $this->plugin_slug,
99
+ 'agentAppUrl' => $this->lc_aa_url,
100
+ );
101
+
102
+ wp_localize_script( 'livechat', 'config', $config );
103
+ }
104
+
105
+ /**
106
+ * Fix CSS for icon in menu.
107
+ */
108
+ public function load_menu_icon_styles() {
109
+ wp_enqueue_style( 'livechat-menu', $this->plugin_url . 'css/livechat-menu.css', false, $this->plugin_version );
110
+ }
111
+
112
+ /**
113
+ * Adds nonce value to AJAX object in JS script.
114
+ */
115
+ public function inject_nonce_object() {
116
+ $nonce = array(
117
+ 'value' => wp_create_nonce( 'wp_ajax_lc_connect' ),
118
+ );
119
+
120
+ wp_localize_script( 'bridge', 'ajax_nonce', $nonce );
121
+ }
122
+
123
+ /**
124
+ * Loads CSS.
125
+ */
126
+ private function load_design_system_styles() {
127
+ // phpcs:disable WordPress.WP.EnqueuedResourceParameters.MissingVersion
128
+ // Files below don't need to be versioned.
129
+ wp_register_style( 'livechat-source-sans-pro-font', 'https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600' );
130
+ wp_register_style( 'livechat-material-icons', 'https://fonts.googleapis.com/icon?family=Material+Icons' );
131
+ wp_register_style( 'livechat-design-system', 'https://cdn.livechat-static.com/design-system/styles.css' );
132
+ wp_enqueue_style( 'livechat-source-sans-pro-font', false, $this->plugin_version );
133
+ wp_enqueue_style( 'livechat-material-icons', false, $this->plugin_version );
134
+ wp_enqueue_style( 'livechat-design-system', false, $this->plugin_version );
135
+ // phpcs:enable WordPress.WP.EnqueuedResourceParameters.MissingVersion
136
+ }
137
+
138
+ /**
139
+ * Returns instance of SetupProvider (singleton pattern).
140
+ *
141
+ * @return SetupProvider|null
142
+ */
143
+ public static function get_instance() {
144
+ if ( ! isset( static::$instance ) ) {
145
+ $module = ModuleConfiguration::get_instance();
146
+ static::$instance = new static(
147
+ $module->get_plugin_url(),
148
+ $module->get_plugin_version(),
149
+ PLUGIN_SLUG,
150
+ LC_AA_URL
151
+ );
152
+ }
153
+
154
+ return static::$instance;
155
+ }
156
+ }
plugin_files/Services/Store.class.php CHANGED
@@ -7,6 +7,8 @@
7
 
8
  namespace LiveChat\Services;
9
 
 
 
10
  /**
11
  * Class Store
12
  *
@@ -20,15 +22,31 @@ class Store {
20
  */
21
  private static $instance = null;
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  /**
24
  * Saves store token in WP database
25
  *
26
- * @param string $store_token JWT store token.
27
  *
28
  * @return bool
29
  */
30
- public function authorize_store( $store_token ) {
31
- return update_option( 'livechat_store_token', $store_token );
32
  }
33
 
34
  /**
@@ -37,7 +55,7 @@ class Store {
37
  * @return bool
38
  */
39
  public function remove_store_data() {
40
- return delete_option( 'livechat_store_token' );
41
  }
42
 
43
  /**
@@ -46,7 +64,7 @@ class Store {
46
  * @return string
47
  */
48
  public function get_store_token() {
49
- $store_token = get_option( 'livechat_store_token' );
50
  if ( ! $store_token ) {
51
  return '';
52
  }
@@ -54,6 +72,15 @@ class Store {
54
  return $store_token;
55
  }
56
 
 
 
 
 
 
 
 
 
 
57
  /**
58
  * Returns new instance of User class
59
  *
@@ -61,7 +88,7 @@ class Store {
61
  */
62
  public static function get_instance() {
63
  if ( ! isset( static::$instance ) ) {
64
- static::$instance = new static();
65
  }
66
 
67
  return static::$instance;
7
 
8
  namespace LiveChat\Services;
9
 
10
+ use LiveChat\Services\Options\StoreToken;
11
+
12
  /**
13
  * Class Store
14
  *
22
  */
23
  private static $instance = null;
24
 
25
+ /**
26
+ * Instance of StoreToken.
27
+ *
28
+ * @var StoreToken
29
+ */
30
+ private $store_token;
31
+
32
+ /**
33
+ * Store constructor.
34
+ *
35
+ * @param StoreToken $store_token StoreToken instance.
36
+ */
37
+ public function __construct( $store_token ) {
38
+ $this->store_token = $store_token;
39
+ }
40
+
41
  /**
42
  * Saves store token in WP database
43
  *
44
+ * @param string $token JWT store token.
45
  *
46
  * @return bool
47
  */
48
+ public function authorize_store( $token ) {
49
+ return $this->store_token->set( $token );
50
  }
51
 
52
  /**
55
  * @return bool
56
  */
57
  public function remove_store_data() {
58
+ return $this->store_token->remove();
59
  }
60
 
61
  /**
64
  * @return string
65
  */
66
  public function get_store_token() {
67
+ $store_token = $this->store_token->get();
68
  if ( ! $store_token ) {
69
  return '';
70
  }
72
  return $store_token;
73
  }
74
 
75
+ /**
76
+ * Checks if plugin is connected with LiveChat account.
77
+ *
78
+ * @return bool
79
+ */
80
+ public function is_connected() {
81
+ return ! empty( $this->get_store_token() );
82
+ }
83
+
84
  /**
85
  * Returns new instance of User class
86
  *
88
  */
89
  public static function get_instance() {
90
  if ( ! isset( static::$instance ) ) {
91
+ static::$instance = new static( StoreToken::get_instance() );
92
  }
93
 
94
  return static::$instance;
plugin_files/Services/TemplateParser.class.php CHANGED
@@ -48,9 +48,8 @@ class TemplateParser {
48
  * @return string
49
  */
50
  private function get_template_file_contents( $template_file_name ) {
51
- // phpcs:disable WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
52
  $content = file_get_contents( $this->templates_dir . '/' . $template_file_name );
53
- // phpcs:enable
54
  return $content ? $content : '';
55
  }
56
 
@@ -83,9 +82,8 @@ class TemplateParser {
83
  );
84
 
85
  if ( $render ) {
86
- // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
87
  echo $parsed_template_file;
88
- // phpcs:enable
89
  }
90
 
91
  return $parsed_template_file;
48
  * @return string
49
  */
50
  private function get_template_file_contents( $template_file_name ) {
51
+ // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
52
  $content = file_get_contents( $this->templates_dir . '/' . $template_file_name );
 
53
  return $content ? $content : '';
54
  }
55
 
82
  );
83
 
84
  if ( $render ) {
85
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
86
  echo $parsed_template_file;
 
87
  }
88
 
89
  return $parsed_template_file;
plugin_files/Services/Templates/ChatWidgetScriptTemplate.class.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class ChatWidgetScriptTemplate
4
+ *
5
+ * @package LiveChat\Services\Templates
6
+ */
7
+
8
+ namespace LiveChat\Services\Templates;
9
+
10
+ use Exception;
11
+ use LiveChat\Exceptions\ApiClientException;
12
+ use LiveChat\Exceptions\InvalidTokenException;
13
+ use LiveChat\Services\CertProvider;
14
+ use LiveChat\Services\ConnectTokenProvider;
15
+ use LiveChat\Services\Factories\UrlProviderFactory;
16
+ use LiveChat\Services\Options\WidgetURL;
17
+ use LiveChat\Services\Store;
18
+ use LiveChat\Services\TemplateParser;
19
+
20
+ /**
21
+ * Class ChatWidgetScriptTemplate
22
+ *
23
+ * @package LiveChat\Services\Templates
24
+ */
25
+ class ChatWidgetScriptTemplate extends Template {
26
+ /**
27
+ * Instance of Store.
28
+ *
29
+ * @var Store
30
+ */
31
+ private $store;
32
+
33
+ /**
34
+ * Instance of WidgetURL.
35
+ *
36
+ * @var WidgetURL
37
+ */
38
+ private $widget_url;
39
+
40
+ /**
41
+ * Instance of ConnectTokenProvider.
42
+ *
43
+ * @var ConnectTokenProvider
44
+ */
45
+ private $connect_token_provider;
46
+
47
+ /**
48
+ * Instance of UrlProviderFactory.
49
+ *
50
+ * @var UrlProviderFactory
51
+ */
52
+ private $url_provider_factory;
53
+
54
+ /**
55
+ * Instance of CustomerTrackingTemplate.
56
+ *
57
+ * @var CustomerTrackingTemplate
58
+ */
59
+ private $customer_tracking_template;
60
+
61
+ /**
62
+ * WidgetProvider constructor.
63
+ *
64
+ * @param Store $store Instance of Store.
65
+ * @param WidgetURL $widget_url Instance of WidgetURL.
66
+ * @param ConnectTokenProvider $connect_token_provider Instance of ConnectTokenProvider.
67
+ * @param UrlProviderFactory $url_provider_factory Instance of UrlProviderFactory.
68
+ * @param CustomerTrackingTemplate $customer_tracking_template Instance of CustomerTrackingTemplate.
69
+ * @param TemplateParser $template_parser Instance of TemplateParser.
70
+ */
71
+ public function __construct(
72
+ $store,
73
+ $widget_url,
74
+ $connect_token_provider,
75
+ $url_provider_factory,
76
+ $customer_tracking_template,
77
+ $template_parser
78
+ ) {
79
+ parent::__construct( $template_parser );
80
+ $this->store = $store;
81
+ $this->widget_url = $widget_url;
82
+ $this->connect_token_provider = $connect_token_provider;
83
+ $this->customer_tracking_template = $customer_tracking_template;
84
+ $this->url_provider_factory = $url_provider_factory;
85
+ }
86
+
87
+ /**
88
+ * Checks if widget URL matches RegEx. Returns true if URL is valid,
89
+ * otherwise returns false.
90
+ *
91
+ * @param string $widget_url Widget URL to check.
92
+ *
93
+ * @return false|int
94
+ */
95
+ private function is_widget_url_valid( $widget_url ) {
96
+ return preg_match( LC_WIDGET_URL_REGEX, $widget_url );
97
+ }
98
+
99
+ /**
100
+ * Gets URL from token
101
+ *
102
+ * @return string
103
+ * @throws ApiClientException Can be thrown from ConnectTokenProvider and UrlProvider.
104
+ * @throws InvalidTokenException Can be thrown from ConnectTokenProvider and UrlProvider.
105
+ */
106
+ private function get_url_from_token() {
107
+ $connect_token = $this->connect_token_provider->get(
108
+ $this->store->get_store_token(),
109
+ 'store',
110
+ true
111
+ );
112
+
113
+ $api_url = $this->url_provider_factory->create( $connect_token )->get_api_url();
114
+
115
+ return sprintf(
116
+ '%s/api/v1/script/%s/widget.js',
117
+ $api_url,
118
+ $connect_token->get_store_uuid()
119
+ );
120
+ }
121
+
122
+ /**
123
+ * Injects chat widget script.
124
+ *
125
+ * @return string
126
+ * @throws ApiClientException Can be thrown from ConnectTokenProvider and UrlProvider.
127
+ * @throws InvalidTokenException Can be thrown from ConnectTokenProvider and UrlProvider.
128
+ */
129
+ public function render() {
130
+ $widget_url = $this->widget_url->get();
131
+
132
+ if ( ! $widget_url || ! $this->is_widget_url_valid( $widget_url ) ) {
133
+ $widget_url = $this->get_url_from_token();
134
+ $this->widget_url->set( $widget_url );
135
+ }
136
+
137
+ $context = array(
138
+ 'customerTrackingScript' => is_woo() ? $this->customer_tracking_template->render() : '',
139
+ 'widgetUrl' => $widget_url,
140
+ );
141
+
142
+ return $this->template_parser->parse_template( 'chat_widget_script.html.twig', $context );
143
+ }
144
+
145
+ /**
146
+ * Returns instance of ChatWidgetScriptTemplate.
147
+ *
148
+ * @return ChatWidgetScriptTemplate|static
149
+ * @throws Exception
150
+ */
151
+ public static function create() {
152
+ return new static(
153
+ Store::get_instance(),
154
+ WidgetURL::get_instance(),
155
+ ConnectTokenProvider::create( CertProvider::create() ),
156
+ UrlProviderFactory::get_instance(),
157
+ CustomerTrackingTemplate::create(),
158
+ TemplateParser::create( '../templates' )
159
+ );
160
+ }
161
+ }
plugin_files/{Helpers/ConfirmIdentityNoticeHelper.class.php → Services/Templates/ConfirmIdentityNoticeTemplate.class.php} RENAMED
@@ -1,25 +1,22 @@
1
  <?php
2
  /**
3
- * Class ConfirmIdentityNoticeHelper
4
  *
5
- * @package LiveChat\Helpers
6
  */
7
 
8
- namespace LiveChat\Helpers;
9
-
10
- use LiveChat\Services\TemplateParser;
11
 
12
  /**
13
- * Class ConfirmIdentityNoticeHelper
14
  */
15
- class ConfirmIdentityNoticeHelper extends LiveChatHelper {
16
-
17
  /**
18
  * Renders helper.
19
  */
20
  public function render() {
21
  $context = array();
22
- $context['lcNoticeLogoUrl'] = esc_html( plugins_url( 'wp-live-chat-software-for-wordpress' ) . '/plugin_files/images/livechat-logo.svg' );
23
  $context['header'] = esc_html__( 'Action required - confirm your identity', 'wp-live-chat-software-for-wordpress' );
24
  $context['notice'] = esc_html__(
25
  'Thank you for updating LiveChat to the latest version. Please click Connect to confirm your identity and finish the installation.',
@@ -27,6 +24,6 @@ class ConfirmIdentityNoticeHelper extends LiveChatHelper {
27
  );
28
  $context['button'] = esc_html__( 'Connect', 'wp-live-chat-software-for-wordpress' );
29
 
30
- TemplateParser::create( '../templates' )->parse_template( 'confirm_identity_notice.html.twig', $context );
31
  }
32
  }
1
  <?php
2
  /**
3
+ * Class ConfirmIdentityNoticeTemplate
4
  *
5
+ * @package LiveChat\Services\Templates
6
  */
7
 
8
+ namespace LiveChat\Services\Templates;
 
 
9
 
10
  /**
11
+ * Class ConfirmIdentityNoticeTemplate
12
  */
13
+ class ConfirmIdentityNoticeTemplate extends Template {
 
14
  /**
15
  * Renders helper.
16
  */
17
  public function render() {
18
  $context = array();
19
+ $context['lcNoticeLogoUrl'] = esc_html( plugins_url( PLUGIN_SLUG ) . '/plugin_files/images/livechat-logo.svg' );
20
  $context['header'] = esc_html__( 'Action required - confirm your identity', 'wp-live-chat-software-for-wordpress' );
21
  $context['notice'] = esc_html__(
22
  'Thank you for updating LiveChat to the latest version. Please click Connect to confirm your identity and finish the installation.',
24
  );
25
  $context['button'] = esc_html__( 'Connect', 'wp-live-chat-software-for-wordpress' );
26
 
27
+ $this->template_parser->parse_template( 'confirm_identity_notice.html.twig', $context );
28
  }
29
  }
plugin_files/Services/Templates/ConnectNoticeTemplate.class.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class ConnectNoticeTemplate
4
+ *
5
+ * @package LiveChat\Services\Templates
6
+ */
7
+
8
+ namespace LiveChat\Services\Templates;
9
+
10
+ /**
11
+ * Class ConnectNoticeTemplate
12
+ */
13
+ class ConnectNoticeTemplate extends Template {
14
+ /**
15
+ * Renders ConnectNotice in WP dashboard.
16
+ *
17
+ * @return string
18
+ */
19
+ public function render() {
20
+ $context = array();
21
+ $context['lcNoticeLogoUrl'] = esc_html(
22
+ sprintf(
23
+ '%s/plugin_files/images/livechat-logo.svg',
24
+ plugins_url( PLUGIN_SLUG )
25
+ )
26
+ );
27
+ $context['noticeHeader'] = esc_html__( 'Action required - connect LiveChat', 'wp-live-chat-software-for-wordpress' );
28
+ $context['paragraph1'] = esc_html__( 'Please', 'wp-live-chat-software-for-wordpress' );
29
+ $context['paragraph2'] = esc_html__( 'connect your LiveChat account', 'wp-live-chat-software-for-wordpress' );
30
+ $context['paragraph3'] = esc_html__( 'to start chatting with your customers.', 'wp-live-chat-software-for-wordpress' );
31
+ $context['button'] = esc_html__( 'Connect', 'wp-live-chat-software-for-wordpress' );
32
+
33
+ return $this->template_parser->parse_template( 'connect_notice.html.twig', $context );
34
+ }
35
+ }
plugin_files/Services/Templates/CustomerTrackingTemplate.class.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class CustomerTrackingTemplate
4
+ *
5
+ * @package LiveChat\Services\Templates
6
+ */
7
+
8
+ namespace LiveChat\Services\Templates;
9
+
10
+ use LiveChat\Services\TemplateParser;
11
+ use LiveChat\Services\User;
12
+
13
+ /**
14
+ * Class CustomerTrackingTemplate
15
+ *
16
+ * @package LiveChat\Services\Templates
17
+ */
18
+ class CustomerTrackingTemplate extends Template {
19
+ /**
20
+ * User instance.
21
+ *
22
+ * @var User
23
+ */
24
+ private $user;
25
+
26
+ /**
27
+ * CustomerTrackingTemplate constructor.
28
+ *
29
+ * @param User $user User instance.
30
+ * @param TemplateParser $template_parser TemplateParser instance.
31
+ */
32
+ public function __construct( $user, $template_parser ) {
33
+ parent::__construct( $template_parser );
34
+ $this->user = $user;
35
+ }
36
+
37
+ /**
38
+ * Renders customer tracking script.
39
+ *
40
+ * @return null|string
41
+ */
42
+ public function render() {
43
+ $context = array(
44
+ 'lcConnectJSON' => wp_json_encode(
45
+ array(
46
+ 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
47
+ 'customer' => $this->user->get_user_data(),
48
+ )
49
+ ),
50
+ );
51
+
52
+ return $this->template_parser->parse_template( 'customer_tracking.html.twig', $context, false );
53
+ }
54
+
55
+ /**
56
+ * Returns new instance of CustomerTrackingTemplate.
57
+ *
58
+ * @return static
59
+ */
60
+ public static function create() {
61
+ return new static(
62
+ User::get_instance(),
63
+ TemplateParser::create( '../templates' )
64
+ );
65
+ }
66
+ }
plugin_files/Services/Templates/DeactivationModalTemplate.class.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class DeactivationModalTemplate
4
+ *
5
+ * @package LiveChat\Services\Templates
6
+ */
7
+
8
+ namespace LiveChat\Services\Templates;
9
+
10
+ use LiveChat\Services\LicenseProvider;
11
+ use LiveChat\Services\User;
12
+
13
+ /**
14
+ * Class DeactivationModalTemplate
15
+ */
16
+ class DeactivationModalTemplate extends Template {
17
+ /**
18
+ * Renders modal with deactivation feedback form.
19
+ */
20
+ public function render() {
21
+ $user = User::get_instance()->get_user_data();
22
+ $license_number = LicenseProvider::create()->get_license_number();
23
+
24
+ $context = array();
25
+ $context['cancelButton'] = esc_html__( 'Cancel', 'wp-live-chat-software-for-wordpress' );
26
+ $context['lcNoticeLogo'] = esc_html(
27
+ sprintf(
28
+ '%s/plugin_files/images/livechat-icon.svg',
29
+ plugins_url( PLUGIN_SLUG )
30
+ )
31
+ );
32
+ $context['header'] = esc_html__( 'Quick Feedback', 'wp-live-chat-software-for-wordpress' );
33
+ $context['description'] = esc_html__( 'If you have a moment, please let us know why you are deactivating LiveChat:', 'wp-live-chat-software-for-wordpress' );
34
+ $context['reasonNoLongerNeed'] = esc_html__( 'I no longer need the plugin.', 'wp-live-chat-software-for-wordpress' );
35
+ $context['reasonDoesNotWork'] = esc_html__( "I couldn't get the plugin to work.", 'wp-live-chat-software-for-wordpress' );
36
+ $context['reasonBetterPlugin'] = esc_html__( 'I found a better plugin.', 'wp-live-chat-software-for-wordpress' );
37
+ $context['reasonTemporaryDeactivation'] = esc_html__( "It's a temporary deactivation.", 'wp-live-chat-software-for-wordpress' );
38
+ $context['reasonOther'] = esc_html__( 'Other', 'wp-live-chat-software-for-wordpress' );
39
+ $context['textPlaceholder'] = esc_html__( 'Tell us more...', 'wp-live-chat-software-for-wordpress' );
40
+ $context['options'] = esc_html__( 'Please choose one of available options.', 'wp-live-chat-software-for-wordpress' );
41
+ $context['feedback'] = esc_html__( 'Please provide additional feedback.', 'wp-live-chat-software-for-wordpress' );
42
+ $context['licenseNumber'] = $license_number;
43
+ $context['name'] = $user['name'];
44
+ $context['email'] = $user['email'];
45
+ $context['skipButton'] = esc_html__( 'Skip & continue', 'wp-live-chat-software-for-wordpress' );
46
+ $context['sendButton'] = esc_html__( 'Send feedback', 'wp-live-chat-software-for-wordpress' );
47
+
48
+ $this->template_parser->parse_template( 'deactivation_modal.html.twig', $context );
49
+ }
50
+ }
plugin_files/Services/Templates/NoticeTemplate.class.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class NoticeTemplate
4
+ *
5
+ * @package LiveChat\Services\Templates
6
+ */
7
+
8
+ namespace LiveChat\Services\Templates;
9
+
10
+ use LiveChat\Services\ModuleConfiguration;
11
+ use LiveChat\Services\Options\ReviewNoticeOptions;
12
+ use LiveChat\Services\Store;
13
+ use LiveChat\Services\TemplateParser;
14
+ use LiveChat\Services\UrlProvider;
15
+ use LiveChat\Services\User;
16
+
17
+ /**
18
+ * Class NoticeTemplate
19
+ */
20
+ class NoticeTemplate extends Template {
21
+ /**
22
+ * ModuleConfiguration instance
23
+ *
24
+ * @var ModuleConfiguration|null
25
+ */
26
+ private $module = null;
27
+
28
+ /**
29
+ * Current user instance
30
+ *
31
+ * @var User|null
32
+ */
33
+ private $user = null;
34
+
35
+ /**
36
+ * Current store instance.
37
+ *
38
+ * @var Store|null
39
+ */
40
+ private $store = null;
41
+
42
+ /**
43
+ * UrlProvider instance.
44
+ *
45
+ * @var UrlProvider
46
+ */
47
+ private $url_provider;
48
+
49
+ /**
50
+ * Current platform name.
51
+ *
52
+ * @var string
53
+ */
54
+ private $platform;
55
+
56
+ /**
57
+ * ReviewNoticeOptions instance.
58
+ *
59
+ * @var ReviewNoticeOptions
60
+ */
61
+ private $review_notice;
62
+
63
+ /**
64
+ * NoticeTemplate constructor.
65
+ *
66
+ * @param ModuleConfiguration $module ModuleConfiguration class instance.
67
+ * @param User $user User class instance.
68
+ * @param Store $store Store class instance.
69
+ * @param TemplateParser $template_parser Instance of TemplateParser.
70
+ * @param UrlProvider $url_provider Instance of UrlProvider.
71
+ * @param ReviewNoticeOptions $review_notice ReviewNoticeOptions instance.
72
+ * @param string $platform Current platform name.
73
+ */
74
+ public function __construct(
75
+ $module,
76
+ $user,
77
+ $store,
78
+ $template_parser,
79
+ $url_provider,
80
+ $review_notice,
81
+ $platform
82
+ ) {
83
+ parent::__construct( $template_parser );
84
+ $this->module = $module;
85
+ $this->user = $user;
86
+ $this->store = $store;
87
+ $this->url_provider = $url_provider;
88
+ $this->review_notice = $review_notice;
89
+ $this->platform = $platform;
90
+ }
91
+
92
+ /**
93
+ * Renders notice iframe with Connect service.
94
+ */
95
+ public function render() {
96
+ $context = array();
97
+ $context['noticeUrl'] = esc_html( $this->url_provider->get_app_url( '/notice' ) );
98
+ $context['wpVer'] = esc_html( $this->module->get_wp_version() );
99
+ $context['moduleVer'] = esc_html( $this->module->get_plugin_version() );
100
+ $context['lcToken'] = esc_html( $this->user->get_current_user_token() );
101
+ $context['storeToken'] = esc_html( $this->store->get_store_token() );
102
+ $context['options'] = wp_json_encode( $this->review_notice->get() );
103
+ $context['platform'] = esc_js( $this->platform );
104
+
105
+ $this->template_parser->parse_template( 'notice.html.twig', $context );
106
+ }
107
+
108
+ /**
109
+ * Returns new instance of NoticeTemplate.
110
+ *
111
+ * @return static
112
+ */
113
+ public static function create() {
114
+ return new static(
115
+ ModuleConfiguration::get_instance(),
116
+ User::get_instance(),
117
+ Store::get_instance(),
118
+ TemplateParser::create( '../templates' ),
119
+ UrlProvider::create_from_token(),
120
+ ReviewNoticeOptions::get_instance(),
121
+ PLATFORM
122
+ );
123
+ }
124
+ }
plugin_files/Services/Templates/ResourcesTabTemplate.class.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class ResourcesTabTemplate
4
+ *
5
+ * @package LiveChat\Services\Templates
6
+ */
7
+
8
+ namespace LiveChat\Services\Templates;
9
+
10
+ /**
11
+ * Class ResourcesTabTemplate
12
+ */
13
+ class ResourcesTabTemplate extends Template {
14
+ /**
15
+ * Renders iframe with Resources page.
16
+ */
17
+ public function render() {
18
+ $context = array();
19
+ $context['resourcesUrl'] = esc_html( LC_RESOURCES_URL );
20
+ $this->template_parser->parse_template( 'resources.html.twig', $context );
21
+ }
22
+ }
plugin_files/Services/Templates/SettingsTemplate.class.php ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class ConnectServiceTemplate
4
+ *
5
+ * @package LiveChat\Services\Templates
6
+ */
7
+
8
+ namespace LiveChat\Services\Templates;
9
+
10
+ use LiveChat\Services\LicenseProvider;
11
+ use LiveChat\Services\ModuleConfiguration;
12
+ use LiveChat\Services\Options\Deprecated\DeprecatedReviewNoticeOptions;
13
+ use LiveChat\Services\Options\Deprecated\Widget\DeprecatedWidgetSettings;
14
+ use LiveChat\Services\Options\ReviewNoticeOptions;
15
+ use LiveChat\Services\Store;
16
+ use LiveChat\Services\TemplateParser;
17
+ use LiveChat\Services\UrlProvider;
18
+ use LiveChat\Services\User;
19
+
20
+ /**
21
+ * Class ConnectServiceTemplate
22
+ */
23
+ class SettingsTemplate extends Template {
24
+ /**
25
+ * ModuleConfiguration instance
26
+ *
27
+ * @var ModuleConfiguration|null
28
+ */
29
+ private $module = null;
30
+
31
+ /**
32
+ * Current user instance
33
+ *
34
+ * @var User|null
35
+ */
36
+ private $user = null;
37
+
38
+ /**
39
+ * Current store instance.
40
+ *
41
+ * @var Store|null
42
+ */
43
+ private $store = null;
44
+
45
+ /**
46
+ * Instance of LicenseProvider.
47
+ *
48
+ * @var LicenseProvider
49
+ */
50
+ private $license_provider;
51
+
52
+ /**
53
+ * Instance of DeprecatedWidgetSettings.
54
+ *
55
+ * @var DeprecatedWidgetSettings
56
+ */
57
+ private $deprecated_widget_settings;
58
+
59
+ /**
60
+ * Instance of DeprecatedReviewNoticeOptions.
61
+ *
62
+ * @var DeprecatedReviewNoticeOptions
63
+ */
64
+ private $deprecated_review_notice;
65
+
66
+ /**
67
+ * Instance of ReviewNoticeOptions.
68
+ *
69
+ * @var ReviewNoticeOptions
70
+ */
71
+ private $review_notice;
72
+
73
+ /**
74
+ * UrlProvider instance.
75
+ *
76
+ * @var UrlProvider
77
+ */
78
+ private $url_provider;
79
+
80
+ /**
81
+ * ConnectServiceTemplate constructor.
82
+ *
83
+ * @param ModuleConfiguration $module ModuleConfiguration class instance.
84
+ * @param User $user User class instance.
85
+ * @param Store $store Store class instance.
86
+ * @param TemplateParser $template_parser Instance of TemplateParser.
87
+ * @param LicenseProvider $license_provider Instance of LicenseProvider.
88
+ * @param DeprecatedWidgetSettings $deprecated_widget_settings Instance of DeprecatedWidgetSettings.
89
+ * @param DeprecatedReviewNoticeOptions $deprecated_review_notice Instance of DeprecatedReviewNoticeOptions.
90
+ * @param ReviewNoticeOptions $review_notice Instance of ReviewNoticeOptions.
91
+ * @param UrlProvider $url_provider Instance of UrlProvider.
92
+ */
93
+ public function __construct(
94
+ $module,
95
+ $user,
96
+ $store,
97
+ $template_parser,
98
+ $license_provider,
99
+ $deprecated_widget_settings,
100
+ $deprecated_review_notice,
101
+ $review_notice,
102
+ $url_provider
103
+ ) {
104
+ parent::__construct( $template_parser );
105
+ $this->module = $module;
106
+ $this->user = $user;
107
+ $this->store = $store;
108
+ $this->license_provider = $license_provider;
109
+ $this->deprecated_widget_settings = $deprecated_widget_settings;
110
+ $this->deprecated_review_notice = $deprecated_review_notice;
111
+ $this->review_notice = $review_notice;
112
+ $this->url_provider = $url_provider;
113
+ }
114
+
115
+ /**
116
+ * Returns legacy options array.
117
+ *
118
+ * @returns array
119
+ */
120
+ private function get_legacy_options() {
121
+ return array_merge(
122
+ $this->deprecated_review_notice->get(),
123
+ $this->review_notice->get(),
124
+ $this->deprecated_widget_settings->get()
125
+ );
126
+ }
127
+
128
+ /**
129
+ * Renders iframe with Connect service.
130
+ */
131
+ public function render() {
132
+ $context = array();
133
+ $context['appUrl'] = esc_html( $this->url_provider->get_app_url() );
134
+ $context['siteUrl'] = esc_html( $this->module->get_site_url() );
135
+ $context['userEmail'] = esc_html( $this->user->get_user_data()['email'] );
136
+ $context['userName'] = esc_html( $this->user->get_user_data()['name'] );
137
+ $context['wpVer'] = esc_html( $this->module->get_wp_version() );
138
+ $context['extensionVer'] = esc_html( $this->module->get_extension_version() );
139
+ $context['moduleVer'] = esc_html( $this->module->get_plugin_version() );
140
+ $context['lcToken'] = esc_html( $this->user->get_current_user_token() );
141
+ $context['storeToken'] = esc_html( $this->store->get_store_token() );
142
+ $context['partnerId'] = esc_html( LC_PARTNER_ID );
143
+ $context['utmCampaign'] = esc_html( LC_UTM_CAMPAIGN );
144
+ $context['license'] = esc_html( $this->license_provider->get_license_number() );
145
+ $context['legacyOptions'] = wp_json_encode( $this->get_legacy_options() );
146
+ $context['platform'] = esc_js( get_platform() );
147
+
148
+ $this->template_parser->parse_template( 'connect.html.twig', $context );
149
+ }
150
+
151
+ /**
152
+ * Returns new instance of ConnectServiceTemplate.
153
+ *
154
+ * @return static
155
+ */
156
+ public static function create() {
157
+ return new static(
158
+ ModuleConfiguration::get_instance(),
159
+ User::get_instance(),
160
+ Store::get_instance(),
161
+ TemplateParser::create( '../templates' ),
162
+ LicenseProvider::create(),
163
+ DeprecatedWidgetSettings::get_instance(),
164
+ DeprecatedReviewNoticeOptions::get_instance(),
165
+ ReviewNoticeOptions::get_instance(),
166
+ UrlProvider::create_from_token()
167
+ );
168
+ }
169
+ }
plugin_files/Services/Templates/Template.class.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class Template
4
+ *
5
+ * @package LiveChat\Services\Templates
6
+ */
7
+
8
+ namespace LiveChat\Services\Templates;
9
+
10
+ use LiveChat\Services\TemplateParser;
11
+
12
+ /**
13
+ * Class Template
14
+ *
15
+ * @package LiveChat\Services\Templates
16
+ */
17
+ abstract class Template {
18
+ /**
19
+ * Instance of TemplateParser.
20
+ *
21
+ * @var TemplateParser
22
+ */
23
+ protected $template_parser;
24
+
25
+ /**
26
+ * Template constructor.
27
+ *
28
+ * @param TemplateParser $template_parser Instance of TemplateParser.
29
+ */
30
+ public function __construct( $template_parser ) {
31
+ $this->template_parser = $template_parser;
32
+ }
33
+
34
+ /**
35
+ * Renders template.
36
+ *
37
+ * @return mixed
38
+ */
39
+ abstract public function render();
40
+
41
+ /**
42
+ * Returns new instance of Template.
43
+ *
44
+ * @return static
45
+ */
46
+ public static function create() {
47
+ return new static( TemplateParser::create( '../templates' ) );
48
+ }
49
+ }
plugin_files/Services/Templates/TrackingCodeTemplate.class.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class TrackingCodeTemplate
4
+ *
5
+ * @package LiveChat\Services\Templates
6
+ */
7
+
8
+ namespace LiveChat\Services\Templates;
9
+
10
+ use LiveChat\Services\LicenseProvider;
11
+ use LiveChat\Services\Options\Deprecated\Widget\DeprecatedWidgetSettings;
12
+ use LiveChat\Services\Store;
13
+ use LiveChat\Services\TemplateParser;
14
+ use LiveChat\Services\User;
15
+
16
+ /**
17
+ * Class TrackingCodeTemplate
18
+ *
19
+ * @package LiveChat\Services\Templates
20
+ */
21
+ class TrackingCodeTemplate extends Template {
22
+ /**
23
+ * Instance of Store.
24
+ *
25
+ * @var Store
26
+ */
27
+ private $store;
28
+
29
+ /**
30
+ * Instance of User.
31
+ *
32
+ * @var User
33
+ */
34
+ private $user;
35
+
36
+ /**
37
+ * Instance of LicenseProvider.
38
+ *
39
+ * @var LicenseProvider
40
+ */
41
+ private $license_provider;
42
+
43
+ /**
44
+ * Instance of DeprecatedWidgetSettings.
45
+ *
46
+ * @var DeprecatedWidgetSettings
47
+ */
48
+ private $widget_settings;
49
+
50
+ /**
51
+ * TrackingCodeTemplate constructor.
52
+ *
53
+ * @param Store $store Instance of Store.
54
+ * @param User $user Instance of User.
55
+ * @param LicenseProvider $license_provider Instance of LicenseProvider.
56
+ * @param TemplateParser $template_parser Instance of TemplateParser.
57
+ * @param DeprecatedWidgetSettings $widget_settings Instance of DeprecatedWidgetSettings.
58
+ */
59
+ public function __construct( $store, $user, $license_provider, $template_parser, $widget_settings ) {
60
+ parent::__construct( $template_parser );
61
+ $this->store = $store;
62
+ $this->user = $user;
63
+ $this->license_provider = $license_provider;
64
+ $this->widget_settings = $widget_settings;
65
+ }
66
+
67
+ /**
68
+ * Checks if visitor is on mobile device.
69
+ *
70
+ * @return bool
71
+ */
72
+ private function check_mobile() {
73
+ $user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) : '';
74
+ $regex = '/((Chrome).*(Mobile))|((Android).*)|((iPhone|iPod).*Apple.*Mobile)|((Android).*(Mobile))/i';
75
+ return preg_match( $regex, $user_agent );
76
+ }
77
+
78
+ /**
79
+ * Injects scripts with tracking code.
80
+ *
81
+ * @return string
82
+ */
83
+ public function render() {
84
+ if ( ! $this->license_provider->has_deprecated_license_number() || $this->store->is_connected() ) {
85
+ return '';
86
+ }
87
+
88
+ $settings = $this->widget_settings->get();
89
+ $hide_on_mobile = $settings['hideOnMobile'];
90
+ $hide_for_guests = $settings['hideForGuests'];
91
+ $is_mobile = $this->check_mobile();
92
+ $is_logged = $this->user->check_logged();
93
+
94
+ if ( ( $hide_on_mobile && $is_mobile ) || ( $hide_for_guests && ! $is_logged ) ) {
95
+ return '';
96
+ }
97
+
98
+ $context = array();
99
+ $context['licenseNumber'] = $this->license_provider->get_license_number();
100
+
101
+ $visitor = $this->user->get_user_data();
102
+ $context['visitorName'] = $visitor['name'];
103
+ $context['visitorEmail'] = $visitor['email'];
104
+
105
+ return $this->template_parser->parse_template( 'tracking_code.html.twig', $context );
106
+ }
107
+
108
+ /**
109
+ * Returns new instance of TrackingCodeTemplate.
110
+ *
111
+ * @return static
112
+ */
113
+ public static function create() {
114
+ return new static(
115
+ Store::get_instance(),
116
+ User::get_instance(),
117
+ LicenseProvider::create(),
118
+ TemplateParser::create( '../templates' ),
119
+ DeprecatedWidgetSettings::get_instance()
120
+ );
121
+ }
122
+ }
plugin_files/Services/TokenValidator.class.php CHANGED
@@ -38,16 +38,23 @@ class TokenValidator {
38
  * Checks if given token is valid JWT token.
39
  *
40
  * @param string $token JWT token to validate.
 
41
  *
42
  * @return ConnectToken|null
43
  */
44
- private function validate_jwt_token( $token ) {
45
  try {
46
  return ConnectToken::load(
47
  $token,
48
  $this->cert_provider->get_stored_cert()
49
  );
50
  } catch ( Exception $exception ) {
 
 
 
 
 
 
51
  return null;
52
  }
53
  }
@@ -56,11 +63,12 @@ class TokenValidator {
56
  * Validates signed store token
57
  *
58
  * @param string $store_token JWT store token.
 
59
  *
60
  * @throws InvalidTokenException Can be thrown if store_token is incorrect.
61
  */
62
- public function validate_store_token( $store_token ) {
63
- $decoded_store_token = $this->validate_jwt_token( $store_token );
64
 
65
  if ( is_null( $decoded_store_token ) || ! $decoded_store_token->get_store_uuid() ) {
66
  throw InvalidTokenException::store();
38
  * Checks if given token is valid JWT token.
39
  *
40
  * @param string $token JWT token to validate.
41
+ * @param bool $allow_expired True if should allow expired tokens.
42
  *
43
  * @return ConnectToken|null
44
  */
45
+ private function validate_jwt_token( $token, $allow_expired = false ) {
46
  try {
47
  return ConnectToken::load(
48
  $token,
49
  $this->cert_provider->get_stored_cert()
50
  );
51
  } catch ( Exception $exception ) {
52
+ if ( $allow_expired && 'Expired token' === $exception->getMessage() ) {
53
+ return ConnectToken::decode(
54
+ $token
55
+ );
56
+ }
57
+
58
  return null;
59
  }
60
  }
63
  * Validates signed store token
64
  *
65
  * @param string $store_token JWT store token.
66
+ * @param bool $allow_expired True if should allow expired tokens.
67
  *
68
  * @throws InvalidTokenException Can be thrown if store_token is incorrect.
69
  */
70
+ public function validate_store_token( $store_token, $allow_expired = false ) {
71
+ $decoded_store_token = $this->validate_jwt_token( $store_token, $allow_expired );
72
 
73
  if ( is_null( $decoded_store_token ) || ! $decoded_store_token->get_store_uuid() ) {
74
  throw InvalidTokenException::store();
plugin_files/Services/UrlProvider.class.php CHANGED
@@ -7,6 +7,8 @@
7
 
8
  namespace LiveChat\Services;
9
 
 
 
10
  /**
11
  * Class UrlProvider
12
  */
@@ -23,33 +25,44 @@ class UrlProvider {
23
  *
24
  * @var string
25
  */
26
- private $api_url_format = LC_API_URL_PATTERN;
27
 
28
  /**
29
  * Format for frontend url.
30
  *
31
  * @var string
32
  */
33
- private $app_url_format = LC_APP_URL_PATTERN;
34
 
35
  /**
36
  * UrlProvider constructor.
37
  *
38
- * @param ConnectToken|null $connect_token Instance of ConnectTokenProvider.
 
 
39
  */
40
- public function __construct( $connect_token = null ) {
41
- $this->connect_token = $connect_token;
 
 
 
 
 
 
42
  }
43
 
44
  /**
45
  * Returns frontend url based on ConnectToken (if exists) or returns default url.
46
  *
 
47
  * @return string
48
  */
49
- public function get_app_url() {
50
  return sprintf(
51
  $this->app_url_format,
52
- is_null( $this->connect_token ) ? 'us' : $this->connect_token->get_api_region()
 
 
53
  );
54
  }
55
 
@@ -70,27 +83,38 @@ class UrlProvider {
70
  }
71
 
72
  /**
73
- * Return widget url based on ConnectToken
74
  *
75
- * @return string
76
  */
77
- public function get_widget_url() {
78
- $api_url = $this->get_api_url();
79
-
80
- return sprintf(
81
- $api_url . '/api/v1/script/%s/widget.js',
82
- $this->connect_token->get_store_uuid()
83
- );
 
84
  }
85
 
86
  /**
87
  * Returns new instance of UrlProvider class.
88
  *
89
- * @param ConnectToken|null $connect_token Instance of ConnectToken.
 
 
90
  *
91
  * @return $this
92
  */
93
- public static function create( $connect_token = null ) {
94
- return new static( $connect_token );
 
 
 
 
 
 
 
 
95
  }
96
  }
7
 
8
  namespace LiveChat\Services;
9
 
10
+ use Exception;
11
+
12
  /**
13
  * Class UrlProvider
14
  */
25
  *
26
  * @var string
27
  */
28
+ private $api_url_format;
29
 
30
  /**
31
  * Format for frontend url.
32
  *
33
  * @var string
34
  */
35
+ private $app_url_format;
36
 
37
  /**
38
  * UrlProvider constructor.
39
  *
40
+ * @param ConnectToken|null $connect_token Instance of ConnectTokenProvider.
41
+ * @param string $api_url_format Format for API url.
42
+ * @param string $app_url_format Format for frontend url.
43
  */
44
+ public function __construct(
45
+ $connect_token,
46
+ $api_url_format,
47
+ $app_url_format
48
+ ) {
49
+ $this->connect_token = $connect_token;
50
+ $this->api_url_format = $api_url_format;
51
+ $this->app_url_format = $app_url_format;
52
  }
53
 
54
  /**
55
  * Returns frontend url based on ConnectToken (if exists) or returns default url.
56
  *
57
+ * @param string $path Frontend url optional path.
58
  * @return string
59
  */
60
+ public function get_app_url( $path = '' ) {
61
  return sprintf(
62
  $this->app_url_format,
63
+ is_null( $this->connect_token ) ? 'us' : $this->connect_token->get_api_region(),
64
+ get_platform(),
65
+ $path
66
  );
67
  }
68
 
83
  }
84
 
85
  /**
86
+ * Returns UrlProvider instance based on token.
87
  *
88
+ * @return UrlProvider
89
  */
90
+ public static function create_from_token() {
91
+ try {
92
+ $store_token = Store::get_instance()->get_store_token();
93
+ $decoded_token = ConnectTokenProvider::create( CertProvider::create() )->get( $store_token, 'store' );
94
+ return self::create( $decoded_token );
95
+ } catch ( Exception $exception ) {
96
+ return self::create();
97
+ }
98
  }
99
 
100
  /**
101
  * Returns new instance of UrlProvider class.
102
  *
103
+ * @param ConnectToken|null $connect_token Instance of ConnectTokenProvider.
104
+ * @param string $api_url_format Format for API url.
105
+ * @param string $app_url_format Format for frontend url.
106
  *
107
  * @return $this
108
  */
109
+ public static function create(
110
+ $connect_token = null,
111
+ $api_url_format = LC_API_URL_PATTERN,
112
+ $app_url_format = LC_APP_URL_PATTERN
113
+ ) {
114
+ return new static(
115
+ $connect_token,
116
+ $api_url_format,
117
+ $app_url_format
118
+ );
119
  }
120
  }
plugin_files/Services/User.class.php CHANGED
@@ -7,28 +7,43 @@
7
 
8
  namespace LiveChat\Services;
9
 
 
 
 
10
  /**
11
  * Class User
 
 
12
  */
13
  class User {
14
  /**
15
  * Instance of User class (singleton pattern)
16
  *
17
- * @var null
18
  */
19
  private static $instance = null;
20
 
 
 
 
 
 
 
 
21
  /**
22
  * Currently logged in user data
23
  *
24
- * @var null
25
  */
26
- private $current_user = null;
27
 
28
  /**
29
  * User constructor.
 
 
30
  */
31
- public function __construct() {
 
32
  $this->current_user = wp_get_current_user();
33
  }
34
 
@@ -38,7 +53,7 @@ class User {
38
  * @return boolean
39
  */
40
  public function check_logged() {
41
- if ( property_exists( $this->current_user->data, 'ID' ) ) {
42
  return true;
43
  }
44
  return false;
@@ -50,39 +65,51 @@ class User {
50
  * @return array
51
  */
52
  public function get_user_data() {
53
- $email = '';
54
- $name = '';
 
 
 
 
 
 
 
 
 
55
 
56
  if ( ! empty( $this->current_user->user_email ) ) {
57
- $email = $this->current_user->user_email;
58
  }
59
 
60
- if ( ! empty( $this->current_user->user_firstname ) && ! empty( $this->current_user->user_lastname ) ) {
61
- $name = $this->current_user->user_firstname . ' ' . $this->current_user->user_lastname;
 
 
 
 
 
 
 
 
62
  } else {
63
- $name = $this->current_user->user_login;
64
  }
65
 
66
- return array(
67
- 'name' => $name,
68
- 'email' => $email,
69
- );
70
  }
71
 
72
  /**
73
  * Return array of users authorized in LiveChat
74
  *
75
- * @return array|null
76
  */
77
  private function get_authorized_users() {
78
- $authorized_users = get_option( 'livechat_authorized_users' );
79
- if ( ! $authorized_users ) {
80
- return null;
81
- }
82
-
83
- return array_values(
84
- array_filter( explode( ',', $authorized_users ) )
85
- );
86
  }
87
 
88
  /**
@@ -94,25 +121,14 @@ class User {
94
  * @return bool
95
  */
96
  private function set_user_token( $user_id, $token ) {
97
- return update_option( 'livechat_user_' . $user_id . '_token', $token );
98
- }
99
-
100
- /**
101
- * Removes token for given user from WP database
102
- *
103
- * @param int $user_id User's id.
104
- *
105
- * @return bool
106
- */
107
- private function remove_user_token( $user_id ) {
108
- return delete_option( 'livechat_user_' . $user_id . '_token' );
109
  }
110
 
111
  /**
112
  * Removes current user tokens from WP database
113
  */
114
  public function remove_current_user_token() {
115
- $this->remove_user_token( $this->current_user->ID );
116
  }
117
 
118
  /**
@@ -122,14 +138,16 @@ class User {
122
  $authorized_users = $this->get_authorized_users();
123
 
124
  if ( empty( $authorized_users ) ) {
125
- return;
126
  }
127
 
 
 
128
  foreach ( $authorized_users as $user_id ) {
129
- $this->remove_user_token( $user_id );
130
  }
131
 
132
- delete_option( 'livechat_authorized_users' );
133
  }
134
 
135
  /**
@@ -141,13 +159,16 @@ class User {
141
  * @return bool
142
  */
143
  public function authorize_current_user( $user_token ) {
144
- $authorized_users = $this->get_authorized_users();
145
- $user_id = $this->current_user->ID;
146
- $authorized_users[] = $user_id;
147
- return update_option(
148
- 'livechat_authorized_users',
149
- implode( ',', $authorized_users )
150
- ) && $this->set_user_token( $user_id, $user_token );
 
 
 
151
  }
152
 
153
  /**
@@ -156,13 +177,10 @@ class User {
156
  * @return mixed|string|void
157
  */
158
  public function get_current_user_token() {
159
- $user_id = $this->current_user->ID;
160
-
161
- $user_token = get_option( 'livechat_user_' . $user_id . '_token' );
162
  if ( ! $user_token ) {
163
  return '';
164
  }
165
-
166
  return $user_token;
167
  }
168
 
@@ -173,7 +191,7 @@ class User {
173
  */
174
  public static function get_instance() {
175
  if ( ! isset( static::$instance ) ) {
176
- static::$instance = new static();
177
  }
178
 
179
  return static::$instance;
7
 
8
  namespace LiveChat\Services;
9
 
10
+ use LiveChat\Services\Options\UserAuthOptions;
11
+ use WP_User;
12
+
13
  /**
14
  * Class User
15
+ *
16
+ * @package LiveChat\Services
17
  */
18
  class User {
19
  /**
20
  * Instance of User class (singleton pattern)
21
  *
22
+ * @var User|null
23
  */
24
  private static $instance = null;
25
 
26
+ /**
27
+ * Instance of UserAuthOptions.
28
+ *
29
+ * @var UserAuthOptions
30
+ */
31
+ private $options;
32
+
33
  /**
34
  * Currently logged in user data
35
  *
36
+ * @var WP_User
37
  */
38
+ private $current_user;
39
 
40
  /**
41
  * User constructor.
42
+ *
43
+ * @param UserAuthOptions $options UserAuthOptions instance.
44
  */
45
+ public function __construct( $options ) {
46
+ $this->options = $options;
47
  $this->current_user = wp_get_current_user();
48
  }
49
 
53
  * @return boolean
54
  */
55
  public function check_logged() {
56
+ if ( property_exists( $this->current_user->data, 'ID' ) && ! empty( $this->current_user->data->ID ) ) {
57
  return true;
58
  }
59
  return false;
65
  * @return array
66
  */
67
  public function get_user_data() {
68
+ $user = array(
69
+ 'id' => '',
70
+ 'name' => '',
71
+ 'email' => '',
72
+ );
73
+
74
+ if ( ! $this->check_logged() ) {
75
+ return $user;
76
+ }
77
+
78
+ $user['id'] = $this->current_user->ID;
79
 
80
  if ( ! empty( $this->current_user->user_email ) ) {
81
+ $user['email'] = $this->current_user->user_email;
82
  }
83
 
84
+ if ( ! empty( $this->current_user->user_firstname ) || ! empty( $this->current_user->user_lastname ) ) {
85
+ $user['name'] = implode(
86
+ ' ',
87
+ array_filter(
88
+ array(
89
+ $this->current_user->user_firstname,
90
+ $this->current_user->user_lastname,
91
+ )
92
+ )
93
+ );
94
  } else {
95
+ $user['name'] = $this->current_user->user_login;
96
  }
97
 
98
+ return $user;
 
 
 
99
  }
100
 
101
  /**
102
  * Return array of users authorized in LiveChat
103
  *
104
+ * @return array
105
  */
106
  private function get_authorized_users() {
107
+ $authorized_users = $this->options->authorized_users->get();
108
+ return empty( $authorized_users )
109
+ ? array()
110
+ : array_values(
111
+ array_filter( $authorized_users )
112
+ );
 
 
113
  }
114
 
115
  /**
121
  * @return bool
122
  */
123
  private function set_user_token( $user_id, $token ) {
124
+ return $this->options->user_token->set( $user_id, $token );
 
 
 
 
 
 
 
 
 
 
 
125
  }
126
 
127
  /**
128
  * Removes current user tokens from WP database
129
  */
130
  public function remove_current_user_token() {
131
+ return $this->options->user_token->remove( $this->current_user->ID );
132
  }
133
 
134
  /**
138
  $authorized_users = $this->get_authorized_users();
139
 
140
  if ( empty( $authorized_users ) ) {
141
+ return false;
142
  }
143
 
144
+ $was_successful = true;
145
+
146
  foreach ( $authorized_users as $user_id ) {
147
+ $was_successful &= $this->options->user_token->remove( $user_id );
148
  }
149
 
150
+ return $this->options->authorized_users->remove() && $was_successful;
151
  }
152
 
153
  /**
159
  * @return bool
160
  */
161
  public function authorize_current_user( $user_token ) {
162
+ $authorized_users = $this->get_authorized_users();
163
+ $user_id = $this->current_user->ID;
164
+
165
+ if ( false === array_search( (string) $user_id, $authorized_users, true ) ) {
166
+ $authorized_users[] = $user_id;
167
+ return $this->options->user_token->set( $user_id, $user_token ) &&
168
+ $this->options->authorized_users->set( $authorized_users );
169
+ }
170
+
171
+ return $this->options->user_token->set( $user_id, $user_token );
172
  }
173
 
174
  /**
177
  * @return mixed|string|void
178
  */
179
  public function get_current_user_token() {
180
+ $user_token = $this->options->user_token->get( $this->current_user->ID );
 
 
181
  if ( ! $user_token ) {
182
  return '';
183
  }
 
184
  return $user_token;
185
  }
186
 
191
  */
192
  public static function get_instance() {
193
  if ( ! isset( static::$instance ) ) {
194
+ static::$instance = new static( UserAuthOptions::get_instance() );
195
  }
196
 
197
  return static::$instance;
plugin_files/Services/WidgetProvider.class.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class WidgetProvider
4
+ *
5
+ * @package LiveChat\Services
6
+ */
7
+
8
+ namespace LiveChat\Services;
9
+
10
+ use Exception;
11
+ use LiveChat\Services\Templates\ChatWidgetScriptTemplate;
12
+ use LiveChat\Services\Templates\TrackingCodeTemplate;
13
+
14
+ /**
15
+ * Class WidgetProvider
16
+ *
17
+ * @package LiveChat\Services
18
+ */
19
+ class WidgetProvider {
20
+ /**
21
+ * Instance of WidgetProvider.
22
+ *
23
+ * @var WidgetProvider|null
24
+ */
25
+ private static $instance = null;
26
+
27
+ /**
28
+ * Instance of ChatWidgetScriptTemplate.
29
+ *
30
+ * @var ChatWidgetScriptTemplate
31
+ */
32
+ private $chat_widget_script_template;
33
+
34
+ /**
35
+ * Instance of TrackingCodeTemplate.
36
+ *
37
+ * @var TrackingCodeTemplate
38
+ */
39
+ private $tracking_code_template;
40
+
41
+ /**
42
+ * WidgetProvider constructor.
43
+ *
44
+ * @param ChatWidgetScriptTemplate $chat_widget_script_template Instance of ChatWidgetScriptTemplate.
45
+ * @param TrackingCodeTemplate $tracking_code_template Instance of TrackingCodeTemplate.
46
+ */
47
+ public function __construct( $chat_widget_script_template, $tracking_code_template ) {
48
+ $this->chat_widget_script_template = $chat_widget_script_template;
49
+ $this->tracking_code_template = $tracking_code_template;
50
+ }
51
+
52
+ /**
53
+ * Sets widget script.
54
+ */
55
+ public function set_widget() {
56
+ try {
57
+ $this->chat_widget_script_template->render();
58
+ } catch ( Exception $ex ) {
59
+ $this->tracking_code_template->render();
60
+ }
61
+ }
62
+
63
+ /**
64
+ * Returns instance of WidgetProvider (singleton pattern).
65
+ *
66
+ * @return WidgetProvider|null
67
+ * @throws Exception
68
+ */
69
+ public static function get_instance() {
70
+ if ( ! isset( static::$instance ) ) {
71
+ static::$instance = new static(
72
+ ChatWidgetScriptTemplate::create(),
73
+ TrackingCodeTemplate::create()
74
+ );
75
+ }
76
+
77
+ return static::$instance;
78
+ }
79
+ }
plugin_files/Services/WooCommerce/CustomerTrackingProvider.class.php ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class CustomerTrackingProvider
4
+ *
5
+ * @package LiveChat\Services\WooCommerce
6
+ */
7
+
8
+ namespace LiveChat\Services\WooCommerce;
9
+
10
+ use LiveChat\Services\User;
11
+ use WC_Cart;
12
+ use WC_Customer;
13
+
14
+ /**
15
+ * Class CustomerTrackingProvider
16
+ *
17
+ * @package LiveChat\Services\WooCommerce
18
+ */
19
+ class CustomerTrackingProvider {
20
+ /**
21
+ * Instance of User.
22
+ *
23
+ * @var User
24
+ */
25
+ private $user;
26
+
27
+ /**
28
+ * CustomerTrackingProvider constructor.
29
+ *
30
+ * @param User $user Instance of User.
31
+ */
32
+ public function __construct( $user ) {
33
+ $this->user = $user;
34
+ }
35
+
36
+ /**
37
+ * Returns shipping address string for given customer.
38
+ *
39
+ * @param WC_Customer $customer Woo customer.
40
+ * @param array $countries WooCommerce countries.
41
+ *
42
+ * @return string
43
+ */
44
+ private function get_shipping_address( $customer, $countries ) {
45
+ return implode(
46
+ ', ',
47
+ array_filter(
48
+ array(
49
+ $customer->get_shipping_address_1(),
50
+ $customer->get_shipping_address_2(),
51
+ implode(
52
+ ' ',
53
+ array_filter(
54
+ array(
55
+ $customer->get_shipping_city(),
56
+ $customer->get_shipping_state(),
57
+ $customer->get_shipping_postcode(),
58
+ )
59
+ )
60
+ ),
61
+ $countries[ $customer->get_shipping_country() ],
62
+ )
63
+ )
64
+ );
65
+ }
66
+
67
+ /**
68
+ * Returns cart contents.
69
+ *
70
+ * @param WC_Cart $woo_cart Woo cart.
71
+ *
72
+ * @return array
73
+ */
74
+ private function get_cart_content( $woo_cart ) {
75
+ $count = $woo_cart->get_cart_contents_count();
76
+ $cart = array();
77
+
78
+ if ( $count > 0 ) {
79
+ $cart['Total count'] = $count;
80
+ $total = $woo_cart->get_cart_contents_total();
81
+ $currency = get_woocommerce_currency();
82
+ $cart['Total value'] = "$total $currency";
83
+
84
+ $items = $woo_cart->get_cart_contents();
85
+ foreach ( $items as $item ) {
86
+ $product = wc_get_product( $item['data'] );
87
+ $url = $product->get_permalink();
88
+ $qty = $item['quantity'];
89
+ $name = $product->get_name();
90
+
91
+ $cart[ "{$qty}x $name" ] = $url;
92
+ }
93
+ }
94
+
95
+ return $cart;
96
+ }
97
+
98
+ /**
99
+ * Returns cart and customer tracking data for AJAX action.
100
+ */
101
+ public function ajax_get_customer_tracking() {
102
+ $woocommerce = WC();
103
+
104
+ if ( ! $woocommerce ) {
105
+ return null;
106
+ }
107
+
108
+ $woo_customer = $woocommerce->customer;
109
+
110
+ if ( ! $woo_customer ) {
111
+ return null;
112
+ }
113
+
114
+ $customer_details = array();
115
+
116
+ if ( $this->user->check_logged() ) {
117
+ $order = wc_get_customer_last_order( $woo_customer->get_id() );
118
+ $order_url = $order ? $order->get_edit_order_url() : null;
119
+ $customer_details['Last order'] = $order_url ? $order_url : '---';
120
+
121
+ $customer_details['Shipping address'] = $this->get_shipping_address( $woo_customer, $woocommerce->countries->get_countries() );
122
+ }
123
+
124
+ $cart_contents = $this->get_cart_content( $woocommerce->cart );
125
+ wp_send_json(
126
+ array(
127
+ 'cart' => array_merge(
128
+ $customer_details,
129
+ $cart_contents
130
+ ),
131
+ 'customer' => $this->user->get_user_data(),
132
+ )
133
+ );
134
+ }
135
+
136
+ /**
137
+ * Returns new instance of CustomerTrackingProvider class.
138
+ *
139
+ * @return CustomerTrackingProvider
140
+ */
141
+ public static function create() {
142
+ return new static(
143
+ User::get_instance()
144
+ );
145
+ }
146
+ }
plugin_files/css/livechat-general.css CHANGED
@@ -30,6 +30,11 @@
30
  display: none;
31
  }
32
 
 
 
 
 
 
33
  .lc-table {
34
  padding-top: 50px;
35
  width: 100%;
@@ -232,6 +237,28 @@ p.lc-meta-text {
232
 
233
  /* General Notices */
234
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235
  .lc-notice {
236
  border-left-color: #4384F5;
237
  padding: 5px 10px;
@@ -303,7 +330,7 @@ p.lc-meta-text {
303
  }
304
 
305
  #lc-deactivation-feedback-modal-container .lc-modal__header {
306
- padding-bottom: 10px;
307
  }
308
 
309
  #lc-deactivation-feedback-form .lc-form-group {
@@ -318,13 +345,13 @@ p.lc-meta-text {
318
  }
319
 
320
  #lc-deactivation-feedback-logo {
321
- max-width: 80px;
322
  height: auto;
323
  float: left;
324
  }
325
 
326
  #lc-deactivation-feedback-modal-title {
327
- margin: 2px 0 0 8px;
328
  }
329
 
330
  #lc-deactivation-feedback-other-field {
30
  display: none;
31
  }
32
 
33
+ .livechat_page_livechat_settings .notice,
34
+ .livechat_page_livechat_resources .notice {
35
+ display: none;
36
+ }
37
+
38
  .lc-table {
39
  padding-top: 50px;
40
  width: 100%;
237
 
238
  /* General Notices */
239
 
240
+ #lc-notice-container {
241
+ width: 100%;
242
+ height: 1px;
243
+ border-left: none;
244
+ box-shadow: none;
245
+ padding: 0;
246
+ background: #f1f1f1;
247
+ overflow: hidden;
248
+ max-height: 150px;
249
+ }
250
+
251
+ @media screen and (max-width: 561px) {
252
+ #lc-notice-container {
253
+ max-height: 300px;
254
+ }
255
+ }
256
+
257
+ #lc-notice-iframe {
258
+ width: 100%;
259
+ height: 1px;
260
+ }
261
+
262
  .lc-notice {
263
  border-left-color: #4384F5;
264
  padding: 5px 10px;
330
  }
331
 
332
  #lc-deactivation-feedback-modal-container .lc-modal__header {
333
+ padding-bottom: 0;
334
  }
335
 
336
  #lc-deactivation-feedback-form .lc-form-group {
345
  }
346
 
347
  #lc-deactivation-feedback-logo {
348
+ max-width: 50px;
349
  height: auto;
350
  float: left;
351
  }
352
 
353
  #lc-deactivation-feedback-modal-title {
354
+ margin: 0;
355
  }
356
 
357
  #lc-deactivation-feedback-other-field {
plugin_files/css/livechat-review.css DELETED
@@ -1,39 +0,0 @@
1
- /* Review Notice */
2
-
3
- #lc-review-notice-actions {
4
- margin: 5px auto;
5
- display: flex;
6
- flex-flow: row nowrap;
7
- justify-content: flex-start;
8
- align-content: center;
9
- }
10
-
11
- .lc-review-notice-action {
12
- text-decoration: none;
13
- padding: 0 16px 0 8px;
14
- margin: 5px;
15
- }
16
-
17
- .lc-review-notice-action:first-of-type {
18
- margin-left: 0;
19
- }
20
-
21
- .lc-review-notice-action:last-of-type {
22
- margin-right: 0;
23
- }
24
-
25
- .lc-review-notice-action span {
26
- margin-left: 6px;
27
- }
28
-
29
- @media screen and (max-width: 635px) {
30
- #lc-review-notice-actions {
31
- flex-flow: column wrap;
32
- align-content: flex-start;
33
- align-items: baseline;
34
- }
35
-
36
- .lc-review-notice-action {
37
- margin: 3px 0;
38
- }
39
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin_files/images/livechat-icon.svg CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0" encoding="utf-8"?>
2
  <!-- Generator: Adobe Illustrator 24.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" id="Logos" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
- viewBox="-35 -15 160 160" style="enable-background:new 0 0 80 80;" xml:space="preserve">
5
  <style type="text/css">
6
  .st0{fill:#FF5100;}
7
  </style>
1
  <?xml version="1.0" encoding="utf-8"?>
2
  <!-- Generator: Adobe Illustrator 24.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Logos" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
4
+ viewBox="-35 -15 160 160" style="enable-background:new 0 0 80 80;" xml:space="preserve">
5
  <style type="text/css">
6
  .st0{fill:#FF5100;}
7
  </style>
plugin_files/images/livechat-logo.svg CHANGED
@@ -1,6 +1,6 @@
1
  <?xml version="1.0" encoding="utf-8"?>
2
  <!-- Generator: Adobe Illustrator 24.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" id="Logos" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
  viewBox="0 0 356 80" style="enable-background:new 0 0 356 80;" xml:space="preserve">
5
  <style type="text/css">
6
  .st0{fill:#FF5100;}
1
  <?xml version="1.0" encoding="utf-8"?>
2
  <!-- Generator: Adobe Illustrator 24.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Logos" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
4
  viewBox="0 0 356 80" style="enable-background:new 0 0 356 80;" xml:space="preserve">
5
  <style type="text/css">
6
  .st0{fill:#FF5100;}
plugin_files/js/connect.js CHANGED
@@ -1,4 +1,4 @@
1
- // Version: "2.5.0"
2
  parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"MVLi":[function(require,module,exports) {
3
  var global = arguments[3];
4
  var t=arguments[3],o=function(t){return t&&t.Math==Math&&t};module.exports=o("object"==typeof globalThis&&globalThis)||o("object"==typeof window&&window)||o("object"==typeof self&&self)||o("object"==typeof t&&t)||Function("return this")();
@@ -411,7 +411,7 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel
411
  },{"../internals/fix-regexp-well-known-symbol-logic":"xXXd","../internals/is-regexp":"fTdC","../internals/an-object":"eAPg","../internals/require-object-coercible":"RWPB","../internals/species-constructor":"mxIp","../internals/advance-string-index":"AIo2","../internals/to-length":"j9AG","../internals/regexp-exec-abstract":"hv6q","../internals/regexp-exec":"OSep","../internals/fails":"pWu7"}],"GB8Q":[function(require,module,exports) {
412
  "use strict";var r=require("../internals/export"),t=require("../internals/object-get-own-property-descriptor").f,e=require("../internals/to-length"),i=require("../internals/not-a-regexp"),n=require("../internals/require-object-coercible"),s=require("../internals/correct-is-regexp-logic"),a=require("../internals/is-pure"),o="".startsWith,l=Math.min,c=s("startsWith"),u=!a&&!c&&!!function(){var r=t(String.prototype,"startsWith");return r&&!r.writable}();r({target:"String",proto:!0,forced:!u&&!c},{startsWith:function(r){var t=String(n(this));i(r);var s=e(l(arguments.length>1?arguments[1]:void 0,t.length)),a=String(r);return o?o.call(t,a,s):t.slice(s,s+a.length)===a}});
413
  },{"../internals/export":"rhEq","../internals/object-get-own-property-descriptor":"zm15","../internals/to-length":"j9AG","../internals/not-a-regexp":"gIbS","../internals/require-object-coercible":"RWPB","../internals/correct-is-regexp-logic":"cTby","../internals/is-pure":"tGwT"}],"t1eM":[function(require,module,exports) {
414
- module.exports="\t\n\v\f\r                \u2028\u2029\ufeff";
415
  },{}],"Fme6":[function(require,module,exports) {
416
  var e=require("../internals/require-object-coercible"),r=require("../internals/whitespaces"),t="["+r+"]",n=RegExp("^"+t+t+"*"),i=RegExp(t+t+"*$"),a=function(r){return function(t){var a=String(e(t));return 1&r&&(a=a.replace(n,"")),2&r&&(a=a.replace(i,"")),a}};module.exports={start:a(1),end:a(2),trim:a(3)};
417
  },{"../internals/require-object-coercible":"RWPB","../internals/whitespaces":"t1eM"}],"UtzI":[function(require,module,exports) {
@@ -817,9 +817,11 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel
817
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SignInCommand=void 0;var e=require("./Command");function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){if(null==e)return{};var r,o,u=n(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(u[r]=e[r])}return u}function n(e,t){if(null==e)return{};var r,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)r=u[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),e}function f(e,r){return!r||"object"!==t(r)&&"function"!=typeof r?c(e):r}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var s=function(t){function n(e,t,r,u){var i;return o(this,n),(i=f(this,l(n).call(this,t,r,u))).userToken=e,i}return a(n,e.Command),i(n,null,[{key:"getName",value:function(){return"SignInCommand"}},{key:"fromObject",value:function(e){var t=e.userToken,o=e.platform,u=e.platformVer,i=e.moduleVer,f=r(e,["userToken","platform","platformVer","moduleVer"]),c=new n(t,o,u,i);return c.setProperties(f),c}}]),n}();exports.SignInCommand=s;
818
  },{"./Command":"ulfL"}],"og2y":[function(require,module,exports) {
819
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.JoinCommand=void 0;var e=require("./Command");function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){if(null==e)return{};var r,n,u=o(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(u[r]=e[r])}return u}function o(e,t){if(null==e)return{};var r,o,n={},u=Object.keys(e);for(o=0;o<u.length;o++)r=u[o],t.indexOf(r)>=0||(n[r]=e[r]);return n}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function i(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),e}function f(e,r){return!r||"object"!==t(r)&&"function"!=typeof r?c(e):r}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var s=function(t){function o(e,t,r,u,i,c){var a;return n(this,o),(a=f(this,l(o).call(this,u,i,c))).storeToken=e,a.userId=t,a.userName=r,a}return a(o,e.Command),i(o,null,[{key:"getName",value:function(){return"JoinCommand"}},{key:"fromObject",value:function(e){var t=e.storeToken,n=e.userId,u=e.userName,i=e.platform,f=e.platformVer,c=e.moduleVer,l=r(e,["storeToken","userId","userName","platform","platformVer","moduleVer"]),a=new o(t,n,u,i,f,c);return a.setProperties(l),a}}]),o}();exports.JoinCommand=s;
 
 
820
  },{"./Command":"ulfL"}],"wiV8":[function(require,module,exports) {
821
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./Command");Object.keys(e).forEach(function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(exports,r,{enumerable:!0,get:function(){return e[r]}})});var r=require("./ConnectCommand");Object.keys(r).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return r[e]}})});var t=require("./SignInCommand");Object.keys(t).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})});var n=require("./JoinCommand");Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return n[e]}})});
822
- },{"./Command":"ulfL","./ConnectCommand":"B7pK","./SignInCommand":"nEb6","./JoinCommand":"og2y"}],"T8Ex":[function(require,module,exports) {
823
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.UserSignedInEvent=void 0;var e=require("./Event");function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(null==e)return{};var n,o,u=r(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(u[n]=e[n])}return u}function r(e,t){if(null==e)return{};var n,r,o={},u=Object.keys(e);for(r=0;r<u.length;r++)n=u[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),e}function f(e,n){return!n||"object"!==t(n)&&"function"!=typeof n?c(e):n}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var p=function(t){function r(e,t){var n;return o(this,r),(n=f(this,l(r).call(this))).userToken=e,n.storeToken=t,n}return s(r,e.Event),i(r,null,[{key:"getName",value:function(){return"UserSignedInEvent"}},{key:"fromObject",value:function(e){var t=e.userToken,o=e.storeToken,u=n(e,["userToken","storeToken"]),i=new r(t,o);return i.setProperties(u),i}}]),r}();exports.UserSignedInEvent=p;
824
  },{"./Event":"h36w"}],"mzHb":[function(require,module,exports) {
825
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AgentWasCreatedEvent=void 0;var e=require("./Event");function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(null==e)return{};var n,o,u=r(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(u[n]=e[n])}return u}function r(e,t){if(null==e)return{};var n,r,o={},u=Object.keys(e);for(r=0;r<u.length;r++)n=u[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),e}function f(e,n){return!n||"object"!==t(n)&&"function"!=typeof n?c(e):n}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var p=function(t){function r(e){var t;return o(this,r),(t=f(this,l(r).call(this))).userToken=e,t}return a(r,e.Event),i(r,null,[{key:"getName",value:function(){return"AgentWasCreatedEvent"}},{key:"fromObject",value:function(e){var t=e.userToken,o=n(e,["userToken"]),u=new r(t);return u.setProperties(o),u}}]),r}();exports.AgentWasCreatedEvent=p;
@@ -827,10 +829,14 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel
827
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ErrorOccurredEvent=void 0;var e=require("./Event");function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){if(null==e)return{};var r,o,u=n(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(o=0;o<c.length;o++)r=c[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(u[r]=e[r])}return u}function n(e,t){if(null==e)return{};var r,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)r=u[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),e}function i(e,r){return!r||"object"!==t(r)&&"function"!=typeof r?f(e):r}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var p=function(t){function n(e,t){var r,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return o(this,n),(r=i(this,a(n).call(this))).errorMessage=e,r.statusCode=t,r.metadata=u,r}return l(n,e.Event),c(n,null,[{key:"getName",value:function(){return"ErrorOccurredEvent"}},{key:"fromObject",value:function(e){var t=e.errorMessage,o=e.statusCode,u=e.metadata,c=void 0===u?null:u,i=r(e,["errorMessage","statusCode","metadata"]),f=new n(t,o,c);return f.setProperties(i),f}}]),n}();exports.ErrorOccurredEvent=p;
828
  },{"./Event":"h36w"}],"Hfvt":[function(require,module,exports) {
829
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AppWasDisconnectedEvent=void 0;var e=require("./Event");function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function r(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}function u(e,n){return!n||"object"!==t(n)&&"function"!=typeof n?i(e):n}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var a=function(t){function o(){return n(this,o),u(this,c(o).call(this))}return f(o,e.Event),r(o,null,[{key:"getName",value:function(){return"AppWasDisconnectedEvent"}},{key:"fromObject",value:function(e){var t=new o;return t.setProperties(e),t}}]),o}();exports.AppWasDisconnectedEvent=a;
 
 
 
 
830
  },{"./Event":"h36w"}],"Sykw":[function(require,module,exports) {
831
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./Event");Object.keys(e).forEach(function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(exports,r,{enumerable:!0,get:function(){return e[r]}})});var r=require("./UserSignedInEvent");Object.keys(r).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return r[e]}})});var t=require("./AgentWasCreatedEvent");Object.keys(t).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})});var n=require("./ErrorOccurredEvent");Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return n[e]}})});var u=require("./AppWasDisconnectedEvent");Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return u[e]}})});
832
- },{"./Event":"h36w","./UserSignedInEvent":"T8Ex","./AgentWasCreatedEvent":"mzHb","./ErrorOccurredEvent":"sxXM","./AppWasDisconnectedEvent":"Hfvt"}],"ixYr":[function(require,module,exports) {
833
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./Register");Object.keys(e).forEach(function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(exports,r,{enumerable:!0,get:function(){return e[r]}})});var r=require("./CommandsRegister");Object.keys(r).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return r[e]}})});var t=require("./EventsRegister");Object.keys(t).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})});
834
  },{"./Register":"PvzX","./CommandsRegister":"CcKS","./EventsRegister":"nSEc"}],"Focm":[function(require,module,exports) {
835
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("core-js/stable"),require("regenerator-runtime/runtime");var e=require("./bridge");Object.keys(e).forEach(function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(exports,r,{enumerable:!0,get:function(){return e[r]}})});var r=require("./commands");Object.keys(r).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return r[e]}})});var t=require("./events");Object.keys(t).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})});var u=require("./register");Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return u[e]}})});
836
- },{"core-js/stable":"XqIO","regenerator-runtime/runtime":"QVnC","./bridge":"aInX","./commands":"wiV8","./events":"Sykw","./register":"ixYr"}]},{},["Focm"], "AppBridge")
1
+ // Version: "2.7.0"
2
  parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"MVLi":[function(require,module,exports) {
3
  var global = arguments[3];
4
  var t=arguments[3],o=function(t){return t&&t.Math==Math&&t};module.exports=o("object"==typeof globalThis&&globalThis)||o("object"==typeof window&&window)||o("object"==typeof self&&self)||o("object"==typeof t&&t)||Function("return this")();
411
  },{"../internals/fix-regexp-well-known-symbol-logic":"xXXd","../internals/is-regexp":"fTdC","../internals/an-object":"eAPg","../internals/require-object-coercible":"RWPB","../internals/species-constructor":"mxIp","../internals/advance-string-index":"AIo2","../internals/to-length":"j9AG","../internals/regexp-exec-abstract":"hv6q","../internals/regexp-exec":"OSep","../internals/fails":"pWu7"}],"GB8Q":[function(require,module,exports) {
412
  "use strict";var r=require("../internals/export"),t=require("../internals/object-get-own-property-descriptor").f,e=require("../internals/to-length"),i=require("../internals/not-a-regexp"),n=require("../internals/require-object-coercible"),s=require("../internals/correct-is-regexp-logic"),a=require("../internals/is-pure"),o="".startsWith,l=Math.min,c=s("startsWith"),u=!a&&!c&&!!function(){var r=t(String.prototype,"startsWith");return r&&!r.writable}();r({target:"String",proto:!0,forced:!u&&!c},{startsWith:function(r){var t=String(n(this));i(r);var s=e(l(arguments.length>1?arguments[1]:void 0,t.length)),a=String(r);return o?o.call(t,a,s):t.slice(s,s+a.length)===a}});
413
  },{"../internals/export":"rhEq","../internals/object-get-own-property-descriptor":"zm15","../internals/to-length":"j9AG","../internals/not-a-regexp":"gIbS","../internals/require-object-coercible":"RWPB","../internals/correct-is-regexp-logic":"cTby","../internals/is-pure":"tGwT"}],"t1eM":[function(require,module,exports) {
414
+ module.exports="\t\n\v\f\r                \u2028\u2029\ufeff";
415
  },{}],"Fme6":[function(require,module,exports) {
416
  var e=require("../internals/require-object-coercible"),r=require("../internals/whitespaces"),t="["+r+"]",n=RegExp("^"+t+t+"*"),i=RegExp(t+t+"*$"),a=function(r){return function(t){var a=String(e(t));return 1&r&&(a=a.replace(n,"")),2&r&&(a=a.replace(i,"")),a}};module.exports={start:a(1),end:a(2),trim:a(3)};
417
  },{"../internals/require-object-coercible":"RWPB","../internals/whitespaces":"t1eM"}],"UtzI":[function(require,module,exports) {
817
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SignInCommand=void 0;var e=require("./Command");function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){if(null==e)return{};var r,o,u=n(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(u[r]=e[r])}return u}function n(e,t){if(null==e)return{};var r,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)r=u[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),e}function f(e,r){return!r||"object"!==t(r)&&"function"!=typeof r?c(e):r}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var s=function(t){function n(e,t,r,u){var i;return o(this,n),(i=f(this,l(n).call(this,t,r,u))).userToken=e,i}return a(n,e.Command),i(n,null,[{key:"getName",value:function(){return"SignInCommand"}},{key:"fromObject",value:function(e){var t=e.userToken,o=e.platform,u=e.platformVer,i=e.moduleVer,f=r(e,["userToken","platform","platformVer","moduleVer"]),c=new n(t,o,u,i);return c.setProperties(f),c}}]),n}();exports.SignInCommand=s;
818
  },{"./Command":"ulfL"}],"og2y":[function(require,module,exports) {
819
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.JoinCommand=void 0;var e=require("./Command");function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){if(null==e)return{};var r,n,u=o(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(u[r]=e[r])}return u}function o(e,t){if(null==e)return{};var r,o,n={},u=Object.keys(e);for(o=0;o<u.length;o++)r=u[o],t.indexOf(r)>=0||(n[r]=e[r]);return n}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function i(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),e}function f(e,r){return!r||"object"!==t(r)&&"function"!=typeof r?c(e):r}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var s=function(t){function o(e,t,r,u,i,c){var a;return n(this,o),(a=f(this,l(o).call(this,u,i,c))).storeToken=e,a.userId=t,a.userName=r,a}return a(o,e.Command),i(o,null,[{key:"getName",value:function(){return"JoinCommand"}},{key:"fromObject",value:function(e){var t=e.storeToken,n=e.userId,u=e.userName,i=e.platform,f=e.platformVer,c=e.moduleVer,l=r(e,["storeToken","userId","userName","platform","platformVer","moduleVer"]),a=new o(t,n,u,i,f,c);return a.setProperties(l),a}}]),o}();exports.JoinCommand=s;
820
+ },{"./Command":"ulfL"}],"u8am":[function(require,module,exports) {
821
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GetNoticeCommand=void 0;var e=require("./Command");function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){if(null==e)return{};var r,n,u=o(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(u[r]=e[r])}return u}function o(e,t){if(null==e)return{};var r,o,n={},u=Object.keys(e);for(o=0;o<u.length;o++)r=u[o],t.indexOf(r)>=0||(n[r]=e[r]);return n}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function i(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),e}function f(e,r){return!r||"object"!==t(r)&&"function"!=typeof r?c(e):r}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var s=function(t){function o(e,t,r,u,i,c){var a;return n(this,o),(a=f(this,l(o).call(this,u,i,c))).storeToken=e,a.userToken=t,a.maxWidth=r,a}return a(o,e.Command),i(o,null,[{key:"getName",value:function(){return"GetNoticeCommand"}},{key:"fromObject",value:function(e){var t=e.storeToken,n=e.userToken,u=e.maxWidth,i=e.platform,f=e.platformVer,c=e.moduleVer,l=r(e,["storeToken","userToken","maxWidth","platform","platformVer","moduleVer"]),a=new o(t,n,u,i,f,c);return a.setProperties(l),a}}]),o}();exports.GetNoticeCommand=s;
822
  },{"./Command":"ulfL"}],"wiV8":[function(require,module,exports) {
823
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./Command");Object.keys(e).forEach(function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(exports,r,{enumerable:!0,get:function(){return e[r]}})});var r=require("./ConnectCommand");Object.keys(r).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return r[e]}})});var t=require("./SignInCommand");Object.keys(t).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})});var n=require("./JoinCommand");Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return n[e]}})});var o=require("./GetNoticeCommand");Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return o[e]}})});
824
+ },{"./Command":"ulfL","./ConnectCommand":"B7pK","./SignInCommand":"nEb6","./JoinCommand":"og2y","./GetNoticeCommand":"u8am"}],"T8Ex":[function(require,module,exports) {
825
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.UserSignedInEvent=void 0;var e=require("./Event");function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(null==e)return{};var n,o,u=r(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(u[n]=e[n])}return u}function r(e,t){if(null==e)return{};var n,r,o={},u=Object.keys(e);for(r=0;r<u.length;r++)n=u[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),e}function f(e,n){return!n||"object"!==t(n)&&"function"!=typeof n?c(e):n}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var p=function(t){function r(e,t){var n;return o(this,r),(n=f(this,l(r).call(this))).userToken=e,n.storeToken=t,n}return s(r,e.Event),i(r,null,[{key:"getName",value:function(){return"UserSignedInEvent"}},{key:"fromObject",value:function(e){var t=e.userToken,o=e.storeToken,u=n(e,["userToken","storeToken"]),i=new r(t,o);return i.setProperties(u),i}}]),r}();exports.UserSignedInEvent=p;
826
  },{"./Event":"h36w"}],"mzHb":[function(require,module,exports) {
827
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AgentWasCreatedEvent=void 0;var e=require("./Event");function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(null==e)return{};var n,o,u=r(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(u[n]=e[n])}return u}function r(e,t){if(null==e)return{};var n,r,o={},u=Object.keys(e);for(r=0;r<u.length;r++)n=u[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),e}function f(e,n){return!n||"object"!==t(n)&&"function"!=typeof n?c(e):n}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var p=function(t){function r(e){var t;return o(this,r),(t=f(this,l(r).call(this))).userToken=e,t}return a(r,e.Event),i(r,null,[{key:"getName",value:function(){return"AgentWasCreatedEvent"}},{key:"fromObject",value:function(e){var t=e.userToken,o=n(e,["userToken"]),u=new r(t);return u.setProperties(o),u}}]),r}();exports.AgentWasCreatedEvent=p;
829
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ErrorOccurredEvent=void 0;var e=require("./Event");function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){if(null==e)return{};var r,o,u=n(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(o=0;o<c.length;o++)r=c[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(u[r]=e[r])}return u}function n(e,t){if(null==e)return{};var r,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)r=u[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),e}function i(e,r){return!r||"object"!==t(r)&&"function"!=typeof r?f(e):r}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var p=function(t){function n(e,t){var r,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return o(this,n),(r=i(this,a(n).call(this))).errorMessage=e,r.statusCode=t,r.metadata=u,r}return l(n,e.Event),c(n,null,[{key:"getName",value:function(){return"ErrorOccurredEvent"}},{key:"fromObject",value:function(e){var t=e.errorMessage,o=e.statusCode,u=e.metadata,c=void 0===u?null:u,i=r(e,["errorMessage","statusCode","metadata"]),f=new n(t,o,c);return f.setProperties(i),f}}]),n}();exports.ErrorOccurredEvent=p;
830
  },{"./Event":"h36w"}],"Hfvt":[function(require,module,exports) {
831
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AppWasDisconnectedEvent=void 0;var e=require("./Event");function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function r(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}function u(e,n){return!n||"object"!==t(n)&&"function"!=typeof n?i(e):n}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var a=function(t){function o(){return n(this,o),u(this,c(o).call(this))}return f(o,e.Event),r(o,null,[{key:"getName",value:function(){return"AppWasDisconnectedEvent"}},{key:"fromObject",value:function(e){var t=new o;return t.setProperties(e),t}}]),o}();exports.AppWasDisconnectedEvent=a;
832
+ },{"./Event":"h36w"}],"sLz7":[function(require,module,exports) {
833
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.WidgetScriptUpdatedEvent=void 0;var t=require("./Event");function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){if(null==t)return{};var r,o,i=n(t,e);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(t);for(o=0;o<u.length;o++)r=u[o],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(i[r]=t[r])}return i}function n(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function u(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),t}function c(t,r){return!r||"object"!==e(r)&&"function"!=typeof r?f(t):r}function f(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var y=function(e){function n(t){var e;return o(this,n),(e=c(this,l(n).call(this))).widgetURL=t,e}return p(n,t.Event),u(n,null,[{key:"getName",value:function(){return"WidgetScriptUpdatedEvent"}},{key:"fromObject",value:function(t){var e=t.widgetURL,o=r(t,["widgetURL"]),i=new n(e);return i.setProperties(o),i}}]),n}();exports.WidgetScriptUpdatedEvent=y;
834
+ },{"./Event":"h36w"}],"q4dH":[function(require,module,exports) {
835
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.NoticeFetchedEvent=void 0;var e=require("./Event");function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(null==e)return{};var n,o,u=r(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(u[n]=e[n])}return u}function r(e,t){if(null==e)return{};var n,r,o={},u=Object.keys(e);for(r=0;r<u.length;r++)n=u[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),e}function c(e,n){return!n||"object"!==t(n)&&"function"!=typeof n?f(e):n}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var y=function(t){function r(e){var t;return o(this,r),(t=c(this,l(r).call(this))).maxHeight=e,t}return a(r,e.Event),i(r,null,[{key:"getName",value:function(){return"NoticeFetchedEvent"}},{key:"fromObject",value:function(e){var t=e.maxHeight,o=n(e,["maxHeight"]),u=new r(t);return u.setProperties(o),u}}]),r}();exports.NoticeFetchedEvent=y;
836
  },{"./Event":"h36w"}],"Sykw":[function(require,module,exports) {
837
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./Event");Object.keys(e).forEach(function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});var t=require("./UserSignedInEvent");Object.keys(t).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})});var r=require("./AgentWasCreatedEvent");Object.keys(r).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return r[e]}})});var n=require("./ErrorOccurredEvent");Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return n[e]}})});var u=require("./AppWasDisconnectedEvent");Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return u[e]}})});var o=require("./WidgetScriptUpdatedEvent");Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return o[e]}})});var c=require("./NoticeFetchedEvent");Object.keys(c).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return c[e]}})});
838
+ },{"./Event":"h36w","./UserSignedInEvent":"T8Ex","./AgentWasCreatedEvent":"mzHb","./ErrorOccurredEvent":"sxXM","./AppWasDisconnectedEvent":"Hfvt","./WidgetScriptUpdatedEvent":"sLz7","./NoticeFetchedEvent":"q4dH"}],"ixYr":[function(require,module,exports) {
839
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./Register");Object.keys(e).forEach(function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(exports,r,{enumerable:!0,get:function(){return e[r]}})});var r=require("./CommandsRegister");Object.keys(r).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return r[e]}})});var t=require("./EventsRegister");Object.keys(t).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})});
840
  },{"./Register":"PvzX","./CommandsRegister":"CcKS","./EventsRegister":"nSEc"}],"Focm":[function(require,module,exports) {
841
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("core-js/stable"),require("regenerator-runtime/runtime");var e=require("./bridge");Object.keys(e).forEach(function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(exports,r,{enumerable:!0,get:function(){return e[r]}})});var r=require("./commands");Object.keys(r).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return r[e]}})});var t=require("./events");Object.keys(t).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})});var u=require("./register");Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return u[e]}})});
842
+ },{"core-js/stable":"XqIO","regenerator-runtime/runtime":"QVnC","./bridge":"aInX","./commands":"wiV8","./events":"Sykw","./register":"ixYr"}]},{},["Focm"], "AppBridge")
plugin_files/js/livechat-review.js DELETED
@@ -1,52 +0,0 @@
1
- (function ($) {
2
- $( document ).ready(
3
- function () {
4
- var dismissButton = $( "#lc-review-notice button" );
5
- dismissButton.hide();
6
- $( "#lc-review-dismiss" ).click(
7
- function (e) {
8
- e.preventDefault();
9
- $.ajax(
10
- {
11
- url: ajaxurl,
12
- type: "POST",
13
- data: {
14
- action: 'lc_review_dismiss'
15
- }
16
- }
17
- );
18
- dismissButton.click();
19
- }
20
- );
21
- $( "#lc-review-postpone" ).click(
22
- function (e) {
23
- e.preventDefault();
24
- $.ajax(
25
- {
26
- url: ajaxurl,
27
- type: "POST",
28
- data: {
29
- action: 'lc_review_postpone'
30
- }
31
- }
32
- );
33
- dismissButton.click();
34
- }
35
- );
36
- $( "#lc-review-now" ).click(
37
- function () {
38
- $.ajax(
39
- {
40
- url: ajaxurl,
41
- type: "POST",
42
- data: {
43
- action: 'lc_review_dismiss'
44
- }
45
- }
46
- );
47
- dismissButton.click();
48
- }
49
- );
50
- }
51
- )
52
- })( jQuery );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
plugin_files/js/livechat.js CHANGED
@@ -1,16 +1,10 @@
1
- (function($)
2
- {
3
- var LiveChat =
4
- {
5
- slug: 'wp-live-chat-software-for-wordpress',
6
  buttonLoaderHtml:
7
- '<div class="lc-loader-wrapper lc-btn__loader"><div class="lc-loader-spinner-wrapper lc-loader-spinner-wrapper--small"><div class="lc-loader-spinner lc-loader-spinner--thin" /></div></div>',
8
- init: function()
9
- {
10
- this.signInWithLiveChat();
11
- this.bindDisconnect();
12
  this.openAgentAppInNewTab();
13
- this.hideInstalledNotification();
14
  this.connectNoticeButtonHandler();
15
  this.deactivationModalOpenHandler();
16
  this.deactivationModalCloseHandler();
@@ -23,126 +17,9 @@
23
  tmpDiv.textContent = str;
24
  return tmpDiv.innerHTML;
25
  },
26
- bindEvent: function(element, eventName, eventHandler) {
27
- if (element.addEventListener) {
28
- element.addEventListener( eventName, eventHandler, false );
29
- } else if (element.attachEvent) {
30
- element.attachEvent( 'on' + eventName, eventHandler );
31
- }
32
- },
33
- signInWithLiveChat: function () {
34
- var logoutButton = document.getElementById( 'resetAccount' ),
35
- iframeEl = document.getElementById( 'login-with-livechat' );
36
-
37
- LiveChat.bindEvent(
38
- window,
39
- 'message',
40
- function (e) {
41
- if (e.origin !== 'https://addons.livechatinc.com') {
42
- return false;
43
- }
44
-
45
- try {
46
- var lcDetails = JSON.parse( e.data );
47
- if (lcDetails.type === 'logged-in') {
48
- var licenseForm = $( 'form#licenseForm' );
49
- if (licenseForm.length) {
50
- licenseForm.find( 'input#licenseEmail' ).val( lcDetails.email );
51
- licenseForm.find( 'input#licenseNumber' ).val( lcDetails.license );
52
- LiveChat.sendEvent(
53
- 'Integrations: User authorized the app',
54
- lcDetails.license,
55
- lcDetails.email,
56
- function () {
57
- licenseForm.submit();
58
- }
59
- );
60
- }
61
- }
62
- } catch (e) {
63
- console.warn( e );
64
- }
65
- }
66
- );
67
-
68
- if (logoutButton) {
69
- LiveChat.bindEvent(
70
- logoutButton,
71
- 'click',
72
- function (e) {
73
- sendMessage( 'logout' );
74
- }
75
- );
76
- }
77
-
78
- var sendMessage = function(msg) {
79
- iframeEl.contentWindow.postMessage( msg, '*' );
80
- };
81
- },
82
- openAgentAppInNewTab: function() {
83
  $( "ul#adminmenu a[href='" + config.agentAppUrl + "']" ).attr( 'target', '_blank' );
84
  },
85
- bindDisconnect: function() {
86
- $( '#resetAccount' ).click(
87
- function (e) {
88
- e.preventDefault();
89
- LiveChat.sendEvent(
90
- 'Integrations: User unauthorized the app',
91
- lcDetails.license,
92
- lcDetails.email,
93
- function () {
94
- location.href = $( '#resetAccount' ).attr( 'href' );
95
- }
96
- );
97
- }
98
- );
99
- },
100
- sendEvent: function(eventName, license, email, callback) {
101
- var amplitudeURL = 'https://queue.livechatinc.com/app_event/';
102
- var data = {
103
- "e" : JSON.stringify(
104
- [{
105
- "event_type": eventName,
106
- "user_id": email,
107
- "user_properties": {
108
- "license": license
109
- },
110
- "product_name": "livechat",
111
- "event_properties": {
112
- "integration name": this.slug
113
- }
114
- }]
115
- )
116
- };
117
- $.ajax(
118
- {
119
- url: amplitudeURL,
120
- type: 'GET',
121
- crossOrigin: true,
122
- data: data
123
- }
124
- ).always(
125
- function () {
126
- if (callback) {
127
- callback();
128
- }
129
- }
130
- );
131
- },
132
- hideInstalledNotification: function () {
133
- var notificationElement = $( '.updated.installed' );
134
- $( '#installed-close' ).click(
135
- function () {
136
- notificationElement.slideUp();
137
- }
138
- );
139
- setTimeout(
140
- function () {
141
- notificationElement.slideUp();
142
- },
143
- 3000
144
- );
145
- },
146
  connectNoticeButtonHandler: function () {
147
  $( '#lc-connect-notice-button' ).click(
148
  function () {
@@ -166,7 +43,7 @@
166
  )
167
  }
168
  },
169
- deactivationModalOpenHandler: function() {
170
  var that = this;
171
  $( 'table.plugins tr[data-slug=' + that.slug + '] span.deactivate a' ).click(
172
  function (e) {
@@ -178,7 +55,7 @@
178
  }
179
  )
180
  },
181
- deactivationModalCloseHandler: function() {
182
  var that = this;
183
  var modalOverlay = $( '#lc-deactivation-feedback-modal-overlay' );
184
  modalOverlay.click(
@@ -212,7 +89,7 @@
212
  }
213
  )
214
  },
215
- sendFeedback: function(response, comment) {
216
  var that = this;
217
  response = response ? this.sanitize( response ) : 'skipped';
218
  comment = comment ? this.sanitize( comment ) : '';
@@ -221,7 +98,7 @@
221
 
222
  var deactivationDetails = window.deactivationDetails;
223
 
224
- if ( ! deactivationDetails ) {
225
  return redirectToDeactivation();
226
  }
227
 
@@ -245,7 +122,7 @@
245
  }
246
  );
247
  },
248
- deactivationFormSkipHandler: function() {
249
  var that = this;
250
  $( '#lc-deactivation-feedback-modal-skip-btn' ).click(
251
  function () {
@@ -287,10 +164,5 @@
287
  }
288
  };
289
 
290
- $( document ).ready(
291
- function()
292
- {
293
- LiveChat.init();
294
- }
295
- );
296
  })( jQuery );
1
+ (function ($) {
2
+ var LiveChat = {
3
+ slug: config.slug,
 
 
4
  buttonLoaderHtml:
5
+ '<div class="lc-loader-wrapper lc-btn__loader"><div class="lc-loader-spinner-wrapper lc-loader-spinner-wrapper--small"><div class="lc-loader-spinner lc-loader-spinner--thin" /></div></div>',
6
+ init: function () {
 
 
 
7
  this.openAgentAppInNewTab();
 
8
  this.connectNoticeButtonHandler();
9
  this.deactivationModalOpenHandler();
10
  this.deactivationModalCloseHandler();
17
  tmpDiv.textContent = str;
18
  return tmpDiv.innerHTML;
19
  },
20
+ openAgentAppInNewTab: function () {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  $( "ul#adminmenu a[href='" + config.agentAppUrl + "']" ).attr( 'target', '_blank' );
22
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  connectNoticeButtonHandler: function () {
24
  $( '#lc-connect-notice-button' ).click(
25
  function () {
43
  )
44
  }
45
  },
46
+ deactivationModalOpenHandler: function () {
47
  var that = this;
48
  $( 'table.plugins tr[data-slug=' + that.slug + '] span.deactivate a' ).click(
49
  function (e) {
55
  }
56
  )
57
  },
58
+ deactivationModalCloseHandler: function () {
59
  var that = this;
60
  var modalOverlay = $( '#lc-deactivation-feedback-modal-overlay' );
61
  modalOverlay.click(
89
  }
90
  )
91
  },
92
+ sendFeedback: function (response, comment) {
93
  var that = this;
94
  response = response ? this.sanitize( response ) : 'skipped';
95
  comment = comment ? this.sanitize( comment ) : '';
98
 
99
  var deactivationDetails = window.deactivationDetails;
100
 
101
+ if ( ! deactivationDetails) {
102
  return redirectToDeactivation();
103
  }
104
 
122
  }
123
  );
124
  },
125
+ deactivationFormSkipHandler: function () {
126
  var that = this;
127
  $( '#lc-deactivation-feedback-modal-skip-btn' ).click(
128
  function () {
164
  }
165
  };
166
 
167
+ $( document ).ready( LiveChat.init.bind( LiveChat ) );
 
 
 
 
 
168
  })( jQuery );
plugin_files/templates/chat_widget_script.html.twig ADDED
@@ -0,0 +1,2 @@
 
 
1
+ {{ customerTrackingScript }}
2
+ <script async type="text/javascript" src="{{ widgetUrl }}"></script>
plugin_files/templates/connect.html.twig CHANGED
@@ -8,9 +8,15 @@
8
  var USER_EMAIL = '{{ userEmail }}';
9
  var USER_NAME = '{{ userName }}'
10
  var WP_VER = '{{ wpVer }}';
 
11
  var MODULE_VER = '{{ moduleVer }}';
12
  var PARTNER_ID = '{{ partnerId }}';
13
  var UTM_CAMPAIGN = '{{ utmCampaign }}';
 
 
 
 
 
14
 
15
  (function () {
16
  var interval = setInterval(function () {
@@ -48,6 +54,18 @@
48
  });
49
  }
50
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  var eventsRegister = new AppBridge.EventsRegister();
52
  eventsRegister.register(AppBridge.UserSignedInEvent, function (data) {
53
  return userSignedInHandler(data.userToken, data.storeToken);
@@ -68,16 +86,20 @@
68
  return entityNotFound('user');
69
  }
70
  });
 
 
 
71
 
72
- AppBridge.AppBridgeParent.init('wordpress', eventsRegister, document.getElementById('lc-container'), '{{ appUrl }}').then(function (bridge) {
73
  document.getElementsByTagName('iframe')[0].classList.add('lc-iframe');
74
 
75
  if (LC_TOKEN) {
76
  return bridge.call(AppBridge.SignInCommand.fromObject({
77
  userToken: LC_TOKEN,
78
  platform: bridge.platform,
79
- platformVer: WP_VER,
80
- moduleVer: MODULE_VER
 
81
  }));
82
  }
83
 
@@ -87,7 +109,7 @@
87
  userId: USER_EMAIL,
88
  userName: USER_NAME,
89
  platform: bridge.platform,
90
- platformVer: WP_VER,
91
  moduleVer: MODULE_VER
92
  }));
93
  }
@@ -97,10 +119,12 @@
97
  userId: USER_EMAIL,
98
  userName: USER_NAME,
99
  platform: bridge.platform,
100
- platformVer: WP_VER,
101
  moduleVer: MODULE_VER,
102
  partnerId: PARTNER_ID,
103
- utmCampaign: UTM_CAMPAIGN
 
 
104
  }));
105
  });
106
  }, 100);
8
  var USER_EMAIL = '{{ userEmail }}';
9
  var USER_NAME = '{{ userName }}'
10
  var WP_VER = '{{ wpVer }}';
11
+ var EXTENSION_VER = '{{ extensionVer }}';
12
  var MODULE_VER = '{{ moduleVer }}';
13
  var PARTNER_ID = '{{ partnerId }}';
14
  var UTM_CAMPAIGN = '{{ utmCampaign }}';
15
+ var LICENSE = '{{ license }}';
16
+ var LEGACY_OPTIONS = '{{ legacyOptions }}';
17
+ var PLATFORM = '{{ platform }}';
18
+
19
+ var PLATFORM_VERSION = [WP_VER, EXTENSION_VER].filter(Boolean).join('#');
20
 
21
  (function () {
22
  var interval = setInterval(function () {
54
  });
55
  }
56
 
57
+ function parseOptions(options) {
58
+ try {
59
+ return JSON.parse(options);
60
+ } catch (e) {
61
+ return null;
62
+ }
63
+ }
64
+
65
+ function widgetScriptUpdated(widgetURL) {
66
+ return adminAjaxCall('lc_widget_script_updated', { widget_url: widgetURL });
67
+ }
68
+
69
  var eventsRegister = new AppBridge.EventsRegister();
70
  eventsRegister.register(AppBridge.UserSignedInEvent, function (data) {
71
  return userSignedInHandler(data.userToken, data.storeToken);
86
  return entityNotFound('user');
87
  }
88
  });
89
+ eventsRegister.register(AppBridge.WidgetScriptUpdatedEvent, function (data) {
90
+ return widgetScriptUpdated(data.widgetURL)
91
+ })
92
 
93
+ AppBridge.AppBridgeParent.init(PLATFORM, eventsRegister, document.getElementById('lc-container'), '{{ appUrl }}').then(function (bridge) {
94
  document.getElementsByTagName('iframe')[0].classList.add('lc-iframe');
95
 
96
  if (LC_TOKEN) {
97
  return bridge.call(AppBridge.SignInCommand.fromObject({
98
  userToken: LC_TOKEN,
99
  platform: bridge.platform,
100
+ platformVer: PLATFORM_VERSION,
101
+ moduleVer: MODULE_VER,
102
+ options: parseOptions(LEGACY_OPTIONS),
103
  }));
104
  }
105
 
109
  userId: USER_EMAIL,
110
  userName: USER_NAME,
111
  platform: bridge.platform,
112
+ platformVer: PLATFORM_VERSION,
113
  moduleVer: MODULE_VER
114
  }));
115
  }
119
  userId: USER_EMAIL,
120
  userName: USER_NAME,
121
  platform: bridge.platform,
122
+ platformVer: PLATFORM_VERSION,
123
  moduleVer: MODULE_VER,
124
  partnerId: PARTNER_ID,
125
+ utmCampaign: UTM_CAMPAIGN,
126
+ license: LICENSE,
127
+ options: parseOptions(LEGACY_OPTIONS),
128
  }));
129
  });
130
  }, 100);
plugin_files/templates/connect_notice.html.twig ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="lc-design-system-typography notice notice-info lc-notice" id="lc-connect-notice">
2
+ <div class="lc-notice-column">
3
+ <img class="lc-notice-logo" src="{{ lcNoticeLogoUrl }}" alt="LiveChat logo" />
4
+ </div>
5
+ <div class="lc-notice-column">
6
+ <p id="lc-connect-notice-header">
7
+ {{ noticeHeader }}
8
+ </p>
9
+ <p>
10
+ {{ paragraph1 }}
11
+ <a href="admin.php?page=livechat_settings">{{ paragraph2 }}</a>
12
+ {{ paragraph3 }}
13
+ </p>
14
+ </div>
15
+ <div class="lc-notice-column" id="lc-connect-notice-button-column">
16
+ <p>
17
+ <button class="lc-btn lc-btn--primary" id="lc-connect-notice-button" type="button">
18
+ {{ button }}
19
+ </button>
20
+ </p>
21
+ </div>
22
+ </div>
plugin_files/templates/customer_tracking.html.twig ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <script type="text/javascript">
2
+ window.__lc_connect = '{{ lcConnectJSON }}';
3
+ </script>
plugin_files/templates/deactivation_modal.html.twig ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="lc-design-system-typography lc-modal-base__overlay" id="lc-deactivation-feedback-modal-overlay" style="display: none">
2
+ <div class="lc-modal-base" id="lc-deactivation-feedback-modal-container">
3
+ <button title="{{ cancelButton }}" class="lc-modal-base__close">
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width="24px"
7
+ height="24px"
8
+ viewBox="0 0 24 24"
9
+ fill="#424D57"
10
+ class="material material-close-icon undefined"
11
+ >
12
+ <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" />
13
+ </svg>
14
+ </button>
15
+ <div class="lc-modal__header">
16
+ <div class="lc-modal__heading" id="lc-deactivation-feedback-modal-heading">
17
+ <img
18
+ id="lc-deactivation-feedback-logo"
19
+ alt="LiveChat logo"
20
+ src="{{ lcNoticeLogo }}"
21
+ />
22
+ <h2 id="lc-deactivation-feedback-modal-title">
23
+ {{ header }}
24
+ </h2>
25
+ </div>
26
+ </div>
27
+ <div class="lc-modal__body">
28
+ <form
29
+ action="#"
30
+ method="post"
31
+ id="lc-deactivation-feedback-form"
32
+ >
33
+ <div role="group" class="lc-form-group">
34
+ <div class="lc-form-group__header">
35
+ <div class="lc-form-group__label">
36
+ {{ description }}
37
+ </div>
38
+ </div>
39
+ <div class="lc-field-group">
40
+ <div class="lc-radio">
41
+ <label class="lc-radio__label">
42
+ <div class="lc-radio__circle">
43
+ <span class="lc-radio__inner-circle"></span>
44
+ <input
45
+ type="radio"
46
+ class="lc-radio__input"
47
+ value="I no longer need the plugin."
48
+ name="lc-deactivation-feedback-option"
49
+ />
50
+ </div>
51
+ <div class="lc-radio__text">
52
+ {{ reasonNoLongerNeed }}
53
+ </div>
54
+ </label>
55
+ </div>
56
+ <div class="lc-radio">
57
+ <label class="lc-radio__label">
58
+ <div class="lc-radio__circle">
59
+ <span class="lc-radio__inner-circle"></span>
60
+ <input
61
+ type="radio"
62
+ class="lc-radio__input"
63
+ value="I couldn't get the plugin to work."
64
+ name="lc-deactivation-feedback-option"
65
+ />
66
+ </div>
67
+ <div class="lc-radio__text">
68
+ {{ reasonDoesNotWork }}
69
+ </div>
70
+ </label>
71
+ </div>
72
+ <div class="lc-radio">
73
+ <label class="lc-radio__label">
74
+ <div class="lc-radio__circle">
75
+ <span class="lc-radio__inner-circle"></span>
76
+ <input
77
+ type="radio"
78
+ class="lc-radio__input"
79
+ value="I found a better plugin."
80
+ name="lc-deactivation-feedback-option"
81
+ />
82
+ </div>
83
+ <div class="lc-radio__text">
84
+ {{ reasonBetterPlugin }}
85
+ </div>
86
+ </label>
87
+ </div>
88
+ <div class="lc-radio">
89
+ <label class="lc-radio__label">
90
+ <div class="lc-radio__circle">
91
+ <span class="lc-radio__inner-circle"></span>
92
+ <input
93
+ type="radio"
94
+ class="lc-radio__input"
95
+ value="It's a temporary deactivation."
96
+ name="lc-deactivation-feedback-option"
97
+ />
98
+ </div>
99
+ <div class="lc-radio__text">
100
+ {{ reasonTemporaryDeactivation }}
101
+ </div>
102
+ </label>
103
+ </div>
104
+ <div class="lc-radio">
105
+ <label class="lc-radio__label">
106
+ <div class="lc-radio__circle">
107
+ <span class="lc-radio__inner-circle"></span>
108
+ <input
109
+ type="radio"
110
+ class="lc-radio__input"
111
+ value="Other"
112
+ name="lc-deactivation-feedback-option"
113
+ id="lc-deactivation-feedback-option-other"
114
+ />
115
+ </div>
116
+ <div class="lc-radio__text">
117
+ {{ reasonOther }}
118
+ </div>
119
+ </label>
120
+ </div>
121
+ <div class="lc-text-field" id="lc-deactivation-feedback-other-field">
122
+ <div>
123
+ <textarea
124
+ class="lc-textarea"
125
+ placeholder="{{ textPlaceholder }}"
126
+ ></textarea>
127
+ </div>
128
+ </div>
129
+ <span class="lc-field-error" id="lc-deactivation-feedback-form-option-error">
130
+ {{ options }}
131
+ </span>
132
+ <span class="lc-field-error" id="lc-deactivation-feedback-form-other-error">
133
+ {{ feedback }}
134
+ </span>
135
+ </div>
136
+ </div>
137
+ </form>
138
+ <script>
139
+ window.deactivationDetails = window.deactivationDetails || {};
140
+ window.deactivationDetails = {
141
+ license: {{ licenseNumber }},
142
+ name: '{{ name }}',
143
+ wpEmail: '{{ email }}'
144
+ };
145
+ </script>
146
+ </div>
147
+ <div class="lc-modal__footer">
148
+ <button class="lc-btn" id="lc-deactivation-feedback-modal-skip-btn">
149
+ {{ skipButton }}
150
+ </button>
151
+ <button class="lc-btn lc-btn--primary" id="lc-deactivation-feedback-modal-submit-btn">
152
+ {{ sendButton }}
153
+ </button>
154
+ </div>
155
+ </div>
156
+ </div>
plugin_files/templates/notice.html.twig ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="lc-notice-container" class="notice"></div>
2
+
3
+ <script src="https://cdn.polyfill.io/v3/polyfill.min.js?features=default,es6,fetch,Array.prototype.includes,Object.keys,Symbol.iterator&flags=gated" type="text/javascript"></script>
4
+ <script>
5
+ var LC_TOKEN = '{{ lcToken }}';
6
+ var STORE_TOKEN = '{{ storeToken }}';
7
+ var WP_VER = '{{ wpVer }}';
8
+ var WOO_VER = '{{ wooVer }}';
9
+ var MODULE_VER = '{{ moduleVer }}';
10
+ var PLATFORM = '{{ platform }}';
11
+ var OPTIONS = '{{ options }}';
12
+
13
+ var PLATFORM_VERSION = [WP_VER, WOO_VER].join('#');
14
+
15
+ (function () {
16
+ var interval = setInterval(function () {
17
+ if (window.AppBridge === undefined) {
18
+ return;
19
+ }
20
+ clearInterval(interval);
21
+
22
+ function parseOptions(options) {
23
+ try {
24
+ return JSON.parse(options);
25
+ } catch (e) {
26
+ return null;
27
+ }
28
+ }
29
+
30
+ function adminAjaxCall(action, data = {}, type = 'POST') {
31
+ return jQuery.ajax({
32
+ url: ajaxurl, //ajaxurl is WP global variable
33
+ type,
34
+ data: {
35
+ ...data,
36
+ action,
37
+ security: ajax_nonce.value
38
+ }
39
+ });
40
+ }
41
+
42
+ function reviewNoticeCleanup() {
43
+ if (optionsCleared) {
44
+ return;
45
+ }
46
+
47
+ adminAjaxCall('lc_review_notice_cleanup');
48
+ optionsCleared = true;
49
+ }
50
+
51
+ var container = document.getElementById('lc-notice-container');
52
+ var iframeId = 'lc-notice-iframe';
53
+ var optionsCleared = false;
54
+
55
+ var eventsRegister = new AppBridge.EventsRegister();
56
+
57
+ eventsRegister.register(AppBridge.NoticeFetchedEvent, function (data) {
58
+ var iframe = document.getElementById(iframeId);
59
+ container.style.height = `${data.maxHeight}px`;
60
+ iframe.style.height = `${data.maxHeight}px`;
61
+
62
+ reviewNoticeCleanup();
63
+ });
64
+
65
+ AppBridge.AppBridgeParent.init(PLATFORM, eventsRegister, container, '{{ noticeUrl }}').then(function (bridge) {
66
+ container.getElementsByTagName('iframe')[0].id = iframeId;
67
+ bridgeInstance = bridge;
68
+
69
+ return bridge.call(AppBridge.GetNoticeCommand.fromObject({
70
+ maxWidth: container.offsetWidth,
71
+ storeToken: STORE_TOKEN,
72
+ userToken: LC_TOKEN,
73
+ platform: bridge.platform,
74
+ platformVer: PLATFORM_VERSION,
75
+ moduleVer: MODULE_VER,
76
+ options: parseOptions(OPTIONS)
77
+ }));
78
+ });
79
+ }, 100);
80
+ })();
81
+ </script>
plugin_files/templates/plugins_conflict_notice.html.twig ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="lc-design-system-typography notice notice-info lc-notice lc-notice-plugin-conflict" id="lc-plugins-conflict-notice">
2
+ <div class="lc-notice-column">
3
+ <img class="lc-notice-logo" src="{{ lcNoticeLogoUrl }}" alt="LiveChat logo" />
4
+ </div>
5
+ <div class="lc-notice-column" style="flex: 1">
6
+ <p id="lc-plugins-conflict-notice-header">
7
+ {{ header1 }} <strong>{{ header2 }}</strong> {{ header3 }}
8
+ </p>
9
+ <p>
10
+ {{ notice1 }} <strong>{{ notice2 }}</strong> {{ notice3 }}
11
+ </p>
12
+ </div>
13
+ <div class="lc-notice-column" id="lc-plugins-conflict-notice-button-column" style="min-width: 150px">
14
+ <p>
15
+ <a href="{{ url }}">
16
+ <button class="lc-btn lc-btn--primary" id="lc-plugins-conflict-notice-button" type="button" style="min-width: 150px">
17
+ {{ button }}
18
+ </button>
19
+ </a>
20
+ </p>
21
+ </div>
22
+ </div>
plugin_files/templates/resources.html.twig CHANGED
@@ -1,9 +1,3 @@
1
  <div id="resources-container">
2
  <iframe src="{{ resourcesUrl }}"></iframe>
3
  </div>
4
-
5
- <script>
6
- if (document.getElementById('lc-connect-notice')) {
7
- document.getElementById('resources-container').style.height = '80vh';
8
- }
9
- </script>
1
  <div id="resources-container">
2
  <iframe src="{{ resourcesUrl }}"></iframe>
3
  </div>
 
 
 
 
 
 
plugin_files/templates/tracking_code.html.twig ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!-- Start of LiveChat (www.livechat.com) code -->
2
+ <script>
3
+ var LICENSE_NUMBER = '{{ licenseNumber }}';
4
+ var VISITOR_NAME = '{{ visitorName }}';
5
+ var VISITOR_EMAIL = '{{ visitorEmail }}';
6
+
7
+ window.__lc = window.__lc || {};
8
+ window.__lc.license = LICENSE_NUMBER;
9
+
10
+ window.__lc.visitor = {
11
+ name: VISITOR_NAME,
12
+ email: VISITOR_EMAIL
13
+ };
14
+
15
+ ;(function(n,t,c){function i(n){return e._h?e._h.apply(null,n):e._q.push(n)}var e={_q:[],_h:null,_v:"2.0",on:function(){i(["on",c.call(arguments)])},once:function(){i(["once",c.call(arguments)])},off:function(){i(["off",c.call(arguments)])},get:function(){if(!e._h)throw new Error("[LiveChatWidget] You can't use getters before load.");return i(["get",c.call(arguments)])},call:function(){i(["call",c.call(arguments)])},init:function(){var n=t.createElement("script");n.async=!0,n.type="text/javascript",n.src="https://cdn.livechatinc.com/tracking.js",t.head.appendChild(n)}};!n.__lc.asyncInit&&e.init(),n.LiveChatWidget=n.LiveChatWidget||e}(window,document,[].slice))
16
+ </script>
17
+ <noscript><a href="https://www.livechat.com/chat-with/{{ licenseNumber }}/" rel="nofollow">Chat with us</a>, powered by <a href="https://www.livechat.com/?welcome" rel="noopener nofollow" target="_blank">LiveChat</a></noscript>
18
+ <!-- End of LiveChat code -->
readme.txt CHANGED
@@ -1,14 +1,14 @@
1
  === LiveChat - WP live chat plugin for WordPress ===
2
  Contributors: LiveChat
3
  Tags: live chat, chat plugin, live chat plugin, wordpress live chat, wordpress chat,
4
- Stable tag: 4.4.3
5
  Requires PHP: 5.6
6
- Tested up to: 5.6
7
- Requires at least: 4.0
8
- License: GPLv2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Live chat and help desk software plugin for WordPress. Add LiveChat (live chat and help desk software) to your WordPress.
12
 
13
  == Description ==
14
 
@@ -24,13 +24,13 @@ https://www.youtube.com/watch?v=dKUdE-JKhZI
24
 
25
  LiveChat comes with a comprehensive set of features, **including proactive chat invitations** that allow agents to send personalized messages automatically. Trigger the invitations when a visitor meets predefined criteria, e.g. the number of visited pages or time spent on the website.
26
 
27
- Make customer service more efficient. Hold multiple chat sessions at the same time, send canned responses to frequently asked questions, tag your chats, and send files to customers through the chat widget.
28
 
29
  LiveChat comes with a **built-in ticketing system to provide customer support 24/7**. Collect the tickets with messages that customers leave when you’re away and answer them when you’re back online. The ticketing system will also help you manage and track the cases that are more time-consuming to solve and require more than a single chat.
30
 
31
  = Live Chat for WordPress website =
32
 
33
- One of the key things about LiveChat - WP live chat plugin for WordPress is that it is designed to work with any WordPress site builder - Elementor Page Builder, Page Builder by SiteOrigin, WordPress Page Builder – Beaver Builder, to name a few.
34
 
35
  In addition, this WordPress plugin works well with any WordPress theme or WordPress template you may use without requiring any modifications.
36
 
@@ -64,7 +64,7 @@ Add a live chat widget to every page of your website, including the checkout pag
64
 
65
  = Requirements =
66
 
67
- The WordPress Live Chat Plugin by LiveChat is free, but you need to be a LiveChat customer. LiveChat comes with a free trial, allowing you to [test the service for 14 days](https://www.livechat.com/try-livechat/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration).
68
 
69
  Test the features available in the Team plan by default, including a ticketing system, unlimited chats, chat triggers, and full widget customization.
70
 
@@ -76,9 +76,9 @@ Take a look at LiveChat plans and features on our [website](https://www.livechat
76
 
77
  LiveChat – WP live chat plugin for WordPress is a fully translation-ready plugin. You can translate the plugin into any language on [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/wp-live-chat-software-for-wordpress/).
78
 
79
- = Notes =
80
 
81
- You want to open a LiveChat account for a client? Expand your business offer by adding LiveChat in projects you run for your customers.
82
 
83
  [Check our Partner Program](https://partners.livechat.com/?utm_source=wordpress.org&utm_medium=referral&utm_campaign=wordpress_listing)
84
 
@@ -89,14 +89,14 @@ You want to open a LiveChat account for a client? Expand your business offer by
89
  - **Chat via a direct live chat link** – invite customers to chat by sending a link in your emails, social media, or website.
90
  - **Canned responses** – improve your efficiency and help customers faster thanks to predefined answers to the most common questions.
91
  - **Chat widget customization** – enrich your chat widget with neatly looking eye-catchers, chat buttons, and more. Choose a theme, pick a color, display your logo, and add a lot more tweaks to your chat widget.
92
- - **File upload support** – send and receive files via the live chat widget to better understand your customers.
93
  - **Support and agent ratings** – get a better understanding of visitor satisfaction by allowing them to rate a chat during or after the live chat session.
94
  - **Visitor tracking** – our live chat widget keeps track of your customers' location and shows what page they are on, where they are from, and more.
95
- - **Ticket form** – collect the tickets with messages that customers leave when you’re away and answer them when you’re back online.
96
  - **Chat surveys** - add surveys to the live chat window and gather customer information and insights at the beginning and end of each chat.
97
  - **Multi-channel communications** – provide instant customer service across several channels: a chat widget on your website, Messenger, Apple Business Chat, and more.
98
  - **Chat log and data exporting** – browse through comments reflecting customers' needs and expectations. Store, access, and export messages at any time using our API.
99
- - **Mobile apps** – chat on the go. Don't make your customers wait and talk to them wherever you are, thanks to our iOS and Android apps.
100
  - **Reports and analytics** – optimize the communication with your visitors thanks to the built-in live chat and ticket metrics. Access reports through the API and export gathered data to the CSV format.
101
  - **Chat assignment** – assign conversations to the available agents automatically. Alternatively, they can go straight to the queue, and it is up to you and your team to decide when to pick them up.
102
  - **Tags and keywords** – organize and categorize chats to find common issues and questions.
@@ -109,7 +109,7 @@ https://www.youtube.com/watch?v=w-tO_H5qCTk
109
 
110
  That's not all. Check out [more features](https://www.livechat.com/features/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration) that will help you close more sales and increase customer satisfaction.
111
 
112
- == Multilingual live chat plugin ==
113
 
114
  Adjusting the language of your chat window to the language of your website is a critical step of the customization. We translated LiveChat into 45 languages:
115
 
@@ -214,7 +214,7 @@ We do. Try out all features of our live chat plugin for free for 14 days.
214
  = Are there any limitations during the trial period? =
215
  There are no limitations. Test all of the features available in the Team plan by default.
216
 
217
- = Is it required to install any additional software to use LiveChat? =
218
  No. LiveChat works in a Software as a Service model and doesn’t require any extra service to work.
219
 
220
  = Do you provide live chat support? =
@@ -226,7 +226,7 @@ Yes, you can add our live chat widget to any website using JavaScript.
226
  = How many website visitors can contact me via this live chat plugin in real time? =
227
  One agent can handle up to 99 chats at the same time.
228
 
229
- = What e-commerce platforms does LiveChat integrate with? =
230
  Currently, we integrate with BigCommerce, Shopify, Volusion, Big Cartel, Magento 1, Magento 2, 3dcart, Commerce V3, CoreCommerce, CS-Cart, Easy Digital Downloads (EDD), Ecwid, ekmPowershop, Shoplo, Miva, OpenCart, osCommerce, PrestaShop, SITE123, AmeriCommerce, Wix, WooCommerce, X-Cart, Zen Cart, VirtueMart, nopCommerce, Zoey, Jumpseller, NetSuite SuiteCommerce, and Renderforest.
231
 
232
  = I am logged in. How do I start? =
@@ -259,11 +259,11 @@ You can use three different categories, each serving a different purpose: the ow
259
  = Can I disable the live chat widget on mobile devices? =
260
  It is possible to prevent the live chat window from popping up on mobile devices.
261
 
262
- = What can I customize in the live chat dashboard? =
263
  You can customize a range of features, like the [live chat surveys](https://www.livechat.com/kb/chat-surveys/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration), [live chat theme](https://www.livechat.com/kb/chat-window-customization/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration), [live chat buttons](https://www.livechat.com/kb/chat-button-guide/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration), [live chat greetings](https://www.livechat.com/kb/why-should-i-set-up-chat-greetings/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration), [live chat canned responses](https://www.livechat.com/kb/canned-responses/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration), [live chat tags](https://www.livechat.com/kb/tagging-chats-and-tickets/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration) and and some other advanced live chat settings.
264
 
265
  = How does the live chat app work after hours? =
266
- When you go offline, your live chat widget is replaced with a ticket form. It means that visitors can still leave you questions as tickets. To manage tickets you need to log into your live chat app.
267
 
268
  = How to personalize my live chat avatar? =
269
  To change your live chat avatar, navigate to the "Agents" section, pick your account, and click "Edit." You can also edit the name and title for your avatar.
@@ -272,10 +272,10 @@ To change your live chat avatar, navigate to the "Agents" section, pick your acc
272
  Yes. Use our live chat to monitor multiple websites using a single account, and customize the look of the live chat widget individually for each website.
273
 
274
  = Can I have my customers include their contact details when they are asking for support? =
275
- Sure, you can use the pre-chat survey at the beginning of each live chat to collect relevant information, such as an email address or phone number.
276
 
277
  = How can I get notified of incoming live chats? =
278
- There are sound and visual notifications available to make sure that no chat or message goes unnoticed.
279
 
280
  = Can I live chat with customers on my mobile? =
281
  With our [mobile live chat apps](https://www.livechat.com/kb/stay-mobile-with-livechat/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration) for iPhone, iPad and Android you can chat everywhere: in a car, at home or while shopping.
@@ -286,10 +286,10 @@ They are all stored in the Archives section inside the LiveChat dashboard.
286
  = Is there an option to delete some of the live chat transcripts from Archives? =
287
  You have to contact our support team. They will be more than happy to help you with that.
288
 
289
- = Can I add live chat to Facebook? =
290
  You can add a live chat option to your Facebook page that will open a whole new channel for your customers. Read more about the LiveChat [integration with Facebook](https://www.livechat.com/kb/adding-live-chat-to-facebook/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration).
291
 
292
- = Can live chat agents help one another when chatting with customers? =
293
  Yes, they can transfer chats to other live chat agents. Additionally, each ongoing chat can be supervised in real-time for coaching purposes. Read more on the transfers and supervision features [here](https://www.livechat.com/kb/in-chat-cooperation-transfers-and-supervision/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration).
294
 
295
  = Can I deactivate my live chat widget momentarily without having to remove the plugin? =
@@ -316,10 +316,10 @@ Sure - head over to our [website](https://www.livechat.com/resources/?utm_source
316
  = Do you have any reviews from your customers I could check? =
317
  Here are some [live chat reviews](https://www.livechat.com/customers/live-chat-reviews/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration) our customers sent us.
318
 
319
- = I love LiveChat. How can I promote it? =
320
  Feel free to leave us a review. Your feedback is crucial because it helps others discover our live chat software.
321
 
322
- = How do I learn more about LiveChat and your live chat plugin? =
323
  Navigate to our [website](https://www.livechat.com/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration) and start a live chat with us!
324
 
325
 
@@ -333,7 +333,7 @@ Navigate to our [website](https://www.livechat.com/?utm_source=wordpress.org&utm
333
  4. Click the `LiveChat` menu on the left.
334
  5. Create a new account or sign-in if you already have a LiveChat account.
335
 
336
- = Manual Installation =
337
 
338
  1. Upload `wp-live-chat-software-for-wordpress` directory to WordPress plugins directory (`/wp-content/plugins/`).
339
  2. Activate the live chat plugin through the `Plugins` menu in WordPress.
@@ -352,6 +352,11 @@ For more detailed instructions, go to the [live chat plugin page](https://www.li
352
 
353
  == Changelog ==
354
 
 
 
 
 
 
355
  = 4.4.3 =
356
  * bug fixes
357
 
@@ -376,42 +381,3 @@ For more detailed instructions, go to the [live chat plugin page](https://www.li
376
  = 4.3.0 =
377
  * bug fixes
378
  * disconnect option added
379
-
380
- = 4.2.3 =
381
- * plugin activation hook fix
382
-
383
- = 4.2.2 =
384
- * docs update
385
-
386
- = 4.2.1 =
387
- * docs update
388
-
389
- = 4.2.0 =
390
- * LiveChat rebranding updates
391
- * refreshed 'Resources' section
392
- * 'Go to LiveChat' link in sidebar menu
393
- * improvements of signup/signin flow
394
-
395
- = 4.1.5 =
396
- * UI improvements
397
-
398
- = 4.1.4 =
399
- * update of dependencies
400
-
401
- = 4.1.3 =
402
- * bug fixes
403
-
404
- = 4.1.2 =
405
- * CSS improvements
406
-
407
- = 4.1.1 =
408
- * bug fixes
409
-
410
- = 4.1.0 =
411
- * 'Resources' section added
412
- * bug fixes
413
-
414
- = 4.0.0 =
415
- * revised in-admin signup/login page view
416
- * introducing a new way of creating accounts in LiveChat
417
- * added the possibility of creating or logging into a LiveChat account to all users in WordPress
1
  === LiveChat - WP live chat plugin for WordPress ===
2
  Contributors: LiveChat
3
  Tags: live chat, chat plugin, live chat plugin, wordpress live chat, wordpress chat,
4
+ Stable tag: 4.4.4
5
  Requires PHP: 5.6
6
+ Tested up to: 5.7
7
+ Requires at least: 4.4
8
+ License: GPLv3 or later
9
+ License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
11
+ Live chat and help desk software plugin for WordPress. Add LiveChat (live chat and help desk software) to your WordPress.
12
 
13
  == Description ==
14
 
24
 
25
  LiveChat comes with a comprehensive set of features, **including proactive chat invitations** that allow agents to send personalized messages automatically. Trigger the invitations when a visitor meets predefined criteria, e.g. the number of visited pages or time spent on the website.
26
 
27
+ Make customer service more efficient. Hold multiple chat sessions at the same time, send canned responses to frequently asked questions, tag your chats, and send files to customers through the chat widget.
28
 
29
  LiveChat comes with a **built-in ticketing system to provide customer support 24/7**. Collect the tickets with messages that customers leave when you’re away and answer them when you’re back online. The ticketing system will also help you manage and track the cases that are more time-consuming to solve and require more than a single chat.
30
 
31
  = Live Chat for WordPress website =
32
 
33
+ One of the key things about LiveChat - WP live chat plugin for WordPress is that it is designed to work with any WordPress site builder - Elementor Page Builder, Page Builder by SiteOrigin, WordPress Page Builder – Beaver Builder, to name a few.
34
 
35
  In addition, this WordPress plugin works well with any WordPress theme or WordPress template you may use without requiring any modifications.
36
 
64
 
65
  = Requirements =
66
 
67
+ The WordPress Live Chat Plugin by LiveChat is free, but you need to be a LiveChat customer. LiveChat comes with a free trial, allowing you to [test the service for 14 days](https://www.livechat.com/try-livechat/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration).
68
 
69
  Test the features available in the Team plan by default, including a ticketing system, unlimited chats, chat triggers, and full widget customization.
70
 
76
 
77
  LiveChat – WP live chat plugin for WordPress is a fully translation-ready plugin. You can translate the plugin into any language on [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/wp-live-chat-software-for-wordpress/).
78
 
79
+ = Notes =
80
 
81
+ You want to open a LiveChat account for a client? Expand your business offer by adding LiveChat in projects you run for your customers.
82
 
83
  [Check our Partner Program](https://partners.livechat.com/?utm_source=wordpress.org&utm_medium=referral&utm_campaign=wordpress_listing)
84
 
89
  - **Chat via a direct live chat link** – invite customers to chat by sending a link in your emails, social media, or website.
90
  - **Canned responses** – improve your efficiency and help customers faster thanks to predefined answers to the most common questions.
91
  - **Chat widget customization** – enrich your chat widget with neatly looking eye-catchers, chat buttons, and more. Choose a theme, pick a color, display your logo, and add a lot more tweaks to your chat widget.
92
+ - **File upload support** – send and receive files via the live chat widget to better understand your customers.
93
  - **Support and agent ratings** – get a better understanding of visitor satisfaction by allowing them to rate a chat during or after the live chat session.
94
  - **Visitor tracking** – our live chat widget keeps track of your customers' location and shows what page they are on, where they are from, and more.
95
+ - **Ticket form** – collect the tickets with messages that customers leave when you’re away and answer them when you’re back online.
96
  - **Chat surveys** - add surveys to the live chat window and gather customer information and insights at the beginning and end of each chat.
97
  - **Multi-channel communications** – provide instant customer service across several channels: a chat widget on your website, Messenger, Apple Business Chat, and more.
98
  - **Chat log and data exporting** – browse through comments reflecting customers' needs and expectations. Store, access, and export messages at any time using our API.
99
+ - **Mobile apps** – chat on the go. Don't make your customers wait and talk to them wherever you are, thanks to our iOS and Android apps.
100
  - **Reports and analytics** – optimize the communication with your visitors thanks to the built-in live chat and ticket metrics. Access reports through the API and export gathered data to the CSV format.
101
  - **Chat assignment** – assign conversations to the available agents automatically. Alternatively, they can go straight to the queue, and it is up to you and your team to decide when to pick them up.
102
  - **Tags and keywords** – organize and categorize chats to find common issues and questions.
109
 
110
  That's not all. Check out [more features](https://www.livechat.com/features/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration) that will help you close more sales and increase customer satisfaction.
111
 
112
+ == Multilingual live chat plugin ==
113
 
114
  Adjusting the language of your chat window to the language of your website is a critical step of the customization. We translated LiveChat into 45 languages:
115
 
214
  = Are there any limitations during the trial period? =
215
  There are no limitations. Test all of the features available in the Team plan by default.
216
 
217
+ = Is it required to install any additional software to use LiveChat? =
218
  No. LiveChat works in a Software as a Service model and doesn’t require any extra service to work.
219
 
220
  = Do you provide live chat support? =
226
  = How many website visitors can contact me via this live chat plugin in real time? =
227
  One agent can handle up to 99 chats at the same time.
228
 
229
+ = What e-commerce platforms does LiveChat integrate with? =
230
  Currently, we integrate with BigCommerce, Shopify, Volusion, Big Cartel, Magento 1, Magento 2, 3dcart, Commerce V3, CoreCommerce, CS-Cart, Easy Digital Downloads (EDD), Ecwid, ekmPowershop, Shoplo, Miva, OpenCart, osCommerce, PrestaShop, SITE123, AmeriCommerce, Wix, WooCommerce, X-Cart, Zen Cart, VirtueMart, nopCommerce, Zoey, Jumpseller, NetSuite SuiteCommerce, and Renderforest.
231
 
232
  = I am logged in. How do I start? =
259
  = Can I disable the live chat widget on mobile devices? =
260
  It is possible to prevent the live chat window from popping up on mobile devices.
261
 
262
+ = What can I customize in the live chat dashboard? =
263
  You can customize a range of features, like the [live chat surveys](https://www.livechat.com/kb/chat-surveys/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration), [live chat theme](https://www.livechat.com/kb/chat-window-customization/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration), [live chat buttons](https://www.livechat.com/kb/chat-button-guide/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration), [live chat greetings](https://www.livechat.com/kb/why-should-i-set-up-chat-greetings/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration), [live chat canned responses](https://www.livechat.com/kb/canned-responses/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration), [live chat tags](https://www.livechat.com/kb/tagging-chats-and-tickets/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration) and and some other advanced live chat settings.
264
 
265
  = How does the live chat app work after hours? =
266
+ When you go offline, your live chat widget is replaced with a ticket form. It means that visitors can still leave you questions as tickets. To manage tickets you need to log into your live chat app.
267
 
268
  = How to personalize my live chat avatar? =
269
  To change your live chat avatar, navigate to the "Agents" section, pick your account, and click "Edit." You can also edit the name and title for your avatar.
272
  Yes. Use our live chat to monitor multiple websites using a single account, and customize the look of the live chat widget individually for each website.
273
 
274
  = Can I have my customers include their contact details when they are asking for support? =
275
+ Sure, you can use the pre-chat survey at the beginning of each live chat to collect relevant information, such as an email address or phone number.
276
 
277
  = How can I get notified of incoming live chats? =
278
+ There are sound and visual notifications available to make sure that no chat or message goes unnoticed.
279
 
280
  = Can I live chat with customers on my mobile? =
281
  With our [mobile live chat apps](https://www.livechat.com/kb/stay-mobile-with-livechat/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration) for iPhone, iPad and Android you can chat everywhere: in a car, at home or while shopping.
286
  = Is there an option to delete some of the live chat transcripts from Archives? =
287
  You have to contact our support team. They will be more than happy to help you with that.
288
 
289
+ = Can I add live chat to Facebook? =
290
  You can add a live chat option to your Facebook page that will open a whole new channel for your customers. Read more about the LiveChat [integration with Facebook](https://www.livechat.com/kb/adding-live-chat-to-facebook/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration).
291
 
292
+ = Can live chat agents help one another when chatting with customers? =
293
  Yes, they can transfer chats to other live chat agents. Additionally, each ongoing chat can be supervised in real-time for coaching purposes. Read more on the transfers and supervision features [here](https://www.livechat.com/kb/in-chat-cooperation-transfers-and-supervision/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration).
294
 
295
  = Can I deactivate my live chat widget momentarily without having to remove the plugin? =
316
  = Do you have any reviews from your customers I could check? =
317
  Here are some [live chat reviews](https://www.livechat.com/customers/live-chat-reviews/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration) our customers sent us.
318
 
319
+ = I love LiveChat. How can I promote it? =
320
  Feel free to leave us a review. Your feedback is crucial because it helps others discover our live chat software.
321
 
322
+ = How do I learn more about LiveChat and your live chat plugin? =
323
  Navigate to our [website](https://www.livechat.com/?utm_source=wordpress.org&utm_medium=integration&utm_campaign=WordpressIntegration) and start a live chat with us!
324
 
325
 
333
  4. Click the `LiveChat` menu on the left.
334
  5. Create a new account or sign-in if you already have a LiveChat account.
335
 
336
+ = Manual Installation =
337
 
338
  1. Upload `wp-live-chat-software-for-wordpress` directory to WordPress plugins directory (`/wp-content/plugins/`).
339
  2. Activate the live chat plugin through the `Plugins` menu in WordPress.
352
 
353
  == Changelog ==
354
 
355
+ = 4.4.4 =
356
+ * asynchronous chat widget loading
357
+ * support for the new admin notices mechanism
358
+ * WordPress 5.7 compatibility check
359
+
360
  = 4.4.3 =
361
  * bug fixes
362
 
381
  = 4.3.0 =
382
  * bug fixes
383
  * disconnect option added
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit8c4cc7cb7b7f1a240155ea0b65423ac9::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInita679062790a12b21d3b8605f99cd1fb8::getLoader();
vendor/composer/autoload_classmap.php CHANGED
@@ -13,30 +13,109 @@ return array(
13
  'LiveChat\\Exceptions\\ErrorCodes' => $baseDir . '/plugin_files/Exceptions/ErrorCode.class.php',
14
  'LiveChat\\Exceptions\\HttpClientException' => $baseDir . '/plugin_files/Exceptions/HttpClientException.class.php',
15
  'LiveChat\\Exceptions\\InvalidTokenException' => $baseDir . '/plugin_files/Exceptions/InvalidTokenException.class.php',
16
- 'LiveChat\\Helpers\\ConfirmIdentityNoticeHelper' => $baseDir . '/plugin_files/Helpers/ConfirmIdentityNoticeHelper.class.php',
17
- 'LiveChat\\Helpers\\ConnectNoticeHelper' => $baseDir . '/plugin_files/Helpers/ConnectNoticeHelper.class.php',
18
- 'LiveChat\\Helpers\\ConnectServiceHelper' => $baseDir . '/plugin_files/Helpers/ConnectServiceHelper.class.php',
19
- 'LiveChat\\Helpers\\DeactivationFeedbackFormHelper' => $baseDir . '/plugin_files/Helpers/DeactivationFeedbackFormHelper.class.php',
20
- 'LiveChat\\Helpers\\LiveChatHelper' => $baseDir . '/plugin_files/Helpers/LiveChatHelper.class.php',
21
- 'LiveChat\\Helpers\\ResourcesTabHelper' => $baseDir . '/plugin_files/Helpers/ResourcesTabHelper.class.php',
22
- 'LiveChat\\Helpers\\ReviewNoticeHelper' => $baseDir . '/plugin_files/Helpers/ReviewNoticeHelper.class.php',
23
- 'LiveChat\\Helpers\\TrackingCodeHelper' => $baseDir . '/plugin_files/Helpers/TrackingCodeHelper.class.php',
24
  'LiveChat\\LiveChat' => $baseDir . '/plugin_files/LiveChat.class.php',
25
  'LiveChat\\LiveChatAdmin' => $baseDir . '/plugin_files/LiveChatAdmin.class.php',
26
  'LiveChat\\Services\\ApiClient' => $baseDir . '/plugin_files/Services/ApiClient.class.php',
27
  'LiveChat\\Services\\ApiClientTest' => $baseDir . '/plugin_files/tests/services/ApiClientTest.class.php',
28
  'LiveChat\\Services\\CertProvider' => $baseDir . '/plugin_files/Services/CertProvider.class.php',
29
  'LiveChat\\Services\\CertProviderTest' => $baseDir . '/plugin_files/tests/services/CertProviderTest.class.php',
 
 
30
  'LiveChat\\Services\\ConnectToken' => $baseDir . '/plugin_files/Services/ConnectToken.class.php',
31
  'LiveChat\\Services\\ConnectTokenProvider' => $baseDir . '/plugin_files/Services/ConnectTokenProvider.class.php',
32
  'LiveChat\\Services\\ConnectTokenProviderTest' => $baseDir . '/plugin_files/tests/services/ConnectTokenProviderTest.class.php',
33
  'LiveChat\\Services\\ConnectTokenTest' => $baseDir . '/plugin_files/tests/services/ConnectTokenTest.class.php',
 
 
 
 
 
 
 
 
34
  'LiveChat\\Services\\MockData' => $baseDir . '/plugin_files/tests/services/UserTest.class.php',
35
  'LiveChat\\Services\\ModuleConfiguration' => $baseDir . '/plugin_files/Services/ModuleConfiguration.class.php',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  'LiveChat\\Services\\Store' => $baseDir . '/plugin_files/Services/Store.class.php',
37
  'LiveChat\\Services\\StoreTest' => $baseDir . '/plugin_files/tests/services/StoreTest.class.php',
38
  'LiveChat\\Services\\TemplateParser' => $baseDir . '/plugin_files/Services/TemplateParser.class.php',
39
  'LiveChat\\Services\\TemplateParserTest' => $baseDir . '/plugin_files/tests/services/TemplateParserTest.class.php',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  'LiveChat\\Services\\TokenValidator' => $baseDir . '/plugin_files/Services/TokenValidator.class.php',
41
  'LiveChat\\Services\\TokenValidatorTest' => $baseDir . '/plugin_files/tests/services/TokenValidatorTest.class.php',
42
  'LiveChat\\Services\\UrlProvider' => $baseDir . '/plugin_files/Services/UrlProvider.class.php',
@@ -44,4 +123,8 @@ return array(
44
  'LiveChat\\Services\\User' => $baseDir . '/plugin_files/Services/User.class.php',
45
  'LiveChat\\Services\\UserTest' => $baseDir . '/plugin_files/tests/services/UserTest.class.php',
46
  'LiveChat\\Services\\WP_Error' => $baseDir . '/plugin_files/tests/services/ApiClientTest.class.php',
 
 
 
 
47
  );
13
  'LiveChat\\Exceptions\\ErrorCodes' => $baseDir . '/plugin_files/Exceptions/ErrorCode.class.php',
14
  'LiveChat\\Exceptions\\HttpClientException' => $baseDir . '/plugin_files/Exceptions/HttpClientException.class.php',
15
  'LiveChat\\Exceptions\\InvalidTokenException' => $baseDir . '/plugin_files/Exceptions/InvalidTokenException.class.php',
 
 
 
 
 
 
 
 
16
  'LiveChat\\LiveChat' => $baseDir . '/plugin_files/LiveChat.class.php',
17
  'LiveChat\\LiveChatAdmin' => $baseDir . '/plugin_files/LiveChatAdmin.class.php',
18
  'LiveChat\\Services\\ApiClient' => $baseDir . '/plugin_files/Services/ApiClient.class.php',
19
  'LiveChat\\Services\\ApiClientTest' => $baseDir . '/plugin_files/tests/services/ApiClientTest.class.php',
20
  'LiveChat\\Services\\CertProvider' => $baseDir . '/plugin_files/Services/CertProvider.class.php',
21
  'LiveChat\\Services\\CertProviderTest' => $baseDir . '/plugin_files/tests/services/CertProviderTest.class.php',
22
+ 'LiveChat\\Services\\ConfirmIdentityNoticeTest' => $baseDir . '/plugin_files/tests/services/notifications/ConfirmIdentityNoticeTest.class.php',
23
+ 'LiveChat\\Services\\ConnectNoticeTest' => $baseDir . '/plugin_files/tests/services/notifications/ConnectNoticeTest.class.php',
24
  'LiveChat\\Services\\ConnectToken' => $baseDir . '/plugin_files/Services/ConnectToken.class.php',
25
  'LiveChat\\Services\\ConnectTokenProvider' => $baseDir . '/plugin_files/Services/ConnectTokenProvider.class.php',
26
  'LiveChat\\Services\\ConnectTokenProviderTest' => $baseDir . '/plugin_files/tests/services/ConnectTokenProviderTest.class.php',
27
  'LiveChat\\Services\\ConnectTokenTest' => $baseDir . '/plugin_files/tests/services/ConnectTokenTest.class.php',
28
+ 'LiveChat\\Services\\DeactivationModalTest' => $baseDir . '/plugin_files/tests/services/notifications/DeactivationModalTest.class.php',
29
+ 'LiveChat\\Services\\Factories\\ApiClientFactory' => $baseDir . '/plugin_files/Services/Factories/ApiClientFactory.class.php',
30
+ 'LiveChat\\Services\\Factories\\ConnectTokenProviderFactory' => $baseDir . '/plugin_files/Services/Factories/ConnectTokenProviderFactory.class.php',
31
+ 'LiveChat\\Services\\Factories\\UrlProviderFactory' => $baseDir . '/plugin_files/Services/Factories/UrlProviderFactory.class.php',
32
+ 'LiveChat\\Services\\LicenseProvider' => $baseDir . '/plugin_files/Services/LicenseProvider.class.php',
33
+ 'LiveChat\\Services\\LicenseProviderTest' => $baseDir . '/plugin_files/tests/services/LicenseProviderTest.class.php',
34
+ 'LiveChat\\Services\\MenuProvider' => $baseDir . '/plugin_files/Services/MenuProvider.class.php',
35
+ 'LiveChat\\Services\\MenuProviderTest' => $baseDir . '/plugin_files/tests/services/MenuProviderTest.class.php',
36
  'LiveChat\\Services\\MockData' => $baseDir . '/plugin_files/tests/services/UserTest.class.php',
37
  'LiveChat\\Services\\ModuleConfiguration' => $baseDir . '/plugin_files/Services/ModuleConfiguration.class.php',
38
+ 'LiveChat\\Services\\NoticeTest' => $baseDir . '/plugin_files/tests/services/notifications/NoticeTest.class.php',
39
+ 'LiveChat\\Services\\NotificationTest' => $baseDir . '/plugin_files/tests/services/notifications/NotificationTest.class.php',
40
+ 'LiveChat\\Services\\NotificationsRenderer' => $baseDir . '/plugin_files/Services/NotificationsRenderer.class.php',
41
+ 'LiveChat\\Services\\NotificationsRendererTest' => $baseDir . '/plugin_files/tests/services/NotificationsRendererTest.class.php',
42
+ 'LiveChat\\Services\\Notifications\\ConfirmIdentityNotice' => $baseDir . '/plugin_files/Services/Notifications/ConfirmIdentityNotice.class.php',
43
+ 'LiveChat\\Services\\Notifications\\ConnectNotice' => $baseDir . '/plugin_files/Services/Notifications/ConnectNotice.class.php',
44
+ 'LiveChat\\Services\\Notifications\\DeactivationModal' => $baseDir . '/plugin_files/Services/Notifications/DeactivationModal.class.php',
45
+ 'LiveChat\\Services\\Notifications\\Notice' => $baseDir . '/plugin_files/Services/Notifications/Notice.class.php',
46
+ 'LiveChat\\Services\\Notifications\\Notification' => $baseDir . '/plugin_files/Services/Notifications/Notification.class.php',
47
+ 'LiveChat\\Services\\Options\\AuthorizedUsers' => $baseDir . '/plugin_files/Services/Options/AuthorizedUsers.class.php',
48
+ 'LiveChat\\Services\\Options\\AuthorizedUsersTest' => $baseDir . '/plugin_files/tests/services/options/AuthorizedUsersTest.class.php',
49
+ 'LiveChat\\Services\\Options\\Deprecated\\DeprecatedLicenseEmail' => $baseDir . '/plugin_files/Services/Options/Deprecated/DeprecatedLicenseEmail.class.php',
50
+ 'LiveChat\\Services\\Options\\Deprecated\\DeprecatedLicenseNumber' => $baseDir . '/plugin_files/Services/Options/Deprecated/DeprecatedLicenseNumber.class.php',
51
+ 'LiveChat\\Services\\Options\\Deprecated\\DeprecatedOption' => $baseDir . '/plugin_files/Services/Options/Deprecated/DeprecatedOption.class.php',
52
+ 'LiveChat\\Services\\Options\\Deprecated\\DeprecatedOptionTest' => $baseDir . '/plugin_files/tests/services/options/deprecated/DeprecatedOptionTest.class.php',
53
+ 'LiveChat\\Services\\Options\\Deprecated\\DeprecatedOptions' => $baseDir . '/plugin_files/Services/Options/Deprecated/DeprecatedOptions.class.php',
54
+ 'LiveChat\\Services\\Options\\Deprecated\\DeprecatedOptionsTest' => $baseDir . '/plugin_files/tests/services/options/deprecated/DeprecatedOptionsTest.class.php',
55
+ 'LiveChat\\Services\\Options\\Deprecated\\DeprecatedReviewNoticeDismissed' => $baseDir . '/plugin_files/Services/Options/Deprecated/DeprecatedReviewNoticeDismissed.class.php',
56
+ 'LiveChat\\Services\\Options\\Deprecated\\DeprecatedReviewNoticeOffset' => $baseDir . '/plugin_files/Services/Options/Deprecated/DeprecatedReviewNoticeOffset.class.php',
57
+ 'LiveChat\\Services\\Options\\Deprecated\\DeprecatedReviewNoticeOptions' => $baseDir . '/plugin_files/Services/Options/Deprecated/DeprecatedReviewNoticeOptions.class.php',
58
+ 'LiveChat\\Services\\Options\\Deprecated\\DeprecatedReviewNoticeTimestamp' => $baseDir . '/plugin_files/Services/Options/Deprecated/DeprecatedReviewNoticeTimestamp.class.php',
59
+ 'LiveChat\\Services\\Options\\Deprecated\\Widget\\DeprecatedWidgetSettings' => $baseDir . '/plugin_files/Services/Options/Deprecated/Widget/DeprecatedWidgetSettings.class.php',
60
+ 'LiveChat\\Services\\Options\\Deprecated\\Widget\\DeprecatedWidgetSettingsTest' => $baseDir . '/plugin_files/tests/services/options/deprecated/widget/DeprecatedWidgetSettingsTest.class.php',
61
+ 'LiveChat\\Services\\Options\\Deprecated\\Widget\\DeprecatedWidgetWooCommerceSettings' => $baseDir . '/plugin_files/Services/Options/Deprecated/Widget/DeprecatedWidgetWooCommerceSettings.class.php',
62
+ 'LiveChat\\Services\\Options\\Deprecated\\Widget\\DeprecatedWidgetWooCommerceSettingsTest' => $baseDir . '/plugin_files/tests/services/options/deprecated/widget/DeprecatedWidgetWooCommerceSettingsTest.class.php',
63
+ 'LiveChat\\Services\\Options\\Deprecated\\Widget\\DeprecatedWidgetWordPressDisableGuestsOption' => $baseDir . '/plugin_files/Services/Options/Deprecated/Widget/DeprecatedWidgetWordPressDisableGuestsOption.class.php',
64
+ 'LiveChat\\Services\\Options\\Deprecated\\Widget\\DeprecatedWidgetWordPressDisableMobileOption' => $baseDir . '/plugin_files/Services/Options/Deprecated/Widget/DeprecatedWidgetWordPressDisableMobileOption.class.php',
65
+ 'LiveChat\\Services\\Options\\Deprecated\\Widget\\DeprecatedWidgetWordPressSettings' => $baseDir . '/plugin_files/Services/Options/Deprecated/Widget/DeprecatedWidgetWordPressSettings.class.php',
66
+ 'LiveChat\\Services\\Options\\Deprecated\\Widget\\DeprecatedWidgetWordPressSettingsTest' => $baseDir . '/plugin_files/tests/services/options/deprecated/widget/DeprecatedWidgetWordPressSettingsTest.class.php',
67
+ 'LiveChat\\Services\\Options\\Option' => $baseDir . '/plugin_files/Services/Options/Option.class.php',
68
+ 'LiveChat\\Services\\Options\\OptionTestCase' => $baseDir . '/plugin_files/tests/services/options/OptionTestCase.php',
69
+ 'LiveChat\\Services\\Options\\OptionsSet' => $baseDir . '/plugin_files/Services/Options/OptionsSet.class.php',
70
+ 'LiveChat\\Services\\Options\\OptionsSetTest' => $baseDir . '/plugin_files/tests/services/options/OptionsSetTest.class.php',
71
+ 'LiveChat\\Services\\Options\\Platform' => $baseDir . '/plugin_files/Services/Options/Platform.class.php',
72
+ 'LiveChat\\Services\\Options\\PublicKey' => $baseDir . '/plugin_files/Services/Options/PublicKey.class.php',
73
+ 'LiveChat\\Services\\Options\\ReadableOption' => $baseDir . '/plugin_files/Services/Options/ReadableOption.class.php',
74
+ 'LiveChat\\Services\\Options\\ReadableOptionTest' => $baseDir . '/plugin_files/tests/services/options/ReadableOptionTest.class.php',
75
+ 'LiveChat\\Services\\Options\\ReviewNoticeDismissed' => $baseDir . '/plugin_files/Services/Options/ReviewNoticeDismissed.class.php',
76
+ 'LiveChat\\Services\\Options\\ReviewNoticeOffset' => $baseDir . '/plugin_files/Services/Options/ReviewNoticeOffset.class.php',
77
+ 'LiveChat\\Services\\Options\\ReviewNoticeOptions' => $baseDir . '/plugin_files/Services/Options/ReviewNoticeOptions.class.php',
78
+ 'LiveChat\\Services\\Options\\ReviewNoticeOptionsTest' => $baseDir . '/plugin_files/tests/services/options/ReviewNoticeOptionsTest.class.php',
79
+ 'LiveChat\\Services\\Options\\ReviewNoticeTimestamp' => $baseDir . '/plugin_files/Services/Options/ReviewNoticeTimestamp.class.php',
80
+ 'LiveChat\\Services\\Options\\SettingsOptions' => $baseDir . '/plugin_files/Services/Options/SettingsOptions.class.php',
81
+ 'LiveChat\\Services\\Options\\StoreToken' => $baseDir . '/plugin_files/Services/Options/StoreToken.class.php',
82
+ 'LiveChat\\Services\\Options\\Synchronized' => $baseDir . '/plugin_files/Services/Options/Synchronized.class.php',
83
+ 'LiveChat\\Services\\Options\\UserAuthOptions' => $baseDir . '/plugin_files/Services/Options/UserAuthOptions.class.php',
84
+ 'LiveChat\\Services\\Options\\UserOption' => $baseDir . '/plugin_files/Services/Options/UserOption.class.php',
85
+ 'LiveChat\\Services\\Options\\UserOptionTest' => $baseDir . '/plugin_files/tests/services/options/UserOptionTest.class.php',
86
+ 'LiveChat\\Services\\Options\\UserToken' => $baseDir . '/plugin_files/Services/Options/UserToken.class.php',
87
+ 'LiveChat\\Services\\Options\\WidgetURL' => $baseDir . '/plugin_files/Services/Options/WidgetURL.class.php',
88
+ 'LiveChat\\Services\\Options\\WooCommerce\\WooCommerceOption' => $baseDir . '/plugin_files/Services/Options/WooCommerce/WooCommerceOption.class.php',
89
+ 'LiveChat\\Services\\Options\\WooCommerce\\WooCommerceOptionTest' => $baseDir . '/plugin_files/tests/services/options/woocommerce/WooCommerceOptionTest.class.php',
90
+ 'LiveChat\\Services\\Options\\WooCommerce\\WooCommerceUserOption' => $baseDir . '/plugin_files/Services/Options/WooCommerce/WooCommerceUserOption.class.php',
91
+ 'LiveChat\\Services\\Options\\WooCommerce\\WooCommerceUserOptionTest' => $baseDir . '/plugin_files/tests/services/options/woocommerce/WooCommerceUserOptionTest.class.php',
92
+ 'LiveChat\\Services\\Options\\WritableOption' => $baseDir . '/plugin_files/Services/Options/WritableOption.class.php',
93
+ 'LiveChat\\Services\\Options\\WritableOptionTest' => $baseDir . '/plugin_files/tests/services/options/WritableOptionTest.class.php',
94
+ 'LiveChat\\Services\\PlatformProvider' => $baseDir . '/plugin_files/Services/PlatformProvider.class.php',
95
+ 'LiveChat\\Services\\PlatformProviderTest' => $baseDir . '/plugin_files/tests/services/PlatformProviderTest.class.php',
96
+ 'LiveChat\\Services\\SettingsProvider' => $baseDir . '/plugin_files/Services/SettingsProvider.class.php',
97
+ 'LiveChat\\Services\\SettingsProviderTest' => $baseDir . '/plugin_files/tests/services/SettingsProviderTest.class.php',
98
+ 'LiveChat\\Services\\SetupProvider' => $baseDir . '/plugin_files/Services/SetupProvider.class.php',
99
+ 'LiveChat\\Services\\SetupProviderTest' => $baseDir . '/plugin_files/tests/services/SetupProviderTest.class.php',
100
  'LiveChat\\Services\\Store' => $baseDir . '/plugin_files/Services/Store.class.php',
101
  'LiveChat\\Services\\StoreTest' => $baseDir . '/plugin_files/tests/services/StoreTest.class.php',
102
  'LiveChat\\Services\\TemplateParser' => $baseDir . '/plugin_files/Services/TemplateParser.class.php',
103
  'LiveChat\\Services\\TemplateParserTest' => $baseDir . '/plugin_files/tests/services/TemplateParserTest.class.php',
104
+ 'LiveChat\\Services\\Templates\\ChatWidgetScriptTemplate' => $baseDir . '/plugin_files/Services/Templates/ChatWidgetScriptTemplate.class.php',
105
+ 'LiveChat\\Services\\Templates\\ChatWidgetScriptTemplateTest' => $baseDir . '/plugin_files/tests/services/templates/ChatWidgetScriptTemplateTest.class.php',
106
+ 'LiveChat\\Services\\Templates\\ConfirmIdentityNoticeTemplate' => $baseDir . '/plugin_files/Services/Templates/ConfirmIdentityNoticeTemplate.class.php',
107
+ 'LiveChat\\Services\\Templates\\ConnectNoticeTemplate' => $baseDir . '/plugin_files/Services/Templates/ConnectNoticeTemplate.class.php',
108
+ 'LiveChat\\Services\\Templates\\CustomerTrackingTemplate' => $baseDir . '/plugin_files/Services/Templates/CustomerTrackingTemplate.class.php',
109
+ 'LiveChat\\Services\\Templates\\CustomerTrackingTemplateTest' => $baseDir . '/plugin_files/tests/services/templates/CustomerTrackingTemplateTest.class.php',
110
+ 'LiveChat\\Services\\Templates\\DeactivationModalTemplate' => $baseDir . '/plugin_files/Services/Templates/DeactivationModalTemplate.class.php',
111
+ 'LiveChat\\Services\\Templates\\NoticeTemplate' => $baseDir . '/plugin_files/Services/Templates/NoticeTemplate.class.php',
112
+ 'LiveChat\\Services\\Templates\\NoticeTemplateTest' => $baseDir . '/plugin_files/tests/services/templates/NoticeTemplateTest.class.php',
113
+ 'LiveChat\\Services\\Templates\\ResourcesTabTemplate' => $baseDir . '/plugin_files/Services/Templates/ResourcesTabTemplate.class.php',
114
+ 'LiveChat\\Services\\Templates\\SettingsTemplate' => $baseDir . '/plugin_files/Services/Templates/SettingsTemplate.class.php',
115
+ 'LiveChat\\Services\\Templates\\SettingsTemplateTest' => $baseDir . '/plugin_files/tests/services/templates/SettingsTemplateTest.class.php',
116
+ 'LiveChat\\Services\\Templates\\Template' => $baseDir . '/plugin_files/Services/Templates/Template.class.php',
117
+ 'LiveChat\\Services\\Templates\\TrackingCodeTemplate' => $baseDir . '/plugin_files/Services/Templates/TrackingCodeTemplate.class.php',
118
+ 'LiveChat\\Services\\Templates\\TrackingCodeTemplateTest' => $baseDir . '/plugin_files/tests/services/templates/TrackingCodeTemplateTest.class.php',
119
  'LiveChat\\Services\\TokenValidator' => $baseDir . '/plugin_files/Services/TokenValidator.class.php',
120
  'LiveChat\\Services\\TokenValidatorTest' => $baseDir . '/plugin_files/tests/services/TokenValidatorTest.class.php',
121
  'LiveChat\\Services\\UrlProvider' => $baseDir . '/plugin_files/Services/UrlProvider.class.php',
123
  'LiveChat\\Services\\User' => $baseDir . '/plugin_files/Services/User.class.php',
124
  'LiveChat\\Services\\UserTest' => $baseDir . '/plugin_files/tests/services/UserTest.class.php',
125
  'LiveChat\\Services\\WP_Error' => $baseDir . '/plugin_files/tests/services/ApiClientTest.class.php',
126
+ 'LiveChat\\Services\\WidgetProvider' => $baseDir . '/plugin_files/Services/WidgetProvider.class.php',
127
+ 'LiveChat\\Services\\WidgetProviderTest' => $baseDir . '/plugin_files/tests/services/WidgetProviderTest.class.php',
128
+ 'LiveChat\\Services\\WooCommerce\\CustomerTrackingProvider' => $baseDir . '/plugin_files/Services/WooCommerce/CustomerTrackingProvider.class.php',
129
+ 'LiveChat\\Services\\WooCommerce\\CustomerTrackingProviderTest' => $baseDir . '/plugin_files/tests/services/woocommerce/CustomerTrackingProviderTest.class.php',
130
  );
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit8c4cc7cb7b7f1a240155ea0b65423ac9
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit8c4cc7cb7b7f1a240155ea0b65423ac9
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInit8c4cc7cb7b7f1a240155ea0b65423ac9', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
- spl_autoload_unregister(array('ComposerAutoloaderInit8c4cc7cb7b7f1a240155ea0b65423ac9', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInit8c4cc7cb7b7f1a240155ea0b65423ac9::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInita679062790a12b21d3b8605f99cd1fb8
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInita679062790a12b21d3b8605f99cd1fb8', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInita679062790a12b21d3b8605f99cd1fb8', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInita679062790a12b21d3b8605f99cd1fb8::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit8c4cc7cb7b7f1a240155ea0b65423ac9
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'L' =>
@@ -36,30 +36,109 @@ class ComposerStaticInit8c4cc7cb7b7f1a240155ea0b65423ac9
36
  'LiveChat\\Exceptions\\ErrorCodes' => __DIR__ . '/../..' . '/plugin_files/Exceptions/ErrorCode.class.php',
37
  'LiveChat\\Exceptions\\HttpClientException' => __DIR__ . '/../..' . '/plugin_files/Exceptions/HttpClientException.class.php',
38
  'LiveChat\\Exceptions\\InvalidTokenException' => __DIR__ . '/../..' . '/plugin_files/Exceptions/InvalidTokenException.class.php',
39
- 'LiveChat\\Helpers\\ConfirmIdentityNoticeHelper' => __DIR__ . '/../..' . '/plugin_files/Helpers/ConfirmIdentityNoticeHelper.class.php',
40
- 'LiveChat\\Helpers\\ConnectNoticeHelper' => __DIR__ . '/../..' . '/plugin_files/Helpers/ConnectNoticeHelper.class.php',
41
- 'LiveChat\\Helpers\\ConnectServiceHelper' => __DIR__ . '/../..' . '/plugin_files/Helpers/ConnectServiceHelper.class.php',
42
- 'LiveChat\\Helpers\\DeactivationFeedbackFormHelper' => __DIR__ . '/../..' . '/plugin_files/Helpers/DeactivationFeedbackFormHelper.class.php',
43
- 'LiveChat\\Helpers\\LiveChatHelper' => __DIR__ . '/../..' . '/plugin_files/Helpers/LiveChatHelper.class.php',
44
- 'LiveChat\\Helpers\\ResourcesTabHelper' => __DIR__ . '/../..' . '/plugin_files/Helpers/ResourcesTabHelper.class.php',
45
- 'LiveChat\\Helpers\\ReviewNoticeHelper' => __DIR__ . '/../..' . '/plugin_files/Helpers/ReviewNoticeHelper.class.php',
46
- 'LiveChat\\Helpers\\TrackingCodeHelper' => __DIR__ . '/../..' . '/plugin_files/Helpers/TrackingCodeHelper.class.php',
47
  'LiveChat\\LiveChat' => __DIR__ . '/../..' . '/plugin_files/LiveChat.class.php',
48
  'LiveChat\\LiveChatAdmin' => __DIR__ . '/../..' . '/plugin_files/LiveChatAdmin.class.php',
49
  'LiveChat\\Services\\ApiClient' => __DIR__ . '/../..' . '/plugin_files/Services/ApiClient.class.php',
50
  'LiveChat\\Services\\ApiClientTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/ApiClientTest.class.php',
51
  'LiveChat\\Services\\CertProvider' => __DIR__ . '/../..' . '/plugin_files/Services/CertProvider.class.php',
52
  'LiveChat\\Services\\CertProviderTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/CertProviderTest.class.php',
 
 
53
  'LiveChat\\Services\\ConnectToken' => __DIR__ . '/../..' . '/plugin_files/Services/ConnectToken.class.php',
54
  'LiveChat\\Services\\ConnectTokenProvider' => __DIR__ . '/../..' . '/plugin_files/Services/ConnectTokenProvider.class.php',
55
  'LiveChat\\Services\\ConnectTokenProviderTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/ConnectTokenProviderTest.class.php',
56
  'LiveChat\\Services\\ConnectTokenTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/ConnectTokenTest.class.php',
 
 
 
 
 
 
 
 
57
  'LiveChat\\Services\\MockData' => __DIR__ . '/../..' . '/plugin_files/tests/services/UserTest.class.php',
58
  'LiveChat\\Services\\ModuleConfiguration' => __DIR__ . '/../..' . '/plugin_files/Services/ModuleConfiguration.class.php',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  'LiveChat\\Services\\Store' => __DIR__ . '/../..' . '/plugin_files/Services/Store.class.php',
60
  'LiveChat\\Services\\StoreTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/StoreTest.class.php',
61
  'LiveChat\\Services\\TemplateParser' => __DIR__ . '/../..' . '/plugin_files/Services/TemplateParser.class.php',
62
  'LiveChat\\Services\\TemplateParserTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/TemplateParserTest.class.php',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  'LiveChat\\Services\\TokenValidator' => __DIR__ . '/../..' . '/plugin_files/Services/TokenValidator.class.php',
64
  'LiveChat\\Services\\TokenValidatorTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/TokenValidatorTest.class.php',
65
  'LiveChat\\Services\\UrlProvider' => __DIR__ . '/../..' . '/plugin_files/Services/UrlProvider.class.php',
@@ -67,14 +146,18 @@ class ComposerStaticInit8c4cc7cb7b7f1a240155ea0b65423ac9
67
  'LiveChat\\Services\\User' => __DIR__ . '/../..' . '/plugin_files/Services/User.class.php',
68
  'LiveChat\\Services\\UserTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/UserTest.class.php',
69
  'LiveChat\\Services\\WP_Error' => __DIR__ . '/../..' . '/plugin_files/tests/services/ApiClientTest.class.php',
 
 
 
 
70
  );
71
 
72
  public static function getInitializer(ClassLoader $loader)
73
  {
74
  return \Closure::bind(function () use ($loader) {
75
- $loader->prefixLengthsPsr4 = ComposerStaticInit8c4cc7cb7b7f1a240155ea0b65423ac9::$prefixLengthsPsr4;
76
- $loader->prefixDirsPsr4 = ComposerStaticInit8c4cc7cb7b7f1a240155ea0b65423ac9::$prefixDirsPsr4;
77
- $loader->classMap = ComposerStaticInit8c4cc7cb7b7f1a240155ea0b65423ac9::$classMap;
78
 
79
  }, null, ClassLoader::class);
80
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInita679062790a12b21d3b8605f99cd1fb8
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'L' =>
36
  'LiveChat\\Exceptions\\ErrorCodes' => __DIR__ . '/../..' . '/plugin_files/Exceptions/ErrorCode.class.php',
37
  'LiveChat\\Exceptions\\HttpClientException' => __DIR__ . '/../..' . '/plugin_files/Exceptions/HttpClientException.class.php',
38
  'LiveChat\\Exceptions\\InvalidTokenException' => __DIR__ . '/../..' . '/plugin_files/Exceptions/InvalidTokenException.class.php',
 
 
 
 
 
 
 
 
39
  'LiveChat\\LiveChat' => __DIR__ . '/../..' . '/plugin_files/LiveChat.class.php',
40
  'LiveChat\\LiveChatAdmin' => __DIR__ . '/../..' . '/plugin_files/LiveChatAdmin.class.php',
41
  'LiveChat\\Services\\ApiClient' => __DIR__ . '/../..' . '/plugin_files/Services/ApiClient.class.php',
42
  'LiveChat\\Services\\ApiClientTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/ApiClientTest.class.php',
43
  'LiveChat\\Services\\CertProvider' => __DIR__ . '/../..' . '/plugin_files/Services/CertProvider.class.php',
44
  'LiveChat\\Services\\CertProviderTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/CertProviderTest.class.php',
45
+ 'LiveChat\\Services\\ConfirmIdentityNoticeTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/notifications/ConfirmIdentityNoticeTest.class.php',
46
+ 'LiveChat\\Services\\ConnectNoticeTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/notifications/ConnectNoticeTest.class.php',
47
  'LiveChat\\Services\\ConnectToken' => __DIR__ . '/../..' . '/plugin_files/Services/ConnectToken.class.php',
48
  'LiveChat\\Services\\ConnectTokenProvider' => __DIR__ . '/../..' . '/plugin_files/Services/ConnectTokenProvider.class.php',
49
  'LiveChat\\Services\\ConnectTokenProviderTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/ConnectTokenProviderTest.class.php',
50
  'LiveChat\\Services\\ConnectTokenTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/ConnectTokenTest.class.php',
51
+ 'LiveChat\\Services\\DeactivationModalTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/notifications/DeactivationModalTest.class.php',
52
+ 'LiveChat\\Services\\Factories\\ApiClientFactory' => __DIR__ . '/../..' . '/plugin_files/Services/Factories/ApiClientFactory.class.php',
53
+ 'LiveChat\\Services\\Factories\\ConnectTokenProviderFactory' => __DIR__ . '/../..' . '/plugin_files/Services/Factories/ConnectTokenProviderFactory.class.php',
54
+ 'LiveChat\\Services\\Factories\\UrlProviderFactory' => __DIR__ . '/../..' . '/plugin_files/Services/Factories/UrlProviderFactory.class.php',
55
+ 'LiveChat\\Services\\LicenseProvider' => __DIR__ . '/../..' . '/plugin_files/Services/LicenseProvider.class.php',
56
+ 'LiveChat\\Services\\LicenseProviderTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/LicenseProviderTest.class.php',
57
+ 'LiveChat\\Services\\MenuProvider' => __DIR__ . '/../..' . '/plugin_files/Services/MenuProvider.class.php',
58
+ 'LiveChat\\Services\\MenuProviderTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/MenuProviderTest.class.php',
59
  'LiveChat\\Services\\MockData' => __DIR__ . '/../..' . '/plugin_files/tests/services/UserTest.class.php',
60
  'LiveChat\\Services\\ModuleConfiguration' => __DIR__ . '/../..' . '/plugin_files/Services/ModuleConfiguration.class.php',
61
+ 'LiveChat\\Services\\NoticeTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/notifications/NoticeTest.class.php',
62
+ 'LiveChat\\Services\\NotificationTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/notifications/NotificationTest.class.php',
63
+ 'LiveChat\\Services\\NotificationsRenderer' => __DIR__ . '/../..' . '/plugin_files/Services/NotificationsRenderer.class.php',
64
+ 'LiveChat\\Services\\NotificationsRendererTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/NotificationsRendererTest.class.php',
65
+ 'LiveChat\\Services\\Notifications\\ConfirmIdentityNotice' => __DIR__ . '/../..' . '/plugin_files/Services/Notifications/ConfirmIdentityNotice.class.php',
66
+ 'LiveChat\\Services\\Notifications\\ConnectNotice' => __DIR__ . '/../..' . '/plugin_files/Services/Notifications/ConnectNotice.class.php',
67
+ 'LiveChat\\Services\\Notifications\\DeactivationModal' => __DIR__ . '/../..' . '/plugin_files/Services/Notifications/DeactivationModal.class.php',
68
+ 'LiveChat\\Services\\Notifications\\Notice' => __DIR__ . '/../..' . '/plugin_files/Services/Notifications/Notice.class.php',
69
+ 'LiveChat\\Services\\Notifications\\Notification' => __DIR__ . '/../..' . '/plugin_files/Services/Notifications/Notification.class.php',
70
+ 'LiveChat\\Services\\Options\\AuthorizedUsers' => __DIR__ . '/../..' . '/plugin_files/Services/Options/AuthorizedUsers.class.php',
71
+ 'LiveChat\\Services\\Options\\AuthorizedUsersTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/options/AuthorizedUsersTest.class.php',
72
+ 'LiveChat\\Services\\Options\\Deprecated\\DeprecatedLicenseEmail' => __DIR__ . '/../..' . '/plugin_files/Services/Options/Deprecated/DeprecatedLicenseEmail.class.php',
73
+ 'LiveChat\\Services\\Options\\Deprecated\\DeprecatedLicenseNumber' => __DIR__ . '/../..' . '/plugin_files/Services/Options/Deprecated/DeprecatedLicenseNumber.class.php',
74
+ 'LiveChat\\Services\\Options\\Deprecated\\DeprecatedOption' => __DIR__ . '/../..' . '/plugin_files/Services/Options/Deprecated/DeprecatedOption.class.php',
75
+ 'LiveChat\\Services\\Options\\Deprecated\\DeprecatedOptionTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/options/deprecated/DeprecatedOptionTest.class.php',
76
+ 'LiveChat\\Services\\Options\\Deprecated\\DeprecatedOptions' => __DIR__ . '/../..' . '/plugin_files/Services/Options/Deprecated/DeprecatedOptions.class.php',
77
+ 'LiveChat\\Services\\Options\\Deprecated\\DeprecatedOptionsTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/options/deprecated/DeprecatedOptionsTest.class.php',
78
+ 'LiveChat\\Services\\Options\\Deprecated\\DeprecatedReviewNoticeDismissed' => __DIR__ . '/../..' . '/plugin_files/Services/Options/Deprecated/DeprecatedReviewNoticeDismissed.class.php',
79
+ 'LiveChat\\Services\\Options\\Deprecated\\DeprecatedReviewNoticeOffset' => __DIR__ . '/../..' . '/plugin_files/Services/Options/Deprecated/DeprecatedReviewNoticeOffset.class.php',
80
+ 'LiveChat\\Services\\Options\\Deprecated\\DeprecatedReviewNoticeOptions' => __DIR__ . '/../..' . '/plugin_files/Services/Options/Deprecated/DeprecatedReviewNoticeOptions.class.php',
81
+ 'LiveChat\\Services\\Options\\Deprecated\\DeprecatedReviewNoticeTimestamp' => __DIR__ . '/../..' . '/plugin_files/Services/Options/Deprecated/DeprecatedReviewNoticeTimestamp.class.php',
82
+ 'LiveChat\\Services\\Options\\Deprecated\\Widget\\DeprecatedWidgetSettings' => __DIR__ . '/../..' . '/plugin_files/Services/Options/Deprecated/Widget/DeprecatedWidgetSettings.class.php',
83
+ 'LiveChat\\Services\\Options\\Deprecated\\Widget\\DeprecatedWidgetSettingsTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/options/deprecated/widget/DeprecatedWidgetSettingsTest.class.php',
84
+ 'LiveChat\\Services\\Options\\Deprecated\\Widget\\DeprecatedWidgetWooCommerceSettings' => __DIR__ . '/../..' . '/plugin_files/Services/Options/Deprecated/Widget/DeprecatedWidgetWooCommerceSettings.class.php',
85
+ 'LiveChat\\Services\\Options\\Deprecated\\Widget\\DeprecatedWidgetWooCommerceSettingsTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/options/deprecated/widget/DeprecatedWidgetWooCommerceSettingsTest.class.php',
86
+ 'LiveChat\\Services\\Options\\Deprecated\\Widget\\DeprecatedWidgetWordPressDisableGuestsOption' => __DIR__ . '/../..' . '/plugin_files/Services/Options/Deprecated/Widget/DeprecatedWidgetWordPressDisableGuestsOption.class.php',
87
+ 'LiveChat\\Services\\Options\\Deprecated\\Widget\\DeprecatedWidgetWordPressDisableMobileOption' => __DIR__ . '/../..' . '/plugin_files/Services/Options/Deprecated/Widget/DeprecatedWidgetWordPressDisableMobileOption.class.php',
88
+ 'LiveChat\\Services\\Options\\Deprecated\\Widget\\DeprecatedWidgetWordPressSettings' => __DIR__ . '/../..' . '/plugin_files/Services/Options/Deprecated/Widget/DeprecatedWidgetWordPressSettings.class.php',
89
+ 'LiveChat\\Services\\Options\\Deprecated\\Widget\\DeprecatedWidgetWordPressSettingsTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/options/deprecated/widget/DeprecatedWidgetWordPressSettingsTest.class.php',
90
+ 'LiveChat\\Services\\Options\\Option' => __DIR__ . '/../..' . '/plugin_files/Services/Options/Option.class.php',
91
+ 'LiveChat\\Services\\Options\\OptionTestCase' => __DIR__ . '/../..' . '/plugin_files/tests/services/options/OptionTestCase.php',
92
+ 'LiveChat\\Services\\Options\\OptionsSet' => __DIR__ . '/../..' . '/plugin_files/Services/Options/OptionsSet.class.php',
93
+ 'LiveChat\\Services\\Options\\OptionsSetTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/options/OptionsSetTest.class.php',
94
+ 'LiveChat\\Services\\Options\\Platform' => __DIR__ . '/../..' . '/plugin_files/Services/Options/Platform.class.php',
95
+ 'LiveChat\\Services\\Options\\PublicKey' => __DIR__ . '/../..' . '/plugin_files/Services/Options/PublicKey.class.php',
96
+ 'LiveChat\\Services\\Options\\ReadableOption' => __DIR__ . '/../..' . '/plugin_files/Services/Options/ReadableOption.class.php',
97
+ 'LiveChat\\Services\\Options\\ReadableOptionTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/options/ReadableOptionTest.class.php',
98
+ 'LiveChat\\Services\\Options\\ReviewNoticeDismissed' => __DIR__ . '/../..' . '/plugin_files/Services/Options/ReviewNoticeDismissed.class.php',
99
+ 'LiveChat\\Services\\Options\\ReviewNoticeOffset' => __DIR__ . '/../..' . '/plugin_files/Services/Options/ReviewNoticeOffset.class.php',
100
+ 'LiveChat\\Services\\Options\\ReviewNoticeOptions' => __DIR__ . '/../..' . '/plugin_files/Services/Options/ReviewNoticeOptions.class.php',
101
+ 'LiveChat\\Services\\Options\\ReviewNoticeOptionsTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/options/ReviewNoticeOptionsTest.class.php',
102
+ 'LiveChat\\Services\\Options\\ReviewNoticeTimestamp' => __DIR__ . '/../..' . '/plugin_files/Services/Options/ReviewNoticeTimestamp.class.php',
103
+ 'LiveChat\\Services\\Options\\SettingsOptions' => __DIR__ . '/../..' . '/plugin_files/Services/Options/SettingsOptions.class.php',
104
+ 'LiveChat\\Services\\Options\\StoreToken' => __DIR__ . '/../..' . '/plugin_files/Services/Options/StoreToken.class.php',
105
+ 'LiveChat\\Services\\Options\\Synchronized' => __DIR__ . '/../..' . '/plugin_files/Services/Options/Synchronized.class.php',
106
+ 'LiveChat\\Services\\Options\\UserAuthOptions' => __DIR__ . '/../..' . '/plugin_files/Services/Options/UserAuthOptions.class.php',
107
+ 'LiveChat\\Services\\Options\\UserOption' => __DIR__ . '/../..' . '/plugin_files/Services/Options/UserOption.class.php',
108
+ 'LiveChat\\Services\\Options\\UserOptionTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/options/UserOptionTest.class.php',
109
+ 'LiveChat\\Services\\Options\\UserToken' => __DIR__ . '/../..' . '/plugin_files/Services/Options/UserToken.class.php',
110
+ 'LiveChat\\Services\\Options\\WidgetURL' => __DIR__ . '/../..' . '/plugin_files/Services/Options/WidgetURL.class.php',
111
+ 'LiveChat\\Services\\Options\\WooCommerce\\WooCommerceOption' => __DIR__ . '/../..' . '/plugin_files/Services/Options/WooCommerce/WooCommerceOption.class.php',
112
+ 'LiveChat\\Services\\Options\\WooCommerce\\WooCommerceOptionTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/options/woocommerce/WooCommerceOptionTest.class.php',
113
+ 'LiveChat\\Services\\Options\\WooCommerce\\WooCommerceUserOption' => __DIR__ . '/../..' . '/plugin_files/Services/Options/WooCommerce/WooCommerceUserOption.class.php',
114
+ 'LiveChat\\Services\\Options\\WooCommerce\\WooCommerceUserOptionTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/options/woocommerce/WooCommerceUserOptionTest.class.php',
115
+ 'LiveChat\\Services\\Options\\WritableOption' => __DIR__ . '/../..' . '/plugin_files/Services/Options/WritableOption.class.php',
116
+ 'LiveChat\\Services\\Options\\WritableOptionTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/options/WritableOptionTest.class.php',
117
+ 'LiveChat\\Services\\PlatformProvider' => __DIR__ . '/../..' . '/plugin_files/Services/PlatformProvider.class.php',
118
+ 'LiveChat\\Services\\PlatformProviderTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/PlatformProviderTest.class.php',
119
+ 'LiveChat\\Services\\SettingsProvider' => __DIR__ . '/../..' . '/plugin_files/Services/SettingsProvider.class.php',
120
+ 'LiveChat\\Services\\SettingsProviderTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/SettingsProviderTest.class.php',
121
+ 'LiveChat\\Services\\SetupProvider' => __DIR__ . '/../..' . '/plugin_files/Services/SetupProvider.class.php',
122
+ 'LiveChat\\Services\\SetupProviderTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/SetupProviderTest.class.php',
123
  'LiveChat\\Services\\Store' => __DIR__ . '/../..' . '/plugin_files/Services/Store.class.php',
124
  'LiveChat\\Services\\StoreTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/StoreTest.class.php',
125
  'LiveChat\\Services\\TemplateParser' => __DIR__ . '/../..' . '/plugin_files/Services/TemplateParser.class.php',
126
  'LiveChat\\Services\\TemplateParserTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/TemplateParserTest.class.php',
127
+ 'LiveChat\\Services\\Templates\\ChatWidgetScriptTemplate' => __DIR__ . '/../..' . '/plugin_files/Services/Templates/ChatWidgetScriptTemplate.class.php',
128
+ 'LiveChat\\Services\\Templates\\ChatWidgetScriptTemplateTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/templates/ChatWidgetScriptTemplateTest.class.php',
129
+ 'LiveChat\\Services\\Templates\\ConfirmIdentityNoticeTemplate' => __DIR__ . '/../..' . '/plugin_files/Services/Templates/ConfirmIdentityNoticeTemplate.class.php',
130
+ 'LiveChat\\Services\\Templates\\ConnectNoticeTemplate' => __DIR__ . '/../..' . '/plugin_files/Services/Templates/ConnectNoticeTemplate.class.php',
131
+ 'LiveChat\\Services\\Templates\\CustomerTrackingTemplate' => __DIR__ . '/../..' . '/plugin_files/Services/Templates/CustomerTrackingTemplate.class.php',
132
+ 'LiveChat\\Services\\Templates\\CustomerTrackingTemplateTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/templates/CustomerTrackingTemplateTest.class.php',
133
+ 'LiveChat\\Services\\Templates\\DeactivationModalTemplate' => __DIR__ . '/../..' . '/plugin_files/Services/Templates/DeactivationModalTemplate.class.php',
134
+ 'LiveChat\\Services\\Templates\\NoticeTemplate' => __DIR__ . '/../..' . '/plugin_files/Services/Templates/NoticeTemplate.class.php',
135
+ 'LiveChat\\Services\\Templates\\NoticeTemplateTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/templates/NoticeTemplateTest.class.php',
136
+ 'LiveChat\\Services\\Templates\\ResourcesTabTemplate' => __DIR__ . '/../..' . '/plugin_files/Services/Templates/ResourcesTabTemplate.class.php',
137
+ 'LiveChat\\Services\\Templates\\SettingsTemplate' => __DIR__ . '/../..' . '/plugin_files/Services/Templates/SettingsTemplate.class.php',
138
+ 'LiveChat\\Services\\Templates\\SettingsTemplateTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/templates/SettingsTemplateTest.class.php',
139
+ 'LiveChat\\Services\\Templates\\Template' => __DIR__ . '/../..' . '/plugin_files/Services/Templates/Template.class.php',
140
+ 'LiveChat\\Services\\Templates\\TrackingCodeTemplate' => __DIR__ . '/../..' . '/plugin_files/Services/Templates/TrackingCodeTemplate.class.php',
141
+ 'LiveChat\\Services\\Templates\\TrackingCodeTemplateTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/templates/TrackingCodeTemplateTest.class.php',
142
  'LiveChat\\Services\\TokenValidator' => __DIR__ . '/../..' . '/plugin_files/Services/TokenValidator.class.php',
143
  'LiveChat\\Services\\TokenValidatorTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/TokenValidatorTest.class.php',
144
  'LiveChat\\Services\\UrlProvider' => __DIR__ . '/../..' . '/plugin_files/Services/UrlProvider.class.php',
146
  'LiveChat\\Services\\User' => __DIR__ . '/../..' . '/plugin_files/Services/User.class.php',
147
  'LiveChat\\Services\\UserTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/UserTest.class.php',
148
  'LiveChat\\Services\\WP_Error' => __DIR__ . '/../..' . '/plugin_files/tests/services/ApiClientTest.class.php',
149
+ 'LiveChat\\Services\\WidgetProvider' => __DIR__ . '/../..' . '/plugin_files/Services/WidgetProvider.class.php',
150
+ 'LiveChat\\Services\\WidgetProviderTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/WidgetProviderTest.class.php',
151
+ 'LiveChat\\Services\\WooCommerce\\CustomerTrackingProvider' => __DIR__ . '/../..' . '/plugin_files/Services/WooCommerce/CustomerTrackingProvider.class.php',
152
+ 'LiveChat\\Services\\WooCommerce\\CustomerTrackingProviderTest' => __DIR__ . '/../..' . '/plugin_files/tests/services/woocommerce/CustomerTrackingProviderTest.class.php',
153
  );
154
 
155
  public static function getInitializer(ClassLoader $loader)
156
  {
157
  return \Closure::bind(function () use ($loader) {
158
+ $loader->prefixLengthsPsr4 = ComposerStaticInita679062790a12b21d3b8605f99cd1fb8::$prefixLengthsPsr4;
159
+ $loader->prefixDirsPsr4 = ComposerStaticInita679062790a12b21d3b8605f99cd1fb8::$prefixDirsPsr4;
160
+ $loader->classMap = ComposerStaticInita679062790a12b21d3b8605f99cd1fb8::$classMap;
161
 
162
  }, null, ClassLoader::class);
163
  }
vendor/composer/installed.json CHANGED
@@ -1,17 +1,17 @@
1
  [
2
  {
3
  "name": "firebase/php-jwt",
4
- "version": "v5.2.0",
5
- "version_normalized": "5.2.0.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/firebase/php-jwt.git",
9
- "reference": "feb0e820b8436873675fd3aca04f3728eb2185cb"
10
  },
11
  "dist": {
12
  "type": "zip",
13
- "url": "https://api.github.com/repos/firebase/php-jwt/zipball/feb0e820b8436873675fd3aca04f3728eb2185cb",
14
- "reference": "feb0e820b8436873675fd3aca04f3728eb2185cb",
15
  "shasum": ""
16
  },
17
  "require": {
@@ -20,7 +20,7 @@
20
  "require-dev": {
21
  "phpunit/phpunit": ">=4.8 <=9"
22
  },
23
- "time": "2020-03-25T18:49:23+00:00",
24
  "type": "library",
25
  "installation-source": "dist",
26
  "autoload": {
1
  [
2
  {
3
  "name": "firebase/php-jwt",
4
+ "version": "v5.2.1",
5
+ "version_normalized": "5.2.1.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/firebase/php-jwt.git",
9
+ "reference": "f42c9110abe98dd6cfe9053c49bc86acc70b2d23"
10
  },
11
  "dist": {
12
  "type": "zip",
13
+ "url": "https://api.github.com/repos/firebase/php-jwt/zipball/f42c9110abe98dd6cfe9053c49bc86acc70b2d23",
14
+ "reference": "f42c9110abe98dd6cfe9053c49bc86acc70b2d23",
15
  "shasum": ""
16
  },
17
  "require": {
20
  "require-dev": {
21
  "phpunit/phpunit": ">=4.8 <=9"
22
  },
23
+ "time": "2021-02-12T00:02:00+00:00",
24
  "type": "library",
25
  "installation-source": "dist",
26
  "autoload": {
vendor/firebase/php-jwt/README.md CHANGED
@@ -115,6 +115,19 @@ echo "Decode:\n" . print_r($decoded_array, true) . "\n";
115
  ?>
116
  ```
117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  Changelog
119
  ---------
120
 
115
  ?>
116
  ```
117
 
118
+ Using JWKs
119
+ ----------
120
+
121
+ ```php
122
+ // Set of keys. The "keys" key is required. For example, the JSON response to
123
+ // this endpoint: https://www.gstatic.com/iap/verify/public_key-jwk
124
+ $jwks = ['keys' => []];
125
+
126
+ // JWK::parseKeySet($jwks) returns an associative array of **kid** to private
127
+ // key. Pass this as the second parameter to JWT::decode.
128
+ JWT::decode($payload, JWK::parseKeySet($jwks), $supportedAlgorithm);
129
+ ```
130
+
131
  Changelog
132
  ---------
133
 
vendor/firebase/php-jwt/src/JWK.php CHANGED
@@ -3,6 +3,7 @@
3
  namespace Firebase\JWT;
4
 
5
  use DomainException;
 
6
  use UnexpectedValueException;
7
 
8
  /**
3
  namespace Firebase\JWT;
4
 
5
  use DomainException;
6
+ use InvalidArgumentException;
7
  use UnexpectedValueException;
8
 
9
  /**