Skip to content

Commit 4f51776

Browse files
authored
Merge pull request #134 from BuildFire/mcd-renaissanceranch
feat(mcd-renaissanceranch): add option for enable get more points but…
2 parents 4957b51 + b5c3512 commit 4f51776

47 files changed

Lines changed: 2213 additions & 8739 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

control/content/app.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,5 @@
7676
}
7777
};
7878

79-
Buildfire.analytics.registerEvent(
80-
{ title: "Reward redeemed", key: 'reward-redeemed', description: "User has redeemed a reward" },
81-
{ silentNotification: true }
82-
);
83-
Buildfire.analytics.registerEvent(
84-
{ title: "Points earned", key: 'points-earned', description: "User has earned points" },
85-
{ silentNotification: true }
86-
);
8779
}])
88-
})(window.angular, window.buildfire);
80+
})(window.angular, window.buildfire);

control/content/controllers/content.home.controller.js

Lines changed: 53 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
console.info('init success result:', result);
7676
ContentHome.data = result;
7777
if (!ContentHome.data)
78-
ContentHome.data = angular.copy(_data);
78+
ContentHome.data = angular.copy(_data);
7979

8080
//make sure to assign to the right appId
8181
ContentHome.data.appId = _data.appId;
@@ -84,22 +84,23 @@
8484
if (tmrDelay) clearTimeout(tmrDelay);
8585

8686
buildfire.datastore.get(TAG_NAMES.LOYALTY_INFO,function(err,data){
87-
ContentHome.settings = data.data.settings;
88-
if (!ContentHome.settings || !ContentHome.settings.redemptionPasscode){
89-
ContentHome.showRedemptionPasscodeHint = true;
90-
} else {
91-
ContentHome.showRedemptionPasscodeHint = false;
92-
}
93-
if (!$scope.$$phase) $scope.$digest();
94-
updateMasterItem(ContentHome.data);
95-
if(Number(ContentHome.data.pointsPerDollar) <= 0) {
96-
ContentHome.data.pointsPerDollar = 1;
87+
ContentHome.settings = data.data.settings;
88+
if (!ContentHome.settings || !ContentHome.settings.redemptionPasscode){
89+
ContentHome.showRedemptionPasscodeHint = true;
90+
} else {
91+
ContentHome.showRedemptionPasscodeHint = false;
92+
}
93+
ContentHome.initializeSettings();
94+
if (!$scope.$$phase) $scope.$digest();
95+
updateMasterItem(ContentHome.data);
96+
if(Number(ContentHome.data.pointsPerDollar) <= 0) {
97+
ContentHome.data.pointsPerDollar = 1;
9798
saveData(JSON.parse(angular.toJson(ContentHome.data)));
98-
}
99+
}
99100
});
100101
};
101102
ContentHome.error = function (err) {
102-
ContentHome.showRedemptionPasscodeHint = true;
103+
ContentHome.showRedemptionPasscodeHint = true;
103104
if (err && err.code == 2100) {
104105
console.error('Error while getting application:', err);
105106
var success = function (result) {
@@ -110,34 +111,34 @@
110111
type: 'AppCreated'
111112
});
112113
}
113-
, error = function (err) {
114+
, error = function (err) {
114115
console.log('Error while saving data : ', err);
115116
if(err && err.code == 2000) {
116-
ContentHome.data = angular.copy(_data);
117-
buildfire.messaging.sendMessageToWidget({
118-
type: 'AppCreated'
119-
});
117+
ContentHome.data = angular.copy(_data);
118+
buildfire.messaging.sendMessageToWidget({
119+
type: 'AppCreated'
120+
});
120121
}
121122
};
122123
if (ContentHome.currentLoggedInUser) {
123124
_data.userToken = ContentHome.currentLoggedInUser.userToken;
124125
_data.auth = ContentHome.currentLoggedInUser.auth;
125126
LoyaltyAPI.addEditApplication(_data).then(success, error);
126127
} else {
127-
buildfire.dialog.toast({
128-
message: "Please make sure you are logged In",
129-
type: "danger",
130-
});
128+
buildfire.dialog.toast({
129+
message: "Please make sure you are logged In",
130+
type: "danger",
131+
});
131132
}
132133
}
133134
};
134135
ContentHome.successloyaltyRewards = function (result) {
135136
ContentHome.loyaltyRewards = result;
136137
if (!ContentHome.loyaltyRewards) {
137-
ContentHome.loyaltyRewards = [];
138-
$rootScope.showEmptyState = true;
138+
ContentHome.loyaltyRewards = [];
139+
$rootScope.showEmptyState = true;
139140
} else {
140-
$rootScope.showEmptyState = false;
141+
$rootScope.showEmptyState = false;
141142
}
142143
ContentHome.loyaltyRewardsCloned = ContentHome.loyaltyRewards
143144
ContentHome.addDeepLinks(result);
@@ -154,7 +155,6 @@
154155
ContentHome.loyaltyRewards = [];
155156
LoyaltyAPI.getApplication(`${context.appId}_${context.instanceId}`).then(ContentHome.success, ContentHome.error);
156157
buildfire.auth.getCurrentUser(function (err, user) {
157-
console.log("!!!!!!!!!!User!!!!!!!!!!!!", user);
158158
if (user && user._cpUser) {
159159
ContentHome.currentLoggedInUser = user._cpUser;
160160
if (!$scope.$$phase) $scope.$digest();
@@ -163,6 +163,33 @@
163163
});
164164
};
165165

166+
ContentHome.initializeSettings = function() {
167+
if (!ContentHome.settings || Object.keys(ContentHome.settings).length === 0) {
168+
ContentHome.settings = {
169+
purchaseOption: {
170+
name: "Per Money Spent",
171+
value: "perMoneySpent"
172+
}
173+
};
174+
buildfire.datastore.save({settings: ContentHome.settings}, TAG_NAMES.LOYALTY_INFO, function (err, data) {
175+
if (err) {
176+
console.error('Error while saving data:', err);
177+
}
178+
else {
179+
Buildfire.analytics.registerEvent(
180+
{ title: "Reward redeemed", key: 'reward-redeemed', description: "User has redeemed a reward" },
181+
{ silentNotification: true }
182+
);
183+
Buildfire.analytics.registerEvent(
184+
{ title: "Points earned", key: 'points-earned', description: "User has earned points" },
185+
{ silentNotification: true }
186+
);
187+
}
188+
});
189+
190+
}
191+
};
192+
166193
ContentHome.search = function() {
167194
if(ContentHome.title != ""){
168195
ContentHome.loyaltyRewards = ContentHome.loyaltyRewardsCloned.filter(x=>x.title.includes(ContentHome.title))

control/content/templates/home.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</div>
1919
<div class="col-md-3">
2020
<a class="add-item-a" href="#/reward">
21-
<button class="btn btn-success stretch" href="#/reward">
21+
<button class="btn btn-primary stretch" href="#/reward">
2222
<span class="icon icon-plus margin-right-ten"></span> Add Item
2323
</button>
2424
</a>

control/introduction/style.css

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,12 @@
3333

3434
.copy.pull-right > .title.ellipsis {
3535
width: initial !important;
36-
}
36+
}
37+
38+
.add-new-carousel {
39+
background-color: #09A3EE !important;
40+
}
41+
42+
.add-new-carousel:hover {
43+
background-color: #0089d1 !important;
44+
}

0 commit comments

Comments
 (0)