storemw-core-client 1.0.20 → 1.0.22

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.
@@ -1,7 +1 @@
1
- import "dotenv/config";
2
- export declare const env: {
3
- NODE_ENV: string;
4
- API_BASE_URL: string;
5
- API_TOKEN: string;
6
- DEBUG: boolean;
7
- };
1
+ export {};
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
+ // import "dotenv/config";
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.env = void 0;
4
- require("dotenv/config");
5
- exports.env = {
6
- NODE_ENV: process.env.NODE_ENV ?? "development",
7
- // 👇 the API endpoint
8
- API_BASE_URL: process.env.NEXT_PUBLIC_API_BASE_URL ??
9
- process.env.VITE_API_BASE_URL ??
10
- process.env.API_BASE_URL ??
11
- "",
12
- // 👇 optional auth token
13
- API_TOKEN: process.env.API_TOKEN ?? "",
14
- // 👇 you can add more if needed later
15
- DEBUG: process.env.DEBUG === "true",
16
- };
4
+ // export const env = {
5
+ // NODE_ENV: process.env.NODE_ENV ?? "development",
6
+ // // 👇 the API endpoint
7
+ // API_BASE_URL:
8
+ // process.env.NEXT_PUBLIC_API_BASE_URL ??
9
+ // process.env.VITE_API_BASE_URL ??
10
+ // process.env.API_BASE_URL ??
11
+ // "",
12
+ // // 👇 optional auth token
13
+ // API_TOKEN: process.env.API_TOKEN ?? "",
14
+ // // 👇 you can add more if needed later
15
+ // DEBUG: process.env.DEBUG === "true",
16
+ // };
17
17
  //# sourceMappingURL=env.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/config/env.ts"],"names":[],"mappings":";;;AAAA,yBAAuB;AAEV,QAAA,GAAG,GAAG;IACf,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa;IAE/C,sBAAsB;IACtB,YAAY,EACR,OAAO,CAAC,GAAG,CAAC,wBAAwB;QACpC,OAAO,CAAC,GAAG,CAAC,iBAAiB;QAC7B,OAAO,CAAC,GAAG,CAAC,YAAY;QACxB,EAAE;IAEN,yBAAyB;IACzB,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE;IAEtC,sCAAsC;IACtC,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,MAAM;CACtC,CAAC","sourcesContent":["import \"dotenv/config\";\n\nexport const env = {\n NODE_ENV: process.env.NODE_ENV ?? \"development\",\n\n // 👇 the API endpoint\n API_BASE_URL:\n process.env.NEXT_PUBLIC_API_BASE_URL ??\n process.env.VITE_API_BASE_URL ??\n process.env.API_BASE_URL ??\n \"\",\n\n // 👇 optional auth token\n API_TOKEN: process.env.API_TOKEN ?? \"\",\n\n // 👇 you can add more if needed later\n DEBUG: process.env.DEBUG === \"true\",\n};\n"]}
1
+ {"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/config/env.ts"],"names":[],"mappings":";AAAA,0BAA0B;;AAE1B,uBAAuB;AACvB,uDAAuD;AAEvD,6BAA6B;AAC7B,oBAAoB;AACpB,kDAAkD;AAClD,2CAA2C;AAC3C,sCAAsC;AACtC,cAAc;AAEd,gCAAgC;AAChC,8CAA8C;AAE9C,6CAA6C;AAC7C,2CAA2C;AAC3C,KAAK","sourcesContent":["// import \"dotenv/config\";\n\n// export const env = {\n// NODE_ENV: process.env.NODE_ENV ?? \"development\",\n\n// // 👇 the API endpoint\n// API_BASE_URL:\n// process.env.NEXT_PUBLIC_API_BASE_URL ??\n// process.env.VITE_API_BASE_URL ??\n// process.env.API_BASE_URL ??\n// \"\",\n\n// // 👇 optional auth token\n// API_TOKEN: process.env.API_TOKEN ?? \"\",\n\n// // 👇 you can add more if needed later\n// DEBUG: process.env.DEBUG === \"true\",\n// };\n"]}
@@ -1,2 +1 @@
1
- export { env } from "./env";
2
1
  export { getApiConfig, setApiConfig } from "./config";
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setApiConfig = exports.getApiConfig = exports.env = void 0;
4
- var env_1 = require("./env");
5
- Object.defineProperty(exports, "env", { enumerable: true, get: function () { return env_1.env; } });
3
+ exports.setApiConfig = exports.getApiConfig = void 0;
4
+ // export { env } from "./env"
6
5
  var config_1 = require("./config");
7
6
  Object.defineProperty(exports, "getApiConfig", { enumerable: true, get: function () { return config_1.getApiConfig; } });
8
7
  Object.defineProperty(exports, "setApiConfig", { enumerable: true, get: function () { return config_1.setApiConfig; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;;AAAA,6BAA2B;AAAlB,0FAAA,GAAG,OAAA;AACZ,mCAAqD;AAA5C,sGAAA,YAAY,OAAA;AAAE,sGAAA,YAAY,OAAA","sourcesContent":["export { env } from \"./env\"\nexport { getApiConfig, setApiConfig } from \"./config\""]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;;AAAA,8BAA8B;AAC9B,mCAAqD;AAA5C,sGAAA,YAAY,OAAA;AAAE,sGAAA,YAAY,OAAA","sourcesContent":["// export { env } from \"./env\"\nexport { getApiConfig, setApiConfig } from \"./config\""]}
@@ -64,7 +64,7 @@ const AuthService = (props) => {
64
64
  };
65
65
  const response = await makeCall({
66
66
  url,
67
- method: 'put',
67
+ method: 'post',
68
68
  payload: postData
69
69
  });
70
70
  };
@@ -1 +1 @@
1
- {"version":3,"file":"AuthService.js","sourceRoot":"","sources":["../../../src/services/auth/AuthService.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG;IACtB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ,EAAE,SAAS;IAC3B,WAAW,EAAE,aAAa;IAC1B,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;CACZ,CAAA;AA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AAC;IAEpB,CAAC,CAAA;IAED,MAAM,cAAc,GAAG,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAwB,EAAE,EAAE;QAGlF,MAAM,GAAG,GAAG,GAAG,SAAS,kBAAkB,CAAC;QAE3C,MAAM,QAAQ,GAAG;YACb,KAAK,EAAE;gBACH,MAAM,EAAE,iBAAiB;aAC5B;YACD,OAAO,EAAE;gBACL,IAAI,EAAE;oBACF,gBAAgB,EAAE,OAAO;oBACzB,YAAY,EAAE,QAAQ;oBACtB,gBAAgB,EAAE,OAAO;iBAC5B;aACJ;SACJ,CAAA;QAED,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC;YAC5B,GAAG;YACH,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,QAAQ;SACpB,CAAC,CAAC;IAEP,CAAC,CAAA;IAED,OAAO;QACH,SAAS;QACT,cAAc;KACjB,CAAC;AACN,CAAC,CAAA;AAzEY,QAAA,WAAW,eAyEvB","sourcesContent":["import { DefaultServiceProps } from '@/lib';\n\nexport const routeTypes = {\n admin: \"admin\",\n retail: \"retail\", // retail\n workstation: \"workstation\",\n customer: \"customer\",\n member: \"member\",\n public: \"public\",\n driver: \"driver\",\n console: \"console\"\n} as const\n\nexport const authTargetTypes = {\n admin: \"administrator\",\n // retail: \"retailer\",\n retailer: \"retail\",\n workstation: \"workstation\", // worker\n customer: \"customer\",\n member: \"member\",\n public: \"public\",\n driver: \"driver\",\n console: \"console\"\n} as const\n\n// Step 2: Infer the value type (e.g., \"administrator\" | \"retailer\" | ...)\nexport type AuthTargetType = typeof authTargetTypes[keyof typeof authTargetTypes]\n\n// Optional: keyof helper to get \"admin\" | \"retail\" | ...\n// export type AuthTargetKey = keyof typeof authTargetTypes\n\n// Step 3: Define route mapping\n// export const authTargetSystemRouteTypes: Record<AuthTargetType, string> = {\n// [authTargetTypes.admin]: routeTypes.admin,\n// [authTargetTypes.retail]: routeTypes.retail,\n// [authTargetTypes.workstation]: routeTypes.workstation,\n// [authTargetTypes.customer]: routeTypes.customer,\n// [authTargetTypes.member]: routeTypes.member,\n// [authTargetTypes.driver]: routeTypes.driver,\n// }\n\nexport type AuthServiceProps = DefaultServiceProps & {\n authTargetType: AuthTargetType\n}\n\nexport type AuthLoginProps = {\n authTargetType?: AuthTargetType,\n accountId?: string\n accountCode?: string\n username: string\n password: string\n};\n\ntype confirmPasswordProps = {\n current: string\n password: string\n confirm: string\n}\n\nexport const AuthService = (props: AuthServiceProps) => {\n\n const { authTargetType } = props ?? {}\n\n const { makeCall } = props.apiService\n\n const endpoint1 = \"auth\";\n\n const authLogin = async (props: AuthLoginProps) => {\n\n const {\n authTargetType: overrideAuthTargetType,\n username,\n password,\n accountId = \"\",\n accountCode = \"\"\n } = props\n\n const url = `${endpoint1}/token`;\n\n const postData = {\n scope: {\n target: overrideAuthTargetType || authTargetType,\n action: \"\",\n },\n payload: {\n ...(accountId ? { account_id: accountId } : {}),\n ...(accountCode ? { account_code: accountCode } : {}),\n username,\n password\n }\n }\n\n const response = await makeCall({\n url,\n method: \"post\",\n payload: postData\n });\n\n return response;\n\n }\n\n const changePassword = async ({ current, password, confirm }: confirmPasswordProps) => {\n\n\n const url = `${endpoint1}/change_password`;\n\n const postData = {\n scope: {\n target: \"change_password\"\n },\n payload: {\n auth: {\n current_password: current,\n new_password: password,\n confirm_password: confirm\n }\n }\n }\n\n const response = await makeCall({\n url,\n method: 'put',\n payload: postData\n });\n\n }\n\n return {\n authLogin,\n changePassword\n };\n}\n"]}
1
+ {"version":3,"file":"AuthService.js","sourceRoot":"","sources":["../../../src/services/auth/AuthService.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG;IACtB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ,EAAE,SAAS;IAC3B,WAAW,EAAE,aAAa;IAC1B,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;I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ACpB,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IAEpB,CAAC,CAAA;IAED,MAAM,cAAc,GAAG,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAwB,EAAE,EAAE;QAGlF,MAAM,GAAG,GAAG,GAAG,SAAS,kBAAkB,CAAC;QAE3C,MAAM,QAAQ,GAAG;YACb,KAAK,EAAE;gBACH,MAAM,EAAE,iBAAiB;aAC5B;YACD,OAAO,EAAE;gBACL,IAAI,EAAE;oBACF,gBAAgB,EAAE,OAAO;oBACzB,YAAY,EAAE,QAAQ;oBACtB,gBAAgB,EAAE,OAAO;iBAC5B;aACJ;SACJ,CAAA;QAED,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC;YAC5B,GAAG;YACH,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,QAAQ;SACpB,CAAC,CAAC;IAEP,CAAC,CAAA;IAED,OAAO;QACH,SAAS;QACT,cAAc;KACjB,CAAC;AACN,CAAC,CAAA;AAzEY,QAAA,WAAW,eAyEvB","sourcesContent":["import { DefaultServiceProps } from '@/lib';\n\nexport const routeTypes = {\n admin: \"admin\",\n retail: \"retail\", // retail\n workstation: \"workstation\",\n customer: \"customer\",\n member: \"member\",\n public: \"public\",\n driver: \"driver\",\n console: \"console\"\n} as const\n\nexport const authTargetTypes = {\n admin: \"administrator\",\n // retail: \"retailer\",\n retailer: \"retail\",\n workstation: \"workstation\", // worker\n customer: \"customer\",\n member: \"member\",\n public: \"public\",\n driver: \"driver\",\n console: \"console\"\n} as const\n\n// Step 2: Infer the value type (e.g., \"administrator\" | \"retailer\" | ...)\nexport type AuthTargetType = typeof authTargetTypes[keyof typeof authTargetTypes]\n\n// Optional: keyof helper to get \"admin\" | \"retail\" | ...\n// export type AuthTargetKey = keyof typeof authTargetTypes\n\n// Step 3: Define route mapping\n// export const authTargetSystemRouteTypes: Record<AuthTargetType, string> = {\n// [authTargetTypes.admin]: routeTypes.admin,\n// [authTargetTypes.retail]: routeTypes.retail,\n// [authTargetTypes.workstation]: routeTypes.workstation,\n// [authTargetTypes.customer]: routeTypes.customer,\n// [authTargetTypes.member]: routeTypes.member,\n// [authTargetTypes.driver]: routeTypes.driver,\n// }\n\nexport type AuthServiceProps = DefaultServiceProps & {\n authTargetType: AuthTargetType\n}\n\nexport type AuthLoginProps = {\n authTargetType?: AuthTargetType,\n accountId?: string\n accountCode?: string\n username: string\n password: string\n};\n\ntype confirmPasswordProps = {\n current: string\n password: string\n confirm: string\n}\n\nexport const AuthService = (props: AuthServiceProps) => {\n\n const { authTargetType } = props ?? {}\n\n const { makeCall } = props.apiService\n\n const endpoint1 = \"auth\";\n\n const authLogin = async (props: AuthLoginProps) => {\n\n const {\n authTargetType: overrideAuthTargetType,\n username,\n password,\n accountId = \"\",\n accountCode = \"\"\n } = props\n\n const url = `${endpoint1}/token`;\n\n const postData = {\n scope: {\n target: overrideAuthTargetType || authTargetType,\n action: \"\",\n },\n payload: {\n ...(accountId ? { account_id: accountId } : {}),\n ...(accountCode ? { account_code: accountCode } : {}),\n username,\n password\n }\n }\n\n const response = await makeCall({\n url,\n method: \"post\",\n payload: postData\n });\n\n return response;\n\n }\n\n const changePassword = async ({ current, password, confirm }: confirmPasswordProps) => {\n\n\n const url = `${endpoint1}/change_password`;\n\n const postData = {\n scope: {\n target: \"change_password\"\n },\n payload: {\n auth: {\n current_password: current,\n new_password: password,\n confirm_password: confirm\n }\n }\n }\n\n const response = await makeCall({\n url,\n method: 'post',\n payload: postData\n });\n\n }\n\n return {\n authLogin,\n changePassword\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storemw-core-client",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -55,8 +55,6 @@
55
55
  "dependencies": {
56
56
  "axios": "^1.13.1",
57
57
  "dayjs": "^1.11.18",
58
- "dotenv": "^17.2.3",
59
- "lodash": "^4.17.21",
60
- "storemw-core-api": "^1.0.66"
58
+ "lodash": "^4.17.21"
61
59
  }
62
60
  }