@aimee.shop/sdk 0.16.0 → 0.18.0-dev.114
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/core/errors/checkout-refusal.d.ts +4 -0
- package/dist/core/errors/checkout-refusal.d.ts.map +1 -1
- package/dist/core/errors/checkout-refusal.js +2 -0
- package/dist/core/errors/checkout-refusal.js.map +1 -1
- package/dist/core/events/event-names.d.ts +144 -147
- package/dist/core/events/event-names.d.ts.map +1 -1
- package/dist/core/events/event-names.js +143 -146
- package/dist/core/events/event-names.js.map +1 -1
- package/dist/index.d.ts +16 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/services/core/assets.client.d.ts +2 -8
- package/dist/services/core/assets.client.d.ts.map +1 -1
- package/dist/services/core/assets.client.js.map +1 -1
- package/dist/services/core/base-resource.d.ts +7 -2
- package/dist/services/core/base-resource.d.ts.map +1 -1
- package/dist/services/core/base-resource.js +27 -20
- package/dist/services/core/base-resource.js.map +1 -1
- package/dist/services/core/cart-messages/cart-messages.client.d.ts +14 -4
- package/dist/services/core/cart-messages/cart-messages.client.d.ts.map +1 -1
- package/dist/services/core/cart-messages/cart-messages.client.js +37 -4
- package/dist/services/core/cart-messages/cart-messages.client.js.map +1 -1
- package/dist/services/core/cart-messages/index.d.ts +1 -1
- package/dist/services/core/cart-messages/index.d.ts.map +1 -1
- package/dist/services/core/cart-messages/types.d.ts +17 -0
- package/dist/services/core/cart-messages/types.d.ts.map +1 -1
- package/dist/services/core/carts.client.d.ts +25 -4
- package/dist/services/core/carts.client.d.ts.map +1 -1
- package/dist/services/core/carts.client.js +18 -0
- package/dist/services/core/carts.client.js.map +1 -1
- package/dist/services/core/categories.client.d.ts +13 -7
- package/dist/services/core/categories.client.d.ts.map +1 -1
- package/dist/services/core/categories.client.js.map +1 -1
- package/dist/services/core/checkout.client.d.ts +74 -35
- package/dist/services/core/checkout.client.d.ts.map +1 -1
- package/dist/services/core/checkout.client.js +3 -2
- package/dist/services/core/checkout.client.js.map +1 -1
- package/dist/services/core/cms/cms.client.d.ts +1 -1
- package/dist/services/core/cms/cms.client.js +1 -1
- package/dist/services/core/cms/entries.client.d.ts +4 -2
- package/dist/services/core/cms/entries.client.d.ts.map +1 -1
- package/dist/services/core/cms/entries.client.js +8 -2
- package/dist/services/core/cms/entries.client.js.map +1 -1
- package/dist/services/core/cms/types.d.ts +95 -53
- package/dist/services/core/cms/types.d.ts.map +1 -1
- package/dist/services/core/cms/types.js.map +1 -1
- package/dist/services/core/customers.client.d.ts +79 -62
- package/dist/services/core/customers.client.d.ts.map +1 -1
- package/dist/services/core/customers.client.js +27 -13
- package/dist/services/core/customers.client.js.map +1 -1
- package/dist/services/core/discounts.client.d.ts +187 -79
- package/dist/services/core/discounts.client.d.ts.map +1 -1
- package/dist/services/core/discounts.client.js +80 -43
- package/dist/services/core/discounts.client.js.map +1 -1
- package/dist/services/core/exports/types.d.ts +1 -1
- package/dist/services/core/exports/types.d.ts.map +1 -1
- package/dist/services/core/exports/types.js +1 -0
- package/dist/services/core/exports/types.js.map +1 -1
- package/dist/services/core/facets.client.d.ts +6 -4
- package/dist/services/core/facets.client.d.ts.map +1 -1
- package/dist/services/core/facets.client.js.map +1 -1
- package/dist/services/core/fulfillments.client.d.ts +51 -27
- package/dist/services/core/fulfillments.client.d.ts.map +1 -1
- package/dist/services/core/fulfillments.client.js +30 -18
- package/dist/services/core/fulfillments.client.js.map +1 -1
- package/dist/services/core/inventory/adjustments.client.d.ts +12 -2
- package/dist/services/core/inventory/adjustments.client.d.ts.map +1 -1
- package/dist/services/core/inventory/adjustments.client.js.map +1 -1
- package/dist/services/core/inventory/index.d.ts +1 -1
- package/dist/services/core/inventory/index.d.ts.map +1 -1
- package/dist/services/core/inventory/reservations.client.d.ts +3 -3
- package/dist/services/core/inventory/reservations.client.d.ts.map +1 -1
- package/dist/services/core/inventory/reservations.client.js +2 -2
- package/dist/services/core/inventory/reservations.client.js.map +1 -1
- package/dist/services/core/inventory/types.d.ts +29 -6
- package/dist/services/core/inventory/types.d.ts.map +1 -1
- package/dist/services/core/inventory/types.js +1 -0
- package/dist/services/core/inventory/types.js.map +1 -1
- package/dist/services/core/invoices.client.d.ts +1 -6
- package/dist/services/core/invoices.client.d.ts.map +1 -1
- package/dist/services/core/invoices.client.js +1 -1
- package/dist/services/core/invoices.client.js.map +1 -1
- package/dist/services/core/openai-feed.client.d.ts +34 -3
- package/dist/services/core/openai-feed.client.d.ts.map +1 -1
- package/dist/services/core/openai-feed.client.js.map +1 -1
- package/dist/services/core/option-types.client.d.ts +6 -7
- package/dist/services/core/option-types.client.d.ts.map +1 -1
- package/dist/services/core/option-types.client.js +7 -8
- package/dist/services/core/option-types.client.js.map +1 -1
- package/dist/services/core/option-values.client.d.ts +2 -1
- package/dist/services/core/option-values.client.d.ts.map +1 -1
- package/dist/services/core/option-values.client.js +2 -1
- package/dist/services/core/option-values.client.js.map +1 -1
- package/dist/services/core/order-edits.client.d.ts +5 -7
- package/dist/services/core/order-edits.client.d.ts.map +1 -1
- package/dist/services/core/order-edits.client.js +1 -1
- package/dist/services/core/order-edits.client.js.map +1 -1
- package/dist/services/core/orders.client.d.ts +120 -40
- package/dist/services/core/orders.client.d.ts.map +1 -1
- package/dist/services/core/orders.client.js +41 -10
- package/dist/services/core/orders.client.js.map +1 -1
- package/dist/services/core/pricing/currencies.client.d.ts +9 -23
- package/dist/services/core/pricing/currencies.client.d.ts.map +1 -1
- package/dist/services/core/pricing/currencies.client.js +12 -30
- package/dist/services/core/pricing/currencies.client.js.map +1 -1
- package/dist/services/core/pricing/pricing.client.d.ts +1 -1
- package/dist/services/core/pricing/pricing.client.d.ts.map +1 -1
- package/dist/services/core/pricing/pricing.client.js.map +1 -1
- package/dist/services/core/pricing/store-markets.client.d.ts +2 -5
- package/dist/services/core/pricing/store-markets.client.d.ts.map +1 -1
- package/dist/services/core/pricing/store-markets.client.js +1 -7
- package/dist/services/core/pricing/store-markets.client.js.map +1 -1
- package/dist/services/core/pricing/types.d.ts +41 -57
- package/dist/services/core/pricing/types.d.ts.map +1 -1
- package/dist/services/core/pricing/variant-prices.client.d.ts +2 -2
- package/dist/services/core/pricing/variant-prices.client.d.ts.map +1 -1
- package/dist/services/core/pricing/variant-prices.client.js +2 -6
- package/dist/services/core/pricing/variant-prices.client.js.map +1 -1
- package/dist/services/core/products.client.d.ts +71 -13
- package/dist/services/core/products.client.d.ts.map +1 -1
- package/dist/services/core/products.client.js.map +1 -1
- package/dist/services/core/returns.client.d.ts +21 -6
- package/dist/services/core/returns.client.d.ts.map +1 -1
- package/dist/services/core/returns.client.js +12 -6
- package/dist/services/core/returns.client.js.map +1 -1
- package/dist/services/core/reviews.client.d.ts +17 -15
- package/dist/services/core/reviews.client.d.ts.map +1 -1
- package/dist/services/core/reviews.client.js.map +1 -1
- package/dist/services/core/search.client.d.ts +26 -11
- package/dist/services/core/search.client.d.ts.map +1 -1
- package/dist/services/core/search.client.js.map +1 -1
- package/dist/services/core/shipping/classes.client.d.ts +2 -5
- package/dist/services/core/shipping/classes.client.d.ts.map +1 -1
- package/dist/services/core/shipping/classes.client.js +4 -0
- package/dist/services/core/shipping/classes.client.js.map +1 -1
- package/dist/services/core/shipping/labels.client.d.ts +3 -6
- package/dist/services/core/shipping/labels.client.d.ts.map +1 -1
- package/dist/services/core/shipping/labels.client.js +5 -1
- package/dist/services/core/shipping/labels.client.js.map +1 -1
- package/dist/services/core/shipping/providers.client.d.ts +2 -5
- package/dist/services/core/shipping/providers.client.d.ts.map +1 -1
- package/dist/services/core/shipping/providers.client.js +6 -2
- package/dist/services/core/shipping/providers.client.js.map +1 -1
- package/dist/services/core/shipping/rules.client.d.ts +2 -5
- package/dist/services/core/shipping/rules.client.d.ts.map +1 -1
- package/dist/services/core/shipping/rules.client.js +4 -2
- package/dist/services/core/shipping/rules.client.js.map +1 -1
- package/dist/services/core/shipping/shipping.client.d.ts +4 -4
- package/dist/services/core/shipping/shipping.client.d.ts.map +1 -1
- package/dist/services/core/shipping/shipping.client.js +7 -5
- package/dist/services/core/shipping/shipping.client.js.map +1 -1
- package/dist/services/core/shipping/store-providers.client.d.ts +5 -5
- package/dist/services/core/shipping/store-providers.client.d.ts.map +1 -1
- package/dist/services/core/shipping/store-providers.client.js +1 -1
- package/dist/services/core/shipping/store-providers.client.js.map +1 -1
- package/dist/services/core/shipping/types.d.ts +192 -65
- package/dist/services/core/shipping/types.d.ts.map +1 -1
- package/dist/services/core/shipping/zones.client.d.ts +2 -5
- package/dist/services/core/shipping/zones.client.d.ts.map +1 -1
- package/dist/services/core/shipping/zones.client.js +4 -0
- package/dist/services/core/shipping/zones.client.js.map +1 -1
- package/dist/services/core/storefront/index.d.ts +1 -1
- package/dist/services/core/storefront/index.d.ts.map +1 -1
- package/dist/services/core/storefront/index.js.map +1 -1
- package/dist/services/core/storefront/storefront-auth.client.d.ts +9 -4
- package/dist/services/core/storefront/storefront-auth.client.d.ts.map +1 -1
- package/dist/services/core/storefront/storefront-auth.client.js +7 -2
- package/dist/services/core/storefront/storefront-auth.client.js.map +1 -1
- package/dist/services/core/storefront/storefront-subscriptions.client.d.ts +3 -1
- package/dist/services/core/storefront/storefront-subscriptions.client.d.ts.map +1 -1
- package/dist/services/core/storefront/storefront-subscriptions.client.js.map +1 -1
- package/dist/services/core/storefront/storefront.client.d.ts +4 -1
- package/dist/services/core/storefront/storefront.client.d.ts.map +1 -1
- package/dist/services/core/storefront/storefront.client.js +4 -1
- package/dist/services/core/storefront/storefront.client.js.map +1 -1
- package/dist/services/core/storefront/types.d.ts +10 -0
- package/dist/services/core/storefront/types.d.ts.map +1 -1
- package/dist/services/core/stores/configuration.client.d.ts +21 -18
- package/dist/services/core/stores/configuration.client.d.ts.map +1 -1
- package/dist/services/core/stores/configuration.client.js.map +1 -1
- package/dist/services/core/stores/index.d.ts +1 -1
- package/dist/services/core/stores/index.d.ts.map +1 -1
- package/dist/services/core/stores/index.js.map +1 -1
- package/dist/services/core/stores/stores.client.d.ts +42 -14
- package/dist/services/core/stores/stores.client.d.ts.map +1 -1
- package/dist/services/core/stores/stores.client.js +9 -5
- package/dist/services/core/stores/stores.client.js.map +1 -1
- package/dist/services/core/taxes/jurisdictions.client.d.ts +4 -4
- package/dist/services/core/taxes/jurisdictions.client.d.ts.map +1 -1
- package/dist/services/core/taxes/jurisdictions.client.js +7 -4
- package/dist/services/core/taxes/jurisdictions.client.js.map +1 -1
- package/dist/services/core/taxes/providers.client.d.ts +1 -1
- package/dist/services/core/taxes/providers.client.d.ts.map +1 -1
- package/dist/services/core/taxes/providers.client.js.map +1 -1
- package/dist/services/core/taxes/store-providers.client.d.ts +5 -5
- package/dist/services/core/taxes/store-providers.client.d.ts.map +1 -1
- package/dist/services/core/taxes/store-providers.client.js +1 -1
- package/dist/services/core/taxes/store-providers.client.js.map +1 -1
- package/dist/services/core/taxes/taxes.client.d.ts +6 -3
- package/dist/services/core/taxes/taxes.client.d.ts.map +1 -1
- package/dist/services/core/taxes/taxes.client.js +5 -2
- package/dist/services/core/taxes/taxes.client.js.map +1 -1
- package/dist/services/core/taxes/types.d.ts +238 -131
- package/dist/services/core/taxes/types.d.ts.map +1 -1
- package/dist/services/core/variants.client.d.ts +72 -9
- package/dist/services/core/variants.client.d.ts.map +1 -1
- package/dist/services/core/variants.client.js.map +1 -1
- package/dist/services/core/wishlists.client.d.ts +31 -25
- package/dist/services/core/wishlists.client.d.ts.map +1 -1
- package/dist/services/core/wishlists.client.js +4 -2
- package/dist/services/core/wishlists.client.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { HttpClientTransport as HttpClient } from '../../core/http-client.js';
|
|
2
|
-
import type { AddressSnapshot } from '../../core/types/address.js';
|
|
3
2
|
import type { PaginatedResponse } from '../../core/types/pagination.js';
|
|
4
3
|
import { BaseResourceClient } from './base-resource.js';
|
|
5
4
|
export type CustomerType = 'guest' | 'individual' | 'organization';
|
|
@@ -31,7 +30,6 @@ interface CustomerMutableFields {
|
|
|
31
30
|
externalRefs?: Record<string, unknown>;
|
|
32
31
|
preferences?: Record<string, unknown>;
|
|
33
32
|
metadata?: Record<string, unknown>;
|
|
34
|
-
notes?: string;
|
|
35
33
|
tags?: string[];
|
|
36
34
|
taxExemptStatus?: CustomerTaxExemptStatus;
|
|
37
35
|
customerGroupId?: string;
|
|
@@ -41,10 +39,10 @@ interface CustomerMutableFields {
|
|
|
41
39
|
paymentTerms?: PaymentTerms;
|
|
42
40
|
accountNumber?: string;
|
|
43
41
|
}
|
|
44
|
-
export interface Customer extends CustomerMutableFields {
|
|
42
|
+
export interface Customer extends Omit<CustomerMutableFields, 'cognitoUserId'> {
|
|
45
43
|
id: string;
|
|
46
44
|
tenantId: string;
|
|
47
|
-
storeId: string;
|
|
45
|
+
storeId: string | null;
|
|
48
46
|
customerType: CustomerType;
|
|
49
47
|
status: CustomerStatus;
|
|
50
48
|
isGuest: boolean;
|
|
@@ -62,19 +60,25 @@ export interface Customer extends CustomerMutableFields {
|
|
|
62
60
|
registeredAt?: string;
|
|
63
61
|
loyaltyPoints: number;
|
|
64
62
|
purchasingLimit?: string;
|
|
65
|
-
addresses?: CustomerAddress[];
|
|
66
63
|
createdAt: string;
|
|
67
64
|
updatedAt: string;
|
|
68
65
|
}
|
|
66
|
+
/** Returned by createGuest: the customer plus the token that identifies the guest later */
|
|
67
|
+
export interface GuestCustomer extends Customer {
|
|
68
|
+
guestToken: string;
|
|
69
|
+
}
|
|
69
70
|
export type CreateCustomerDto = CustomerMutableFields & {
|
|
70
71
|
purchasingLimit?: number;
|
|
71
72
|
};
|
|
72
73
|
export type UpdateCustomerDto = CustomerMutableFields & {
|
|
73
74
|
purchasingLimit?: number;
|
|
75
|
+
/** ISO date string */
|
|
76
|
+
lastLoginAt?: string;
|
|
77
|
+
/** ISO date string */
|
|
78
|
+
registeredAt?: string;
|
|
74
79
|
};
|
|
75
80
|
export interface CustomerFilters extends Record<string, unknown> {
|
|
76
|
-
email
|
|
77
|
-
isGuest?: boolean;
|
|
81
|
+
/** Matches email, firstName, lastName */
|
|
78
82
|
search?: string;
|
|
79
83
|
customerType?: CustomerFilterType;
|
|
80
84
|
status?: CustomerStatus;
|
|
@@ -82,16 +86,31 @@ export interface CustomerFilters extends Record<string, unknown> {
|
|
|
82
86
|
export type AddressType = 'billing' | 'shipping' | 'work' | 'home' | 'other';
|
|
83
87
|
export type DefaultAddressType = 'billing' | 'shipping';
|
|
84
88
|
export type ValidationStatus = 'pending' | 'valid' | 'invalid' | 'failed';
|
|
85
|
-
export type ValidationProvider = '
|
|
86
|
-
export type GeocodingProvider = '
|
|
87
|
-
|
|
89
|
+
export type ValidationProvider = 'easypost';
|
|
90
|
+
export type GeocodingProvider = 'easypost';
|
|
91
|
+
/** Postal fields shared by customer address responses and write DTOs */
|
|
92
|
+
interface CustomerAddressFields {
|
|
93
|
+
firstName?: string;
|
|
94
|
+
lastName?: string;
|
|
95
|
+
company?: string;
|
|
96
|
+
address1: string;
|
|
97
|
+
address2?: string;
|
|
98
|
+
address3?: string;
|
|
99
|
+
city: string;
|
|
100
|
+
state?: string;
|
|
101
|
+
zip: string;
|
|
102
|
+
/** ISO-2 on responses; ISO-2, ISO-3 or English name accepted on writes */
|
|
103
|
+
country: string;
|
|
104
|
+
phone?: string;
|
|
105
|
+
instructions?: string;
|
|
106
|
+
}
|
|
107
|
+
export interface CustomerAddress extends CustomerAddressFields {
|
|
88
108
|
id: string;
|
|
89
109
|
customerId: string;
|
|
90
110
|
tenantId: string;
|
|
91
111
|
storeId: string;
|
|
92
112
|
type: AddressType;
|
|
93
113
|
label?: string;
|
|
94
|
-
address3?: string;
|
|
95
114
|
isValidated: boolean;
|
|
96
115
|
validationStatus: ValidationStatus;
|
|
97
116
|
validationMetadata?: Record<string, unknown>;
|
|
@@ -104,10 +123,9 @@ export interface CustomerAddress extends AddressSnapshot {
|
|
|
104
123
|
createdAt: string;
|
|
105
124
|
updatedAt: string;
|
|
106
125
|
}
|
|
107
|
-
export interface CreateCustomerAddressDto extends
|
|
126
|
+
export interface CreateCustomerAddressDto extends CustomerAddressFields {
|
|
108
127
|
type: AddressType;
|
|
109
128
|
label?: string;
|
|
110
|
-
address3?: string;
|
|
111
129
|
isValidated?: boolean;
|
|
112
130
|
validationStatus?: ValidationStatus;
|
|
113
131
|
validationMetadata?: Record<string, unknown>;
|
|
@@ -118,10 +136,9 @@ export interface CreateCustomerAddressDto extends AddressSnapshot {
|
|
|
118
136
|
isDefaultShipping?: boolean;
|
|
119
137
|
metadata?: Record<string, unknown>;
|
|
120
138
|
}
|
|
121
|
-
export interface UpdateCustomerAddressDto extends Partial<
|
|
139
|
+
export interface UpdateCustomerAddressDto extends Partial<CustomerAddressFields> {
|
|
122
140
|
type?: AddressType;
|
|
123
141
|
label?: string;
|
|
124
|
-
address3?: string;
|
|
125
142
|
isValidated?: boolean;
|
|
126
143
|
validationStatus?: ValidationStatus;
|
|
127
144
|
validationMetadata?: Record<string, unknown>;
|
|
@@ -133,49 +150,37 @@ export interface UpdateCustomerAddressDto extends Partial<AddressSnapshot> {
|
|
|
133
150
|
metadata?: Record<string, unknown>;
|
|
134
151
|
}
|
|
135
152
|
export interface ValidateAddressDto {
|
|
136
|
-
isValidated
|
|
153
|
+
isValidated: boolean;
|
|
137
154
|
latitude?: number;
|
|
138
155
|
longitude?: number;
|
|
139
156
|
metadata?: Record<string, unknown>;
|
|
140
157
|
}
|
|
141
|
-
export interface ValidateAddressDataDto extends Pick<
|
|
142
|
-
address2?: string;
|
|
143
|
-
address3?: string;
|
|
144
|
-
state?: string;
|
|
158
|
+
export interface ValidateAddressDataDto extends Pick<CustomerAddressFields, 'address1' | 'address2' | 'address3' | 'city' | 'state' | 'zip' | 'country'> {
|
|
145
159
|
provider?: ValidationProvider;
|
|
146
160
|
}
|
|
147
161
|
export interface AddressValidationResult {
|
|
148
162
|
isValid: boolean;
|
|
149
|
-
validationStatus:
|
|
150
|
-
standardizedAddress
|
|
151
|
-
address1
|
|
152
|
-
address2
|
|
153
|
-
address3
|
|
154
|
-
city
|
|
155
|
-
state
|
|
156
|
-
zip
|
|
157
|
-
country
|
|
163
|
+
validationStatus: 'valid' | 'invalid' | 'failed';
|
|
164
|
+
standardizedAddress: {
|
|
165
|
+
address1: string;
|
|
166
|
+
address2: string | null;
|
|
167
|
+
address3: string | null;
|
|
168
|
+
city: string;
|
|
169
|
+
state: string | null;
|
|
170
|
+
zip: string;
|
|
171
|
+
country: string;
|
|
158
172
|
};
|
|
159
|
-
geocoding
|
|
160
|
-
latitude
|
|
161
|
-
longitude
|
|
162
|
-
timezone
|
|
173
|
+
geocoding: {
|
|
174
|
+
latitude: number;
|
|
175
|
+
longitude: number;
|
|
176
|
+
timezone: string;
|
|
177
|
+
} | null;
|
|
178
|
+
validationMetadata: {
|
|
179
|
+
provider: string;
|
|
180
|
+
confidence: number;
|
|
181
|
+
timestamp: string;
|
|
182
|
+
componentsMatched: string[];
|
|
163
183
|
};
|
|
164
|
-
validationMetadata?: Record<string, unknown>;
|
|
165
|
-
}
|
|
166
|
-
export interface GeocodeAddressDto extends Pick<AddressSnapshot, 'address1' | 'city' | 'zip' | 'country'> {
|
|
167
|
-
address2?: string;
|
|
168
|
-
address3?: string;
|
|
169
|
-
state?: string;
|
|
170
|
-
provider?: GeocodingProvider;
|
|
171
|
-
}
|
|
172
|
-
export interface GeocodeResult {
|
|
173
|
-
latitude: number;
|
|
174
|
-
longitude: number;
|
|
175
|
-
timezone?: string;
|
|
176
|
-
provider?: string;
|
|
177
|
-
accuracy?: string;
|
|
178
|
-
metadata?: Record<string, unknown>;
|
|
179
184
|
}
|
|
180
185
|
export interface ValidationProvidersResult {
|
|
181
186
|
validationProviders: ProviderInfo[];
|
|
@@ -184,8 +189,8 @@ export interface ValidationProvidersResult {
|
|
|
184
189
|
export interface ProviderInfo {
|
|
185
190
|
name: string;
|
|
186
191
|
displayName: string;
|
|
187
|
-
supportedCountries
|
|
188
|
-
features
|
|
192
|
+
supportedCountries: string[];
|
|
193
|
+
features: string[];
|
|
189
194
|
isEnabled: boolean;
|
|
190
195
|
}
|
|
191
196
|
export interface ConvertGuestDto {
|
|
@@ -195,6 +200,10 @@ export interface ConvertGuestDto {
|
|
|
195
200
|
phone?: string;
|
|
196
201
|
cognitoUserId?: string;
|
|
197
202
|
}
|
|
203
|
+
export interface MergeCustomersDto {
|
|
204
|
+
sourceCustomerId: string;
|
|
205
|
+
targetCustomerId: string;
|
|
206
|
+
}
|
|
198
207
|
export declare class CustomersClient extends BaseResourceClient<Customer, CreateCustomerDto, UpdateCustomerDto, CustomerFilters> {
|
|
199
208
|
constructor(httpClient: HttpClient, baseUrl: string);
|
|
200
209
|
/**
|
|
@@ -219,23 +228,35 @@ export declare class CustomersClient extends BaseResourceClient<Customer, Create
|
|
|
219
228
|
/**
|
|
220
229
|
* Get customer by email
|
|
221
230
|
*/
|
|
222
|
-
getByEmail(email: string): Promise<Customer>;
|
|
231
|
+
getByEmail(email: string): Promise<Customer | null>;
|
|
223
232
|
/**
|
|
224
|
-
* Create a guest customer for anonymous shopping
|
|
233
|
+
* Create a guest customer for anonymous shopping.
|
|
234
|
+
* Keep the returned guestToken to look the guest up later.
|
|
225
235
|
*/
|
|
226
|
-
createGuest(): Promise<
|
|
236
|
+
createGuest(): Promise<GuestCustomer>;
|
|
227
237
|
/**
|
|
228
|
-
* Get guest customer by token
|
|
238
|
+
* Get guest customer by token, or null when the token matches no customer
|
|
229
239
|
*/
|
|
230
|
-
getByGuestToken(token: string): Promise<Customer>;
|
|
240
|
+
getByGuestToken(token: string): Promise<Customer | null>;
|
|
231
241
|
/**
|
|
232
242
|
* Convert a guest customer to a registered customer
|
|
233
243
|
*/
|
|
234
244
|
convertToRegistered(customerId: string, data: ConvertGuestDto): Promise<Customer>;
|
|
235
245
|
/**
|
|
236
|
-
*
|
|
246
|
+
* Merge a source customer into a target customer.
|
|
247
|
+
*
|
|
248
|
+
* Requires both `customers:update` and `customers:delete`. The source customer is
|
|
249
|
+
* closed by the backend; the returned customer is the updated target.
|
|
237
250
|
*/
|
|
238
|
-
|
|
251
|
+
merge(data: MergeCustomersDto): Promise<Customer>;
|
|
252
|
+
/**
|
|
253
|
+
* Get customer addresses with optional type filter.
|
|
254
|
+
* The API pages addresses with a 0-indexed page (default 0) and limit (default 50).
|
|
255
|
+
*/
|
|
256
|
+
getAddresses(customerId: string, type?: AddressType, options?: {
|
|
257
|
+
page?: number;
|
|
258
|
+
limit?: number;
|
|
259
|
+
}): Promise<CustomerAddress[]>;
|
|
239
260
|
/**
|
|
240
261
|
* Get a specific address by ID
|
|
241
262
|
*/
|
|
@@ -255,7 +276,7 @@ export declare class CustomersClient extends BaseResourceClient<Customer, Create
|
|
|
255
276
|
/**
|
|
256
277
|
* Get default billing or shipping address
|
|
257
278
|
*/
|
|
258
|
-
getDefaultAddress(customerId: string, type: DefaultAddressType): Promise<CustomerAddress>;
|
|
279
|
+
getDefaultAddress(customerId: string, type: DefaultAddressType): Promise<CustomerAddress | null>;
|
|
259
280
|
/**
|
|
260
281
|
* Get all addresses of a specific type
|
|
261
282
|
*/
|
|
@@ -272,10 +293,6 @@ export declare class CustomersClient extends BaseResourceClient<Customer, Create
|
|
|
272
293
|
* Validate address data using external services (Google Places, SmartyStreets)
|
|
273
294
|
*/
|
|
274
295
|
validateAddressData(customerId: string, data: ValidateAddressDataDto): Promise<AddressValidationResult>;
|
|
275
|
-
/**
|
|
276
|
-
* Geocode an address to get latitude, longitude, and timezone
|
|
277
|
-
*/
|
|
278
|
-
geocodeAddress(customerId: string, data: GeocodeAddressDto): Promise<GeocodeResult>;
|
|
279
296
|
/**
|
|
280
297
|
* Get available address validation and geocoding providers
|
|
281
298
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customers.client.d.ts","sourceRoot":"","sources":["../../../../../src/services/core/customers.client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,IAAI,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,KAAK,EA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 -33,19 +33,23 @@ export class CustomersClient extends BaseResourceClient {
|
|
|
33
33
|
* Get customer by email
|
|
34
34
|
*/
|
|
35
35
|
async getByEmail(email) {
|
|
36
|
-
|
|
36
|
+
// The API answers 200 with an empty body (not 404) when no customer matches
|
|
37
|
+
const customer = await this.http.get(`${this.endpoint}/email/${encodeURIComponent(email)}`);
|
|
38
|
+
return customer || null;
|
|
37
39
|
}
|
|
38
40
|
/**
|
|
39
|
-
* Create a guest customer for anonymous shopping
|
|
41
|
+
* Create a guest customer for anonymous shopping.
|
|
42
|
+
* Keep the returned guestToken to look the guest up later.
|
|
40
43
|
*/
|
|
41
44
|
async createGuest() {
|
|
42
45
|
return this.http.post(`${this.endpoint}/guest`, {});
|
|
43
46
|
}
|
|
44
47
|
/**
|
|
45
|
-
* Get guest customer by token
|
|
48
|
+
* Get guest customer by token, or null when the token matches no customer
|
|
46
49
|
*/
|
|
47
50
|
async getByGuestToken(token) {
|
|
48
|
-
|
|
51
|
+
const customer = await this.http.get(`${this.endpoint}/guest/${encodeURIComponent(token)}`);
|
|
52
|
+
return customer || null;
|
|
49
53
|
}
|
|
50
54
|
/**
|
|
51
55
|
* Convert a guest customer to a registered customer
|
|
@@ -53,14 +57,28 @@ export class CustomersClient extends BaseResourceClient {
|
|
|
53
57
|
async convertToRegistered(customerId, data) {
|
|
54
58
|
return this.http.post(`${this.endpoint}/${customerId}/convert-to-registered`, data);
|
|
55
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Merge a source customer into a target customer.
|
|
62
|
+
*
|
|
63
|
+
* Requires both `customers:update` and `customers:delete`. The source customer is
|
|
64
|
+
* closed by the backend; the returned customer is the updated target.
|
|
65
|
+
*/
|
|
66
|
+
async merge(data) {
|
|
67
|
+
return this.http.post(`${this.endpoint}/merge`, data);
|
|
68
|
+
}
|
|
56
69
|
// ==================== Address Methods ====================
|
|
57
70
|
/**
|
|
58
|
-
* Get customer addresses with optional type filter
|
|
71
|
+
* Get customer addresses with optional type filter.
|
|
72
|
+
* The API pages addresses with a 0-indexed page (default 0) and limit (default 50).
|
|
59
73
|
*/
|
|
60
|
-
async getAddresses(customerId, type) {
|
|
74
|
+
async getAddresses(customerId, type, options = {}) {
|
|
61
75
|
const params = {};
|
|
62
76
|
if (type)
|
|
63
77
|
params.type = type;
|
|
78
|
+
if (options.page !== undefined)
|
|
79
|
+
params.page = String(options.page);
|
|
80
|
+
if (options.limit !== undefined)
|
|
81
|
+
params.limit = String(options.limit);
|
|
64
82
|
return this.http.get(`${this.endpoint}/${customerId}/addresses`, { params });
|
|
65
83
|
}
|
|
66
84
|
/**
|
|
@@ -91,7 +109,9 @@ export class CustomersClient extends BaseResourceClient {
|
|
|
91
109
|
* Get default billing or shipping address
|
|
92
110
|
*/
|
|
93
111
|
async getDefaultAddress(customerId, type) {
|
|
94
|
-
|
|
112
|
+
// The API answers 200 with an empty body when no default is set
|
|
113
|
+
const address = await this.http.get(`${this.endpoint}/${customerId}/addresses/default/${type}`);
|
|
114
|
+
return address || null;
|
|
95
115
|
}
|
|
96
116
|
/**
|
|
97
117
|
* Get all addresses of a specific type
|
|
@@ -117,12 +137,6 @@ export class CustomersClient extends BaseResourceClient {
|
|
|
117
137
|
async validateAddressData(customerId, data) {
|
|
118
138
|
return this.http.post(`${this.endpoint}/${customerId}/addresses/validate`, data);
|
|
119
139
|
}
|
|
120
|
-
/**
|
|
121
|
-
* Geocode an address to get latitude, longitude, and timezone
|
|
122
|
-
*/
|
|
123
|
-
async geocodeAddress(customerId, data) {
|
|
124
|
-
return this.http.post(`${this.endpoint}/${customerId}/addresses/geocode`, data);
|
|
125
|
-
}
|
|
126
140
|
/**
|
|
127
141
|
* Get available address validation and geocoding providers
|
|
128
142
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customers.client.js","sourceRoot":"","sources":["../../../../../src/services/core/customers.client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"customers.client.js","sourceRoot":"","sources":["../../../../../src/services/core/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