@infrab4a/connect 4.3.0-beta.2 → 4.3.0-beta.4

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/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import 'reflect-metadata';
2
- import { plainToInstance, instanceToPlain, Expose, Type } from 'class-transformer';
3
2
  import * as tslib_1 from 'tslib';
4
3
  import { __decorate, __metadata, __rest } from 'tslib';
4
+ import { plainToInstance, instanceToPlain, Type, Expose } from 'class-transformer';
5
5
  import { parseISO } from 'date-fns';
6
6
  export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub } from 'date-fns';
7
7
  import { isNil, isArray as isArray$1, first, last, flatten, compact, get, isString, each, unset, isObject as isObject$1, set, isNumber, isEmpty, chunk, isDate, isBoolean, isInteger, isNaN as isNaN$1, omit } from 'lodash';
@@ -9,8 +9,9 @@ export { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil,
9
9
  import { debug } from 'debug';
10
10
  import { CustomError } from 'ts-custom-error';
11
11
  import axios from 'axios';
12
- import { collection, getDoc, doc, where, orderBy, getDocs, query, startAfter, startAt, limit, addDoc, setDoc, deleteField, arrayUnion, arrayRemove, deleteDoc, Timestamp } from 'firebase/firestore';
13
12
  import { signInWithEmailAndPassword, signInWithPopup, GoogleAuthProvider, signInAnonymously, sendPasswordResetEmail, createUserWithEmailAndPassword, sendEmailVerification } from 'firebase/auth';
13
+ import { collection, getDoc, doc, where, orderBy, getDocs, query, startAfter, startAt, limit, addDoc, setDoc, deleteField, arrayUnion, arrayRemove, deleteDoc, Timestamp } from 'firebase/firestore';
14
+ import { ref, uploadBytes } from 'firebase/storage';
14
15
  import { mutation, query as query$1 } from 'gql-query-builder';
15
16
 
16
17
  class BaseModel {
@@ -36,6 +37,187 @@ class BaseModel {
36
37
  }
37
38
  }
38
39
 
40
+ class Filter extends BaseModel {
41
+ static get identifiersFields() {
42
+ return ['id'];
43
+ }
44
+ }
45
+
46
+ class CategoryBase extends BaseModel {
47
+ static get identifiersFields() {
48
+ return ['id'];
49
+ }
50
+ }
51
+ __decorate([
52
+ Type(() => CategoryBase),
53
+ __metadata("design:type", CategoryBase)
54
+ ], CategoryBase.prototype, "parent", void 0);
55
+ __decorate([
56
+ Type(() => Filter),
57
+ __metadata("design:type", Array)
58
+ ], CategoryBase.prototype, "filters", void 0);
59
+
60
+ class CategoryForProduct extends CategoryBase {
61
+ static get identifiersFields() {
62
+ return ['id'];
63
+ }
64
+ }
65
+
66
+ class ProductBase extends BaseModel {
67
+ get evaluation() {
68
+ return {
69
+ reviews: this.reviews,
70
+ count: this.reviewsTotal,
71
+ rating: this.rate,
72
+ };
73
+ }
74
+ set evaluation(evaluation) {
75
+ if (!evaluation) {
76
+ this.reviews = null;
77
+ this.reviewsTotal = null;
78
+ this.rate = null;
79
+ return;
80
+ }
81
+ this.reviews = evaluation.reviews || this.reviews;
82
+ this.reviewsTotal = evaluation.count || this.reviewsTotal;
83
+ this.rate = evaluation.rating || this.rate;
84
+ }
85
+ static get identifiersFields() {
86
+ return ['id'];
87
+ }
88
+ }
89
+
90
+ class ProductForKit extends ProductBase {
91
+ static get identifiersFields() {
92
+ return ['id'];
93
+ }
94
+ }
95
+ __decorate([
96
+ Type(() => CategoryForProduct),
97
+ __metadata("design:type", CategoryForProduct)
98
+ ], ProductForKit.prototype, "category", void 0);
99
+
100
+ class KitProduct extends BaseModel {
101
+ static get identifiersFields() {
102
+ return ['productId', 'kitProductId'];
103
+ }
104
+ }
105
+ __decorate([
106
+ Type(() => ProductForKit),
107
+ __metadata("design:type", ProductForKit)
108
+ ], KitProduct.prototype, "kit", void 0);
109
+ __decorate([
110
+ Type(() => ProductForKit),
111
+ __metadata("design:type", ProductForKit)
112
+ ], KitProduct.prototype, "product", void 0);
113
+
114
+ class ProductForCategory extends ProductBase {
115
+ static get identifiersFields() {
116
+ return ['id'];
117
+ }
118
+ }
119
+ __decorate([
120
+ Type(() => KitProduct),
121
+ __metadata("design:type", Array)
122
+ ], ProductForCategory.prototype, "kitProducts", void 0);
123
+
124
+ class Category extends CategoryBase {
125
+ static get identifiersFields() {
126
+ return ['id'];
127
+ }
128
+ }
129
+ __decorate([
130
+ Type(() => ProductForCategory),
131
+ __metadata("design:type", Array)
132
+ ], Category.prototype, "childrenProducts", void 0);
133
+
134
+ class CategoryCollectionChildren extends BaseModel {
135
+ static get identifiersFields() {
136
+ return ['collectionId', 'categoryId'];
137
+ }
138
+ }
139
+ __decorate([
140
+ Type(() => CategoryCollectionChildren),
141
+ __metadata("design:type", CategoryCollectionChildren)
142
+ ], CategoryCollectionChildren.prototype, "parent", void 0);
143
+
144
+ class CategoryFilter extends BaseModel {
145
+ static get identifiersFields() {
146
+ return ['id'];
147
+ }
148
+ }
149
+ __decorate([
150
+ Type(() => Filter),
151
+ __metadata("design:type", Filter)
152
+ ], CategoryFilter.prototype, "filter", void 0);
153
+ __decorate([
154
+ Type(() => Category),
155
+ __metadata("design:type", Category)
156
+ ], CategoryFilter.prototype, "category", void 0);
157
+
158
+ var GenderDestination;
159
+ (function (GenderDestination) {
160
+ GenderDestination["FEMALE"] = "female";
161
+ GenderDestination["MALE"] = "male";
162
+ GenderDestination["UNISEX"] = "unisex";
163
+ })(GenderDestination || (GenderDestination = {}));
164
+
165
+ var Shops;
166
+ (function (Shops) {
167
+ Shops["MENSMARKET"] = "mensmarket";
168
+ Shops["GLAMSHOP"] = "Glamshop";
169
+ Shops["GLAMPOINTS"] = "Glampoints";
170
+ Shops["ALL"] = "ALL";
171
+ })(Shops || (Shops = {}));
172
+
173
+ class FilterOption extends BaseModel {
174
+ static get identifiersFields() {
175
+ return ['id'];
176
+ }
177
+ }
178
+
179
+ class Product extends ProductBase {
180
+ static get identifiersFields() {
181
+ return ['id'];
182
+ }
183
+ }
184
+ __decorate([
185
+ Type(() => CategoryForProduct),
186
+ __metadata("design:type", CategoryForProduct)
187
+ ], Product.prototype, "category", void 0);
188
+ __decorate([
189
+ Type(() => KitProduct),
190
+ __metadata("design:type", Array)
191
+ ], Product.prototype, "kitProducts", void 0);
192
+
193
+ class ProductReviews extends BaseModel {
194
+ static get identifiersFields() {
195
+ return ['id'];
196
+ }
197
+ }
198
+
199
+ class Variant extends BaseModel {
200
+ static get identifiersFields() {
201
+ return ['id', 'productId'];
202
+ }
203
+ }
204
+
205
+ class Wishlist extends Category {
206
+ static get identifiersFields() {
207
+ return ['id'];
208
+ }
209
+ }
210
+
211
+ class Buy2Win extends BaseModel {
212
+ static get identifiersFields() {
213
+ return ['id'];
214
+ }
215
+ }
216
+ __decorate([
217
+ Type(() => Category),
218
+ __metadata("design:type", Array)
219
+ ], Buy2Win.prototype, "categories", void 0);
220
+
39
221
  var Where;
40
222
  (function (Where) {
41
223
  Where["EQUALS"] = "==";
@@ -61,6 +243,18 @@ var UpdateOptionActions;
61
243
  UpdateOptionActions["NULL"] = "null";
62
244
  })(UpdateOptionActions || (UpdateOptionActions = {}));
63
245
 
246
+ class CampaignDashboard extends BaseModel {
247
+ static get identifiersFields() {
248
+ return ['id'];
249
+ }
250
+ }
251
+
252
+ class CampaignHashtag extends BaseModel {
253
+ static get identifiersFields() {
254
+ return ['id'];
255
+ }
256
+ }
257
+
64
258
  var AccessoryImportances;
65
259
  (function (AccessoryImportances) {
66
260
  AccessoryImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
@@ -1816,316 +2010,43 @@ class Address extends BaseModel {
1816
2010
 
1817
2011
  class UserAddress extends Address {
1818
2012
  static get identifiersFields() {
1819
- return ['id', 'userId'];
1820
- }
1821
- }
1822
-
1823
- class Subscription extends BaseModel {
1824
- static get identifiersFields() {
1825
- return ['id'];
1826
- }
1827
- }
1828
- __decorate([
1829
- Type(() => User),
1830
- __metadata("design:type", User)
1831
- ], Subscription.prototype, "user", void 0);
1832
- __decorate([
1833
- Type(() => SubscriptionPlan),
1834
- __metadata("design:type", SubscriptionPlan)
1835
- ], Subscription.prototype, "subscriptionPlan", void 0);
1836
- __decorate([
1837
- Type(() => UserAddress),
1838
- __metadata("design:type", UserAddress)
1839
- ], Subscription.prototype, "shippingAddress", void 0);
1840
- __decorate([
1841
- Type(() => UserAddress),
1842
- __metadata("design:type", UserAddress)
1843
- ], Subscription.prototype, "billingAddress", void 0);
1844
- __decorate([
1845
- Type(() => Coupon),
1846
- __metadata("design:type", Coupon)
1847
- ], Subscription.prototype, "coupon", void 0);
1848
- __decorate([
1849
- Type(() => Edition),
1850
- __metadata("design:type", Array)
1851
- ], Subscription.prototype, "editions", void 0);
1852
- __decorate([
1853
- Type(() => SubscriptionPayment),
1854
- __metadata("design:type", Array)
1855
- ], Subscription.prototype, "payment", void 0);
1856
-
1857
- class Filter extends BaseModel {
1858
- static get identifiersFields() {
1859
- return ['id'];
1860
- }
1861
- }
1862
-
1863
- class CategoryBase extends BaseModel {
1864
- static get identifiersFields() {
1865
- return ['id'];
1866
- }
1867
- }
1868
- __decorate([
1869
- Type(() => CategoryBase),
1870
- __metadata("design:type", CategoryBase)
1871
- ], CategoryBase.prototype, "parent", void 0);
1872
- __decorate([
1873
- Type(() => Filter),
1874
- __metadata("design:type", Array)
1875
- ], CategoryBase.prototype, "filters", void 0);
1876
-
1877
- class CategoryForProduct extends CategoryBase {
1878
- static get identifiersFields() {
1879
- return ['id'];
1880
- }
1881
- }
1882
-
1883
- class ProductBase extends BaseModel {
1884
- get evaluation() {
1885
- return {
1886
- reviews: this.reviews,
1887
- count: this.reviewsTotal,
1888
- rating: this.rate,
1889
- };
1890
- }
1891
- set evaluation(evaluation) {
1892
- if (!evaluation) {
1893
- this.reviews = null;
1894
- this.reviewsTotal = null;
1895
- this.rate = null;
1896
- return;
1897
- }
1898
- this.reviews = evaluation.reviews || this.reviews;
1899
- this.reviewsTotal = evaluation.count || this.reviewsTotal;
1900
- this.rate = evaluation.rating || this.rate;
1901
- }
1902
- static get identifiersFields() {
1903
- return ['id'];
1904
- }
1905
- }
1906
-
1907
- class ProductForKit extends ProductBase {
1908
- static get identifiersFields() {
1909
- return ['id'];
1910
- }
1911
- }
1912
- __decorate([
1913
- Type(() => CategoryForProduct),
1914
- __metadata("design:type", CategoryForProduct)
1915
- ], ProductForKit.prototype, "category", void 0);
1916
-
1917
- class KitProduct extends BaseModel {
1918
- static get identifiersFields() {
1919
- return ['productId', 'kitProductId'];
1920
- }
1921
- }
1922
- __decorate([
1923
- Type(() => ProductForKit),
1924
- __metadata("design:type", ProductForKit)
1925
- ], KitProduct.prototype, "kit", void 0);
1926
- __decorate([
1927
- Type(() => ProductForKit),
1928
- __metadata("design:type", ProductForKit)
1929
- ], KitProduct.prototype, "product", void 0);
1930
-
1931
- class ProductForCategory extends ProductBase {
1932
- static get identifiersFields() {
1933
- return ['id'];
1934
- }
1935
- }
1936
- __decorate([
1937
- Type(() => KitProduct),
1938
- __metadata("design:type", Array)
1939
- ], ProductForCategory.prototype, "kitProducts", void 0);
1940
-
1941
- class Category extends CategoryBase {
1942
- static get identifiersFields() {
1943
- return ['id'];
1944
- }
1945
- }
1946
- __decorate([
1947
- Type(() => ProductForCategory),
1948
- __metadata("design:type", Array)
1949
- ], Category.prototype, "childrenProducts", void 0);
1950
-
1951
- class CategoryCollectionChildren extends BaseModel {
1952
- static get identifiersFields() {
1953
- return ['collectionId', 'categoryId'];
1954
- }
1955
- }
1956
- __decorate([
1957
- Type(() => CategoryCollectionChildren),
1958
- __metadata("design:type", CategoryCollectionChildren)
1959
- ], CategoryCollectionChildren.prototype, "parent", void 0);
1960
-
1961
- class CategoryFilter extends BaseModel {
1962
- static get identifiersFields() {
1963
- return ['id'];
1964
- }
1965
- }
1966
- __decorate([
1967
- Type(() => Filter),
1968
- __metadata("design:type", Filter)
1969
- ], CategoryFilter.prototype, "filter", void 0);
1970
- __decorate([
1971
- Type(() => Category),
1972
- __metadata("design:type", Category)
1973
- ], CategoryFilter.prototype, "category", void 0);
1974
-
1975
- var GenderDestination;
1976
- (function (GenderDestination) {
1977
- GenderDestination["FEMALE"] = "female";
1978
- GenderDestination["MALE"] = "male";
1979
- GenderDestination["UNISEX"] = "unisex";
1980
- })(GenderDestination || (GenderDestination = {}));
1981
-
1982
- var Shops;
1983
- (function (Shops) {
1984
- Shops["MENSMARKET"] = "mensmarket";
1985
- Shops["GLAMSHOP"] = "Glamshop";
1986
- Shops["GLAMPOINTS"] = "Glampoints";
1987
- Shops["ALL"] = "ALL";
1988
- })(Shops || (Shops = {}));
1989
-
1990
- class FilterOption extends BaseModel {
1991
- static get identifiersFields() {
1992
- return ['id'];
1993
- }
1994
- }
1995
-
1996
- class Product extends ProductBase {
1997
- static get identifiersFields() {
1998
- return ['id'];
1999
- }
2000
- }
2001
- __decorate([
2002
- Type(() => CategoryForProduct),
2003
- __metadata("design:type", CategoryForProduct)
2004
- ], Product.prototype, "category", void 0);
2005
- __decorate([
2006
- Type(() => KitProduct),
2007
- __metadata("design:type", Array)
2008
- ], Product.prototype, "kitProducts", void 0);
2009
-
2010
- class ProductReviews extends BaseModel {
2011
- static get identifiersFields() {
2012
- return ['id'];
2013
- }
2014
- }
2015
-
2016
- class Variant extends BaseModel {
2017
- static get identifiersFields() {
2018
- return ['id', 'productId'];
2019
- }
2020
- }
2021
-
2022
- class Wishlist extends Category {
2023
- static get identifiersFields() {
2024
- return ['id'];
2025
- }
2026
- }
2027
-
2028
- class Buy2Win extends BaseModel {
2029
- static get identifiersFields() {
2030
- return ['id'];
2031
- }
2032
- }
2033
- __decorate([
2034
- Type(() => Category),
2035
- __metadata("design:type", Array)
2036
- ], Buy2Win.prototype, "categories", void 0);
2037
-
2038
- class CampaignDashboard extends BaseModel {
2039
- static get identifiersFields() {
2040
- return ['id'];
2041
- }
2042
- }
2043
-
2044
- class CampaignHashtag extends BaseModel {
2045
- static get identifiersFields() {
2046
- return ['id'];
2047
- }
2048
- }
2049
-
2050
- class LineItem extends Product {
2051
- }
2052
-
2053
- class ShippingMethod extends BaseModel {
2054
- static get identifiersFields() {
2055
- return ['id'];
2056
- }
2057
- }
2058
-
2059
- class Checkout extends BaseModel {
2060
- static get identifiersFields() {
2061
- return ['id'];
2062
- }
2063
- }
2064
- __decorate([
2065
- Type(() => LineItem),
2066
- __metadata("design:type", Array)
2067
- ], Checkout.prototype, "lineItems", void 0);
2068
- __decorate([
2069
- Type(() => User),
2070
- __metadata("design:type", User)
2071
- ], Checkout.prototype, "user", void 0);
2072
- __decorate([
2073
- Type(() => UserAddress),
2074
- __metadata("design:type", UserAddress)
2075
- ], Checkout.prototype, "shippingAddress", void 0);
2076
- __decorate([
2077
- Type(() => UserAddress),
2078
- __metadata("design:type", UserAddress)
2079
- ], Checkout.prototype, "billingAddress", void 0);
2080
- __decorate([
2081
- Type(() => ShippingMethod),
2082
- __metadata("design:type", ShippingMethod)
2083
- ], Checkout.prototype, "shipping", void 0);
2084
- __decorate([
2085
- Type(() => Coupon),
2086
- __metadata("design:type", Coupon)
2087
- ], Checkout.prototype, "coupon", void 0);
2088
-
2089
- var OrderStatus;
2090
- (function (OrderStatus) {
2091
- OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
2092
- OrderStatus["EM_PREPARO"] = "Preparando pedido";
2093
- OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
2094
- OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
2095
- OrderStatus["ENVIADO"] = "Enviado";
2096
- OrderStatus["ENTREGUE"] = "Entregue";
2097
- OrderStatus["CANCELADO"] = "Cancelado";
2098
- OrderStatus["CREDIT_CARD"] = "credit_card";
2099
- })(OrderStatus || (OrderStatus = {}));
2100
-
2101
- class Order extends Checkout {
2102
- }
2103
- __decorate([
2104
- Type(() => Payment),
2105
- __metadata("design:type", Payment)
2106
- ], Order.prototype, "payment", void 0);
2013
+ return ['id', 'userId'];
2014
+ }
2015
+ }
2107
2016
 
2108
- class CheckoutSubscription extends BaseModel {
2017
+ class Subscription extends BaseModel {
2109
2018
  static get identifiersFields() {
2110
2019
  return ['id'];
2111
2020
  }
2112
2021
  }
2022
+ __decorate([
2023
+ Type(() => User),
2024
+ __metadata("design:type", User)
2025
+ ], Subscription.prototype, "user", void 0);
2026
+ __decorate([
2027
+ Type(() => SubscriptionPlan),
2028
+ __metadata("design:type", SubscriptionPlan)
2029
+ ], Subscription.prototype, "subscriptionPlan", void 0);
2113
2030
  __decorate([
2114
2031
  Type(() => UserAddress),
2115
2032
  __metadata("design:type", UserAddress)
2116
- ], CheckoutSubscription.prototype, "shippingAddress", void 0);
2033
+ ], Subscription.prototype, "shippingAddress", void 0);
2117
2034
  __decorate([
2118
2035
  Type(() => UserAddress),
2119
2036
  __metadata("design:type", UserAddress)
2120
- ], CheckoutSubscription.prototype, "billingAddress", void 0);
2121
- __decorate([
2122
- Type(() => SubscriptionPlan),
2123
- __metadata("design:type", SubscriptionPlan)
2124
- ], CheckoutSubscription.prototype, "subscriptionPlan", void 0);
2037
+ ], Subscription.prototype, "billingAddress", void 0);
2125
2038
  __decorate([
2126
2039
  Type(() => Coupon),
2127
2040
  __metadata("design:type", Coupon)
2128
- ], CheckoutSubscription.prototype, "coupon", void 0);
2041
+ ], Subscription.prototype, "coupon", void 0);
2042
+ __decorate([
2043
+ Type(() => Edition),
2044
+ __metadata("design:type", Array)
2045
+ ], Subscription.prototype, "editions", void 0);
2046
+ __decorate([
2047
+ Type(() => SubscriptionPayment),
2048
+ __metadata("design:type", Array)
2049
+ ], Subscription.prototype, "payment", void 0);
2129
2050
 
2130
2051
  class SubscriptionMaterialization extends BaseModel {
2131
2052
  static get identifiersFields() {
@@ -2276,6 +2197,86 @@ class RecoveryPassword {
2276
2197
  }
2277
2198
  }
2278
2199
 
2200
+ class LineItem extends Product {
2201
+ }
2202
+
2203
+ class ShippingMethod extends BaseModel {
2204
+ static get identifiersFields() {
2205
+ return ['id'];
2206
+ }
2207
+ }
2208
+
2209
+ class Checkout extends BaseModel {
2210
+ static get identifiersFields() {
2211
+ return ['id'];
2212
+ }
2213
+ }
2214
+ __decorate([
2215
+ Type(() => LineItem),
2216
+ __metadata("design:type", Array)
2217
+ ], Checkout.prototype, "lineItems", void 0);
2218
+ __decorate([
2219
+ Type(() => User),
2220
+ __metadata("design:type", User)
2221
+ ], Checkout.prototype, "user", void 0);
2222
+ __decorate([
2223
+ Type(() => UserAddress),
2224
+ __metadata("design:type", UserAddress)
2225
+ ], Checkout.prototype, "shippingAddress", void 0);
2226
+ __decorate([
2227
+ Type(() => UserAddress),
2228
+ __metadata("design:type", UserAddress)
2229
+ ], Checkout.prototype, "billingAddress", void 0);
2230
+ __decorate([
2231
+ Type(() => ShippingMethod),
2232
+ __metadata("design:type", ShippingMethod)
2233
+ ], Checkout.prototype, "shipping", void 0);
2234
+ __decorate([
2235
+ Type(() => Coupon),
2236
+ __metadata("design:type", Coupon)
2237
+ ], Checkout.prototype, "coupon", void 0);
2238
+
2239
+ var OrderStatus;
2240
+ (function (OrderStatus) {
2241
+ OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
2242
+ OrderStatus["EM_PREPARO"] = "Preparando pedido";
2243
+ OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
2244
+ OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
2245
+ OrderStatus["ENVIADO"] = "Enviado";
2246
+ OrderStatus["ENTREGUE"] = "Entregue";
2247
+ OrderStatus["CANCELADO"] = "Cancelado";
2248
+ OrderStatus["CREDIT_CARD"] = "credit_card";
2249
+ })(OrderStatus || (OrderStatus = {}));
2250
+
2251
+ class Order extends Checkout {
2252
+ }
2253
+ __decorate([
2254
+ Type(() => Payment),
2255
+ __metadata("design:type", Payment)
2256
+ ], Order.prototype, "payment", void 0);
2257
+
2258
+ class CheckoutSubscription extends BaseModel {
2259
+ static get identifiersFields() {
2260
+ return ['id'];
2261
+ }
2262
+ }
2263
+ __decorate([
2264
+ Type(() => UserAddress),
2265
+ __metadata("design:type", UserAddress)
2266
+ ], CheckoutSubscription.prototype, "shippingAddress", void 0);
2267
+ __decorate([
2268
+ Type(() => UserAddress),
2269
+ __metadata("design:type", UserAddress)
2270
+ ], CheckoutSubscription.prototype, "billingAddress", void 0);
2271
+ __decorate([
2272
+ Type(() => SubscriptionPlan),
2273
+ __metadata("design:type", SubscriptionPlan)
2274
+ ], CheckoutSubscription.prototype, "subscriptionPlan", void 0);
2275
+ __decorate([
2276
+ Type(() => Coupon),
2277
+ __metadata("design:type", Coupon)
2278
+ ], CheckoutSubscription.prototype, "coupon", void 0);
2279
+
2279
2280
  class RoundProductPricesHelper {
2280
2281
  static roundProductPrices(product) {
2281
2282
  product.price.price = Number(product.price.price.toFixed(2));
@@ -2609,6 +2610,75 @@ class ProductsIndex {
2609
2610
  }
2610
2611
  }
2611
2612
 
2613
+ class AuthenticationFirebaseAuthService {
2614
+ constructor(firebaseAuth) {
2615
+ this.firebaseAuth = firebaseAuth;
2616
+ }
2617
+ async signInWithEmailAndPassword(data) {
2618
+ const credentials = await signInWithEmailAndPassword(this.firebaseAuth, data.email, data.password);
2619
+ const user = credentials.user;
2620
+ return {
2621
+ id: user.uid,
2622
+ displayName: user.displayName,
2623
+ email: user.email,
2624
+ phone: user.phoneNumber,
2625
+ isAnonymous: false,
2626
+ };
2627
+ }
2628
+ async signInWithGoogle() {
2629
+ const credentials = await signInWithPopup(this.firebaseAuth, new GoogleAuthProvider());
2630
+ const user = credentials.user;
2631
+ return {
2632
+ id: user.uid,
2633
+ displayName: user.displayName,
2634
+ email: user.email,
2635
+ phone: user.phoneNumber,
2636
+ isAnonymous: false,
2637
+ };
2638
+ }
2639
+ async signOut() {
2640
+ this.firebaseAuth.signOut();
2641
+ }
2642
+ async signInAnonymously() {
2643
+ const auth = await signInAnonymously(this.firebaseAuth);
2644
+ const user = auth.user;
2645
+ user.id = auth.user.uid;
2646
+ return user;
2647
+ }
2648
+ async sendPasswordResetEmail(email) {
2649
+ return sendPasswordResetEmail(this.firebaseAuth, email);
2650
+ }
2651
+ }
2652
+
2653
+ class RegisterFirebaseAuthService {
2654
+ constructor(firebaseAuth) {
2655
+ this.firebaseAuth = firebaseAuth;
2656
+ }
2657
+ async register(params) {
2658
+ if (!params.email)
2659
+ throw new RequiredArgumentError(['email']);
2660
+ try {
2661
+ const auth = await createUserWithEmailAndPassword(this.firebaseAuth, params.email, params.password);
2662
+ const user = is(auth.user);
2663
+ if (!user)
2664
+ throw new Error('User not created');
2665
+ await sendEmailVerification(user);
2666
+ user.id = user.uid;
2667
+ return user;
2668
+ }
2669
+ catch (error) {
2670
+ if (!(error instanceof Error))
2671
+ throw error;
2672
+ const firebaseError = error;
2673
+ if (firebaseError.code === 'auth/email-already-in-use')
2674
+ throw new UserAlreadyRegisteredError('Email already registered');
2675
+ if (firebaseError.code === 'auth/weak-password')
2676
+ throw new WeakPasswordError();
2677
+ throw error;
2678
+ }
2679
+ }
2680
+ }
2681
+
2612
2682
  const withFirestore = (MixinBase) => {
2613
2683
  const isObjectsAndNoDate = (data) => data &&
2614
2684
  !Array.isArray(data) &&
@@ -3479,72 +3549,14 @@ class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(with
3479
3549
  }
3480
3550
  }
3481
3551
 
3482
- class AuthenticationFirebaseAuthService {
3483
- constructor(firebaseAuth) {
3484
- this.firebaseAuth = firebaseAuth;
3485
- }
3486
- async signInWithEmailAndPassword(data) {
3487
- const credentials = await signInWithEmailAndPassword(this.firebaseAuth, data.email, data.password);
3488
- const user = credentials.user;
3489
- return {
3490
- id: user.uid,
3491
- displayName: user.displayName,
3492
- email: user.email,
3493
- phone: user.phoneNumber,
3494
- isAnonymous: false,
3495
- };
3496
- }
3497
- async signInWithGoogle() {
3498
- const credentials = await signInWithPopup(this.firebaseAuth, new GoogleAuthProvider());
3499
- const user = credentials.user;
3500
- return {
3501
- id: user.uid,
3502
- displayName: user.displayName,
3503
- email: user.email,
3504
- phone: user.phoneNumber,
3505
- isAnonymous: false,
3506
- };
3507
- }
3508
- async signOut() {
3509
- this.firebaseAuth.signOut();
3510
- }
3511
- async signInAnonymously() {
3512
- const auth = await signInAnonymously(this.firebaseAuth);
3513
- const user = auth.user;
3514
- user.id = auth.user.uid;
3515
- return user;
3516
- }
3517
- async sendPasswordResetEmail(email) {
3518
- return sendPasswordResetEmail(this.firebaseAuth, email);
3519
- }
3520
- }
3521
-
3522
- class RegisterFirebaseAuthService {
3523
- constructor(firebaseAuth) {
3524
- this.firebaseAuth = firebaseAuth;
3552
+ class FirebaseFileUploaderService {
3553
+ constructor(storage, baseUrl) {
3554
+ this.storage = storage;
3555
+ this.baseUrl = baseUrl;
3525
3556
  }
3526
- async register(params) {
3527
- if (!params.email)
3528
- throw new RequiredArgumentError(['email']);
3529
- try {
3530
- const auth = await createUserWithEmailAndPassword(this.firebaseAuth, params.email, params.password);
3531
- const user = is(auth.user);
3532
- if (!user)
3533
- throw new Error('User not created');
3534
- await sendEmailVerification(user);
3535
- user.id = user.uid;
3536
- return user;
3537
- }
3538
- catch (error) {
3539
- if (!(error instanceof Error))
3540
- throw error;
3541
- const firebaseError = error;
3542
- if (firebaseError.code === 'auth/email-already-in-use')
3543
- throw new UserAlreadyRegisteredError('Email already registered');
3544
- if (firebaseError.code === 'auth/weak-password')
3545
- throw new WeakPasswordError();
3546
- throw error;
3547
- }
3557
+ async upload(path, file) {
3558
+ const storageRef = ref(this.storage, path);
3559
+ return uploadBytes(storageRef, file).then((reference) => `${this.baseUrl}/${reference.ref.bucket}/${reference.ref.fullPath}`);
3548
3560
  }
3549
3561
  }
3550
3562
 
@@ -4571,18 +4583,24 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4571
4583
  const plainData = this.paramsToPlain({ products });
4572
4584
  if (!plainData.products || plainData.products.length <= 0)
4573
4585
  return [];
4586
+ const category = await this.get({ id: categoryId.toString() });
4574
4587
  await this.mutation('delete_category_product', ['affected_rows'], {
4575
4588
  where: {
4576
4589
  type: 'category_product_bool_exp',
4577
4590
  required: true,
4578
- value: { category_id: { _eq: categoryId } },
4591
+ value: {
4592
+ category_id: { _eq: categoryId },
4593
+ product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
4594
+ },
4579
4595
  },
4580
4596
  });
4581
4597
  await this.mutation('insert_category_product', ['affected_rows'], {
4582
4598
  objects: {
4583
4599
  type: '[category_product_insert_input!]',
4584
4600
  required: true,
4585
- value: plainData.products.map((productId) => ({ category_id: categoryId, product_id: productId })),
4601
+ value: plainData.products
4602
+ .filter((productId) => !category.products.includes(productId))
4603
+ .map((productId) => ({ category_id: categoryId, product_id: productId })),
4586
4604
  },
4587
4605
  });
4588
4606
  return plainData.products;
@@ -4620,15 +4638,14 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4620
4638
  },
4621
4639
  })
4622
4640
  .then((res) => res.data);
4623
- const currentFiltersId = currentFilters.map((f) => f.id);
4641
+ const currentFiltersId = currentFilters.map((f) => f.filterId);
4624
4642
  const filtersUpdatedId = filters.value.map((f) => f.id);
4625
4643
  const filterToBeDeleted = currentFiltersId.filter((c) => !filtersUpdatedId.includes(c));
4626
4644
  const filterToBeInserted = filtersUpdatedId.filter((c) => !currentFiltersId.includes(c));
4627
4645
  for (const filter of filterToBeDeleted) {
4628
4646
  const index = currentFilters.findIndex((f) => f.id == filter);
4629
- if (index != -1) {
4647
+ if (index != -1)
4630
4648
  currentFilters.splice(index, 1);
4631
- }
4632
4649
  await this.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filter);
4633
4650
  }
4634
4651
  for (const filter of filterToBeInserted) {
@@ -5479,6 +5496,10 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5479
5496
  throw new NotFoundError(`Category with id ${identifiers.id} is not a wishlist`);
5480
5497
  return data;
5481
5498
  }
5499
+ async find(params) {
5500
+ const { filters } = params, rest = __rest(params, ["filters"]);
5501
+ return await super.find(Object.assign(Object.assign({}, rest), { filters: Object.assign(Object.assign({}, filters), { isWishlist: { operator: Where.EQUALS, value: true } }) }));
5502
+ }
5482
5503
  async update(params) {
5483
5504
  const { products, id: checkId, metadata, filters } = params, data = __rest(params, ["products", "id", "metadata", "filters"]);
5484
5505
  const plainData = this.paramsToPlain({ id: checkId });
@@ -5537,19 +5558,25 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5537
5558
  const plainData = this.paramsToPlain({ products });
5538
5559
  if (!plainData.products || plainData.products.length <= 0)
5539
5560
  return [];
5561
+ const category = await this.get({ id: categoryId.toString() });
5562
+ await this.categoryFilterRepository.deleteByCategory(categoryId);
5540
5563
  await this.mutation('delete_category_product', ['affected_rows'], {
5541
5564
  where: {
5542
5565
  type: 'category_product_bool_exp',
5543
5566
  required: true,
5544
- value: { category_id: { _eq: categoryId } },
5567
+ value: {
5568
+ category_id: categoryId,
5569
+ product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
5570
+ },
5545
5571
  },
5546
5572
  });
5547
- await this.categoryFilterRepository.deleteByCategory(categoryId);
5548
5573
  await this.mutation('insert_category_product', ['affected_rows'], {
5549
5574
  objects: {
5550
5575
  type: '[category_product_insert_input!]',
5551
5576
  required: true,
5552
- value: plainData.products.map((productId) => ({ category_id: categoryId, product_id: productId })),
5577
+ value: plainData.products
5578
+ .filter((productId) => !category.products.includes(productId))
5579
+ .map((productId) => ({ category_id: categoryId, product_id: productId })),
5553
5580
  },
5554
5581
  });
5555
5582
  return plainData.products;
@@ -5604,4 +5631,4 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5604
5631
  }
5605
5632
  }
5606
5633
 
5607
- export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, Logger, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductReviews, ProductReviewsHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
5634
+ export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, Logger, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductReviews, ProductReviewsHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };