Skip to content

Commit

Permalink
Merge branch 'release/1.1.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
Eduardo Garcia committed Oct 11, 2016
2 parents 740242c + 9de3608 commit cf5811c
Show file tree
Hide file tree
Showing 24 changed files with 586 additions and 238 deletions.
Expand Up @@ -87,7 +87,7 @@

var formId = form.attr('id');

if (!defaultFormExcludedIdsRegex.test(formId) && (!formExcludedIdsRegexStr || !new RegExp(formExcludedIdsRegexStr).test(formId)) && (interactedForms.indexOf(formId) === -1)) {
if (!defaultFormExcludedIdsRegex.test(formId) && (!formExcludedIdsRegexStr || !new RegExp(formExcludedIdsRegexStr).test(formId)) && (A.Array.indexOf(interactedForms, formId) === -1)) {
interactedForms.push(formId);

trackElementEvent('interact', formId);
Expand Down
Expand Up @@ -7450,6 +7450,8 @@ var types = exports.types = {
}, {}],
171: [function(require, module, exports) {

var json = require('json');

/**
* Export `fmt`
*/
Expand All @@ -7460,7 +7462,7 @@ module.exports = fmt;
* Formatters
*/

fmt.o = JSON.stringify;
fmt.o = json.stringify;
fmt.s = String;
fmt.d = parseInt;

Expand All @@ -7484,7 +7486,7 @@ return str.replace(/%([a-z])/gi, function(_, f) {
});
}

}, {}],
}, {"json":29}],
174: [function(require, module, exports) {

/**
Expand Down Expand Up @@ -8315,7 +8317,7 @@ each(events, function(label) {
self.conversion({
conversionId: id,
value: revenue,
label: label,
label: label
});
});
};
Expand Down Expand Up @@ -9475,7 +9477,7 @@ each(products, function(product) {
item_id: track.id() || track.sku(),
desc: product.description || track.name(),
quantity: track.quantity(),
amount: track.price(),
amount: track.price()
});
});

Expand Down Expand Up @@ -10471,7 +10473,7 @@ each(products, function(product) {
image_url: product.image,
price: track.price(),
title: track.name(),
url: product.url,
url: product.url
});
});

Expand Down Expand Up @@ -12340,7 +12342,7 @@ each(products, function(product) {
category: track.category(),
quantity: track.quantity(),
price: track.price(),
name: track.name(),
name: track.name()
});
})

Expand Down Expand Up @@ -15336,7 +15338,7 @@ var name = page.name();
var settings = {
event: 'refresh',
labels: this.labels('page', category, name),
qacct: this.options.pCode,
qacct: this.options.pCode
};
var user = this.analytics.user();
if (user.id()) settings.uid = user.id();
Expand Down Expand Up @@ -15589,7 +15591,7 @@ var init = {
last_name: identify.lastName(),
user_image: identify.avatar(),
email: email,
user_id: id,
user_id: id
};

if (accountId) init.account_id = accountId;
Expand Down

Large diffs are not rendered by default.

@@ -1,112 +1,119 @@
;(function() {
var ioRequest;
var isFunction;
var pendingFlush;
var requestId;
var requestInterval;
var requestUri;
var themeDisplayData = {};

var LiferayAnalyticsProcessor = Liferay.Analytics.integration('LiferayAnalyticsProcessor').readyOnInitialize();

LiferayAnalyticsProcessor.prototype._ready = true;

LiferayAnalyticsProcessor.prototype.flush = function(callback) {
var instance = this;

var events = instance.getPendingEvents();

pendingFlush = false;

if (events.length) {
if (ioRequest) {
ioRequest(
requestUri,
{
data: {
events: JSON.stringify(events),
themeDisplayData: JSON.stringify(themeDisplayData)
},
on: {
failure: function(err) {
console.error(err.type);
},
success: function() {
if (isFunction(callback)) {
callback();
AUI().use(
'json',
function(A) {
var ioRequest;
var isFunction;
var pendingFlush;
var requestId;
var requestInterval;
var requestUri;
var themeDisplayData = {};

var LiferayAnalyticsProcessor = Liferay.Analytics.integration('LiferayAnalyticsProcessor').readyOnInitialize();

LiferayAnalyticsProcessor.prototype._ready = true;

LiferayAnalyticsProcessor.prototype.flush = function (callback) {
var instance = this;

var events = instance.getPendingEvents();

pendingFlush = false;

if (events.length) {
if (ioRequest) {
ioRequest(
requestUri,
{
data: {
events: A.JSON.stringify(events),
themeDisplayData: A.JSON.stringify(themeDisplayData)
},
on: {
failure: function (err) {
console.error(err.type);
},
success: function () {
if (isFunction(callback)) {
callback();
}
}
}
}
}
);

instance.store([]);

requestId = clearInterval(requestId);
}
);
else {
pendingFlush = true;
}
}
};

instance.store([]);
LiferayAnalyticsProcessor.prototype.getPendingEvents = function () {
var instance = this;

requestId = clearInterval(requestId);
}
else {
pendingFlush = true;
}
}
};
var storedEvents = localStorage.getItem('ct-analytics-events') || '[]';

LiferayAnalyticsProcessor.prototype.getPendingEvents = function() {
var instance = this;
return A.JSON.parse(storedEvents);
};

var storedEvents = localStorage.getItem('ct-analytics-events') || '[]';
LiferayAnalyticsProcessor.prototype.initialize = function () {
var instance = this;

return JSON.parse(storedEvents);
};
requestInterval = instance.options.interval;
requestUri = instance.options.uri;

LiferayAnalyticsProcessor.prototype.initialize = function() {
var instance = this;
AUI().use(
'aui-io-request',
function (A) {
A.Object.each(
themeDisplay,
function (item, index) {
if (A.Lang.isFunction(item)) {
var indexName = /^(get|is)(.*)$/.exec(index)[2];

requestInterval = instance.options.interval;
requestUri = instance.options.uri;
var indexNameFirstCharacter = indexName.charAt(0);

AUI().use(
'aui-io-request',
function(A) {
A.Object.each(
themeDisplay,
function(item, index) {
if (A.Lang.isFunction(item)) {
var indexName = /^(get|is)(.*)$/.exec(index)[2];
indexName = indexNameFirstCharacter.toLowerCase() + indexName.slice(1);

indexName = indexName[0].toLowerCase() + indexName.slice(1);
themeDisplayData[indexName] = themeDisplay[index]();
}
}
);

themeDisplayData[indexName] = themeDisplay[index]();
}
isFunction = A.Lang.isFunction;
ioRequest = A.io.request;
}
);
};

isFunction = A.Lang.isFunction;
ioRequest = A.io.request;
}
);
};
LiferayAnalyticsProcessor.prototype.store = function (events) {
var instance = this;

LiferayAnalyticsProcessor.prototype.store = function(events) {
var instance = this;
events = events || [];

events = events || [];
localStorage.setItem('ct-analytics-events', A.JSON.stringify(events));
};

localStorage.setItem('ct-analytics-events', JSON.stringify(events));
};
LiferayAnalyticsProcessor.prototype.track = function (event, properties) {
var instance = this;

LiferayAnalyticsProcessor.prototype.track = function(event, properties) {
var instance = this;
var events = instance.getPendingEvents();

var events = instance.getPendingEvents();
events.push(event.obj);

events.push(event.obj);
instance.store(events);

instance.store(events);
if (!requestId) {
requestId = setTimeout(instance.flush.bind(instance), requestInterval);
}
};

if (!requestId) {
requestId = setTimeout(instance.flush.bind(instance), requestInterval);
Liferay.Analytics.addIntegration(LiferayAnalyticsProcessor);
}
};

Liferay.Analytics.addIntegration(LiferayAnalyticsProcessor);
);
})();
4 changes: 2 additions & 2 deletions anonymous-users-api/META-INF/liferay-portlet.xml
Expand Up @@ -3,9 +3,9 @@

<liferay-portlet-app>
<portlet>
<portlet-name>anonysmous-user-api</portlet-name>
<portlet-name>anonymous-users-api</portlet-name>
<scheduler-entry>
<scheduler-event-listener-class>com.liferay.content.targeting.anonymous.users.messaging.CheckAnonymousUsersMessageListener</scheduler-event-listener-class>
<scheduler-event-listener-class>com.liferay.content.targeting.anonymous.users.messaging.CheckAUMessageListener</scheduler-event-listener-class>
<trigger>
<simple>
<property-key>anonymous.users.check.interval</property-key>
Expand Down
16 changes: 16 additions & 0 deletions anonymous-users-api/META-INF/portlet.xml
@@ -0,0 +1,16 @@
<?xml version="1.0"?>

<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0">
<portlet>
<portlet-name>anonymous-users-api</portlet-name>
<portlet-class>com.liferay.portal.kernel.portlet.LiferayPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
</supports>
<portlet-info>
<title>Anonymous Users Service</title>
<short-title>Anonymous Users Service</short-title>
<keywords>Anonymous Users Service</keywords>
</portlet-info>
</portlet>
</portlet-app>
2 changes: 2 additions & 0 deletions anonymous-users-api/bnd.bnd
Expand Up @@ -13,6 +13,8 @@ Import-Package:\
Include-Resource:\
classes,\
WEB-INF/classes/META-INF=classes/META-INF/,\
WEB-INF/liferay-portlet.xml=META-INF/liferay-portlet.xml,\
WEB-INF/portlet.xml=META-INF/portlet.xml,\
WEB-INF/sql=sql,\
WEB-INF/liferay-hook.xml=META-INF/liferay-hook.xml,\
@${app.server.portal.dir}/WEB-INF/lib/util-java.jar,\
Expand Down
Expand Up @@ -21,7 +21,7 @@
/**
* @author Pavel Savinov
*/
public class CheckAnonymousUsersMessageListener extends BaseMessageListener {
public class CheckAUMessageListener extends BaseMessageListener {

@Override
protected void doReceive(Message message) throws Exception {
Expand Down
Expand Up @@ -92,9 +92,9 @@ public String getFormHTML(
}
catch (Exception e) {
_log.error(
"Error while processing rule form template " +
_FORM_TEMPLATE_PATH,
e);
"Error while processing rule form template " +
_FORM_TEMPLATE_PATH,
e);
}

return content;
Expand Down
Expand Up @@ -109,7 +109,9 @@ public static long[] getAssetCategoryIds(
UserSegment userSegment =
UserSegmentLocalServiceUtil.fetchUserSegment(userSegmentIds[i]);

assetCategoryIds[i] = userSegment.getAssetCategoryId(groupId);
if (userSegment != null) {
assetCategoryIds[i] = userSegment.getAssetCategoryId(groupId);
}
}

return assetCategoryIds;
Expand Down Expand Up @@ -236,7 +238,8 @@ public static boolean isStaged(long liveGroupId, String portletId)

return GetterUtil.getBoolean(
liveGroupTypeSettings.getProperty(
StagingUtil.getStagedPortletId(portletId)), false);
StagingUtil.getStagedPortletId(portletId)),
false);
}

// This method already exists in 7.0
Expand Down

0 comments on commit cf5811c

Please sign in to comment.