@elqnt/product 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,30 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ProductNameTS } from '@elqnt/types';
3
+ import React from 'react';
4
+
5
+ type ProductTheme = {
6
+ primary: string;
7
+ borderClass: string;
8
+ outlineClass: string;
9
+ buttonBgClass: string;
10
+ buttonHoverBGClass: string;
11
+ textClass: string;
12
+ };
13
+ type ProductContextType = {
14
+ product: ProductNameTS;
15
+ orgId?: string;
16
+ userId?: string;
17
+ setProduct: (product: ProductNameTS) => void;
18
+ theme?: ProductTheme;
19
+ };
20
+ declare let ProductContext: React.Context<ProductContextType>;
21
+ declare function ProductProvider(props: {
22
+ children: React.ReactNode;
23
+ product: ProductNameTS;
24
+ orgId?: string;
25
+ userId?: string;
26
+ theme?: ProductTheme;
27
+ }): react_jsx_runtime.JSX.Element;
28
+ declare const useProductContext: () => ProductContextType;
29
+
30
+ export { ProductContext, ProductProvider, useProductContext };
@@ -0,0 +1,30 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ProductNameTS } from '@elqnt/types';
3
+ import React from 'react';
4
+
5
+ type ProductTheme = {
6
+ primary: string;
7
+ borderClass: string;
8
+ outlineClass: string;
9
+ buttonBgClass: string;
10
+ buttonHoverBGClass: string;
11
+ textClass: string;
12
+ };
13
+ type ProductContextType = {
14
+ product: ProductNameTS;
15
+ orgId?: string;
16
+ userId?: string;
17
+ setProduct: (product: ProductNameTS) => void;
18
+ theme?: ProductTheme;
19
+ };
20
+ declare let ProductContext: React.Context<ProductContextType>;
21
+ declare function ProductProvider(props: {
22
+ children: React.ReactNode;
23
+ product: ProductNameTS;
24
+ orgId?: string;
25
+ userId?: string;
26
+ theme?: ProductTheme;
27
+ }): react_jsx_runtime.JSX.Element;
28
+ declare const useProductContext: () => ProductContextType;
29
+
30
+ export { ProductContext, ProductProvider, useProductContext };
package/dist/index.js ADDED
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // index.tsx
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ ProductContext: () => ProductContext,
24
+ ProductProvider: () => ProductProvider,
25
+ useProductContext: () => useProductContext
26
+ });
27
+ module.exports = __toCommonJS(index_exports);
28
+
29
+ // context/product-context.tsx
30
+ var import_react = require("react");
31
+ var import_jsx_runtime = require("react/jsx-runtime");
32
+ var ProductContext = (0, import_react.createContext)({
33
+ product: "shop-assist",
34
+ setProduct: () => {
35
+ }
36
+ });
37
+ function ProductProvider(props) {
38
+ const { userId } = props;
39
+ const [product, setProduct] = (0, import_react.useState)(props.product);
40
+ const [orgId, setOrgId] = (0, import_react.useState)(props.orgId);
41
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
42
+ ProductContext.Provider,
43
+ {
44
+ value: {
45
+ product,
46
+ setProduct,
47
+ orgId,
48
+ userId,
49
+ theme: props.theme
50
+ },
51
+ children: props.children
52
+ }
53
+ );
54
+ }
55
+ var useProductContext = () => (0, import_react.useContext)(ProductContext);
56
+ // Annotate the CommonJS export names for ESM import in node:
57
+ 0 && (module.exports = {
58
+ ProductContext,
59
+ ProductProvider,
60
+ useProductContext
61
+ });
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../index.tsx","../context/product-context.tsx"],"sourcesContent":["export * from \"./context\";\n// export * from \"./hooks\";\n// export * from \"./models\";\n// export * from \"./store\";\n\n// export * from \"./utils\";\n// export * from \"./client-types\";\n","\"use client\";\nimport { ProductNameTS } from \"@elqnt/types\";\nimport React, { createContext, useContext, useState } from \"react\";\n\ntype ProductTheme = {\n primary: string;\n borderClass: string;\n outlineClass: string;\n buttonBgClass: string;\n buttonHoverBGClass: string;\n textClass: string;\n};\n\ntype ProductContextType = {\n product: ProductNameTS;\n orgId?: string;\n userId?: string;\n setProduct: (product: ProductNameTS) => void;\n theme?: ProductTheme;\n};\n\nexport let ProductContext = createContext<ProductContextType>({\n product: \"shop-assist\",\n setProduct: () => {},\n});\n\nexport function ProductProvider(props: {\n children: React.ReactNode;\n product: ProductNameTS;\n orgId?: string;\n userId?: string;\n theme?: ProductTheme;\n}) {\n const { userId } = props;\n const [product, setProduct] = useState(props.product);\n const [orgId, setOrgId] = useState(props.orgId);\n\n return (\n <ProductContext.Provider\n value={{\n product,\n setProduct,\n orgId,\n userId,\n theme: props.theme,\n }}\n >\n {props.children}\n </ProductContext.Provider>\n );\n}\n\nexport const useProductContext = () => useContext(ProductContext);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,mBAA2D;AAoCvD;AAjBG,IAAI,qBAAiB,4BAAkC;AAAA,EAC5D,SAAS;AAAA,EACT,YAAY,MAAM;AAAA,EAAC;AACrB,CAAC;AAEM,SAAS,gBAAgB,OAM7B;AACD,QAAM,EAAE,OAAO,IAAI;AACnB,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,MAAM,OAAO;AACpD,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAS,MAAM,KAAK;AAE9C,SACE;AAAA,IAAC,eAAe;AAAA,IAAf;AAAA,MACC,OAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,OAAO,MAAM;AAAA,MACf;AAAA,MAEC,gBAAM;AAAA;AAAA,EACT;AAEJ;AAEO,IAAM,oBAAoB,UAAM,yBAAW,cAAc;","names":[]}
package/dist/index.mjs ADDED
@@ -0,0 +1,33 @@
1
+ // context/product-context.tsx
2
+ import { createContext, useContext, useState } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ var ProductContext = createContext({
5
+ product: "shop-assist",
6
+ setProduct: () => {
7
+ }
8
+ });
9
+ function ProductProvider(props) {
10
+ const { userId } = props;
11
+ const [product, setProduct] = useState(props.product);
12
+ const [orgId, setOrgId] = useState(props.orgId);
13
+ return /* @__PURE__ */ jsx(
14
+ ProductContext.Provider,
15
+ {
16
+ value: {
17
+ product,
18
+ setProduct,
19
+ orgId,
20
+ userId,
21
+ theme: props.theme
22
+ },
23
+ children: props.children
24
+ }
25
+ );
26
+ }
27
+ var useProductContext = () => useContext(ProductContext);
28
+ export {
29
+ ProductContext,
30
+ ProductProvider,
31
+ useProductContext
32
+ };
33
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../context/product-context.tsx"],"sourcesContent":["\"use client\";\nimport { ProductNameTS } from \"@elqnt/types\";\nimport React, { createContext, useContext, useState } from \"react\";\n\ntype ProductTheme = {\n primary: string;\n borderClass: string;\n outlineClass: string;\n buttonBgClass: string;\n buttonHoverBGClass: string;\n textClass: string;\n};\n\ntype ProductContextType = {\n product: ProductNameTS;\n orgId?: string;\n userId?: string;\n setProduct: (product: ProductNameTS) => void;\n theme?: ProductTheme;\n};\n\nexport let ProductContext = createContext<ProductContextType>({\n product: \"shop-assist\",\n setProduct: () => {},\n});\n\nexport function ProductProvider(props: {\n children: React.ReactNode;\n product: ProductNameTS;\n orgId?: string;\n userId?: string;\n theme?: ProductTheme;\n}) {\n const { userId } = props;\n const [product, setProduct] = useState(props.product);\n const [orgId, setOrgId] = useState(props.orgId);\n\n return (\n <ProductContext.Provider\n value={{\n product,\n setProduct,\n orgId,\n userId,\n theme: props.theme,\n }}\n >\n {props.children}\n </ProductContext.Provider>\n );\n}\n\nexport const useProductContext = () => useContext(ProductContext);\n"],"mappings":";AAEA,SAAgB,eAAe,YAAY,gBAAgB;AAoCvD;AAjBG,IAAI,iBAAiB,cAAkC;AAAA,EAC5D,SAAS;AAAA,EACT,YAAY,MAAM;AAAA,EAAC;AACrB,CAAC;AAEM,SAAS,gBAAgB,OAM7B;AACD,QAAM,EAAE,OAAO,IAAI;AACnB,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,MAAM,OAAO;AACpD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,MAAM,KAAK;AAE9C,SACE;AAAA,IAAC,eAAe;AAAA,IAAf;AAAA,MACC,OAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,OAAO,MAAM;AAAA,MACf;AAAA,MAEC,gBAAM;AAAA;AAAA,EACT;AAEJ;AAEO,IAAM,oBAAoB,MAAM,WAAW,cAAc;","names":[]}
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@elqnt/product",
3
+ "version": "1.0.0",
4
+ "description": "Product-aware system components for Eloquent platform",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.mjs",
11
+ "require": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "files": ["dist"],
16
+ "scripts": {
17
+ "build": "tsup",
18
+ "dev": "tsup --watch",
19
+ "clean": "rm -rf dist",
20
+ "typecheck": "tsc --noEmit"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/Blazi-Commerce/eloquent-packages.git",
25
+ "directory": "packages/product"
26
+ },
27
+ "dependencies": {
28
+ "@elqnt/types": "^1.0.0"
29
+ },
30
+ "peerDependencies": {
31
+ "react": "^18.0.0 || ^19.0.0"
32
+ },
33
+ "devDependencies": {
34
+ "@types/react": "^19.0.0",
35
+ "react": "^19.0.0",
36
+ "tsup": "^8.0.0",
37
+ "typescript": "^5.0.0"
38
+ }
39
+ }