@infrab4a/connect 0.17.0-beta.9 → 0.17.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/bundles/infrab4a-connect.umd.js +88 -55
  2. package/bundles/infrab4a-connect.umd.js.map +1 -1
  3. package/domain/catalog/models/enums/shops.enum.d.ts +1 -2
  4. package/domain/shop-settings/models/index.d.ts +1 -0
  5. package/domain/shop-settings/models/shop-settings.d.ts +6 -0
  6. package/domain/shop-settings/repositories/index.d.ts +1 -0
  7. package/domain/shop-settings/repositories/shop-settings.repository.d.ts +4 -0
  8. package/domain/shopping/models/coupons/coupon.d.ts +5 -10
  9. package/domain/shopping/models/coupons/enums/coupon-types.enum.d.ts +4 -2
  10. package/domain/shopping/models/coupons/enums/exclusivities.enum.d.ts +1 -4
  11. package/domain/shopping/models/coupons/financial-coupon.d.ts +9 -0
  12. package/domain/shopping/models/coupons/index.d.ts +1 -0
  13. package/domain/shopping/models/enums/checkout-types.enum.d.ts +1 -2
  14. package/esm2015/domain/catalog/models/enums/shops.enum.js +1 -2
  15. package/esm2015/domain/shop-settings/models/index.js +2 -1
  16. package/esm2015/domain/shop-settings/models/shop-settings.js +7 -0
  17. package/esm2015/domain/shop-settings/repositories/index.js +2 -1
  18. package/esm2015/domain/shop-settings/repositories/shop-settings.repository.js +2 -0
  19. package/esm2015/domain/shopping/models/coupons/coupon.js +2 -17
  20. package/esm2015/domain/shopping/models/coupons/enums/coupon-subtypes.enum.js +1 -1
  21. package/esm2015/domain/shopping/models/coupons/enums/coupon-types.enum.js +5 -7
  22. package/esm2015/domain/shopping/models/coupons/enums/exclusivities.enum.js +1 -4
  23. package/esm2015/domain/shopping/models/coupons/financial-coupon.js +28 -0
  24. package/esm2015/domain/shopping/models/coupons/index.js +2 -1
  25. package/esm2015/domain/shopping/models/enums/checkout-types.enum.js +1 -2
  26. package/esm2015/infra/firebase/firestore/repositories/catalog/category-firestore.repository.js +4 -2
  27. package/esm2015/infra/firebase/firestore/repositories/catalog/product-firestore.repository.js +2 -2
  28. package/esm2015/infra/firebase/firestore/repositories/shop-settings/index.js +2 -1
  29. package/esm2015/infra/firebase/firestore/repositories/shop-settings/shop-settings-firestore.repository.js +12 -0
  30. package/fesm2015/infrab4a-connect.js +49 -29
  31. package/fesm2015/infrab4a-connect.js.map +1 -1
  32. package/infra/firebase/firestore/repositories/shop-settings/index.d.ts +1 -0
  33. package/infra/firebase/firestore/repositories/shop-settings/shop-settings-firestore.repository.d.ts +49 -0
  34. package/package.json +1 -1
  35. package/domain/shopping/models/coupons/enums/coupon-club-mens.enum.d.ts +0 -5
  36. package/esm2015/domain/shopping/models/coupons/enums/coupon-club-mens.enum.js +0 -7
@@ -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('axios'), require('firebase'), require('firebase/app')) :
3
- typeof define === 'function' && define.amd ? define('@infrab4a/connect', ['exports', 'reflect-metadata', 'class-transformer', 'date-fns', 'lodash', 'axios', 'firebase', 'firebase/app'], 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.axios, global.firebase, global.firebase$1));
5
- })(this, (function (exports, reflectMetadata, classTransformer, dateFns, lodash, axios, firebase, firebase$1) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('reflect-metadata'), require('class-transformer'), require('date-fns'), require('lodash'), require('ts-md5'), require('axios'), require('firebase'), require('firebase/app')) :
3
+ typeof define === 'function' && define.amd ? define('@infrab4a/connect', ['exports', 'reflect-metadata', 'class-transformer', 'date-fns', 'lodash', 'ts-md5', 'axios', 'firebase', 'firebase/app'], 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.tsMd5, global.axios, global.firebase, global.firebase$1));
5
+ })(this, (function (exports, reflectMetadata, classTransformer, dateFns, lodash, tsMd5, axios, firebase, firebase$1) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -787,13 +787,6 @@
787
787
  return Address;
788
788
  }(BaseModel));
789
789
 
790
- exports.CheckoutTypes = void 0;
791
- (function (CheckoutTypes) {
792
- CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
793
- CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
794
- CheckoutTypes[CheckoutTypes["ALL"] = 3] = "ALL";
795
- })(exports.CheckoutTypes || (exports.CheckoutTypes = {}));
796
-
797
790
  var Base = /** @class */ (function () {
798
791
  function Base() {
799
792
  var args = [];
@@ -805,33 +798,6 @@
805
798
  return Base;
806
799
  }());
807
800
 
808
- exports.CouponTypes = void 0;
809
- (function (CouponTypes) {
810
- CouponTypes[CouponTypes["ABSOLUTE"] = 1] = "ABSOLUTE";
811
- CouponTypes[CouponTypes["PERCENTAGE"] = 2] = "PERCENTAGE";
812
- // FINANCIAL = 1,
813
- // PRODUCT,
814
- // GIFTCARD,
815
- // VOUCHER,
816
- })(exports.CouponTypes || (exports.CouponTypes = {}));
817
-
818
- exports.CouponSubtypes = void 0;
819
- (function (CouponSubtypes) {
820
- CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
821
- CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
822
- })(exports.CouponSubtypes || (exports.CouponSubtypes = {}));
823
-
824
- exports.Exclusivities = void 0;
825
- (function (Exclusivities) {
826
- Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
827
- Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
828
- Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
829
- Exclusivities[Exclusivities["ACTIVE_SUBSCRIBER"] = 4] = "ACTIVE_SUBSCRIBER";
830
- Exclusivities[Exclusivities["INACTIVE_SUBSCRIBER"] = 5] = "INACTIVE_SUBSCRIBER";
831
- Exclusivities[Exclusivities["NON_SUBSCRIBER"] = 6] = "NON_SUBSCRIBER";
832
- })(exports.Exclusivities || (exports.Exclusivities = {}));
833
-
834
- var COUPON_EXPIRATION = 60 * 60 * 24 * 30;
835
801
  var Coupon = /** @class */ (function (_super) {
836
802
  __extends(Coupon, _super);
837
803
  function Coupon() {
@@ -847,20 +813,6 @@
847
813
  Coupon.prototype.identifierFields = function () {
848
814
  return ['id'];
849
815
  };
850
- Coupon.createCoupon = function (userId) {
851
- return this.toInstance({
852
- nickname: "" + Date.now(),
853
- type: exports.CouponTypes.ABSOLUTE,
854
- checkoutType: exports.CheckoutTypes.ECOMMERCE,
855
- discount: 30,
856
- user: userId,
857
- useLimit: 1,
858
- useLimitPerUser: true,
859
- createdAt: new Date(Date.now()),
860
- beginAt: new Date(Date.now()),
861
- expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
862
- });
863
- };
864
816
  return Coupon;
865
817
  }(BaseModel));
866
818
  __decorate([
@@ -1166,7 +1118,6 @@
1166
1118
  Shops["MENSMARKET"] = "mensmarket";
1167
1119
  Shops["GLAMSHOP"] = "Glamshop";
1168
1120
  Shops["GLAMPOINTS"] = "Glampoints";
1169
- Shops["ALL"] = "ALL";
1170
1121
  })(exports.Shops || (exports.Shops = {}));
1171
1122
 
1172
1123
  var Category = /** @class */ (function (_super) {
@@ -1206,6 +1157,60 @@
1206
1157
  return Variant;
1207
1158
  }(BaseModel));
1208
1159
 
1160
+ exports.CouponTypes = void 0;
1161
+ (function (CouponTypes) {
1162
+ CouponTypes[CouponTypes["FINANCIAL"] = 1] = "FINANCIAL";
1163
+ CouponTypes[CouponTypes["PRODUCT"] = 2] = "PRODUCT";
1164
+ CouponTypes[CouponTypes["GIFTCARD"] = 3] = "GIFTCARD";
1165
+ CouponTypes[CouponTypes["VOUCHER"] = 4] = "VOUCHER";
1166
+ })(exports.CouponTypes || (exports.CouponTypes = {}));
1167
+
1168
+ exports.CouponSubtypes = void 0;
1169
+ (function (CouponSubtypes) {
1170
+ CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
1171
+ CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
1172
+ })(exports.CouponSubtypes || (exports.CouponSubtypes = {}));
1173
+
1174
+ exports.Exclusivities = void 0;
1175
+ (function (Exclusivities) {
1176
+ Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
1177
+ Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
1178
+ Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
1179
+ })(exports.Exclusivities || (exports.Exclusivities = {}));
1180
+
1181
+ exports.CheckoutTypes = void 0;
1182
+ (function (CheckoutTypes) {
1183
+ CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
1184
+ CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
1185
+ })(exports.CheckoutTypes || (exports.CheckoutTypes = {}));
1186
+
1187
+ var COUPON_EXPIRATION = 60 * 60 * 24 * 30;
1188
+ var FinancialCoupon = /** @class */ (function (_super) {
1189
+ __extends(FinancialCoupon, _super);
1190
+ function FinancialCoupon() {
1191
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
1192
+ _this.type = exports.CouponTypes.FINANCIAL;
1193
+ return _this;
1194
+ }
1195
+ FinancialCoupon.isFinancialCoupon = function (coupon) {
1196
+ return coupon.type === exports.CouponTypes.FINANCIAL && !!coupon.subtype;
1197
+ };
1198
+ FinancialCoupon.createCoupon = function (userId) {
1199
+ return this.toInstance({
1200
+ name: tsMd5.Md5.hashStr(userId + "_" + Date.now).toString(),
1201
+ nickname: "" + Date.now(),
1202
+ type: exports.CouponTypes.FINANCIAL,
1203
+ subtype: exports.CouponSubtypes.PERCENTAGE,
1204
+ checkoutType: exports.CheckoutTypes.ECOMMERCE,
1205
+ discount: 30,
1206
+ user: userId,
1207
+ createdAt: new Date(Date.now()),
1208
+ expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
1209
+ });
1210
+ };
1211
+ return FinancialCoupon;
1212
+ }(Coupon));
1213
+
1209
1214
  exports.OrderStatus = void 0;
1210
1215
  (function (OrderStatus) {
1211
1216
  OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
@@ -1437,6 +1442,17 @@
1437
1442
  return ShopMenu;
1438
1443
  }(BaseModel));
1439
1444
 
1445
+ var ShopSettings = /** @class */ (function (_super) {
1446
+ __extends(ShopSettings, _super);
1447
+ function ShopSettings() {
1448
+ return _super !== null && _super.apply(this, arguments) || this;
1449
+ }
1450
+ ShopSettings.prototype.identifierFields = function () {
1451
+ return ['id'];
1452
+ };
1453
+ return ShopSettings;
1454
+ }(BaseModel));
1455
+
1440
1456
  var InvalidArgumentError = /** @class */ (function (_super) {
1441
1457
  __extends(InvalidArgumentError, _super);
1442
1458
  function InvalidArgumentError(message) {
@@ -2238,7 +2254,9 @@
2238
2254
  productIds = chunks_1_1.value;
2239
2255
  if ((options === null || options === void 0 ? void 0 : options.limit) && products.length >= (options === null || options === void 0 ? void 0 : options.limit))
2240
2256
  return [3 /*break*/, 6];
2241
- return [4 /*yield*/, this.collection('products').where(publishedField, '==', true).where('id', 'in', productIds)];
2257
+ return [4 /*yield*/, this.collection('productsErpVitrine')
2258
+ .where(publishedField, '==', true)
2259
+ .where('id', 'in', productIds)];
2242
2260
  case 3:
2243
2261
  query = _b.sent();
2244
2262
  if (options === null || options === void 0 ? void 0 : options.hasStock)
@@ -2279,7 +2297,7 @@
2279
2297
  function ProductFirestoreRepository(firestore) {
2280
2298
  var _this = _super.call(this) || this;
2281
2299
  _this.firestore = firestore;
2282
- _this.collectionName = 'products';
2300
+ _this.collectionName = 'productsErpVitrine';
2283
2301
  _this.model = Product;
2284
2302
  return _this;
2285
2303
  }
@@ -2509,6 +2527,18 @@
2509
2527
  return ShopMenuFirestoreRepository;
2510
2528
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
2511
2529
 
2530
+ var ShopSettingsFirestoreRepository = /** @class */ (function (_super) {
2531
+ __extends(ShopSettingsFirestoreRepository, _super);
2532
+ function ShopSettingsFirestoreRepository(firestore) {
2533
+ var _this = _super.call(this) || this;
2534
+ _this.firestore = firestore;
2535
+ _this.collectionName = 'shopSettings';
2536
+ _this.model = ShopSettings;
2537
+ return _this;
2538
+ }
2539
+ return ShopSettingsFirestoreRepository;
2540
+ }(withCrudFirestore(withHelpers(withFirestore(Base)))));
2541
+
2512
2542
  var AuthenticationFirebaseAuthService = /** @class */ (function () {
2513
2543
  function AuthenticationFirebaseAuthService(firebaseAuth) {
2514
2544
  this.firebaseAuth = firebaseAuth;
@@ -2691,6 +2721,7 @@
2691
2721
  exports.CouponFirestoreRepository = CouponFirestoreRepository;
2692
2722
  exports.DuplicatedResultsError = DuplicatedResultsError;
2693
2723
  exports.Edition = Edition;
2724
+ exports.FinancialCoupon = FinancialCoupon;
2694
2725
  exports.Home = Home;
2695
2726
  exports.HomeFirestoreRepository = HomeFirestoreRepository;
2696
2727
  exports.InvalidArgumentError = InvalidArgumentError;
@@ -2714,6 +2745,8 @@
2714
2745
  exports.ShippingMethod = ShippingMethod;
2715
2746
  exports.ShopMenu = ShopMenu;
2716
2747
  exports.ShopMenuFirestoreRepository = ShopMenuFirestoreRepository;
2748
+ exports.ShopSettings = ShopSettings;
2749
+ exports.ShopSettingsFirestoreRepository = ShopSettingsFirestoreRepository;
2717
2750
  exports.SignOut = SignOut;
2718
2751
  exports.Subscription = Subscription;
2719
2752
  exports.SubscriptionEditionFirestoreRepository = SubscriptionEditionFirestoreRepository;