{"version":3,"file":"daffodil-authorizenet-state.mjs","names":["i1","i1","i2"],"sources":["../../../libs/authorizenet/state/src/actions/authorizenet.actions.ts","../../../libs/authorizenet/state/src/reducers/authorize-net/initial-state.ts","../../../libs/authorizenet/state/src/reducers/authorize-net/authorize-net.reducer.ts","../../../libs/authorizenet/state/src/reducers/authorize-net.reducers.ts","../../../libs/authorizenet/state/src/reducers/authorizenet-store-feature-key.ts","../../../libs/authorizenet/state/src/reducers/token/extra.token.ts","../../../libs/authorizenet/state/src/selectors/authorize-net.selector.ts","../../../libs/authorizenet/state/src/config/default.ts","../../../libs/authorizenet/state/src/config/token.ts","../../../libs/authorizenet/state/src/injection-tokens/error-matcher.token.ts","../../../libs/authorizenet/state/src/facades/authorize-net.facade.ts","../../../libs/authorizenet/state/src/effects/authorize-net.effects.ts","../../../libs/authorizenet/state/src/reducers/token/reducers.token.ts","../../../libs/authorizenet/state/src/authorize-net-state.module.ts","../../../libs/authorizenet/state/src/payment-state.module.ts","../../../libs/authorizenet/state/src/provider.ts"],"sourcesContent":["import { Action } from '@ngrx/store';\n\nimport {\n  DaffAuthorizenetPaymentRequest,\n  DaffAuthorizeNetTokenRequest,\n} from '@daffodil/authorizenet';\nimport { DaffCartAddress } from '@daffodil/cart';\nimport { DaffIdentifiable } from '@daffodil/core';\nimport { DaffStateError } from '@daffodil/core/state';\nimport { DaffPersonalAddress } from '@daffodil/geography';\nimport { DaffPaymentGenerateToken } from '@daffodil/payment/state';\n\nexport enum DaffAuthorizeNetActionTypes {\n  UpdatePaymentAction = '[@daffodil/authorizenet] Update Payment',\n  UpdatePaymentSuccessAction = '[@daffodil/authorizenet] Update Payment Success',\n  UpdatePaymentFailureAction = '[@daffodil/authorizenet] Update Payment Failure',\n  ApplyPaymentAction = '[@daffodil/authorizenet] Apply Payment',\n  LoadAcceptJsAction = '[@daffodil/authorizenet] Load Accept Js',\n  LoadAcceptJsSuccessAction = '[@daffodil/authorizenet] Load Accept Js Success',\n  LoadAcceptJsFailureAction = '[@daffodil/authorizenet] Load Accept Js Failure'\n}\n\n/**\n * An action triggered to initialize a generate token request.\n *\n * @param payload - An DaffAuthorizeNetRequestData object.\n */\nexport class DaffAuthorizeNetUpdatePayment<\n  T extends DaffAuthorizeNetTokenRequest = DaffAuthorizeNetTokenRequest,\n  V extends DaffCartAddress = DaffCartAddress\n> implements Action {\n  readonly type = DaffAuthorizeNetActionTypes.UpdatePaymentAction;\n\n  constructor(public tokenRequest: T, public address: Partial<V>) { }\n}\n\n/**\n * An action triggered upon successfully updating the payment method.\n *\n * @param payload - A string that is the payment nonce for a credit card.\n */\nexport class DaffAuthorizeNetUpdatePaymentSuccess implements Action {\n  readonly type = DaffAuthorizeNetActionTypes.UpdatePaymentSuccessAction;\n}\n\n/**\n * An action triggered upon failing to update the payment method.\n *\n * @param payload - A string that is an error message.\n */\nexport class DaffAuthorizeNetUpdatePaymentFailure implements Action {\n  readonly type = DaffAuthorizeNetActionTypes.UpdatePaymentFailureAction;\n\n  constructor(public payload: DaffStateError) { }\n}\n\nexport class DaffLoadAcceptJs implements Action {\n  readonly type = DaffAuthorizeNetActionTypes.LoadAcceptJsAction;\n}\n\n/**\n * Indicates that the AcceptJs library has loaded successfully.\n */\nexport class DaffLoadAcceptJsSuccess implements Action {\n  readonly type = DaffAuthorizeNetActionTypes.LoadAcceptJsSuccessAction;\n}\n\n/**\n * Indicates that the AcceptJs library has failed to load\n */\nexport class DaffLoadAcceptJsFailure implements Action {\n  readonly type = DaffAuthorizeNetActionTypes.LoadAcceptJsFailureAction;\n\n  constructor(public payload: DaffStateError) {};\n}\n\n/**\n * Triggers the application of an authorize.net payment.\n *\n * @role action\n */\nexport class DaffAuthorizenetApplyPayment implements DaffPaymentGenerateToken<DaffAuthorizenetPaymentRequest> {\n  readonly type = DaffAuthorizeNetActionTypes.ApplyPaymentAction;\n\n  constructor(\n    public request: DaffAuthorizenetPaymentRequest,\n    public address?: DaffPersonalAddress | DaffIdentifiable,\n  ) {};\n}\n\nexport type DaffAuthorizeNetActions<\n  T extends DaffAuthorizeNetTokenRequest = DaffAuthorizeNetTokenRequest\n> =\n\t| DaffAuthorizeNetUpdatePayment<T>\n\t| DaffAuthorizeNetUpdatePaymentSuccess\n\t| DaffAuthorizeNetUpdatePaymentFailure\n\t| DaffAuthorizenetApplyPayment\n\t| DaffLoadAcceptJsSuccess\n\t| DaffLoadAcceptJsFailure\n\t| DaffLoadAcceptJs;\n","import { DaffAuthorizeNetReducerState } from './authorize-net-reducer.interface';\n\nexport const daffAuthorizeNetReducerInitialState: DaffAuthorizeNetReducerState = {\n  isAcceptLoaded: false,\n  paymentError: null,\n  acceptJsLoadError: null,\n  loading: false,\n};\n","import { DaffAuthorizeNetTokenRequest } from '@daffodil/authorizenet';\nimport {\n  DaffPaymentActions,\n  DaffPaymentActionTypes,\n} from '@daffodil/payment/state';\n\nimport { DaffAuthorizeNetReducerState } from './authorize-net-reducer.interface';\nimport { daffAuthorizeNetReducerInitialState } from './initial-state';\nimport {\n  DaffAuthorizeNetActions,\n  DaffAuthorizeNetActionTypes,\n} from '../../actions/authorizenet.actions';\n\nexport function daffAuthorizeNetReducer <T extends DaffAuthorizeNetTokenRequest>(\n  state: DaffAuthorizeNetReducerState = daffAuthorizeNetReducerInitialState,\n  action: DaffAuthorizeNetActions<T> | DaffPaymentActions,\n): DaffAuthorizeNetReducerState {\n  switch (action.type) {\n    case DaffAuthorizeNetActionTypes.UpdatePaymentAction:\n    case DaffAuthorizeNetActionTypes.ApplyPaymentAction:\n      return {\n        ...state,\n        loading: true,\n      };\n    case DaffAuthorizeNetActionTypes.UpdatePaymentSuccessAction:\n    case DaffPaymentActionTypes.GenerateTokenSuccessAction:\n      return {\n        ...state,\n        loading: false,\n        paymentError: null,\n      };\n    case DaffAuthorizeNetActionTypes.UpdatePaymentFailureAction:\n    case DaffPaymentActionTypes.GenerateTokenFailureAction:\n      return {\n        ...state,\n        loading: false,\n        paymentError: action.payload,\n      };\n\n    case DaffAuthorizeNetActionTypes.LoadAcceptJsSuccessAction:\n      return {\n        ...state,\n        isAcceptLoaded: true,\n        acceptJsLoadError: null,\n      };\n    case DaffAuthorizeNetActionTypes.LoadAcceptJsFailureAction:\n      return {\n        ...state,\n        loading: false,\n        acceptJsLoadError: action.payload,\n      };\n    default:\n      return state;\n  }\n}\n","import { daffAuthorizeNetReducer } from './authorize-net/authorize-net.reducer';\n\nexport const daffAuthorizeNetReducers = {\n  authorizeNet: daffAuthorizeNetReducer,\n};\n","export const DAFF_AUTHORIZENET_STORE_FEATURE_KEY = 'daffAuthorizenet';\n","import { ActionReducer } from '@ngrx/store';\n\nimport { createMultiInjectionToken } from '@daffodil/core';\n\nimport { DaffAuthorizeNetReducersState } from '../authorize-net-reducers.interface';\n\nexport const {\n  /**\n   * A token to hold the injectable extra reducers.\n   *\n   * Prefer using {@link daffAuthorizeNetProvideExtraReducers}.\n   */\n  token: DAFF_AUTHORIZE_NET_EXTRA_REDUCERS,\n\n  /**\n   * Provides additional reducers that run after the standard Daffodil authorizenet reducers.\n   *\n   * @example\n   * ```ts\n   * providers: [\n   *   ...daffAuthorizeNetProvideExtraReducers(\n   *     myReducer1,\n   *     myReducer2\n   *   )\n   * ]\n   * ```\n   */\n  provider: daffAuthorizeNetProvideExtraReducers,\n} = createMultiInjectionToken<ActionReducer<DaffAuthorizeNetReducersState>>(\n  'DAFF_AUTHORIZE_NET_EXTRA_REDUCERS',\n  { providedIn: 'any' },\n);\n","import {\n  createSelector,\n  createFeatureSelector,\n  MemoizedSelector,\n  defaultMemoize,\n} from '@ngrx/store';\n\nimport { DaffStateError } from '@daffodil/core/state';\n\nimport {\n  DaffAuthorizeNetReducersState,\n  DaffAuthorizeNetReducerState,\n  DaffAuthorizeNetStateRootSlice,\n  DAFF_AUTHORIZENET_STORE_FEATURE_KEY,\n} from '../reducers/public_api';\n\n\nexport interface DaffAuthorizeNetMemoizedSelectors {\n  selectAuthorizeNetFeatureState: MemoizedSelector<DaffAuthorizeNetStateRootSlice, DaffAuthorizeNetReducersState>;\n  selectAuthorizeNetState: MemoizedSelector<DaffAuthorizeNetStateRootSlice, DaffAuthorizeNetReducerState> ;\n  selectLoading: MemoizedSelector<DaffAuthorizeNetStateRootSlice, boolean>;\n  selectPaymentError: MemoizedSelector<DaffAuthorizeNetStateRootSlice, DaffStateError>;\n  selectAcceptJsLoadError: MemoizedSelector<DaffAuthorizeNetStateRootSlice, DaffStateError>;\n  selectIsAcceptJsLoaded: MemoizedSelector<DaffAuthorizeNetStateRootSlice, boolean>;\n}\n\nconst createAuthorizeNetSelectors = (): DaffAuthorizeNetMemoizedSelectors => {\n\n  /**\n   * AuthorizeNet Feature State\n   */\n  const selectAuthorizeNetFeatureState = createFeatureSelector<DaffAuthorizeNetStateRootSlice, DaffAuthorizeNetReducersState>(DAFF_AUTHORIZENET_STORE_FEATURE_KEY);\n\n  /**\n   * AuthorizeNet State\n   */\n  const selectAuthorizeNetState = createSelector(\n    selectAuthorizeNetFeatureState,\n    (state: DaffAuthorizeNetReducersState) => state.authorizeNet,\n  );\n\n  /**\n   * AuthorizeNet loading state\n   */\n  const selectLoading = createSelector(\n    selectAuthorizeNetState,\n    (state: DaffAuthorizeNetReducerState) => state.loading,\n  );\n\n  /**\n   * AuthorizeNet payment error\n   */\n  const selectPaymentError = createSelector(\n    selectAuthorizeNetState,\n    (state: DaffAuthorizeNetReducerState) => state.paymentError,\n  );\n\n  /**\n   * AcceptJs load error\n   */\n  const selectAcceptJsLoadError = createSelector(\n    selectAuthorizeNetState,\n    (state: DaffAuthorizeNetReducerState) => state.acceptJsLoadError,\n  );\n\n  /**\n   * AcceptJs is loaded\n   */\n  const selectIsAcceptJsLoaded = createSelector(\n    selectAuthorizeNetState,\n    (state: DaffAuthorizeNetReducerState) => state.isAcceptLoaded,\n  );\n\n  return {\n    selectAuthorizeNetFeatureState,\n    selectAuthorizeNetState,\n    selectLoading,\n    selectPaymentError,\n    selectAcceptJsLoadError,\n    selectIsAcceptJsLoaded,\n  };\n};\n\nexport const daffAuthorizeNetSelectors: () => DaffAuthorizeNetMemoizedSelectors = defaultMemoize(() => createAuthorizeNetSelectors()).memoized;\n","import { DaffAuthorizeNetStateConfig } from './type';\n\nexport const daffAuthorizeNetStateDefaultConfig: DaffAuthorizeNetStateConfig = {\n  acceptMaxRetries: 5,\n  acceptBackoffTiming: 30,\n};\n","import { createConfigInjectionToken } from '@daffodil/core';\n\nimport { daffAuthorizeNetStateDefaultConfig } from './default';\nimport { DaffAuthorizeNetStateConfig } from './type';\n\nexport const {\n  token: DAFF_AUTHORIZE_NET_STATE_CONFIG,\n  /**\n   * Provider function for {@link DAFF_AUTHORIZE_NET_STATE_CONFIG}.\n   */\n  provider: provideDaffAuthorizeNetStateConfig,\n} = createConfigInjectionToken<DaffAuthorizeNetStateConfig>(daffAuthorizeNetStateDefaultConfig, 'DAFF_AUTHORIZE_NET_STATE_CONFIG');\n","import { createSingleInjectionToken } from '@daffodil/core';\nimport { daffTransformErrorToStateError } from '@daffodil/core/state';\n\n/**\n * Transforms `DaffError`s into `DaffStateError`s before they are serialized into state.\n * Can be used to further refine Daffodil errors into more specific app errors.\n */\nexport const {\n  token: DAFF_AUTHORIZENET_ERROR_MATCHER,\n  /**\n   * Provider function for {@link DAFF_AUTHORIZENET_ERROR_MATCHER}.\n   */\n  provider: provideDaffAuthorizenetErrorMatcher,\n} = createSingleInjectionToken<typeof daffTransformErrorToStateError>(\n  'DAFF_AUTHORIZENET_ERROR_MATCHER',\n  { factory: () => daffTransformErrorToStateError },\n);\n","import { Injectable } from '@angular/core';\nimport {\n  Action,\n  Store,\n  select,\n} from '@ngrx/store';\nimport { Observable } from 'rxjs';\n\nimport { DaffStateError } from '@daffodil/core/state';\n\nimport { DaffAuthorizeNetFacadeInterface } from './authorize-net-facade.interface';\nimport { DaffAuthorizeNetStateRootSlice } from '../reducers/authorize-net-reducers.interface';\nimport { daffAuthorizeNetSelectors } from '../selectors/authorize-net.selector';\n\n@Injectable({\n  providedIn: 'root',\n})\nexport class DaffAuthorizeNetFacade implements DaffAuthorizeNetFacadeInterface {\n\n  isAcceptJsLoaded$: Observable<boolean>;\n  loading$: Observable<boolean>;\n  paymentError$: Observable<DaffStateError>;\n  acceptJsLoadError$: Observable<DaffStateError>;\n\n  constructor(private store: Store<DaffAuthorizeNetStateRootSlice>) {\n    const {\n      selectIsAcceptJsLoaded,\n      selectLoading,\n      selectPaymentError,\n      selectAcceptJsLoadError,\n    } = daffAuthorizeNetSelectors();\n\n    this.isAcceptJsLoaded$ = this.store.pipe(select(selectIsAcceptJsLoaded));\n    this.loading$ = this.store.pipe(select(selectLoading));\n    this.paymentError$ = this.store.pipe(select(selectPaymentError));\n    this.acceptJsLoadError$ = this.store.pipe(select(selectAcceptJsLoadError));\n  }\n\n  dispatch(action: Action) {\n    this.store.dispatch(action);\n  }\n}\n","import {\n  Injectable,\n  Inject,\n} from '@angular/core';\nimport {\n  Actions,\n  createEffect,\n  ofType,\n} from '@ngrx/effects';\nimport {\n  defer,\n  Observable,\n  of,\n} from 'rxjs';\nimport {\n  switchMap,\n  catchError,\n  map,\n  tap,\n} from 'rxjs/operators';\n\nimport {\n  DaffAcceptJsLoadingService,\n  DaffAuthorizeNetTokenRequest,\n} from '@daffodil/authorizenet';\nimport {\n  DaffAuthorizeNetDriver,\n  DaffAuthorizeNetService,\n  DaffAuthorizeNetPaymentId,\n  DaffAuthorizeNetAcceptjsMissingError,\n} from '@daffodil/authorizenet/driver';\nimport {\n  DaffCartPaymentActionTypes,\n  DaffCartPaymentUpdateWithBilling,\n  DaffCartPaymentUpdateWithBillingFailure,\n} from '@daffodil/cart/state';\nimport {\n  backoff,\n  DaffError,\n} from '@daffodil/core';\nimport {\n  substream,\n  ErrorTransformer,\n} from '@daffodil/core/state';\n\nimport {\n  DaffAuthorizeNetActionTypes,\n  DaffAuthorizeNetUpdatePayment,\n  DaffAuthorizeNetUpdatePaymentFailure,\n  DaffLoadAcceptJs,\n  DaffAuthorizeNetUpdatePaymentSuccess,\n  DaffLoadAcceptJsFailure,\n  DaffLoadAcceptJsSuccess,\n} from '../actions/authorizenet.actions';\nimport {\n  DAFF_AUTHORIZE_NET_STATE_CONFIG,\n  DaffAuthorizeNetStateConfig,\n} from '../config/public_api';\nimport { DAFF_AUTHORIZENET_ERROR_MATCHER } from '../injection-tokens/public_api';\n\n@Injectable()\nexport class DaffAuthorizeNetEffects<T extends DaffAuthorizeNetTokenRequest = DaffAuthorizeNetTokenRequest> {\n\n  constructor(\n    private actions$: Actions,\n    @Inject(DaffAuthorizeNetDriver) private driver: DaffAuthorizeNetService<T>,\n    @Inject(DaffAuthorizeNetPaymentId) private authorizeNetPaymentId: string,\n    @Inject(DAFF_AUTHORIZENET_ERROR_MATCHER) private errorMatcher: ErrorTransformer,\n    @Inject(DAFF_AUTHORIZE_NET_STATE_CONFIG) private config: DaffAuthorizeNetStateConfig,\n    private acceptJsLoadingService: DaffAcceptJsLoadingService,\n  ) {}\n\n\n  updatePayment$: Observable<any> = createEffect(() => this.actions$.pipe(\n    ofType(DaffAuthorizeNetActionTypes.UpdatePaymentAction),\n    switchMap((action: DaffAuthorizeNetUpdatePayment<T>) =>\n      this.driver.generateToken(action.tokenRequest).pipe(\n        map(resp => new DaffCartPaymentUpdateWithBilling(\n          {\n            method: this.authorizeNetPaymentId,\n            payment_info: resp,\n          },\n          action.address,\n        )),\n        catchError((error: DaffError) =>\n          of(new DaffAuthorizeNetUpdatePaymentFailure(this.errorMatcher(error))),\n        ),\n      ),\n    ),\n  ));\n\n\n  updatePaymentSuccessSubstream$: Observable<any> = createEffect(() => this.actions$.pipe(\n    substream(\n      [DaffAuthorizeNetActionTypes.UpdatePaymentAction, DaffCartPaymentActionTypes.CartPaymentUpdateWithBillingSuccessAction],\n      DaffCartPaymentActionTypes.CartPaymentUpdateWithBillingFailureAction,\n    ),\n    map(() => new DaffAuthorizeNetUpdatePaymentSuccess()),\n  ));\n\n\n  updatePaymentFailureSubstream$: Observable<any> = createEffect(() => this.actions$.pipe(\n    substream(\n      [DaffAuthorizeNetActionTypes.UpdatePaymentAction, DaffCartPaymentActionTypes.CartPaymentUpdateWithBillingFailureAction],\n      DaffCartPaymentActionTypes.CartPaymentUpdateWithBillingSuccessAction,\n    ),\n    map(([updatePaymentAction, updatePaymentFailureAction]: [DaffAuthorizeNetUpdatePayment, DaffCartPaymentUpdateWithBillingFailure]) =>\n      new DaffAuthorizeNetUpdatePaymentFailure(this.errorMatcher(updatePaymentFailureAction.payload[0])),\n    ),\n  ));\n\n\n  loadAcceptJs$ = createEffect(() => (maxTries = this.config.acceptMaxRetries, ms = this.config.acceptBackoffTiming): Observable<any> => this.actions$.pipe(\n    ofType(DaffAuthorizeNetActionTypes.LoadAcceptJsAction),\n    tap((action: DaffLoadAcceptJs) => this.acceptJsLoadingService.load()),\n    switchMap(() => defer(() => of(this.acceptJsLoadingService.getAccept())).pipe(\n      backoff(maxTries, ms),\n      map((Accept) => Accept ? new DaffLoadAcceptJsSuccess() : new DaffLoadAcceptJsFailure(new DaffAuthorizeNetAcceptjsMissingError('Accept.js failed to load.'))),\n      catchError((error: DaffError) => of(new DaffLoadAcceptJsFailure(this.errorMatcher(error)))),\n    )),\n  ));\n}\n","import { ActionReducer } from '@ngrx/store';\n\nimport { createSingleInjectionToken } from '@daffodil/core';\n\nimport { DaffAuthorizeNetReducersState } from '../authorize-net-reducers.interface';\n\nexport const {\n  /**\n   * An internal token to hold the Daffodil authorizenet reducers.\n   * Includes the extra and standard reducers.\n   *\n   * @docs-private\n   */\n  token: DAFF_AUTHORIZE_NET_REDUCERS,\n  /**\n   * Provider function for {@link DAFF_AUTHORIZE_NET_REDUCERS}.\n   */\n  provider: provideDaffAuthorizeNetReducers,\n  /**\n   * Factory provider function for {@link DAFF_AUTHORIZE_NET_REDUCERS}.\n   */\n  factoryProvider: provideDaffAuthorizeNetReducersFactory,\n} = createSingleInjectionToken<ActionReducer<DaffAuthorizeNetReducersState>>(\n  'DAFF_AUTHORIZE_NET_REDUCERS',\n);\n","import {\n  inject,\n  ModuleWithProviders,\n  NgModule,\n} from '@angular/core';\nimport { EffectsModule } from '@ngrx/effects';\nimport {\n  combineReducers,\n  StoreModule,\n} from '@ngrx/store';\n\nimport { daffComposeReducers } from '@daffodil/core/state';\n\nimport {\n  DaffAuthorizeNetStateConfig,\n  daffAuthorizeNetStateDefaultConfig,\n  provideDaffAuthorizeNetStateConfig,\n} from './config/public_api';\nimport { DaffAuthorizeNetEffects } from './effects/authorize-net.effects';\nimport { daffAuthorizeNetReducer } from './reducers/authorize-net/authorize-net.reducer';\nimport { DAFF_AUTHORIZENET_STORE_FEATURE_KEY } from './reducers/authorizenet-store-feature-key';\nimport { DAFF_AUTHORIZE_NET_EXTRA_REDUCERS } from './reducers/token/extra.token';\nimport {\n  DAFF_AUTHORIZE_NET_REDUCERS,\n  provideDaffAuthorizeNetReducersFactory,\n} from './reducers/token/reducers.token';\n\n/**\n * @deprecated in favor of {@link provideDaffAuthorizeNetState} Deprecated in version 0.95.0. Will be removed in version 0.98.0.\n */\n@NgModule({\n  imports: [\n    StoreModule.forFeature(DAFF_AUTHORIZENET_STORE_FEATURE_KEY, DAFF_AUTHORIZE_NET_REDUCERS),\n    EffectsModule.forFeature([DaffAuthorizeNetEffects]),\n  ],\n  providers: [\n    provideDaffAuthorizeNetStateConfig(daffAuthorizeNetStateDefaultConfig),\n    provideDaffAuthorizeNetReducersFactory(() => daffComposeReducers([\n      combineReducers({\n        authorizeNet: daffAuthorizeNetReducer,\n      }),\n      ...inject(DAFF_AUTHORIZE_NET_EXTRA_REDUCERS),\n    ])),\n  ],\n})\nexport class DaffAuthorizeNetStateModule {\n  static withConfig(config: Partial<DaffAuthorizeNetStateConfig> = {}): ModuleWithProviders<DaffAuthorizeNetStateModule> {\n    return {\n      ngModule: DaffAuthorizeNetStateModule,\n      providers: [\n        provideDaffAuthorizeNetStateConfig({\n          ...daffAuthorizeNetStateDefaultConfig,\n          ...config,\n        }),\n      ],\n    };\n  }\n}\n","import { NgModule } from '@angular/core';\nimport { combineReducers } from '@ngrx/store';\n\nimport { DAFF_AUTHORIZENET_PAYMENT_KIND } from '@daffodil/authorizenet';\nimport { DaffAuthorizeNetPaymentDriver } from '@daffodil/authorizenet/driver';\nimport {\n  daffPaymentProvideAvailableProcessors,\n  daffPaymentProvideExtraReducers,\n  daffPaymentReducerFactory,\n  DaffPaymentStateModule,\n} from '@daffodil/payment/state';\n\nimport { DaffAuthorizeNetActionTypes } from './actions/authorizenet.actions';\n\n/**\n * @deprecated in favor of {@link provideDaffAuthorizeNetPaymentState} Deprecated in version 0.95.0. Will be removed in version 0.98.0.\n */\n@NgModule({\n  imports: [\n    DaffPaymentStateModule,\n  ],\n  providers: [\n    daffPaymentProvideAvailableProcessors({\n      kind: DAFF_AUTHORIZENET_PAYMENT_KIND,\n      action: DaffAuthorizeNetActionTypes.ApplyPaymentAction,\n      driver: DaffAuthorizeNetPaymentDriver,\n    }),\n    ...daffPaymentProvideExtraReducers(combineReducers({\n      payment: daffPaymentReducerFactory([DaffAuthorizeNetActionTypes.ApplyPaymentAction]),\n    })),\n  ],\n})\nexport class DaffAuthorizeNetPaymentStateModule { }\n","import {\n  EnvironmentProviders,\n  inject,\n  makeEnvironmentProviders,\n} from '@angular/core';\nimport { provideEffects } from '@ngrx/effects';\nimport {\n  combineReducers,\n  provideState,\n} from '@ngrx/store';\n\nimport { DAFF_AUTHORIZENET_PAYMENT_KIND } from '@daffodil/authorizenet';\nimport { DaffAuthorizeNetPaymentDriver } from '@daffodil/authorizenet/driver';\nimport { daffComposeReducers } from '@daffodil/core/state';\nimport {\n  daffPaymentProvideAvailableProcessors,\n  daffPaymentProvideExtraReducers,\n  daffPaymentReducerFactory,\n  provideDaffPaymentState,\n} from '@daffodil/payment/state';\n\nimport { DaffAuthorizeNetActionTypes } from './actions/authorizenet.actions';\nimport {\n  DaffAuthorizeNetStateConfig,\n  daffAuthorizeNetStateDefaultConfig,\n  provideDaffAuthorizeNetStateConfig,\n} from './config/public_api';\nimport { DaffAuthorizeNetEffects } from './effects/authorize-net.effects';\nimport { daffAuthorizeNetReducer } from './reducers/authorize-net/authorize-net.reducer';\nimport { DAFF_AUTHORIZENET_STORE_FEATURE_KEY } from './reducers/authorizenet-store-feature-key';\nimport { DAFF_AUTHORIZE_NET_EXTRA_REDUCERS } from './reducers/token/extra.token';\nimport {\n  DAFF_AUTHORIZE_NET_REDUCERS,\n  provideDaffAuthorizeNetReducersFactory,\n} from './reducers/token/reducers.token';\n\n/**\n * Provides the `@daffodil/authorizenet/state` feature state and effects.\n * The passed config is merged over {@link daffAuthorizeNetStateDefaultConfig}.\n */\nexport const provideDaffAuthorizeNetState = (config: Partial<DaffAuthorizeNetStateConfig> = {}): EnvironmentProviders => makeEnvironmentProviders([\n  provideState(DAFF_AUTHORIZENET_STORE_FEATURE_KEY, DAFF_AUTHORIZE_NET_REDUCERS),\n  provideEffects(DaffAuthorizeNetEffects),\n  provideDaffAuthorizeNetStateConfig({\n    ...daffAuthorizeNetStateDefaultConfig,\n    ...config,\n  }),\n  provideDaffAuthorizeNetReducersFactory(() => daffComposeReducers([\n    combineReducers({\n      authorizeNet: daffAuthorizeNetReducer,\n    }),\n    ...inject(DAFF_AUTHORIZE_NET_EXTRA_REDUCERS),\n  ])),\n]);\n\n/**\n * Registers Authorize.Net as an available payment processor with `@daffodil/payment/state`.\n * Includes {@link provideDaffPaymentState}.\n */\nexport const provideDaffAuthorizeNetPaymentState = (): EnvironmentProviders => makeEnvironmentProviders([\n  provideDaffPaymentState(),\n  daffPaymentProvideAvailableProcessors({\n    kind: DAFF_AUTHORIZENET_PAYMENT_KIND,\n    action: DaffAuthorizeNetActionTypes.ApplyPaymentAction,\n    driver: DaffAuthorizeNetPaymentDriver,\n  }),\n  ...daffPaymentProvideExtraReducers(combineReducers({\n    payment: daffPaymentReducerFactory([DaffAuthorizeNetActionTypes.ApplyPaymentAction]),\n  })),\n]);\n"],"mappings":";;;;;;;;;;;;;;;AAYA,IAAY;CAAZ,SAAY,6BAA2B;CACrC,4BAAA,yBA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