|
29 | 29 | } |
30 | 30 |
|
31 | 31 | if (response.isValid !== true) { |
32 | | - notificationsService.warning("HubSpot Configuration", |
33 | | - "Invalid setup. Please review the API/OAuth settings."); |
| 32 | + // if directive runs from property editor, the notifications should be hidden, because they will not be displayed properly behind the overlay window. |
| 33 | + // if directive runs from data type, the notifications are displayed |
| 34 | + if (typeof $scope.connected === "undefined") |
| 35 | + notificationsService.warning("HubSpot Configuration", |
| 36 | + "Invalid setup. Please review the API/OAuth settings."); |
34 | 37 | } |
35 | 38 | }); |
36 | 39 |
|
|
46 | 49 | vm.onRevokeToken = function() { |
47 | 50 | umbracoCmsIntegrationsCrmHubspotResource.revokeAccessToken().then(function (response) { |
48 | 51 | vm.oauthSetup.isConnected = false; |
49 | | - notificationsService.success("HubSpot Configuration", "OAuth connection revoked."); |
| 52 | + |
| 53 | + if(typeof $scope.connected === "undefined") |
| 54 | + notificationsService.success("HubSpot Configuration", "OAuth connection revoked."); |
| 55 | + |
| 56 | + if (typeof $scope.revoked === "function") |
| 57 | + $scope.revoked(); |
50 | 58 | }); |
51 | 59 | } |
52 | 60 |
|
|
56 | 64 |
|
57 | 65 | umbracoCmsIntegrationsCrmHubspotResource.getAccessToken(event.data.code).then(function (response) { |
58 | 66 | if (response.startsWith("Error:")) { |
59 | | - notificationsService.error("HubSpot Configuration", response); |
| 67 | + if (typeof $scope.connected === "undefined") |
| 68 | + notificationsService.error("HubSpot Configuration", response); |
60 | 69 | } else { |
61 | 70 | vm.oauthSetup.isConnected = true; |
62 | 71 | vm.status.description = umbracoCmsIntegrationsCrmHubspotService.configDescription.OAuthConnected; |
63 | | - notificationsService.success("HubSpot Configuration", "OAuth connected."); |
| 72 | + |
| 73 | + if (typeof $scope.connected === "undefined") |
| 74 | + notificationsService.success("HubSpot Configuration", "OAuth connected."); |
| 75 | + |
| 76 | + if (typeof $scope.connected === "function") |
| 77 | + $scope.connected(); |
64 | 78 | } |
65 | 79 | }); |
66 | 80 |
|
|
0 commit comments