Skip to content

Commit

Permalink
fix(demo): in-memory driver never gets loaded (#3051)
Browse files Browse the repository at this point in the history
  • Loading branch information
griest024 authored Sep 17, 2024
1 parent cb114f1 commit d4df739
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 42 deletions.
12 changes: 12 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@
{
"replace": "apps/demo/src/environments/environment.ts",
"with": "apps/demo/src/environments/environment.prod.ts"
},
{
"replace": "apps/demo/src/app/drivers/driver.module.ts",
"with": "apps/demo/src/app/drivers/in-memory.module.ts"
}
]
},
Expand All @@ -86,6 +90,10 @@
{
"replace": "apps/demo/src/environments/environment.ts",
"with": "apps/demo/src/environments/environment.magento.ts"
},
{
"replace": "apps/demo/src/app/drivers/driver.module.ts",
"with": "apps/demo/src/app/drivers/magento.module.ts"
}
]
},
Expand All @@ -94,6 +102,10 @@
{
"replace": "apps/demo/src/environments/environment.ts",
"with": "apps/demo/src/environments/environment.venia.ts"
},
{
"replace": "apps/demo/src/app/drivers/driver.module.ts",
"with": "apps/demo/src/app/drivers/magento.module.ts"
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions apps/demo/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { DemoCartRootModule } from './cart/cart-root.module';
import { CategoryModule } from './category/category.module';
import { DemoCheckoutStepActionTypes } from './checkout/actions/checkout-step.actions';
import { TemplateModule } from './core/template/template/template.module';
import { DemoDriverMap } from './drivers/map';
import { DemoDriverModule } from './drivers/driver.module';
import { NotFoundModule } from './misc/not-found/not-found.module';
import { ProductModule } from './product/product.module';
import { DemoRoutingComponentModule } from './routing/routing-component.module';
Expand All @@ -36,7 +36,7 @@ import { environment } from '../environments/environment';

HttpClientModule,

DemoDriverMap[environment.driver.variant],
DemoDriverModule,

StoreModule.forRoot({}),
EffectsModule.forRoot([]),
Expand Down
4 changes: 4 additions & 0 deletions apps/demo/src/app/drivers/driver.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { NgModule } from '@angular/core';

@NgModule()
export class DemoDriverModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
import { HttpClientInMemoryWebApiModule } from 'angular-in-memory-web-api';

import { DaffAuthInMemoryDriverModule } from '@daffodil/auth/driver/in-memory';
import { DaffAuthorizeNetInMemoryDriverModule } from '@daffodil/authorizenet/driver/in-memory';
import { DaffCartInMemoryDriverModule } from '@daffodil/cart/driver/in-memory';
import { DaffCategoryInMemoryDriverModule } from '@daffodil/category/driver/in-memory';
import { DaffInMemoryBackendCategoryService } from '@daffodil/category/driver/in-memory';
Expand All @@ -19,13 +20,13 @@ import { DaffProductInMemoryDriverModule } from '@daffodil/product/driver/in-mem
import { DaffCompositeProductInMemoryDriverModule } from '@daffodil/product-composite/driver/in-memory';
import { DaffConfigurableProductInMemoryDriverModule } from '@daffodil/product-configurable/driver/in-memory';

import { DemoInMemoryBackendService } from './backend/backend.service';
import { DEMO_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG } from './external-router.config.token';

import { DemoInMemoryBackendService } from './in-memory/backend/backend.service';
import { DEMO_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG } from './in-memory/external-router.config.token';

@NgModule({
imports: [
HttpClientInMemoryWebApiModule.forRoot(DemoInMemoryBackendService),
DaffAuthorizeNetInMemoryDriverModule.forRoot(),
DaffAuthInMemoryDriverModule.forRoot(),
DaffProductInMemoryDriverModule.forRoot(),
DaffCompositeProductInMemoryDriverModule.forRoot(),
Expand All @@ -47,4 +48,4 @@ import { DEMO_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG } from './external-router.
},
],
})
export class DemoInMemoryDriverModule { }
export class DemoDriverModule { }
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import { DaffNavigationMagentoDriverModule } from '@daffodil/navigation/driver/m
import { DaffNewsletterInMemoryDriverModule } from '@daffodil/newsletter/driver/in-memory';
import { DaffProductMagentoDriverModule } from '@daffodil/product/driver/magento';

import { demoMagentoApolloOptions } from './apollo-options.factory';
import { environment } from '../../../environments/environment';
import { MagentoEnvironmentDriverConfiguration } from '../../../environments/environment.interface';
import { demoMagentoApolloOptions } from './magento/apollo-options.factory';
import { environment } from '../../environments/environment';
import { MagentoEnvironmentDriverConfiguration } from '../../environments/environment.interface';

@NgModule({
imports: [
Expand Down Expand Up @@ -47,4 +47,4 @@ import { MagentoEnvironmentDriverConfiguration } from '../../../environments/env
},
],
})
export class DemoMagentoDriverModule {}
export class DemoDriverModule {}
22 changes: 0 additions & 22 deletions apps/demo/src/app/drivers/map.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { DaffCartInMemoryDriverModule } from '@daffodil/cart/driver/in-memory';
import { DaffNewsletterInMemoryDriverModule } from '@daffodil/newsletter/driver/in-memory';
import { DaffProductShopifyDriverModule } from '@daffodil/product/driver/shopify';

import { environment } from '../../../environments/environment';
import { ShopifyEnviromentDriverConfiguration } from '../../../environments/environment.interface';
import { environment } from '../../environments/environment';
import { ShopifyEnviromentDriverConfiguration } from '../../environments/environment.interface';

const cache = new InMemoryCache();

Expand All @@ -25,7 +25,7 @@ const cache = new InMemoryCache();
DaffNewsletterInMemoryDriverModule.forRoot(),
],
})
export class DemoShopifyDriverModule {
export class DemoDriverModule {
driver: ShopifyEnviromentDriverConfiguration = (<ShopifyEnviromentDriverConfiguration>environment.driver);

// Shopify
Expand Down
14 changes: 7 additions & 7 deletions apps/demo/src/environments/environment.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@

import { DaffAuthorizeNetConfig } from '@daffodil/authorizenet/driver';

export const DemoDriverVariantEnum = {
IN_MEMORY: 0,
MAGENTO: 1,
SHOPIFY: 2,
export enum DemoDriverVariantEnum {
IN_MEMORY = 'IN_MEMORY',
MAGENTO = 'MAGENTO',
SHOPIFY = 'SHOPIFY',
};

export interface InMemoryEnviromentDriverConfiguration {
variant: typeof DemoDriverVariantEnum.IN_MEMORY;
variant: DemoDriverVariantEnum.IN_MEMORY;
}

export interface MagentoEnvironmentDriverConfiguration {
variant: typeof DemoDriverVariantEnum.MAGENTO;
variant: DemoDriverVariantEnum.MAGENTO;
domain: string;
anetConfig: DaffAuthorizeNetConfig;
}

export interface ShopifyEnviromentDriverConfiguration {
variant: typeof DemoDriverVariantEnum.SHOPIFY;
variant: DemoDriverVariantEnum.SHOPIFY;
domain: string;
publicAccessToken: string;
}
Expand Down

0 comments on commit d4df739

Please sign in to comment.