@infrab4a/connect 4.9.7-beta.23 → 4.9.7-beta.25
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.cjs.js +212 -60
- package/index.esm.js +211 -61
- package/package.json +1 -1
- package/src/domain/catalog/models/product-base.d.ts +2 -1
- package/src/domain/catalog/models/types/index.d.ts +1 -0
- package/src/domain/catalog/models/types/product-label.type.d.ts +1 -0
- package/src/domain/catalog/repositories/category.repository.d.ts +1 -1
- package/src/domain/catalog/repositories/wishlist.repository.d.ts +1 -1
- package/src/domain/general/index.d.ts +1 -0
- package/src/domain/general/search/index.d.ts +1 -0
- package/src/domain/general/search/product-search-index.d.ts +3 -0
- package/src/domain/shopping/models/coupons/coupon.d.ts +3 -3
- package/src/domain/shopping/models/coupons/enums/coupon-category.enum.d.ts +14 -0
- package/src/domain/shopping/models/coupons/enums/coupon-types.enum.d.ts +2 -1
- package/src/domain/shopping/models/coupons/enums/index.d.ts +2 -1
- package/src/domain/shopping/models/order.d.ts +4 -0
- package/src/domain/shopping/types/index.d.ts +1 -0
- package/src/domain/shopping/types/order-tracking-events.type.d.ts +14 -0
- package/src/infra/elasticsearch/indexes/products-index.d.ts +37 -1
- package/src/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +1 -1
- package/src/infra/index.d.ts +1 -0
- package/src/infra/vertex-ai/adapters/index.d.ts +2 -0
- package/src/infra/vertex-ai/adapters/vertex-ai-search.adapter.d.ts +10 -0
- package/src/infra/vertex-ai/adapters/vertex-axios.adapter.d.ts +15 -0
- package/src/infra/vertex-ai/index.d.ts +3 -0
- package/src/infra/vertex-ai/indexes/index.d.ts +1 -0
- package/src/infra/vertex-ai/indexes/products-vertex-search.d.ts +13 -0
- package/src/infra/vertex-ai/types/axios-vertex-search-config.d.ts +4 -0
- package/src/infra/vertex-ai/types/index.d.ts +3 -0
- package/src/infra/vertex-ai/types/product-bulk.d.ts +4 -0
- package/src/infra/vertex-ai/types/product-search.d.ts +21 -0
package/index.cjs.js
CHANGED
|
@@ -1843,40 +1843,6 @@ const parseDateTime = (value) => {
|
|
|
1843
1843
|
return date;
|
|
1844
1844
|
};
|
|
1845
1845
|
|
|
1846
|
-
exports.CheckoutTypes = void 0;
|
|
1847
|
-
(function (CheckoutTypes) {
|
|
1848
|
-
CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
|
|
1849
|
-
CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
|
|
1850
|
-
CheckoutTypes[CheckoutTypes["ALL"] = 3] = "ALL";
|
|
1851
|
-
})(exports.CheckoutTypes || (exports.CheckoutTypes = {}));
|
|
1852
|
-
|
|
1853
|
-
exports.CouponTypes = void 0;
|
|
1854
|
-
(function (CouponTypes) {
|
|
1855
|
-
CouponTypes[CouponTypes["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
1856
|
-
CouponTypes[CouponTypes["PERCENTAGE"] = 2] = "PERCENTAGE";
|
|
1857
|
-
// FINANCIAL = 1,
|
|
1858
|
-
// PRODUCT,
|
|
1859
|
-
// GIFTCARD,
|
|
1860
|
-
// VOUCHER,
|
|
1861
|
-
})(exports.CouponTypes || (exports.CouponTypes = {}));
|
|
1862
|
-
|
|
1863
|
-
exports.CouponSubtypes = void 0;
|
|
1864
|
-
(function (CouponSubtypes) {
|
|
1865
|
-
CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
1866
|
-
CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
|
|
1867
|
-
})(exports.CouponSubtypes || (exports.CouponSubtypes = {}));
|
|
1868
|
-
|
|
1869
|
-
exports.Exclusivities = void 0;
|
|
1870
|
-
(function (Exclusivities) {
|
|
1871
|
-
Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
|
|
1872
|
-
Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
|
|
1873
|
-
Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
|
|
1874
|
-
Exclusivities[Exclusivities["ACTIVE_SUBSCRIBER"] = 4] = "ACTIVE_SUBSCRIBER";
|
|
1875
|
-
Exclusivities[Exclusivities["INACTIVE_SUBSCRIBER"] = 5] = "INACTIVE_SUBSCRIBER";
|
|
1876
|
-
Exclusivities[Exclusivities["NON_SUBSCRIBER"] = 6] = "NON_SUBSCRIBER";
|
|
1877
|
-
})(exports.Exclusivities || (exports.Exclusivities = {}));
|
|
1878
|
-
|
|
1879
|
-
const COUPON_EXPIRATION = +1000 * 60 * 60 * 24 * 30;
|
|
1880
1846
|
class Coupon extends BaseModel {
|
|
1881
1847
|
get isInfluencer() {
|
|
1882
1848
|
return !lodash.isNil(this.influencerEmail);
|
|
@@ -1884,30 +1850,6 @@ class Coupon extends BaseModel {
|
|
|
1884
1850
|
static get identifiersFields() {
|
|
1885
1851
|
return ['id'];
|
|
1886
1852
|
}
|
|
1887
|
-
static createCoupon(userId) {
|
|
1888
|
-
return this.toInstance({
|
|
1889
|
-
nickname: `${Date.now()}`,
|
|
1890
|
-
checkoutType: exports.CheckoutTypes.ECOMMERCE,
|
|
1891
|
-
discount: {
|
|
1892
|
-
subscriber: {
|
|
1893
|
-
type: exports.CouponTypes.ABSOLUTE,
|
|
1894
|
-
value: 10,
|
|
1895
|
-
},
|
|
1896
|
-
non_subscriber: {
|
|
1897
|
-
type: exports.CouponTypes.ABSOLUTE,
|
|
1898
|
-
value: 10,
|
|
1899
|
-
},
|
|
1900
|
-
subscription: {
|
|
1901
|
-
type: exports.CouponTypes.ABSOLUTE,
|
|
1902
|
-
value: 10,
|
|
1903
|
-
},
|
|
1904
|
-
},
|
|
1905
|
-
user: userId,
|
|
1906
|
-
createdAt: new Date(Date.now()),
|
|
1907
|
-
beginAt: new Date(Date.now()),
|
|
1908
|
-
expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
|
|
1909
|
-
});
|
|
1910
|
-
}
|
|
1911
1853
|
}
|
|
1912
1854
|
|
|
1913
1855
|
class SubscriptionPlan extends BaseModel {
|
|
@@ -2182,6 +2124,52 @@ tslib.__decorate([
|
|
|
2182
2124
|
tslib.__metadata("design:type", Coupon)
|
|
2183
2125
|
], Checkout.prototype, "coupon", void 0);
|
|
2184
2126
|
|
|
2127
|
+
exports.CouponCategory = void 0;
|
|
2128
|
+
(function (CouponCategory) {
|
|
2129
|
+
CouponCategory["Reembolso"] = "Reembolso";
|
|
2130
|
+
CouponCategory["Desculpas"] = "Desculpas";
|
|
2131
|
+
CouponCategory["BFlu"] = "BFlu";
|
|
2132
|
+
CouponCategory["ROYAL"] = "Royal";
|
|
2133
|
+
CouponCategory["Glamdiva"] = "Glamdiva";
|
|
2134
|
+
CouponCategory["Impulsionamento"] = "Impulsionamento";
|
|
2135
|
+
CouponCategory["PaidMedia"] = "Paid Media";
|
|
2136
|
+
CouponCategory["Organic"] = "Organic";
|
|
2137
|
+
CouponCategory["Direct"] = "Direct";
|
|
2138
|
+
CouponCategory["CRM"] = "CRM";
|
|
2139
|
+
CouponCategory["LOJAUNICO"] = "Loja \u00FAnico";
|
|
2140
|
+
CouponCategory["Outros"] = "Outros";
|
|
2141
|
+
})(exports.CouponCategory || (exports.CouponCategory = {}));
|
|
2142
|
+
|
|
2143
|
+
exports.CouponSubtypes = void 0;
|
|
2144
|
+
(function (CouponSubtypes) {
|
|
2145
|
+
CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
2146
|
+
CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
|
|
2147
|
+
})(exports.CouponSubtypes || (exports.CouponSubtypes = {}));
|
|
2148
|
+
|
|
2149
|
+
exports.CouponTypes = void 0;
|
|
2150
|
+
(function (CouponTypes) {
|
|
2151
|
+
CouponTypes[CouponTypes["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
2152
|
+
CouponTypes[CouponTypes["PERCENTAGE"] = 2] = "PERCENTAGE";
|
|
2153
|
+
CouponTypes[CouponTypes["SHIPPING"] = 3] = "SHIPPING";
|
|
2154
|
+
})(exports.CouponTypes || (exports.CouponTypes = {}));
|
|
2155
|
+
|
|
2156
|
+
exports.Exclusivities = void 0;
|
|
2157
|
+
(function (Exclusivities) {
|
|
2158
|
+
Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
|
|
2159
|
+
Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
|
|
2160
|
+
Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
|
|
2161
|
+
Exclusivities[Exclusivities["ACTIVE_SUBSCRIBER"] = 4] = "ACTIVE_SUBSCRIBER";
|
|
2162
|
+
Exclusivities[Exclusivities["INACTIVE_SUBSCRIBER"] = 5] = "INACTIVE_SUBSCRIBER";
|
|
2163
|
+
Exclusivities[Exclusivities["NON_SUBSCRIBER"] = 6] = "NON_SUBSCRIBER";
|
|
2164
|
+
})(exports.Exclusivities || (exports.Exclusivities = {}));
|
|
2165
|
+
|
|
2166
|
+
exports.CheckoutTypes = void 0;
|
|
2167
|
+
(function (CheckoutTypes) {
|
|
2168
|
+
CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
|
|
2169
|
+
CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
|
|
2170
|
+
CheckoutTypes[CheckoutTypes["ALL"] = 3] = "ALL";
|
|
2171
|
+
})(exports.CheckoutTypes || (exports.CheckoutTypes = {}));
|
|
2172
|
+
|
|
2185
2173
|
exports.OrderStatus = void 0;
|
|
2186
2174
|
(function (OrderStatus) {
|
|
2187
2175
|
OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
|
|
@@ -2596,7 +2584,9 @@ class ProductsIndex {
|
|
|
2596
2584
|
RoundProductPricesHelper.roundProductPrices(hit._source);
|
|
2597
2585
|
return hit;
|
|
2598
2586
|
});
|
|
2599
|
-
return search
|
|
2587
|
+
return search.hits.map((hit) => {
|
|
2588
|
+
return Object.assign(Object.assign({}, hit._source), { stock: hit._source.stock.quantity });
|
|
2589
|
+
});
|
|
2600
2590
|
}
|
|
2601
2591
|
async save(product) {
|
|
2602
2592
|
try {
|
|
@@ -4808,7 +4798,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4808
4798
|
bindPersistData: (value) => ({
|
|
4809
4799
|
filters: { data: value.map((filter) => ({ filter_id: filter.id })) },
|
|
4810
4800
|
}),
|
|
4811
|
-
from: (filters) => (filters === null || filters === void 0 ? void 0 : filters.map((filter) => filter === null || filter === void 0 ? void 0 : filter.filter)) || [],
|
|
4801
|
+
from: (filters) => (filters === null || filters === void 0 ? void 0 : filters.map((filter) => filter === null || filter === void 0 ? void 0 : filter.filter).filter((filter) => filter.enabled)) || [],
|
|
4812
4802
|
},
|
|
4813
4803
|
},
|
|
4814
4804
|
{ createdAt: { columnName: 'created_at' } },
|
|
@@ -5447,6 +5437,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5447
5437
|
{ subscriberPrice: { columnName: 'subscriber_price' } },
|
|
5448
5438
|
'published',
|
|
5449
5439
|
'outlet',
|
|
5440
|
+
'label',
|
|
5450
5441
|
'sku',
|
|
5451
5442
|
{
|
|
5452
5443
|
stock: {
|
|
@@ -6259,6 +6250,12 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6259
6250
|
options: {
|
|
6260
6251
|
enableCount: false,
|
|
6261
6252
|
},
|
|
6253
|
+
orderBy: {
|
|
6254
|
+
id: 'asc',
|
|
6255
|
+
},
|
|
6256
|
+
limits: {
|
|
6257
|
+
limit: 1,
|
|
6258
|
+
},
|
|
6262
6259
|
});
|
|
6263
6260
|
if (!data.length)
|
|
6264
6261
|
throw new NotFoundError(`Wishlists from person ${personId} not found`);
|
|
@@ -6400,6 +6397,159 @@ tslib.__decorate([
|
|
|
6400
6397
|
tslib.__metadata("design:returntype", Promise)
|
|
6401
6398
|
], WishlistHasuraGraphQLRepository.prototype, "findBfluOrGlamgirlWishlists", null);
|
|
6402
6399
|
|
|
6400
|
+
class VertexAxiosAdapter {
|
|
6401
|
+
constructor(config) {
|
|
6402
|
+
this.config = config;
|
|
6403
|
+
this.logger = DebugHelper.from(this);
|
|
6404
|
+
}
|
|
6405
|
+
async query(term, total, gender) {
|
|
6406
|
+
const logger = this.logger.with('query');
|
|
6407
|
+
const req = {
|
|
6408
|
+
url: `${this.config.url}/search`,
|
|
6409
|
+
method: 'POST',
|
|
6410
|
+
responseType: 'json',
|
|
6411
|
+
headers: {
|
|
6412
|
+
Accept: 'application/json',
|
|
6413
|
+
},
|
|
6414
|
+
data: { term, total, gender },
|
|
6415
|
+
};
|
|
6416
|
+
try {
|
|
6417
|
+
const { data } = await axios__default["default"](req);
|
|
6418
|
+
return data;
|
|
6419
|
+
}
|
|
6420
|
+
catch (error) {
|
|
6421
|
+
logger.error({ req, res: error });
|
|
6422
|
+
throw error;
|
|
6423
|
+
}
|
|
6424
|
+
}
|
|
6425
|
+
async get(id) {
|
|
6426
|
+
const logger = this.logger.with('update');
|
|
6427
|
+
const req = {
|
|
6428
|
+
url: `${this.config.url}/${id}`,
|
|
6429
|
+
method: 'GET',
|
|
6430
|
+
responseType: 'json',
|
|
6431
|
+
headers: {
|
|
6432
|
+
Accept: 'application/json',
|
|
6433
|
+
},
|
|
6434
|
+
};
|
|
6435
|
+
try {
|
|
6436
|
+
const { data } = await axios__default["default"](req);
|
|
6437
|
+
return data;
|
|
6438
|
+
}
|
|
6439
|
+
catch (error) {
|
|
6440
|
+
logger.error({ req, res: error });
|
|
6441
|
+
throw error;
|
|
6442
|
+
}
|
|
6443
|
+
}
|
|
6444
|
+
async save(data) {
|
|
6445
|
+
const logger = this.logger.with('save');
|
|
6446
|
+
const req = {
|
|
6447
|
+
url: `${this.config.url}/sync`,
|
|
6448
|
+
method: 'POST',
|
|
6449
|
+
responseType: 'json',
|
|
6450
|
+
headers: {
|
|
6451
|
+
Accept: 'application/json',
|
|
6452
|
+
},
|
|
6453
|
+
data,
|
|
6454
|
+
};
|
|
6455
|
+
try {
|
|
6456
|
+
const { data } = await axios__default["default"](req);
|
|
6457
|
+
return data;
|
|
6458
|
+
}
|
|
6459
|
+
catch (error) {
|
|
6460
|
+
logger.error({ req, res: error });
|
|
6461
|
+
throw error;
|
|
6462
|
+
}
|
|
6463
|
+
}
|
|
6464
|
+
async update(id, data) {
|
|
6465
|
+
const logger = this.logger.with('update');
|
|
6466
|
+
const req = {
|
|
6467
|
+
url: `${this.config.url}/${id}`,
|
|
6468
|
+
method: 'PUT',
|
|
6469
|
+
responseType: 'json',
|
|
6470
|
+
headers: {
|
|
6471
|
+
Accept: 'application/json',
|
|
6472
|
+
},
|
|
6473
|
+
data,
|
|
6474
|
+
};
|
|
6475
|
+
try {
|
|
6476
|
+
const { data } = await axios__default["default"](req);
|
|
6477
|
+
return data;
|
|
6478
|
+
}
|
|
6479
|
+
catch (error) {
|
|
6480
|
+
logger.error({ req, res: error });
|
|
6481
|
+
throw error;
|
|
6482
|
+
}
|
|
6483
|
+
}
|
|
6484
|
+
async delete(id) {
|
|
6485
|
+
const logger = this.logger.with('delete');
|
|
6486
|
+
const req = {
|
|
6487
|
+
url: `${this.config.url}/${id}`,
|
|
6488
|
+
method: 'DELETE',
|
|
6489
|
+
responseType: 'json',
|
|
6490
|
+
headers: {
|
|
6491
|
+
Accept: 'application/json',
|
|
6492
|
+
},
|
|
6493
|
+
};
|
|
6494
|
+
try {
|
|
6495
|
+
const { data } = await axios__default["default"](req);
|
|
6496
|
+
return data;
|
|
6497
|
+
}
|
|
6498
|
+
catch (error) {
|
|
6499
|
+
logger.error({ req, res: error });
|
|
6500
|
+
throw error;
|
|
6501
|
+
}
|
|
6502
|
+
}
|
|
6503
|
+
bulkProducts(products) {
|
|
6504
|
+
return;
|
|
6505
|
+
}
|
|
6506
|
+
}
|
|
6507
|
+
|
|
6508
|
+
class ProductsVertexSearch {
|
|
6509
|
+
constructor(adapter) {
|
|
6510
|
+
this.adapter = adapter;
|
|
6511
|
+
}
|
|
6512
|
+
async getById(id) {
|
|
6513
|
+
const data = await this.adapter.get(id);
|
|
6514
|
+
return data;
|
|
6515
|
+
}
|
|
6516
|
+
async search(searchTerm, total, gender) {
|
|
6517
|
+
try {
|
|
6518
|
+
const result = await this.adapter.query(searchTerm, total, gender);
|
|
6519
|
+
return result;
|
|
6520
|
+
}
|
|
6521
|
+
catch (error) {
|
|
6522
|
+
console.error(error);
|
|
6523
|
+
}
|
|
6524
|
+
}
|
|
6525
|
+
async save(product) {
|
|
6526
|
+
try {
|
|
6527
|
+
const _a = product.toPlain(), { createdAt, updatedAt, kitProducts } = _a, data = tslib.__rest(_a, ["createdAt", "updatedAt", "kitProducts"]);
|
|
6528
|
+
const newProduct = Product.toInstance(data);
|
|
6529
|
+
await this.adapter.save(newProduct);
|
|
6530
|
+
}
|
|
6531
|
+
catch (error) {
|
|
6532
|
+
console.error(error);
|
|
6533
|
+
}
|
|
6534
|
+
}
|
|
6535
|
+
async update(product) {
|
|
6536
|
+
try {
|
|
6537
|
+
await this.adapter.update(product.id, product);
|
|
6538
|
+
}
|
|
6539
|
+
catch (error) {
|
|
6540
|
+
console.error(error);
|
|
6541
|
+
}
|
|
6542
|
+
}
|
|
6543
|
+
async delete(id) {
|
|
6544
|
+
try {
|
|
6545
|
+
await this.adapter.delete(id);
|
|
6546
|
+
}
|
|
6547
|
+
catch (error) {
|
|
6548
|
+
console.error(error);
|
|
6549
|
+
}
|
|
6550
|
+
}
|
|
6551
|
+
}
|
|
6552
|
+
|
|
6403
6553
|
Object.defineProperty(exports, 'add', {
|
|
6404
6554
|
enumerable: true,
|
|
6405
6555
|
get: function () { return dateFns.add; }
|
|
@@ -6589,6 +6739,7 @@ exports.ProductStockNotification = ProductStockNotification;
|
|
|
6589
6739
|
exports.ProductStockNotificationHasuraGraphQLRepository = ProductStockNotificationHasuraGraphQLRepository;
|
|
6590
6740
|
exports.ProductVariantFirestoreRepository = ProductVariantFirestoreRepository;
|
|
6591
6741
|
exports.ProductsIndex = ProductsIndex;
|
|
6742
|
+
exports.ProductsVertexSearch = ProductsVertexSearch;
|
|
6592
6743
|
exports.RecoveryPassword = RecoveryPassword;
|
|
6593
6744
|
exports.ReflectHelper = ReflectHelper;
|
|
6594
6745
|
exports.Register = Register;
|
|
@@ -6627,6 +6778,7 @@ exports.UserPaymentMethodFirestoreRepository = UserPaymentMethodFirestoreReposit
|
|
|
6627
6778
|
exports.Variant = Variant;
|
|
6628
6779
|
exports.VariantHasuraGraphQL = VariantHasuraGraphQL;
|
|
6629
6780
|
exports.VariantHasuraGraphQLRepository = VariantHasuraGraphQLRepository;
|
|
6781
|
+
exports.VertexAxiosAdapter = VertexAxiosAdapter;
|
|
6630
6782
|
exports.WeakPasswordError = WeakPasswordError;
|
|
6631
6783
|
exports.Wishlist = Wishlist;
|
|
6632
6784
|
exports.WishlistHasuraGraphQLRepository = WishlistHasuraGraphQLRepository;
|
package/index.esm.js
CHANGED
|
@@ -1837,40 +1837,6 @@ const parseDateTime = (value) => {
|
|
|
1837
1837
|
return date;
|
|
1838
1838
|
};
|
|
1839
1839
|
|
|
1840
|
-
var CheckoutTypes;
|
|
1841
|
-
(function (CheckoutTypes) {
|
|
1842
|
-
CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
|
|
1843
|
-
CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
|
|
1844
|
-
CheckoutTypes[CheckoutTypes["ALL"] = 3] = "ALL";
|
|
1845
|
-
})(CheckoutTypes || (CheckoutTypes = {}));
|
|
1846
|
-
|
|
1847
|
-
var CouponTypes;
|
|
1848
|
-
(function (CouponTypes) {
|
|
1849
|
-
CouponTypes[CouponTypes["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
1850
|
-
CouponTypes[CouponTypes["PERCENTAGE"] = 2] = "PERCENTAGE";
|
|
1851
|
-
// FINANCIAL = 1,
|
|
1852
|
-
// PRODUCT,
|
|
1853
|
-
// GIFTCARD,
|
|
1854
|
-
// VOUCHER,
|
|
1855
|
-
})(CouponTypes || (CouponTypes = {}));
|
|
1856
|
-
|
|
1857
|
-
var CouponSubtypes;
|
|
1858
|
-
(function (CouponSubtypes) {
|
|
1859
|
-
CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
1860
|
-
CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
|
|
1861
|
-
})(CouponSubtypes || (CouponSubtypes = {}));
|
|
1862
|
-
|
|
1863
|
-
var Exclusivities;
|
|
1864
|
-
(function (Exclusivities) {
|
|
1865
|
-
Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
|
|
1866
|
-
Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
|
|
1867
|
-
Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
|
|
1868
|
-
Exclusivities[Exclusivities["ACTIVE_SUBSCRIBER"] = 4] = "ACTIVE_SUBSCRIBER";
|
|
1869
|
-
Exclusivities[Exclusivities["INACTIVE_SUBSCRIBER"] = 5] = "INACTIVE_SUBSCRIBER";
|
|
1870
|
-
Exclusivities[Exclusivities["NON_SUBSCRIBER"] = 6] = "NON_SUBSCRIBER";
|
|
1871
|
-
})(Exclusivities || (Exclusivities = {}));
|
|
1872
|
-
|
|
1873
|
-
const COUPON_EXPIRATION = +1000 * 60 * 60 * 24 * 30;
|
|
1874
1840
|
class Coupon extends BaseModel {
|
|
1875
1841
|
get isInfluencer() {
|
|
1876
1842
|
return !isNil(this.influencerEmail);
|
|
@@ -1878,30 +1844,6 @@ class Coupon extends BaseModel {
|
|
|
1878
1844
|
static get identifiersFields() {
|
|
1879
1845
|
return ['id'];
|
|
1880
1846
|
}
|
|
1881
|
-
static createCoupon(userId) {
|
|
1882
|
-
return this.toInstance({
|
|
1883
|
-
nickname: `${Date.now()}`,
|
|
1884
|
-
checkoutType: CheckoutTypes.ECOMMERCE,
|
|
1885
|
-
discount: {
|
|
1886
|
-
subscriber: {
|
|
1887
|
-
type: CouponTypes.ABSOLUTE,
|
|
1888
|
-
value: 10,
|
|
1889
|
-
},
|
|
1890
|
-
non_subscriber: {
|
|
1891
|
-
type: CouponTypes.ABSOLUTE,
|
|
1892
|
-
value: 10,
|
|
1893
|
-
},
|
|
1894
|
-
subscription: {
|
|
1895
|
-
type: CouponTypes.ABSOLUTE,
|
|
1896
|
-
value: 10,
|
|
1897
|
-
},
|
|
1898
|
-
},
|
|
1899
|
-
user: userId,
|
|
1900
|
-
createdAt: new Date(Date.now()),
|
|
1901
|
-
beginAt: new Date(Date.now()),
|
|
1902
|
-
expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
|
|
1903
|
-
});
|
|
1904
|
-
}
|
|
1905
1847
|
}
|
|
1906
1848
|
|
|
1907
1849
|
class SubscriptionPlan extends BaseModel {
|
|
@@ -2176,6 +2118,52 @@ __decorate([
|
|
|
2176
2118
|
__metadata("design:type", Coupon)
|
|
2177
2119
|
], Checkout.prototype, "coupon", void 0);
|
|
2178
2120
|
|
|
2121
|
+
var CouponCategory;
|
|
2122
|
+
(function (CouponCategory) {
|
|
2123
|
+
CouponCategory["Reembolso"] = "Reembolso";
|
|
2124
|
+
CouponCategory["Desculpas"] = "Desculpas";
|
|
2125
|
+
CouponCategory["BFlu"] = "BFlu";
|
|
2126
|
+
CouponCategory["ROYAL"] = "Royal";
|
|
2127
|
+
CouponCategory["Glamdiva"] = "Glamdiva";
|
|
2128
|
+
CouponCategory["Impulsionamento"] = "Impulsionamento";
|
|
2129
|
+
CouponCategory["PaidMedia"] = "Paid Media";
|
|
2130
|
+
CouponCategory["Organic"] = "Organic";
|
|
2131
|
+
CouponCategory["Direct"] = "Direct";
|
|
2132
|
+
CouponCategory["CRM"] = "CRM";
|
|
2133
|
+
CouponCategory["LOJAUNICO"] = "Loja \u00FAnico";
|
|
2134
|
+
CouponCategory["Outros"] = "Outros";
|
|
2135
|
+
})(CouponCategory || (CouponCategory = {}));
|
|
2136
|
+
|
|
2137
|
+
var CouponSubtypes;
|
|
2138
|
+
(function (CouponSubtypes) {
|
|
2139
|
+
CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
2140
|
+
CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
|
|
2141
|
+
})(CouponSubtypes || (CouponSubtypes = {}));
|
|
2142
|
+
|
|
2143
|
+
var CouponTypes;
|
|
2144
|
+
(function (CouponTypes) {
|
|
2145
|
+
CouponTypes[CouponTypes["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
2146
|
+
CouponTypes[CouponTypes["PERCENTAGE"] = 2] = "PERCENTAGE";
|
|
2147
|
+
CouponTypes[CouponTypes["SHIPPING"] = 3] = "SHIPPING";
|
|
2148
|
+
})(CouponTypes || (CouponTypes = {}));
|
|
2149
|
+
|
|
2150
|
+
var Exclusivities;
|
|
2151
|
+
(function (Exclusivities) {
|
|
2152
|
+
Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
|
|
2153
|
+
Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
|
|
2154
|
+
Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
|
|
2155
|
+
Exclusivities[Exclusivities["ACTIVE_SUBSCRIBER"] = 4] = "ACTIVE_SUBSCRIBER";
|
|
2156
|
+
Exclusivities[Exclusivities["INACTIVE_SUBSCRIBER"] = 5] = "INACTIVE_SUBSCRIBER";
|
|
2157
|
+
Exclusivities[Exclusivities["NON_SUBSCRIBER"] = 6] = "NON_SUBSCRIBER";
|
|
2158
|
+
})(Exclusivities || (Exclusivities = {}));
|
|
2159
|
+
|
|
2160
|
+
var CheckoutTypes;
|
|
2161
|
+
(function (CheckoutTypes) {
|
|
2162
|
+
CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
|
|
2163
|
+
CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
|
|
2164
|
+
CheckoutTypes[CheckoutTypes["ALL"] = 3] = "ALL";
|
|
2165
|
+
})(CheckoutTypes || (CheckoutTypes = {}));
|
|
2166
|
+
|
|
2179
2167
|
var OrderStatus;
|
|
2180
2168
|
(function (OrderStatus) {
|
|
2181
2169
|
OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
|
|
@@ -2590,7 +2578,9 @@ class ProductsIndex {
|
|
|
2590
2578
|
RoundProductPricesHelper.roundProductPrices(hit._source);
|
|
2591
2579
|
return hit;
|
|
2592
2580
|
});
|
|
2593
|
-
return search
|
|
2581
|
+
return search.hits.map((hit) => {
|
|
2582
|
+
return Object.assign(Object.assign({}, hit._source), { stock: hit._source.stock.quantity });
|
|
2583
|
+
});
|
|
2594
2584
|
}
|
|
2595
2585
|
async save(product) {
|
|
2596
2586
|
try {
|
|
@@ -4802,7 +4792,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4802
4792
|
bindPersistData: (value) => ({
|
|
4803
4793
|
filters: { data: value.map((filter) => ({ filter_id: filter.id })) },
|
|
4804
4794
|
}),
|
|
4805
|
-
from: (filters) => (filters === null || filters === void 0 ? void 0 : filters.map((filter) => filter === null || filter === void 0 ? void 0 : filter.filter)) || [],
|
|
4795
|
+
from: (filters) => (filters === null || filters === void 0 ? void 0 : filters.map((filter) => filter === null || filter === void 0 ? void 0 : filter.filter).filter((filter) => filter.enabled)) || [],
|
|
4806
4796
|
},
|
|
4807
4797
|
},
|
|
4808
4798
|
{ createdAt: { columnName: 'created_at' } },
|
|
@@ -5441,6 +5431,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5441
5431
|
{ subscriberPrice: { columnName: 'subscriber_price' } },
|
|
5442
5432
|
'published',
|
|
5443
5433
|
'outlet',
|
|
5434
|
+
'label',
|
|
5444
5435
|
'sku',
|
|
5445
5436
|
{
|
|
5446
5437
|
stock: {
|
|
@@ -6253,6 +6244,12 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6253
6244
|
options: {
|
|
6254
6245
|
enableCount: false,
|
|
6255
6246
|
},
|
|
6247
|
+
orderBy: {
|
|
6248
|
+
id: 'asc',
|
|
6249
|
+
},
|
|
6250
|
+
limits: {
|
|
6251
|
+
limit: 1,
|
|
6252
|
+
},
|
|
6256
6253
|
});
|
|
6257
6254
|
if (!data.length)
|
|
6258
6255
|
throw new NotFoundError(`Wishlists from person ${personId} not found`);
|
|
@@ -6394,4 +6391,157 @@ __decorate([
|
|
|
6394
6391
|
__metadata("design:returntype", Promise)
|
|
6395
6392
|
], WishlistHasuraGraphQLRepository.prototype, "findBfluOrGlamgirlWishlists", null);
|
|
6396
6393
|
|
|
6397
|
-
|
|
6394
|
+
class VertexAxiosAdapter {
|
|
6395
|
+
constructor(config) {
|
|
6396
|
+
this.config = config;
|
|
6397
|
+
this.logger = DebugHelper.from(this);
|
|
6398
|
+
}
|
|
6399
|
+
async query(term, total, gender) {
|
|
6400
|
+
const logger = this.logger.with('query');
|
|
6401
|
+
const req = {
|
|
6402
|
+
url: `${this.config.url}/search`,
|
|
6403
|
+
method: 'POST',
|
|
6404
|
+
responseType: 'json',
|
|
6405
|
+
headers: {
|
|
6406
|
+
Accept: 'application/json',
|
|
6407
|
+
},
|
|
6408
|
+
data: { term, total, gender },
|
|
6409
|
+
};
|
|
6410
|
+
try {
|
|
6411
|
+
const { data } = await axios(req);
|
|
6412
|
+
return data;
|
|
6413
|
+
}
|
|
6414
|
+
catch (error) {
|
|
6415
|
+
logger.error({ req, res: error });
|
|
6416
|
+
throw error;
|
|
6417
|
+
}
|
|
6418
|
+
}
|
|
6419
|
+
async get(id) {
|
|
6420
|
+
const logger = this.logger.with('update');
|
|
6421
|
+
const req = {
|
|
6422
|
+
url: `${this.config.url}/${id}`,
|
|
6423
|
+
method: 'GET',
|
|
6424
|
+
responseType: 'json',
|
|
6425
|
+
headers: {
|
|
6426
|
+
Accept: 'application/json',
|
|
6427
|
+
},
|
|
6428
|
+
};
|
|
6429
|
+
try {
|
|
6430
|
+
const { data } = await axios(req);
|
|
6431
|
+
return data;
|
|
6432
|
+
}
|
|
6433
|
+
catch (error) {
|
|
6434
|
+
logger.error({ req, res: error });
|
|
6435
|
+
throw error;
|
|
6436
|
+
}
|
|
6437
|
+
}
|
|
6438
|
+
async save(data) {
|
|
6439
|
+
const logger = this.logger.with('save');
|
|
6440
|
+
const req = {
|
|
6441
|
+
url: `${this.config.url}/sync`,
|
|
6442
|
+
method: 'POST',
|
|
6443
|
+
responseType: 'json',
|
|
6444
|
+
headers: {
|
|
6445
|
+
Accept: 'application/json',
|
|
6446
|
+
},
|
|
6447
|
+
data,
|
|
6448
|
+
};
|
|
6449
|
+
try {
|
|
6450
|
+
const { data } = await axios(req);
|
|
6451
|
+
return data;
|
|
6452
|
+
}
|
|
6453
|
+
catch (error) {
|
|
6454
|
+
logger.error({ req, res: error });
|
|
6455
|
+
throw error;
|
|
6456
|
+
}
|
|
6457
|
+
}
|
|
6458
|
+
async update(id, data) {
|
|
6459
|
+
const logger = this.logger.with('update');
|
|
6460
|
+
const req = {
|
|
6461
|
+
url: `${this.config.url}/${id}`,
|
|
6462
|
+
method: 'PUT',
|
|
6463
|
+
responseType: 'json',
|
|
6464
|
+
headers: {
|
|
6465
|
+
Accept: 'application/json',
|
|
6466
|
+
},
|
|
6467
|
+
data,
|
|
6468
|
+
};
|
|
6469
|
+
try {
|
|
6470
|
+
const { data } = await axios(req);
|
|
6471
|
+
return data;
|
|
6472
|
+
}
|
|
6473
|
+
catch (error) {
|
|
6474
|
+
logger.error({ req, res: error });
|
|
6475
|
+
throw error;
|
|
6476
|
+
}
|
|
6477
|
+
}
|
|
6478
|
+
async delete(id) {
|
|
6479
|
+
const logger = this.logger.with('delete');
|
|
6480
|
+
const req = {
|
|
6481
|
+
url: `${this.config.url}/${id}`,
|
|
6482
|
+
method: 'DELETE',
|
|
6483
|
+
responseType: 'json',
|
|
6484
|
+
headers: {
|
|
6485
|
+
Accept: 'application/json',
|
|
6486
|
+
},
|
|
6487
|
+
};
|
|
6488
|
+
try {
|
|
6489
|
+
const { data } = await axios(req);
|
|
6490
|
+
return data;
|
|
6491
|
+
}
|
|
6492
|
+
catch (error) {
|
|
6493
|
+
logger.error({ req, res: error });
|
|
6494
|
+
throw error;
|
|
6495
|
+
}
|
|
6496
|
+
}
|
|
6497
|
+
bulkProducts(products) {
|
|
6498
|
+
return;
|
|
6499
|
+
}
|
|
6500
|
+
}
|
|
6501
|
+
|
|
6502
|
+
class ProductsVertexSearch {
|
|
6503
|
+
constructor(adapter) {
|
|
6504
|
+
this.adapter = adapter;
|
|
6505
|
+
}
|
|
6506
|
+
async getById(id) {
|
|
6507
|
+
const data = await this.adapter.get(id);
|
|
6508
|
+
return data;
|
|
6509
|
+
}
|
|
6510
|
+
async search(searchTerm, total, gender) {
|
|
6511
|
+
try {
|
|
6512
|
+
const result = await this.adapter.query(searchTerm, total, gender);
|
|
6513
|
+
return result;
|
|
6514
|
+
}
|
|
6515
|
+
catch (error) {
|
|
6516
|
+
console.error(error);
|
|
6517
|
+
}
|
|
6518
|
+
}
|
|
6519
|
+
async save(product) {
|
|
6520
|
+
try {
|
|
6521
|
+
const _a = product.toPlain(), { createdAt, updatedAt, kitProducts } = _a, data = __rest(_a, ["createdAt", "updatedAt", "kitProducts"]);
|
|
6522
|
+
const newProduct = Product.toInstance(data);
|
|
6523
|
+
await this.adapter.save(newProduct);
|
|
6524
|
+
}
|
|
6525
|
+
catch (error) {
|
|
6526
|
+
console.error(error);
|
|
6527
|
+
}
|
|
6528
|
+
}
|
|
6529
|
+
async update(product) {
|
|
6530
|
+
try {
|
|
6531
|
+
await this.adapter.update(product.id, product);
|
|
6532
|
+
}
|
|
6533
|
+
catch (error) {
|
|
6534
|
+
console.error(error);
|
|
6535
|
+
}
|
|
6536
|
+
}
|
|
6537
|
+
async delete(id) {
|
|
6538
|
+
try {
|
|
6539
|
+
await this.adapter.delete(id);
|
|
6540
|
+
}
|
|
6541
|
+
catch (error) {
|
|
6542
|
+
console.error(error);
|
|
6543
|
+
}
|
|
6544
|
+
}
|
|
6545
|
+
}
|
|
6546
|
+
|
|
6547
|
+
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, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponCategory, 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, OrderBlocked, OrderBlockedFirestoreRepository, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, PersonTypes, Plans, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductReviews, ProductReviewsHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, ProductsVertexSearch, 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, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, VertexAxiosAdapter, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseModel, GenericIdentifier, ModelBaseStructure } from '../../generic/model';
|
|
2
|
-
import { ProductEvaluation, ProductGender, ProductMetadata, ProductReview, ShopDescription, ShopPrice, Stock } from './types';
|
|
2
|
+
import { ProductEvaluation, ProductGender, ProductLabel, ProductMetadata, ProductReview, ShopDescription, ShopPrice, Stock } from './types';
|
|
3
3
|
import { Variant } from './variant';
|
|
4
4
|
export declare class ProductBase<ChildProduct extends ModelBaseStructure<ChildProduct, Identifiers>, Identifiers = ChildProduct['identifiersFields']> extends BaseModel<ChildProduct, Identifiers> {
|
|
5
5
|
id: string;
|
|
@@ -34,6 +34,7 @@ export declare class ProductBase<ChildProduct extends ModelBaseStructure<ChildPr
|
|
|
34
34
|
shoppingCount?: number;
|
|
35
35
|
metadata: ProductMetadata;
|
|
36
36
|
outlet?: boolean;
|
|
37
|
+
label?: ProductLabel;
|
|
37
38
|
private reviewsTotal?;
|
|
38
39
|
get evaluation(): ProductEvaluation;
|
|
39
40
|
set evaluation(evaluation: ProductEvaluation);
|
|
@@ -5,6 +5,7 @@ export * from './category-most-relevant.type';
|
|
|
5
5
|
export * from './category-product';
|
|
6
6
|
export * from './product-evaluation.type';
|
|
7
7
|
export * from './product-gender.type';
|
|
8
|
+
export * from './product-label.type';
|
|
8
9
|
export * from './product-metadata.type';
|
|
9
10
|
export * from './product-review.type';
|
|
10
11
|
export * from './report-stock-notification.type';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ProductLabel = 'outlet' | 'on-sale' | 'last-units' | 'glamstar';
|
|
@@ -2,7 +2,7 @@ import { CrudRepository } from '../../generic/repository/crud.repository';
|
|
|
2
2
|
import { Product } from '../models';
|
|
3
3
|
import { Category } from '../models/category';
|
|
4
4
|
import { Shops } from '../models/enums/shops.enum';
|
|
5
|
-
export interface CategoryRepository extends CrudRepository<
|
|
5
|
+
export interface CategoryRepository<T extends Category = Category> extends CrudRepository<T> {
|
|
6
6
|
getCategoryBySlug(slug: string, shop: Shops): Promise<Category>;
|
|
7
7
|
getCategoryByShop(shop: string): Promise<Category[]>;
|
|
8
8
|
getCategoriesForHome(categoryIds: string[], limit?: number, gender?: string): Promise<{
|
|
@@ -2,7 +2,7 @@ import { CategoryRepository } from '.';
|
|
|
2
2
|
import { FindRepositoryParams, RepositoryFindResult } from '../../generic';
|
|
3
3
|
import { Shops } from '../models';
|
|
4
4
|
import { Wishlist } from '../models/wishlist';
|
|
5
|
-
export interface WishlistRepository extends CategoryRepository {
|
|
5
|
+
export interface WishlistRepository extends CategoryRepository<Wishlist> {
|
|
6
6
|
getWishlistBySlug(slug: string): Promise<Wishlist>;
|
|
7
7
|
getWishlistByPerson(personId: string): Promise<Wishlist[]>;
|
|
8
8
|
findBfluOrGlamgirlWishlists(params: FindRepositoryParams<Wishlist>, shops: Shops[]): Promise<RepositoryFindResult<Wishlist>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './product-search-index';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Shops } from '../../../catalog/models/enums/shops.enum';
|
|
2
2
|
import { BaseModel, GenericIdentifier } from '../../../generic/model/base.model';
|
|
3
3
|
import { CheckoutTypes } from '../enums/checkout-types.enum';
|
|
4
|
-
import { CouponTypes, Exclusivities } from './enums';
|
|
4
|
+
import { CouponCategory, CouponTypes, Exclusivities } from './enums';
|
|
5
5
|
import { ClubeDaMensPlan } from './enums/coupon-club-mens.enum';
|
|
6
6
|
export declare class Coupon extends BaseModel<Coupon> {
|
|
7
7
|
id: string;
|
|
8
|
-
category?:
|
|
8
|
+
category?: CouponCategory;
|
|
9
9
|
discount: {
|
|
10
10
|
subscriber: {
|
|
11
11
|
type: CouponTypes;
|
|
@@ -48,6 +48,7 @@ export declare class Coupon extends BaseModel<Coupon> {
|
|
|
48
48
|
expiresIn?: Date;
|
|
49
49
|
shopAvailability: Shops;
|
|
50
50
|
personId?: number;
|
|
51
|
+
personEmail?: string;
|
|
51
52
|
influencerEmail?: string;
|
|
52
53
|
plan?: ClubeDaMensPlan;
|
|
53
54
|
productsCategories: string[];
|
|
@@ -59,5 +60,4 @@ export declare class Coupon extends BaseModel<Coupon> {
|
|
|
59
60
|
exclusivityType?: Exclusivities[];
|
|
60
61
|
get isInfluencer(): boolean;
|
|
61
62
|
static get identifiersFields(): GenericIdentifier[];
|
|
62
|
-
static createCoupon(userId: string): Coupon;
|
|
63
63
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare enum CouponCategory {
|
|
2
|
+
Reembolso = "Reembolso",
|
|
3
|
+
Desculpas = "Desculpas",
|
|
4
|
+
BFlu = "BFlu",
|
|
5
|
+
ROYAL = "Royal",
|
|
6
|
+
Glamdiva = "Glamdiva",
|
|
7
|
+
Impulsionamento = "Impulsionamento",
|
|
8
|
+
PaidMedia = "Paid Media",
|
|
9
|
+
Organic = "Organic",
|
|
10
|
+
Direct = "Direct",
|
|
11
|
+
CRM = "CRM",
|
|
12
|
+
LOJAUNICO = "Loja \u00FAnico",
|
|
13
|
+
Outros = "Outros"
|
|
14
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OrderTrackingEvent } from '../types';
|
|
1
2
|
import { Checkout } from './checkout';
|
|
2
3
|
import { OrderStatus } from './enums/order-status.enum';
|
|
3
4
|
import { Payment } from './payment';
|
|
@@ -6,5 +7,8 @@ export declare class Order extends Checkout {
|
|
|
6
7
|
orderNumber?: string;
|
|
7
8
|
trackingCode?: string;
|
|
8
9
|
trackingUrl?: string;
|
|
10
|
+
sentAt?: string;
|
|
11
|
+
deliveredAt?: string;
|
|
12
|
+
trackingEvents?: OrderTrackingEvent[];
|
|
9
13
|
payment: Payment;
|
|
10
14
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type OrderTrackingEvent = {
|
|
2
|
+
cnpj?: string;
|
|
3
|
+
eventCategory?: string;
|
|
4
|
+
eventDate?: string;
|
|
5
|
+
eventDescription?: string;
|
|
6
|
+
eventTime?: string;
|
|
7
|
+
invoiceNumber?: string;
|
|
8
|
+
observation?: string;
|
|
9
|
+
proofUrl?: string;
|
|
10
|
+
receiverDocument?: string;
|
|
11
|
+
receiverName?: string;
|
|
12
|
+
receiverRelationship?: string;
|
|
13
|
+
shippingCompanyName?: string;
|
|
14
|
+
};
|
|
@@ -6,7 +6,43 @@ export declare class ProductsIndex {
|
|
|
6
6
|
private index;
|
|
7
7
|
constructor(adapter: ElasticSearchAdapter<Product>);
|
|
8
8
|
getById(id: string): Promise<Product>;
|
|
9
|
-
search(searchTerm: string, total: number, shop?: string): Promise<
|
|
9
|
+
search(searchTerm: string, total: number, shop?: string): Promise<{
|
|
10
|
+
stock: number;
|
|
11
|
+
category: import("../../../domain/catalog/models/category-for-product").CategoryForProduct;
|
|
12
|
+
kitProducts?: import("../../../domain").KitProduct[];
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
slug: string;
|
|
16
|
+
description: import("../../../domain").ShopDescription;
|
|
17
|
+
sku: string;
|
|
18
|
+
price: import("../../../domain").ShopPrice;
|
|
19
|
+
hasVariants: boolean;
|
|
20
|
+
NCM: string;
|
|
21
|
+
EAN: string;
|
|
22
|
+
CEST: string;
|
|
23
|
+
weight: number;
|
|
24
|
+
costPrice: number;
|
|
25
|
+
images?: string[];
|
|
26
|
+
miniatures?: string[];
|
|
27
|
+
published: boolean;
|
|
28
|
+
createdAt?: Date;
|
|
29
|
+
updatedAt?: Date;
|
|
30
|
+
brand: string;
|
|
31
|
+
tags?: string[];
|
|
32
|
+
filters?: string[];
|
|
33
|
+
type?: string;
|
|
34
|
+
categories?: string[];
|
|
35
|
+
reviews?: import("../../../domain").ProductReview[];
|
|
36
|
+
variants?: import("../../../domain").Variant[];
|
|
37
|
+
video?: string;
|
|
38
|
+
isKit?: boolean;
|
|
39
|
+
rate?: number;
|
|
40
|
+
gender?: import("../../../domain").ProductGender;
|
|
41
|
+
shoppingCount?: number;
|
|
42
|
+
metadata: import("../../../domain").ProductMetadata;
|
|
43
|
+
outlet?: boolean;
|
|
44
|
+
label?: import("../../../domain").ProductLabel;
|
|
45
|
+
}[]>;
|
|
10
46
|
save(product: ProductHasuraGraphQL): Promise<void>;
|
|
11
47
|
update(product: ProductHasuraGraphQL): Promise<void>;
|
|
12
48
|
delete(id: string): Promise<void>;
|
|
@@ -5,7 +5,7 @@ import { FirestoreRepository, FirestoreSubRepository } from '../types';
|
|
|
5
5
|
export declare const withHelpers: <TMixinBase extends MixinCtor = MixinCtor>(MixinBase: MixinCtor & TMixinBase) => {
|
|
6
6
|
new (...args: any[]): {
|
|
7
7
|
[x: string]: any;
|
|
8
|
-
toArray<T extends ModelBaseStructure<T>>(snapShot: QuerySnapshot<T, import("
|
|
8
|
+
toArray<T extends ModelBaseStructure<T>>(snapShot: QuerySnapshot<T, import("firebase/firestore").DocumentData> | QueryDocumentSnapshot<T, import("firebase/firestore").DocumentData>[]): T[];
|
|
9
9
|
isSubCollection<T_1 extends ModelBaseStructure<T_1>, E extends ModelBaseStructure<E>>(repository: FirestoreRepository<T_1> | FirestoreSubRepository<T_1, E>): repository is FirestoreSubRepository<T_1, E>;
|
|
10
10
|
};
|
|
11
11
|
} & TMixinBase;
|
package/src/infra/index.d.ts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Product } from '../../../domain';
|
|
2
|
+
import { ProductBulk } from '../types';
|
|
3
|
+
export interface VertexSearchAdapter<T> {
|
|
4
|
+
query(searchTerm: string, total: number, gender?: String): Promise<T[]>;
|
|
5
|
+
get(id: string): Promise<T>;
|
|
6
|
+
save(data: Product): Promise<any>;
|
|
7
|
+
update(id: string, data: Product): Promise<any>;
|
|
8
|
+
delete(id: string): Promise<void>;
|
|
9
|
+
bulkProducts(products: ProductBulk[]): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Product } from '../../../domain';
|
|
2
|
+
import { ProductBulk, ProductSearch } from '../types';
|
|
3
|
+
import { VertexSearchConfig } from '../types/axios-vertex-search-config';
|
|
4
|
+
import { VertexSearchAdapter } from './vertex-ai-search.adapter';
|
|
5
|
+
export declare class VertexAxiosAdapter implements VertexSearchAdapter<ProductSearch> {
|
|
6
|
+
private readonly config;
|
|
7
|
+
private logger;
|
|
8
|
+
constructor(config: VertexSearchConfig);
|
|
9
|
+
query(term: string, total: number, gender?: String): Promise<ProductSearch[]>;
|
|
10
|
+
get(id: string): Promise<ProductSearch>;
|
|
11
|
+
save(data: Product): Promise<any>;
|
|
12
|
+
update(id: string, data: Product): Promise<any>;
|
|
13
|
+
delete(id: string): Promise<void>;
|
|
14
|
+
bulkProducts(products: ProductBulk[]): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './products-vertex-search';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ProductSearchIndex } from '../../../domain';
|
|
2
|
+
import { ProductHasuraGraphQL } from '../../hasura-graphql';
|
|
3
|
+
import { VertexSearchAdapter } from '../adapters';
|
|
4
|
+
import { ProductSearch } from '../types';
|
|
5
|
+
export declare class ProductsVertexSearch implements ProductSearchIndex {
|
|
6
|
+
private readonly adapter;
|
|
7
|
+
constructor(adapter: VertexSearchAdapter<ProductSearch>);
|
|
8
|
+
getById(id: string): Promise<ProductSearch>;
|
|
9
|
+
search<ProductSearch>(searchTerm: string, total: number, gender?: String): Promise<ProductSearch[]>;
|
|
10
|
+
save(product: ProductHasuraGraphQL): Promise<void>;
|
|
11
|
+
update(product: ProductHasuraGraphQL): Promise<void>;
|
|
12
|
+
delete(id: string): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type ProductSearch = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
ean?: string;
|
|
5
|
+
sku: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
miniatures?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
slug: string;
|
|
10
|
+
brand: string;
|
|
11
|
+
published: boolean;
|
|
12
|
+
gender: string;
|
|
13
|
+
shoppingCount: number;
|
|
14
|
+
stock: number;
|
|
15
|
+
rating: number;
|
|
16
|
+
fullPrice: number;
|
|
17
|
+
price: number;
|
|
18
|
+
subscriberPrice: number;
|
|
19
|
+
outlet: boolean;
|
|
20
|
+
createdAt: Date;
|
|
21
|
+
};
|