@aptly-as/types 3.0.15 → 3.0.16
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/core/content.d.ts +6 -0
- package/core/content.js +22 -0
- package/core/index.d.ts +1 -0
- package/core/index.js +1 -0
- package/core/webhook-event-data.d.ts +21 -15
- package/models/organization.d.ts +2 -0
- package/models/payment.d.ts +15 -5
- package/models/project.d.ts +2 -0
- package/models/unit.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AptlyOrganizationContent, AptlyProjectContent } from '../models/index.js';
|
|
2
|
+
export interface AptlyContentProps {
|
|
3
|
+
organization?: AptlyOrganizationContent;
|
|
4
|
+
project?: AptlyProjectContent;
|
|
5
|
+
}
|
|
6
|
+
export declare function useAptlyLogoSrc(content: AptlyContentProps): string;
|
package/core/content.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function useAptlyLogoSrc(content) {
|
|
2
|
+
let src = '';
|
|
3
|
+
if (content.project && 'theme' in content.project) {
|
|
4
|
+
if (content.project.theme?.images) {
|
|
5
|
+
if (content.project.theme.images.logoMedia) {
|
|
6
|
+
src = content.project.theme.images.logoMedia.src;
|
|
7
|
+
}
|
|
8
|
+
else if (content.project.theme.images.logo) {
|
|
9
|
+
src = content.project.theme.images.logo;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
if (!src && content.organization && 'name' in content.organization) {
|
|
14
|
+
if (content.organization.logoMedia) {
|
|
15
|
+
src = content.organization.logoMedia.src;
|
|
16
|
+
}
|
|
17
|
+
else if (content.organization.logo) {
|
|
18
|
+
src = content.organization.logo;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return src;
|
|
22
|
+
}
|
package/core/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { AptlyCloudinaryFile } from './cloudinary.js';
|
|
|
3
3
|
export * from './api.js';
|
|
4
4
|
export * from './app.js';
|
|
5
5
|
export * from './cloudinary.js';
|
|
6
|
+
export * from './content.js';
|
|
6
7
|
export * from './job.js';
|
|
7
8
|
export * from './mongoose.js';
|
|
8
9
|
export * from './redirect.js';
|
package/core/index.js
CHANGED
|
@@ -1,35 +1,41 @@
|
|
|
1
|
-
import { AptlyDocumentSchema, AptlyOrderSchema, AptlyPaymentSchema, AptlyPaymentSettlement, AptlyProjectSchema, AptlyUnitSchema } from '../models/index.js';
|
|
1
|
+
import { AptlyDocumentSchema, AptlyOrderSchema, AptlyOrganizationSchema, AptlyPaymentSchema, AptlyPaymentSettlement, AptlyProjectSchema, AptlyUnitSchema } from '../models/index.js';
|
|
2
2
|
export declare namespace AptlyWebhookEventData {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type Organization<ID, DATE> = Pick<AptlyOrganizationSchema<ID, DATE>, '_id' | 'name' | 'logoMedia' | 'logo'>;
|
|
4
|
+
type Project<ID, DATE> = Pick<AptlyProjectSchema<ID, DATE>, '_id' | 'name' | 'theme'>;
|
|
5
|
+
type Unit<ID, DATE> = Pick<AptlyUnitSchema<ID, DATE>, '_id' | 'name'>;
|
|
6
|
+
export interface UnitWebhookSchema<ID, DATE> {
|
|
7
|
+
unit: Unit<ID, DATE>;
|
|
5
8
|
}
|
|
6
|
-
interface UnitDocumentWebhookSchema<ID, DATE> {
|
|
9
|
+
export interface UnitDocumentWebhookSchema<ID, DATE> {
|
|
7
10
|
document: AptlyDocumentSchema<ID, DATE>;
|
|
8
11
|
documentUrl: string;
|
|
9
12
|
}
|
|
10
|
-
type Payment = PaymentSchema<string, string>;
|
|
11
|
-
interface PaymentSchema<ID, DATE> {
|
|
12
|
-
|
|
13
|
-
project:
|
|
13
|
+
export type Payment = PaymentSchema<string, string>;
|
|
14
|
+
export interface PaymentSchema<ID, DATE> {
|
|
15
|
+
organization: Organization<ID, DATE>;
|
|
16
|
+
project: Project<ID, DATE>;
|
|
17
|
+
unit: Unit<ID, DATE>;
|
|
14
18
|
payment: AptlyPaymentSchema<ID, DATE>;
|
|
15
19
|
order: Pick<AptlyOrderSchema<ID, DATE>, '_id' | 'orderNumber'>;
|
|
16
20
|
documentUrl?: string;
|
|
17
21
|
reportDocumentUrl?: string;
|
|
18
22
|
}
|
|
19
|
-
type NewUnitDocument = NewUnitDocumentSchema<string, string>;
|
|
20
|
-
type NewUnitDocumentSchema<ID, DATE> = UnitWebhookSchema<ID, DATE> & UnitDocumentWebhookSchema<ID, DATE>;
|
|
21
|
-
type NewUnitOrder = NewUnitOrderSchema<string, string>;
|
|
22
|
-
interface NewUnitOrderSchema<ID, DATE> extends NewUnitDocumentSchema<ID, DATE> {
|
|
23
|
+
export type NewUnitDocument = NewUnitDocumentSchema<string, string>;
|
|
24
|
+
export type NewUnitDocumentSchema<ID, DATE> = UnitWebhookSchema<ID, DATE> & UnitDocumentWebhookSchema<ID, DATE>;
|
|
25
|
+
export type NewUnitOrder = NewUnitOrderSchema<string, string>;
|
|
26
|
+
export interface NewUnitOrderSchema<ID, DATE> extends NewUnitDocumentSchema<ID, DATE> {
|
|
23
27
|
order: Pick<AptlyOrderSchema<ID, DATE>, '_id' | 'orderNumber' | 'receipt' | 'period'>;
|
|
24
28
|
}
|
|
25
|
-
type Order = OrderSchema<string, string>;
|
|
26
|
-
interface OrderSchema<ID, DATE> {
|
|
27
|
-
|
|
29
|
+
export type Order = OrderSchema<string, string>;
|
|
30
|
+
export interface OrderSchema<ID, DATE> {
|
|
31
|
+
organization: Organization<ID, DATE>;
|
|
32
|
+
project: Project<ID, DATE>;
|
|
28
33
|
unit: Pick<AptlyUnitSchema<ID, DATE>, '_id' | 'name' | 'shipping' | 'users'>;
|
|
29
34
|
order: AptlyOrderSchema<ID, DATE>;
|
|
30
35
|
receiptUrl?: string;
|
|
31
36
|
signedReceiptUrl?: string;
|
|
32
37
|
}
|
|
38
|
+
export {};
|
|
33
39
|
}
|
|
34
40
|
export declare namespace AptlyAppWebhookEventData {
|
|
35
41
|
interface SettlementCreate extends Pick<AptlyPaymentSettlement, 'app' | 'at' | 'externalId' | 'externalRef' | 'destination'> {
|
package/models/organization.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ import { AptlyDepartmentGeneric } from './department.js';
|
|
|
12
12
|
import { AptlyProducerSchema } from './producer.js';
|
|
13
13
|
import { AptlyAppSchema } from './app.js';
|
|
14
14
|
import { AptlyAlgorithmSchema } from './algorithm.js';
|
|
15
|
+
export type AptlyOrganizationContent = AptlyOrganizationContentSchema<string, string>;
|
|
16
|
+
export type AptlyOrganizationContentSchema<ID, DATE> = Pick<AptlyOrganizationSchema<ID, DATE>, '_id' | 'name' | 'logoMedia' | 'logo'>;
|
|
15
17
|
export type AptlyOrganization = AptlyOrganizationSchema<string, string>;
|
|
16
18
|
export interface AptlyOrganizationSchema<ID, DATE> extends AptlyBaseSchema<ID, DATE>, AptlyHistorySchema<ID, DATE> {
|
|
17
19
|
slug: string;
|
package/models/payment.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { AptlyAddress } from './address.js';
|
|
2
2
|
import { AptlyAppSchema } from './app.js';
|
|
3
|
-
import { AptlyCustomerSchema } from './customer.js';
|
|
3
|
+
import { AptlyCustomer, AptlyCustomerSchema } from './customer.js';
|
|
4
4
|
import { AptlyDocumentSchema } from './document.js';
|
|
5
5
|
import { AptlyBaseSchema } from './extends.js';
|
|
6
|
-
import { AptlyOrderPaymentStatus, AptlyOrderSchema } from './order.js';
|
|
7
|
-
import { AptlyOrganizationSchema } from './organization.js';
|
|
6
|
+
import { AptlyOrder, AptlyOrderPaymentStatus, AptlyOrderSchema } from './order.js';
|
|
7
|
+
import { AptlyOrganizationContent, AptlyOrganizationSchema } from './organization.js';
|
|
8
8
|
import { AptlyPickConfirmedSchema } from './pick.js';
|
|
9
|
-
import { AptlyProjectSchema } from './project.js';
|
|
10
|
-
import { AptlyUnitSchema } from './unit.js';
|
|
9
|
+
import { AptlyProjectContent, AptlyProjectSchema } from './project.js';
|
|
10
|
+
import { AptlyUnitContent, AptlyUnitSchema } from './unit.js';
|
|
11
11
|
import { AptlyUserSchema } from './user.js';
|
|
12
12
|
export type AptlyPayment = AptlyPaymentSchema<string, string>;
|
|
13
13
|
export interface AptlyPaymentSchema<ID, DATE> extends Omit<AptlyBaseSchema<ID, DATE>, 'name' | 'archived'> {
|
|
@@ -88,6 +88,16 @@ export interface AptlyPaymentItemSchema<ID> {
|
|
|
88
88
|
totalCost: number;
|
|
89
89
|
totalVat: number;
|
|
90
90
|
}
|
|
91
|
+
export interface AptlyPaymentInitPaymentBody {
|
|
92
|
+
organization: AptlyOrganizationContent;
|
|
93
|
+
project: AptlyProjectContent;
|
|
94
|
+
unit: AptlyUnitContent;
|
|
95
|
+
order: AptlyOrder;
|
|
96
|
+
customer: AptlyCustomer;
|
|
97
|
+
shipping: AptlyAddress;
|
|
98
|
+
billing: AptlyAddress;
|
|
99
|
+
redirectUri: string;
|
|
100
|
+
}
|
|
91
101
|
export interface AptlyPaymentCaptureBody {
|
|
92
102
|
id: string;
|
|
93
103
|
status: AptlyOrderPaymentStatus;
|
package/models/project.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ import { AptlyBaseSchema, AptlyHistorySchema } from './extends.js';
|
|
|
11
11
|
import { AptlyDocumentSchema } from './document.js';
|
|
12
12
|
import { AptlyUnitOptionExtraItemSchema } from './unit.js';
|
|
13
13
|
import { AptlyMediaSrc } from './media.js';
|
|
14
|
+
export type AptlyProjectContent = AptlyProjectContentSchema<string, string>;
|
|
15
|
+
export type AptlyProjectContentSchema<ID, DATE> = Pick<AptlyProjectSchema<ID, DATE>, '_id' | 'name' | 'theme'>;
|
|
14
16
|
export type AptlyProject = AptlyProjectSchema<string, string>;
|
|
15
17
|
export interface AptlyProjectSchema<ID, DATE> extends AptlyBaseSchema<ID, DATE>, AptlyHistorySchema<ID, DATE> {
|
|
16
18
|
organization: AptlyOrganizationSchema<ID, DATE> | ID;
|
package/models/unit.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ import { AptlyUnitTemplateBaseSchema, AptlyUnitTemplateCategorySchema, AptlyUnit
|
|
|
12
12
|
import { AptlyIntegration, AptlyUnitItemParamKey, AptlyUnitStatus } from '../enums/index.js';
|
|
13
13
|
import { AptlyUserSchema } from './user.js';
|
|
14
14
|
import { AptlyOrganizationSchema } from './organization.js';
|
|
15
|
+
export type AptlyUnitContent = AptlyUnitContentSchema<string, string>;
|
|
16
|
+
export type AptlyUnitContentSchema<ID, DATE> = Pick<AptlyUnitSchema<ID, DATE>, '_id' | 'name' | 'address' | 'shipping' | 'billing'>;
|
|
15
17
|
export type AptlyUnit = AptlyUnitSchema<string, string>;
|
|
16
18
|
export interface AptlyUnitSchema<ID, DATE> extends AptlyUnitTemplateBaseSchema<ID, DATE>, AptlyUnitEditData<DATE>, AptlyHistorySchema<ID, DATE> {
|
|
17
19
|
status: AptlyUnitStatus;
|