@23blocks/block-sales 3.3.2 → 3.4.0
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/dist/index.esm.js +41 -2
- package/dist/src/lib/mappers/index.d.ts +1 -0
- package/dist/src/lib/mappers/index.d.ts.map +1 -1
- package/dist/src/lib/mappers/purchase.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/purchase.mapper.d.ts.map +1 -0
- package/dist/src/lib/sales.block.d.ts +3 -1
- package/dist/src/lib/sales.block.d.ts.map +1 -1
- package/dist/src/lib/services/index.d.ts +1 -0
- package/dist/src/lib/services/index.d.ts.map +1 -1
- package/dist/src/lib/services/purchases.service.d.ts +18 -0
- package/dist/src/lib/services/purchases.service.d.ts.map +1 -0
- package/dist/src/lib/types/index.d.ts +1 -0
- package/dist/src/lib/types/index.d.ts.map +1 -1
- package/dist/src/lib/types/purchase.d.ts +103 -0
- package/dist/src/lib/types/purchase.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1882,6 +1882,44 @@ function createVendorPaymentsService(transport, _config) {
|
|
|
1882
1882
|
};
|
|
1883
1883
|
}
|
|
1884
1884
|
|
|
1885
|
+
const purchaseMapper = {
|
|
1886
|
+
type: 'Purchase',
|
|
1887
|
+
map: (resource)=>({
|
|
1888
|
+
orderUniqueId: parseString(resource.attributes['order_unique_id']) || '',
|
|
1889
|
+
orderDisplayId: parseString(resource.attributes['order_display_id']) || '',
|
|
1890
|
+
subscriptionModelCode: parseString(resource.attributes['subscription_model_code']) || '',
|
|
1891
|
+
subscriptionStatus: parseString(resource.attributes['subscription_status']) || '',
|
|
1892
|
+
identityType: parseString(resource.attributes['identity_type']) || 'user',
|
|
1893
|
+
gateway: parseString(resource.attributes['gateway']) || 'none',
|
|
1894
|
+
amount: parseNumber(resource.attributes['amount']),
|
|
1895
|
+
purchasedAt: parseDate(resource.attributes['purchased_at']) || new Date()
|
|
1896
|
+
})
|
|
1897
|
+
};
|
|
1898
|
+
|
|
1899
|
+
function createPurchasesService(transport, _config) {
|
|
1900
|
+
return {
|
|
1901
|
+
async create (data) {
|
|
1902
|
+
const response = await transport.post('/purchases', {
|
|
1903
|
+
purchase: {
|
|
1904
|
+
subscription_model_code: data.subscriptionModelCode,
|
|
1905
|
+
identity_type: data.identityType,
|
|
1906
|
+
user_unique_id: 'userUniqueId' in data ? data.userUniqueId : undefined,
|
|
1907
|
+
company_unique_id: 'companyUniqueId' in data ? data.companyUniqueId : undefined,
|
|
1908
|
+
entity_unique_id: 'entityUniqueId' in data ? data.entityUniqueId : undefined,
|
|
1909
|
+
gateway: data.gateway,
|
|
1910
|
+
gateway_transaction_id: data.gatewayTransactionId,
|
|
1911
|
+
amount: data.amount,
|
|
1912
|
+
discount_amount: data.discountAmount,
|
|
1913
|
+
promo_code: data.promoCode,
|
|
1914
|
+
price_unique_id: data.priceUniqueId,
|
|
1915
|
+
metadata: data.metadata
|
|
1916
|
+
}
|
|
1917
|
+
});
|
|
1918
|
+
return decodeOne(response, purchaseMapper);
|
|
1919
|
+
}
|
|
1920
|
+
};
|
|
1921
|
+
}
|
|
1922
|
+
|
|
1885
1923
|
/**
|
|
1886
1924
|
* Create the Sales block.
|
|
1887
1925
|
*
|
|
@@ -1904,7 +1942,8 @@ function createVendorPaymentsService(transport, _config) {
|
|
|
1904
1942
|
flexibleOrders: createFlexibleOrdersService(transport),
|
|
1905
1943
|
stripe: createStripeService(transport),
|
|
1906
1944
|
mercadopago: createMercadoPagoService(transport),
|
|
1907
|
-
vendorPayments: createVendorPaymentsService(transport)
|
|
1945
|
+
vendorPayments: createVendorPaymentsService(transport),
|
|
1946
|
+
purchases: createPurchasesService(transport)
|
|
1908
1947
|
};
|
|
1909
1948
|
}
|
|
1910
1949
|
const salesBlockMetadata = {
|
|
@@ -1919,4 +1958,4 @@ const salesBlockMetadata = {
|
|
|
1919
1958
|
]
|
|
1920
1959
|
};
|
|
1921
1960
|
|
|
1922
|
-
export { createFlexibleOrdersService, createMercadoPagoService, createOrderDetailsService, createOrderTaxesService, createOrdersService, createPaymentsService, createSalesBlock, createSalesCustomersService, createSalesEntitiesService, createSalesUsersService, createStripeService, createSubscriptionModelsService, createSubscriptionsService, createVendorPaymentsService, flexibleOrderMapper, orderDetailMapper, orderMapper, orderTaxMapper, parseBoolean, parseDate, parseNumber, parseOptionalNumber, parseOrderStatus, parsePaymentStatus, parseStatus, parseString, parseStringArray, parseSubscriptionInterval, parseSubscriptionStatus, paymentMapper, salesBlockMetadata, salesCustomerMapper, salesEntityMapper, salesUserMapper, subscriptionMapper, subscriptionModelMapper };
|
|
1961
|
+
export { createFlexibleOrdersService, createMercadoPagoService, createOrderDetailsService, createOrderTaxesService, createOrdersService, createPaymentsService, createPurchasesService, createSalesBlock, createSalesCustomersService, createSalesEntitiesService, createSalesUsersService, createStripeService, createSubscriptionModelsService, createSubscriptionsService, createVendorPaymentsService, flexibleOrderMapper, orderDetailMapper, orderMapper, orderTaxMapper, parseBoolean, parseDate, parseNumber, parseOptionalNumber, parseOrderStatus, parsePaymentStatus, parseStatus, parseString, parseStringArray, parseSubscriptionInterval, parseSubscriptionStatus, paymentMapper, purchaseMapper, salesBlockMetadata, salesCustomerMapper, salesEntityMapper, salesUserMapper, subscriptionMapper, subscriptionModelMapper };
|
|
@@ -8,5 +8,6 @@ export * from './entity.mapper.js';
|
|
|
8
8
|
export * from './user.mapper.js';
|
|
9
9
|
export * from './customer.mapper.js';
|
|
10
10
|
export * from './flexible-order.mapper.js';
|
|
11
|
+
export * from './purchase.mapper.js';
|
|
11
12
|
export * from './utils.js';
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"purchase.mapper.d.ts","sourceRoot":"","sources":["../../../../src/lib/mappers/purchase.mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGrD,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,QAAQ,CAYnD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Transport, BlockConfig, BlockMetadata } from '@23blocks/contracts';
|
|
2
|
-
import { type OrdersService, type OrderDetailsService, type OrderTaxesService, type PaymentsService, type SubscriptionsService, type SubscriptionModelsService, type SalesEntitiesService, type SalesUsersService, type SalesCustomersService, type FlexibleOrdersService, type StripeService, type MercadoPagoService, type VendorPaymentsService } from './services/index.js';
|
|
2
|
+
import { type OrdersService, type OrderDetailsService, type OrderTaxesService, type PaymentsService, type SubscriptionsService, type SubscriptionModelsService, type SalesEntitiesService, type SalesUsersService, type SalesCustomersService, type FlexibleOrdersService, type StripeService, type MercadoPagoService, type VendorPaymentsService, type PurchasesService } from './services/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Configuration for the Sales block.
|
|
5
5
|
*/
|
|
@@ -39,6 +39,8 @@ export interface SalesBlock {
|
|
|
39
39
|
mercadopago: MercadoPagoService;
|
|
40
40
|
/** Vendor payment management */
|
|
41
41
|
vendorPayments: VendorPaymentsService;
|
|
42
|
+
/** Gateway-agnostic single-call purchases (Order + Payment + Subscription) */
|
|
43
|
+
purchases: PurchasesService;
|
|
42
44
|
}
|
|
43
45
|
/**
|
|
44
46
|
* Create the Sales block.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sales.block.d.ts","sourceRoot":"","sources":["../../../src/lib/sales.block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,
|
|
1
|
+
{"version":3,"file":"sales.block.d.ts","sourceRoot":"","sources":["../../../src/lib/sales.block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAeL,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAC;AAE7B;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,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,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Transport } from '@23blocks/contracts';
|
|
2
|
+
import type { Purchase, CreatePurchaseRequest } from '../types/purchase.js';
|
|
3
|
+
export interface PurchasesService {
|
|
4
|
+
/**
|
|
5
|
+
* Create a gateway-agnostic purchase.
|
|
6
|
+
*
|
|
7
|
+
* Creates an Order + OrderDetail + Payment + Subscription in a single call.
|
|
8
|
+
* Use this for free plan activations and server-confirmed purchases instead
|
|
9
|
+
* of the multi-step register + create-subscription + checkout flow.
|
|
10
|
+
*
|
|
11
|
+
* @returns The Purchase record with order, subscription, and payment details.
|
|
12
|
+
*/
|
|
13
|
+
create(data: CreatePurchaseRequest): Promise<Purchase>;
|
|
14
|
+
}
|
|
15
|
+
export declare function createPurchasesService(transport: Transport, _config: {
|
|
16
|
+
appId: string;
|
|
17
|
+
}): PurchasesService;
|
|
18
|
+
//# sourceMappingURL=purchases.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"purchases.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/purchases.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAG5E,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;OAQG;IACH,MAAM,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACxD;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,gBAAgB,CAsBzG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A completed purchase record (Order + Payment + Subscription in a single call).
|
|
3
|
+
*/
|
|
4
|
+
export interface Purchase {
|
|
5
|
+
orderUniqueId: string;
|
|
6
|
+
orderDisplayId: string;
|
|
7
|
+
subscriptionModelCode: string;
|
|
8
|
+
subscriptionStatus: string;
|
|
9
|
+
identityType: string;
|
|
10
|
+
gateway: string;
|
|
11
|
+
amount: number;
|
|
12
|
+
purchasedAt: Date;
|
|
13
|
+
}
|
|
14
|
+
/** Common optional fields shared across all purchase identity types. */
|
|
15
|
+
interface CreatePurchaseBase {
|
|
16
|
+
/** Plan code, e.g. `'free'`, `'pro-monthly'`. */
|
|
17
|
+
subscriptionModelCode: string;
|
|
18
|
+
/** Payment gateway. Default: `'none'`. */
|
|
19
|
+
gateway?: 'Stripe' | 'MercadoPago' | 'none';
|
|
20
|
+
/** Gateway transaction ID for server-confirmed purchases. */
|
|
21
|
+
gatewayTransactionId?: string;
|
|
22
|
+
/** Overrides the plan's recurring payment amount. */
|
|
23
|
+
amount?: number;
|
|
24
|
+
/** Discount amount. Default: `0`. */
|
|
25
|
+
discountAmount?: number;
|
|
26
|
+
/** Promotional code. */
|
|
27
|
+
promoCode?: string;
|
|
28
|
+
/** Specific SubscriptionModelPrice UUID. */
|
|
29
|
+
priceUniqueId?: string;
|
|
30
|
+
metadata?: Record<string, unknown>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Create a purchase as an individual user (B2C).
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* This is the default identity type when `identityType` is omitted.
|
|
37
|
+
*
|
|
38
|
+
* Required fields: `subscriptionModelCode`, `userUniqueId`
|
|
39
|
+
*/
|
|
40
|
+
export interface CreatePurchaseUserRequest extends CreatePurchaseBase {
|
|
41
|
+
identityType?: 'user';
|
|
42
|
+
/** Unique ID of the authenticated user. Required for identity type `'user'`. */
|
|
43
|
+
userUniqueId: string;
|
|
44
|
+
companyUniqueId?: never;
|
|
45
|
+
entityUniqueId?: never;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Create a purchase as a company (B2B).
|
|
49
|
+
*
|
|
50
|
+
* Required fields: `subscriptionModelCode`, `companyUniqueId`
|
|
51
|
+
*/
|
|
52
|
+
export interface CreatePurchaseCompanyRequest extends CreatePurchaseBase {
|
|
53
|
+
identityType: 'customer';
|
|
54
|
+
/** Unique ID of the company. Required for identity type `'customer'`. */
|
|
55
|
+
companyUniqueId: string;
|
|
56
|
+
userUniqueId?: never;
|
|
57
|
+
entityUniqueId?: never;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Create a purchase as an entity (AI agents, autonomous systems).
|
|
61
|
+
*
|
|
62
|
+
* Required fields: `subscriptionModelCode`, `entityUniqueId`
|
|
63
|
+
*/
|
|
64
|
+
export interface CreatePurchaseEntityRequest extends CreatePurchaseBase {
|
|
65
|
+
identityType: 'entity';
|
|
66
|
+
/** Unique ID of the entity. Required for identity type `'entity'`. */
|
|
67
|
+
entityUniqueId: string;
|
|
68
|
+
userUniqueId?: never;
|
|
69
|
+
companyUniqueId?: never;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Request to create a purchase.
|
|
73
|
+
*
|
|
74
|
+
* Creates an Order + OrderDetail + Payment + Subscription in a single call.
|
|
75
|
+
* Use this for free plan activations and server-confirmed purchases.
|
|
76
|
+
*
|
|
77
|
+
* The required fields depend on the `identityType`:
|
|
78
|
+
*
|
|
79
|
+
* - **`'user'`** (default) — individual B2C: requires `userUniqueId`
|
|
80
|
+
* - **`'customer'`** — company B2B: requires `companyUniqueId`
|
|
81
|
+
* - **`'entity'`** — AI agent / autonomous system: requires `entityUniqueId`
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* // Free plan signup (user)
|
|
86
|
+
* await sales.purchases.create({ subscriptionModelCode: 'free', userUniqueId: 'uuid-...' });
|
|
87
|
+
*
|
|
88
|
+
* // Paid plan with Stripe (company)
|
|
89
|
+
* await sales.purchases.create({
|
|
90
|
+
* identityType: 'customer',
|
|
91
|
+
* subscriptionModelCode: 'pro-monthly',
|
|
92
|
+
* companyUniqueId: 'uuid-...',
|
|
93
|
+
* gateway: 'Stripe',
|
|
94
|
+
* gatewayTransactionId: 'pi_...',
|
|
95
|
+
* });
|
|
96
|
+
*
|
|
97
|
+
* // Entity purchase
|
|
98
|
+
* await sales.purchases.create({ identityType: 'entity', subscriptionModelCode: 'agent-tier', entityUniqueId: 'uuid-...' });
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export type CreatePurchaseRequest = CreatePurchaseUserRequest | CreatePurchaseCompanyRequest | CreatePurchaseEntityRequest;
|
|
102
|
+
export {};
|
|
103
|
+
//# sourceMappingURL=purchase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"purchase.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/purchase.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,IAAI,CAAC;CACnB;AAED,wEAAwE;AACxE,UAAU,kBAAkB;IAC1B,iDAAiD;IACjD,qBAAqB,EAAE,MAAM,CAAC;IAC9B,0CAA0C;IAC1C,OAAO,CAAC,EAAE,QAAQ,GAAG,aAAa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