From 4d2507710841832842a95fd0d77088aed7387e46 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 15 Aug 2017 10:05:39 -0400 Subject: [PATCH] more preprocessing for self host --- src/app/app.js | 2 + src/app/config.js | 8 +++- ...anizationBillingChangePaymentController.js | 8 +++- .../settingsBillingChangePaymentController.js | 8 +++- .../settingsCreateOrganizationController.js | 6 ++- src/app/settings/settingsPremiumController.js | 8 +++- src/index.html | 37 +++++++++++++++++-- 7 files changed, 66 insertions(+), 11 deletions(-) diff --git a/src/app/app.js b/src/app/app.js index d1d8f18a32..496bb2ac18 100644 --- a/src/app/app.js +++ b/src/app/app.js @@ -6,9 +6,11 @@ 'ui.bootstrap.showErrors', 'toastr', 'angulartics', + // @if !selfHosted 'angulartics.google.analytics', 'angular-stripe', 'credit-cards', + // @endif 'angular-promise-polyfill', 'bit.directives', diff --git a/src/app/config.js b/src/app/config.js index 466dcac052..8113788cad 100644 --- a/src/app/config.js +++ b/src/app/config.js @@ -2,7 +2,11 @@ angular .module('bit') .config(function ($stateProvider, $urlRouterProvider, $httpProvider, jwtInterceptorProvider, jwtOptionsProvider, - $uibTooltipProvider, toastrConfig, $locationProvider, $qProvider, stripeProvider, appSettings) { + $uibTooltipProvider, toastrConfig, $locationProvider, $qProvider, appSettings + // @if !selfHosted + , stripeProvider + // @endif + ) { angular.extend(appSettings, window.bitwardenAppSettings); $qProvider.errorOnUnhandledRejections(false); @@ -37,7 +41,9 @@ angular return refreshPromise; }; + // @if !selfHosted stripeProvider.setPublishableKey(appSettings.stripeKey); + // @endif angular.extend(toastrConfig, { closeButton: true, diff --git a/src/app/organization/organizationBillingChangePaymentController.js b/src/app/organization/organizationBillingChangePaymentController.js index 3f40c3dc57..82298a13d1 100644 --- a/src/app/organization/organizationBillingChangePaymentController.js +++ b/src/app/organization/organizationBillingChangePaymentController.js @@ -1,8 +1,12 @@ angular .module('bit.organization') - .controller('organizationBillingChangePaymentController', function ($scope, $state, $uibModalInstance, apiService, stripe, - $analytics, toastr, existingPaymentMethod) { + .controller('organizationBillingChangePaymentController', function ($scope, $state, $uibModalInstance, apiService, + $analytics, toastr, existingPaymentMethod + // @if !selfHosted + , stripe + // @endif + ) { $analytics.eventTrack('organizationBillingChangePaymentController', { category: 'Modal' }); $scope.existingPaymentMethod = existingPaymentMethod; $scope.paymentMethod = 'card'; diff --git a/src/app/settings/settingsBillingChangePaymentController.js b/src/app/settings/settingsBillingChangePaymentController.js index 62a8d8bb0b..57ab6462df 100644 --- a/src/app/settings/settingsBillingChangePaymentController.js +++ b/src/app/settings/settingsBillingChangePaymentController.js @@ -1,8 +1,12 @@ angular .module('bit.organization') - .controller('settingsBillingChangePaymentController', function ($scope, $state, $uibModalInstance, apiService, stripe, - $analytics, toastr, existingPaymentMethod, appSettings, $timeout) { + .controller('settingsBillingChangePaymentController', function ($scope, $state, $uibModalInstance, apiService, + $analytics, toastr, existingPaymentMethod, appSettings, $timeout + // @if !selfHosted + , stripe + // @endif + ) { $analytics.eventTrack('settingsBillingChangePaymentController', { category: 'Modal' }); $scope.existingPaymentMethod = existingPaymentMethod; $scope.paymentMethod = 'card'; diff --git a/src/app/settings/settingsCreateOrganizationController.js b/src/app/settings/settingsCreateOrganizationController.js index b22d79173e..1f41322213 100644 --- a/src/app/settings/settingsCreateOrganizationController.js +++ b/src/app/settings/settingsCreateOrganizationController.js @@ -2,7 +2,11 @@ .module('bit.settings') .controller('settingsCreateOrganizationController', function ($scope, $state, apiService, cryptoService, - toastr, $analytics, authService, stripe, constants, appSettings, validationService) { + toastr, $analytics, authService, constants, appSettings, validationService + // @if !selfHosted + , stripe + // @endif + ) { $scope.plans = constants.plans; $scope.storageGb = constants.storageGb; $scope.paymentMethod = 'card'; diff --git a/src/app/settings/settingsPremiumController.js b/src/app/settings/settingsPremiumController.js index a24c52a191..41760be795 100644 --- a/src/app/settings/settingsPremiumController.js +++ b/src/app/settings/settingsPremiumController.js @@ -1,8 +1,12 @@ angular .module('bit.settings') - .controller('settingsPremiumController', function ($scope, $state, apiService, toastr, $analytics, authService, stripe, - constants, $timeout, appSettings, validationService) { + .controller('settingsPremiumController', function ($scope, $state, apiService, toastr, $analytics, authService, + constants, $timeout, appSettings, validationService + // @if !selfHosted + , stripe + // @endif + ) { authService.getUserProfile().then(function (profile) { if (profile.premium) { return $state.go('backend.user.settingsBilling'); diff --git a/src/index.html b/src/index.html index c2c051f8bb..b6fe9f684c 100644 --- a/src/index.html +++ b/src/index.html @@ -2,6 +2,7 @@ + + + bitwarden.com Password Manager - - + +