From 545412eb000c6223199f8df4d879f5e725e05dc7 Mon Sep 17 00:00:00 2001 From: Caleb Alldrin Date: Wed, 18 Dec 2024 18:05:43 -0800 Subject: [PATCH] Move variables to cartEvents.js to avoid circular dependency --- src/app/cart/cart.component.js | 2 +- src/app/cart/cart.component.spec.js | 2 +- .../productConfigForm/productConfigForm.component.js | 2 +- .../productConfigForm/productConfigForm.component.spec.js | 2 +- .../giveOneTimeGift/giveOneTimeGift.modal.component.js | 2 +- .../giveOneTimeGift/giveOneTimeGift.modal.component.spec.js | 2 +- src/common/components/nav/navCart/navCart.component.js | 4 +--- src/common/components/nav/navCart/navCart.component.spec.js | 3 ++- src/common/components/nav/navCartIcon.component.js | 3 ++- src/common/components/nav/navCartIcon.component.spec.js | 2 +- src/common/lib/cartEvents.js | 2 ++ 11 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 src/common/lib/cartEvents.js diff --git a/src/app/cart/cart.component.js b/src/app/cart/cart.component.js index 9eef901ba..9ccbb83e7 100644 --- a/src/app/cart/cart.component.js +++ b/src/app/cart/cart.component.js @@ -10,7 +10,7 @@ import productModalService from 'common/services/productModal.service' import desigSrcDirective from 'common/directives/desigSrc.directive' import displayRateTotals from 'common/components/displayRateTotals/displayRateTotals.component' -import { cartUpdatedEvent } from 'common/components/nav/navCart/navCart.component' +import { cartUpdatedEvent } from 'common/lib/cartEvents' import analyticsFactory from 'app/analytics/analytics.factory' diff --git a/src/app/cart/cart.component.spec.js b/src/app/cart/cart.component.spec.js index ca14206fe..0f1a0fa29 100644 --- a/src/app/cart/cart.component.spec.js +++ b/src/app/cart/cart.component.spec.js @@ -6,7 +6,7 @@ import { Observable } from 'rxjs/Observable' import 'rxjs/add/observable/of' import 'rxjs/add/observable/throw' -import { cartUpdatedEvent } from 'common/components/nav/navCart/navCart.component' +import { cartUpdatedEvent } from 'common/lib/cartEvents' describe('cart', () => { beforeEach(angular.mock.module(module.name)) diff --git a/src/app/productConfig/productConfigForm/productConfigForm.component.js b/src/app/productConfig/productConfigForm/productConfigForm.component.js index e6193fe8c..43ce5c9f5 100644 --- a/src/app/productConfig/productConfigForm/productConfigForm.component.js +++ b/src/app/productConfig/productConfigForm/productConfigForm.component.js @@ -27,7 +27,7 @@ import { } from 'common/services/giftHelpers/giftDates.service' import desigSrcDirective from 'common/directives/desigSrc.directive' import showErrors from 'common/filters/showErrors.filter' -import { giftAddedEvent, cartUpdatedEvent } from 'common/components/nav/navCart/navCart.component' +import { giftAddedEvent, cartUpdatedEvent } from 'common/lib/cartEvents' import { giveGiftParams } from '../giveGiftParams' import loading from 'common/components/loading/loading.component' import analyticsFactory from 'app/analytics/analytics.factory' diff --git a/src/app/productConfig/productConfigForm/productConfigForm.component.spec.js b/src/app/productConfig/productConfigForm/productConfigForm.component.spec.js index de678fb24..70f639879 100644 --- a/src/app/productConfig/productConfigForm/productConfigForm.component.spec.js +++ b/src/app/productConfig/productConfigForm/productConfigForm.component.spec.js @@ -7,7 +7,7 @@ import 'rxjs/add/observable/of' import 'rxjs/add/observable/throw' import module, { brandedCoverFeeCheckedEvent } from './productConfigForm.component' -import { giftAddedEvent, cartUpdatedEvent } from 'common/components/nav/navCart/navCart.component' +import { giftAddedEvent, cartUpdatedEvent } from 'common/lib/cartEvents' import { giveGiftParams } from '../giveGiftParams' import { brandedCheckoutAmountUpdatedEvent } from '../../../common/components/paymentMethods/coverFees/coverFees.component' diff --git a/src/app/profile/yourGiving/giveOneTimeGift/giveOneTimeGift.modal.component.js b/src/app/profile/yourGiving/giveOneTimeGift/giveOneTimeGift.modal.component.js index 8d6e75948..22204aac0 100644 --- a/src/app/profile/yourGiving/giveOneTimeGift/giveOneTimeGift.modal.component.js +++ b/src/app/profile/yourGiving/giveOneTimeGift/giveOneTimeGift.modal.component.js @@ -5,7 +5,7 @@ import concat from 'lodash/concat' import step1SelectRecentRecipients from './step1/selectRecentRecipients.component' import step1SearchRecipients from './step1/searchRecipients.component' import step2EnterAmounts from './step2/enterAmounts.component' -import { giftAddedEvent } from 'common/components/nav/navCart/navCart.component' +import { giftAddedEvent } from 'common/lib/cartEvents' import RecurringGiftModel from 'common/models/recurringGift.model' diff --git a/src/app/profile/yourGiving/giveOneTimeGift/giveOneTimeGift.modal.component.spec.js b/src/app/profile/yourGiving/giveOneTimeGift/giveOneTimeGift.modal.component.spec.js index 70251998b..b30c57ea7 100644 --- a/src/app/profile/yourGiving/giveOneTimeGift/giveOneTimeGift.modal.component.spec.js +++ b/src/app/profile/yourGiving/giveOneTimeGift/giveOneTimeGift.modal.component.spec.js @@ -6,7 +6,7 @@ import 'rxjs/add/observable/from' import 'rxjs/add/observable/throw' import RecurringGiftModel from 'common/models/recurringGift.model' -import { giftAddedEvent } from 'common/components/nav/navCart/navCart.component' +import { giftAddedEvent } from 'common/lib/cartEvents' import module from './giveOneTimeGift.modal.component' diff --git a/src/common/components/nav/navCart/navCart.component.js b/src/common/components/nav/navCart/navCart.component.js index 42f30aedf..c5a5f2f57 100644 --- a/src/common/components/nav/navCart/navCart.component.js +++ b/src/common/components/nav/navCart/navCart.component.js @@ -7,9 +7,7 @@ import orderService from 'common/services/api/order.service' import analyticsFactory from 'app/analytics/analytics.factory' import template from './navCart.tpl.html' - -export const giftAddedEvent = 'giftAddedToCart' -export const cartUpdatedEvent = 'cartUpdatedEvent' +import { giftAddedEvent, cartUpdatedEvent } from 'common/lib/cartEvents' const componentName = 'navCart' diff --git a/src/common/components/nav/navCart/navCart.component.spec.js b/src/common/components/nav/navCart/navCart.component.spec.js index 3ea72ba33..8423fcf85 100644 --- a/src/common/components/nav/navCart/navCart.component.spec.js +++ b/src/common/components/nav/navCart/navCart.component.spec.js @@ -4,7 +4,8 @@ import { Observable } from 'rxjs/Observable' import { Subject } from 'rxjs/Subject' import 'rxjs/add/observable/of' import 'rxjs/add/observable/throw' -import module, { giftAddedEvent, cartUpdatedEvent } from './navCart.component' +import module from './navCart.component' +import { giftAddedEvent, cartUpdatedEvent } from 'common/lib/cartEvents' describe('navCart', () => { beforeEach(angular.mock.module(module.name)) diff --git a/src/common/components/nav/navCartIcon.component.js b/src/common/components/nav/navCartIcon.component.js index 12bdd894c..32ca30663 100644 --- a/src/common/components/nav/navCartIcon.component.js +++ b/src/common/components/nav/navCartIcon.component.js @@ -1,6 +1,7 @@ import angular from 'angular' -import navCart, { giftAddedEvent, cartUpdatedEvent } from 'common/components/nav/navCart/navCart.component' +import navCart from 'common/components/nav/navCart/navCart.component' +import { giftAddedEvent, cartUpdatedEvent } from 'common/lib/cartEvents' import uibDropdown from 'angular-ui-bootstrap/src/dropdown' import analyticsFactory from 'app/analytics/analytics.factory' diff --git a/src/common/components/nav/navCartIcon.component.spec.js b/src/common/components/nav/navCartIcon.component.spec.js index 517c6c5be..c2397ca4c 100644 --- a/src/common/components/nav/navCartIcon.component.spec.js +++ b/src/common/components/nav/navCartIcon.component.spec.js @@ -2,7 +2,7 @@ import angular from 'angular' import 'angular-mocks' import module from './navCartIcon.component' -import { giftAddedEvent, cartUpdatedEvent } from 'common/components/nav/navCart/navCart.component' +import { giftAddedEvent, cartUpdatedEvent } from 'common/lib/cartEvents' describe('nav cart icon', function () { beforeEach(angular.mock.module(module.name)) diff --git a/src/common/lib/cartEvents.js b/src/common/lib/cartEvents.js new file mode 100644 index 000000000..d4b9d0c42 --- /dev/null +++ b/src/common/lib/cartEvents.js @@ -0,0 +1,2 @@ +export const giftAddedEvent = 'giftAddedToCart' +export const cartUpdatedEvent = 'cartUpdatedEvent'