@o3r/application 12.3.0-prerelease.7 → 12.3.0-prerelease.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,10 +49,10 @@ class OtterApplicationDevtools {
49
49
  isProduction: isProductionEnvironment(this.document?.body.dataset)
50
50
  };
51
51
  }
52
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: OtterApplicationDevtools, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
53
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: OtterApplicationDevtools, providedIn: 'root' }); }
52
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: OtterApplicationDevtools, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
53
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: OtterApplicationDevtools, providedIn: 'root' }); }
54
54
  }
55
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: OtterApplicationDevtools, decorators: [{
55
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: OtterApplicationDevtools, decorators: [{
56
56
  type: Injectable,
57
57
  args: [{ providedIn: 'root' }]
58
58
  }] });
@@ -79,10 +79,10 @@ class ApplicationDevtoolsConsoleService {
79
79
  displayApplicationInfo() {
80
80
  console.info('Application info', this.applicationDevtools.getApplicationInformation());
81
81
  }
82
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ApplicationDevtoolsConsoleService, deps: [{ token: OtterApplicationDevtools }, { token: OTTER_APPLICATION_DEVTOOLS_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
83
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ApplicationDevtoolsConsoleService, providedIn: 'root' }); }
82
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: ApplicationDevtoolsConsoleService, deps: [{ token: OtterApplicationDevtools }, { token: OTTER_APPLICATION_DEVTOOLS_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
83
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: ApplicationDevtoolsConsoleService, providedIn: 'root' }); }
84
84
  }
85
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ApplicationDevtoolsConsoleService, decorators: [{
85
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: ApplicationDevtoolsConsoleService, decorators: [{
86
86
  type: Injectable,
87
87
  args: [{
88
88
  providedIn: 'root'
@@ -203,10 +203,10 @@ class ApplicationDevtoolsMessageService {
203
203
  prepareVisualTesting(this.options.e2eIgnoreClass);
204
204
  this.sendApplicationInformation();
205
205
  }
206
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ApplicationDevtoolsMessageService, deps: [{ token: i1.LoggerService }, { token: OtterApplicationDevtools }, { token: OTTER_APPLICATION_DEVTOOLS_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
207
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ApplicationDevtoolsMessageService, providedIn: 'root' }); }
206
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: ApplicationDevtoolsMessageService, deps: [{ token: i1.LoggerService }, { token: OtterApplicationDevtools }, { token: OTTER_APPLICATION_DEVTOOLS_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
207
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: ApplicationDevtoolsMessageService, providedIn: 'root' }); }
208
208
  }
209
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ApplicationDevtoolsMessageService, decorators: [{
209
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: ApplicationDevtoolsMessageService, decorators: [{
210
210
  type: Injectable,
211
211
  args: [{
212
212
  providedIn: 'root'
@@ -234,16 +234,16 @@ class ApplicationDevtoolsModule {
234
234
  ]
235
235
  };
236
236
  }
237
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ApplicationDevtoolsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
238
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.4", ngImport: i0, type: ApplicationDevtoolsModule }); }
239
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ApplicationDevtoolsModule, providers: [
237
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: ApplicationDevtoolsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
238
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: ApplicationDevtoolsModule }); }
239
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: ApplicationDevtoolsModule, providers: [
240
240
  { provide: OTTER_APPLICATION_DEVTOOLS_OPTIONS, useValue: OTTER_APPLICATION_DEVTOOLS_DEFAULT_OPTIONS },
241
241
  ApplicationDevtoolsMessageService,
242
242
  ApplicationDevtoolsConsoleService,
243
243
  OtterApplicationDevtools
244
244
  ] }); }
245
245
  }
246
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ApplicationDevtoolsModule, decorators: [{
246
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: ApplicationDevtoolsModule, decorators: [{
247
247
  type: NgModule,
248
248
  args: [{
249
249
  providers: [
@@ -1 +1 @@
1
- {"version":3,"file":"o3r-application.mjs","sources":["../../src/browser-preference/helper.ts","../../src/devkit/application-devkit.interface.ts","../../src/devkit/application-devtools.token.ts","../../src/devkit/application-devtools.service.ts","../../src/devkit/application-devtools.console.service.ts","../../src/devkit/application-devtools.message.service.ts","../../src/devkit/application-devtools.module.ts","../../src/o3r-application.ts"],"sourcesContent":["/**\n * Method that returns the setting of the user regarding animations.\n * This setting is generally set in the Operating System settings, and it is used by browsers.\n * Refer to: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion\n */\nexport function prefersReducedMotion(): boolean {\n const mediaQueryList = window.matchMedia('(prefers-reduced-motion)');\n\n return mediaQueryList.matches;\n}\n","import type {\n ConnectContentMessage,\n DevtoolsCommonOptions,\n MessageDataTypes,\n OtterMessageContent,\n RequestMessagesContentMessage,\n} from '@o3r/core';\n\nexport interface ApplicationDevtoolsServiceOptions extends DevtoolsCommonOptions {\n /**\n * Application name\n */\n appName?: string;\n /**\n * CSS classname applied to an HTML tag to hide it, ignore it, in the e2e visual testing process\n */\n e2eIgnoreClass?: string;\n}\n\n/**\n * Session information used to track all the calls done by one or several APIs of the SDK.\n */\nexport interface SessionInformation {\n /**\n * The session ID\n */\n id: string;\n /**\n * The generated time\n */\n generatedTime: Date;\n}\n\n/** Information relative loaded application */\nexport interface ApplicationInformation {\n /**\n * Application name\n */\n appName: string;\n /** Application Version */\n appVersion: string;\n /**\n * Session Information\n * @note This is a session ID will be provided only with the Amadeus Otter implementation of the application package.\n */\n session?: SessionInformation;\n /**\n * Log Link\n * @note This a link to Alf logs, it will be provided only with the Amadeus Otter implementation of the application package.\n */\n logLink?: string;\n /** Is Production Environment */\n isProduction: boolean;\n}\n\n/** Toggle Visual Testing */\nexport interface ToggleVisualTestingMessage extends OtterMessageContent<'toggleVisualTesting'> {\n /** Toggle the visual testing mode */\n toggle?: boolean;\n}\n\n/** Application Information Message Content */\nexport interface ApplicationInformationContentMessage extends ApplicationInformation, OtterMessageContent<'applicationInformation'> {\n}\n\n/** State selection message */\nexport interface StateSelectionContentMessage extends OtterMessageContent<'stateSelection'> {\n /** Name of the state */\n stateName: string;\n /** Color of the state */\n stateColor: string;\n /** Contrast color of the state */\n stateColorContrast: string;\n}\n\n/** Unselect state message */\nexport interface UnselectStateContentMessage extends OtterMessageContent<'unselectState'> {}\n\ntype ApplicationMessageContents =\n | ApplicationInformationContentMessage\n | StateSelectionContentMessage\n | UnselectStateContentMessage\n | ToggleVisualTestingMessage;\n\n/** List of possible DataTypes for Application messages */\nexport type ApplicationMessageDataTypes = MessageDataTypes<ApplicationMessageContents>;\n\n/** List of all messages for application purpose */\nexport type AvailableApplicationMessageContents =\n | ApplicationMessageContents\n | ConnectContentMessage\n | RequestMessagesContentMessage<ApplicationMessageDataTypes>;\n\n/**\n * Determine if the given message is a Application message\n * @param message message to check\n */\nexport const isApplicationMessage = (message: any): message is AvailableApplicationMessageContents => {\n return message && (\n message.dataType === 'toggleVisualTesting'\n || message.dataType === 'stateSelection'\n || message.dataType === 'applicationInformation'\n || message.dataType === 'unselectState'\n || message.dataType === 'requestMessages'\n || message.dataType === 'connect');\n};\n","import {\n InjectionToken,\n} from '@angular/core';\nimport {\n ApplicationDevtoolsServiceOptions,\n} from './application-devkit.interface';\n\nexport const OTTER_APPLICATION_DEVTOOLS_DEFAULT_OPTIONS: Readonly<ApplicationDevtoolsServiceOptions> = {\n isActivatedOnBootstrap: false\n} as const;\n\nexport const OTTER_APPLICATION_DEVTOOLS_OPTIONS = new InjectionToken<ApplicationDevtoolsServiceOptions>('Otter Application Devtools options');\n","import {\n DOCUMENT,\n} from '@angular/common';\nimport {\n inject,\n Injectable,\n} from '@angular/core';\nimport {\n type Dataset,\n isProductionEnvironment,\n} from '@o3r/core';\nimport {\n ENVIRONMENT_CONFIG_TOKEN,\n} from '@o3r/routing';\nimport type {\n ApplicationInformation,\n} from './application-devkit.interface';\nimport {\n OTTER_APPLICATION_DEVTOOLS_OPTIONS,\n} from './application-devtools.token';\n\n@Injectable({ providedIn: 'root' })\nexport class OtterApplicationDevtools {\n private readonly options = inject(OTTER_APPLICATION_DEVTOOLS_OPTIONS, { optional: true });\n private readonly document = inject(DOCUMENT, { optional: true });\n private readonly env = inject(ENVIRONMENT_CONFIG_TOKEN, { optional: true });\n\n public getApplicationInformation(): ApplicationInformation {\n return {\n appName: this.options?.appName || 'unknown',\n appVersion: this.env?.APP_VERSION || 'unknown',\n isProduction: isProductionEnvironment(this.document?.body.dataset as Dataset)\n };\n }\n}\n","/* eslint-disable no-console -- purpose of the service is to log in the console */\nimport {\n Inject,\n Injectable,\n Optional,\n} from '@angular/core';\nimport type {\n DevtoolsServiceInterface,\n WindowWithDevtools,\n} from '@o3r/core';\nimport {\n ApplicationDevtoolsServiceOptions,\n} from './application-devkit.interface';\nimport {\n OtterApplicationDevtools,\n} from './application-devtools.service';\nimport {\n OTTER_APPLICATION_DEVTOOLS_DEFAULT_OPTIONS,\n OTTER_APPLICATION_DEVTOOLS_OPTIONS,\n} from './application-devtools.token';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ApplicationDevtoolsConsoleService implements DevtoolsServiceInterface {\n /** Name of the Window property to access to the devtools */\n public static readonly windowModuleName = 'application';\n\n private readonly options: ApplicationDevtoolsServiceOptions;\n\n constructor(\n private readonly applicationDevtools: OtterApplicationDevtools,\n @Optional() @Inject(OTTER_APPLICATION_DEVTOOLS_OPTIONS) options?: ApplicationDevtoolsServiceOptions\n ) {\n this.options = { ...OTTER_APPLICATION_DEVTOOLS_DEFAULT_OPTIONS, ...options };\n\n if (this.options.isActivatedOnBootstrap) {\n this.activate();\n }\n }\n\n /** @inheritDoc */\n public activate() {\n const windowWithDevtools: WindowWithDevtools = window;\n windowWithDevtools._OTTER_DEVTOOLS_ ||= {};\n windowWithDevtools._OTTER_DEVTOOLS_[ApplicationDevtoolsConsoleService.windowModuleName] = this;\n\n console.info(`Otter Application Devtools is now accessible via the _OTTER_DEVTOOLS_.${ApplicationDevtoolsConsoleService.windowModuleName} variable`);\n }\n\n /** Display the information relative to the running application */\n public displayApplicationInfo() {\n console.info('Application info', this.applicationDevtools.getApplicationInformation());\n }\n}\n","import {\n DOCUMENT,\n} from '@angular/common';\nimport {\n DestroyRef,\n inject,\n Inject,\n Injectable,\n Optional,\n} from '@angular/core';\nimport {\n takeUntilDestroyed,\n} from '@angular/core/rxjs-interop';\nimport {\n DevtoolsServiceInterface,\n filterMessageContent,\n sendOtterMessage,\n} from '@o3r/core';\nimport {\n LoggerService,\n} from '@o3r/logger';\nimport {\n isVisualTestingEnabled,\n prepareVisualTesting,\n toggleVisualTestingRender,\n} from '@o3r/testing/visual-test/utils';\nimport {\n fromEvent,\n} from 'rxjs';\nimport {\n type ApplicationDevtoolsServiceOptions,\n type ApplicationMessageDataTypes,\n type AvailableApplicationMessageContents,\n isApplicationMessage,\n type StateSelectionContentMessage,\n} from './application-devkit.interface';\nimport {\n OtterApplicationDevtools,\n} from './application-devtools.service';\nimport {\n OTTER_APPLICATION_DEVTOOLS_DEFAULT_OPTIONS,\n OTTER_APPLICATION_DEVTOOLS_OPTIONS,\n} from './application-devtools.token';\n\nconst OTTER_STATE_RIBBON_ID = 'otter-devtools-state-ribbon';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ApplicationDevtoolsMessageService implements DevtoolsServiceInterface {\n private readonly document = inject(DOCUMENT);\n private readonly options: ApplicationDevtoolsServiceOptions;\n private readonly sendMessage = sendOtterMessage<AvailableApplicationMessageContents>;\n private readonly destroyRef = inject(DestroyRef);\n\n constructor(\n private readonly logger: LoggerService,\n private readonly applicationDevtools: OtterApplicationDevtools,\n @Optional() @Inject(OTTER_APPLICATION_DEVTOOLS_OPTIONS) options?: ApplicationDevtoolsServiceOptions) {\n this.options = {\n ...OTTER_APPLICATION_DEVTOOLS_DEFAULT_OPTIONS,\n ...options\n };\n\n if (this.options.isActivatedOnBootstrap) {\n this.activate();\n }\n }\n\n private sendApplicationInformation() {\n this.sendMessage('applicationInformation', this.applicationDevtools.getApplicationInformation());\n }\n\n /**\n * Function to connect the plugin to the Otter DevTools extension\n */\n private connectPlugin() {\n this.logger.debug('Otter DevTools is plugged to application service of the application');\n void this.sendApplicationInformation();\n }\n\n /**\n * Function to trigger a re-send a requested messages to the Otter Chrome DevTools extension\n * @param only restricted list of messages to re-send\n */\n private handleReEmitRequest(only?: ApplicationMessageDataTypes[]) {\n if (!only || only.includes('applicationInformation')) {\n this.sendApplicationInformation();\n }\n }\n\n /**\n * Function to handle the incoming messages from Otter Chrome DevTools extension\n * @param message\n */\n private handleEvents(message: AvailableApplicationMessageContents) {\n this.logger.debug('Message handling by the application service', message);\n\n switch (message.dataType) {\n case 'connect': {\n this.connectPlugin();\n break;\n }\n case 'requestMessages': {\n this.handleReEmitRequest(message.only);\n break;\n }\n case 'toggleVisualTesting': {\n this.toggleVisualTestingRender(message.toggle);\n break;\n }\n case 'stateSelection': {\n this.onStateSelection(message);\n break;\n }\n case 'unselectState': {\n this.unselectState();\n break;\n }\n default: {\n this.logger.warn('Message ignored by the application service', message);\n }\n }\n }\n\n private unselectState() {\n const ribbonElement = this.document.body.querySelector<HTMLDivElement>(`#${OTTER_STATE_RIBBON_ID}`);\n if (ribbonElement) {\n ribbonElement.remove();\n }\n }\n\n private onStateSelection(message: StateSelectionContentMessage) {\n let ribbonElement = this.document.body.querySelector<HTMLDivElement>(`#${OTTER_STATE_RIBBON_ID}`);\n if (!ribbonElement) {\n ribbonElement = this.document.createElement('div');\n ribbonElement.id = OTTER_STATE_RIBBON_ID;\n this.document.body.append(ribbonElement);\n }\n if (message.stateName) {\n ribbonElement.innerHTML = message.stateName;\n ribbonElement.style.background = message.stateColor;\n ribbonElement.style.color = message.stateColorContrast;\n ribbonElement.style.position = 'fixed';\n ribbonElement.style.bottom = '0';\n ribbonElement.style.right = '0';\n ribbonElement.style.transform = 'translate(calc(100% * (1 - cos(45deg)))) rotate(-45deg)';\n ribbonElement.style.transformOrigin = 'bottom left';\n ribbonElement.style.clipPath = 'inset(0 -100%)';\n ribbonElement.style.boxShadow = `0px 0px 0px 999px ${message.stateColor}`;\n } else {\n ribbonElement.style.display = 'none';\n }\n }\n\n /**\n * Toggle visual testing rendering\n * @param enabled activate or deactivate the visual testing mode\n */\n private toggleVisualTestingRender(enabled?: boolean) {\n toggleVisualTestingRender(enabled === undefined ? !isVisualTestingEnabled() : enabled);\n }\n\n /** @inheritDoc */\n public activate() {\n fromEvent(window, 'message').pipe(\n takeUntilDestroyed(this.destroyRef),\n filterMessageContent(isApplicationMessage)\n ).subscribe((e) => this.handleEvents(e));\n prepareVisualTesting(this.options.e2eIgnoreClass);\n this.sendApplicationInformation();\n }\n}\n","import {\n ModuleWithProviders,\n NgModule,\n} from '@angular/core';\nimport type {\n ApplicationDevtoolsServiceOptions,\n} from './application-devkit.interface';\nimport {\n ApplicationDevtoolsConsoleService,\n} from './application-devtools.console.service';\nimport {\n ApplicationDevtoolsMessageService,\n} from './application-devtools.message.service';\nimport {\n OtterApplicationDevtools,\n} from './application-devtools.service';\nimport {\n OTTER_APPLICATION_DEVTOOLS_DEFAULT_OPTIONS,\n OTTER_APPLICATION_DEVTOOLS_OPTIONS,\n} from './application-devtools.token';\n\n@NgModule({\n providers: [\n { provide: OTTER_APPLICATION_DEVTOOLS_OPTIONS, useValue: OTTER_APPLICATION_DEVTOOLS_DEFAULT_OPTIONS },\n ApplicationDevtoolsMessageService,\n ApplicationDevtoolsConsoleService,\n OtterApplicationDevtools\n ]\n})\nexport class ApplicationDevtoolsModule {\n /**\n * Initialize Otter Devtools\n * @param options\n */\n public static instrument(options: Partial<ApplicationDevtoolsServiceOptions>): ModuleWithProviders<ApplicationDevtoolsModule> {\n return {\n ngModule: ApplicationDevtoolsModule,\n providers: [\n { provide: OTTER_APPLICATION_DEVTOOLS_OPTIONS, useValue: { ...OTTER_APPLICATION_DEVTOOLS_DEFAULT_OPTIONS, ...options }, multi: false },\n ApplicationDevtoolsMessageService,\n ApplicationDevtoolsConsoleService,\n OtterApplicationDevtools\n ]\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;AAAA;;;;AAIG;SACa,oBAAoB,GAAA;IAClC,MAAM,cAAc,GAAG,MAAM,CAAC,UAAU,CAAC,0BAA0B,CAAC;IAEpE,OAAO,cAAc,CAAC,OAAO;AAC/B;;ACoFA;;;AAGG;AACU,MAAA,oBAAoB,GAAG,CAAC,OAAY,KAAoD;AACnG,IAAA,OAAO,OAAO,KACZ,OAAO,CAAC,QAAQ,KAAK;WAClB,OAAO,CAAC,QAAQ,KAAK;WACrB,OAAO,CAAC,QAAQ,KAAK;WACrB,OAAO,CAAC,QAAQ,KAAK;WACrB,OAAO,CAAC,QAAQ,KAAK;AACrB,WAAA,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC;AACtC;;AClGa,MAAA,0CAA0C,GAAgD;AACrG,IAAA,sBAAsB,EAAE;;MAGb,kCAAkC,GAAG,IAAI,cAAc,CAAoC,oCAAoC;;MCW/H,wBAAwB,CAAA;AADrC,IAAA,WAAA,GAAA;QAEmB,IA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C5BD;;AAEG;;;;"}
1
+ {"version":3,"file":"o3r-application.mjs","sources":["../../src/browser-preference/helper.ts","../../src/devkit/application-devkit.interface.ts","../../src/devkit/application-devtools.token.ts","../../src/devkit/application-devtools.service.ts","../../src/devkit/application-devtools.console.service.ts","../../src/devkit/application-devtools.message.service.ts","../../src/devkit/application-devtools.module.ts","../../src/o3r-application.ts"],"sourcesContent":["/**\n * Method that returns the setting of the user regarding animations.\n * This setting is generally set in the Operating System settings, and it is used by browsers.\n * Refer to: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion\n */\nexport function prefersReducedMotion(): boolean {\n const mediaQueryList = window.matchMedia('(prefers-reduced-motion)');\n\n return mediaQueryList.matches;\n}\n","import type {\n ConnectContentMessage,\n DevtoolsCommonOptions,\n MessageDataTypes,\n OtterMessageContent,\n RequestMessagesContentMessage,\n} from '@o3r/core';\n\nexport interface ApplicationDevtoolsServiceOptions extends DevtoolsCommonOptions {\n /**\n * Application name\n */\n appName?: string;\n /**\n * CSS classname applied to an HTML tag to hide it, ignore it, in the e2e visual testing process\n */\n e2eIgnoreClass?: string;\n}\n\n/**\n * Session information used to track all the calls done by one or several APIs of the SDK.\n */\nexport interface SessionInformation {\n /**\n * The session ID\n */\n id: string;\n /**\n * The generated time\n */\n generatedTime: Date;\n}\n\n/** Information relative loaded application */\nexport interface ApplicationInformation {\n /**\n * Application name\n */\n appName: string;\n /** Application Version */\n appVersion: string;\n /**\n * Session Information\n * @note This is a session ID will be provided only with the Amadeus Otter implementation of the application package.\n */\n session?: SessionInformation;\n /**\n * Log Link\n * @note This a link to Alf logs, it will be provided only with the Amadeus Otter implementation of the application package.\n */\n logLink?: string;\n /** Is Production Environment */\n isProduction: boolean;\n}\n\n/** Toggle Visual Testing */\nexport interface ToggleVisualTestingMessage extends OtterMessageContent<'toggleVisualTesting'> {\n /** Toggle the visual testing mode */\n toggle?: boolean;\n}\n\n/** Application Information Message Content */\nexport interface ApplicationInformationContentMessage extends ApplicationInformation, OtterMessageContent<'applicationInformation'> {\n}\n\n/** State selection message */\nexport interface StateSelectionContentMessage extends OtterMessageContent<'stateSelection'> {\n /** Name of the state */\n stateName: string;\n /** Color of the state */\n stateColor: string;\n /** Contrast color of the state */\n stateColorContrast: string;\n}\n\n/** Unselect state message */\nexport interface UnselectStateContentMessage extends OtterMessageContent<'unselectState'> {}\n\ntype ApplicationMessageContents =\n | ApplicationInformationContentMessage\n | StateSelectionContentMessage\n | UnselectStateContentMessage\n | ToggleVisualTestingMessage;\n\n/** List of possible DataTypes for Application messages */\nexport type ApplicationMessageDataTypes = MessageDataTypes<ApplicationMessageContents>;\n\n/** List of all messages for application purpose */\nexport type AvailableApplicationMessageContents =\n | ApplicationMessageContents\n | ConnectContentMessage\n | RequestMessagesContentMessage<ApplicationMessageDataTypes>;\n\n/**\n * Determine if the given message is a Application message\n * @param message message to check\n */\nexport const isApplicationMessage = (message: any): message is AvailableApplicationMessageContents => {\n return message && (\n message.dataType === 'toggleVisualTesting'\n || message.dataType === 'stateSelection'\n || message.dataType === 'applicationInformation'\n || message.dataType === 'unselectState'\n || message.dataType === 'requestMessages'\n || message.dataType === 'connect');\n};\n","import {\n InjectionToken,\n} from '@angular/core';\nimport {\n ApplicationDevtoolsServiceOptions,\n} from './application-devkit.interface';\n\nexport const OTTER_APPLICATION_DEVTOOLS_DEFAULT_OPTIONS: Readonly<ApplicationDevtoolsServiceOptions> = {\n isActivatedOnBootstrap: false\n} as const;\n\nexport const OTTER_APPLICATION_DEVTOOLS_OPTIONS = new InjectionToken<ApplicationDevtoolsServiceOptions>('Otter Application Devtools options');\n","import {\n DOCUMENT,\n} from '@angular/common';\nimport {\n inject,\n Injectable,\n} from '@angular/core';\nimport {\n type Dataset,\n isProductionEnvironment,\n} from '@o3r/core';\nimport {\n ENVIRONMENT_CONFIG_TOKEN,\n} from '@o3r/routing';\nimport type {\n ApplicationInformation,\n} from './application-devkit.interface';\nimport {\n OTTER_APPLICATION_DEVTOOLS_OPTIONS,\n} from './application-devtools.token';\n\n@Injectable({ providedIn: 'root' })\nexport class OtterApplicationDevtools {\n private readonly options = inject(OTTER_APPLICATION_DEVTOOLS_OPTIONS, { optional: true });\n private readonly document = inject(DOCUMENT, { optional: true });\n private readonly env = inject(ENVIRONMENT_CONFIG_TOKEN, { optional: true });\n\n public getApplicationInformation(): ApplicationInformation {\n return {\n appName: this.options?.appName || 'unknown',\n appVersion: this.env?.APP_VERSION || 'unknown',\n isProduction: isProductionEnvironment(this.document?.body.dataset as Dataset)\n };\n }\n}\n","/* eslint-disable no-console -- purpose of the service is to log in the console */\nimport {\n Inject,\n Injectable,\n Optional,\n} from '@angular/core';\nimport type {\n DevtoolsServiceInterface,\n WindowWithDevtools,\n} from '@o3r/core';\nimport {\n ApplicationDevtoolsServiceOptions,\n} from './application-devkit.interface';\nimport {\n OtterApplicationDevtools,\n} from './application-devtools.service';\nimport {\n OTTER_APPLICATION_DEVTOOLS_DEFAULT_OPTIONS,\n OTTER_APPLICATION_DEVTOOLS_OPTIONS,\n} from './application-devtools.token';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ApplicationDevtoolsConsoleService implements DevtoolsServiceInterface {\n /** Name of the Window property to access to the devtools */\n public static readonly windowModuleName = 'application';\n\n private readonly options: ApplicationDevtoolsServiceOptions;\n\n constructor(\n private readonly applicationDevtools: OtterApplicationDevtools,\n @Optional() @Inject(OTTER_APPLICATION_DEVTOOLS_OPTIONS) options?: ApplicationDevtoolsServiceOptions\n ) {\n this.options = { ...OTTER_APPLICATION_DEVTOOLS_DEFAULT_OPTIONS, ...options };\n\n if (this.options.isActivatedOnBootstrap) {\n this.activate();\n }\n }\n\n /** @inheritDoc */\n public activate() {\n const windowWithDevtools: WindowWithDevtools = window;\n windowWithDevtools._OTTER_DEVTOOLS_ ||= {};\n windowWithDevtools._OTTER_DEVTOOLS_[ApplicationDevtoolsConsoleService.windowModuleName] = this;\n\n console.info(`Otter Application Devtools is now accessible via the _OTTER_DEVTOOLS_.${ApplicationDevtoolsConsoleService.windowModuleName} variable`);\n }\n\n /** Display the information relative to the running application */\n public displayApplicationInfo() {\n console.info('Application info', this.applicationDevtools.getApplicationInformation());\n }\n}\n","import {\n DOCUMENT,\n} from '@angular/common';\nimport {\n DestroyRef,\n inject,\n Inject,\n Injectable,\n Optional,\n} from '@angular/core';\nimport {\n takeUntilDestroyed,\n} from '@angular/core/rxjs-interop';\nimport {\n DevtoolsServiceInterface,\n filterMessageContent,\n sendOtterMessage,\n} from '@o3r/core';\nimport {\n LoggerService,\n} from '@o3r/logger';\nimport {\n isVisualTestingEnabled,\n prepareVisualTesting,\n toggleVisualTestingRender,\n} from '@o3r/testing/visual-test/utils';\nimport {\n fromEvent,\n} from 'rxjs';\nimport {\n type ApplicationDevtoolsServiceOptions,\n type ApplicationMessageDataTypes,\n type AvailableApplicationMessageContents,\n isApplicationMessage,\n type StateSelectionContentMessage,\n} from './application-devkit.interface';\nimport {\n OtterApplicationDevtools,\n} from './application-devtools.service';\nimport {\n OTTER_APPLICATION_DEVTOOLS_DEFAULT_OPTIONS,\n OTTER_APPLICATION_DEVTOOLS_OPTIONS,\n} from './application-devtools.token';\n\nconst OTTER_STATE_RIBBON_ID = 'otter-devtools-state-ribbon';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ApplicationDevtoolsMessageService implements DevtoolsServiceInterface {\n private readonly document = inject(DOCUMENT);\n private readonly options: ApplicationDevtoolsServiceOptions;\n private readonly sendMessage = sendOtterMessage<AvailableApplicationMessageContents>;\n private readonly destroyRef = inject(DestroyRef);\n\n constructor(\n private readonly logger: LoggerService,\n private readonly applicationDevtools: OtterApplicationDevtools,\n @Optional() @Inject(OTTER_APPLICATION_DEVTOOLS_OPTIONS) options?: ApplicationDevtoolsServiceOptions) {\n this.options = {\n ...OTTER_APPLICATION_DEVTOOLS_DEFAULT_OPTIONS,\n ...options\n };\n\n if (this.options.isActivatedOnBootstrap) {\n this.activate();\n }\n }\n\n private sendApplicationInformation() {\n this.sendMessage('applicationInformation', this.applicationDevtools.getApplicationInformation());\n }\n\n /**\n * Function to connect the plugin to the Otter DevTools extension\n */\n private connectPlugin() {\n this.logger.debug('Otter DevTools is plugged to application service of the application');\n void this.sendApplicationInformation();\n }\n\n /**\n * Function to trigger a re-send a requested messages to the Otter Chrome DevTools extension\n * @param only restricted list of messages to re-send\n */\n private handleReEmitRequest(only?: ApplicationMessageDataTypes[]) {\n if (!only || only.includes('applicationInformation')) {\n this.sendApplicationInformation();\n }\n }\n\n /**\n * Function to handle the incoming messages from Otter Chrome DevTools extension\n * @param message\n */\n private handleEvents(message: AvailableApplicationMessageContents) {\n this.logger.debug('Message handling by the application service', message);\n\n switch (message.dataType) {\n case 'connect': {\n this.connectPlugin();\n break;\n }\n case 'requestMessages': {\n this.handleReEmitRequest(message.only);\n break;\n }\n case 'toggleVisualTesting': {\n this.toggleVisualTestingRender(message.toggle);\n break;\n }\n case 'stateSelection': {\n this.onStateSelection(message);\n break;\n }\n case 'unselectState': {\n this.unselectState();\n break;\n }\n default: {\n this.logger.warn('Message ignored by the application service', message);\n }\n }\n }\n\n private unselectState() {\n const ribbonElement = this.document.body.querySelector<HTMLDivElement>(`#${OTTER_STATE_RIBBON_ID}`);\n if (ribbonElement) {\n ribbonElement.remove();\n }\n }\n\n private onStateSelection(message: StateSelectionContentMessage) {\n let ribbonElement = this.document.body.querySelector<HTMLDivElement>(`#${OTTER_STATE_RIBBON_ID}`);\n if (!ribbonElement) {\n ribbonElement = this.document.createElement('div');\n ribbonElement.id = OTTER_STATE_RIBBON_ID;\n this.document.body.append(ribbonElement);\n }\n if (message.stateName) {\n ribbonElement.innerHTML = message.stateName;\n ribbonElement.style.background = message.stateColor;\n ribbonElement.style.color = message.stateColorContrast;\n ribbonElement.style.position = 'fixed';\n ribbonElement.style.bottom = '0';\n ribbonElement.style.right = '0';\n ribbonElement.style.transform = 'translate(calc(100% * (1 - cos(45deg)))) rotate(-45deg)';\n ribbonElement.style.transformOrigin = 'bottom left';\n ribbonElement.style.clipPath = 'inset(0 -100%)';\n ribbonElement.style.boxShadow = `0px 0px 0px 999px ${message.stateColor}`;\n } else {\n ribbonElement.style.display = 'none';\n }\n }\n\n /**\n * Toggle visual testing rendering\n * @param enabled activate or deactivate the visual testing mode\n */\n private toggleVisualTestingRender(enabled?: boolean) {\n toggleVisualTestingRender(enabled === undefined ? !isVisualTestingEnabled() : enabled);\n }\n\n /** @inheritDoc */\n public activate() {\n fromEvent(window, 'message').pipe(\n takeUntilDestroyed(this.destroyRef),\n filterMessageContent(isApplicationMessage)\n ).subscribe((e) => this.handleEvents(e));\n prepareVisualTesting(this.options.e2eIgnoreClass);\n this.sendApplicationInformation();\n }\n}\n","import {\n ModuleWithProviders,\n NgModule,\n} from '@angular/core';\nimport type {\n ApplicationDevtoolsServiceOptions,\n} from './application-devkit.interface';\nimport {\n ApplicationDevtoolsConsoleService,\n} from './application-devtools.console.service';\nimport {\n ApplicationDevtoolsMessageService,\n} from './application-devtools.message.service';\nimport {\n OtterApplicationDevtools,\n} from './application-devtools.service';\nimport {\n OTTER_APPLICATION_DEVTOOLS_DEFAULT_OPTIONS,\n OTTER_APPLICATION_DEVTOOLS_OPTIONS,\n} from './application-devtools.token';\n\n@NgModule({\n providers: [\n { provide: OTTER_APPLICATION_DEVTOOLS_OPTIONS, useValue: OTTER_APPLICATION_DEVTOOLS_DEFAULT_OPTIONS },\n ApplicationDevtoolsMessageService,\n ApplicationDevtoolsConsoleService,\n OtterApplicationDevtools\n ]\n})\nexport class ApplicationDevtoolsModule {\n /**\n * Initialize Otter Devtools\n * @param options\n */\n public static instrument(options: Partial<ApplicationDevtoolsServiceOptions>): ModuleWithProviders<ApplicationDevtoolsModule> {\n return {\n ngModule: ApplicationDevtoolsModule,\n providers: [\n { provide: OTTER_APPLICATION_DEVTOOLS_OPTIONS, useValue: { ...OTTER_APPLICATION_DEVTOOLS_DEFAULT_OPTIONS, ...options }, multi: false },\n ApplicationDevtoolsMessageService,\n ApplicationDevtoolsConsoleService,\n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,yBAAyB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;mIAAzB,yBAAyB,EAAA,CAAA,CAAA;AAAzB,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,yBAAyB,EAPzB,SAAA,EAAA;AACT,YAAA,EAAE,OAAO,EAAE,kCAAkC,EAAE,QAAQ,EAAE,0CAA0C,EAAE;YACrG,iCAAiC;YACjC,iCAAiC;YACjC;AACD,SAAA,EAAA,CAAA,CAAA;;4FAEU,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBARrC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,SAAS,EAAE;AACT,wBAAA,EAAE,OAAO,EAAE,kCAAkC,EAAE,QAAQ,EAAE,0CAA0C,EAAE;wBACrG,iCAAiC;wBACjC,iCAAiC;wBACjC;AACD;AACF,iBAAA;;;AC5BD;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/application",
3
- "version": "12.3.0-prerelease.7",
3
+ "version": "12.3.0-prerelease.71",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -26,11 +26,11 @@
26
26
  "@angular-devkit/schematics": "^19.0.0",
27
27
  "@angular/common": "^19.0.0",
28
28
  "@angular/core": "^19.0.0",
29
- "@o3r/core": "^12.3.0-prerelease.7",
30
- "@o3r/logger": "^12.3.0-prerelease.7",
31
- "@o3r/routing": "^12.3.0-prerelease.7",
32
- "@o3r/schematics": "^12.3.0-prerelease.7",
33
- "@o3r/testing": "^12.3.0-prerelease.7",
29
+ "@o3r/core": "^12.3.0-prerelease.71",
30
+ "@o3r/logger": "^12.3.0-prerelease.71",
31
+ "@o3r/routing": "^12.3.0-prerelease.71",
32
+ "@o3r/schematics": "^12.3.0-prerelease.71",
33
+ "@o3r/testing": "^12.3.0-prerelease.71",
34
34
  "@schematics/angular": "^19.0.0",
35
35
  "rxjs": "^7.8.1",
36
36
  "ts-node": "~10.9.2",
@@ -48,6 +48,7 @@
48
48
  }
49
49
  },
50
50
  "dependencies": {
51
+ "@o3r/schematics": "^12.3.0-prerelease.71",
51
52
  "tslib": "^2.6.2"
52
53
  },
53
54
  "engines": {
@@ -1,8 +1,7 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
1
  import type { NgAddSchematicsSchema } from '../schema';
3
2
  /**
4
3
  * Register Devtools to the application
5
4
  * @param options
6
5
  */
7
- export declare const registerDevtools: (options: NgAddSchematicsSchema) => Promise<Rule>;
6
+ export declare const registerDevtools: (options: NgAddSchematicsSchema) => import("@angular-devkit/schematics").Rule;
8
7
  //# sourceMappingURL=devtools-registration.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"devtools-registration.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/helpers/devtools-registration.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,IAAI,EACL,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,WAAW,CAAC;AAOnB;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAU,SAAS,qBAAqB,KAAG,OAAO,CAAC,IAAI,CAgBnF,CAAC"}
1
+ {"version":3,"file":"devtools-registration.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/helpers/devtools-registration.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,WAAW,CAAC;AAOnB;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS,qBAAqB,8CAe9D,CAAC"}
@@ -4,6 +4,7 @@ exports.registerDevtools = void 0;
4
4
  const node_fs_1 = require("node:fs");
5
5
  const path = require("node:path");
6
6
  const schematics_1 = require("@angular-devkit/schematics");
7
+ const schematics_2 = require("@o3r/schematics");
7
8
  const DEVTOOL_MODULE_NAME = 'ApplicationDevtoolsModule';
8
9
  const CONSOLE_DEVTOOL_SERVICE_NAME = 'ApplicationDevtoolsConsoleService';
9
10
  const MESSAGE_DEVTOOL_SERVICE_NAME = 'ApplicationDevtoolsMessageService';
@@ -12,16 +13,15 @@ const PACKAGE_NAME = JSON.parse((0, node_fs_1.readFileSync)(path.resolve(__dirna
12
13
  * Register Devtools to the application
13
14
  * @param options
14
15
  */
15
- const registerDevtools = async (options) => {
16
- const { registerDevtoolsToApplication } = await Promise.resolve().then(() => require('@o3r/schematics'));
16
+ const registerDevtools = (options) => {
17
17
  return (0, schematics_1.chain)([
18
- registerDevtoolsToApplication({
18
+ (0, schematics_2.registerDevtoolsToApplication)({
19
19
  moduleName: DEVTOOL_MODULE_NAME,
20
20
  packageName: PACKAGE_NAME,
21
21
  serviceName: CONSOLE_DEVTOOL_SERVICE_NAME,
22
22
  projectName: options.projectName
23
23
  }),
24
- registerDevtoolsToApplication({
24
+ (0, schematics_2.registerDevtoolsToApplication)({
25
25
  moduleName: DEVTOOL_MODULE_NAME,
26
26
  packageName: PACKAGE_NAME,
27
27
  serviceName: MESSAGE_DEVTOOL_SERVICE_NAME,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,IAAI,EAGL,MAAM,4BAA4B,CAAC;AAUpC,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,UAAU,CAAC;AA6GlB;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAI,SAAS,qBAAqB,KAAG,IAKtD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,IAAI,EAGL,MAAM,4BAA4B,CAAC;AAoBpC,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,UAAU,CAAC;AA6FlB;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAI,SAAS,qBAAqB,SAA2C,CAAC"}
@@ -3,14 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ngAdd = void 0;
4
4
  const path = require("node:path");
5
5
  const schematics_1 = require("@angular-devkit/schematics");
6
+ const schematics_2 = require("@o3r/schematics");
6
7
  const utility_1 = require("@schematics/angular/utility");
7
8
  const devtools_registration_1 = require("./helpers/devtools-registration");
8
- const reportMissingSchematicsDep = (logger) => (reason) => {
9
- logger.error(`[ERROR]: Adding @o3r/application has failed.
10
- If the error is related to missing @o3r dependencies you need to install '@o3r/core' to be able to use the o3r application package. Please run 'ng add @o3r/core' .
11
- Otherwise, use the error message as guidance.`);
12
- throw reason;
13
- };
14
9
  /**
15
10
  * Add Otter application to an Angular Project
16
11
  * @param options The options to pass to ng-add execution
@@ -18,15 +13,14 @@ Otherwise, use the error message as guidance.`);
18
13
  function ngAddFn(options) {
19
14
  /* ng add rules */
20
15
  return async (tree, context) => {
21
- const { getAppModuleFilePath, getWorkspaceConfig, insertImportToModuleFile, setupDependencies, getO3rPeerDeps, getProjectNewDependenciesTypes, getPackageInstallConfig } = await Promise.resolve().then(() => require('@o3r/schematics'));
22
16
  const { isImported } = await Promise.resolve().then(() => require('@schematics/angular/utility/ast-utils')).catch(() => ({ isImported: undefined }));
23
17
  const ts = await Promise.resolve().then(() => require('typescript')).catch(() => undefined);
24
18
  const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
25
- const depsInfo = getO3rPeerDeps(packageJsonPath);
26
- const workspaceProject = options.projectName ? getWorkspaceConfig(tree)?.projects[options.projectName] : undefined;
19
+ const depsInfo = (0, schematics_2.getO3rPeerDeps)(packageJsonPath);
20
+ const workspaceProject = options.projectName ? (0, schematics_2.getWorkspaceConfig)(tree)?.projects[options.projectName] : undefined;
27
21
  const addAngularAnimationPreferences = () => {
28
22
  const additionalRules = [];
29
- const moduleFilePath = getAppModuleFilePath(tree, context, options.projectName);
23
+ const moduleFilePath = (0, schematics_2.getAppModuleFilePath)(tree, context, options.projectName);
30
24
  if (!moduleFilePath || !options.projectName) {
31
25
  return tree;
32
26
  }
@@ -46,7 +40,7 @@ function ngAddFn(options) {
46
40
  }
47
41
  const importInRootModule = (name, file, moduleFunction) => additionalRules.push((0, utility_1.addRootImport)(options.projectName, ({ code, external }) => code `\n${external(name, file)}${moduleFunction}`));
48
42
  const recorder = tree.beginUpdate(moduleFilePath);
49
- insertImportToModuleFile('prefersReducedMotion', '@o3r/application', sourceFile, recorder, moduleFilePath);
43
+ (0, schematics_2.insertImportToModuleFile)('prefersReducedMotion', '@o3r/application', sourceFile, recorder, moduleFilePath);
50
44
  importInRootModule('BrowserAnimationsModule', '@angular/platform-browser/animations', '.withConfig({disableAnimations: prefersReducedMotion()})');
51
45
  tree.commitUpdate(recorder);
52
46
  return (0, schematics_1.chain)(additionalRules)(tree, context);
@@ -55,15 +49,15 @@ function ngAddFn(options) {
55
49
  acc[dep] = {
56
50
  inManifest: [{
57
51
  range: `${options.exactO3rVersion ? '' : '~'}${depsInfo.packageVersion}`,
58
- types: getProjectNewDependenciesTypes(workspaceProject)
52
+ types: (0, schematics_2.getProjectNewDependenciesTypes)(workspaceProject)
59
53
  }],
60
54
  ngAddOptions: { exactO3rVersion: options.exactO3rVersion }
61
55
  };
62
56
  return acc;
63
- }, getPackageInstallConfig(packageJsonPath, tree, options.projectName, false, !!options.exactO3rVersion));
64
- const registerDevtoolRule = await (0, devtools_registration_1.registerDevtools)(options);
57
+ }, (0, schematics_2.getPackageInstallConfig)(packageJsonPath, tree, options.projectName, false, !!options.exactO3rVersion));
58
+ const registerDevtoolRule = (0, devtools_registration_1.registerDevtools)(options);
65
59
  return () => (0, schematics_1.chain)([
66
- setupDependencies({
60
+ (0, schematics_2.setupDependencies)({
67
61
  projectName: options.projectName,
68
62
  dependencies,
69
63
  ngAddToRun: depsInfo.o3rPeerDeps
@@ -77,9 +71,6 @@ function ngAddFn(options) {
77
71
  * Add Otter application to an Angular Project
78
72
  * @param options The options to pass to ng-add execution
79
73
  */
80
- const ngAdd = (options) => async (_, { logger }) => {
81
- const { createOtterSchematic } = await Promise.resolve().then(() => require('@o3r/schematics')).catch(reportMissingSchematicsDep(logger));
82
- return createOtterSchematic(ngAddFn)(options);
83
- };
74
+ const ngAdd = (options) => (0, schematics_2.createOtterSchematic)(ngAddFn)(options);
84
75
  exports.ngAdd = ngAdd;
85
76
  //# sourceMappingURL=index.js.map