@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
|
@@ -6,7 +6,6 @@ export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, f
|
|
|
6
6
|
import { isString, isNil, isNumber, isDate, set, isObject, isEmpty, chunk, isBoolean, isInteger, isNaN as isNaN$1, omit } from 'lodash';
|
|
7
7
|
export { chunk, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set } from 'lodash';
|
|
8
8
|
import { CustomError } from 'ts-custom-error';
|
|
9
|
-
import { Md5 } from 'ts-md5';
|
|
10
9
|
import axios from 'axios';
|
|
11
10
|
import firebase from 'firebase';
|
|
12
11
|
import { mutation, query } from 'gql-query-builder';
|
|
@@ -466,12 +465,6 @@ class Address extends BaseModel {
|
|
|
466
465
|
}
|
|
467
466
|
}
|
|
468
467
|
|
|
469
|
-
var CheckoutTypes;
|
|
470
|
-
(function (CheckoutTypes) {
|
|
471
|
-
CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
|
|
472
|
-
CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
|
|
473
|
-
})(CheckoutTypes || (CheckoutTypes = {}));
|
|
474
|
-
|
|
475
468
|
class Base {
|
|
476
469
|
constructor(...args) {
|
|
477
470
|
Object.assign(this, ...args);
|
|
@@ -492,12 +485,21 @@ const parseDateTime = (value) => {
|
|
|
492
485
|
return date;
|
|
493
486
|
};
|
|
494
487
|
|
|
488
|
+
var CheckoutTypes;
|
|
489
|
+
(function (CheckoutTypes) {
|
|
490
|
+
CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
|
|
491
|
+
CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
|
|
492
|
+
CheckoutTypes[CheckoutTypes["ALL"] = 3] = "ALL";
|
|
493
|
+
})(CheckoutTypes || (CheckoutTypes = {}));
|
|
494
|
+
|
|
495
495
|
var CouponTypes;
|
|
496
496
|
(function (CouponTypes) {
|
|
497
|
-
CouponTypes[CouponTypes["
|
|
498
|
-
CouponTypes[CouponTypes["
|
|
499
|
-
|
|
500
|
-
|
|
497
|
+
CouponTypes[CouponTypes["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
498
|
+
CouponTypes[CouponTypes["PERCENTAGE"] = 2] = "PERCENTAGE";
|
|
499
|
+
// FINANCIAL = 1,
|
|
500
|
+
// PRODUCT,
|
|
501
|
+
// GIFTCARD,
|
|
502
|
+
// VOUCHER,
|
|
501
503
|
})(CouponTypes || (CouponTypes = {}));
|
|
502
504
|
|
|
503
505
|
var CouponSubtypes;
|
|
@@ -511,8 +513,12 @@ var Exclusivities;
|
|
|
511
513
|
Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
|
|
512
514
|
Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
|
|
513
515
|
Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
|
|
516
|
+
Exclusivities[Exclusivities["ACTIVE_SUBSCRIBER"] = 4] = "ACTIVE_SUBSCRIBER";
|
|
517
|
+
Exclusivities[Exclusivities["INACTIVE_SUBSCRIBER"] = 5] = "INACTIVE_SUBSCRIBER";
|
|
518
|
+
Exclusivities[Exclusivities["NON_SUBSCRIBER"] = 6] = "NON_SUBSCRIBER";
|
|
514
519
|
})(Exclusivities || (Exclusivities = {}));
|
|
515
520
|
|
|
521
|
+
const COUPON_EXPIRATION = +1000 * 60 * 60 * 24 * 30;
|
|
516
522
|
class Coupon extends BaseModel {
|
|
517
523
|
get isInfluencer() {
|
|
518
524
|
return !isNil(this.influencerEmail);
|
|
@@ -520,6 +526,20 @@ class Coupon extends BaseModel {
|
|
|
520
526
|
static get identifiersFields() {
|
|
521
527
|
return ['id'];
|
|
522
528
|
}
|
|
529
|
+
static createCoupon(userId) {
|
|
530
|
+
return this.toInstance({
|
|
531
|
+
nickname: `${Date.now()}`,
|
|
532
|
+
type: CouponTypes.ABSOLUTE,
|
|
533
|
+
checkoutType: CheckoutTypes.ECOMMERCE,
|
|
534
|
+
discount: 30,
|
|
535
|
+
user: userId,
|
|
536
|
+
useLimit: 1,
|
|
537
|
+
useLimitPerUser: true,
|
|
538
|
+
createdAt: new Date(Date.now()),
|
|
539
|
+
beginAt: new Date(Date.now()),
|
|
540
|
+
expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
|
|
541
|
+
});
|
|
542
|
+
}
|
|
523
543
|
}
|
|
524
544
|
__decorate([
|
|
525
545
|
Expose({ name: 'checkout_type' }),
|
|
@@ -739,18 +759,12 @@ class Category extends BaseModel {
|
|
|
739
759
|
}
|
|
740
760
|
}
|
|
741
761
|
|
|
742
|
-
var GenderDestination;
|
|
743
|
-
(function (GenderDestination) {
|
|
744
|
-
GenderDestination["FEMALE"] = "female";
|
|
745
|
-
GenderDestination["MALE"] = "male";
|
|
746
|
-
GenderDestination["UNISEX"] = "unisex";
|
|
747
|
-
})(GenderDestination || (GenderDestination = {}));
|
|
748
|
-
|
|
749
762
|
var Shops;
|
|
750
763
|
(function (Shops) {
|
|
751
764
|
Shops["MENSMARKET"] = "mensmarket";
|
|
752
765
|
Shops["GLAMSHOP"] = "Glamshop";
|
|
753
766
|
Shops["GLAMPOINTS"] = "Glampoints";
|
|
767
|
+
Shops["ALL"] = "ALL";
|
|
754
768
|
})(Shops || (Shops = {}));
|
|
755
769
|
|
|
756
770
|
class Product extends BaseModel {
|
|
@@ -793,30 +807,6 @@ class Variant extends BaseModel {
|
|
|
793
807
|
}
|
|
794
808
|
}
|
|
795
809
|
|
|
796
|
-
const COUPON_EXPIRATION = 60 * 60 * 24 * 30;
|
|
797
|
-
class FinancialCoupon extends Coupon {
|
|
798
|
-
constructor() {
|
|
799
|
-
super(...arguments);
|
|
800
|
-
this.type = CouponTypes.FINANCIAL;
|
|
801
|
-
}
|
|
802
|
-
static isFinancialCoupon(coupon) {
|
|
803
|
-
return coupon.type === CouponTypes.FINANCIAL && !!coupon.subtype;
|
|
804
|
-
}
|
|
805
|
-
static createCoupon(userId) {
|
|
806
|
-
return this.toInstance({
|
|
807
|
-
name: Md5.hashStr(`${userId}_${Date.now}`).toString(),
|
|
808
|
-
nickname: `${Date.now()}`,
|
|
809
|
-
type: CouponTypes.FINANCIAL,
|
|
810
|
-
subtype: CouponSubtypes.PERCENTAGE,
|
|
811
|
-
checkoutType: CheckoutTypes.ECOMMERCE,
|
|
812
|
-
discount: 30,
|
|
813
|
-
user: userId,
|
|
814
|
-
createdAt: new Date(Date.now()),
|
|
815
|
-
expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
|
|
816
|
-
});
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
|
|
820
810
|
var OrderStatus;
|
|
821
811
|
(function (OrderStatus) {
|
|
822
812
|
OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
|
|
@@ -2653,7 +2643,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
2653
2643
|
'type',
|
|
2654
2644
|
'video',
|
|
2655
2645
|
'weight',
|
|
2656
|
-
'gender',
|
|
2657
2646
|
{
|
|
2658
2647
|
shopAvailability: {
|
|
2659
2648
|
columnName: 'shop_availabilities',
|
|
@@ -2834,7 +2823,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
2834
2823
|
where: {
|
|
2835
2824
|
type: 'product_kit_bool_exp',
|
|
2836
2825
|
required: true,
|
|
2837
|
-
value: {
|
|
2826
|
+
value: { product_id: { _eq: productId } },
|
|
2838
2827
|
},
|
|
2839
2828
|
});
|
|
2840
2829
|
yield this.mutation('insert_product_kit', ['affected_rows'], {
|
|
@@ -2842,8 +2831,8 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
2842
2831
|
type: '[product_kit_insert_input!]',
|
|
2843
2832
|
required: true,
|
|
2844
2833
|
value: plainData.kitProducts.map((kitProduct) => ({
|
|
2845
|
-
kit_product_id: productId,
|
|
2846
|
-
product_id:
|
|
2834
|
+
kit_product_id: kitProduct.productId || kitProduct.product.id,
|
|
2835
|
+
product_id: productId,
|
|
2847
2836
|
quantity: kitProduct.quantity,
|
|
2848
2837
|
})),
|
|
2849
2838
|
},
|
|
@@ -3077,5 +3066,5 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
3077
3066
|
* Generated bundle index. Do not edit.
|
|
3078
3067
|
*/
|
|
3079
3068
|
|
|
3080
|
-
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Category, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, FilterType,
|
|
3069
|
+
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Category, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, FilterType, FragranceImportances, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, Register, RegisterFirebaseAuthService, RequiredArgumentError, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserSearchFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|
|
3081
3070
|
//# sourceMappingURL=infrab4a-connect.js.map
|