Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ const INITIAL_ORDERCLOUD_CONTEXT: IOrderCloudContext = {
},
baseApiUrl: "https://api.ordercloud.io/v1",
clientId: "",
scope: [],
customScope: [],
allowAnonymous: false,
token: undefined,
autoApplyPromotions: false,
Expand Down
4 changes: 2 additions & 2 deletions src/models/IOrderCloudContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export interface IOrderCloudContext {

baseApiUrl: string;
clientId: string;
scope: ApiRole[];
customScope: string[];
scope?: ApiRole[];
customScope?: string[];
allowAnonymous: boolean;
defaultErrorHandler?: (error:OrderCloudError, context:IOrderCloudErrorContext) => void;
token?: string;
Expand Down
4 changes: 2 additions & 2 deletions src/models/IOrderCloudProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { OpenAPIV3 } from "openapi-types";
export interface IOrderCloudProvider {
baseApiUrl: string;
clientId: string;
scope: ApiRole[];
customScope: string[];
scope?: ApiRole[];
customScope?: string[];
allowAnonymous: boolean;
xpSchemas?: OpenAPIV3.SchemaObject;
autoApplyPromotions?: boolean,
Expand Down
27 changes: 18 additions & 9 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,46 @@ import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { name, version } from "./package.json";
import path from "path";
import dts from 'vite-plugin-dts'
import dts from "vite-plugin-dts";
import { nodePolyfills } from "vite-plugin-node-polyfills";

// https://vitejs.dev/config/
export default defineConfig({
build: {
lib: {
lib: {
entry: path.resolve(__dirname, "src/index.ts"),
fileName: "index",
name: "ordercloud-react",
name: "@ordercloud/react-sdk",
},
rollupOptions: {
// Externalize deps that shouldn't be bundled
external: ["react", "react-dom", "ordercloud-javascript-sdk", "@tanstack/react-query", "@tanstack/react-table"],
external: [
"react",
"react-dom",
"ordercloud-javascript-sdk",
"@tanstack/react-query",
"@tanstack/react-table",
],
output: {
// Global vars to use in UMD build for externalized deps
globals: {
react: "React",
"react-dom": "ReactDOM",
"ordercloud-javascript-sdk": "ordercloud",
"@tanstack/react-query": "ReactQuery",
"@tanstack/react-table": "ReactTable"
"@tanstack/react-table": "ReactTable",
},
},
},
},
define: {
pkgJson: { name, version },
},
plugins: [react(), dts({ rollupTypes: true }), nodePolyfills({
include: ["util", "querystring", "http", "https"],
}),],

plugins: [
react(),
dts({ rollupTypes: true }),
nodePolyfills({
include: ["util", "querystring", "http", "https"],
}),
],
});