@@ -60,14 +60,19 @@ const description = t("site.description");
6060 ERROR = 'grant_error',
6161 REJECTED = 'grant_rejected',
6262 INVALID = 'grant_invalid',
63+ KEY_SUCCESS = 'key_add_success',
64+ KEY_ERROR = 'key_add_error',
6365 }
6466
65- type Intent = 'connect' | 'funds'
67+ type Intent = 'connect' | 'reconnect' | ' funds' | 'update_budget '
6668
6769 const DEFAULT_ERROR_MESSAGE = function (_version: string, intent: Intent) {
6870 if(intent === 'funds') {
6971 return 'Something went wrong. Please try adding funds again.'
7072 }
73+ if(intent === 'update_budget') {
74+ return 'Something went wrong. Please try updating your budget again.'
75+ }
7176 return 'Something went wrong. Please try reconnecting your wallet.'
7277 }
7378 const CLOSE_TAB_MESSAGE = 'You may safely close this tab.'
@@ -80,13 +85,19 @@ const description = t("site.description");
8085 const ERROR_MESSAGES = {
8186 continuation_failed(_version: string, intent: Intent): string {
8287 if(intent === 'funds') {
83- return 'An error occured. Please try adding funds again.'
88+ return 'An error occurred. Please try adding funds again.'
89+ }
90+ if(intent === 'update_budget') {
91+ return 'An error occurred. Please try updating your budget again.'
8492 }
8593 return 'An error occurred. Please try reconnecting the wallet.'
8694 },
8795 hash_failed(_version: string, intent: Intent): string {
8896 if(intent === 'funds') {
89- return 'An error occured. Please try adding funds again.'
97+ return 'An error occurred. Please try adding funds again.'
98+ }
99+ if(intent === 'update_budget') {
100+ return 'An error occurred. Please try updating your budget again.'
90101 }
91102 return 'An error occurred. Please try reconnecting the wallet.'
92103 },
@@ -97,18 +108,33 @@ const description = t("site.description");
97108 if(intent === 'funds') {
98109 return 'You have successfully added more funds.'
99110 }
111+ if(intent === 'update_budget') {
112+ return 'You have successfully updated your budget.'
113+ }
100114 return 'Your wallet is now successfully connected to the extension.'
101115 },
116+ key_add_success(_version: string): string {
117+ return 'Your wallet is now successfully reconnected to the extension.'
118+ },
102119 grant_rejected(_version: string, intent: Intent): string {
103120 if(intent === 'funds') {
104121 return 'No funds were added.'
105122 }
123+ if(intent === 'update_budget') {
124+ return 'Your budget was not updated.'
125+ }
106126 return 'Your request was successfully rejected.'
107127 },
128+ key_add_error(_version: string): string {
129+ return 'Something went wrong with your request. Please try reconnecting your wallet.'
130+ },
108131 grant_invalid(_version: string, intent: Intent): string {
109132 if(intent === 'funds') {
110133 return 'Something went wrong with your request. Please try adding funds again.'
111134 }
135+ if(intent === 'update_budget') {
136+ return 'Something went wrong with your request. Please try updating your budget again.'
137+ }
112138 return 'Something went wrong with your request. Please try reconnecting your wallet.'
113139 }
114140 }
@@ -134,11 +160,21 @@ const description = t("site.description");
134160 heroInfo.textContent = CLOSE_TAB_MESSAGE
135161 heroHeading.textContent = MESSAGES[SuccessParam.SUCCESS](version, intent)
136162 break
163+ case SuccessParam.KEY_SUCCESS:
164+ updateImage('success')
165+ heroInfo.textContent = CLOSE_TAB_MESSAGE
166+ heroHeading.textContent = MESSAGES[SuccessParam.KEY_SUCCESS](version)
167+ break
137168 case SuccessParam.REJECTED:
138169 updateImage('warning')
139170 heroInfo.textContent = CLOSE_TAB_MESSAGE
140171 heroHeading.textContent = MESSAGES[SuccessParam.REJECTED](version, intent)
141172 break
173+ case SuccessParam.KEY_ERROR:
174+ updateImage('error')
175+ heroInfo.textContent = CLOSE_TAB_MESSAGE
176+ heroHeading.textContent = MESSAGES[SuccessParam.KEY_ERROR](version)
177+ break
142178 case SuccessParam.INVALID:
143179 updateImage('error')
144180 heroInfo.textContent = CLOSE_TAB_MESSAGE