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