@gethydra/sdk 0.1.33 → 0.1.35
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.d.ts +82 -1
- package/dist/index.js +7 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -20848,6 +20848,62 @@ type AnalyticsTimeSeries = components['schemas']['AnalyticsTimeSeries'];
|
|
|
20848
20848
|
type AnalyticsOrdersSeries = components['schemas']['AnalyticsOrdersSeries'];
|
|
20849
20849
|
type AnalyticsTopProduct = components['schemas']['AnalyticsTopProduct'];
|
|
20850
20850
|
type AnalyticsActionItems = components['schemas']['AnalyticsActionItems'];
|
|
20851
|
+
type PosDashboardMetric = {
|
|
20852
|
+
value: number;
|
|
20853
|
+
previous: number | null;
|
|
20854
|
+
change: number | null;
|
|
20855
|
+
};
|
|
20856
|
+
type PosDashboardTakings = {
|
|
20857
|
+
cash_collected: number;
|
|
20858
|
+
card_collected: number;
|
|
20859
|
+
gift_card_payments: number;
|
|
20860
|
+
store_credit_payments: number;
|
|
20861
|
+
discounts_given: number;
|
|
20862
|
+
net_collected: number;
|
|
20863
|
+
};
|
|
20864
|
+
type PosAnalyticsDashboard = {
|
|
20865
|
+
period: {
|
|
20866
|
+
from: string;
|
|
20867
|
+
to: string;
|
|
20868
|
+
};
|
|
20869
|
+
comparison_period: {
|
|
20870
|
+
from: string;
|
|
20871
|
+
to: string;
|
|
20872
|
+
} | null;
|
|
20873
|
+
currency: string;
|
|
20874
|
+
takings: PosDashboardTakings;
|
|
20875
|
+
previous_takings: PosDashboardTakings | null;
|
|
20876
|
+
summary: {
|
|
20877
|
+
gross_revenue: PosDashboardMetric;
|
|
20878
|
+
net_collected: PosDashboardMetric;
|
|
20879
|
+
order_count: PosDashboardMetric;
|
|
20880
|
+
average_order_value: PosDashboardMetric;
|
|
20881
|
+
items_sold: PosDashboardMetric;
|
|
20882
|
+
};
|
|
20883
|
+
top_products: Array<{
|
|
20884
|
+
product_id: string | null;
|
|
20885
|
+
title: string;
|
|
20886
|
+
image_src: string | null;
|
|
20887
|
+
revenue: number;
|
|
20888
|
+
quantity_sold: number;
|
|
20889
|
+
orders: number;
|
|
20890
|
+
}>;
|
|
20891
|
+
staff: Array<{
|
|
20892
|
+
staff_id: string;
|
|
20893
|
+
staff_name: string;
|
|
20894
|
+
order_count: number;
|
|
20895
|
+
total_collected: number;
|
|
20896
|
+
gross_revenue: number;
|
|
20897
|
+
}>;
|
|
20898
|
+
};
|
|
20899
|
+
type PosDashboardParams = {
|
|
20900
|
+
location_id: string;
|
|
20901
|
+
from: string;
|
|
20902
|
+
to: string;
|
|
20903
|
+
compare?: 'previous_period' | 'none';
|
|
20904
|
+
top_products_limit?: number;
|
|
20905
|
+
top_products_sort?: 'revenue' | 'quantity';
|
|
20906
|
+
};
|
|
20851
20907
|
type SummaryParams = NonNullable<operations['getAnalyticsSummary']['parameters']['query']>;
|
|
20852
20908
|
type RevenueParams = NonNullable<operations['getRevenueTimeSeries']['parameters']['query']>;
|
|
20853
20909
|
type OrdersParams = NonNullable<operations['getOrdersTimeSeries']['parameters']['query']>;
|
|
@@ -20860,6 +20916,7 @@ declare class AnalyticsResource {
|
|
|
20860
20916
|
orders(params?: OrdersParams): Promise<DataResponse<AnalyticsOrdersSeries>>;
|
|
20861
20917
|
topProducts(params?: TopProductsParams): Promise<DataResponse<AnalyticsTopProduct[]>>;
|
|
20862
20918
|
actionItems(): Promise<DataResponse<AnalyticsActionItems>>;
|
|
20919
|
+
posDashboard(params: PosDashboardParams): Promise<DataResponse<PosAnalyticsDashboard>>;
|
|
20863
20920
|
}
|
|
20864
20921
|
|
|
20865
20922
|
type CreditTransaction = NonNullable<operations['issueCustomerCredit']['responses']['201']['content']['application/json']['data']>;
|
|
@@ -21248,6 +21305,26 @@ interface CreditDebitBody {
|
|
|
21248
21305
|
amount: number;
|
|
21249
21306
|
note?: string;
|
|
21250
21307
|
}
|
|
21308
|
+
/** Response from converting a gift card to store credit. */
|
|
21309
|
+
interface GiftCardConvertResult {
|
|
21310
|
+
gift_card: GiftCard;
|
|
21311
|
+
credit_transaction: {
|
|
21312
|
+
id: string;
|
|
21313
|
+
customer_id: string;
|
|
21314
|
+
type: 'credit' | 'debit' | 'expiry';
|
|
21315
|
+
amount: number;
|
|
21316
|
+
balance_after: number;
|
|
21317
|
+
reason: string;
|
|
21318
|
+
note: string | null;
|
|
21319
|
+
related_order_id: string | null;
|
|
21320
|
+
related_refund_id: string | null;
|
|
21321
|
+
expires_at: string | null;
|
|
21322
|
+
metadata: Record<string, string | number>;
|
|
21323
|
+
created_at: string;
|
|
21324
|
+
updated_at: string;
|
|
21325
|
+
};
|
|
21326
|
+
customer_balance: number;
|
|
21327
|
+
}
|
|
21251
21328
|
declare class GiftCardsResource {
|
|
21252
21329
|
private client;
|
|
21253
21330
|
constructor(client: Hydra);
|
|
@@ -21267,6 +21344,10 @@ declare class GiftCardsResource {
|
|
|
21267
21344
|
}): Promise<GiftCardTransaction[]>;
|
|
21268
21345
|
credit(id: string, body: CreditDebitBody, options?: ResourceRequestOptions): Promise<DataResponse<GiftCard>>;
|
|
21269
21346
|
debit(id: string, body: CreditDebitBody, options?: ResourceRequestOptions): Promise<DataResponse<GiftCard>>;
|
|
21347
|
+
/** Convert a gift card's remaining balance into store credit on a customer account. */
|
|
21348
|
+
convert(id: string, body: {
|
|
21349
|
+
customer_id: string;
|
|
21350
|
+
}): Promise<DataResponse<GiftCardConvertResult>>;
|
|
21270
21351
|
/** Look up a gift card by code (publishable key OK). */
|
|
21271
21352
|
lookup(code: string): Promise<DataResponse<GiftCardLookup>>;
|
|
21272
21353
|
}
|
|
@@ -21436,4 +21517,4 @@ declare class HydraIdempotencyError extends HydraError {
|
|
|
21436
21517
|
constructor(body: HydraErrorBody, headers: Headers);
|
|
21437
21518
|
}
|
|
21438
21519
|
|
|
21439
|
-
export { AddressesResource, type AnalyticsActionItems$1 as AnalyticsActionItems, type AnalyticsOrdersSeries$1 as AnalyticsOrdersSeries, AnalyticsResource, type AnalyticsSummary$1 as AnalyticsSummary, type AnalyticsTimeSeries$1 as AnalyticsTimeSeries, type AnalyticsTopProduct$1 as AnalyticsTopProduct, type AppInfo, type Appointment$1 as Appointment, type AvailabilityOverride$1 as AvailabilityOverride, BookingsResource, type Cart$1 as Cart, type CartItem, CartResource, type Channel$1 as Channel, ChannelsResource, type CheckoutCreate$1 as CheckoutCreate, type CheckoutGet$1 as CheckoutGet, type CheckoutListItem$1 as CheckoutListItem, CheckoutResource, CheckoutsResource, type Collection$1 as Collection, CollectionsResource, CompaniesResource, type Company$1 as Company, ContentCategoriesResource, type ContentCategory$1 as ContentCategory, type CreateGiftCardBody, type Customer$1 as Customer, type CustomerGroup$1 as CustomerGroup, CustomerGroupsResource, type CustomerMembership$1 as CustomerMembership, type CustomerPhoto$1 as CustomerPhoto, CustomerPhotosResource, CustomersResource, type DataResponse, type DayAvailability$1 as DayAvailability, type Discount$1 as Discount, DiscountsResource, type DraftOrder$1 as DraftOrder, DraftOrdersResource, type ExchangeRate$1 as ExchangeRate, ExchangeRatesResource, type Fulfillment$1 as Fulfillment, type FulfillmentOrder$2 as FulfillmentOrder, FulfillmentOrdersResource, FulfillmentsResource, type GenerateVariantsResult$1 as GenerateVariantsResult, type GiftCard, type CreditDebitBody as GiftCardCreditDebitBody, type GiftCardLookup, type GiftCardTransaction, GiftCardsResource, Hydra, HydraAuthenticationError, type HydraConfig, HydraConnectionError, HydraError, type HydraErrorBody, HydraIdempotencyError, HydraNotFoundError, HydraPermissionError, HydraRateLimitError, HydraValidationError, type Image$2 as Image, ImagesResource, IntegrationsResource, type InventoryLevel$1 as InventoryLevel, InventoryResource, type ListGiftCardTransactionsParams, type ListGiftCardsParams, type ListResponse, type Location$1 as Location, LocationsResource, type Lookbook$1 as Lookbook, type LookbookTag$1 as LookbookTag, LookbooksResource, type LoyaltySummary, type MembershipPlan$1 as MembershipPlan, MembershipPlansResource, MetafieldsResource, type NotificationLog$1 as NotificationLog, NotificationsResource, type Order$2 as Order, OrdersResource, type PaginateOptions, type Pagination, type Post$1 as Post, PostsResource, type Product$1 as Product, type ProductStats$1 as ProductStats, ProductsResource, type Promotion$1 as Promotion, PromotionsResource, type PurchaseOrder$1 as PurchaseOrder, PurchaseOrdersResource, type Redirect$1 as Redirect, RedirectsResource, type Refund$1 as Refund, RefundsResource, type RequestOptions, type ResourceRequestOptions, type Return$1 as Return, ReturnsResource, SearchResource, type ShippingRate$1 as ShippingRate, ShippingResource, type ShippingZone$1 as ShippingZone, type Slot, type Store$1 as Store, StoreCreditResource, StoreResource, type SuggestedSlot$1 as SuggestedSlot, type Tag$1 as Tag, TagsResource, type TaxExemption$1 as TaxExemption, type TaxGroup$1 as TaxGroup, type TaxRate$1 as TaxRate, TaxResource, type UpdateGiftCardBody, type Variant$2 as Variant, type VariantPrice$1 as VariantPrice, VariantsResource, type Webhook$1 as Webhook, WebhooksResource, paginate, toArray };
|
|
21520
|
+
export { AddressesResource, type AnalyticsActionItems$1 as AnalyticsActionItems, type AnalyticsOrdersSeries$1 as AnalyticsOrdersSeries, AnalyticsResource, type AnalyticsSummary$1 as AnalyticsSummary, type AnalyticsTimeSeries$1 as AnalyticsTimeSeries, type AnalyticsTopProduct$1 as AnalyticsTopProduct, type AppInfo, type Appointment$1 as Appointment, type AvailabilityOverride$1 as AvailabilityOverride, BookingsResource, type Cart$1 as Cart, type CartItem, CartResource, type Channel$1 as Channel, ChannelsResource, type CheckoutCreate$1 as CheckoutCreate, type CheckoutGet$1 as CheckoutGet, type CheckoutListItem$1 as CheckoutListItem, CheckoutResource, CheckoutsResource, type Collection$1 as Collection, CollectionsResource, CompaniesResource, type Company$1 as Company, ContentCategoriesResource, type ContentCategory$1 as ContentCategory, type CreateGiftCardBody, type Customer$1 as Customer, type CustomerGroup$1 as CustomerGroup, CustomerGroupsResource, type CustomerMembership$1 as CustomerMembership, type CustomerPhoto$1 as CustomerPhoto, CustomerPhotosResource, CustomersResource, type DataResponse, type DayAvailability$1 as DayAvailability, type Discount$1 as Discount, DiscountsResource, type DraftOrder$1 as DraftOrder, DraftOrdersResource, type ExchangeRate$1 as ExchangeRate, ExchangeRatesResource, type Fulfillment$1 as Fulfillment, type FulfillmentOrder$2 as FulfillmentOrder, FulfillmentOrdersResource, FulfillmentsResource, type GenerateVariantsResult$1 as GenerateVariantsResult, type GiftCard, type GiftCardConvertResult, type CreditDebitBody as GiftCardCreditDebitBody, type GiftCardLookup, type GiftCardTransaction, GiftCardsResource, Hydra, HydraAuthenticationError, type HydraConfig, HydraConnectionError, HydraError, type HydraErrorBody, HydraIdempotencyError, HydraNotFoundError, HydraPermissionError, HydraRateLimitError, HydraValidationError, type Image$2 as Image, ImagesResource, IntegrationsResource, type InventoryLevel$1 as InventoryLevel, InventoryResource, type ListGiftCardTransactionsParams, type ListGiftCardsParams, type ListResponse, type Location$1 as Location, LocationsResource, type Lookbook$1 as Lookbook, type LookbookTag$1 as LookbookTag, LookbooksResource, type LoyaltySummary, type MembershipPlan$1 as MembershipPlan, MembershipPlansResource, MetafieldsResource, type NotificationLog$1 as NotificationLog, NotificationsResource, type Order$2 as Order, OrdersResource, type PaginateOptions, type Pagination, type PosAnalyticsDashboard, type Post$1 as Post, PostsResource, type Product$1 as Product, type ProductStats$1 as ProductStats, ProductsResource, type Promotion$1 as Promotion, PromotionsResource, type PurchaseOrder$1 as PurchaseOrder, PurchaseOrdersResource, type Redirect$1 as Redirect, RedirectsResource, type Refund$1 as Refund, RefundsResource, type RequestOptions, type ResourceRequestOptions, type Return$1 as Return, ReturnsResource, SearchResource, type ShippingRate$1 as ShippingRate, ShippingResource, type ShippingZone$1 as ShippingZone, type Slot, type Store$1 as Store, StoreCreditResource, StoreResource, type SuggestedSlot$1 as SuggestedSlot, type Tag$1 as Tag, TagsResource, type TaxExemption$1 as TaxExemption, type TaxGroup$1 as TaxGroup, type TaxRate$1 as TaxRate, TaxResource, type UpdateGiftCardBody, type Variant$2 as Variant, type VariantPrice$1 as VariantPrice, VariantsResource, type Webhook$1 as Webhook, WebhooksResource, paginate, toArray };
|
package/dist/index.js
CHANGED
|
@@ -1370,6 +1370,9 @@ var AnalyticsResource = class {
|
|
|
1370
1370
|
async actionItems() {
|
|
1371
1371
|
return this.client.request("GET", "/v1/analytics/action-items");
|
|
1372
1372
|
}
|
|
1373
|
+
async posDashboard(params) {
|
|
1374
|
+
return this.client.request("GET", "/v1/pos/analytics/dashboard", { params });
|
|
1375
|
+
}
|
|
1373
1376
|
};
|
|
1374
1377
|
|
|
1375
1378
|
// src/resources/store-credit.ts
|
|
@@ -1794,6 +1797,10 @@ var GiftCardsResource = class {
|
|
|
1794
1797
|
async debit(id, body, options) {
|
|
1795
1798
|
return this.client.request("POST", `/v1/gift-cards/${id}/debit`, { body, ...options });
|
|
1796
1799
|
}
|
|
1800
|
+
/** Convert a gift card's remaining balance into store credit on a customer account. */
|
|
1801
|
+
async convert(id, body) {
|
|
1802
|
+
return this.client.request("POST", `/v1/gift-cards/${id}/convert`, { body });
|
|
1803
|
+
}
|
|
1797
1804
|
/** Look up a gift card by code (publishable key OK). */
|
|
1798
1805
|
async lookup(code) {
|
|
1799
1806
|
return this.client.request("GET", "/v1/gift-cards/lookup", { params: { code } });
|