@01.software/sdk 0.45.0 → 0.46.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/CHANGELOG.md +8 -0
- package/MIGRATION.md +19 -0
- package/README.md +49 -4
- package/dist/client.cjs +13 -0
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +3 -3
- package/dist/client.d.ts +3 -3
- package/dist/client.js +13 -0
- package/dist/client.js.map +1 -1
- package/dist/{collection-client-Ckfusuee.d.ts → collection-client-D6kKrYdq.d.ts} +1 -1
- package/dist/{collection-client-BSo7VXQE.d.cts → collection-client-DolMjCoC.d.cts} +1 -1
- package/dist/index.cjs +13 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/dist/query.cjs +8 -0
- package/dist/query.cjs.map +1 -1
- package/dist/query.d.cts +2 -2
- package/dist/query.d.ts +2 -2
- package/dist/query.js +8 -0
- package/dist/query.js.map +1 -1
- package/dist/server.cjs +99 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +99 -1
- package/dist/server.js.map +1 -1
- package/dist/{types-BlOvjoTX.d.ts → types-C60vHIkY.d.ts} +40 -1
- package/dist/{types-C4WuJfw7.d.cts → types-xlqBeW2N.d.cts} +40 -1
- package/package.json +3 -3
package/dist/server.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as ServerCollectionClient } from './collection-client-
|
|
2
|
-
export { C as CollectionClient } from './collection-client-
|
|
3
|
-
import { aA as RawBaseApi, aB as ServerApiOptions, aC as ServerCommerceClient, aD as TenantIntrospectionClient, aE as SubscribeMembershipParams, aF as SubscribeMembershipResponse, e as CancelMembershipParams, f as CancelMembershipResponse, a as CommunityClient, aG as BanCustomerParams, aH as CommunityBan, aI as UnbanCustomerParams, M as MarketDiscovery, g as ClientState, aJ as ClientServerConfig, E as EventsClient, aK as RootServerClientWithEvents } from './types-
|
|
4
|
-
export { A as AddItemParams, aL as CancelServerPaymentSessionParams, aM as CartApi, aN as CartApiOptions, l as CartMergeResult, m as CartMineResult, n as CartMutationResult, o as CheckoutAbandonedReason, p as CheckoutAmounts, aO as CheckoutApi, aP as CheckoutApiOptions, aQ as CheckoutListItem, q as CheckoutOrderReference, r as CheckoutPaymentSessionRef, aR as CheckoutQueryParams, aS as CheckoutQueryResult, s as CheckoutShippingAddress, aT as CheckoutStatus, t as ClearCartParams, aU as CollectionFieldSchema, aV as CollectionSchemaResponse, aW as ConfirmTossPaymentSessionParams, w as CreateCartParams, x as CreateCartResult, B as CreatePaymentSessionParams,
|
|
1
|
+
import { S as ServerCollectionClient } from './collection-client-DolMjCoC.cjs';
|
|
2
|
+
export { C as CollectionClient } from './collection-client-DolMjCoC.cjs';
|
|
3
|
+
import { aA as RawBaseApi, aB as ServerApiOptions, aC as ServerCommerceClient, aD as TenantIntrospectionClient, aE as SubscribeMembershipParams, aF as SubscribeMembershipResponse, e as CancelMembershipParams, f as CancelMembershipResponse, a as CommunityClient, aG as BanCustomerParams, aH as CommunityBan, aI as UnbanCustomerParams, M as MarketDiscovery, g as ClientState, aJ as ClientServerConfig, E as EventsClient, aK as RootServerClientWithEvents } from './types-xlqBeW2N.cjs';
|
|
4
|
+
export { A as AddItemParams, aL as CancelServerPaymentSessionParams, aM as CartApi, aN as CartApiOptions, l as CartMergeResult, m as CartMineResult, n as CartMutationResult, o as CheckoutAbandonedReason, p as CheckoutAmounts, aO as CheckoutApi, aP as CheckoutApiOptions, aQ as CheckoutListItem, q as CheckoutOrderReference, r as CheckoutPaymentSessionRef, aR as CheckoutQueryParams, aS as CheckoutQueryResult, s as CheckoutShippingAddress, aT as CheckoutStatus, t as ClearCartParams, aU as CollectionFieldSchema, aV as CollectionSchemaResponse, aW as ConfirmCustomPaymentSessionOptions, aX as ConfirmCustomPaymentSessionParams, aY as ConfirmCustomPaymentSessionResponse, aZ as ConfirmTossPaymentSessionParams, w as CreateCartParams, x as CreateCartResult, a_ as CreateCustomPaymentSessionParams, B as CreatePaymentSessionParams, a$ as CreateServerCheckoutParams, b0 as CreateServerCheckoutResult, b1 as CustomPaymentSession, b2 as CustomPaymentSessionProof, d as CustomerMembershipView, D as CustomerSnapshot, b3 as EventAdmissionAvailabilityParams, b4 as EventAdmissionAvailabilityResponse, b5 as EventAdmissionAvailabilityType, b6 as EventAdmissionPricePresentment, b7 as EventGuestCancelParams, b8 as EventGuestRegistration, b9 as EventGuestRegistrationResponse, ba as EventRegistrationAnswerInput, bb as EventRegistrationAttendeeInput, bc as EventRegistrationPublic, bd as EventRegistrationRegisterParams, be as EventRegistrationRegisterResponse, bf as EventsCalendarItem, bg as EventsClientOptions, bh as EventsDateParam, bi as EventsExternalSource, bj as EventsLocation, bk as EventsOccurrenceLocation, bl as EventsRangeEvent, bm as EventsRangeOccurrence, bn as EventsRangeParams, bo as EventsRangeResponse, bp as EventsTaxonomyItem, I as MembershipStatus, bq as ModerationApi, J as Money, O as OpenCheckoutPaymentState, L as PaymentFailureReason, N as PaymentNextAction, Q as PaymentProviderStatus, R as PaymentReconciliationReason, br as PaymentSessionApi, bs as PaymentSessionApiOptions, S as PaymentSessionRole, T as ProductUpsertInput, U as ProductUpsertParams, V as ProductUpsertResponse, W as ProductUpsertVariantInput, X as PublicAttribute, Y as PublicCaptureEvidence, Z as PublicCart, _ as PublicCartItem, $ as PublicCartItemAdmission, a0 as PublicCartMarket, a1 as PublicCartReference, a2 as PublicCheckout, a3 as PublicCheckoutItem, a4 as PublicMediaAsset, a5 as PublicMediaSize, a6 as PublicOrder, a7 as PublicOrderAmounts, a8 as PublicOrderItem, a9 as PublicOrderReference, aa as PublicPaymentSession, ab as ReconciliationRequired, ac as RemoveItemParams, ae as RetrieveCartParams, af as RetrieveCheckoutParams, bt as RetrieveServerCheckoutParams, bu as RetrieveServerPaymentSessionParams, bv as RootServerClient, bw as ServerCartMergeParams, bx as ServerCartMineParams, by as ServerCheckout, ak as ShippingLine, am as SpentCheckoutPaymentState, bz as TenantContextInput, bA as TenantContextResponse, bB as TenantFeatureProgressEvidenceValue, bC as TenantFeatureProgressFeature, bD as TenantFeatureProgressGroup, bE as TenantFeatureProgressInput, bF as TenantFeatureProgressItem, bG as TenantFeatureProgressItemState, bH as TenantFeatureProgressResponse, bI as TenantFeatureProgressSeverity, bJ as TenantFeatureProgressStatus, bK as TenantFieldConfigState, bL as TenantIntrospectionApi, bM as TenantIntrospectionApiOptions, av as UpdateCartAttributesParams, aw as UpdateDiscountCodesParams, ax as UpdateItemParams, ay as VariantInput } from './types-xlqBeW2N.cjs';
|
|
5
5
|
import './payload-types-CJZuXcgF.cjs';
|
|
6
6
|
import './metadata.cjs';
|
|
7
7
|
import './const-BAG0MH0u.cjs';
|
package/dist/server.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as ServerCollectionClient } from './collection-client-
|
|
2
|
-
export { C as CollectionClient } from './collection-client-
|
|
3
|
-
import { aA as RawBaseApi, aB as ServerApiOptions, aC as ServerCommerceClient, aD as TenantIntrospectionClient, aE as SubscribeMembershipParams, aF as SubscribeMembershipResponse, e as CancelMembershipParams, f as CancelMembershipResponse, a as CommunityClient, aG as BanCustomerParams, aH as CommunityBan, aI as UnbanCustomerParams, M as MarketDiscovery, g as ClientState, aJ as ClientServerConfig, E as EventsClient, aK as RootServerClientWithEvents } from './types-
|
|
4
|
-
export { A as AddItemParams, aL as CancelServerPaymentSessionParams, aM as CartApi, aN as CartApiOptions, l as CartMergeResult, m as CartMineResult, n as CartMutationResult, o as CheckoutAbandonedReason, p as CheckoutAmounts, aO as CheckoutApi, aP as CheckoutApiOptions, aQ as CheckoutListItem, q as CheckoutOrderReference, r as CheckoutPaymentSessionRef, aR as CheckoutQueryParams, aS as CheckoutQueryResult, s as CheckoutShippingAddress, aT as CheckoutStatus, t as ClearCartParams, aU as CollectionFieldSchema, aV as CollectionSchemaResponse, aW as ConfirmTossPaymentSessionParams, w as CreateCartParams, x as CreateCartResult, B as CreatePaymentSessionParams,
|
|
1
|
+
import { S as ServerCollectionClient } from './collection-client-D6kKrYdq.js';
|
|
2
|
+
export { C as CollectionClient } from './collection-client-D6kKrYdq.js';
|
|
3
|
+
import { aA as RawBaseApi, aB as ServerApiOptions, aC as ServerCommerceClient, aD as TenantIntrospectionClient, aE as SubscribeMembershipParams, aF as SubscribeMembershipResponse, e as CancelMembershipParams, f as CancelMembershipResponse, a as CommunityClient, aG as BanCustomerParams, aH as CommunityBan, aI as UnbanCustomerParams, M as MarketDiscovery, g as ClientState, aJ as ClientServerConfig, E as EventsClient, aK as RootServerClientWithEvents } from './types-C60vHIkY.js';
|
|
4
|
+
export { A as AddItemParams, aL as CancelServerPaymentSessionParams, aM as CartApi, aN as CartApiOptions, l as CartMergeResult, m as CartMineResult, n as CartMutationResult, o as CheckoutAbandonedReason, p as CheckoutAmounts, aO as CheckoutApi, aP as CheckoutApiOptions, aQ as CheckoutListItem, q as CheckoutOrderReference, r as CheckoutPaymentSessionRef, aR as CheckoutQueryParams, aS as CheckoutQueryResult, s as CheckoutShippingAddress, aT as CheckoutStatus, t as ClearCartParams, aU as CollectionFieldSchema, aV as CollectionSchemaResponse, aW as ConfirmCustomPaymentSessionOptions, aX as ConfirmCustomPaymentSessionParams, aY as ConfirmCustomPaymentSessionResponse, aZ as ConfirmTossPaymentSessionParams, w as CreateCartParams, x as CreateCartResult, a_ as CreateCustomPaymentSessionParams, B as CreatePaymentSessionParams, a$ as CreateServerCheckoutParams, b0 as CreateServerCheckoutResult, b1 as CustomPaymentSession, b2 as CustomPaymentSessionProof, d as CustomerMembershipView, D as CustomerSnapshot, b3 as EventAdmissionAvailabilityParams, b4 as EventAdmissionAvailabilityResponse, b5 as EventAdmissionAvailabilityType, b6 as EventAdmissionPricePresentment, b7 as EventGuestCancelParams, b8 as EventGuestRegistration, b9 as EventGuestRegistrationResponse, ba as EventRegistrationAnswerInput, bb as EventRegistrationAttendeeInput, bc as EventRegistrationPublic, bd as EventRegistrationRegisterParams, be as EventRegistrationRegisterResponse, bf as EventsCalendarItem, bg as EventsClientOptions, bh as EventsDateParam, bi as EventsExternalSource, bj as EventsLocation, bk as EventsOccurrenceLocation, bl as EventsRangeEvent, bm as EventsRangeOccurrence, bn as EventsRangeParams, bo as EventsRangeResponse, bp as EventsTaxonomyItem, I as MembershipStatus, bq as ModerationApi, J as Money, O as OpenCheckoutPaymentState, L as PaymentFailureReason, N as PaymentNextAction, Q as PaymentProviderStatus, R as PaymentReconciliationReason, br as PaymentSessionApi, bs as PaymentSessionApiOptions, S as PaymentSessionRole, T as ProductUpsertInput, U as ProductUpsertParams, V as ProductUpsertResponse, W as ProductUpsertVariantInput, X as PublicAttribute, Y as PublicCaptureEvidence, Z as PublicCart, _ as PublicCartItem, $ as PublicCartItemAdmission, a0 as PublicCartMarket, a1 as PublicCartReference, a2 as PublicCheckout, a3 as PublicCheckoutItem, a4 as PublicMediaAsset, a5 as PublicMediaSize, a6 as PublicOrder, a7 as PublicOrderAmounts, a8 as PublicOrderItem, a9 as PublicOrderReference, aa as PublicPaymentSession, ab as ReconciliationRequired, ac as RemoveItemParams, ae as RetrieveCartParams, af as RetrieveCheckoutParams, bt as RetrieveServerCheckoutParams, bu as RetrieveServerPaymentSessionParams, bv as RootServerClient, bw as ServerCartMergeParams, bx as ServerCartMineParams, by as ServerCheckout, ak as ShippingLine, am as SpentCheckoutPaymentState, bz as TenantContextInput, bA as TenantContextResponse, bB as TenantFeatureProgressEvidenceValue, bC as TenantFeatureProgressFeature, bD as TenantFeatureProgressGroup, bE as TenantFeatureProgressInput, bF as TenantFeatureProgressItem, bG as TenantFeatureProgressItemState, bH as TenantFeatureProgressResponse, bI as TenantFeatureProgressSeverity, bJ as TenantFeatureProgressStatus, bK as TenantFieldConfigState, bL as TenantIntrospectionApi, bM as TenantIntrospectionApiOptions, av as UpdateCartAttributesParams, aw as UpdateDiscountCodesParams, ax as UpdateItemParams, ay as VariantInput } from './types-C60vHIkY.js';
|
|
5
5
|
import './payload-types-CJZuXcgF.js';
|
|
6
6
|
import './metadata.js';
|
|
7
7
|
import './const-CaPq2AE4.js';
|
package/dist/server.js
CHANGED
|
@@ -375,6 +375,11 @@ function redactSensitiveHeaders(headers) {
|
|
|
375
375
|
redacted["x-preview-token"]
|
|
376
376
|
);
|
|
377
377
|
}
|
|
378
|
+
if (redacted["x-custom-payment-signature"]) {
|
|
379
|
+
redacted["x-custom-payment-signature"] = redactSensitiveHeader(
|
|
380
|
+
redacted["x-custom-payment-signature"]
|
|
381
|
+
);
|
|
382
|
+
}
|
|
378
383
|
return redacted;
|
|
379
384
|
}
|
|
380
385
|
function getErrorSuggestion(status) {
|
|
@@ -1643,6 +1648,14 @@ var COMMERCE_ENDPOINTS = {
|
|
|
1643
1648
|
create: endpoint("POST", "/api/payment-sessions/create"),
|
|
1644
1649
|
retrieve: endpoint("POST", "/api/payment-sessions/retrieve"),
|
|
1645
1650
|
cancel: endpoint("POST", "/api/payment-sessions/cancel"),
|
|
1651
|
+
custom: {
|
|
1652
|
+
create: sharedEndpoint(
|
|
1653
|
+
COMMERCE_ENDPOINT_OPERATIONS.paymentSessions.custom.create
|
|
1654
|
+
),
|
|
1655
|
+
confirm: sharedEndpoint(
|
|
1656
|
+
COMMERCE_ENDPOINT_OPERATIONS.paymentSessions.custom.confirm
|
|
1657
|
+
)
|
|
1658
|
+
},
|
|
1646
1659
|
server: {
|
|
1647
1660
|
create: endpoint("POST", "/api/payment-sessions/server/create"),
|
|
1648
1661
|
retrieve: endpoint("POST", "/api/payment-sessions/server/retrieve"),
|
|
@@ -3036,6 +3049,43 @@ function validateMoney(value, resource, path) {
|
|
|
3036
3049
|
safeMinor(money.amountMinor, resource, `${path}.amountMinor`);
|
|
3037
3050
|
currency(money.currency, resource, `${path}.currency`);
|
|
3038
3051
|
}
|
|
3052
|
+
function validateCustomPaymentSession(value) {
|
|
3053
|
+
const resource = "custom PaymentSession";
|
|
3054
|
+
const session = record(value, resource, "$");
|
|
3055
|
+
exact(
|
|
3056
|
+
session,
|
|
3057
|
+
["id", "provider", "providerSessionId", "money"],
|
|
3058
|
+
[],
|
|
3059
|
+
resource,
|
|
3060
|
+
"$"
|
|
3061
|
+
);
|
|
3062
|
+
string(session.id, resource, "$.id");
|
|
3063
|
+
const provider = string(session.provider, resource, "$.provider");
|
|
3064
|
+
if (!/^[a-z0-9][a-z0-9_-]{0,63}$/i.test(provider)) {
|
|
3065
|
+
fail(resource, "$.provider", "provider slug");
|
|
3066
|
+
}
|
|
3067
|
+
string(session.providerSessionId, resource, "$.providerSessionId");
|
|
3068
|
+
validateMoney(session.money, resource, "$.money");
|
|
3069
|
+
return value;
|
|
3070
|
+
}
|
|
3071
|
+
function validateConfirmCustomPaymentSessionResponse(value) {
|
|
3072
|
+
const resource = "custom PaymentSession confirmation";
|
|
3073
|
+
const result = record(value, resource, "$");
|
|
3074
|
+
exact(
|
|
3075
|
+
result,
|
|
3076
|
+
["orderId", "transactionId", "status"],
|
|
3077
|
+
["alreadyConfirmed"],
|
|
3078
|
+
resource,
|
|
3079
|
+
"$"
|
|
3080
|
+
);
|
|
3081
|
+
string(result.orderId, resource, "$.orderId");
|
|
3082
|
+
string(result.transactionId, resource, "$.transactionId");
|
|
3083
|
+
if (result.status !== "paid") fail(resource, "$.status", "paid");
|
|
3084
|
+
if (result.alreadyConfirmed !== void 0) {
|
|
3085
|
+
boolean(result.alreadyConfirmed, resource, "$.alreadyConfirmed");
|
|
3086
|
+
}
|
|
3087
|
+
return value;
|
|
3088
|
+
}
|
|
3039
3089
|
function validateCaptureEvidence(value, resource, path) {
|
|
3040
3090
|
const evidence = record(value, resource, path);
|
|
3041
3091
|
exact(evidence, ["amountMinor", "currency", "observedAt"], [], resource, path);
|
|
@@ -4915,6 +4965,49 @@ var PaymentSessionApi = class extends CustomerScopedApi {
|
|
|
4915
4965
|
);
|
|
4916
4966
|
}
|
|
4917
4967
|
};
|
|
4968
|
+
var CustomPaymentSessionApi = class extends BaseApi {
|
|
4969
|
+
constructor(options) {
|
|
4970
|
+
super("CustomPaymentSessionApi", options);
|
|
4971
|
+
}
|
|
4972
|
+
async create(params) {
|
|
4973
|
+
assertCommerceIdempotencyKey(params.idempotencyKey);
|
|
4974
|
+
const body = {
|
|
4975
|
+
provider: params.provider,
|
|
4976
|
+
checkoutToken: params.checkoutToken
|
|
4977
|
+
};
|
|
4978
|
+
const result = await this.requestEndpoint(
|
|
4979
|
+
COMMERCE_ENDPOINTS.paymentSessions.custom.create,
|
|
4980
|
+
body,
|
|
4981
|
+
{ headers: { "X-Idempotency-Key": params.idempotencyKey } }
|
|
4982
|
+
);
|
|
4983
|
+
return validateCustomPaymentSession(result);
|
|
4984
|
+
}
|
|
4985
|
+
async confirm(params, options = {}) {
|
|
4986
|
+
const body = {
|
|
4987
|
+
provider: params.provider,
|
|
4988
|
+
providerSessionId: params.providerSessionId,
|
|
4989
|
+
providerPaymentId: params.providerPaymentId,
|
|
4990
|
+
providerEventId: params.providerEventId,
|
|
4991
|
+
amount: params.amount,
|
|
4992
|
+
currency: params.currency,
|
|
4993
|
+
occurredAt: params.occurredAt
|
|
4994
|
+
};
|
|
4995
|
+
const proof = await options.createProof?.(JSON.stringify(body));
|
|
4996
|
+
const result = await this.requestEndpoint(
|
|
4997
|
+
COMMERCE_ENDPOINTS.paymentSessions.custom.confirm,
|
|
4998
|
+
body,
|
|
4999
|
+
proof ? {
|
|
5000
|
+
headers: {
|
|
5001
|
+
"X-Custom-Payment-Timestamp": proof.timestamp,
|
|
5002
|
+
"X-Custom-Payment-Signature": proof.signature
|
|
5003
|
+
}
|
|
5004
|
+
} : void 0
|
|
5005
|
+
);
|
|
5006
|
+
return validateConfirmCustomPaymentSessionResponse(
|
|
5007
|
+
result
|
|
5008
|
+
);
|
|
5009
|
+
}
|
|
5010
|
+
};
|
|
4918
5011
|
|
|
4919
5012
|
// src/core/preview/server-preview-client.ts
|
|
4920
5013
|
var ServerPreviewClient = class extends RawBaseApi {
|
|
@@ -4992,6 +5085,7 @@ var ServerCommerceClient = class {
|
|
|
4992
5085
|
const orderApi = new OrderApi(serverOptions);
|
|
4993
5086
|
const checkoutApi = new CheckoutApi(serverOptions);
|
|
4994
5087
|
const paymentSessionApi = new PaymentSessionApi(serverOptions);
|
|
5088
|
+
const customPaymentSessionApi = new CustomPaymentSessionApi(serverOptions);
|
|
4995
5089
|
this.product = {
|
|
4996
5090
|
stockCheck: productApi.stockCheck.bind(productApi),
|
|
4997
5091
|
listingGroups: (params) => productApi.listingGroups(this.withMarket(params)),
|
|
@@ -5037,7 +5131,11 @@ var ServerCommerceClient = class {
|
|
|
5037
5131
|
create: paymentSessionApi.create.bind(paymentSessionApi),
|
|
5038
5132
|
retrieve: (params) => paymentSessionApi.retrieve(params),
|
|
5039
5133
|
cancel: (params) => paymentSessionApi.cancel(params),
|
|
5040
|
-
confirm: paymentSessionApi.confirm.bind(paymentSessionApi)
|
|
5134
|
+
confirm: paymentSessionApi.confirm.bind(paymentSessionApi),
|
|
5135
|
+
custom: {
|
|
5136
|
+
create: customPaymentSessionApi.create.bind(customPaymentSessionApi),
|
|
5137
|
+
confirm: customPaymentSessionApi.confirm.bind(customPaymentSessionApi)
|
|
5138
|
+
}
|
|
5041
5139
|
};
|
|
5042
5140
|
this.discounts = {
|
|
5043
5141
|
validate: discountApi.validate.bind(discountApi)
|