Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LPS-137025 Validate/Create fields rules to Business Info - Info Panel #123

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
4e6d377
LPS-135660 Change Classic theme by Solution theme
joseabelenda Jul 15, 2021
7c696e6
LPS-135662 Create business home cover
joseabelenda Jul 15, 2021
0713ff8
LPS-135663 create our philosophy fragment
joseabelenda Jul 15, 2021
ab023e4
LPS-135948 Create Get a Quote Page
joseabelenda Jul 20, 2021
0e6ea2e
LPS-135948 Create Quote NavBar Fragment
joseabelenda Jul 20, 2021
310e4f2
LPS-135951 Create Quote Page Template
joseabelenda Jul 20, 2021
f3278c2
LPS-135948 Change Public template by Public Quote template
joseabelenda Jul 20, 2021
3629a98
LPS-135660 Add more tokens to Style Books
joseabelenda Jul 20, 2021
24328cc
LPS-135948 SF
joseabelenda Jul 20, 2021
1f6479f
LPS-135715 Create Asset Category hierarchy with the Raylife properties
nicolas-sss Jul 20, 2021
813c47d
LPS-136030 Update Business Home Cover Styling and Logic
kevenleone Jul 21, 2021
eba32c3
LPS-136029 Create Get a Quote Footer
kevenleone Jul 21, 2021
972a79c
LPS-135717 Create ObjectDefinitionSampleGenerator
joseabelenda Jul 22, 2021
b8d5dfb
LPS-136029 SF
joseabelenda Jul 22, 2021
279703d
LPS-136019 Improve Public Navbar fragment
mateuscdomingos Jul 22, 2021
54746ec
LPS-135717 Add sample data using Liferay Object
joseabelenda Jul 23, 2021
c508f11
LPS-135645 Raylife D2C Code
kevenleone Jul 23, 2021
c7b7ede
LPS-135645 SF
joseabelenda Jul 24, 2021
304cf83
LPS-135717 Remove ObjectDefinitionSampleGenerator
joseabelenda Jul 24, 2021
5e58937
LPS-135950 Improve Quote NavBar Fragment
mateuscdomingos Jul 26, 2021
69c71d2
LPS-135716 Add commerce dependencies
victortrajano Jul 26, 2021
96d9e56
LPS-135716 Create importCPDefinitions methods passing assetCategories…
victortrajano Jul 26, 2021
ef9cac8
LPS-135716 Add methods to create commerce structures
victortrajano Jul 26, 2021
640e9f1
LPS-135716 add external reference in json
victortrajano Jul 26, 2021
e659ace
LPS-135716 Create json files in resources
victortrajano Jul 26, 2021
31c6456
LPS-135716 Fix
victortrajano Jul 26, 2021
eb7faee
LPS-135716 SF
joseabelenda Jul 27, 2021
66de1c7
LPS-136251 Update Thumbnail
kevenleone Jul 26, 2021
4960129
LPS-136252 Update font-size for Fields
kevenleone Jul 26, 2021
6a33404
LPS-136252 Add Missing Options for Product Select
kevenleone Jul 26, 2021
f1a495b
LPS-135715 Add Guest permissions to Asset Categories
nicolas-sss Jul 27, 2021
1f53b6c
LPS-135715 SF
nicolas-sss Jul 27, 2021
9d8417c
LPS-136245 Add link on Business Home Cover Fragment to Get A Quote Page
mateuscdomingos Jul 27, 2021
df824c8
LPS-136309 Use Typography from StyleBook
kevenleone Jul 28, 2021
2f83ff5
LPS-136309 Get data from Categories API
kevenleone Jul 28, 2021
ab03b41
Add Remote Web Component (WIP)
joseabelenda Jul 28, 2021
d45085e
LPS-136419 Add Products in Asset Categories
kevenleone Jul 29, 2021
daa9eeb
LPS-136419 Empty Option no longer needed
kevenleone Jul 29, 2021
ed511e5
LPS-136453 Add Quote Page Placeholder
kevenleone Jul 29, 2021
90daf4c
LPS-136454 Add Get in Touch Placeholder
kevenleone Jul 29, 2021
9000f00
LPS-136420 Add error feedback to Home Business Cover Input
mateuscdomingos Jul 30, 2021
3da547c
LPS-136685 Add liferay d2c web component
Aug 3, 2021
6941bb4
LPS-136449 Create Hang Tight Fragment
mgmenezes Aug 4, 2021
783efb2
LPS-136449 SF
mgmenezes Aug 4, 2021
0444fce
LPS-136448 Create Hang Tight Placeholder Page
mgmenezes Aug 4, 2021
bb09881
LPS-136026 Add Remote Web Component to Get a Quote page
nicolas-sss Aug 6, 2021
9754de4
LPS-137025 Create hook to get Legal Entities
Aug 9, 2021
24cf8fa
LPS-137025 Add new inputs to attend the mock
Aug 9, 2021
d27dc58
LPS-137025 Add First Select option for non Default Values
Aug 9, 2021
b0a2afe
LPS-137025 Adjust placeholder to add the percentage
Aug 9, 2021
05cbf0e
LPS-137025 Fix defaultValue prop to Select and Switch
Aug 9, 2021
b905367
LPS-137025 Add Default Values to ControlledSwitch
Aug 9, 2021
9dec97e
LPS-137025 Fix Legal Entities list
Aug 9, 2021
0a0c5fa
LPS-137025 Add new REGEX to validate percentage until 100
Aug 9, 2021
0e12f89
LPS-137025 Export getCategoryProperties instead getBusinessClassCode
Aug 9, 2021
0be3388
LPS-137025 Save segment in form's value
Aug 9, 2021
ee7e991
LPS-137025 Validate BCC and Segment to show some fields
Aug 9, 2021
5330dbf
LPS-137025 Fix Step Percentage to Business field
Aug 9, 2021
b088b71
LPS-137025 Fix indentations
Aug 9, 2021
84efb75
LPS-137025 Centralize logic to businessFields
Aug 9, 2021
1fd1fa1
LPS-137025 Remove default value for placeholder parameter in InputWit…
Aug 10, 2021
3317def
LPS-137025 Remove option hidden for Select atom
Aug 10, 2021
9243257
LPS-137025 Pass pattern within rules prop
Aug 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"liferayDir": "../../remote-component-dxp/bundles",
"webpack": {
"rules": [
{
"test": "src\\/.*\\.js$",
"use": "babel-loader"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Bundle-Name: Liferay Remote Web Component Admin Web
Bundle-SymbolicName: com.liferay.remote.web.component.admin.web
Bundle-Version: 1.0.4
Web-ContextPath: /remote-web-component-admin-web
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
dependencies {
compileOnly group: "biz.aQute.bnd", name: "biz.aQute.bnd.annotation", version: "4.2.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.impl", version: "default"
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "default"
compileOnly group: "com.liferay.portal", name: "com.liferay.util.java", version: "default"
compileOnly group: "com.liferay.portal", name: "com.liferay.util.taglib", version: "default"
compileOnly group: "javax.portlet", name: "portlet-api", version: "3.0.1"
compileOnly group: "javax.servlet.jsp", name: "javax.servlet.jsp-api", version: "2.3.1"
compileOnly group: "org.apache.felix", name: "org.apache.felix.http.servlet-api", version: "1.1.2"
compileOnly group: "org.osgi", name: "org.osgi.service.component", version: "1.3.0"
compileOnly group: "org.osgi", name: "org.osgi.service.component.annotations", version: "1.3.0"
compileOnly group: "org.osgi", name: "osgi.core", version: "6.0.0"
compileOnly project(":apps:configuration-admin:configuration-admin-api")
compileOnly project(":apps:dynamic-data-mapping:dynamic-data-mapping-api")
compileOnly project(":apps:frontend-taglib:frontend-taglib")
compileOnly project(":apps:petra:petra-portlet-url-builder")
compileOnly project(":apps:static:portal-configuration:portal-configuration-metatype-api")
compileOnly project(":core:petra:petra-io")
compileOnly project(":core:petra:petra-lang")
compileOnly project(":core:petra:petra-string")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"dependencies": {
"redux-micro-frontend": "^1.0.1"
},
"description": "",
"main": "js/index.js",
"name": "@liferay/remote-web-component-admin-web",
"private": true,
"scripts": {
"build": "liferay-npm-scripts build",
"checkFormat": "liferay-npm-scripts check",
"format": "liferay-npm-scripts fix",
"test": "liferay-npm-scripts test"
},
"version": "1.0.4"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/

package com.liferay.remote.web.component.admin.web.internal;

import com.liferay.portal.configuration.metatype.bnd.util.ConfigurableUtil;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.Portal;
import com.liferay.portal.kernel.util.UnicodeProperties;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.remote.web.component.admin.web.internal.configuration.RemoteWebComponentConfiguration;
import com.liferay.remote.web.component.admin.web.internal.util.Timestamp;

import java.io.IOException;

import java.time.Instant;

import java.util.Dictionary;
import java.util.Hashtable;
import java.util.Map;

import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.service.component.ComponentFactory;
import org.osgi.service.component.ComponentInstance;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.ConfigurationPolicy;
import org.osgi.service.component.annotations.Deactivate;
import org.osgi.service.component.annotations.Reference;

/**
* @author Iván Zaera Avellón
* @author Raymond Augé
*/
@Component(
configurationPid = "com.liferay.remote.web.component.admin.web.internal.configuration.RemoteWebComponentConfiguration",
configurationPolicy = ConfigurationPolicy.REQUIRE, immediate = true,
service = RemoteWebComponentPortletRegistrar.class
)
public class RemoteWebComponentPortletRegistrar {

@Activate
protected void activate(
BundleContext bundleContext, Map<String, Object> properties) {

_remoteWebComponentConfiguration = ConfigurableUtil.createConfigurable(
RemoteWebComponentConfiguration.class, properties);

_elementName = _remoteWebComponentConfiguration.elementName();

if (_log.isInfoEnabled()) {
_log.info(
String.format(
"Starting remote web component %s", _elementName));
}

// Portlet

Dictionary<String, Object> componentProperties = new Hashtable<>(
properties);

componentProperties.remove(Constants.SERVICE_PID);

componentProperties.put(
"com.liferay.portlet.css-class-wrapper",
"portlet-remote-web-component");
componentProperties.put(
"com.liferay.portlet.requires-namespaced-parameters", "false");
componentProperties.put("javax.portlet.name", _getPortletName());
componentProperties.put(
"javax.portlet.preferences",
"classpath:/META-INF/portlet-preferences/default-preferences.xml");
componentProperties.put(
"javax.portlet.security-role-ref", "power-user,user");
componentProperties.put("javax.portlet.version", "3.0");

UnicodeProperties unicodeProperties = new UnicodeProperties();

try {
unicodeProperties.load(
_remoteWebComponentConfiguration.portletServiceProperties());
unicodeProperties.forEach(componentProperties::put);
}
catch (IOException ioException) {
_log.error(
String.format(
"Could not parse portlet service properties for %s",
_elementName),
ioException);
}

Instant now = Instant.now();

String[] webComponentJSUrls = Timestamp.append(
_remoteWebComponentConfiguration.webComponentUrl(), now);

componentProperties.put(
"com.liferay.portlet.header-portal-javascript", webComponentJSUrls);

String[] webComponentCSSUrls = Timestamp.append(
_remoteWebComponentConfiguration.webComponentCssUrl(), now);

if (webComponentCSSUrls.length > 0) {
componentProperties.put(
"com.liferay.portlet.header-portal-css", webComponentCSSUrls);
}

String displayCategory =
_remoteWebComponentConfiguration.portletDisplayCategory();

displayCategory =
Validator.isNotNull(displayCategory) ? displayCategory : "sample";

componentProperties.put(
"com.liferay.portlet.display-category",
"category." + displayCategory);

componentProperties.put(
"com.liferay.portlet.instanceable",
String.valueOf(_remoteWebComponentConfiguration.instanceable()));

//componentProperties.put(

// "com.liferay.portlet.single-page-application", "false");

componentProperties.put(
"javax.portlet.resource-bundle", _getResourceBundleName());

_portletInstance = _remoteWebComponentPortletFactory.newInstance(
componentProperties);

// Resource Bundle Loader

componentProperties = new Hashtable<>(properties);

componentProperties.remove(Constants.SERVICE_PID);
componentProperties.put(
"resource.bundle.base.name", _getResourceBundleName());
componentProperties.put(
"servlet.context.name", "remote-web-component-admin-web");
componentProperties.put(
"javax.portlet.title." + _getPortletName(),
_remoteWebComponentConfiguration.name());
componentProperties.put("category." + displayCategory, displayCategory);

_bundleResourceLoaderInstance =
_remoteWebComponentResourceBundleLoaderFactory.newInstance(
componentProperties);

// Friendly URL Mapper

componentProperties = new Hashtable<>(properties);

componentProperties.remove(Constants.SERVICE_PID);
componentProperties.put("javax.portlet.name", _getPortletName());

_friendlyURLMapperInstance =
_remoteWebComponentFriendlyURLMapperFactory.newInstance(
componentProperties);

// Top Js Dynamic Include

componentProperties = new Hashtable<>(properties);

componentProperties.remove(Constants.SERVICE_PID);
componentProperties.put("javax.portlet.name", _getPortletName());

_topJsDynamicInclude =
_remoteWebComponentTopJsDynamicInclude.newInstance(
componentProperties);

if (_log.isInfoEnabled()) {
_log.info(
String.format("Started remote web component %s", _elementName));
}
}

@Deactivate
protected void deactivate() {
if (_log.isInfoEnabled()) {
_log.info(
String.format(
"Stopping remote web component %s", _elementName));
}

_portletInstance.dispose();
_bundleResourceLoaderInstance.dispose();
_friendlyURLMapperInstance.dispose();
_topJsDynamicInclude.dispose();

_portletInstance = null;
_bundleResourceLoaderInstance = null;
_friendlyURLMapperInstance = null;
_topJsDynamicInclude = null;

if (_log.isInfoEnabled()) {
_log.info(
String.format("Stopped remote web component %s", _elementName));
}
}

private String _getPortletName() {
final String portletAlias =
_remoteWebComponentConfiguration.portletAlias();

String portletName =
Validator.isNotNull(portletAlias) ? portletAlias : _elementName;

return _portal.getJsSafePortletId("rwc_" + portletName);
}

private String _getResourceBundleName() {
return _getPortletName() + ".Language";
}

private static final Log _log = LogFactoryUtil.getLog(
RemoteWebComponentPortletRegistrar.class);

private volatile ComponentInstance _bundleResourceLoaderInstance;
private volatile String _elementName;
private volatile ComponentInstance _friendlyURLMapperInstance;

@Reference
private Portal _portal;

private volatile ComponentInstance _portletInstance;
private volatile RemoteWebComponentConfiguration
_remoteWebComponentConfiguration;

@Reference(
target = "(component.factory=remote.web.component.friendly.url.mapper)"
)
private ComponentFactory _remoteWebComponentFriendlyURLMapperFactory;

@Reference(target = "(component.factory=remote.web.component.portlet)")
private ComponentFactory _remoteWebComponentPortletFactory;

@Reference(
target = "(component.factory=remote.web.component.resource.bundle.loader)"
)
private ComponentFactory _remoteWebComponentResourceBundleLoaderFactory;

@Reference(
target = "(component.factory=remote.web.component.top.js.dynamic.include)"
)
private ComponentFactory _remoteWebComponentTopJsDynamicInclude;

private volatile ComponentInstance _topJsDynamicInclude;

}