@infrab4a/connect 1.0.0-beta.29 → 1.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/infrab4a-connect.umd.js +278 -2234
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/esm2015/infrab4a-connect.js +2 -2
- package/esm2015/lib/domain/catalog/index.js +3 -0
- package/esm2015/lib/domain/catalog/models/category.js +7 -0
- package/esm2015/lib/domain/catalog/models/enums/index.js +2 -0
- package/esm2015/lib/domain/catalog/models/enums/shops.enum.js +6 -0
- package/esm2015/lib/domain/catalog/models/index.js +6 -0
- package/esm2015/lib/domain/catalog/models/product.js +11 -0
- package/esm2015/lib/domain/catalog/models/types/category-condition.type.js +2 -0
- package/esm2015/lib/domain/catalog/models/types/category-filter.type.js +2 -0
- package/esm2015/lib/domain/catalog/models/types/index.js +8 -0
- package/esm2015/lib/domain/catalog/models/types/product-review.type.js +2 -0
- package/esm2015/lib/domain/catalog/models/types/shops-description.type.js +2 -0
- package/esm2015/lib/domain/catalog/models/types/shops-price.type.js +2 -0
- package/esm2015/lib/domain/catalog/models/types/stock.type.js +2 -0
- package/esm2015/lib/domain/catalog/models/types/variant-grade.type.js +2 -0
- package/esm2015/lib/domain/catalog/models/variant.js +7 -0
- package/esm2015/lib/domain/catalog/repositories/category.repository.js +2 -0
- package/esm2015/lib/domain/catalog/repositories/index.js +5 -0
- package/esm2015/lib/domain/catalog/repositories/product.repository.js +2 -0
- package/esm2015/lib/domain/catalog/repositories/subscription-product.repository.js +2 -0
- package/esm2015/lib/domain/catalog/repositories/variant.repository.js +2 -0
- package/esm2015/lib/domain/general/index.js +3 -0
- package/esm2015/lib/domain/general/model/base-model-with-identifier-fields.js +2 -0
- package/esm2015/lib/domain/general/model/base.model.js +13 -0
- package/esm2015/lib/domain/general/model/identifier-fields.js +2 -0
- package/esm2015/lib/domain/general/model/index.js +5 -0
- package/esm2015/lib/domain/general/model/types/base-model-builder.type.js +2 -0
- package/esm2015/lib/domain/general/model/types/index.js +4 -0
- package/esm2015/lib/domain/general/model/types/non-function-properties.type.js +2 -0
- package/esm2015/lib/domain/general/model/types/non-function-property-name.type.js +2 -0
- package/esm2015/lib/domain/general/repository/create.repository.js +2 -0
- package/esm2015/lib/domain/general/repository/crud.repository.js +2 -0
- package/esm2015/lib/domain/general/repository/delete.repository.js +2 -0
- package/esm2015/lib/domain/general/repository/enums/index.js +3 -0
- package/esm2015/lib/domain/general/repository/enums/update-option-actions.enum.js +9 -0
- package/esm2015/lib/domain/general/repository/enums/where.enum.js +12 -0
- package/esm2015/lib/domain/general/repository/find.repository.js +2 -0
- package/esm2015/lib/domain/general/repository/get.repository.js +2 -0
- package/esm2015/lib/domain/general/repository/index.js +10 -0
- package/esm2015/lib/domain/general/repository/read.repository.js +2 -0
- package/esm2015/lib/domain/general/repository/types/index.js +6 -0
- package/esm2015/lib/domain/general/repository/types/repository-find-filters.type.js +2 -0
- package/esm2015/lib/domain/general/repository/types/repository-find-result.type.js +2 -0
- package/esm2015/lib/domain/general/repository/types/repository-limit-options.type.js +2 -0
- package/esm2015/lib/domain/general/repository/types/repository-order-by-list.type.js +2 -0
- package/esm2015/lib/domain/general/repository/types/repository-update-params.type.js +2 -0
- package/esm2015/lib/domain/general/repository/update.repository.js +2 -0
- package/esm2015/lib/domain/index.js +7 -0
- package/esm2015/lib/domain/location/index.js +2 -0
- package/esm2015/lib/domain/location/models/address.js +4 -0
- package/esm2015/lib/domain/location/models/index.js +3 -0
- package/esm2015/lib/domain/location/models/types/index.js +4 -0
- package/esm2015/lib/domain/location/models/types/location-bound.type.js +2 -0
- package/esm2015/lib/domain/location/models/types/location-geometry.type.js +2 -0
- package/esm2015/lib/domain/location/models/types/location-lat-lng.type.js +2 -0
- package/esm2015/lib/domain/shop-settings/enums/filter-type.enum.js +21 -0
- package/esm2015/lib/domain/shop-settings/enums/index.js +3 -0
- package/esm2015/lib/domain/shop-settings/enums/questions-filters.enum.js +21 -0
- package/esm2015/lib/domain/shop-settings/helpers/beauty-questions.helper.js +46 -0
- package/esm2015/lib/domain/shop-settings/helpers/index.js +2 -0
- package/esm2015/lib/domain/shop-settings/index.js +5 -0
- package/esm2015/lib/domain/shop-settings/models/home.js +7 -0
- package/esm2015/lib/domain/shop-settings/models/index.js +4 -0
- package/esm2015/lib/domain/shop-settings/models/shop-menu.js +7 -0
- package/esm2015/lib/domain/shop-settings/models/types/banner.type.js +2 -0
- package/esm2015/lib/domain/shop-settings/models/types/benefit.type.js +2 -0
- package/esm2015/lib/domain/shop-settings/models/types/index.js +5 -0
- package/esm2015/lib/domain/shop-settings/models/types/menu-nav.type.js +2 -0
- package/esm2015/lib/domain/shop-settings/models/types/sub-menu.type.js +2 -0
- package/esm2015/lib/domain/shop-settings/repositories/home.repository.js +2 -0
- package/esm2015/lib/domain/shop-settings/repositories/index.js +3 -0
- package/esm2015/lib/domain/shop-settings/repositories/shop-menu.repository.js +2 -0
- package/esm2015/lib/domain/shopping/index.js +3 -0
- package/esm2015/lib/domain/shopping/models/buy-2-win.js +14 -0
- package/esm2015/lib/domain/shopping/models/checkout.js +46 -0
- package/esm2015/lib/domain/shopping/models/coupons/club-coupon.js +18 -0
- package/esm2015/lib/domain/shopping/models/coupons/coupon.js +31 -0
- package/esm2015/lib/domain/shopping/models/coupons/enums/discount-type.enum.js +7 -0
- package/esm2015/lib/domain/shopping/models/coupons/enums/exclusivities.enum.js +7 -0
- package/esm2015/lib/domain/shopping/models/coupons/enums/index.js +3 -0
- package/esm2015/lib/domain/shopping/models/coupons/index.js +5 -0
- package/esm2015/lib/domain/shopping/models/coupons/store-coupon.js +23 -0
- package/esm2015/lib/domain/shopping/models/enums/checkout-types.enum.js +6 -0
- package/esm2015/lib/domain/shopping/models/enums/index.js +3 -0
- package/esm2015/lib/domain/shopping/models/enums/order-status.enum.js +12 -0
- package/esm2015/lib/domain/shopping/models/index.js +12 -0
- package/esm2015/lib/domain/shopping/models/line-item.js +4 -0
- package/esm2015/lib/domain/shopping/models/order.js +11 -0
- package/esm2015/lib/domain/shopping/models/payment.js +169 -0
- package/esm2015/lib/domain/shopping/models/shipping-method.js +7 -0
- package/esm2015/lib/domain/shopping/models/subscription/checkout.js +28 -0
- package/esm2015/lib/domain/shopping/models/subscription/index.js +3 -0
- package/esm2015/lib/domain/shopping/models/subscription/plan.js +7 -0
- package/esm2015/lib/domain/shopping/models/types/index.js +8 -0
- package/esm2015/lib/domain/shopping/models/types/payment-address.type.js +2 -0
- package/esm2015/lib/domain/shopping/models/types/payment-billing.type.js +2 -0
- package/esm2015/lib/domain/shopping/models/types/payment-card.type.js +2 -0
- package/esm2015/lib/domain/shopping/models/types/payment-customer.type.js +2 -0
- package/esm2015/lib/domain/shopping/models/types/payment-document.type.js +2 -0
- package/esm2015/lib/domain/shopping/models/types/payment-item.type.js +2 -0
- package/esm2015/lib/domain/shopping/models/types/payment-shipping.type.js +2 -0
- package/esm2015/lib/domain/shopping/repositories/buy-2-win.repository.js +2 -0
- package/esm2015/lib/domain/shopping/repositories/checkout.repository.js +2 -0
- package/esm2015/lib/domain/shopping/repositories/coupon.repository.js +2 -0
- package/esm2015/lib/domain/shopping/repositories/index.js +8 -0
- package/esm2015/lib/domain/shopping/repositories/legacy-order.repository.js +2 -0
- package/esm2015/lib/domain/shopping/repositories/order.repository.js +2 -0
- package/esm2015/lib/domain/shopping/repositories/payment.repository.js +2 -0
- package/esm2015/lib/domain/shopping/repositories/subscription/checkout.repository.js +2 -0
- package/esm2015/lib/domain/shopping/repositories/subscription/index.js +3 -0
- package/esm2015/lib/domain/shopping/repositories/subscription/plan.repository.js +2 -0
- package/esm2015/lib/domain/users/errors/index.js +4 -0
- package/esm2015/lib/domain/users/errors/unauthorized.error.js +7 -0
- package/esm2015/lib/domain/users/errors/user-already-registered.error.js +7 -0
- package/esm2015/lib/domain/users/errors/weak-password.error.js +7 -0
- package/esm2015/lib/domain/users/index.js +6 -0
- package/esm2015/lib/domain/users/models/beauty-profile.js +12 -0
- package/esm2015/lib/domain/users/models/enums/accessory-importances.enum.js +7 -0
- package/esm2015/lib/domain/users/models/enums/area.enum.js +13 -0
- package/esm2015/lib/domain/users/models/enums/beard-problems.enum.js +11 -0
- package/esm2015/lib/domain/users/models/enums/beard-sizes.enum.js +9 -0
- package/esm2015/lib/domain/users/models/enums/beauty-product-importances.enum.js +8 -0
- package/esm2015/lib/domain/users/models/enums/body-problems.enum.js +13 -0
- package/esm2015/lib/domain/users/models/enums/body-shapes.enum.js +9 -0
- package/esm2015/lib/domain/users/models/enums/body-tattoos.enum.js +7 -0
- package/esm2015/lib/domain/users/models/enums/face-skin-oilinesses.enum.js +9 -0
- package/esm2015/lib/domain/users/models/enums/face-skin-problems.enum.js +12 -0
- package/esm2015/lib/domain/users/models/enums/face-skin-tones.enum.js +10 -0
- package/esm2015/lib/domain/users/models/enums/family-incomes.enum.js +10 -0
- package/esm2015/lib/domain/users/models/enums/fragrance-importances.enum.js +7 -0
- package/esm2015/lib/domain/users/models/enums/hair-colors.enum.js +12 -0
- package/esm2015/lib/domain/users/models/enums/hair-problems.enum.js +12 -0
- package/esm2015/lib/domain/users/models/enums/hair-strands.enum.js +10 -0
- package/esm2015/lib/domain/users/models/enums/hair-types.enum.js +9 -0
- package/esm2015/lib/domain/users/models/enums/index.js +21 -0
- package/esm2015/lib/domain/users/models/enums/office-position.enum.js +8 -0
- package/esm2015/lib/domain/users/models/enums/product-spents.enum.js +10 -0
- package/esm2015/lib/domain/users/models/enums/user-type.enum.js +10 -0
- package/esm2015/lib/domain/users/models/index.js +8 -0
- package/esm2015/lib/domain/users/models/lead.js +7 -0
- package/esm2015/lib/domain/users/models/subscription/edition.js +7 -0
- package/esm2015/lib/domain/users/models/subscription/enums/billing-status.enum.js +5 -0
- package/esm2015/lib/domain/users/models/subscription/enums/edition-status.enum.js +6 -0
- package/esm2015/lib/domain/users/models/subscription/enums/index.js +5 -0
- package/esm2015/lib/domain/users/models/subscription/enums/payment-type.enum.js +7 -0
- package/esm2015/lib/domain/users/models/subscription/enums/status.enum.js +6 -0
- package/esm2015/lib/domain/users/models/subscription/index.js +5 -0
- package/esm2015/lib/domain/users/models/subscription/payment.js +14 -0
- package/esm2015/lib/domain/users/models/subscription/subscription.js +43 -0
- package/esm2015/lib/domain/users/models/user-address.js +7 -0
- package/esm2015/lib/domain/users/models/user-payment-method.js +7 -0
- package/esm2015/lib/domain/users/models/user.js +26 -0
- package/esm2015/lib/domain/users/repositories/beauty-profile.repository.js +2 -0
- package/esm2015/lib/domain/users/repositories/edition.repository.js +2 -0
- package/esm2015/lib/domain/users/repositories/index.js +9 -0
- package/esm2015/lib/domain/users/repositories/lead.repository.js +2 -0
- package/esm2015/lib/domain/users/repositories/subscription-payment.repository.js +2 -0
- package/esm2015/lib/domain/users/repositories/subscription.repository.js +2 -0
- package/esm2015/lib/domain/users/repositories/user-address.repository.js +2 -0
- package/esm2015/lib/domain/users/repositories/user-payment-method.repository.js +2 -0
- package/esm2015/lib/domain/users/repositories/user.repository.js +2 -0
- package/esm2015/lib/domain/users/services/authentication.service.js +2 -0
- package/esm2015/lib/domain/users/services/index.js +4 -0
- package/esm2015/lib/domain/users/services/register.service.js +2 -0
- package/esm2015/lib/domain/users/services/types/basic-user-data.type.js +2 -0
- package/esm2015/lib/domain/users/services/types/index.js +2 -0
- package/esm2015/lib/domain/users/use-cases/authentication.js +40 -0
- package/esm2015/lib/domain/users/use-cases/index.js +4 -0
- package/esm2015/lib/domain/users/use-cases/register.js +34 -0
- package/esm2015/lib/domain/users/use-cases/signout.js +12 -0
- package/esm2015/lib/errors/duplicated-results.error.js +7 -0
- package/esm2015/lib/errors/index.js +5 -0
- package/esm2015/lib/errors/invalid-argument.error.js +7 -0
- package/esm2015/lib/errors/not-found.error.js +7 -0
- package/esm2015/lib/errors/required-argument.error.js +8 -0
- package/esm2015/lib/index.js +5 -0
- package/esm2015/lib/infra/firebase/auth/authentication-firebase-auth.service.js +47 -0
- package/esm2015/lib/infra/firebase/auth/index.js +3 -0
- package/esm2015/lib/infra/firebase/auth/register-firebase-auth.service.js +26 -0
- package/esm2015/lib/infra/firebase/auth/types/firebase-user-with-id.type.js +2 -0
- package/esm2015/lib/infra/firebase/firestore/index.js +4 -0
- package/esm2015/lib/infra/firebase/firestore/mixins/index.js +10 -0
- package/esm2015/lib/infra/firebase/firestore/mixins/with-create-firestore.mixin.js +31 -0
- package/esm2015/lib/infra/firebase/firestore/mixins/with-crud-firestore.mixin.js +10 -0
- package/esm2015/lib/infra/firebase/firestore/mixins/with-delete-firestore.mixin.js +18 -0
- package/esm2015/lib/infra/firebase/firestore/mixins/with-find-firestore.mixin.js +76 -0
- package/esm2015/lib/infra/firebase/firestore/mixins/with-firestore.mixin.js +26 -0
- package/esm2015/lib/infra/firebase/firestore/mixins/with-get-firestore.mixin.js +24 -0
- package/esm2015/lib/infra/firebase/firestore/mixins/with-helpers.mixin.js +17 -0
- package/esm2015/lib/infra/firebase/firestore/mixins/with-sub-collection.mixin.js +11 -0
- package/esm2015/lib/infra/firebase/firestore/mixins/with-update-firestore.mixin.js +45 -0
- package/esm2015/lib/infra/firebase/firestore/models/user-search.js +7 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/catalog/category-firestore.repository.js +78 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/catalog/index.js +5 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/catalog/product-firestore.repository.js +23 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.js +14 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.js +12 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/index.js +5 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.js +12 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/shop-settings/index.js +3 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.js +12 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.js +12 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.js +12 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.js +12 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.js +39 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/shopping/index.js +9 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.js +9 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/shopping/order-firestore.repository.js +12 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.js +12 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.js +12 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/users/index.js +10 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/users/lead-firestore.repository.js +12 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.js +14 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/users/subscription-firestore.repository.js +12 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.js +14 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/users/user-address-firestore.repository.js +14 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.js +14 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/users/user-firestore.repository.js +70 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.js +14 -0
- package/esm2015/lib/infra/firebase/firestore/repositories/users/user-search-firestore.repository.js +12 -0
- package/esm2015/lib/infra/firebase/firestore/types/firestore-sub.repository.type.js +2 -0
- package/esm2015/lib/infra/firebase/firestore/types/firestore.helpers.type.js +2 -0
- package/esm2015/lib/infra/firebase/firestore/types/firestore.repository.type.js +2 -0
- package/esm2015/lib/infra/firebase/firestore/types/index.js +4 -0
- package/esm2015/lib/infra/firebase/index.js +3 -0
- package/esm2015/lib/infra/index.js +2 -0
- package/esm2015/lib/utils/index.js +5 -0
- package/esm2015/lib/utils/mixins/base.mixin.js +6 -0
- package/esm2015/lib/utils/mixins/index.js +3 -0
- package/esm2015/lib/utils/mixins/mixin-ctor.type.js +2 -0
- package/esm2015/lib/utils/types/index.js +2 -0
- package/esm2015/lib/utils/types/prop.type.js +2 -0
- package/esm2015/public-api.js +3 -0
- package/fesm2015/infrab4a-connect.js +173 -1466
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/infrab4a-connect.d.ts +1 -1
- package/lib/domain/catalog/models/category.d.ts +22 -0
- package/lib/domain/catalog/models/enums/shops.enum.d.ts +4 -0
- package/lib/domain/catalog/models/index.d.ts +5 -0
- package/lib/domain/catalog/models/product.d.ts +33 -0
- package/lib/domain/catalog/models/types/product-review.type.d.ts +14 -0
- package/lib/domain/catalog/models/variant.d.ts +14 -0
- package/lib/domain/catalog/repositories/category.repository.d.ts +12 -0
- package/lib/domain/catalog/repositories/product.repository.d.ts +5 -0
- package/lib/domain/catalog/repositories/subscription-product.repository.d.ts +4 -0
- package/lib/domain/catalog/repositories/variant.repository.d.ts +4 -0
- package/lib/domain/general/model/base-model-with-identifier-fields.d.ts +3 -0
- package/lib/domain/general/model/base.model.d.ts +6 -0
- package/lib/domain/general/model/index.d.ts +4 -0
- package/lib/domain/general/model/types/base-model-builder.type.d.ts +5 -0
- package/lib/domain/general/model/types/index.d.ts +3 -0
- package/lib/domain/general/model/types/non-function-properties.type.d.ts +2 -0
- package/lib/domain/general/model/types/non-function-property-name.type.d.ts +3 -0
- package/lib/domain/general/repository/create.repository.d.ts +5 -0
- package/lib/domain/general/repository/crud.repository.d.ts +7 -0
- package/lib/domain/general/repository/delete.repository.d.ts +5 -0
- package/lib/domain/general/repository/enums/where.enum.d.ts +10 -0
- package/lib/domain/general/repository/find.repository.d.ts +5 -0
- package/lib/domain/general/repository/get.repository.d.ts +5 -0
- package/lib/domain/general/repository/read.repository.d.ts +5 -0
- package/lib/domain/general/repository/types/index.d.ts +5 -0
- package/lib/domain/general/repository/types/repository-find-filters.type.d.ts +14 -0
- package/lib/domain/general/repository/types/repository-update-params.type.d.ts +11 -0
- package/lib/domain/general/repository/update.repository.d.ts +5 -0
- package/lib/domain/index.d.ts +6 -0
- package/lib/domain/location/models/address.d.ts +21 -0
- package/lib/domain/shop-settings/models/home.d.ts +17 -0
- package/lib/domain/shop-settings/models/shop-menu.d.ts +7 -0
- package/lib/domain/shop-settings/models/types/index.d.ts +4 -0
- package/lib/domain/shop-settings/repositories/home.repository.d.ts +4 -0
- package/lib/domain/shop-settings/repositories/shop-menu.repository.d.ts +4 -0
- package/lib/domain/shopping/models/buy-2-win.d.ts +18 -0
- package/lib/domain/shopping/models/checkout.d.ts +28 -0
- package/lib/domain/shopping/models/coupons/club-coupon.d.ts +7 -0
- package/lib/domain/shopping/models/coupons/coupon.d.ts +28 -0
- package/lib/domain/shopping/models/coupons/enums/discount-type.enum.d.ts +5 -0
- package/lib/domain/shopping/models/coupons/enums/index.d.ts +2 -0
- package/lib/domain/shopping/models/coupons/index.d.ts +4 -0
- package/lib/domain/shopping/models/coupons/store-coupon.d.ts +8 -0
- package/lib/domain/shopping/models/payment.d.ts +69 -0
- package/lib/domain/shopping/models/shipping-method.d.ts +18 -0
- package/lib/domain/shopping/models/subscription/checkout.d.ts +23 -0
- package/lib/domain/shopping/models/subscription/plan.d.ts +12 -0
- package/lib/domain/shopping/repositories/buy-2-win.repository.d.ts +4 -0
- package/lib/domain/shopping/repositories/checkout.repository.d.ts +4 -0
- package/lib/domain/shopping/repositories/coupon.repository.d.ts +4 -0
- package/lib/domain/shopping/repositories/order.repository.d.ts +4 -0
- package/lib/domain/shopping/repositories/payment.repository.d.ts +4 -0
- package/lib/domain/shopping/repositories/subscription/checkout.repository.d.ts +4 -0
- package/lib/domain/shopping/repositories/subscription/plan.repository.d.ts +4 -0
- package/lib/domain/users/errors/unauthorized.error.d.ts +4 -0
- package/lib/domain/users/errors/user-already-registered.error.d.ts +4 -0
- package/lib/domain/users/errors/weak-password.error.d.ts +4 -0
- package/lib/domain/users/models/beauty-profile.d.ts +12 -0
- package/lib/domain/users/models/lead.d.ts +9 -0
- package/lib/domain/users/models/subscription/edition.d.ts +15 -0
- package/lib/domain/users/models/subscription/payment.d.ts +14 -0
- package/lib/domain/users/models/subscription/subscription.d.ts +30 -0
- package/lib/domain/users/models/user-address.d.ts +7 -0
- package/lib/domain/users/models/user-payment-method.d.ts +13 -0
- package/lib/domain/users/models/user.d.ts +24 -0
- package/lib/domain/users/repositories/beauty-profile.repository.d.ts +4 -0
- package/lib/domain/users/repositories/edition.repository.d.ts +4 -0
- package/lib/domain/users/repositories/lead.repository.d.ts +4 -0
- package/lib/domain/users/repositories/subscription-payment.repository.d.ts +4 -0
- package/lib/domain/users/repositories/subscription.repository.d.ts +4 -0
- package/lib/domain/users/repositories/user-address.repository.d.ts +4 -0
- package/lib/domain/users/repositories/user-payment-method.repository.d.ts +4 -0
- package/lib/domain/users/repositories/user.repository.d.ts +6 -0
- package/lib/domain/users/services/authentication.service.d.ts +11 -0
- package/lib/domain/users/use-cases/index.d.ts +3 -0
- package/lib/errors/duplicated-results.error.d.ts +4 -0
- package/lib/errors/invalid-argument.error.d.ts +4 -0
- package/lib/errors/not-found.error.d.ts +4 -0
- package/lib/errors/required-argument.error.d.ts +5 -0
- package/lib/index.d.ts +4 -0
- package/lib/infra/firebase/auth/authentication-firebase-auth.service.d.ts +11 -0
- package/lib/infra/firebase/auth/register-firebase-auth.service.d.ts +8 -0
- package/lib/infra/firebase/firestore/mixins/with-create-firestore.mixin.d.ts +17 -0
- package/lib/infra/firebase/firestore/mixins/with-crud-firestore.mixin.d.ts +29 -0
- package/lib/infra/firebase/firestore/mixins/with-delete-firestore.mixin.d.ts +15 -0
- package/lib/infra/firebase/firestore/mixins/with-find-firestore.mixin.d.ts +20 -0
- package/lib/infra/firebase/firestore/mixins/with-firestore.mixin.d.ts +15 -0
- package/lib/infra/firebase/firestore/mixins/with-get-firestore.mixin.d.ts +15 -0
- package/lib/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +10 -0
- package/lib/infra/firebase/firestore/mixins/with-sub-collection.mixin.d.ts +14 -0
- package/lib/infra/firebase/firestore/mixins/with-update-firestore.mixin.d.ts +16 -0
- package/lib/infra/firebase/firestore/models/user-search.d.ts +9 -0
- package/lib/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +55 -0
- package/lib/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +50 -0
- package/lib/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.d.ts +60 -0
- package/lib/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.d.ts +49 -0
- package/lib/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.d.ts +49 -0
- package/lib/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.d.ts +49 -0
- package/lib/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.d.ts +49 -0
- package/lib/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.d.ts +49 -0
- package/lib/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.d.ts +49 -0
- package/lib/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.d.ts +53 -0
- package/lib/infra/firebase/firestore/repositories/shopping/order-firestore.repository.d.ts +49 -0
- package/lib/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.d.ts +49 -0
- package/lib/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.d.ts +49 -0
- package/lib/infra/firebase/firestore/repositories/users/lead-firestore.repository.d.ts +49 -0
- package/lib/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.d.ts +60 -0
- package/lib/infra/firebase/firestore/repositories/users/subscription-firestore.repository.d.ts +49 -0
- package/lib/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.d.ts +60 -0
- package/lib/infra/firebase/firestore/repositories/users/user-address-firestore.repository.d.ts +60 -0
- package/lib/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.d.ts +60 -0
- package/lib/infra/firebase/firestore/repositories/users/user-firestore.repository.d.ts +60 -0
- package/lib/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.d.ts +60 -0
- package/lib/infra/firebase/firestore/repositories/users/user-search-firestore.repository.d.ts +50 -0
- package/lib/infra/firebase/firestore/types/firestore-sub.repository.type.d.ts +6 -0
- package/lib/infra/firebase/firestore/types/firestore.helpers.type.d.ts +8 -0
- package/lib/infra/firebase/firestore/types/firestore.repository.type.d.ts +8 -0
- package/lib/infra/index.d.ts +1 -0
- package/lib/utils/index.d.ts +4 -0
- package/lib/utils/mixins/index.d.ts +2 -0
- package/lib/utils/mixins/mixin-ctor.type.d.ts +1 -0
- package/lib/utils/types/index.d.ts +1 -0
- package/package.json +3 -7
- package/public-api.d.ts +2 -0
- package/domain/catalog/models/category.d.ts +0 -23
- package/domain/catalog/models/enums/shops.enum.d.ts +0 -5
- package/domain/catalog/models/index.d.ts +0 -6
- package/domain/catalog/models/kit-product.d.ts +0 -12
- package/domain/catalog/models/product.d.ts +0 -39
- package/domain/catalog/models/types/product-review.type.d.ts +0 -17
- package/domain/catalog/models/variant.d.ts +0 -18
- package/domain/catalog/repositories/category.repository.d.ts +0 -15
- package/domain/catalog/repositories/product.repository.d.ts +0 -12
- package/domain/catalog/repositories/subscription-product.repository.d.ts +0 -4
- package/domain/catalog/repositories/variant.repository.d.ts +0 -4
- package/domain/generic/model/base.model.d.ts +0 -10
- package/domain/generic/model/index.d.ts +0 -3
- package/domain/generic/model/types/base-model-builder.type.d.ts +0 -15
- package/domain/generic/model/types/identifier-model.type.d.ts +0 -7
- package/domain/generic/model/types/index.d.ts +0 -5
- package/domain/generic/model/types/model-base-structure.type.d.ts +0 -6
- package/domain/generic/model/types/non-function-properties.type.d.ts +0 -12
- package/domain/generic/model/types/non-function-property-name.type.d.ts +0 -4
- package/domain/generic/repository/create.repository.d.ts +0 -8
- package/domain/generic/repository/crud.repository.d.ts +0 -19
- package/domain/generic/repository/delete.repository.d.ts +0 -7
- package/domain/generic/repository/enums/where.enum.d.ts +0 -13
- package/domain/generic/repository/find.repository.d.ts +0 -11
- package/domain/generic/repository/get.repository.d.ts +0 -5
- package/domain/generic/repository/read.repository.d.ts +0 -14
- package/domain/generic/repository/types/index.d.ts +0 -6
- package/domain/generic/repository/types/repository-find-filters.type.d.ts +0 -13
- package/domain/generic/repository/types/repository-update-params.type.d.ts +0 -11
- package/domain/generic/repository/types/where-options.type.d.ts +0 -2
- package/domain/generic/repository/update.repository.d.ts +0 -6
- package/domain/index.d.ts +0 -6
- package/domain/location/models/address.d.ts +0 -22
- package/domain/shop-settings/models/home.d.ts +0 -17
- package/domain/shop-settings/models/shop-menu.d.ts +0 -7
- package/domain/shop-settings/models/types/home-data.type.d.ts +0 -15
- package/domain/shop-settings/models/types/index.d.ts +0 -5
- package/domain/shop-settings/repositories/home.repository.d.ts +0 -4
- package/domain/shop-settings/repositories/shop-menu.repository.d.ts +0 -4
- package/domain/shopping/models/buy-2-win.d.ts +0 -16
- package/domain/shopping/models/checkout.d.ts +0 -27
- package/domain/shopping/models/coupons/coupon.d.ts +0 -26
- package/domain/shopping/models/coupons/enums/coupon-subtypes.enum.d.ts +0 -4
- package/domain/shopping/models/coupons/enums/coupon-types.enum.d.ts +0 -6
- package/domain/shopping/models/coupons/enums/index.d.ts +0 -3
- package/domain/shopping/models/coupons/financial-coupon.d.ts +0 -9
- package/domain/shopping/models/coupons/index.d.ts +0 -3
- package/domain/shopping/models/payment.d.ts +0 -67
- package/domain/shopping/models/shipping-method.d.ts +0 -16
- package/domain/shopping/models/subscription/checkout.d.ts +0 -21
- package/domain/shopping/models/subscription/plan.d.ts +0 -10
- package/domain/shopping/repositories/buy-2-win.repository.d.ts +0 -4
- package/domain/shopping/repositories/checkout.repository.d.ts +0 -4
- package/domain/shopping/repositories/coupon.repository.d.ts +0 -4
- package/domain/shopping/repositories/order.repository.d.ts +0 -4
- package/domain/shopping/repositories/payment.repository.d.ts +0 -4
- package/domain/shopping/repositories/subscription/checkout.repository.d.ts +0 -4
- package/domain/shopping/repositories/subscription/plan.repository.d.ts +0 -4
- package/domain/users/errors/unauthorized.error.d.ts +0 -5
- package/domain/users/errors/user-already-registered.error.d.ts +0 -5
- package/domain/users/errors/weak-password.error.d.ts +0 -5
- package/domain/users/models/beauty-profile.d.ts +0 -11
- package/domain/users/models/lead.d.ts +0 -7
- package/domain/users/models/subscription/edition.d.ts +0 -16
- package/domain/users/models/subscription/payment.d.ts +0 -13
- package/domain/users/models/subscription/subscription.d.ts +0 -28
- package/domain/users/models/user-address.d.ts +0 -7
- package/domain/users/models/user-payment-method.d.ts +0 -14
- package/domain/users/models/user.d.ts +0 -26
- package/domain/users/repositories/beauty-profile.repository.d.ts +0 -4
- package/domain/users/repositories/edition.repository.d.ts +0 -4
- package/domain/users/repositories/lead.repository.d.ts +0 -4
- package/domain/users/repositories/subscription-payment.repository.d.ts +0 -4
- package/domain/users/repositories/subscription.repository.d.ts +0 -4
- package/domain/users/repositories/user-address.repository.d.ts +0 -4
- package/domain/users/repositories/user-payment-method.repository.d.ts +0 -4
- package/domain/users/repositories/user.repository.d.ts +0 -6
- package/domain/users/services/authentication.service.d.ts +0 -12
- package/domain/users/use-cases/index.d.ts +0 -4
- package/domain/users/use-cases/recovery-password.d.ts +0 -6
- package/errors/duplicated-results.error.d.ts +0 -5
- package/errors/invalid-argument.error.d.ts +0 -5
- package/errors/not-found.error.d.ts +0 -5
- package/errors/required-argument.error.d.ts +0 -6
- package/esm2015/domain/catalog/index.js +0 -3
- package/esm2015/domain/catalog/models/category.js +0 -10
- package/esm2015/domain/catalog/models/enums/index.js +0 -2
- package/esm2015/domain/catalog/models/enums/shops.enum.js +0 -7
- package/esm2015/domain/catalog/models/index.js +0 -7
- package/esm2015/domain/catalog/models/kit-product.js +0 -18
- package/esm2015/domain/catalog/models/product.js +0 -21
- package/esm2015/domain/catalog/models/types/category-condition.type.js +0 -2
- package/esm2015/domain/catalog/models/types/category-filter.type.js +0 -2
- package/esm2015/domain/catalog/models/types/index.js +0 -8
- package/esm2015/domain/catalog/models/types/product-review.type.js +0 -2
- package/esm2015/domain/catalog/models/types/shops-description.type.js +0 -2
- package/esm2015/domain/catalog/models/types/shops-price.type.js +0 -2
- package/esm2015/domain/catalog/models/types/stock.type.js +0 -2
- package/esm2015/domain/catalog/models/types/variant-grade.type.js +0 -2
- package/esm2015/domain/catalog/models/variant.js +0 -10
- package/esm2015/domain/catalog/repositories/category.repository.js +0 -2
- package/esm2015/domain/catalog/repositories/index.js +0 -5
- package/esm2015/domain/catalog/repositories/product.repository.js +0 -2
- package/esm2015/domain/catalog/repositories/subscription-product.repository.js +0 -2
- package/esm2015/domain/catalog/repositories/variant.repository.js +0 -2
- package/esm2015/domain/generic/index.js +0 -3
- package/esm2015/domain/generic/model/base.model.js +0 -23
- package/esm2015/domain/generic/model/identifier-fields.js +0 -2
- package/esm2015/domain/generic/model/index.js +0 -4
- package/esm2015/domain/generic/model/types/base-model-builder.type.js +0 -2
- package/esm2015/domain/generic/model/types/identifier-model.type.js +0 -2
- package/esm2015/domain/generic/model/types/index.js +0 -6
- package/esm2015/domain/generic/model/types/model-base-structure.type.js +0 -2
- package/esm2015/domain/generic/model/types/non-function-properties.type.js +0 -2
- package/esm2015/domain/generic/model/types/non-function-property-name.type.js +0 -2
- package/esm2015/domain/generic/repository/create.repository.js +0 -2
- package/esm2015/domain/generic/repository/crud.repository.js +0 -2
- package/esm2015/domain/generic/repository/delete.repository.js +0 -2
- package/esm2015/domain/generic/repository/enums/index.js +0 -3
- package/esm2015/domain/generic/repository/enums/update-option-actions.enum.js +0 -9
- package/esm2015/domain/generic/repository/enums/where.enum.js +0 -15
- package/esm2015/domain/generic/repository/find.repository.js +0 -2
- package/esm2015/domain/generic/repository/get.repository.js +0 -2
- package/esm2015/domain/generic/repository/index.js +0 -10
- package/esm2015/domain/generic/repository/read.repository.js +0 -2
- package/esm2015/domain/generic/repository/types/index.js +0 -7
- package/esm2015/domain/generic/repository/types/repository-find-filters.type.js +0 -2
- package/esm2015/domain/generic/repository/types/repository-find-result.type.js +0 -2
- package/esm2015/domain/generic/repository/types/repository-limit-options.type.js +0 -2
- package/esm2015/domain/generic/repository/types/repository-order-by-list.type.js +0 -2
- package/esm2015/domain/generic/repository/types/repository-update-params.type.js +0 -2
- package/esm2015/domain/generic/repository/types/where-options.type.js +0 -2
- package/esm2015/domain/generic/repository/update.repository.js +0 -2
- package/esm2015/domain/index.js +0 -7
- package/esm2015/domain/location/index.js +0 -2
- package/esm2015/domain/location/models/address.js +0 -7
- package/esm2015/domain/location/models/index.js +0 -3
- package/esm2015/domain/location/models/types/index.js +0 -4
- package/esm2015/domain/location/models/types/location-bound.type.js +0 -2
- package/esm2015/domain/location/models/types/location-geometry.type.js +0 -2
- package/esm2015/domain/location/models/types/location-lat-lng.type.js +0 -2
- package/esm2015/domain/shop-settings/enums/filter-type.enum.js +0 -21
- package/esm2015/domain/shop-settings/enums/index.js +0 -3
- package/esm2015/domain/shop-settings/enums/questions-filters.enum.js +0 -21
- package/esm2015/domain/shop-settings/helpers/beauty-questions.helper.js +0 -46
- package/esm2015/domain/shop-settings/helpers/index.js +0 -2
- package/esm2015/domain/shop-settings/index.js +0 -5
- package/esm2015/domain/shop-settings/models/home.js +0 -7
- package/esm2015/domain/shop-settings/models/index.js +0 -4
- package/esm2015/domain/shop-settings/models/shop-menu.js +0 -7
- package/esm2015/domain/shop-settings/models/types/banner.type.js +0 -2
- package/esm2015/domain/shop-settings/models/types/benefit.type.js +0 -2
- package/esm2015/domain/shop-settings/models/types/home-data.type.js +0 -2
- package/esm2015/domain/shop-settings/models/types/index.js +0 -6
- package/esm2015/domain/shop-settings/models/types/menu-nav.type.js +0 -2
- package/esm2015/domain/shop-settings/models/types/sub-menu.type.js +0 -2
- package/esm2015/domain/shop-settings/repositories/home.repository.js +0 -2
- package/esm2015/domain/shop-settings/repositories/index.js +0 -3
- package/esm2015/domain/shop-settings/repositories/shop-menu.repository.js +0 -2
- package/esm2015/domain/shopping/index.js +0 -3
- package/esm2015/domain/shopping/models/buy-2-win.js +0 -14
- package/esm2015/domain/shopping/models/checkout.js +0 -38
- package/esm2015/domain/shopping/models/coupons/coupon.js +0 -23
- package/esm2015/domain/shopping/models/coupons/enums/coupon-subtypes.enum.js +0 -6
- package/esm2015/domain/shopping/models/coupons/enums/coupon-types.enum.js +0 -8
- package/esm2015/domain/shopping/models/coupons/enums/exclusivities.enum.js +0 -7
- package/esm2015/domain/shopping/models/coupons/enums/index.js +0 -4
- package/esm2015/domain/shopping/models/coupons/financial-coupon.js +0 -28
- package/esm2015/domain/shopping/models/coupons/index.js +0 -4
- package/esm2015/domain/shopping/models/enums/checkout-types.enum.js +0 -6
- package/esm2015/domain/shopping/models/enums/index.js +0 -3
- package/esm2015/domain/shopping/models/enums/order-status.enum.js +0 -12
- package/esm2015/domain/shopping/models/index.js +0 -12
- package/esm2015/domain/shopping/models/line-item.js +0 -4
- package/esm2015/domain/shopping/models/order.js +0 -11
- package/esm2015/domain/shopping/models/payment.js +0 -169
- package/esm2015/domain/shopping/models/shipping-method.js +0 -7
- package/esm2015/domain/shopping/models/subscription/checkout.js +0 -28
- package/esm2015/domain/shopping/models/subscription/index.js +0 -3
- package/esm2015/domain/shopping/models/subscription/plan.js +0 -7
- package/esm2015/domain/shopping/models/types/index.js +0 -8
- package/esm2015/domain/shopping/models/types/payment-address.type.js +0 -2
- package/esm2015/domain/shopping/models/types/payment-billing.type.js +0 -2
- package/esm2015/domain/shopping/models/types/payment-card.type.js +0 -2
- package/esm2015/domain/shopping/models/types/payment-customer.type.js +0 -2
- package/esm2015/domain/shopping/models/types/payment-document.type.js +0 -2
- package/esm2015/domain/shopping/models/types/payment-item.type.js +0 -2
- package/esm2015/domain/shopping/models/types/payment-shipping.type.js +0 -2
- package/esm2015/domain/shopping/repositories/buy-2-win.repository.js +0 -2
- package/esm2015/domain/shopping/repositories/checkout.repository.js +0 -2
- package/esm2015/domain/shopping/repositories/coupon.repository.js +0 -2
- package/esm2015/domain/shopping/repositories/index.js +0 -8
- package/esm2015/domain/shopping/repositories/legacy-order.repository.js +0 -2
- package/esm2015/domain/shopping/repositories/order.repository.js +0 -2
- package/esm2015/domain/shopping/repositories/payment.repository.js +0 -2
- package/esm2015/domain/shopping/repositories/subscription/checkout.repository.js +0 -2
- package/esm2015/domain/shopping/repositories/subscription/index.js +0 -3
- package/esm2015/domain/shopping/repositories/subscription/plan.repository.js +0 -2
- package/esm2015/domain/users/errors/index.js +0 -4
- package/esm2015/domain/users/errors/unauthorized.error.js +0 -8
- package/esm2015/domain/users/errors/user-already-registered.error.js +0 -8
- package/esm2015/domain/users/errors/weak-password.error.js +0 -8
- package/esm2015/domain/users/index.js +0 -6
- package/esm2015/domain/users/models/beauty-profile.js +0 -12
- package/esm2015/domain/users/models/enums/accessory-importances.enum.js +0 -7
- package/esm2015/domain/users/models/enums/area.enum.js +0 -13
- package/esm2015/domain/users/models/enums/beard-problems.enum.js +0 -11
- package/esm2015/domain/users/models/enums/beard-sizes.enum.js +0 -9
- package/esm2015/domain/users/models/enums/beauty-product-importances.enum.js +0 -8
- package/esm2015/domain/users/models/enums/body-problems.enum.js +0 -13
- package/esm2015/domain/users/models/enums/body-shapes.enum.js +0 -9
- package/esm2015/domain/users/models/enums/body-tattoos.enum.js +0 -7
- package/esm2015/domain/users/models/enums/face-skin-oilinesses.enum.js +0 -9
- package/esm2015/domain/users/models/enums/face-skin-problems.enum.js +0 -12
- package/esm2015/domain/users/models/enums/face-skin-tones.enum.js +0 -10
- package/esm2015/domain/users/models/enums/family-incomes.enum.js +0 -10
- package/esm2015/domain/users/models/enums/fragrance-importances.enum.js +0 -7
- package/esm2015/domain/users/models/enums/hair-colors.enum.js +0 -12
- package/esm2015/domain/users/models/enums/hair-problems.enum.js +0 -12
- package/esm2015/domain/users/models/enums/hair-strands.enum.js +0 -10
- package/esm2015/domain/users/models/enums/hair-types.enum.js +0 -9
- package/esm2015/domain/users/models/enums/index.js +0 -21
- package/esm2015/domain/users/models/enums/office-position.enum.js +0 -8
- package/esm2015/domain/users/models/enums/product-spents.enum.js +0 -10
- package/esm2015/domain/users/models/enums/user-type.enum.js +0 -10
- package/esm2015/domain/users/models/index.js +0 -8
- package/esm2015/domain/users/models/lead.js +0 -7
- package/esm2015/domain/users/models/subscription/edition.js +0 -7
- package/esm2015/domain/users/models/subscription/enums/billing-status.enum.js +0 -5
- package/esm2015/domain/users/models/subscription/enums/edition-status.enum.js +0 -6
- package/esm2015/domain/users/models/subscription/enums/index.js +0 -5
- package/esm2015/domain/users/models/subscription/enums/payment-type.enum.js +0 -7
- package/esm2015/domain/users/models/subscription/enums/status.enum.js +0 -6
- package/esm2015/domain/users/models/subscription/index.js +0 -5
- package/esm2015/domain/users/models/subscription/payment.js +0 -14
- package/esm2015/domain/users/models/subscription/subscription.js +0 -43
- package/esm2015/domain/users/models/user-address.js +0 -7
- package/esm2015/domain/users/models/user-payment-method.js +0 -7
- package/esm2015/domain/users/models/user.js +0 -26
- package/esm2015/domain/users/repositories/beauty-profile.repository.js +0 -2
- package/esm2015/domain/users/repositories/edition.repository.js +0 -2
- package/esm2015/domain/users/repositories/index.js +0 -9
- package/esm2015/domain/users/repositories/lead.repository.js +0 -2
- package/esm2015/domain/users/repositories/subscription-payment.repository.js +0 -2
- package/esm2015/domain/users/repositories/subscription.repository.js +0 -2
- package/esm2015/domain/users/repositories/user-address.repository.js +0 -2
- package/esm2015/domain/users/repositories/user-payment-method.repository.js +0 -2
- package/esm2015/domain/users/repositories/user.repository.js +0 -2
- package/esm2015/domain/users/services/authentication.service.js +0 -2
- package/esm2015/domain/users/services/index.js +0 -4
- package/esm2015/domain/users/services/register.service.js +0 -2
- package/esm2015/domain/users/services/types/basic-user-data.type.js +0 -2
- package/esm2015/domain/users/services/types/index.js +0 -2
- package/esm2015/domain/users/use-cases/authentication.js +0 -40
- package/esm2015/domain/users/use-cases/index.js +0 -5
- package/esm2015/domain/users/use-cases/recovery-password.js +0 -12
- package/esm2015/domain/users/use-cases/register.js +0 -34
- package/esm2015/domain/users/use-cases/signout.js +0 -12
- package/esm2015/errors/duplicated-results.error.js +0 -8
- package/esm2015/errors/index.js +0 -5
- package/esm2015/errors/invalid-argument.error.js +0 -8
- package/esm2015/errors/not-found.error.js +0 -8
- package/esm2015/errors/required-argument.error.js +0 -9
- package/esm2015/index.js +0 -6
- package/esm2015/infra/elasticsearch/adapters/axios.adapter.js +0 -22
- package/esm2015/infra/elasticsearch/adapters/elastic-search.adapter.js +0 -2
- package/esm2015/infra/elasticsearch/adapters/index.js +0 -3
- package/esm2015/infra/elasticsearch/index.js +0 -4
- package/esm2015/infra/elasticsearch/indexes/index.js +0 -2
- package/esm2015/infra/elasticsearch/indexes/products-index.js +0 -59
- package/esm2015/infra/elasticsearch/types/elastic-search-result.js +0 -2
- package/esm2015/infra/elasticsearch/types/index.js +0 -2
- package/esm2015/infra/firebase/auth/authentication-firebase-auth.service.js +0 -52
- package/esm2015/infra/firebase/auth/index.js +0 -3
- package/esm2015/infra/firebase/auth/register-firebase-auth.service.js +0 -26
- package/esm2015/infra/firebase/auth/types/firebase-user-with-id.type.js +0 -2
- package/esm2015/infra/firebase/firestore/index.js +0 -4
- package/esm2015/infra/firebase/firestore/mixins/index.js +0 -10
- package/esm2015/infra/firebase/firestore/mixins/with-create-firestore.mixin.js +0 -31
- package/esm2015/infra/firebase/firestore/mixins/with-crud-firestore.mixin.js +0 -10
- package/esm2015/infra/firebase/firestore/mixins/with-delete-firestore.mixin.js +0 -18
- package/esm2015/infra/firebase/firestore/mixins/with-find-firestore.mixin.js +0 -86
- package/esm2015/infra/firebase/firestore/mixins/with-firestore.mixin.js +0 -22
- package/esm2015/infra/firebase/firestore/mixins/with-get-firestore.mixin.js +0 -24
- package/esm2015/infra/firebase/firestore/mixins/with-helpers.mixin.js +0 -17
- package/esm2015/infra/firebase/firestore/mixins/with-sub-collection.mixin.js +0 -11
- package/esm2015/infra/firebase/firestore/mixins/with-update-firestore.mixin.js +0 -45
- package/esm2015/infra/firebase/firestore/models/user-search.js +0 -7
- package/esm2015/infra/firebase/firestore/repositories/catalog/category-firestore.repository.js +0 -72
- package/esm2015/infra/firebase/firestore/repositories/catalog/index.js +0 -5
- package/esm2015/infra/firebase/firestore/repositories/catalog/product-firestore.repository.js +0 -53
- package/esm2015/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.js +0 -14
- package/esm2015/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.js +0 -12
- package/esm2015/infra/firebase/firestore/repositories/index.js +0 -5
- package/esm2015/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.js +0 -56
- package/esm2015/infra/firebase/firestore/repositories/shop-settings/index.js +0 -3
- package/esm2015/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.js +0 -12
- package/esm2015/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.js +0 -12
- package/esm2015/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.js +0 -12
- package/esm2015/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.js +0 -12
- package/esm2015/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.js +0 -29
- package/esm2015/infra/firebase/firestore/repositories/shopping/index.js +0 -9
- package/esm2015/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.js +0 -9
- package/esm2015/infra/firebase/firestore/repositories/shopping/order-firestore.repository.js +0 -12
- package/esm2015/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.js +0 -12
- package/esm2015/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.js +0 -12
- package/esm2015/infra/firebase/firestore/repositories/users/index.js +0 -10
- package/esm2015/infra/firebase/firestore/repositories/users/lead-firestore.repository.js +0 -12
- package/esm2015/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.js +0 -14
- package/esm2015/infra/firebase/firestore/repositories/users/subscription-firestore.repository.js +0 -12
- package/esm2015/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.js +0 -14
- package/esm2015/infra/firebase/firestore/repositories/users/user-address-firestore.repository.js +0 -14
- package/esm2015/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.js +0 -14
- package/esm2015/infra/firebase/firestore/repositories/users/user-firestore.repository.js +0 -70
- package/esm2015/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.js +0 -14
- package/esm2015/infra/firebase/firestore/repositories/users/user-search-firestore.repository.js +0 -12
- package/esm2015/infra/firebase/firestore/types/firestore-sub.repository.type.js +0 -2
- package/esm2015/infra/firebase/firestore/types/firestore.helpers.type.js +0 -2
- package/esm2015/infra/firebase/firestore/types/firestore.repository.type.js +0 -2
- package/esm2015/infra/firebase/firestore/types/index.js +0 -4
- package/esm2015/infra/firebase/index.js +0 -3
- package/esm2015/infra/hasura-graphql/enums/hasura-graphql-column-type.enum.js +0 -13
- package/esm2015/infra/hasura-graphql/enums/hasura-graphql-where.enum.js +0 -15
- package/esm2015/infra/hasura-graphql/enums/index.js +0 -3
- package/esm2015/infra/hasura-graphql/index.js +0 -5
- package/esm2015/infra/hasura-graphql/mixins/helpers/attribute-option.helper.js +0 -31
- package/esm2015/infra/hasura-graphql/mixins/helpers/filter-option.helper.js +0 -18
- package/esm2015/infra/hasura-graphql/mixins/helpers/graphql-field.helper.js +0 -70
- package/esm2015/infra/hasura-graphql/mixins/helpers/index.js +0 -4
- package/esm2015/infra/hasura-graphql/mixins/index.js +0 -8
- package/esm2015/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.js +0 -45
- package/esm2015/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.js +0 -10
- package/esm2015/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.js +0 -29
- package/esm2015/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.js +0 -93
- package/esm2015/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.js +0 -35
- package/esm2015/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.js +0 -95
- package/esm2015/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.js +0 -56
- package/esm2015/infra/hasura-graphql/models/category-hasura-graphql.js +0 -4
- package/esm2015/infra/hasura-graphql/models/index.js +0 -5
- package/esm2015/infra/hasura-graphql/models/kit-product-hasura-graphql.js +0 -15
- package/esm2015/infra/hasura-graphql/models/product-hasura-graphql.js +0 -11
- package/esm2015/infra/hasura-graphql/models/variant-hasura-graphql.js +0 -9
- package/esm2015/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.js +0 -135
- package/esm2015/infra/hasura-graphql/repositories/catalog/index.js +0 -4
- package/esm2015/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.js +0 -367
- package/esm2015/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.js +0 -100
- package/esm2015/infra/hasura-graphql/repositories/index.js +0 -2
- package/esm2015/infra/hasura-graphql/types/fields.type.js +0 -2
- package/esm2015/infra/hasura-graphql/types/graphql.repository.type.js +0 -2
- package/esm2015/infra/hasura-graphql/types/hasura-graphql-auth-options.type.js +0 -2
- package/esm2015/infra/hasura-graphql/types/hasura-graphql-fields.type.js +0 -2
- package/esm2015/infra/hasura-graphql/types/hasura-graphql-headers.type.js +0 -2
- package/esm2015/infra/hasura-graphql/types/index.js +0 -9
- package/esm2015/infra/hasura-graphql/types/nested-field.type.js +0 -2
- package/esm2015/infra/hasura-graphql/types/query-builder-options.type.js +0 -2
- package/esm2015/infra/hasura-graphql/types/variable-options.type.js +0 -2
- package/esm2015/infra/index.js +0 -4
- package/esm2015/utils/index.js +0 -8
- package/esm2015/utils/is-uuid.js +0 -3
- package/esm2015/utils/mixins/base.mixin.js +0 -6
- package/esm2015/utils/mixins/index.js +0 -4
- package/esm2015/utils/mixins/merge-constructor-params.type.js +0 -2
- package/esm2015/utils/mixins/mixin-ctor.type.js +0 -2
- package/esm2015/utils/parse-datetime.js +0 -14
- package/esm2015/utils/types/array-element.type.js +0 -2
- package/esm2015/utils/types/index.js +0 -3
- package/esm2015/utils/types/prop.type.js +0 -2
- package/index.d.ts +0 -5
- package/infra/elasticsearch/adapters/axios.adapter.d.ts +0 -11
- package/infra/elasticsearch/adapters/elastic-search.adapter.d.ts +0 -4
- package/infra/elasticsearch/adapters/index.d.ts +0 -2
- package/infra/elasticsearch/index.d.ts +0 -3
- package/infra/elasticsearch/indexes/index.d.ts +0 -1
- package/infra/elasticsearch/indexes/products-index.d.ts +0 -11
- package/infra/elasticsearch/types/elastic-search-result.d.ts +0 -7
- package/infra/elasticsearch/types/index.d.ts +0 -1
- package/infra/firebase/auth/authentication-firebase-auth.service.d.ts +0 -12
- package/infra/firebase/auth/register-firebase-auth.service.d.ts +0 -8
- package/infra/firebase/firestore/mixins/with-create-firestore.mixin.d.ts +0 -4
- package/infra/firebase/firestore/mixins/with-crud-firestore.mixin.d.ts +0 -4
- package/infra/firebase/firestore/mixins/with-delete-firestore.mixin.d.ts +0 -4
- package/infra/firebase/firestore/mixins/with-find-firestore.mixin.d.ts +0 -4
- package/infra/firebase/firestore/mixins/with-firestore.mixin.d.ts +0 -4
- package/infra/firebase/firestore/mixins/with-get-firestore.mixin.d.ts +0 -4
- package/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +0 -11
- package/infra/firebase/firestore/mixins/with-sub-collection.mixin.d.ts +0 -7
- package/infra/firebase/firestore/mixins/with-update-firestore.mixin.d.ts +0 -7
- package/infra/firebase/firestore/models/user-search.d.ts +0 -9
- package/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +0 -17
- package/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +0 -11
- package/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.d.ts +0 -13
- package/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.d.ts +0 -8
- package/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.d.ts +0 -16
- package/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.d.ts +0 -8
- package/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.d.ts +0 -8
- package/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.d.ts +0 -8
- package/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.d.ts +0 -8
- package/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.d.ts +0 -12
- package/infra/firebase/firestore/repositories/shopping/order-firestore.repository.d.ts +0 -8
- package/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.d.ts +0 -8
- package/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.d.ts +0 -8
- package/infra/firebase/firestore/repositories/users/lead-firestore.repository.d.ts +0 -8
- package/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.d.ts +0 -13
- package/infra/firebase/firestore/repositories/users/subscription-firestore.repository.d.ts +0 -8
- package/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.d.ts +0 -13
- package/infra/firebase/firestore/repositories/users/user-address-firestore.repository.d.ts +0 -13
- package/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.d.ts +0 -13
- package/infra/firebase/firestore/repositories/users/user-firestore.repository.d.ts +0 -19
- package/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.d.ts +0 -13
- package/infra/firebase/firestore/repositories/users/user-search-firestore.repository.d.ts +0 -9
- package/infra/firebase/firestore/types/firestore-sub.repository.type.d.ts +0 -6
- package/infra/firebase/firestore/types/firestore.helpers.type.d.ts +0 -8
- package/infra/firebase/firestore/types/firestore.repository.type.d.ts +0 -12
- package/infra/hasura-graphql/enums/hasura-graphql-column-type.enum.d.ts +0 -11
- package/infra/hasura-graphql/enums/hasura-graphql-where.enum.d.ts +0 -13
- package/infra/hasura-graphql/enums/index.d.ts +0 -2
- package/infra/hasura-graphql/index.d.ts +0 -4
- package/infra/hasura-graphql/mixins/helpers/attribute-option.helper.d.ts +0 -13
- package/infra/hasura-graphql/mixins/helpers/filter-option.helper.d.ts +0 -6
- package/infra/hasura-graphql/mixins/helpers/graphql-field.helper.d.ts +0 -8
- package/infra/hasura-graphql/mixins/helpers/index.d.ts +0 -3
- package/infra/hasura-graphql/mixins/index.d.ts +0 -7
- package/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.d.ts +0 -8
- package/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.d.ts +0 -11
- package/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.d.ts +0 -7
- package/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.d.ts +0 -31
- package/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.d.ts +0 -24
- package/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.d.ts +0 -11
- package/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.d.ts +0 -14
- package/infra/hasura-graphql/models/category-hasura-graphql.d.ts +0 -6
- package/infra/hasura-graphql/models/index.d.ts +0 -4
- package/infra/hasura-graphql/models/kit-product-hasura-graphql.d.ts +0 -6
- package/infra/hasura-graphql/models/product-hasura-graphql.d.ts +0 -9
- package/infra/hasura-graphql/models/variant-hasura-graphql.d.ts +0 -9
- package/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.d.ts +0 -22
- package/infra/hasura-graphql/repositories/catalog/index.d.ts +0 -3
- package/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +0 -26
- package/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.d.ts +0 -13
- package/infra/hasura-graphql/repositories/index.d.ts +0 -1
- package/infra/hasura-graphql/types/fields.type.d.ts +0 -2
- package/infra/hasura-graphql/types/graphql.repository.type.d.ts +0 -21
- package/infra/hasura-graphql/types/hasura-graphql-auth-options.type.d.ts +0 -8
- package/infra/hasura-graphql/types/hasura-graphql-fields.type.d.ts +0 -36
- package/infra/hasura-graphql/types/hasura-graphql-headers.type.d.ts +0 -7
- package/infra/hasura-graphql/types/index.d.ts +0 -8
- package/infra/hasura-graphql/types/nested-field.type.d.ts +0 -7
- package/infra/hasura-graphql/types/query-builder-options.type.d.ts +0 -7
- package/infra/hasura-graphql/types/variable-options.type.d.ts +0 -9
- package/infra/index.d.ts +0 -3
- package/utils/index.d.ts +0 -7
- package/utils/is-uuid.d.ts +0 -1
- package/utils/mixins/index.d.ts +0 -3
- package/utils/mixins/merge-constructor-params.type.d.ts +0 -3
- package/utils/mixins/mixin-ctor.type.d.ts +0 -1
- package/utils/parse-datetime.d.ts +0 -1
- package/utils/types/array-element.type.d.ts +0 -1
- package/utils/types/index.d.ts +0 -2
- /package/{domain → lib/domain}/catalog/index.d.ts +0 -0
- /package/{domain → lib/domain}/catalog/models/enums/index.d.ts +0 -0
- /package/{domain → lib/domain}/catalog/models/types/category-condition.type.d.ts +0 -0
- /package/{domain → lib/domain}/catalog/models/types/category-filter.type.d.ts +0 -0
- /package/{domain → lib/domain}/catalog/models/types/index.d.ts +0 -0
- /package/{domain → lib/domain}/catalog/models/types/shops-description.type.d.ts +0 -0
- /package/{domain → lib/domain}/catalog/models/types/shops-price.type.d.ts +0 -0
- /package/{domain → lib/domain}/catalog/models/types/stock.type.d.ts +0 -0
- /package/{domain → lib/domain}/catalog/models/types/variant-grade.type.d.ts +0 -0
- /package/{domain → lib/domain}/catalog/repositories/index.d.ts +0 -0
- /package/{domain/generic → lib/domain/general}/index.d.ts +0 -0
- /package/{domain/generic → lib/domain/general}/model/identifier-fields.d.ts +0 -0
- /package/{domain/generic → lib/domain/general}/repository/enums/index.d.ts +0 -0
- /package/{domain/generic → lib/domain/general}/repository/enums/update-option-actions.enum.d.ts +0 -0
- /package/{domain/generic → lib/domain/general}/repository/index.d.ts +0 -0
- /package/{domain/generic → lib/domain/general}/repository/types/repository-find-result.type.d.ts +0 -0
- /package/{domain/generic → lib/domain/general}/repository/types/repository-limit-options.type.d.ts +0 -0
- /package/{domain/generic → lib/domain/general}/repository/types/repository-order-by-list.type.d.ts +0 -0
- /package/{domain → lib/domain}/location/index.d.ts +0 -0
- /package/{domain → lib/domain}/location/models/index.d.ts +0 -0
- /package/{domain → lib/domain}/location/models/types/index.d.ts +0 -0
- /package/{domain → lib/domain}/location/models/types/location-bound.type.d.ts +0 -0
- /package/{domain → lib/domain}/location/models/types/location-geometry.type.d.ts +0 -0
- /package/{domain → lib/domain}/location/models/types/location-lat-lng.type.d.ts +0 -0
- /package/{domain → lib/domain}/shop-settings/enums/filter-type.enum.d.ts +0 -0
- /package/{domain → lib/domain}/shop-settings/enums/index.d.ts +0 -0
- /package/{domain → lib/domain}/shop-settings/enums/questions-filters.enum.d.ts +0 -0
- /package/{domain → lib/domain}/shop-settings/helpers/beauty-questions.helper.d.ts +0 -0
- /package/{domain → lib/domain}/shop-settings/helpers/index.d.ts +0 -0
- /package/{domain → lib/domain}/shop-settings/index.d.ts +0 -0
- /package/{domain → lib/domain}/shop-settings/models/index.d.ts +0 -0
- /package/{domain → lib/domain}/shop-settings/models/types/banner.type.d.ts +0 -0
- /package/{domain → lib/domain}/shop-settings/models/types/benefit.type.d.ts +0 -0
- /package/{domain → lib/domain}/shop-settings/models/types/menu-nav.type.d.ts +0 -0
- /package/{domain → lib/domain}/shop-settings/models/types/sub-menu.type.d.ts +0 -0
- /package/{domain → lib/domain}/shop-settings/repositories/index.d.ts +0 -0
- /package/{domain → lib/domain}/shopping/index.d.ts +0 -0
- /package/{domain → lib/domain}/shopping/models/coupons/enums/exclusivities.enum.d.ts +0 -0
- /package/{domain → lib/domain}/shopping/models/enums/checkout-types.enum.d.ts +0 -0
- /package/{domain → lib/domain}/shopping/models/enums/index.d.ts +0 -0
- /package/{domain → lib/domain}/shopping/models/enums/order-status.enum.d.ts +0 -0
- /package/{domain → lib/domain}/shopping/models/index.d.ts +0 -0
- /package/{domain → lib/domain}/shopping/models/line-item.d.ts +0 -0
- /package/{domain → lib/domain}/shopping/models/order.d.ts +0 -0
- /package/{domain → lib/domain}/shopping/models/subscription/index.d.ts +0 -0
- /package/{domain → lib/domain}/shopping/models/types/index.d.ts +0 -0
- /package/{domain → lib/domain}/shopping/models/types/payment-address.type.d.ts +0 -0
- /package/{domain → lib/domain}/shopping/models/types/payment-billing.type.d.ts +0 -0
- /package/{domain → lib/domain}/shopping/models/types/payment-card.type.d.ts +0 -0
- /package/{domain → lib/domain}/shopping/models/types/payment-customer.type.d.ts +0 -0
- /package/{domain → lib/domain}/shopping/models/types/payment-document.type.d.ts +0 -0
- /package/{domain → lib/domain}/shopping/models/types/payment-item.type.d.ts +0 -0
- /package/{domain → lib/domain}/shopping/models/types/payment-shipping.type.d.ts +0 -0
- /package/{domain → lib/domain}/shopping/repositories/index.d.ts +0 -0
- /package/{domain → lib/domain}/shopping/repositories/legacy-order.repository.d.ts +0 -0
- /package/{domain → lib/domain}/shopping/repositories/subscription/index.d.ts +0 -0
- /package/{domain → lib/domain}/users/errors/index.d.ts +0 -0
- /package/{domain → lib/domain}/users/index.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/enums/accessory-importances.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/enums/area.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/enums/beard-problems.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/enums/beard-sizes.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/enums/beauty-product-importances.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/enums/body-problems.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/enums/body-shapes.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/enums/body-tattoos.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/enums/face-skin-oilinesses.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/enums/face-skin-problems.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/enums/face-skin-tones.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/enums/family-incomes.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/enums/fragrance-importances.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/enums/hair-colors.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/enums/hair-problems.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/enums/hair-strands.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/enums/hair-types.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/enums/index.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/enums/office-position.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/enums/product-spents.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/enums/user-type.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/index.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/subscription/enums/billing-status.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/subscription/enums/edition-status.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/subscription/enums/index.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/subscription/enums/payment-type.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/subscription/enums/status.enum.d.ts +0 -0
- /package/{domain → lib/domain}/users/models/subscription/index.d.ts +0 -0
- /package/{domain → lib/domain}/users/repositories/index.d.ts +0 -0
- /package/{domain → lib/domain}/users/services/index.d.ts +0 -0
- /package/{domain → lib/domain}/users/services/register.service.d.ts +0 -0
- /package/{domain → lib/domain}/users/services/types/basic-user-data.type.d.ts +0 -0
- /package/{domain → lib/domain}/users/services/types/index.d.ts +0 -0
- /package/{domain → lib/domain}/users/use-cases/authentication.d.ts +0 -0
- /package/{domain → lib/domain}/users/use-cases/register.d.ts +0 -0
- /package/{domain → lib/domain}/users/use-cases/signout.d.ts +0 -0
- /package/{errors → lib/errors}/index.d.ts +0 -0
- /package/{infra → lib/infra}/firebase/auth/index.d.ts +0 -0
- /package/{infra → lib/infra}/firebase/auth/types/firebase-user-with-id.type.d.ts +0 -0
- /package/{infra → lib/infra}/firebase/firestore/index.d.ts +0 -0
- /package/{infra → lib/infra}/firebase/firestore/mixins/index.d.ts +0 -0
- /package/{infra → lib/infra}/firebase/firestore/repositories/catalog/index.d.ts +0 -0
- /package/{infra → lib/infra}/firebase/firestore/repositories/index.d.ts +0 -0
- /package/{infra → lib/infra}/firebase/firestore/repositories/shop-settings/index.d.ts +0 -0
- /package/{infra → lib/infra}/firebase/firestore/repositories/shopping/index.d.ts +0 -0
- /package/{infra → lib/infra}/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.d.ts +0 -0
- /package/{infra → lib/infra}/firebase/firestore/repositories/users/index.d.ts +0 -0
- /package/{infra → lib/infra}/firebase/firestore/types/index.d.ts +0 -0
- /package/{infra → lib/infra}/firebase/index.d.ts +0 -0
- /package/{utils → lib/utils}/mixins/base.mixin.d.ts +0 -0
- /package/{utils → lib/utils}/types/prop.type.d.ts +0 -0
|
@@ -1,52 +1,33 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import {
|
|
3
|
-
import { __decorate, __metadata, __awaiter
|
|
4
|
-
import {
|
|
5
|
-
export {
|
|
6
|
-
import { isString, isNil, isNumber, isDate, set, isObject, isEmpty, chunk, isBoolean, isInteger, isNaN as isNaN$1, omit } from 'lodash';
|
|
7
|
-
export { chunk, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set } from 'lodash';
|
|
8
|
-
import { CustomError } from 'ts-custom-error';
|
|
9
|
-
import { Md5 } from 'ts-md5';
|
|
10
|
-
import axios from 'axios';
|
|
2
|
+
import { plainToClass, classToPlain, Expose, Type } from 'class-transformer';
|
|
3
|
+
import { __decorate, __metadata, __awaiter } from 'tslib';
|
|
4
|
+
import { isNil, isObject, isNumber, isString, isEmpty } from 'lodash';
|
|
5
|
+
export { chunk, isEmpty, isNil, isNumber, isObject, isString, pick } from 'lodash';
|
|
11
6
|
import firebase from 'firebase';
|
|
12
|
-
import
|
|
13
|
-
import fetch from 'node-fetch';
|
|
7
|
+
import firebase$1 from 'firebase/app';
|
|
14
8
|
|
|
15
9
|
class BaseModel {
|
|
16
|
-
get identifier() {
|
|
17
|
-
const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
|
|
18
|
-
return fields.reduce((object, field) => (Object.assign(Object.assign({}, object), { [field]: this[field] })), {});
|
|
19
|
-
}
|
|
20
|
-
get identifiersFields() {
|
|
21
|
-
return this.constructor.identifiersFields;
|
|
22
|
-
}
|
|
23
10
|
constructor(args) {
|
|
24
11
|
Object.assign(this, args);
|
|
25
12
|
}
|
|
26
13
|
static toInstance(data) {
|
|
27
|
-
return
|
|
28
|
-
}
|
|
29
|
-
static isModel(value) {
|
|
30
|
-
return value instanceof this;
|
|
14
|
+
return plainToClass(this, data);
|
|
31
15
|
}
|
|
32
16
|
toPlain() {
|
|
33
|
-
return
|
|
17
|
+
return classToPlain(this, { exposeUnsetFields: false });
|
|
34
18
|
}
|
|
35
19
|
}
|
|
36
20
|
|
|
37
21
|
var Where;
|
|
38
22
|
(function (Where) {
|
|
39
23
|
Where["EQUALS"] = "==";
|
|
24
|
+
Where["NOTEQUALS"] = "!=";
|
|
40
25
|
Where["GT"] = ">";
|
|
41
26
|
Where["GTE"] = ">=";
|
|
42
27
|
Where["IN"] = "in";
|
|
43
|
-
Where["NOTIN"] = "not in";
|
|
44
28
|
Where["LT"] = "<";
|
|
45
29
|
Where["LTE"] = "<=";
|
|
46
30
|
Where["LIKE"] = "like";
|
|
47
|
-
Where["NOTLIKE"] = "not like";
|
|
48
|
-
Where["ISNULL"] = "is null";
|
|
49
|
-
Where["ISNOTNULL"] = "is not null";
|
|
50
31
|
})(Where || (Where = {}));
|
|
51
32
|
|
|
52
33
|
var UpdateOptionActions;
|
|
@@ -279,13 +260,13 @@ var Status;
|
|
|
279
260
|
})(Status || (Status = {}));
|
|
280
261
|
|
|
281
262
|
class Edition extends BaseModel {
|
|
282
|
-
|
|
283
|
-
return ['id'
|
|
263
|
+
identifierFields() {
|
|
264
|
+
return ['id'];
|
|
284
265
|
}
|
|
285
266
|
}
|
|
286
267
|
|
|
287
268
|
class Payment extends BaseModel {
|
|
288
|
-
|
|
269
|
+
identifierFields() {
|
|
289
270
|
return ['id'];
|
|
290
271
|
}
|
|
291
272
|
}
|
|
@@ -451,8 +432,8 @@ __decorate([
|
|
|
451
432
|
], Payment.prototype, "pixExpirationDate", void 0);
|
|
452
433
|
|
|
453
434
|
class SubscriptionPayment extends BaseModel {
|
|
454
|
-
|
|
455
|
-
return ['id'
|
|
435
|
+
identifierFields() {
|
|
436
|
+
return ['id'];
|
|
456
437
|
}
|
|
457
438
|
}
|
|
458
439
|
__decorate([
|
|
@@ -461,9 +442,6 @@ __decorate([
|
|
|
461
442
|
], SubscriptionPayment.prototype, "payment", void 0);
|
|
462
443
|
|
|
463
444
|
class Address extends BaseModel {
|
|
464
|
-
static get identifiersFields() {
|
|
465
|
-
return ['id'];
|
|
466
|
-
}
|
|
467
445
|
}
|
|
468
446
|
|
|
469
447
|
var CheckoutTypes;
|
|
@@ -478,33 +456,12 @@ class Base {
|
|
|
478
456
|
}
|
|
479
457
|
}
|
|
480
458
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
!/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T\d{2}:\d{2}:\d{2}/.test(value))
|
|
488
|
-
return value;
|
|
489
|
-
const date = parseISO(value);
|
|
490
|
-
if (isNaN(date.getTime()))
|
|
491
|
-
return value;
|
|
492
|
-
return date;
|
|
493
|
-
};
|
|
494
|
-
|
|
495
|
-
var CouponTypes;
|
|
496
|
-
(function (CouponTypes) {
|
|
497
|
-
CouponTypes[CouponTypes["FINANCIAL"] = 1] = "FINANCIAL";
|
|
498
|
-
CouponTypes[CouponTypes["PRODUCT"] = 2] = "PRODUCT";
|
|
499
|
-
CouponTypes[CouponTypes["GIFTCARD"] = 3] = "GIFTCARD";
|
|
500
|
-
CouponTypes[CouponTypes["VOUCHER"] = 4] = "VOUCHER";
|
|
501
|
-
})(CouponTypes || (CouponTypes = {}));
|
|
502
|
-
|
|
503
|
-
var CouponSubtypes;
|
|
504
|
-
(function (CouponSubtypes) {
|
|
505
|
-
CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
506
|
-
CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
|
|
507
|
-
})(CouponSubtypes || (CouponSubtypes = {}));
|
|
459
|
+
var DiscountType;
|
|
460
|
+
(function (DiscountType) {
|
|
461
|
+
DiscountType[DiscountType["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
462
|
+
DiscountType[DiscountType["PERCENTAGE"] = 2] = "PERCENTAGE";
|
|
463
|
+
DiscountType[DiscountType["FREE_SHIPPING"] = 3] = "FREE_SHIPPING";
|
|
464
|
+
})(DiscountType || (DiscountType = {}));
|
|
508
465
|
|
|
509
466
|
var Exclusivities;
|
|
510
467
|
(function (Exclusivities) {
|
|
@@ -517,9 +474,17 @@ class Coupon extends BaseModel {
|
|
|
517
474
|
get isInfluencer() {
|
|
518
475
|
return !isNil(this.influencerEmail);
|
|
519
476
|
}
|
|
520
|
-
|
|
477
|
+
identifierFields() {
|
|
521
478
|
return ['id'];
|
|
522
479
|
}
|
|
480
|
+
calculeDiscount(amount) {
|
|
481
|
+
switch (this.discountType) {
|
|
482
|
+
case DiscountType.ABSOLUTE:
|
|
483
|
+
return this.discount < amount ? this.discount : amount;
|
|
484
|
+
case DiscountType.PERCENTAGE:
|
|
485
|
+
return this.discount * 0.01 * amount;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
523
488
|
}
|
|
524
489
|
__decorate([
|
|
525
490
|
Expose({ name: 'checkout_type' }),
|
|
@@ -531,7 +496,7 @@ __decorate([
|
|
|
531
496
|
], Coupon.prototype, "exclusivityType", void 0);
|
|
532
497
|
|
|
533
498
|
class SubscriptionPlan extends BaseModel {
|
|
534
|
-
|
|
499
|
+
identifierFields() {
|
|
535
500
|
return ['id'];
|
|
536
501
|
}
|
|
537
502
|
}
|
|
@@ -542,8 +507,8 @@ class BeautyProfile extends BaseModel {
|
|
|
542
507
|
delete plain.id;
|
|
543
508
|
return plain;
|
|
544
509
|
}
|
|
545
|
-
|
|
546
|
-
return ['id'
|
|
510
|
+
identifierFields() {
|
|
511
|
+
return ['id'];
|
|
547
512
|
}
|
|
548
513
|
}
|
|
549
514
|
|
|
@@ -554,14 +519,14 @@ class User extends BaseModel {
|
|
|
554
519
|
instance.displayName = `${data.firstName}${!isNil(data.lastName) ? ` ${data.lastName}` : ''}`;
|
|
555
520
|
return instance;
|
|
556
521
|
}
|
|
522
|
+
identifierFields() {
|
|
523
|
+
return ['id'];
|
|
524
|
+
}
|
|
557
525
|
toPlain() {
|
|
558
526
|
const plain = super.toPlain();
|
|
559
527
|
delete plain.beautyProfile;
|
|
560
528
|
return plain;
|
|
561
529
|
}
|
|
562
|
-
static get identifiersFields() {
|
|
563
|
-
return ['id'];
|
|
564
|
-
}
|
|
565
530
|
}
|
|
566
531
|
__decorate([
|
|
567
532
|
Type(() => BeautyProfile),
|
|
@@ -569,7 +534,7 @@ __decorate([
|
|
|
569
534
|
], User.prototype, "beautyProfile", void 0);
|
|
570
535
|
|
|
571
536
|
class Subscription extends BaseModel {
|
|
572
|
-
|
|
537
|
+
identifierFields() {
|
|
573
538
|
return ['id'];
|
|
574
539
|
}
|
|
575
540
|
}
|
|
@@ -603,24 +568,24 @@ __decorate([
|
|
|
603
568
|
], Subscription.prototype, "payment", void 0);
|
|
604
569
|
|
|
605
570
|
class UserAddress extends Address {
|
|
606
|
-
|
|
607
|
-
return ['id'
|
|
571
|
+
identifierFields() {
|
|
572
|
+
return ['id'];
|
|
608
573
|
}
|
|
609
574
|
}
|
|
610
575
|
|
|
611
576
|
class UserPaymentMethod extends BaseModel {
|
|
612
|
-
|
|
613
|
-
return ['id'
|
|
577
|
+
identifierFields() {
|
|
578
|
+
return ['id'];
|
|
614
579
|
}
|
|
615
580
|
}
|
|
616
581
|
|
|
617
582
|
class Lead extends BaseModel {
|
|
618
|
-
|
|
583
|
+
identifierFields() {
|
|
619
584
|
return ['id'];
|
|
620
585
|
}
|
|
621
586
|
}
|
|
622
587
|
|
|
623
|
-
class UnauthorizedError extends
|
|
588
|
+
class UnauthorizedError extends Error {
|
|
624
589
|
constructor(message) {
|
|
625
590
|
super(message);
|
|
626
591
|
this.message = message;
|
|
@@ -663,14 +628,14 @@ class Authentication {
|
|
|
663
628
|
}
|
|
664
629
|
}
|
|
665
630
|
|
|
666
|
-
class UserAlreadyRegisteredError extends
|
|
631
|
+
class UserAlreadyRegisteredError extends Error {
|
|
667
632
|
constructor(message) {
|
|
668
633
|
super(message);
|
|
669
634
|
this.message = message;
|
|
670
635
|
}
|
|
671
636
|
}
|
|
672
637
|
|
|
673
|
-
class WeakPasswordError extends
|
|
638
|
+
class WeakPasswordError extends Error {
|
|
674
639
|
constructor(message = 'Weak password') {
|
|
675
640
|
super(message);
|
|
676
641
|
this.message = message;
|
|
@@ -687,9 +652,9 @@ class Register {
|
|
|
687
652
|
const email = params.email.toLocaleLowerCase();
|
|
688
653
|
const displayName = `${params.firstName} ${params.lastName}`;
|
|
689
654
|
if (yield this.userRepository.checkIfExistsByField('cpf', params.cpf))
|
|
690
|
-
throw new UserAlreadyRegisteredError(`
|
|
655
|
+
throw new UserAlreadyRegisteredError(`User with CPF ${params.cpf} already registered`);
|
|
691
656
|
if (yield this.userRepository.checkIfExistsByField('email', params.email))
|
|
692
|
-
throw new UserAlreadyRegisteredError(`
|
|
657
|
+
throw new UserAlreadyRegisteredError(`User with E-mail ${params.email} already registered`);
|
|
693
658
|
const auth = yield this.registerService.register({
|
|
694
659
|
birthday: params.birthday,
|
|
695
660
|
email,
|
|
@@ -719,33 +684,18 @@ class SignOut {
|
|
|
719
684
|
}
|
|
720
685
|
}
|
|
721
686
|
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
728
|
-
yield this.authService.sendPasswordResetEmail(email);
|
|
729
|
-
});
|
|
730
|
-
}
|
|
731
|
-
}
|
|
687
|
+
var Shops;
|
|
688
|
+
(function (Shops) {
|
|
689
|
+
Shops["MENSMARKET"] = "mensmarket";
|
|
690
|
+
Shops["GLAMSHOP"] = "Glamshop";
|
|
691
|
+
})(Shops || (Shops = {}));
|
|
732
692
|
|
|
733
693
|
class Category extends BaseModel {
|
|
734
694
|
identifierFields() {
|
|
735
695
|
return ['id'];
|
|
736
696
|
}
|
|
737
|
-
static get identifiersFields() {
|
|
738
|
-
return ['id'];
|
|
739
|
-
}
|
|
740
697
|
}
|
|
741
698
|
|
|
742
|
-
var Shops;
|
|
743
|
-
(function (Shops) {
|
|
744
|
-
Shops["MENSMARKET"] = "mensmarket";
|
|
745
|
-
Shops["GLAMSHOP"] = "Glamshop";
|
|
746
|
-
Shops["GLAMPOINTS"] = "Glampoints";
|
|
747
|
-
})(Shops || (Shops = {}));
|
|
748
|
-
|
|
749
699
|
class Product extends BaseModel {
|
|
750
700
|
identifierFields() {
|
|
751
701
|
return ['id'];
|
|
@@ -754,61 +704,45 @@ class Product extends BaseModel {
|
|
|
754
704
|
var _a, _b, _c, _d, _e, _f;
|
|
755
705
|
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]) || {}));
|
|
756
706
|
}
|
|
757
|
-
static get identifiersFields() {
|
|
758
|
-
return ['id'];
|
|
759
|
-
}
|
|
760
707
|
}
|
|
761
|
-
__decorate([
|
|
762
|
-
Type(() => KitProduct),
|
|
763
|
-
__metadata("design:type", Array)
|
|
764
|
-
], Product.prototype, "kitProducts", void 0);
|
|
765
|
-
|
|
766
|
-
class KitProduct extends BaseModel {
|
|
767
|
-
static get identifiersFields() {
|
|
768
|
-
return ['productId', 'kitProducId'];
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
__decorate([
|
|
772
|
-
Type(() => Product),
|
|
773
|
-
__metadata("design:type", Product)
|
|
774
|
-
], KitProduct.prototype, "kit", void 0);
|
|
775
|
-
__decorate([
|
|
776
|
-
Type(() => Product),
|
|
777
|
-
__metadata("design:type", Product)
|
|
778
|
-
], KitProduct.prototype, "product", void 0);
|
|
779
708
|
|
|
780
709
|
class Variant extends BaseModel {
|
|
781
710
|
identifierFields() {
|
|
782
711
|
return ['id'];
|
|
783
712
|
}
|
|
784
|
-
|
|
785
|
-
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
class ClubCoupon extends Coupon {
|
|
716
|
+
constructor() {
|
|
717
|
+
super(...arguments);
|
|
718
|
+
this.checkoutType = CheckoutTypes.SUBSCRIPTION;
|
|
719
|
+
}
|
|
720
|
+
static isClubCoupon(coupon) {
|
|
721
|
+
return coupon instanceof ClubCoupon;
|
|
786
722
|
}
|
|
787
723
|
}
|
|
724
|
+
__decorate([
|
|
725
|
+
Expose({ name: 'checkout_type' }),
|
|
726
|
+
__metadata("design:type", Object)
|
|
727
|
+
], ClubCoupon.prototype, "checkoutType", void 0);
|
|
788
728
|
|
|
789
|
-
|
|
790
|
-
class FinancialCoupon extends Coupon {
|
|
729
|
+
class StoreCoupon extends Coupon {
|
|
791
730
|
constructor() {
|
|
792
731
|
super(...arguments);
|
|
793
|
-
this.
|
|
794
|
-
}
|
|
795
|
-
static
|
|
796
|
-
return coupon
|
|
797
|
-
}
|
|
798
|
-
static createCoupon(userId) {
|
|
799
|
-
return this.toInstance({
|
|
800
|
-
name: Md5.hashStr(`${userId}_${Date.now}`).toString(),
|
|
801
|
-
nickname: `${Date.now()}`,
|
|
802
|
-
type: CouponTypes.FINANCIAL,
|
|
803
|
-
subtype: CouponSubtypes.PERCENTAGE,
|
|
804
|
-
checkoutType: CheckoutTypes.ECOMMERCE,
|
|
805
|
-
discount: 30,
|
|
806
|
-
user: userId,
|
|
807
|
-
createdAt: new Date(Date.now()),
|
|
808
|
-
expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
|
|
809
|
-
});
|
|
732
|
+
this.checkoutType = CheckoutTypes.ECOMMERCE;
|
|
733
|
+
}
|
|
734
|
+
static isStoreCoupon(coupon) {
|
|
735
|
+
return coupon instanceof StoreCoupon;
|
|
810
736
|
}
|
|
811
737
|
}
|
|
738
|
+
__decorate([
|
|
739
|
+
Expose({ name: 'checkout_type' }),
|
|
740
|
+
__metadata("design:type", Object)
|
|
741
|
+
], StoreCoupon.prototype, "checkoutType", void 0);
|
|
742
|
+
__decorate([
|
|
743
|
+
Type(() => Category),
|
|
744
|
+
__metadata("design:type", Array)
|
|
745
|
+
], StoreCoupon.prototype, "categories", void 0);
|
|
812
746
|
|
|
813
747
|
var OrderStatus;
|
|
814
748
|
(function (OrderStatus) {
|
|
@@ -826,13 +760,21 @@ class LineItem extends Product {
|
|
|
826
760
|
}
|
|
827
761
|
|
|
828
762
|
class ShippingMethod extends BaseModel {
|
|
829
|
-
|
|
763
|
+
identifierFields() {
|
|
830
764
|
return ['id'];
|
|
831
765
|
}
|
|
832
766
|
}
|
|
833
767
|
|
|
834
768
|
class Checkout extends BaseModel {
|
|
835
|
-
|
|
769
|
+
get subTotalPrice() {
|
|
770
|
+
return this.lineItems.reduce((total, item) => {
|
|
771
|
+
return total + item.pricePaid;
|
|
772
|
+
}, 0);
|
|
773
|
+
}
|
|
774
|
+
get totalPrice() {
|
|
775
|
+
return this.totalPrice - this.discount;
|
|
776
|
+
}
|
|
777
|
+
identifierFields() {
|
|
836
778
|
return ['id'];
|
|
837
779
|
}
|
|
838
780
|
}
|
|
@@ -857,8 +799,8 @@ __decorate([
|
|
|
857
799
|
__metadata("design:type", ShippingMethod)
|
|
858
800
|
], Checkout.prototype, "shipping", void 0);
|
|
859
801
|
__decorate([
|
|
860
|
-
Type(() =>
|
|
861
|
-
__metadata("design:type",
|
|
802
|
+
Type(() => StoreCoupon),
|
|
803
|
+
__metadata("design:type", StoreCoupon)
|
|
862
804
|
], Checkout.prototype, "coupon", void 0);
|
|
863
805
|
|
|
864
806
|
class Order extends Checkout {
|
|
@@ -869,7 +811,7 @@ __decorate([
|
|
|
869
811
|
], Order.prototype, "payment", void 0);
|
|
870
812
|
|
|
871
813
|
class CheckoutSubscription extends BaseModel {
|
|
872
|
-
|
|
814
|
+
identifierFields() {
|
|
873
815
|
return ['id'];
|
|
874
816
|
}
|
|
875
817
|
}
|
|
@@ -891,7 +833,7 @@ __decorate([
|
|
|
891
833
|
], CheckoutSubscription.prototype, "coupon", void 0);
|
|
892
834
|
|
|
893
835
|
class Buy2Win extends BaseModel {
|
|
894
|
-
|
|
836
|
+
identifierFields() {
|
|
895
837
|
return ['id'];
|
|
896
838
|
}
|
|
897
839
|
}
|
|
@@ -987,25 +929,25 @@ class BeautyQuestionsHelper {
|
|
|
987
929
|
}
|
|
988
930
|
|
|
989
931
|
class Home extends BaseModel {
|
|
990
|
-
|
|
932
|
+
identifierFields() {
|
|
991
933
|
return ['id'];
|
|
992
934
|
}
|
|
993
935
|
}
|
|
994
936
|
|
|
995
937
|
class ShopMenu extends BaseModel {
|
|
996
|
-
|
|
938
|
+
identifierFields() {
|
|
997
939
|
return ['id'];
|
|
998
940
|
}
|
|
999
941
|
}
|
|
1000
942
|
|
|
1001
|
-
class InvalidArgumentError extends
|
|
943
|
+
class InvalidArgumentError extends Error {
|
|
1002
944
|
constructor(message) {
|
|
1003
945
|
super(message);
|
|
1004
946
|
this.message = message;
|
|
1005
947
|
}
|
|
1006
948
|
}
|
|
1007
949
|
|
|
1008
|
-
class RequiredArgumentError extends
|
|
950
|
+
class RequiredArgumentError extends Error {
|
|
1009
951
|
constructor(args) {
|
|
1010
952
|
super(`Required arguments: ${args.join(', ')}`);
|
|
1011
953
|
this.args = args;
|
|
@@ -1013,99 +955,25 @@ class RequiredArgumentError extends CustomError {
|
|
|
1013
955
|
}
|
|
1014
956
|
}
|
|
1015
957
|
|
|
1016
|
-
class NotFoundError extends
|
|
958
|
+
class NotFoundError extends Error {
|
|
1017
959
|
constructor(message) {
|
|
1018
960
|
super(message);
|
|
1019
961
|
this.message = message;
|
|
1020
962
|
}
|
|
1021
963
|
}
|
|
1022
964
|
|
|
1023
|
-
class DuplicatedResultsError extends
|
|
965
|
+
class DuplicatedResultsError extends Error {
|
|
1024
966
|
constructor(message) {
|
|
1025
967
|
super(message);
|
|
1026
968
|
this.message = message;
|
|
1027
969
|
}
|
|
1028
970
|
}
|
|
1029
971
|
|
|
1030
|
-
class AxiosAdapter {
|
|
1031
|
-
constructor(config) {
|
|
1032
|
-
this.config = config;
|
|
1033
|
-
}
|
|
1034
|
-
query(index, query) {
|
|
1035
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1036
|
-
const { data } = yield axios({
|
|
1037
|
-
url: `${this.config.url}/${index}`,
|
|
1038
|
-
method: 'POST',
|
|
1039
|
-
headers: { Authorization: `Basic ${this.config.credential}` },
|
|
1040
|
-
data: query,
|
|
1041
|
-
});
|
|
1042
|
-
return {
|
|
1043
|
-
total: data.hits.total.value,
|
|
1044
|
-
hits: data.hits.hits,
|
|
1045
|
-
};
|
|
1046
|
-
});
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
class ProductsIndex {
|
|
1051
|
-
constructor(adapter) {
|
|
1052
|
-
this.adapter = adapter;
|
|
1053
|
-
}
|
|
1054
|
-
findById(ids, options) {
|
|
1055
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1056
|
-
const publishedField = options.shop === Shops.GLAMSHOP ? 'publishedGlam' : 'published';
|
|
1057
|
-
const fields = [
|
|
1058
|
-
'brand',
|
|
1059
|
-
'id',
|
|
1060
|
-
'images',
|
|
1061
|
-
'miniatures',
|
|
1062
|
-
'name',
|
|
1063
|
-
'price',
|
|
1064
|
-
'sku',
|
|
1065
|
-
'stock',
|
|
1066
|
-
'slug',
|
|
1067
|
-
'reviews',
|
|
1068
|
-
'pricePaid',
|
|
1069
|
-
'isGift',
|
|
1070
|
-
'stock',
|
|
1071
|
-
'weight',
|
|
1072
|
-
'tags',
|
|
1073
|
-
'hasVariants',
|
|
1074
|
-
];
|
|
1075
|
-
const { hits } = yield this.adapter.query('products/_search', Object.assign({ _source: fields, query: {
|
|
1076
|
-
bool: {
|
|
1077
|
-
filter: [
|
|
1078
|
-
{
|
|
1079
|
-
terms: {
|
|
1080
|
-
_id: ids,
|
|
1081
|
-
},
|
|
1082
|
-
},
|
|
1083
|
-
{
|
|
1084
|
-
term: {
|
|
1085
|
-
[publishedField]: true,
|
|
1086
|
-
},
|
|
1087
|
-
},
|
|
1088
|
-
...(options.hasStock
|
|
1089
|
-
? [
|
|
1090
|
-
{
|
|
1091
|
-
range: {
|
|
1092
|
-
'stock.quantity': {
|
|
1093
|
-
gt: 0,
|
|
1094
|
-
},
|
|
1095
|
-
},
|
|
1096
|
-
},
|
|
1097
|
-
]
|
|
1098
|
-
: []),
|
|
1099
|
-
],
|
|
1100
|
-
},
|
|
1101
|
-
} }, (options.size ? { size: options.size } : {})));
|
|
1102
|
-
return hits.map((hit) => Product.toInstance(hit._source));
|
|
1103
|
-
});
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
972
|
const withFirestore = (MixinBase) => {
|
|
1108
973
|
return class extends MixinBase {
|
|
974
|
+
constructor(...args) {
|
|
975
|
+
super(args);
|
|
976
|
+
}
|
|
1109
977
|
collection(path) {
|
|
1110
978
|
return this.firestore.collection(path || this.collectionName).withConverter(this.buildModelInstance());
|
|
1111
979
|
}
|
|
@@ -1115,11 +983,11 @@ const withFirestore = (MixinBase) => {
|
|
|
1115
983
|
fromFirestore: (snap) => {
|
|
1116
984
|
const data = snap.data();
|
|
1117
985
|
Object.keys(data).forEach((key) => {
|
|
1118
|
-
if (data[key]
|
|
986
|
+
if (data[key] instanceof firebase.firestore.Timestamp) {
|
|
1119
987
|
data[key] = data[key].toDate();
|
|
1120
988
|
}
|
|
1121
989
|
});
|
|
1122
|
-
return this.model.toInstance(Object.assign(
|
|
990
|
+
return this.model.toInstance(Object.assign({ id: snap.id }, data));
|
|
1123
991
|
},
|
|
1124
992
|
};
|
|
1125
993
|
}
|
|
@@ -1168,9 +1036,6 @@ const withFindFirestore = (MixinBase) => {
|
|
|
1168
1036
|
const getValueFromFilter = (filter) => {
|
|
1169
1037
|
return checkIfIsFilterOption(filter) ? filter.value : filter;
|
|
1170
1038
|
};
|
|
1171
|
-
const getFinalValueFrom = (value) => isNumber(value) || isString(value) || isDate(value) || Array.isArray(value)
|
|
1172
|
-
? value
|
|
1173
|
-
: Object.values(getFinalValueFrom);
|
|
1174
1039
|
return class FindFirestore extends MixinBase {
|
|
1175
1040
|
constructor() {
|
|
1176
1041
|
super(...arguments);
|
|
@@ -1178,33 +1043,25 @@ const withFindFirestore = (MixinBase) => {
|
|
|
1178
1043
|
this.buildWhereSentence = (queryReference, fieldName, options) => {
|
|
1179
1044
|
if (this.isSubCollection(this) && fieldName === this.parentIdField)
|
|
1180
1045
|
return queryReference;
|
|
1181
|
-
const value = (options === null || options === void 0 ? void 0 : options.value) || options;
|
|
1182
|
-
const object = {};
|
|
1183
|
-
set(object, fieldName, value);
|
|
1184
|
-
const plainInstance = new this.model(object).toPlain();
|
|
1185
|
-
const firestoreFieldName = fieldName.toString().indexOf('.') > -1
|
|
1186
|
-
? fieldName.toString()
|
|
1187
|
-
: Object.keys(plainInstance).find((key) => plainInstance[key]);
|
|
1188
1046
|
if ((options === null || options === void 0 ? void 0 : options.operator) === Where.LIKE) {
|
|
1189
1047
|
if (Array.isArray(options === null || options === void 0 ? void 0 : options.value))
|
|
1190
|
-
return queryReference.where(
|
|
1191
|
-
queryReference = queryReference.where(
|
|
1192
|
-
queryReference = queryReference.where(
|
|
1048
|
+
return queryReference.where(fieldName.toString(), 'array-contains-any', options.value);
|
|
1049
|
+
queryReference = queryReference.where(fieldName.toString(), '>=', options.value);
|
|
1050
|
+
queryReference = queryReference.where(fieldName.toString(), '<=', `${options.value}~`);
|
|
1193
1051
|
return queryReference;
|
|
1194
1052
|
}
|
|
1195
1053
|
if ((options === null || options === void 0 ? void 0 : options.operator) === Where.IN && Array.isArray(options === null || options === void 0 ? void 0 : options.value))
|
|
1196
|
-
return queryReference.where(
|
|
1197
|
-
if (isObject(options) && isNil(options === null || options === void 0 ? void 0 : options.operator) && isNil(options === null || options === void 0 ? void 0 : options.value))
|
|
1198
|
-
return Object.keys(options).reduce((queryReferenceWithWhere, key) => this.buildWhereSentence(queryReferenceWithWhere, `${fieldName
|
|
1199
|
-
|
|
1200
|
-
return queryReference.where(firestoreFieldName, (options === null || options === void 0 ? void 0 : options.operator) || '==', (options === null || options === void 0 ? void 0 : options.value) || options);
|
|
1054
|
+
return queryReference.where(fieldName.toString(), 'array-contains', options.value);
|
|
1055
|
+
if (isObject(options) && isNil(options === null || options === void 0 ? void 0 : options.operator) && isNil(options === null || options === void 0 ? void 0 : options.value))
|
|
1056
|
+
return Object.keys(options).reduce((queryReferenceWithWhere, key) => this.buildWhereSentence(queryReferenceWithWhere, `${fieldName}.${key}`, options[key]), queryReference);
|
|
1057
|
+
return queryReference.where(fieldName.toString(), (options === null || options === void 0 ? void 0 : options.operator) || '==', (options === null || options === void 0 ? void 0 : options.value) || options);
|
|
1201
1058
|
};
|
|
1202
1059
|
}
|
|
1203
|
-
find(
|
|
1060
|
+
find(filters, limits, orderBy) {
|
|
1204
1061
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1205
|
-
let query = this.collection(this.buildCollectionPathForFind(filters
|
|
1206
|
-
query = this.makeFirestoreWhere(query,
|
|
1207
|
-
|
|
1062
|
+
let query = this.collection(this.buildCollectionPathForFind(filters));
|
|
1063
|
+
filters === null || filters === void 0 ? void 0 : filters.forEach((filterer) => (query = this.makeFirestoreWhere(query, filterer)));
|
|
1064
|
+
orderBy === null || orderBy === void 0 ? void 0 : orderBy.forEach((orderer) => Object.keys(orderer).forEach((fieldName) => (query = query.orderBy(fieldName, orderer[fieldName]))));
|
|
1208
1065
|
query = yield this.defineLimits(query, filters, limits);
|
|
1209
1066
|
const docs = yield query.get();
|
|
1210
1067
|
const data = docs.docs.map((doc) => doc.data());
|
|
@@ -1215,18 +1072,19 @@ const withFindFirestore = (MixinBase) => {
|
|
|
1215
1072
|
});
|
|
1216
1073
|
}
|
|
1217
1074
|
buildCollectionPathForFind(filters) {
|
|
1075
|
+
var _a;
|
|
1218
1076
|
if (!this.isSubCollection(this))
|
|
1219
1077
|
return this.collectionName;
|
|
1220
1078
|
const parentIdField = this.parentIdField;
|
|
1221
|
-
const parentId = getValueFromFilter(filters === null ||
|
|
1079
|
+
const parentId = getValueFromFilter((_a = filters.find((groupFilter) => Boolean(getValueFromFilter(groupFilter[parentIdField])))) === null || _a === void 0 ? void 0 : _a[parentIdField]);
|
|
1222
1080
|
return `${this.parentRepository.collectionName}/${parentId}/${this.collectionName}`;
|
|
1223
1081
|
}
|
|
1224
1082
|
defineLimits(query, filters, limits) {
|
|
1225
1083
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1226
1084
|
if (limits === null || limits === void 0 ? void 0 : limits.offset) {
|
|
1227
|
-
if (this.model
|
|
1085
|
+
if (limits.offset instanceof this.model)
|
|
1228
1086
|
query = query.startAfter(yield this.collection(this.buildCollectionPathForFind(filters))
|
|
1229
|
-
.doc(limits.offset[limits.offset.
|
|
1087
|
+
.doc(limits.offset[limits.offset.identifierFields().shift()])
|
|
1230
1088
|
.get());
|
|
1231
1089
|
else if (isNumber(limits.offset) || isString(limits.offset))
|
|
1232
1090
|
query = query.startAt(limits.offset);
|
|
@@ -1258,7 +1116,7 @@ const withCreateFirestore = (MixinBase) => {
|
|
|
1258
1116
|
save(data) {
|
|
1259
1117
|
var _a;
|
|
1260
1118
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1261
|
-
const id = (_a = data[data.
|
|
1119
|
+
const id = (_a = data[data.identifierFields().shift()]) === null || _a === void 0 ? void 0 : _a.toString();
|
|
1262
1120
|
const collectionPath = this.buildCollectionPathForAdd(data);
|
|
1263
1121
|
if (isEmpty(id))
|
|
1264
1122
|
return this.collection(collectionPath).add(data);
|
|
@@ -1295,7 +1153,7 @@ const withUpdateFirestore = (MixinBase) => {
|
|
|
1295
1153
|
update(data) {
|
|
1296
1154
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1297
1155
|
const model = new this.model();
|
|
1298
|
-
const keyField = model.
|
|
1156
|
+
const keyField = model.identifierFields().shift();
|
|
1299
1157
|
const docRef = this.collection(this.buildCollectionPathForUpdate(data)).doc(getValueFromParams(data, keyField).toString());
|
|
1300
1158
|
yield docRef.set(this.paramsToPlain(data), { merge: true });
|
|
1301
1159
|
const doc = yield docRef.get();
|
|
@@ -1309,8 +1167,8 @@ const withUpdateFirestore = (MixinBase) => {
|
|
|
1309
1167
|
}
|
|
1310
1168
|
paramsToPlain(params) {
|
|
1311
1169
|
const model = this.model;
|
|
1312
|
-
if (model
|
|
1313
|
-
return params
|
|
1170
|
+
if (params instanceof model)
|
|
1171
|
+
return params;
|
|
1314
1172
|
return Object.keys(params).reduce((data, currentKey) => (Object.assign(Object.assign({}, data), { [currentKey]: getValueByAction(params[currentKey]) })), {});
|
|
1315
1173
|
}
|
|
1316
1174
|
};
|
|
@@ -1359,7 +1217,7 @@ class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(with
|
|
|
1359
1217
|
}
|
|
1360
1218
|
|
|
1361
1219
|
class UserSearch extends BaseModel {
|
|
1362
|
-
|
|
1220
|
+
identifierFields() {
|
|
1363
1221
|
return ['id'];
|
|
1364
1222
|
}
|
|
1365
1223
|
}
|
|
@@ -1394,7 +1252,7 @@ class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
|
|
|
1394
1252
|
}
|
|
1395
1253
|
checkIfExistsByField(field, value) {
|
|
1396
1254
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1397
|
-
const result = yield this.userSearchFirestoreRepository.find({ [field]: { operator: Where.EQUALS, value } });
|
|
1255
|
+
const result = yield this.userSearchFirestoreRepository.find([{ [field]: { operator: Where.EQUALS, value } }]);
|
|
1398
1256
|
return result.count > 0;
|
|
1399
1257
|
});
|
|
1400
1258
|
}
|
|
@@ -1527,43 +1385,49 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
|
|
|
1527
1385
|
getCategoriesForHome(categoryIds, limit = 4) {
|
|
1528
1386
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1529
1387
|
const categorySnap = yield this.collection(this.collectionName)
|
|
1530
|
-
.where('id', 'in', categoryIds
|
|
1388
|
+
.where('id', 'in', categoryIds)
|
|
1531
1389
|
.where('published', '==', true)
|
|
1532
1390
|
.get();
|
|
1533
1391
|
if (categorySnap.empty)
|
|
1534
1392
|
throw new NotFoundError('Categories not found');
|
|
1535
1393
|
const categories = categorySnap.docs.map((doc) => doc.data());
|
|
1536
|
-
const homeSections =
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1394
|
+
const homeSections = [];
|
|
1395
|
+
for (const category of categories) {
|
|
1396
|
+
const publishedField = category.shop === Shops.GLAMSHOP ? 'publishedGlam' : 'published';
|
|
1397
|
+
const productSnap = yield this.collection('products')
|
|
1398
|
+
.where('categories', 'array-contains', category.id)
|
|
1399
|
+
.where(publishedField, '==', true)
|
|
1400
|
+
.where('stock.quantity', '>', 1)
|
|
1401
|
+
.limit(limit)
|
|
1402
|
+
.get();
|
|
1403
|
+
const products = productSnap.docs.map((doc) => doc.data());
|
|
1404
|
+
homeSections.push({ category, products });
|
|
1405
|
+
}
|
|
1542
1406
|
return homeSections;
|
|
1543
1407
|
});
|
|
1544
1408
|
}
|
|
1545
|
-
mountCategory(category
|
|
1409
|
+
mountCategory(category) {
|
|
1546
1410
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1547
1411
|
if (!category.products)
|
|
1548
1412
|
throw new RequiredArgumentError(['Category products is empty']);
|
|
1549
|
-
const chunks =
|
|
1413
|
+
const chunks = category.products.reduce((resultArray, item, index) => {
|
|
1414
|
+
const chunkIndex = Math.floor(index / 10);
|
|
1415
|
+
if (!resultArray[chunkIndex])
|
|
1416
|
+
resultArray[chunkIndex] = [];
|
|
1417
|
+
resultArray[chunkIndex].push(item);
|
|
1418
|
+
return resultArray;
|
|
1419
|
+
}, []);
|
|
1550
1420
|
const products = [];
|
|
1551
1421
|
const publishedField = category.shop === Shops.GLAMSHOP ? 'publishedGlam' : 'published';
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
break;
|
|
1555
|
-
let query = yield this.collection('productsErpVitrine')
|
|
1422
|
+
yield Promise.all(chunks.map((productIds) => __awaiter(this, void 0, void 0, function* () {
|
|
1423
|
+
const productSnap = yield this.collection('products')
|
|
1556
1424
|
.where(publishedField, '==', true)
|
|
1557
|
-
.where('id', 'in', productIds)
|
|
1558
|
-
|
|
1559
|
-
query = query.where('stock.quantity', '>', 0);
|
|
1560
|
-
if (options === null || options === void 0 ? void 0 : options.limit)
|
|
1561
|
-
query = query.limit(options === null || options === void 0 ? void 0 : options.limit);
|
|
1562
|
-
const productSnap = yield query.get();
|
|
1425
|
+
.where('id', 'in', productIds)
|
|
1426
|
+
.get();
|
|
1563
1427
|
if (productSnap.empty)
|
|
1564
|
-
|
|
1428
|
+
return;
|
|
1565
1429
|
products.push(...productSnap.docs.map((doc) => doc.data()));
|
|
1566
|
-
}
|
|
1430
|
+
})));
|
|
1567
1431
|
return products;
|
|
1568
1432
|
});
|
|
1569
1433
|
}
|
|
@@ -1573,49 +1437,19 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
|
|
|
1573
1437
|
constructor(firestore) {
|
|
1574
1438
|
super();
|
|
1575
1439
|
this.firestore = firestore;
|
|
1576
|
-
this.
|
|
1577
|
-
this.collectionName = 'productsErpVitrine';
|
|
1440
|
+
this.collectionName = 'products';
|
|
1578
1441
|
this.model = Product;
|
|
1579
1442
|
}
|
|
1580
1443
|
getBySlug(slug, shop) {
|
|
1581
1444
|
var _a;
|
|
1582
1445
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1583
|
-
const result = yield this.find(
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
},
|
|
1588
|
-
});
|
|
1446
|
+
const result = yield this.find([
|
|
1447
|
+
{ slug: { operator: Where.EQUALS, value: slug } },
|
|
1448
|
+
{ shopAvailability: { operator: Where.IN, value: [shop] } },
|
|
1449
|
+
]);
|
|
1589
1450
|
return (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift();
|
|
1590
1451
|
});
|
|
1591
1452
|
}
|
|
1592
|
-
fetchReviews(status) {
|
|
1593
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1594
|
-
const { data: products } = yield this.find();
|
|
1595
|
-
products.forEach((product) => {
|
|
1596
|
-
var _a;
|
|
1597
|
-
if ([undefined, 0].includes((_a = product.reviews) === null || _a === void 0 ? void 0 : _a.length))
|
|
1598
|
-
return;
|
|
1599
|
-
const productInfo = {
|
|
1600
|
-
productId: product.id,
|
|
1601
|
-
productName: product.name,
|
|
1602
|
-
productSku: product.sku,
|
|
1603
|
-
};
|
|
1604
|
-
this.reviews.pending = [];
|
|
1605
|
-
this.reviews.approved = [];
|
|
1606
|
-
this.reviews.rejected = [];
|
|
1607
|
-
product.reviews.forEach((review) => {
|
|
1608
|
-
if ([null, undefined].includes(review.status))
|
|
1609
|
-
return this.reviews.pending.push(Object.assign(Object.assign({}, review), productInfo));
|
|
1610
|
-
if (review.status === false)
|
|
1611
|
-
return this.reviews.rejected.push(Object.assign(Object.assign({}, review), productInfo));
|
|
1612
|
-
if (!!review.status)
|
|
1613
|
-
return this.reviews.approved.push(Object.assign(Object.assign({}, review), productInfo));
|
|
1614
|
-
});
|
|
1615
|
-
});
|
|
1616
|
-
return this.reviews[status];
|
|
1617
|
-
});
|
|
1618
|
-
}
|
|
1619
1453
|
}
|
|
1620
1454
|
|
|
1621
1455
|
class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Product) {
|
|
@@ -1655,19 +1489,28 @@ class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirest
|
|
|
1655
1489
|
this.model = Coupon;
|
|
1656
1490
|
}
|
|
1657
1491
|
buildModelInstance() {
|
|
1658
|
-
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
1659
1492
|
return {
|
|
1660
1493
|
toFirestore: (data) => {
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1494
|
+
var _a;
|
|
1495
|
+
const plain = (data === null || data === void 0 ? void 0 : data.toPlain) ? data.toPlain() : data;
|
|
1496
|
+
if (!!plain.categories)
|
|
1497
|
+
plain.categories = (_a = plain === null || plain === void 0 ? void 0 : plain.categories) === null || _a === void 0 ? void 0 : _a.map((category) => category.id);
|
|
1664
1498
|
return plain;
|
|
1665
1499
|
},
|
|
1666
1500
|
fromFirestore: (snap) => {
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1501
|
+
var _a;
|
|
1502
|
+
const data = snap.data();
|
|
1503
|
+
Object.keys(data).forEach((key) => {
|
|
1504
|
+
if (data[key] instanceof firebase.firestore.Timestamp) {
|
|
1505
|
+
data[key] = data[key].toDate();
|
|
1506
|
+
}
|
|
1507
|
+
});
|
|
1508
|
+
data.categories = (_a = data === null || data === void 0 ? void 0 : data.categories) === null || _a === void 0 ? void 0 : _a.map((category) => ({ id: category }));
|
|
1509
|
+
if (data.checkout_type === CheckoutTypes.SUBSCRIPTION)
|
|
1510
|
+
return ClubCoupon.toInstance(Object.assign({ id: snap.id }, data));
|
|
1511
|
+
if (data.checkout_type === CheckoutTypes.ECOMMERCE)
|
|
1512
|
+
return StoreCoupon.toInstance(Object.assign({ id: snap.id }, data));
|
|
1513
|
+
return this.model.toInstance(Object.assign({ id: snap.id }, data));
|
|
1671
1514
|
},
|
|
1672
1515
|
};
|
|
1673
1516
|
}
|
|
@@ -1730,52 +1573,9 @@ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
|
|
|
1730
1573
|
constructor(firestore) {
|
|
1731
1574
|
super();
|
|
1732
1575
|
this.firestore = firestore;
|
|
1733
|
-
this.homeToFirestore = (home) => {
|
|
1734
|
-
var _a;
|
|
1735
|
-
if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
|
|
1736
|
-
home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.homeCategoryGroupToPlain);
|
|
1737
|
-
home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.homeCategoryGroupToPlain);
|
|
1738
|
-
home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.homeCategoryGroupToPlain);
|
|
1739
|
-
}
|
|
1740
|
-
return home;
|
|
1741
|
-
};
|
|
1742
|
-
this.homeCategoryGroupToPlain = (homeCategoryGroup) => ({
|
|
1743
|
-
category: homeCategoryGroup.category.toPlain(),
|
|
1744
|
-
products: homeCategoryGroup.products.map((product) => product.toPlain()),
|
|
1745
|
-
});
|
|
1746
|
-
this.homeFromFirestore = (home) => {
|
|
1747
|
-
var _a;
|
|
1748
|
-
if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
|
|
1749
|
-
home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
|
|
1750
|
-
home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
|
|
1751
|
-
home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
|
|
1752
|
-
home.data.createdAt =
|
|
1753
|
-
home.data.createdAt instanceof firebase.firestore.Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
|
|
1754
|
-
home.data.expiresAt =
|
|
1755
|
-
home.data.expiresAt instanceof firebase.firestore.Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
|
|
1756
|
-
}
|
|
1757
|
-
return home;
|
|
1758
|
-
};
|
|
1759
|
-
this.plainToHomeCategoryGroup = (homeCategoryGroup) => ({
|
|
1760
|
-
category: Category.toInstance(homeCategoryGroup.category),
|
|
1761
|
-
products: homeCategoryGroup.products.map((product) => Product.toInstance(product)),
|
|
1762
|
-
});
|
|
1763
1576
|
this.collectionName = 'dms';
|
|
1764
1577
|
this.model = Home;
|
|
1765
1578
|
}
|
|
1766
|
-
buildModelInstance() {
|
|
1767
|
-
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
1768
|
-
return {
|
|
1769
|
-
toFirestore: (data) => {
|
|
1770
|
-
const modifiedData = this.homeToFirestore(data);
|
|
1771
|
-
return toFirestore(modifiedData);
|
|
1772
|
-
},
|
|
1773
|
-
fromFirestore: (snap) => {
|
|
1774
|
-
const instance = fromFirestore(snap);
|
|
1775
|
-
return this.homeFromFirestore(instance);
|
|
1776
|
-
},
|
|
1777
|
-
};
|
|
1778
|
-
}
|
|
1779
1579
|
}
|
|
1780
1580
|
|
|
1781
1581
|
class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
@@ -1806,7 +1606,7 @@ class AuthenticationFirebaseAuthService {
|
|
|
1806
1606
|
}
|
|
1807
1607
|
signInWithGoogle() {
|
|
1808
1608
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1809
|
-
const credentials = yield this.firebaseAuth.signInWithPopup(new firebase.auth.GoogleAuthProvider());
|
|
1609
|
+
const credentials = yield this.firebaseAuth.signInWithPopup(new firebase$1.auth.GoogleAuthProvider());
|
|
1810
1610
|
const user = credentials.user;
|
|
1811
1611
|
return {
|
|
1812
1612
|
id: user.uid,
|
|
@@ -1830,11 +1630,6 @@ class AuthenticationFirebaseAuthService {
|
|
|
1830
1630
|
return user;
|
|
1831
1631
|
});
|
|
1832
1632
|
}
|
|
1833
|
-
sendPasswordResetEmail(email) {
|
|
1834
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1835
|
-
return this.firebaseAuth.sendPasswordResetEmail(email);
|
|
1836
|
-
});
|
|
1837
|
-
}
|
|
1838
1633
|
}
|
|
1839
1634
|
|
|
1840
1635
|
class RegisterFirebaseAuthService {
|
|
@@ -1861,1097 +1656,9 @@ class RegisterFirebaseAuthService {
|
|
|
1861
1656
|
}
|
|
1862
1657
|
}
|
|
1863
1658
|
|
|
1864
|
-
class AttributeOptionHelper {
|
|
1865
|
-
}
|
|
1866
|
-
AttributeOptionHelper.FindByAttribute = (attributeName, fields) => {
|
|
1867
|
-
if (fields.includes(attributeName))
|
|
1868
|
-
return { columnName: attributeName.toString(), attributeName };
|
|
1869
|
-
const field = fields.find((columnOption) => isObject(columnOption) && Object.keys(columnOption).includes(attributeName.toString()));
|
|
1870
|
-
const fieldOption = field === null || field === void 0 ? void 0 : field[attributeName.toString()];
|
|
1871
|
-
if (isNil(fieldOption))
|
|
1872
|
-
return { columnName: attributeName.toString(), attributeName };
|
|
1873
|
-
if (Array.isArray(fieldOption))
|
|
1874
|
-
return { columnName: attributeName.toString(), attributeName, fields: fieldOption };
|
|
1875
|
-
return Object.assign({ attributeName, columnName: attributeName.toString() }, fieldOption);
|
|
1876
|
-
};
|
|
1877
|
-
AttributeOptionHelper.CheckIsColumnOption = (fieldValue) => !!fieldValue.columnName;
|
|
1878
|
-
AttributeOptionHelper.FindColumnOptionFromList = (columnName, fields) => {
|
|
1879
|
-
if (fields.includes(columnName))
|
|
1880
|
-
return { columnName, attributeName: columnName };
|
|
1881
|
-
const field = fields.find((columnOption) => {
|
|
1882
|
-
var _a;
|
|
1883
|
-
return isObject(columnOption) &&
|
|
1884
|
-
((_a = Object.values(columnOption).find((option) => AttributeOptionHelper.CheckIsColumnOption(option) && option.columnName === columnName)) === null || _a === void 0 ? void 0 : _a.columnName) === columnName;
|
|
1885
|
-
}) || {};
|
|
1886
|
-
const attributeName = Object.keys(field).find((fieldOptionFromList) => AttributeOptionHelper.CheckIsColumnOption(field[fieldOptionFromList]) ||
|
|
1887
|
-
Array.isArray(field[fieldOptionFromList]));
|
|
1888
|
-
const fieldOption = field === null || field === void 0 ? void 0 : field[attributeName];
|
|
1889
|
-
if (Array.isArray(fieldOption))
|
|
1890
|
-
return { attributeName: attributeName, fields: fieldOption };
|
|
1891
|
-
return Object.assign({ attributeName: attributeName || columnName, columnName }, fieldOption);
|
|
1892
|
-
};
|
|
1893
|
-
|
|
1894
|
-
class GraphQLFieldHelper {
|
|
1895
|
-
}
|
|
1896
|
-
GraphQLFieldHelper.CheckIsGraphQLParams = (params) => !isString(params) && Array.isArray(params) && params.length >= 0 && !!params[0].operation;
|
|
1897
|
-
GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields = (fields) => {
|
|
1898
|
-
return fields === null || fields === void 0 ? void 0 : fields.map((field) => {
|
|
1899
|
-
if (isString(field))
|
|
1900
|
-
return field.toString();
|
|
1901
|
-
const fieldName = Object.keys(field).shift();
|
|
1902
|
-
const fieldValue = field[fieldName];
|
|
1903
|
-
if (Array.isArray(fieldValue))
|
|
1904
|
-
return { [fieldName]: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue) };
|
|
1905
|
-
if (!AttributeOptionHelper.CheckIsColumnOption(fieldValue))
|
|
1906
|
-
return;
|
|
1907
|
-
if (fieldValue.fields)
|
|
1908
|
-
return {
|
|
1909
|
-
[fieldValue.columnName || fieldName]: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
|
|
1910
|
-
};
|
|
1911
|
-
return fieldValue.columnName;
|
|
1912
|
-
}).filter((field) => !!field);
|
|
1913
|
-
};
|
|
1914
|
-
GraphQLFieldHelper.ConvertFieldValueFrom = (data, fields) => Object.keys(data).reduce((result, columnName) => {
|
|
1915
|
-
const { attributeName, fields: attributeFields, from, } = AttributeOptionHelper.FindColumnOptionFromList(columnName, fields);
|
|
1916
|
-
if (!!attributeFields && Array.isArray(attributeFields)) {
|
|
1917
|
-
if (Array.isArray(data[columnName]))
|
|
1918
|
-
return Object.assign(Object.assign({}, result), { [attributeName]: from
|
|
1919
|
-
? from(data[columnName], data)
|
|
1920
|
-
: data[columnName].map((value) => GraphQLFieldHelper.ConvertFieldValueFrom(value, attributeFields)) });
|
|
1921
|
-
if (isObject(data[columnName]))
|
|
1922
|
-
return Object.assign(Object.assign({}, result), { [attributeName]: GraphQLFieldHelper.ConvertFieldValueFrom(data[columnName], attributeFields) });
|
|
1923
|
-
}
|
|
1924
|
-
if (!!from)
|
|
1925
|
-
return Object.assign(Object.assign({}, result), { [attributeName]: from(data[columnName], data) });
|
|
1926
|
-
return Object.assign(Object.assign({}, result), { [attributeName]: parseDateTime(data[columnName]) });
|
|
1927
|
-
}, {});
|
|
1928
|
-
GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
|
|
1929
|
-
var _a;
|
|
1930
|
-
const data = ((_a = instance.toPlain) === null || _a === void 0 ? void 0 : _a.call(instance)) || instance;
|
|
1931
|
-
return Object.keys(data).reduce((result, attributeName) => {
|
|
1932
|
-
const { columnName, fields: attributeFields, foreignKeyColumn, to, bindPersistData, } = AttributeOptionHelper.FindByAttribute(attributeName, fields);
|
|
1933
|
-
if (bindPersistData)
|
|
1934
|
-
return Object.assign(Object.assign({}, result), bindPersistData(data[attributeName], instance));
|
|
1935
|
-
if (isNil(columnName))
|
|
1936
|
-
return result;
|
|
1937
|
-
if (!!foreignKeyColumn &&
|
|
1938
|
-
!isEmpty(foreignKeyColumn) &&
|
|
1939
|
-
!Object.keys(foreignKeyColumn).filter((key) => { var _a; return !((_a = data[attributeName]) === null || _a === void 0 ? void 0 : _a[key]); }).length)
|
|
1940
|
-
return Object.keys(foreignKeyColumn).reduce((object, current) => { var _a; return (Object.assign(Object.assign({}, object), { [foreignKeyColumn[current]]: (_a = data[attributeName]) === null || _a === void 0 ? void 0 : _a[current] })); }, Object.assign({}, result));
|
|
1941
|
-
if (update && isObject(data[attributeName]) && !isNil(attributeFields) && !isDate(data[attributeName]))
|
|
1942
|
-
return result;
|
|
1943
|
-
if (!!columnName && Array.isArray(attributeFields) && isObject(data[attributeName])) {
|
|
1944
|
-
const converted = !isNil(columnName) && to ? to(instance[attributeName], instance) : data[attributeName];
|
|
1945
|
-
return Object.assign(Object.assign({}, result), (converted !== undefined
|
|
1946
|
-
? {
|
|
1947
|
-
[columnName]: {
|
|
1948
|
-
data: instance[attributeName] instanceof BaseModel
|
|
1949
|
-
? GraphQLFieldHelper.ConvertFieldValueTo(data[attributeName], attributeFields)
|
|
1950
|
-
: converted,
|
|
1951
|
-
},
|
|
1952
|
-
}
|
|
1953
|
-
: {}));
|
|
1954
|
-
}
|
|
1955
|
-
if (!!to)
|
|
1956
|
-
return Object.assign(Object.assign({}, result), { [columnName]: to(instance[attributeName], instance) });
|
|
1957
|
-
return Object.assign(Object.assign({}, result), { [columnName]: data[attributeName] });
|
|
1958
|
-
}, {});
|
|
1959
|
-
};
|
|
1960
|
-
|
|
1961
|
-
class FilterOptionHelper {
|
|
1962
|
-
}
|
|
1963
|
-
FilterOptionHelper.CheckIfIsFilterOption = (filter) => !isNil(filter === null || filter === void 0 ? void 0 : filter.operator);
|
|
1964
|
-
FilterOptionHelper.GetValueFromFilter = (filter, fieldOption) => {
|
|
1965
|
-
if (!FilterOptionHelper.CheckIfIsFilterOption(filter))
|
|
1966
|
-
return filter;
|
|
1967
|
-
if (filter.operator === Where.ISNULL)
|
|
1968
|
-
return true;
|
|
1969
|
-
if (filter.operator === Where.ISNOTNULL)
|
|
1970
|
-
return false;
|
|
1971
|
-
const converter = fieldOption.to ? fieldOption.to : (value) => value;
|
|
1972
|
-
return Array.isArray(filter.value) && !fieldOption.fields && [Where.IN, Where.NOTIN].includes(filter.operator)
|
|
1973
|
-
? filter.value.map((fieldValue) => converter(fieldValue))
|
|
1974
|
-
: converter(filter.value);
|
|
1975
|
-
};
|
|
1976
|
-
|
|
1977
|
-
const withCreateHasuraGraphQL = (MixinBase) => {
|
|
1978
|
-
return class CreateHasuraGraphQLMixin extends MixinBase {
|
|
1979
|
-
constructor(...params) {
|
|
1980
|
-
const options = params === null || params === void 0 ? void 0 : params[0];
|
|
1981
|
-
super(...params);
|
|
1982
|
-
this.insertGraphQLOperation = (options === null || options === void 0 ? void 0 : options.insertGraphQLOperation) || `insert_${this.tableName}_one`;
|
|
1983
|
-
this.insertGraphQLObjectType = (options === null || options === void 0 ? void 0 : options.insertGraphQLObjectType) || `${this.tableName}_insert_input`;
|
|
1984
|
-
}
|
|
1985
|
-
create(data) {
|
|
1986
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1987
|
-
const newData = yield this.save(this.model.toInstance(data));
|
|
1988
|
-
return this.model.toInstance(newData);
|
|
1989
|
-
});
|
|
1990
|
-
}
|
|
1991
|
-
save(data) {
|
|
1992
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1993
|
-
const primaryKeyColumns = this.model.identifiersFields.map((field) => AttributeOptionHelper.FindByAttribute(field, this.fields).columnName);
|
|
1994
|
-
const foreignKeyColumns = this.fields
|
|
1995
|
-
.map((field) => {
|
|
1996
|
-
const columnOptions = Object.values(field).shift();
|
|
1997
|
-
return (AttributeOptionHelper.CheckIsColumnOption(columnOptions) &&
|
|
1998
|
-
columnOptions.foreignKeyColumn && [
|
|
1999
|
-
...Object.values(columnOptions.foreignKeyColumn),
|
|
2000
|
-
{
|
|
2001
|
-
[columnOptions.columnName]: Object.keys(columnOptions.foreignKeyColumn).map((foreignKeyField) => {
|
|
2002
|
-
var _a;
|
|
2003
|
-
return ((_a = AttributeOptionHelper.FindByAttribute(foreignKeyField, columnOptions === null || columnOptions === void 0 ? void 0 : columnOptions.fields)) === null || _a === void 0 ? void 0 : _a.columnName) ||
|
|
2004
|
-
foreignKeyField;
|
|
2005
|
-
}),
|
|
2006
|
-
},
|
|
2007
|
-
]);
|
|
2008
|
-
})
|
|
2009
|
-
.filter(Boolean)
|
|
2010
|
-
.reduce((keys, current) => [...keys, ...current], []);
|
|
2011
|
-
const result = yield this.mutation(this.insertGraphQLOperation, [...primaryKeyColumns, ...foreignKeyColumns], {
|
|
2012
|
-
object: { type: this.insertGraphQLObjectType, required: true, value: this.convertDataToHasura(data) },
|
|
2013
|
-
});
|
|
2014
|
-
return Object.assign(Object.assign({}, data.toPlain()), this.convertDataFromHasura(result[this.insertGraphQLOperation]).toPlain());
|
|
2015
|
-
});
|
|
2016
|
-
}
|
|
2017
|
-
};
|
|
2018
|
-
};
|
|
2019
|
-
|
|
2020
|
-
const withDeleteHasuraGraphQL = (MixinBase) => {
|
|
2021
|
-
return class DeleteHasuraGraphQLMixin extends MixinBase {
|
|
2022
|
-
constructor(...params) {
|
|
2023
|
-
const options = params === null || params === void 0 ? void 0 : params[0];
|
|
2024
|
-
super(...params);
|
|
2025
|
-
this.deleteGraphQLOperation = (options === null || options === void 0 ? void 0 : options.deleteGraphQLOperation) || `delete_${this.tableName}_by_pk`;
|
|
2026
|
-
}
|
|
2027
|
-
delete(identifiers) {
|
|
2028
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2029
|
-
const instance = this.model.toInstance(identifiers);
|
|
2030
|
-
yield this.mutation(this.deleteGraphQLOperation, this.model.identifiersFields.map((field) => AttributeOptionHelper.FindByAttribute(field, this.fields).columnName), this.model.identifiersFields.reduce((ids, identifier) => {
|
|
2031
|
-
if (isNil(instance[identifier]))
|
|
2032
|
-
return ids;
|
|
2033
|
-
const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
|
|
2034
|
-
const value = columnOption.to(identifiers[identifier.toString()], instance);
|
|
2035
|
-
return Object.assign(Object.assign({}, ids), { [columnOption.columnName]: {
|
|
2036
|
-
type: this.getAttributeGraphQLTypeOf(columnOption.type || value),
|
|
2037
|
-
value,
|
|
2038
|
-
required: true,
|
|
2039
|
-
} });
|
|
2040
|
-
}, {}));
|
|
2041
|
-
});
|
|
2042
|
-
}
|
|
2043
|
-
};
|
|
2044
|
-
};
|
|
2045
|
-
|
|
2046
|
-
const withHasuraGraphQL = (MixinBase) => {
|
|
2047
|
-
return class HasuraGraphQLMixin extends MixinBase {
|
|
2048
|
-
constructor(...params) {
|
|
2049
|
-
const options = params[0];
|
|
2050
|
-
super(...params);
|
|
2051
|
-
this.tableName = options.tableName;
|
|
2052
|
-
this.endpoint = options.endpoint;
|
|
2053
|
-
this.authOptions = options.authOptions;
|
|
2054
|
-
this.model = options.model;
|
|
2055
|
-
this.fields = options.fields || this.model.identifiersFields;
|
|
2056
|
-
}
|
|
2057
|
-
get headers() {
|
|
2058
|
-
return Object.assign(Object.assign(Object.assign({ 'Content-Type': 'application/json' }, (isNil(this.authOptions.authToken) ? {} : { Authorization: this.authOptions.authToken })), (isNil(this.authOptions.adminSecret) ? {} : { 'X-Hasura-Admin-Secret': this.authOptions.adminSecret })), (isNil(this.authOptions.authRole)
|
|
2059
|
-
? {}
|
|
2060
|
-
: { 'X-Hasura-Role': this.authOptions.authRole.role, 'X-Hasura-User-Id': this.authOptions.authRole.userId }));
|
|
2061
|
-
}
|
|
2062
|
-
mutation(operation, fields, variables) {
|
|
2063
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2064
|
-
const resultQuery = mutation({
|
|
2065
|
-
operation,
|
|
2066
|
-
variables,
|
|
2067
|
-
fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fields),
|
|
2068
|
-
});
|
|
2069
|
-
return this.fetch(resultQuery);
|
|
2070
|
-
});
|
|
2071
|
-
}
|
|
2072
|
-
query(operation, fields, variables) {
|
|
2073
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2074
|
-
const resultQuery = GraphQLFieldHelper.CheckIsGraphQLParams(operation)
|
|
2075
|
-
? query(operation.map((option) => ({
|
|
2076
|
-
operation: option.operation,
|
|
2077
|
-
variables: option.variables,
|
|
2078
|
-
fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(option.fields),
|
|
2079
|
-
})))
|
|
2080
|
-
: query({
|
|
2081
|
-
operation,
|
|
2082
|
-
variables,
|
|
2083
|
-
fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fields),
|
|
2084
|
-
});
|
|
2085
|
-
JSON.stringify(resultQuery);
|
|
2086
|
-
return this.fetch(resultQuery);
|
|
2087
|
-
});
|
|
2088
|
-
}
|
|
2089
|
-
fetch(params) {
|
|
2090
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2091
|
-
const headers = this.headers;
|
|
2092
|
-
const response = yield fetch(`${this.endpoint}`, {
|
|
2093
|
-
method: 'POST',
|
|
2094
|
-
body: JSON.stringify(params),
|
|
2095
|
-
headers,
|
|
2096
|
-
});
|
|
2097
|
-
const result = yield response.json();
|
|
2098
|
-
if (!isNil(result.errors))
|
|
2099
|
-
throw new Error(JSON.stringify(result.errors));
|
|
2100
|
-
return result.data;
|
|
2101
|
-
});
|
|
2102
|
-
}
|
|
2103
|
-
getAttributeGraphQLTypeOf(value) {
|
|
2104
|
-
if (isUUID(value))
|
|
2105
|
-
return 'uuid';
|
|
2106
|
-
if (isString(value))
|
|
2107
|
-
return 'String';
|
|
2108
|
-
if (isBoolean(value))
|
|
2109
|
-
return 'Boolean';
|
|
2110
|
-
if (value instanceof Date)
|
|
2111
|
-
return 'timestamptz';
|
|
2112
|
-
if (isInteger(value))
|
|
2113
|
-
return 'Int';
|
|
2114
|
-
if (isNumber(value))
|
|
2115
|
-
return 'numeric';
|
|
2116
|
-
throw new Error('Type not implemented yet');
|
|
2117
|
-
}
|
|
2118
|
-
checkIfIsDateTimeAndParse(value) {
|
|
2119
|
-
if (!/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.test(value))
|
|
2120
|
-
return value;
|
|
2121
|
-
const date = parseISO(value);
|
|
2122
|
-
if (isNaN$1(date.getTime()))
|
|
2123
|
-
return value;
|
|
2124
|
-
return date;
|
|
2125
|
-
}
|
|
2126
|
-
convertDataFromHasura(data) {
|
|
2127
|
-
const plain = GraphQLFieldHelper.ConvertFieldValueFrom(data, this.fields);
|
|
2128
|
-
return this.model.toInstance(plain);
|
|
2129
|
-
}
|
|
2130
|
-
convertDataToHasura(instance, update = false) {
|
|
2131
|
-
return GraphQLFieldHelper.ConvertFieldValueTo(instance, this.fields, update);
|
|
2132
|
-
}
|
|
2133
|
-
};
|
|
2134
|
-
};
|
|
2135
|
-
|
|
2136
|
-
const withUpdateHasuraGraphQL = (MixinBase) => {
|
|
2137
|
-
const getValueByAction = (options) => {
|
|
2138
|
-
if (options instanceof BaseModel)
|
|
2139
|
-
return options.toPlain();
|
|
2140
|
-
if (isNil(options === null || options === void 0 ? void 0 : options.action))
|
|
2141
|
-
return options;
|
|
2142
|
-
if ([UpdateOptionActions.REMOVE_FIELD.toString(), UpdateOptionActions.NULL.toString()].includes(options.action))
|
|
2143
|
-
return null;
|
|
2144
|
-
return options.value;
|
|
2145
|
-
};
|
|
2146
|
-
return class UpdateHasuraGraphQLMixin extends MixinBase {
|
|
2147
|
-
constructor(...params) {
|
|
2148
|
-
const options = params === null || params === void 0 ? void 0 : params[0];
|
|
2149
|
-
super(...params);
|
|
2150
|
-
this.updateGraphQLOperation = (options === null || options === void 0 ? void 0 : options.updateGraphQLOperation) || `update_${this.tableName}_by_pk`;
|
|
2151
|
-
this.updateGraphQLObjectType = (options === null || options === void 0 ? void 0 : options.updateGraphQLObjectType) || `${this.tableName}_set_input`;
|
|
2152
|
-
this.updateGraphQLPKType = (options === null || options === void 0 ? void 0 : options.updateGraphQLPKType) || `${this.tableName}_pk_columns_input`;
|
|
2153
|
-
}
|
|
2154
|
-
update(data) {
|
|
2155
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2156
|
-
const plainData = this.paramsToPlain(data);
|
|
2157
|
-
yield this.mutation(this.updateGraphQLOperation, this.model.identifiersFields.map((field) => AttributeOptionHelper.FindByAttribute(field, this.fields).columnName), {
|
|
2158
|
-
_set: {
|
|
2159
|
-
type: this.updateGraphQLObjectType,
|
|
2160
|
-
value: this.convertDataToHasura(this.model.toInstance(plainData), true),
|
|
2161
|
-
required: true,
|
|
2162
|
-
},
|
|
2163
|
-
pk_columns: { type: this.updateGraphQLPKType, value: this.getUpdateModelKeys(plainData), required: true },
|
|
2164
|
-
});
|
|
2165
|
-
return this.model.toInstance(plainData);
|
|
2166
|
-
});
|
|
2167
|
-
}
|
|
2168
|
-
paramsToPlain(params) {
|
|
2169
|
-
const model = this.model;
|
|
2170
|
-
if (model.isModel(params))
|
|
2171
|
-
return params.toPlain();
|
|
2172
|
-
return Object.keys(params).reduce((data, currentKey) => (Object.assign(Object.assign({}, data), (params[currentKey] !== undefined && { [currentKey]: getValueByAction(params[currentKey]) }))), {});
|
|
2173
|
-
}
|
|
2174
|
-
getUpdateModelKeys(data) {
|
|
2175
|
-
const instance = this.model.toInstance(data);
|
|
2176
|
-
return this.model.identifiersFields.reduce((ids, identifier) => {
|
|
2177
|
-
var _a;
|
|
2178
|
-
if (isNil(instance[identifier]))
|
|
2179
|
-
return ids;
|
|
2180
|
-
const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
|
|
2181
|
-
const value = ((_a = columnOption === null || columnOption === void 0 ? void 0 : columnOption.to) === null || _a === void 0 ? void 0 : _a.call(columnOption, data[identifier.toString()], instance)) || data[columnOption.attributeName];
|
|
2182
|
-
return Object.assign(Object.assign({}, ids), { [columnOption.columnName]: value });
|
|
2183
|
-
}, {});
|
|
2184
|
-
}
|
|
2185
|
-
};
|
|
2186
|
-
};
|
|
2187
|
-
|
|
2188
|
-
const withGetHasuraGraphQL = (MixinBase) => {
|
|
2189
|
-
return class GetHasuraGraphQLMixin extends MixinBase {
|
|
2190
|
-
constructor(...params) {
|
|
2191
|
-
const options = params === null || params === void 0 ? void 0 : params[0];
|
|
2192
|
-
super(...params);
|
|
2193
|
-
this.getGraphQLOperation = (options === null || options === void 0 ? void 0 : options.getGraphQLOperation) || `${this.tableName}_by_pk`;
|
|
2194
|
-
}
|
|
2195
|
-
get(identifiers) {
|
|
2196
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2197
|
-
const instance = this.model.toInstance(identifiers);
|
|
2198
|
-
const result = yield this.query(this.getGraphQLOperation, this.fields, this.model.identifiersFields.reduce((ids, identifier) => {
|
|
2199
|
-
var _a;
|
|
2200
|
-
if (isNil(instance[identifier]))
|
|
2201
|
-
return ids;
|
|
2202
|
-
const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
|
|
2203
|
-
const value = ((_a = columnOption === null || columnOption === void 0 ? void 0 : columnOption.to) === null || _a === void 0 ? void 0 : _a.call(columnOption, identifiers[identifier.toString()], instance)) || identifiers[identifier.toString()];
|
|
2204
|
-
return Object.assign(Object.assign({}, ids), { [columnOption.columnName]: {
|
|
2205
|
-
type: this.getAttributeGraphQLTypeOf(columnOption.type || value),
|
|
2206
|
-
value,
|
|
2207
|
-
required: true,
|
|
2208
|
-
} });
|
|
2209
|
-
}, {}));
|
|
2210
|
-
const data = result[this.getGraphQLOperation];
|
|
2211
|
-
if (isNil(data))
|
|
2212
|
-
throw new NotFoundError(`${instance.constructor.name} not found`);
|
|
2213
|
-
return this.convertDataFromHasura(result[this.getGraphQLOperation]);
|
|
2214
|
-
});
|
|
2215
|
-
}
|
|
2216
|
-
};
|
|
2217
|
-
};
|
|
2218
|
-
|
|
2219
|
-
var HasuraGraphQLWhere;
|
|
2220
|
-
(function (HasuraGraphQLWhere) {
|
|
2221
|
-
HasuraGraphQLWhere["EQUALS"] = "_eq";
|
|
2222
|
-
HasuraGraphQLWhere["GT"] = "_gt";
|
|
2223
|
-
HasuraGraphQLWhere["GTE"] = "_gte";
|
|
2224
|
-
HasuraGraphQLWhere["IN"] = "_in";
|
|
2225
|
-
HasuraGraphQLWhere["NOTIN"] = "_nin";
|
|
2226
|
-
HasuraGraphQLWhere["LT"] = "_lt";
|
|
2227
|
-
HasuraGraphQLWhere["LTE"] = "_lte";
|
|
2228
|
-
HasuraGraphQLWhere["LIKE"] = "_like";
|
|
2229
|
-
HasuraGraphQLWhere["NOTLIKE"] = "_nlike";
|
|
2230
|
-
HasuraGraphQLWhere["ISNULL"] = "_is_null";
|
|
2231
|
-
HasuraGraphQLWhere["ISNOTNULL"] = "_is_null";
|
|
2232
|
-
})(HasuraGraphQLWhere || (HasuraGraphQLWhere = {}));
|
|
2233
|
-
|
|
2234
|
-
var HasuraGraphQLColumnType;
|
|
2235
|
-
(function (HasuraGraphQLColumnType) {
|
|
2236
|
-
HasuraGraphQLColumnType["Int"] = "Int";
|
|
2237
|
-
HasuraGraphQLColumnType["Float"] = "Float";
|
|
2238
|
-
HasuraGraphQLColumnType["Boolean"] = "Boolean";
|
|
2239
|
-
HasuraGraphQLColumnType["String"] = "String";
|
|
2240
|
-
HasuraGraphQLColumnType["DateTime"] = "timestampz";
|
|
2241
|
-
HasuraGraphQLColumnType["Json"] = "json";
|
|
2242
|
-
HasuraGraphQLColumnType["Jsonb"] = "jsonb";
|
|
2243
|
-
HasuraGraphQLColumnType["Enum"] = "enum";
|
|
2244
|
-
HasuraGraphQLColumnType["Uuid"] = "uuid";
|
|
2245
|
-
})(HasuraGraphQLColumnType || (HasuraGraphQLColumnType = {}));
|
|
2246
|
-
|
|
2247
|
-
const withFindHasuraGraphQL = (MixinBase) => {
|
|
2248
|
-
return class FindHasuraGraphQLMixin extends MixinBase {
|
|
2249
|
-
constructor() {
|
|
2250
|
-
super(...arguments);
|
|
2251
|
-
this.makeGraphQLWhere = (filter, fields) => Object.keys(filter).reduce((variables, fieldName) => {
|
|
2252
|
-
const columnOption = AttributeOptionHelper.FindByAttribute(fieldName, fields);
|
|
2253
|
-
if (!columnOption.bindFindFilter)
|
|
2254
|
-
return Object.assign(Object.assign({}, variables), { [columnOption.columnName]: this.buildWhereSentence(fieldName, filter[fieldName], fields) });
|
|
2255
|
-
const builtFilter = columnOption.bindFindFilter(filter[fieldName]);
|
|
2256
|
-
return Object.assign(Object.assign({}, variables), Object.keys(builtFilter).reduce((variablesList, columnName) => (Object.assign(Object.assign({}, variablesList), { [columnName]: this.buildWhereSentence(fieldName, builtFilter[columnName], fields) })), {}));
|
|
2257
|
-
}, {});
|
|
2258
|
-
this.buildWhereSentence = (field, options, fields) => {
|
|
2259
|
-
const fieldSentenceOptions = AttributeOptionHelper.FindByAttribute(field, fields);
|
|
2260
|
-
if (!Array.isArray(options) &&
|
|
2261
|
-
isObject(options) &&
|
|
2262
|
-
isNil(options === null || options === void 0 ? void 0 : options.operator) &&
|
|
2263
|
-
isNil(options === null || options === void 0 ? void 0 : options.value) &&
|
|
2264
|
-
isNil(fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.to))
|
|
2265
|
-
return Object.keys(options).reduce((variables, key) => {
|
|
2266
|
-
const fieldOptions = AttributeOptionHelper.FindByAttribute(key, (fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.fields) || fields);
|
|
2267
|
-
const columnName = fieldOptions.columnName;
|
|
2268
|
-
const columnFields = fieldOptions.fields;
|
|
2269
|
-
return Object.assign(Object.assign({}, variables), { [columnName]: this.buildWhereSentence(key, options[key], columnFields || []) });
|
|
2270
|
-
}, {});
|
|
2271
|
-
if (!Array.isArray(options) && !isNil(fieldSentenceOptions.fields))
|
|
2272
|
-
return {
|
|
2273
|
-
[fieldSentenceOptions.fields[0]]: this.buildOperatorSentence(options, fieldSentenceOptions),
|
|
2274
|
-
};
|
|
2275
|
-
if (isObject(options) && !FilterOptionHelper.CheckIfIsFilterOption(options))
|
|
2276
|
-
options = Object.values(options)[0];
|
|
2277
|
-
return Array.isArray(options)
|
|
2278
|
-
? options.reduce((whereSentence, option) => (Object.assign(Object.assign({}, whereSentence), this.buildOperatorSentence(option, fieldSentenceOptions))), {})
|
|
2279
|
-
: this.buildOperatorSentence(options, fieldSentenceOptions);
|
|
2280
|
-
};
|
|
2281
|
-
this.buildOperatorSentence = (options, fieldOption) => ({
|
|
2282
|
-
[this.getHasuraOperator(options, fieldOption)]: FilterOptionHelper.GetValueFromFilter(options, fieldOption),
|
|
2283
|
-
});
|
|
2284
|
-
this.getHasuraOperator = (options, fieldOption) => FilterOptionHelper.CheckIfIsFilterOption(options)
|
|
2285
|
-
? fieldOption.type === HasuraGraphQLColumnType.Jsonb
|
|
2286
|
-
? this.getHasuraJsonbOperator(options)
|
|
2287
|
-
: HasuraGraphQLWhere[Object.keys(HasuraGraphQLWhere).find((graphQLOperator) => graphQLOperator === Object.keys(Where).find((operator) => Where[operator] === (options === null || options === void 0 ? void 0 : options.operator)))]
|
|
2288
|
-
: HasuraGraphQLWhere.EQUALS;
|
|
2289
|
-
this.getHasuraJsonbOperator = (options) => options.operator === Where.IN
|
|
2290
|
-
? '_contains'
|
|
2291
|
-
: options.operator === Where.LIKE
|
|
2292
|
-
? '_has_keys_any'
|
|
2293
|
-
: HasuraGraphQLWhere[Object.keys(HasuraGraphQLWhere).find((graphQLOperator) => graphQLOperator === Object.keys(Where).find((operator) => Where[operator] === (options === null || options === void 0 ? void 0 : options.operator)))];
|
|
2294
|
-
}
|
|
2295
|
-
find(options) {
|
|
2296
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2297
|
-
const { filters, limits, orderBy } = options || {};
|
|
2298
|
-
const variablesCount = Object.assign(Object.assign({}, (isNil(orderBy) ? {} : { order_by: { type: `${this.tableName}_order_by!`, list: true, value: orderBy } })), (isNil(filters)
|
|
2299
|
-
? {}
|
|
2300
|
-
: {
|
|
2301
|
-
where: {
|
|
2302
|
-
value: this.makeGraphQLWhere(filters, this.fields),
|
|
2303
|
-
type: `${this.tableName}_bool_exp`,
|
|
2304
|
-
required: true,
|
|
2305
|
-
},
|
|
2306
|
-
}));
|
|
2307
|
-
const variables = Object.assign(Object.assign({}, (isNil(limits) ? {} : limits)), variablesCount);
|
|
2308
|
-
const result = yield this.query([
|
|
2309
|
-
{
|
|
2310
|
-
operation: this.tableName,
|
|
2311
|
-
fields: options.fields
|
|
2312
|
-
? options.fields
|
|
2313
|
-
.map((fieldName) => {
|
|
2314
|
-
var _a;
|
|
2315
|
-
return (_a = this.fields.find((fieldOption) => fieldOption === fieldName)) !== null && _a !== void 0 ? _a : this.fields.find((fieldOption) => Object.keys(fieldOption).shift() === fieldName);
|
|
2316
|
-
})
|
|
2317
|
-
.filter(Boolean)
|
|
2318
|
-
: this.fields,
|
|
2319
|
-
variables,
|
|
2320
|
-
},
|
|
2321
|
-
{
|
|
2322
|
-
operation: `${this.tableName}_aggregate`,
|
|
2323
|
-
fields: [{ aggregate: ['count'] }],
|
|
2324
|
-
variables: variablesCount,
|
|
2325
|
-
},
|
|
2326
|
-
]);
|
|
2327
|
-
const data = result[this.tableName].map((row) => this.convertDataFromHasura(row));
|
|
2328
|
-
const count = result[`${this.tableName}_aggregate`].aggregate.count;
|
|
2329
|
-
return { count, data };
|
|
2330
|
-
});
|
|
2331
|
-
}
|
|
2332
|
-
};
|
|
2333
|
-
};
|
|
2334
|
-
|
|
2335
|
-
const withCrudHasuraGraphQL = (MixinBase) => {
|
|
2336
|
-
return class CrudHasuraGraphQLMixin extends withUpdateHasuraGraphQL(withGetHasuraGraphQL(withFindHasuraGraphQL(withDeleteHasuraGraphQL(withCreateHasuraGraphQL(MixinBase))))) {
|
|
2337
|
-
};
|
|
2338
|
-
};
|
|
2339
|
-
|
|
2340
|
-
class CategoryHasuraGraphQL extends Category {
|
|
2341
|
-
}
|
|
2342
|
-
|
|
2343
|
-
class ProductHasuraGraphQL extends Product {
|
|
2344
|
-
}
|
|
2345
|
-
__decorate([
|
|
2346
|
-
Type(() => KitProductHasuraGraphQL),
|
|
2347
|
-
__metadata("design:type", Array)
|
|
2348
|
-
], ProductHasuraGraphQL.prototype, "kitProducts", void 0);
|
|
2349
|
-
|
|
2350
|
-
class KitProductHasuraGraphQL extends KitProduct {
|
|
2351
|
-
}
|
|
2352
|
-
__decorate([
|
|
2353
|
-
Type(() => ProductHasuraGraphQL),
|
|
2354
|
-
__metadata("design:type", ProductHasuraGraphQL)
|
|
2355
|
-
], KitProductHasuraGraphQL.prototype, "kit", void 0);
|
|
2356
|
-
__decorate([
|
|
2357
|
-
Type(() => ProductHasuraGraphQL),
|
|
2358
|
-
__metadata("design:type", ProductHasuraGraphQL)
|
|
2359
|
-
], KitProductHasuraGraphQL.prototype, "product", void 0);
|
|
2360
|
-
|
|
2361
|
-
class VariantHasuraGraphQL extends Variant {
|
|
2362
|
-
constructor() {
|
|
2363
|
-
super(...arguments);
|
|
2364
|
-
this.name = '';
|
|
2365
|
-
this.hasVariants = false;
|
|
2366
|
-
}
|
|
2367
|
-
}
|
|
2368
|
-
|
|
2369
|
-
class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
2370
|
-
constructor(endpoint, authOptions, productRepository) {
|
|
2371
|
-
super({
|
|
2372
|
-
tableName: 'category',
|
|
2373
|
-
model: Category,
|
|
2374
|
-
endpoint,
|
|
2375
|
-
authOptions,
|
|
2376
|
-
fields: [
|
|
2377
|
-
{ id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
|
|
2378
|
-
{ firestoreId: { columnName: 'firestore_id' } },
|
|
2379
|
-
'name',
|
|
2380
|
-
'description',
|
|
2381
|
-
'image',
|
|
2382
|
-
'published',
|
|
2383
|
-
'shop',
|
|
2384
|
-
'slug',
|
|
2385
|
-
{ brandCategory: { columnName: 'brand_category' } },
|
|
2386
|
-
{ brandCategoryBanner: { columnName: 'brand_banner' } },
|
|
2387
|
-
{ brandCategoryBannerMobile: { columnName: 'brand_banner_mobile' } },
|
|
2388
|
-
{ brandLogo: { columnName: 'brand_logo' } },
|
|
2389
|
-
{ brandCondition: { columnName: 'brand_condition' } },
|
|
2390
|
-
{
|
|
2391
|
-
conditions: {
|
|
2392
|
-
columnName: 'tag_condition',
|
|
2393
|
-
type: HasuraGraphQLColumnType.Jsonb,
|
|
2394
|
-
from: (tags, row) => ({ brand: row.brand_condition, tags: Array.isArray(tags) ? tags : [] }),
|
|
2395
|
-
bindPersistData: (value) => {
|
|
2396
|
-
var _a, _b;
|
|
2397
|
-
return {
|
|
2398
|
-
brand_condition: value.brand,
|
|
2399
|
-
tag_condition: `{"${((_b = (_a = value === null || value === void 0 ? void 0 : value.tags) === null || _a === void 0 ? void 0 : _a.join) === null || _b === void 0 ? void 0 : _b.call(_a, '","')) || ''}"}`,
|
|
2400
|
-
};
|
|
2401
|
-
},
|
|
2402
|
-
bindFindFilter: (sentence) => {
|
|
2403
|
-
return Object.assign(Object.assign({}, (sentence.brand ? { brand_condition: sentence.brand } : {})), (sentence.tags ? { tag_condition: sentence.tags } : {}));
|
|
2404
|
-
},
|
|
2405
|
-
},
|
|
2406
|
-
},
|
|
2407
|
-
'filters',
|
|
2408
|
-
{ createdAt: { columnName: 'created_at' } },
|
|
2409
|
-
{ updatedAt: { columnName: 'updated_at' } },
|
|
2410
|
-
{
|
|
2411
|
-
products: {
|
|
2412
|
-
columnName: 'products',
|
|
2413
|
-
fields: ['product_id'],
|
|
2414
|
-
from: (value) => value.map((product) => product.product_id.toString()),
|
|
2415
|
-
to: (productIds) => productIds.map((productId) => ({
|
|
2416
|
-
product_id: +productId,
|
|
2417
|
-
})),
|
|
2418
|
-
},
|
|
2419
|
-
},
|
|
2420
|
-
],
|
|
2421
|
-
});
|
|
2422
|
-
this.productRepository = productRepository;
|
|
2423
|
-
}
|
|
2424
|
-
get(identifiers) {
|
|
2425
|
-
const _super = Object.create(null, {
|
|
2426
|
-
get: { get: () => super.get }
|
|
2427
|
-
});
|
|
2428
|
-
var _a;
|
|
2429
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2430
|
-
return Number.isNaN(+identifiers.id)
|
|
2431
|
-
? (_a = (yield this.find({ filters: { firestoreId: identifiers.id } })).data) === null || _a === void 0 ? void 0 : _a[0]
|
|
2432
|
-
: _super.get.call(this, identifiers);
|
|
2433
|
-
});
|
|
2434
|
-
}
|
|
2435
|
-
getCategoryBySlug(slug, shop) {
|
|
2436
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2437
|
-
if (!slug)
|
|
2438
|
-
return;
|
|
2439
|
-
const { data, count } = yield this.find({ filters: { slug, shop, published: true } });
|
|
2440
|
-
if (count > 1)
|
|
2441
|
-
throw new DuplicatedResultsError('Query returned duplicated values');
|
|
2442
|
-
if (!count)
|
|
2443
|
-
throw new NotFoundError(`Category with slug ${slug} not found`);
|
|
2444
|
-
return data.shift();
|
|
2445
|
-
});
|
|
2446
|
-
}
|
|
2447
|
-
getCategoriesForHome(categoryIds, limit = 4) {
|
|
2448
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2449
|
-
const { data: categories, count } = yield this.find({
|
|
2450
|
-
filters: { firestoreId: { operator: Where.IN, value: categoryIds.filter(Boolean) }, published: true },
|
|
2451
|
-
});
|
|
2452
|
-
if (!count)
|
|
2453
|
-
throw new NotFoundError('Categories not found');
|
|
2454
|
-
const homeSections = yield Promise.all(categories.map((category) => __awaiter(this, void 0, void 0, function* () {
|
|
2455
|
-
return ({
|
|
2456
|
-
category,
|
|
2457
|
-
products: yield this.mountCategory(category, { limit, hasStock: true }),
|
|
2458
|
-
});
|
|
2459
|
-
})));
|
|
2460
|
-
return homeSections;
|
|
2461
|
-
});
|
|
2462
|
-
}
|
|
2463
|
-
mountCategory(category, options) {
|
|
2464
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2465
|
-
if (!category.products)
|
|
2466
|
-
throw new RequiredArgumentError(['Category products is empty']);
|
|
2467
|
-
const products = [];
|
|
2468
|
-
const publishedField = category.shop === Shops.GLAMSHOP ? 'publishedGlam' : 'published';
|
|
2469
|
-
const { data: productsData } = yield this.productRepository.find(Object.assign({ filters: Object.assign({ id: { operator: Where.IN, value: category.products }, [publishedField]: true }, ((options === null || options === void 0 ? void 0 : options.hasStock) ? { stock: { quantity: { operator: Where.GT, value: 0 } } } : {})), fields: [
|
|
2470
|
-
'id',
|
|
2471
|
-
'name',
|
|
2472
|
-
'slug',
|
|
2473
|
-
'images',
|
|
2474
|
-
'miniatures',
|
|
2475
|
-
'price',
|
|
2476
|
-
'fullPrice',
|
|
2477
|
-
'subscriberDiscountPercentage',
|
|
2478
|
-
'subscriberPrice',
|
|
2479
|
-
'stock',
|
|
2480
|
-
'published',
|
|
2481
|
-
'publishedGlam',
|
|
2482
|
-
'CEST',
|
|
2483
|
-
'EAN',
|
|
2484
|
-
'NCM',
|
|
2485
|
-
'brand',
|
|
2486
|
-
'costPrice',
|
|
2487
|
-
'hasVariants',
|
|
2488
|
-
'isKit',
|
|
2489
|
-
'shopAvailability',
|
|
2490
|
-
'sku',
|
|
2491
|
-
] }, ((options === null || options === void 0 ? void 0 : options.limit) ? { limits: { limit: options === null || options === void 0 ? void 0 : options.limit } } : {})));
|
|
2492
|
-
products.push(...productsData);
|
|
2493
|
-
return products;
|
|
2494
|
-
});
|
|
2495
|
-
}
|
|
2496
|
-
}
|
|
2497
|
-
|
|
2498
|
-
class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
2499
|
-
constructor(endpoint, authOptions) {
|
|
2500
|
-
super({
|
|
2501
|
-
tableName: 'product',
|
|
2502
|
-
model: ProductHasuraGraphQL,
|
|
2503
|
-
endpoint,
|
|
2504
|
-
authOptions,
|
|
2505
|
-
fields: [],
|
|
2506
|
-
});
|
|
2507
|
-
this.bindReviewToModel = (plain) => (Object.assign(Object.assign({}, omit(plain, ['product_id', 'created_at', 'updated_at', 'person_id', 'order_id'])), { createdAt: typeof plain.created_at === 'string' ? new Date(plain.created_at) : plain.created_at, updatedAt: typeof plain.updated_at === 'string' ? new Date(plain.updated_at) : plain.updated_at, personId: plain.person_id, orderId: plain.order_id }));
|
|
2508
|
-
this.bindReviewToHasura = (review) => (Object.assign(Object.assign({}, omit(review, ['productId', 'createdAt', 'updatedAt', 'personId', 'orderId'])), { person_id: review.personId, order_id: review.orderId }));
|
|
2509
|
-
const commonFields = [
|
|
2510
|
-
{ id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
|
|
2511
|
-
{ firestoreId: { columnName: 'firestore_id' } },
|
|
2512
|
-
{ CEST: { columnName: 'cest' } },
|
|
2513
|
-
{ EAN: { columnName: 'ean' } },
|
|
2514
|
-
{ NCM: { columnName: 'ncm' } },
|
|
2515
|
-
'brand',
|
|
2516
|
-
{ costPrice: { columnName: 'cost_price' } },
|
|
2517
|
-
{
|
|
2518
|
-
description: {
|
|
2519
|
-
columnName: 'description',
|
|
2520
|
-
from: (description) => Object.values(Shops).reduce((shops, shop) => (Object.assign(Object.assign({}, shops), { [shop]: { description } })), {}),
|
|
2521
|
-
to: (value) => Object.values(value).shift().description,
|
|
2522
|
-
},
|
|
2523
|
-
},
|
|
2524
|
-
{ hasVariants: { columnName: 'has_variants' } },
|
|
2525
|
-
{ images: { columnName: 'images', to: (value) => { var _a; return `{"${((_a = value === null || value === void 0 ? void 0 : value.join) === null || _a === void 0 ? void 0 : _a.call(value, `","`)) || ''}"}`; } } },
|
|
2526
|
-
{ miniatures: { columnName: 'miniatures', to: (value) => { var _a; return `{"${((_a = value === null || value === void 0 ? void 0 : value.join) === null || _a === void 0 ? void 0 : _a.call(value, `","`)) || ''}"}`; } } },
|
|
2527
|
-
'name',
|
|
2528
|
-
{
|
|
2529
|
-
price: {
|
|
2530
|
-
columnName: 'price',
|
|
2531
|
-
from: (price, data) => Object.values(Shops).reduce((prices, shop) => (Object.assign(Object.assign({}, prices), { [shop]: {
|
|
2532
|
-
price,
|
|
2533
|
-
fullPrice: data.full_price,
|
|
2534
|
-
subscriberDiscountPercentage: data.subscriber_discount_percentage,
|
|
2535
|
-
subscriberPrice: data.subscriber_price,
|
|
2536
|
-
} })), {}),
|
|
2537
|
-
bindFindFilter: (sentence) => {
|
|
2538
|
-
const filters = Object.values(sentence).shift();
|
|
2539
|
-
return Object.assign(Object.assign(Object.assign(Object.assign({}, (((filters === null || filters === void 0 ? void 0 : filters.price) || (filters === null || filters === void 0 ? void 0 : filters.price) === 0) && { price: filters.price })), ((filters.fullPrice || filters.fullPrice === 0) && { full_price: filters.fullPrice })), ((filters.subscriberDiscountPercentage || filters.subscriberDiscountPercentage === 0) && {
|
|
2540
|
-
subscriber_discount_percentage: filters.subscriberDiscountPercentage,
|
|
2541
|
-
})), ((filters.subscriberPrice || filters.subscriberPrice === 0) && {
|
|
2542
|
-
subscriber_price: filters.subscriberPrice,
|
|
2543
|
-
}));
|
|
2544
|
-
},
|
|
2545
|
-
bindPersistData: (value) => {
|
|
2546
|
-
const priceData = Object.values(value).shift();
|
|
2547
|
-
return Object.assign(Object.assign(Object.assign(Object.assign({}, ((priceData === null || priceData === void 0 ? void 0 : priceData.price) >= 0 && { price: priceData.price })), (priceData.fullPrice >= 0 && { full_price: priceData.fullPrice })), (priceData.subscriberDiscountPercentage >= 0 && {
|
|
2548
|
-
subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
|
|
2549
|
-
})), (priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }));
|
|
2550
|
-
},
|
|
2551
|
-
},
|
|
2552
|
-
},
|
|
2553
|
-
{ fullPrice: { columnName: 'full_price' } },
|
|
2554
|
-
{ subscriberDiscountPercentage: { columnName: 'subscriber_discount_percentage' } },
|
|
2555
|
-
{ subscriberPrice: { columnName: 'subscriber_price' } },
|
|
2556
|
-
'published',
|
|
2557
|
-
{ publishedGlam: { columnName: 'published_glam' } },
|
|
2558
|
-
'sku',
|
|
2559
|
-
{
|
|
2560
|
-
stock: {
|
|
2561
|
-
columnName: 'stock',
|
|
2562
|
-
from: (quantity) => ({ quantity }),
|
|
2563
|
-
to: (value) => (isNil(value === null || value === void 0 ? void 0 : value.quantity) ? value : value === null || value === void 0 ? void 0 : value.quantity),
|
|
2564
|
-
},
|
|
2565
|
-
},
|
|
2566
|
-
'slug',
|
|
2567
|
-
'type',
|
|
2568
|
-
'video',
|
|
2569
|
-
'weight',
|
|
2570
|
-
{
|
|
2571
|
-
shopAvailability: {
|
|
2572
|
-
columnName: 'shop_availabilities',
|
|
2573
|
-
fields: ['shop'],
|
|
2574
|
-
from: (shop) => (Array.isArray(shop) ? shop.map((row) => row.shop) : []),
|
|
2575
|
-
to: (shops) => shops.map((shop) => ({ shop })),
|
|
2576
|
-
},
|
|
2577
|
-
},
|
|
2578
|
-
{ tags: { columnName: 'tags', type: HasuraGraphQLColumnType.Jsonb } },
|
|
2579
|
-
{ isKit: { columnName: 'is_kit' } },
|
|
2580
|
-
{ createdAt: { columnName: 'created_at' } },
|
|
2581
|
-
{ updatedAt: { columnName: 'updated_at' } },
|
|
2582
|
-
];
|
|
2583
|
-
this.fields = [
|
|
2584
|
-
...commonFields,
|
|
2585
|
-
{
|
|
2586
|
-
categories: {
|
|
2587
|
-
columnName: 'categories',
|
|
2588
|
-
fields: ['category_id'],
|
|
2589
|
-
bindPersistData: (value) => ({
|
|
2590
|
-
categories: { data: value.map((category) => ({ category_id: +category })) },
|
|
2591
|
-
}),
|
|
2592
|
-
to: (categories) => categories.map((categoryId) => +categoryId),
|
|
2593
|
-
from: (categories) => (categories === null || categories === void 0 ? void 0 : categories.map((category) => { var _a; return (_a = category === null || category === void 0 ? void 0 : category.category_id) === null || _a === void 0 ? void 0 : _a.toString(); })) || [],
|
|
2594
|
-
},
|
|
2595
|
-
},
|
|
2596
|
-
{
|
|
2597
|
-
kitProducts: {
|
|
2598
|
-
columnName: 'kit_products',
|
|
2599
|
-
foreignKeyColumn: { productId: 'id' },
|
|
2600
|
-
fields: [
|
|
2601
|
-
{ productId: { columnName: 'product_id' } },
|
|
2602
|
-
{ kitProductId: { columnName: 'kit_product_id' } },
|
|
2603
|
-
'quantity',
|
|
2604
|
-
{ product: { columnName: 'product', foreignKeyColumn: { id: 'product_id' }, fields: commonFields } },
|
|
2605
|
-
],
|
|
2606
|
-
},
|
|
2607
|
-
},
|
|
2608
|
-
];
|
|
2609
|
-
}
|
|
2610
|
-
get reviewsFields() {
|
|
2611
|
-
return [
|
|
2612
|
-
'id',
|
|
2613
|
-
'shop',
|
|
2614
|
-
'rate',
|
|
2615
|
-
'author',
|
|
2616
|
-
'email',
|
|
2617
|
-
'location',
|
|
2618
|
-
'review',
|
|
2619
|
-
'status',
|
|
2620
|
-
'title',
|
|
2621
|
-
'person_id',
|
|
2622
|
-
'points',
|
|
2623
|
-
'order_id',
|
|
2624
|
-
'created_at',
|
|
2625
|
-
'updated_at',
|
|
2626
|
-
];
|
|
2627
|
-
}
|
|
2628
|
-
create(data) {
|
|
2629
|
-
const _super = Object.create(null, {
|
|
2630
|
-
create: { get: () => super.create }
|
|
2631
|
-
});
|
|
2632
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2633
|
-
const product = yield _super.create.call(this, omit(data, ['reviews']));
|
|
2634
|
-
try {
|
|
2635
|
-
product.reviews = yield this.updateReviews(+product.id, data);
|
|
2636
|
-
}
|
|
2637
|
-
catch (error) {
|
|
2638
|
-
yield this.delete({ id: product.id });
|
|
2639
|
-
throw error;
|
|
2640
|
-
}
|
|
2641
|
-
return product;
|
|
2642
|
-
});
|
|
2643
|
-
}
|
|
2644
|
-
get(identifiers) {
|
|
2645
|
-
const _super = Object.create(null, {
|
|
2646
|
-
get: { get: () => super.get }
|
|
2647
|
-
});
|
|
2648
|
-
var _a;
|
|
2649
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2650
|
-
const product = Number.isNaN(+identifiers.id)
|
|
2651
|
-
? (_a = (yield this.find({ filters: { firestoreId: identifiers.id } })).data) === null || _a === void 0 ? void 0 : _a[0]
|
|
2652
|
-
: yield _super.get.call(this, identifiers);
|
|
2653
|
-
product.reviews = yield this.findReviewsByProduct(+product.id);
|
|
2654
|
-
return product;
|
|
2655
|
-
});
|
|
2656
|
-
}
|
|
2657
|
-
getBySlug(slug, shop) {
|
|
2658
|
-
var _a;
|
|
2659
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2660
|
-
const result = yield this.find({
|
|
2661
|
-
filters: {
|
|
2662
|
-
slug: { operator: Where.EQUALS, value: slug },
|
|
2663
|
-
shopAvailability: { operator: Where.IN, value: [shop] },
|
|
2664
|
-
},
|
|
2665
|
-
});
|
|
2666
|
-
return (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift();
|
|
2667
|
-
});
|
|
2668
|
-
}
|
|
2669
|
-
update(params) {
|
|
2670
|
-
const _super = Object.create(null, {
|
|
2671
|
-
update: { get: () => super.update }
|
|
2672
|
-
});
|
|
2673
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2674
|
-
const { categories, kitProducts, reviews, id: checkId } = params, data = __rest(params, ["categories", "kitProducts", "reviews", "id"]);
|
|
2675
|
-
const plainData = this.paramsToPlain({ id: checkId });
|
|
2676
|
-
const id = yield this.getId(plainData.id);
|
|
2677
|
-
const product = yield _super.update.call(this, Object.assign({ id }, data));
|
|
2678
|
-
product.categories = categories && (yield this.updateCategories(+id, { categories }));
|
|
2679
|
-
product.kitProducts = kitProducts && (yield this.updateKitProducts(+id, { kitProducts }));
|
|
2680
|
-
product.reviews = reviews && (yield this.updateReviews(+id, { reviews }));
|
|
2681
|
-
return product;
|
|
2682
|
-
});
|
|
2683
|
-
}
|
|
2684
|
-
fetchReviews(status) {
|
|
2685
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2686
|
-
const reviews = {
|
|
2687
|
-
status: status === 'pending'
|
|
2688
|
-
? { [HasuraGraphQLWhere.ISNULL]: true }
|
|
2689
|
-
: { [HasuraGraphQLWhere.EQUALS]: status === 'approved' },
|
|
2690
|
-
};
|
|
2691
|
-
const { product: data } = yield this.query('product', ['id', 'name', 'sku', { reviews: { columnName: 'reviews', fields: this.reviewsFields } }], {
|
|
2692
|
-
where: { value: { reviews }, type: 'product_bool_exp', required: true },
|
|
2693
|
-
});
|
|
2694
|
-
return data.reduce((reviews, product) => [
|
|
2695
|
-
...reviews,
|
|
2696
|
-
...product.reviews
|
|
2697
|
-
.filter((review) => (status === 'pending' && [undefined, null].includes(review.status)) ||
|
|
2698
|
-
(status === 'approved' && review.status === true) ||
|
|
2699
|
-
(status === 'rejected' && review.status === false))
|
|
2700
|
-
.map((review) => (Object.assign(Object.assign({}, this.bindReviewToModel(review)), { productId: product.id, productName: product.name, productSku: product.sku }))),
|
|
2701
|
-
], []);
|
|
2702
|
-
});
|
|
2703
|
-
}
|
|
2704
|
-
updateCategories(productId, { categories }) {
|
|
2705
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2706
|
-
const plainData = this.paramsToPlain({ categories });
|
|
2707
|
-
yield this.mutation('delete_category_product', ['affected_rows'], {
|
|
2708
|
-
where: {
|
|
2709
|
-
type: 'category_product_bool_exp',
|
|
2710
|
-
required: true,
|
|
2711
|
-
value: { product_id: { _eq: productId } },
|
|
2712
|
-
},
|
|
2713
|
-
});
|
|
2714
|
-
yield this.mutation('insert_category_product', ['affected_rows'], {
|
|
2715
|
-
objects: {
|
|
2716
|
-
type: '[category_product_insert_input!]',
|
|
2717
|
-
required: true,
|
|
2718
|
-
value: plainData.categories.map((categoryId) => ({ category_id: categoryId, product_id: productId })),
|
|
2719
|
-
},
|
|
2720
|
-
});
|
|
2721
|
-
return plainData.categories;
|
|
2722
|
-
});
|
|
2723
|
-
}
|
|
2724
|
-
updateKitProducts(productId, { kitProducts }) {
|
|
2725
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2726
|
-
const plainData = this.paramsToPlain({ kitProducts });
|
|
2727
|
-
yield this.mutation('delete_product_kit', ['affected_rows'], {
|
|
2728
|
-
where: {
|
|
2729
|
-
type: 'product_kit_bool_exp',
|
|
2730
|
-
required: true,
|
|
2731
|
-
value: { product_id: { _eq: productId } },
|
|
2732
|
-
},
|
|
2733
|
-
});
|
|
2734
|
-
yield this.mutation('insert_product_kit', ['affected_rows'], {
|
|
2735
|
-
objects: {
|
|
2736
|
-
type: '[product_kit_insert_input!]',
|
|
2737
|
-
required: true,
|
|
2738
|
-
value: plainData.kitProducts.map((kitProduct) => ({
|
|
2739
|
-
kit_product_id: kitProduct.productId || kitProduct.product.id,
|
|
2740
|
-
product_id: productId,
|
|
2741
|
-
quantity: kitProduct.quantity,
|
|
2742
|
-
})),
|
|
2743
|
-
},
|
|
2744
|
-
});
|
|
2745
|
-
return plainData.kitProducts;
|
|
2746
|
-
});
|
|
2747
|
-
}
|
|
2748
|
-
updateReviews(productId, { reviews }) {
|
|
2749
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2750
|
-
if (!reviews)
|
|
2751
|
-
return [];
|
|
2752
|
-
if ('action' in reviews && reviews.action === 'remove') {
|
|
2753
|
-
const reviewIds = yield Promise.all(reviews.value.map((reviewData) => __awaiter(this, void 0, void 0, function* () {
|
|
2754
|
-
const review = yield this.findReview(reviewData, productId);
|
|
2755
|
-
return review === null || review === void 0 ? void 0 : review.id;
|
|
2756
|
-
})));
|
|
2757
|
-
yield this.mutation('delete_product_review', ['affected_rows'], {
|
|
2758
|
-
where: { value: { id: { _in: reviewIds.filter(Boolean) } }, type: 'product_review_bool_exp', required: true },
|
|
2759
|
-
});
|
|
2760
|
-
return reviews.value.map((review, index) => !reviewIds[index] && review).filter(Boolean);
|
|
2761
|
-
}
|
|
2762
|
-
const plainData = this.paramsToPlain({ reviews });
|
|
2763
|
-
return Promise.all(plainData.reviews.map((reviewData) => __awaiter(this, void 0, void 0, function* () {
|
|
2764
|
-
const review = yield this.findReview(reviewData, productId);
|
|
2765
|
-
if (review)
|
|
2766
|
-
return this.bindReviewToModel((yield this.mutation('update_product_review_by_pk', this.reviewsFields, {
|
|
2767
|
-
pk_columns: {
|
|
2768
|
-
value: { id: review.id },
|
|
2769
|
-
type: 'product_review_pk_columns_input',
|
|
2770
|
-
required: true,
|
|
2771
|
-
},
|
|
2772
|
-
_set: {
|
|
2773
|
-
value: omit(this.bindReviewToHasura(reviewData), ['id', 'product_id']),
|
|
2774
|
-
type: 'product_review_set_input',
|
|
2775
|
-
required: true,
|
|
2776
|
-
},
|
|
2777
|
-
})).update_product_review_by_pk);
|
|
2778
|
-
return this.bindReviewToModel((yield this.mutation('insert_product_review_one', this.reviewsFields, {
|
|
2779
|
-
object: {
|
|
2780
|
-
value: omit(Object.assign(Object.assign({}, this.bindReviewToHasura(reviewData)), { product_id: productId }), ['id']),
|
|
2781
|
-
type: 'product_review_insert_input',
|
|
2782
|
-
required: true,
|
|
2783
|
-
},
|
|
2784
|
-
})).insert_product_review_one);
|
|
2785
|
-
})));
|
|
2786
|
-
});
|
|
2787
|
-
}
|
|
2788
|
-
getId(id) {
|
|
2789
|
-
var _a, _b;
|
|
2790
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2791
|
-
if (!Number.isNaN(+id))
|
|
2792
|
-
return id;
|
|
2793
|
-
const { data } = yield this.find({ filters: { firestoreId: id } });
|
|
2794
|
-
if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
|
|
2795
|
-
return (_b = data === null || data === void 0 ? void 0 : data[0]) === null || _b === void 0 ? void 0 : _b.id;
|
|
2796
|
-
throw new NotFoundError(`Product with id ${id} not found`);
|
|
2797
|
-
});
|
|
2798
|
-
}
|
|
2799
|
-
findReviewsByProduct(productId) {
|
|
2800
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2801
|
-
const { product_review: data } = yield this.query('product_review', this.reviewsFields, {
|
|
2802
|
-
where: {
|
|
2803
|
-
value: {
|
|
2804
|
-
product_id: { _eq: productId },
|
|
2805
|
-
},
|
|
2806
|
-
type: 'product_review_bool_exp',
|
|
2807
|
-
required: true,
|
|
2808
|
-
},
|
|
2809
|
-
});
|
|
2810
|
-
return data && data.map((review) => this.bindReviewToModel(review));
|
|
2811
|
-
});
|
|
2812
|
-
}
|
|
2813
|
-
findReview(review, productId) {
|
|
2814
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2815
|
-
if (review.id)
|
|
2816
|
-
return review;
|
|
2817
|
-
let loadedReview;
|
|
2818
|
-
if (review.personId)
|
|
2819
|
-
loadedReview = yield this.getReviewByPersonId(review.personId, productId);
|
|
2820
|
-
if (!loadedReview && review.author && review.email)
|
|
2821
|
-
loadedReview = yield this.getReviewByAuthorAndEmail(review.author, review.email, productId);
|
|
2822
|
-
return loadedReview || review;
|
|
2823
|
-
});
|
|
2824
|
-
}
|
|
2825
|
-
getReviewByPersonId(personId, productId) {
|
|
2826
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2827
|
-
const { product_review: data } = yield this.query('product_review', this.reviewsFields, {
|
|
2828
|
-
where: {
|
|
2829
|
-
value: {
|
|
2830
|
-
product_id: { _eq: productId },
|
|
2831
|
-
person_id: { _eq: personId },
|
|
2832
|
-
},
|
|
2833
|
-
type: `product_review_bool_exp`,
|
|
2834
|
-
required: true,
|
|
2835
|
-
},
|
|
2836
|
-
});
|
|
2837
|
-
return data && data[0] && this.bindReviewToModel(data[0]);
|
|
2838
|
-
});
|
|
2839
|
-
}
|
|
2840
|
-
getReviewByAuthorAndEmail(author, email, productId) {
|
|
2841
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2842
|
-
const { product_review: data } = yield this.query('product_review', this.reviewsFields, {
|
|
2843
|
-
where: {
|
|
2844
|
-
value: {
|
|
2845
|
-
product_id: { _eq: productId },
|
|
2846
|
-
author: { _eq: author },
|
|
2847
|
-
email: { _eq: email },
|
|
2848
|
-
},
|
|
2849
|
-
type: `product_review_bool_exp`,
|
|
2850
|
-
required: true,
|
|
2851
|
-
},
|
|
2852
|
-
});
|
|
2853
|
-
return data && data[0] && this.bindReviewToModel(data[0]);
|
|
2854
|
-
});
|
|
2855
|
-
}
|
|
2856
|
-
}
|
|
2857
|
-
|
|
2858
|
-
class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
2859
|
-
constructor(endpoint, authOptions) {
|
|
2860
|
-
super({
|
|
2861
|
-
tableName: 'product',
|
|
2862
|
-
model: VariantHasuraGraphQL,
|
|
2863
|
-
endpoint,
|
|
2864
|
-
authOptions,
|
|
2865
|
-
fields: [
|
|
2866
|
-
{ id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
|
|
2867
|
-
{ firestoreId: { columnName: 'firestore_id' } },
|
|
2868
|
-
{ productId: { columnName: 'main_product_id', to: (value) => +value, from: (value) => value === null || value === void 0 ? void 0 : value.toString() } },
|
|
2869
|
-
{ EAN: { columnName: 'ean' } },
|
|
2870
|
-
{ costPrice: { columnName: 'cost_price' } },
|
|
2871
|
-
{
|
|
2872
|
-
price: {
|
|
2873
|
-
columnName: 'price',
|
|
2874
|
-
from: (price, data) => Object.values(Shops).reduce((prices, shop) => (Object.assign(Object.assign({}, prices), { [shop]: {
|
|
2875
|
-
price,
|
|
2876
|
-
fullPrice: data.full_price,
|
|
2877
|
-
subscriberDiscountPercentage: data.subscriber_discount_percentage,
|
|
2878
|
-
subscriberPrice: data.subscriber_price,
|
|
2879
|
-
} })), {}),
|
|
2880
|
-
bindFindFilter: (sentence) => {
|
|
2881
|
-
const filters = Object.values(sentence).shift();
|
|
2882
|
-
return Object.assign(Object.assign(Object.assign(Object.assign({}, (((filters === null || filters === void 0 ? void 0 : filters.price) || (filters === null || filters === void 0 ? void 0 : filters.price) === 0) && { price: filters.price })), ((filters.fullPrice || filters.fullPrice === 0) && { full_price: filters.fullPrice })), ((filters.subscriberDiscountPercentage || filters.subscriberDiscountPercentage === 0) && {
|
|
2883
|
-
subscriber_discount_percentage: filters.subscriberDiscountPercentage,
|
|
2884
|
-
})), ((filters.subscriberPrice || filters.subscriberPrice === 0) && {
|
|
2885
|
-
subscriber_price: filters.subscriberPrice,
|
|
2886
|
-
}));
|
|
2887
|
-
},
|
|
2888
|
-
bindPersistData: (value) => {
|
|
2889
|
-
const priceData = Object.values(value).shift();
|
|
2890
|
-
return Object.assign(Object.assign(Object.assign(Object.assign({}, ((priceData === null || priceData === void 0 ? void 0 : priceData.price) >= 0 && { price: priceData.price })), (priceData.fullPrice >= 0 && { full_price: priceData.fullPrice })), (priceData.subscriberDiscountPercentage >= 0 && {
|
|
2891
|
-
subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
|
|
2892
|
-
})), (priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }));
|
|
2893
|
-
},
|
|
2894
|
-
},
|
|
2895
|
-
},
|
|
2896
|
-
{ fullPrice: { columnName: 'full_price' } },
|
|
2897
|
-
{ subscriberDiscountPercentage: { columnName: 'subscriber_discount_percentage' } },
|
|
2898
|
-
{ subscriberPrice: { columnName: 'subscriber_price' } },
|
|
2899
|
-
'sku',
|
|
2900
|
-
{
|
|
2901
|
-
stock: {
|
|
2902
|
-
columnName: 'stock',
|
|
2903
|
-
from: (quantity) => ({ quantity }),
|
|
2904
|
-
to: (value) => (isNil(value === null || value === void 0 ? void 0 : value.quantity) ? value : value === null || value === void 0 ? void 0 : value.quantity),
|
|
2905
|
-
},
|
|
2906
|
-
},
|
|
2907
|
-
'weight',
|
|
2908
|
-
{ name: { to: () => '', from: () => undefined } },
|
|
2909
|
-
{ hasVariants: { columnName: 'has_variants', to: () => false, from: () => undefined } },
|
|
2910
|
-
{ createdAt: { columnName: 'created_at' } },
|
|
2911
|
-
{ updatedAt: { columnName: 'updated_at' } },
|
|
2912
|
-
],
|
|
2913
|
-
});
|
|
2914
|
-
}
|
|
2915
|
-
get(identifiers) {
|
|
2916
|
-
const _super = Object.create(null, {
|
|
2917
|
-
get: { get: () => super.get }
|
|
2918
|
-
});
|
|
2919
|
-
var _a;
|
|
2920
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2921
|
-
return Number.isNaN(+identifiers.id)
|
|
2922
|
-
? (_a = (yield this.find({ filters: { firestoreId: identifiers.id } })).data) === null || _a === void 0 ? void 0 : _a[0]
|
|
2923
|
-
: _super.get.call(this, identifiers);
|
|
2924
|
-
});
|
|
2925
|
-
}
|
|
2926
|
-
update(params) {
|
|
2927
|
-
const _super = Object.create(null, {
|
|
2928
|
-
update: { get: () => super.update }
|
|
2929
|
-
});
|
|
2930
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2931
|
-
const { productId, id: checkId } = params, data = __rest(params, ["productId", "id"]);
|
|
2932
|
-
const dataWithProductId = this.paramsToPlain({ id: checkId, productId });
|
|
2933
|
-
const id = yield this.getId(dataWithProductId.id);
|
|
2934
|
-
const product = yield _super.update.call(this, Object.assign({ id }, data));
|
|
2935
|
-
product.productId = dataWithProductId.productId;
|
|
2936
|
-
return product;
|
|
2937
|
-
});
|
|
2938
|
-
}
|
|
2939
|
-
getId(id) {
|
|
2940
|
-
var _a, _b;
|
|
2941
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2942
|
-
if (!Number.isNaN(+id))
|
|
2943
|
-
return id;
|
|
2944
|
-
const { data } = yield this.find({ filters: { firestoreId: id } });
|
|
2945
|
-
if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
|
|
2946
|
-
return (_b = data === null || data === void 0 ? void 0 : data[0]) === null || _b === void 0 ? void 0 : _b.id;
|
|
2947
|
-
throw new NotFoundError(`Product with id ${id} not found`);
|
|
2948
|
-
});
|
|
2949
|
-
}
|
|
2950
|
-
}
|
|
2951
|
-
|
|
2952
1659
|
/**
|
|
2953
1660
|
* Generated bundle index. Do not edit.
|
|
2954
1661
|
*/
|
|
2955
1662
|
|
|
2956
|
-
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService,
|
|
1663
|
+
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Category, CategoryFirestoreRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClubCoupon, Coupon, CouponFirestoreRepository, DiscountType, 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, QuestionsFilters, Register, RegisterFirebaseAuthService, RequiredArgumentError, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, Shops, SignInMethods, SignOut, Status, StoreCoupon, 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 };
|
|
2957
1664
|
//# sourceMappingURL=infrab4a-connect.js.map
|