@infrab4a/connect 1.0.5 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/infrab4a-connect.umd.js +68 -73
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/domain/catalog/models/enums/index.d.ts +0 -1
- package/domain/catalog/models/enums/shops.enum.d.ts +2 -1
- package/domain/catalog/models/product.d.ts +1 -2
- package/domain/catalog/models/types/index.d.ts +3 -4
- package/domain/shopping/models/coupons/coupon.d.ts +12 -6
- package/domain/shopping/models/coupons/enums/coupon-club-mens.enum.d.ts +5 -0
- package/domain/shopping/models/coupons/enums/coupon-types.enum.d.ts +2 -4
- package/domain/shopping/models/coupons/enums/exclusivities.enum.d.ts +4 -1
- package/domain/shopping/models/coupons/index.d.ts +0 -1
- package/domain/shopping/models/enums/checkout-types.enum.d.ts +2 -1
- package/esm2015/domain/catalog/models/enums/index.js +1 -2
- package/esm2015/domain/catalog/models/enums/shops.enum.js +2 -1
- package/esm2015/domain/catalog/models/product.js +1 -1
- package/esm2015/domain/catalog/models/types/index.js +4 -5
- package/esm2015/domain/shopping/models/coupons/coupon.js +18 -3
- package/esm2015/domain/shopping/models/coupons/enums/coupon-club-mens.enum.js +7 -0
- package/esm2015/domain/shopping/models/coupons/enums/coupon-subtypes.enum.js +1 -1
- package/esm2015/domain/shopping/models/coupons/enums/coupon-types.enum.js +7 -5
- package/esm2015/domain/shopping/models/coupons/enums/exclusivities.enum.js +4 -1
- package/esm2015/domain/shopping/models/coupons/index.js +1 -2
- package/esm2015/domain/shopping/models/enums/checkout-types.enum.js +2 -1
- package/esm2015/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.js +4 -5
- package/fesm2015/infrab4a-connect.js +36 -47
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/package.json +1 -1
- package/domain/catalog/models/enums/product-genders.enum.d.ts +0 -5
- package/domain/catalog/models/types/product-gender.type.d.ts +0 -1
- package/domain/shopping/models/coupons/financial-coupon.d.ts +0 -9
- package/esm2015/domain/catalog/models/enums/product-genders.enum.js +0 -7
- package/esm2015/domain/catalog/models/types/product-gender.type.js +0 -2
- package/esm2015/domain/shopping/models/coupons/financial-coupon.js +0 -28
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('reflect-metadata'), require('class-transformer'), require('date-fns'), require('lodash'), require('ts-custom-error'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@infrab4a/connect', ['exports', 'reflect-metadata', 'class-transformer', 'date-fns', 'lodash', 'ts-custom-error', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a.connect = {}), null, global["class-transformer"], global["date-fns"], global.lodash, global["ts-custom-error"], global
|
|
5
|
-
})(this, (function (exports, reflectMetadata, classTransformer, dateFns, lodash, tsCustomError,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('reflect-metadata'), require('class-transformer'), require('date-fns'), require('lodash'), require('ts-custom-error'), require('axios'), require('firebase'), require('gql-query-builder'), require('node-fetch')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@infrab4a/connect', ['exports', 'reflect-metadata', 'class-transformer', 'date-fns', 'lodash', 'ts-custom-error', 'axios', 'firebase', 'gql-query-builder', 'node-fetch'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a.connect = {}), null, global["class-transformer"], global["date-fns"], global.lodash, global["ts-custom-error"], global.axios, global.firebase, global["gql-query-builder"], global["node-fetch"]));
|
|
5
|
+
})(this, (function (exports, reflectMetadata, classTransformer, dateFns, lodash, tsCustomError, axios, firebase, gqlQueryBuilder, fetch) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -289,7 +289,7 @@
|
|
|
289
289
|
Status["CANCELLED"] = "Cancelado";
|
|
290
290
|
})(exports.Status || (exports.Status = {}));
|
|
291
291
|
|
|
292
|
-
|
|
292
|
+
/******************************************************************************
|
|
293
293
|
Copyright (c) Microsoft Corporation.
|
|
294
294
|
|
|
295
295
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -387,7 +387,7 @@
|
|
|
387
387
|
function step(op) {
|
|
388
388
|
if (f)
|
|
389
389
|
throw new TypeError("Generator is already executing.");
|
|
390
|
-
while (_)
|
|
390
|
+
while (g && (g = 0, op[0] && (_ = 0)), _)
|
|
391
391
|
try {
|
|
392
392
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
393
393
|
return t;
|
|
@@ -451,7 +451,11 @@
|
|
|
451
451
|
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
452
452
|
if (k2 === undefined)
|
|
453
453
|
k2 = k;
|
|
454
|
-
Object.
|
|
454
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
455
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
456
|
+
desc = { enumerable: true, get: function () { return m[k]; } };
|
|
457
|
+
}
|
|
458
|
+
Object.defineProperty(o, k2, desc);
|
|
455
459
|
}) : (function (o, m, k, k2) {
|
|
456
460
|
if (k2 === undefined)
|
|
457
461
|
k2 = k;
|
|
@@ -606,6 +610,11 @@
|
|
|
606
610
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
607
611
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
608
612
|
}
|
|
613
|
+
function __classPrivateFieldIn(state, receiver) {
|
|
614
|
+
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
|
|
615
|
+
throw new TypeError("Cannot use 'in' operator on non-object");
|
|
616
|
+
return typeof state === "function" ? receiver === state : state.has(receiver);
|
|
617
|
+
}
|
|
609
618
|
|
|
610
619
|
var Edition = /** @class */ (function (_super) {
|
|
611
620
|
__extends(Edition, _super);
|
|
@@ -856,6 +865,40 @@
|
|
|
856
865
|
return date;
|
|
857
866
|
};
|
|
858
867
|
|
|
868
|
+
exports.CheckoutTypes = void 0;
|
|
869
|
+
(function (CheckoutTypes) {
|
|
870
|
+
CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
|
|
871
|
+
CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
|
|
872
|
+
CheckoutTypes[CheckoutTypes["ALL"] = 3] = "ALL";
|
|
873
|
+
})(exports.CheckoutTypes || (exports.CheckoutTypes = {}));
|
|
874
|
+
|
|
875
|
+
exports.CouponTypes = void 0;
|
|
876
|
+
(function (CouponTypes) {
|
|
877
|
+
CouponTypes[CouponTypes["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
878
|
+
CouponTypes[CouponTypes["PERCENTAGE"] = 2] = "PERCENTAGE";
|
|
879
|
+
// FINANCIAL = 1,
|
|
880
|
+
// PRODUCT,
|
|
881
|
+
// GIFTCARD,
|
|
882
|
+
// VOUCHER,
|
|
883
|
+
})(exports.CouponTypes || (exports.CouponTypes = {}));
|
|
884
|
+
|
|
885
|
+
exports.CouponSubtypes = void 0;
|
|
886
|
+
(function (CouponSubtypes) {
|
|
887
|
+
CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
888
|
+
CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
|
|
889
|
+
})(exports.CouponSubtypes || (exports.CouponSubtypes = {}));
|
|
890
|
+
|
|
891
|
+
exports.Exclusivities = void 0;
|
|
892
|
+
(function (Exclusivities) {
|
|
893
|
+
Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
|
|
894
|
+
Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
|
|
895
|
+
Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
|
|
896
|
+
Exclusivities[Exclusivities["ACTIVE_SUBSCRIBER"] = 4] = "ACTIVE_SUBSCRIBER";
|
|
897
|
+
Exclusivities[Exclusivities["INACTIVE_SUBSCRIBER"] = 5] = "INACTIVE_SUBSCRIBER";
|
|
898
|
+
Exclusivities[Exclusivities["NON_SUBSCRIBER"] = 6] = "NON_SUBSCRIBER";
|
|
899
|
+
})(exports.Exclusivities || (exports.Exclusivities = {}));
|
|
900
|
+
|
|
901
|
+
var COUPON_EXPIRATION = +1000 * 60 * 60 * 24 * 30;
|
|
859
902
|
var Coupon = /** @class */ (function (_super) {
|
|
860
903
|
__extends(Coupon, _super);
|
|
861
904
|
function Coupon() {
|
|
@@ -875,6 +918,20 @@
|
|
|
875
918
|
enumerable: false,
|
|
876
919
|
configurable: true
|
|
877
920
|
});
|
|
921
|
+
Coupon.createCoupon = function (userId) {
|
|
922
|
+
return this.toInstance({
|
|
923
|
+
nickname: "" + Date.now(),
|
|
924
|
+
type: exports.CouponTypes.ABSOLUTE,
|
|
925
|
+
checkoutType: exports.CheckoutTypes.ECOMMERCE,
|
|
926
|
+
discount: 30,
|
|
927
|
+
user: userId,
|
|
928
|
+
useLimit: 1,
|
|
929
|
+
useLimitPerUser: true,
|
|
930
|
+
createdAt: new Date(Date.now()),
|
|
931
|
+
beginAt: new Date(Date.now()),
|
|
932
|
+
expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
|
|
933
|
+
});
|
|
934
|
+
};
|
|
878
935
|
return Coupon;
|
|
879
936
|
}(BaseModel));
|
|
880
937
|
__decorate([
|
|
@@ -1221,18 +1278,12 @@
|
|
|
1221
1278
|
return Category;
|
|
1222
1279
|
}(BaseModel));
|
|
1223
1280
|
|
|
1224
|
-
exports.GenderDestination = void 0;
|
|
1225
|
-
(function (GenderDestination) {
|
|
1226
|
-
GenderDestination["FEMALE"] = "female";
|
|
1227
|
-
GenderDestination["MALE"] = "male";
|
|
1228
|
-
GenderDestination["UNISEX"] = "unisex";
|
|
1229
|
-
})(exports.GenderDestination || (exports.GenderDestination = {}));
|
|
1230
|
-
|
|
1231
1281
|
exports.Shops = void 0;
|
|
1232
1282
|
(function (Shops) {
|
|
1233
1283
|
Shops["MENSMARKET"] = "mensmarket";
|
|
1234
1284
|
Shops["GLAMSHOP"] = "Glamshop";
|
|
1235
1285
|
Shops["GLAMPOINTS"] = "Glampoints";
|
|
1286
|
+
Shops["ALL"] = "ALL";
|
|
1236
1287
|
})(exports.Shops || (exports.Shops = {}));
|
|
1237
1288
|
|
|
1238
1289
|
var Product = /** @class */ (function (_super) {
|
|
@@ -1302,60 +1353,6 @@
|
|
|
1302
1353
|
return Variant;
|
|
1303
1354
|
}(BaseModel));
|
|
1304
1355
|
|
|
1305
|
-
exports.CouponTypes = void 0;
|
|
1306
|
-
(function (CouponTypes) {
|
|
1307
|
-
CouponTypes[CouponTypes["FINANCIAL"] = 1] = "FINANCIAL";
|
|
1308
|
-
CouponTypes[CouponTypes["PRODUCT"] = 2] = "PRODUCT";
|
|
1309
|
-
CouponTypes[CouponTypes["GIFTCARD"] = 3] = "GIFTCARD";
|
|
1310
|
-
CouponTypes[CouponTypes["VOUCHER"] = 4] = "VOUCHER";
|
|
1311
|
-
})(exports.CouponTypes || (exports.CouponTypes = {}));
|
|
1312
|
-
|
|
1313
|
-
exports.CouponSubtypes = void 0;
|
|
1314
|
-
(function (CouponSubtypes) {
|
|
1315
|
-
CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
1316
|
-
CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
|
|
1317
|
-
})(exports.CouponSubtypes || (exports.CouponSubtypes = {}));
|
|
1318
|
-
|
|
1319
|
-
exports.Exclusivities = void 0;
|
|
1320
|
-
(function (Exclusivities) {
|
|
1321
|
-
Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
|
|
1322
|
-
Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
|
|
1323
|
-
Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
|
|
1324
|
-
})(exports.Exclusivities || (exports.Exclusivities = {}));
|
|
1325
|
-
|
|
1326
|
-
exports.CheckoutTypes = void 0;
|
|
1327
|
-
(function (CheckoutTypes) {
|
|
1328
|
-
CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
|
|
1329
|
-
CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
|
|
1330
|
-
})(exports.CheckoutTypes || (exports.CheckoutTypes = {}));
|
|
1331
|
-
|
|
1332
|
-
var COUPON_EXPIRATION = 60 * 60 * 24 * 30;
|
|
1333
|
-
var FinancialCoupon = /** @class */ (function (_super) {
|
|
1334
|
-
__extends(FinancialCoupon, _super);
|
|
1335
|
-
function FinancialCoupon() {
|
|
1336
|
-
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
1337
|
-
_this.type = exports.CouponTypes.FINANCIAL;
|
|
1338
|
-
return _this;
|
|
1339
|
-
}
|
|
1340
|
-
FinancialCoupon.isFinancialCoupon = function (coupon) {
|
|
1341
|
-
return coupon.type === exports.CouponTypes.FINANCIAL && !!coupon.subtype;
|
|
1342
|
-
};
|
|
1343
|
-
FinancialCoupon.createCoupon = function (userId) {
|
|
1344
|
-
return this.toInstance({
|
|
1345
|
-
name: tsMd5.Md5.hashStr(userId + "_" + Date.now).toString(),
|
|
1346
|
-
nickname: "" + Date.now(),
|
|
1347
|
-
type: exports.CouponTypes.FINANCIAL,
|
|
1348
|
-
subtype: exports.CouponSubtypes.PERCENTAGE,
|
|
1349
|
-
checkoutType: exports.CheckoutTypes.ECOMMERCE,
|
|
1350
|
-
discount: 30,
|
|
1351
|
-
user: userId,
|
|
1352
|
-
createdAt: new Date(Date.now()),
|
|
1353
|
-
expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
|
|
1354
|
-
});
|
|
1355
|
-
};
|
|
1356
|
-
return FinancialCoupon;
|
|
1357
|
-
}(Coupon));
|
|
1358
|
-
|
|
1359
1356
|
exports.OrderStatus = void 0;
|
|
1360
1357
|
(function (OrderStatus) {
|
|
1361
1358
|
OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
|
|
@@ -3909,7 +3906,6 @@
|
|
|
3909
3906
|
'type',
|
|
3910
3907
|
'video',
|
|
3911
3908
|
'weight',
|
|
3912
|
-
'gender',
|
|
3913
3909
|
{
|
|
3914
3910
|
shopAvailability: {
|
|
3915
3911
|
columnName: 'shop_availabilities',
|
|
@@ -4194,7 +4190,7 @@
|
|
|
4194
4190
|
where: {
|
|
4195
4191
|
type: 'product_kit_bool_exp',
|
|
4196
4192
|
required: true,
|
|
4197
|
-
value: {
|
|
4193
|
+
value: { product_id: { _eq: productId } },
|
|
4198
4194
|
},
|
|
4199
4195
|
})];
|
|
4200
4196
|
case 1:
|
|
@@ -4204,8 +4200,8 @@
|
|
|
4204
4200
|
type: '[product_kit_insert_input!]',
|
|
4205
4201
|
required: true,
|
|
4206
4202
|
value: plainData.kitProducts.map(function (kitProduct) { return ({
|
|
4207
|
-
kit_product_id: productId,
|
|
4208
|
-
product_id:
|
|
4203
|
+
kit_product_id: kitProduct.productId || kitProduct.product.id,
|
|
4204
|
+
product_id: productId,
|
|
4209
4205
|
quantity: kitProduct.quantity,
|
|
4210
4206
|
}); }),
|
|
4211
4207
|
},
|
|
@@ -4679,7 +4675,6 @@
|
|
|
4679
4675
|
exports.CouponFirestoreRepository = CouponFirestoreRepository;
|
|
4680
4676
|
exports.DuplicatedResultsError = DuplicatedResultsError;
|
|
4681
4677
|
exports.Edition = Edition;
|
|
4682
|
-
exports.FinancialCoupon = FinancialCoupon;
|
|
4683
4678
|
exports.Home = Home;
|
|
4684
4679
|
exports.HomeFirestoreRepository = HomeFirestoreRepository;
|
|
4685
4680
|
exports.InvalidArgumentError = InvalidArgumentError;
|