@artisan-commerce/types 0.13.0-canary.9 → 0.13.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/build/index.d.ts +8 -6
  3. package/build/index.js +8 -6
  4. package/build/index.js.map +1 -1
  5. package/build/types/account.types.d.ts +5 -5
  6. package/build/types/app.types.d.ts +46 -29
  7. package/build/types/app.types.js +1 -0
  8. package/build/types/app.types.js.map +1 -1
  9. package/build/types/artisanDB.types.d.ts +24 -0
  10. package/build/types/artisanDB.types.js +1 -0
  11. package/build/types/artisanDB.types.js.map +1 -1
  12. package/build/types/banner.types.d.ts +97 -0
  13. package/build/types/{coupons.types.js → banner.types.js} +2 -1
  14. package/build/types/banner.types.js.map +1 -0
  15. package/build/types/billingData.types.d.ts +23 -0
  16. package/build/types/billingData.types.js +1 -0
  17. package/build/types/billingData.types.js.map +1 -1
  18. package/build/types/catalogue.types.d.ts +16 -0
  19. package/build/types/catalogue.types.js +4 -0
  20. package/build/types/catalogue.types.js.map +1 -0
  21. package/build/types/category.types.d.ts +21 -2
  22. package/build/types/category.types.js +1 -0
  23. package/build/types/category.types.js.map +1 -1
  24. package/build/types/common.types.d.ts +28 -0
  25. package/build/types/common.types.js +1 -1
  26. package/build/types/common.types.js.map +1 -1
  27. package/build/types/country.types.d.ts +34 -1
  28. package/build/types/coupon.types.d.ts +112 -0
  29. package/build/types/{channel.types.js → coupon.types.js} +2 -2
  30. package/build/types/coupon.types.js.map +1 -0
  31. package/build/types/http.types.d.ts +45 -0
  32. package/build/types/image.types.d.ts +54 -2
  33. package/build/types/livingPlace.types.d.ts +65 -4
  34. package/build/types/livingPlace.types.js +1 -0
  35. package/build/types/livingPlace.types.js.map +1 -1
  36. package/build/types/payment.types.d.ts +81 -0
  37. package/build/types/payment.types.js +4 -0
  38. package/build/types/payment.types.js.map +1 -0
  39. package/build/types/product.types.d.ts +178 -52
  40. package/build/types/product.types.js +1 -25
  41. package/build/types/product.types.js.map +1 -1
  42. package/build/types/shippingAddress.types.d.ts +48 -0
  43. package/build/types/shippingAddress.types.js +1 -0
  44. package/build/types/shippingAddress.types.js.map +1 -1
  45. package/build/types/shippingCost.types.d.ts +31 -0
  46. package/build/types/shoppingCart.types.d.ts +75 -21
  47. package/build/types/shoppingCart.types.js +1 -0
  48. package/build/types/shoppingCart.types.js.map +1 -1
  49. package/build/types/store.types.d.ts +154 -25
  50. package/build/types/store.types.js +1 -21
  51. package/build/types/store.types.js.map +1 -1
  52. package/build/types/user.types.d.ts +77 -9
  53. package/build/types/user.types.js +1 -12
  54. package/build/types/user.types.js.map +1 -1
  55. package/build/types/vendor.types.d.ts +16 -0
  56. package/package.json +2 -2
  57. package/build/types/channel.types.d.ts +0 -5
  58. package/build/types/channel.types.js.map +0 -1
  59. package/build/types/coupons.types.d.ts +0 -96
  60. package/build/types/coupons.types.js.map +0 -1
@@ -1,18 +1,51 @@
1
+ /**
2
+ * Representation of a Commerce Country.
3
+ *
4
+ * @interface Country
5
+ * @since 0.5.14
6
+ */
1
7
  export interface Country {
8
+ /** Country's id */
2
9
  countryId: string;
10
+ /** Country's name */
3
11
  name: string;
12
+ /** Country ISO code, e.g.: EC */
4
13
  code: string;
14
+ /** Whether or not the country is active */
5
15
  active: boolean;
16
+ /**
17
+ * Object which contains information about country's currency,
18
+ * see {@link CountryCurrency}
19
+ */
6
20
  currency: CountryCurrency;
21
+ /** Array of taxes usually applied on the country, see {@link CountryTax} */
7
22
  taxes: CountryTax[];
8
23
  }
24
+ /**
25
+ * Representation of a country's currency.
26
+ *
27
+ * @interface CountryCurrency
28
+ * @since 0.5.14
29
+ */
9
30
  export interface CountryCurrency {
31
+ /** Currency's id */
10
32
  currencyId: string;
33
+ /** Currency's name */
11
34
  name: string;
35
+ /** Currency's symbol */
12
36
  sign: string;
13
37
  }
38
+ /**
39
+ * Representation of a country's tax.
40
+ *
41
+ * @interface CountryTax
42
+ * @since 0.5.14
43
+ */
14
44
  export interface CountryTax {
45
+ /** Tax name */
15
46
  tax: string;
47
+ /** Value added tax rate */
16
48
  vatRate: string;
17
- percentage: string;
49
+ /** Tax percentage */
50
+ percentage: number;
18
51
  }
@@ -0,0 +1,112 @@
1
+ import { ArtisanDBCollectionReference } from "./artisanDB.types";
2
+ import { ArtisanDBQueryDocumentSnapshot } from "./artisanDB.types";
3
+ import { ArtisanDBDocumentData } from "./artisanDB.types";
4
+ import { Image } from "./image.types";
5
+ /**
6
+ * Wallet user information.
7
+ *
8
+ * @interface Wallet
9
+ * @since 0.5.14
10
+ */
11
+ export interface Wallet {
12
+ /** {@link Benefit}'s array from firestore user wallet */
13
+ benefits: Benefit[];
14
+ }
15
+ /**
16
+ * Benefit information.
17
+ *
18
+ * @interface Benefit
19
+ * @since 0.5.14
20
+ */
21
+ export interface Benefit {
22
+ /** The user wallet id */
23
+ hash: string;
24
+ /** The benefit awards, see {@link Award} */
25
+ award: Award;
26
+ /** Benefit id */
27
+ benefitId: number;
28
+ /** Benefit wallet id */
29
+ benefitWalletId: number;
30
+ /** Benefit code in back-end */
31
+ code: null;
32
+ /** Combined */
33
+ combined: string;
34
+ /** Benefit creation date */
35
+ createdAt: string;
36
+ /** Benefit description */
37
+ description: string;
38
+ /** Benefit discount percentage */
39
+ discountPercentage: number;
40
+ /** Benefit expiration date */
41
+ expirationDate: string;
42
+ /** External benefit id */
43
+ externalId: null;
44
+ /** Benefit images, see {@link Image} */
45
+ image: Image[];
46
+ /** The award limit */
47
+ limitAward: null;
48
+ /** The benefit limit */
49
+ limitBenefit: number;
50
+ /** The logic operator of the benefit */
51
+ logicOperator: string;
52
+ /** Benefit stock */
53
+ quantity: number;
54
+ /** The rules of the benefit */
55
+ rules: any[];
56
+ /** The benefit title */
57
+ title: string;
58
+ /** Benefit type, see {@link BenefitTypes} */
59
+ type: BenefitTypes;
60
+ /** Benefit update date */
61
+ updatedAt: string;
62
+ /** The channel id of the benefit */
63
+ channelId: number;
64
+ /** The vendor id of the benefit */
65
+ vendorId: number;
66
+ /** The account id of the benefit */
67
+ accountId: number;
68
+ }
69
+ /**
70
+ * Award information.
71
+ *
72
+ * @interface Award
73
+ * @since 0.5.14
74
+ */
75
+ export interface Award {
76
+ /** The id of the award */
77
+ id: number;
78
+ /** The id of the benefit */
79
+ benefitId: number;
80
+ /** Benefit discount percentage */
81
+ discountPercentage: number;
82
+ /** Benefit discount value */
83
+ discountValue: null;
84
+ }
85
+ /**
86
+ * Applied benefit array in shopping cart.
87
+ *
88
+ * @typedef ShoppingCartBenefits
89
+ * @since 0.5.14
90
+ */
91
+ export declare type ShoppingCartBenefits = Benefit[];
92
+ /**
93
+ * A benefit DB node from a user.
94
+ *
95
+ * @typedef BenefitsByUserNode
96
+ * @since 0.5.14
97
+ */
98
+ export declare type BenefitsByUserNode = ArtisanDBQueryDocumentSnapshot<ArtisanDBDocumentData>;
99
+ /**
100
+ * The complete collection of benefits DB nodes from a user.
101
+ *
102
+ * @typedef BenefitsByUserNodes
103
+ * @since 0.5.14
104
+ */
105
+ export declare type BenefitsByUserNodes = ArtisanDBCollectionReference<ArtisanDBDocumentData>;
106
+ /**
107
+ * The possible values of the benefit type.
108
+ *
109
+ * @typedef BenefitTypes
110
+ * @since 0.5.14
111
+ */
112
+ export declare type BenefitTypes = "ALTER_DELIVERY" | "PRODUCT" | "DISCOUNT";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
- // Channel types and interfaces
2
+ // Coupons types and interfaces
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- //# sourceMappingURL=channel.types.js.map
4
+ //# sourceMappingURL=coupon.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coupon.types.js","sourceRoot":"","sources":["../../src/types/coupon.types.ts"],"names":[],"mappings":";AAAA,+BAA+B"}
@@ -1,19 +1,64 @@
1
+ /**
2
+ * Representation of a Artisan request.
3
+ *
4
+ * @interface ArtisanRequest
5
+ * @since 0.5.14
6
+ */
1
7
  export interface ArtisanRequest {
8
+ /** Request's url */
2
9
  url: string;
10
+ /** Request's headers, see {@link ArtisanRequestHeaders} */
3
11
  headers: ArtisanRequestHeaders;
12
+ /** Request's body, see {@link ArtisanRequestBody} */
4
13
  body: ArtisanRequestBody;
14
+ /** Request's query, see {@link ArtisanQuery} */
5
15
  query: ArtisanQuery;
16
+ /** Request's params, see {@link ArtisanParams} */
6
17
  params: ArtisanParams;
18
+ /** Request's method, see {@link ArtisanRequestMethod} */
7
19
  method?: ArtisanRequestMethod;
8
20
  }
21
+ /**
22
+ * Artisan request headers based on the fetch API.
23
+ *
24
+ * @typedef ArtisanRequestHeaders
25
+ * @since 0.5.14
26
+ */
9
27
  export declare type ArtisanRequestHeaders = Headers;
28
+ /**
29
+ * Allowed methods for requests.
30
+ *
31
+ * @typedef ArtisanRequestMethod
32
+ * @since 0.5.14
33
+ */
10
34
  export declare type ArtisanRequestMethod = "POST" | "GET" | "PUT" | "DELETE" | "PATCH";
35
+ /**
36
+ * Artisan request's body.
37
+ *
38
+ * @interface ArtisanRequestBody
39
+ * @since 0.5.14
40
+ * @property {any} [key:string] Object with key-value pairs
41
+ */
11
42
  export interface ArtisanRequestBody {
12
43
  [key: string]: any;
13
44
  }
45
+ /**
46
+ * Artisan request's body.
47
+ *
48
+ * @interface ArtisanQuery
49
+ * @since 0.5.14
50
+ * @property {string | number | boolean} [key:string] Object with key-value pairs
51
+ */
14
52
  export interface ArtisanQuery {
15
53
  [key: string]: string | number | boolean;
16
54
  }
55
+ /**
56
+ * Artisan request's params.
57
+ *
58
+ * @interface ArtisanParams
59
+ * @since 0.5.14
60
+ * @property {string | number} [key:string] Object with key-value pairs
61
+ */
17
62
  export interface ArtisanParams {
18
63
  [key: string]: string | number;
19
64
  }
@@ -1,16 +1,68 @@
1
+ /**
2
+ * Representation of a image allocated in a CDN.
3
+ *
4
+ * @interface CDNImage
5
+ * @since 0.5.14
6
+ */
1
7
  export interface CDNImage {
8
+ /** The bucket where the image is located */
2
9
  bucket?: string;
10
+ /** The cloud where the image is saved */
3
11
  cloudFrontUrl?: string;
12
+ /** The directory where the image is saved */
4
13
  key?: string;
14
+ /** Image's name */
5
15
  name: string;
16
+ /** The url where the image is saved */
6
17
  url: string;
18
+ /** The base 64 image value */
7
19
  base64?: string;
8
20
  }
21
+ /**
22
+ * A image url.
23
+ *
24
+ * @typedef URLImage
25
+ * @since 0.5.14
26
+ */
9
27
  export declare type URLImage = string;
28
+ /**
29
+ * Configuration on how to setup the cloudfront image manipulation.
30
+ *
31
+ * @since 0.5.14
32
+ * @interface ImageManipulationConfig
33
+ */
10
34
  export interface ImageManipulationConfig {
35
+ /** Image's width */
11
36
  width?: number;
37
+ /** Image's height */
12
38
  height?: number;
13
- fit?: "fill" | "cover" | "contain" | "inside" | "outside";
14
- toFormat?: "jpg" | "jpeg" | "png" | "svg";
39
+ /** Determines how to resize the image, see {@link ImageFit} */
40
+ fit?: ImageFit;
41
+ /**
42
+ * Determines in which format the resulting image must be,
43
+ * see {@link ImageToFormat}
44
+ */
45
+ toFormat?: ImageToFormat;
15
46
  }
47
+ /**
48
+ * Representation of a Commerce Image which could be a
49
+ * {@link CDNImage} or a {@link URLImage}.
50
+ *
51
+ * @typedef Image
52
+ * @since 0.5.14
53
+ */
16
54
  export declare type Image = CDNImage | URLImage;
55
+ /**
56
+ * Contains different properties on how to resize the image.
57
+ *
58
+ * @typedef ImageFit
59
+ * @since 0.5.14
60
+ */
61
+ export declare type ImageFit = "fill" | "cover" | "contain" | "inside" | "outside";
62
+ /**
63
+ * Contains different image formats.
64
+ *
65
+ * @typedef ImageToFormat
66
+ * @since 0.5.14
67
+ */
68
+ export declare type ImageToFormat = "jpg" | "jpeg" | "png" | "svg";
@@ -1,31 +1,92 @@
1
+ /**
2
+ * Representation of a living place base object.
3
+ *
4
+ * @interface BaseLivingPlace
5
+ * @since 0.5.14
6
+ */
1
7
  export interface BaseLivingPlace {
8
+ /** Living place's id */
2
9
  id: number;
3
10
  }
11
+ /**
12
+ * Representation of a living place.
13
+ *
14
+ * @interface LivingPlace
15
+ * @since 0.5.14
16
+ * @extends {{@link BaseLivingPlace}
17
+ */
4
18
  export interface LivingPlace extends BaseLivingPlace {
19
+ /** Living place's name */
5
20
  name: string;
21
+ /** Whether or not the living place is active */
6
22
  active: number;
23
+ /** Country unique identifier */
7
24
  countryId: number;
25
+ /** Array of fields required to save a living place, see {@link Field} */
8
26
  fields: Field[];
9
27
  }
28
+ /**
29
+ * Representation of a living place which will be saved.
30
+ *
31
+ * @interface LivingPlaceToSave
32
+ * @since 0.5.14
33
+ * @extends {{@link BaseLivingPlace}
34
+ */
10
35
  export interface LivingPlaceToSave extends BaseLivingPlace {
36
+ /** Array of fields to be saved, see {@link FieldRecord} */
11
37
  fields: FieldRecord[];
12
38
  }
39
+ /**
40
+ * Representation of a field object.
41
+ *
42
+ * @interface Field
43
+ * @since 0.5.14
44
+ */
13
45
  export interface Field {
46
+ /** Field's id */
14
47
  id: string;
48
+ /** Field's label */
15
49
  label: string;
16
- rules: Rules;
17
- messages: Messages;
50
+ /** Field's rules, see {@link Rules} */
51
+ rules: Rule;
52
+ /** Field's messages based on rules, see {@link Messages} */
53
+ messages: Message;
54
+ /** Field's value */
18
55
  value?: string;
19
56
  }
57
+ /**
58
+ * Representation of a field record.
59
+ *
60
+ * @interface FieldRecord
61
+ * @since 0.5.14
62
+ */
20
63
  export interface FieldRecord {
64
+ /** Field record's id */
21
65
  id: string;
66
+ /** Field record's value */
22
67
  value: string;
23
68
  }
24
- export interface Messages {
69
+ /**
70
+ * Messages for living places.
71
+ *
72
+ * @interface Message
73
+ * @since 0.5.14
74
+ */
75
+ export interface Message {
76
+ /** The maximum number's message of allowed living places */
25
77
  max: string;
78
+ /** The minimum number's message of allowed living places */
26
79
  min: string;
27
80
  }
28
- export interface Rules {
81
+ /**
82
+ * Rules for living places.
83
+ *
84
+ * @interface Rule
85
+ * @since 0.5.14
86
+ */
87
+ export interface Rule {
88
+ /** The maximum number of allowed living places */
29
89
  max: number;
90
+ /** The minimum number of allowed living places */
30
91
  min: number;
31
92
  }
@@ -1,3 +1,4 @@
1
1
  "use strict";
2
+ // Living place types and interfaces
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  //# sourceMappingURL=livingPlace.types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"livingPlace.types.js","sourceRoot":"","sources":["../../src/types/livingPlace.types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"livingPlace.types.js","sourceRoot":"","sources":["../../src/types/livingPlace.types.ts"],"names":[],"mappings":";AAAA,oCAAoC"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Basic payment method object.
3
+ *
4
+ * @interface BasePaymentMethod
5
+ * @since 0.5.14
6
+ */
7
+ export interface BasePaymentMethod {
8
+ /** Payment method's id */
9
+ id: number;
10
+ /** Payment method's created date */
11
+ created_at: string | null;
12
+ /** Payment method's updated date */
13
+ updated_at: string | null;
14
+ /** Payment method's deleted date */
15
+ deleted_at: string | null;
16
+ }
17
+ /**
18
+ * Representation of a Commerce Payment method.
19
+ *
20
+ * @interface PaymentMethod
21
+ * @since 0.5.14
22
+ * @extends {{@link BasePaymentMethod}
23
+ */
24
+ export interface PaymentMethod extends BasePaymentMethod {
25
+ /** Payment method's name, see {@link PaymentMethodName} */
26
+ name: PaymentMethodName;
27
+ /** Payment method image's url, commonly used to save image cards */
28
+ image_url: string;
29
+ /** Whether or not the payment method is default */
30
+ default: boolean;
31
+ /** Payment method's external id */
32
+ external_id: string | null;
33
+ /** Payment method's external code */
34
+ external_code: number;
35
+ /** Payment method's parent id */
36
+ parent_id: string | null;
37
+ /** Payment method cards' allowed brands, see {@link CreditCardBrand} */
38
+ methods: CreditCardBrand[];
39
+ }
40
+ /**
41
+ * Representation of a credit card brand.
42
+ *
43
+ * @interface CreditCardBrand
44
+ * @since 0.5.14
45
+ * @extends {{@link PaymentMethod}
46
+ */
47
+ export interface CreditCardBrand extends PaymentMethod {
48
+ /** Payment method cards' allowed brands, see {@link CreditCardMappings}*/
49
+ cc_brands: CreditCardMapping[];
50
+ }
51
+ /**
52
+ * Representation of a credit card brand.
53
+ *
54
+ * @interface CreditCardMapping
55
+ * @since 0.5.14
56
+ * @extends {{@link BasePaymentMethod}
57
+ */
58
+ export interface CreditCardMapping extends BasePaymentMethod {
59
+ /** Credit card mapping unique identifier */
60
+ id: number;
61
+ /** Credit card mapping name, see {@link CardName} */
62
+ name: CardName;
63
+ /** Payment method image's url, commonly used to save image cards */
64
+ image_url: string;
65
+ /** Mapping of credit cards */
66
+ cc_brands_mapping: unknown[];
67
+ }
68
+ /**
69
+ * Payment method common names.
70
+ *
71
+ * @typedef PaymentMethodName
72
+ * @since 0.5.14
73
+ */
74
+ export declare type PaymentMethodName = "CREDIT_CARD" | "CASH";
75
+ /**
76
+ * Cards common names.
77
+ *
78
+ * @typedef CardName
79
+ * @since 0.5.14
80
+ */
81
+ export declare type CardName = "Diners" | "Discover" | "American Express" | "Visa" | "MasterCard";
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // Payment types and interfaces
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=payment.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment.types.js","sourceRoot":"","sources":["../../src/types/payment.types.ts"],"names":[],"mappings":";AAAA,+BAA+B"}