@infrab4a/connect 0.14.2 → 0.14.3-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -24
- package/bundles/infrab4a-connect.umd.js +2252 -2252
- 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 +5 -5
- package/esm2015/lib/domain/catalog/repositories/product.repository.js +2 -2
- package/esm2015/lib/domain/catalog/repositories/subscription-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 +12 -12
- 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/enums/filter-type.enum.js +21 -21
- package/esm2015/lib/domain/shop-settings/enums/index.js +3 -3
- package/esm2015/lib/domain/shop-settings/enums/questions-filters.enum.js +21 -21
- package/esm2015/lib/domain/shop-settings/helpers/beauty-questions.helper.js +46 -46
- package/esm2015/lib/domain/shop-settings/helpers/index.js +2 -2
- package/esm2015/lib/domain/shop-settings/index.js +5 -5
- 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 +4 -4
- package/esm2015/lib/domain/users/errors/unauthorized.error.js +7 -7
- package/esm2015/lib/domain/users/errors/user-already-registered.error.js +7 -7
- package/esm2015/lib/domain/users/errors/weak-password.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/accessory-importances.enum.js +7 -7
- package/esm2015/lib/domain/users/models/enums/area.enum.js +13 -13
- package/esm2015/lib/domain/users/models/enums/beard-problems.enum.js +11 -11
- package/esm2015/lib/domain/users/models/enums/beard-sizes.enum.js +9 -9
- package/esm2015/lib/domain/users/models/enums/beauty-product-importances.enum.js +8 -8
- package/esm2015/lib/domain/users/models/enums/body-problems.enum.js +13 -13
- package/esm2015/lib/domain/users/models/enums/body-shapes.enum.js +9 -9
- package/esm2015/lib/domain/users/models/enums/body-tattoos.enum.js +7 -7
- package/esm2015/lib/domain/users/models/enums/face-skin-oilinesses.enum.js +9 -9
- package/esm2015/lib/domain/users/models/enums/face-skin-problems.enum.js +12 -12
- package/esm2015/lib/domain/users/models/enums/face-skin-tones.enum.js +10 -10
- package/esm2015/lib/domain/users/models/enums/family-incomes.enum.js +10 -10
- package/esm2015/lib/domain/users/models/enums/fragrance-importances.enum.js +7 -7
- package/esm2015/lib/domain/users/models/enums/hair-colors.enum.js +12 -12
- package/esm2015/lib/domain/users/models/enums/hair-problems.enum.js +12 -12
- package/esm2015/lib/domain/users/models/enums/hair-strands.enum.js +10 -10
- package/esm2015/lib/domain/users/models/enums/hair-types.enum.js +9 -9
- package/esm2015/lib/domain/users/models/enums/index.js +21 -21
- package/esm2015/lib/domain/users/models/enums/office-position.enum.js +8 -8
- package/esm2015/lib/domain/users/models/enums/product-spents.enum.js +10 -10
- 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 +6 -6
- 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 +6 -6
- 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 +4 -4
- package/esm2015/lib/domain/users/services/register.service.js +2 -2
- package/esm2015/lib/domain/users/services/types/basic-user-data.type.js +2 -2
- package/esm2015/lib/domain/users/services/types/index.js +2 -2
- package/esm2015/lib/domain/users/use-cases/authentication.js +40 -40
- package/esm2015/lib/domain/users/use-cases/index.js +5 -5
- package/esm2015/lib/domain/users/use-cases/recovery-password.js +12 -12
- package/esm2015/lib/domain/users/use-cases/register.js +34 -34
- 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 +52 -52
- package/esm2015/lib/infra/firebase/auth/index.js +3 -3
- package/esm2015/lib/infra/firebase/auth/register-firebase-auth.service.js +26 -26
- package/esm2015/lib/infra/firebase/auth/types/firebase-user-with-id.type.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 +31 -31
- 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 +76 -76
- 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/models/user-search.js +7 -7
- package/esm2015/lib/infra/firebase/firestore/repositories/catalog/category-firestore.repository.js +74 -74
- package/esm2015/lib/infra/firebase/firestore/repositories/catalog/index.js +5 -5
- 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/catalog/subscription-product-firestore.repository.js +12 -12
- 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 +29 -29
- 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 +10 -10
- 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 +70 -70
- package/esm2015/lib/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.js +14 -14
- package/esm2015/lib/infra/firebase/firestore/repositories/users/user-search-firestore.repository.js +12 -12
- 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 +1530 -1530
- 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 -22
- 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 +35 -35
- 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 +15 -14
- 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 +14 -14
- package/lib/domain/catalog/repositories/category.repository.d.ts +12 -12
- package/lib/domain/catalog/repositories/index.d.ts +4 -4
- package/lib/domain/catalog/repositories/product.repository.d.ts +5 -5
- package/lib/domain/catalog/repositories/subscription-product.repository.d.ts +4 -4
- 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 +10 -10
- 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/enums/filter-type.enum.d.ts +19 -19
- package/lib/domain/shop-settings/enums/index.d.ts +2 -2
- package/lib/domain/shop-settings/enums/questions-filters.enum.d.ts +19 -19
- package/lib/domain/shop-settings/helpers/beauty-questions.helper.d.ts +9 -9
- package/lib/domain/shop-settings/helpers/index.d.ts +1 -1
- package/lib/domain/shop-settings/index.d.ts +4 -4
- 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 +3 -3
- package/lib/domain/users/errors/unauthorized.error.d.ts +4 -4
- package/lib/domain/users/errors/user-already-registered.error.d.ts +4 -4
- package/lib/domain/users/errors/weak-password.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/accessory-importances.enum.d.ts +5 -5
- package/lib/domain/users/models/enums/area.enum.d.ts +11 -11
- package/lib/domain/users/models/enums/beard-problems.enum.d.ts +9 -9
- package/lib/domain/users/models/enums/beard-sizes.enum.d.ts +7 -7
- package/lib/domain/users/models/enums/beauty-product-importances.enum.d.ts +6 -6
- package/lib/domain/users/models/enums/body-problems.enum.d.ts +11 -11
- package/lib/domain/users/models/enums/body-shapes.enum.d.ts +7 -7
- package/lib/domain/users/models/enums/body-tattoos.enum.d.ts +5 -5
- package/lib/domain/users/models/enums/face-skin-oilinesses.enum.d.ts +7 -7
- package/lib/domain/users/models/enums/face-skin-problems.enum.d.ts +10 -10
- package/lib/domain/users/models/enums/face-skin-tones.enum.d.ts +8 -8
- package/lib/domain/users/models/enums/family-incomes.enum.d.ts +8 -8
- package/lib/domain/users/models/enums/fragrance-importances.enum.d.ts +5 -5
- package/lib/domain/users/models/enums/hair-colors.enum.d.ts +10 -10
- package/lib/domain/users/models/enums/hair-problems.enum.d.ts +10 -10
- package/lib/domain/users/models/enums/hair-strands.enum.d.ts +8 -8
- package/lib/domain/users/models/enums/hair-types.enum.d.ts +7 -7
- package/lib/domain/users/models/enums/index.d.ts +20 -20
- package/lib/domain/users/models/enums/office-position.enum.d.ts +6 -6
- package/lib/domain/users/models/enums/product-spents.enum.d.ts +8 -8
- 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 +4 -4
- 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 +4 -4
- 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 +6 -6
- package/lib/domain/users/services/authentication.service.d.ts +12 -12
- package/lib/domain/users/services/index.d.ts +3 -3
- package/lib/domain/users/services/register.service.d.ts +7 -7
- package/lib/domain/users/services/types/basic-user-data.type.d.ts +4 -4
- package/lib/domain/users/services/types/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 +4 -4
- package/lib/domain/users/use-cases/recovery-password.d.ts +6 -6
- package/lib/domain/users/use-cases/register.d.ts +13 -13
- 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 +12 -12
- package/lib/infra/firebase/auth/index.d.ts +2 -2
- package/lib/infra/firebase/auth/register-firebase-auth.service.d.ts +8 -8
- package/lib/infra/firebase/auth/types/firebase-user-with-id.type.d.ts +3 -3
- 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/models/user-search.d.ts +9 -9
- package/lib/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +55 -55
- package/lib/infra/firebase/firestore/repositories/catalog/index.d.ts +4 -4
- 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/catalog/subscription-product-firestore.repository.d.ts +49 -49
- 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 +53 -53
- 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 +9 -9
- 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 +60 -60
- package/lib/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.d.ts +60 -60
- package/lib/infra/firebase/firestore/repositories/users/user-search-firestore.repository.d.ts +50 -50
- 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,1644 +7,1644 @@ 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
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
var Where;
|
|
23
|
-
(function (Where) {
|
|
24
|
-
Where["EQUALS"] = "==";
|
|
25
|
-
Where["NOTEQUALS"] = "!=";
|
|
26
|
-
Where["GT"] = ">";
|
|
27
|
-
Where["GTE"] = ">=";
|
|
28
|
-
Where["IN"] = "in";
|
|
29
|
-
Where["LT"] = "<";
|
|
30
|
-
Where["LTE"] = "<=";
|
|
31
|
-
Where["LIKE"] = "like";
|
|
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
|
+
}
|
|
21
|
+
|
|
22
|
+
var Where;
|
|
23
|
+
(function (Where) {
|
|
24
|
+
Where["EQUALS"] = "==";
|
|
25
|
+
Where["NOTEQUALS"] = "!=";
|
|
26
|
+
Where["GT"] = ">";
|
|
27
|
+
Where["GTE"] = ">=";
|
|
28
|
+
Where["IN"] = "in";
|
|
29
|
+
Where["LT"] = "<";
|
|
30
|
+
Where["LTE"] = "<=";
|
|
31
|
+
Where["LIKE"] = "like";
|
|
32
32
|
})(Where || (Where = {}));
|
|
33
33
|
|
|
34
|
-
var UpdateOptionActions;
|
|
35
|
-
(function (UpdateOptionActions) {
|
|
36
|
-
UpdateOptionActions["UPDATE"] = "update";
|
|
37
|
-
UpdateOptionActions["MERGE"] = "merge";
|
|
38
|
-
UpdateOptionActions["REMOVE"] = "remove";
|
|
39
|
-
UpdateOptionActions["REMOVE_FIELD"] = "removeField";
|
|
40
|
-
UpdateOptionActions["NULL"] = "null";
|
|
34
|
+
var UpdateOptionActions;
|
|
35
|
+
(function (UpdateOptionActions) {
|
|
36
|
+
UpdateOptionActions["UPDATE"] = "update";
|
|
37
|
+
UpdateOptionActions["MERGE"] = "merge";
|
|
38
|
+
UpdateOptionActions["REMOVE"] = "remove";
|
|
39
|
+
UpdateOptionActions["REMOVE_FIELD"] = "removeField";
|
|
40
|
+
UpdateOptionActions["NULL"] = "null";
|
|
41
41
|
})(UpdateOptionActions || (UpdateOptionActions = {}));
|
|
42
42
|
|
|
43
|
-
var AccessoryImportances;
|
|
44
|
-
(function (AccessoryImportances) {
|
|
45
|
-
AccessoryImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
|
|
46
|
-
AccessoryImportances["LIKE_RARELY_USE"] = "Gosto, mas uso poucos";
|
|
47
|
-
AccessoryImportances["LIKE_ALWAYS_FOLLOW_FASHION"] = "Gosto muito de acess\u00F3rios e sempre procuro acompanhar a moda";
|
|
43
|
+
var AccessoryImportances;
|
|
44
|
+
(function (AccessoryImportances) {
|
|
45
|
+
AccessoryImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
|
|
46
|
+
AccessoryImportances["LIKE_RARELY_USE"] = "Gosto, mas uso poucos";
|
|
47
|
+
AccessoryImportances["LIKE_ALWAYS_FOLLOW_FASHION"] = "Gosto muito de acess\u00F3rios e sempre procuro acompanhar a moda";
|
|
48
48
|
})(AccessoryImportances || (AccessoryImportances = {}));
|
|
49
49
|
|
|
50
|
-
var Area;
|
|
51
|
-
(function (Area) {
|
|
52
|
-
Area["GP"] = "Geral";
|
|
53
|
-
Area["CRM"] = "CRM";
|
|
54
|
-
Area["MediaProd"] = "Media Production";
|
|
55
|
-
Area["Tech"] = "Tecnologia";
|
|
56
|
-
Area["Transactional"] = "Transacional";
|
|
57
|
-
Area["Operations"] = "Opera\u00E7\u00F5es";
|
|
58
|
-
Area["Sales"] = "Comercial";
|
|
59
|
-
Area["Finantial"] = "Financeiro";
|
|
60
|
-
Area["HR"] = "RH";
|
|
50
|
+
var Area;
|
|
51
|
+
(function (Area) {
|
|
52
|
+
Area["GP"] = "Geral";
|
|
53
|
+
Area["CRM"] = "CRM";
|
|
54
|
+
Area["MediaProd"] = "Media Production";
|
|
55
|
+
Area["Tech"] = "Tecnologia";
|
|
56
|
+
Area["Transactional"] = "Transacional";
|
|
57
|
+
Area["Operations"] = "Opera\u00E7\u00F5es";
|
|
58
|
+
Area["Sales"] = "Comercial";
|
|
59
|
+
Area["Finantial"] = "Financeiro";
|
|
60
|
+
Area["HR"] = "RH";
|
|
61
61
|
})(Area || (Area = {}));
|
|
62
62
|
|
|
63
|
-
var BeardProblems;
|
|
64
|
-
(function (BeardProblems) {
|
|
65
|
-
BeardProblems["NO_PROBLEMS"] = "Sem problemas";
|
|
66
|
-
BeardProblems["DRY"] = "Barba Seca";
|
|
67
|
-
BeardProblems["OILY"] = "Barba Oleaosa";
|
|
68
|
-
BeardProblems["DANCRUFF"] = "Barba com Caspa";
|
|
69
|
-
BeardProblems["INGROWN_HAIRS"] = "P\u00EAlos Encravados";
|
|
70
|
-
BeardProblems["DOESNT_GROW"] = "N\u00E3o Cresce";
|
|
71
|
-
BeardProblems["SPARSE_BEARD"] = "Barba Rala";
|
|
63
|
+
var BeardProblems;
|
|
64
|
+
(function (BeardProblems) {
|
|
65
|
+
BeardProblems["NO_PROBLEMS"] = "Sem problemas";
|
|
66
|
+
BeardProblems["DRY"] = "Barba Seca";
|
|
67
|
+
BeardProblems["OILY"] = "Barba Oleaosa";
|
|
68
|
+
BeardProblems["DANCRUFF"] = "Barba com Caspa";
|
|
69
|
+
BeardProblems["INGROWN_HAIRS"] = "P\u00EAlos Encravados";
|
|
70
|
+
BeardProblems["DOESNT_GROW"] = "N\u00E3o Cresce";
|
|
71
|
+
BeardProblems["SPARSE_BEARD"] = "Barba Rala";
|
|
72
72
|
})(BeardProblems || (BeardProblems = {}));
|
|
73
73
|
|
|
74
|
-
var BeardSizes;
|
|
75
|
-
(function (BeardSizes) {
|
|
76
|
-
BeardSizes["BIG"] = "Grande";
|
|
77
|
-
BeardSizes["MEDIUM"] = "M\u00E9dia";
|
|
78
|
-
BeardSizes["SHORT"] = "Curta";
|
|
79
|
-
BeardSizes["MUSTACHE"] = "Bigode";
|
|
80
|
-
BeardSizes["NOTHING"] = "Sem Barba";
|
|
74
|
+
var BeardSizes;
|
|
75
|
+
(function (BeardSizes) {
|
|
76
|
+
BeardSizes["BIG"] = "Grande";
|
|
77
|
+
BeardSizes["MEDIUM"] = "M\u00E9dia";
|
|
78
|
+
BeardSizes["SHORT"] = "Curta";
|
|
79
|
+
BeardSizes["MUSTACHE"] = "Bigode";
|
|
80
|
+
BeardSizes["NOTHING"] = "Sem Barba";
|
|
81
81
|
})(BeardSizes || (BeardSizes = {}));
|
|
82
82
|
|
|
83
|
-
var BeautyProductImportances;
|
|
84
|
-
(function (BeautyProductImportances) {
|
|
85
|
-
BeautyProductImportances["KNOW_LITTLE_ABOUT"] = "Conhe\u00E7o bem pouco de produtos de beleza e rotinas de cuidados";
|
|
86
|
-
BeautyProductImportances["ALREADY_BOUGHT_NOTHING_SPECIALIZED"] = "J\u00E1 comprei alguns produtos b\u00E1sicos para cuidar de mim, mas nada muito especializado";
|
|
87
|
-
BeautyProductImportances["GOOD_CARE_MYSELF"] = "Me considero um homem que se cuida bem. Conhe\u00E7o sobre produtos especializados e me preocupo em ter uma rotina de cuidados";
|
|
88
|
-
BeautyProductImportances["PERSONAL_CARE_EXPERT"] = "Sou um expert em cuidados pessoais";
|
|
83
|
+
var BeautyProductImportances;
|
|
84
|
+
(function (BeautyProductImportances) {
|
|
85
|
+
BeautyProductImportances["KNOW_LITTLE_ABOUT"] = "Conhe\u00E7o bem pouco de produtos de beleza e rotinas de cuidados";
|
|
86
|
+
BeautyProductImportances["ALREADY_BOUGHT_NOTHING_SPECIALIZED"] = "J\u00E1 comprei alguns produtos b\u00E1sicos para cuidar de mim, mas nada muito especializado";
|
|
87
|
+
BeautyProductImportances["GOOD_CARE_MYSELF"] = "Me considero um homem que se cuida bem. Conhe\u00E7o sobre produtos especializados e me preocupo em ter uma rotina de cuidados";
|
|
88
|
+
BeautyProductImportances["PERSONAL_CARE_EXPERT"] = "Sou um expert em cuidados pessoais";
|
|
89
89
|
})(BeautyProductImportances || (BeautyProductImportances = {}));
|
|
90
90
|
|
|
91
|
-
var BodyProblems;
|
|
92
|
-
(function (BodyProblems) {
|
|
93
|
-
BodyProblems["NO_WORRIES"] = "Sem preocupa\u00E7\u00F5es";
|
|
94
|
-
BodyProblems["FLACCIDITY"] = "Flacidez";
|
|
95
|
-
BodyProblems["LOCALIZED_FAT"] = "Gordura Localizada";
|
|
96
|
-
BodyProblems["STRETCH_MARKS"] = "Estrias";
|
|
97
|
-
BodyProblems["SENSITIVE_SKIN"] = "Pele Sens\u00EDvel";
|
|
98
|
-
BodyProblems["DRY_SKIN"] = "Pele Seca";
|
|
99
|
-
BodyProblems["OILY_ACNE"] = "Oleosa/Acne";
|
|
100
|
-
BodyProblems["SKIN_FRECKLES"] = "Pele com Sardas";
|
|
101
|
-
BodyProblems["PHOTOSENSITIVE_SKIN"] = "Pele Fotossens\u00EDvel";
|
|
91
|
+
var BodyProblems;
|
|
92
|
+
(function (BodyProblems) {
|
|
93
|
+
BodyProblems["NO_WORRIES"] = "Sem preocupa\u00E7\u00F5es";
|
|
94
|
+
BodyProblems["FLACCIDITY"] = "Flacidez";
|
|
95
|
+
BodyProblems["LOCALIZED_FAT"] = "Gordura Localizada";
|
|
96
|
+
BodyProblems["STRETCH_MARKS"] = "Estrias";
|
|
97
|
+
BodyProblems["SENSITIVE_SKIN"] = "Pele Sens\u00EDvel";
|
|
98
|
+
BodyProblems["DRY_SKIN"] = "Pele Seca";
|
|
99
|
+
BodyProblems["OILY_ACNE"] = "Oleosa/Acne";
|
|
100
|
+
BodyProblems["SKIN_FRECKLES"] = "Pele com Sardas";
|
|
101
|
+
BodyProblems["PHOTOSENSITIVE_SKIN"] = "Pele Fotossens\u00EDvel";
|
|
102
102
|
})(BodyProblems || (BodyProblems = {}));
|
|
103
103
|
|
|
104
|
-
var BodyShapes;
|
|
105
|
-
(function (BodyShapes) {
|
|
106
|
-
BodyShapes["LEAN"] = "Magro";
|
|
107
|
-
BodyShapes["REGULAR"] = "Regular";
|
|
108
|
-
BodyShapes["OVERWEIGHT"] = "Acima do Peso";
|
|
109
|
-
BodyShapes["ATHLETIC"] = "Atl\u00E9tico";
|
|
110
|
-
BodyShapes["MUSCULAR"] = "Musculoso";
|
|
104
|
+
var BodyShapes;
|
|
105
|
+
(function (BodyShapes) {
|
|
106
|
+
BodyShapes["LEAN"] = "Magro";
|
|
107
|
+
BodyShapes["REGULAR"] = "Regular";
|
|
108
|
+
BodyShapes["OVERWEIGHT"] = "Acima do Peso";
|
|
109
|
+
BodyShapes["ATHLETIC"] = "Atl\u00E9tico";
|
|
110
|
+
BodyShapes["MUSCULAR"] = "Musculoso";
|
|
111
111
|
})(BodyShapes || (BodyShapes = {}));
|
|
112
112
|
|
|
113
|
-
var BodyTattoos;
|
|
114
|
-
(function (BodyTattoos) {
|
|
115
|
-
BodyTattoos["NONE"] = "Nenhuma";
|
|
116
|
-
BodyTattoos["HAS_DOESNT_CARE"] = "Tenho mas n\u00E3o cuido";
|
|
117
|
-
BodyTattoos["HAS_CARE_LOT"] = "Tenho e cuido bastante";
|
|
113
|
+
var BodyTattoos;
|
|
114
|
+
(function (BodyTattoos) {
|
|
115
|
+
BodyTattoos["NONE"] = "Nenhuma";
|
|
116
|
+
BodyTattoos["HAS_DOESNT_CARE"] = "Tenho mas n\u00E3o cuido";
|
|
117
|
+
BodyTattoos["HAS_CARE_LOT"] = "Tenho e cuido bastante";
|
|
118
118
|
})(BodyTattoos || (BodyTattoos = {}));
|
|
119
119
|
|
|
120
|
-
var FaceSkinOilinesses;
|
|
121
|
-
(function (FaceSkinOilinesses) {
|
|
122
|
-
FaceSkinOilinesses["DRY"] = "Seca";
|
|
123
|
-
FaceSkinOilinesses["OILY"] = "Oleaosa";
|
|
124
|
-
FaceSkinOilinesses["MIXED"] = "Mista";
|
|
125
|
-
FaceSkinOilinesses["NORMAL"] = "Normal";
|
|
126
|
-
FaceSkinOilinesses["DONT_KNOW"] = "Eu n\u00E3o sei como dizer";
|
|
120
|
+
var FaceSkinOilinesses;
|
|
121
|
+
(function (FaceSkinOilinesses) {
|
|
122
|
+
FaceSkinOilinesses["DRY"] = "Seca";
|
|
123
|
+
FaceSkinOilinesses["OILY"] = "Oleaosa";
|
|
124
|
+
FaceSkinOilinesses["MIXED"] = "Mista";
|
|
125
|
+
FaceSkinOilinesses["NORMAL"] = "Normal";
|
|
126
|
+
FaceSkinOilinesses["DONT_KNOW"] = "Eu n\u00E3o sei como dizer";
|
|
127
127
|
})(FaceSkinOilinesses || (FaceSkinOilinesses = {}));
|
|
128
128
|
|
|
129
|
-
var FaceSkinProblems;
|
|
130
|
-
(function (FaceSkinProblems) {
|
|
131
|
-
FaceSkinProblems["NO_PROBLEMS"] = "Sem problemas";
|
|
132
|
-
FaceSkinProblems["DARK_CIRCLES"] = "Olheiras";
|
|
133
|
-
FaceSkinProblems["WRINKLES"] = "Rugas";
|
|
134
|
-
FaceSkinProblems["BLACKHEADS_PIMPLES"] = "Cravos e Espinhas";
|
|
135
|
-
FaceSkinProblems["STAINS"] = "Manchas";
|
|
136
|
-
FaceSkinProblems["FRECKLES"] = "Sardas";
|
|
137
|
-
FaceSkinProblems["SENSITIVE"] = "Sens\u00EDvel";
|
|
138
|
-
FaceSkinProblems["PHOTOSENSITIVE"] = "Fotossens\u00EDvel";
|
|
129
|
+
var FaceSkinProblems;
|
|
130
|
+
(function (FaceSkinProblems) {
|
|
131
|
+
FaceSkinProblems["NO_PROBLEMS"] = "Sem problemas";
|
|
132
|
+
FaceSkinProblems["DARK_CIRCLES"] = "Olheiras";
|
|
133
|
+
FaceSkinProblems["WRINKLES"] = "Rugas";
|
|
134
|
+
FaceSkinProblems["BLACKHEADS_PIMPLES"] = "Cravos e Espinhas";
|
|
135
|
+
FaceSkinProblems["STAINS"] = "Manchas";
|
|
136
|
+
FaceSkinProblems["FRECKLES"] = "Sardas";
|
|
137
|
+
FaceSkinProblems["SENSITIVE"] = "Sens\u00EDvel";
|
|
138
|
+
FaceSkinProblems["PHOTOSENSITIVE"] = "Fotossens\u00EDvel";
|
|
139
139
|
})(FaceSkinProblems || (FaceSkinProblems = {}));
|
|
140
140
|
|
|
141
|
-
var FaceSkinTones;
|
|
142
|
-
(function (FaceSkinTones) {
|
|
143
|
-
FaceSkinTones["VERY_CLEAR"] = "Muito Clara";
|
|
144
|
-
FaceSkinTones["CLEAR"] = "Clara";
|
|
145
|
-
FaceSkinTones["MEDIUM_LIGHT"] = "Clara M\u00E9dia";
|
|
146
|
-
FaceSkinTones["MEDIUM_DARK"] = "Escura M\u00E9dia";
|
|
147
|
-
FaceSkinTones["DARK"] = "Escura";
|
|
148
|
-
FaceSkinTones["VERY_DARK"] = "Muito Escura";
|
|
141
|
+
var FaceSkinTones;
|
|
142
|
+
(function (FaceSkinTones) {
|
|
143
|
+
FaceSkinTones["VERY_CLEAR"] = "Muito Clara";
|
|
144
|
+
FaceSkinTones["CLEAR"] = "Clara";
|
|
145
|
+
FaceSkinTones["MEDIUM_LIGHT"] = "Clara M\u00E9dia";
|
|
146
|
+
FaceSkinTones["MEDIUM_DARK"] = "Escura M\u00E9dia";
|
|
147
|
+
FaceSkinTones["DARK"] = "Escura";
|
|
148
|
+
FaceSkinTones["VERY_DARK"] = "Muito Escura";
|
|
149
149
|
})(FaceSkinTones || (FaceSkinTones = {}));
|
|
150
150
|
|
|
151
|
-
var FamilyIncomes;
|
|
152
|
-
(function (FamilyIncomes) {
|
|
153
|
-
FamilyIncomes["UNTIL_3000"] = "At\u00E9 R$3.000";
|
|
154
|
-
FamilyIncomes["SINCE_3001_TO_7000"] = "De R$3.001 a R$7.000";
|
|
155
|
-
FamilyIncomes["SINCE_7001_TO_10000"] = "De R$7.001 a R$10.000";
|
|
156
|
-
FamilyIncomes["SINCE_10001_TO_15000"] = "De R$10.001 a R$15.000";
|
|
157
|
-
FamilyIncomes["GRAN_THAN_15000"] = "Mais de R$15.000";
|
|
158
|
-
FamilyIncomes["NOW_ANSWER"] = "Prefiro nao responder";
|
|
151
|
+
var FamilyIncomes;
|
|
152
|
+
(function (FamilyIncomes) {
|
|
153
|
+
FamilyIncomes["UNTIL_3000"] = "At\u00E9 R$3.000";
|
|
154
|
+
FamilyIncomes["SINCE_3001_TO_7000"] = "De R$3.001 a R$7.000";
|
|
155
|
+
FamilyIncomes["SINCE_7001_TO_10000"] = "De R$7.001 a R$10.000";
|
|
156
|
+
FamilyIncomes["SINCE_10001_TO_15000"] = "De R$10.001 a R$15.000";
|
|
157
|
+
FamilyIncomes["GRAN_THAN_15000"] = "Mais de R$15.000";
|
|
158
|
+
FamilyIncomes["NOW_ANSWER"] = "Prefiro nao responder";
|
|
159
159
|
})(FamilyIncomes || (FamilyIncomes = {}));
|
|
160
160
|
|
|
161
|
-
var FragranceImportances;
|
|
162
|
-
(function (FragranceImportances) {
|
|
163
|
-
FragranceImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
|
|
164
|
-
FragranceImportances["LIKE_ALWAYS_USE_SAME"] = "Gosto de perfumes, mas uso sempre os mesmos";
|
|
165
|
-
FragranceImportances["LIKE_INNOVATE"] = "Gosto de inovar e conhecer novas fragr\u00E2ncias";
|
|
161
|
+
var FragranceImportances;
|
|
162
|
+
(function (FragranceImportances) {
|
|
163
|
+
FragranceImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
|
|
164
|
+
FragranceImportances["LIKE_ALWAYS_USE_SAME"] = "Gosto de perfumes, mas uso sempre os mesmos";
|
|
165
|
+
FragranceImportances["LIKE_INNOVATE"] = "Gosto de inovar e conhecer novas fragr\u00E2ncias";
|
|
166
166
|
})(FragranceImportances || (FragranceImportances = {}));
|
|
167
167
|
|
|
168
|
-
var HairColors;
|
|
169
|
-
(function (HairColors) {
|
|
170
|
-
HairColors["BLACK"] = "Preto";
|
|
171
|
-
HairColors["DARK_BROWN"] = "Castanho Escuro";
|
|
172
|
-
HairColors["LIGHT_BROWN"] = "Castanho Claro";
|
|
173
|
-
HairColors["DARK_BLONDE"] = "Loiro Escuro";
|
|
174
|
-
HairColors["LIGHT_BLONDE"] = "Loiro Claro";
|
|
175
|
-
HairColors["WHITE_GRAY"] = "Branco/Grisalho";
|
|
176
|
-
HairColors["REDHEAD"] = "Ruivo";
|
|
177
|
-
HairColors["OTHER"] = "RuiOutroo";
|
|
168
|
+
var HairColors;
|
|
169
|
+
(function (HairColors) {
|
|
170
|
+
HairColors["BLACK"] = "Preto";
|
|
171
|
+
HairColors["DARK_BROWN"] = "Castanho Escuro";
|
|
172
|
+
HairColors["LIGHT_BROWN"] = "Castanho Claro";
|
|
173
|
+
HairColors["DARK_BLONDE"] = "Loiro Escuro";
|
|
174
|
+
HairColors["LIGHT_BLONDE"] = "Loiro Claro";
|
|
175
|
+
HairColors["WHITE_GRAY"] = "Branco/Grisalho";
|
|
176
|
+
HairColors["REDHEAD"] = "Ruivo";
|
|
177
|
+
HairColors["OTHER"] = "RuiOutroo";
|
|
178
178
|
})(HairColors || (HairColors = {}));
|
|
179
179
|
|
|
180
|
-
var HairProblems;
|
|
181
|
-
(function (HairProblems) {
|
|
182
|
-
HairProblems["NO_PROBLEMS"] = "Sem problemas";
|
|
183
|
-
HairProblems["DANCRUFF"] = "Caspa";
|
|
184
|
-
HairProblems["LOSS"] = "Queda";
|
|
185
|
-
HairProblems["OILY"] = "Oleosidade";
|
|
186
|
-
HairProblems["DRYNESS"] = "Ressecamento";
|
|
187
|
-
HairProblems["CHEMICAL"] = "Quimica";
|
|
188
|
-
HairProblems["WHITE_HAIR"] = "Cabelos Brancos";
|
|
189
|
-
HairProblems["REBEL_WIRES"] = "Fios Rebeldes";
|
|
180
|
+
var HairProblems;
|
|
181
|
+
(function (HairProblems) {
|
|
182
|
+
HairProblems["NO_PROBLEMS"] = "Sem problemas";
|
|
183
|
+
HairProblems["DANCRUFF"] = "Caspa";
|
|
184
|
+
HairProblems["LOSS"] = "Queda";
|
|
185
|
+
HairProblems["OILY"] = "Oleosidade";
|
|
186
|
+
HairProblems["DRYNESS"] = "Ressecamento";
|
|
187
|
+
HairProblems["CHEMICAL"] = "Quimica";
|
|
188
|
+
HairProblems["WHITE_HAIR"] = "Cabelos Brancos";
|
|
189
|
+
HairProblems["REBEL_WIRES"] = "Fios Rebeldes";
|
|
190
190
|
})(HairProblems || (HairProblems = {}));
|
|
191
191
|
|
|
192
|
-
var HairStrands;
|
|
193
|
-
(function (HairStrands) {
|
|
194
|
-
HairStrands["NORMAL"] = "Fio Normal";
|
|
195
|
-
HairStrands["DRY"] = "Fio Seco";
|
|
196
|
-
HairStrands["OILY"] = "Fio Oleoso";
|
|
197
|
-
HairStrands["MIXED"] = "Fio Misto";
|
|
198
|
-
HairStrands["FINE"] = "Fio Fino";
|
|
199
|
-
HairStrands["THICK"] = "Fio Grosso";
|
|
192
|
+
var HairStrands;
|
|
193
|
+
(function (HairStrands) {
|
|
194
|
+
HairStrands["NORMAL"] = "Fio Normal";
|
|
195
|
+
HairStrands["DRY"] = "Fio Seco";
|
|
196
|
+
HairStrands["OILY"] = "Fio Oleoso";
|
|
197
|
+
HairStrands["MIXED"] = "Fio Misto";
|
|
198
|
+
HairStrands["FINE"] = "Fio Fino";
|
|
199
|
+
HairStrands["THICK"] = "Fio Grosso";
|
|
200
200
|
})(HairStrands || (HairStrands = {}));
|
|
201
201
|
|
|
202
|
-
var HairTypes;
|
|
203
|
-
(function (HairTypes) {
|
|
204
|
-
HairTypes["Smooth"] = "Liso";
|
|
205
|
-
HairTypes["WAVY"] = "Ondulado";
|
|
206
|
-
HairTypes["CURLY"] = "Cacheado";
|
|
207
|
-
HairTypes["FRIZZY"] = "Crespo";
|
|
208
|
-
HairTypes["BALD"] = "Sou careca";
|
|
202
|
+
var HairTypes;
|
|
203
|
+
(function (HairTypes) {
|
|
204
|
+
HairTypes["Smooth"] = "Liso";
|
|
205
|
+
HairTypes["WAVY"] = "Ondulado";
|
|
206
|
+
HairTypes["CURLY"] = "Cacheado";
|
|
207
|
+
HairTypes["FRIZZY"] = "Crespo";
|
|
208
|
+
HairTypes["BALD"] = "Sou careca";
|
|
209
209
|
})(HairTypes || (HairTypes = {}));
|
|
210
210
|
|
|
211
|
-
var OfficePosition;
|
|
212
|
-
(function (OfficePosition) {
|
|
213
|
-
OfficePosition["Intern"] = "Estagi\u00E1rio";
|
|
214
|
-
OfficePosition["Analyst"] = "Analista";
|
|
215
|
-
OfficePosition["Manager"] = "Gerente";
|
|
216
|
-
OfficePosition["Director"] = "Diretor";
|
|
211
|
+
var OfficePosition;
|
|
212
|
+
(function (OfficePosition) {
|
|
213
|
+
OfficePosition["Intern"] = "Estagi\u00E1rio";
|
|
214
|
+
OfficePosition["Analyst"] = "Analista";
|
|
215
|
+
OfficePosition["Manager"] = "Gerente";
|
|
216
|
+
OfficePosition["Director"] = "Diretor";
|
|
217
217
|
})(OfficePosition || (OfficePosition = {}));
|
|
218
218
|
|
|
219
|
-
var ProductSpents;
|
|
220
|
-
(function (ProductSpents) {
|
|
221
|
-
ProductSpents["UNTIL_50"] = "At\u00E9 R$50";
|
|
222
|
-
ProductSpents["SINCE_51_TO_100"] = "De R$51 a R$100";
|
|
223
|
-
ProductSpents["SINCE_101_TO_200"] = "De R$101 a R$200";
|
|
224
|
-
ProductSpents["SINCE_201_TO_300"] = "De R$201 a R$300";
|
|
225
|
-
ProductSpents["GRAN_THAN_300"] = "Mais de R$300";
|
|
226
|
-
ProductSpents["NOW_ANSWER"] = "Prefiro nao responder";
|
|
219
|
+
var ProductSpents;
|
|
220
|
+
(function (ProductSpents) {
|
|
221
|
+
ProductSpents["UNTIL_50"] = "At\u00E9 R$50";
|
|
222
|
+
ProductSpents["SINCE_51_TO_100"] = "De R$51 a R$100";
|
|
223
|
+
ProductSpents["SINCE_101_TO_200"] = "De R$101 a R$200";
|
|
224
|
+
ProductSpents["SINCE_201_TO_300"] = "De R$201 a R$300";
|
|
225
|
+
ProductSpents["GRAN_THAN_300"] = "Mais de R$300";
|
|
226
|
+
ProductSpents["NOW_ANSWER"] = "Prefiro nao responder";
|
|
227
227
|
})(ProductSpents || (ProductSpents = {}));
|
|
228
228
|
|
|
229
|
-
var UserType;
|
|
230
|
-
(function (UserType) {
|
|
231
|
-
UserType["B2C"] = "Cliente Transacional";
|
|
232
|
-
UserType["GlamGirl"] = "Glamgirl";
|
|
233
|
-
UserType["MensBoy"] = "Mensboy";
|
|
234
|
-
UserType["B2B"] = "Company";
|
|
235
|
-
UserType["Collaborator"] = "Funcion\u00E1rio";
|
|
236
|
-
UserType["Influencer"] = "Influencer";
|
|
229
|
+
var UserType;
|
|
230
|
+
(function (UserType) {
|
|
231
|
+
UserType["B2C"] = "Cliente Transacional";
|
|
232
|
+
UserType["GlamGirl"] = "Glamgirl";
|
|
233
|
+
UserType["MensBoy"] = "Mensboy";
|
|
234
|
+
UserType["B2B"] = "Company";
|
|
235
|
+
UserType["Collaborator"] = "Funcion\u00E1rio";
|
|
236
|
+
UserType["Influencer"] = "Influencer";
|
|
237
237
|
})(UserType || (UserType = {}));
|
|
238
238
|
|
|
239
|
-
var BillingStatus;
|
|
240
|
-
(function (BillingStatus) {
|
|
241
|
-
BillingStatus["PAYED"] = "PAGO";
|
|
239
|
+
var BillingStatus;
|
|
240
|
+
(function (BillingStatus) {
|
|
241
|
+
BillingStatus["PAYED"] = "PAGO";
|
|
242
242
|
})(BillingStatus || (BillingStatus = {}));
|
|
243
243
|
|
|
244
|
-
var EditionStatus;
|
|
245
|
-
(function (EditionStatus) {
|
|
246
|
-
EditionStatus["ALLOCATION_WAITING"] = "Aguardando aloca\u00E7\u00E3o";
|
|
247
|
-
EditionStatus["SHIPPED"] = "Enviado";
|
|
244
|
+
var EditionStatus;
|
|
245
|
+
(function (EditionStatus) {
|
|
246
|
+
EditionStatus["ALLOCATION_WAITING"] = "Aguardando aloca\u00E7\u00E3o";
|
|
247
|
+
EditionStatus["SHIPPED"] = "Enviado";
|
|
248
248
|
})(EditionStatus || (EditionStatus = {}));
|
|
249
249
|
|
|
250
|
-
var PaymentType;
|
|
251
|
-
(function (PaymentType) {
|
|
252
|
-
PaymentType["AQUISITION"] = "Aquisi\u00E7\u00E3o";
|
|
253
|
-
PaymentType["RENEWAL"] = "Renova\u00E7\u00E3o";
|
|
254
|
-
PaymentType["FREIGHT"] = "mudan\u00E7a de endere\u00E7o, Frete";
|
|
250
|
+
var PaymentType;
|
|
251
|
+
(function (PaymentType) {
|
|
252
|
+
PaymentType["AQUISITION"] = "Aquisi\u00E7\u00E3o";
|
|
253
|
+
PaymentType["RENEWAL"] = "Renova\u00E7\u00E3o";
|
|
254
|
+
PaymentType["FREIGHT"] = "mudan\u00E7a de endere\u00E7o, Frete";
|
|
255
255
|
})(PaymentType || (PaymentType = {}));
|
|
256
256
|
|
|
257
|
-
var Status;
|
|
258
|
-
(function (Status) {
|
|
259
|
-
Status["ACTIVE"] = "active";
|
|
260
|
-
Status["CANCELLED"] = "Cancelado";
|
|
257
|
+
var Status;
|
|
258
|
+
(function (Status) {
|
|
259
|
+
Status["ACTIVE"] = "active";
|
|
260
|
+
Status["CANCELLED"] = "Cancelado";
|
|
261
261
|
})(Status || (Status = {}));
|
|
262
262
|
|
|
263
|
-
class Edition extends BaseModel {
|
|
264
|
-
identifierFields() {
|
|
265
|
-
return ['id'];
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
class Payment extends BaseModel {
|
|
270
|
-
identifierFields() {
|
|
271
|
-
return ['id'];
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
__decorate([
|
|
275
|
-
Expose({ name: 'refuse_reason' }),
|
|
276
|
-
__metadata("design:type", String)
|
|
277
|
-
], Payment.prototype, "refuseReason", void 0);
|
|
278
|
-
__decorate([
|
|
279
|
-
Expose({ name: 'status_reason' }),
|
|
280
|
-
__metadata("design:type", String)
|
|
281
|
-
], Payment.prototype, "statusReason", void 0);
|
|
282
|
-
__decorate([
|
|
283
|
-
Expose({ name: 'acquirer_response_code' }),
|
|
284
|
-
__metadata("design:type", String)
|
|
285
|
-
], Payment.prototype, "acquirerResponseCode", void 0);
|
|
286
|
-
__decorate([
|
|
287
|
-
Expose({ name: 'acquirer_name' }),
|
|
288
|
-
__metadata("design:type", String)
|
|
289
|
-
], Payment.prototype, "acquirerName", void 0);
|
|
290
|
-
__decorate([
|
|
291
|
-
Expose({ name: 'acquirer_id' }),
|
|
292
|
-
__metadata("design:type", String)
|
|
293
|
-
], Payment.prototype, "acquirerId", void 0);
|
|
294
|
-
__decorate([
|
|
295
|
-
Expose({ name: 'authorization_code' }),
|
|
296
|
-
__metadata("design:type", String)
|
|
297
|
-
], Payment.prototype, "authorizationCode", void 0);
|
|
298
|
-
__decorate([
|
|
299
|
-
Expose({ name: 'soft_descriptor' }),
|
|
300
|
-
__metadata("design:type", String)
|
|
301
|
-
], Payment.prototype, "softDescriptor", void 0);
|
|
302
|
-
__decorate([
|
|
303
|
-
Expose({ name: 'date_created' }),
|
|
304
|
-
__metadata("design:type", String)
|
|
305
|
-
], Payment.prototype, "dateCreated", void 0);
|
|
306
|
-
__decorate([
|
|
307
|
-
Expose({ name: 'date_updated' }),
|
|
308
|
-
__metadata("design:type", String)
|
|
309
|
-
], Payment.prototype, "dateUpdated", void 0);
|
|
310
|
-
__decorate([
|
|
311
|
-
Expose({ name: 'authorized_amount' }),
|
|
312
|
-
__metadata("design:type", Number)
|
|
313
|
-
], Payment.prototype, "authorizedAmount", void 0);
|
|
314
|
-
__decorate([
|
|
315
|
-
Expose({ name: 'paid_amount' }),
|
|
316
|
-
__metadata("design:type", Number)
|
|
317
|
-
], Payment.prototype, "paidAmount", void 0);
|
|
318
|
-
__decorate([
|
|
319
|
-
Expose({ name: 'refunded_amount' }),
|
|
320
|
-
__metadata("design:type", Number)
|
|
321
|
-
], Payment.prototype, "refundedAmount", void 0);
|
|
322
|
-
__decorate([
|
|
323
|
-
Expose({ name: 'card_holder_name' }),
|
|
324
|
-
__metadata("design:type", String)
|
|
325
|
-
], Payment.prototype, "cardHolderName", void 0);
|
|
326
|
-
__decorate([
|
|
327
|
-
Expose({ name: 'card_last_digits' }),
|
|
328
|
-
__metadata("design:type", String)
|
|
329
|
-
], Payment.prototype, "cardLastDigits", void 0);
|
|
330
|
-
__decorate([
|
|
331
|
-
Expose({ name: 'card_first_digits' }),
|
|
332
|
-
__metadata("design:type", String)
|
|
333
|
-
], Payment.prototype, "cardFirstDigits", void 0);
|
|
334
|
-
__decorate([
|
|
335
|
-
Expose({ name: 'card_brand' }),
|
|
336
|
-
__metadata("design:type", String)
|
|
337
|
-
], Payment.prototype, "cardBrand", void 0);
|
|
338
|
-
__decorate([
|
|
339
|
-
Expose({ name: 'card_pin_mode' }),
|
|
340
|
-
__metadata("design:type", String)
|
|
341
|
-
], Payment.prototype, "cardPinMode", void 0);
|
|
342
|
-
__decorate([
|
|
343
|
-
Expose({ name: 'card_magstripe_fallback' }),
|
|
344
|
-
__metadata("design:type", Boolean)
|
|
345
|
-
], Payment.prototype, "cardMagstripeFallback", void 0);
|
|
346
|
-
__decorate([
|
|
347
|
-
Expose({ name: 'cvm_pin' }),
|
|
348
|
-
__metadata("design:type", Boolean)
|
|
349
|
-
], Payment.prototype, "cvmPin", void 0);
|
|
350
|
-
__decorate([
|
|
351
|
-
Expose({ name: 'postback_url' }),
|
|
352
|
-
__metadata("design:type", String)
|
|
353
|
-
], Payment.prototype, "postbackUrl", void 0);
|
|
354
|
-
__decorate([
|
|
355
|
-
Expose({ name: 'payment_method' }),
|
|
356
|
-
__metadata("design:type", String)
|
|
357
|
-
], Payment.prototype, "paymentMethod", void 0);
|
|
358
|
-
__decorate([
|
|
359
|
-
Expose({ name: 'capture_method' }),
|
|
360
|
-
__metadata("design:type", String)
|
|
361
|
-
], Payment.prototype, "captureMethod", void 0);
|
|
362
|
-
__decorate([
|
|
363
|
-
Expose({ name: 'antifraud_score' }),
|
|
364
|
-
__metadata("design:type", String)
|
|
365
|
-
], Payment.prototype, "antifraudScore", void 0);
|
|
366
|
-
__decorate([
|
|
367
|
-
Expose({ name: 'boleto_url' }),
|
|
368
|
-
__metadata("design:type", String)
|
|
369
|
-
], Payment.prototype, "boletoUrl", void 0);
|
|
370
|
-
__decorate([
|
|
371
|
-
Expose({ name: 'boleto_barcode' }),
|
|
372
|
-
__metadata("design:type", String)
|
|
373
|
-
], Payment.prototype, "boletoBarcode", void 0);
|
|
374
|
-
__decorate([
|
|
375
|
-
Expose({ name: 'boleto_expiration_date' }),
|
|
376
|
-
__metadata("design:type", String)
|
|
377
|
-
], Payment.prototype, "boletoExpirationDate", void 0);
|
|
378
|
-
__decorate([
|
|
379
|
-
Expose({ name: 'subscription_id' }),
|
|
380
|
-
__metadata("design:type", String)
|
|
381
|
-
], Payment.prototype, "subscriptionId", void 0);
|
|
382
|
-
__decorate([
|
|
383
|
-
Expose({ name: 'split_rules' }),
|
|
384
|
-
__metadata("design:type", String)
|
|
385
|
-
], Payment.prototype, "splitRules", void 0);
|
|
386
|
-
__decorate([
|
|
387
|
-
Expose({ name: 'antifraud_metadata' }),
|
|
388
|
-
__metadata("design:type", Object)
|
|
389
|
-
], Payment.prototype, "antifraudMetadata", void 0);
|
|
390
|
-
__decorate([
|
|
391
|
-
Expose({ name: 'reference_key' }),
|
|
392
|
-
__metadata("design:type", String)
|
|
393
|
-
], Payment.prototype, "referenceKey", void 0);
|
|
394
|
-
__decorate([
|
|
395
|
-
Expose({ name: 'local_transaction_id' }),
|
|
396
|
-
__metadata("design:type", String)
|
|
397
|
-
], Payment.prototype, "localTransactionId", void 0);
|
|
398
|
-
__decorate([
|
|
399
|
-
Expose({ name: 'local_time' }),
|
|
400
|
-
__metadata("design:type", String)
|
|
401
|
-
], Payment.prototype, "localTime", void 0);
|
|
402
|
-
__decorate([
|
|
403
|
-
Expose({ name: 'fraud_covered' }),
|
|
404
|
-
__metadata("design:type", Boolean)
|
|
405
|
-
], Payment.prototype, "fraudCovered", void 0);
|
|
406
|
-
__decorate([
|
|
407
|
-
Expose({ name: 'fraud_reimbursed' }),
|
|
408
|
-
__metadata("design:type", String)
|
|
409
|
-
], Payment.prototype, "fraudReimbursed", void 0);
|
|
410
|
-
__decorate([
|
|
411
|
-
Expose({ name: 'order_id' }),
|
|
412
|
-
__metadata("design:type", String)
|
|
413
|
-
], Payment.prototype, "orderId", void 0);
|
|
414
|
-
__decorate([
|
|
415
|
-
Expose({ name: 'risk_level' }),
|
|
416
|
-
__metadata("design:type", String)
|
|
417
|
-
], Payment.prototype, "riskLevel", void 0);
|
|
418
|
-
__decorate([
|
|
419
|
-
Expose({ name: 'receipt_url' }),
|
|
420
|
-
__metadata("design:type", String)
|
|
421
|
-
], Payment.prototype, "receiptUrl", void 0);
|
|
422
|
-
__decorate([
|
|
423
|
-
Expose({ name: 'private_label' }),
|
|
424
|
-
__metadata("design:type", String)
|
|
425
|
-
], Payment.prototype, "privateLabel", void 0);
|
|
426
|
-
__decorate([
|
|
427
|
-
Expose({ name: 'pix_qr_code' }),
|
|
428
|
-
__metadata("design:type", String)
|
|
429
|
-
], Payment.prototype, "pixQrCode", void 0);
|
|
430
|
-
__decorate([
|
|
431
|
-
Expose({ name: 'pix_expiration_date' }),
|
|
432
|
-
__metadata("design:type", String)
|
|
263
|
+
class Edition extends BaseModel {
|
|
264
|
+
identifierFields() {
|
|
265
|
+
return ['id'];
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
class Payment extends BaseModel {
|
|
270
|
+
identifierFields() {
|
|
271
|
+
return ['id'];
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
__decorate([
|
|
275
|
+
Expose({ name: 'refuse_reason' }),
|
|
276
|
+
__metadata("design:type", String)
|
|
277
|
+
], Payment.prototype, "refuseReason", void 0);
|
|
278
|
+
__decorate([
|
|
279
|
+
Expose({ name: 'status_reason' }),
|
|
280
|
+
__metadata("design:type", String)
|
|
281
|
+
], Payment.prototype, "statusReason", void 0);
|
|
282
|
+
__decorate([
|
|
283
|
+
Expose({ name: 'acquirer_response_code' }),
|
|
284
|
+
__metadata("design:type", String)
|
|
285
|
+
], Payment.prototype, "acquirerResponseCode", void 0);
|
|
286
|
+
__decorate([
|
|
287
|
+
Expose({ name: 'acquirer_name' }),
|
|
288
|
+
__metadata("design:type", String)
|
|
289
|
+
], Payment.prototype, "acquirerName", void 0);
|
|
290
|
+
__decorate([
|
|
291
|
+
Expose({ name: 'acquirer_id' }),
|
|
292
|
+
__metadata("design:type", String)
|
|
293
|
+
], Payment.prototype, "acquirerId", void 0);
|
|
294
|
+
__decorate([
|
|
295
|
+
Expose({ name: 'authorization_code' }),
|
|
296
|
+
__metadata("design:type", String)
|
|
297
|
+
], Payment.prototype, "authorizationCode", void 0);
|
|
298
|
+
__decorate([
|
|
299
|
+
Expose({ name: 'soft_descriptor' }),
|
|
300
|
+
__metadata("design:type", String)
|
|
301
|
+
], Payment.prototype, "softDescriptor", void 0);
|
|
302
|
+
__decorate([
|
|
303
|
+
Expose({ name: 'date_created' }),
|
|
304
|
+
__metadata("design:type", String)
|
|
305
|
+
], Payment.prototype, "dateCreated", void 0);
|
|
306
|
+
__decorate([
|
|
307
|
+
Expose({ name: 'date_updated' }),
|
|
308
|
+
__metadata("design:type", String)
|
|
309
|
+
], Payment.prototype, "dateUpdated", void 0);
|
|
310
|
+
__decorate([
|
|
311
|
+
Expose({ name: 'authorized_amount' }),
|
|
312
|
+
__metadata("design:type", Number)
|
|
313
|
+
], Payment.prototype, "authorizedAmount", void 0);
|
|
314
|
+
__decorate([
|
|
315
|
+
Expose({ name: 'paid_amount' }),
|
|
316
|
+
__metadata("design:type", Number)
|
|
317
|
+
], Payment.prototype, "paidAmount", void 0);
|
|
318
|
+
__decorate([
|
|
319
|
+
Expose({ name: 'refunded_amount' }),
|
|
320
|
+
__metadata("design:type", Number)
|
|
321
|
+
], Payment.prototype, "refundedAmount", void 0);
|
|
322
|
+
__decorate([
|
|
323
|
+
Expose({ name: 'card_holder_name' }),
|
|
324
|
+
__metadata("design:type", String)
|
|
325
|
+
], Payment.prototype, "cardHolderName", void 0);
|
|
326
|
+
__decorate([
|
|
327
|
+
Expose({ name: 'card_last_digits' }),
|
|
328
|
+
__metadata("design:type", String)
|
|
329
|
+
], Payment.prototype, "cardLastDigits", void 0);
|
|
330
|
+
__decorate([
|
|
331
|
+
Expose({ name: 'card_first_digits' }),
|
|
332
|
+
__metadata("design:type", String)
|
|
333
|
+
], Payment.prototype, "cardFirstDigits", void 0);
|
|
334
|
+
__decorate([
|
|
335
|
+
Expose({ name: 'card_brand' }),
|
|
336
|
+
__metadata("design:type", String)
|
|
337
|
+
], Payment.prototype, "cardBrand", void 0);
|
|
338
|
+
__decorate([
|
|
339
|
+
Expose({ name: 'card_pin_mode' }),
|
|
340
|
+
__metadata("design:type", String)
|
|
341
|
+
], Payment.prototype, "cardPinMode", void 0);
|
|
342
|
+
__decorate([
|
|
343
|
+
Expose({ name: 'card_magstripe_fallback' }),
|
|
344
|
+
__metadata("design:type", Boolean)
|
|
345
|
+
], Payment.prototype, "cardMagstripeFallback", void 0);
|
|
346
|
+
__decorate([
|
|
347
|
+
Expose({ name: 'cvm_pin' }),
|
|
348
|
+
__metadata("design:type", Boolean)
|
|
349
|
+
], Payment.prototype, "cvmPin", void 0);
|
|
350
|
+
__decorate([
|
|
351
|
+
Expose({ name: 'postback_url' }),
|
|
352
|
+
__metadata("design:type", String)
|
|
353
|
+
], Payment.prototype, "postbackUrl", void 0);
|
|
354
|
+
__decorate([
|
|
355
|
+
Expose({ name: 'payment_method' }),
|
|
356
|
+
__metadata("design:type", String)
|
|
357
|
+
], Payment.prototype, "paymentMethod", void 0);
|
|
358
|
+
__decorate([
|
|
359
|
+
Expose({ name: 'capture_method' }),
|
|
360
|
+
__metadata("design:type", String)
|
|
361
|
+
], Payment.prototype, "captureMethod", void 0);
|
|
362
|
+
__decorate([
|
|
363
|
+
Expose({ name: 'antifraud_score' }),
|
|
364
|
+
__metadata("design:type", String)
|
|
365
|
+
], Payment.prototype, "antifraudScore", void 0);
|
|
366
|
+
__decorate([
|
|
367
|
+
Expose({ name: 'boleto_url' }),
|
|
368
|
+
__metadata("design:type", String)
|
|
369
|
+
], Payment.prototype, "boletoUrl", void 0);
|
|
370
|
+
__decorate([
|
|
371
|
+
Expose({ name: 'boleto_barcode' }),
|
|
372
|
+
__metadata("design:type", String)
|
|
373
|
+
], Payment.prototype, "boletoBarcode", void 0);
|
|
374
|
+
__decorate([
|
|
375
|
+
Expose({ name: 'boleto_expiration_date' }),
|
|
376
|
+
__metadata("design:type", String)
|
|
377
|
+
], Payment.prototype, "boletoExpirationDate", void 0);
|
|
378
|
+
__decorate([
|
|
379
|
+
Expose({ name: 'subscription_id' }),
|
|
380
|
+
__metadata("design:type", String)
|
|
381
|
+
], Payment.prototype, "subscriptionId", void 0);
|
|
382
|
+
__decorate([
|
|
383
|
+
Expose({ name: 'split_rules' }),
|
|
384
|
+
__metadata("design:type", String)
|
|
385
|
+
], Payment.prototype, "splitRules", void 0);
|
|
386
|
+
__decorate([
|
|
387
|
+
Expose({ name: 'antifraud_metadata' }),
|
|
388
|
+
__metadata("design:type", Object)
|
|
389
|
+
], Payment.prototype, "antifraudMetadata", void 0);
|
|
390
|
+
__decorate([
|
|
391
|
+
Expose({ name: 'reference_key' }),
|
|
392
|
+
__metadata("design:type", String)
|
|
393
|
+
], Payment.prototype, "referenceKey", void 0);
|
|
394
|
+
__decorate([
|
|
395
|
+
Expose({ name: 'local_transaction_id' }),
|
|
396
|
+
__metadata("design:type", String)
|
|
397
|
+
], Payment.prototype, "localTransactionId", void 0);
|
|
398
|
+
__decorate([
|
|
399
|
+
Expose({ name: 'local_time' }),
|
|
400
|
+
__metadata("design:type", String)
|
|
401
|
+
], Payment.prototype, "localTime", void 0);
|
|
402
|
+
__decorate([
|
|
403
|
+
Expose({ name: 'fraud_covered' }),
|
|
404
|
+
__metadata("design:type", Boolean)
|
|
405
|
+
], Payment.prototype, "fraudCovered", void 0);
|
|
406
|
+
__decorate([
|
|
407
|
+
Expose({ name: 'fraud_reimbursed' }),
|
|
408
|
+
__metadata("design:type", String)
|
|
409
|
+
], Payment.prototype, "fraudReimbursed", void 0);
|
|
410
|
+
__decorate([
|
|
411
|
+
Expose({ name: 'order_id' }),
|
|
412
|
+
__metadata("design:type", String)
|
|
413
|
+
], Payment.prototype, "orderId", void 0);
|
|
414
|
+
__decorate([
|
|
415
|
+
Expose({ name: 'risk_level' }),
|
|
416
|
+
__metadata("design:type", String)
|
|
417
|
+
], Payment.prototype, "riskLevel", void 0);
|
|
418
|
+
__decorate([
|
|
419
|
+
Expose({ name: 'receipt_url' }),
|
|
420
|
+
__metadata("design:type", String)
|
|
421
|
+
], Payment.prototype, "receiptUrl", void 0);
|
|
422
|
+
__decorate([
|
|
423
|
+
Expose({ name: 'private_label' }),
|
|
424
|
+
__metadata("design:type", String)
|
|
425
|
+
], Payment.prototype, "privateLabel", void 0);
|
|
426
|
+
__decorate([
|
|
427
|
+
Expose({ name: 'pix_qr_code' }),
|
|
428
|
+
__metadata("design:type", String)
|
|
429
|
+
], Payment.prototype, "pixQrCode", void 0);
|
|
430
|
+
__decorate([
|
|
431
|
+
Expose({ name: 'pix_expiration_date' }),
|
|
432
|
+
__metadata("design:type", String)
|
|
433
433
|
], Payment.prototype, "pixExpirationDate", void 0);
|
|
434
434
|
|
|
435
|
-
class SubscriptionPayment extends BaseModel {
|
|
436
|
-
identifierFields() {
|
|
437
|
-
return ['id'];
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
__decorate([
|
|
441
|
-
Type(() => Payment),
|
|
442
|
-
__metadata("design:type", Payment)
|
|
435
|
+
class SubscriptionPayment extends BaseModel {
|
|
436
|
+
identifierFields() {
|
|
437
|
+
return ['id'];
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
__decorate([
|
|
441
|
+
Type(() => Payment),
|
|
442
|
+
__metadata("design:type", Payment)
|
|
443
443
|
], SubscriptionPayment.prototype, "payment", void 0);
|
|
444
444
|
|
|
445
|
-
class Address extends BaseModel {
|
|
445
|
+
class Address extends BaseModel {
|
|
446
446
|
}
|
|
447
447
|
|
|
448
|
-
var CheckoutTypes;
|
|
449
|
-
(function (CheckoutTypes) {
|
|
450
|
-
CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
|
|
451
|
-
CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
|
|
448
|
+
var CheckoutTypes;
|
|
449
|
+
(function (CheckoutTypes) {
|
|
450
|
+
CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
|
|
451
|
+
CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
|
|
452
452
|
})(CheckoutTypes || (CheckoutTypes = {}));
|
|
453
453
|
|
|
454
|
-
class Base {
|
|
455
|
-
constructor(...args) {
|
|
456
|
-
Object.assign(this, ...args);
|
|
457
|
-
}
|
|
454
|
+
class Base {
|
|
455
|
+
constructor(...args) {
|
|
456
|
+
Object.assign(this, ...args);
|
|
457
|
+
}
|
|
458
458
|
}
|
|
459
459
|
|
|
460
|
-
var CouponTypes;
|
|
461
|
-
(function (CouponTypes) {
|
|
462
|
-
CouponTypes[CouponTypes["FINANCIAL"] = 1] = "FINANCIAL";
|
|
463
|
-
CouponTypes[CouponTypes["PRODUCT"] = 2] = "PRODUCT";
|
|
464
|
-
CouponTypes[CouponTypes["GIFTCARD"] = 3] = "GIFTCARD";
|
|
465
|
-
CouponTypes[CouponTypes["VOUCHER"] = 4] = "VOUCHER";
|
|
460
|
+
var CouponTypes;
|
|
461
|
+
(function (CouponTypes) {
|
|
462
|
+
CouponTypes[CouponTypes["FINANCIAL"] = 1] = "FINANCIAL";
|
|
463
|
+
CouponTypes[CouponTypes["PRODUCT"] = 2] = "PRODUCT";
|
|
464
|
+
CouponTypes[CouponTypes["GIFTCARD"] = 3] = "GIFTCARD";
|
|
465
|
+
CouponTypes[CouponTypes["VOUCHER"] = 4] = "VOUCHER";
|
|
466
466
|
})(CouponTypes || (CouponTypes = {}));
|
|
467
467
|
|
|
468
|
-
var CouponSubtypes;
|
|
469
|
-
(function (CouponSubtypes) {
|
|
470
|
-
CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
471
|
-
CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
|
|
468
|
+
var CouponSubtypes;
|
|
469
|
+
(function (CouponSubtypes) {
|
|
470
|
+
CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
471
|
+
CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
|
|
472
472
|
})(CouponSubtypes || (CouponSubtypes = {}));
|
|
473
473
|
|
|
474
|
-
var Exclusivities;
|
|
475
|
-
(function (Exclusivities) {
|
|
476
|
-
Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
|
|
477
|
-
Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
|
|
478
|
-
Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
|
|
474
|
+
var Exclusivities;
|
|
475
|
+
(function (Exclusivities) {
|
|
476
|
+
Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
|
|
477
|
+
Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
|
|
478
|
+
Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
|
|
479
479
|
})(Exclusivities || (Exclusivities = {}));
|
|
480
480
|
|
|
481
|
-
class Coupon extends BaseModel {
|
|
482
|
-
get isInfluencer() {
|
|
483
|
-
return !isNil(this.influencerEmail);
|
|
484
|
-
}
|
|
485
|
-
identifierFields() {
|
|
486
|
-
return ['id'];
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
__decorate([
|
|
490
|
-
Expose({ name: 'checkout_type' }),
|
|
491
|
-
__metadata("design:type", Number)
|
|
492
|
-
], Coupon.prototype, "checkoutType", void 0);
|
|
493
|
-
__decorate([
|
|
494
|
-
Expose({ name: 'exclusivity_type' }),
|
|
495
|
-
__metadata("design:type", Number)
|
|
481
|
+
class Coupon extends BaseModel {
|
|
482
|
+
get isInfluencer() {
|
|
483
|
+
return !isNil(this.influencerEmail);
|
|
484
|
+
}
|
|
485
|
+
identifierFields() {
|
|
486
|
+
return ['id'];
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
__decorate([
|
|
490
|
+
Expose({ name: 'checkout_type' }),
|
|
491
|
+
__metadata("design:type", Number)
|
|
492
|
+
], Coupon.prototype, "checkoutType", void 0);
|
|
493
|
+
__decorate([
|
|
494
|
+
Expose({ name: 'exclusivity_type' }),
|
|
495
|
+
__metadata("design:type", Number)
|
|
496
496
|
], Coupon.prototype, "exclusivityType", void 0);
|
|
497
497
|
|
|
498
|
-
class SubscriptionPlan extends BaseModel {
|
|
499
|
-
identifierFields() {
|
|
500
|
-
return ['id'];
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
class BeautyProfile extends BaseModel {
|
|
505
|
-
toPlain() {
|
|
506
|
-
const plain = super.toPlain();
|
|
507
|
-
delete plain.id;
|
|
508
|
-
return plain;
|
|
509
|
-
}
|
|
510
|
-
identifierFields() {
|
|
511
|
-
return ['id'];
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
class User extends BaseModel {
|
|
516
|
-
static toInstance(data) {
|
|
517
|
-
const instance = super.toInstance(data);
|
|
518
|
-
if (!isNil(data.firstName))
|
|
519
|
-
instance.displayName = `${data.firstName}${!isNil(data.lastName) ? ` ${data.lastName}` : ''}`;
|
|
520
|
-
return instance;
|
|
521
|
-
}
|
|
522
|
-
identifierFields() {
|
|
523
|
-
return ['id'];
|
|
524
|
-
}
|
|
525
|
-
toPlain() {
|
|
526
|
-
const plain = super.toPlain();
|
|
527
|
-
delete plain.beautyProfile;
|
|
528
|
-
return plain;
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
__decorate([
|
|
532
|
-
Type(() => BeautyProfile),
|
|
533
|
-
__metadata("design:type", BeautyProfile)
|
|
498
|
+
class SubscriptionPlan extends BaseModel {
|
|
499
|
+
identifierFields() {
|
|
500
|
+
return ['id'];
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
class BeautyProfile extends BaseModel {
|
|
505
|
+
toPlain() {
|
|
506
|
+
const plain = super.toPlain();
|
|
507
|
+
delete plain.id;
|
|
508
|
+
return plain;
|
|
509
|
+
}
|
|
510
|
+
identifierFields() {
|
|
511
|
+
return ['id'];
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
class User extends BaseModel {
|
|
516
|
+
static toInstance(data) {
|
|
517
|
+
const instance = super.toInstance(data);
|
|
518
|
+
if (!isNil(data.firstName))
|
|
519
|
+
instance.displayName = `${data.firstName}${!isNil(data.lastName) ? ` ${data.lastName}` : ''}`;
|
|
520
|
+
return instance;
|
|
521
|
+
}
|
|
522
|
+
identifierFields() {
|
|
523
|
+
return ['id'];
|
|
524
|
+
}
|
|
525
|
+
toPlain() {
|
|
526
|
+
const plain = super.toPlain();
|
|
527
|
+
delete plain.beautyProfile;
|
|
528
|
+
return plain;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
__decorate([
|
|
532
|
+
Type(() => BeautyProfile),
|
|
533
|
+
__metadata("design:type", BeautyProfile)
|
|
534
534
|
], User.prototype, "beautyProfile", void 0);
|
|
535
535
|
|
|
536
|
-
class Subscription extends BaseModel {
|
|
537
|
-
identifierFields() {
|
|
538
|
-
return ['id'];
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
__decorate([
|
|
542
|
-
Type(() => User),
|
|
543
|
-
__metadata("design:type", User)
|
|
544
|
-
], Subscription.prototype, "user", void 0);
|
|
545
|
-
__decorate([
|
|
546
|
-
Type(() => SubscriptionPlan),
|
|
547
|
-
__metadata("design:type", SubscriptionPlan)
|
|
548
|
-
], Subscription.prototype, "subscriptionPlan", void 0);
|
|
549
|
-
__decorate([
|
|
550
|
-
Type(() => Address),
|
|
551
|
-
__metadata("design:type", Address)
|
|
552
|
-
], Subscription.prototype, "shippingAddress", void 0);
|
|
553
|
-
__decorate([
|
|
554
|
-
Type(() => Address),
|
|
555
|
-
__metadata("design:type", Address)
|
|
556
|
-
], Subscription.prototype, "billingAddress", void 0);
|
|
557
|
-
__decorate([
|
|
558
|
-
Type(() => Coupon),
|
|
559
|
-
__metadata("design:type", Coupon)
|
|
560
|
-
], Subscription.prototype, "coupon", void 0);
|
|
561
|
-
__decorate([
|
|
562
|
-
Type(() => Edition),
|
|
563
|
-
__metadata("design:type", Array)
|
|
564
|
-
], Subscription.prototype, "editions", void 0);
|
|
565
|
-
__decorate([
|
|
566
|
-
Type(() => SubscriptionPayment),
|
|
567
|
-
__metadata("design:type", Array)
|
|
536
|
+
class Subscription extends BaseModel {
|
|
537
|
+
identifierFields() {
|
|
538
|
+
return ['id'];
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
__decorate([
|
|
542
|
+
Type(() => User),
|
|
543
|
+
__metadata("design:type", User)
|
|
544
|
+
], Subscription.prototype, "user", void 0);
|
|
545
|
+
__decorate([
|
|
546
|
+
Type(() => SubscriptionPlan),
|
|
547
|
+
__metadata("design:type", SubscriptionPlan)
|
|
548
|
+
], Subscription.prototype, "subscriptionPlan", void 0);
|
|
549
|
+
__decorate([
|
|
550
|
+
Type(() => Address),
|
|
551
|
+
__metadata("design:type", Address)
|
|
552
|
+
], Subscription.prototype, "shippingAddress", void 0);
|
|
553
|
+
__decorate([
|
|
554
|
+
Type(() => Address),
|
|
555
|
+
__metadata("design:type", Address)
|
|
556
|
+
], Subscription.prototype, "billingAddress", void 0);
|
|
557
|
+
__decorate([
|
|
558
|
+
Type(() => Coupon),
|
|
559
|
+
__metadata("design:type", Coupon)
|
|
560
|
+
], Subscription.prototype, "coupon", void 0);
|
|
561
|
+
__decorate([
|
|
562
|
+
Type(() => Edition),
|
|
563
|
+
__metadata("design:type", Array)
|
|
564
|
+
], Subscription.prototype, "editions", void 0);
|
|
565
|
+
__decorate([
|
|
566
|
+
Type(() => SubscriptionPayment),
|
|
567
|
+
__metadata("design:type", Array)
|
|
568
568
|
], Subscription.prototype, "payment", void 0);
|
|
569
569
|
|
|
570
|
-
class UserAddress extends Address {
|
|
571
|
-
identifierFields() {
|
|
572
|
-
return ['id'];
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
class UserPaymentMethod extends BaseModel {
|
|
577
|
-
identifierFields() {
|
|
578
|
-
return ['id'];
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
class Lead extends BaseModel {
|
|
583
|
-
identifierFields() {
|
|
584
|
-
return ['id'];
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
class UnauthorizedError extends Error {
|
|
589
|
-
constructor(message) {
|
|
590
|
-
super(message);
|
|
591
|
-
this.message = message;
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
var SignInMethods;
|
|
596
|
-
(function (SignInMethods) {
|
|
597
|
-
SignInMethods["EMAIL_PASSWORD"] = "email_password";
|
|
598
|
-
SignInMethods["GOOGLE"] = "google";
|
|
599
|
-
})(SignInMethods || (SignInMethods = {}));
|
|
600
|
-
class Authentication {
|
|
601
|
-
constructor(authService, userRepository) {
|
|
602
|
-
this.authService = authService;
|
|
603
|
-
this.userRepository = userRepository;
|
|
604
|
-
}
|
|
605
|
-
signIn({ email, password }, signInMethod) {
|
|
606
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
607
|
-
const method = this.getServiceByMethod(signInMethod);
|
|
608
|
-
const userAuth = yield this.authService[method]({ email, password });
|
|
609
|
-
const user = this.userRepository.get(userAuth);
|
|
610
|
-
if (!isNil(user))
|
|
611
|
-
return user;
|
|
612
|
-
if (/^.+@b4a.com.br$/.test(userAuth.email))
|
|
613
|
-
return this.createsUserByCredential(userAuth);
|
|
614
|
-
throw new UnauthorizedError('Invalid credentials');
|
|
615
|
-
});
|
|
616
|
-
}
|
|
617
|
-
getServiceByMethod(signInMethod) {
|
|
618
|
-
return signInMethod === SignInMethods.EMAIL_PASSWORD ? 'signInWithEmailAndPassword' : 'signInWithGoogle';
|
|
619
|
-
}
|
|
620
|
-
createsUserByCredential(user) {
|
|
621
|
-
var _a;
|
|
622
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
623
|
-
const [firstName, lastName] = (_a = user.displayName) === null || _a === void 0 ? void 0 : _a.split(/\s/);
|
|
624
|
-
const person = User.toInstance(Object.assign(Object.assign({}, user), { cpf: '', birthday: new Date(), firstName,
|
|
625
|
-
lastName, acceptsNewsletter: false, area: Area.Transactional, officePosition: OfficePosition.Intern, type: UserType.Collaborator }));
|
|
626
|
-
return this.userRepository.create(person);
|
|
627
|
-
});
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
class UserAlreadyRegisteredError extends Error {
|
|
632
|
-
constructor(message) {
|
|
633
|
-
super(message);
|
|
634
|
-
this.message = message;
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
class WeakPasswordError extends Error {
|
|
639
|
-
constructor(message = 'Weak password') {
|
|
640
|
-
super(message);
|
|
641
|
-
this.message = message;
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
class Register {
|
|
646
|
-
constructor(registerService, userRepository) {
|
|
647
|
-
this.registerService = registerService;
|
|
648
|
-
this.userRepository = userRepository;
|
|
649
|
-
}
|
|
650
|
-
register(params) {
|
|
651
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
652
|
-
const email = params.email.toLocaleLowerCase();
|
|
653
|
-
const displayName = `${params.firstName} ${params.lastName}`;
|
|
654
|
-
if (yield this.userRepository.checkIfExistsByField('cpf', params.cpf))
|
|
655
|
-
throw new UserAlreadyRegisteredError(`Usuário com CPF ${params.cpf} já registrado.`);
|
|
656
|
-
if (yield this.userRepository.checkIfExistsByField('email', params.email))
|
|
657
|
-
throw new UserAlreadyRegisteredError(`Usuário com e-mail ${params.email} já registrado.`);
|
|
658
|
-
const auth = yield this.registerService.register({
|
|
659
|
-
birthday: params.birthday,
|
|
660
|
-
email,
|
|
661
|
-
firstName: params.firstName,
|
|
662
|
-
lastName: params.lastName,
|
|
663
|
-
cpf: params.cpf,
|
|
664
|
-
displayName,
|
|
665
|
-
phone: params.phone,
|
|
666
|
-
password: params.password,
|
|
667
|
-
});
|
|
668
|
-
delete params.password;
|
|
669
|
-
const user = yield this.userRepository.create(Object.assign(Object.assign({}, params), { id: auth.id, email,
|
|
670
|
-
displayName, type: UserType.B2C, dateCreated: new Date(), dateModified: new Date() }));
|
|
671
|
-
return user;
|
|
672
|
-
});
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
class SignOut {
|
|
677
|
-
constructor(authService) {
|
|
678
|
-
this.authService = authService;
|
|
679
|
-
}
|
|
680
|
-
signOut() {
|
|
681
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
682
|
-
yield this.authService.signOut();
|
|
683
|
-
});
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
class RecoveryPassword {
|
|
688
|
-
constructor(authService) {
|
|
689
|
-
this.authService = authService;
|
|
690
|
-
}
|
|
691
|
-
sendEmail(email) {
|
|
692
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
693
|
-
yield this.authService.sendPasswordResetEmail(email);
|
|
694
|
-
});
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
var Shops;
|
|
699
|
-
(function (Shops) {
|
|
700
|
-
Shops["MENSMARKET"] = "mensmarket";
|
|
701
|
-
Shops["GLAMSHOP"] = "Glamshop";
|
|
570
|
+
class UserAddress extends Address {
|
|
571
|
+
identifierFields() {
|
|
572
|
+
return ['id'];
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
class UserPaymentMethod extends BaseModel {
|
|
577
|
+
identifierFields() {
|
|
578
|
+
return ['id'];
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
class Lead extends BaseModel {
|
|
583
|
+
identifierFields() {
|
|
584
|
+
return ['id'];
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
class UnauthorizedError extends Error {
|
|
589
|
+
constructor(message) {
|
|
590
|
+
super(message);
|
|
591
|
+
this.message = message;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
var SignInMethods;
|
|
596
|
+
(function (SignInMethods) {
|
|
597
|
+
SignInMethods["EMAIL_PASSWORD"] = "email_password";
|
|
598
|
+
SignInMethods["GOOGLE"] = "google";
|
|
599
|
+
})(SignInMethods || (SignInMethods = {}));
|
|
600
|
+
class Authentication {
|
|
601
|
+
constructor(authService, userRepository) {
|
|
602
|
+
this.authService = authService;
|
|
603
|
+
this.userRepository = userRepository;
|
|
604
|
+
}
|
|
605
|
+
signIn({ email, password }, signInMethod) {
|
|
606
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
607
|
+
const method = this.getServiceByMethod(signInMethod);
|
|
608
|
+
const userAuth = yield this.authService[method]({ email, password });
|
|
609
|
+
const user = this.userRepository.get(userAuth);
|
|
610
|
+
if (!isNil(user))
|
|
611
|
+
return user;
|
|
612
|
+
if (/^.+@b4a.com.br$/.test(userAuth.email))
|
|
613
|
+
return this.createsUserByCredential(userAuth);
|
|
614
|
+
throw new UnauthorizedError('Invalid credentials');
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
getServiceByMethod(signInMethod) {
|
|
618
|
+
return signInMethod === SignInMethods.EMAIL_PASSWORD ? 'signInWithEmailAndPassword' : 'signInWithGoogle';
|
|
619
|
+
}
|
|
620
|
+
createsUserByCredential(user) {
|
|
621
|
+
var _a;
|
|
622
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
623
|
+
const [firstName, lastName] = (_a = user.displayName) === null || _a === void 0 ? void 0 : _a.split(/\s/);
|
|
624
|
+
const person = User.toInstance(Object.assign(Object.assign({}, user), { cpf: '', birthday: new Date(), firstName,
|
|
625
|
+
lastName, acceptsNewsletter: false, area: Area.Transactional, officePosition: OfficePosition.Intern, type: UserType.Collaborator }));
|
|
626
|
+
return this.userRepository.create(person);
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
class UserAlreadyRegisteredError extends Error {
|
|
632
|
+
constructor(message) {
|
|
633
|
+
super(message);
|
|
634
|
+
this.message = message;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
class WeakPasswordError extends Error {
|
|
639
|
+
constructor(message = 'Weak password') {
|
|
640
|
+
super(message);
|
|
641
|
+
this.message = message;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
class Register {
|
|
646
|
+
constructor(registerService, userRepository) {
|
|
647
|
+
this.registerService = registerService;
|
|
648
|
+
this.userRepository = userRepository;
|
|
649
|
+
}
|
|
650
|
+
register(params) {
|
|
651
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
652
|
+
const email = params.email.toLocaleLowerCase();
|
|
653
|
+
const displayName = `${params.firstName} ${params.lastName}`;
|
|
654
|
+
if (yield this.userRepository.checkIfExistsByField('cpf', params.cpf))
|
|
655
|
+
throw new UserAlreadyRegisteredError(`Usuário com CPF ${params.cpf} já registrado.`);
|
|
656
|
+
if (yield this.userRepository.checkIfExistsByField('email', params.email))
|
|
657
|
+
throw new UserAlreadyRegisteredError(`Usuário com e-mail ${params.email} já registrado.`);
|
|
658
|
+
const auth = yield this.registerService.register({
|
|
659
|
+
birthday: params.birthday,
|
|
660
|
+
email,
|
|
661
|
+
firstName: params.firstName,
|
|
662
|
+
lastName: params.lastName,
|
|
663
|
+
cpf: params.cpf,
|
|
664
|
+
displayName,
|
|
665
|
+
phone: params.phone,
|
|
666
|
+
password: params.password,
|
|
667
|
+
});
|
|
668
|
+
delete params.password;
|
|
669
|
+
const user = yield this.userRepository.create(Object.assign(Object.assign({}, params), { id: auth.id, email,
|
|
670
|
+
displayName, type: UserType.B2C, dateCreated: new Date(), dateModified: new Date() }));
|
|
671
|
+
return user;
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
class SignOut {
|
|
677
|
+
constructor(authService) {
|
|
678
|
+
this.authService = authService;
|
|
679
|
+
}
|
|
680
|
+
signOut() {
|
|
681
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
682
|
+
yield this.authService.signOut();
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
class RecoveryPassword {
|
|
688
|
+
constructor(authService) {
|
|
689
|
+
this.authService = authService;
|
|
690
|
+
}
|
|
691
|
+
sendEmail(email) {
|
|
692
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
693
|
+
yield this.authService.sendPasswordResetEmail(email);
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
var Shops;
|
|
699
|
+
(function (Shops) {
|
|
700
|
+
Shops["MENSMARKET"] = "mensmarket";
|
|
701
|
+
Shops["GLAMSHOP"] = "Glamshop";
|
|
702
702
|
})(Shops || (Shops = {}));
|
|
703
703
|
|
|
704
|
-
class Category extends BaseModel {
|
|
705
|
-
identifierFields() {
|
|
706
|
-
return ['id'];
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
class Product extends BaseModel {
|
|
711
|
-
identifierFields() {
|
|
712
|
-
return ['id'];
|
|
713
|
-
}
|
|
714
|
-
getInfoByShop(shop) {
|
|
715
|
-
var _a, _b, _c, _d, _e, _f;
|
|
716
|
-
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]) || {}));
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
class Variant extends BaseModel {
|
|
721
|
-
identifierFields() {
|
|
722
|
-
return ['id'];
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
const COUPON_EXPIRATION = 60 * 60 * 24 * 30;
|
|
727
|
-
class FinancialCoupon extends Coupon {
|
|
728
|
-
constructor() {
|
|
729
|
-
super(...arguments);
|
|
730
|
-
this.type = CouponTypes.FINANCIAL;
|
|
731
|
-
}
|
|
732
|
-
static isFinancialCoupon(coupon) {
|
|
733
|
-
return coupon.type === CouponTypes.FINANCIAL && !!coupon.subtype;
|
|
734
|
-
}
|
|
735
|
-
static createCoupon(userId) {
|
|
736
|
-
return this.toInstance({
|
|
737
|
-
name: Md5.hashStr(`${userId}_${Date.now}`).toString(),
|
|
738
|
-
nickname: `${Date.now()}`,
|
|
739
|
-
type: CouponTypes.FINANCIAL,
|
|
740
|
-
subtype: CouponSubtypes.PERCENTAGE,
|
|
741
|
-
checkoutType: CheckoutTypes.ECOMMERCE,
|
|
742
|
-
discount: 30,
|
|
743
|
-
user: userId,
|
|
744
|
-
createdAt: new Date(Date.now()),
|
|
745
|
-
expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
var OrderStatus;
|
|
751
|
-
(function (OrderStatus) {
|
|
752
|
-
OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
|
|
753
|
-
OrderStatus["EM_PREPARO"] = "Preparando pedido";
|
|
754
|
-
OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
|
|
755
|
-
OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
|
|
756
|
-
OrderStatus["ENVIADO"] = "Pedido Enviado";
|
|
757
|
-
OrderStatus["ENTREGUE"] = "Pedido entregue";
|
|
758
|
-
OrderStatus["CANCELADO"] = "Cancelado";
|
|
759
|
-
OrderStatus["CREDIT_CARD"] = "credit_card";
|
|
704
|
+
class Category extends BaseModel {
|
|
705
|
+
identifierFields() {
|
|
706
|
+
return ['id'];
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
class Product extends BaseModel {
|
|
711
|
+
identifierFields() {
|
|
712
|
+
return ['id'];
|
|
713
|
+
}
|
|
714
|
+
getInfoByShop(shop) {
|
|
715
|
+
var _a, _b, _c, _d, _e, _f;
|
|
716
|
+
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]) || {}));
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
class Variant extends BaseModel {
|
|
721
|
+
identifierFields() {
|
|
722
|
+
return ['id'];
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
const COUPON_EXPIRATION = 60 * 60 * 24 * 30;
|
|
727
|
+
class FinancialCoupon extends Coupon {
|
|
728
|
+
constructor() {
|
|
729
|
+
super(...arguments);
|
|
730
|
+
this.type = CouponTypes.FINANCIAL;
|
|
731
|
+
}
|
|
732
|
+
static isFinancialCoupon(coupon) {
|
|
733
|
+
return coupon.type === CouponTypes.FINANCIAL && !!coupon.subtype;
|
|
734
|
+
}
|
|
735
|
+
static createCoupon(userId) {
|
|
736
|
+
return this.toInstance({
|
|
737
|
+
name: Md5.hashStr(`${userId}_${Date.now}`).toString(),
|
|
738
|
+
nickname: `${Date.now()}`,
|
|
739
|
+
type: CouponTypes.FINANCIAL,
|
|
740
|
+
subtype: CouponSubtypes.PERCENTAGE,
|
|
741
|
+
checkoutType: CheckoutTypes.ECOMMERCE,
|
|
742
|
+
discount: 30,
|
|
743
|
+
user: userId,
|
|
744
|
+
createdAt: new Date(Date.now()),
|
|
745
|
+
expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
var OrderStatus;
|
|
751
|
+
(function (OrderStatus) {
|
|
752
|
+
OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
|
|
753
|
+
OrderStatus["EM_PREPARO"] = "Preparando pedido";
|
|
754
|
+
OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
|
|
755
|
+
OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
|
|
756
|
+
OrderStatus["ENVIADO"] = "Pedido Enviado";
|
|
757
|
+
OrderStatus["ENTREGUE"] = "Pedido entregue";
|
|
758
|
+
OrderStatus["CANCELADO"] = "Cancelado";
|
|
759
|
+
OrderStatus["CREDIT_CARD"] = "credit_card";
|
|
760
760
|
})(OrderStatus || (OrderStatus = {}));
|
|
761
761
|
|
|
762
|
-
class LineItem extends Product {
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
class ShippingMethod extends BaseModel {
|
|
766
|
-
identifierFields() {
|
|
767
|
-
return ['id'];
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
class Checkout extends BaseModel {
|
|
772
|
-
identifierFields() {
|
|
773
|
-
return ['id'];
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
__decorate([
|
|
777
|
-
Type(() => LineItem),
|
|
778
|
-
__metadata("design:type", Array)
|
|
779
|
-
], Checkout.prototype, "lineItems", void 0);
|
|
780
|
-
__decorate([
|
|
781
|
-
Type(() => User),
|
|
782
|
-
__metadata("design:type", User)
|
|
783
|
-
], Checkout.prototype, "user", void 0);
|
|
784
|
-
__decorate([
|
|
785
|
-
Type(() => Address),
|
|
786
|
-
__metadata("design:type", Address)
|
|
787
|
-
], Checkout.prototype, "shippingAddress", void 0);
|
|
788
|
-
__decorate([
|
|
789
|
-
Type(() => Address),
|
|
790
|
-
__metadata("design:type", Address)
|
|
791
|
-
], Checkout.prototype, "billingAddress", void 0);
|
|
792
|
-
__decorate([
|
|
793
|
-
Type(() => ShippingMethod),
|
|
794
|
-
__metadata("design:type", ShippingMethod)
|
|
795
|
-
], Checkout.prototype, "shipping", void 0);
|
|
796
|
-
__decorate([
|
|
797
|
-
Type(() => Coupon),
|
|
798
|
-
__metadata("design:type", Coupon)
|
|
762
|
+
class LineItem extends Product {
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
class ShippingMethod extends BaseModel {
|
|
766
|
+
identifierFields() {
|
|
767
|
+
return ['id'];
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
class Checkout extends BaseModel {
|
|
772
|
+
identifierFields() {
|
|
773
|
+
return ['id'];
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
__decorate([
|
|
777
|
+
Type(() => LineItem),
|
|
778
|
+
__metadata("design:type", Array)
|
|
779
|
+
], Checkout.prototype, "lineItems", void 0);
|
|
780
|
+
__decorate([
|
|
781
|
+
Type(() => User),
|
|
782
|
+
__metadata("design:type", User)
|
|
783
|
+
], Checkout.prototype, "user", void 0);
|
|
784
|
+
__decorate([
|
|
785
|
+
Type(() => Address),
|
|
786
|
+
__metadata("design:type", Address)
|
|
787
|
+
], Checkout.prototype, "shippingAddress", void 0);
|
|
788
|
+
__decorate([
|
|
789
|
+
Type(() => Address),
|
|
790
|
+
__metadata("design:type", Address)
|
|
791
|
+
], Checkout.prototype, "billingAddress", void 0);
|
|
792
|
+
__decorate([
|
|
793
|
+
Type(() => ShippingMethod),
|
|
794
|
+
__metadata("design:type", ShippingMethod)
|
|
795
|
+
], Checkout.prototype, "shipping", void 0);
|
|
796
|
+
__decorate([
|
|
797
|
+
Type(() => Coupon),
|
|
798
|
+
__metadata("design:type", Coupon)
|
|
799
799
|
], Checkout.prototype, "coupon", void 0);
|
|
800
800
|
|
|
801
|
-
class Order extends Checkout {
|
|
802
|
-
}
|
|
803
|
-
__decorate([
|
|
804
|
-
Type(() => Payment),
|
|
805
|
-
__metadata("design:type", Payment)
|
|
801
|
+
class Order extends Checkout {
|
|
802
|
+
}
|
|
803
|
+
__decorate([
|
|
804
|
+
Type(() => Payment),
|
|
805
|
+
__metadata("design:type", Payment)
|
|
806
806
|
], Order.prototype, "payment", void 0);
|
|
807
807
|
|
|
808
|
-
class CheckoutSubscription extends BaseModel {
|
|
809
|
-
identifierFields() {
|
|
810
|
-
return ['id'];
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
__decorate([
|
|
814
|
-
Type(() => Address),
|
|
815
|
-
__metadata("design:type", Address)
|
|
816
|
-
], CheckoutSubscription.prototype, "shippingAddress", void 0);
|
|
817
|
-
__decorate([
|
|
818
|
-
Type(() => Address),
|
|
819
|
-
__metadata("design:type", Address)
|
|
820
|
-
], CheckoutSubscription.prototype, "billingAddress", void 0);
|
|
821
|
-
__decorate([
|
|
822
|
-
Type(() => SubscriptionPlan),
|
|
823
|
-
__metadata("design:type", SubscriptionPlan)
|
|
824
|
-
], CheckoutSubscription.prototype, "subscriptionPlan", void 0);
|
|
825
|
-
__decorate([
|
|
826
|
-
Type(() => Coupon),
|
|
827
|
-
__metadata("design:type", Coupon)
|
|
808
|
+
class CheckoutSubscription extends BaseModel {
|
|
809
|
+
identifierFields() {
|
|
810
|
+
return ['id'];
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
__decorate([
|
|
814
|
+
Type(() => Address),
|
|
815
|
+
__metadata("design:type", Address)
|
|
816
|
+
], CheckoutSubscription.prototype, "shippingAddress", void 0);
|
|
817
|
+
__decorate([
|
|
818
|
+
Type(() => Address),
|
|
819
|
+
__metadata("design:type", Address)
|
|
820
|
+
], CheckoutSubscription.prototype, "billingAddress", void 0);
|
|
821
|
+
__decorate([
|
|
822
|
+
Type(() => SubscriptionPlan),
|
|
823
|
+
__metadata("design:type", SubscriptionPlan)
|
|
824
|
+
], CheckoutSubscription.prototype, "subscriptionPlan", void 0);
|
|
825
|
+
__decorate([
|
|
826
|
+
Type(() => Coupon),
|
|
827
|
+
__metadata("design:type", Coupon)
|
|
828
828
|
], CheckoutSubscription.prototype, "coupon", void 0);
|
|
829
829
|
|
|
830
|
-
class Buy2Win extends BaseModel {
|
|
831
|
-
identifierFields() {
|
|
832
|
-
return ['id'];
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
__decorate([
|
|
836
|
-
Type(() => Category),
|
|
837
|
-
__metadata("design:type", Array)
|
|
830
|
+
class Buy2Win extends BaseModel {
|
|
831
|
+
identifierFields() {
|
|
832
|
+
return ['id'];
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
__decorate([
|
|
836
|
+
Type(() => Category),
|
|
837
|
+
__metadata("design:type", Array)
|
|
838
838
|
], Buy2Win.prototype, "categories", void 0);
|
|
839
839
|
|
|
840
|
-
var FilterType;
|
|
841
|
-
(function (FilterType) {
|
|
842
|
-
FilterType["ACCESSORY_IMPORTANCE"] = "accessoryImportance";
|
|
843
|
-
FilterType["BEARD_PROBLEMS"] = "beardProblems";
|
|
844
|
-
FilterType["BEARD_SIZE"] = "beardSize";
|
|
845
|
-
FilterType["BEAUTY_PRODUCT_IMPORTANCE"] = "beautyProductImportance";
|
|
846
|
-
FilterType["BODY_PROBLEMS"] = "bodyProblems";
|
|
847
|
-
FilterType["BODY_SHAPE"] = "bodyShape";
|
|
848
|
-
FilterType["BODY_TATTOOS"] = "bodyTattoos";
|
|
849
|
-
FilterType["FACE_SKIN_OILINESS"] = "faceSkinOiliness";
|
|
850
|
-
FilterType["FACE_SKIN_PROBLEMS"] = "faceSkinProblems";
|
|
851
|
-
FilterType["FACE_SKIN_TONE"] = "faceSkinTone";
|
|
852
|
-
FilterType["FAMILY_INCOME"] = "familyIncome";
|
|
853
|
-
FilterType["FRAGRANCE_IMPORTANCE"] = "fragranceImportance";
|
|
854
|
-
FilterType["HAIR_COLOR"] = "hairColor";
|
|
855
|
-
FilterType["HAIR_PROBLEMS"] = "hairProblems";
|
|
856
|
-
FilterType["HAIR_STRANDS"] = "hairStrands";
|
|
857
|
-
FilterType["HAIR_TYPE"] = "hairType";
|
|
858
|
-
FilterType["PRODUCT_SPENT"] = "productSpent";
|
|
840
|
+
var FilterType;
|
|
841
|
+
(function (FilterType) {
|
|
842
|
+
FilterType["ACCESSORY_IMPORTANCE"] = "accessoryImportance";
|
|
843
|
+
FilterType["BEARD_PROBLEMS"] = "beardProblems";
|
|
844
|
+
FilterType["BEARD_SIZE"] = "beardSize";
|
|
845
|
+
FilterType["BEAUTY_PRODUCT_IMPORTANCE"] = "beautyProductImportance";
|
|
846
|
+
FilterType["BODY_PROBLEMS"] = "bodyProblems";
|
|
847
|
+
FilterType["BODY_SHAPE"] = "bodyShape";
|
|
848
|
+
FilterType["BODY_TATTOOS"] = "bodyTattoos";
|
|
849
|
+
FilterType["FACE_SKIN_OILINESS"] = "faceSkinOiliness";
|
|
850
|
+
FilterType["FACE_SKIN_PROBLEMS"] = "faceSkinProblems";
|
|
851
|
+
FilterType["FACE_SKIN_TONE"] = "faceSkinTone";
|
|
852
|
+
FilterType["FAMILY_INCOME"] = "familyIncome";
|
|
853
|
+
FilterType["FRAGRANCE_IMPORTANCE"] = "fragranceImportance";
|
|
854
|
+
FilterType["HAIR_COLOR"] = "hairColor";
|
|
855
|
+
FilterType["HAIR_PROBLEMS"] = "hairProblems";
|
|
856
|
+
FilterType["HAIR_STRANDS"] = "hairStrands";
|
|
857
|
+
FilterType["HAIR_TYPE"] = "hairType";
|
|
858
|
+
FilterType["PRODUCT_SPENT"] = "productSpent";
|
|
859
859
|
})(FilterType || (FilterType = {}));
|
|
860
860
|
|
|
861
|
-
var QuestionsFilters;
|
|
862
|
-
(function (QuestionsFilters) {
|
|
863
|
-
QuestionsFilters["ACCESSORY_IMPORTANCE"] = "Voc\u00EA gosta de usar acess\u00F3rios masculinos?";
|
|
864
|
-
QuestionsFilters["BEARD_PROBLEMS"] = "Quais problemas de barba voc\u00EA tem?";
|
|
865
|
-
QuestionsFilters["BEARD_SIZE"] = "Quais caracteristicas se aplicam \u00E0 sua BARBA/BIGODE?";
|
|
866
|
-
QuestionsFilters["BEAUTY_PRODUCT_IMPORTANCE"] = "O que descreve melhor a sua rela\u00E7\u00E3o com produtos de beleza e cuidados pessoais?";
|
|
867
|
-
QuestionsFilters["BODY_PROBLEMS"] = "Qual ou quais preocupa\u00E7\u00F5es voc\u00EA tem com a pele do seu corpo?";
|
|
868
|
-
QuestionsFilters["BODY_SHAPE"] = "Qual e seu tipo de CORPO?";
|
|
869
|
-
QuestionsFilters["BODY_TATTOOS"] = "Voc\u00EA tem alguma tatuagem?";
|
|
870
|
-
QuestionsFilters["FACE_SKIN_OILINESS"] = "Quais caracteristicas se aplicam \u00E0 pele do seu ROSTO?";
|
|
871
|
-
QuestionsFilters["FACE_SKIN_PROBLEMS"] = "Quais problemas a pele do seu rosto tem?";
|
|
872
|
-
QuestionsFilters["FACE_SKIN_TONE"] = "Qual seu tom de pele?";
|
|
873
|
-
QuestionsFilters["FAMILY_INCOME"] = "Qual a sua renda familiar mensal (considerando a renda de todas as pessoas que moram com voc\u00EA)?";
|
|
874
|
-
QuestionsFilters["FRAGRANCE_IMPORTANCE"] = "O quanto voc\u00EA gosta de experimentar perfumes?";
|
|
875
|
-
QuestionsFilters["HAIR_COLOR"] = "Seu cabelo \u00E9 naturalmente de qual COR?";
|
|
876
|
-
QuestionsFilters["HAIR_PROBLEMS"] = "Qual ou quais problemas/caracter\u00EDstica de cabelo te preocupam?";
|
|
877
|
-
QuestionsFilters["HAIR_STRANDS"] = "Como s\u00E3o seus fios?";
|
|
878
|
-
QuestionsFilters["HAIR_TYPE"] = "Como \u00E9 o seu cabelo?";
|
|
879
|
-
QuestionsFilters["PRODUCT_SPENT"] = "Qual \u00E9 o seu nivel de gasto mensal em produtos de beleza e cuidados pessoais?";
|
|
861
|
+
var QuestionsFilters;
|
|
862
|
+
(function (QuestionsFilters) {
|
|
863
|
+
QuestionsFilters["ACCESSORY_IMPORTANCE"] = "Voc\u00EA gosta de usar acess\u00F3rios masculinos?";
|
|
864
|
+
QuestionsFilters["BEARD_PROBLEMS"] = "Quais problemas de barba voc\u00EA tem?";
|
|
865
|
+
QuestionsFilters["BEARD_SIZE"] = "Quais caracteristicas se aplicam \u00E0 sua BARBA/BIGODE?";
|
|
866
|
+
QuestionsFilters["BEAUTY_PRODUCT_IMPORTANCE"] = "O que descreve melhor a sua rela\u00E7\u00E3o com produtos de beleza e cuidados pessoais?";
|
|
867
|
+
QuestionsFilters["BODY_PROBLEMS"] = "Qual ou quais preocupa\u00E7\u00F5es voc\u00EA tem com a pele do seu corpo?";
|
|
868
|
+
QuestionsFilters["BODY_SHAPE"] = "Qual e seu tipo de CORPO?";
|
|
869
|
+
QuestionsFilters["BODY_TATTOOS"] = "Voc\u00EA tem alguma tatuagem?";
|
|
870
|
+
QuestionsFilters["FACE_SKIN_OILINESS"] = "Quais caracteristicas se aplicam \u00E0 pele do seu ROSTO?";
|
|
871
|
+
QuestionsFilters["FACE_SKIN_PROBLEMS"] = "Quais problemas a pele do seu rosto tem?";
|
|
872
|
+
QuestionsFilters["FACE_SKIN_TONE"] = "Qual seu tom de pele?";
|
|
873
|
+
QuestionsFilters["FAMILY_INCOME"] = "Qual a sua renda familiar mensal (considerando a renda de todas as pessoas que moram com voc\u00EA)?";
|
|
874
|
+
QuestionsFilters["FRAGRANCE_IMPORTANCE"] = "O quanto voc\u00EA gosta de experimentar perfumes?";
|
|
875
|
+
QuestionsFilters["HAIR_COLOR"] = "Seu cabelo \u00E9 naturalmente de qual COR?";
|
|
876
|
+
QuestionsFilters["HAIR_PROBLEMS"] = "Qual ou quais problemas/caracter\u00EDstica de cabelo te preocupam?";
|
|
877
|
+
QuestionsFilters["HAIR_STRANDS"] = "Como s\u00E3o seus fios?";
|
|
878
|
+
QuestionsFilters["HAIR_TYPE"] = "Como \u00E9 o seu cabelo?";
|
|
879
|
+
QuestionsFilters["PRODUCT_SPENT"] = "Qual \u00E9 o seu nivel de gasto mensal em produtos de beleza e cuidados pessoais?";
|
|
880
880
|
})(QuestionsFilters || (QuestionsFilters = {}));
|
|
881
881
|
|
|
882
|
-
class BeautyQuestionsHelper {
|
|
883
|
-
static getAnswers(filter) {
|
|
884
|
-
switch (filter) {
|
|
885
|
-
case FilterType.ACCESSORY_IMPORTANCE:
|
|
886
|
-
return AccessoryImportances;
|
|
887
|
-
case FilterType.BEARD_PROBLEMS:
|
|
888
|
-
return BeardProblems;
|
|
889
|
-
case FilterType.BEARD_SIZE:
|
|
890
|
-
return BeardSizes;
|
|
891
|
-
case FilterType.BEAUTY_PRODUCT_IMPORTANCE:
|
|
892
|
-
return BeautyProductImportances;
|
|
893
|
-
case FilterType.BODY_PROBLEMS:
|
|
894
|
-
return BodyProblems;
|
|
895
|
-
case FilterType.BODY_SHAPE:
|
|
896
|
-
return BodyShapes;
|
|
897
|
-
case FilterType.BODY_TATTOOS:
|
|
898
|
-
return BodyTattoos;
|
|
899
|
-
case FilterType.FACE_SKIN_OILINESS:
|
|
900
|
-
return FaceSkinOilinesses;
|
|
901
|
-
case FilterType.FACE_SKIN_PROBLEMS:
|
|
902
|
-
return FaceSkinProblems;
|
|
903
|
-
case FilterType.FACE_SKIN_TONE:
|
|
904
|
-
return FaceSkinTones;
|
|
905
|
-
case FilterType.FAMILY_INCOME:
|
|
906
|
-
return FamilyIncomes;
|
|
907
|
-
case FilterType.FRAGRANCE_IMPORTANCE:
|
|
908
|
-
return FragranceImportances;
|
|
909
|
-
case FilterType.HAIR_COLOR:
|
|
910
|
-
return HairColors;
|
|
911
|
-
case FilterType.HAIR_PROBLEMS:
|
|
912
|
-
return HairProblems;
|
|
913
|
-
case FilterType.HAIR_STRANDS:
|
|
914
|
-
return HairStrands;
|
|
915
|
-
case FilterType.HAIR_TYPE:
|
|
916
|
-
return HairTypes;
|
|
917
|
-
case FilterType.PRODUCT_SPENT:
|
|
918
|
-
return ProductSpents;
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
static getQuestions(filter) {
|
|
922
|
-
return QuestionsFilters[filter];
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
class Home extends BaseModel {
|
|
927
|
-
identifierFields() {
|
|
928
|
-
return ['id'];
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
-
class ShopMenu extends BaseModel {
|
|
933
|
-
identifierFields() {
|
|
934
|
-
return ['id'];
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
class InvalidArgumentError extends Error {
|
|
939
|
-
constructor(message) {
|
|
940
|
-
super(message);
|
|
941
|
-
this.message = message;
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
class RequiredArgumentError extends Error {
|
|
946
|
-
constructor(args) {
|
|
947
|
-
super(`Required arguments: ${args.join(', ')}`);
|
|
948
|
-
this.args = args;
|
|
949
|
-
this.arguments = args;
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
class NotFoundError extends Error {
|
|
954
|
-
constructor(message) {
|
|
955
|
-
super(message);
|
|
956
|
-
this.message = message;
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
class DuplicatedResultsError extends Error {
|
|
961
|
-
constructor(message) {
|
|
962
|
-
super(message);
|
|
963
|
-
this.message = message;
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
const withFirestore = (MixinBase) => {
|
|
968
|
-
return class extends MixinBase {
|
|
969
|
-
constructor(...args) {
|
|
970
|
-
super(args);
|
|
971
|
-
}
|
|
972
|
-
collection(path) {
|
|
973
|
-
return this.firestore.collection(path || this.collectionName).withConverter(this.buildModelInstance());
|
|
974
|
-
}
|
|
975
|
-
buildModelInstance() {
|
|
976
|
-
return {
|
|
977
|
-
toFirestore: (data) => ((data === null || data === void 0 ? void 0 : data.toPlain) ? data.toPlain() : data),
|
|
978
|
-
fromFirestore: (snap) => {
|
|
979
|
-
const data = snap.data();
|
|
980
|
-
Object.keys(data).forEach((key) => {
|
|
981
|
-
if (data[key] instanceof firebase.firestore.Timestamp) {
|
|
982
|
-
data[key] = data[key].toDate();
|
|
983
|
-
}
|
|
984
|
-
});
|
|
985
|
-
return this.model.toInstance(Object.assign(Object.assign({}, data), { id: snap.id }));
|
|
986
|
-
},
|
|
987
|
-
};
|
|
988
|
-
}
|
|
989
|
-
};
|
|
882
|
+
class BeautyQuestionsHelper {
|
|
883
|
+
static getAnswers(filter) {
|
|
884
|
+
switch (filter) {
|
|
885
|
+
case FilterType.ACCESSORY_IMPORTANCE:
|
|
886
|
+
return AccessoryImportances;
|
|
887
|
+
case FilterType.BEARD_PROBLEMS:
|
|
888
|
+
return BeardProblems;
|
|
889
|
+
case FilterType.BEARD_SIZE:
|
|
890
|
+
return BeardSizes;
|
|
891
|
+
case FilterType.BEAUTY_PRODUCT_IMPORTANCE:
|
|
892
|
+
return BeautyProductImportances;
|
|
893
|
+
case FilterType.BODY_PROBLEMS:
|
|
894
|
+
return BodyProblems;
|
|
895
|
+
case FilterType.BODY_SHAPE:
|
|
896
|
+
return BodyShapes;
|
|
897
|
+
case FilterType.BODY_TATTOOS:
|
|
898
|
+
return BodyTattoos;
|
|
899
|
+
case FilterType.FACE_SKIN_OILINESS:
|
|
900
|
+
return FaceSkinOilinesses;
|
|
901
|
+
case FilterType.FACE_SKIN_PROBLEMS:
|
|
902
|
+
return FaceSkinProblems;
|
|
903
|
+
case FilterType.FACE_SKIN_TONE:
|
|
904
|
+
return FaceSkinTones;
|
|
905
|
+
case FilterType.FAMILY_INCOME:
|
|
906
|
+
return FamilyIncomes;
|
|
907
|
+
case FilterType.FRAGRANCE_IMPORTANCE:
|
|
908
|
+
return FragranceImportances;
|
|
909
|
+
case FilterType.HAIR_COLOR:
|
|
910
|
+
return HairColors;
|
|
911
|
+
case FilterType.HAIR_PROBLEMS:
|
|
912
|
+
return HairProblems;
|
|
913
|
+
case FilterType.HAIR_STRANDS:
|
|
914
|
+
return HairStrands;
|
|
915
|
+
case FilterType.HAIR_TYPE:
|
|
916
|
+
return HairTypes;
|
|
917
|
+
case FilterType.PRODUCT_SPENT:
|
|
918
|
+
return ProductSpents;
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
static getQuestions(filter) {
|
|
922
|
+
return QuestionsFilters[filter];
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
class Home extends BaseModel {
|
|
927
|
+
identifierFields() {
|
|
928
|
+
return ['id'];
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
class ShopMenu extends BaseModel {
|
|
933
|
+
identifierFields() {
|
|
934
|
+
return ['id'];
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
class InvalidArgumentError extends Error {
|
|
939
|
+
constructor(message) {
|
|
940
|
+
super(message);
|
|
941
|
+
this.message = message;
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
class RequiredArgumentError extends Error {
|
|
946
|
+
constructor(args) {
|
|
947
|
+
super(`Required arguments: ${args.join(', ')}`);
|
|
948
|
+
this.args = args;
|
|
949
|
+
this.arguments = args;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
class NotFoundError extends Error {
|
|
954
|
+
constructor(message) {
|
|
955
|
+
super(message);
|
|
956
|
+
this.message = message;
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
class DuplicatedResultsError extends Error {
|
|
961
|
+
constructor(message) {
|
|
962
|
+
super(message);
|
|
963
|
+
this.message = message;
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
const withFirestore = (MixinBase) => {
|
|
968
|
+
return class extends MixinBase {
|
|
969
|
+
constructor(...args) {
|
|
970
|
+
super(args);
|
|
971
|
+
}
|
|
972
|
+
collection(path) {
|
|
973
|
+
return this.firestore.collection(path || this.collectionName).withConverter(this.buildModelInstance());
|
|
974
|
+
}
|
|
975
|
+
buildModelInstance() {
|
|
976
|
+
return {
|
|
977
|
+
toFirestore: (data) => ((data === null || data === void 0 ? void 0 : data.toPlain) ? data.toPlain() : data),
|
|
978
|
+
fromFirestore: (snap) => {
|
|
979
|
+
const data = snap.data();
|
|
980
|
+
Object.keys(data).forEach((key) => {
|
|
981
|
+
if (data[key] instanceof firebase.firestore.Timestamp) {
|
|
982
|
+
data[key] = data[key].toDate();
|
|
983
|
+
}
|
|
984
|
+
});
|
|
985
|
+
return this.model.toInstance(Object.assign(Object.assign({}, data), { id: snap.id }));
|
|
986
|
+
},
|
|
987
|
+
};
|
|
988
|
+
}
|
|
989
|
+
};
|
|
990
990
|
};
|
|
991
991
|
|
|
992
|
-
const withHelpers = (MixinBase) => {
|
|
993
|
-
return class extends MixinBase {
|
|
994
|
-
toArray(snapShot) {
|
|
995
|
-
if (Array.isArray(snapShot)) {
|
|
996
|
-
return snapShot.map((doc) => doc.data());
|
|
997
|
-
}
|
|
998
|
-
else {
|
|
999
|
-
return snapShot.docs.map((doc) => doc.data());
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
isSubCollection(repository) {
|
|
1003
|
-
return !isNil(Object.keys(this).find((key) => key === 'parentRepository'));
|
|
1004
|
-
}
|
|
1005
|
-
};
|
|
992
|
+
const withHelpers = (MixinBase) => {
|
|
993
|
+
return class extends MixinBase {
|
|
994
|
+
toArray(snapShot) {
|
|
995
|
+
if (Array.isArray(snapShot)) {
|
|
996
|
+
return snapShot.map((doc) => doc.data());
|
|
997
|
+
}
|
|
998
|
+
else {
|
|
999
|
+
return snapShot.docs.map((doc) => doc.data());
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
isSubCollection(repository) {
|
|
1003
|
+
return !isNil(Object.keys(this).find((key) => key === 'parentRepository'));
|
|
1004
|
+
}
|
|
1005
|
+
};
|
|
1006
1006
|
};
|
|
1007
1007
|
|
|
1008
|
-
const withGetFirestore = (MixinBase) => {
|
|
1009
|
-
return class GetFirestore extends MixinBase {
|
|
1010
|
-
get(identifiers) {
|
|
1011
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1012
|
-
const doc = yield this.collection(this.buildCollectionPathForGet(identifiers))
|
|
1013
|
-
.doc(Object.values(identifiers).shift().toString())
|
|
1014
|
-
.get();
|
|
1015
|
-
const data = doc.data();
|
|
1016
|
-
if (isNil(data))
|
|
1017
|
-
throw new NotFoundError(`Document ${JSON.stringify(identifiers)} not found`);
|
|
1018
|
-
return data;
|
|
1019
|
-
});
|
|
1020
|
-
}
|
|
1021
|
-
buildCollectionPathForGet(identifiers) {
|
|
1022
|
-
return this.isSubCollection(this)
|
|
1023
|
-
? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
|
|
1024
|
-
: this.collectionName;
|
|
1025
|
-
}
|
|
1026
|
-
};
|
|
1008
|
+
const withGetFirestore = (MixinBase) => {
|
|
1009
|
+
return class GetFirestore extends MixinBase {
|
|
1010
|
+
get(identifiers) {
|
|
1011
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1012
|
+
const doc = yield this.collection(this.buildCollectionPathForGet(identifiers))
|
|
1013
|
+
.doc(Object.values(identifiers).shift().toString())
|
|
1014
|
+
.get();
|
|
1015
|
+
const data = doc.data();
|
|
1016
|
+
if (isNil(data))
|
|
1017
|
+
throw new NotFoundError(`Document ${JSON.stringify(identifiers)} not found`);
|
|
1018
|
+
return data;
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
buildCollectionPathForGet(identifiers) {
|
|
1022
|
+
return this.isSubCollection(this)
|
|
1023
|
+
? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
|
|
1024
|
+
: this.collectionName;
|
|
1025
|
+
}
|
|
1026
|
+
};
|
|
1027
1027
|
};
|
|
1028
1028
|
|
|
1029
|
-
const withFindFirestore = (MixinBase) => {
|
|
1030
|
-
const checkIfIsFilterOption = (filter) => !isNil(filter === null || filter === void 0 ? void 0 : filter.operator);
|
|
1031
|
-
const getValueFromFilter = (filter) => {
|
|
1032
|
-
return checkIfIsFilterOption(filter) ? filter.value : filter;
|
|
1033
|
-
};
|
|
1034
|
-
return class FindFirestore extends MixinBase {
|
|
1035
|
-
constructor() {
|
|
1036
|
-
super(...arguments);
|
|
1037
|
-
this.makeFirestoreWhere = (queryReference, filter) => Object.keys(filter).reduce((query, fieldName) => this.buildWhereSentence(query, fieldName, filter[fieldName]), queryReference);
|
|
1038
|
-
this.buildWhereSentence = (queryReference, fieldName, options) => {
|
|
1039
|
-
if (this.isSubCollection(this) && fieldName === this.parentIdField)
|
|
1040
|
-
return queryReference;
|
|
1041
|
-
if ((options === null || options === void 0 ? void 0 : options.operator) === Where.LIKE) {
|
|
1042
|
-
if (Array.isArray(options === null || options === void 0 ? void 0 : options.value))
|
|
1043
|
-
return queryReference.where(fieldName.toString(), 'array-contains-any', options.value);
|
|
1044
|
-
queryReference = queryReference.where(fieldName.toString(), '>=', options.value);
|
|
1045
|
-
queryReference = queryReference.where(fieldName.toString(), '<=', `${options.value}~`);
|
|
1046
|
-
return queryReference;
|
|
1047
|
-
}
|
|
1048
|
-
if ((options === null || options === void 0 ? void 0 : options.operator) === Where.IN && Array.isArray(options === null || options === void 0 ? void 0 : options.value))
|
|
1049
|
-
return queryReference.where(fieldName.toString(), 'array-contains', options.value);
|
|
1050
|
-
if (isObject(options) && isNil(options === null || options === void 0 ? void 0 : options.operator) && isNil(options === null || options === void 0 ? void 0 : options.value))
|
|
1051
|
-
return Object.keys(options).reduce((queryReferenceWithWhere, key) => this.buildWhereSentence(queryReferenceWithWhere, `${fieldName}.${key}`, options[key]), queryReference);
|
|
1052
|
-
return queryReference.where(fieldName.toString(), (options === null || options === void 0 ? void 0 : options.operator) || '==', (options === null || options === void 0 ? void 0 : options.value) || options);
|
|
1053
|
-
};
|
|
1054
|
-
}
|
|
1055
|
-
find(filters, limits, orderBy) {
|
|
1056
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1057
|
-
let query = this.collection(this.buildCollectionPathForFind(filters));
|
|
1058
|
-
filters === null || filters === void 0 ? void 0 : filters.forEach((filterer) => (query = this.makeFirestoreWhere(query, filterer)));
|
|
1059
|
-
orderBy === null || orderBy === void 0 ? void 0 : orderBy.forEach((orderer) => Object.keys(orderer).forEach((fieldName) => (query = query.orderBy(fieldName, orderer[fieldName]))));
|
|
1060
|
-
query = yield this.defineLimits(query, filters, limits);
|
|
1061
|
-
const docs = yield query.get();
|
|
1062
|
-
const data = docs.docs.map((doc) => doc.data());
|
|
1063
|
-
return {
|
|
1064
|
-
data,
|
|
1065
|
-
count: this.calculateCount(data, limits),
|
|
1066
|
-
};
|
|
1067
|
-
});
|
|
1068
|
-
}
|
|
1069
|
-
buildCollectionPathForFind(filters) {
|
|
1070
|
-
var _a;
|
|
1071
|
-
if (!this.isSubCollection(this))
|
|
1072
|
-
return this.collectionName;
|
|
1073
|
-
const parentIdField = this.parentIdField;
|
|
1074
|
-
const parentId = getValueFromFilter((_a = filters.find((groupFilter) => Boolean(getValueFromFilter(groupFilter[parentIdField])))) === null || _a === void 0 ? void 0 : _a[parentIdField]);
|
|
1075
|
-
return `${this.parentRepository.collectionName}/${parentId}/${this.collectionName}`;
|
|
1076
|
-
}
|
|
1077
|
-
defineLimits(query, filters, limits) {
|
|
1078
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1079
|
-
if (limits === null || limits === void 0 ? void 0 : limits.offset) {
|
|
1080
|
-
if (limits.offset instanceof this.model)
|
|
1081
|
-
query = query.startAfter(yield this.collection(this.buildCollectionPathForFind(filters))
|
|
1082
|
-
.doc(limits.offset[limits.offset.identifierFields().shift()])
|
|
1083
|
-
.get());
|
|
1084
|
-
else if (isNumber(limits.offset) || isString(limits.offset))
|
|
1085
|
-
query = query.startAt(limits.offset);
|
|
1086
|
-
}
|
|
1087
|
-
if (limits === null || limits === void 0 ? void 0 : limits.limit)
|
|
1088
|
-
query = query.limit(limits.limit);
|
|
1089
|
-
return query;
|
|
1090
|
-
});
|
|
1091
|
-
}
|
|
1092
|
-
calculateCount(data, limits) {
|
|
1093
|
-
if (data.length <= 0)
|
|
1094
|
-
return 0;
|
|
1095
|
-
if (data.length < (limits === null || limits === void 0 ? void 0 : limits.limit))
|
|
1096
|
-
return data.length;
|
|
1097
|
-
return Infinity;
|
|
1098
|
-
}
|
|
1099
|
-
};
|
|
1029
|
+
const withFindFirestore = (MixinBase) => {
|
|
1030
|
+
const checkIfIsFilterOption = (filter) => !isNil(filter === null || filter === void 0 ? void 0 : filter.operator);
|
|
1031
|
+
const getValueFromFilter = (filter) => {
|
|
1032
|
+
return checkIfIsFilterOption(filter) ? filter.value : filter;
|
|
1033
|
+
};
|
|
1034
|
+
return class FindFirestore extends MixinBase {
|
|
1035
|
+
constructor() {
|
|
1036
|
+
super(...arguments);
|
|
1037
|
+
this.makeFirestoreWhere = (queryReference, filter) => Object.keys(filter).reduce((query, fieldName) => this.buildWhereSentence(query, fieldName, filter[fieldName]), queryReference);
|
|
1038
|
+
this.buildWhereSentence = (queryReference, fieldName, options) => {
|
|
1039
|
+
if (this.isSubCollection(this) && fieldName === this.parentIdField)
|
|
1040
|
+
return queryReference;
|
|
1041
|
+
if ((options === null || options === void 0 ? void 0 : options.operator) === Where.LIKE) {
|
|
1042
|
+
if (Array.isArray(options === null || options === void 0 ? void 0 : options.value))
|
|
1043
|
+
return queryReference.where(fieldName.toString(), 'array-contains-any', options.value);
|
|
1044
|
+
queryReference = queryReference.where(fieldName.toString(), '>=', options.value);
|
|
1045
|
+
queryReference = queryReference.where(fieldName.toString(), '<=', `${options.value}~`);
|
|
1046
|
+
return queryReference;
|
|
1047
|
+
}
|
|
1048
|
+
if ((options === null || options === void 0 ? void 0 : options.operator) === Where.IN && Array.isArray(options === null || options === void 0 ? void 0 : options.value))
|
|
1049
|
+
return queryReference.where(fieldName.toString(), 'array-contains', options.value);
|
|
1050
|
+
if (isObject(options) && isNil(options === null || options === void 0 ? void 0 : options.operator) && isNil(options === null || options === void 0 ? void 0 : options.value))
|
|
1051
|
+
return Object.keys(options).reduce((queryReferenceWithWhere, key) => this.buildWhereSentence(queryReferenceWithWhere, `${fieldName}.${key}`, options[key]), queryReference);
|
|
1052
|
+
return queryReference.where(fieldName.toString(), (options === null || options === void 0 ? void 0 : options.operator) || '==', (options === null || options === void 0 ? void 0 : options.value) || options);
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
find(filters, limits, orderBy) {
|
|
1056
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1057
|
+
let query = this.collection(this.buildCollectionPathForFind(filters));
|
|
1058
|
+
filters === null || filters === void 0 ? void 0 : filters.forEach((filterer) => (query = this.makeFirestoreWhere(query, filterer)));
|
|
1059
|
+
orderBy === null || orderBy === void 0 ? void 0 : orderBy.forEach((orderer) => Object.keys(orderer).forEach((fieldName) => (query = query.orderBy(fieldName, orderer[fieldName]))));
|
|
1060
|
+
query = yield this.defineLimits(query, filters, limits);
|
|
1061
|
+
const docs = yield query.get();
|
|
1062
|
+
const data = docs.docs.map((doc) => doc.data());
|
|
1063
|
+
return {
|
|
1064
|
+
data,
|
|
1065
|
+
count: this.calculateCount(data, limits),
|
|
1066
|
+
};
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
buildCollectionPathForFind(filters) {
|
|
1070
|
+
var _a;
|
|
1071
|
+
if (!this.isSubCollection(this))
|
|
1072
|
+
return this.collectionName;
|
|
1073
|
+
const parentIdField = this.parentIdField;
|
|
1074
|
+
const parentId = getValueFromFilter((_a = filters.find((groupFilter) => Boolean(getValueFromFilter(groupFilter[parentIdField])))) === null || _a === void 0 ? void 0 : _a[parentIdField]);
|
|
1075
|
+
return `${this.parentRepository.collectionName}/${parentId}/${this.collectionName}`;
|
|
1076
|
+
}
|
|
1077
|
+
defineLimits(query, filters, limits) {
|
|
1078
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1079
|
+
if (limits === null || limits === void 0 ? void 0 : limits.offset) {
|
|
1080
|
+
if (limits.offset instanceof this.model)
|
|
1081
|
+
query = query.startAfter(yield this.collection(this.buildCollectionPathForFind(filters))
|
|
1082
|
+
.doc(limits.offset[limits.offset.identifierFields().shift()])
|
|
1083
|
+
.get());
|
|
1084
|
+
else if (isNumber(limits.offset) || isString(limits.offset))
|
|
1085
|
+
query = query.startAt(limits.offset);
|
|
1086
|
+
}
|
|
1087
|
+
if (limits === null || limits === void 0 ? void 0 : limits.limit)
|
|
1088
|
+
query = query.limit(limits.limit);
|
|
1089
|
+
return query;
|
|
1090
|
+
});
|
|
1091
|
+
}
|
|
1092
|
+
calculateCount(data, limits) {
|
|
1093
|
+
if (data.length <= 0)
|
|
1094
|
+
return 0;
|
|
1095
|
+
if (data.length < (limits === null || limits === void 0 ? void 0 : limits.limit))
|
|
1096
|
+
return data.length;
|
|
1097
|
+
return Infinity;
|
|
1098
|
+
}
|
|
1099
|
+
};
|
|
1100
1100
|
};
|
|
1101
1101
|
|
|
1102
|
-
const withCreateFirestore = (MixinBase) => {
|
|
1103
|
-
return class CreateFirestore extends MixinBase {
|
|
1104
|
-
create(data) {
|
|
1105
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1106
|
-
const docRef = yield this.save(this.model.toInstance(data));
|
|
1107
|
-
const doc = yield docRef.get();
|
|
1108
|
-
return doc.data();
|
|
1109
|
-
});
|
|
1110
|
-
}
|
|
1111
|
-
save(data) {
|
|
1112
|
-
var _a;
|
|
1113
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1114
|
-
const id = (_a = data[data.identifierFields().shift()]) === null || _a === void 0 ? void 0 : _a.toString();
|
|
1115
|
-
const collectionPath = this.buildCollectionPathForAdd(data);
|
|
1116
|
-
if (isEmpty(id))
|
|
1117
|
-
return this.collection(collectionPath).add(data);
|
|
1118
|
-
const docRef = this.collection(collectionPath).doc(id);
|
|
1119
|
-
yield docRef.set(data);
|
|
1120
|
-
return docRef;
|
|
1121
|
-
});
|
|
1122
|
-
}
|
|
1123
|
-
buildCollectionPathForAdd(identifiers) {
|
|
1124
|
-
return this.isSubCollection(this)
|
|
1125
|
-
? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
|
|
1126
|
-
: this.collectionName;
|
|
1127
|
-
}
|
|
1128
|
-
};
|
|
1102
|
+
const withCreateFirestore = (MixinBase) => {
|
|
1103
|
+
return class CreateFirestore extends MixinBase {
|
|
1104
|
+
create(data) {
|
|
1105
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1106
|
+
const docRef = yield this.save(this.model.toInstance(data));
|
|
1107
|
+
const doc = yield docRef.get();
|
|
1108
|
+
return doc.data();
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
1111
|
+
save(data) {
|
|
1112
|
+
var _a;
|
|
1113
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1114
|
+
const id = (_a = data[data.identifierFields().shift()]) === null || _a === void 0 ? void 0 : _a.toString();
|
|
1115
|
+
const collectionPath = this.buildCollectionPathForAdd(data);
|
|
1116
|
+
if (isEmpty(id))
|
|
1117
|
+
return this.collection(collectionPath).add(data);
|
|
1118
|
+
const docRef = this.collection(collectionPath).doc(id);
|
|
1119
|
+
yield docRef.set(data);
|
|
1120
|
+
return docRef;
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
buildCollectionPathForAdd(identifiers) {
|
|
1124
|
+
return this.isSubCollection(this)
|
|
1125
|
+
? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
|
|
1126
|
+
: this.collectionName;
|
|
1127
|
+
}
|
|
1128
|
+
};
|
|
1129
1129
|
};
|
|
1130
1130
|
|
|
1131
|
-
const withUpdateFirestore = (MixinBase) => {
|
|
1132
|
-
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; };
|
|
1133
|
-
const getValueByAction = (options) => {
|
|
1134
|
-
const fieldValues = firebase.firestore.FieldValue;
|
|
1135
|
-
if (isNil(options.action))
|
|
1136
|
-
return options;
|
|
1137
|
-
if (options.action === UpdateOptionActions.REMOVE_FIELD)
|
|
1138
|
-
return fieldValues.delete();
|
|
1139
|
-
if (Array.isArray(options.value)) {
|
|
1140
|
-
if (options.action === UpdateOptionActions.MERGE)
|
|
1141
|
-
return fieldValues.arrayUnion(...options.value);
|
|
1142
|
-
if (options.action === UpdateOptionActions.REMOVE)
|
|
1143
|
-
return fieldValues.arrayRemove(...options.value);
|
|
1144
|
-
}
|
|
1145
|
-
return options.value;
|
|
1146
|
-
};
|
|
1147
|
-
return class UpdateFirestore extends MixinBase {
|
|
1148
|
-
update(data) {
|
|
1149
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1150
|
-
const model = new this.model();
|
|
1151
|
-
const keyField = model.identifierFields().shift();
|
|
1152
|
-
const docRef = this.collection(this.buildCollectionPathForUpdate(data)).doc(getValueFromParams(data, keyField).toString());
|
|
1153
|
-
yield docRef.set(this.paramsToPlain(data), { merge: true });
|
|
1154
|
-
const doc = yield docRef.get();
|
|
1155
|
-
return doc.data();
|
|
1156
|
-
});
|
|
1157
|
-
}
|
|
1158
|
-
buildCollectionPathForUpdate(identifiers) {
|
|
1159
|
-
return this.isSubCollection(this)
|
|
1160
|
-
? `${this.parentRepository.collectionName}/${getValueFromParams(identifiers, this.parentIdField)}/${this.collectionName}`
|
|
1161
|
-
: this.collectionName;
|
|
1162
|
-
}
|
|
1163
|
-
paramsToPlain(params) {
|
|
1164
|
-
const model = this.model;
|
|
1165
|
-
if (params instanceof model)
|
|
1166
|
-
return params;
|
|
1167
|
-
return Object.keys(params).reduce((data, currentKey) => (Object.assign(Object.assign({}, data), { [currentKey]: getValueByAction(params[currentKey]) })), {});
|
|
1168
|
-
}
|
|
1169
|
-
};
|
|
1131
|
+
const withUpdateFirestore = (MixinBase) => {
|
|
1132
|
+
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; };
|
|
1133
|
+
const getValueByAction = (options) => {
|
|
1134
|
+
const fieldValues = firebase.firestore.FieldValue;
|
|
1135
|
+
if (isNil(options.action))
|
|
1136
|
+
return options;
|
|
1137
|
+
if (options.action === UpdateOptionActions.REMOVE_FIELD)
|
|
1138
|
+
return fieldValues.delete();
|
|
1139
|
+
if (Array.isArray(options.value)) {
|
|
1140
|
+
if (options.action === UpdateOptionActions.MERGE)
|
|
1141
|
+
return fieldValues.arrayUnion(...options.value);
|
|
1142
|
+
if (options.action === UpdateOptionActions.REMOVE)
|
|
1143
|
+
return fieldValues.arrayRemove(...options.value);
|
|
1144
|
+
}
|
|
1145
|
+
return options.value;
|
|
1146
|
+
};
|
|
1147
|
+
return class UpdateFirestore extends MixinBase {
|
|
1148
|
+
update(data) {
|
|
1149
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1150
|
+
const model = new this.model();
|
|
1151
|
+
const keyField = model.identifierFields().shift();
|
|
1152
|
+
const docRef = this.collection(this.buildCollectionPathForUpdate(data)).doc(getValueFromParams(data, keyField).toString());
|
|
1153
|
+
yield docRef.set(this.paramsToPlain(data), { merge: true });
|
|
1154
|
+
const doc = yield docRef.get();
|
|
1155
|
+
return doc.data();
|
|
1156
|
+
});
|
|
1157
|
+
}
|
|
1158
|
+
buildCollectionPathForUpdate(identifiers) {
|
|
1159
|
+
return this.isSubCollection(this)
|
|
1160
|
+
? `${this.parentRepository.collectionName}/${getValueFromParams(identifiers, this.parentIdField)}/${this.collectionName}`
|
|
1161
|
+
: this.collectionName;
|
|
1162
|
+
}
|
|
1163
|
+
paramsToPlain(params) {
|
|
1164
|
+
const model = this.model;
|
|
1165
|
+
if (params instanceof model)
|
|
1166
|
+
return params;
|
|
1167
|
+
return Object.keys(params).reduce((data, currentKey) => (Object.assign(Object.assign({}, data), { [currentKey]: getValueByAction(params[currentKey]) })), {});
|
|
1168
|
+
}
|
|
1169
|
+
};
|
|
1170
1170
|
};
|
|
1171
1171
|
|
|
1172
|
-
const withDeleteFirestore = (MixinBase) => {
|
|
1173
|
-
return class DeleteFirestore extends MixinBase {
|
|
1174
|
-
delete(identifiers) {
|
|
1175
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1176
|
-
yield this.collection(this.buildCollectionPathForRemove(identifiers))
|
|
1177
|
-
.doc(Object.values(identifiers).shift().toString())
|
|
1178
|
-
.delete();
|
|
1179
|
-
});
|
|
1180
|
-
}
|
|
1181
|
-
buildCollectionPathForRemove(identifiers) {
|
|
1182
|
-
return this.isSubCollection(this)
|
|
1183
|
-
? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
|
|
1184
|
-
: this.collectionName;
|
|
1185
|
-
}
|
|
1186
|
-
};
|
|
1172
|
+
const withDeleteFirestore = (MixinBase) => {
|
|
1173
|
+
return class DeleteFirestore extends MixinBase {
|
|
1174
|
+
delete(identifiers) {
|
|
1175
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1176
|
+
yield this.collection(this.buildCollectionPathForRemove(identifiers))
|
|
1177
|
+
.doc(Object.values(identifiers).shift().toString())
|
|
1178
|
+
.delete();
|
|
1179
|
+
});
|
|
1180
|
+
}
|
|
1181
|
+
buildCollectionPathForRemove(identifiers) {
|
|
1182
|
+
return this.isSubCollection(this)
|
|
1183
|
+
? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
|
|
1184
|
+
: this.collectionName;
|
|
1185
|
+
}
|
|
1186
|
+
};
|
|
1187
1187
|
};
|
|
1188
1188
|
|
|
1189
|
-
const withSubCollection = (MixinBase, ParentModel) => {
|
|
1190
|
-
return class SubCollectionMix extends MixinBase {
|
|
1191
|
-
constructor(...args) {
|
|
1192
|
-
super(args);
|
|
1193
|
-
}
|
|
1194
|
-
collection(path) {
|
|
1195
|
-
return super.collection(path);
|
|
1196
|
-
}
|
|
1197
|
-
};
|
|
1189
|
+
const withSubCollection = (MixinBase, ParentModel) => {
|
|
1190
|
+
return class SubCollectionMix extends MixinBase {
|
|
1191
|
+
constructor(...args) {
|
|
1192
|
+
super(args);
|
|
1193
|
+
}
|
|
1194
|
+
collection(path) {
|
|
1195
|
+
return super.collection(path);
|
|
1196
|
+
}
|
|
1197
|
+
};
|
|
1198
1198
|
};
|
|
1199
1199
|
|
|
1200
|
-
const withCrudFirestore = (MixinBase) => {
|
|
1201
|
-
return class CrudFirestore extends withUpdateFirestore(withGetFirestore(withFindFirestore(withDeleteFirestore(withCreateFirestore(MixinBase))))) {
|
|
1202
|
-
};
|
|
1200
|
+
const withCrudFirestore = (MixinBase) => {
|
|
1201
|
+
return class CrudFirestore extends withUpdateFirestore(withGetFirestore(withFindFirestore(withDeleteFirestore(withCreateFirestore(MixinBase))))) {
|
|
1202
|
+
};
|
|
1203
1203
|
};
|
|
1204
1204
|
|
|
1205
|
-
class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1206
|
-
constructor(firestore) {
|
|
1207
|
-
super();
|
|
1208
|
-
this.firestore = firestore;
|
|
1209
|
-
this.collectionName = 'subscription';
|
|
1210
|
-
this.model = Subscription;
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
class UserSearch extends BaseModel {
|
|
1215
|
-
identifierFields() {
|
|
1216
|
-
return ['id'];
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
|
-
class UserSearchFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1221
|
-
constructor(firestore) {
|
|
1222
|
-
super();
|
|
1223
|
-
this.firestore = firestore;
|
|
1224
|
-
this.collectionName = 'userSearch';
|
|
1225
|
-
this.model = UserSearch;
|
|
1226
|
-
}
|
|
1227
|
-
}
|
|
1228
|
-
|
|
1229
|
-
class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1230
|
-
constructor(firestore, userSearchFirestoreRepository = new UserSearchFirestoreRepository(firestore)) {
|
|
1231
|
-
super();
|
|
1232
|
-
this.firestore = firestore;
|
|
1233
|
-
this.userSearchFirestoreRepository = userSearchFirestoreRepository;
|
|
1234
|
-
this.collectionName = 'users';
|
|
1235
|
-
this.model = User;
|
|
1236
|
-
}
|
|
1237
|
-
get(identifiers) {
|
|
1238
|
-
const _super = Object.create(null, {
|
|
1239
|
-
get: { get: () => super.get }
|
|
1240
|
-
});
|
|
1241
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1242
|
-
const user = yield _super.get.call(this, { id: identifiers.id });
|
|
1243
|
-
user.beautyProfile = yield this.getBeautyProfile(user.id);
|
|
1244
|
-
user.isSubscriber = yield this.checkIfIsSubscriber(user.id);
|
|
1245
|
-
return user;
|
|
1246
|
-
});
|
|
1247
|
-
}
|
|
1248
|
-
checkIfExistsByField(field, value) {
|
|
1249
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1250
|
-
const result = yield this.userSearchFirestoreRepository.find([{ [field]: { operator: Where.EQUALS, value } }]);
|
|
1251
|
-
return result.count > 0;
|
|
1252
|
-
});
|
|
1253
|
-
}
|
|
1254
|
-
buildModelInstance() {
|
|
1255
|
-
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
1256
|
-
return {
|
|
1257
|
-
toFirestore: (data) => {
|
|
1258
|
-
const plain = toFirestore(data);
|
|
1259
|
-
delete plain.isSubscriber;
|
|
1260
|
-
return plain;
|
|
1261
|
-
},
|
|
1262
|
-
fromFirestore,
|
|
1263
|
-
};
|
|
1264
|
-
}
|
|
1265
|
-
getBeautyProfile(userId) {
|
|
1266
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1267
|
-
const beautyProfile = yield this.collection()
|
|
1268
|
-
.doc(userId)
|
|
1269
|
-
.collection('CX')
|
|
1270
|
-
.withConverter(this.buildBeautyProfileModelInstance())
|
|
1271
|
-
.doc('beautyProfile')
|
|
1272
|
-
.get();
|
|
1273
|
-
return beautyProfile.data();
|
|
1274
|
-
});
|
|
1275
|
-
}
|
|
1276
|
-
checkIfIsSubscriber(userId) {
|
|
1277
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1278
|
-
const docs = yield this.firestore
|
|
1279
|
-
.collection('subscription')
|
|
1280
|
-
.where('user.id', '==', userId)
|
|
1281
|
-
.where('status', '==', 'active')
|
|
1282
|
-
.get();
|
|
1283
|
-
return !!docs && !!docs.size;
|
|
1284
|
-
});
|
|
1285
|
-
}
|
|
1286
|
-
buildBeautyProfileModelInstance() {
|
|
1287
|
-
return {
|
|
1288
|
-
toFirestore: (data) => data.toPlain(),
|
|
1289
|
-
fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
|
|
1290
|
-
};
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
|
|
1294
|
-
class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
|
|
1295
|
-
constructor(firestore, parentRepository) {
|
|
1296
|
-
super();
|
|
1297
|
-
this.firestore = firestore;
|
|
1298
|
-
this.parentRepository = parentRepository;
|
|
1299
|
-
this.collectionName = 'editions';
|
|
1300
|
-
this.parentIdField = 'subscriptionId';
|
|
1301
|
-
this.model = Edition;
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
|
-
class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
|
|
1306
|
-
constructor(firestore, parentRepository) {
|
|
1307
|
-
super();
|
|
1308
|
-
this.firestore = firestore;
|
|
1309
|
-
this.parentRepository = parentRepository;
|
|
1310
|
-
this.collectionName = 'CX';
|
|
1311
|
-
this.parentIdField = 'userId';
|
|
1312
|
-
this.model = BeautyProfile;
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
|
|
1316
|
-
class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
|
|
1317
|
-
constructor(firestore, parentRepository) {
|
|
1318
|
-
super();
|
|
1319
|
-
this.firestore = firestore;
|
|
1320
|
-
this.parentRepository = parentRepository;
|
|
1321
|
-
this.collectionName = 'address';
|
|
1322
|
-
this.parentIdField = 'userId';
|
|
1323
|
-
this.model = UserAddress;
|
|
1324
|
-
}
|
|
1325
|
-
}
|
|
1326
|
-
|
|
1327
|
-
class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
|
|
1328
|
-
constructor(firestore, parentRepository) {
|
|
1329
|
-
super();
|
|
1330
|
-
this.firestore = firestore;
|
|
1331
|
-
this.parentRepository = parentRepository;
|
|
1332
|
-
this.collectionName = 'payment_method';
|
|
1333
|
-
this.parentIdField = 'userId';
|
|
1334
|
-
this.model = UserPaymentMethod;
|
|
1335
|
-
}
|
|
1336
|
-
}
|
|
1337
|
-
|
|
1338
|
-
class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
|
|
1339
|
-
constructor(firestore, parentRepository) {
|
|
1340
|
-
super();
|
|
1341
|
-
this.firestore = firestore;
|
|
1342
|
-
this.parentRepository = parentRepository;
|
|
1343
|
-
this.collectionName = 'payments';
|
|
1344
|
-
this.parentIdField = 'subscriptionId';
|
|
1345
|
-
this.model = SubscriptionPayment;
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
|
|
1349
|
-
class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1350
|
-
constructor(firestore) {
|
|
1351
|
-
super();
|
|
1352
|
-
this.firestore = firestore;
|
|
1353
|
-
this.collectionName = 'leads';
|
|
1354
|
-
this.model = Lead;
|
|
1355
|
-
}
|
|
1356
|
-
}
|
|
1357
|
-
|
|
1358
|
-
class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1359
|
-
constructor(firestore) {
|
|
1360
|
-
super();
|
|
1361
|
-
this.firestore = firestore;
|
|
1362
|
-
this.collectionName = 'categories';
|
|
1363
|
-
this.model = Category;
|
|
1364
|
-
}
|
|
1365
|
-
getCategoryBySlug(slug, shop) {
|
|
1366
|
-
return this.collection(this.collectionName)
|
|
1367
|
-
.where('slug', '==', slug)
|
|
1368
|
-
.where('shop', '==', shop)
|
|
1369
|
-
.where('published', '==', true)
|
|
1370
|
-
.get()
|
|
1371
|
-
.then((snap) => {
|
|
1372
|
-
if (snap.size > 1)
|
|
1373
|
-
throw new DuplicatedResultsError('Query returned duplicated values');
|
|
1374
|
-
if (snap.empty)
|
|
1375
|
-
throw new NotFoundError(`Document with slug ${slug} not found`);
|
|
1376
|
-
return snap.docs[0].data();
|
|
1377
|
-
})
|
|
1378
|
-
.catch((error) => error);
|
|
1379
|
-
}
|
|
1380
|
-
getCategoriesForHome(categoryIds, limit = 4) {
|
|
1381
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1382
|
-
const categorySnap = yield this.collection(this.collectionName)
|
|
1383
|
-
.where('id', 'in', categoryIds)
|
|
1384
|
-
.where('published', '==', true)
|
|
1385
|
-
.get();
|
|
1386
|
-
if (categorySnap.empty)
|
|
1387
|
-
throw new NotFoundError('Categories not found');
|
|
1388
|
-
const categories = categorySnap.docs.map((doc) => doc.data());
|
|
1389
|
-
const homeSections = [];
|
|
1390
|
-
for (const category of categories) {
|
|
1391
|
-
const products = yield this.mountCategory(category);
|
|
1392
|
-
homeSections.push({
|
|
1393
|
-
category,
|
|
1394
|
-
products: products.filter((product) => product.stock.quantity > 0).splice(0, limit),
|
|
1395
|
-
});
|
|
1396
|
-
}
|
|
1397
|
-
return homeSections;
|
|
1398
|
-
});
|
|
1399
|
-
}
|
|
1400
|
-
mountCategory(category) {
|
|
1401
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1402
|
-
if (!category.products)
|
|
1403
|
-
throw new RequiredArgumentError(['Category products is empty']);
|
|
1404
|
-
const chunks = category.products.reduce((resultArray, item, index) => {
|
|
1405
|
-
const chunkIndex = Math.floor(index / 10);
|
|
1406
|
-
if (!resultArray[chunkIndex])
|
|
1407
|
-
resultArray[chunkIndex] = [];
|
|
1408
|
-
resultArray[chunkIndex].push(item);
|
|
1409
|
-
return resultArray;
|
|
1410
|
-
}, []);
|
|
1411
|
-
const products = [];
|
|
1412
|
-
const publishedField = category.shop === Shops.GLAMSHOP ? 'publishedGlam' : 'published';
|
|
1413
|
-
yield Promise.all(chunks.map((productIds) => __awaiter(this, void 0, void 0, function* () {
|
|
1414
|
-
const productSnap = yield this.collection('products')
|
|
1415
|
-
.where(publishedField, '==', true)
|
|
1416
|
-
.where('id', 'in', productIds)
|
|
1417
|
-
.get();
|
|
1418
|
-
if (productSnap.empty)
|
|
1419
|
-
return;
|
|
1420
|
-
products.push(...productSnap.docs.map((doc) => doc.data()));
|
|
1421
|
-
})));
|
|
1422
|
-
return products;
|
|
1423
|
-
});
|
|
1424
|
-
}
|
|
1425
|
-
}
|
|
1426
|
-
|
|
1427
|
-
class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1428
|
-
constructor(firestore) {
|
|
1429
|
-
super();
|
|
1430
|
-
this.firestore = firestore;
|
|
1431
|
-
this.collectionName = 'products';
|
|
1432
|
-
this.model = Product;
|
|
1433
|
-
}
|
|
1434
|
-
getBySlug(slug, shop) {
|
|
1435
|
-
var _a;
|
|
1436
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1437
|
-
const result = yield this.find([
|
|
1438
|
-
{ slug: { operator: Where.EQUALS, value: slug } },
|
|
1439
|
-
{ shopAvailability: { operator: Where.IN, value: [shop] } },
|
|
1440
|
-
]);
|
|
1441
|
-
return (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift();
|
|
1442
|
-
});
|
|
1443
|
-
}
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
|
-
class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Product) {
|
|
1447
|
-
constructor(firestore, parentRepository) {
|
|
1448
|
-
super();
|
|
1449
|
-
this.firestore = firestore;
|
|
1450
|
-
this.parentRepository = parentRepository;
|
|
1451
|
-
this.collectionName = 'variants';
|
|
1452
|
-
this.parentIdField = 'productId';
|
|
1453
|
-
this.model = Variant;
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
|
-
class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1458
|
-
constructor(firestore) {
|
|
1459
|
-
super();
|
|
1460
|
-
this.firestore = firestore;
|
|
1461
|
-
this.collectionName = 'subscriptionProducts';
|
|
1462
|
-
this.model = Product;
|
|
1463
|
-
}
|
|
1464
|
-
}
|
|
1465
|
-
|
|
1466
|
-
class CheckoutFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1467
|
-
constructor(firestore) {
|
|
1468
|
-
super();
|
|
1469
|
-
this.firestore = firestore;
|
|
1470
|
-
this.collectionName = 'checkouts';
|
|
1471
|
-
this.model = Checkout;
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
|
|
1475
|
-
class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1476
|
-
constructor(firestore) {
|
|
1477
|
-
super();
|
|
1478
|
-
this.firestore = firestore;
|
|
1479
|
-
this.collectionName = 'coupons';
|
|
1480
|
-
this.model = Coupon;
|
|
1481
|
-
}
|
|
1482
|
-
buildModelInstance() {
|
|
1483
|
-
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
1484
|
-
return {
|
|
1485
|
-
toFirestore: (data) => {
|
|
1486
|
-
const plain = toFirestore(data);
|
|
1487
|
-
if (!!data.expiresIn)
|
|
1488
|
-
plain.expiresIn = data.expiresIn.getTime();
|
|
1489
|
-
return plain;
|
|
1490
|
-
},
|
|
1491
|
-
fromFirestore: (snap) => {
|
|
1492
|
-
const instance = fromFirestore(snap);
|
|
1493
|
-
if (!isNil(instance.expiresIn))
|
|
1494
|
-
instance.expiresIn = new Date(snap.data().expiresIn);
|
|
1495
|
-
return instance;
|
|
1496
|
-
},
|
|
1497
|
-
};
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
|
|
1501
|
-
class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1502
|
-
constructor(firestore) {
|
|
1503
|
-
super();
|
|
1504
|
-
this.firestore = firestore;
|
|
1505
|
-
this.collectionName = 'orders';
|
|
1506
|
-
this.model = Order;
|
|
1507
|
-
}
|
|
1508
|
-
}
|
|
1509
|
-
|
|
1510
|
-
class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1511
|
-
constructor(firestore) {
|
|
1512
|
-
super();
|
|
1513
|
-
this.firestore = firestore;
|
|
1514
|
-
this.collectionName = 'payments';
|
|
1515
|
-
this.model = Payment;
|
|
1516
|
-
}
|
|
1517
|
-
}
|
|
1518
|
-
|
|
1519
|
-
class CheckoutSubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1520
|
-
constructor(firestore) {
|
|
1521
|
-
super();
|
|
1522
|
-
this.firestore = firestore;
|
|
1523
|
-
this.collectionName = 'checkoutsSubscription';
|
|
1524
|
-
this.model = CheckoutSubscription;
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
1527
|
-
|
|
1528
|
-
class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1529
|
-
constructor(firestore) {
|
|
1530
|
-
super();
|
|
1531
|
-
this.firestore = firestore;
|
|
1532
|
-
this.collectionName = 'subscriptionPlans';
|
|
1533
|
-
this.model = SubscriptionPlan;
|
|
1534
|
-
}
|
|
1535
|
-
}
|
|
1536
|
-
|
|
1537
|
-
class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1538
|
-
constructor(firestore) {
|
|
1539
|
-
super();
|
|
1540
|
-
this.firestore = firestore;
|
|
1541
|
-
this.collectionName = 'buy2win';
|
|
1542
|
-
this.model = Buy2Win;
|
|
1543
|
-
}
|
|
1544
|
-
}
|
|
1545
|
-
|
|
1546
|
-
class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
|
|
1547
|
-
constructor(firestore) {
|
|
1548
|
-
super(firestore);
|
|
1549
|
-
this.firestore = firestore;
|
|
1550
|
-
this.collectionName = 'legacyOrders';
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
1553
|
-
|
|
1554
|
-
class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1555
|
-
constructor(firestore) {
|
|
1556
|
-
super();
|
|
1557
|
-
this.firestore = firestore;
|
|
1558
|
-
this.collectionName = 'dms';
|
|
1559
|
-
this.model = Home;
|
|
1560
|
-
}
|
|
1561
|
-
}
|
|
1562
|
-
|
|
1563
|
-
class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1564
|
-
constructor(firestore) {
|
|
1565
|
-
super();
|
|
1566
|
-
this.firestore = firestore;
|
|
1567
|
-
this.collectionName = 'shopMenus';
|
|
1568
|
-
this.model = ShopMenu;
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
|
|
1572
|
-
class AuthenticationFirebaseAuthService {
|
|
1573
|
-
constructor(firebaseAuth) {
|
|
1574
|
-
this.firebaseAuth = firebaseAuth;
|
|
1575
|
-
}
|
|
1576
|
-
signInWithEmailAndPassword(data) {
|
|
1577
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1578
|
-
const credentials = yield this.firebaseAuth.signInWithEmailAndPassword(data.email, data.password);
|
|
1579
|
-
const user = credentials.user;
|
|
1580
|
-
return {
|
|
1581
|
-
id: user.uid,
|
|
1582
|
-
displayName: user.displayName,
|
|
1583
|
-
email: user.email,
|
|
1584
|
-
phone: user.phoneNumber,
|
|
1585
|
-
isAnonymous: false,
|
|
1586
|
-
};
|
|
1587
|
-
});
|
|
1588
|
-
}
|
|
1589
|
-
signInWithGoogle() {
|
|
1590
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1591
|
-
const credentials = yield this.firebaseAuth.signInWithPopup(new firebase$1.auth.GoogleAuthProvider());
|
|
1592
|
-
const user = credentials.user;
|
|
1593
|
-
return {
|
|
1594
|
-
id: user.uid,
|
|
1595
|
-
displayName: user.displayName,
|
|
1596
|
-
email: user.email,
|
|
1597
|
-
phone: user.phoneNumber,
|
|
1598
|
-
isAnonymous: false,
|
|
1599
|
-
};
|
|
1600
|
-
});
|
|
1601
|
-
}
|
|
1602
|
-
signOut() {
|
|
1603
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1604
|
-
this.firebaseAuth.signOut();
|
|
1605
|
-
});
|
|
1606
|
-
}
|
|
1607
|
-
signInAnonymously() {
|
|
1608
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1609
|
-
const auth = yield this.firebaseAuth.signInAnonymously();
|
|
1610
|
-
const user = auth.user;
|
|
1611
|
-
user.id = auth.user.uid;
|
|
1612
|
-
return user;
|
|
1613
|
-
});
|
|
1614
|
-
}
|
|
1615
|
-
sendPasswordResetEmail(email) {
|
|
1616
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1617
|
-
return this.firebaseAuth.sendPasswordResetEmail(email);
|
|
1618
|
-
});
|
|
1619
|
-
}
|
|
1620
|
-
}
|
|
1621
|
-
|
|
1622
|
-
class RegisterFirebaseAuthService {
|
|
1623
|
-
constructor(firebaseAuth) {
|
|
1624
|
-
this.firebaseAuth = firebaseAuth;
|
|
1625
|
-
}
|
|
1626
|
-
register(params) {
|
|
1627
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1628
|
-
try {
|
|
1629
|
-
const auth = yield this.firebaseAuth.createUserWithEmailAndPassword(params.email, params.password);
|
|
1630
|
-
const user = auth.user;
|
|
1631
|
-
user.sendEmailVerification();
|
|
1632
|
-
user.id = auth.user.uid;
|
|
1633
|
-
return user;
|
|
1634
|
-
}
|
|
1635
|
-
catch (error) {
|
|
1636
|
-
if (error.code === 'auth/email-already-in-use')
|
|
1637
|
-
throw new UserAlreadyRegisteredError('Email already registered');
|
|
1638
|
-
if (error.code === 'auth/weak-password')
|
|
1639
|
-
throw new WeakPasswordError();
|
|
1640
|
-
throw error;
|
|
1641
|
-
}
|
|
1642
|
-
});
|
|
1643
|
-
}
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
|
-
/**
|
|
1647
|
-
* Generated bundle index. Do not edit.
|
|
1205
|
+
class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1206
|
+
constructor(firestore) {
|
|
1207
|
+
super();
|
|
1208
|
+
this.firestore = firestore;
|
|
1209
|
+
this.collectionName = 'subscription';
|
|
1210
|
+
this.model = Subscription;
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
class UserSearch extends BaseModel {
|
|
1215
|
+
identifierFields() {
|
|
1216
|
+
return ['id'];
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
class UserSearchFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1221
|
+
constructor(firestore) {
|
|
1222
|
+
super();
|
|
1223
|
+
this.firestore = firestore;
|
|
1224
|
+
this.collectionName = 'userSearch';
|
|
1225
|
+
this.model = UserSearch;
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1230
|
+
constructor(firestore, userSearchFirestoreRepository = new UserSearchFirestoreRepository(firestore)) {
|
|
1231
|
+
super();
|
|
1232
|
+
this.firestore = firestore;
|
|
1233
|
+
this.userSearchFirestoreRepository = userSearchFirestoreRepository;
|
|
1234
|
+
this.collectionName = 'users';
|
|
1235
|
+
this.model = User;
|
|
1236
|
+
}
|
|
1237
|
+
get(identifiers) {
|
|
1238
|
+
const _super = Object.create(null, {
|
|
1239
|
+
get: { get: () => super.get }
|
|
1240
|
+
});
|
|
1241
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1242
|
+
const user = yield _super.get.call(this, { id: identifiers.id });
|
|
1243
|
+
user.beautyProfile = yield this.getBeautyProfile(user.id);
|
|
1244
|
+
user.isSubscriber = yield this.checkIfIsSubscriber(user.id);
|
|
1245
|
+
return user;
|
|
1246
|
+
});
|
|
1247
|
+
}
|
|
1248
|
+
checkIfExistsByField(field, value) {
|
|
1249
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1250
|
+
const result = yield this.userSearchFirestoreRepository.find([{ [field]: { operator: Where.EQUALS, value } }]);
|
|
1251
|
+
return result.count > 0;
|
|
1252
|
+
});
|
|
1253
|
+
}
|
|
1254
|
+
buildModelInstance() {
|
|
1255
|
+
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
1256
|
+
return {
|
|
1257
|
+
toFirestore: (data) => {
|
|
1258
|
+
const plain = toFirestore(data);
|
|
1259
|
+
delete plain.isSubscriber;
|
|
1260
|
+
return plain;
|
|
1261
|
+
},
|
|
1262
|
+
fromFirestore,
|
|
1263
|
+
};
|
|
1264
|
+
}
|
|
1265
|
+
getBeautyProfile(userId) {
|
|
1266
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1267
|
+
const beautyProfile = yield this.collection()
|
|
1268
|
+
.doc(userId)
|
|
1269
|
+
.collection('CX')
|
|
1270
|
+
.withConverter(this.buildBeautyProfileModelInstance())
|
|
1271
|
+
.doc('beautyProfile')
|
|
1272
|
+
.get();
|
|
1273
|
+
return beautyProfile.data();
|
|
1274
|
+
});
|
|
1275
|
+
}
|
|
1276
|
+
checkIfIsSubscriber(userId) {
|
|
1277
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1278
|
+
const docs = yield this.firestore
|
|
1279
|
+
.collection('subscription')
|
|
1280
|
+
.where('user.id', '==', userId)
|
|
1281
|
+
.where('status', '==', 'active')
|
|
1282
|
+
.get();
|
|
1283
|
+
return !!docs && !!docs.size;
|
|
1284
|
+
});
|
|
1285
|
+
}
|
|
1286
|
+
buildBeautyProfileModelInstance() {
|
|
1287
|
+
return {
|
|
1288
|
+
toFirestore: (data) => data.toPlain(),
|
|
1289
|
+
fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
|
|
1290
|
+
};
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
|
|
1295
|
+
constructor(firestore, parentRepository) {
|
|
1296
|
+
super();
|
|
1297
|
+
this.firestore = firestore;
|
|
1298
|
+
this.parentRepository = parentRepository;
|
|
1299
|
+
this.collectionName = 'editions';
|
|
1300
|
+
this.parentIdField = 'subscriptionId';
|
|
1301
|
+
this.model = Edition;
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
|
|
1306
|
+
constructor(firestore, parentRepository) {
|
|
1307
|
+
super();
|
|
1308
|
+
this.firestore = firestore;
|
|
1309
|
+
this.parentRepository = parentRepository;
|
|
1310
|
+
this.collectionName = 'CX';
|
|
1311
|
+
this.parentIdField = 'userId';
|
|
1312
|
+
this.model = BeautyProfile;
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
|
|
1317
|
+
constructor(firestore, parentRepository) {
|
|
1318
|
+
super();
|
|
1319
|
+
this.firestore = firestore;
|
|
1320
|
+
this.parentRepository = parentRepository;
|
|
1321
|
+
this.collectionName = 'address';
|
|
1322
|
+
this.parentIdField = 'userId';
|
|
1323
|
+
this.model = UserAddress;
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
|
|
1328
|
+
constructor(firestore, parentRepository) {
|
|
1329
|
+
super();
|
|
1330
|
+
this.firestore = firestore;
|
|
1331
|
+
this.parentRepository = parentRepository;
|
|
1332
|
+
this.collectionName = 'payment_method';
|
|
1333
|
+
this.parentIdField = 'userId';
|
|
1334
|
+
this.model = UserPaymentMethod;
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
|
|
1339
|
+
constructor(firestore, parentRepository) {
|
|
1340
|
+
super();
|
|
1341
|
+
this.firestore = firestore;
|
|
1342
|
+
this.parentRepository = parentRepository;
|
|
1343
|
+
this.collectionName = 'payments';
|
|
1344
|
+
this.parentIdField = 'subscriptionId';
|
|
1345
|
+
this.model = SubscriptionPayment;
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1350
|
+
constructor(firestore) {
|
|
1351
|
+
super();
|
|
1352
|
+
this.firestore = firestore;
|
|
1353
|
+
this.collectionName = 'leads';
|
|
1354
|
+
this.model = Lead;
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1359
|
+
constructor(firestore) {
|
|
1360
|
+
super();
|
|
1361
|
+
this.firestore = firestore;
|
|
1362
|
+
this.collectionName = 'categories';
|
|
1363
|
+
this.model = Category;
|
|
1364
|
+
}
|
|
1365
|
+
getCategoryBySlug(slug, shop) {
|
|
1366
|
+
return this.collection(this.collectionName)
|
|
1367
|
+
.where('slug', '==', slug)
|
|
1368
|
+
.where('shop', '==', shop)
|
|
1369
|
+
.where('published', '==', true)
|
|
1370
|
+
.get()
|
|
1371
|
+
.then((snap) => {
|
|
1372
|
+
if (snap.size > 1)
|
|
1373
|
+
throw new DuplicatedResultsError('Query returned duplicated values');
|
|
1374
|
+
if (snap.empty)
|
|
1375
|
+
throw new NotFoundError(`Document with slug ${slug} not found`);
|
|
1376
|
+
return snap.docs[0].data();
|
|
1377
|
+
})
|
|
1378
|
+
.catch((error) => error);
|
|
1379
|
+
}
|
|
1380
|
+
getCategoriesForHome(categoryIds, limit = 4) {
|
|
1381
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1382
|
+
const categorySnap = yield this.collection(this.collectionName)
|
|
1383
|
+
.where('id', 'in', categoryIds)
|
|
1384
|
+
.where('published', '==', true)
|
|
1385
|
+
.get();
|
|
1386
|
+
if (categorySnap.empty)
|
|
1387
|
+
throw new NotFoundError('Categories not found');
|
|
1388
|
+
const categories = categorySnap.docs.map((doc) => doc.data());
|
|
1389
|
+
const homeSections = [];
|
|
1390
|
+
for (const category of categories) {
|
|
1391
|
+
const products = yield this.mountCategory(category);
|
|
1392
|
+
homeSections.push({
|
|
1393
|
+
category,
|
|
1394
|
+
products: products.filter((product) => product.stock.quantity > 0).splice(0, limit),
|
|
1395
|
+
});
|
|
1396
|
+
}
|
|
1397
|
+
return homeSections;
|
|
1398
|
+
});
|
|
1399
|
+
}
|
|
1400
|
+
mountCategory(category) {
|
|
1401
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1402
|
+
if (!category.products)
|
|
1403
|
+
throw new RequiredArgumentError(['Category products is empty']);
|
|
1404
|
+
const chunks = category.products.reduce((resultArray, item, index) => {
|
|
1405
|
+
const chunkIndex = Math.floor(index / 10);
|
|
1406
|
+
if (!resultArray[chunkIndex])
|
|
1407
|
+
resultArray[chunkIndex] = [];
|
|
1408
|
+
resultArray[chunkIndex].push(item);
|
|
1409
|
+
return resultArray;
|
|
1410
|
+
}, []);
|
|
1411
|
+
const products = [];
|
|
1412
|
+
const publishedField = category.shop === Shops.GLAMSHOP ? 'publishedGlam' : 'published';
|
|
1413
|
+
yield Promise.all(chunks.map((productIds) => __awaiter(this, void 0, void 0, function* () {
|
|
1414
|
+
const productSnap = yield this.collection('products')
|
|
1415
|
+
.where(publishedField, '==', true)
|
|
1416
|
+
.where('id', 'in', productIds)
|
|
1417
|
+
.get();
|
|
1418
|
+
if (productSnap.empty)
|
|
1419
|
+
return;
|
|
1420
|
+
products.push(...productSnap.docs.map((doc) => doc.data()));
|
|
1421
|
+
})));
|
|
1422
|
+
return products;
|
|
1423
|
+
});
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1428
|
+
constructor(firestore) {
|
|
1429
|
+
super();
|
|
1430
|
+
this.firestore = firestore;
|
|
1431
|
+
this.collectionName = 'products';
|
|
1432
|
+
this.model = Product;
|
|
1433
|
+
}
|
|
1434
|
+
getBySlug(slug, shop) {
|
|
1435
|
+
var _a;
|
|
1436
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1437
|
+
const result = yield this.find([
|
|
1438
|
+
{ slug: { operator: Where.EQUALS, value: slug } },
|
|
1439
|
+
{ shopAvailability: { operator: Where.IN, value: [shop] } },
|
|
1440
|
+
]);
|
|
1441
|
+
return (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift();
|
|
1442
|
+
});
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Product) {
|
|
1447
|
+
constructor(firestore, parentRepository) {
|
|
1448
|
+
super();
|
|
1449
|
+
this.firestore = firestore;
|
|
1450
|
+
this.parentRepository = parentRepository;
|
|
1451
|
+
this.collectionName = 'variants';
|
|
1452
|
+
this.parentIdField = 'productId';
|
|
1453
|
+
this.model = Variant;
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1458
|
+
constructor(firestore) {
|
|
1459
|
+
super();
|
|
1460
|
+
this.firestore = firestore;
|
|
1461
|
+
this.collectionName = 'subscriptionProducts';
|
|
1462
|
+
this.model = Product;
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
class CheckoutFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1467
|
+
constructor(firestore) {
|
|
1468
|
+
super();
|
|
1469
|
+
this.firestore = firestore;
|
|
1470
|
+
this.collectionName = 'checkouts';
|
|
1471
|
+
this.model = Checkout;
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1476
|
+
constructor(firestore) {
|
|
1477
|
+
super();
|
|
1478
|
+
this.firestore = firestore;
|
|
1479
|
+
this.collectionName = 'coupons';
|
|
1480
|
+
this.model = Coupon;
|
|
1481
|
+
}
|
|
1482
|
+
buildModelInstance() {
|
|
1483
|
+
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
1484
|
+
return {
|
|
1485
|
+
toFirestore: (data) => {
|
|
1486
|
+
const plain = toFirestore(data);
|
|
1487
|
+
if (!!data.expiresIn)
|
|
1488
|
+
plain.expiresIn = data.expiresIn.getTime();
|
|
1489
|
+
return plain;
|
|
1490
|
+
},
|
|
1491
|
+
fromFirestore: (snap) => {
|
|
1492
|
+
const instance = fromFirestore(snap);
|
|
1493
|
+
if (!isNil(instance.expiresIn))
|
|
1494
|
+
instance.expiresIn = new Date(snap.data().expiresIn);
|
|
1495
|
+
return instance;
|
|
1496
|
+
},
|
|
1497
|
+
};
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1502
|
+
constructor(firestore) {
|
|
1503
|
+
super();
|
|
1504
|
+
this.firestore = firestore;
|
|
1505
|
+
this.collectionName = 'orders';
|
|
1506
|
+
this.model = Order;
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1511
|
+
constructor(firestore) {
|
|
1512
|
+
super();
|
|
1513
|
+
this.firestore = firestore;
|
|
1514
|
+
this.collectionName = 'payments';
|
|
1515
|
+
this.model = Payment;
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
class CheckoutSubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1520
|
+
constructor(firestore) {
|
|
1521
|
+
super();
|
|
1522
|
+
this.firestore = firestore;
|
|
1523
|
+
this.collectionName = 'checkoutsSubscription';
|
|
1524
|
+
this.model = CheckoutSubscription;
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1529
|
+
constructor(firestore) {
|
|
1530
|
+
super();
|
|
1531
|
+
this.firestore = firestore;
|
|
1532
|
+
this.collectionName = 'subscriptionPlans';
|
|
1533
|
+
this.model = SubscriptionPlan;
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1538
|
+
constructor(firestore) {
|
|
1539
|
+
super();
|
|
1540
|
+
this.firestore = firestore;
|
|
1541
|
+
this.collectionName = 'buy2win';
|
|
1542
|
+
this.model = Buy2Win;
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
|
|
1547
|
+
constructor(firestore) {
|
|
1548
|
+
super(firestore);
|
|
1549
|
+
this.firestore = firestore;
|
|
1550
|
+
this.collectionName = 'legacyOrders';
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1555
|
+
constructor(firestore) {
|
|
1556
|
+
super();
|
|
1557
|
+
this.firestore = firestore;
|
|
1558
|
+
this.collectionName = 'dms';
|
|
1559
|
+
this.model = Home;
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1564
|
+
constructor(firestore) {
|
|
1565
|
+
super();
|
|
1566
|
+
this.firestore = firestore;
|
|
1567
|
+
this.collectionName = 'shopMenus';
|
|
1568
|
+
this.model = ShopMenu;
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
class AuthenticationFirebaseAuthService {
|
|
1573
|
+
constructor(firebaseAuth) {
|
|
1574
|
+
this.firebaseAuth = firebaseAuth;
|
|
1575
|
+
}
|
|
1576
|
+
signInWithEmailAndPassword(data) {
|
|
1577
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1578
|
+
const credentials = yield this.firebaseAuth.signInWithEmailAndPassword(data.email, data.password);
|
|
1579
|
+
const user = credentials.user;
|
|
1580
|
+
return {
|
|
1581
|
+
id: user.uid,
|
|
1582
|
+
displayName: user.displayName,
|
|
1583
|
+
email: user.email,
|
|
1584
|
+
phone: user.phoneNumber,
|
|
1585
|
+
isAnonymous: false,
|
|
1586
|
+
};
|
|
1587
|
+
});
|
|
1588
|
+
}
|
|
1589
|
+
signInWithGoogle() {
|
|
1590
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1591
|
+
const credentials = yield this.firebaseAuth.signInWithPopup(new firebase$1.auth.GoogleAuthProvider());
|
|
1592
|
+
const user = credentials.user;
|
|
1593
|
+
return {
|
|
1594
|
+
id: user.uid,
|
|
1595
|
+
displayName: user.displayName,
|
|
1596
|
+
email: user.email,
|
|
1597
|
+
phone: user.phoneNumber,
|
|
1598
|
+
isAnonymous: false,
|
|
1599
|
+
};
|
|
1600
|
+
});
|
|
1601
|
+
}
|
|
1602
|
+
signOut() {
|
|
1603
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1604
|
+
this.firebaseAuth.signOut();
|
|
1605
|
+
});
|
|
1606
|
+
}
|
|
1607
|
+
signInAnonymously() {
|
|
1608
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1609
|
+
const auth = yield this.firebaseAuth.signInAnonymously();
|
|
1610
|
+
const user = auth.user;
|
|
1611
|
+
user.id = auth.user.uid;
|
|
1612
|
+
return user;
|
|
1613
|
+
});
|
|
1614
|
+
}
|
|
1615
|
+
sendPasswordResetEmail(email) {
|
|
1616
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1617
|
+
return this.firebaseAuth.sendPasswordResetEmail(email);
|
|
1618
|
+
});
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
class RegisterFirebaseAuthService {
|
|
1623
|
+
constructor(firebaseAuth) {
|
|
1624
|
+
this.firebaseAuth = firebaseAuth;
|
|
1625
|
+
}
|
|
1626
|
+
register(params) {
|
|
1627
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1628
|
+
try {
|
|
1629
|
+
const auth = yield this.firebaseAuth.createUserWithEmailAndPassword(params.email, params.password);
|
|
1630
|
+
const user = auth.user;
|
|
1631
|
+
user.sendEmailVerification();
|
|
1632
|
+
user.id = auth.user.uid;
|
|
1633
|
+
return user;
|
|
1634
|
+
}
|
|
1635
|
+
catch (error) {
|
|
1636
|
+
if (error.code === 'auth/email-already-in-use')
|
|
1637
|
+
throw new UserAlreadyRegisteredError('Email already registered');
|
|
1638
|
+
if (error.code === 'auth/weak-password')
|
|
1639
|
+
throw new WeakPasswordError();
|
|
1640
|
+
throw error;
|
|
1641
|
+
}
|
|
1642
|
+
});
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
/**
|
|
1647
|
+
* Generated bundle index. Do not edit.
|
|
1648
1648
|
*/
|
|
1649
1649
|
|
|
1650
1650
|
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Category, CategoryFirestoreRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, FilterType, FinancialCoupon, FragranceImportances, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductSpents, ProductVariantFirestoreRepository, QuestionsFilters, RecoveryPassword, Register, RegisterFirebaseAuthService, RequiredArgumentError, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserSearchFirestoreRepository, UserType, Variant, WeakPasswordError, Where, withCreateFirestore, withCrudFirestore, withDeleteFirestore, withFindFirestore, withFirestore, withGetFirestore, withHelpers, withSubCollection, withUpdateFirestore };
|