Paid Offer to Offer Bookmark

Paid Offer to Offer Bookmark
pull/916/head
Shahana Farooqui 3 years ago
parent 5ee58e01f6
commit aaf2aceab2

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -13,6 +13,6 @@
<style>@font-face{font-family:Roboto;src:url(Roboto-Thin.f7a95c9c5999532c.woff2) format("woff2"),url(Roboto-Thin.c13c157cb81e8ebb.woff) format("woff");font-weight:100;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-ThinItalic.b0e084abf689f393.woff2) format("woff2"),url(Roboto-ThinItalic.1111028df6cea564.woff) format("woff");font-weight:100;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Light.0e01b6cd13b3857f.woff2) format("woff2"),url(Roboto-Light.603ca9a537b88428.woff) format("woff");font-weight:300;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-LightItalic.232ef4b20215f720.woff2) format("woff2"),url(Roboto-LightItalic.1b5e142f787151c8.woff) format("woff");font-weight:300;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Regular.475ba9e4e2d63456.woff2) format("woff2"),url(Roboto-Regular.bcefbfee882bc1cb.woff) format("woff");font-weight:400;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-RegularItalic.e3a9ebdaac06bbc4.woff2) format("woff2"),url(Roboto-RegularItalic.0668fae6af0cf8c2.woff) format("woff");font-weight:400;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Medium.457532032ceb0168.woff2) format("woff2"),url(Roboto-Medium.6e1ae5f0b324a0aa.woff) format("woff");font-weight:500;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-MediumItalic.872f7060602d55d2.woff2) format("woff2"),url(Roboto-MediumItalic.e06fb533801cbb08.woff) format("woff");font-weight:500;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Bold.447291a88c067396.woff2) format("woff2"),url(Roboto-Bold.fc482e6133cf5e26.woff) format("woff");font-weight:700;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BoldItalic.1b15168ef6fa4e16.woff2) format("woff2"),url(Roboto-BoldItalic.e26ba339b06f09f7.woff) format("woff");font-weight:700;font-style:italic}@font-face{font-family:Roboto;src:url(Roboto-Black.2eaa390d458c877d.woff2) format("woff2"),url(Roboto-Black.b25f67ad8583da68.woff) format("woff");font-weight:900;font-style:normal}@font-face{font-family:Roboto;src:url(Roboto-BlackItalic.7dc03ee444552bc5.woff2) format("woff2"),url(Roboto-BlackItalic.c8dc642467cb3099.woff) format("woff");font-weight:900;font-style:italic}html{width:100%;height:99%;line-height:1.5;overflow-x:hidden;font-family:Roboto,sans-serif!important;font-size:62.5%}body{box-sizing:border-box;height:100%;margin:0;overflow:hidden}*{margin:0;padding:0}</style><link rel="stylesheet" href="styles.2c38f7d09aa7e379.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.2c38f7d09aa7e379.css"></noscript></head>
<body>
<rtl-app></rtl-app>
<script src="runtime.0a835836cdce0c7a.js" type="module"></script><script src="polyfills.6d989da208bd6fd1.js" type="module"></script><script src="main.1cbf15fea673c893.js" type="module"></script>
<script src="runtime.fc4d0eddd5a52ab2.js" type="module"></script><script src="polyfills.6d989da208bd6fd1.js" type="module"></script><script src="main.23fb2bcb6487787c.js" type="module"></script>
</body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +1 @@
(()=>{"use strict";var e,v={},g={};function r(e){var i=g[e];if(void 0!==i)return i.exports;var t=g[e]={id:e,loaded:!1,exports:{}};return v[e].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}r.m=v,e=[],r.O=(i,t,f,o)=>{if(!t){var a=1/0;for(n=0;n<e.length;n++){for(var[t,f,o]=e[n],c=!0,u=0;u<t.length;u++)(!1&o||a>=o)&&Object.keys(r.O).every(b=>r.O[b](t[u]))?t.splice(u--,1):(c=!1,o<a&&(a=o));if(c){e.splice(n--,1);var l=f();void 0!==l&&(i=l)}}return i}o=o||0;for(var n=e.length;n>0&&e[n-1][2]>o;n--)e[n]=e[n-1];e[n]=[t,f,o]},r.n=e=>{var i=e&&e.__esModule?()=>e.default:()=>e;return r.d(i,{a:i}),i},r.d=(e,i)=>{for(var t in i)r.o(i,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:i[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((i,t)=>(r.f[t](e,i),i),[])),r.u=e=>e+"."+{341:"74ba7d9f1c552ad2",637:"2fc9559ec90af37c",859:"dccba581e7254ce5",893:"277223bd17cb8056"}[e]+".js",r.miniCssF=e=>{},r.o=(e,i)=>Object.prototype.hasOwnProperty.call(e,i),(()=>{var e={},i="RTLApp:";r.l=(t,f,o,n)=>{if(e[t])e[t].push(f);else{var a,c;if(void 0!==o)for(var u=document.getElementsByTagName("script"),l=0;l<u.length;l++){var d=u[l];if(d.getAttribute("src")==t||d.getAttribute("data-webpack")==i+o){a=d;break}}a||(c=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",i+o),a.src=r.tu(t)),e[t]=[f];var s=(m,b)=>{a.onerror=a.onload=null,clearTimeout(p);var h=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),h&&h.forEach(_=>_(b)),m)return m(b)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=s.bind(null,a.onerror),a.onload=s.bind(null,a.onload),c&&document.head.appendChild(a)}}})(),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tu=i=>(void 0===e&&(e={createScriptURL:t=>t},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e.createScriptURL(i))})(),r.p="",(()=>{var e={666:0};r.f.j=(f,o)=>{var n=r.o(e,f)?e[f]:void 0;if(0!==n)if(n)o.push(n[2]);else if(666!=f){var a=new Promise((d,s)=>n=e[f]=[d,s]);o.push(n[2]=a);var c=r.p+r.u(f),u=new Error;r.l(c,d=>{if(r.o(e,f)&&(0!==(n=e[f])&&(e[f]=void 0),n)){var s=d&&("load"===d.type?"missing":d.type),p=d&&d.target&&d.target.src;u.message="Loading chunk "+f+" failed.\n("+s+": "+p+")",u.name="ChunkLoadError",u.type=s,u.request=p,n[1](u)}},"chunk-"+f,f)}else e[f]=0},r.O.j=f=>0===e[f];var i=(f,o)=>{var u,l,[n,a,c]=o,d=0;if(n.some(p=>0!==e[p])){for(u in a)r.o(a,u)&&(r.m[u]=a[u]);if(c)var s=c(r)}for(f&&f(o);d<n.length;d++)r.o(e,l=n[d])&&e[l]&&e[l][0](),e[n[d]]=0;return r.O(s)},t=self.webpackChunkRTLApp=self.webpackChunkRTLApp||[];t.forEach(i.bind(null,0)),t.push=i.bind(null,t.push.bind(t))})()})();
(()=>{"use strict";var e,v={},g={};function r(e){var i=g[e];if(void 0!==i)return i.exports;var t=g[e]={id:e,loaded:!1,exports:{}};return v[e].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}r.m=v,e=[],r.O=(i,t,f,o)=>{if(!t){var a=1/0;for(n=0;n<e.length;n++){for(var[t,f,o]=e[n],c=!0,u=0;u<t.length;u++)(!1&o||a>=o)&&Object.keys(r.O).every(b=>r.O[b](t[u]))?t.splice(u--,1):(c=!1,o<a&&(a=o));if(c){e.splice(n--,1);var d=f();void 0!==d&&(i=d)}}return i}o=o||0;for(var n=e.length;n>0&&e[n-1][2]>o;n--)e[n]=e[n-1];e[n]=[t,f,o]},r.n=e=>{var i=e&&e.__esModule?()=>e.default:()=>e;return r.d(i,{a:i}),i},r.d=(e,i)=>{for(var t in i)r.o(i,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:i[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((i,t)=>(r.f[t](e,i),i),[])),r.u=e=>e+"."+{341:"0edff5464a6cbffa",637:"2fc9559ec90af37c",859:"dccba581e7254ce5",893:"277223bd17cb8056"}[e]+".js",r.miniCssF=e=>{},r.o=(e,i)=>Object.prototype.hasOwnProperty.call(e,i),(()=>{var e={},i="RTLApp:";r.l=(t,f,o,n)=>{if(e[t])e[t].push(f);else{var a,c;if(void 0!==o)for(var u=document.getElementsByTagName("script"),d=0;d<u.length;d++){var l=u[d];if(l.getAttribute("src")==t||l.getAttribute("data-webpack")==i+o){a=l;break}}a||(c=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",i+o),a.src=r.tu(t)),e[t]=[f];var s=(m,b)=>{a.onerror=a.onload=null,clearTimeout(p);var h=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),h&&h.forEach(_=>_(b)),m)return m(b)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=s.bind(null,a.onerror),a.onload=s.bind(null,a.onload),c&&document.head.appendChild(a)}}})(),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tu=i=>(void 0===e&&(e={createScriptURL:t=>t},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e.createScriptURL(i))})(),r.p="",(()=>{var e={666:0};r.f.j=(f,o)=>{var n=r.o(e,f)?e[f]:void 0;if(0!==n)if(n)o.push(n[2]);else if(666!=f){var a=new Promise((l,s)=>n=e[f]=[l,s]);o.push(n[2]=a);var c=r.p+r.u(f),u=new Error;r.l(c,l=>{if(r.o(e,f)&&(0!==(n=e[f])&&(e[f]=void 0),n)){var s=l&&("load"===l.type?"missing":l.type),p=l&&l.target&&l.target.src;u.message="Loading chunk "+f+" failed.\n("+s+": "+p+")",u.name="ChunkLoadError",u.type=s,u.request=p,n[1](u)}},"chunk-"+f,f)}else e[f]=0},r.O.j=f=>0===e[f];var i=(f,o)=>{var u,d,[n,a,c]=o,l=0;if(n.some(p=>0!==e[p])){for(u in a)r.o(a,u)&&(r.m[u]=a[u]);if(c)var s=c(r)}for(f&&f(o);l<n.length;l++)r.o(e,d=n[l])&&e[d]&&e[d][0](),e[n[l]]=0;return r.O(s)},t=self.webpackChunkRTLApp=self.webpackChunkRTLApp||[];t.forEach(i.bind(null,0)),t.push=i.bind(null,t.push.bind(t))})()})();

@ -67,7 +67,7 @@ export const ClRoutes: Routes = [
{ path: 'payments', component: CLLightningPaymentsComponent, canActivate: [CLUnlockedGuard] },
{ path: 'invoices', component: CLLightningInvoicesTableComponent, canActivate: [CLUnlockedGuard] },
{ path: 'offers', component: CLOffersTableComponent, canActivate: [CLUnlockedGuard] },
{ path: 'paidoffr', component: CLPaidOffersTableComponent, canActivate: [CLUnlockedGuard] }
{ path: 'offrBookmarks', component: CLPaidOffersTableComponent, canActivate: [CLUnlockedGuard] }
]
},
{

@ -3,7 +3,7 @@ import { createAction, props } from '@ngrx/store';
import { CLActions } from '../../shared/services/consts-enums-functions';
import { ApiCallStatusPayload } from '../../shared/models/apiCallsPayload';
import { SelNodeChild } from '../../shared/models/RTLconfig';
import { GetInfo, Fees, Peer, Payment, PayRequest, QueryRoutes, Channel, FeeRates, ForwardingEvent, Invoice, ListInvoices, OnChain, UTXO, SaveChannel, GetNewAddress, DetachPeer, UpdateChannel, CloseChannel, DecodePayment, SendPayment, GetQueryRoutes, ChannelLookup, OfferInvoice, Offer, PaidOffer, OfferRequest } from '../../shared/models/clModels';
import { GetInfo, Fees, Peer, Payment, PayRequest, QueryRoutes, Channel, FeeRates, ForwardingEvent, Invoice, ListInvoices, OnChain, UTXO, SaveChannel, GetNewAddress, DetachPeer, UpdateChannel, CloseChannel, DecodePayment, SendPayment, GetQueryRoutes, ChannelLookup, OfferInvoice, Offer, OfferBookmark } from '../../shared/models/clModels';
export const updateCLAPICallStatus = createAction(CLActions.UPDATE_API_CALL_STATUS_CL, props<{ payload: ApiCallStatusPayload }>());
@ -125,12 +125,12 @@ export const disableOffer = createAction(CLActions.DISABLE_OFFER_CL, props<{ pay
export const updateOffer = createAction(CLActions.UPDATE_OFFER_CL, props<{ payload: { offer: Offer } }>());
export const fetchPaidOffers = createAction(CLActions.FETCH_PAID_OFFERS_CL);
export const fetchOfferBookmarks = createAction(CLActions.FETCH_OFFER_BOOKMARKS_CL);
export const setPaidOffers = createAction(CLActions.SET_PAID_OFFERS_CL, props<{ payload: PaidOffer[] }>());
export const setOfferBookmarks = createAction(CLActions.SET_OFFER_BOOKMARKS_CL, props<{ payload: OfferBookmark[] }>());
export const addUpdatePaidOffer = createAction(CLActions.ADD_UPDATE_PAID_OFFER_CL, props<{ payload: PaidOffer }>());
export const addUpdateOfferBookmark = createAction(CLActions.ADD_UPDATE_OFFER_BOOKMARK_CL, props<{ payload: OfferBookmark }>());
export const deletePaidOffer = createAction(CLActions.DELETE_PAID_OFFER_CL, props<{ payload: { offer_uuid: string } }>());
export const deleteOfferBookmark = createAction(CLActions.DELETE_OFFER_BOOKMARK_CL, props<{ payload: { offer_uuid: string } }>());
export const removePaidOffer = createAction(CLActions.REMOVE_PAID_OFFER_CL, props<{ payload: { offer_uuid: string } }>());
export const removeOfferBookmark = createAction(CLActions.REMOVE_OFFER_BOOKMARK_CL, props<{ payload: { offer_uuid: string } }>());

@ -19,7 +19,7 @@ import { AlertTypeEnum, APICallStatusEnum, UI_MESSAGES, CLWSEventTypeEnum, CLAct
import { closeAllDialogs, closeSpinner, logout, openAlert, openSnackBar, openSpinner, setApiUrl, setNodeData } from '../../store/rtl.actions';
import { RTLState } from '../../store/rtl.state';
import { addUpdatePaidOffer, fetchBalance, fetchChannels, fetchFeeRates, fetchFees, fetchInvoices, fetchLocalRemoteBalance, fetchPayments, fetchPeers, fetchUTXOs, getForwardingHistory, setFailedForwardingHistory, setLookup, setPeers, setQueryRoutes, updateCLAPICallStatus, updateInvoice } from './cl.actions';
import { addUpdateOfferBookmark, fetchBalance, fetchChannels, fetchFeeRates, fetchFees, fetchInvoices, fetchLocalRemoteBalance, fetchPayments, fetchPeers, fetchUTXOs, getForwardingHistory, setFailedForwardingHistory, setLookup, setPeers, setQueryRoutes, updateCLAPICallStatus, updateInvoice } from './cl.actions';
import { allAPIsCallStatus, clNodeInformation } from './cl.selector';
import { ApiCallsListCL } from '../../shared/models/apiCallsPayload';
import { CLOfferInformationComponent } from '../transactions/offers/offer-information-modal/offer-information.component';
@ -502,7 +502,7 @@ export class CLEffects implements OnDestroy {
snackBarMessageStr = 'Payment Sent Successfully but Offer Saving to Database Failed.';
}
if (sendRes.saveToDBResponse && sendRes.saveToDBResponse !== 'NA') {
this.store.dispatch(addUpdatePaidOffer({ payload: sendRes.saveToDBResponse }));
this.store.dispatch(addUpdateOfferBookmark({ payload: sendRes.saveToDBResponse }));
snackBarMessageStr = 'Payment Sent Successfully and Offer Saved to Database.';
}
setTimeout(() => {
@ -891,7 +891,7 @@ export class CLEffects implements OnDestroy {
));
offersPaidFetchCL = createEffect(() => this.actions.pipe(
ofType(CLActions.FETCH_PAID_OFFERS_CL),
ofType(CLActions.FETCH_OFFER_BOOKMARKS_CL),
mergeMap((action: { type: string, payload: any }) => {
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchPaidOffers', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.get(this.CHILD_API_URL + environment.OFFERS_API + '/paidoffers').
@ -899,7 +899,7 @@ export class CLEffects implements OnDestroy {
this.logger.info(res);
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'FetchPaidOffers', status: APICallStatusEnum.COMPLETED } }));
return {
type: CLActions.SET_PAID_OFFERS_CL,
type: CLActions.SET_OFFER_BOOKMARKS_CL,
payload: res || []
};
}),
@ -912,23 +912,23 @@ export class CLEffects implements OnDestroy {
));
peidOffersDeleteCL = createEffect(() => this.actions.pipe(
ofType(CLActions.DELETE_PAID_OFFER_CL),
ofType(CLActions.DELETE_OFFER_BOOKMARK_CL),
mergeMap((action: { type: string, payload: { offer_uuid: string } }) => {
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.DELETE_PAID_OFFER }));
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'DeletePaidOffer', status: APICallStatusEnum.INITIATED } }));
this.store.dispatch(openSpinner({ payload: UI_MESSAGES.DELETE_OFFER_BOOKMARK }));
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'DeleteOfferBookmark', status: APICallStatusEnum.INITIATED } }));
return this.httpClient.delete(this.CHILD_API_URL + environment.OFFERS_API + '/paidoffer/' + action.payload.offer_uuid).
pipe(map((postRes: any) => {
this.logger.info(postRes);
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'DeletePaidOffer', status: APICallStatusEnum.COMPLETED } }));
this.store.dispatch(closeSpinner({ payload: UI_MESSAGES.DELETE_PAID_OFFER }));
this.store.dispatch(openSnackBar({ payload: 'Paid Offer Deleted Successfully!' }));
this.store.dispatch(updateCLAPICallStatus({ payload: { action: 'DeleteOfferBookmark', status: APICallStatusEnum.COMPLETED } }));
this.store.dispatch(closeSpinner({ payload: UI_MESSAGES.DELETE_OFFER_BOOKMARK }));
this.store.dispatch(openSnackBar({ payload: 'Offer Bookmark Deleted Successfully!' }));
return {
type: CLActions.REMOVE_PAID_OFFER_CL,
type: CLActions.REMOVE_OFFER_BOOKMARK_CL,
payload: { offer_uuid: action.payload.offer_uuid }
};
}),
catchError((err: any) => {
this.handleErrorWithoutAlert('DeletePaidOffer', UI_MESSAGES.DELETE_PAID_OFFER, 'Deleting Paid Offer Failed.', err);
this.handleErrorWithoutAlert('DeleteOfferBookmark', UI_MESSAGES.DELETE_OFFER_BOOKMARK, 'Deleting Offer Bookmark Failed.', err);
return of({ type: RTLActions.VOID });
})
);

@ -4,7 +4,7 @@ import {
addInvoice, addPeer, removeChannel, removePeer, resetCLStore, setBalance, setChannels,
setChildNodeSettingsCL, setFailedForwardingHistory, setFeeRates, setFees, setForwardingHistory,
setInfo, setInvoices, setLocalRemoteBalance, setOffers, addOffer, setPayments, setPeers, setUTXOs,
updateCLAPICallStatus, updateInvoice, updateOffer, setPaidOffers, addUpdatePaidOffer, removePaidOffer
updateCLAPICallStatus, updateInvoice, updateOffer, setOfferBookmarks, addUpdateOfferBookmark, removeOfferBookmark
} from './cl.actions';
import { Channel } from '../../shared/models/clModels';
@ -172,36 +172,36 @@ export const CLReducer = createReducer(initCLState,
offers: modifiedOffers
};
}),
on(setPaidOffers, (state, { payload }) => ({
on(setOfferBookmarks, (state, { payload }) => ({
...state,
paidOffers: payload
offersBookmarks: payload
})),
on(addUpdatePaidOffer, (state, { payload }) => {
const newPaidOffers = [...state.paidOffers];
const offerExistsIdx = newPaidOffers.findIndex((offer) => offer.id === payload.id);
if (offerExistsIdx < 0) {
newPaidOffers.unshift(payload);
on(addUpdateOfferBookmark, (state, { payload }) => {
const newOfferBMs = [...state.offersBookmarks];
const offerBMExistsIdx = newOfferBMs.findIndex((offer) => offer.id === payload.id);
if (offerBMExistsIdx < 0) {
newOfferBMs.unshift(payload);
} else {
let updatedOffer = { ...newPaidOffers[offerExistsIdx] };
let updatedOffer = { ...newOfferBMs[offerBMExistsIdx] };
updatedOffer.title = payload.title;
updatedOffer.amountmSat = payload.amountmSat;
updatedOffer.updatedAt = payload.updatedAt;
newPaidOffers.splice(offerExistsIdx, 1, updatedOffer);
newOfferBMs.splice(offerBMExistsIdx, 1, updatedOffer);
}
return {
...state,
paidOffers: newPaidOffers
offersBookmarks: newOfferBMs
};
}),
on(removePaidOffer, (state, { payload }) => {
const modifiedPaidOffers = [...state.paidOffers];
const removePaidOfferIdx = state.paidOffers.findIndex((po) => po.id === payload.offer_uuid);
if (removePaidOfferIdx > -1) {
modifiedPaidOffers.splice(removePaidOfferIdx, 1);
on(removeOfferBookmark, (state, { payload }) => {
const modifiedOfferBookmarks = [...state.offersBookmarks];
const removeOfferBookmarkIdx = state.offersBookmarks.findIndex((ob) => ob.id === payload.offer_uuid);
if (removeOfferBookmarkIdx > -1) {
modifiedOfferBookmarks.splice(removeOfferBookmarkIdx, 1);
}
return {
...state,
paidOffers: modifiedPaidOffers
offersBookmarks: modifiedOfferBookmarks
};
})
);

@ -26,5 +26,5 @@ export const nodeInfoAndBalanceAndNumPeers = createSelector(clState, (state: CLS
export const nodeInfoAndBalance = createSelector(clState, (state: CLState) => ({ information: state.information, balance: state.balance }));
export const nodeInfoAndNodeSettingsAndAPIsStatus = createSelector(clState, (state: CLState) => ({ information: state.information, nodeSettings: state.nodeSettings, apisCallStatus: [state.apisCallStatus.FetchInfo, state.apisCallStatus.FetchForwardingHistory] }));
export const offers = createSelector(clState, (state: CLState) => ({ offers: state.offers, apiCallStatus: state.apisCallStatus.FetchOffers }));
export const paidOffers = createSelector(clState, (state: CLState) => ({ paidOffers: state.paidOffers, apiCallStatus: state.apisCallStatus.FetchPaidOffers }));
export const offerBookmarks = createSelector(clState, (state: CLState) => ({ offersBookmarks: state.offersBookmarks, apiCallStatus: state.apisCallStatus.FetchOfferBookmarks }));
export const getoffer = (offerBolt12Str) => createSelector(clState, (state: CLState) => (state.offers.find((offer: Offer) => offer.bolt12 === offerBolt12Str)));

@ -1,6 +1,6 @@
import { SelNodeChild } from '../../shared/models/RTLconfig';
import { APICallStatusEnum, UserPersonaEnum } from '../../shared/services/consts-enums-functions';
import { GetInfo, Fees, Balance, LocalRemoteBalance, Peer, Payment, Channel, FeeRates, ForwardingEvent, ListInvoices, UTXO, Offer, PaidOffer } from '../../shared/models/clModels';
import { GetInfo, Fees, Balance, LocalRemoteBalance, Peer, Payment, Channel, FeeRates, ForwardingEvent, ListInvoices, UTXO, Offer, OfferBookmark } from '../../shared/models/clModels';
import { ApiCallsListCL } from '../../shared/models/apiCallsPayload';
export interface CLState {
@ -22,7 +22,7 @@ export interface CLState {
invoices: ListInvoices;
utxos: UTXO[];
offers: Offer[];
paidOffers: PaidOffer[];
offersBookmarks: OfferBookmark[];
}
export const initCLState: CLState = {
@ -41,7 +41,7 @@ export const initCLState: CLState = {
FetchForwardingHistory: { status: APICallStatusEnum.UN_INITIATED },
FetchFailedForwardingHistory: { status: APICallStatusEnum.UN_INITIATED },
FetchOffers: { status: APICallStatusEnum.UN_INITIATED },
FetchPaidOffers: { status: APICallStatusEnum.UN_INITIATED }
FetchOfferBookmarks: { status: APICallStatusEnum.UN_INITIATED }
},
nodeSettings: { userPersona: UserPersonaEnum.OPERATOR, selCurrencyUnit: 'USD', fiatConversion: false, channelBackupPath: '', currencyUnits: [], enableOffers: false },
information: {},
@ -60,5 +60,5 @@ export const initCLState: CLState = {
invoices: { invoices: [] },
utxos: [],
offers: [],
paidOffers: []
offersBookmarks: []
};

@ -3,7 +3,7 @@
<div fxLayout="column" fxLayoutAlign="start stretch" fxLayout.gt-sm="row wrap" class="page-sub-title-container mt-1">
<div fxFlex="70" fxLayoutAlign="start start" fxLayoutAlign.gt-sm="start center">
<fa-icon [icon]="faHistory" class="page-title-img mr-1"></fa-icon>
<span class="page-title">Paid & Saved Offers</span>
<span class="page-title">Offer Bookmarks</span>
</div>
<mat-form-field fxFlex="30" fxLayoutAlign="start end">
<input matInput (keyup)="applyFilter()" [(ngModel)]="selFilter" placeholder="Filter">
@ -42,7 +42,7 @@
<mat-select placeholder="Actions" tabindex="4" class="mr-0">
<mat-select-trigger></mat-select-trigger>
<mat-option (click)="onPaidOfferClick(offer)">View Info</mat-option>
<mat-option (click)="onDeleteOffer(offer)">Delete Offer</mat-option>
<mat-option (click)="onDeleteBookmark(offer)">Delete Bookmark</mat-option>
<mat-option (click)="onRePayOffer(offer)">Pay Again</mat-option>
</mat-select>
</div>

@ -9,17 +9,17 @@ import { MatTableDataSource } from '@angular/material/table';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, getPaginatorLabel, ScreenSizeEnum, APICallStatusEnum, PaymentTypes, AlertTypeEnum } from '../../../../shared/services/consts-enums-functions';
import { ApiCallStatusPayload } from '../../../../shared/models/apiCallsPayload';
import { PaidOffer } from '../../../../shared/models/clModels';
import { OfferBookmark } from '../../../../shared/models/clModels';
import { LoggerService } from '../../../../shared/services/logger.service';
import { CommonService } from '../../../../shared/services/common.service';
import { RTLEffects } from '../../../../store/rtl.effects';
import { RTLState } from '../../../../store/rtl.state';
import { openAlert, openConfirmation } from '../../../../store/rtl.actions';
import { paidOffers } from '../../../store/cl.selector';
import { offerBookmarks } from '../../../store/cl.selector';
import { CLOfferInformationComponent } from '../offer-information-modal/offer-information.component';
import { CLLightningSendPaymentsComponent } from '../../send-payment-modal/send-payment.component';
import { deletePaidOffer } from '../../../store/cl.actions';
import { deleteOfferBookmark } from '../../../store/cl.actions';
@Component({
selector: 'rtl-cl-paid-offers-table',
@ -36,7 +36,7 @@ export class CLPaidOffersTableComponent implements OnInit, AfterViewInit, OnDest
faHistory = faHistory;
public displayedColumns: any[] = [];
public paidOffers: any;
public paidOfferJSONArr: PaidOffer[] = [];
public paidOfferJSONArr: OfferBookmark[] = [];
public flgSticky = false;
public pageSize = PAGE_SIZE;
public pageSizeOptions = PAGE_SIZE_OPTIONS;
@ -66,18 +66,18 @@ export class CLPaidOffersTableComponent implements OnInit, AfterViewInit, OnDest
}
ngOnInit() {
this.store.select(paidOffers).pipe(takeUntil(this.unSubs[0])).
subscribe((paidOffersSeletor: { paidOffers: PaidOffer[], apiCallStatus: ApiCallStatusPayload }) => {
this.store.select(offerBookmarks).pipe(takeUntil(this.unSubs[0])).
subscribe((offerBMsSeletor: { offersBookmarks: OfferBookmark[], apiCallStatus: ApiCallStatusPayload }) => {
this.errorMessage = '';
this.apiCallStatus = paidOffersSeletor.apiCallStatus;
this.apiCallStatus = offerBMsSeletor.apiCallStatus;
if (this.apiCallStatus.status === APICallStatusEnum.ERROR) {
this.errorMessage = (typeof (this.apiCallStatus.message) === 'object') ? JSON.stringify(this.apiCallStatus.message) : this.apiCallStatus.message;
}
this.paidOfferJSONArr = paidOffersSeletor.paidOffers || [];
this.paidOfferJSONArr = offerBMsSeletor.offersBookmarks || [];
if (this.paidOfferJSONArr && this.paidOfferJSONArr.length > 0 && this.sort && this.paginator) {
this.loadOffersTable(this.paidOfferJSONArr);
}
this.logger.info(paidOffersSeletor);
this.logger.info(offerBMsSeletor);
});
}
@ -87,7 +87,7 @@ export class CLPaidOffersTableComponent implements OnInit, AfterViewInit, OnDest
}
}
onPaidOfferClick(selOffer: PaidOffer) {
onPaidOfferClick(selOffer: OfferBookmark) {
this.store.dispatch(openAlert({
payload: {
data: {
@ -99,13 +99,13 @@ export class CLPaidOffersTableComponent implements OnInit, AfterViewInit, OnDest
}));
}
onDeleteOffer(selOffer: PaidOffer) {
onDeleteBookmark(selOffer: OfferBookmark) {
this.store.dispatch(openConfirmation({
payload: {
data: {
type: AlertTypeEnum.CONFIRM,
alertTitle: 'Delete Offer',
titleMessage: 'Deleting Offer: ' + (selOffer.title || selOffer.description),
alertTitle: 'Delete Bookmark',
titleMessage: 'Deleting Bookmark: ' + (selOffer.title || selOffer.description),
noBtnText: 'Cancel',
yesBtnText: 'Delete'
}
@ -113,12 +113,12 @@ export class CLPaidOffersTableComponent implements OnInit, AfterViewInit, OnDest
}));
this.rtlEffects.closeConfirm.pipe(takeUntil(this.unSubs[1])).subscribe((confirmRes) => {
if (confirmRes) {
this.store.dispatch(deletePaidOffer({ payload: { offer_uuid: selOffer.id } }));
this.store.dispatch(deleteOfferBookmark({ payload: { offer_uuid: selOffer.id } }));
}
});
}
onRePayOffer(selOffer: PaidOffer) {
onRePayOffer(selOffer: OfferBookmark) {
this.store.dispatch(openAlert({
payload: {
data: {
@ -136,11 +136,11 @@ export class CLPaidOffersTableComponent implements OnInit, AfterViewInit, OnDest
this.paidOffers.filter = this.selFilter.trim().toLowerCase();
}
loadOffersTable(paidOffrs: PaidOffer[]) {
this.paidOffers = (paidOffrs) ? new MatTableDataSource<PaidOffer>([...paidOffrs]) : new MatTableDataSource([]);
loadOffersTable(paidOffrs: OfferBookmark[]) {
this.paidOffers = (paidOffrs) ? new MatTableDataSource<OfferBookmark>([...paidOffrs]) : new MatTableDataSource([]);
this.paidOffers.sortingDataAccessor = (data: any, sortHeaderId: string) => ((data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null);
this.paidOffers.sort = this.sort;
this.paidOffers.filterPredicate = (paidOfr: PaidOffer, fltr: string) => JSON.stringify(paidOfr).toLowerCase().includes(fltr);
this.paidOffers.filterPredicate = (paidOfr: OfferBookmark, fltr: string) => JSON.stringify(paidOfr).toLowerCase().includes(fltr);
this.paidOffers.paginator = this.paginator;
this.applyFilter();
}

@ -62,7 +62,7 @@
<mat-error *ngIf="!offerAmount">Offer amount is required.</mat-error>
</mat-form-field>
<div fxFlex="100">
<mat-checkbox fxFlex="30" tabindex="6" class="mt-1" color="primary" [(ngModel)]="flgSaveToDB" matTooltip="Save or update offer in database for future payments" [matTooltipPosition]="'above'">Save/Update Offer</mat-checkbox>
<mat-checkbox fxFlex="30" tabindex="6" class="mt-1" color="primary" [(ngModel)]="flgSaveToDB" matTooltip="Save offer in database for future payments" [matTooltipPosition]="'above'">Bookmark Offer</mat-checkbox>
</div>
<mat-form-field fxFlex="100" *ngIf="flgSaveToDB || offerTitle !== ''" class="mt-1">
<input matInput placeholder="Title to Save" [(ngModel)]="offerTitle" tabindex="7">

@ -223,7 +223,7 @@ export class CLLightningSendPaymentsComponent implements OnInit, OnDestroy {
this.store.dispatch(fetchOfferInvoice({ payload: { offer: this.offerRequest } }));
}
} else {
this.store.dispatch(sendPayment({ payload: { uiMessage: UI_MESSAGES.SEND_OFFER, paymentType: PaymentTypes.OFFER, invoice: this.offerInvoice.invoice, saveToDB: this.flgSaveToDB, offerUUID: this.offerUUID, offerBolt12: this.offerRequest, amount: this.offerAmount * 1000, zeroAmtOffer: this.zeroAmtOffer, title: this.offerTitle, vendor: this.offerVendor, description: this.offerDescription, fromDialog: true } }));
this.store.dispatch(sendPayment({ payload: { uiMessage: UI_MESSAGES.SEND_PAYMENT, paymentType: PaymentTypes.OFFER, invoice: this.offerInvoice.invoice, saveToDB: this.flgSaveToDB, offerUUID: this.offerUUID, offerBolt12: this.offerRequest, amount: this.offerAmount * 1000, zeroAmtOffer: this.zeroAmtOffer, title: this.offerTitle, vendor: this.offerVendor, description: this.offerDescription, fromDialog: true } }));
}
}
}

@ -13,7 +13,7 @@ import { clNodeSettings, localRemoteBalance } from '../store/cl.selector';
import { LocalRemoteBalance } from '../../shared/models/clModels';
import { ApiCallStatusPayload } from '../../shared/models/apiCallsPayload';
import { SelNodeChild } from '../../shared/models/RTLconfig';
import { fetchOffers, fetchPaidOffers } from '../store/cl.actions';
import { fetchOffers, fetchOfferBookmarks } from '../store/cl.actions';
@Component({
selector: 'rtl-cl-transactions',
@ -47,9 +47,9 @@ export class CLTransactionsComponent implements OnInit, OnDestroy {
this.selNode = nodeSettings;
if (this.selNode.enableOffers) {
this.store.dispatch(fetchOffers());
this.store.dispatch(fetchPaidOffers());
this.store.dispatch(fetchOfferBookmarks());
this.links.push({ link: 'offers', name: 'Offers' });
this.links.push({ link: 'paidoffr', name: 'Paid Offers' });
this.links.push({ link: 'offrBookmarks', name: 'Paid Offer Bookmarks' });
const linkFound = this.links.find((link) => this.router.url.includes(link.link));
this.activeLink = linkFound ? linkFound.link : this.links[0].link;
}

@ -1,7 +1,7 @@
<div [perfectScrollbar] fxLayout="column" fxFlex="100">
<div fxFlex="100" class="alert alert-info mt-1">
<fa-icon [icon]="faInfoCircle" class="mr-1 alert-icon"></fa-icon>
<span>Exprimental features ahead, so proceed with caution. By enabling these features, you could lose funds.</span>
<span>Experimental features should be enabled with caution. Many such features may be implementation specific and not ratified for the BOLT spec. Enabling these may still result in a broken experience. Referencing relevant feature documentation is highly advised before enabling.</span>
</div>
<form fxLayout="column" fxLayoutAlign="start stretch" class="page-sub-title-container mt-1" #form="ngForm">
<div fxLayout="row">
@ -24,7 +24,7 @@
<form *ngIf="i === 0" fxLayout="column" fxFlex="100" fxLayoutAlign="start stretch" class="page-sub-title-container" #form="ngForm">
<div fxFlex="100" class="alert alert-info">
<fa-icon [icon]="faInfoCircle" class="mr-1 alert-icon"></fa-icon>
<span>Please ensure that <strong>experimental-offers</strong> flag is set to true in the CLightning config before enabling it in the RTL. Click <strong><a href="http://bolt12.org" target="_blank">here</a></strong> to learn more about CLightning offers.</span>
<span>Please ensure that <strong>experimental-offers</strong> flag is set to true in the CLightning config before enabling it in RTL. Click <strong><a href="http://bolt12.org" target="_blank">here</a></strong> to learn more about CLightning offers.</span>
</div>
<h4 class="mt-2">Description</h4>
<span>Offers is a draft specification (also referred as BOLT12) for Lightning nodes and wallets, with experimental support in C-Lightning.</span>

@ -57,7 +57,7 @@ export interface ApiCallsListCL {
FetchForwardingHistory: ApiCallStatusPayload;
FetchFailedForwardingHistory: ApiCallStatusPayload;
FetchOffers: ApiCallStatusPayload;
FetchPaidOffers: ApiCallStatusPayload;
FetchOfferBookmarks: ApiCallStatusPayload;
}
export interface ApiCallsListECL {

@ -97,7 +97,7 @@ export interface Offer {
used?: boolean;
}
export interface PaidOffer {
export interface OfferBookmark {
id?: string;
updatedAt?: string;
createdAt?: string;

@ -252,7 +252,6 @@ export const UI_MESSAGES = {
FETCH_INVOICE: 'Fetching Invoice...',
GET_SENT_PAYMENTS: 'Getting Sent Payments...',
SEND_PAYMENT: 'Sending Payment...',
SEND_OFFER: 'Sending Offer...',
SEND_KEYSEND: 'Sending Keysend Payment...',
SEARCHING_NODE: 'Searching Node...',
SEARCHING_CHANNEL: 'Searching Channel...',
@ -290,7 +289,7 @@ export const UI_MESSAGES = {
VERIFY_TOKEN: 'Verify Token...',
DISABLE_OFFER: 'Disabling Offer...',
CREATE_OFFER: 'Creating Offer...',
DELETE_PAID_OFFER: 'Deleting Paid Offer...',
DELETE_OFFER_BOOKMARK: 'Deleting Bookmark...',
};
export enum PaymentTypes {
@ -473,11 +472,11 @@ export enum CLActions {
ADD_OFFER_CL = 'ADD_OFFER_CL',
DISABLE_OFFER_CL = 'DISABLE_OFFER_CL',
UPDATE_OFFER_CL = 'UPDATE_OFFER_CL',
FETCH_PAID_OFFERS_CL = 'FETCH_PAID_OFFERS_CL',
SET_PAID_OFFERS_CL = 'SET_PAID_OFFERS_CL',
ADD_UPDATE_PAID_OFFER_CL = 'ADD_UPDATE_PAID_OFFER_CL',
DELETE_PAID_OFFER_CL = 'DELETE_PAID_OFFER_CL',
REMOVE_PAID_OFFER_CL = 'REMOVE_PAID_OFFER_CL'
FETCH_OFFER_BOOKMARKS_CL = 'FETCH_OFFER_BOOKMARKS_CL',
SET_OFFER_BOOKMARKS_CL = 'SET_OFFER_BOOKMARKS_CL',
ADD_UPDATE_OFFER_BOOKMARK_CL = 'ADD_UPDATE_OFFER_BOOKMARK_CL',
DELETE_OFFER_BOOKMARK_CL = 'DELETE_OFFER_BOOKMARK_CL',
REMOVE_OFFER_BOOKMARK_CL = 'REMOVE_OFFER_BOOKMARK_CL'
};
export enum ECLActions {

Loading…
Cancel
Save