@nauticana/sail 1.1.25 → 1.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -12
- package/package.json +2 -1
- package/src/component/billing/portal_button.ts +6 -1
- package/src/component/document/document_review_queue.html +24 -0
- package/src/component/document/document_review_queue.ts +67 -0
- package/src/component/document/document_upload.html +31 -0
- package/src/component/document/document_upload.ts +113 -0
- package/src/component/document/partner_documents.html +33 -0
- package/src/component/document/partner_documents.ts +92 -0
- package/src/component/login/login_component.ts +3 -3
- package/src/component/payment/user_payment_methods.html +1 -1
- package/src/component/payment/user_payment_methods.ts +6 -6
- package/src/component/table/action_params_dialog.html +10 -0
- package/src/component/table/action_params_dialog.ts +9 -1
- package/src/config.ts +5 -5
- package/src/index.ts +5 -0
- package/src/model/agency.ts +8 -0
- package/src/model/document.ts +36 -0
- package/src/service/agency.service.ts +7 -0
- package/src/service/auth.service.ts +55 -21
- package/src/service/billing.service.ts +3 -3
- package/src/service/label.service.ts +22 -0
- package/src/service/notification_inbox.service.ts +54 -15
- package/src/service/partner_document.service.ts +111 -0
- package/src/service/realtime.service.ts +5 -3
- package/src/service/rest_service.ts +11 -1
- package/src/service/rest_url.ts +8 -4
- package/src/service/user_payment_method.service.ts +8 -14
- package/src/util/errors.ts +5 -0
|
@@ -8,13 +8,10 @@ import { UserPaymentMethod } from '../model/appdata';
|
|
|
8
8
|
/**
|
|
9
9
|
* UserPaymentMethodService — consumer-side saved-payment-methods API.
|
|
10
10
|
*
|
|
11
|
-
* list
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* endpoint because it needs an atomic multi-row UPDATE
|
|
16
|
-
* (`SET is_default = (id = ?) WHERE user_id = session`) that abstract
|
|
17
|
-
* single-row CRUD can't express.
|
|
11
|
+
* list goes through keel's generic REST CRUD against the UserSpecific basis
|
|
12
|
+
* user_payment_method table. remove and setDefault are keel table actions:
|
|
13
|
+
* remove detaches the method at the provider before deleting the row, so keel
|
|
14
|
+
* grants no generic DELETE on the table.
|
|
18
15
|
*/
|
|
19
16
|
@Injectable({ providedIn: 'root' })
|
|
20
17
|
export class UserPaymentMethodService extends BaseRestService {
|
|
@@ -29,15 +26,12 @@ export class UserPaymentMethodService extends BaseRestService {
|
|
|
29
26
|
return this.backend.list<UserPaymentMethod>('user_payment_method');
|
|
30
27
|
}
|
|
31
28
|
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
return this.
|
|
29
|
+
/** Detach a saved payment method at the provider and delete it. */
|
|
30
|
+
remove(id: number): Observable<{ message: string }> {
|
|
31
|
+
return this.http.post<{ message: string }>(this.url(RestURL.paymentMethodRemoveURL), { id });
|
|
35
32
|
}
|
|
36
33
|
|
|
37
|
-
/**
|
|
38
|
-
* Mark one row as default; clears every other row in the same call.
|
|
39
|
-
* Custom endpoint — see service-class doc for the rationale.
|
|
40
|
-
*/
|
|
34
|
+
/** Mark one row as default; clears every other row in the same call. */
|
|
41
35
|
setDefault(id: number): Observable<{ message: string }> {
|
|
42
36
|
return this.http.post<{ message: string }>(this.url(RestURL.paymentMethodSetDefaultURL), { id });
|
|
43
37
|
}
|
package/src/util/errors.ts
CHANGED
|
@@ -31,6 +31,11 @@ export function isTransportFailure(err: unknown): boolean {
|
|
|
31
31
|
return statusOf(err) === 0;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/** True for keel's 403: the session is valid but lacks the grant for this action. */
|
|
35
|
+
export function isPermissionDenied(err: unknown): boolean {
|
|
36
|
+
return statusOf(err) === 403;
|
|
37
|
+
}
|
|
38
|
+
|
|
34
39
|
/**
|
|
35
40
|
* Human-readable message from any sail error shape — SailApiError (BackendService),
|
|
36
41
|
* raw HttpErrorResponse (direct HttpClient calls), or plain Error.
|