@infrab4a/connect 4.9.7-beta.0 → 4.9.7-beta.10
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 +200 -67
- package/index.esm.js +200 -69
- package/package.json +1 -1
- package/src/domain/catalog/models/category-base.d.ts +17 -3
- package/src/domain/catalog/models/filter.d.ts +2 -0
- package/src/domain/catalog/models/types/category-images.type.d.ts +8 -0
- package/src/domain/catalog/models/types/category-metadata.type.d.ts +2 -0
- package/src/domain/catalog/models/types/category-most-relevant.type.d.ts +4 -0
- package/src/domain/catalog/models/types/index.d.ts +3 -0
- package/src/domain/catalog/models/types/report-stock-notification.type.d.ts +9 -0
- package/src/domain/catalog/repositories/product-stock-notification.repository.d.ts +9 -1
- package/src/domain/shopping/index.d.ts +1 -0
- package/src/domain/shopping/models/coupons/coupon.d.ts +1 -1
- package/src/domain/shopping/models/index.d.ts +1 -0
- package/src/domain/shopping/models/order-blocked.d.ts +26 -0
- package/src/domain/shopping/repositories/index.d.ts +1 -0
- package/src/domain/shopping/repositories/order-blocked.repository.d.ts +6 -0
- package/src/domain/shopping/types/index.d.ts +1 -0
- package/src/domain/shopping/types/payment-card-info.type.d.ts +4 -0
- package/src/infra/firebase/firestore/repositories/shopping/index.d.ts +1 -0
- package/src/infra/firebase/firestore/repositories/shopping/order-blocked-firestore.repository.ts.d.ts +9 -0
- package/src/infra/firebase/firestore/services/connect-collection.service.d.ts +2 -2
- package/src/infra/hasura-graphql/repositories/catalog/product-stock-notification-hasura-graphql.repository.d.ts +9 -1
package/index.cjs.js
CHANGED
|
@@ -42,16 +42,50 @@ class BaseModel {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
exports.GenderDestination = void 0;
|
|
46
|
+
(function (GenderDestination) {
|
|
47
|
+
GenderDestination["FEMALE"] = "female";
|
|
48
|
+
GenderDestination["MALE"] = "male";
|
|
49
|
+
GenderDestination["UNISEX"] = "unisex";
|
|
50
|
+
})(exports.GenderDestination || (exports.GenderDestination = {}));
|
|
51
|
+
|
|
52
|
+
exports.Shops = void 0;
|
|
53
|
+
(function (Shops) {
|
|
54
|
+
Shops["MENSMARKET"] = "mensmarket";
|
|
55
|
+
Shops["GLAMSHOP"] = "Glamshop";
|
|
56
|
+
Shops["GLAMPOINTS"] = "Glampoints";
|
|
57
|
+
Shops["ALL"] = "ALL";
|
|
58
|
+
})(exports.Shops || (exports.Shops = {}));
|
|
59
|
+
|
|
45
60
|
class Filter extends BaseModel {
|
|
46
61
|
static get identifiersFields() {
|
|
47
62
|
return ['id'];
|
|
48
63
|
}
|
|
49
64
|
}
|
|
65
|
+
tslib.__decorate([
|
|
66
|
+
classTransformer.Type(() => Category),
|
|
67
|
+
tslib.__metadata("design:type", Array)
|
|
68
|
+
], Filter.prototype, "categories", void 0);
|
|
50
69
|
|
|
51
70
|
class CategoryBase extends BaseModel {
|
|
52
71
|
static get identifiersFields() {
|
|
53
72
|
return ['id'];
|
|
54
73
|
}
|
|
74
|
+
get glamImages() {
|
|
75
|
+
return this.images[exports.Shops.GLAMSHOP];
|
|
76
|
+
}
|
|
77
|
+
get mensImages() {
|
|
78
|
+
return this.images[exports.Shops.MENSMARKET];
|
|
79
|
+
}
|
|
80
|
+
get glamMetadata() {
|
|
81
|
+
return this.metadata.find((metadata) => metadata.shop === exports.Shops.GLAMSHOP);
|
|
82
|
+
}
|
|
83
|
+
get mensMetadata() {
|
|
84
|
+
return this.metadata.find((metadata) => metadata.shop === exports.Shops.MENSMARKET);
|
|
85
|
+
}
|
|
86
|
+
getMostRelevantByShop(shop) {
|
|
87
|
+
return this.mostRelevant[shop];
|
|
88
|
+
}
|
|
55
89
|
}
|
|
56
90
|
tslib.__decorate([
|
|
57
91
|
classTransformer.Type(() => CategoryBase),
|
|
@@ -160,21 +194,6 @@ tslib.__decorate([
|
|
|
160
194
|
tslib.__metadata("design:type", Category)
|
|
161
195
|
], CategoryFilter.prototype, "category", void 0);
|
|
162
196
|
|
|
163
|
-
exports.GenderDestination = void 0;
|
|
164
|
-
(function (GenderDestination) {
|
|
165
|
-
GenderDestination["FEMALE"] = "female";
|
|
166
|
-
GenderDestination["MALE"] = "male";
|
|
167
|
-
GenderDestination["UNISEX"] = "unisex";
|
|
168
|
-
})(exports.GenderDestination || (exports.GenderDestination = {}));
|
|
169
|
-
|
|
170
|
-
exports.Shops = void 0;
|
|
171
|
-
(function (Shops) {
|
|
172
|
-
Shops["MENSMARKET"] = "mensmarket";
|
|
173
|
-
Shops["GLAMSHOP"] = "Glamshop";
|
|
174
|
-
Shops["GLAMPOINTS"] = "Glampoints";
|
|
175
|
-
Shops["ALL"] = "ALL";
|
|
176
|
-
})(exports.Shops || (exports.Shops = {}));
|
|
177
|
-
|
|
178
197
|
class FilterOption extends BaseModel {
|
|
179
198
|
static get identifiersFields() {
|
|
180
199
|
return ['id'];
|
|
@@ -2163,6 +2182,12 @@ tslib.__decorate([
|
|
|
2163
2182
|
tslib.__metadata("design:type", Payment)
|
|
2164
2183
|
], Order.prototype, "payment", void 0);
|
|
2165
2184
|
|
|
2185
|
+
class OrderBlocked extends BaseModel {
|
|
2186
|
+
static get identifiersFields() {
|
|
2187
|
+
return ['id'];
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2166
2191
|
class CheckoutSubscription extends BaseModel {
|
|
2167
2192
|
static get identifiersFields() {
|
|
2168
2193
|
return ['id'];
|
|
@@ -2862,7 +2887,7 @@ const withFindFirestore = (MixinBase) => {
|
|
|
2862
2887
|
const req = { collection: collectionName, data: find };
|
|
2863
2888
|
try {
|
|
2864
2889
|
const intercepted = await ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.request) === null || _d === void 0 ? void 0 : _d.call(_c, { find }));
|
|
2865
|
-
const { filters, limits, orderBy } = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.find) || find;
|
|
2890
|
+
const { fields, filters, limits, orderBy } = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.find) || find;
|
|
2866
2891
|
const queries = this.makeFirestoreWhere(filters || {});
|
|
2867
2892
|
const ordination = this.makeFirestoreOrderBy(filters, orderBy);
|
|
2868
2893
|
const offsets = await this.defineLimits(filters, limits);
|
|
@@ -2901,8 +2926,9 @@ const withFindFirestore = (MixinBase) => {
|
|
|
2901
2926
|
.getDoc((_a = Object.values(limits.offset.identifier).shift()) === null || _a === void 0 ? void 0 : _a.toString())
|
|
2902
2927
|
.get(),
|
|
2903
2928
|
]);
|
|
2904
|
-
else if (lodash.isNumber(limits.offset) || lodash.isString(limits.offset))
|
|
2929
|
+
else if (lodash.isNumber(limits.offset) || lodash.isString(limits.offset)) {
|
|
2905
2930
|
queries.push(['fromStartAt', limits.offset]);
|
|
2931
|
+
}
|
|
2906
2932
|
}
|
|
2907
2933
|
if (limits === null || limits === void 0 ? void 0 : limits.limit)
|
|
2908
2934
|
queries.push(['limit', limits.limit]);
|
|
@@ -2986,7 +3012,9 @@ const withUpdateFirestore = (MixinBase) => {
|
|
|
2986
3012
|
const req = { collection: collectionName, data };
|
|
2987
3013
|
try {
|
|
2988
3014
|
const identifiers = getValueFromParams(data, keyField);
|
|
2989
|
-
const docRef = this.collection().getDoc(identifiers.toString());
|
|
3015
|
+
const docRef = this.collection(collectionName).getDoc(identifiers.toString());
|
|
3016
|
+
if (!(await docRef.get()).data())
|
|
3017
|
+
throw new NotFoundError(`Document '${collectionName}/${Object.values(identifiers.toString())}' not found`);
|
|
2990
3018
|
const plainFromData = this.model.toInstance(this.paramsToPlain(data));
|
|
2991
3019
|
const intercepted = await ((_b = (_a = this.interceptors) === null || _a === void 0 ? void 0 : _a.request) === null || _b === void 0 ? void 0 : _b.call(_a, { instance: plainFromData }));
|
|
2992
3020
|
const builded = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.instance) || plainFromData;
|
|
@@ -3551,6 +3579,47 @@ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
|
|
|
3551
3579
|
}
|
|
3552
3580
|
}
|
|
3553
3581
|
|
|
3582
|
+
class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3583
|
+
constructor({ firestore, interceptors, }) {
|
|
3584
|
+
super({
|
|
3585
|
+
firestore,
|
|
3586
|
+
collectionName: 'paymentBlockedAttempts',
|
|
3587
|
+
model: OrderBlocked,
|
|
3588
|
+
interceptors,
|
|
3589
|
+
});
|
|
3590
|
+
}
|
|
3591
|
+
async createBlockedOrderOrPayment(checkout, blockType, type, limiteRange, card = null) {
|
|
3592
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3593
|
+
return this.create(OrderBlocked.toInstance({
|
|
3594
|
+
customer: {
|
|
3595
|
+
name: ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.displayName) || '',
|
|
3596
|
+
cpf: ((_b = checkout.user) === null || _b === void 0 ? void 0 : _b.cpf) || '',
|
|
3597
|
+
id: (_c = checkout.user) === null || _c === void 0 ? void 0 : _c.id,
|
|
3598
|
+
email: ((_d = checkout.user) === null || _d === void 0 ? void 0 : _d.email) || '',
|
|
3599
|
+
phoneNumber: '+55' + ((_e = checkout.user) === null || _e === void 0 ? void 0 : _e.phone),
|
|
3600
|
+
isSubscriber: (_f = checkout.user) === null || _f === void 0 ? void 0 : _f.isSubscriber,
|
|
3601
|
+
subscriptionPlan: ((_g = checkout.user) === null || _g === void 0 ? void 0 : _g.subscriptionPlan) || '',
|
|
3602
|
+
shippingAddress: Object.assign(Object.assign({}, checkout.shippingAddress), { zip: this.formatZip((_h = checkout.shippingAddress) === null || _h === void 0 ? void 0 : _h.zip) }),
|
|
3603
|
+
},
|
|
3604
|
+
blockType,
|
|
3605
|
+
limiteRange,
|
|
3606
|
+
type,
|
|
3607
|
+
card,
|
|
3608
|
+
checkout: {
|
|
3609
|
+
id: checkout.id,
|
|
3610
|
+
shop: checkout.shop,
|
|
3611
|
+
total: checkout.totalPrice,
|
|
3612
|
+
},
|
|
3613
|
+
date: new Date(),
|
|
3614
|
+
}));
|
|
3615
|
+
}
|
|
3616
|
+
formatZip(zip) {
|
|
3617
|
+
if (zip.length === 8)
|
|
3618
|
+
return zip.substring(0, 5) + '-' + zip.substring(5, 8);
|
|
3619
|
+
return zip;
|
|
3620
|
+
}
|
|
3621
|
+
}
|
|
3622
|
+
|
|
3554
3623
|
class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3555
3624
|
constructor({ firestore, interceptors }) {
|
|
3556
3625
|
super({
|
|
@@ -3727,19 +3796,21 @@ class ConnectCollectionService {
|
|
|
3727
3796
|
return new ConnectDocumentService(newDoc.path, this.firestore).withConverter(this.converter);
|
|
3728
3797
|
}
|
|
3729
3798
|
async getDocs() {
|
|
3799
|
+
if (this.startingAt > 0)
|
|
3800
|
+
this.limitBy += this.startingAt;
|
|
3730
3801
|
const constraints = [
|
|
3731
3802
|
...this.wheres,
|
|
3732
3803
|
...this.orderBys,
|
|
3733
|
-
...(this.limitBy ? [this.limitBy] : []),
|
|
3734
|
-
...(this.offsetBy ? [this.offsetBy] : []),
|
|
3735
|
-
...(this.statingAt ? [this.statingAt] : []),
|
|
3736
|
-
...(this.startingAfter ? [this.startingAfter] : []),
|
|
3804
|
+
...(this.limitBy ? [firestore.limit(this.limitBy)] : []),
|
|
3737
3805
|
];
|
|
3738
|
-
return firestore.getDocs(firestore.query(this.reference, ...constraints)).then((docs) =>
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3806
|
+
return firestore.getDocs(firestore.query(this.reference, ...constraints)).then((docs) => {
|
|
3807
|
+
const docsPaginated = this.startingAt > 0 ? docs.docs.slice(this.startingAt, this.limitBy) : docs.docs;
|
|
3808
|
+
return {
|
|
3809
|
+
empty: Boolean(docsPaginated.length),
|
|
3810
|
+
size: docsPaginated.length,
|
|
3811
|
+
docs: docsPaginated.map((doc) => new ConnectBaseDocumentSnapshot(doc)),
|
|
3812
|
+
};
|
|
3813
|
+
});
|
|
3743
3814
|
}
|
|
3744
3815
|
getDoc(id) {
|
|
3745
3816
|
return new ConnectDocumentService(`${this.reference.path}/${id}`, this.firestore).withConverter(this.converter);
|
|
@@ -3753,15 +3824,15 @@ class ConnectCollectionService {
|
|
|
3753
3824
|
return this;
|
|
3754
3825
|
}
|
|
3755
3826
|
limit(quantity) {
|
|
3756
|
-
this.limitBy =
|
|
3827
|
+
this.limitBy = quantity;
|
|
3757
3828
|
return this;
|
|
3758
3829
|
}
|
|
3759
3830
|
offset(offsetBy) {
|
|
3760
|
-
this.offsetBy =
|
|
3831
|
+
this.offsetBy = offsetBy;
|
|
3761
3832
|
return this;
|
|
3762
3833
|
}
|
|
3763
3834
|
fromStartAt(startingAt) {
|
|
3764
|
-
this.
|
|
3835
|
+
this.startingAt = startingAt;
|
|
3765
3836
|
return this;
|
|
3766
3837
|
}
|
|
3767
3838
|
fromStartAfter(startingAt) {
|
|
@@ -4682,6 +4753,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4682
4753
|
'name',
|
|
4683
4754
|
'description',
|
|
4684
4755
|
'image',
|
|
4756
|
+
{ images: { columnName: 'images', type: HasuraGraphQLColumnType.Jsonb } },
|
|
4685
4757
|
'published',
|
|
4686
4758
|
'shop',
|
|
4687
4759
|
{ shops: { columnName: 'shops', type: HasuraGraphQLColumnType.Jsonb } },
|
|
@@ -4737,7 +4809,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4737
4809
|
{
|
|
4738
4810
|
metadata: {
|
|
4739
4811
|
columnName: 'metadata',
|
|
4740
|
-
fields: ['title', 'description'],
|
|
4812
|
+
fields: ['shop', 'title', 'description'],
|
|
4741
4813
|
bindPersistData: (value) => ({
|
|
4742
4814
|
metadata: { data: value },
|
|
4743
4815
|
}),
|
|
@@ -4764,7 +4836,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4764
4836
|
}
|
|
4765
4837
|
async create(params) {
|
|
4766
4838
|
const { metadata } = params, data = tslib.__rest(params, ["metadata"]);
|
|
4767
|
-
return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || { description: null, title: null } }));
|
|
4839
|
+
return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || [{ shop: null, description: null, title: null }] }));
|
|
4768
4840
|
}
|
|
4769
4841
|
async get(identifiers) {
|
|
4770
4842
|
var _a;
|
|
@@ -4874,7 +4946,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4874
4946
|
return products;
|
|
4875
4947
|
}
|
|
4876
4948
|
async getChildren(parentId) {
|
|
4877
|
-
const { category_tree } = await this.query('category_tree', ['id', 'name', 'parent_id', 'slug', 'reference'], {
|
|
4949
|
+
const { category_tree } = await this.query('category_tree', ['id', 'name', 'parent_id', 'slug', 'reference', 'published', 'shops'], {
|
|
4878
4950
|
args: {
|
|
4879
4951
|
type: 'category_tree_args',
|
|
4880
4952
|
value: { parentid: parentId },
|
|
@@ -4955,22 +5027,35 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4955
5027
|
return plainData.products;
|
|
4956
5028
|
}
|
|
4957
5029
|
async updateMetadata(categoryId, { metadata }) {
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
5030
|
+
if (Array.isArray(metadata) && !metadata.length)
|
|
5031
|
+
return [];
|
|
5032
|
+
if (Array.isArray(metadata) && metadata.length) {
|
|
5033
|
+
await this.mutation('delete_category_metadata', ['affected_rows'], {
|
|
5034
|
+
where: {
|
|
5035
|
+
type: 'category_metadata_bool_exp',
|
|
5036
|
+
required: true,
|
|
5037
|
+
value: { category_id: { _eq: categoryId } },
|
|
5038
|
+
},
|
|
5039
|
+
});
|
|
5040
|
+
await this.mutation('insert_category_metadata', ['affected_rows'], {
|
|
5041
|
+
objects: {
|
|
5042
|
+
type: '[category_metadata_insert_input!]',
|
|
5043
|
+
required: true,
|
|
5044
|
+
value: metadata.map((m) => (Object.assign({ category_id: categoryId }, m))),
|
|
5045
|
+
},
|
|
5046
|
+
});
|
|
5047
|
+
return metadata;
|
|
5048
|
+
}
|
|
5049
|
+
if ('action' in metadata && metadata.action === 'remove' && metadata.value.length) {
|
|
5050
|
+
await this.mutation('delete_category_metadata', ['affected_rows'], {
|
|
5051
|
+
where: {
|
|
5052
|
+
type: 'category_metadata_bool_exp',
|
|
5053
|
+
required: true,
|
|
5054
|
+
value: { category_id: { _eq: categoryId } },
|
|
5055
|
+
},
|
|
5056
|
+
});
|
|
5057
|
+
return [];
|
|
5058
|
+
}
|
|
4974
5059
|
}
|
|
4975
5060
|
async updateFilters(categoryId, { filters }) {
|
|
4976
5061
|
if ('action' in filters && filters.action === 'remove' && filters.value.length) {
|
|
@@ -5082,6 +5167,17 @@ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGrap
|
|
|
5082
5167
|
],
|
|
5083
5168
|
},
|
|
5084
5169
|
},
|
|
5170
|
+
{
|
|
5171
|
+
categories: {
|
|
5172
|
+
columnName: 'categories',
|
|
5173
|
+
foreignKeyColumn: { category_id: 'id' },
|
|
5174
|
+
fields: [{ category: ['id', 'name', 'slug'] }],
|
|
5175
|
+
bindPersistData: (value) => ({
|
|
5176
|
+
categories: { data: value.map((filter) => ({ filter_id: filter.id })) },
|
|
5177
|
+
}),
|
|
5178
|
+
from: (categories) => (categories === null || categories === void 0 ? void 0 : categories.map((category) => category === null || category === void 0 ? void 0 : category.category)) || [],
|
|
5179
|
+
},
|
|
5180
|
+
},
|
|
5085
5181
|
],
|
|
5086
5182
|
});
|
|
5087
5183
|
this.filterOptionRepository = filterOptionRepository;
|
|
@@ -5793,7 +5889,24 @@ class ProductStockNotificationHasuraGraphQLRepository extends withCrudHasuraGrap
|
|
|
5793
5889
|
email,
|
|
5794
5890
|
});
|
|
5795
5891
|
}
|
|
5892
|
+
async getNotificationsReport({ ean, sku, name, category, reference, emailsCount, }) {
|
|
5893
|
+
const query = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (ean && { ean: { _eq: ean } })), (sku && { sku: { _eq: sku } })), (name && { name: { _iregex: name } })), (category && { category: { _iregex: category } })), (reference && { category_reference: { _eq: reference } })), (emailsCount && { emails_registered: { _eq: emailsCount } }));
|
|
5894
|
+
const { report_stock_notification } = await this.query('report_stock_notification', ['ean', 'sku', 'name', 'stock', 'category', 'category_reference', 'emails_registered'], {
|
|
5895
|
+
where: {
|
|
5896
|
+
type: 'report_stock_notification_bool_exp',
|
|
5897
|
+
value: query,
|
|
5898
|
+
required: true,
|
|
5899
|
+
},
|
|
5900
|
+
});
|
|
5901
|
+
return report_stock_notification;
|
|
5902
|
+
}
|
|
5796
5903
|
}
|
|
5904
|
+
tslib.__decorate([
|
|
5905
|
+
Log(),
|
|
5906
|
+
tslib.__metadata("design:type", Function),
|
|
5907
|
+
tslib.__metadata("design:paramtypes", [Object]),
|
|
5908
|
+
tslib.__metadata("design:returntype", Promise)
|
|
5909
|
+
], ProductStockNotificationHasuraGraphQLRepository.prototype, "getNotificationsReport", null);
|
|
5797
5910
|
|
|
5798
5911
|
class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
5799
5912
|
constructor({ endpoint, authOptions, interceptors, }) {
|
|
@@ -5966,7 +6079,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5966
6079
|
{
|
|
5967
6080
|
metadata: {
|
|
5968
6081
|
columnName: 'metadata',
|
|
5969
|
-
fields: ['title', 'description'],
|
|
6082
|
+
fields: ['shop', 'title', 'description'],
|
|
5970
6083
|
bindPersistData: (value) => ({
|
|
5971
6084
|
metadata: { data: value },
|
|
5972
6085
|
}),
|
|
@@ -5993,8 +6106,9 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5993
6106
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
5994
6107
|
}
|
|
5995
6108
|
async create(params) {
|
|
6109
|
+
var _a;
|
|
5996
6110
|
const { metadata } = params, data = tslib.__rest(params, ["metadata"]);
|
|
5997
|
-
return super.create(Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadata: metadata || { description: data.description, title: data.name } }));
|
|
6111
|
+
return super.create(Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadata: metadata || [{ shop: (_a = data.shop) !== null && _a !== void 0 ? _a : null, description: data.description, title: data.name }] }));
|
|
5998
6112
|
}
|
|
5999
6113
|
async get(identifiers) {
|
|
6000
6114
|
const data = await super.get(identifiers);
|
|
@@ -6118,22 +6232,39 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6118
6232
|
return plainData.products;
|
|
6119
6233
|
}
|
|
6120
6234
|
async updateMetadata(categoryId, { metadata }) {
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6235
|
+
if (Array.isArray(metadata) && !metadata.length)
|
|
6236
|
+
return [];
|
|
6237
|
+
if (Array.isArray(metadata) && metadata.length) {
|
|
6238
|
+
const metadataUpdated = [];
|
|
6239
|
+
for (const data of metadata) {
|
|
6240
|
+
const update = await this.mutation('update_category_metadata_by_pk', ['category_id', 'shop'], {
|
|
6241
|
+
pk_columns: {
|
|
6242
|
+
value: { category_id: categoryId, shop: data.shop },
|
|
6243
|
+
type: 'category_metadata_pk_columns_input',
|
|
6244
|
+
required: true,
|
|
6245
|
+
},
|
|
6246
|
+
_set: {
|
|
6247
|
+
value: lodash.omit(data, ['category_id', 'shop']),
|
|
6248
|
+
type: 'category_metadata_set_input',
|
|
6249
|
+
required: true,
|
|
6250
|
+
},
|
|
6251
|
+
});
|
|
6252
|
+
metadataUpdated.push(update);
|
|
6253
|
+
}
|
|
6254
|
+
return metadataUpdated;
|
|
6255
|
+
}
|
|
6256
|
+
if ('action' in metadata && metadata.action === 'remove' && metadata.value.length) {
|
|
6257
|
+
for (let i = 0; i < metadata.value.length; i++) {
|
|
6258
|
+
await this.mutation('delete_category_metadata', ['affected_rows'], {
|
|
6259
|
+
where: {
|
|
6260
|
+
type: 'category_metadata_bool_exp',
|
|
6261
|
+
required: true,
|
|
6262
|
+
value: { category_id: { _eq: categoryId }, shop: metadata.value[i].shop },
|
|
6263
|
+
},
|
|
6264
|
+
});
|
|
6265
|
+
}
|
|
6266
|
+
return [];
|
|
6267
|
+
}
|
|
6137
6268
|
}
|
|
6138
6269
|
}
|
|
6139
6270
|
tslib.__decorate([
|
|
@@ -6329,6 +6460,8 @@ exports.Log = Log;
|
|
|
6329
6460
|
exports.Logger = Logger;
|
|
6330
6461
|
exports.NotFoundError = NotFoundError;
|
|
6331
6462
|
exports.Order = Order;
|
|
6463
|
+
exports.OrderBlocked = OrderBlocked;
|
|
6464
|
+
exports.OrderBlockedFirestoreRepository = OrderBlockedFirestoreRepository;
|
|
6332
6465
|
exports.OrderFirestoreRepository = OrderFirestoreRepository;
|
|
6333
6466
|
exports.Payment = Payment;
|
|
6334
6467
|
exports.PaymentFirestoreRepository = PaymentFirestoreRepository;
|
package/index.esm.js
CHANGED
|
@@ -9,7 +9,7 @@ import { debug } from 'debug';
|
|
|
9
9
|
import { CustomError } from 'ts-custom-error';
|
|
10
10
|
import axios from 'axios';
|
|
11
11
|
import { signInWithEmailAndPassword, signInWithPopup, GoogleAuthProvider, signInAnonymously, sendPasswordResetEmail, createUserWithEmailAndPassword, sendEmailVerification } from 'firebase/auth';
|
|
12
|
-
import { deleteField, arrayUnion, arrayRemove, Timestamp, doc, getDoc, updateDoc, setDoc, deleteDoc, collection, getDocs, query, where, orderBy,
|
|
12
|
+
import { deleteField, arrayUnion, arrayRemove, Timestamp, doc, getDoc, updateDoc, setDoc, deleteDoc, collection, limit, getDocs, query, where, orderBy, startAfter, addDoc } from 'firebase/firestore';
|
|
13
13
|
import { ref, uploadBytes } from 'firebase/storage';
|
|
14
14
|
import { mutation, query as query$1 } from 'gql-query-builder';
|
|
15
15
|
|
|
@@ -36,16 +36,50 @@ class BaseModel {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
var GenderDestination;
|
|
40
|
+
(function (GenderDestination) {
|
|
41
|
+
GenderDestination["FEMALE"] = "female";
|
|
42
|
+
GenderDestination["MALE"] = "male";
|
|
43
|
+
GenderDestination["UNISEX"] = "unisex";
|
|
44
|
+
})(GenderDestination || (GenderDestination = {}));
|
|
45
|
+
|
|
46
|
+
var Shops;
|
|
47
|
+
(function (Shops) {
|
|
48
|
+
Shops["MENSMARKET"] = "mensmarket";
|
|
49
|
+
Shops["GLAMSHOP"] = "Glamshop";
|
|
50
|
+
Shops["GLAMPOINTS"] = "Glampoints";
|
|
51
|
+
Shops["ALL"] = "ALL";
|
|
52
|
+
})(Shops || (Shops = {}));
|
|
53
|
+
|
|
39
54
|
class Filter extends BaseModel {
|
|
40
55
|
static get identifiersFields() {
|
|
41
56
|
return ['id'];
|
|
42
57
|
}
|
|
43
58
|
}
|
|
59
|
+
__decorate([
|
|
60
|
+
Type(() => Category),
|
|
61
|
+
__metadata("design:type", Array)
|
|
62
|
+
], Filter.prototype, "categories", void 0);
|
|
44
63
|
|
|
45
64
|
class CategoryBase extends BaseModel {
|
|
46
65
|
static get identifiersFields() {
|
|
47
66
|
return ['id'];
|
|
48
67
|
}
|
|
68
|
+
get glamImages() {
|
|
69
|
+
return this.images[Shops.GLAMSHOP];
|
|
70
|
+
}
|
|
71
|
+
get mensImages() {
|
|
72
|
+
return this.images[Shops.MENSMARKET];
|
|
73
|
+
}
|
|
74
|
+
get glamMetadata() {
|
|
75
|
+
return this.metadata.find((metadata) => metadata.shop === Shops.GLAMSHOP);
|
|
76
|
+
}
|
|
77
|
+
get mensMetadata() {
|
|
78
|
+
return this.metadata.find((metadata) => metadata.shop === Shops.MENSMARKET);
|
|
79
|
+
}
|
|
80
|
+
getMostRelevantByShop(shop) {
|
|
81
|
+
return this.mostRelevant[shop];
|
|
82
|
+
}
|
|
49
83
|
}
|
|
50
84
|
__decorate([
|
|
51
85
|
Type(() => CategoryBase),
|
|
@@ -154,21 +188,6 @@ __decorate([
|
|
|
154
188
|
__metadata("design:type", Category)
|
|
155
189
|
], CategoryFilter.prototype, "category", void 0);
|
|
156
190
|
|
|
157
|
-
var GenderDestination;
|
|
158
|
-
(function (GenderDestination) {
|
|
159
|
-
GenderDestination["FEMALE"] = "female";
|
|
160
|
-
GenderDestination["MALE"] = "male";
|
|
161
|
-
GenderDestination["UNISEX"] = "unisex";
|
|
162
|
-
})(GenderDestination || (GenderDestination = {}));
|
|
163
|
-
|
|
164
|
-
var Shops;
|
|
165
|
-
(function (Shops) {
|
|
166
|
-
Shops["MENSMARKET"] = "mensmarket";
|
|
167
|
-
Shops["GLAMSHOP"] = "Glamshop";
|
|
168
|
-
Shops["GLAMPOINTS"] = "Glampoints";
|
|
169
|
-
Shops["ALL"] = "ALL";
|
|
170
|
-
})(Shops || (Shops = {}));
|
|
171
|
-
|
|
172
191
|
class FilterOption extends BaseModel {
|
|
173
192
|
static get identifiersFields() {
|
|
174
193
|
return ['id'];
|
|
@@ -2157,6 +2176,12 @@ __decorate([
|
|
|
2157
2176
|
__metadata("design:type", Payment)
|
|
2158
2177
|
], Order.prototype, "payment", void 0);
|
|
2159
2178
|
|
|
2179
|
+
class OrderBlocked extends BaseModel {
|
|
2180
|
+
static get identifiersFields() {
|
|
2181
|
+
return ['id'];
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2160
2185
|
class CheckoutSubscription extends BaseModel {
|
|
2161
2186
|
static get identifiersFields() {
|
|
2162
2187
|
return ['id'];
|
|
@@ -2856,7 +2881,7 @@ const withFindFirestore = (MixinBase) => {
|
|
|
2856
2881
|
const req = { collection: collectionName, data: find };
|
|
2857
2882
|
try {
|
|
2858
2883
|
const intercepted = await ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.request) === null || _d === void 0 ? void 0 : _d.call(_c, { find }));
|
|
2859
|
-
const { filters, limits, orderBy } = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.find) || find;
|
|
2884
|
+
const { fields, filters, limits, orderBy } = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.find) || find;
|
|
2860
2885
|
const queries = this.makeFirestoreWhere(filters || {});
|
|
2861
2886
|
const ordination = this.makeFirestoreOrderBy(filters, orderBy);
|
|
2862
2887
|
const offsets = await this.defineLimits(filters, limits);
|
|
@@ -2895,8 +2920,9 @@ const withFindFirestore = (MixinBase) => {
|
|
|
2895
2920
|
.getDoc((_a = Object.values(limits.offset.identifier).shift()) === null || _a === void 0 ? void 0 : _a.toString())
|
|
2896
2921
|
.get(),
|
|
2897
2922
|
]);
|
|
2898
|
-
else if (isNumber(limits.offset) || isString(limits.offset))
|
|
2923
|
+
else if (isNumber(limits.offset) || isString(limits.offset)) {
|
|
2899
2924
|
queries.push(['fromStartAt', limits.offset]);
|
|
2925
|
+
}
|
|
2900
2926
|
}
|
|
2901
2927
|
if (limits === null || limits === void 0 ? void 0 : limits.limit)
|
|
2902
2928
|
queries.push(['limit', limits.limit]);
|
|
@@ -2980,7 +3006,9 @@ const withUpdateFirestore = (MixinBase) => {
|
|
|
2980
3006
|
const req = { collection: collectionName, data };
|
|
2981
3007
|
try {
|
|
2982
3008
|
const identifiers = getValueFromParams(data, keyField);
|
|
2983
|
-
const docRef = this.collection().getDoc(identifiers.toString());
|
|
3009
|
+
const docRef = this.collection(collectionName).getDoc(identifiers.toString());
|
|
3010
|
+
if (!(await docRef.get()).data())
|
|
3011
|
+
throw new NotFoundError(`Document '${collectionName}/${Object.values(identifiers.toString())}' not found`);
|
|
2984
3012
|
const plainFromData = this.model.toInstance(this.paramsToPlain(data));
|
|
2985
3013
|
const intercepted = await ((_b = (_a = this.interceptors) === null || _a === void 0 ? void 0 : _a.request) === null || _b === void 0 ? void 0 : _b.call(_a, { instance: plainFromData }));
|
|
2986
3014
|
const builded = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.instance) || plainFromData;
|
|
@@ -3545,6 +3573,47 @@ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
|
|
|
3545
3573
|
}
|
|
3546
3574
|
}
|
|
3547
3575
|
|
|
3576
|
+
class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3577
|
+
constructor({ firestore, interceptors, }) {
|
|
3578
|
+
super({
|
|
3579
|
+
firestore,
|
|
3580
|
+
collectionName: 'paymentBlockedAttempts',
|
|
3581
|
+
model: OrderBlocked,
|
|
3582
|
+
interceptors,
|
|
3583
|
+
});
|
|
3584
|
+
}
|
|
3585
|
+
async createBlockedOrderOrPayment(checkout, blockType, type, limiteRange, card = null) {
|
|
3586
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3587
|
+
return this.create(OrderBlocked.toInstance({
|
|
3588
|
+
customer: {
|
|
3589
|
+
name: ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.displayName) || '',
|
|
3590
|
+
cpf: ((_b = checkout.user) === null || _b === void 0 ? void 0 : _b.cpf) || '',
|
|
3591
|
+
id: (_c = checkout.user) === null || _c === void 0 ? void 0 : _c.id,
|
|
3592
|
+
email: ((_d = checkout.user) === null || _d === void 0 ? void 0 : _d.email) || '',
|
|
3593
|
+
phoneNumber: '+55' + ((_e = checkout.user) === null || _e === void 0 ? void 0 : _e.phone),
|
|
3594
|
+
isSubscriber: (_f = checkout.user) === null || _f === void 0 ? void 0 : _f.isSubscriber,
|
|
3595
|
+
subscriptionPlan: ((_g = checkout.user) === null || _g === void 0 ? void 0 : _g.subscriptionPlan) || '',
|
|
3596
|
+
shippingAddress: Object.assign(Object.assign({}, checkout.shippingAddress), { zip: this.formatZip((_h = checkout.shippingAddress) === null || _h === void 0 ? void 0 : _h.zip) }),
|
|
3597
|
+
},
|
|
3598
|
+
blockType,
|
|
3599
|
+
limiteRange,
|
|
3600
|
+
type,
|
|
3601
|
+
card,
|
|
3602
|
+
checkout: {
|
|
3603
|
+
id: checkout.id,
|
|
3604
|
+
shop: checkout.shop,
|
|
3605
|
+
total: checkout.totalPrice,
|
|
3606
|
+
},
|
|
3607
|
+
date: new Date(),
|
|
3608
|
+
}));
|
|
3609
|
+
}
|
|
3610
|
+
formatZip(zip) {
|
|
3611
|
+
if (zip.length === 8)
|
|
3612
|
+
return zip.substring(0, 5) + '-' + zip.substring(5, 8);
|
|
3613
|
+
return zip;
|
|
3614
|
+
}
|
|
3615
|
+
}
|
|
3616
|
+
|
|
3548
3617
|
class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3549
3618
|
constructor({ firestore, interceptors }) {
|
|
3550
3619
|
super({
|
|
@@ -3721,19 +3790,21 @@ class ConnectCollectionService {
|
|
|
3721
3790
|
return new ConnectDocumentService(newDoc.path, this.firestore).withConverter(this.converter);
|
|
3722
3791
|
}
|
|
3723
3792
|
async getDocs() {
|
|
3793
|
+
if (this.startingAt > 0)
|
|
3794
|
+
this.limitBy += this.startingAt;
|
|
3724
3795
|
const constraints = [
|
|
3725
3796
|
...this.wheres,
|
|
3726
3797
|
...this.orderBys,
|
|
3727
|
-
...(this.limitBy ? [this.limitBy] : []),
|
|
3728
|
-
...(this.offsetBy ? [this.offsetBy] : []),
|
|
3729
|
-
...(this.statingAt ? [this.statingAt] : []),
|
|
3730
|
-
...(this.startingAfter ? [this.startingAfter] : []),
|
|
3798
|
+
...(this.limitBy ? [limit(this.limitBy)] : []),
|
|
3731
3799
|
];
|
|
3732
|
-
return getDocs(query(this.reference, ...constraints)).then((docs) =>
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3800
|
+
return getDocs(query(this.reference, ...constraints)).then((docs) => {
|
|
3801
|
+
const docsPaginated = this.startingAt > 0 ? docs.docs.slice(this.startingAt, this.limitBy) : docs.docs;
|
|
3802
|
+
return {
|
|
3803
|
+
empty: Boolean(docsPaginated.length),
|
|
3804
|
+
size: docsPaginated.length,
|
|
3805
|
+
docs: docsPaginated.map((doc) => new ConnectBaseDocumentSnapshot(doc)),
|
|
3806
|
+
};
|
|
3807
|
+
});
|
|
3737
3808
|
}
|
|
3738
3809
|
getDoc(id) {
|
|
3739
3810
|
return new ConnectDocumentService(`${this.reference.path}/${id}`, this.firestore).withConverter(this.converter);
|
|
@@ -3747,15 +3818,15 @@ class ConnectCollectionService {
|
|
|
3747
3818
|
return this;
|
|
3748
3819
|
}
|
|
3749
3820
|
limit(quantity) {
|
|
3750
|
-
this.limitBy =
|
|
3821
|
+
this.limitBy = quantity;
|
|
3751
3822
|
return this;
|
|
3752
3823
|
}
|
|
3753
3824
|
offset(offsetBy) {
|
|
3754
|
-
this.offsetBy =
|
|
3825
|
+
this.offsetBy = offsetBy;
|
|
3755
3826
|
return this;
|
|
3756
3827
|
}
|
|
3757
3828
|
fromStartAt(startingAt) {
|
|
3758
|
-
this.
|
|
3829
|
+
this.startingAt = startingAt;
|
|
3759
3830
|
return this;
|
|
3760
3831
|
}
|
|
3761
3832
|
fromStartAfter(startingAt) {
|
|
@@ -4676,6 +4747,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4676
4747
|
'name',
|
|
4677
4748
|
'description',
|
|
4678
4749
|
'image',
|
|
4750
|
+
{ images: { columnName: 'images', type: HasuraGraphQLColumnType.Jsonb } },
|
|
4679
4751
|
'published',
|
|
4680
4752
|
'shop',
|
|
4681
4753
|
{ shops: { columnName: 'shops', type: HasuraGraphQLColumnType.Jsonb } },
|
|
@@ -4731,7 +4803,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4731
4803
|
{
|
|
4732
4804
|
metadata: {
|
|
4733
4805
|
columnName: 'metadata',
|
|
4734
|
-
fields: ['title', 'description'],
|
|
4806
|
+
fields: ['shop', 'title', 'description'],
|
|
4735
4807
|
bindPersistData: (value) => ({
|
|
4736
4808
|
metadata: { data: value },
|
|
4737
4809
|
}),
|
|
@@ -4758,7 +4830,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4758
4830
|
}
|
|
4759
4831
|
async create(params) {
|
|
4760
4832
|
const { metadata } = params, data = __rest(params, ["metadata"]);
|
|
4761
|
-
return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || { description: null, title: null } }));
|
|
4833
|
+
return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || [{ shop: null, description: null, title: null }] }));
|
|
4762
4834
|
}
|
|
4763
4835
|
async get(identifiers) {
|
|
4764
4836
|
var _a;
|
|
@@ -4868,7 +4940,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4868
4940
|
return products;
|
|
4869
4941
|
}
|
|
4870
4942
|
async getChildren(parentId) {
|
|
4871
|
-
const { category_tree } = await this.query('category_tree', ['id', 'name', 'parent_id', 'slug', 'reference'], {
|
|
4943
|
+
const { category_tree } = await this.query('category_tree', ['id', 'name', 'parent_id', 'slug', 'reference', 'published', 'shops'], {
|
|
4872
4944
|
args: {
|
|
4873
4945
|
type: 'category_tree_args',
|
|
4874
4946
|
value: { parentid: parentId },
|
|
@@ -4949,22 +5021,35 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4949
5021
|
return plainData.products;
|
|
4950
5022
|
}
|
|
4951
5023
|
async updateMetadata(categoryId, { metadata }) {
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
5024
|
+
if (Array.isArray(metadata) && !metadata.length)
|
|
5025
|
+
return [];
|
|
5026
|
+
if (Array.isArray(metadata) && metadata.length) {
|
|
5027
|
+
await this.mutation('delete_category_metadata', ['affected_rows'], {
|
|
5028
|
+
where: {
|
|
5029
|
+
type: 'category_metadata_bool_exp',
|
|
5030
|
+
required: true,
|
|
5031
|
+
value: { category_id: { _eq: categoryId } },
|
|
5032
|
+
},
|
|
5033
|
+
});
|
|
5034
|
+
await this.mutation('insert_category_metadata', ['affected_rows'], {
|
|
5035
|
+
objects: {
|
|
5036
|
+
type: '[category_metadata_insert_input!]',
|
|
5037
|
+
required: true,
|
|
5038
|
+
value: metadata.map((m) => (Object.assign({ category_id: categoryId }, m))),
|
|
5039
|
+
},
|
|
5040
|
+
});
|
|
5041
|
+
return metadata;
|
|
5042
|
+
}
|
|
5043
|
+
if ('action' in metadata && metadata.action === 'remove' && metadata.value.length) {
|
|
5044
|
+
await this.mutation('delete_category_metadata', ['affected_rows'], {
|
|
5045
|
+
where: {
|
|
5046
|
+
type: 'category_metadata_bool_exp',
|
|
5047
|
+
required: true,
|
|
5048
|
+
value: { category_id: { _eq: categoryId } },
|
|
5049
|
+
},
|
|
5050
|
+
});
|
|
5051
|
+
return [];
|
|
5052
|
+
}
|
|
4968
5053
|
}
|
|
4969
5054
|
async updateFilters(categoryId, { filters }) {
|
|
4970
5055
|
if ('action' in filters && filters.action === 'remove' && filters.value.length) {
|
|
@@ -5076,6 +5161,17 @@ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGrap
|
|
|
5076
5161
|
],
|
|
5077
5162
|
},
|
|
5078
5163
|
},
|
|
5164
|
+
{
|
|
5165
|
+
categories: {
|
|
5166
|
+
columnName: 'categories',
|
|
5167
|
+
foreignKeyColumn: { category_id: 'id' },
|
|
5168
|
+
fields: [{ category: ['id', 'name', 'slug'] }],
|
|
5169
|
+
bindPersistData: (value) => ({
|
|
5170
|
+
categories: { data: value.map((filter) => ({ filter_id: filter.id })) },
|
|
5171
|
+
}),
|
|
5172
|
+
from: (categories) => (categories === null || categories === void 0 ? void 0 : categories.map((category) => category === null || category === void 0 ? void 0 : category.category)) || [],
|
|
5173
|
+
},
|
|
5174
|
+
},
|
|
5079
5175
|
],
|
|
5080
5176
|
});
|
|
5081
5177
|
this.filterOptionRepository = filterOptionRepository;
|
|
@@ -5787,7 +5883,24 @@ class ProductStockNotificationHasuraGraphQLRepository extends withCrudHasuraGrap
|
|
|
5787
5883
|
email,
|
|
5788
5884
|
});
|
|
5789
5885
|
}
|
|
5886
|
+
async getNotificationsReport({ ean, sku, name, category, reference, emailsCount, }) {
|
|
5887
|
+
const query = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (ean && { ean: { _eq: ean } })), (sku && { sku: { _eq: sku } })), (name && { name: { _iregex: name } })), (category && { category: { _iregex: category } })), (reference && { category_reference: { _eq: reference } })), (emailsCount && { emails_registered: { _eq: emailsCount } }));
|
|
5888
|
+
const { report_stock_notification } = await this.query('report_stock_notification', ['ean', 'sku', 'name', 'stock', 'category', 'category_reference', 'emails_registered'], {
|
|
5889
|
+
where: {
|
|
5890
|
+
type: 'report_stock_notification_bool_exp',
|
|
5891
|
+
value: query,
|
|
5892
|
+
required: true,
|
|
5893
|
+
},
|
|
5894
|
+
});
|
|
5895
|
+
return report_stock_notification;
|
|
5896
|
+
}
|
|
5790
5897
|
}
|
|
5898
|
+
__decorate([
|
|
5899
|
+
Log(),
|
|
5900
|
+
__metadata("design:type", Function),
|
|
5901
|
+
__metadata("design:paramtypes", [Object]),
|
|
5902
|
+
__metadata("design:returntype", Promise)
|
|
5903
|
+
], ProductStockNotificationHasuraGraphQLRepository.prototype, "getNotificationsReport", null);
|
|
5791
5904
|
|
|
5792
5905
|
class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
5793
5906
|
constructor({ endpoint, authOptions, interceptors, }) {
|
|
@@ -5960,7 +6073,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5960
6073
|
{
|
|
5961
6074
|
metadata: {
|
|
5962
6075
|
columnName: 'metadata',
|
|
5963
|
-
fields: ['title', 'description'],
|
|
6076
|
+
fields: ['shop', 'title', 'description'],
|
|
5964
6077
|
bindPersistData: (value) => ({
|
|
5965
6078
|
metadata: { data: value },
|
|
5966
6079
|
}),
|
|
@@ -5987,8 +6100,9 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5987
6100
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
5988
6101
|
}
|
|
5989
6102
|
async create(params) {
|
|
6103
|
+
var _a;
|
|
5990
6104
|
const { metadata } = params, data = __rest(params, ["metadata"]);
|
|
5991
|
-
return super.create(Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadata: metadata || { description: data.description, title: data.name } }));
|
|
6105
|
+
return super.create(Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadata: metadata || [{ shop: (_a = data.shop) !== null && _a !== void 0 ? _a : null, description: data.description, title: data.name }] }));
|
|
5992
6106
|
}
|
|
5993
6107
|
async get(identifiers) {
|
|
5994
6108
|
const data = await super.get(identifiers);
|
|
@@ -6112,22 +6226,39 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6112
6226
|
return plainData.products;
|
|
6113
6227
|
}
|
|
6114
6228
|
async updateMetadata(categoryId, { metadata }) {
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6229
|
+
if (Array.isArray(metadata) && !metadata.length)
|
|
6230
|
+
return [];
|
|
6231
|
+
if (Array.isArray(metadata) && metadata.length) {
|
|
6232
|
+
const metadataUpdated = [];
|
|
6233
|
+
for (const data of metadata) {
|
|
6234
|
+
const update = await this.mutation('update_category_metadata_by_pk', ['category_id', 'shop'], {
|
|
6235
|
+
pk_columns: {
|
|
6236
|
+
value: { category_id: categoryId, shop: data.shop },
|
|
6237
|
+
type: 'category_metadata_pk_columns_input',
|
|
6238
|
+
required: true,
|
|
6239
|
+
},
|
|
6240
|
+
_set: {
|
|
6241
|
+
value: omit(data, ['category_id', 'shop']),
|
|
6242
|
+
type: 'category_metadata_set_input',
|
|
6243
|
+
required: true,
|
|
6244
|
+
},
|
|
6245
|
+
});
|
|
6246
|
+
metadataUpdated.push(update);
|
|
6247
|
+
}
|
|
6248
|
+
return metadataUpdated;
|
|
6249
|
+
}
|
|
6250
|
+
if ('action' in metadata && metadata.action === 'remove' && metadata.value.length) {
|
|
6251
|
+
for (let i = 0; i < metadata.value.length; i++) {
|
|
6252
|
+
await this.mutation('delete_category_metadata', ['affected_rows'], {
|
|
6253
|
+
where: {
|
|
6254
|
+
type: 'category_metadata_bool_exp',
|
|
6255
|
+
required: true,
|
|
6256
|
+
value: { category_id: { _eq: categoryId }, shop: metadata.value[i].shop },
|
|
6257
|
+
},
|
|
6258
|
+
});
|
|
6259
|
+
}
|
|
6260
|
+
return [];
|
|
6261
|
+
}
|
|
6131
6262
|
}
|
|
6132
6263
|
}
|
|
6133
6264
|
__decorate([
|
|
@@ -6149,4 +6280,4 @@ __decorate([
|
|
|
6149
6280
|
__metadata("design:returntype", Promise)
|
|
6150
6281
|
], WishlistHasuraGraphQLRepository.prototype, "getCategoryByShop", null);
|
|
6151
6282
|
|
|
6152
|
-
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, 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, Plans, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductReviews, ProductReviewsHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, 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, UpdateUserImage, 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 };
|
|
6283
|
+
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, 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, Plans, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductReviews, ProductReviewsHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, 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, UpdateUserImage, 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 };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseModel, GenericIdentifier, ModelBaseStructure } from '../../generic/model';
|
|
2
2
|
import { Shops } from './enums';
|
|
3
3
|
import { Filter } from './filter';
|
|
4
|
-
import { CategoryCondition, CategoryMetadata } from './types';
|
|
4
|
+
import { CategoryCondition, CategoryImages, CategoryMetadata, CategoryMostRelevant } from './types';
|
|
5
5
|
export declare class CategoryBase<ChildCategory extends ModelBaseStructure<ChildCategory, Identifiers> = ModelBaseStructure<any, any>, Identifiers = ChildCategory['identifiersFields']> extends BaseModel<ChildCategory, Identifiers> {
|
|
6
6
|
id: string;
|
|
7
7
|
brandCategory: boolean;
|
|
@@ -9,6 +9,7 @@ export declare class CategoryBase<ChildCategory extends ModelBaseStructure<Child
|
|
|
9
9
|
name: string;
|
|
10
10
|
slug: string;
|
|
11
11
|
image?: string;
|
|
12
|
+
images?: CategoryImages;
|
|
12
13
|
brandCategoryBanner?: string;
|
|
13
14
|
brandCategoryBannerMobile?: string;
|
|
14
15
|
description: string;
|
|
@@ -19,15 +20,28 @@ export declare class CategoryBase<ChildCategory extends ModelBaseStructure<Child
|
|
|
19
20
|
shop?: Shops;
|
|
20
21
|
shops?: string[];
|
|
21
22
|
published: boolean;
|
|
22
|
-
metadata: CategoryMetadata;
|
|
23
|
+
metadata: CategoryMetadata[];
|
|
23
24
|
isCollection?: boolean;
|
|
24
25
|
isWishlist?: boolean;
|
|
25
26
|
reference?: string;
|
|
26
27
|
parentId?: number;
|
|
27
28
|
theme?: string;
|
|
28
29
|
bannerUrl?: string;
|
|
29
|
-
mostRelevant?:
|
|
30
|
+
mostRelevant?: CategoryMostRelevant;
|
|
30
31
|
parent?: CategoryBase;
|
|
31
32
|
filters?: Filter[];
|
|
32
33
|
static get identifiersFields(): GenericIdentifier[];
|
|
34
|
+
get glamImages(): {
|
|
35
|
+
image: string;
|
|
36
|
+
brandBanner: string;
|
|
37
|
+
brandBannerMobile: string;
|
|
38
|
+
};
|
|
39
|
+
get mensImages(): {
|
|
40
|
+
image: string;
|
|
41
|
+
brandBanner: string;
|
|
42
|
+
brandBannerMobile: string;
|
|
43
|
+
};
|
|
44
|
+
get glamMetadata(): CategoryMetadata;
|
|
45
|
+
get mensMetadata(): CategoryMetadata;
|
|
46
|
+
getMostRelevantByShop(shop: Shops): string[];
|
|
33
47
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseModel, GenericIdentifier } from '../../generic/model';
|
|
2
|
+
import { Category } from './category';
|
|
2
3
|
import { FilterOption } from './filter-option';
|
|
3
4
|
export declare class Filter extends BaseModel<Filter> {
|
|
4
5
|
id: number;
|
|
@@ -8,5 +9,6 @@ export declare class Filter extends BaseModel<Filter> {
|
|
|
8
9
|
options?: FilterOption[];
|
|
9
10
|
createdAt?: Date;
|
|
10
11
|
updatedAt?: Date;
|
|
12
|
+
categories?: Category[];
|
|
11
13
|
static get identifiersFields(): GenericIdentifier[];
|
|
12
14
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
export * from './category-condition.type';
|
|
2
|
+
export * from './category-images.type';
|
|
2
3
|
export * from './category-metadata.type';
|
|
4
|
+
export * from './category-most-relevant.type';
|
|
3
5
|
export * from './category-product';
|
|
4
6
|
export * from './product-evaluation.type';
|
|
5
7
|
export * from './product-gender.type';
|
|
6
8
|
export * from './product-metadata.type';
|
|
7
9
|
export * from './product-review.type';
|
|
10
|
+
export * from './report-stock-notification.type';
|
|
8
11
|
export * from './shop-description.type';
|
|
9
12
|
export * from './shop-price.type';
|
|
10
13
|
export * from './stock.type';
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { CrudRepository } from '../../generic/repository/crud.repository';
|
|
2
|
-
import { ProductStockNotification, Shops } from '../models';
|
|
2
|
+
import { ProductStockNotification, ReportStockNotification, Shops } from '../models';
|
|
3
3
|
export interface ProductStockNotificationRepository extends CrudRepository<ProductStockNotification> {
|
|
4
4
|
addCustomerEmail(shop: Shops, productId: string, name: string, email: string): Promise<void>;
|
|
5
|
+
getNotificationsReport({ ean, sku, name, category, reference, emailsCount, }: {
|
|
6
|
+
ean?: string;
|
|
7
|
+
sku?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
category?: string;
|
|
10
|
+
reference?: string;
|
|
11
|
+
emailsCount?: number;
|
|
12
|
+
}): Promise<ReportStockNotification[]>;
|
|
5
13
|
}
|
|
@@ -56,7 +56,7 @@ export declare class Coupon extends BaseModel<Coupon> {
|
|
|
56
56
|
createdAt: Date;
|
|
57
57
|
updatedAt?: Date;
|
|
58
58
|
checkoutType: CheckoutTypes;
|
|
59
|
-
exclusivityType?: [
|
|
59
|
+
exclusivityType?: Exclusivities[];
|
|
60
60
|
get isInfluencer(): boolean;
|
|
61
61
|
static get identifiersFields(): GenericIdentifier[];
|
|
62
62
|
static createCoupon(userId: string): Coupon;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseModel, GenericIdentifier } from '../../generic';
|
|
2
|
+
import { UserAddress } from '../../users';
|
|
3
|
+
export declare class OrderBlocked extends BaseModel<OrderBlocked> {
|
|
4
|
+
id?: string;
|
|
5
|
+
customer: {
|
|
6
|
+
name: string;
|
|
7
|
+
cpf: string;
|
|
8
|
+
id: string;
|
|
9
|
+
email: string;
|
|
10
|
+
phoneNumber: string;
|
|
11
|
+
isSubscriber: boolean;
|
|
12
|
+
subscriptionPlan: string;
|
|
13
|
+
shippingAddress: UserAddress;
|
|
14
|
+
};
|
|
15
|
+
blockType: string;
|
|
16
|
+
limiteRange: string;
|
|
17
|
+
type: string;
|
|
18
|
+
card?: any;
|
|
19
|
+
checkout: {
|
|
20
|
+
id: string;
|
|
21
|
+
shop: string;
|
|
22
|
+
total: number;
|
|
23
|
+
};
|
|
24
|
+
date: Date;
|
|
25
|
+
static get identifiersFields(): GenericIdentifier[];
|
|
26
|
+
}
|
|
@@ -4,6 +4,7 @@ export * from './campaign-hashtag.repository';
|
|
|
4
4
|
export * from './checkout.repository';
|
|
5
5
|
export * from './coupon.repository';
|
|
6
6
|
export * from './legacy-order.repository';
|
|
7
|
+
export * from './order-blocked.repository';
|
|
7
8
|
export * from './order.repository';
|
|
8
9
|
export * from './payment.repository';
|
|
9
10
|
export * from './subscription';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CrudRepository } from '../../generic/repository/crud.repository';
|
|
2
|
+
import { Checkout, OrderBlocked } from '../models';
|
|
3
|
+
import { PaymentCardInfo } from '../types';
|
|
4
|
+
export interface OrderBlockedRepository extends CrudRepository<OrderBlocked> {
|
|
5
|
+
createBlockedOrderOrPayment(checkout: Checkout, blockType: string, type: string, limiteRange: string, card?: PaymentCardInfo): Promise<OrderBlocked>;
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './payment-card-info.type';
|
|
@@ -5,6 +5,7 @@ export * from './checkout-firestore.repository';
|
|
|
5
5
|
export * from './checkout-subscription-firestore.repository';
|
|
6
6
|
export * from './coupon-firestore.repository';
|
|
7
7
|
export * from './legacy-order-firestore.repository';
|
|
8
|
+
export * from './order-blocked-firestore.repository.ts';
|
|
8
9
|
export * from './order-firestore.repository';
|
|
9
10
|
export * from './payment-firestore.repository';
|
|
10
11
|
export * from './subscription-plan-firestore.repository';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Checkout, OrderBlocked, OrderBlockedRepository, PaymentCardInfo } from '../../../../../domain';
|
|
2
|
+
import { FirestoreConstructorParams } from '../../mixins';
|
|
3
|
+
declare const OrderBlockedFirestoreRepository_base: import("../../../../../utils").MixinCtor<import("../..").FirestoreRepository<OrderBlocked> & import("../../../../../domain").CrudRepository<OrderBlocked, import("../../../../../domain").CrudParams<OrderBlocked>> & import("../..").FirestoreHelpers, [FirestoreConstructorParams<OrderBlocked>, ...any[]]>;
|
|
4
|
+
export declare class OrderBlockedFirestoreRepository extends OrderBlockedFirestoreRepository_base implements OrderBlockedRepository {
|
|
5
|
+
constructor({ firestore, interceptors, }: Pick<FirestoreConstructorParams<OrderBlocked>, 'firestore' | 'interceptors'>);
|
|
6
|
+
createBlockedOrderOrPayment(checkout: Checkout, blockType: string, type: string, limiteRange: string, card?: PaymentCardInfo): Promise<OrderBlocked>;
|
|
7
|
+
private formatZip;
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
@@ -9,12 +9,12 @@ export declare class ConnectCollectionService<T extends ConnectDocumentData> imp
|
|
|
9
9
|
private orderBys;
|
|
10
10
|
private limitBy;
|
|
11
11
|
private offsetBy;
|
|
12
|
-
private
|
|
12
|
+
private startingAt;
|
|
13
13
|
private startingAfter;
|
|
14
14
|
private converter;
|
|
15
15
|
constructor(path: string, firestore: Firestore);
|
|
16
16
|
add(data: T, id?: string): Promise<ConnectDocumentReference<T>>;
|
|
17
|
-
getDocs(): Promise<ConnectQuerySnapshot<T
|
|
17
|
+
getDocs(): Promise<ConnectQuerySnapshot<T> | any>;
|
|
18
18
|
getDoc(id?: string): ConnectDocumentReference<T>;
|
|
19
19
|
where(attribute: string, operator: ConnectWhereOption, value: any): ConnectCollectionReference<T>;
|
|
20
20
|
order(attribute: string, order: 'asc' | 'desc'): ConnectCollectionReference<T>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Filter, ProductStockNotification, Shops } from '../../../../domain';
|
|
1
|
+
import { Filter, ProductStockNotification, ReportStockNotification, Shops } from '../../../../domain';
|
|
2
2
|
import { ProductStockNotificationRepository } from '../../../../domain/catalog/repositories';
|
|
3
3
|
import { HasuraConstructorParams } from '../../mixins';
|
|
4
4
|
declare const ProductStockNotificationHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../..").GraphQLRepository<ProductStockNotification> & import("../../../../domain").CrudRepository<ProductStockNotification, import("../../../../domain").CrudParams<ProductStockNotification>> & import("../../../../domain").UpdateRepository<ProductStockNotification, import("../../../../domain").RepositoryUpdateParams<ProductStockNotification>> & {
|
|
@@ -7,5 +7,13 @@ declare const ProductStockNotificationHasuraGraphQLRepository_base: import("../.
|
|
|
7
7
|
export declare class ProductStockNotificationHasuraGraphQLRepository extends ProductStockNotificationHasuraGraphQLRepository_base implements ProductStockNotificationRepository {
|
|
8
8
|
constructor({ endpoint, authOptions, interceptors, }: Pick<HasuraConstructorParams<Filter>, 'endpoint' | 'authOptions' | 'interceptors'>);
|
|
9
9
|
addCustomerEmail(shop: Shops, productId: string, name: string, email: string): Promise<void>;
|
|
10
|
+
getNotificationsReport({ ean, sku, name, category, reference, emailsCount, }: {
|
|
11
|
+
ean?: string;
|
|
12
|
+
sku?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
category?: string;
|
|
15
|
+
reference?: string;
|
|
16
|
+
emailsCount?: number;
|
|
17
|
+
}): Promise<ReportStockNotification[]>;
|
|
10
18
|
}
|
|
11
19
|
export {};
|