storemw-core-client 1.0.30 → 1.0.31

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,23 +1,13 @@
1
1
  import { DefaultServiceProps } from '../../lib';
2
- export declare const routeTypes: {
3
- readonly admin: "admin";
4
- readonly retail: "retail";
5
- readonly workstation: "workstation";
6
- readonly customer: "customer";
7
- readonly member: "member";
8
- readonly public: "public";
9
- readonly driver: "driver";
10
- readonly console: "console";
11
- };
12
2
  export declare const authTargetTypes: {
13
- readonly admin: "administrator";
14
- readonly retailer: "retail";
15
- readonly workstation: "workstation";
3
+ readonly administrator: "administrator";
4
+ readonly retailer: "retailer";
5
+ readonly worker: "worker";
16
6
  readonly customer: "customer";
17
7
  readonly member: "member";
18
8
  readonly public: "public";
19
9
  readonly driver: "driver";
20
- readonly console: "console";
10
+ readonly operator: "operator";
21
11
  };
22
12
  export type AuthTargetType = typeof authTargetTypes[keyof typeof authTargetTypes];
23
13
  export type AuthServiceProps = DefaultServiceProps & {
@@ -1,26 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AuthService = exports.authTargetTypes = exports.routeTypes = void 0;
4
- exports.routeTypes = {
5
- admin: "admin",
6
- retail: "retail", // retail
7
- workstation: "workstation",
8
- customer: "customer",
9
- member: "member",
10
- public: "public",
11
- driver: "driver",
12
- console: "console"
13
- };
3
+ exports.AuthService = exports.authTargetTypes = void 0;
4
+ // export const routeTypes = {
5
+ // admin: "admin",
6
+ // retail: "retail", // retail
7
+ // workstation: "workstation",
8
+ // customer: "customer",
9
+ // member: "member",
10
+ // public: "public",
11
+ // driver: "driver",
12
+ // console: "console"
13
+ // } as const
14
14
  exports.authTargetTypes = {
15
- admin: "administrator",
16
- // retail: "retailer",
17
- retailer: "retail",
18
- workstation: "workstation", // worker
15
+ administrator: "administrator",
16
+ retailer: "retailer",
17
+ worker: "worker",
19
18
  customer: "customer",
20
19
  member: "member",
21
20
  public: "public",
22
21
  driver: "driver",
23
- console: "console"
22
+ operator: "operator"
24
23
  };
25
24
  const AuthService = (props) => {
26
25
  const { authTargetType } = props ?? {};
@@ -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;AAEG,QAAA,eAAe,GAAG;IAC3B,KAAK,EAAE,eAAe;IACtB,sBAAsB;IACtB,QAAQ,EAAE,QAAQ;IAClB,WAAW,EAAE,aAAa,EAAE,SAAS;IACrC,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;CACZ,CAAA;AAoCH,MAAM,WAAW,GAAG,CAAC,KAAuB,EAAE,EAAE;IAEnD,MAAM,EAAE,cAAc,EAAE,GAAG,KAAK,IAAI,EAAE,CAAA;IAEtC,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,UAAU,CAAA;IAErC,MAAM,SAAS,GAAG,MAAM,CAAC;IAEzB,MAAM,SAAS,GAAG,KAAK,EAAE,KAAqB,EAAE,EAAE;QAE9C,MAAM,EACF,cAAc,EAAE,sBAAsB,EACtC,QAAQ,EACR,QAAQ,EACR,SAAS,GAAG,EAAE,EACd,WAAW,GAAG,EAAE,EACnB,GAAG,KAAK,CAAA;QAET,MAAM,GAAG,GAAG,GAAG,SAAS,QAAQ,CAAC;QAEjC,MAAM,QAAQ,GAAG;YACb,KAAK,EAAE;gBACH,MAAM,EAAE,sBAAsB,IAAI,cAAc;gBAChD,MAAM,EAAE,EAAE;aACb;YACD,OAAO,EAAE;gBACL,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC/C,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACrD,QAAQ;gBACR,QAAQ;aACX;SACJ,CAAA;QAED,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC;YAC5B,GAAG;YACH,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,QAAQ;SACpB,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;gBACzB,MAAM,EAAE,EAAE;aACb;YACD,OAAO,EAAE;gBACL,gBAAgB,EAAE,OAAO;gBACzB,YAAY,EAAE,QAAQ;gBACtB,gBAAgB,EAAE,OAAO;aAC5B;SACJ,CAAA;QAED,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC;YAC5B,GAAG;YACH,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,QAAQ;SACpB,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAA;IAEnB,CAAC,CAAA;IAED,OAAO;QACH,SAAS;QACT,cAAc;KACjB,CAAC;AACN,CAAC,CAAA;AA1EY,QAAA,WAAW,eA0EvB","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 action: \"\"\n },\n payload: {\n current_password: current,\n new_password: password,\n confirm_password: confirm\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 return {\n authLogin,\n changePassword\n };\n}\n"]}
1
+ {"version":3,"file":"AuthService.js","sourceRoot":"","sources":["../../../src/services/auth/AuthService.ts"],"names":[],"mappings":";;;AAEA,8BAA8B;AAC9B,sBAAsB;AACtB,kCAAkC;AAClC,kCAAkC;AAClC,4BAA4B;AAC5B,wBAAwB;AACxB,wBAAwB;AACxB,wBAAwB;AACxB,yBAAyB;AACzB,aAAa;AAEA,QAAA,eAAe,GAAG;IAC3B,aAAa,EAAE,eAAe;IAC9B,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;CACd,CAAA;AAoCH,MAAM,WAAW,GAAG,CAAC,KAAuB,EAAE,EAAE;IAEnD,MAAM,EAAE,cAAc,EAAE,GAAG,KAAK,IAAI,EAAE,CAAA;IAEtC,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,UAAU,CAAA;IAErC,MAAM,SAAS,GAAG,MAAM,CAAC;IAEzB,MAAM,SAAS,GAAG,KAAK,EAAE,KAAqB,EAAE,EAAE;QAE9C,MAAM,EACF,cAAc,EAAE,sBAAsB,EACtC,QAAQ,EACR,QAAQ,EACR,SAAS,GAAG,EAAE,EACd,WAAW,GAAG,EAAE,EACnB,GAAG,KAAK,CAAA;QAET,MAAM,GAAG,GAAG,GAAG,SAAS,QAAQ,CAAC;QAEjC,MAAM,QAAQ,GAAG;YACb,KAAK,EAAE;gBACH,MAAM,EAAE,sBAAsB,IAAI,cAAc;gBAChD,MAAM,EAAE,EAAE;aACb;YACD,OAAO,EAAE;gBACL,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC/C,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACrD,QAAQ;gBACR,QAAQ;aACX;SACJ,CAAA;QAED,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC;YAC5B,GAAG;YACH,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,QAAQ;SACpB,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;gBACzB,MAAM,EAAE,EAAE;aACb;YACD,OAAO,EAAE;gBACL,gBAAgB,EAAE,OAAO;gBACzB,YAAY,EAAE,QAAQ;gBACtB,gBAAgB,EAAE,OAAO;aAC5B;SACJ,CAAA;QAED,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC;YAC5B,GAAG;YACH,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,QAAQ;SACpB,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAA;IAEnB,CAAC,CAAA;IAED,OAAO;QACH,SAAS;QACT,cAAc;KACjB,CAAC;AACN,CAAC,CAAA;AA1EY,QAAA,WAAW,eA0EvB","sourcesContent":["import { DefaultServiceProps } from '@/lib';\n\n// export 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 administrator: \"administrator\",\n retailer: \"retailer\",\n worker: \"worker\",\n customer: \"customer\",\n member: \"member\",\n public: \"public\",\n driver: \"driver\",\n operator: \"operator\"\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 action: \"\"\n },\n payload: {\n current_password: current,\n new_password: password,\n confirm_password: confirm\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 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.30",
3
+ "version": "1.0.31",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {