@infrab4a/connect 0.9.7 → 0.9.8
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/README.md +24 -24
- package/bundles/infrab4a-connect.umd.js +1845 -1845
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/esm2015/infrab4a-connect.js +4 -4
- package/esm2015/lib/domain/catalog/index.js +3 -3
- package/esm2015/lib/domain/catalog/models/category.js +7 -7
- package/esm2015/lib/domain/catalog/models/enums/index.js +2 -2
- package/esm2015/lib/domain/catalog/models/enums/shops.enum.js +6 -6
- package/esm2015/lib/domain/catalog/models/index.js +6 -6
- package/esm2015/lib/domain/catalog/models/product.js +11 -11
- package/esm2015/lib/domain/catalog/models/types/category-condition.type.js +2 -2
- package/esm2015/lib/domain/catalog/models/types/category-filter.type.js +2 -2
- package/esm2015/lib/domain/catalog/models/types/index.js +8 -8
- package/esm2015/lib/domain/catalog/models/types/product-review.type.js +2 -2
- package/esm2015/lib/domain/catalog/models/types/shops-description.type.js +2 -2
- package/esm2015/lib/domain/catalog/models/types/shops-price.type.js +2 -2
- package/esm2015/lib/domain/catalog/models/types/stock.type.js +2 -2
- package/esm2015/lib/domain/catalog/models/types/variant-grade.type.js +2 -2
- package/esm2015/lib/domain/catalog/models/variant.js +7 -7
- package/esm2015/lib/domain/catalog/repositories/category.repository.js +2 -2
- package/esm2015/lib/domain/catalog/repositories/index.js +4 -4
- package/esm2015/lib/domain/catalog/repositories/product.repository.js +2 -2
- package/esm2015/lib/domain/catalog/repositories/variant.repository.js +2 -2
- package/esm2015/lib/domain/general/index.js +3 -3
- package/esm2015/lib/domain/general/model/base-model-with-identifier-fields.js +2 -2
- package/esm2015/lib/domain/general/model/base.model.js +13 -13
- package/esm2015/lib/domain/general/model/identifier-fields.js +2 -2
- package/esm2015/lib/domain/general/model/index.js +5 -5
- package/esm2015/lib/domain/general/model/types/base-model-builder.type.js +2 -2
- package/esm2015/lib/domain/general/model/types/index.js +4 -4
- package/esm2015/lib/domain/general/model/types/non-function-properties.type.js +2 -2
- package/esm2015/lib/domain/general/model/types/non-function-property-name.type.js +2 -2
- package/esm2015/lib/domain/general/repository/create.repository.js +2 -2
- package/esm2015/lib/domain/general/repository/crud.repository.js +2 -2
- package/esm2015/lib/domain/general/repository/delete.repository.js +2 -2
- package/esm2015/lib/domain/general/repository/enums/index.js +3 -3
- package/esm2015/lib/domain/general/repository/enums/update-option-actions.enum.js +9 -9
- package/esm2015/lib/domain/general/repository/enums/where.enum.js +11 -11
- package/esm2015/lib/domain/general/repository/find.repository.js +2 -2
- package/esm2015/lib/domain/general/repository/get.repository.js +2 -2
- package/esm2015/lib/domain/general/repository/index.js +10 -10
- package/esm2015/lib/domain/general/repository/read.repository.js +2 -2
- package/esm2015/lib/domain/general/repository/types/index.js +6 -6
- package/esm2015/lib/domain/general/repository/types/repository-find-filters.type.js +2 -2
- package/esm2015/lib/domain/general/repository/types/repository-find-result.type.js +2 -2
- package/esm2015/lib/domain/general/repository/types/repository-limit-options.type.js +2 -2
- package/esm2015/lib/domain/general/repository/types/repository-order-by-list.type.js +2 -2
- package/esm2015/lib/domain/general/repository/types/repository-update-params.type.js +2 -2
- package/esm2015/lib/domain/general/repository/update.repository.js +2 -2
- package/esm2015/lib/domain/index.js +7 -7
- package/esm2015/lib/domain/location/index.js +2 -2
- package/esm2015/lib/domain/location/models/address.js +4 -4
- package/esm2015/lib/domain/location/models/index.js +3 -3
- package/esm2015/lib/domain/location/models/types/index.js +4 -4
- package/esm2015/lib/domain/location/models/types/location-bound.type.js +2 -2
- package/esm2015/lib/domain/location/models/types/location-geometry.type.js +2 -2
- package/esm2015/lib/domain/location/models/types/location-lat-lng.type.js +2 -2
- package/esm2015/lib/domain/shop-settings/index.js +3 -3
- package/esm2015/lib/domain/shop-settings/models/home.js +7 -7
- package/esm2015/lib/domain/shop-settings/models/index.js +4 -4
- package/esm2015/lib/domain/shop-settings/models/shop-menu.js +7 -7
- package/esm2015/lib/domain/shop-settings/models/types/banner.type.js +2 -2
- package/esm2015/lib/domain/shop-settings/models/types/benefit.type.js +2 -2
- package/esm2015/lib/domain/shop-settings/models/types/index.js +5 -5
- package/esm2015/lib/domain/shop-settings/models/types/menu-nav.type.js +2 -2
- package/esm2015/lib/domain/shop-settings/models/types/sub-menu.type.js +2 -2
- package/esm2015/lib/domain/shop-settings/repositories/home.repository.js +2 -2
- package/esm2015/lib/domain/shop-settings/repositories/index.js +3 -3
- package/esm2015/lib/domain/shop-settings/repositories/shop-menu.repository.js +2 -2
- package/esm2015/lib/domain/shopping/index.js +3 -3
- package/esm2015/lib/domain/shopping/models/buy-2-win.js +14 -14
- package/esm2015/lib/domain/shopping/models/checkout.js +38 -38
- package/esm2015/lib/domain/shopping/models/coupons/coupon.js +23 -23
- package/esm2015/lib/domain/shopping/models/coupons/enums/coupon-subtypes.enum.js +6 -6
- package/esm2015/lib/domain/shopping/models/coupons/enums/coupon-types.enum.js +8 -8
- package/esm2015/lib/domain/shopping/models/coupons/enums/exclusivities.enum.js +7 -7
- package/esm2015/lib/domain/shopping/models/coupons/enums/index.js +4 -4
- package/esm2015/lib/domain/shopping/models/coupons/financial-coupon.js +28 -28
- package/esm2015/lib/domain/shopping/models/coupons/index.js +4 -4
- package/esm2015/lib/domain/shopping/models/enums/checkout-types.enum.js +6 -6
- package/esm2015/lib/domain/shopping/models/enums/index.js +3 -3
- package/esm2015/lib/domain/shopping/models/enums/order-status.enum.js +12 -12
- package/esm2015/lib/domain/shopping/models/index.js +12 -12
- package/esm2015/lib/domain/shopping/models/line-item.js +4 -4
- package/esm2015/lib/domain/shopping/models/order.js +11 -11
- package/esm2015/lib/domain/shopping/models/payment.js +169 -169
- package/esm2015/lib/domain/shopping/models/shipping-method.js +7 -7
- package/esm2015/lib/domain/shopping/models/subscription/checkout.js +28 -28
- package/esm2015/lib/domain/shopping/models/subscription/index.js +3 -3
- package/esm2015/lib/domain/shopping/models/subscription/plan.js +7 -7
- package/esm2015/lib/domain/shopping/models/types/index.js +8 -8
- package/esm2015/lib/domain/shopping/models/types/payment-address.type.js +2 -2
- package/esm2015/lib/domain/shopping/models/types/payment-billing.type.js +2 -2
- package/esm2015/lib/domain/shopping/models/types/payment-card.type.js +2 -2
- package/esm2015/lib/domain/shopping/models/types/payment-customer.type.js +2 -2
- package/esm2015/lib/domain/shopping/models/types/payment-document.type.js +2 -2
- package/esm2015/lib/domain/shopping/models/types/payment-item.type.js +2 -2
- package/esm2015/lib/domain/shopping/models/types/payment-shipping.type.js +2 -2
- package/esm2015/lib/domain/shopping/repositories/buy-2-win.repository.js +2 -2
- package/esm2015/lib/domain/shopping/repositories/checkout.repository.js +2 -2
- package/esm2015/lib/domain/shopping/repositories/coupon.repository.js +2 -2
- package/esm2015/lib/domain/shopping/repositories/index.js +8 -8
- package/esm2015/lib/domain/shopping/repositories/legacy-order.repository.js +2 -2
- package/esm2015/lib/domain/shopping/repositories/order.repository.js +2 -2
- package/esm2015/lib/domain/shopping/repositories/payment.repository.js +2 -2
- package/esm2015/lib/domain/shopping/repositories/subscription/checkout.repository.js +2 -2
- package/esm2015/lib/domain/shopping/repositories/subscription/index.js +3 -3
- package/esm2015/lib/domain/shopping/repositories/subscription/plan.repository.js +2 -2
- package/esm2015/lib/domain/users/errors/index.js +2 -2
- package/esm2015/lib/domain/users/errors/unauthorized.error.js +7 -7
- package/esm2015/lib/domain/users/index.js +6 -6
- package/esm2015/lib/domain/users/models/beauty-profile.js +12 -12
- package/esm2015/lib/domain/users/models/enums/area.enum.js +13 -13
- package/esm2015/lib/domain/users/models/enums/beard-sizes.enum.js +9 -9
- package/esm2015/lib/domain/users/models/enums/hair-types.enum.js +9 -9
- package/esm2015/lib/domain/users/models/enums/index.js +7 -7
- package/esm2015/lib/domain/users/models/enums/office-position.enum.js +8 -8
- package/esm2015/lib/domain/users/models/enums/user-type.enum.js +10 -10
- package/esm2015/lib/domain/users/models/index.js +8 -8
- package/esm2015/lib/domain/users/models/lead.js +7 -7
- package/esm2015/lib/domain/users/models/subscription/edition.js +7 -7
- package/esm2015/lib/domain/users/models/subscription/enums/billing-status.enum.js +5 -5
- package/esm2015/lib/domain/users/models/subscription/enums/edition-status.enum.js +5 -5
- package/esm2015/lib/domain/users/models/subscription/enums/index.js +5 -5
- package/esm2015/lib/domain/users/models/subscription/enums/payment-type.enum.js +7 -7
- package/esm2015/lib/domain/users/models/subscription/enums/status.enum.js +5 -5
- package/esm2015/lib/domain/users/models/subscription/index.js +5 -5
- package/esm2015/lib/domain/users/models/subscription/payment.js +14 -14
- package/esm2015/lib/domain/users/models/subscription/subscription.js +43 -43
- package/esm2015/lib/domain/users/models/user-address.js +7 -7
- package/esm2015/lib/domain/users/models/user-payment-method.js +7 -7
- package/esm2015/lib/domain/users/models/user.js +26 -26
- package/esm2015/lib/domain/users/repositories/beauty-profile.repository.js +2 -2
- package/esm2015/lib/domain/users/repositories/edition.repository.js +2 -2
- package/esm2015/lib/domain/users/repositories/index.js +9 -9
- package/esm2015/lib/domain/users/repositories/lead.repository.js +2 -2
- package/esm2015/lib/domain/users/repositories/subscription-payment.repository.js +2 -2
- package/esm2015/lib/domain/users/repositories/subscription.repository.js +2 -2
- package/esm2015/lib/domain/users/repositories/user-address.repository.js +2 -2
- package/esm2015/lib/domain/users/repositories/user-payment-method.repository.js +2 -2
- package/esm2015/lib/domain/users/repositories/user.repository.js +2 -2
- package/esm2015/lib/domain/users/services/authentication.service.js +2 -2
- package/esm2015/lib/domain/users/services/index.js +2 -2
- package/esm2015/lib/domain/users/use-cases/authentication.js +40 -40
- package/esm2015/lib/domain/users/use-cases/index.js +3 -3
- package/esm2015/lib/domain/users/use-cases/signout.js +12 -12
- package/esm2015/lib/errors/duplicated-results.error.js +7 -7
- package/esm2015/lib/errors/index.js +5 -5
- package/esm2015/lib/errors/invalid-argument.error.js +7 -7
- package/esm2015/lib/errors/not-found.error.js +7 -7
- package/esm2015/lib/errors/required-argument.error.js +8 -8
- package/esm2015/lib/index.js +5 -5
- package/esm2015/lib/infra/firebase/auth/authentication-firebase-auth.service.js +27 -27
- package/esm2015/lib/infra/firebase/auth/index.js +2 -2
- package/esm2015/lib/infra/firebase/firestore/index.js +4 -4
- package/esm2015/lib/infra/firebase/firestore/mixins/index.js +10 -10
- package/esm2015/lib/infra/firebase/firestore/mixins/with-create-firestore.mixin.js +30 -30
- package/esm2015/lib/infra/firebase/firestore/mixins/with-crud-firestore.mixin.js +10 -10
- package/esm2015/lib/infra/firebase/firestore/mixins/with-delete-firestore.mixin.js +18 -18
- package/esm2015/lib/infra/firebase/firestore/mixins/with-find-firestore.mixin.js +74 -74
- package/esm2015/lib/infra/firebase/firestore/mixins/with-firestore.mixin.js +26 -26
- package/esm2015/lib/infra/firebase/firestore/mixins/with-get-firestore.mixin.js +24 -24
- package/esm2015/lib/infra/firebase/firestore/mixins/with-helpers.mixin.js +17 -17
- package/esm2015/lib/infra/firebase/firestore/mixins/with-sub-collection.mixin.js +11 -11
- package/esm2015/lib/infra/firebase/firestore/mixins/with-update-firestore.mixin.js +45 -45
- package/esm2015/lib/infra/firebase/firestore/repositories/catalog/category-firestore.repository.js +78 -78
- package/esm2015/lib/infra/firebase/firestore/repositories/catalog/index.js +4 -4
- package/esm2015/lib/infra/firebase/firestore/repositories/catalog/product-firestore.repository.js +23 -23
- package/esm2015/lib/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.js +14 -14
- package/esm2015/lib/infra/firebase/firestore/repositories/index.js +5 -5
- package/esm2015/lib/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.js +12 -12
- package/esm2015/lib/infra/firebase/firestore/repositories/shop-settings/index.js +3 -3
- package/esm2015/lib/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.js +12 -12
- package/esm2015/lib/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.js +12 -12
- package/esm2015/lib/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.js +12 -12
- package/esm2015/lib/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.js +12 -12
- package/esm2015/lib/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.js +12 -12
- package/esm2015/lib/infra/firebase/firestore/repositories/shopping/index.js +9 -9
- package/esm2015/lib/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.js +9 -9
- package/esm2015/lib/infra/firebase/firestore/repositories/shopping/order-firestore.repository.js +12 -12
- package/esm2015/lib/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.js +12 -12
- package/esm2015/lib/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.js +12 -12
- package/esm2015/lib/infra/firebase/firestore/repositories/users/index.js +9 -9
- package/esm2015/lib/infra/firebase/firestore/repositories/users/lead-firestore.repository.js +12 -12
- package/esm2015/lib/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.js +14 -14
- package/esm2015/lib/infra/firebase/firestore/repositories/users/subscription-firestore.repository.js +12 -12
- package/esm2015/lib/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.js +14 -14
- package/esm2015/lib/infra/firebase/firestore/repositories/users/user-address-firestore.repository.js +14 -14
- package/esm2015/lib/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.js +14 -14
- package/esm2015/lib/infra/firebase/firestore/repositories/users/user-firestore.repository.js +62 -62
- package/esm2015/lib/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.js +14 -14
- package/esm2015/lib/infra/firebase/firestore/types/firestore-sub.repository.type.js +2 -2
- package/esm2015/lib/infra/firebase/firestore/types/firestore.helpers.type.js +2 -2
- package/esm2015/lib/infra/firebase/firestore/types/firestore.repository.type.js +2 -2
- package/esm2015/lib/infra/firebase/firestore/types/index.js +4 -4
- package/esm2015/lib/infra/firebase/index.js +3 -3
- package/esm2015/lib/infra/index.js +2 -2
- package/esm2015/lib/utils/index.js +5 -5
- package/esm2015/lib/utils/mixins/base.mixin.js +6 -6
- package/esm2015/lib/utils/mixins/index.js +3 -3
- package/esm2015/lib/utils/mixins/mixin-ctor.type.js +2 -2
- package/esm2015/lib/utils/types/index.js +2 -2
- package/esm2015/lib/utils/types/prop.type.js +2 -2
- package/esm2015/public-api.js +3 -3
- package/fesm2015/infrab4a-connect.js +1088 -1088
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/infrab4a-connect.d.ts +5 -5
- package/lib/domain/catalog/index.d.ts +2 -2
- package/lib/domain/catalog/models/category.d.ts +22 -21
- package/lib/domain/catalog/models/enums/index.d.ts +1 -1
- package/lib/domain/catalog/models/enums/shops.enum.d.ts +4 -4
- package/lib/domain/catalog/models/index.d.ts +5 -5
- package/lib/domain/catalog/models/product.d.ts +33 -33
- package/lib/domain/catalog/models/types/category-condition.type.d.ts +4 -4
- package/lib/domain/catalog/models/types/category-filter.type.d.ts +4 -4
- package/lib/domain/catalog/models/types/index.d.ts +7 -7
- package/lib/domain/catalog/models/types/product-review.type.d.ts +12 -12
- package/lib/domain/catalog/models/types/shops-description.type.d.ts +7 -7
- package/lib/domain/catalog/models/types/shops-price.type.d.ts +10 -10
- package/lib/domain/catalog/models/types/stock.type.d.ts +3 -3
- package/lib/domain/catalog/models/types/variant-grade.type.d.ts +4 -4
- package/lib/domain/catalog/models/variant.d.ts +12 -12
- package/lib/domain/catalog/repositories/category.repository.d.ts +12 -12
- package/lib/domain/catalog/repositories/index.d.ts +3 -3
- package/lib/domain/catalog/repositories/product.repository.d.ts +5 -5
- package/lib/domain/catalog/repositories/variant.repository.d.ts +4 -4
- package/lib/domain/general/index.d.ts +2 -2
- package/lib/domain/general/model/base-model-with-identifier-fields.d.ts +3 -3
- package/lib/domain/general/model/base.model.d.ts +6 -6
- package/lib/domain/general/model/identifier-fields.d.ts +4 -4
- package/lib/domain/general/model/index.d.ts +4 -4
- package/lib/domain/general/model/types/base-model-builder.type.d.ts +5 -5
- package/lib/domain/general/model/types/index.d.ts +3 -3
- package/lib/domain/general/model/types/non-function-properties.type.d.ts +2 -2
- package/lib/domain/general/model/types/non-function-property-name.type.d.ts +3 -3
- package/lib/domain/general/repository/create.repository.d.ts +5 -5
- package/lib/domain/general/repository/crud.repository.d.ts +7 -7
- package/lib/domain/general/repository/delete.repository.d.ts +5 -5
- package/lib/domain/general/repository/enums/index.d.ts +2 -2
- package/lib/domain/general/repository/enums/update-option-actions.enum.d.ts +7 -7
- package/lib/domain/general/repository/enums/where.enum.d.ts +9 -9
- package/lib/domain/general/repository/find.repository.d.ts +5 -5
- package/lib/domain/general/repository/get.repository.d.ts +5 -5
- package/lib/domain/general/repository/index.d.ts +9 -9
- package/lib/domain/general/repository/read.repository.d.ts +5 -5
- package/lib/domain/general/repository/types/index.d.ts +5 -5
- package/lib/domain/general/repository/types/repository-find-filters.type.d.ts +14 -14
- package/lib/domain/general/repository/types/repository-find-result.type.d.ts +4 -4
- package/lib/domain/general/repository/types/repository-limit-options.type.d.ts +4 -4
- package/lib/domain/general/repository/types/repository-order-by-list.type.d.ts +5 -5
- package/lib/domain/general/repository/types/repository-update-params.type.d.ts +11 -11
- package/lib/domain/general/repository/update.repository.d.ts +5 -5
- package/lib/domain/index.d.ts +6 -6
- package/lib/domain/location/index.d.ts +1 -1
- package/lib/domain/location/models/address.d.ts +21 -21
- package/lib/domain/location/models/index.d.ts +2 -2
- package/lib/domain/location/models/types/index.d.ts +3 -3
- package/lib/domain/location/models/types/location-bound.type.d.ts +6 -6
- package/lib/domain/location/models/types/location-geometry.type.d.ts +7 -7
- package/lib/domain/location/models/types/location-lat-lng.type.d.ts +4 -4
- package/lib/domain/shop-settings/index.d.ts +2 -2
- package/lib/domain/shop-settings/models/home.d.ts +17 -17
- package/lib/domain/shop-settings/models/index.d.ts +3 -3
- package/lib/domain/shop-settings/models/shop-menu.d.ts +7 -7
- package/lib/domain/shop-settings/models/types/banner.type.d.ts +6 -6
- package/lib/domain/shop-settings/models/types/benefit.type.d.ts +5 -5
- package/lib/domain/shop-settings/models/types/index.d.ts +4 -4
- package/lib/domain/shop-settings/models/types/menu-nav.type.d.ts +8 -8
- package/lib/domain/shop-settings/models/types/sub-menu.type.d.ts +8 -8
- package/lib/domain/shop-settings/repositories/home.repository.d.ts +4 -4
- package/lib/domain/shop-settings/repositories/index.d.ts +2 -2
- package/lib/domain/shop-settings/repositories/shop-menu.repository.d.ts +4 -4
- package/lib/domain/shopping/index.d.ts +2 -2
- package/lib/domain/shopping/models/buy-2-win.d.ts +18 -18
- package/lib/domain/shopping/models/checkout.d.ts +28 -28
- package/lib/domain/shopping/models/coupons/coupon.d.ts +28 -28
- package/lib/domain/shopping/models/coupons/enums/coupon-subtypes.enum.d.ts +4 -4
- package/lib/domain/shopping/models/coupons/enums/coupon-types.enum.d.ts +6 -6
- package/lib/domain/shopping/models/coupons/enums/exclusivities.enum.d.ts +5 -5
- package/lib/domain/shopping/models/coupons/enums/index.d.ts +3 -3
- package/lib/domain/shopping/models/coupons/financial-coupon.d.ts +8 -8
- package/lib/domain/shopping/models/coupons/index.d.ts +3 -3
- package/lib/domain/shopping/models/enums/checkout-types.enum.d.ts +4 -4
- package/lib/domain/shopping/models/enums/index.d.ts +2 -2
- package/lib/domain/shopping/models/enums/order-status.enum.d.ts +10 -10
- package/lib/domain/shopping/models/index.d.ts +11 -11
- package/lib/domain/shopping/models/line-item.d.ts +8 -8
- package/lib/domain/shopping/models/order.d.ts +9 -9
- package/lib/domain/shopping/models/payment.d.ts +69 -69
- package/lib/domain/shopping/models/shipping-method.d.ts +18 -18
- package/lib/domain/shopping/models/subscription/checkout.d.ts +23 -23
- package/lib/domain/shopping/models/subscription/index.d.ts +2 -2
- package/lib/domain/shopping/models/subscription/plan.d.ts +12 -12
- package/lib/domain/shopping/models/types/index.d.ts +7 -7
- package/lib/domain/shopping/models/types/payment-address.type.d.ts +12 -12
- package/lib/domain/shopping/models/types/payment-billing.type.d.ts +7 -7
- package/lib/domain/shopping/models/types/payment-card.type.d.ts +14 -14
- package/lib/domain/shopping/models/types/payment-customer.type.d.ts +18 -18
- package/lib/domain/shopping/models/types/payment-document.type.d.ts +6 -6
- package/lib/domain/shopping/models/types/payment-item.type.d.ts +11 -11
- package/lib/domain/shopping/models/types/payment-shipping.type.d.ts +10 -10
- package/lib/domain/shopping/repositories/buy-2-win.repository.d.ts +4 -4
- package/lib/domain/shopping/repositories/checkout.repository.d.ts +4 -4
- package/lib/domain/shopping/repositories/coupon.repository.d.ts +4 -4
- package/lib/domain/shopping/repositories/index.d.ts +7 -7
- package/lib/domain/shopping/repositories/legacy-order.repository.d.ts +3 -3
- package/lib/domain/shopping/repositories/order.repository.d.ts +4 -4
- package/lib/domain/shopping/repositories/payment.repository.d.ts +4 -4
- package/lib/domain/shopping/repositories/subscription/checkout.repository.d.ts +4 -4
- package/lib/domain/shopping/repositories/subscription/index.d.ts +2 -2
- package/lib/domain/shopping/repositories/subscription/plan.repository.d.ts +4 -4
- package/lib/domain/users/errors/index.d.ts +1 -1
- package/lib/domain/users/errors/unauthorized.error.d.ts +4 -4
- package/lib/domain/users/index.d.ts +5 -5
- package/lib/domain/users/models/beauty-profile.d.ts +12 -12
- package/lib/domain/users/models/enums/area.enum.d.ts +11 -11
- package/lib/domain/users/models/enums/beard-sizes.enum.d.ts +7 -7
- package/lib/domain/users/models/enums/hair-types.enum.d.ts +7 -7
- package/lib/domain/users/models/enums/index.d.ts +6 -6
- package/lib/domain/users/models/enums/office-position.enum.d.ts +6 -6
- package/lib/domain/users/models/enums/user-type.enum.d.ts +8 -8
- package/lib/domain/users/models/index.d.ts +7 -7
- package/lib/domain/users/models/lead.d.ts +9 -9
- package/lib/domain/users/models/subscription/edition.d.ts +15 -15
- package/lib/domain/users/models/subscription/enums/billing-status.enum.d.ts +3 -3
- package/lib/domain/users/models/subscription/enums/edition-status.enum.d.ts +3 -3
- package/lib/domain/users/models/subscription/enums/index.d.ts +4 -4
- package/lib/domain/users/models/subscription/enums/payment-type.enum.d.ts +5 -5
- package/lib/domain/users/models/subscription/enums/status.enum.d.ts +3 -3
- package/lib/domain/users/models/subscription/index.d.ts +4 -4
- package/lib/domain/users/models/subscription/payment.d.ts +14 -14
- package/lib/domain/users/models/subscription/subscription.d.ts +30 -30
- package/lib/domain/users/models/user-address.d.ts +7 -7
- package/lib/domain/users/models/user-payment-method.d.ts +13 -13
- package/lib/domain/users/models/user.d.ts +24 -24
- package/lib/domain/users/repositories/beauty-profile.repository.d.ts +4 -4
- package/lib/domain/users/repositories/edition.repository.d.ts +4 -4
- package/lib/domain/users/repositories/index.d.ts +8 -8
- package/lib/domain/users/repositories/lead.repository.d.ts +4 -4
- package/lib/domain/users/repositories/subscription-payment.repository.d.ts +4 -4
- package/lib/domain/users/repositories/subscription.repository.d.ts +4 -4
- package/lib/domain/users/repositories/user-address.repository.d.ts +4 -4
- package/lib/domain/users/repositories/user-payment-method.repository.d.ts +4 -4
- package/lib/domain/users/repositories/user.repository.d.ts +4 -4
- package/lib/domain/users/services/authentication.service.d.ts +10 -10
- package/lib/domain/users/services/index.d.ts +1 -1
- package/lib/domain/users/use-cases/authentication.d.ts +21 -21
- package/lib/domain/users/use-cases/index.d.ts +2 -2
- package/lib/domain/users/use-cases/signout.d.ts +6 -6
- package/lib/errors/duplicated-results.error.d.ts +4 -4
- package/lib/errors/index.d.ts +4 -4
- package/lib/errors/invalid-argument.error.d.ts +4 -4
- package/lib/errors/not-found.error.d.ts +4 -4
- package/lib/errors/required-argument.error.d.ts +5 -5
- package/lib/index.d.ts +4 -4
- package/lib/infra/firebase/auth/authentication-firebase-auth.service.d.ts +9 -9
- package/lib/infra/firebase/auth/index.d.ts +1 -1
- package/lib/infra/firebase/firestore/index.d.ts +3 -3
- package/lib/infra/firebase/firestore/mixins/index.d.ts +9 -9
- package/lib/infra/firebase/firestore/mixins/with-create-firestore.mixin.d.ts +17 -17
- package/lib/infra/firebase/firestore/mixins/with-crud-firestore.mixin.d.ts +29 -29
- package/lib/infra/firebase/firestore/mixins/with-delete-firestore.mixin.d.ts +15 -15
- package/lib/infra/firebase/firestore/mixins/with-find-firestore.mixin.d.ts +20 -20
- package/lib/infra/firebase/firestore/mixins/with-firestore.mixin.d.ts +15 -15
- package/lib/infra/firebase/firestore/mixins/with-get-firestore.mixin.d.ts +15 -15
- package/lib/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +10 -10
- package/lib/infra/firebase/firestore/mixins/with-sub-collection.mixin.d.ts +14 -14
- package/lib/infra/firebase/firestore/mixins/with-update-firestore.mixin.d.ts +16 -16
- package/lib/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +55 -55
- package/lib/infra/firebase/firestore/repositories/catalog/index.d.ts +3 -3
- package/lib/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +50 -50
- package/lib/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.d.ts +60 -60
- package/lib/infra/firebase/firestore/repositories/index.d.ts +4 -4
- package/lib/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.d.ts +49 -49
- package/lib/infra/firebase/firestore/repositories/shop-settings/index.d.ts +2 -2
- package/lib/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.d.ts +49 -49
- package/lib/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.d.ts +49 -49
- package/lib/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.d.ts +49 -49
- package/lib/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.d.ts +49 -49
- package/lib/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.d.ts +49 -49
- package/lib/infra/firebase/firestore/repositories/shopping/index.d.ts +8 -8
- package/lib/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.d.ts +7 -7
- package/lib/infra/firebase/firestore/repositories/shopping/order-firestore.repository.d.ts +49 -49
- package/lib/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.d.ts +49 -49
- package/lib/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.d.ts +49 -49
- package/lib/infra/firebase/firestore/repositories/users/index.d.ts +8 -8
- package/lib/infra/firebase/firestore/repositories/users/lead-firestore.repository.d.ts +49 -49
- package/lib/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.d.ts +60 -60
- package/lib/infra/firebase/firestore/repositories/users/subscription-firestore.repository.d.ts +49 -49
- package/lib/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.d.ts +60 -60
- package/lib/infra/firebase/firestore/repositories/users/user-address-firestore.repository.d.ts +60 -60
- package/lib/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.d.ts +60 -60
- package/lib/infra/firebase/firestore/repositories/users/user-firestore.repository.d.ts +57 -57
- package/lib/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.d.ts +60 -60
- package/lib/infra/firebase/firestore/types/firestore-sub.repository.type.d.ts +6 -6
- package/lib/infra/firebase/firestore/types/firestore.helpers.type.d.ts +8 -8
- package/lib/infra/firebase/firestore/types/firestore.repository.type.d.ts +8 -8
- package/lib/infra/firebase/firestore/types/index.d.ts +3 -3
- package/lib/infra/firebase/index.d.ts +2 -2
- package/lib/infra/index.d.ts +1 -1
- package/lib/utils/index.d.ts +4 -4
- package/lib/utils/mixins/base.mixin.d.ts +3 -3
- package/lib/utils/mixins/index.d.ts +2 -2
- package/lib/utils/mixins/mixin-ctor.type.d.ts +1 -1
- package/lib/utils/types/index.d.ts +1 -1
- package/lib/utils/types/prop.type.d.ts +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +2 -2
|
@@ -7,1256 +7,1256 @@ import { Md5 } from 'ts-md5';
|
|
|
7
7
|
import firebase from 'firebase';
|
|
8
8
|
import firebase$1 from 'firebase/app';
|
|
9
9
|
|
|
10
|
-
class BaseModel {
|
|
11
|
-
constructor(args) {
|
|
12
|
-
Object.assign(this, args);
|
|
13
|
-
}
|
|
14
|
-
static toInstance(data) {
|
|
15
|
-
return plainToClass(this, data);
|
|
16
|
-
}
|
|
17
|
-
toPlain() {
|
|
18
|
-
return classToPlain(this, { exposeUnsetFields: false });
|
|
19
|
-
}
|
|
10
|
+
class BaseModel {
|
|
11
|
+
constructor(args) {
|
|
12
|
+
Object.assign(this, args);
|
|
13
|
+
}
|
|
14
|
+
static toInstance(data) {
|
|
15
|
+
return plainToClass(this, data);
|
|
16
|
+
}
|
|
17
|
+
toPlain() {
|
|
18
|
+
return classToPlain(this, { exposeUnsetFields: false });
|
|
19
|
+
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
var Where;
|
|
23
|
-
(function (Where) {
|
|
24
|
-
Where["EQUALS"] = "==";
|
|
25
|
-
Where["GT"] = ">";
|
|
26
|
-
Where["GTE"] = ">=";
|
|
27
|
-
Where["IN"] = "in";
|
|
28
|
-
Where["LT"] = "<";
|
|
29
|
-
Where["LTE"] = "<=";
|
|
30
|
-
Where["LIKE"] = "like";
|
|
22
|
+
var Where;
|
|
23
|
+
(function (Where) {
|
|
24
|
+
Where["EQUALS"] = "==";
|
|
25
|
+
Where["GT"] = ">";
|
|
26
|
+
Where["GTE"] = ">=";
|
|
27
|
+
Where["IN"] = "in";
|
|
28
|
+
Where["LT"] = "<";
|
|
29
|
+
Where["LTE"] = "<=";
|
|
30
|
+
Where["LIKE"] = "like";
|
|
31
31
|
})(Where || (Where = {}));
|
|
32
32
|
|
|
33
|
-
var UpdateOptionActions;
|
|
34
|
-
(function (UpdateOptionActions) {
|
|
35
|
-
UpdateOptionActions["UPDATE"] = "update";
|
|
36
|
-
UpdateOptionActions["MERGE"] = "merge";
|
|
37
|
-
UpdateOptionActions["REMOVE"] = "remove";
|
|
38
|
-
UpdateOptionActions["REMOVE_FIELD"] = "removeField";
|
|
39
|
-
UpdateOptionActions["NULL"] = "null";
|
|
33
|
+
var UpdateOptionActions;
|
|
34
|
+
(function (UpdateOptionActions) {
|
|
35
|
+
UpdateOptionActions["UPDATE"] = "update";
|
|
36
|
+
UpdateOptionActions["MERGE"] = "merge";
|
|
37
|
+
UpdateOptionActions["REMOVE"] = "remove";
|
|
38
|
+
UpdateOptionActions["REMOVE_FIELD"] = "removeField";
|
|
39
|
+
UpdateOptionActions["NULL"] = "null";
|
|
40
40
|
})(UpdateOptionActions || (UpdateOptionActions = {}));
|
|
41
41
|
|
|
42
|
-
var UserType;
|
|
43
|
-
(function (UserType) {
|
|
44
|
-
UserType["B2C"] = "Cliente Transacional";
|
|
45
|
-
UserType["GlamGirl"] = "Glamgirl";
|
|
46
|
-
UserType["MensBoy"] = "Mensboy";
|
|
47
|
-
UserType["B2B"] = "Company";
|
|
48
|
-
UserType["Collaborator"] = "Funcion\u00E1rio";
|
|
49
|
-
UserType["Influencer"] = "Influencer";
|
|
42
|
+
var UserType;
|
|
43
|
+
(function (UserType) {
|
|
44
|
+
UserType["B2C"] = "Cliente Transacional";
|
|
45
|
+
UserType["GlamGirl"] = "Glamgirl";
|
|
46
|
+
UserType["MensBoy"] = "Mensboy";
|
|
47
|
+
UserType["B2B"] = "Company";
|
|
48
|
+
UserType["Collaborator"] = "Funcion\u00E1rio";
|
|
49
|
+
UserType["Influencer"] = "Influencer";
|
|
50
50
|
})(UserType || (UserType = {}));
|
|
51
51
|
|
|
52
|
-
var BeardSizes;
|
|
53
|
-
(function (BeardSizes) {
|
|
54
|
-
BeardSizes["BIG"] = "Grande";
|
|
55
|
-
BeardSizes["MEDIUM"] = "M\u00E9dia";
|
|
56
|
-
BeardSizes["SHORT"] = "Curta";
|
|
57
|
-
BeardSizes["MUSTACHE"] = "Bigode";
|
|
58
|
-
BeardSizes["NOTHING"] = "Sem Barba";
|
|
52
|
+
var BeardSizes;
|
|
53
|
+
(function (BeardSizes) {
|
|
54
|
+
BeardSizes["BIG"] = "Grande";
|
|
55
|
+
BeardSizes["MEDIUM"] = "M\u00E9dia";
|
|
56
|
+
BeardSizes["SHORT"] = "Curta";
|
|
57
|
+
BeardSizes["MUSTACHE"] = "Bigode";
|
|
58
|
+
BeardSizes["NOTHING"] = "Sem Barba";
|
|
59
59
|
})(BeardSizes || (BeardSizes = {}));
|
|
60
60
|
|
|
61
|
-
var HairTypes;
|
|
62
|
-
(function (HairTypes) {
|
|
63
|
-
HairTypes["Smooth"] = "Liso";
|
|
64
|
-
HairTypes["WAVY"] = "Ondulado";
|
|
65
|
-
HairTypes["CURLY"] = "Cacheado";
|
|
66
|
-
HairTypes["FRIZZY"] = "Crespo";
|
|
67
|
-
HairTypes["BALD"] = "Sou careca";
|
|
61
|
+
var HairTypes;
|
|
62
|
+
(function (HairTypes) {
|
|
63
|
+
HairTypes["Smooth"] = "Liso";
|
|
64
|
+
HairTypes["WAVY"] = "Ondulado";
|
|
65
|
+
HairTypes["CURLY"] = "Cacheado";
|
|
66
|
+
HairTypes["FRIZZY"] = "Crespo";
|
|
67
|
+
HairTypes["BALD"] = "Sou careca";
|
|
68
68
|
})(HairTypes || (HairTypes = {}));
|
|
69
69
|
|
|
70
|
-
var Area;
|
|
71
|
-
(function (Area) {
|
|
72
|
-
Area["GP"] = "Geral";
|
|
73
|
-
Area["CRM"] = "CRM";
|
|
74
|
-
Area["MediaProd"] = "Media Production";
|
|
75
|
-
Area["Tech"] = "Tecnologia";
|
|
76
|
-
Area["Transactional"] = "Transacional";
|
|
77
|
-
Area["Operations"] = "Opera\u00E7\u00F5es";
|
|
78
|
-
Area["Sales"] = "Comercial";
|
|
79
|
-
Area["Finantial"] = "Financeiro";
|
|
80
|
-
Area["HR"] = "RH";
|
|
70
|
+
var Area;
|
|
71
|
+
(function (Area) {
|
|
72
|
+
Area["GP"] = "Geral";
|
|
73
|
+
Area["CRM"] = "CRM";
|
|
74
|
+
Area["MediaProd"] = "Media Production";
|
|
75
|
+
Area["Tech"] = "Tecnologia";
|
|
76
|
+
Area["Transactional"] = "Transacional";
|
|
77
|
+
Area["Operations"] = "Opera\u00E7\u00F5es";
|
|
78
|
+
Area["Sales"] = "Comercial";
|
|
79
|
+
Area["Finantial"] = "Financeiro";
|
|
80
|
+
Area["HR"] = "RH";
|
|
81
81
|
})(Area || (Area = {}));
|
|
82
82
|
|
|
83
|
-
var OfficePosition;
|
|
84
|
-
(function (OfficePosition) {
|
|
85
|
-
OfficePosition["Intern"] = "Estagi\u00E1rio";
|
|
86
|
-
OfficePosition["Analyst"] = "Analista";
|
|
87
|
-
OfficePosition["Manager"] = "Gerente";
|
|
88
|
-
OfficePosition["Director"] = "Diretor";
|
|
83
|
+
var OfficePosition;
|
|
84
|
+
(function (OfficePosition) {
|
|
85
|
+
OfficePosition["Intern"] = "Estagi\u00E1rio";
|
|
86
|
+
OfficePosition["Analyst"] = "Analista";
|
|
87
|
+
OfficePosition["Manager"] = "Gerente";
|
|
88
|
+
OfficePosition["Director"] = "Diretor";
|
|
89
89
|
})(OfficePosition || (OfficePosition = {}));
|
|
90
90
|
|
|
91
|
-
var BillingStatus;
|
|
92
|
-
(function (BillingStatus) {
|
|
93
|
-
BillingStatus["PAYED"] = "PAGO";
|
|
91
|
+
var BillingStatus;
|
|
92
|
+
(function (BillingStatus) {
|
|
93
|
+
BillingStatus["PAYED"] = "PAGO";
|
|
94
94
|
})(BillingStatus || (BillingStatus = {}));
|
|
95
95
|
|
|
96
|
-
var EditionStatus;
|
|
97
|
-
(function (EditionStatus) {
|
|
98
|
-
EditionStatus["ALLOCATION_WAITING"] = "Aguardando aloca\u00E7\u00E3o";
|
|
96
|
+
var EditionStatus;
|
|
97
|
+
(function (EditionStatus) {
|
|
98
|
+
EditionStatus["ALLOCATION_WAITING"] = "Aguardando aloca\u00E7\u00E3o";
|
|
99
99
|
})(EditionStatus || (EditionStatus = {}));
|
|
100
100
|
|
|
101
|
-
var PaymentType;
|
|
102
|
-
(function (PaymentType) {
|
|
103
|
-
PaymentType["AQUISITION"] = "Aquisi\u00E7\u00E3o";
|
|
104
|
-
PaymentType["RENEWAL"] = "Renova\u00E7\u00E3o";
|
|
105
|
-
PaymentType["FREIGHT"] = "mudan\u00E7a de endere\u00E7o, Frete";
|
|
101
|
+
var PaymentType;
|
|
102
|
+
(function (PaymentType) {
|
|
103
|
+
PaymentType["AQUISITION"] = "Aquisi\u00E7\u00E3o";
|
|
104
|
+
PaymentType["RENEWAL"] = "Renova\u00E7\u00E3o";
|
|
105
|
+
PaymentType["FREIGHT"] = "mudan\u00E7a de endere\u00E7o, Frete";
|
|
106
106
|
})(PaymentType || (PaymentType = {}));
|
|
107
107
|
|
|
108
|
-
var Status;
|
|
109
|
-
(function (Status) {
|
|
110
|
-
Status["ACTIVE"] = "active";
|
|
108
|
+
var Status;
|
|
109
|
+
(function (Status) {
|
|
110
|
+
Status["ACTIVE"] = "active";
|
|
111
111
|
})(Status || (Status = {}));
|
|
112
112
|
|
|
113
|
-
class Edition extends BaseModel {
|
|
114
|
-
identifierFields() {
|
|
115
|
-
return ['id'];
|
|
116
|
-
}
|
|
113
|
+
class Edition extends BaseModel {
|
|
114
|
+
identifierFields() {
|
|
115
|
+
return ['id'];
|
|
116
|
+
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
class Payment extends BaseModel {
|
|
120
|
-
identifierFields() {
|
|
121
|
-
return ['id'];
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
__decorate([
|
|
125
|
-
Expose({ name: 'refuse_reason' }),
|
|
126
|
-
__metadata("design:type", String)
|
|
127
|
-
], Payment.prototype, "refuseReason", void 0);
|
|
128
|
-
__decorate([
|
|
129
|
-
Expose({ name: 'status_reason' }),
|
|
130
|
-
__metadata("design:type", String)
|
|
131
|
-
], Payment.prototype, "statusReason", void 0);
|
|
132
|
-
__decorate([
|
|
133
|
-
Expose({ name: 'acquirer_response_code' }),
|
|
134
|
-
__metadata("design:type", String)
|
|
135
|
-
], Payment.prototype, "acquirerResponseCode", void 0);
|
|
136
|
-
__decorate([
|
|
137
|
-
Expose({ name: 'acquirer_name' }),
|
|
138
|
-
__metadata("design:type", String)
|
|
139
|
-
], Payment.prototype, "acquirerName", void 0);
|
|
140
|
-
__decorate([
|
|
141
|
-
Expose({ name: 'acquirer_id' }),
|
|
142
|
-
__metadata("design:type", String)
|
|
143
|
-
], Payment.prototype, "acquirerId", void 0);
|
|
144
|
-
__decorate([
|
|
145
|
-
Expose({ name: 'authorization_code' }),
|
|
146
|
-
__metadata("design:type", String)
|
|
147
|
-
], Payment.prototype, "authorizationCode", void 0);
|
|
148
|
-
__decorate([
|
|
149
|
-
Expose({ name: 'soft_descriptor' }),
|
|
150
|
-
__metadata("design:type", String)
|
|
151
|
-
], Payment.prototype, "softDescriptor", void 0);
|
|
152
|
-
__decorate([
|
|
153
|
-
Expose({ name: 'date_created' }),
|
|
154
|
-
__metadata("design:type", String)
|
|
155
|
-
], Payment.prototype, "dateCreated", void 0);
|
|
156
|
-
__decorate([
|
|
157
|
-
Expose({ name: 'date_updated' }),
|
|
158
|
-
__metadata("design:type", String)
|
|
159
|
-
], Payment.prototype, "dateUpdated", void 0);
|
|
160
|
-
__decorate([
|
|
161
|
-
Expose({ name: 'authorized_amount' }),
|
|
162
|
-
__metadata("design:type", Number)
|
|
163
|
-
], Payment.prototype, "authorizedAmount", void 0);
|
|
164
|
-
__decorate([
|
|
165
|
-
Expose({ name: 'paid_amount' }),
|
|
166
|
-
__metadata("design:type", Number)
|
|
167
|
-
], Payment.prototype, "paidAmount", void 0);
|
|
168
|
-
__decorate([
|
|
169
|
-
Expose({ name: 'refunded_amount' }),
|
|
170
|
-
__metadata("design:type", Number)
|
|
171
|
-
], Payment.prototype, "refundedAmount", void 0);
|
|
172
|
-
__decorate([
|
|
173
|
-
Expose({ name: 'card_holder_name' }),
|
|
174
|
-
__metadata("design:type", String)
|
|
175
|
-
], Payment.prototype, "cardHolderName", void 0);
|
|
176
|
-
__decorate([
|
|
177
|
-
Expose({ name: 'card_last_digits' }),
|
|
178
|
-
__metadata("design:type", String)
|
|
179
|
-
], Payment.prototype, "cardLastDigits", void 0);
|
|
180
|
-
__decorate([
|
|
181
|
-
Expose({ name: 'card_first_digits' }),
|
|
182
|
-
__metadata("design:type", String)
|
|
183
|
-
], Payment.prototype, "cardFirstDigits", void 0);
|
|
184
|
-
__decorate([
|
|
185
|
-
Expose({ name: 'card_brand' }),
|
|
186
|
-
__metadata("design:type", String)
|
|
187
|
-
], Payment.prototype, "cardBrand", void 0);
|
|
188
|
-
__decorate([
|
|
189
|
-
Expose({ name: 'card_pin_mode' }),
|
|
190
|
-
__metadata("design:type", String)
|
|
191
|
-
], Payment.prototype, "cardPinMode", void 0);
|
|
192
|
-
__decorate([
|
|
193
|
-
Expose({ name: 'card_magstripe_fallback' }),
|
|
194
|
-
__metadata("design:type", Boolean)
|
|
195
|
-
], Payment.prototype, "cardMagstripeFallback", void 0);
|
|
196
|
-
__decorate([
|
|
197
|
-
Expose({ name: 'cvm_pin' }),
|
|
198
|
-
__metadata("design:type", Boolean)
|
|
199
|
-
], Payment.prototype, "cvmPin", void 0);
|
|
200
|
-
__decorate([
|
|
201
|
-
Expose({ name: 'postback_url' }),
|
|
202
|
-
__metadata("design:type", String)
|
|
203
|
-
], Payment.prototype, "postbackUrl", void 0);
|
|
204
|
-
__decorate([
|
|
205
|
-
Expose({ name: 'payment_method' }),
|
|
206
|
-
__metadata("design:type", String)
|
|
207
|
-
], Payment.prototype, "paymentMethod", void 0);
|
|
208
|
-
__decorate([
|
|
209
|
-
Expose({ name: 'capture_method' }),
|
|
210
|
-
__metadata("design:type", String)
|
|
211
|
-
], Payment.prototype, "captureMethod", void 0);
|
|
212
|
-
__decorate([
|
|
213
|
-
Expose({ name: 'antifraud_score' }),
|
|
214
|
-
__metadata("design:type", String)
|
|
215
|
-
], Payment.prototype, "antifraudScore", void 0);
|
|
216
|
-
__decorate([
|
|
217
|
-
Expose({ name: 'boleto_url' }),
|
|
218
|
-
__metadata("design:type", String)
|
|
219
|
-
], Payment.prototype, "boletoUrl", void 0);
|
|
220
|
-
__decorate([
|
|
221
|
-
Expose({ name: 'boleto_barcode' }),
|
|
222
|
-
__metadata("design:type", String)
|
|
223
|
-
], Payment.prototype, "boletoBarcode", void 0);
|
|
224
|
-
__decorate([
|
|
225
|
-
Expose({ name: 'boleto_expiration_date' }),
|
|
226
|
-
__metadata("design:type", String)
|
|
227
|
-
], Payment.prototype, "boletoExpirationDate", void 0);
|
|
228
|
-
__decorate([
|
|
229
|
-
Expose({ name: 'subscription_id' }),
|
|
230
|
-
__metadata("design:type", String)
|
|
231
|
-
], Payment.prototype, "subscriptionId", void 0);
|
|
232
|
-
__decorate([
|
|
233
|
-
Expose({ name: 'split_rules' }),
|
|
234
|
-
__metadata("design:type", String)
|
|
235
|
-
], Payment.prototype, "splitRules", void 0);
|
|
236
|
-
__decorate([
|
|
237
|
-
Expose({ name: 'antifraud_metadata' }),
|
|
238
|
-
__metadata("design:type", Object)
|
|
239
|
-
], Payment.prototype, "antifraudMetadata", void 0);
|
|
240
|
-
__decorate([
|
|
241
|
-
Expose({ name: 'reference_key' }),
|
|
242
|
-
__metadata("design:type", String)
|
|
243
|
-
], Payment.prototype, "referenceKey", void 0);
|
|
244
|
-
__decorate([
|
|
245
|
-
Expose({ name: 'local_transaction_id' }),
|
|
246
|
-
__metadata("design:type", String)
|
|
247
|
-
], Payment.prototype, "localTransactionId", void 0);
|
|
248
|
-
__decorate([
|
|
249
|
-
Expose({ name: 'local_time' }),
|
|
250
|
-
__metadata("design:type", String)
|
|
251
|
-
], Payment.prototype, "localTime", void 0);
|
|
252
|
-
__decorate([
|
|
253
|
-
Expose({ name: 'fraud_covered' }),
|
|
254
|
-
__metadata("design:type", Boolean)
|
|
255
|
-
], Payment.prototype, "fraudCovered", void 0);
|
|
256
|
-
__decorate([
|
|
257
|
-
Expose({ name: 'fraud_reimbursed' }),
|
|
258
|
-
__metadata("design:type", String)
|
|
259
|
-
], Payment.prototype, "fraudReimbursed", void 0);
|
|
260
|
-
__decorate([
|
|
261
|
-
Expose({ name: 'order_id' }),
|
|
262
|
-
__metadata("design:type", String)
|
|
263
|
-
], Payment.prototype, "orderId", void 0);
|
|
264
|
-
__decorate([
|
|
265
|
-
Expose({ name: 'risk_level' }),
|
|
266
|
-
__metadata("design:type", String)
|
|
267
|
-
], Payment.prototype, "riskLevel", void 0);
|
|
268
|
-
__decorate([
|
|
269
|
-
Expose({ name: 'receipt_url' }),
|
|
270
|
-
__metadata("design:type", String)
|
|
271
|
-
], Payment.prototype, "receiptUrl", void 0);
|
|
272
|
-
__decorate([
|
|
273
|
-
Expose({ name: 'private_label' }),
|
|
274
|
-
__metadata("design:type", String)
|
|
275
|
-
], Payment.prototype, "privateLabel", void 0);
|
|
276
|
-
__decorate([
|
|
277
|
-
Expose({ name: 'pix_qr_code' }),
|
|
278
|
-
__metadata("design:type", String)
|
|
279
|
-
], Payment.prototype, "pixQrCode", void 0);
|
|
280
|
-
__decorate([
|
|
281
|
-
Expose({ name: 'pix_expiration_date' }),
|
|
282
|
-
__metadata("design:type", String)
|
|
119
|
+
class Payment extends BaseModel {
|
|
120
|
+
identifierFields() {
|
|
121
|
+
return ['id'];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
__decorate([
|
|
125
|
+
Expose({ name: 'refuse_reason' }),
|
|
126
|
+
__metadata("design:type", String)
|
|
127
|
+
], Payment.prototype, "refuseReason", void 0);
|
|
128
|
+
__decorate([
|
|
129
|
+
Expose({ name: 'status_reason' }),
|
|
130
|
+
__metadata("design:type", String)
|
|
131
|
+
], Payment.prototype, "statusReason", void 0);
|
|
132
|
+
__decorate([
|
|
133
|
+
Expose({ name: 'acquirer_response_code' }),
|
|
134
|
+
__metadata("design:type", String)
|
|
135
|
+
], Payment.prototype, "acquirerResponseCode", void 0);
|
|
136
|
+
__decorate([
|
|
137
|
+
Expose({ name: 'acquirer_name' }),
|
|
138
|
+
__metadata("design:type", String)
|
|
139
|
+
], Payment.prototype, "acquirerName", void 0);
|
|
140
|
+
__decorate([
|
|
141
|
+
Expose({ name: 'acquirer_id' }),
|
|
142
|
+
__metadata("design:type", String)
|
|
143
|
+
], Payment.prototype, "acquirerId", void 0);
|
|
144
|
+
__decorate([
|
|
145
|
+
Expose({ name: 'authorization_code' }),
|
|
146
|
+
__metadata("design:type", String)
|
|
147
|
+
], Payment.prototype, "authorizationCode", void 0);
|
|
148
|
+
__decorate([
|
|
149
|
+
Expose({ name: 'soft_descriptor' }),
|
|
150
|
+
__metadata("design:type", String)
|
|
151
|
+
], Payment.prototype, "softDescriptor", void 0);
|
|
152
|
+
__decorate([
|
|
153
|
+
Expose({ name: 'date_created' }),
|
|
154
|
+
__metadata("design:type", String)
|
|
155
|
+
], Payment.prototype, "dateCreated", void 0);
|
|
156
|
+
__decorate([
|
|
157
|
+
Expose({ name: 'date_updated' }),
|
|
158
|
+
__metadata("design:type", String)
|
|
159
|
+
], Payment.prototype, "dateUpdated", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
Expose({ name: 'authorized_amount' }),
|
|
162
|
+
__metadata("design:type", Number)
|
|
163
|
+
], Payment.prototype, "authorizedAmount", void 0);
|
|
164
|
+
__decorate([
|
|
165
|
+
Expose({ name: 'paid_amount' }),
|
|
166
|
+
__metadata("design:type", Number)
|
|
167
|
+
], Payment.prototype, "paidAmount", void 0);
|
|
168
|
+
__decorate([
|
|
169
|
+
Expose({ name: 'refunded_amount' }),
|
|
170
|
+
__metadata("design:type", Number)
|
|
171
|
+
], Payment.prototype, "refundedAmount", void 0);
|
|
172
|
+
__decorate([
|
|
173
|
+
Expose({ name: 'card_holder_name' }),
|
|
174
|
+
__metadata("design:type", String)
|
|
175
|
+
], Payment.prototype, "cardHolderName", void 0);
|
|
176
|
+
__decorate([
|
|
177
|
+
Expose({ name: 'card_last_digits' }),
|
|
178
|
+
__metadata("design:type", String)
|
|
179
|
+
], Payment.prototype, "cardLastDigits", void 0);
|
|
180
|
+
__decorate([
|
|
181
|
+
Expose({ name: 'card_first_digits' }),
|
|
182
|
+
__metadata("design:type", String)
|
|
183
|
+
], Payment.prototype, "cardFirstDigits", void 0);
|
|
184
|
+
__decorate([
|
|
185
|
+
Expose({ name: 'card_brand' }),
|
|
186
|
+
__metadata("design:type", String)
|
|
187
|
+
], Payment.prototype, "cardBrand", void 0);
|
|
188
|
+
__decorate([
|
|
189
|
+
Expose({ name: 'card_pin_mode' }),
|
|
190
|
+
__metadata("design:type", String)
|
|
191
|
+
], Payment.prototype, "cardPinMode", void 0);
|
|
192
|
+
__decorate([
|
|
193
|
+
Expose({ name: 'card_magstripe_fallback' }),
|
|
194
|
+
__metadata("design:type", Boolean)
|
|
195
|
+
], Payment.prototype, "cardMagstripeFallback", void 0);
|
|
196
|
+
__decorate([
|
|
197
|
+
Expose({ name: 'cvm_pin' }),
|
|
198
|
+
__metadata("design:type", Boolean)
|
|
199
|
+
], Payment.prototype, "cvmPin", void 0);
|
|
200
|
+
__decorate([
|
|
201
|
+
Expose({ name: 'postback_url' }),
|
|
202
|
+
__metadata("design:type", String)
|
|
203
|
+
], Payment.prototype, "postbackUrl", void 0);
|
|
204
|
+
__decorate([
|
|
205
|
+
Expose({ name: 'payment_method' }),
|
|
206
|
+
__metadata("design:type", String)
|
|
207
|
+
], Payment.prototype, "paymentMethod", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
Expose({ name: 'capture_method' }),
|
|
210
|
+
__metadata("design:type", String)
|
|
211
|
+
], Payment.prototype, "captureMethod", void 0);
|
|
212
|
+
__decorate([
|
|
213
|
+
Expose({ name: 'antifraud_score' }),
|
|
214
|
+
__metadata("design:type", String)
|
|
215
|
+
], Payment.prototype, "antifraudScore", void 0);
|
|
216
|
+
__decorate([
|
|
217
|
+
Expose({ name: 'boleto_url' }),
|
|
218
|
+
__metadata("design:type", String)
|
|
219
|
+
], Payment.prototype, "boletoUrl", void 0);
|
|
220
|
+
__decorate([
|
|
221
|
+
Expose({ name: 'boleto_barcode' }),
|
|
222
|
+
__metadata("design:type", String)
|
|
223
|
+
], Payment.prototype, "boletoBarcode", void 0);
|
|
224
|
+
__decorate([
|
|
225
|
+
Expose({ name: 'boleto_expiration_date' }),
|
|
226
|
+
__metadata("design:type", String)
|
|
227
|
+
], Payment.prototype, "boletoExpirationDate", void 0);
|
|
228
|
+
__decorate([
|
|
229
|
+
Expose({ name: 'subscription_id' }),
|
|
230
|
+
__metadata("design:type", String)
|
|
231
|
+
], Payment.prototype, "subscriptionId", void 0);
|
|
232
|
+
__decorate([
|
|
233
|
+
Expose({ name: 'split_rules' }),
|
|
234
|
+
__metadata("design:type", String)
|
|
235
|
+
], Payment.prototype, "splitRules", void 0);
|
|
236
|
+
__decorate([
|
|
237
|
+
Expose({ name: 'antifraud_metadata' }),
|
|
238
|
+
__metadata("design:type", Object)
|
|
239
|
+
], Payment.prototype, "antifraudMetadata", void 0);
|
|
240
|
+
__decorate([
|
|
241
|
+
Expose({ name: 'reference_key' }),
|
|
242
|
+
__metadata("design:type", String)
|
|
243
|
+
], Payment.prototype, "referenceKey", void 0);
|
|
244
|
+
__decorate([
|
|
245
|
+
Expose({ name: 'local_transaction_id' }),
|
|
246
|
+
__metadata("design:type", String)
|
|
247
|
+
], Payment.prototype, "localTransactionId", void 0);
|
|
248
|
+
__decorate([
|
|
249
|
+
Expose({ name: 'local_time' }),
|
|
250
|
+
__metadata("design:type", String)
|
|
251
|
+
], Payment.prototype, "localTime", void 0);
|
|
252
|
+
__decorate([
|
|
253
|
+
Expose({ name: 'fraud_covered' }),
|
|
254
|
+
__metadata("design:type", Boolean)
|
|
255
|
+
], Payment.prototype, "fraudCovered", void 0);
|
|
256
|
+
__decorate([
|
|
257
|
+
Expose({ name: 'fraud_reimbursed' }),
|
|
258
|
+
__metadata("design:type", String)
|
|
259
|
+
], Payment.prototype, "fraudReimbursed", void 0);
|
|
260
|
+
__decorate([
|
|
261
|
+
Expose({ name: 'order_id' }),
|
|
262
|
+
__metadata("design:type", String)
|
|
263
|
+
], Payment.prototype, "orderId", void 0);
|
|
264
|
+
__decorate([
|
|
265
|
+
Expose({ name: 'risk_level' }),
|
|
266
|
+
__metadata("design:type", String)
|
|
267
|
+
], Payment.prototype, "riskLevel", void 0);
|
|
268
|
+
__decorate([
|
|
269
|
+
Expose({ name: 'receipt_url' }),
|
|
270
|
+
__metadata("design:type", String)
|
|
271
|
+
], Payment.prototype, "receiptUrl", void 0);
|
|
272
|
+
__decorate([
|
|
273
|
+
Expose({ name: 'private_label' }),
|
|
274
|
+
__metadata("design:type", String)
|
|
275
|
+
], Payment.prototype, "privateLabel", void 0);
|
|
276
|
+
__decorate([
|
|
277
|
+
Expose({ name: 'pix_qr_code' }),
|
|
278
|
+
__metadata("design:type", String)
|
|
279
|
+
], Payment.prototype, "pixQrCode", void 0);
|
|
280
|
+
__decorate([
|
|
281
|
+
Expose({ name: 'pix_expiration_date' }),
|
|
282
|
+
__metadata("design:type", String)
|
|
283
283
|
], Payment.prototype, "pixExpirationDate", void 0);
|
|
284
284
|
|
|
285
|
-
class SubscriptionPayment extends BaseModel {
|
|
286
|
-
identifierFields() {
|
|
287
|
-
return ['id'];
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
__decorate([
|
|
291
|
-
Type(() => Payment),
|
|
292
|
-
__metadata("design:type", Payment)
|
|
285
|
+
class SubscriptionPayment extends BaseModel {
|
|
286
|
+
identifierFields() {
|
|
287
|
+
return ['id'];
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
__decorate([
|
|
291
|
+
Type(() => Payment),
|
|
292
|
+
__metadata("design:type", Payment)
|
|
293
293
|
], SubscriptionPayment.prototype, "payment", void 0);
|
|
294
294
|
|
|
295
|
-
class Address extends BaseModel {
|
|
295
|
+
class Address extends BaseModel {
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
-
var CheckoutTypes;
|
|
299
|
-
(function (CheckoutTypes) {
|
|
300
|
-
CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
|
|
301
|
-
CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
|
|
298
|
+
var CheckoutTypes;
|
|
299
|
+
(function (CheckoutTypes) {
|
|
300
|
+
CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
|
|
301
|
+
CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
|
|
302
302
|
})(CheckoutTypes || (CheckoutTypes = {}));
|
|
303
303
|
|
|
304
|
-
class Base {
|
|
305
|
-
constructor(...args) {
|
|
306
|
-
Object.assign(this, ...args);
|
|
307
|
-
}
|
|
304
|
+
class Base {
|
|
305
|
+
constructor(...args) {
|
|
306
|
+
Object.assign(this, ...args);
|
|
307
|
+
}
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
-
var CouponTypes;
|
|
311
|
-
(function (CouponTypes) {
|
|
312
|
-
CouponTypes[CouponTypes["FINANCIAL"] = 1] = "FINANCIAL";
|
|
313
|
-
CouponTypes[CouponTypes["PRODUCT"] = 2] = "PRODUCT";
|
|
314
|
-
CouponTypes[CouponTypes["GIFTCARD"] = 3] = "GIFTCARD";
|
|
315
|
-
CouponTypes[CouponTypes["VOUCHER"] = 4] = "VOUCHER";
|
|
310
|
+
var CouponTypes;
|
|
311
|
+
(function (CouponTypes) {
|
|
312
|
+
CouponTypes[CouponTypes["FINANCIAL"] = 1] = "FINANCIAL";
|
|
313
|
+
CouponTypes[CouponTypes["PRODUCT"] = 2] = "PRODUCT";
|
|
314
|
+
CouponTypes[CouponTypes["GIFTCARD"] = 3] = "GIFTCARD";
|
|
315
|
+
CouponTypes[CouponTypes["VOUCHER"] = 4] = "VOUCHER";
|
|
316
316
|
})(CouponTypes || (CouponTypes = {}));
|
|
317
317
|
|
|
318
|
-
var CouponSubtypes;
|
|
319
|
-
(function (CouponSubtypes) {
|
|
320
|
-
CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
321
|
-
CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
|
|
318
|
+
var CouponSubtypes;
|
|
319
|
+
(function (CouponSubtypes) {
|
|
320
|
+
CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
321
|
+
CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
|
|
322
322
|
})(CouponSubtypes || (CouponSubtypes = {}));
|
|
323
323
|
|
|
324
|
-
var Exclusivities;
|
|
325
|
-
(function (Exclusivities) {
|
|
326
|
-
Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
|
|
327
|
-
Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
|
|
328
|
-
Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
|
|
324
|
+
var Exclusivities;
|
|
325
|
+
(function (Exclusivities) {
|
|
326
|
+
Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
|
|
327
|
+
Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
|
|
328
|
+
Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
|
|
329
329
|
})(Exclusivities || (Exclusivities = {}));
|
|
330
330
|
|
|
331
|
-
class Coupon extends BaseModel {
|
|
332
|
-
get isInfluencer() {
|
|
333
|
-
return !isNil(this.influencerEmail);
|
|
334
|
-
}
|
|
335
|
-
identifierFields() {
|
|
336
|
-
return ['id'];
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
__decorate([
|
|
340
|
-
Expose({ name: 'checkout_type' }),
|
|
341
|
-
__metadata("design:type", Number)
|
|
342
|
-
], Coupon.prototype, "checkoutType", void 0);
|
|
343
|
-
__decorate([
|
|
344
|
-
Expose({ name: 'exclusivity_type' }),
|
|
345
|
-
__metadata("design:type", Number)
|
|
331
|
+
class Coupon extends BaseModel {
|
|
332
|
+
get isInfluencer() {
|
|
333
|
+
return !isNil(this.influencerEmail);
|
|
334
|
+
}
|
|
335
|
+
identifierFields() {
|
|
336
|
+
return ['id'];
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
__decorate([
|
|
340
|
+
Expose({ name: 'checkout_type' }),
|
|
341
|
+
__metadata("design:type", Number)
|
|
342
|
+
], Coupon.prototype, "checkoutType", void 0);
|
|
343
|
+
__decorate([
|
|
344
|
+
Expose({ name: 'exclusivity_type' }),
|
|
345
|
+
__metadata("design:type", Number)
|
|
346
346
|
], Coupon.prototype, "exclusivityType", void 0);
|
|
347
347
|
|
|
348
|
-
class SubscriptionPlan extends BaseModel {
|
|
349
|
-
identifierFields() {
|
|
350
|
-
return ['id'];
|
|
351
|
-
}
|
|
348
|
+
class SubscriptionPlan extends BaseModel {
|
|
349
|
+
identifierFields() {
|
|
350
|
+
return ['id'];
|
|
351
|
+
}
|
|
352
352
|
}
|
|
353
353
|
|
|
354
|
-
class BeautyProfile extends BaseModel {
|
|
355
|
-
toPlain() {
|
|
356
|
-
const plain = super.toPlain();
|
|
357
|
-
delete plain.id;
|
|
358
|
-
return plain;
|
|
359
|
-
}
|
|
360
|
-
identifierFields() {
|
|
361
|
-
return ['id'];
|
|
362
|
-
}
|
|
354
|
+
class BeautyProfile extends BaseModel {
|
|
355
|
+
toPlain() {
|
|
356
|
+
const plain = super.toPlain();
|
|
357
|
+
delete plain.id;
|
|
358
|
+
return plain;
|
|
359
|
+
}
|
|
360
|
+
identifierFields() {
|
|
361
|
+
return ['id'];
|
|
362
|
+
}
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
-
class User extends BaseModel {
|
|
366
|
-
static toInstance(data) {
|
|
367
|
-
const instance = super.toInstance(data);
|
|
368
|
-
if (!isNil(data.firstName))
|
|
369
|
-
instance.displayName = `${data.firstName}${!isNil(data.lastName) ? ` ${data.lastName}` : ''}`;
|
|
370
|
-
return instance;
|
|
371
|
-
}
|
|
372
|
-
identifierFields() {
|
|
373
|
-
return ['id'];
|
|
374
|
-
}
|
|
375
|
-
toPlain() {
|
|
376
|
-
const plain = super.toPlain();
|
|
377
|
-
delete plain.beautyProfile;
|
|
378
|
-
return plain;
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
__decorate([
|
|
382
|
-
Type(() => BeautyProfile),
|
|
383
|
-
__metadata("design:type", BeautyProfile)
|
|
365
|
+
class User extends BaseModel {
|
|
366
|
+
static toInstance(data) {
|
|
367
|
+
const instance = super.toInstance(data);
|
|
368
|
+
if (!isNil(data.firstName))
|
|
369
|
+
instance.displayName = `${data.firstName}${!isNil(data.lastName) ? ` ${data.lastName}` : ''}`;
|
|
370
|
+
return instance;
|
|
371
|
+
}
|
|
372
|
+
identifierFields() {
|
|
373
|
+
return ['id'];
|
|
374
|
+
}
|
|
375
|
+
toPlain() {
|
|
376
|
+
const plain = super.toPlain();
|
|
377
|
+
delete plain.beautyProfile;
|
|
378
|
+
return plain;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
__decorate([
|
|
382
|
+
Type(() => BeautyProfile),
|
|
383
|
+
__metadata("design:type", BeautyProfile)
|
|
384
384
|
], User.prototype, "beautyProfile", void 0);
|
|
385
385
|
|
|
386
|
-
class Subscription extends BaseModel {
|
|
387
|
-
identifierFields() {
|
|
388
|
-
return ['id'];
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
__decorate([
|
|
392
|
-
Type(() => User),
|
|
393
|
-
__metadata("design:type", User)
|
|
394
|
-
], Subscription.prototype, "user", void 0);
|
|
395
|
-
__decorate([
|
|
396
|
-
Type(() => SubscriptionPlan),
|
|
397
|
-
__metadata("design:type", SubscriptionPlan)
|
|
398
|
-
], Subscription.prototype, "subscriptionPlan", void 0);
|
|
399
|
-
__decorate([
|
|
400
|
-
Type(() => Address),
|
|
401
|
-
__metadata("design:type", Address)
|
|
402
|
-
], Subscription.prototype, "shippingAddress", void 0);
|
|
403
|
-
__decorate([
|
|
404
|
-
Type(() => Address),
|
|
405
|
-
__metadata("design:type", Address)
|
|
406
|
-
], Subscription.prototype, "billingAddress", void 0);
|
|
407
|
-
__decorate([
|
|
408
|
-
Type(() => Coupon),
|
|
409
|
-
__metadata("design:type", Coupon)
|
|
410
|
-
], Subscription.prototype, "coupon", void 0);
|
|
411
|
-
__decorate([
|
|
412
|
-
Type(() => Edition),
|
|
413
|
-
__metadata("design:type", Array)
|
|
414
|
-
], Subscription.prototype, "editions", void 0);
|
|
415
|
-
__decorate([
|
|
416
|
-
Type(() => SubscriptionPayment),
|
|
417
|
-
__metadata("design:type", Array)
|
|
386
|
+
class Subscription extends BaseModel {
|
|
387
|
+
identifierFields() {
|
|
388
|
+
return ['id'];
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
__decorate([
|
|
392
|
+
Type(() => User),
|
|
393
|
+
__metadata("design:type", User)
|
|
394
|
+
], Subscription.prototype, "user", void 0);
|
|
395
|
+
__decorate([
|
|
396
|
+
Type(() => SubscriptionPlan),
|
|
397
|
+
__metadata("design:type", SubscriptionPlan)
|
|
398
|
+
], Subscription.prototype, "subscriptionPlan", void 0);
|
|
399
|
+
__decorate([
|
|
400
|
+
Type(() => Address),
|
|
401
|
+
__metadata("design:type", Address)
|
|
402
|
+
], Subscription.prototype, "shippingAddress", void 0);
|
|
403
|
+
__decorate([
|
|
404
|
+
Type(() => Address),
|
|
405
|
+
__metadata("design:type", Address)
|
|
406
|
+
], Subscription.prototype, "billingAddress", void 0);
|
|
407
|
+
__decorate([
|
|
408
|
+
Type(() => Coupon),
|
|
409
|
+
__metadata("design:type", Coupon)
|
|
410
|
+
], Subscription.prototype, "coupon", void 0);
|
|
411
|
+
__decorate([
|
|
412
|
+
Type(() => Edition),
|
|
413
|
+
__metadata("design:type", Array)
|
|
414
|
+
], Subscription.prototype, "editions", void 0);
|
|
415
|
+
__decorate([
|
|
416
|
+
Type(() => SubscriptionPayment),
|
|
417
|
+
__metadata("design:type", Array)
|
|
418
418
|
], Subscription.prototype, "payment", void 0);
|
|
419
419
|
|
|
420
|
-
class UserAddress extends Address {
|
|
421
|
-
identifierFields() {
|
|
422
|
-
return ['id'];
|
|
423
|
-
}
|
|
420
|
+
class UserAddress extends Address {
|
|
421
|
+
identifierFields() {
|
|
422
|
+
return ['id'];
|
|
423
|
+
}
|
|
424
424
|
}
|
|
425
425
|
|
|
426
|
-
class UserPaymentMethod extends BaseModel {
|
|
427
|
-
identifierFields() {
|
|
428
|
-
return ['id'];
|
|
429
|
-
}
|
|
426
|
+
class UserPaymentMethod extends BaseModel {
|
|
427
|
+
identifierFields() {
|
|
428
|
+
return ['id'];
|
|
429
|
+
}
|
|
430
430
|
}
|
|
431
431
|
|
|
432
|
-
class Lead extends BaseModel {
|
|
433
|
-
identifierFields() {
|
|
434
|
-
return ['id'];
|
|
435
|
-
}
|
|
432
|
+
class Lead extends BaseModel {
|
|
433
|
+
identifierFields() {
|
|
434
|
+
return ['id'];
|
|
435
|
+
}
|
|
436
436
|
}
|
|
437
437
|
|
|
438
|
-
class UnauthorizedError extends Error {
|
|
439
|
-
constructor(message) {
|
|
440
|
-
super(message);
|
|
441
|
-
this.message = message;
|
|
442
|
-
}
|
|
438
|
+
class UnauthorizedError extends Error {
|
|
439
|
+
constructor(message) {
|
|
440
|
+
super(message);
|
|
441
|
+
this.message = message;
|
|
442
|
+
}
|
|
443
443
|
}
|
|
444
444
|
|
|
445
|
-
var SignInMethods;
|
|
446
|
-
(function (SignInMethods) {
|
|
447
|
-
SignInMethods["EMAIL_PASSWORD"] = "email_password";
|
|
448
|
-
SignInMethods["GOOGLE"] = "google";
|
|
449
|
-
})(SignInMethods || (SignInMethods = {}));
|
|
450
|
-
class Authentication {
|
|
451
|
-
constructor(authService, userRepository) {
|
|
452
|
-
this.authService = authService;
|
|
453
|
-
this.userRepository = userRepository;
|
|
454
|
-
}
|
|
455
|
-
signIn({ email, password }, signInMethod) {
|
|
456
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
457
|
-
const method = this.getServiceByMethod(signInMethod);
|
|
458
|
-
const userAuth = yield this.authService[method]({ email, password });
|
|
459
|
-
const user = this.userRepository.get(userAuth);
|
|
460
|
-
if (!isNil(user))
|
|
461
|
-
return user;
|
|
462
|
-
if (/^.+@b4a.com.br$/.test(userAuth.email))
|
|
463
|
-
return this.createsUserByCredential(userAuth);
|
|
464
|
-
throw new UnauthorizedError('Invalid credentials');
|
|
465
|
-
});
|
|
466
|
-
}
|
|
467
|
-
getServiceByMethod(signInMethod) {
|
|
468
|
-
return signInMethod === SignInMethods.EMAIL_PASSWORD ? 'signInWithEmailAndPassword' : 'signInWithGoogle';
|
|
469
|
-
}
|
|
470
|
-
createsUserByCredential(user) {
|
|
471
|
-
var _a;
|
|
472
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
473
|
-
const [firstName, lastName] = (_a = user.displayName) === null || _a === void 0 ? void 0 : _a.split(/\s/);
|
|
474
|
-
const person = User.toInstance(Object.assign(Object.assign({}, user), { cpf: '', birthday: new Date(), firstName,
|
|
475
|
-
lastName, acceptsNewsletter: false, area: Area.Transactional, officePosition: OfficePosition.Intern, type: UserType.Collaborator }));
|
|
476
|
-
return this.userRepository.create(person);
|
|
477
|
-
});
|
|
478
|
-
}
|
|
445
|
+
var SignInMethods;
|
|
446
|
+
(function (SignInMethods) {
|
|
447
|
+
SignInMethods["EMAIL_PASSWORD"] = "email_password";
|
|
448
|
+
SignInMethods["GOOGLE"] = "google";
|
|
449
|
+
})(SignInMethods || (SignInMethods = {}));
|
|
450
|
+
class Authentication {
|
|
451
|
+
constructor(authService, userRepository) {
|
|
452
|
+
this.authService = authService;
|
|
453
|
+
this.userRepository = userRepository;
|
|
454
|
+
}
|
|
455
|
+
signIn({ email, password }, signInMethod) {
|
|
456
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
457
|
+
const method = this.getServiceByMethod(signInMethod);
|
|
458
|
+
const userAuth = yield this.authService[method]({ email, password });
|
|
459
|
+
const user = this.userRepository.get(userAuth);
|
|
460
|
+
if (!isNil(user))
|
|
461
|
+
return user;
|
|
462
|
+
if (/^.+@b4a.com.br$/.test(userAuth.email))
|
|
463
|
+
return this.createsUserByCredential(userAuth);
|
|
464
|
+
throw new UnauthorizedError('Invalid credentials');
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
getServiceByMethod(signInMethod) {
|
|
468
|
+
return signInMethod === SignInMethods.EMAIL_PASSWORD ? 'signInWithEmailAndPassword' : 'signInWithGoogle';
|
|
469
|
+
}
|
|
470
|
+
createsUserByCredential(user) {
|
|
471
|
+
var _a;
|
|
472
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
473
|
+
const [firstName, lastName] = (_a = user.displayName) === null || _a === void 0 ? void 0 : _a.split(/\s/);
|
|
474
|
+
const person = User.toInstance(Object.assign(Object.assign({}, user), { cpf: '', birthday: new Date(), firstName,
|
|
475
|
+
lastName, acceptsNewsletter: false, area: Area.Transactional, officePosition: OfficePosition.Intern, type: UserType.Collaborator }));
|
|
476
|
+
return this.userRepository.create(person);
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
479
|
}
|
|
480
480
|
|
|
481
|
-
class SignOut {
|
|
482
|
-
constructor(authService) {
|
|
483
|
-
this.authService = authService;
|
|
484
|
-
}
|
|
485
|
-
signOut() {
|
|
486
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
487
|
-
yield this.authService.signOut();
|
|
488
|
-
});
|
|
489
|
-
}
|
|
481
|
+
class SignOut {
|
|
482
|
+
constructor(authService) {
|
|
483
|
+
this.authService = authService;
|
|
484
|
+
}
|
|
485
|
+
signOut() {
|
|
486
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
487
|
+
yield this.authService.signOut();
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
490
|
}
|
|
491
491
|
|
|
492
|
-
var Shops;
|
|
493
|
-
(function (Shops) {
|
|
494
|
-
Shops["MENSMARKET"] = "mensmarket";
|
|
495
|
-
Shops["GLAMSHOP"] = "Glamshop";
|
|
492
|
+
var Shops;
|
|
493
|
+
(function (Shops) {
|
|
494
|
+
Shops["MENSMARKET"] = "mensmarket";
|
|
495
|
+
Shops["GLAMSHOP"] = "Glamshop";
|
|
496
496
|
})(Shops || (Shops = {}));
|
|
497
497
|
|
|
498
|
-
class Category extends BaseModel {
|
|
499
|
-
identifierFields() {
|
|
500
|
-
return ['id'];
|
|
501
|
-
}
|
|
498
|
+
class Category extends BaseModel {
|
|
499
|
+
identifierFields() {
|
|
500
|
+
return ['id'];
|
|
501
|
+
}
|
|
502
502
|
}
|
|
503
503
|
|
|
504
|
-
class Product extends BaseModel {
|
|
505
|
-
identifierFields() {
|
|
506
|
-
return ['id'];
|
|
507
|
-
}
|
|
508
|
-
getInfoByShop(shop) {
|
|
509
|
-
var _a, _b, _c, _d, _e, _f;
|
|
510
|
-
return Object.assign(Object.assign(Object.assign({}, (((_b = (_a = this.description) === null || _a === void 0 ? void 0 : _a[shop]) === null || _b === void 0 ? void 0 : _b.description) ? { description: (_d = (_c = this.description) === null || _c === void 0 ? void 0 : _c[shop]) === null || _d === void 0 ? void 0 : _d.description } : {})), (((_e = this.price) === null || _e === void 0 ? void 0 : _e[shop]) || {})), (((_f = this.stock) === null || _f === void 0 ? void 0 : _f[shop]) || {}));
|
|
511
|
-
}
|
|
504
|
+
class Product extends BaseModel {
|
|
505
|
+
identifierFields() {
|
|
506
|
+
return ['id'];
|
|
507
|
+
}
|
|
508
|
+
getInfoByShop(shop) {
|
|
509
|
+
var _a, _b, _c, _d, _e, _f;
|
|
510
|
+
return Object.assign(Object.assign(Object.assign({}, (((_b = (_a = this.description) === null || _a === void 0 ? void 0 : _a[shop]) === null || _b === void 0 ? void 0 : _b.description) ? { description: (_d = (_c = this.description) === null || _c === void 0 ? void 0 : _c[shop]) === null || _d === void 0 ? void 0 : _d.description } : {})), (((_e = this.price) === null || _e === void 0 ? void 0 : _e[shop]) || {})), (((_f = this.stock) === null || _f === void 0 ? void 0 : _f[shop]) || {}));
|
|
511
|
+
}
|
|
512
512
|
}
|
|
513
513
|
|
|
514
|
-
class Variant extends BaseModel {
|
|
515
|
-
identifierFields() {
|
|
516
|
-
return ['id'];
|
|
517
|
-
}
|
|
514
|
+
class Variant extends BaseModel {
|
|
515
|
+
identifierFields() {
|
|
516
|
+
return ['id'];
|
|
517
|
+
}
|
|
518
518
|
}
|
|
519
519
|
|
|
520
|
-
const COUPON_EXPIRATION = 60 * 60 * 24 * 30;
|
|
521
|
-
class FinancialCoupon extends Coupon {
|
|
522
|
-
constructor() {
|
|
523
|
-
super(...arguments);
|
|
524
|
-
this.type = CouponTypes.FINANCIAL;
|
|
525
|
-
}
|
|
526
|
-
static isFinancialCoupon(coupon) {
|
|
527
|
-
return coupon.type === CouponTypes.FINANCIAL && !!coupon.subtype;
|
|
528
|
-
}
|
|
529
|
-
static createCoupon(userId) {
|
|
530
|
-
return this.toInstance({
|
|
531
|
-
name: Md5.hashStr(`${userId}_${Date.now}`).toString(),
|
|
532
|
-
nickname: `${Date.now()}`,
|
|
533
|
-
type: CouponTypes.FINANCIAL,
|
|
534
|
-
subtype: CouponSubtypes.PERCENTAGE,
|
|
535
|
-
checkoutType: CheckoutTypes.ECOMMERCE,
|
|
536
|
-
discount: 30,
|
|
537
|
-
user: userId,
|
|
538
|
-
createdAt: new Date(Date.now()),
|
|
539
|
-
expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
|
|
540
|
-
});
|
|
541
|
-
}
|
|
520
|
+
const COUPON_EXPIRATION = 60 * 60 * 24 * 30;
|
|
521
|
+
class FinancialCoupon extends Coupon {
|
|
522
|
+
constructor() {
|
|
523
|
+
super(...arguments);
|
|
524
|
+
this.type = CouponTypes.FINANCIAL;
|
|
525
|
+
}
|
|
526
|
+
static isFinancialCoupon(coupon) {
|
|
527
|
+
return coupon.type === CouponTypes.FINANCIAL && !!coupon.subtype;
|
|
528
|
+
}
|
|
529
|
+
static createCoupon(userId) {
|
|
530
|
+
return this.toInstance({
|
|
531
|
+
name: Md5.hashStr(`${userId}_${Date.now}`).toString(),
|
|
532
|
+
nickname: `${Date.now()}`,
|
|
533
|
+
type: CouponTypes.FINANCIAL,
|
|
534
|
+
subtype: CouponSubtypes.PERCENTAGE,
|
|
535
|
+
checkoutType: CheckoutTypes.ECOMMERCE,
|
|
536
|
+
discount: 30,
|
|
537
|
+
user: userId,
|
|
538
|
+
createdAt: new Date(Date.now()),
|
|
539
|
+
expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
542
|
}
|
|
543
543
|
|
|
544
|
-
var OrderStatus;
|
|
545
|
-
(function (OrderStatus) {
|
|
546
|
-
OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
|
|
547
|
-
OrderStatus["EM_PREPARO"] = "Preparando pedido";
|
|
548
|
-
OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
|
|
549
|
-
OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
|
|
550
|
-
OrderStatus["ENVIADO"] = "Pedido Enviado";
|
|
551
|
-
OrderStatus["ENTREGUE"] = "Pedido entregue";
|
|
552
|
-
OrderStatus["CANCELADO"] = "Cancelado";
|
|
553
|
-
OrderStatus["CREDIT_CARD"] = "credit_card";
|
|
544
|
+
var OrderStatus;
|
|
545
|
+
(function (OrderStatus) {
|
|
546
|
+
OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
|
|
547
|
+
OrderStatus["EM_PREPARO"] = "Preparando pedido";
|
|
548
|
+
OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
|
|
549
|
+
OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
|
|
550
|
+
OrderStatus["ENVIADO"] = "Pedido Enviado";
|
|
551
|
+
OrderStatus["ENTREGUE"] = "Pedido entregue";
|
|
552
|
+
OrderStatus["CANCELADO"] = "Cancelado";
|
|
553
|
+
OrderStatus["CREDIT_CARD"] = "credit_card";
|
|
554
554
|
})(OrderStatus || (OrderStatus = {}));
|
|
555
555
|
|
|
556
|
-
class LineItem extends Product {
|
|
556
|
+
class LineItem extends Product {
|
|
557
557
|
}
|
|
558
558
|
|
|
559
|
-
class ShippingMethod extends BaseModel {
|
|
560
|
-
identifierFields() {
|
|
561
|
-
return ['id'];
|
|
562
|
-
}
|
|
559
|
+
class ShippingMethod extends BaseModel {
|
|
560
|
+
identifierFields() {
|
|
561
|
+
return ['id'];
|
|
562
|
+
}
|
|
563
563
|
}
|
|
564
564
|
|
|
565
|
-
class Checkout extends BaseModel {
|
|
566
|
-
identifierFields() {
|
|
567
|
-
return ['id'];
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
__decorate([
|
|
571
|
-
Type(() => LineItem),
|
|
572
|
-
__metadata("design:type", Array)
|
|
573
|
-
], Checkout.prototype, "lineItems", void 0);
|
|
574
|
-
__decorate([
|
|
575
|
-
Type(() => User),
|
|
576
|
-
__metadata("design:type", User)
|
|
577
|
-
], Checkout.prototype, "user", void 0);
|
|
578
|
-
__decorate([
|
|
579
|
-
Type(() => Address),
|
|
580
|
-
__metadata("design:type", Address)
|
|
581
|
-
], Checkout.prototype, "shippingAddress", void 0);
|
|
582
|
-
__decorate([
|
|
583
|
-
Type(() => Address),
|
|
584
|
-
__metadata("design:type", Address)
|
|
585
|
-
], Checkout.prototype, "billingAddress", void 0);
|
|
586
|
-
__decorate([
|
|
587
|
-
Type(() => ShippingMethod),
|
|
588
|
-
__metadata("design:type", ShippingMethod)
|
|
589
|
-
], Checkout.prototype, "shipping", void 0);
|
|
590
|
-
__decorate([
|
|
591
|
-
Type(() => Coupon),
|
|
592
|
-
__metadata("design:type", Coupon)
|
|
565
|
+
class Checkout extends BaseModel {
|
|
566
|
+
identifierFields() {
|
|
567
|
+
return ['id'];
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
__decorate([
|
|
571
|
+
Type(() => LineItem),
|
|
572
|
+
__metadata("design:type", Array)
|
|
573
|
+
], Checkout.prototype, "lineItems", void 0);
|
|
574
|
+
__decorate([
|
|
575
|
+
Type(() => User),
|
|
576
|
+
__metadata("design:type", User)
|
|
577
|
+
], Checkout.prototype, "user", void 0);
|
|
578
|
+
__decorate([
|
|
579
|
+
Type(() => Address),
|
|
580
|
+
__metadata("design:type", Address)
|
|
581
|
+
], Checkout.prototype, "shippingAddress", void 0);
|
|
582
|
+
__decorate([
|
|
583
|
+
Type(() => Address),
|
|
584
|
+
__metadata("design:type", Address)
|
|
585
|
+
], Checkout.prototype, "billingAddress", void 0);
|
|
586
|
+
__decorate([
|
|
587
|
+
Type(() => ShippingMethod),
|
|
588
|
+
__metadata("design:type", ShippingMethod)
|
|
589
|
+
], Checkout.prototype, "shipping", void 0);
|
|
590
|
+
__decorate([
|
|
591
|
+
Type(() => Coupon),
|
|
592
|
+
__metadata("design:type", Coupon)
|
|
593
593
|
], Checkout.prototype, "coupon", void 0);
|
|
594
594
|
|
|
595
|
-
class Order extends Checkout {
|
|
596
|
-
}
|
|
597
|
-
__decorate([
|
|
598
|
-
Type(() => Payment),
|
|
599
|
-
__metadata("design:type", Payment)
|
|
595
|
+
class Order extends Checkout {
|
|
596
|
+
}
|
|
597
|
+
__decorate([
|
|
598
|
+
Type(() => Payment),
|
|
599
|
+
__metadata("design:type", Payment)
|
|
600
600
|
], Order.prototype, "payment", void 0);
|
|
601
601
|
|
|
602
|
-
class CheckoutSubscription extends BaseModel {
|
|
603
|
-
identifierFields() {
|
|
604
|
-
return ['id'];
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
__decorate([
|
|
608
|
-
Type(() => Address),
|
|
609
|
-
__metadata("design:type", Address)
|
|
610
|
-
], CheckoutSubscription.prototype, "shippingAddress", void 0);
|
|
611
|
-
__decorate([
|
|
612
|
-
Type(() => Address),
|
|
613
|
-
__metadata("design:type", Address)
|
|
614
|
-
], CheckoutSubscription.prototype, "billingAddress", void 0);
|
|
615
|
-
__decorate([
|
|
616
|
-
Type(() => SubscriptionPlan),
|
|
617
|
-
__metadata("design:type", SubscriptionPlan)
|
|
618
|
-
], CheckoutSubscription.prototype, "subscriptionPlan", void 0);
|
|
619
|
-
__decorate([
|
|
620
|
-
Type(() => Coupon),
|
|
621
|
-
__metadata("design:type", Coupon)
|
|
602
|
+
class CheckoutSubscription extends BaseModel {
|
|
603
|
+
identifierFields() {
|
|
604
|
+
return ['id'];
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
__decorate([
|
|
608
|
+
Type(() => Address),
|
|
609
|
+
__metadata("design:type", Address)
|
|
610
|
+
], CheckoutSubscription.prototype, "shippingAddress", void 0);
|
|
611
|
+
__decorate([
|
|
612
|
+
Type(() => Address),
|
|
613
|
+
__metadata("design:type", Address)
|
|
614
|
+
], CheckoutSubscription.prototype, "billingAddress", void 0);
|
|
615
|
+
__decorate([
|
|
616
|
+
Type(() => SubscriptionPlan),
|
|
617
|
+
__metadata("design:type", SubscriptionPlan)
|
|
618
|
+
], CheckoutSubscription.prototype, "subscriptionPlan", void 0);
|
|
619
|
+
__decorate([
|
|
620
|
+
Type(() => Coupon),
|
|
621
|
+
__metadata("design:type", Coupon)
|
|
622
622
|
], CheckoutSubscription.prototype, "coupon", void 0);
|
|
623
623
|
|
|
624
|
-
class Buy2Win extends BaseModel {
|
|
625
|
-
identifierFields() {
|
|
626
|
-
return ['id'];
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
__decorate([
|
|
630
|
-
Type(() => Category),
|
|
631
|
-
__metadata("design:type", Array)
|
|
624
|
+
class Buy2Win extends BaseModel {
|
|
625
|
+
identifierFields() {
|
|
626
|
+
return ['id'];
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
__decorate([
|
|
630
|
+
Type(() => Category),
|
|
631
|
+
__metadata("design:type", Array)
|
|
632
632
|
], Buy2Win.prototype, "categories", void 0);
|
|
633
633
|
|
|
634
|
-
class Home extends BaseModel {
|
|
635
|
-
identifierFields() {
|
|
636
|
-
return ['id'];
|
|
637
|
-
}
|
|
634
|
+
class Home extends BaseModel {
|
|
635
|
+
identifierFields() {
|
|
636
|
+
return ['id'];
|
|
637
|
+
}
|
|
638
638
|
}
|
|
639
639
|
|
|
640
|
-
class ShopMenu extends BaseModel {
|
|
641
|
-
identifierFields() {
|
|
642
|
-
return ['id'];
|
|
643
|
-
}
|
|
640
|
+
class ShopMenu extends BaseModel {
|
|
641
|
+
identifierFields() {
|
|
642
|
+
return ['id'];
|
|
643
|
+
}
|
|
644
644
|
}
|
|
645
645
|
|
|
646
|
-
class InvalidArgumentError extends Error {
|
|
647
|
-
constructor(message) {
|
|
648
|
-
super(message);
|
|
649
|
-
this.message = message;
|
|
650
|
-
}
|
|
646
|
+
class InvalidArgumentError extends Error {
|
|
647
|
+
constructor(message) {
|
|
648
|
+
super(message);
|
|
649
|
+
this.message = message;
|
|
650
|
+
}
|
|
651
651
|
}
|
|
652
652
|
|
|
653
|
-
class RequiredArgumentError extends Error {
|
|
654
|
-
constructor(args) {
|
|
655
|
-
super(`Required arguments: ${args.join(', ')}`);
|
|
656
|
-
this.args = args;
|
|
657
|
-
this.arguments = args;
|
|
658
|
-
}
|
|
653
|
+
class RequiredArgumentError extends Error {
|
|
654
|
+
constructor(args) {
|
|
655
|
+
super(`Required arguments: ${args.join(', ')}`);
|
|
656
|
+
this.args = args;
|
|
657
|
+
this.arguments = args;
|
|
658
|
+
}
|
|
659
659
|
}
|
|
660
660
|
|
|
661
|
-
class NotFoundError extends Error {
|
|
662
|
-
constructor(message) {
|
|
663
|
-
super(message);
|
|
664
|
-
this.message = message;
|
|
665
|
-
}
|
|
661
|
+
class NotFoundError extends Error {
|
|
662
|
+
constructor(message) {
|
|
663
|
+
super(message);
|
|
664
|
+
this.message = message;
|
|
665
|
+
}
|
|
666
666
|
}
|
|
667
667
|
|
|
668
|
-
class DuplicatedResultsError extends Error {
|
|
669
|
-
constructor(message) {
|
|
670
|
-
super(message);
|
|
671
|
-
this.message = message;
|
|
672
|
-
}
|
|
668
|
+
class DuplicatedResultsError extends Error {
|
|
669
|
+
constructor(message) {
|
|
670
|
+
super(message);
|
|
671
|
+
this.message = message;
|
|
672
|
+
}
|
|
673
673
|
}
|
|
674
674
|
|
|
675
|
-
const withFirestore = (MixinBase) => {
|
|
676
|
-
return class extends MixinBase {
|
|
677
|
-
constructor(...args) {
|
|
678
|
-
super(args);
|
|
679
|
-
}
|
|
680
|
-
collection(path) {
|
|
681
|
-
return this.firestore.collection(path || this.collectionName).withConverter(this.buildModelInstance());
|
|
682
|
-
}
|
|
683
|
-
buildModelInstance() {
|
|
684
|
-
return {
|
|
685
|
-
toFirestore: (data) => ((data === null || data === void 0 ? void 0 : data.toPlain) ? data.toPlain() : data),
|
|
686
|
-
fromFirestore: (snap) => {
|
|
687
|
-
const data = snap.data();
|
|
688
|
-
Object.keys(data).forEach((key) => {
|
|
689
|
-
if (data[key] instanceof firebase.firestore.Timestamp) {
|
|
690
|
-
data[key] = data[key].toDate();
|
|
691
|
-
}
|
|
692
|
-
});
|
|
693
|
-
return this.model.toInstance(Object.assign({ id: snap.id }, data));
|
|
694
|
-
},
|
|
695
|
-
};
|
|
696
|
-
}
|
|
697
|
-
};
|
|
675
|
+
const withFirestore = (MixinBase) => {
|
|
676
|
+
return class extends MixinBase {
|
|
677
|
+
constructor(...args) {
|
|
678
|
+
super(args);
|
|
679
|
+
}
|
|
680
|
+
collection(path) {
|
|
681
|
+
return this.firestore.collection(path || this.collectionName).withConverter(this.buildModelInstance());
|
|
682
|
+
}
|
|
683
|
+
buildModelInstance() {
|
|
684
|
+
return {
|
|
685
|
+
toFirestore: (data) => ((data === null || data === void 0 ? void 0 : data.toPlain) ? data.toPlain() : data),
|
|
686
|
+
fromFirestore: (snap) => {
|
|
687
|
+
const data = snap.data();
|
|
688
|
+
Object.keys(data).forEach((key) => {
|
|
689
|
+
if (data[key] instanceof firebase.firestore.Timestamp) {
|
|
690
|
+
data[key] = data[key].toDate();
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
return this.model.toInstance(Object.assign({ id: snap.id }, data));
|
|
694
|
+
},
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
};
|
|
698
698
|
};
|
|
699
699
|
|
|
700
|
-
const withHelpers = (MixinBase) => {
|
|
701
|
-
return class extends MixinBase {
|
|
702
|
-
toArray(snapShot) {
|
|
703
|
-
if (Array.isArray(snapShot)) {
|
|
704
|
-
return snapShot.map((doc) => doc.data());
|
|
705
|
-
}
|
|
706
|
-
else {
|
|
707
|
-
return snapShot.docs.map((doc) => doc.data());
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
isSubCollection(repository) {
|
|
711
|
-
return !isNil(Object.keys(this).find((key) => key === 'parentRepository'));
|
|
712
|
-
}
|
|
713
|
-
};
|
|
700
|
+
const withHelpers = (MixinBase) => {
|
|
701
|
+
return class extends MixinBase {
|
|
702
|
+
toArray(snapShot) {
|
|
703
|
+
if (Array.isArray(snapShot)) {
|
|
704
|
+
return snapShot.map((doc) => doc.data());
|
|
705
|
+
}
|
|
706
|
+
else {
|
|
707
|
+
return snapShot.docs.map((doc) => doc.data());
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
isSubCollection(repository) {
|
|
711
|
+
return !isNil(Object.keys(this).find((key) => key === 'parentRepository'));
|
|
712
|
+
}
|
|
713
|
+
};
|
|
714
714
|
};
|
|
715
715
|
|
|
716
|
-
const withGetFirestore = (MixinBase) => {
|
|
717
|
-
return class GetFirestore extends MixinBase {
|
|
718
|
-
get(identifiers) {
|
|
719
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
720
|
-
const doc = yield this.collection(this.buildCollectionPathForGet(identifiers))
|
|
721
|
-
.doc(Object.values(identifiers).shift().toString())
|
|
722
|
-
.get();
|
|
723
|
-
const data = doc.data();
|
|
724
|
-
if (isNil(data))
|
|
725
|
-
throw new NotFoundError(`Document ${JSON.stringify(identifiers)} not found`);
|
|
726
|
-
return data;
|
|
727
|
-
});
|
|
728
|
-
}
|
|
729
|
-
buildCollectionPathForGet(identifiers) {
|
|
730
|
-
return this.isSubCollection(this)
|
|
731
|
-
? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
|
|
732
|
-
: this.collectionName;
|
|
733
|
-
}
|
|
734
|
-
};
|
|
716
|
+
const withGetFirestore = (MixinBase) => {
|
|
717
|
+
return class GetFirestore extends MixinBase {
|
|
718
|
+
get(identifiers) {
|
|
719
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
720
|
+
const doc = yield this.collection(this.buildCollectionPathForGet(identifiers))
|
|
721
|
+
.doc(Object.values(identifiers).shift().toString())
|
|
722
|
+
.get();
|
|
723
|
+
const data = doc.data();
|
|
724
|
+
if (isNil(data))
|
|
725
|
+
throw new NotFoundError(`Document ${JSON.stringify(identifiers)} not found`);
|
|
726
|
+
return data;
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
buildCollectionPathForGet(identifiers) {
|
|
730
|
+
return this.isSubCollection(this)
|
|
731
|
+
? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
|
|
732
|
+
: this.collectionName;
|
|
733
|
+
}
|
|
734
|
+
};
|
|
735
735
|
};
|
|
736
736
|
|
|
737
|
-
const withFindFirestore = (MixinBase) => {
|
|
738
|
-
const checkIfIsFilterOption = (filter) => !isNil(filter === null || filter === void 0 ? void 0 : filter.operator);
|
|
739
|
-
const getValueFromFilter = (filter) => {
|
|
740
|
-
return checkIfIsFilterOption(filter) ? filter.value : filter;
|
|
741
|
-
};
|
|
742
|
-
return class FindFirestore extends MixinBase {
|
|
743
|
-
constructor() {
|
|
744
|
-
super(...arguments);
|
|
745
|
-
this.makeFirestoreWhere = (queryReference, filter) => Object.keys(filter).reduce((query, fieldName) => this.buildWhereSentence(query, fieldName, filter[fieldName]), queryReference);
|
|
746
|
-
this.buildWhereSentence = (queryReference, fieldName, options) => {
|
|
747
|
-
if (this.isSubCollection(this) && fieldName === this.parentIdField)
|
|
748
|
-
return queryReference;
|
|
749
|
-
if ((options === null || options === void 0 ? void 0 : options.operator) === Where.LIKE) {
|
|
750
|
-
queryReference = queryReference.where(fieldName.toString(), '>=', options.value);
|
|
751
|
-
queryReference = queryReference.where(fieldName.toString(), '<=', `${options.value}~`);
|
|
752
|
-
return queryReference;
|
|
753
|
-
}
|
|
754
|
-
if ((options === null || options === void 0 ? void 0 : options.operator) === Where.IN && Array.isArray(options === null || options === void 0 ? void 0 : options.value))
|
|
755
|
-
return queryReference.where(fieldName.toString(), 'array-contains-any', options.value);
|
|
756
|
-
if (isObject(options) && isNil(options === null || options === void 0 ? void 0 : options.operator) && isNil(options === null || options === void 0 ? void 0 : options.value))
|
|
757
|
-
return Object.keys(options).reduce((queryReferenceWithWhere, key) => this.buildWhereSentence(queryReferenceWithWhere, `${fieldName}.${key}`, options[key]), queryReference);
|
|
758
|
-
return queryReference.where(fieldName.toString(), (options === null || options === void 0 ? void 0 : options.operator) || '==', (options === null || options === void 0 ? void 0 : options.value) || options);
|
|
759
|
-
};
|
|
760
|
-
}
|
|
761
|
-
find(filters, limits, orderBy) {
|
|
762
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
763
|
-
let query = this.collection(this.buildCollectionPathForFind(filters));
|
|
764
|
-
filters === null || filters === void 0 ? void 0 : filters.forEach((filterer) => (query = this.makeFirestoreWhere(query, filterer)));
|
|
765
|
-
orderBy === null || orderBy === void 0 ? void 0 : orderBy.forEach((orderer) => Object.keys(orderer).forEach((fieldName) => (query = query.orderBy(fieldName, orderer[fieldName]))));
|
|
766
|
-
query = yield this.defineLimits(query, filters, limits);
|
|
767
|
-
const docs = yield query.get();
|
|
768
|
-
const data = docs.docs.map((doc) => doc.data());
|
|
769
|
-
return {
|
|
770
|
-
data,
|
|
771
|
-
count: this.calculateCount(data, limits),
|
|
772
|
-
};
|
|
773
|
-
});
|
|
774
|
-
}
|
|
775
|
-
buildCollectionPathForFind(filters) {
|
|
776
|
-
var _a;
|
|
777
|
-
if (!this.isSubCollection(this))
|
|
778
|
-
return this.collectionName;
|
|
779
|
-
const parentIdField = this.parentIdField;
|
|
780
|
-
const parentId = getValueFromFilter((_a = filters.find((groupFilter) => Boolean(getValueFromFilter(groupFilter[parentIdField])))) === null || _a === void 0 ? void 0 : _a[parentIdField]);
|
|
781
|
-
return `${this.parentRepository.collectionName}/${parentId}/${this.collectionName}`;
|
|
782
|
-
}
|
|
783
|
-
defineLimits(query, filters, limits) {
|
|
784
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
785
|
-
if (limits === null || limits === void 0 ? void 0 : limits.offset) {
|
|
786
|
-
if (limits.offset instanceof this.model)
|
|
787
|
-
query = query.startAfter(yield this.collection(this.buildCollectionPathForFind(filters))
|
|
788
|
-
.doc(limits.offset[limits.offset.identifierFields().shift()])
|
|
789
|
-
.get());
|
|
790
|
-
else if (isNumber(limits.offset) || isString(limits.offset))
|
|
791
|
-
query = query.startAt(limits.offset);
|
|
792
|
-
}
|
|
793
|
-
if (limits === null || limits === void 0 ? void 0 : limits.limit)
|
|
794
|
-
query = query.limit(limits.limit);
|
|
795
|
-
return query;
|
|
796
|
-
});
|
|
797
|
-
}
|
|
798
|
-
calculateCount(data, limits) {
|
|
799
|
-
if (data.length <= 0)
|
|
800
|
-
return 0;
|
|
801
|
-
if (data.length < (limits === null || limits === void 0 ? void 0 : limits.limit))
|
|
802
|
-
return data.length;
|
|
803
|
-
return Infinity;
|
|
804
|
-
}
|
|
805
|
-
};
|
|
737
|
+
const withFindFirestore = (MixinBase) => {
|
|
738
|
+
const checkIfIsFilterOption = (filter) => !isNil(filter === null || filter === void 0 ? void 0 : filter.operator);
|
|
739
|
+
const getValueFromFilter = (filter) => {
|
|
740
|
+
return checkIfIsFilterOption(filter) ? filter.value : filter;
|
|
741
|
+
};
|
|
742
|
+
return class FindFirestore extends MixinBase {
|
|
743
|
+
constructor() {
|
|
744
|
+
super(...arguments);
|
|
745
|
+
this.makeFirestoreWhere = (queryReference, filter) => Object.keys(filter).reduce((query, fieldName) => this.buildWhereSentence(query, fieldName, filter[fieldName]), queryReference);
|
|
746
|
+
this.buildWhereSentence = (queryReference, fieldName, options) => {
|
|
747
|
+
if (this.isSubCollection(this) && fieldName === this.parentIdField)
|
|
748
|
+
return queryReference;
|
|
749
|
+
if ((options === null || options === void 0 ? void 0 : options.operator) === Where.LIKE) {
|
|
750
|
+
queryReference = queryReference.where(fieldName.toString(), '>=', options.value);
|
|
751
|
+
queryReference = queryReference.where(fieldName.toString(), '<=', `${options.value}~`);
|
|
752
|
+
return queryReference;
|
|
753
|
+
}
|
|
754
|
+
if ((options === null || options === void 0 ? void 0 : options.operator) === Where.IN && Array.isArray(options === null || options === void 0 ? void 0 : options.value))
|
|
755
|
+
return queryReference.where(fieldName.toString(), 'array-contains-any', options.value);
|
|
756
|
+
if (isObject(options) && isNil(options === null || options === void 0 ? void 0 : options.operator) && isNil(options === null || options === void 0 ? void 0 : options.value))
|
|
757
|
+
return Object.keys(options).reduce((queryReferenceWithWhere, key) => this.buildWhereSentence(queryReferenceWithWhere, `${fieldName}.${key}`, options[key]), queryReference);
|
|
758
|
+
return queryReference.where(fieldName.toString(), (options === null || options === void 0 ? void 0 : options.operator) || '==', (options === null || options === void 0 ? void 0 : options.value) || options);
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
find(filters, limits, orderBy) {
|
|
762
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
763
|
+
let query = this.collection(this.buildCollectionPathForFind(filters));
|
|
764
|
+
filters === null || filters === void 0 ? void 0 : filters.forEach((filterer) => (query = this.makeFirestoreWhere(query, filterer)));
|
|
765
|
+
orderBy === null || orderBy === void 0 ? void 0 : orderBy.forEach((orderer) => Object.keys(orderer).forEach((fieldName) => (query = query.orderBy(fieldName, orderer[fieldName]))));
|
|
766
|
+
query = yield this.defineLimits(query, filters, limits);
|
|
767
|
+
const docs = yield query.get();
|
|
768
|
+
const data = docs.docs.map((doc) => doc.data());
|
|
769
|
+
return {
|
|
770
|
+
data,
|
|
771
|
+
count: this.calculateCount(data, limits),
|
|
772
|
+
};
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
buildCollectionPathForFind(filters) {
|
|
776
|
+
var _a;
|
|
777
|
+
if (!this.isSubCollection(this))
|
|
778
|
+
return this.collectionName;
|
|
779
|
+
const parentIdField = this.parentIdField;
|
|
780
|
+
const parentId = getValueFromFilter((_a = filters.find((groupFilter) => Boolean(getValueFromFilter(groupFilter[parentIdField])))) === null || _a === void 0 ? void 0 : _a[parentIdField]);
|
|
781
|
+
return `${this.parentRepository.collectionName}/${parentId}/${this.collectionName}`;
|
|
782
|
+
}
|
|
783
|
+
defineLimits(query, filters, limits) {
|
|
784
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
785
|
+
if (limits === null || limits === void 0 ? void 0 : limits.offset) {
|
|
786
|
+
if (limits.offset instanceof this.model)
|
|
787
|
+
query = query.startAfter(yield this.collection(this.buildCollectionPathForFind(filters))
|
|
788
|
+
.doc(limits.offset[limits.offset.identifierFields().shift()])
|
|
789
|
+
.get());
|
|
790
|
+
else if (isNumber(limits.offset) || isString(limits.offset))
|
|
791
|
+
query = query.startAt(limits.offset);
|
|
792
|
+
}
|
|
793
|
+
if (limits === null || limits === void 0 ? void 0 : limits.limit)
|
|
794
|
+
query = query.limit(limits.limit);
|
|
795
|
+
return query;
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
calculateCount(data, limits) {
|
|
799
|
+
if (data.length <= 0)
|
|
800
|
+
return 0;
|
|
801
|
+
if (data.length < (limits === null || limits === void 0 ? void 0 : limits.limit))
|
|
802
|
+
return data.length;
|
|
803
|
+
return Infinity;
|
|
804
|
+
}
|
|
805
|
+
};
|
|
806
806
|
};
|
|
807
807
|
|
|
808
|
-
const withCreateFirestore = (MixinBase) => {
|
|
809
|
-
return class CreateFirestore extends MixinBase {
|
|
810
|
-
create(data) {
|
|
811
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
812
|
-
const docRef = yield this.save(this.model.toInstance(data));
|
|
813
|
-
const doc = yield docRef.get();
|
|
814
|
-
return doc.data();
|
|
815
|
-
});
|
|
816
|
-
}
|
|
817
|
-
save(data) {
|
|
818
|
-
var _a;
|
|
819
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
820
|
-
const id = (_a = data[data.identifierFields().shift()]) === null || _a === void 0 ? void 0 : _a.toString();
|
|
821
|
-
if (isEmpty(id))
|
|
822
|
-
return this.collection(this.buildCollectionPathForAdd(data)).add(data);
|
|
823
|
-
const docRef = this.collection().doc(id);
|
|
824
|
-
yield docRef.set(data);
|
|
825
|
-
return docRef;
|
|
826
|
-
});
|
|
827
|
-
}
|
|
828
|
-
buildCollectionPathForAdd(identifiers) {
|
|
829
|
-
return this.isSubCollection(this)
|
|
830
|
-
? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
|
|
831
|
-
: this.collectionName;
|
|
832
|
-
}
|
|
833
|
-
};
|
|
808
|
+
const withCreateFirestore = (MixinBase) => {
|
|
809
|
+
return class CreateFirestore extends MixinBase {
|
|
810
|
+
create(data) {
|
|
811
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
812
|
+
const docRef = yield this.save(this.model.toInstance(data));
|
|
813
|
+
const doc = yield docRef.get();
|
|
814
|
+
return doc.data();
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
save(data) {
|
|
818
|
+
var _a;
|
|
819
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
820
|
+
const id = (_a = data[data.identifierFields().shift()]) === null || _a === void 0 ? void 0 : _a.toString();
|
|
821
|
+
if (isEmpty(id))
|
|
822
|
+
return this.collection(this.buildCollectionPathForAdd(data)).add(data);
|
|
823
|
+
const docRef = this.collection().doc(id);
|
|
824
|
+
yield docRef.set(data);
|
|
825
|
+
return docRef;
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
buildCollectionPathForAdd(identifiers) {
|
|
829
|
+
return this.isSubCollection(this)
|
|
830
|
+
? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
|
|
831
|
+
: this.collectionName;
|
|
832
|
+
}
|
|
833
|
+
};
|
|
834
834
|
};
|
|
835
835
|
|
|
836
|
-
const withUpdateFirestore = (MixinBase) => {
|
|
837
|
-
const getValueFromParams = (params, field) => { var _a; return (isNil((_a = params[field]) === null || _a === void 0 ? void 0 : _a.value) ? params[field] : params[field].value) || null; };
|
|
838
|
-
const getValueByAction = (options) => {
|
|
839
|
-
const fieldValues = firebase.firestore.FieldValue;
|
|
840
|
-
if (isNil(options.action))
|
|
841
|
-
return options;
|
|
842
|
-
if (options.action === UpdateOptionActions.REMOVE_FIELD)
|
|
843
|
-
return fieldValues.delete();
|
|
844
|
-
if (Array.isArray(options.value)) {
|
|
845
|
-
if (options.action === UpdateOptionActions.MERGE)
|
|
846
|
-
return fieldValues.arrayUnion(...options.value);
|
|
847
|
-
if (options.action === UpdateOptionActions.REMOVE)
|
|
848
|
-
return fieldValues.arrayRemove(...options.value);
|
|
849
|
-
}
|
|
850
|
-
return options.value;
|
|
851
|
-
};
|
|
852
|
-
return class UpdateFirestore extends MixinBase {
|
|
853
|
-
update(data) {
|
|
854
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
855
|
-
const model = new this.model();
|
|
856
|
-
const keyField = model.identifierFields().shift();
|
|
857
|
-
const docRef = this.collection(this.buildCollectionPathForUpdate(data)).doc(getValueFromParams(data, keyField).toString());
|
|
858
|
-
yield docRef.set(this.paramsToPlain(data), { merge: true });
|
|
859
|
-
const doc = yield docRef.get();
|
|
860
|
-
return doc.data();
|
|
861
|
-
});
|
|
862
|
-
}
|
|
863
|
-
buildCollectionPathForUpdate(identifiers) {
|
|
864
|
-
return this.isSubCollection(this)
|
|
865
|
-
? `${this.parentRepository.collectionName}/${getValueFromParams(identifiers, this.parentIdField)}/${this.collectionName}`
|
|
866
|
-
: this.collectionName;
|
|
867
|
-
}
|
|
868
|
-
paramsToPlain(params) {
|
|
869
|
-
const model = this.model;
|
|
870
|
-
if (params instanceof model)
|
|
871
|
-
return params;
|
|
872
|
-
return Object.keys(params).reduce((data, currentKey) => (Object.assign(Object.assign({}, data), { [currentKey]: getValueByAction(params[currentKey]) })), {});
|
|
873
|
-
}
|
|
874
|
-
};
|
|
836
|
+
const withUpdateFirestore = (MixinBase) => {
|
|
837
|
+
const getValueFromParams = (params, field) => { var _a; return (isNil((_a = params[field]) === null || _a === void 0 ? void 0 : _a.value) ? params[field] : params[field].value) || null; };
|
|
838
|
+
const getValueByAction = (options) => {
|
|
839
|
+
const fieldValues = firebase.firestore.FieldValue;
|
|
840
|
+
if (isNil(options.action))
|
|
841
|
+
return options;
|
|
842
|
+
if (options.action === UpdateOptionActions.REMOVE_FIELD)
|
|
843
|
+
return fieldValues.delete();
|
|
844
|
+
if (Array.isArray(options.value)) {
|
|
845
|
+
if (options.action === UpdateOptionActions.MERGE)
|
|
846
|
+
return fieldValues.arrayUnion(...options.value);
|
|
847
|
+
if (options.action === UpdateOptionActions.REMOVE)
|
|
848
|
+
return fieldValues.arrayRemove(...options.value);
|
|
849
|
+
}
|
|
850
|
+
return options.value;
|
|
851
|
+
};
|
|
852
|
+
return class UpdateFirestore extends MixinBase {
|
|
853
|
+
update(data) {
|
|
854
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
855
|
+
const model = new this.model();
|
|
856
|
+
const keyField = model.identifierFields().shift();
|
|
857
|
+
const docRef = this.collection(this.buildCollectionPathForUpdate(data)).doc(getValueFromParams(data, keyField).toString());
|
|
858
|
+
yield docRef.set(this.paramsToPlain(data), { merge: true });
|
|
859
|
+
const doc = yield docRef.get();
|
|
860
|
+
return doc.data();
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
buildCollectionPathForUpdate(identifiers) {
|
|
864
|
+
return this.isSubCollection(this)
|
|
865
|
+
? `${this.parentRepository.collectionName}/${getValueFromParams(identifiers, this.parentIdField)}/${this.collectionName}`
|
|
866
|
+
: this.collectionName;
|
|
867
|
+
}
|
|
868
|
+
paramsToPlain(params) {
|
|
869
|
+
const model = this.model;
|
|
870
|
+
if (params instanceof model)
|
|
871
|
+
return params;
|
|
872
|
+
return Object.keys(params).reduce((data, currentKey) => (Object.assign(Object.assign({}, data), { [currentKey]: getValueByAction(params[currentKey]) })), {});
|
|
873
|
+
}
|
|
874
|
+
};
|
|
875
875
|
};
|
|
876
876
|
|
|
877
|
-
const withDeleteFirestore = (MixinBase) => {
|
|
878
|
-
return class DeleteFirestore extends MixinBase {
|
|
879
|
-
delete(identifiers) {
|
|
880
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
881
|
-
yield this.collection(this.buildCollectionPathForRemove(identifiers))
|
|
882
|
-
.doc(Object.values(identifiers).shift().toString())
|
|
883
|
-
.delete();
|
|
884
|
-
});
|
|
885
|
-
}
|
|
886
|
-
buildCollectionPathForRemove(identifiers) {
|
|
887
|
-
return this.isSubCollection(this)
|
|
888
|
-
? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
|
|
889
|
-
: this.collectionName;
|
|
890
|
-
}
|
|
891
|
-
};
|
|
877
|
+
const withDeleteFirestore = (MixinBase) => {
|
|
878
|
+
return class DeleteFirestore extends MixinBase {
|
|
879
|
+
delete(identifiers) {
|
|
880
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
881
|
+
yield this.collection(this.buildCollectionPathForRemove(identifiers))
|
|
882
|
+
.doc(Object.values(identifiers).shift().toString())
|
|
883
|
+
.delete();
|
|
884
|
+
});
|
|
885
|
+
}
|
|
886
|
+
buildCollectionPathForRemove(identifiers) {
|
|
887
|
+
return this.isSubCollection(this)
|
|
888
|
+
? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
|
|
889
|
+
: this.collectionName;
|
|
890
|
+
}
|
|
891
|
+
};
|
|
892
892
|
};
|
|
893
893
|
|
|
894
|
-
const withSubCollection = (MixinBase, ParentModel) => {
|
|
895
|
-
return class SubCollectionMix extends MixinBase {
|
|
896
|
-
constructor(...args) {
|
|
897
|
-
super(args);
|
|
898
|
-
}
|
|
899
|
-
collection(path) {
|
|
900
|
-
return super.collection(path);
|
|
901
|
-
}
|
|
902
|
-
};
|
|
894
|
+
const withSubCollection = (MixinBase, ParentModel) => {
|
|
895
|
+
return class SubCollectionMix extends MixinBase {
|
|
896
|
+
constructor(...args) {
|
|
897
|
+
super(args);
|
|
898
|
+
}
|
|
899
|
+
collection(path) {
|
|
900
|
+
return super.collection(path);
|
|
901
|
+
}
|
|
902
|
+
};
|
|
903
903
|
};
|
|
904
904
|
|
|
905
|
-
const withCrudFirestore = (MixinBase) => {
|
|
906
|
-
return class CrudFirestore extends withUpdateFirestore(withGetFirestore(withFindFirestore(withDeleteFirestore(withCreateFirestore(MixinBase))))) {
|
|
907
|
-
};
|
|
905
|
+
const withCrudFirestore = (MixinBase) => {
|
|
906
|
+
return class CrudFirestore extends withUpdateFirestore(withGetFirestore(withFindFirestore(withDeleteFirestore(withCreateFirestore(MixinBase))))) {
|
|
907
|
+
};
|
|
908
908
|
};
|
|
909
909
|
|
|
910
|
-
class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
911
|
-
constructor(firestore) {
|
|
912
|
-
super();
|
|
913
|
-
this.firestore = firestore;
|
|
914
|
-
this.collectionName = 'subscription';
|
|
915
|
-
this.model = Subscription;
|
|
916
|
-
}
|
|
910
|
+
class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
911
|
+
constructor(firestore) {
|
|
912
|
+
super();
|
|
913
|
+
this.firestore = firestore;
|
|
914
|
+
this.collectionName = 'subscription';
|
|
915
|
+
this.model = Subscription;
|
|
916
|
+
}
|
|
917
917
|
}
|
|
918
918
|
|
|
919
|
-
class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
920
|
-
constructor(firestore) {
|
|
921
|
-
super();
|
|
922
|
-
this.firestore = firestore;
|
|
923
|
-
this.collectionName = 'users';
|
|
924
|
-
this.model = User;
|
|
925
|
-
}
|
|
926
|
-
get(identifiers) {
|
|
927
|
-
const _super = Object.create(null, {
|
|
928
|
-
get: { get: () => super.get }
|
|
929
|
-
});
|
|
930
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
931
|
-
const user = yield _super.get.call(this, { id: identifiers.id });
|
|
932
|
-
user.beautyProfile = yield this.getBeautyProfile(user.id);
|
|
933
|
-
user.isSubscriber = yield this.checkIfIsSubscriber(user.id);
|
|
934
|
-
return user;
|
|
935
|
-
});
|
|
936
|
-
}
|
|
937
|
-
buildModelInstance() {
|
|
938
|
-
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
939
|
-
return {
|
|
940
|
-
toFirestore: (data) => {
|
|
941
|
-
const plain = toFirestore(data);
|
|
942
|
-
delete plain.isSubscriber;
|
|
943
|
-
return plain;
|
|
944
|
-
},
|
|
945
|
-
fromFirestore,
|
|
946
|
-
};
|
|
947
|
-
}
|
|
948
|
-
getBeautyProfile(userId) {
|
|
949
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
950
|
-
const beautyProfile = yield this.collection()
|
|
951
|
-
.doc(userId)
|
|
952
|
-
.collection('CX')
|
|
953
|
-
.withConverter(this.buildBeautyProfileModelInstance())
|
|
954
|
-
.doc('beautyProfile')
|
|
955
|
-
.get();
|
|
956
|
-
return beautyProfile.data();
|
|
957
|
-
});
|
|
958
|
-
}
|
|
959
|
-
checkIfIsSubscriber(userId) {
|
|
960
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
961
|
-
const docs = yield this.firestore
|
|
962
|
-
.collection('subscription')
|
|
963
|
-
.where('user.id', '==', userId)
|
|
964
|
-
.where('status', '==', 'active')
|
|
965
|
-
.get();
|
|
966
|
-
return !!docs && !!docs.size;
|
|
967
|
-
});
|
|
968
|
-
}
|
|
969
|
-
buildBeautyProfileModelInstance() {
|
|
970
|
-
return {
|
|
971
|
-
toFirestore: (data) => data.toPlain(),
|
|
972
|
-
fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
|
|
973
|
-
};
|
|
974
|
-
}
|
|
919
|
+
class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
920
|
+
constructor(firestore) {
|
|
921
|
+
super();
|
|
922
|
+
this.firestore = firestore;
|
|
923
|
+
this.collectionName = 'users';
|
|
924
|
+
this.model = User;
|
|
925
|
+
}
|
|
926
|
+
get(identifiers) {
|
|
927
|
+
const _super = Object.create(null, {
|
|
928
|
+
get: { get: () => super.get }
|
|
929
|
+
});
|
|
930
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
931
|
+
const user = yield _super.get.call(this, { id: identifiers.id });
|
|
932
|
+
user.beautyProfile = yield this.getBeautyProfile(user.id);
|
|
933
|
+
user.isSubscriber = yield this.checkIfIsSubscriber(user.id);
|
|
934
|
+
return user;
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
buildModelInstance() {
|
|
938
|
+
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
939
|
+
return {
|
|
940
|
+
toFirestore: (data) => {
|
|
941
|
+
const plain = toFirestore(data);
|
|
942
|
+
delete plain.isSubscriber;
|
|
943
|
+
return plain;
|
|
944
|
+
},
|
|
945
|
+
fromFirestore,
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
getBeautyProfile(userId) {
|
|
949
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
950
|
+
const beautyProfile = yield this.collection()
|
|
951
|
+
.doc(userId)
|
|
952
|
+
.collection('CX')
|
|
953
|
+
.withConverter(this.buildBeautyProfileModelInstance())
|
|
954
|
+
.doc('beautyProfile')
|
|
955
|
+
.get();
|
|
956
|
+
return beautyProfile.data();
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
checkIfIsSubscriber(userId) {
|
|
960
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
961
|
+
const docs = yield this.firestore
|
|
962
|
+
.collection('subscription')
|
|
963
|
+
.where('user.id', '==', userId)
|
|
964
|
+
.where('status', '==', 'active')
|
|
965
|
+
.get();
|
|
966
|
+
return !!docs && !!docs.size;
|
|
967
|
+
});
|
|
968
|
+
}
|
|
969
|
+
buildBeautyProfileModelInstance() {
|
|
970
|
+
return {
|
|
971
|
+
toFirestore: (data) => data.toPlain(),
|
|
972
|
+
fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
|
|
973
|
+
};
|
|
974
|
+
}
|
|
975
975
|
}
|
|
976
976
|
|
|
977
|
-
class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
|
|
978
|
-
constructor(firestore, parentRepository) {
|
|
979
|
-
super();
|
|
980
|
-
this.firestore = firestore;
|
|
981
|
-
this.parentRepository = parentRepository;
|
|
982
|
-
this.collectionName = 'editions';
|
|
983
|
-
this.parentIdField = 'subscriptionId';
|
|
984
|
-
this.model = Edition;
|
|
985
|
-
}
|
|
977
|
+
class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
|
|
978
|
+
constructor(firestore, parentRepository) {
|
|
979
|
+
super();
|
|
980
|
+
this.firestore = firestore;
|
|
981
|
+
this.parentRepository = parentRepository;
|
|
982
|
+
this.collectionName = 'editions';
|
|
983
|
+
this.parentIdField = 'subscriptionId';
|
|
984
|
+
this.model = Edition;
|
|
985
|
+
}
|
|
986
986
|
}
|
|
987
987
|
|
|
988
|
-
class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
|
|
989
|
-
constructor(firestore, parentRepository) {
|
|
990
|
-
super();
|
|
991
|
-
this.firestore = firestore;
|
|
992
|
-
this.parentRepository = parentRepository;
|
|
993
|
-
this.collectionName = 'CX';
|
|
994
|
-
this.parentIdField = 'userId';
|
|
995
|
-
this.model = BeautyProfile;
|
|
996
|
-
}
|
|
988
|
+
class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
|
|
989
|
+
constructor(firestore, parentRepository) {
|
|
990
|
+
super();
|
|
991
|
+
this.firestore = firestore;
|
|
992
|
+
this.parentRepository = parentRepository;
|
|
993
|
+
this.collectionName = 'CX';
|
|
994
|
+
this.parentIdField = 'userId';
|
|
995
|
+
this.model = BeautyProfile;
|
|
996
|
+
}
|
|
997
997
|
}
|
|
998
998
|
|
|
999
|
-
class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
|
|
1000
|
-
constructor(firestore, parentRepository) {
|
|
1001
|
-
super();
|
|
1002
|
-
this.firestore = firestore;
|
|
1003
|
-
this.parentRepository = parentRepository;
|
|
1004
|
-
this.collectionName = 'address';
|
|
1005
|
-
this.parentIdField = 'userId';
|
|
1006
|
-
this.model = UserAddress;
|
|
1007
|
-
}
|
|
999
|
+
class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
|
|
1000
|
+
constructor(firestore, parentRepository) {
|
|
1001
|
+
super();
|
|
1002
|
+
this.firestore = firestore;
|
|
1003
|
+
this.parentRepository = parentRepository;
|
|
1004
|
+
this.collectionName = 'address';
|
|
1005
|
+
this.parentIdField = 'userId';
|
|
1006
|
+
this.model = UserAddress;
|
|
1007
|
+
}
|
|
1008
1008
|
}
|
|
1009
1009
|
|
|
1010
|
-
class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
|
|
1011
|
-
constructor(firestore, parentRepository) {
|
|
1012
|
-
super();
|
|
1013
|
-
this.firestore = firestore;
|
|
1014
|
-
this.parentRepository = parentRepository;
|
|
1015
|
-
this.collectionName = 'payment_method';
|
|
1016
|
-
this.parentIdField = 'userId';
|
|
1017
|
-
this.model = UserPaymentMethod;
|
|
1018
|
-
}
|
|
1010
|
+
class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
|
|
1011
|
+
constructor(firestore, parentRepository) {
|
|
1012
|
+
super();
|
|
1013
|
+
this.firestore = firestore;
|
|
1014
|
+
this.parentRepository = parentRepository;
|
|
1015
|
+
this.collectionName = 'payment_method';
|
|
1016
|
+
this.parentIdField = 'userId';
|
|
1017
|
+
this.model = UserPaymentMethod;
|
|
1018
|
+
}
|
|
1019
1019
|
}
|
|
1020
1020
|
|
|
1021
|
-
class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
|
|
1022
|
-
constructor(firestore, parentRepository) {
|
|
1023
|
-
super();
|
|
1024
|
-
this.firestore = firestore;
|
|
1025
|
-
this.parentRepository = parentRepository;
|
|
1026
|
-
this.collectionName = 'payments';
|
|
1027
|
-
this.parentIdField = 'subscriptionId';
|
|
1028
|
-
this.model = SubscriptionPayment;
|
|
1029
|
-
}
|
|
1021
|
+
class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
|
|
1022
|
+
constructor(firestore, parentRepository) {
|
|
1023
|
+
super();
|
|
1024
|
+
this.firestore = firestore;
|
|
1025
|
+
this.parentRepository = parentRepository;
|
|
1026
|
+
this.collectionName = 'payments';
|
|
1027
|
+
this.parentIdField = 'subscriptionId';
|
|
1028
|
+
this.model = SubscriptionPayment;
|
|
1029
|
+
}
|
|
1030
1030
|
}
|
|
1031
1031
|
|
|
1032
|
-
class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1033
|
-
constructor(firestore) {
|
|
1034
|
-
super();
|
|
1035
|
-
this.firestore = firestore;
|
|
1036
|
-
this.collectionName = 'leads';
|
|
1037
|
-
this.model = Lead;
|
|
1038
|
-
}
|
|
1032
|
+
class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1033
|
+
constructor(firestore) {
|
|
1034
|
+
super();
|
|
1035
|
+
this.firestore = firestore;
|
|
1036
|
+
this.collectionName = 'leads';
|
|
1037
|
+
this.model = Lead;
|
|
1038
|
+
}
|
|
1039
1039
|
}
|
|
1040
1040
|
|
|
1041
|
-
class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1042
|
-
constructor(firestore) {
|
|
1043
|
-
super();
|
|
1044
|
-
this.firestore = firestore;
|
|
1045
|
-
this.collectionName = 'categories';
|
|
1046
|
-
this.model = Category;
|
|
1047
|
-
}
|
|
1048
|
-
getCategoryBySlug(slug, shop) {
|
|
1049
|
-
return this.collection(this.collectionName)
|
|
1050
|
-
.where('slug', '==', slug)
|
|
1051
|
-
.where('shop', '==', shop)
|
|
1052
|
-
.where('published', '==', true)
|
|
1053
|
-
.get()
|
|
1054
|
-
.then((snap) => {
|
|
1055
|
-
if (snap.size > 1)
|
|
1056
|
-
throw new DuplicatedResultsError('Query returned duplicated values');
|
|
1057
|
-
if (snap.empty)
|
|
1058
|
-
throw new NotFoundError(`Document with slug ${slug} not found`);
|
|
1059
|
-
return snap.docs[0].data();
|
|
1060
|
-
})
|
|
1061
|
-
.catch((error) => error);
|
|
1062
|
-
}
|
|
1063
|
-
getCategoriesForHome(categoryIds, limit = 4) {
|
|
1064
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1065
|
-
const categorySnap = yield this.collection(this.collectionName)
|
|
1066
|
-
.where('id', 'in', categoryIds)
|
|
1067
|
-
.where('published', '==', true)
|
|
1068
|
-
.get();
|
|
1069
|
-
if (categorySnap.empty)
|
|
1070
|
-
throw new NotFoundError('Categories not found');
|
|
1071
|
-
const categories = categorySnap.docs.map((doc) => doc.data());
|
|
1072
|
-
const homeSections = [];
|
|
1073
|
-
for (const category of categories) {
|
|
1074
|
-
const publishedField = category.shop === Shops.GLAMSHOP ? 'publishedGlam' : 'published';
|
|
1075
|
-
const productSnap = yield this.collection('products')
|
|
1076
|
-
.where('categories', 'array-contains', category.id)
|
|
1077
|
-
.where(publishedField, '==', true)
|
|
1078
|
-
.where('stock.quantity', '>', 1)
|
|
1079
|
-
.limit(limit)
|
|
1080
|
-
.get();
|
|
1081
|
-
const products = productSnap.docs.map((doc) => doc.data());
|
|
1082
|
-
homeSections.push({ category, products });
|
|
1083
|
-
}
|
|
1084
|
-
return homeSections;
|
|
1085
|
-
});
|
|
1086
|
-
}
|
|
1087
|
-
mountCategory(category) {
|
|
1088
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1089
|
-
if (!category.products)
|
|
1090
|
-
throw new RequiredArgumentError(['Category products is empty']);
|
|
1091
|
-
const chunks = category.products.reduce((resultArray, item, index) => {
|
|
1092
|
-
const chunkIndex = Math.floor(index / 10);
|
|
1093
|
-
if (!resultArray[chunkIndex])
|
|
1094
|
-
resultArray[chunkIndex] = [];
|
|
1095
|
-
resultArray[chunkIndex].push(item);
|
|
1096
|
-
return resultArray;
|
|
1097
|
-
}, []);
|
|
1098
|
-
const products = [];
|
|
1099
|
-
const publishedField = category.shop === Shops.GLAMSHOP ? 'publishedGlam' : 'published';
|
|
1100
|
-
yield Promise.all(chunks.map((productIds) => __awaiter(this, void 0, void 0, function* () {
|
|
1101
|
-
const productSnap = yield this.collection('products')
|
|
1102
|
-
.where(publishedField, '==', true)
|
|
1103
|
-
.where('id', 'in', productIds)
|
|
1104
|
-
.get();
|
|
1105
|
-
if (productSnap.empty)
|
|
1106
|
-
return;
|
|
1107
|
-
products.push(...productSnap.docs.map((doc) => doc.data()));
|
|
1108
|
-
})));
|
|
1109
|
-
return products;
|
|
1110
|
-
});
|
|
1111
|
-
}
|
|
1041
|
+
class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1042
|
+
constructor(firestore) {
|
|
1043
|
+
super();
|
|
1044
|
+
this.firestore = firestore;
|
|
1045
|
+
this.collectionName = 'categories';
|
|
1046
|
+
this.model = Category;
|
|
1047
|
+
}
|
|
1048
|
+
getCategoryBySlug(slug, shop) {
|
|
1049
|
+
return this.collection(this.collectionName)
|
|
1050
|
+
.where('slug', '==', slug)
|
|
1051
|
+
.where('shop', '==', shop)
|
|
1052
|
+
.where('published', '==', true)
|
|
1053
|
+
.get()
|
|
1054
|
+
.then((snap) => {
|
|
1055
|
+
if (snap.size > 1)
|
|
1056
|
+
throw new DuplicatedResultsError('Query returned duplicated values');
|
|
1057
|
+
if (snap.empty)
|
|
1058
|
+
throw new NotFoundError(`Document with slug ${slug} not found`);
|
|
1059
|
+
return snap.docs[0].data();
|
|
1060
|
+
})
|
|
1061
|
+
.catch((error) => error);
|
|
1062
|
+
}
|
|
1063
|
+
getCategoriesForHome(categoryIds, limit = 4) {
|
|
1064
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1065
|
+
const categorySnap = yield this.collection(this.collectionName)
|
|
1066
|
+
.where('id', 'in', categoryIds)
|
|
1067
|
+
.where('published', '==', true)
|
|
1068
|
+
.get();
|
|
1069
|
+
if (categorySnap.empty)
|
|
1070
|
+
throw new NotFoundError('Categories not found');
|
|
1071
|
+
const categories = categorySnap.docs.map((doc) => doc.data());
|
|
1072
|
+
const homeSections = [];
|
|
1073
|
+
for (const category of categories) {
|
|
1074
|
+
const publishedField = category.shop === Shops.GLAMSHOP ? 'publishedGlam' : 'published';
|
|
1075
|
+
const productSnap = yield this.collection('products')
|
|
1076
|
+
.where('categories', 'array-contains', category.id)
|
|
1077
|
+
.where(publishedField, '==', true)
|
|
1078
|
+
.where('stock.quantity', '>', 1)
|
|
1079
|
+
.limit(limit)
|
|
1080
|
+
.get();
|
|
1081
|
+
const products = productSnap.docs.map((doc) => doc.data());
|
|
1082
|
+
homeSections.push({ category, products });
|
|
1083
|
+
}
|
|
1084
|
+
return homeSections;
|
|
1085
|
+
});
|
|
1086
|
+
}
|
|
1087
|
+
mountCategory(category) {
|
|
1088
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1089
|
+
if (!category.products)
|
|
1090
|
+
throw new RequiredArgumentError(['Category products is empty']);
|
|
1091
|
+
const chunks = category.products.reduce((resultArray, item, index) => {
|
|
1092
|
+
const chunkIndex = Math.floor(index / 10);
|
|
1093
|
+
if (!resultArray[chunkIndex])
|
|
1094
|
+
resultArray[chunkIndex] = [];
|
|
1095
|
+
resultArray[chunkIndex].push(item);
|
|
1096
|
+
return resultArray;
|
|
1097
|
+
}, []);
|
|
1098
|
+
const products = [];
|
|
1099
|
+
const publishedField = category.shop === Shops.GLAMSHOP ? 'publishedGlam' : 'published';
|
|
1100
|
+
yield Promise.all(chunks.map((productIds) => __awaiter(this, void 0, void 0, function* () {
|
|
1101
|
+
const productSnap = yield this.collection('products')
|
|
1102
|
+
.where(publishedField, '==', true)
|
|
1103
|
+
.where('id', 'in', productIds)
|
|
1104
|
+
.get();
|
|
1105
|
+
if (productSnap.empty)
|
|
1106
|
+
return;
|
|
1107
|
+
products.push(...productSnap.docs.map((doc) => doc.data()));
|
|
1108
|
+
})));
|
|
1109
|
+
return products;
|
|
1110
|
+
});
|
|
1111
|
+
}
|
|
1112
1112
|
}
|
|
1113
1113
|
|
|
1114
|
-
class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1115
|
-
constructor(firestore) {
|
|
1116
|
-
super();
|
|
1117
|
-
this.firestore = firestore;
|
|
1118
|
-
this.collectionName = 'products';
|
|
1119
|
-
this.model = Product;
|
|
1120
|
-
}
|
|
1121
|
-
getBySlug(slug, shop) {
|
|
1122
|
-
var _a;
|
|
1123
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1124
|
-
const result = yield this.find([
|
|
1125
|
-
{ slug: { operator: Where.EQUALS, value: slug } },
|
|
1126
|
-
{ shopAvailability: { operator: Where.IN, value: [shop] } },
|
|
1127
|
-
]);
|
|
1128
|
-
return (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift();
|
|
1129
|
-
});
|
|
1130
|
-
}
|
|
1114
|
+
class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1115
|
+
constructor(firestore) {
|
|
1116
|
+
super();
|
|
1117
|
+
this.firestore = firestore;
|
|
1118
|
+
this.collectionName = 'products';
|
|
1119
|
+
this.model = Product;
|
|
1120
|
+
}
|
|
1121
|
+
getBySlug(slug, shop) {
|
|
1122
|
+
var _a;
|
|
1123
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1124
|
+
const result = yield this.find([
|
|
1125
|
+
{ slug: { operator: Where.EQUALS, value: slug } },
|
|
1126
|
+
{ shopAvailability: { operator: Where.IN, value: [shop] } },
|
|
1127
|
+
]);
|
|
1128
|
+
return (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift();
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1131
1131
|
}
|
|
1132
1132
|
|
|
1133
|
-
class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Product) {
|
|
1134
|
-
constructor(firestore, parentRepository) {
|
|
1135
|
-
super();
|
|
1136
|
-
this.firestore = firestore;
|
|
1137
|
-
this.parentRepository = parentRepository;
|
|
1138
|
-
this.collectionName = 'variants';
|
|
1139
|
-
this.parentIdField = 'productId';
|
|
1140
|
-
this.model = Variant;
|
|
1141
|
-
}
|
|
1133
|
+
class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Product) {
|
|
1134
|
+
constructor(firestore, parentRepository) {
|
|
1135
|
+
super();
|
|
1136
|
+
this.firestore = firestore;
|
|
1137
|
+
this.parentRepository = parentRepository;
|
|
1138
|
+
this.collectionName = 'variants';
|
|
1139
|
+
this.parentIdField = 'productId';
|
|
1140
|
+
this.model = Variant;
|
|
1141
|
+
}
|
|
1142
1142
|
}
|
|
1143
1143
|
|
|
1144
|
-
class CheckoutFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1145
|
-
constructor(firestore) {
|
|
1146
|
-
super();
|
|
1147
|
-
this.firestore = firestore;
|
|
1148
|
-
this.collectionName = 'checkouts';
|
|
1149
|
-
this.model = Checkout;
|
|
1150
|
-
}
|
|
1144
|
+
class CheckoutFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1145
|
+
constructor(firestore) {
|
|
1146
|
+
super();
|
|
1147
|
+
this.firestore = firestore;
|
|
1148
|
+
this.collectionName = 'checkouts';
|
|
1149
|
+
this.model = Checkout;
|
|
1150
|
+
}
|
|
1151
1151
|
}
|
|
1152
1152
|
|
|
1153
|
-
class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1154
|
-
constructor(firestore) {
|
|
1155
|
-
super();
|
|
1156
|
-
this.firestore = firestore;
|
|
1157
|
-
this.collectionName = 'coupons';
|
|
1158
|
-
this.model = Coupon;
|
|
1159
|
-
}
|
|
1153
|
+
class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1154
|
+
constructor(firestore) {
|
|
1155
|
+
super();
|
|
1156
|
+
this.firestore = firestore;
|
|
1157
|
+
this.collectionName = 'coupons';
|
|
1158
|
+
this.model = Coupon;
|
|
1159
|
+
}
|
|
1160
1160
|
}
|
|
1161
1161
|
|
|
1162
|
-
class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1163
|
-
constructor(firestore) {
|
|
1164
|
-
super();
|
|
1165
|
-
this.firestore = firestore;
|
|
1166
|
-
this.collectionName = 'orders';
|
|
1167
|
-
this.model = Order;
|
|
1168
|
-
}
|
|
1162
|
+
class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1163
|
+
constructor(firestore) {
|
|
1164
|
+
super();
|
|
1165
|
+
this.firestore = firestore;
|
|
1166
|
+
this.collectionName = 'orders';
|
|
1167
|
+
this.model = Order;
|
|
1168
|
+
}
|
|
1169
1169
|
}
|
|
1170
1170
|
|
|
1171
|
-
class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1172
|
-
constructor(firestore) {
|
|
1173
|
-
super();
|
|
1174
|
-
this.firestore = firestore;
|
|
1175
|
-
this.collectionName = 'payments';
|
|
1176
|
-
this.model = Payment;
|
|
1177
|
-
}
|
|
1171
|
+
class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1172
|
+
constructor(firestore) {
|
|
1173
|
+
super();
|
|
1174
|
+
this.firestore = firestore;
|
|
1175
|
+
this.collectionName = 'payments';
|
|
1176
|
+
this.model = Payment;
|
|
1177
|
+
}
|
|
1178
1178
|
}
|
|
1179
1179
|
|
|
1180
|
-
class CheckoutSubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1181
|
-
constructor(firestore) {
|
|
1182
|
-
super();
|
|
1183
|
-
this.firestore = firestore;
|
|
1184
|
-
this.collectionName = 'checkoutsSubscription';
|
|
1185
|
-
this.model = CheckoutSubscription;
|
|
1186
|
-
}
|
|
1180
|
+
class CheckoutSubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1181
|
+
constructor(firestore) {
|
|
1182
|
+
super();
|
|
1183
|
+
this.firestore = firestore;
|
|
1184
|
+
this.collectionName = 'checkoutsSubscription';
|
|
1185
|
+
this.model = CheckoutSubscription;
|
|
1186
|
+
}
|
|
1187
1187
|
}
|
|
1188
1188
|
|
|
1189
|
-
class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1190
|
-
constructor(firestore) {
|
|
1191
|
-
super();
|
|
1192
|
-
this.firestore = firestore;
|
|
1193
|
-
this.collectionName = 'subscriptionPlans';
|
|
1194
|
-
this.model = SubscriptionPlan;
|
|
1195
|
-
}
|
|
1189
|
+
class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1190
|
+
constructor(firestore) {
|
|
1191
|
+
super();
|
|
1192
|
+
this.firestore = firestore;
|
|
1193
|
+
this.collectionName = 'subscriptionPlans';
|
|
1194
|
+
this.model = SubscriptionPlan;
|
|
1195
|
+
}
|
|
1196
1196
|
}
|
|
1197
1197
|
|
|
1198
|
-
class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1199
|
-
constructor(firestore) {
|
|
1200
|
-
super();
|
|
1201
|
-
this.firestore = firestore;
|
|
1202
|
-
this.collectionName = 'buy2win';
|
|
1203
|
-
this.model = Buy2Win;
|
|
1204
|
-
}
|
|
1198
|
+
class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1199
|
+
constructor(firestore) {
|
|
1200
|
+
super();
|
|
1201
|
+
this.firestore = firestore;
|
|
1202
|
+
this.collectionName = 'buy2win';
|
|
1203
|
+
this.model = Buy2Win;
|
|
1204
|
+
}
|
|
1205
1205
|
}
|
|
1206
1206
|
|
|
1207
|
-
class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
|
|
1208
|
-
constructor(firestore) {
|
|
1209
|
-
super(firestore);
|
|
1210
|
-
this.firestore = firestore;
|
|
1211
|
-
this.collectionName = 'legacyOrders';
|
|
1212
|
-
}
|
|
1207
|
+
class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
|
|
1208
|
+
constructor(firestore) {
|
|
1209
|
+
super(firestore);
|
|
1210
|
+
this.firestore = firestore;
|
|
1211
|
+
this.collectionName = 'legacyOrders';
|
|
1212
|
+
}
|
|
1213
1213
|
}
|
|
1214
1214
|
|
|
1215
|
-
class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1216
|
-
constructor(firestore) {
|
|
1217
|
-
super();
|
|
1218
|
-
this.firestore = firestore;
|
|
1219
|
-
this.collectionName = 'dms';
|
|
1220
|
-
this.model = Home;
|
|
1221
|
-
}
|
|
1215
|
+
class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1216
|
+
constructor(firestore) {
|
|
1217
|
+
super();
|
|
1218
|
+
this.firestore = firestore;
|
|
1219
|
+
this.collectionName = 'dms';
|
|
1220
|
+
this.model = Home;
|
|
1221
|
+
}
|
|
1222
1222
|
}
|
|
1223
1223
|
|
|
1224
|
-
class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1225
|
-
constructor(firestore) {
|
|
1226
|
-
super();
|
|
1227
|
-
this.firestore = firestore;
|
|
1228
|
-
this.collectionName = 'shopMenus';
|
|
1229
|
-
this.model = ShopMenu;
|
|
1230
|
-
}
|
|
1224
|
+
class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1225
|
+
constructor(firestore) {
|
|
1226
|
+
super();
|
|
1227
|
+
this.firestore = firestore;
|
|
1228
|
+
this.collectionName = 'shopMenus';
|
|
1229
|
+
this.model = ShopMenu;
|
|
1230
|
+
}
|
|
1231
1231
|
}
|
|
1232
1232
|
|
|
1233
|
-
class AuthenticationFirebaseAuthService {
|
|
1234
|
-
constructor(firebaseAuth) {
|
|
1235
|
-
this.firebaseAuth = firebaseAuth;
|
|
1236
|
-
}
|
|
1237
|
-
signInWithEmailAndPassword(data) {
|
|
1238
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1239
|
-
const credentials = yield this.firebaseAuth.signInWithEmailAndPassword(data.email, data.password);
|
|
1240
|
-
const user = credentials.user;
|
|
1241
|
-
return { id: user.uid, displayName: user.displayName, email: user.email, phone: user.phoneNumber };
|
|
1242
|
-
});
|
|
1243
|
-
}
|
|
1244
|
-
signInWithGoogle() {
|
|
1245
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1246
|
-
const credentials = yield this.firebaseAuth.signInWithPopup(new firebase$1.auth.GoogleAuthProvider());
|
|
1247
|
-
const user = credentials.user;
|
|
1248
|
-
return { id: user.uid, displayName: user.displayName, email: user.email, phone: user.phoneNumber };
|
|
1249
|
-
});
|
|
1250
|
-
}
|
|
1251
|
-
signOut() {
|
|
1252
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1253
|
-
this.firebaseAuth.signOut();
|
|
1254
|
-
});
|
|
1255
|
-
}
|
|
1233
|
+
class AuthenticationFirebaseAuthService {
|
|
1234
|
+
constructor(firebaseAuth) {
|
|
1235
|
+
this.firebaseAuth = firebaseAuth;
|
|
1236
|
+
}
|
|
1237
|
+
signInWithEmailAndPassword(data) {
|
|
1238
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1239
|
+
const credentials = yield this.firebaseAuth.signInWithEmailAndPassword(data.email, data.password);
|
|
1240
|
+
const user = credentials.user;
|
|
1241
|
+
return { id: user.uid, displayName: user.displayName, email: user.email, phone: user.phoneNumber };
|
|
1242
|
+
});
|
|
1243
|
+
}
|
|
1244
|
+
signInWithGoogle() {
|
|
1245
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1246
|
+
const credentials = yield this.firebaseAuth.signInWithPopup(new firebase$1.auth.GoogleAuthProvider());
|
|
1247
|
+
const user = credentials.user;
|
|
1248
|
+
return { id: user.uid, displayName: user.displayName, email: user.email, phone: user.phoneNumber };
|
|
1249
|
+
});
|
|
1250
|
+
}
|
|
1251
|
+
signOut() {
|
|
1252
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1253
|
+
this.firebaseAuth.signOut();
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
1256
1256
|
}
|
|
1257
1257
|
|
|
1258
|
-
/**
|
|
1259
|
-
* Generated bundle index. Do not edit.
|
|
1258
|
+
/**
|
|
1259
|
+
* Generated bundle index. Do not edit.
|
|
1260
1260
|
*/
|
|
1261
1261
|
|
|
1262
1262
|
export { Address, Area, Authentication, AuthenticationFirebaseAuthService, Base, BaseModel, BeardSizes, BeautyProfile, BillingStatus, Buy2Win, Buy2WinFirestoreRepository, Category, CategoryFirestoreRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FinancialCoupon, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductVariantFirestoreRepository, RequiredArgumentError, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, Where, withCreateFirestore, withCrudFirestore, withDeleteFirestore, withFindFirestore, withFirestore, withGetFirestore, withHelpers, withSubCollection, withUpdateFirestore };
|