doboxa-js 1.0.3 → 1.1.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/README.md +56 -1
- package/dist/{chunk-CGJD4ZO5.mjs → chunk-7RN7PBJH.mjs} +11 -1
- package/dist/chunk-7RN7PBJH.mjs.map +1 -0
- package/dist/{chunk-WGEOQ35B.mjs → chunk-RTI5YLAB.mjs} +121 -22
- package/dist/chunk-RTI5YLAB.mjs.map +1 -0
- package/dist/{client-BfIS6ja2.d.mts → client-BrWpdgrN.d.mts} +278 -13
- package/dist/{client-BfIS6ja2.d.ts → client-BrWpdgrN.d.ts} +278 -13
- package/dist/client.d.mts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +125 -6
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +2 -2
- package/dist/{errors-CtijMwu-.d.mts → errors-lG5MwUyw.d.mts} +16 -1
- package/dist/{errors-CtijMwu-.d.ts → errors-lG5MwUyw.d.ts} +16 -1
- package/dist/errors.d.mts +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +11 -0
- package/dist/errors.js.map +1 -1
- package/dist/errors.mjs +3 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +130 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-CGJD4ZO5.mjs.map +0 -1
- package/dist/chunk-WGEOQ35B.mjs.map +0 -1
|
@@ -75,15 +75,6 @@ declare class HTTPClient {
|
|
|
75
75
|
patch<T>(path: string, body?: unknown, options?: RequestInit): Promise<T>;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
/**
|
|
79
|
-
* Boolean type alias
|
|
80
|
-
*/
|
|
81
|
-
type Bool = boolean;
|
|
82
|
-
declare function BoolFromJSON(json: any): Bool;
|
|
83
|
-
declare function BoolFromJSONTyped(json: any, ignoreDiscriminator: boolean): Bool;
|
|
84
|
-
declare function BoolToJSON(value?: Bool | null): any;
|
|
85
|
-
declare function BoolToJSONTyped(value?: Bool | null, ignoreDiscriminator?: boolean): any;
|
|
86
|
-
|
|
87
78
|
/**
|
|
88
79
|
* API V2
|
|
89
80
|
* API V2
|
|
@@ -1593,7 +1584,6 @@ declare function OrderToJSONTyped(value?: Omit<Order, 'billing_address' | 'order
|
|
|
1593
1584
|
* https://openapi-generator.tech
|
|
1594
1585
|
* Do not edit the class manually.
|
|
1595
1586
|
*/
|
|
1596
|
-
|
|
1597
1587
|
/**
|
|
1598
1588
|
*
|
|
1599
1589
|
* @export
|
|
@@ -1602,10 +1592,10 @@ declare function OrderToJSONTyped(value?: Omit<Order, 'billing_address' | 'order
|
|
|
1602
1592
|
interface OrderCancellationResponse {
|
|
1603
1593
|
/**
|
|
1604
1594
|
* Cancellation result
|
|
1605
|
-
* @type {
|
|
1595
|
+
* @type {boolean}
|
|
1606
1596
|
* @memberof OrderCancellationResponse
|
|
1607
1597
|
*/
|
|
1608
|
-
cancelled?:
|
|
1598
|
+
cancelled?: boolean;
|
|
1609
1599
|
/**
|
|
1610
1600
|
* Additional details regarding the cancellation process
|
|
1611
1601
|
* @type {string}
|
|
@@ -2727,6 +2717,270 @@ declare class UsersResource {
|
|
|
2727
2717
|
me(): Promise<Me>;
|
|
2728
2718
|
}
|
|
2729
2719
|
|
|
2720
|
+
/**
|
|
2721
|
+
* Actions supported by Doboxa's BaseLinker connector.
|
|
2722
|
+
*/
|
|
2723
|
+
type BaseLinkerAction = 'FileVersion' | 'SupportedMethods' | 'ProductsCategories' | 'ProductsList' | 'ProductsData';
|
|
2724
|
+
/**
|
|
2725
|
+
* Credentials of Doboxa's BaseLinker connector (shop integration file).
|
|
2726
|
+
*/
|
|
2727
|
+
interface BaseLinkerConnectorConfig {
|
|
2728
|
+
/**
|
|
2729
|
+
* Connector URL, e.g. https://pl.doboxa.biz/api/base-linker/{clientToken}/{language}
|
|
2730
|
+
*/
|
|
2731
|
+
url: string;
|
|
2732
|
+
/**
|
|
2733
|
+
* "Hasło" of the integration in the Doboxa client panel
|
|
2734
|
+
*/
|
|
2735
|
+
password: string;
|
|
2736
|
+
}
|
|
2737
|
+
/**
|
|
2738
|
+
* Parameters of a `ProductsList` call.
|
|
2739
|
+
*/
|
|
2740
|
+
interface ProductsListParams {
|
|
2741
|
+
/**
|
|
2742
|
+
* 1-based; past the end returns only `pages`
|
|
2743
|
+
*/
|
|
2744
|
+
page?: number;
|
|
2745
|
+
/**
|
|
2746
|
+
* Filter the list by a single category id
|
|
2747
|
+
*/
|
|
2748
|
+
category_id?: string;
|
|
2749
|
+
}
|
|
2750
|
+
/**
|
|
2751
|
+
* Parameters of a `ProductsData` call.
|
|
2752
|
+
*/
|
|
2753
|
+
interface ProductsDataParams {
|
|
2754
|
+
/**
|
|
2755
|
+
* Design (parent) ids from ProductsList
|
|
2756
|
+
*/
|
|
2757
|
+
products_id: string[];
|
|
2758
|
+
}
|
|
2759
|
+
/**
|
|
2760
|
+
* Error body returned by the connector with HTTP 200.
|
|
2761
|
+
*/
|
|
2762
|
+
interface BaseLinkerError {
|
|
2763
|
+
error: true;
|
|
2764
|
+
error_code: 'no_password' | 'bad_password' | 'unsupported_method' | (string & {});
|
|
2765
|
+
error_text: string;
|
|
2766
|
+
}
|
|
2767
|
+
/**
|
|
2768
|
+
* Connector platform and version.
|
|
2769
|
+
*/
|
|
2770
|
+
interface FileVersionResponse {
|
|
2771
|
+
/**
|
|
2772
|
+
* e.g. "Magento"
|
|
2773
|
+
*/
|
|
2774
|
+
platform: string;
|
|
2775
|
+
/**
|
|
2776
|
+
* e.g. "4.1.91"
|
|
2777
|
+
*/
|
|
2778
|
+
version: string;
|
|
2779
|
+
/**
|
|
2780
|
+
* e.g. 4
|
|
2781
|
+
*/
|
|
2782
|
+
standard: number;
|
|
2783
|
+
}
|
|
2784
|
+
/**
|
|
2785
|
+
* List of actions the connector supports.
|
|
2786
|
+
*/
|
|
2787
|
+
type SupportedMethodsResponse = BaseLinkerAction[];
|
|
2788
|
+
/**
|
|
2789
|
+
* Category id -> "Fototapety / Tematyka / Abstrakcja"
|
|
2790
|
+
*/
|
|
2791
|
+
type ProductsCategoriesResponse = Record<string, string>;
|
|
2792
|
+
/**
|
|
2793
|
+
* First variant of a design, as shown in the list.
|
|
2794
|
+
*/
|
|
2795
|
+
interface ProductsListItem {
|
|
2796
|
+
/**
|
|
2797
|
+
* e.g. "Fototapeta Wikingowie I Smoki Flizelina 90x60"
|
|
2798
|
+
*/
|
|
2799
|
+
name: string;
|
|
2800
|
+
/**
|
|
2801
|
+
* e.g. 999
|
|
2802
|
+
*/
|
|
2803
|
+
quantity: number;
|
|
2804
|
+
/**
|
|
2805
|
+
* e.g. "20.244" - PLN, probably net
|
|
2806
|
+
*/
|
|
2807
|
+
price: string;
|
|
2808
|
+
/**
|
|
2809
|
+
* e.g. "FT-2385-VE90-60"
|
|
2810
|
+
*/
|
|
2811
|
+
sku: string;
|
|
2812
|
+
/**
|
|
2813
|
+
* e.g. "5905451113260"
|
|
2814
|
+
*/
|
|
2815
|
+
ean: string;
|
|
2816
|
+
}
|
|
2817
|
+
/**
|
|
2818
|
+
* A single product of a list page, with its design id.
|
|
2819
|
+
*/
|
|
2820
|
+
interface ProductsListEntry extends ProductsListItem {
|
|
2821
|
+
/**
|
|
2822
|
+
* Design (parent) product id
|
|
2823
|
+
*/
|
|
2824
|
+
id: string;
|
|
2825
|
+
}
|
|
2826
|
+
/**
|
|
2827
|
+
* A page of the product list.
|
|
2828
|
+
*/
|
|
2829
|
+
interface ProductsListResult {
|
|
2830
|
+
/**
|
|
2831
|
+
* Total number of pages
|
|
2832
|
+
*/
|
|
2833
|
+
pages: number;
|
|
2834
|
+
/**
|
|
2835
|
+
* Products of the requested page
|
|
2836
|
+
*/
|
|
2837
|
+
items: ProductsListEntry[];
|
|
2838
|
+
}
|
|
2839
|
+
/**
|
|
2840
|
+
* Raw `ProductsList` response; keys are product ids and `pages` is the total page count.
|
|
2841
|
+
*/
|
|
2842
|
+
type ProductsListResponse = {
|
|
2843
|
+
pages: number;
|
|
2844
|
+
} & {
|
|
2845
|
+
[productId: string]: ProductsListItem | number;
|
|
2846
|
+
};
|
|
2847
|
+
/**
|
|
2848
|
+
* [name, value] pair.
|
|
2849
|
+
*/
|
|
2850
|
+
type ProductFeature = [name: ProductFeatureName | (string & {}), value: string | null];
|
|
2851
|
+
/**
|
|
2852
|
+
* Known feature names returned by the connector.
|
|
2853
|
+
*/
|
|
2854
|
+
type ProductFeatureName = 'product_type' | 'material' | 'dimensions' | 'dimensions_width' | 'dimensions_height' | 'size_code' | 'area_m2' | 'number_of_elements' | 'break_width' | 'break_height' | 'weight_gross' | 'weight_nett' | 'grammage' | 'lamination' | 'printing_technique' | 'structure' | 'length' | 'category_name';
|
|
2855
|
+
/**
|
|
2856
|
+
* A single variant (size x material) of a design.
|
|
2857
|
+
*/
|
|
2858
|
+
interface ProductVariant {
|
|
2859
|
+
/**
|
|
2860
|
+
* Design name without size/material
|
|
2861
|
+
*/
|
|
2862
|
+
full_name: string;
|
|
2863
|
+
/**
|
|
2864
|
+
* e.g. "… Flizelina 90x60"
|
|
2865
|
+
*/
|
|
2866
|
+
name: string;
|
|
2867
|
+
/**
|
|
2868
|
+
* HTML/plain text
|
|
2869
|
+
*/
|
|
2870
|
+
description: string;
|
|
2871
|
+
/**
|
|
2872
|
+
* Size code: "VE90-60", "VEM", "V4", "brak", …
|
|
2873
|
+
*/
|
|
2874
|
+
rozmiar: string;
|
|
2875
|
+
quantity: number;
|
|
2876
|
+
/**
|
|
2877
|
+
* e.g. "20.244"
|
|
2878
|
+
*/
|
|
2879
|
+
price: string;
|
|
2880
|
+
ean: string;
|
|
2881
|
+
/**
|
|
2882
|
+
* e.g. "FT-2385-VE90-60"
|
|
2883
|
+
*/
|
|
2884
|
+
sku: string;
|
|
2885
|
+
features: ProductFeature[];
|
|
2886
|
+
/**
|
|
2887
|
+
* [0] main image, [1] size render, then mask and room shots
|
|
2888
|
+
*/
|
|
2889
|
+
images: string[];
|
|
2890
|
+
category_id: string;
|
|
2891
|
+
/**
|
|
2892
|
+
* e.g. "Fototapety/Tematyka/Dziecięce/Dla chłopca"
|
|
2893
|
+
*/
|
|
2894
|
+
category_name: string;
|
|
2895
|
+
}
|
|
2896
|
+
/**
|
|
2897
|
+
* Parent (design) of a product. Its sku/ean/description are empty and its price
|
|
2898
|
+
* is "0.00" - use the variants for the real values.
|
|
2899
|
+
*/
|
|
2900
|
+
interface ProductData {
|
|
2901
|
+
sku: string;
|
|
2902
|
+
ean: string;
|
|
2903
|
+
/**
|
|
2904
|
+
* e.g. "0.00"
|
|
2905
|
+
*/
|
|
2906
|
+
price: string;
|
|
2907
|
+
/**
|
|
2908
|
+
* e.g. "1.14"
|
|
2909
|
+
*/
|
|
2910
|
+
weight: string;
|
|
2911
|
+
description: string;
|
|
2912
|
+
/**
|
|
2913
|
+
* Category path
|
|
2914
|
+
*/
|
|
2915
|
+
description_extra1: string;
|
|
2916
|
+
/**
|
|
2917
|
+
* e.g. "Fototapeta Wikingowie I Smoki"
|
|
2918
|
+
*/
|
|
2919
|
+
name: string;
|
|
2920
|
+
quantity: number;
|
|
2921
|
+
/**
|
|
2922
|
+
* e.g. "Doboxa"
|
|
2923
|
+
*/
|
|
2924
|
+
man_name: string;
|
|
2925
|
+
features: ProductFeature[];
|
|
2926
|
+
images: string[];
|
|
2927
|
+
category_id: string;
|
|
2928
|
+
category_name: string;
|
|
2929
|
+
/**
|
|
2930
|
+
* Variant product id -> variant
|
|
2931
|
+
*/
|
|
2932
|
+
variants: Record<string, ProductVariant>;
|
|
2933
|
+
}
|
|
2934
|
+
/**
|
|
2935
|
+
* Raw `ProductsData` response; keys are design ids.
|
|
2936
|
+
*/
|
|
2937
|
+
type ProductsDataResponse = Record<string, ProductData> | [];
|
|
2938
|
+
|
|
2939
|
+
/**
|
|
2940
|
+
* Product catalog resource.
|
|
2941
|
+
*
|
|
2942
|
+
* Wraps Doboxa's BaseLinker connector (shop integration file). The connector is
|
|
2943
|
+
* a separate API: it lives on its own URL, takes a form body and reports errors
|
|
2944
|
+
* with HTTP 200, so it is called directly instead of through the generated
|
|
2945
|
+
* API v2 client.
|
|
2946
|
+
*/
|
|
2947
|
+
declare class CatalogResource {
|
|
2948
|
+
private config;
|
|
2949
|
+
constructor(config: BaseLinkerConnectorConfig);
|
|
2950
|
+
/**
|
|
2951
|
+
* Call a connector action.
|
|
2952
|
+
*
|
|
2953
|
+
* @param action - Connector action, e.g. "ProductsList"
|
|
2954
|
+
* @param params - Additional action parameters
|
|
2955
|
+
* @throws DoboxaConnectorError on HTTP or connector errors
|
|
2956
|
+
*/
|
|
2957
|
+
private call;
|
|
2958
|
+
/**
|
|
2959
|
+
* Get the connector platform and version.
|
|
2960
|
+
*/
|
|
2961
|
+
fileVersion(): Promise<FileVersionResponse>;
|
|
2962
|
+
/**
|
|
2963
|
+
* Get the list of actions the connector supports.
|
|
2964
|
+
*/
|
|
2965
|
+
supportedMethods(): Promise<SupportedMethodsResponse>;
|
|
2966
|
+
/**
|
|
2967
|
+
* Get all product categories as a map of category id to category path.
|
|
2968
|
+
*/
|
|
2969
|
+
categories(): Promise<ProductsCategoriesResponse>;
|
|
2970
|
+
/**
|
|
2971
|
+
* List one page of products (designs).
|
|
2972
|
+
*
|
|
2973
|
+
* @param params - Page number and optional category filter
|
|
2974
|
+
*/
|
|
2975
|
+
list(params?: ProductsListParams): Promise<ProductsListResult>;
|
|
2976
|
+
/**
|
|
2977
|
+
* Get full product data (images, variants) for the given design ids.
|
|
2978
|
+
*
|
|
2979
|
+
* @param params - Design ids from the product list
|
|
2980
|
+
*/
|
|
2981
|
+
data(params: ProductsDataParams): Promise<Record<string, ProductData>>;
|
|
2982
|
+
}
|
|
2983
|
+
|
|
2730
2984
|
interface DoboxaConfig {
|
|
2731
2985
|
/**
|
|
2732
2986
|
* API key (access token). If not provided, you must call authentication.login() first.
|
|
@@ -2736,6 +2990,13 @@ interface DoboxaConfig {
|
|
|
2736
2990
|
* Base URL for the API. Defaults to DOBOXA_API_URL environment variable or http://localhost
|
|
2737
2991
|
*/
|
|
2738
2992
|
baseURL?: string;
|
|
2993
|
+
/**
|
|
2994
|
+
* Product catalog credentials (Doboxa's BaseLinker connector).
|
|
2995
|
+
* The connector URL and the "Hasło" are shown in the Doboxa panel:
|
|
2996
|
+
* Integracje -> Edycja. When set, `doboxa.catalog` is available.
|
|
2997
|
+
* The catalog does not use the API key, only the connector password.
|
|
2998
|
+
*/
|
|
2999
|
+
catalog?: BaseLinkerConnectorConfig;
|
|
2739
3000
|
}
|
|
2740
3001
|
/**
|
|
2741
3002
|
* Main Doboxa client class
|
|
@@ -2750,10 +3011,14 @@ declare class Doboxa {
|
|
|
2750
3011
|
readonly orderComments: OrderCommentsResource;
|
|
2751
3012
|
readonly orderStatusChanges: OrderStatusChangesResource;
|
|
2752
3013
|
readonly users: UsersResource;
|
|
3014
|
+
/**
|
|
3015
|
+
* Product catalog (BaseLinker connector). Available only when `catalog` config is provided.
|
|
3016
|
+
*/
|
|
3017
|
+
readonly catalog?: CatalogResource;
|
|
2753
3018
|
private tokenManager;
|
|
2754
3019
|
private httpClient;
|
|
2755
3020
|
private config;
|
|
2756
3021
|
constructor(config?: DoboxaConfig);
|
|
2757
3022
|
}
|
|
2758
3023
|
|
|
2759
|
-
export {
|
|
3024
|
+
export { ClientToJSONTyped as $, AuthenticationResource as A, ApiV2AuthenticationTokenPost200ResponseToJSONTyped as B, ClientsResource as C, Doboxa as D, type Attachment as E, instanceOfAttachment as F, AttachmentFromJSON as G, AttachmentFromJSONTyped as H, InvoicesResource as I, AttachmentToJSON as J, AttachmentToJSONTyped as K, type LoginParams as L, type BillingAddress as M, instanceOfBillingAddress as N, OrdersResource as O, BillingAddressFromJSON as P, BillingAddressFromJSONTyped as Q, type RefreshTokenParams as R, BillingAddressToJSON as S, TrackingNumbersResource as T, UsersResource as U, BillingAddressToJSONTyped as V, type Client as W, instanceOfClient as X, ClientFromJSON as Y, ClientFromJSONTyped as Z, ClientToJSON as _, type DoboxaConfig as a, type OrderCancellationResponse as a$, type CreateOrderComment as a0, CreateOrderCommentAuthorTypeEnum as a1, instanceOfCreateOrderComment as a2, CreateOrderCommentFromJSON as a3, CreateOrderCommentFromJSONTyped as a4, CreateOrderCommentToJSON as a5, CreateOrderCommentToJSONTyped as a6, type DeliveryAddress as a7, instanceOfDeliveryAddress as a8, DeliveryAddressFromJSON as a9, InvoiceItemToJSON as aA, InvoiceItemToJSONTyped as aB, type InvoiceOrder as aC, instanceOfInvoiceOrder as aD, InvoiceOrderFromJSON as aE, InvoiceOrderFromJSONTyped as aF, InvoiceOrderToJSON as aG, InvoiceOrderToJSONTyped as aH, type InvoiceOrderItem as aI, instanceOfInvoiceOrderItem as aJ, InvoiceOrderItemFromJSON as aK, InvoiceOrderItemFromJSONTyped as aL, InvoiceOrderItemToJSON as aM, InvoiceOrderItemToJSONTyped as aN, type Me as aO, instanceOfMe as aP, MeFromJSON as aQ, MeFromJSONTyped as aR, MeToJSON as aS, MeToJSONTyped as aT, type Order as aU, OrderPaymentMethodEnum as aV, instanceOfOrder as aW, OrderFromJSON as aX, OrderFromJSONTyped as aY, OrderToJSON as aZ, OrderToJSONTyped as a_, DeliveryAddressFromJSONTyped as aa, DeliveryAddressToJSON as ab, DeliveryAddressToJSONTyped as ac, type GetApiV2DiscountCodesExternal200Response as ad, instanceOfGetApiV2DiscountCodesExternal200Response as ae, GetApiV2DiscountCodesExternal200ResponseFromJSON as af, GetApiV2DiscountCodesExternal200ResponseFromJSONTyped as ag, GetApiV2DiscountCodesExternal200ResponseToJSON as ah, GetApiV2DiscountCodesExternal200ResponseToJSONTyped as ai, type GetApiV2DiscountCodesExternal200ResponseItemsInner as aj, instanceOfGetApiV2DiscountCodesExternal200ResponseItemsInner as ak, GetApiV2DiscountCodesExternal200ResponseItemsInnerFromJSON as al, GetApiV2DiscountCodesExternal200ResponseItemsInnerFromJSONTyped as am, GetApiV2DiscountCodesExternal200ResponseItemsInnerToJSON as an, GetApiV2DiscountCodesExternal200ResponseItemsInnerToJSONTyped as ao, type Invoice as ap, InvoiceDocumentTypeEnum as aq, instanceOfInvoice as ar, InvoiceFromJSON as as, InvoiceFromJSONTyped as at, InvoiceToJSON as au, InvoiceToJSONTyped as av, type InvoiceItem as aw, instanceOfInvoiceItem as ax, InvoiceItemFromJSON as ay, InvoiceItemFromJSONTyped as az, DiscountCodesResource as b, PageOfClientsFromJSONTyped as b$, OrderCancellationResponseDetailsEnum as b0, instanceOfOrderCancellationResponse as b1, OrderCancellationResponseFromJSON as b2, OrderCancellationResponseFromJSONTyped as b3, OrderCancellationResponseToJSON as b4, OrderCancellationResponseToJSONTyped as b5, type OrderComment as b6, OrderCommentAuthorTypeEnum as b7, instanceOfOrderComment as b8, OrderCommentFromJSON as b9, OrderItemStatusFromJSON as bA, OrderItemStatusFromJSONTyped as bB, OrderItemStatusToJSON as bC, OrderItemStatusToJSONTyped as bD, type OrderOriginalData as bE, instanceOfOrderOriginalData as bF, OrderOriginalDataFromJSON as bG, OrderOriginalDataFromJSONTyped as bH, OrderOriginalDataToJSON as bI, OrderOriginalDataToJSONTyped as bJ, type OrderStatus as bK, OrderStatusStatusEnum as bL, instanceOfOrderStatus as bM, OrderStatusFromJSON as bN, OrderStatusFromJSONTyped as bO, OrderStatusToJSON as bP, OrderStatusToJSONTyped as bQ, type OrderStatusChange as bR, OrderStatusChangeStatusEnum as bS, instanceOfOrderStatusChange as bT, OrderStatusChangeFromJSON as bU, OrderStatusChangeFromJSONTyped as bV, OrderStatusChangeToJSON as bW, OrderStatusChangeToJSONTyped as bX, type PageOfClients as bY, instanceOfPageOfClients as bZ, PageOfClientsFromJSON as b_, OrderCommentFromJSONTyped as ba, OrderCommentToJSON as bb, OrderCommentToJSONTyped as bc, type OrderItem as bd, instanceOfOrderItem as be, OrderItemFromJSON as bf, OrderItemFromJSONTyped as bg, OrderItemToJSON as bh, OrderItemToJSONTyped as bi, type OrderItemCropData as bj, OrderItemCropDataFilterEnum as bk, OrderItemCropDataReflectionEnum as bl, instanceOfOrderItemCropData as bm, OrderItemCropDataFromJSON as bn, OrderItemCropDataFromJSONTyped as bo, OrderItemCropDataToJSON as bp, OrderItemCropDataToJSONTyped as bq, type OrderItemOriginalData as br, instanceOfOrderItemOriginalData as bs, OrderItemOriginalDataFromJSON as bt, OrderItemOriginalDataFromJSONTyped as bu, OrderItemOriginalDataToJSON as bv, OrderItemOriginalDataToJSONTyped as bw, type OrderItemStatus as bx, OrderItemStatusStatusEnum as by, instanceOfOrderItemStatus as bz, OrderCommentsResource as c, ReturnLabelToJSONTyped as c$, PageOfClientsToJSON as c0, PageOfClientsToJSONTyped as c1, type PageOfInvoices as c2, instanceOfPageOfInvoices as c3, PageOfInvoicesFromJSON as c4, PageOfInvoicesFromJSONTyped as c5, PageOfInvoicesToJSON as c6, PageOfInvoicesToJSONTyped as c7, type PageOfOrderComments as c8, instanceOfPageOfOrderComments as c9, PostOrderResponseToJSON as cA, PostOrderResponseToJSONTyped as cB, type PostOrderStatus as cC, PostOrderStatusStatusEnum as cD, instanceOfPostOrderStatus as cE, PostOrderStatusFromJSON as cF, PostOrderStatusFromJSONTyped as cG, PostOrderStatusToJSON as cH, PostOrderStatusToJSONTyped as cI, type PostOrderStatusItem as cJ, PostOrderStatusItemStatusEnum as cK, instanceOfPostOrderStatusItem as cL, PostOrderStatusItemFromJSON as cM, PostOrderStatusItemFromJSONTyped as cN, PostOrderStatusItemToJSON as cO, PostOrderStatusItemToJSONTyped as cP, type PostOrderStatusResponse as cQ, instanceOfPostOrderStatusResponse as cR, PostOrderStatusResponseFromJSON as cS, PostOrderStatusResponseFromJSONTyped as cT, PostOrderStatusResponseToJSON as cU, PostOrderStatusResponseToJSONTyped as cV, type ReturnLabel as cW, instanceOfReturnLabel as cX, ReturnLabelFromJSON as cY, ReturnLabelFromJSONTyped as cZ, ReturnLabelToJSON as c_, PageOfOrderCommentsFromJSON as ca, PageOfOrderCommentsFromJSONTyped as cb, PageOfOrderCommentsToJSON as cc, PageOfOrderCommentsToJSONTyped as cd, type PageOfOrderStatusChanges as ce, instanceOfPageOfOrderStatusChanges as cf, PageOfOrderStatusChangesFromJSON as cg, PageOfOrderStatusChangesFromJSONTyped as ch, PageOfOrderStatusChangesToJSON as ci, PageOfOrderStatusChangesToJSONTyped as cj, type PageOfTrackingNumbers as ck, instanceOfPageOfTrackingNumbers as cl, PageOfTrackingNumbersFromJSON as cm, PageOfTrackingNumbersFromJSONTyped as cn, PageOfTrackingNumbersToJSON as co, PageOfTrackingNumbersToJSONTyped as cp, type PostOrderCommentResponse as cq, instanceOfPostOrderCommentResponse as cr, PostOrderCommentResponseFromJSON as cs, PostOrderCommentResponseFromJSONTyped as ct, PostOrderCommentResponseToJSON as cu, PostOrderCommentResponseToJSONTyped as cv, type PostOrderResponse as cw, instanceOfPostOrderResponse as cx, PostOrderResponseFromJSON as cy, PostOrderResponseFromJSONTyped as cz, OrderStatusChangesResource as d, type TrackingNumber as d0, instanceOfTrackingNumber as d1, TrackingNumberFromJSON as d2, TrackingNumberFromJSONTyped as d3, TrackingNumberToJSON as d4, TrackingNumberToJSONTyped as d5, type TrackingNumberItem as d6, instanceOfTrackingNumberItem as d7, TrackingNumberItemFromJSON as d8, TrackingNumberItemFromJSONTyped as d9, type ProductsDataResponse as dA, TrackingNumberItemToJSON as da, TrackingNumberItemToJSONTyped as db, type Waybill as dc, WaybillDeliveryMethodEnum as dd, instanceOfWaybill as de, WaybillFromJSON as df, WaybillFromJSONTyped as dg, WaybillToJSON as dh, WaybillToJSONTyped as di, type BaseLinkerAction as dj, type BaseLinkerConnectorConfig as dk, type ProductsListParams as dl, type ProductsDataParams as dm, type BaseLinkerError as dn, type FileVersionResponse as dp, type SupportedMethodsResponse as dq, type ProductsCategoriesResponse as dr, type ProductsListItem as ds, type ProductsListEntry as dt, type ProductsListResult as du, type ProductsListResponse as dv, type ProductFeature as dw, type ProductFeatureName as dx, type ProductVariant as dy, type ProductData as dz, CatalogResource as e, type OrderCreateParams as f, type OrderStatusUpdateParams as g, type OrderCommentCreateParams as h, type OrderCancelParams as i, type InvoiceListParams as j, type ClientListParams as k, type DiscountCodeListParams as l, type TrackingNumberListParams as m, type OrderCommentListParams as n, type OrderStatusChangeListParams as o, type ApiV2AuthenticationRefreshTokenPost200Response as p, instanceOfApiV2AuthenticationRefreshTokenPost200Response as q, ApiV2AuthenticationRefreshTokenPost200ResponseFromJSON as r, ApiV2AuthenticationRefreshTokenPost200ResponseFromJSONTyped as s, ApiV2AuthenticationRefreshTokenPost200ResponseToJSON as t, ApiV2AuthenticationRefreshTokenPost200ResponseToJSONTyped as u, type ApiV2AuthenticationTokenPost200Response as v, instanceOfApiV2AuthenticationTokenPost200Response as w, ApiV2AuthenticationTokenPost200ResponseFromJSON as x, ApiV2AuthenticationTokenPost200ResponseFromJSONTyped as y, ApiV2AuthenticationTokenPost200ResponseToJSON as z };
|
package/dist/client.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { D as Doboxa, a as DoboxaConfig } from './client-
|
|
1
|
+
export { D as Doboxa, a as DoboxaConfig } from './client-BrWpdgrN.mjs';
|
package/dist/client.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { D as Doboxa, a as DoboxaConfig } from './client-
|
|
1
|
+
export { D as Doboxa, a as DoboxaConfig } from './client-BrWpdgrN.js';
|
package/dist/client.js
CHANGED
|
@@ -344,6 +344,15 @@ var DoboxaAuthenticationError = class _DoboxaAuthenticationError extends DoboxaE
|
|
|
344
344
|
Object.setPrototypeOf(this, _DoboxaAuthenticationError.prototype);
|
|
345
345
|
}
|
|
346
346
|
};
|
|
347
|
+
var DoboxaConnectorError = class _DoboxaConnectorError extends DoboxaError {
|
|
348
|
+
constructor(errorCode, errorText, message) {
|
|
349
|
+
super(message || errorText || `BaseLinker connector error: ${errorCode}`);
|
|
350
|
+
this.name = "DoboxaConnectorError";
|
|
351
|
+
this.errorCode = errorCode;
|
|
352
|
+
this.errorText = errorText;
|
|
353
|
+
Object.setPrototypeOf(this, _DoboxaConnectorError.prototype);
|
|
354
|
+
}
|
|
355
|
+
};
|
|
347
356
|
function parseErrorResponse(statusCode, body) {
|
|
348
357
|
if (typeof body === "object" && body !== null) {
|
|
349
358
|
if ("invalid_parameters" in body || "error_message" in body) {
|
|
@@ -579,11 +588,6 @@ var AuthenticationResource = class {
|
|
|
579
588
|
}
|
|
580
589
|
};
|
|
581
590
|
|
|
582
|
-
// src/types/generated/src/models/Bool.ts
|
|
583
|
-
function BoolFromJSON(json) {
|
|
584
|
-
return json;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
591
|
// src/types/generated/src/models/Attachment.ts
|
|
588
592
|
function AttachmentToJSON(json) {
|
|
589
593
|
return AttachmentToJSONTyped(json, false);
|
|
@@ -891,7 +895,7 @@ function OrderCancellationResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
891
895
|
return json;
|
|
892
896
|
}
|
|
893
897
|
return {
|
|
894
|
-
"cancelled": json["cancelled"] == null ? void 0 :
|
|
898
|
+
"cancelled": json["cancelled"] == null ? void 0 : json["cancelled"],
|
|
895
899
|
"details": json["details"] == null ? void 0 : json["details"]
|
|
896
900
|
};
|
|
897
901
|
}
|
|
@@ -1991,6 +1995,118 @@ var UsersResource = class {
|
|
|
1991
1995
|
}
|
|
1992
1996
|
};
|
|
1993
1997
|
|
|
1998
|
+
// src/resources/catalog.ts
|
|
1999
|
+
var CatalogResource = class {
|
|
2000
|
+
constructor(config) {
|
|
2001
|
+
this.config = config;
|
|
2002
|
+
}
|
|
2003
|
+
/**
|
|
2004
|
+
* Call a connector action.
|
|
2005
|
+
*
|
|
2006
|
+
* @param action - Connector action, e.g. "ProductsList"
|
|
2007
|
+
* @param params - Additional action parameters
|
|
2008
|
+
* @throws DoboxaConnectorError on HTTP or connector errors
|
|
2009
|
+
*/
|
|
2010
|
+
call(_0) {
|
|
2011
|
+
return __async(this, arguments, function* (action, params = {}) {
|
|
2012
|
+
const response = yield fetch(this.config.url, {
|
|
2013
|
+
method: "POST",
|
|
2014
|
+
headers: {
|
|
2015
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
2016
|
+
},
|
|
2017
|
+
body: new URLSearchParams(__spreadValues({
|
|
2018
|
+
bl_pass: this.config.password,
|
|
2019
|
+
action
|
|
2020
|
+
}, params))
|
|
2021
|
+
});
|
|
2022
|
+
if (!response.ok) {
|
|
2023
|
+
throw new DoboxaConnectorError(
|
|
2024
|
+
`http_${response.status}`,
|
|
2025
|
+
response.statusText || "Unexpected HTTP status",
|
|
2026
|
+
`BaseLinker connector request failed with HTTP ${response.status}`
|
|
2027
|
+
);
|
|
2028
|
+
}
|
|
2029
|
+
let payload;
|
|
2030
|
+
try {
|
|
2031
|
+
payload = yield response.json();
|
|
2032
|
+
} catch (e) {
|
|
2033
|
+
throw new DoboxaConnectorError(
|
|
2034
|
+
"invalid_response",
|
|
2035
|
+
"Connector response is not valid JSON",
|
|
2036
|
+
"BaseLinker connector returned a non-JSON response"
|
|
2037
|
+
);
|
|
2038
|
+
}
|
|
2039
|
+
if (payload !== null && typeof payload === "object" && !Array.isArray(payload) && payload.error === true) {
|
|
2040
|
+
const error = payload;
|
|
2041
|
+
throw new DoboxaConnectorError(error.error_code, error.error_text);
|
|
2042
|
+
}
|
|
2043
|
+
return payload;
|
|
2044
|
+
});
|
|
2045
|
+
}
|
|
2046
|
+
/**
|
|
2047
|
+
* Get the connector platform and version.
|
|
2048
|
+
*/
|
|
2049
|
+
fileVersion() {
|
|
2050
|
+
return __async(this, null, function* () {
|
|
2051
|
+
return this.call("FileVersion");
|
|
2052
|
+
});
|
|
2053
|
+
}
|
|
2054
|
+
/**
|
|
2055
|
+
* Get the list of actions the connector supports.
|
|
2056
|
+
*/
|
|
2057
|
+
supportedMethods() {
|
|
2058
|
+
return __async(this, null, function* () {
|
|
2059
|
+
return this.call("SupportedMethods");
|
|
2060
|
+
});
|
|
2061
|
+
}
|
|
2062
|
+
/**
|
|
2063
|
+
* Get all product categories as a map of category id to category path.
|
|
2064
|
+
*/
|
|
2065
|
+
categories() {
|
|
2066
|
+
return __async(this, null, function* () {
|
|
2067
|
+
return this.call("ProductsCategories");
|
|
2068
|
+
});
|
|
2069
|
+
}
|
|
2070
|
+
/**
|
|
2071
|
+
* List one page of products (designs).
|
|
2072
|
+
*
|
|
2073
|
+
* @param params - Page number and optional category filter
|
|
2074
|
+
*/
|
|
2075
|
+
list() {
|
|
2076
|
+
return __async(this, arguments, function* (params = {}) {
|
|
2077
|
+
var _a;
|
|
2078
|
+
const response = yield this.call("ProductsList", __spreadValues({
|
|
2079
|
+
page: String((_a = params.page) != null ? _a : 1)
|
|
2080
|
+
}, params.category_id !== void 0 ? { category_id: params.category_id } : {}));
|
|
2081
|
+
const items = [];
|
|
2082
|
+
for (const id of Object.keys(response)) {
|
|
2083
|
+
if (id === "pages") {
|
|
2084
|
+
continue;
|
|
2085
|
+
}
|
|
2086
|
+
const value = response[id];
|
|
2087
|
+
if (typeof value !== "object" || value === null) {
|
|
2088
|
+
continue;
|
|
2089
|
+
}
|
|
2090
|
+
items.push(__spreadValues({ id }, value));
|
|
2091
|
+
}
|
|
2092
|
+
return { pages: response.pages, items };
|
|
2093
|
+
});
|
|
2094
|
+
}
|
|
2095
|
+
/**
|
|
2096
|
+
* Get full product data (images, variants) for the given design ids.
|
|
2097
|
+
*
|
|
2098
|
+
* @param params - Design ids from the product list
|
|
2099
|
+
*/
|
|
2100
|
+
data(params) {
|
|
2101
|
+
return __async(this, null, function* () {
|
|
2102
|
+
const response = yield this.call("ProductsData", {
|
|
2103
|
+
products_id: params.products_id.join(",")
|
|
2104
|
+
});
|
|
2105
|
+
return Array.isArray(response) ? {} : response;
|
|
2106
|
+
});
|
|
2107
|
+
}
|
|
2108
|
+
};
|
|
2109
|
+
|
|
1994
2110
|
// src/client.ts
|
|
1995
2111
|
var Doboxa = class {
|
|
1996
2112
|
constructor(config = {}) {
|
|
@@ -2057,6 +2173,9 @@ var Doboxa = class {
|
|
|
2057
2173
|
this.config
|
|
2058
2174
|
);
|
|
2059
2175
|
this.users = new UsersResource(this.httpClient, this.config);
|
|
2176
|
+
if (config.catalog) {
|
|
2177
|
+
this.catalog = new CatalogResource(config.catalog);
|
|
2178
|
+
}
|
|
2060
2179
|
}
|
|
2061
2180
|
};
|
|
2062
2181
|
// Annotate the CommonJS export names for ESM import in node:
|