<?xml version="1.0" encoding="UTF-8"?>
<!--
 * The contents of this file are subject to the terms of the Common Development and
 * Distribution License (the License). You may not use this file except in compliance with the
 * License.
 *
 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
 * specific language governing permission and limitations under the License.
 *
 * When distributing Covered Software, include this CDDL Header Notice in each file and include
 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
 * Header, with the fields enclosed by brackets [] replaced by your own identifying
 * information: "Portions copyright [year] [name of copyright owner]".
 *
 * Copyright 2015-2016 ForgeRock AS.
 * Portions copyright 2017-2026 3A Systems LLC
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.openidentityplatform.openam</groupId>
        <artifactId>openam-ui</artifactId>
        <version>16.1.2</version>
    </parent>

    <artifactId>openam-ui-ria</artifactId>
    <name>OpenAM RIA Web UI</name>
    <packaging>pom</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <codemirror.version>4.10</codemirror.version>
        <handlebars.version>4.7.7</handlebars.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui</groupId>
            <artifactId>user</artifactId>
            <type>zip</type>
            <classifier>www</classifier>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>selectize-non-standalone</artifactId>
            <version>0.12.1</version>
            <classifier>min</classifier>
            <type>js</type>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>text</artifactId>
            <version>2.0.15</version>
            <type>js</type>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>sifter</artifactId>
            <version>0.4.1</version>
            <classifier>min</classifier>
            <type>js</type>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>microplugin</artifactId>
            <version>0.0.3</version>
            <type>js</type>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>qrcode</artifactId>
            <version>1.4.4</version>
            <classifier>min</classifier>
            <type>js</type>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>jquery-sortable</artifactId>
            <version>0.9.13</version>
            <type>js</type>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>jsoneditor</artifactId>
            <version>0.7.9</version>
            <classifier>min</classifier>
            <type>js</type>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>bootstrap-tabdrop</artifactId>
            <version>1.0</version>
            <type>js</type>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>CodeMirror</artifactId>
            <version>${codemirror.version}</version>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>bootstrap-clockpicker</artifactId>
            <version>0.0.7</version>
            <classifier>min</classifier>
            <type>js</type>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>bootstrap-clockpicker</artifactId>
            <version>0.0.7</version>
            <classifier>min</classifier>
            <type>css</type>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>bootstrap-datetimepicker</artifactId>
            <version>4.14.30</version>
            <classifier>min</classifier>
            <type>js</type>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>bootstrap-datetimepicker</artifactId>
            <version>4.14.30</version>
            <classifier>min</classifier>
            <type>css</type>
        </dependency>
        <dependency>
            <!-- handlebars need for fix the processing dependencies in the release build -->
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>handlebars</artifactId>
            <version>${handlebars.version}</version>
            <type>js</type>
            <classifier>min</classifier>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>redux</artifactId>
            <version>3.5.2</version>
            <classifier>min</classifier>
            <type>js</type>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>react-bootstrap</artifactId>
            <version>0.30.1</version>
            <classifier>min</classifier>
            <type>js</type>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>classnames</artifactId>
            <version>2.2.5</version>
            <type>js</type>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>react-input-autosize</artifactId>
            <version>1.1.0</version>
            <classifier>min</classifier>
            <type>js</type>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>react-select</artifactId>
            <version>1.0.0-rc.2</version>
            <classifier>min</classifier>
            <type>js</type>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>react-select</artifactId>
            <version>1.0.0-rc.2</version>
            <classifier>min</classifier>
            <type>css</type>
        </dependency>

        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>sinon</artifactId>
            <version>1.15.4</version>
            <type>js</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>qunit</artifactId>
            <version>1.15.0</version>
            <type>js</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>qunit</artifactId>
            <type>css</type>
            <version>1.15.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>squire</artifactId>
            <version>0.2.0</version>
            <type>js</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.openidentityplatform.commons.ui.libs</groupId>
            <artifactId>base64</artifactId>
            <version>1.0.0</version>
            <classifier>min</classifier>
            <type>js</type>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>${basedir}/src/main/js</directory>
            </resource>
            <resource>
                <directory>${basedir}/src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>

        <testResources>
            <testResource>
                <directory>${basedir}/src/test/js</directory>
            </testResource>
            <testResource>
                <directory>${basedir}/src/test/resources</directory>
            </testResource>
        </testResources>

        <plugins>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.7</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.shared</groupId>
                        <artifactId>maven-filtering</artifactId>
                        <version>1.3</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>resources</goal>
                            <goal>testResources</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-forgerock-ui-user</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>target/dependencies-expanded/forgerock-ui-user</outputDirectory>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.openidentityplatform.commons.ui</groupId>
                                    <artifactId>user</artifactId>
                                    <type>zip</type>
                                    <classifier>www</classifier>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                    <execution>
                        <id>unpack-codemirror</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.openidentityplatform.commons.ui.libs</groupId>
                                    <artifactId>CodeMirror</artifactId>
                                    <type>zip</type>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>

                    <execution>
                        <id>copy-dependencies-test</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/test-classes/libs</outputDirectory>
                            <includeArtifactIds>sinon,qunit,squire</includeArtifactIds>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>false</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>npm-build</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <arguments>run build:production -- --target-version=${project.version}</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npm-test</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <phase>test</phase>
                        <configuration>
                            <arguments>run test</arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>prepare-working-dir</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <finalName>dependencies</finalName>
                            <appendAssemblyId>false</appendAssemblyId>
                            <descriptors>
                                <descriptor>src/main/assembly/dir.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                    <execution>
                        <id>build-final-zip</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>src/main/assembly/zip.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
