@haakco/custd-sdk 3.77.1 → 3.78.1

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.
@@ -48,6 +48,7 @@ export type CampaignEmailSelection = {
48
48
  export type EmailRelayTestSendRequest = {
49
49
  recipient: string;
50
50
  campaign?: CampaignEmailSelection;
51
+ receiptRevision?: string;
51
52
  };
52
53
  export type EmailRelayTestSendResult = {
53
54
  accepted: boolean;
@@ -45,8 +45,10 @@ export type AppMeetingBlock = {
45
45
  status: AppMeetingBlockStatus;
46
46
  /** The time the agenda predicted. */
47
47
  predictedMs: number;
48
- /** The time it has now: an overrun earlier block shrinks the blocks after it. */
48
+ /** The time currently allocated to the block. */
49
49
  allocatedMs: number;
50
+ /** The allocation recorded when the block began. */
51
+ allocatedAtStartMs?: number;
50
52
  /** The time it took, once it is done. */
51
53
  actualMs: number;
52
54
  startedAt?: string;
@@ -61,6 +63,15 @@ export type AppMeetingSummary = {
61
63
  /** How far the meeting ran past its planned end. */
62
64
  overrunMs: number;
63
65
  };
66
+ export type AppMeetingAllocationChange = {
67
+ blockUuid: string;
68
+ beforeMs: number;
69
+ afterMs: number;
70
+ };
71
+ export type AppMeetingAdjustment = {
72
+ blockUuid: string;
73
+ changes: AppMeetingAllocationChange[];
74
+ };
64
75
  /** A meeting as it runs. `startedAt` and `endsAt` are set once it starts. */
65
76
  export type AppMeeting = {
66
77
  name: string;
@@ -72,6 +83,7 @@ export type AppMeeting = {
72
83
  currentBlockUuid?: string;
73
84
  blocks: AppMeetingBlock[] | null;
74
85
  summary: AppMeetingSummary;
86
+ adjustments?: AppMeetingAdjustment[];
75
87
  };
76
88
  export type AppMeetingAction = {
77
89
  description: string;
@@ -3,5 +3,5 @@
3
3
  "sha256": "3d2c6ee13f13224c259f1cee37af6bd5f395bd1aec40fa918a762e312808a8cb",
4
4
  "bytes": 23630,
5
5
  "gzipBytes": 7537,
6
- "sdkVersion": "3.77.1"
6
+ "sdkVersion": "3.78.1"
7
7
  }
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ import { SiteInsightsAdminClient } from "./admin-site-insights-tasks.js";
11
11
  import { SubjectExportClient } from "./admin-subject-exports.js";
12
12
  import { TenantStorageClient } from "./admin-tenant-storage.js";
13
13
  import { type CustdDownloadStream } from "./download-stream.js";
14
+ import { StorefrontClient } from "./storefront.js";
14
15
  export { AUTH_PROJECT_DOMAIN_CONVERGENCES, AUTH_PROJECT_DOMAIN_IMAGE_COMPONENTS, AUTH_PROJECT_DOMAIN_IMAGE_SOURCES, AUTH_PROJECT_DOMAIN_LIFECYCLES, AUTH_PROJECT_DOMAIN_STATUSES, type AuthProjectAppLink, type AuthProjectAppLinkList, type AuthProjectBrandLogo, type AuthProjectDomainBinding, type AuthProjectDomainBindRequest, type AuthProjectDomainConvergence, type AuthProjectDomainDNSProof, type AuthProjectDomainImageComponent, type AuthProjectDomainImageOverride, type AuthProjectDomainImageOverrideRequest, type AuthProjectDomainImageSet, type AuthProjectDomainImageSource, type AuthProjectDomainImages, type AuthProjectDomainLifecycle, type AuthProjectDomainMintRequest, type AuthProjectDomainStatus, } from "./admin-auth-project-domain.js";
15
16
  export { ADMIN_USER_GLOBAL_STATES, ADMIN_USER_MEMBERSHIP_STATES, ADMIN_USER_ROLES, type AdminUser, AdminUserAdminClient, type AdminUserCreateRequest, type AdminUserDisableRequest, type AdminUserEnableRequest, type AdminUserGlobalState, type AdminUserListQuery, type AdminUserListResponse, type AdminUserMembershipCreateRequest, type AdminUserMembershipState, type AdminUserPasswordReset, type AdminUserRemovalRequest, type AdminUserRole, type AdminUserScope, type AdminUserUpdateRequest, } from "./admin-users.js";
16
17
  export { WORKFLOW_TIMING_FACT_KINDS, WORKFLOW_TIMING_STATES, WorkflowTimingAdminClient, type WorkflowTimingAttempt, type WorkflowTimingBatchResult, type WorkflowTimingContribution, type WorkflowTimingDeclaration, type WorkflowTimingDefinition, type WorkflowTimingDefinitionList, type WorkflowTimingDimensionDefinition, type WorkflowTimingDurationHistory, type WorkflowTimingDurationHistoryEntry, type WorkflowTimingDurationProjection, type WorkflowTimingEvaluation, type WorkflowTimingEvaluationArtifact, type WorkflowTimingExcludedStep, type WorkflowTimingExpectation, type WorkflowTimingFact, type WorkflowTimingFactKind, type WorkflowTimingObservation, type WorkflowTimingObservationResult, type WorkflowTimingOutcomeCounts, type WorkflowTimingPrediction, type WorkflowTimingProjectionStatus, type WorkflowTimingProvenance, type WorkflowTimingRebuildResult, type WorkflowTimingReconcileResult, type WorkflowTimingRevision, type WorkflowTimingRun, type WorkflowTimingRunDuration, type WorkflowTimingRunFact, type WorkflowTimingRunList, type WorkflowTimingRunListQuery, type WorkflowTimingRunProjection, type WorkflowTimingRunSummary, type WorkflowTimingRunTiming, type WorkflowTimingState, type WorkflowTimingStepDeclaration, type WorkflowTimingStepDefinition, type WorkflowTimingStepDuration, type WorkflowTimingStepFact, } from "./admin-workflow-timings.js";
@@ -1900,6 +1901,7 @@ export declare class CustdClient {
1900
1901
  readonly measurement: MeasurementClient;
1901
1902
  readonly ingestOperations: IngestOperationsClient;
1902
1903
  readonly publicReads: PublicReadClient;
1904
+ readonly storefronts: StorefrontClient;
1903
1905
  private baseUrl;
1904
1906
  private getToken;
1905
1907
  private fetchImpl;
@@ -2348,3 +2350,4 @@ export * from "./reporting-catalogue.js";
2348
2350
  export type { EventSchemaDocument, EventSchemaRegisterRequest, EventSchemaStateResult, EventSchemaVersion, EventSchemaVersionList, RegisteredEventType, RegisteredEventTypeList, } from "./schema-registry.js";
2349
2351
  export { SiteAIOwnerSession, type SiteAIOwnerSettings, type SiteAIOwnerTransport } from "./site-ai-owner.js";
2350
2352
  export * from "./site-monitor-reports.js";
2353
+ export * from "./storefront.js";
package/dist/index.js CHANGED
@@ -12,6 +12,7 @@ import { SubjectExportClient } from "./admin-subject-exports.js";
12
12
  import { TenantStorageClient } from "./admin-tenant-storage.js";
13
13
  import { responseDownloadStream } from "./download-stream.js";
14
14
  import { isLocalHostname } from "./secure-url.js";
15
+ import { StorefrontClient } from "./storefront.js";
15
16
  export { AUTH_PROJECT_DOMAIN_CONVERGENCES, AUTH_PROJECT_DOMAIN_IMAGE_COMPONENTS, AUTH_PROJECT_DOMAIN_IMAGE_SOURCES, AUTH_PROJECT_DOMAIN_LIFECYCLES, AUTH_PROJECT_DOMAIN_STATUSES, } from "./admin-auth-project-domain.js";
16
17
  export { ADMIN_USER_GLOBAL_STATES, ADMIN_USER_MEMBERSHIP_STATES, ADMIN_USER_ROLES, AdminUserAdminClient, } from "./admin-users.js";
17
18
  export { WORKFLOW_TIMING_FACT_KINDS, WORKFLOW_TIMING_STATES, WorkflowTimingAdminClient, } from "./admin-workflow-timings.js";
@@ -257,6 +258,7 @@ export class CustdClient {
257
258
  this.admin = new AdminNamespace((method, path, body, options) => this.adminRequest(method, path, body, options), (method, path, body, options) => this.apiRequest(method, path, body, options), (path, options) => this.offboardingDownload(path, options), (path, options) => this.auditExportDownload(path, options));
258
259
  this.provisioning = new ProvisioningNamespace((method, path, body, options) => this.apiRequest(method, path, body, options));
259
260
  this.reporting = new ReportingNamespace((method, path, body, options) => this.apiRequest(method, path, body, options), (path, options) => this.apiDownload(path, options));
261
+ this.storefronts = new StorefrontClient((method, path, body, options) => this.apiRequest(method, path, body, options));
260
262
  this.schemas = new SchemaNamespace((method, path, body) => this.apiRequest(method, path, body));
261
263
  this.analytics = new AnalyticsEventClient((method, path, body, options) => this.apiRequest(method, path, body, options));
262
264
  this.parsers = new ParserClient((method, path, body, options) => this.apiRequest(method, path, body, options));
@@ -2240,3 +2242,4 @@ export * from "./public-reads.js";
2240
2242
  export * from "./reporting-catalogue.js";
2241
2243
  export { SiteAIOwnerSession } from "./site-ai-owner.js";
2242
2244
  export * from "./site-monitor-reports.js";
2245
+ export * from "./storefront.js";
@@ -1686,6 +1686,8 @@ export const APP_RESPONSE_LISTS = {
1686
1686
  "links",
1687
1687
  "measurementProject.series",
1688
1688
  "measurementRuns.runs",
1689
+ "meeting.adjustments",
1690
+ "meeting.adjustments[].changes",
1689
1691
  "meeting.blocks",
1690
1692
  "meetingMinutes.actions",
1691
1693
  "plan.parts",
@@ -1715,6 +1717,8 @@ export const APP_RESPONSE_LISTS = {
1715
1717
  "links",
1716
1718
  "measurementProject.series",
1717
1719
  "measurementRuns.runs",
1720
+ "meeting.adjustments",
1721
+ "meeting.adjustments[].changes",
1718
1722
  "meeting.blocks",
1719
1723
  "meetingMinutes.actions",
1720
1724
  "plan.parts",
@@ -1729,6 +1733,8 @@ export const APP_RESPONSE_LISTS = {
1729
1733
  "links",
1730
1734
  "measurementProject.series",
1731
1735
  "measurementRuns.runs",
1736
+ "meeting.adjustments",
1737
+ "meeting.adjustments[].changes",
1732
1738
  "meeting.blocks",
1733
1739
  "meetingMinutes.actions",
1734
1740
  "plan.parts",
@@ -1743,6 +1749,8 @@ export const APP_RESPONSE_LISTS = {
1743
1749
  "links",
1744
1750
  "measurementProject.series",
1745
1751
  "measurementRuns.runs",
1752
+ "meeting.adjustments",
1753
+ "meeting.adjustments[].changes",
1746
1754
  "meeting.blocks",
1747
1755
  "meetingMinutes.actions",
1748
1756
  "plan.parts",
@@ -1764,6 +1772,8 @@ export const APP_RESPONSE_LISTS = {
1764
1772
  "links",
1765
1773
  "measurementProject.series",
1766
1774
  "measurementRuns.runs",
1775
+ "meeting.adjustments",
1776
+ "meeting.adjustments[].changes",
1767
1777
  "meeting.blocks",
1768
1778
  "meetingMinutes.actions",
1769
1779
  "plan.parts",
@@ -1778,6 +1788,8 @@ export const APP_RESPONSE_LISTS = {
1778
1788
  "links",
1779
1789
  "measurementProject.series",
1780
1790
  "measurementRuns.runs",
1791
+ "meeting.adjustments",
1792
+ "meeting.adjustments[].changes",
1781
1793
  "meeting.blocks",
1782
1794
  "meetingMinutes.actions",
1783
1795
  "plan.parts",
@@ -1792,6 +1804,8 @@ export const APP_RESPONSE_LISTS = {
1792
1804
  "links",
1793
1805
  "measurementProject.series",
1794
1806
  "measurementRuns.runs",
1807
+ "meeting.adjustments",
1808
+ "meeting.adjustments[].changes",
1795
1809
  "meeting.blocks",
1796
1810
  "meetingMinutes.actions",
1797
1811
  "plan.parts",
@@ -1808,6 +1822,8 @@ export const APP_RESPONSE_LISTS = {
1808
1822
  "links",
1809
1823
  "measurementProject.series",
1810
1824
  "measurementRuns.runs",
1825
+ "meeting.adjustments",
1826
+ "meeting.adjustments[].changes",
1811
1827
  "meeting.blocks",
1812
1828
  "meetingMinutes.actions",
1813
1829
  "plan.parts",
@@ -1822,6 +1838,8 @@ export const APP_RESPONSE_LISTS = {
1822
1838
  "links",
1823
1839
  "measurementProject.series",
1824
1840
  "measurementRuns.runs",
1841
+ "meeting.adjustments",
1842
+ "meeting.adjustments[].changes",
1825
1843
  "meeting.blocks",
1826
1844
  "meetingMinutes.actions",
1827
1845
  "plan.parts",
@@ -1836,6 +1854,8 @@ export const APP_RESPONSE_LISTS = {
1836
1854
  "links",
1837
1855
  "measurementProject.series",
1838
1856
  "measurementRuns.runs",
1857
+ "meeting.adjustments",
1858
+ "meeting.adjustments[].changes",
1839
1859
  "meeting.blocks",
1840
1860
  "meetingMinutes.actions",
1841
1861
  "plan.parts",
@@ -1850,6 +1870,8 @@ export const APP_RESPONSE_LISTS = {
1850
1870
  "item.links",
1851
1871
  "item.measurementProject.series",
1852
1872
  "item.measurementRuns.runs",
1873
+ "item.meeting.adjustments",
1874
+ "item.meeting.adjustments[].changes",
1853
1875
  "item.meeting.blocks",
1854
1876
  "item.meetingMinutes.actions",
1855
1877
  "item.plan.parts",
@@ -1864,6 +1886,8 @@ export const APP_RESPONSE_LISTS = {
1864
1886
  "links",
1865
1887
  "measurementProject.series",
1866
1888
  "measurementRuns.runs",
1889
+ "meeting.adjustments",
1890
+ "meeting.adjustments[].changes",
1867
1891
  "meeting.blocks",
1868
1892
  "meetingMinutes.actions",
1869
1893
  "plan.parts",
@@ -1878,6 +1902,8 @@ export const APP_RESPONSE_LISTS = {
1878
1902
  "links",
1879
1903
  "measurementProject.series",
1880
1904
  "measurementRuns.runs",
1905
+ "meeting.adjustments",
1906
+ "meeting.adjustments[].changes",
1881
1907
  "meeting.blocks",
1882
1908
  "meetingMinutes.actions",
1883
1909
  "plan.parts",
@@ -1892,6 +1918,8 @@ export const APP_RESPONSE_LISTS = {
1892
1918
  "links",
1893
1919
  "measurementProject.series",
1894
1920
  "measurementRuns.runs",
1921
+ "meeting.adjustments",
1922
+ "meeting.adjustments[].changes",
1895
1923
  "meeting.blocks",
1896
1924
  "meetingMinutes.actions",
1897
1925
  "plan.parts",
@@ -1906,6 +1934,8 @@ export const APP_RESPONSE_LISTS = {
1906
1934
  "item.links",
1907
1935
  "item.measurementProject.series",
1908
1936
  "item.measurementRuns.runs",
1937
+ "item.meeting.adjustments",
1938
+ "item.meeting.adjustments[].changes",
1909
1939
  "item.meeting.blocks",
1910
1940
  "item.meetingMinutes.actions",
1911
1941
  "item.plan.parts",
@@ -0,0 +1,145 @@
1
+ import type { RequestOptions } from "./index.js";
2
+ type StorefrontRequester = <T>(method: string, path: string, body?: unknown, options?: RequestOptions) => Promise<T>;
3
+ /** An exact signed minor-unit count encoded as a decimal string. */
4
+ export type StorefrontMoney = {
5
+ currency: string;
6
+ amountMinor: string;
7
+ };
8
+ export type StorefrontUnitPrice = {
9
+ currency: string;
10
+ amount: string;
11
+ };
12
+ export type StorefrontPriceRevision = {
13
+ priceRevisionUuid: string;
14
+ revision: number;
15
+ unitPrice: StorefrontUnitPrice;
16
+ taxTreatment: string;
17
+ taxRate: string;
18
+ taxLabel: string;
19
+ effectiveFrom: string;
20
+ };
21
+ export type StorefrontOffer = {
22
+ offerUuid: string;
23
+ name: string;
24
+ billingInterval: string;
25
+ priceRevision: StorefrontPriceRevision;
26
+ };
27
+ export type StorefrontCatalogue = {
28
+ offers: StorefrontOffer[];
29
+ canPublish: boolean;
30
+ };
31
+ export type StorefrontPublishOffer = {
32
+ offerUuid?: string;
33
+ name: string;
34
+ billingInterval: "" | "month";
35
+ unitPrice: StorefrontUnitPrice;
36
+ taxRate: string;
37
+ taxLabel: string;
38
+ effectiveFrom?: string;
39
+ };
40
+ export type StorefrontCartLine = {
41
+ offerUuid: string;
42
+ priceRevisionUuid: string;
43
+ quantity: string;
44
+ };
45
+ export type StorefrontCart = {
46
+ cartUuid: string;
47
+ revision: number;
48
+ status: "open" | "checked_out";
49
+ currency: string;
50
+ createdAt: string;
51
+ lines: StorefrontCartLine[];
52
+ };
53
+ /** Set an exact decimal quantity. Use "0" to remove the line. */
54
+ export type StorefrontLineQuantity = {
55
+ quantity: string;
56
+ };
57
+ export type StorefrontTotals = {
58
+ netTotal: StorefrontMoney;
59
+ taxTotal: StorefrontMoney;
60
+ grossTotal: StorefrontMoney;
61
+ };
62
+ export type StorefrontTax = {
63
+ label: string;
64
+ rate: string;
65
+ rounding: string;
66
+ roundingPoint: string;
67
+ amount: StorefrontMoney;
68
+ };
69
+ export type StorefrontServicePeriod = {
70
+ start: string;
71
+ endExclusive: string;
72
+ };
73
+ export type StorefrontQuoteLine = {
74
+ lineNumber: number;
75
+ offerUuid: string;
76
+ priceRevisionUuid: string;
77
+ description: string;
78
+ quantity: string;
79
+ unitPrice: StorefrontUnitPrice;
80
+ extensionRounding: string;
81
+ servicePeriod: StorefrontServicePeriod;
82
+ netAmount: StorefrontMoney;
83
+ tax: StorefrontTax;
84
+ grossAmount: StorefrontMoney;
85
+ };
86
+ export type StorefrontQuote = {
87
+ quoteUuid: string;
88
+ cartUuid: string;
89
+ cartRevision: number;
90
+ issuedAt: string;
91
+ expiresAt: string;
92
+ lines: StorefrontQuoteLine[];
93
+ totals: StorefrontTotals;
94
+ };
95
+ export type StorefrontInvoiceStatus = "open" | "paid";
96
+ export type StorefrontPaymentStatus = "pending" | "settled" | "failed";
97
+ export type StorefrontCheckoutState = "creating" | "ready" | "review_required";
98
+ export type StorefrontReceiptDelivery = {
99
+ channel: string;
100
+ notificationSourceKey: string;
101
+ status: string;
102
+ };
103
+ export type StorefrontReceipt = {
104
+ receiptUuid: string;
105
+ receiptNumber: string;
106
+ invoiceUuid: string;
107
+ paymentUuid: string;
108
+ issuedAt: string;
109
+ amountReceived: StorefrontMoney;
110
+ delivery: StorefrontReceiptDelivery;
111
+ };
112
+ export type StorefrontCreditNote = {
113
+ creditNoteUuid: string;
114
+ creditNoteNumber: string;
115
+ totals: StorefrontTotals;
116
+ };
117
+ export type StorefrontPurchase = {
118
+ invoiceUuid: string;
119
+ invoiceNumber: string;
120
+ status: StorefrontInvoiceStatus;
121
+ totals: StorefrontTotals;
122
+ checkoutState?: StorefrontCheckoutState;
123
+ paymentStatus?: StorefrontPaymentStatus;
124
+ paymentUrl?: string;
125
+ receipt?: StorefrontReceipt;
126
+ creditNote?: StorefrontCreditNote;
127
+ };
128
+ /** Browse a seller's offers and check out using the current buyer identity. */
129
+ export declare class StorefrontClient {
130
+ private readonly request;
131
+ constructor(request: StorefrontRequester);
132
+ listOffers(storefront: string, options?: RequestOptions): Promise<StorefrontCatalogue>;
133
+ publishOffer(storefront: string, offer: StorefrontPublishOffer, options?: RequestOptions): Promise<StorefrontOffer>;
134
+ createCart(storefront: string, options?: RequestOptions): Promise<StorefrontCart>;
135
+ getCart(storefront: string, cartUuid: string, options?: RequestOptions): Promise<StorefrontCart>;
136
+ updateLine(storefront: string, cartUuid: string, offerUuid: string, quantity: StorefrontLineQuantity, options?: RequestOptions): Promise<StorefrontCart>;
137
+ createQuote(storefront: string, cartUuid: string, options?: RequestOptions): Promise<StorefrontQuote>;
138
+ getQuote(storefront: string, quoteUuid: string, options?: RequestOptions): Promise<StorefrontQuote>;
139
+ /** Start or resume the purchase for an accepted quote. */
140
+ checkout(storefront: string, quoteUuid: string, options?: RequestOptions): Promise<StorefrontPurchase>;
141
+ getPurchase(storefront: string, invoiceUuid: string, options?: RequestOptions): Promise<StorefrontPurchase>;
142
+ /** Resume or retry payment for the same invoice. */
143
+ startPayment(storefront: string, invoiceUuid: string, options?: RequestOptions): Promise<StorefrontPurchase>;
144
+ }
145
+ export {};
@@ -0,0 +1,83 @@
1
+ /** Browse a seller's offers and check out using the current buyer identity. */
2
+ export class StorefrontClient {
3
+ constructor(request) {
4
+ this.request = request;
5
+ }
6
+ listOffers(storefront, options) {
7
+ return this.request("GET", storefrontPath(storefront, "offers"), undefined, options);
8
+ }
9
+ publishOffer(storefront, offer, options) {
10
+ return this.request("POST", storefrontPath(storefront, "offers"), offer, options);
11
+ }
12
+ createCart(storefront, options) {
13
+ return this.request("POST", storefrontPath(storefront, "carts"), undefined, options);
14
+ }
15
+ getCart(storefront, cartUuid, options) {
16
+ return this.request("GET", storefrontPath(storefront, "carts", cartUuid), undefined, options);
17
+ }
18
+ updateLine(storefront, cartUuid, offerUuid, quantity, options) {
19
+ return this.request("PUT", storefrontPath(storefront, "carts", cartUuid, "lines", offerUuid), { quantity: quantity.quantity }, options);
20
+ }
21
+ async createQuote(storefront, cartUuid, options) {
22
+ return validateQuote(await this.request("POST", storefrontPath(storefront, "carts", cartUuid, "quotes"), undefined, options));
23
+ }
24
+ async getQuote(storefront, quoteUuid, options) {
25
+ return validateQuote(await this.request("GET", storefrontPath(storefront, "quotes", quoteUuid), undefined, options));
26
+ }
27
+ /** Start or resume the purchase for an accepted quote. */
28
+ async checkout(storefront, quoteUuid, options) {
29
+ return validatePurchase(await this.request("POST", storefrontPath(storefront, "quotes", quoteUuid, "checkout"), undefined, options));
30
+ }
31
+ async getPurchase(storefront, invoiceUuid, options) {
32
+ return validatePurchase(await this.request("GET", storefrontPath(storefront, "purchases", invoiceUuid), undefined, options));
33
+ }
34
+ /** Resume or retry payment for the same invoice. */
35
+ async startPayment(storefront, invoiceUuid, options) {
36
+ return validatePurchase(await this.request("POST", storefrontPath(storefront, "purchases", invoiceUuid, "payment"), undefined, options));
37
+ }
38
+ }
39
+ function storefrontPath(...parts) {
40
+ const segments = parts.map((part) => {
41
+ if (part === "" || part === "." || part === ".." || /[\\/]/.test(part)) {
42
+ throw new Error("custd: invalid storefront path segment");
43
+ }
44
+ return encodeURIComponent(part);
45
+ });
46
+ return `/storefronts/${segments.join("/")}`;
47
+ }
48
+ function validateMoney(value) {
49
+ if (typeof value?.currency !== "string" ||
50
+ !/^[A-Z]{3}$/.test(value.currency) ||
51
+ typeof value.amountMinor !== "string" ||
52
+ !/^(0|-?[1-9][0-9]{0,18})$/.test(value.amountMinor)) {
53
+ throw new Error("custd: invalid storefront money");
54
+ }
55
+ const amount = BigInt(value.amountMinor);
56
+ if (amount < -9223372036854775808n || amount > 9223372036854775807n) {
57
+ throw new Error("custd: storefront money overflows int64");
58
+ }
59
+ }
60
+ function validateTotals(totals) {
61
+ validateMoney(totals.netTotal);
62
+ validateMoney(totals.taxTotal);
63
+ validateMoney(totals.grossTotal);
64
+ }
65
+ function validateQuote(quote) {
66
+ validateTotals(quote.totals);
67
+ for (const line of quote.lines) {
68
+ validateMoney(line.netAmount);
69
+ validateMoney(line.tax.amount);
70
+ validateMoney(line.grossAmount);
71
+ }
72
+ return quote;
73
+ }
74
+ function validatePurchase(purchase) {
75
+ validateTotals(purchase.totals);
76
+ if (purchase.receipt) {
77
+ validateMoney(purchase.receipt.amountReceived);
78
+ }
79
+ if (purchase.creditNote) {
80
+ validateTotals(purchase.creditNote.totals);
81
+ }
82
+ return purchase;
83
+ }
package/dist/version.d.ts CHANGED
@@ -3,8 +3,8 @@
3
3
  * VERSION and scripts/bump-version.sh updates it, so a release cannot leave it
4
4
  * behind.
5
5
  */
6
- export declare const SDK_VERSION = "3.77.1";
6
+ export declare const SDK_VERSION = "3.78.1";
7
7
  /** Product named in X-Custd-Sdk, so Custd can report which callers use which release. */
8
8
  export declare const SDK_PRODUCT = "js";
9
9
  /** Value sent in the X-Custd-Sdk header. */
10
- export declare const SDK_IDENTITY = "js/3.77.1";
10
+ export declare const SDK_IDENTITY = "js/3.78.1";
package/dist/version.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * VERSION and scripts/bump-version.sh updates it, so a release cannot leave it
4
4
  * behind.
5
5
  */
6
- export const SDK_VERSION = "3.77.1";
6
+ export const SDK_VERSION = "3.78.1";
7
7
  /** Product named in X-Custd-Sdk, so Custd can report which callers use which release. */
8
8
  export const SDK_PRODUCT = "js";
9
9
  /** Value sent in the X-Custd-Sdk header. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haakco/custd-sdk",
3
- "version": "3.77.1",
3
+ "version": "3.78.1",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=24 <27"