@scayle/omnichannel-nuxt 1.1.18 → 2.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.
Files changed (108) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +23 -35
  3. package/dist/chunks/createOmnichannelHandler.mjs +790 -0
  4. package/dist/index.d.mts +40 -0
  5. package/dist/index.d.ts +40 -9
  6. package/dist/index.mjs +96 -0
  7. package/dist/module.cjs +5 -0
  8. package/dist/module.d.mts +6 -0
  9. package/dist/module.d.ts +6 -0
  10. package/dist/module.json +4 -0
  11. package/dist/module.mjs +36 -0
  12. package/dist/runtime/composables/useStoreLocator.d.ts +9 -0
  13. package/dist/runtime/composables/useStoreLocator.mjs +18 -0
  14. package/dist/{composables → runtime/composables}/useStoreVariantById.d.ts +1 -2
  15. package/dist/runtime/composables/useStoreVariantById.mjs +20 -0
  16. package/dist/runtime/composables/useStores.d.ts +6 -0
  17. package/dist/runtime/composables/useStores.mjs +14 -0
  18. package/dist/runtime/composables/useVariantStores.d.ts +6 -0
  19. package/dist/runtime/composables/useVariantStores.mjs +14 -0
  20. package/dist/runtime/constants/httpStatus.d.ts +632 -0
  21. package/dist/runtime/constants/httpStatus.mjs +629 -0
  22. package/dist/runtime/constants/index.d.ts +1 -0
  23. package/dist/runtime/constants/index.mjs +1 -0
  24. package/dist/runtime/error/errorHandler.d.ts +7 -0
  25. package/dist/runtime/error/errorHandler.mjs +20 -0
  26. package/dist/runtime/handler.d.ts +2 -0
  27. package/dist/runtime/handler.mjs +48 -0
  28. package/dist/runtime/lib/init.d.ts +26 -0
  29. package/dist/runtime/lib/init.mjs +72 -0
  30. package/dist/{rpc → runtime/rpc}/storeLocator.d.ts +4 -11
  31. package/dist/runtime/rpc/storeLocator.mjs +32 -0
  32. package/dist/{types/omnichannel.d.ts → shared/omnichannel-nuxt.9b492196.d.mts} +25 -24
  33. package/dist/shared/omnichannel-nuxt.9b492196.d.ts +146 -0
  34. package/dist/types.d.mts +8 -0
  35. package/dist/types.d.ts +8 -0
  36. package/package.json +44 -20
  37. package/dist/composables/sharedRef.d.ts +0 -3
  38. package/dist/composables/sharedRef.d.ts.map +0 -1
  39. package/dist/composables/sharedRef.js +0 -16
  40. package/dist/composables/sharedRef.js.map +0 -1
  41. package/dist/composables/useGeocode.d.ts +0 -7
  42. package/dist/composables/useGeocode.d.ts.map +0 -1
  43. package/dist/composables/useGeocode.js +0 -17
  44. package/dist/composables/useGeocode.js.map +0 -1
  45. package/dist/composables/useStoreLocator.d.ts +0 -10
  46. package/dist/composables/useStoreLocator.d.ts.map +0 -1
  47. package/dist/composables/useStoreLocator.js +0 -17
  48. package/dist/composables/useStoreLocator.js.map +0 -1
  49. package/dist/composables/useStoreVariantById.d.ts.map +0 -1
  50. package/dist/composables/useStoreVariantById.js +0 -20
  51. package/dist/composables/useStoreVariantById.js.map +0 -1
  52. package/dist/composables/useStores.d.ts +0 -7
  53. package/dist/composables/useStores.d.ts.map +0 -1
  54. package/dist/composables/useStores.js +0 -17
  55. package/dist/composables/useStores.js.map +0 -1
  56. package/dist/composables/useVariantStores.d.ts +0 -7
  57. package/dist/composables/useVariantStores.d.ts.map +0 -1
  58. package/dist/composables/useVariantStores.js +0 -17
  59. package/dist/composables/useVariantStores.js.map +0 -1
  60. package/dist/constants/index.d.ts +0 -2
  61. package/dist/constants/index.d.ts.map +0 -1
  62. package/dist/constants/index.js +0 -5
  63. package/dist/constants/index.js.map +0 -1
  64. package/dist/constants/omnichannel.d.ts +0 -12
  65. package/dist/constants/omnichannel.d.ts.map +0 -1
  66. package/dist/constants/omnichannel.js +0 -13
  67. package/dist/constants/omnichannel.js.map +0 -1
  68. package/dist/error/errorHandler.d.ts +0 -11
  69. package/dist/error/errorHandler.d.ts.map +0 -1
  70. package/dist/error/errorHandler.js +0 -57
  71. package/dist/error/errorHandler.js.map +0 -1
  72. package/dist/index.d.ts.map +0 -1
  73. package/dist/index.js +0 -18
  74. package/dist/index.js.map +0 -1
  75. package/dist/lib/init.d.ts +0 -11
  76. package/dist/lib/init.d.ts.map +0 -1
  77. package/dist/lib/init.js +0 -49
  78. package/dist/lib/init.js.map +0 -1
  79. package/dist/module/createOmnichannelHandler.d.ts +0 -3
  80. package/dist/module/createOmnichannelHandler.d.ts.map +0 -1
  81. package/dist/module/createOmnichannelHandler.js +0 -56
  82. package/dist/module/createOmnichannelHandler.js.map +0 -1
  83. package/dist/module/register.d.ts +0 -6
  84. package/dist/module/register.d.ts.map +0 -1
  85. package/dist/module/register.js +0 -12
  86. package/dist/module/register.js.map +0 -1
  87. package/dist/rpc/geocode.d.ts +0 -23
  88. package/dist/rpc/geocode.d.ts.map +0 -1
  89. package/dist/rpc/geocode.js +0 -46
  90. package/dist/rpc/geocode.js.map +0 -1
  91. package/dist/rpc/index.d.ts +0 -3
  92. package/dist/rpc/index.d.ts.map +0 -1
  93. package/dist/rpc/index.js +0 -6
  94. package/dist/rpc/index.js.map +0 -1
  95. package/dist/rpc/storeLocator.d.ts.map +0 -1
  96. package/dist/rpc/storeLocator.js +0 -69
  97. package/dist/rpc/storeLocator.js.map +0 -1
  98. package/dist/types/geocode.d.ts +0 -8
  99. package/dist/types/geocode.d.ts.map +0 -1
  100. package/dist/types/geocode.js +0 -3
  101. package/dist/types/geocode.js.map +0 -1
  102. package/dist/types/index.d.ts +0 -3
  103. package/dist/types/index.d.ts.map +0 -1
  104. package/dist/types/index.js +0 -6
  105. package/dist/types/index.js.map +0 -1
  106. package/dist/types/omnichannel.d.ts.map +0 -1
  107. package/dist/types/omnichannel.js +0 -3
  108. package/dist/types/omnichannel.js.map +0 -1
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const axios_1 = tslib_1.__importDefault(require("axios"));
5
- const composition_api_1 = require("@nuxtjs/composition-api");
6
- const sharedRef_1 = require("./sharedRef");
7
- exports.default = (key = 'useGeocode') => {
8
- const response = (0, sharedRef_1.sharedRef)(null, key);
9
- const getData = async (searchParams) => {
10
- response.value = await axios_1.default.post('/api/omnichannel/geocode', searchParams);
11
- };
12
- return {
13
- data: (0, composition_api_1.computed)(() => { var _a; return (_a = response.value) === null || _a === void 0 ? void 0 : _a.data; }),
14
- getData,
15
- };
16
- };
17
- //# sourceMappingURL=useGeocode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useGeocode.js","sourceRoot":"","sources":["../../src/composables/useGeocode.ts"],"names":[],"mappings":";;;AAAA,0DAA4C;AAC5C,6DAAkD;AAElD,2CAAuC;AAEvC,kBAAe,CAAC,GAAG,GAAG,YAAY,EAAE,EAAE;IACpC,MAAM,QAAQ,GAAG,IAAA,qBAAS,EAAuB,IAAI,EAAE,GAAG,CAAC,CAAA;IAE3D,MAAM,OAAO,GAAG,KAAK,EACnB,YAA4D,EAC5D,EAAE;QACF,QAAQ,CAAC,KAAK,GAAG,MAAM,eAAK,CAAC,IAAI,CAAC,0BAA0B,EAAE,YAAY,CAAC,CAAA;IAC7E,CAAC,CAAA;IAED,OAAO;QACL,IAAI,EAAE,IAAA,0BAAQ,EAAC,GAAG,EAAE,WAAC,OAAA,MAAA,QAAQ,CAAC,KAAK,0CAAE,IAAI,CAAA,EAAA,CAAC;QAC1C,OAAO;KACR,CAAA;AACH,CAAC,CAAA"}
@@ -1,10 +0,0 @@
1
- declare const _default: (key?: string) => {
2
- storesData: import("vue").ComputedRef<any>;
3
- refreshStores: (searchParams: import("../index").StoreLocatorSearchParams) => Promise<void>;
4
- storeVariantData: import("vue").ComputedRef<any>;
5
- refreshStoreVariant: (variantId: number, storeId: number) => Promise<void>;
6
- variantStoresData: import("vue").ComputedRef<any>;
7
- refreshVariantStores: (searchParams: import("../index").VariantLocatorSearchParams) => Promise<void>;
8
- };
9
- export default _default;
10
- //# sourceMappingURL=useStoreLocator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useStoreLocator.d.ts","sourceRoot":"","sources":["../../src/composables/useStoreLocator.ts"],"names":[],"mappings":"+BAEqB,MAAM;;;;;;;;AAA3B,wBAmBC"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const index_1 = require("../index");
4
- exports.default = (key = 'useStoreLocator') => {
5
- const { data: storesData, getData: refreshStores } = (0, index_1.useStores)(`${key}-stores`);
6
- const { data: variantStoresData, getData: refreshVariantStores } = (0, index_1.useVariantStores)(`${key}-variant-stores`);
7
- const { data: storeVariantData, getData: refreshStoreVariant } = (0, index_1.useStoreVariantById)(`${key}-variant-by-id`);
8
- return {
9
- storesData,
10
- refreshStores,
11
- storeVariantData,
12
- refreshStoreVariant,
13
- variantStoresData,
14
- refreshVariantStores,
15
- };
16
- };
17
- //# sourceMappingURL=useStoreLocator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useStoreLocator.js","sourceRoot":"","sources":["../../src/composables/useStoreLocator.ts"],"names":[],"mappings":";;AAAA,oCAA2E;AAE3E,kBAAe,CAAC,MAAc,iBAAiB,EAAE,EAAE;IACjD,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,IAAA,iBAAS,EAC5D,GAAG,GAAG,SAAS,CAChB,CAAA;IAED,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,oBAAoB,EAAE,GAC9D,IAAA,wBAAgB,EAAC,GAAG,GAAG,iBAAiB,CAAC,CAAA;IAE3C,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,mBAAmB,EAAE,GAC5D,IAAA,2BAAmB,EAAC,GAAG,GAAG,gBAAgB,CAAC,CAAA;IAE7C,OAAO;QACL,UAAU;QACV,aAAa;QACb,gBAAgB;QAChB,mBAAmB;QACnB,iBAAiB;QACjB,oBAAoB;KACrB,CAAA;AACH,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useStoreVariantById.d.ts","sourceRoot":"","sources":["../../src/composables/useStoreVariantById.ts"],"names":[],"mappings":"+BAGqB,MAAM;;yBAGS,MAAM,WAAW,MAAM;;AAH3D,wBAcC"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const axios_1 = tslib_1.__importDefault(require("axios"));
5
- const composition_api_1 = require("@nuxtjs/composition-api");
6
- const sharedRef_1 = require("./sharedRef");
7
- exports.default = (key = 'useStoreVariantById') => {
8
- const response = (0, sharedRef_1.sharedRef)(null, key);
9
- const getData = async (variantId, storeId) => {
10
- response.value = await axios_1.default.post('/api/omnichannel/storeVariantById', {
11
- storeId,
12
- variantId,
13
- });
14
- };
15
- return {
16
- data: (0, composition_api_1.computed)(() => { var _a; return (_a = response.value) === null || _a === void 0 ? void 0 : _a.data; }),
17
- getData,
18
- };
19
- };
20
- //# sourceMappingURL=useStoreVariantById.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useStoreVariantById.js","sourceRoot":"","sources":["../../src/composables/useStoreVariantById.ts"],"names":[],"mappings":";;;AAAA,0DAA4C;AAC5C,6DAAkD;AAClD,2CAAuC;AACvC,kBAAe,CAAC,MAAc,qBAAqB,EAAE,EAAE;IACrD,MAAM,QAAQ,GAAG,IAAA,qBAAS,EAAuB,IAAI,EAAE,GAAG,CAAC,CAAA;IAE3D,MAAM,OAAO,GAAG,KAAK,EAAE,SAAiB,EAAE,OAAe,EAAE,EAAE;QAC3D,QAAQ,CAAC,KAAK,GAAG,MAAM,eAAK,CAAC,IAAI,CAAC,mCAAmC,EAAE;YACrE,OAAO;YACP,SAAS;SACV,CAAC,CAAA;IACJ,CAAC,CAAA;IAED,OAAO;QACL,IAAI,EAAE,IAAA,0BAAQ,EAAC,GAAG,EAAE,WAAC,OAAA,MAAA,QAAQ,CAAC,KAAK,0CAAE,IAAI,CAAA,EAAA,CAAC;QAC1C,OAAO;KACR,CAAA;AACH,CAAC,CAAA"}
@@ -1,7 +0,0 @@
1
- import { StoreLocatorSearchParams } from '../types';
2
- declare const _default: (key?: string) => {
3
- data: import("@nuxtjs/composition-api").ComputedRef<any>;
4
- getData: (searchParams: StoreLocatorSearchParams) => Promise<void>;
5
- };
6
- export default _default;
7
- //# sourceMappingURL=useStores.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useStores.d.ts","sourceRoot":"","sources":["../../src/composables/useStores.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAA;+BAG9B,MAAM;;4BAGY,wBAAwB;;AAH/D,wBAWC"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const axios_1 = tslib_1.__importDefault(require("axios"));
5
- const composition_api_1 = require("@nuxtjs/composition-api");
6
- const sharedRef_1 = require("./sharedRef");
7
- exports.default = (key = 'useStores') => {
8
- const response = (0, sharedRef_1.sharedRef)(null, key);
9
- const getData = async (searchParams) => {
10
- response.value = await axios_1.default.post('/api/omnichannel/stores', searchParams);
11
- };
12
- return {
13
- data: (0, composition_api_1.computed)(() => { var _a; return (_a = response.value) === null || _a === void 0 ? void 0 : _a.data; }),
14
- getData,
15
- };
16
- };
17
- //# sourceMappingURL=useStores.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useStores.js","sourceRoot":"","sources":["../../src/composables/useStores.ts"],"names":[],"mappings":";;;AAAA,0DAA4C;AAC5C,6DAAkD;AAElD,2CAAuC;AAEvC,kBAAe,CAAC,MAAc,WAAW,EAAE,EAAE;IAC3C,MAAM,QAAQ,GAAG,IAAA,qBAAS,EAAuB,IAAI,EAAE,GAAG,CAAC,CAAA;IAE3D,MAAM,OAAO,GAAG,KAAK,EAAE,YAAsC,EAAE,EAAE;QAC/D,QAAQ,CAAC,KAAK,GAAG,MAAM,eAAK,CAAC,IAAI,CAAC,yBAAyB,EAAE,YAAY,CAAC,CAAA;IAC5E,CAAC,CAAA;IAED,OAAO;QACL,IAAI,EAAE,IAAA,0BAAQ,EAAC,GAAG,EAAE,WAAC,OAAA,MAAA,QAAQ,CAAC,KAAK,0CAAE,IAAI,CAAA,EAAA,CAAC;QAC1C,OAAO;KACR,CAAA;AACH,CAAC,CAAA"}
@@ -1,7 +0,0 @@
1
- import { VariantLocatorSearchParams } from '../types';
2
- declare const _default: (key?: string) => {
3
- data: import("@nuxtjs/composition-api").ComputedRef<any>;
4
- getData: (searchParams: VariantLocatorSearchParams) => Promise<void>;
5
- };
6
- export default _default;
7
- //# sourceMappingURL=useVariantStores.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useVariantStores.d.ts","sourceRoot":"","sources":["../../src/composables/useVariantStores.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAA;+BAEhC,MAAM;;4BAGY,0BAA0B;;AAHjE,wBAcC"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const axios_1 = tslib_1.__importDefault(require("axios"));
5
- const composition_api_1 = require("@nuxtjs/composition-api");
6
- const sharedRef_1 = require("./sharedRef");
7
- exports.default = (key = 'useVariantStores') => {
8
- const response = (0, sharedRef_1.sharedRef)(null, key);
9
- const getData = async (searchParams) => {
10
- response.value = await axios_1.default.post('/api/omnichannel/variantStores', searchParams);
11
- };
12
- return {
13
- data: (0, composition_api_1.computed)(() => { var _a; return (_a = response.value) === null || _a === void 0 ? void 0 : _a.data; }),
14
- getData,
15
- };
16
- };
17
- //# sourceMappingURL=useVariantStores.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useVariantStores.js","sourceRoot":"","sources":["../../src/composables/useVariantStores.ts"],"names":[],"mappings":";;;AAAA,0DAA4C;AAC5C,6DAAkD;AAElD,2CAAuC;AACvC,kBAAe,CAAC,MAAc,kBAAkB,EAAE,EAAE;IAClD,MAAM,QAAQ,GAAG,IAAA,qBAAS,EAAuB,IAAI,EAAE,GAAG,CAAC,CAAA;IAE3D,MAAM,OAAO,GAAG,KAAK,EAAE,YAAwC,EAAE,EAAE;QACjE,QAAQ,CAAC,KAAK,GAAG,MAAM,eAAK,CAAC,IAAI,CAC/B,gCAAgC,EAChC,YAAY,CACb,CAAA;IACH,CAAC,CAAA;IAED,OAAO;QACL,IAAI,EAAE,IAAA,0BAAQ,EAAC,GAAG,EAAE,WAAC,OAAA,MAAA,QAAQ,CAAC,KAAK,0CAAE,IAAI,CAAA,EAAA,CAAC;QAC1C,OAAO;KACR,CAAA;AACH,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './omnichannel';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./omnichannel"), exports);
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":";;;AAAA,wDAA6B"}
@@ -1,12 +0,0 @@
1
- import { ValuesType } from 'utility-types';
2
- export declare const OpeningTime: {
3
- readonly MONDAY: "mon";
4
- readonly TUESDAY: "tue";
5
- readonly WEDNESDAY: "wed";
6
- readonly THURSDAY: "thu";
7
- readonly FRIDAY: "fri";
8
- readonly SATURDAY: "sat";
9
- readonly SUNDAY: "sun";
10
- };
11
- export type OpeningTime = ValuesType<typeof OpeningTime>;
12
- //# sourceMappingURL=omnichannel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"omnichannel.d.ts","sourceRoot":"","sources":["../../src/constants/omnichannel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,eAAO,MAAM,WAAW;;;;;;;;CAQd,CAAA;AAGV,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAA"}
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OpeningTime = void 0;
4
- exports.OpeningTime = {
5
- MONDAY: 'mon',
6
- TUESDAY: 'tue',
7
- WEDNESDAY: 'wed',
8
- THURSDAY: 'thu',
9
- FRIDAY: 'fri',
10
- SATURDAY: 'sat',
11
- SUNDAY: 'sun',
12
- };
13
- //# sourceMappingURL=omnichannel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"omnichannel.js","sourceRoot":"","sources":["../../src/constants/omnichannel.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GAAG;IACzB,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,KAAK;IACb,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,KAAK;CACL,CAAA"}
@@ -1,11 +0,0 @@
1
- import { BAPIError, BaseError, HttpStatusCode } from '@scayle/storefront-core';
2
- import { AxiosError } from 'axios';
3
- declare const parseErrorData: (error: unknown) => {
4
- statusCode: HttpStatusCode;
5
- message: string;
6
- url?: string;
7
- };
8
- type AsyncError = BaseError | BAPIError;
9
- declare const handleError: (error: AxiosError | Error | unknown) => AsyncError;
10
- export { handleError, parseErrorData };
11
- //# sourceMappingURL=errorHandler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errorHandler.d.ts","sourceRoot":"","sources":["../../src/error/errorHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,SAAS,EACT,cAAc,EAEf,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAElC,QAAA,MAAM,cAAc,UACX,OAAO,KACb;IAAE,UAAU,EAAE,cAAc,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CA+B7D,CAAA;AAED,KAAK,UAAU,GAAG,SAAS,GAAG,SAAS,CAAA;AAEvC,QAAA,MAAM,WAAW,UAAW,UAAU,GAAG,KAAK,GAAG,OAAO,KAAG,UAkB1D,CAAA;AAED,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,CAAA"}
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseErrorData = exports.handleError = void 0;
4
- const storefront_core_1 = require("@scayle/storefront-core");
5
- const axios_1 = require("axios");
6
- const parseErrorData = (error) => {
7
- var _a, _b;
8
- if (error instanceof axios_1.AxiosError) {
9
- return {
10
- statusCode: ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data.code) || storefront_core_1.HttpStatusCode.INTERNAL_SERVER_ERROR,
11
- message: ((_b = error.response) === null || _b === void 0 ? void 0 : _b.data.message) || storefront_core_1.HttpStatusMessage.INTERNAL_SERVER_ERROR,
12
- url: error.config.url,
13
- };
14
- }
15
- else if (error instanceof storefront_core_1.BAPIError) {
16
- return {
17
- statusCode: error.statusCode || storefront_core_1.HttpStatusCode.INTERNAL_SERVER_ERROR,
18
- message: error.message || storefront_core_1.HttpStatusMessage.INTERNAL_SERVER_ERROR,
19
- url: error.url,
20
- };
21
- }
22
- else if (error instanceof storefront_core_1.BaseError) {
23
- return {
24
- statusCode: error.statusCode || storefront_core_1.HttpStatusCode.INTERNAL_SERVER_ERROR,
25
- message: error.message || storefront_core_1.HttpStatusMessage.INTERNAL_SERVER_ERROR,
26
- };
27
- }
28
- else if (error instanceof Error) {
29
- return {
30
- statusCode: storefront_core_1.HttpStatusCode.INTERNAL_SERVER_ERROR,
31
- message: error.message || storefront_core_1.HttpStatusMessage.INTERNAL_SERVER_ERROR,
32
- };
33
- }
34
- return {
35
- statusCode: storefront_core_1.HttpStatusCode.INTERNAL_SERVER_ERROR,
36
- message: storefront_core_1.HttpStatusMessage.INTERNAL_SERVER_ERROR,
37
- };
38
- };
39
- exports.parseErrorData = parseErrorData;
40
- const handleError = (error) => {
41
- const { statusCode, message } = parseErrorData(error);
42
- if (statusCode === storefront_core_1.HttpStatusCode.NOT_FOUND) {
43
- return new storefront_core_1.BAPIError(storefront_core_1.HttpStatusMessage.NOT_FOUND, statusCode, message);
44
- }
45
- if (statusCode === storefront_core_1.HttpStatusCode.UNAUTHORIZED) {
46
- return new storefront_core_1.BAPIError(storefront_core_1.HttpStatusMessage.UNAUTHORIZED, statusCode, message);
47
- }
48
- const [key] = Object.entries(storefront_core_1.HttpStatusCode).find(([_, code]) => code === statusCode) ||
49
- [];
50
- const statusCodeKey = key;
51
- const name = statusCodeKey
52
- ? storefront_core_1.HttpStatusMessage[statusCodeKey]
53
- : storefront_core_1.HttpStatusMessage.INTERNAL_SERVER_ERROR;
54
- return new storefront_core_1.BaseError(name, statusCode, message);
55
- };
56
- exports.handleError = handleError;
57
- //# sourceMappingURL=errorHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errorHandler.js","sourceRoot":"","sources":["../../src/error/errorHandler.ts"],"names":[],"mappings":";;;AAAA,6DAKgC;AAChC,iCAAkC;AAElC,MAAM,cAAc,GAAG,CACrB,KAAc,EACiD,EAAE;;IACjE,IAAI,KAAK,YAAY,kBAAU,EAAE;QAC/B,OAAO;YACL,UAAU,EACR,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,IAAI,CAAC,IAAI,KAAI,gCAAc,CAAC,qBAAqB;YACnE,OAAO,EACL,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,IAAI,CAAC,OAAO,KAAI,mCAAiB,CAAC,qBAAqB;YACzE,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG;SACtB,CAAA;KACF;SAAM,IAAI,KAAK,YAAY,2BAAS,EAAE;QACrC,OAAO;YACL,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,gCAAc,CAAC,qBAAqB;YACpE,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,mCAAiB,CAAC,qBAAqB;YACjE,GAAG,EAAE,KAAK,CAAC,GAAG;SACf,CAAA;KACF;SAAM,IAAI,KAAK,YAAY,2BAAS,EAAE;QACrC,OAAO;YACL,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,gCAAc,CAAC,qBAAqB;YACpE,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,mCAAiB,CAAC,qBAAqB;SAClE,CAAA;KACF;SAAM,IAAI,KAAK,YAAY,KAAK,EAAE;QACjC,OAAO;YACL,UAAU,EAAE,gCAAc,CAAC,qBAAqB;YAChD,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,mCAAiB,CAAC,qBAAqB;SAClE,CAAA;KACF;IAED,OAAO;QACL,UAAU,EAAE,gCAAc,CAAC,qBAAqB;QAChD,OAAO,EAAE,mCAAiB,CAAC,qBAAqB;KACjD,CAAA;AACH,CAAC,CAAA;AAwBqB,wCAAc;AApBpC,MAAM,WAAW,GAAG,CAAC,KAAmC,EAAc,EAAE;IACtE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC,KAAK,CAAC,CAAA;IAErD,IAAI,UAAU,KAAK,gCAAc,CAAC,SAAS,EAAE;QAC3C,OAAO,IAAI,2BAAS,CAAC,mCAAiB,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;KACvE;IACD,IAAI,UAAU,KAAK,gCAAc,CAAC,YAAY,EAAE;QAC9C,OAAO,IAAI,2BAAS,CAAC,mCAAiB,CAAC,YAAY,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;KAC1E;IACD,MAAM,CAAC,GAAG,CAAC,GACT,MAAM,CAAC,OAAO,CAAC,gCAAc,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,UAAU,CAAC;QACvE,EAAE,CAAA;IACJ,MAAM,aAAa,GAAG,GAAqC,CAAA;IAC3D,MAAM,IAAI,GAAG,aAAa;QACxB,CAAC,CAAE,mCAAiB,CAAC,aAAa,CAAY;QAC9C,CAAC,CAAC,mCAAiB,CAAC,qBAAqB,CAAA;IAE3C,OAAO,IAAI,2BAAS,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;AACjD,CAAC,CAAA;AAEQ,kCAAW"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,mCAAmC,CAAA;AAClF,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAC5E,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC1E,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAEhE,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA"}
package/dist/index.js DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useGeocode = exports.useStoreLocator = exports.useVariantStores = exports.useStoreVariantById = exports.useStores = void 0;
4
- const tslib_1 = require("tslib");
5
- var useStores_1 = require("./composables/useStores");
6
- Object.defineProperty(exports, "useStores", { enumerable: true, get: function () { return tslib_1.__importDefault(useStores_1).default; } });
7
- var useStoreVariantById_1 = require("./composables/useStoreVariantById");
8
- Object.defineProperty(exports, "useStoreVariantById", { enumerable: true, get: function () { return tslib_1.__importDefault(useStoreVariantById_1).default; } });
9
- var useVariantStores_1 = require("./composables/useVariantStores");
10
- Object.defineProperty(exports, "useVariantStores", { enumerable: true, get: function () { return tslib_1.__importDefault(useVariantStores_1).default; } });
11
- var useStoreLocator_1 = require("./composables/useStoreLocator");
12
- Object.defineProperty(exports, "useStoreLocator", { enumerable: true, get: function () { return tslib_1.__importDefault(useStoreLocator_1).default; } });
13
- var useGeocode_1 = require("./composables/useGeocode");
14
- Object.defineProperty(exports, "useGeocode", { enumerable: true, get: function () { return tslib_1.__importDefault(useGeocode_1).default; } });
15
- tslib_1.__exportStar(require("./constants/index"), exports);
16
- tslib_1.__exportStar(require("./rpc/index"), exports);
17
- tslib_1.__exportStar(require("./types/index"), exports);
18
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,qDAA8D;AAArD,+HAAA,OAAO,OAAa;AAC7B,yEAAkF;AAAzE,mJAAA,OAAO,OAAuB;AACvC,mEAA4E;AAAnE,6IAAA,OAAO,OAAoB;AACpC,iEAA0E;AAAjE,2IAAA,OAAO,OAAmB;AACnC,uDAAgE;AAAvD,iIAAA,OAAO,OAAc;AAE9B,4DAAiC;AACjC,sDAA2B;AAC3B,wDAA6B"}
@@ -1,11 +0,0 @@
1
- import { StoreLocatorConfig } from '../types';
2
- export declare class OmnichannelClient {
3
- private readonly host;
4
- private readonly token;
5
- constructor(host: string, token: string);
6
- get(endpoint?: string, params?: any, signal?: AbortSignal): Promise<any>;
7
- private createClient;
8
- private handleError;
9
- }
10
- export declare const init: (config?: StoreLocatorConfig) => OmnichannelClient | null;
11
- //# sourceMappingURL=init.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/lib/init.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAE7C,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAQ;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;gBAElB,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAK1B,GAAG,CACd,QAAQ,GAAE,MAAW,EACrB,MAAM,CAAC,EAAE,GAAG,EACZ,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,GAAG,CAAC;IAUf,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,WAAW;CAIpB;AAED,eAAO,MAAM,IAAI,YAAa,kBAAkB,6BAM/C,CAAA"}
package/dist/lib/init.js DELETED
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.init = exports.OmnichannelClient = void 0;
4
- const tslib_1 = require("tslib");
5
- const axios_1 = tslib_1.__importDefault(require("axios"));
6
- class OmnichannelClient {
7
- constructor(host, token) {
8
- this.host = host;
9
- this.token = token;
10
- }
11
- async get(endpoint = '', params, signal) {
12
- try {
13
- const client = this.createClient();
14
- const response = await client.get(endpoint, { ...params, signal });
15
- return response.data;
16
- }
17
- catch (error) {
18
- this.handleError(error);
19
- }
20
- }
21
- createClient() {
22
- const config = {
23
- baseURL: this.host,
24
- headers: {
25
- Accept: 'application/json',
26
- 'Content-Type': 'application/json',
27
- },
28
- };
29
- if (this.token) {
30
- config.headers = {
31
- Authorization: `Bearer ${this.token}`,
32
- };
33
- }
34
- return axios_1.default.create(config);
35
- }
36
- handleError(error) {
37
- // TODO: add better error handling
38
- throw error;
39
- }
40
- }
41
- exports.OmnichannelClient = OmnichannelClient;
42
- const init = (config) => {
43
- if (config) {
44
- return new OmnichannelClient(config.host, config.token);
45
- }
46
- return null;
47
- };
48
- exports.init = init;
49
- //# sourceMappingURL=init.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/lib/init.ts"],"names":[],"mappings":";;;;AAAA,0DAAgE;AAGhE,MAAa,iBAAiB;IAI5B,YAAY,IAAY,EAAE,KAAa;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAEM,KAAK,CAAC,GAAG,CACd,WAAmB,EAAE,EACrB,MAAY,EACZ,MAAoB;QAEpB,IAAI;YACF,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,CAAA;YAClC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;YAClE,OAAO,QAAQ,CAAC,IAAI,CAAA;SACrB;QAAC,OAAO,KAAU,EAAE;YACnB,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;SACxB;IACH,CAAC;IAEO,YAAY;QAClB,MAAM,MAAM,GAAuB;YACjC,OAAO,EAAE,IAAI,CAAC,IAAI;YAClB,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;gBAC1B,cAAc,EAAE,kBAAkB;aACnC;SACF,CAAA;QACD,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,MAAM,CAAC,OAAO,GAAG;gBACf,aAAa,EAAE,UAAU,IAAI,CAAC,KAAK,EAAE;aACtC,CAAA;SACF;QACD,OAAO,eAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC7B,CAAC;IAEO,WAAW,CAAC,KAAU;QAC5B,kCAAkC;QAClC,MAAM,KAAK,CAAA;IACb,CAAC;CACF;AA3CD,8CA2CC;AAEM,MAAM,IAAI,GAAG,CAAC,MAA2B,EAAE,EAAE;IAClD,IAAI,MAAM,EAAE;QACV,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAA;KACxD;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AANY,QAAA,IAAI,QAMhB"}
@@ -1,3 +0,0 @@
1
- import { StoreLocatorConfig } from '../types';
2
- export default function createOmnichannelHandler(options: StoreLocatorConfig): import("express-serve-static-core").Express;
3
- //# sourceMappingURL=createOmnichannelHandler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createOmnichannelHandler.d.ts","sourceRoot":"","sources":["../../src/module/createOmnichannelHandler.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAW7C,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,OAAO,EAAE,kBAAkB,+CAmD3E"}
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const express_1 = tslib_1.__importDefault(require("express"));
5
- const body_parser_1 = tslib_1.__importDefault(require("body-parser"));
6
- const storeLocator_1 = require("../rpc/storeLocator");
7
- const geocode_1 = require("../rpc/geocode");
8
- const errorHandler_1 = require("../error/errorHandler");
9
- function createOmnichannelHandler(options) {
10
- const app = (0, express_1.default)();
11
- app.use(body_parser_1.default.urlencoded({ extended: false }));
12
- app.use(body_parser_1.default.json());
13
- app.post(`/stores`, async (req, res) => {
14
- try {
15
- const response = await (0, storeLocator_1.getStores)(req.body, options);
16
- res.json(response);
17
- }
18
- catch (e) {
19
- const parsedError = (0, errorHandler_1.parseErrorData)(e);
20
- res.status(parsedError.statusCode).json({ ...parsedError });
21
- }
22
- });
23
- app.post(`/storeVariantById`, async (req, res) => {
24
- try {
25
- const response = await (0, storeLocator_1.getStoreVariantById)(req.body, options);
26
- res.json(response);
27
- }
28
- catch (e) {
29
- const parsedError = (0, errorHandler_1.parseErrorData)(e);
30
- res.status(parsedError.statusCode).json({ ...parsedError });
31
- }
32
- });
33
- app.post(`/variantStores`, async (req, res) => {
34
- try {
35
- const response = await (0, storeLocator_1.getStoresForVariant)(req.body, options);
36
- res.json(response);
37
- }
38
- catch (e) {
39
- const parsedError = (0, errorHandler_1.parseErrorData)(e);
40
- res.status(parsedError.statusCode).json({ ...parsedError });
41
- }
42
- });
43
- app.post(`/geocode`, async (req, res) => {
44
- try {
45
- const response = await (0, geocode_1.getGeocoder)(req.body, options);
46
- res.json(response);
47
- }
48
- catch (e) {
49
- const parsedError = (0, errorHandler_1.parseErrorData)(e);
50
- res.status(parsedError.statusCode).json({ ...parsedError });
51
- }
52
- });
53
- return app;
54
- }
55
- exports.default = createOmnichannelHandler;
56
- //# sourceMappingURL=createOmnichannelHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createOmnichannelHandler.js","sourceRoot":"","sources":["../../src/module/createOmnichannelHandler.ts"],"names":[],"mappings":";;;AAAA,8DAA6B;AAC7B,sEAAoC;AAGpC,sDAI4B;AAE5B,4CAA4C;AAE5C,wDAAsD;AAEtD,SAAwB,wBAAwB,CAAC,OAA2B;IAC1E,MAAM,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAA;IAErB,GAAG,CAAC,GAAG,CAAC,qBAAU,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,CAAA;IACnD,GAAG,CAAC,GAAG,CAAC,qBAAU,CAAC,IAAI,EAAE,CAAC,CAAA;IAE1B,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;QACrC,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAS,EAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;YAEnD,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;SACnB;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,WAAW,GAAG,IAAA,6BAAc,EAAC,CAAC,CAAC,CAAA;YACrC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,GAAG,WAAW,EAAE,CAAC,CAAA;SAC5D;IACH,CAAC,CAAC,CAAA;IAEF,GAAG,CAAC,IAAI,CAAC,mBAAmB,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;QAC/C,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,IAAA,kCAAmB,EAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;YAE7D,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;SACnB;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,WAAW,GAAG,IAAA,6BAAc,EAAC,CAAC,CAAC,CAAA;YACrC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,GAAG,WAAW,EAAE,CAAC,CAAA;SAC5D;IACH,CAAC,CAAC,CAAA;IAEF,GAAG,CAAC,IAAI,CAAC,gBAAgB,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;QAC5C,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,IAAA,kCAAmB,EAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;YAE7D,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;SACnB;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,WAAW,GAAG,IAAA,6BAAc,EAAC,CAAC,CAAC,CAAA;YACrC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,GAAG,WAAW,EAAE,CAAC,CAAA;SAC5D;IACH,CAAC,CAAC,CAAA;IAEF,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;QACtC,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAW,EAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;YAErD,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;SACnB;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,WAAW,GAAG,IAAA,6BAAc,EAAC,CAAC,CAAC,CAAA;YACrC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,GAAG,WAAW,EAAE,CAAC,CAAA;SAC5D;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,GAAG,CAAA;AACZ,CAAC;AAnDD,2CAmDC"}
@@ -1,6 +0,0 @@
1
- import { Module } from '@nuxt/types';
2
- import { StoreLocatorConfig } from '../types';
3
- type ModuleOptions = StoreLocatorConfig;
4
- declare const omnichannelModule: Module<ModuleOptions>;
5
- export default omnichannelModule;
6
- //# sourceMappingURL=register.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/module/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAG7C,KAAK,aAAa,GAAG,kBAAkB,CAAA;AACvC,QAAA,MAAM,iBAAiB,EAAE,MAAM,CAAC,aAAa,CAO5C,CAAA;AAED,eAAe,iBAAiB,CAAA"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const createOmnichannelHandler_1 = tslib_1.__importDefault(require("./createOmnichannelHandler"));
5
- const omnichannelModule = function (moduleOptions) {
6
- this.addServerMiddleware({
7
- path: '/api/omnichannel',
8
- handler: (0, createOmnichannelHandler_1.default)(moduleOptions),
9
- });
10
- };
11
- exports.default = omnichannelModule;
12
- //# sourceMappingURL=register.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/module/register.ts"],"names":[],"mappings":";;;AAEA,kGAAiE;AAGjE,MAAM,iBAAiB,GAA0B,UAC/C,aAA4B;IAE5B,IAAI,CAAC,mBAAmB,CAAC;QACvB,IAAI,EAAE,kBAAkB;QACxB,OAAO,EAAE,IAAA,kCAAwB,EAAC,aAAa,CAAC;KACjD,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,kBAAe,iBAAiB,CAAA"}
@@ -1,23 +0,0 @@
1
- import { StoreLocatorConfig } from '../types';
2
- export type GeocodeParams = {
3
- /**
4
- * Latitude in degrees. Values will be clamped to the range [-90, 90]. This
5
- * means that if the value specified is less than -90, it will be set to
6
- * -90. And if the value is greater than 90, it will be set to 90.
7
- */
8
- lat: number;
9
- /**
10
- * Longitude in degrees. Values outside the range [-180, 180] will be
11
- * wrapped so that they fall within the range. For example, a value of -190
12
- * will be converted to 170. A value of 190 will be converted to -170. This
13
- * reflects the fact that longitudes wrap around the globe.
14
- */
15
- lng: number;
16
- };
17
- type SearchParams = {
18
- search: string | number;
19
- };
20
- export declare function isObject<T>(input: unknown): input is T;
21
- export declare const getGeocoder: (content: GeocodeParams | SearchParams, storeLocator: StoreLocatorConfig) => Promise<any>;
22
- export {};
23
- //# sourceMappingURL=geocode.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"geocode.d.ts","sourceRoot":"","sources":["../../src/rpc/geocode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAE7C,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;OAIG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;;;;OAKG;IACH,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,KAAK,YAAY,GAAG;IAClB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;CACxB,CAAA;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,CAAC,CAEtD;AACD,eAAO,MAAM,WAAW,YACb,aAAa,GAAG,YAAY,gBACvB,kBAAkB,iBAqCjC,CAAA"}
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getGeocoder = exports.isObject = void 0;
4
- const tslib_1 = require("tslib");
5
- const axios_1 = tslib_1.__importDefault(require("axios"));
6
- function isObject(input) {
7
- return true;
8
- }
9
- exports.isObject = isObject;
10
- const getGeocoder = async function getGeocoder(content, storeLocator) {
11
- if (!storeLocator.googleApiKey) {
12
- return Promise.reject(new Error('Missing Google API Key'));
13
- }
14
- const url = new URL('https://maps.googleapis.com/maps/api/geocode/json');
15
- if (isObject(content) && content.search) {
16
- if (typeof content.search === 'number') {
17
- url.searchParams.set('components', `postal_code:${content.search}`);
18
- }
19
- else {
20
- url.searchParams.set('address', content.search.trim());
21
- }
22
- }
23
- else if (isObject(content)) {
24
- url.searchParams.set('latlng', `${content.lat},${content.lng}`);
25
- }
26
- url.searchParams.set('key', storeLocator.googleApiKey);
27
- return await (0, axios_1.default)({
28
- method: 'get',
29
- url: url.toString(),
30
- })
31
- .then((response) => {
32
- return response.data;
33
- })
34
- .catch((error) => {
35
- console.log('[ERROR] getGeocoder:', {
36
- message: error.message,
37
- params: content,
38
- });
39
- return {
40
- results: [],
41
- status: 'ZERO_RESULTS',
42
- };
43
- });
44
- };
45
- exports.getGeocoder = getGeocoder;
46
- //# sourceMappingURL=geocode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"geocode.js","sourceRoot":"","sources":["../../src/rpc/geocode.ts"],"names":[],"mappings":";;;;AAAA,0DAAyB;AAuBzB,SAAgB,QAAQ,CAAI,KAAc;IACxC,OAAO,IAAI,CAAA;AACb,CAAC;AAFD,4BAEC;AACM,MAAM,WAAW,GAAG,KAAK,UAAU,WAAW,CACnD,OAAqC,EACrC,YAAgC;IAEhC,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE;QAC9B,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAA;KAC3D;IACD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,mDAAmD,CAAC,CAAA;IAExE,IAAI,QAAQ,CAAe,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,EAAE;QACrD,IAAI,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE;YACtC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,YAAY,EAAE,eAAe,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;SACpE;aAAM;YACL,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;SACvD;KACF;SAAM,IAAI,QAAQ,CAAgB,OAAO,CAAC,EAAE;QAC3C,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;KAChE;IAED,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,YAAY,CAAC,YAAY,CAAC,CAAA;IAEtD,OAAO,MAAM,IAAA,eAAK,EAAC;QACjB,MAAM,EAAE,KAAK;QACb,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE;KACpB,CAAC;SACC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;QACjB,OAAO,QAAQ,CAAC,IAAI,CAAA;IACtB,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACf,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE;YAClC,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,MAAM,EAAE,OAAO;SAChB,CAAC,CAAA;QAEF,OAAO;YACL,OAAO,EAAE,EAAE;YACX,MAAM,EAAE,cAAc;SACvB,CAAA;IACH,CAAC,CAAC,CAAA;AACN,CAAC,CAAA;AAvCY,QAAA,WAAW,eAuCvB"}
@@ -1,3 +0,0 @@
1
- export * from './storeLocator';
2
- export * from './geocode';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rpc/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA"}
package/dist/rpc/index.js DELETED
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./storeLocator"), exports);
5
- tslib_1.__exportStar(require("./geocode"), exports);
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rpc/index.ts"],"names":[],"mappings":";;;AAAA,yDAA8B;AAC9B,oDAAyB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"storeLocator.d.ts","sourceRoot":"","sources":["../../src/rpc/storeLocator.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,EAEtB,aAAa,EAEb,kBAAkB,EAClB,wBAAwB,EACxB,eAAe,EAEhB,MAAM,UAAU,CAAA;AAGjB,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE;QACP,OAAO,EAAE,MAAM,CAAA;QACf,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;IACD,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE;QACP,OAAO,EAAE,MAAM,CAAA;QACf,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;IACD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;CAChB;AAID,eAAO,MAAM,SAAS,YACX,wBAAwB,gBACnB,kBAAkB;;;EAoBjC,CAAA;AAED,eAAO,MAAM,mBAAmB,YACrB,2BAA2B,gBACtB,kBAAkB;;;EA4BjC,CAAA;AAED,eAAO,MAAM,mBAAmB,YACrB,2BAA2B,gBACtB,kBAAkB,oCAYjC,CAAA"}