209209 currentUser = user ;
210210 resolve ( ) ;
211211 } ) . catch ( err => reject ( err ) )
212- } ) ,
212+ } ) ,
213213 new Promise ( ( resolve , reject ) => {
214214 Context . getContext ( ) . then ( context => {
215215 currentContext = context ;
234234 } )
235235 } )
236236 } )
237-
237+
238238 Promise . allSettled ( items ) . then ( results => {
239239 itemsList = [ ] ;
240240 results . forEach ( res => {
252252 type : "danger" ,
253253 } ) ;
254254 }
255-
255+
256256 // reset old data
257257 deleteAll ( ) . then ( ( ) => {
258258 // save new data
270270 resolve ( 'Error while saving data : ' , err ) ;
271271 } )
272272 } )
273- } )
273+ } )
274274 Promise . allSettled ( promises ) . then ( res => {
275275 if ( isImport ) {
276276 let sortedItems = orderedItems . sort ( ( a , b ) => a . order - b . order ) ;
277277 let sortedIds = [ ] ;
278- LoyaltyAPI . getRewards ( currentContext . instanceId ) . then ( results => {
278+ LoyaltyAPI . getRewards ( ` ${ currentContext . appId } _ ${ currentContext . instanceId } ` ) . then ( results => {
279279 sortedItems . forEach ( item => {
280280 if ( results ) {
281281 results . forEach ( result => {
291291 } )
292292 const data = {
293293 appId : currentContext . appId ,
294- loyaltyUnqiueId : currentContext . instanceId ,
294+ loyaltyUnqiueId : ` ${ currentContext . appId } _ ${ currentContext . instanceId } ` ,
295295 userToken : currentUser && currentUser . userToken ,
296296 auth : currentUser && currentUser . auth ,
297297 loyaltyRewardIds : sortedIds
298- }
298+ }
299299 LoyaltyAPI . sortRewards ( data ) . finally ( ( ) => {
300300 $timeout ( ( ) => {
301301 sortedItems = [ ] ;
326326 stateSeederInstance ?. requestResult ?. complete ( ) ;
327327 } )
328328 }
329-
329+
330330 // UTILITIES
331331 let _applyDefaults = function ( item ) {
332332 if ( item . title ) {
338338 listImage : item . listImage || "" ,
339339 pointsPerItem : points . pointsPerItem ,
340340 appId : currentContext . appId ,
341- loyaltyUnqiueId : currentContext . instanceId ,
341+ loyaltyUnqiueId : ` ${ currentContext . appId } _ ${ currentContext . instanceId } ` ,
342342 userToken : currentUser && currentUser . userToken ,
343343 auth : currentUser && currentUser . auth ,
344344 }
366366 }
367367
368368 let elimanateNotFoundImages = function ( url ) {
369- const optimisedURL = url . replace ( '1080x720' , '100x100' ) ;
369+ const optimisedURL = url . replace ( '1080x720' , '100x100' ) ;
370370 return new Promise ( ( resolve ) => {
371371 if ( url . includes ( "http" ) ) {
372372 const xhr = new XMLHttpRequest ( ) ;
386386 } else resolve ( false ) ;
387387 } ) ;
388388 } ;
389-
389+
390390 let deleteAll = function ( ) {
391391 const data = {
392392 userToken : currentUser . userToken ,
395395 } ;
396396 return new Promise ( resolve => {
397397 if ( stateSeederInstance . requestResult . resetData ) {
398- LoyaltyAPI . getRewards ( currentContext . instanceId ) . then ( items => {
398+ LoyaltyAPI . getRewards ( ` ${ currentContext . appId } _ ${ currentContext . instanceId } ` ) . then ( items => {
399399 const promises = items . map ( ( item ) => deleteItem ( item . _id , data ) ) ;
400- resolve ( Promise . all ( promises ) ) ;
400+ resolve ( Promise . all ( promises ) ) ;
401401 } ) . catch ( err => console . warn ( 'old data get error' , err ) ) ;
402402 }
403403 else {
432432 stateSeederInstance = new buildfire . components . aiStateSeeder ( {
433433 generateOptions : {
434434 userMessage : `Generate a sample of redeemable items for a new [business-type].` ,
435- maxRecords : 5 ,
435+ maxRecords : 5 ,
436436 systemMessage :
437437 'listImage URL related to title and the list type. use source.unsplash.com for image URL, URL should not have premium_photo or source.unsplash.com/random, cost to redeem which is a number greater than zero and less than 100, return description as HTML.' ,
438438 jsonTemplate : generateJSONTemplate ,
451451 } ,
452452 }
453453 } ] )
454- } ) ( window . angular , window . buildfire ) ;
454+ } ) ( window . angular , window . buildfire ) ;
0 commit comments