@one-commerce/sdk-core 1.7.1 → 1.12.0-alpha.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.
Files changed (47) hide show
  1. package/lib/bundles/bundle.esm.js +962 -0
  2. package/lib/bundles/bundle.esm.js.map +1 -0
  3. package/lib/bundles/bundle.esm.min.js +2 -0
  4. package/lib/bundles/bundle.esm.min.js.map +1 -0
  5. package/lib/bundles/bundle.umd.js +973 -0
  6. package/lib/bundles/bundle.umd.js.map +1 -0
  7. package/lib/bundles/bundle.umd.min.js +2 -0
  8. package/lib/bundles/bundle.umd.min.js.map +1 -0
  9. package/lib/cjs/backofficeServices.js +180 -28
  10. package/lib/cjs/backofficeServices.js.map +1 -0
  11. package/lib/cjs/events.js +56 -22
  12. package/lib/cjs/events.js.map +1 -0
  13. package/lib/cjs/index.js +306 -130
  14. package/lib/cjs/index.js.map +1 -0
  15. package/lib/cjs/shopServices.js +248 -54
  16. package/lib/cjs/shopServices.js.map +1 -0
  17. package/lib/cjs/utils.js +63 -28
  18. package/lib/cjs/utils.js.map +1 -0
  19. package/lib/esm/backofficeServices.js +59 -16
  20. package/lib/esm/backofficeServices.js.map +1 -0
  21. package/lib/esm/events.js +30 -22
  22. package/lib/esm/events.js.map +1 -0
  23. package/lib/esm/index.js +165 -117
  24. package/lib/esm/index.js.map +1 -0
  25. package/lib/esm/shopServices.js +125 -67
  26. package/lib/esm/shopServices.js.map +1 -0
  27. package/lib/esm/utils.js +34 -25
  28. package/lib/esm/utils.js.map +1 -0
  29. package/lib/{cjs → types}/backofficeServices.d.ts +7 -0
  30. package/lib/types/backofficeServices.d.ts.map +1 -0
  31. package/lib/{cjs → types}/events.d.ts +1 -0
  32. package/lib/types/events.d.ts.map +1 -0
  33. package/lib/types/iframe-channel.d.ts +19 -0
  34. package/lib/{esm → types}/index.d.ts +7 -2
  35. package/lib/types/index.d.ts.map +1 -0
  36. package/lib/{esm → types}/shopServices.d.ts +1 -0
  37. package/lib/types/shopServices.d.ts.map +1 -0
  38. package/lib/{esm → types}/utils.d.ts +1 -0
  39. package/lib/types/utils.d.ts.map +1 -0
  40. package/package.json +42 -16
  41. package/lib/cjs/index.d.ts +0 -75
  42. package/lib/cjs/shopServices.d.ts +0 -98
  43. package/lib/cjs/utils.d.ts +0 -8
  44. package/lib/esm/backofficeServices.d.ts +0 -21
  45. package/lib/esm/events.d.ts +0 -7
  46. package/lib/tsconfig.module.tsbuildinfo +0 -1
  47. package/lib/tsconfig.tsbuildinfo +0 -1
@@ -12,6 +12,12 @@ export declare class BackofficeUser extends BaseCallClass implements Backoffice.
12
12
  name?: string;
13
13
  authorities: Array<string>;
14
14
  }
15
+ export declare class BackofficeTenant extends BaseCallClass implements Backoffice.Tenant {
16
+ serviceName: string;
17
+ tenantKey?: string;
18
+ language?: string;
19
+ currency?: string;
20
+ }
15
21
  export declare class BackofficeOrderpath extends BaseCallClass implements Backoffice.Orderpath {
16
22
  serviceName: string;
17
23
  }
@@ -19,3 +25,4 @@ export declare class BackofficeLayout extends BaseCallClass implements Backoffic
19
25
  serviceName: string;
20
26
  isAsideOpened: boolean;
21
27
  }
28
+ //# sourceMappingURL=backofficeServices.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backofficeServices.d.ts","sourceRoot":"","sources":["../../src/backofficeServices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC;AAEtC,qBAAa,iBAAkB,SAAQ,aAAc,YAAW,UAAU,CAAC,OAAO;IAChF,WAAW,SAAY;IAEvB,eAAe,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAGnC,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAGlD;AAED,qBAAa,cAAe,SAAQ,aAAc,YAAW,UAAU,CAAC,IAAI;IAC1E,WAAW,SAAS;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,EAAG,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,EAAG,KAAK,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED,qBAAa,gBAAiB,SAAQ,aAAc,YAAW,UAAU,CAAC,MAAM;IAC9E,WAAW,SAAW;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,mBAAoB,SAAQ,aAAc,YAAW,UAAU,CAAC,SAAS;IACpF,WAAW,SAAc;CAC1B;AAED,qBAAa,gBAAiB,SAAQ,aAAc,YAAW,UAAU,CAAC,MAAM;IAC9E,WAAW,SAAW;IACtB,aAAa,EAAG,OAAO,CAAC;CACzB"}
@@ -5,3 +5,4 @@ declare class Events {
5
5
  emit(key: string, ...params: Array<any>): void;
6
6
  }
7
7
  export default Events;
8
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/events.ts"],"names":[],"mappings":"AAAA,cAAM,MAAM;IACV,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;;IAK/B,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI;IAO7C,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC;CAUxC;AAED,eAAe,MAAM,CAAA"}
@@ -0,0 +1,19 @@
1
+ declare module 'iframe-channel' {
2
+ interface ChannelOptions {
3
+ targetOrigin?: string
4
+ target?: typeof window.parent
5
+ subscribes?: { [k: string]: any }
6
+ attemptInterval?: number
7
+ maxAttempts?: number
8
+ }
9
+ class Channel {
10
+ constructor(options: ChannelOptions);
11
+ postMessage(type: string | number, data: any, opts?: { hasFunction: boolean, functionKeys: Array<string> }): Promise<void>;
12
+ connect(): Promise<void>;
13
+ clearQueue(): void;
14
+ destory(): void;
15
+ subscribe(type: string | number, fun?: Function): void;
16
+ unsubscribe(type: string | number, fun?: Function): void;
17
+ }
18
+ export default Channel
19
+ }
@@ -1,5 +1,5 @@
1
1
  import { Backoffice, Route, Shop } from "@one-commerce/sdk-shared";
2
- import { BackofficeCatalog, BackofficeLayout, BackofficeOrderpath, BackofficeUser } from "./backofficeServices";
2
+ import { BackofficeCatalog, BackofficeLayout, BackofficeOrderpath, BackofficeTenant, BackofficeUser } from "./backofficeServices";
3
3
  import Events from "./events";
4
4
  import { ShopAccount, ShopCart, ShopCatalog, ShopConfig, ShopUtils } from "./shopServices";
5
5
  export declare enum SdkEvents {
@@ -8,6 +8,7 @@ export declare enum SdkEvents {
8
8
  }
9
9
  export interface SdkOptions {
10
10
  debug?: boolean;
11
+ autoheight?: boolean;
11
12
  origin: string;
12
13
  }
13
14
  interface NamedNavigationPayload {
@@ -21,6 +22,7 @@ interface PathNavigationPayload {
21
22
  declare abstract class Sdk<T> extends Events {
22
23
  private channel;
23
24
  private static debug;
25
+ private autoheight;
24
26
  origin: string;
25
27
  isInitialized: boolean;
26
28
  instances: T;
@@ -29,7 +31,7 @@ declare abstract class Sdk<T> extends Events {
29
31
  private initializeServiceGetters;
30
32
  constructor(options: SdkOptions);
31
33
  private setupOptions;
32
- protected callFunction(service: string, fun: string, ...payload: any): Promise<unknown>;
34
+ protected callFunction(service: string, fun: string, ...payload: any): Promise<any>;
33
35
  navigate(event: NamedNavigationPayload | PathNavigationPayload): void;
34
36
  }
35
37
  export interface BackofficeInstances extends Backoffice.Api {
@@ -37,6 +39,7 @@ export interface BackofficeInstances extends Backoffice.Api {
37
39
  orderpath: BackofficeOrderpath;
38
40
  catalog: BackofficeCatalog;
39
41
  user: BackofficeUser;
42
+ tenant: BackofficeTenant;
40
43
  layout: BackofficeLayout;
41
44
  }
42
45
  export interface ShopInstances extends Shop.Api {
@@ -56,6 +59,7 @@ export declare class BackofficeSdk extends Sdk<BackofficeInstances> {
56
59
  orderpath: BackofficeOrderpath;
57
60
  catalog: BackofficeCatalog;
58
61
  user: BackofficeUser;
62
+ tenant: BackofficeTenant;
59
63
  layout: BackofficeLayout;
60
64
  };
61
65
  }
@@ -73,3 +77,4 @@ export declare class ShopSdk extends Sdk<ShopInstances> {
73
77
  };
74
78
  }
75
79
  export {};
80
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAW,KAAK,EAAE,IAAI,EAAC,MAAM,0BAA0B,CAAC;AAG1E,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EACL,WAAW,EACX,QAAQ,EACR,WAAW,EAAE,UAAU,EAAE,SAAS,EACnC,MAAM,gBAAgB,CAAC;AAOxB,oBAAY,SAAS;IACnB,IAAI,SAAO;IACX,MAAM,WAAS;CAChB;AACD,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;CACf;AAED,UAAU,sBAAsB;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,GAAG,CAAA;CACZ;AAED,UAAU,qBAAqB;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,GAAG,CAAA;CACZ;AAED,uBAAe,GAAG,CAAC,CAAC,CAAE,SAAQ,MAAM;IAClC,OAAO,CAAC,OAAO,CAAW;IAC1B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAQ;IAC5B,OAAO,CAAC,UAAU,CAAO;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,UAAQ;IACrB,SAAS,EAAG,CAAC,CAAC;IAEd,OAAO,CAAC,MAAM,CAAC,GAAG;IAIlB,OAAO,CAAC,MAAM,CAAC,IAAI;IAInB,OAAO,CAAC,wBAAwB;gBAYpB,OAAO,EAAE,UAAU;IA8C/B,OAAO,CAAC,YAAY;IAUpB,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG;IAwB7D,QAAQ,CAAC,KAAK,EAAE,sBAAsB,GAAG,qBAAqB;CAItE;AAED,MAAM,WAAW,mBAAoB,SAAQ,UAAU,CAAC,GAAG;IACzD,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,EAAE,mBAAmB,CAAC;IAC/B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE,cAAc,CAAC;IACrB,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,gBAAgB,CAAA;CACzB;AAED,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,GAAG;IAC7C,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE,WAAW,CAAC;IACrB,KAAK,EAAE,SAAS,CAAA;IAChB,MAAM,EAAE,UAAU,CAAA;CACnB;AAED,qBAAa,aAAc,SAAQ,GAAG,CAAC,mBAAmB,CAAC;IACzD,SAAS;;;;;;;;;;MAUR;CACF;AAED,qBAAa,OAAQ,SAAQ,GAAG,CAAC,aAAa,CAAC;IAC7C,SAAS;;;;;;;;;;MAUR;CACF"}
@@ -96,3 +96,4 @@ export declare class ShopConfig extends BaseCallClass implements Shop.Config {
96
96
  isRegistrationEnabled: boolean;
97
97
  currency: any;
98
98
  }
99
+ //# sourceMappingURL=shopServices.d.ts.map
@@ -0,0 +1 @@
1
+ {"version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,CAAC;IAInD,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAI5C,MAAM,EAAE;QACN;;WAEG;QACH,eAAe,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC;QACvE;;WAEG;QACH,wBAAwB,CAAC,YAAY,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC;QAC3E;;WAEG;QACH,aAAa,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC;QACtE;;WAEG;QACH,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,CAAA;KACzD,CAAC;CACH;AAED,qBAAa,UAAW,SAAQ,aAAc,YAAW,IAAI,CAAC,MAAM;IAClE,WAAW,SAAW;IACtB,UAAU,EAAG,MAAM,CAAC;IACpB,wBAAwB,EAAG,OAAO,CAAC;IACnC,eAAe,EAAG,OAAO,CAAC;IAC1B,eAAe,EAAG,OAAO,CAAC;IAC1B,gBAAgB,EAAG,OAAO,CAAC;IAC3B,gBAAgB,EAAG,OAAO,CAAC;IAC3B,iBAAiB,EAAG,OAAO,CAAC;IAC5B,qBAAqB,EAAG,OAAO,CAAC;IAChC,QAAQ,EAAE,GAAG,CAAC;CACf"}
@@ -6,3 +6,4 @@ export declare class BaseCallClass {
6
6
  static update(target: Record<string, any>, payload: Record<string, any>): void;
7
7
  update(payload: any): void;
8
8
  }
9
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAKA,wBAAgB,cAAc,WAI7B;AAED,qBAAa,aAAa;IACxB,WAAW,SAAK;IAChB,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,GAAG,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;gBACvC,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC;IAK7E,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAKvE,MAAM,CAAC,OAAO,EAAE,GAAG;CAMpB"}
package/package.json CHANGED
@@ -1,14 +1,30 @@
1
1
  {
2
2
  "name": "@one-commerce/sdk-core",
3
- "version": "1.7.1",
3
+ "version": "1.12.0-alpha.0",
4
4
  "description": "Core package for One Plugins",
5
- "main": "lib/cjs/index.js",
6
- "typings": "lib/cjs/index.d.ts",
7
5
  "module": "lib/esm/index.js",
6
+ "main": "lib/cjs/index.js",
7
+ "types": "lib/types/index.d.ts",
8
+ "files": [
9
+ "lib",
10
+ "CHANGELOG.md",
11
+ "LICENSE",
12
+ "README.md"
13
+ ],
14
+ "exports": {
15
+ "import": "./lib/esm/index.js",
16
+ "require": "./lib/cjs/index.js",
17
+ "types": "./types/index.d.ts"
18
+ },
8
19
  "license": "MIT",
9
20
  "keywords": [],
10
21
  "scripts": {
11
- "build": "run-p build:*",
22
+ "clean": "rimraf lib",
23
+ "build:esm": "cross-env BABEL_ENV=esmUnbundled babel src --extensions '.ts' --out-dir 'lib/esm' --source-maps",
24
+ "build:cjs": "cross-env BABEL_ENV=cjs babel src --extensions '.ts' --out-dir 'lib/cjs' --source-maps",
25
+ "build:bundles": "cross-env BABEL_ENV=esmBundled rollup -c",
26
+ "declarations": "tsc -p tsconfig.json",
27
+ "build": "npm-run-all -l clean -p build:esm build:cjs build:bundles declarations",
12
28
  "build:main": "tsc -p tsconfig.json",
13
29
  "build:module": "tsc -p tsconfig.module.json",
14
30
  "fix": "run-s fix:*",
@@ -39,16 +55,26 @@
39
55
  "node": ">=14"
40
56
  },
41
57
  "dependencies": {
42
- "@one-commerce/sdk-shared": "^1.7.0",
58
+ "@one-commerce/sdk-shared": "^1.12.0-alpha.0",
43
59
  "iframe-channel": "^1.2.5"
44
60
  },
45
61
  "devDependencies": {
46
62
  "@ava/typescript": "^1.1.1",
63
+ "@babel/cli": "^7.16.7",
64
+ "@babel/core": "^7.16.7",
65
+ "@babel/plugin-proposal-class-properties": "^7.16.7",
66
+ "@babel/plugin-proposal-optional-chaining": "^7.16.7",
67
+ "@babel/preset-env": "^7.16.7",
68
+ "@babel/preset-typescript": "^7.16.7",
47
69
  "@istanbuljs/nyc-config-typescript": "^1.0.1",
48
- "@typescript-eslint/eslint-plugin": "^4.0.1",
49
- "@typescript-eslint/parser": "^4.0.1",
70
+ "@rollup/plugin-babel": "^5.3.0",
71
+ "@rollup/plugin-commonjs": "^21.0.1",
72
+ "@rollup/plugin-node-resolve": "^11.1.1",
73
+ "@typescript-eslint/eslint-plugin": "^4.18.0",
74
+ "@typescript-eslint/parser": "^4.18.0",
50
75
  "ava": "^3.12.1",
51
76
  "codecov": "^3.5.0",
77
+ "cross-env": "^7.0.3",
52
78
  "cspell": "^4.1.0",
53
79
  "cz-conventional-changelog": "^3.3.0",
54
80
  "eslint": "^7.8.0",
@@ -56,23 +82,23 @@
56
82
  "eslint-plugin-eslint-comments": "^3.2.0",
57
83
  "eslint-plugin-functional": "^3.0.2",
58
84
  "eslint-plugin-import": "^2.22.0",
85
+ "eslint-plugin-prettier": "^3.3.1",
86
+ "eslint-plugin-vue": "^7.0.0",
59
87
  "gh-pages": "^3.1.0",
60
88
  "nodemon": "^2.0.7",
61
89
  "npm-run-all": "^4.1.5",
62
90
  "nyc": "^15.1.0",
63
91
  "open-cli": "^6.0.1",
64
- "prettier": "^2.1.1",
92
+ "prettier": "^2.2.1",
93
+ "rimraf": "^3.0.2",
94
+ "rollup": "^2.38.4",
95
+ "rollup-plugin-copy": "^3.4.0",
96
+ "rollup-plugin-terser": "^7.0.2",
65
97
  "standard-version": "^9.0.0",
66
98
  "ts-node": "^9.0.0",
67
99
  "typedoc": "^0.19.0",
68
- "typescript": "^4.0.2"
100
+ "typescript": "~4.1.5"
69
101
  },
70
- "files": [
71
- "lib/",
72
- "CHANGELOG.md",
73
- "LICENSE",
74
- "README.md"
75
- ],
76
102
  "ava": {
77
103
  "failFast": true,
78
104
  "timeout": "60s",
@@ -99,5 +125,5 @@
99
125
  "**/*.spec.js"
100
126
  ]
101
127
  },
102
- "gitHead": "8ced6938af352a38bd82ba9b0b936e9625325f45"
128
+ "gitHead": "383a8f3715b440efa766b33c2b0237392ed1a00a"
103
129
  }
@@ -1,75 +0,0 @@
1
- import { Backoffice, Route, Shop } from "@one-commerce/sdk-shared";
2
- import { BackofficeCatalog, BackofficeLayout, BackofficeOrderpath, BackofficeUser } from "./backofficeServices";
3
- import Events from "./events";
4
- import { ShopAccount, ShopCart, ShopCatalog, ShopConfig, ShopUtils } from "./shopServices";
5
- export declare enum SdkEvents {
6
- INIT = "INIT",
7
- UPDATE = "UPDATE"
8
- }
9
- export interface SdkOptions {
10
- debug?: boolean;
11
- origin: string;
12
- }
13
- interface NamedNavigationPayload {
14
- name: string;
15
- params: any;
16
- }
17
- interface PathNavigationPayload {
18
- path: string;
19
- params: any;
20
- }
21
- declare abstract class Sdk<T> extends Events {
22
- private channel;
23
- private static debug;
24
- origin: string;
25
- isInitialized: boolean;
26
- instances: T;
27
- private static log;
28
- private static warn;
29
- private initializeServiceGetters;
30
- constructor(options: SdkOptions);
31
- private setupOptions;
32
- protected callFunction(service: string, fun: string, ...payload: any): Promise<unknown>;
33
- navigate(event: NamedNavigationPayload | PathNavigationPayload): void;
34
- }
35
- export interface BackofficeInstances extends Backoffice.Api {
36
- route: Route;
37
- orderpath: BackofficeOrderpath;
38
- catalog: BackofficeCatalog;
39
- user: BackofficeUser;
40
- layout: BackofficeLayout;
41
- }
42
- export interface ShopInstances extends Shop.Api {
43
- route: Route;
44
- cart: ShopCart;
45
- catalog: ShopCatalog;
46
- account: ShopAccount;
47
- utils: ShopUtils;
48
- config: ShopConfig;
49
- }
50
- export declare class BackofficeSdk extends Sdk<BackofficeInstances> {
51
- instances: {
52
- route: {
53
- hash: string;
54
- query: {};
55
- };
56
- orderpath: BackofficeOrderpath;
57
- catalog: BackofficeCatalog;
58
- user: BackofficeUser;
59
- layout: BackofficeLayout;
60
- };
61
- }
62
- export declare class ShopSdk extends Sdk<ShopInstances> {
63
- instances: {
64
- route: {
65
- hash: string;
66
- query: {};
67
- };
68
- cart: ShopCart;
69
- catalog: ShopCatalog;
70
- account: ShopAccount;
71
- utils: ShopUtils;
72
- config: ShopConfig;
73
- };
74
- }
75
- export {};
@@ -1,98 +0,0 @@
1
- import { Shop } from "@one-commerce/sdk-shared";
2
- import { BaseCallClass } from "./utils";
3
- export declare class ShopCatalog extends BaseCallClass implements Shop.Catalog {
4
- serviceName: string;
5
- categories: Array<any>;
6
- selectedCategoryId: string | null;
7
- fetchProduct(productId: string): Promise<any>;
8
- getCategoryById(categoryId: string): Promise<any>;
9
- }
10
- export declare class ShopAccount extends BaseCallClass implements Shop.Account {
11
- serviceName: string;
12
- client: {
13
- name: string;
14
- billingAddress?: {
15
- city: string;
16
- country: string;
17
- id: string;
18
- isDefault: boolean;
19
- name: string;
20
- phone: string;
21
- street: string;
22
- type: string;
23
- zipCode: string;
24
- };
25
- };
26
- isAuthenticated: boolean;
27
- user: {
28
- email?: string;
29
- name?: string;
30
- phone?: string;
31
- /**
32
- * @deprecated Use non-nested function instead
33
- */
34
- hasSegment(name: string): Promise<boolean>;
35
- };
36
- hasSegment(name: string): Promise<boolean>;
37
- manager: {
38
- additionalEmail?: string;
39
- email: string;
40
- id: string;
41
- landlinePhone?: string;
42
- mobilePhone?: string;
43
- name: string;
44
- photo?: string;
45
- };
46
- logout(): void;
47
- }
48
- export declare class ShopCart extends BaseCallClass implements Shop.Cart {
49
- serviceName: string;
50
- carts: Array<any>;
51
- currentCart: any;
52
- totalCartPrice: number;
53
- addToCart(productId: string, amount: number, where: string, cartId?: string): Promise<void>;
54
- }
55
- export declare class ShopUtils extends BaseCallClass implements Shop.Utils {
56
- serviceName: string;
57
- currency: any;
58
- isAnonymousAndPurchaseDisabled: boolean;
59
- isB2B: boolean;
60
- isB2BAndPlatformIsNotOpened: boolean;
61
- isIndexPage: boolean;
62
- isPurchaseEnabledOrAuthenticated: boolean;
63
- constructor(call: (service: string, fun: string, ...arg: any) => Promise<any>);
64
- getCategoryPath(id?: string): Promise<string | null>;
65
- getManufacturerSearchUrl(manufacturer: string): Promise<string>;
66
- getProductUrl(product: any): Promise<string | null>;
67
- isExternalUrl(url: string): Promise<boolean>;
68
- routes: {
69
- /**
70
- * @deprecated Use non-nested function instead
71
- */
72
- getCategoryPath(id?: string): (Promise<string | null> | string | null);
73
- /**
74
- * @deprecated Use non-nested function instead
75
- */
76
- getManufacturerSearchUrl(manufacturer: string): (Promise<string> | string);
77
- /**
78
- * @deprecated Use non-nested function instead
79
- */
80
- getProductUrl(product: any): (Promise<string | null> | string | null);
81
- /**
82
- * @deprecated Use non-nested function instead
83
- */
84
- isExternalUrl(url: string): (Promise<boolean> | boolean);
85
- };
86
- }
87
- export declare class ShopConfig extends BaseCallClass implements Shop.Config {
88
- serviceName: string;
89
- accessMode: string;
90
- isB2CRegistrationEnabled: boolean;
91
- isCatalogOpened: boolean;
92
- isGrossSelected: boolean;
93
- isPlatformClosed: boolean;
94
- isPlatformOpened: boolean;
95
- isPurchaseEnabled: boolean;
96
- isRegistrationEnabled: boolean;
97
- currency: any;
98
- }
@@ -1,8 +0,0 @@
1
- export declare function generateCallId(): string;
2
- export declare class BaseCallClass {
3
- serviceName: string;
4
- call: (fun: string, ...arg: any[]) => Promise<any>;
5
- constructor(call: (service: string, fun: string, ...arg: any) => Promise<any>);
6
- static update(target: Record<string, any>, payload: Record<string, any>): void;
7
- update(payload: any): void;
8
- }
@@ -1,21 +0,0 @@
1
- import { Backoffice } from "@one-commerce/sdk-shared";
2
- import { BaseCallClass } from "./utils";
3
- export declare class BackofficeCatalog extends BaseCallClass implements Backoffice.Catalog {
4
- serviceName: string;
5
- fetchCategories(): Promise<Array<unknown>>;
6
- fetchProduct(id: string): Promise<unknown>;
7
- }
8
- export declare class BackofficeUser extends BaseCallClass implements Backoffice.User {
9
- serviceName: string;
10
- email?: string;
11
- id: string;
12
- name?: string;
13
- authorities: Array<string>;
14
- }
15
- export declare class BackofficeOrderpath extends BaseCallClass implements Backoffice.Orderpath {
16
- serviceName: string;
17
- }
18
- export declare class BackofficeLayout extends BaseCallClass implements Backoffice.Layout {
19
- serviceName: string;
20
- isAsideOpened: boolean;
21
- }
@@ -1,7 +0,0 @@
1
- declare class Events {
2
- _callbacks: Record<string, any>;
3
- constructor();
4
- on<T>(key: string, callback: (arg: T) => void): void;
5
- emit(key: string, ...params: Array<any>): void;
6
- }
7
- export default Events;
@@ -1 +0,0 @@
1
- {"program":{"fileNames":["../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.dom.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../shared/build/main/shared/messages.d.ts","../../shared/build/main/shared/api.d.ts","../../shared/build/main/index.d.ts","../src/utils.ts","../src/backofficeServices.ts","../src/events.ts","../src/shopServices.ts","../src/index.ts","../src/types/iframe-channel.d.ts"],"fileInfos":[{"version":"ac3a8c4040e183ce38da69d23b96939112457d1936198e6542672b7963cf0fce","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9",{"version":"1dad4fe1561d99dfd6709127608b99a76e5c2643626c800434f99c48038567ee","affectsGlobalScope":true},{"version":"cce43d02223f8049864f8568bed322c39424013275cd3bcc3f51492d8b546cb3","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"8dff1b4c2df638fcd976cbb0e636f23ab5968e836cd45084cc31d47d1ab19c49","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"8f4c9f651c8294a2eb1cbd12581fe25bfb901ab1d474bb93cd38c7e2f4be7a30","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},"3488caee78be66bee1a74cb1406f0b8371bf0dfc2bd146e6aae9232d9669ba75","0ebe84431b92c2b40372bd0b83d461effd59feb8a70973e13f46754a98843199","3f880625520675cc8daad4ba3d539a1a77d9b8f89fe9bf440e9ebab83788c43e",{"version":"ff9ad3f1527551804ed950a6900a6d5dc54d8ec3565c27086c64cfcf8a804dd7","signature":"524e2b5a7ccf30019badc11c794760649e0f1e12c95b7c5b20fcbdc170f78165"},{"version":"133d7a4f81f4c097e5ab156e8e8cd549a8394ec0bdaca7dc01612e88608a74bb","signature":"3749f25abbeae9ec3b941c3c8410980e463cb6741d128b4c80f95f6c2c6e95ac"},"bbc149a0a418d7a59e9cd4a47e8de5debae5593b7009f1b9819d83809ef9dfe3",{"version":"f82d1c83bcf590847137e48f6144d0b3ef8134f8fce00b4bd15f562076803887","signature":"a1d18f27a7f925a5f6b032e80e65c99d3f2a0bd5b3b0775170bbd25871711520"},{"version":"b5caa1c0ee0036f8b8bee3c3c5870e2d8c1df9fc6bd64a327f8967f647ac4680","signature":"f28eba837505d3e444f77c90516589da0016fa6e4e2075ace6fd20bd23912ab0"},"5e5710e2206d60011b0bb246ecf6ae76c1649928d40c58ba443e679ccd450f13"],"options":{"declaration":true,"esModuleInterop":true,"inlineSourceMap":true,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitAny":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./esm","rootDir":"../src","strict":true,"target":99},"fileIdsList":[[23,24],[23,24,25,26,27,29],[21,22],[23,25,26,27]],"referencedMap":[[25,1],[28,2],[27,1],[23,3]],"exportedModulesMap":[[25,1],[28,4],[27,1],[23,3]],"semanticDiagnosticsPerFile":[5,7,6,2,8,9,10,11,12,13,14,15,3,4,19,16,17,18,20,1,25,26,28,27,29,24,23,22,21]},"version":"4.3.5"}
@@ -1 +0,0 @@
1
- {"program":{"fileNames":["../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.dom.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../shared/build/main/shared/messages.d.ts","../../shared/build/main/shared/api.d.ts","../../shared/build/main/index.d.ts","../src/utils.ts","../src/backofficeServices.ts","../src/events.ts","../src/shopServices.ts","../src/index.ts","../src/types/iframe-channel.d.ts"],"fileInfos":[{"version":"ac3a8c4040e183ce38da69d23b96939112457d1936198e6542672b7963cf0fce","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9",{"version":"1dad4fe1561d99dfd6709127608b99a76e5c2643626c800434f99c48038567ee","affectsGlobalScope":true},{"version":"cce43d02223f8049864f8568bed322c39424013275cd3bcc3f51492d8b546cb3","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"8dff1b4c2df638fcd976cbb0e636f23ab5968e836cd45084cc31d47d1ab19c49","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"8f4c9f651c8294a2eb1cbd12581fe25bfb901ab1d474bb93cd38c7e2f4be7a30","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},"3488caee78be66bee1a74cb1406f0b8371bf0dfc2bd146e6aae9232d9669ba75","0ebe84431b92c2b40372bd0b83d461effd59feb8a70973e13f46754a98843199","3f880625520675cc8daad4ba3d539a1a77d9b8f89fe9bf440e9ebab83788c43e",{"version":"ff9ad3f1527551804ed950a6900a6d5dc54d8ec3565c27086c64cfcf8a804dd7","signature":"524e2b5a7ccf30019badc11c794760649e0f1e12c95b7c5b20fcbdc170f78165"},{"version":"133d7a4f81f4c097e5ab156e8e8cd549a8394ec0bdaca7dc01612e88608a74bb","signature":"3749f25abbeae9ec3b941c3c8410980e463cb6741d128b4c80f95f6c2c6e95ac"},"bbc149a0a418d7a59e9cd4a47e8de5debae5593b7009f1b9819d83809ef9dfe3",{"version":"f82d1c83bcf590847137e48f6144d0b3ef8134f8fce00b4bd15f562076803887","signature":"a1d18f27a7f925a5f6b032e80e65c99d3f2a0bd5b3b0775170bbd25871711520"},{"version":"b5caa1c0ee0036f8b8bee3c3c5870e2d8c1df9fc6bd64a327f8967f647ac4680","signature":"f28eba837505d3e444f77c90516589da0016fa6e4e2075ace6fd20bd23912ab0"},"5e5710e2206d60011b0bb246ecf6ae76c1649928d40c58ba443e679ccd450f13"],"options":{"declaration":true,"esModuleInterop":true,"inlineSourceMap":true,"module":1,"noFallthroughCasesInSwitch":true,"noImplicitAny":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./cjs","rootDir":"../src","strict":true,"target":4},"fileIdsList":[[23,24],[23,24,25,26,27,29],[21,22],[23,25,26,27]],"referencedMap":[[25,1],[28,2],[27,1],[23,3]],"exportedModulesMap":[[25,1],[28,4],[27,1],[23,3]],"semanticDiagnosticsPerFile":[5,7,6,2,8,9,10,11,12,13,14,15,3,4,19,16,17,18,20,1,25,26,28,27,29,24,23,22,21]},"version":"4.3.5"}