chore(feature-flags): Sales Channels enabled by default (#2966)
This commit is contained in:
1 parent
cac81749ea
commit
3308766389
34 files changed
+372
-498
No files matched your search
@@ -43,7 +43,7 @@ describe("GET /admin/orders", () => {
|
||||
"gift_card_tax_total",
|
||||
].includes(field)
|
||||
}),
|
||||
relations: defaultAdminOrdersRelations,
|
||||
relations: [...defaultAdminOrdersRelations],
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
@@ -4,12 +4,11 @@ import { Order } from "../../../.."
|
||||
import {
|
||||
DeleteResponse,
|
||||
FindParams,
|
||||
PaginatedResponse,
|
||||
PaginatedResponse
|
||||
} from "../../../../types/common"
|
||||
import { FlagRouter } from "../../../../utils/flag-router"
|
||||
import middlewares, { transformQuery } from "../../../middlewares"
|
||||
import { AdminGetOrdersParams } from "./list-orders"
|
||||
import { FlagRouter } from "../../../../utils/flag-router"
|
||||
import SalesChannelFeatureFlag from "../../../../loaders/feature-flags/sales-channels"
|
||||
|
||||
const route = Router()
|
||||
|
||||
@@ -17,9 +16,6 @@ export default (app, featureFlagRouter: FlagRouter) => {
|
||||
app.use("/orders", route)
|
||||
|
||||
const relations = [...defaultAdminOrdersRelations]
|
||||
if (featureFlagRouter.isFeatureEnabled(SalesChannelFeatureFlag.key)) {
|
||||
relations.push("sales_channel")
|
||||
}
|
||||
|
||||
/**
|
||||
* List orders
|
||||
@@ -286,6 +282,7 @@ export const defaultAdminOrdersRelations = [
|
||||
"swaps.additional_items",
|
||||
"swaps.fulfillments",
|
||||
"swaps.fulfillments.tracking_links",
|
||||
"sales_channel",
|
||||
]
|
||||
|
||||
export const defaultAdminOrdersFields = [
|
||||
@@ -297,6 +294,7 @@ export const defaultAdminOrdersFields = [
|
||||
"cart_id",
|
||||
"draft_order_id",
|
||||
"customer_id",
|
||||
"sales_channel_id",
|
||||
"email",
|
||||
"region_id",
|
||||
"currency_code",
|
||||
@@ -330,6 +328,7 @@ export const filterableAdminOrdersFields = [
|
||||
"customer_id",
|
||||
"email",
|
||||
"region_id",
|
||||
"sales_channel_id",
|
||||
"currency_code",
|
||||
"tax_rate",
|
||||
"canceled_at",
|
||||
@@ -362,3 +361,4 @@ export * from "./refund-payment"
|
||||
export * from "./request-return"
|
||||
export * from "./update-claim"
|
||||
export * from "./update-order"
|
||||
|
||||
@@ -65,6 +65,7 @@ describe("GET /admin/products/:id", () => {
|
||||
"tags",
|
||||
"type",
|
||||
"collection",
|
||||
"sales_channels",
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
@@ -23,10 +23,7 @@ describe("GET /admin/store", () => {
|
||||
it("calls service retrieve", () => {
|
||||
expect(StoreServiceMock.retrieve).toHaveBeenCalledTimes(1)
|
||||
expect(StoreServiceMock.retrieve).toHaveBeenCalledWith({
|
||||
relations: [
|
||||
"currencies",
|
||||
"default_currency",
|
||||
]
|
||||
relations: ["currencies", "default_currency", "default_sales_channel"],
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -2,7 +2,7 @@ import { FlagSettings } from "../../types/feature-flags"
|
||||
|
||||
const SalesChannelFeatureFlag: FlagSettings = {
|
||||
key: "sales_channels",
|
||||
default_val: false,
|
||||
default_val: true,
|
||||
env_key: "MEDUSA_FF_SALES_CHANNELS",
|
||||
description: "[WIP] Enable the sales channels feature",
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@ export const orders = {
|
||||
testOrder: {
|
||||
id: IdMap.getId("test-order"),
|
||||
email: "virgil@vandijk.dk",
|
||||
sales_channel_id: "test-channel",
|
||||
sales_channel: {
|
||||
id: "test-channel",
|
||||
},
|
||||
billing_address: {
|
||||
first_name: "Virgil",
|
||||
last_name: "Van Dijk",
|
||||
|
||||
@@ -174,8 +174,6 @@ export default class EventBusService {
|
||||
(sub) => sub.id === subscriberId
|
||||
)
|
||||
|
||||
console.log(subscriberId)
|
||||
|
||||
if (subscriberAlreadyExists) {
|
||||
throw Error(`Subscriber with id ${subscriberId} already exists`)
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
/* eslint-disable valid-jsdoc */
|
||||
import { EntityManager } from "typeorm"
|
||||
import { computerizeAmount, MedusaError } from "medusa-core-utils"
|
||||
import { EntityManager } from "typeorm"
|
||||
|
||||
import { AbstractBatchJobStrategy, IFileService } from "../../../interfaces"
|
||||
import CsvParser from "../../../services/csv-parser"
|
||||
import SalesChannelFeatureFlag from "../../../loaders/feature-flags/sales-channels"
|
||||
import { BatchJob, SalesChannel } from "../../../models"
|
||||
import {
|
||||
BatchJobService,
|
||||
ProductCollectionService,
|
||||
@@ -11,29 +12,28 @@ import {
|
||||
ProductVariantService,
|
||||
RegionService,
|
||||
SalesChannelService,
|
||||
ShippingProfileService,
|
||||
ShippingProfileService
|
||||
} from "../../../services"
|
||||
import CsvParser from "../../../services/csv-parser"
|
||||
import { CreateProductInput } from "../../../types/product"
|
||||
import {
|
||||
CreateProductVariantInput,
|
||||
UpdateProductVariantInput,
|
||||
UpdateProductVariantInput
|
||||
} from "../../../types/product-variant"
|
||||
import { BatchJob, SalesChannel } from "../../../models"
|
||||
import { FlagRouter } from "../../../utils/flag-router"
|
||||
import { transformProductData, transformVariantData } from "./utils"
|
||||
import SalesChannelFeatureFlag from "../../../loaders/feature-flags/sales-channels"
|
||||
import {
|
||||
OperationType,
|
||||
ProductImportBatchJob,
|
||||
ProductImportCsvSchema,
|
||||
ProductImportInjectedProps,
|
||||
ProductImportJobContext,
|
||||
TParsedProductImportRowData,
|
||||
TParsedProductImportRowData
|
||||
} from "./types"
|
||||
import {
|
||||
productImportColumnsDefinition,
|
||||
productImportSalesChannelsColumnsDefinition,
|
||||
productImportSalesChannelsColumnsDefinition
|
||||
} from "./types/columns-definition"
|
||||
import { transformProductData, transformVariantData } from "./utils"
|
||||
|
||||
/**
|
||||
* Process this many variant rows before reporting progress.
|
||||
@@ -462,7 +462,7 @@ class ProductImportStrategy extends AbstractBatchJobStrategy {
|
||||
for (const productOp of productOps) {
|
||||
const productData = transformProductData(productOp)
|
||||
try {
|
||||
if (isSalesChannelsFeatureOn) {
|
||||
if (isSalesChannelsFeatureOn && productOp["product.sales_channels"]) {
|
||||
productData["sales_channels"] = await this.processSalesChannels(
|
||||
productOp["product.sales_channels"] as Pick<
|
||||
SalesChannel,
|
||||
|
||||
Reference in new issue
Block a user