@daffodil/driver 0.39.11 → 0.40.1

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 (100) hide show
  1. package/daffodil-driver.d.ts +1 -0
  2. package/{esm2015/daffodil-driver.js → esm2020/daffodil-driver.mjs} +0 -0
  3. package/{esm2015/errors/bad-input.js → esm2020/errors/bad-input.mjs} +0 -0
  4. package/{esm2015/errors/public_api.js → esm2020/errors/public_api.mjs} +0 -0
  5. package/{esm2015/hubspot/daffodil-driver-hubspot.js → esm2020/hubspot/daffodil-driver-hubspot.mjs} +0 -0
  6. package/{esm2015/hubspot/hubspot-forms.provider.js → esm2020/hubspot/hubspot-forms.provider.mjs} +0 -0
  7. package/{esm2015/hubspot/hubspot-forms.service.js → esm2020/hubspot/hubspot-forms.service.mjs} +0 -0
  8. package/{esm2015/hubspot/index.js → esm2020/hubspot/index.mjs} +0 -0
  9. package/{esm2015/hubspot/models/config.js → esm2020/hubspot/models/config.mjs} +0 -0
  10. package/{esm2015/hubspot/models/hubspot-request.js → esm2020/hubspot/models/hubspot-request.mjs} +0 -0
  11. package/{esm2015/hubspot/models/hubspot-response.js → esm2020/hubspot/models/hubspot-response.mjs} +0 -0
  12. package/{esm2015/hubspot/transformers/json-builder.js → esm2020/hubspot/transformers/json-builder.mjs} +0 -0
  13. package/{esm2015/index.js → esm2020/index.mjs} +2 -2
  14. package/{esm2015/magento/daffodil-driver-magento.js → esm2020/magento/daffodil-driver-magento.mjs} +0 -0
  15. package/esm2020/magento/errors/error.class.mjs +12 -0
  16. package/esm2020/magento/errors/public_api.mjs +4 -0
  17. package/esm2020/magento/errors/transform-graphql.mjs +7 -0
  18. package/esm2020/magento/errors/transform.mjs +21 -0
  19. package/esm2020/magento/graphql/cacheable-operations/apollo-cacheable-operations-link-generator.mjs +34 -0
  20. package/{esm2015/magento/graphql/cacheable-operations/cacheable-operations-token.js → esm2020/magento/graphql/cacheable-operations/cacheable-operations-token.mjs} +0 -0
  21. package/{esm2015/magento/graphql/public_api.js → esm2020/magento/graphql/public_api.mjs} +0 -0
  22. package/{esm2015/magento/index.js → esm2020/magento/index.mjs} +0 -0
  23. package/{esm2015/magento/models/public_api.js → esm2020/magento/models/public_api.mjs} +0 -0
  24. package/{esm2015/magento/models/responses/discount.js → esm2020/magento/models/responses/discount.mjs} +0 -0
  25. package/{esm2015/magento/models/responses/money.js → esm2020/magento/models/responses/money.mjs} +0 -0
  26. package/{esm2015/magento/models/responses/public_api.js → esm2020/magento/models/responses/public_api.mjs} +0 -0
  27. package/{esm2015 → esm2020}/magento/schema/introspection.json +0 -0
  28. package/{esm2015/magento/schema/schema.js → esm2020/magento/schema/schema.mjs} +0 -0
  29. package/{esm2015/magento/testing/daffodil-driver-magento-testing.js → esm2020/magento/testing/daffodil-driver-magento-testing.mjs} +0 -0
  30. package/esm2020/magento/testing/factories/discount.factory.mjs +30 -0
  31. package/esm2020/magento/testing/factories/money.factory.mjs +26 -0
  32. package/{esm2015/magento/testing/factories/public_api.js → esm2020/magento/testing/factories/public_api.mjs} +0 -0
  33. package/{esm2015/magento/testing/index.js → esm2020/magento/testing/index.mjs} +0 -0
  34. package/esm2020/models/public_api.mjs +2 -0
  35. package/esm2020/models/response.interface.mjs +2 -0
  36. package/esm2020/public_api.mjs +3 -0
  37. package/fesm2015/{daffodil-driver-hubspot.js → daffodil-driver-hubspot.mjs} +1 -1
  38. package/fesm2015/daffodil-driver-hubspot.mjs.map +1 -0
  39. package/fesm2015/daffodil-driver-magento-testing.mjs +58 -0
  40. package/fesm2015/daffodil-driver-magento-testing.mjs.map +1 -0
  41. package/fesm2015/daffodil-driver-magento.mjs +200 -0
  42. package/fesm2015/daffodil-driver-magento.mjs.map +1 -0
  43. package/fesm2015/{daffodil-driver.js → daffodil-driver.mjs} +1 -1
  44. package/fesm2015/daffodil-driver.mjs.map +1 -0
  45. package/fesm2020/daffodil-driver-hubspot.mjs +56 -0
  46. package/fesm2020/daffodil-driver-hubspot.mjs.map +1 -0
  47. package/fesm2020/daffodil-driver-magento-testing.mjs +58 -0
  48. package/fesm2020/daffodil-driver-magento-testing.mjs.map +1 -0
  49. package/{fesm2015/daffodil-driver-magento.js → fesm2020/daffodil-driver-magento.mjs} +36 -19
  50. package/fesm2020/daffodil-driver-magento.mjs.map +1 -0
  51. package/fesm2020/daffodil-driver.mjs +16 -0
  52. package/fesm2020/daffodil-driver.mjs.map +1 -0
  53. package/hubspot/daffodil-driver-hubspot.d.ts +1 -0
  54. package/hubspot/package.json +5 -6
  55. package/index.d.ts +1 -1
  56. package/magento/daffodil-driver-magento.d.ts +1 -0
  57. package/magento/errors/error.class.d.ts +9 -0
  58. package/magento/errors/public_api.d.ts +2 -0
  59. package/magento/errors/transform-graphql.d.ts +3 -0
  60. package/magento/errors/transform.d.ts +2 -2
  61. package/magento/graphql/cacheable-operations/apollo-cacheable-operations-link-generator.d.ts +3 -0
  62. package/magento/package.json +5 -6
  63. package/magento/testing/daffodil-driver-magento-testing.d.ts +1 -0
  64. package/magento/testing/factories/discount.factory.d.ts +3 -0
  65. package/magento/testing/factories/money.factory.d.ts +3 -0
  66. package/magento/testing/package.json +5 -6
  67. package/models/public_api.d.ts +1 -0
  68. package/models/response.interface.d.ts +15 -0
  69. package/package.json +46 -10
  70. package/public_api.d.ts +2 -0
  71. package/bundles/daffodil-driver-hubspot.umd.js +0 -384
  72. package/bundles/daffodil-driver-hubspot.umd.js.map +0 -1
  73. package/bundles/daffodil-driver-hubspot.umd.min.js +0 -16
  74. package/bundles/daffodil-driver-hubspot.umd.min.js.map +0 -1
  75. package/bundles/daffodil-driver-magento-testing.umd.js +0 -386
  76. package/bundles/daffodil-driver-magento-testing.umd.js.map +0 -1
  77. package/bundles/daffodil-driver-magento-testing.umd.min.js +0 -16
  78. package/bundles/daffodil-driver-magento-testing.umd.min.js.map +0 -1
  79. package/bundles/daffodil-driver-magento.umd.js +0 -199
  80. package/bundles/daffodil-driver-magento.umd.js.map +0 -1
  81. package/bundles/daffodil-driver-magento.umd.min.js +0 -2
  82. package/bundles/daffodil-driver-magento.umd.min.js.map +0 -1
  83. package/bundles/daffodil-driver.umd.js +0 -345
  84. package/bundles/daffodil-driver.umd.js.map +0 -1
  85. package/bundles/daffodil-driver.umd.min.js +0 -16
  86. package/bundles/daffodil-driver.umd.min.js.map +0 -1
  87. package/daffodil-driver.metadata.json +0 -1
  88. package/esm2015/magento/errors/public_api.js +0 -2
  89. package/esm2015/magento/errors/transform.js +0 -22
  90. package/esm2015/magento/graphql/cacheable-operations/apollo-cacheable-operations-link-generator.js +0 -33
  91. package/esm2015/magento/testing/factories/discount.factory.js +0 -29
  92. package/esm2015/magento/testing/factories/money.factory.js +0 -25
  93. package/fesm2015/daffodil-driver-hubspot.js.map +0 -1
  94. package/fesm2015/daffodil-driver-magento-testing.js +0 -55
  95. package/fesm2015/daffodil-driver-magento-testing.js.map +0 -1
  96. package/fesm2015/daffodil-driver-magento.js.map +0 -1
  97. package/fesm2015/daffodil-driver.js.map +0 -1
  98. package/hubspot/daffodil-driver-hubspot.metadata.json +0 -1
  99. package/magento/daffodil-driver-magento.metadata.json +0 -1
  100. package/magento/testing/daffodil-driver-magento-testing.metadata.json +0 -1
@@ -1,4 +1,5 @@
1
1
  /**
2
2
  * Generated bundle index. Do not edit.
3
3
  */
4
+ /// <amd-module name="@daffodil/driver" />
4
5
  export * from './index';
@@ -1,2 +1,2 @@
1
- export * from './errors/public_api';
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9saWJzL2RyaXZlci9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxxQkFBcUIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vZXJyb3JzL3B1YmxpY19hcGknO1xuIl19
1
+ export * from './public_api';
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9saWJzL2RyaXZlci9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxjQUFjLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL3B1YmxpY19hcGknO1xuIl19
@@ -0,0 +1,12 @@
1
+ import { DaffInheritableError, } from '@daffodil/core';
2
+ export const DAFF_DRIVER_MAGENTO_ERROR_CODE = 'DAFF_DRIVER_MAGENTO_ERROR';
3
+ /**
4
+ * A very general error thrown when a more specific error type cannot be determined.
5
+ */
6
+ export class DaffDriverMagentoError extends DaffInheritableError {
7
+ constructor(message) {
8
+ super(message);
9
+ this.code = DAFF_DRIVER_MAGENTO_ERROR_CODE;
10
+ }
11
+ }
12
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3IuY2xhc3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9saWJzL2RyaXZlci9tYWdlbnRvL3NyYy9lcnJvcnMvZXJyb3IuY2xhc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUVMLG9CQUFvQixHQUNyQixNQUFNLGdCQUFnQixDQUFDO0FBRXhCLE1BQU0sQ0FBQyxNQUFNLDhCQUE4QixHQUFHLDJCQUEyQixDQUFDO0FBRTFFOztHQUVHO0FBQ0gsTUFBTSxPQUFPLHNCQUF1QixTQUFRLG9CQUFvQjtJQUcvRCxZQUFZLE9BQWdCO1FBQzFCLEtBQUssQ0FBQyxPQUFPLENBQUMsQ0FBQztRQUhELFNBQUksR0FBVyw4QkFBOEIsQ0FBQztJQUk5RCxDQUFDO0NBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQge1xuICBEYWZmRXJyb3IsXG4gIERhZmZJbmhlcml0YWJsZUVycm9yLFxufSBmcm9tICdAZGFmZm9kaWwvY29yZSc7XG5cbmV4cG9ydCBjb25zdCBEQUZGX0RSSVZFUl9NQUdFTlRPX0VSUk9SX0NPREUgPSAnREFGRl9EUklWRVJfTUFHRU5UT19FUlJPUic7XG5cbi8qKlxuICogQSB2ZXJ5IGdlbmVyYWwgZXJyb3IgdGhyb3duIHdoZW4gYSBtb3JlIHNwZWNpZmljIGVycm9yIHR5cGUgY2Fubm90IGJlIGRldGVybWluZWQuXG4gKi9cbmV4cG9ydCBjbGFzcyBEYWZmRHJpdmVyTWFnZW50b0Vycm9yIGV4dGVuZHMgRGFmZkluaGVyaXRhYmxlRXJyb3IgaW1wbGVtZW50cyBEYWZmRXJyb3Ige1xuXHRwdWJsaWMgcmVhZG9ubHkgY29kZTogc3RyaW5nID0gREFGRl9EUklWRVJfTUFHRU5UT19FUlJPUl9DT0RFO1xuXG5cdGNvbnN0cnVjdG9yKG1lc3NhZ2U/OiBzdHJpbmcpIHtcblx0ICBzdXBlcihtZXNzYWdlKTtcblx0fVxufVxuIl19
@@ -0,0 +1,4 @@
1
+ export { daffTransformMagentoError } from './transform';
2
+ export { daffMagentoTransformGraphQlError } from './transform-graphql';
3
+ export { DAFF_DRIVER_MAGENTO_ERROR_CODE, DaffDriverMagentoError, } from './error.class';
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX2FwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL2xpYnMvZHJpdmVyL21hZ2VudG8vc3JjL2Vycm9ycy9wdWJsaWNfYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSx5QkFBeUIsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUN4RCxPQUFPLEVBQUUsZ0NBQWdDLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUN2RSxPQUFPLEVBQ0wsOEJBQThCLEVBQzlCLHNCQUFzQixHQUN2QixNQUFNLGVBQWUsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCB7IGRhZmZUcmFuc2Zvcm1NYWdlbnRvRXJyb3IgfSBmcm9tICcuL3RyYW5zZm9ybSc7XG5leHBvcnQgeyBkYWZmTWFnZW50b1RyYW5zZm9ybUdyYXBoUWxFcnJvciB9IGZyb20gJy4vdHJhbnNmb3JtLWdyYXBocWwnO1xuZXhwb3J0IHtcbiAgREFGRl9EUklWRVJfTUFHRU5UT19FUlJPUl9DT0RFLFxuICBEYWZmRHJpdmVyTWFnZW50b0Vycm9yLFxufSBmcm9tICcuL2Vycm9yLmNsYXNzJztcbiJdfQ==
@@ -0,0 +1,7 @@
1
+ import { DaffDriverMagentoError } from './error.class';
2
+ export function daffMagentoTransformGraphQlError(error, map) {
3
+ const ErrorClass = map[error.extensions.category] || DaffDriverMagentoError;
4
+ return new ErrorClass(error.message);
5
+ }
6
+ ;
7
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNmb3JtLWdyYXBocWwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9saWJzL2RyaXZlci9tYWdlbnRvL3NyYy9lcnJvcnMvdHJhbnNmb3JtLWdyYXBocWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBT0EsT0FBTyxFQUFFLHNCQUFzQixFQUFFLE1BQU0sZUFBZSxDQUFDO0FBRXZELE1BQU0sVUFBVSxnQ0FBZ0MsQ0FDOUMsS0FBbUIsRUFDbkIsR0FBTTtJQUVOLE1BQU0sVUFBVSxHQUFHLEdBQUcsQ0FBQyxLQUFLLENBQUMsVUFBVSxDQUFDLFFBQVEsQ0FBQyxJQUFJLHNCQUFzQixDQUFDO0lBRTVFLE9BQU8sSUFBSSxVQUFVLENBQUMsS0FBSyxDQUFDLE9BQU8sQ0FBQyxDQUFFO0FBQ3hDLENBQUM7QUFBQSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgR3JhcGhRTEVycm9yIH0gZnJvbSAnZ3JhcGhxbCc7XG5cbmltcG9ydCB7XG4gIERhZmZFcnJvcixcbiAgRGFmZkVycm9yQ29kZU1hcCxcbn0gZnJvbSAnQGRhZmZvZGlsL2NvcmUnO1xuXG5pbXBvcnQgeyBEYWZmRHJpdmVyTWFnZW50b0Vycm9yIH0gZnJvbSAnLi9lcnJvci5jbGFzcyc7XG5cbmV4cG9ydCBmdW5jdGlvbiBkYWZmTWFnZW50b1RyYW5zZm9ybUdyYXBoUWxFcnJvcjxUIGV4dGVuZHMgRGFmZkVycm9yQ29kZU1hcD4oXG4gIGVycm9yOiBHcmFwaFFMRXJyb3IsXG4gIG1hcDogVCxcbik6IERhZmZFcnJvciB7XG4gIGNvbnN0IEVycm9yQ2xhc3MgPSBtYXBbZXJyb3IuZXh0ZW5zaW9ucy5jYXRlZ29yeV0gfHwgRGFmZkRyaXZlck1hZ2VudG9FcnJvcjtcblxuICByZXR1cm4gbmV3IEVycm9yQ2xhc3MoZXJyb3IubWVzc2FnZSkgO1xufTtcbiJdfQ==
@@ -0,0 +1,21 @@
1
+ import { daffIsError, } from '@daffodil/core';
2
+ import { DaffDriverMagentoError } from './error.class';
3
+ import { daffMagentoTransformGraphQlError } from './transform-graphql';
4
+ /**
5
+ * Transforms the passed error according to the lookup in the passed map.
6
+ */
7
+ // TODO: return array of errors
8
+ export function daffTransformMagentoError(error, map) {
9
+ // TODO: handle network errors
10
+ if (error.graphQLErrors) {
11
+ return error.graphQLErrors.map(err => daffMagentoTransformGraphQlError(err, map))[0];
12
+ }
13
+ else if (daffIsError(error)) {
14
+ return error;
15
+ }
16
+ else {
17
+ return new DaffDriverMagentoError(error.message);
18
+ }
19
+ }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mltcG9ydCB7IERhZmZEcml2ZXJNYWdlbnRvRXJyb3IgfSBmcm9tICcuL2Vycm9yLmNsYXNzJztcbmltcG9ydCB7IGRhZmZNYWdlbnRvVHJhbnNmb3JtR3JhcGhRbEVycm9yIH0gZnJvbSAnLi90cmFuc2Zvcm0tZ3JhcGhxbCc7XG5cbi8qKlxuICogVHJhbnNmb3JtcyB0aGUgcGFzc2VkIGVycm9yIGFjY29yZGluZyB0byB0aGUgbG9va3VwIGluIHRoZSBwYXNzZWQgbWFwLlxuICovXG4vLyBUT0RPOiByZXR1cm4gYXJyYXkgb2YgZXJyb3JzXG5leHBvcnQgZnVuY3Rpb24gZGFmZlRyYW5zZm9ybU1hZ2VudG9FcnJvcjxUIGV4dGVuZHMgRGFmZkVycm9yQ29kZU1hcD4oZXJyb3I6IGFueSwgbWFwOiBUKTogRGFmZkVycm9yIHtcbiAgLy8gVE9ETzogaGFuZGxlIG5ldHdvcmsgZXJyb3JzXG4gIGlmIChlcnJvci5ncmFwaFFMRXJyb3JzKSB7XG4gICAgcmV0dXJuIGVycm9yLmdyYXBoUUxFcnJvcnMubWFwKGVyciA9PiBkYWZmTWFnZW50b1RyYW5zZm9ybUdyYXBoUWxFcnJvcjxUPihlcnIsIG1hcCkpWzBdO1xuICB9IGVsc2UgaWYgKGRhZmZJc0Vycm9yKGVycm9yKSkge1xuICAgIHJldHVybiBlcnJvcjtcbiAgfSBlbHNlIHtcbiAgICByZXR1cm4gbmV3IERhZmZEcml2ZXJNYWdlbnRvRXJyb3IoZXJyb3IubWVzc2FnZSk7XG4gIH1cbn07XG4iXX0=
@@ -0,0 +1,34 @@
1
+ import { Inject, Injectable, } from '@angular/core';
2
+ import { ApolloLink } from '@apollo/client/core';
3
+ import { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from './cacheable-operations-token';
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * A service that will convert cacheable apollo operations into a format that Magento will understand as cacheable.
7
+ *
8
+ * @inheritdoc
9
+ */
10
+ export class DaffMagentoApolloCacheableOperationsLinkGenerator {
11
+ constructor(apolloGetRequests) {
12
+ this.apolloGetRequests = apolloGetRequests;
13
+ }
14
+ getLink() {
15
+ return new ApolloLink((operation, forward) => {
16
+ if (this.apolloGetRequests.indexOf(operation.operationName) > -1) {
17
+ operation.setContext({ method: 'GET' });
18
+ }
19
+ return forward(operation);
20
+ });
21
+ }
22
+ }
23
+ DaffMagentoApolloCacheableOperationsLinkGenerator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffMagentoApolloCacheableOperationsLinkGenerator, deps: [{ token: DAFF_MAGENTO_CACHEABLE_OPERATIONS }], target: i0.ɵɵFactoryTarget.Injectable });
24
+ DaffMagentoApolloCacheableOperationsLinkGenerator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffMagentoApolloCacheableOperationsLinkGenerator, providedIn: 'root' });
25
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffMagentoApolloCacheableOperationsLinkGenerator, decorators: [{
26
+ type: Injectable,
27
+ args: [{
28
+ providedIn: 'root',
29
+ }]
30
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
31
+ type: Inject,
32
+ args: [DAFF_MAGENTO_CACHEABLE_OPERATIONS]
33
+ }] }]; } });
34
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBvbGxvLWNhY2hlYWJsZS1vcGVyYXRpb25zLWxpbmstZ2VuZXJhdG9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9kcml2ZXIvbWFnZW50by9zcmMvZ3JhcGhxbC9jYWNoZWFibGUtb3BlcmF0aW9ucy9hcG9sbG8tY2FjaGVhYmxlLW9wZXJhdGlvbnMtbGluay1nZW5lcmF0b3IudHMiX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kOiAnR0VUJyB9KTtcbiAgICAgIH1cbiAgICAgIHJldHVybiBmb3J3YXJkKG9wZXJhdGlvbik7XG4gICAgfSk7XG4gIH1cbn1cbiJdfQ==
@@ -0,0 +1,30 @@
1
+ import { Injectable } from '@angular/core';
2
+ import * as faker from '@faker-js/faker/locale/en_US';
3
+ import { DaffModelFactory } from '@daffodil/core/testing';
4
+ import { MagentoMoneyFactory } from './money.factory';
5
+ import * as i0 from "@angular/core";
6
+ export class MockMagentoDiscount {
7
+ constructor() {
8
+ this.__typename = 'Discount';
9
+ this.amount = this.money();
10
+ this.label = faker.random.word();
11
+ }
12
+ money() {
13
+ return (new MagentoMoneyFactory()).create();
14
+ }
15
+ }
16
+ ;
17
+ export class MagentoDiscountFactory extends DaffModelFactory {
18
+ constructor() {
19
+ super(MockMagentoDiscount);
20
+ }
21
+ }
22
+ MagentoDiscountFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: MagentoDiscountFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
23
+ MagentoDiscountFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: MagentoDiscountFactory, providedIn: 'root' });
24
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: MagentoDiscountFactory, decorators: [{
25
+ type: Injectable,
26
+ args: [{
27
+ providedIn: 'root',
28
+ }]
29
+ }], ctorParameters: function () { return []; } });
30
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlzY291bnQuZmFjdG9yeS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvZHJpdmVyL21hZ2VudG8vdGVzdGluZy9zcmMvZmFjdG9yaWVzL2Rpc2NvdW50LmZhY3RvcnkudHMiXSwibmFtZXMiOltdLCJtYXB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W5nJztcbmltcG9ydCB7XG4gIE1hZ2VudG9EaXNjb3VudCxcbiAgTWFnZW50b01vbmV5LFxufSBmcm9tICdAZGFmZm9kaWwvZHJpdmVyL21hZ2VudG8nO1xuXG5pbXBvcnQgeyBNYWdlbnRvTW9uZXlGYWN0b3J5IH0gZnJvbSAnLi9tb25leS5mYWN0b3J5JztcblxuZXhwb3J0IGNsYXNzIE1vY2tNYWdlbnRvRGlzY291bnQgaW1wbGVtZW50cyBNYWdlbnRvRGlzY291bnQge1xuXHRfX3R5cGVuYW1lID0gJ0Rpc2NvdW50JztcbiAgYW1vdW50ID0gdGhpcy5tb25leSgpO1xuICBsYWJlbCA9IGZha2VyLnJhbmRvbS53b3JkKCk7XG5cbiAgcHJpdmF0ZSBtb25leSgpOiBNYWdlbnRvTW9uZXkge1xuICAgIHJldHVybiAobmV3IE1hZ2VudG9Nb25leUZhY3RvcnkoKSkuY3JlYXRlKCk7XG4gIH1cbn07XG5cbkBJbmplY3RhYmxlKHtcbiAgcHJvdmlkZWRJbjogJ3Jvb3QnLFxufSlcbmV4cG9ydCBjbGFzcyBNYWdlbnRvRGlzY291bnRGYWN0b3J5IGV4dGVuZHMgRGFmZk1vZGVsRmFjdG9yeTxNYWdlbnRvRGlzY291bnQ+IHtcbiAgY29uc3RydWN0b3IoKSB7XG4gICAgc3VwZXIoTW9ja01hZ2VudG9EaXNjb3VudCk7XG4gIH1cbn1cbiJdfQ==
@@ -0,0 +1,26 @@
1
+ import { Injectable } from '@angular/core';
2
+ import * as faker from '@faker-js/faker/locale/en_US';
3
+ import { DaffModelFactory } from '@daffodil/core/testing';
4
+ import * as i0 from "@angular/core";
5
+ export class MockMagentoMoney {
6
+ constructor() {
7
+ this.__typename = 'Money';
8
+ this.value = faker.datatype.number({ min: 1, max: 10000 });
9
+ this.currency = faker.random.word();
10
+ }
11
+ }
12
+ ;
13
+ export class MagentoMoneyFactory extends DaffModelFactory {
14
+ constructor() {
15
+ super(MockMagentoMoney);
16
+ }
17
+ }
18
+ MagentoMoneyFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: MagentoMoneyFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
19
+ MagentoMoneyFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: MagentoMoneyFactory, providedIn: 'root' });
20
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: MagentoMoneyFactory, decorators: [{
21
+ type: Injectable,
22
+ args: [{
23
+ providedIn: 'root',
24
+ }]
25
+ }], ctorParameters: function () { return []; } });
26
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9uZXkuZmFjdG9yeS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvZHJpdmVyL21hZ2VudG8vdGVzdGluZy9zcmMvZmFjdG9yaWVzL21vbmV5LmZhY3RvcnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUMzQyxPQUFPLEtBQUssS0FBSyxNQUFNLDhCQUE4QixDQUFDO0FBRXRELE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHdCQUF3QixDQUFDOztBQUcxRCxNQUFNLE9BQU8sZ0JBQWdCO0lBQTdCO1FBQ0MsZUFBVSxHQUFHLE9BQU8sQ0FBQztRQUNwQixVQUFLLEdBQUcsS0FBSyxDQUFDLFFBQVEsQ0FBQyxNQUFNLENBQUMsRUFBRSxHQUFHLEVBQUUsQ0FBQyxFQUFFLEdBQUcsRUFBRSxLQUFLLEVBQUUsQ0FBQyxDQUFDO1FBQ3RELGFBQVEsR0FBRyxLQUFLLENBQUMsTUFBTSxDQUFDLElBQUksRUFBRSxDQ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uICB9XG59XG4iXX0=
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX2FwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYnMvZHJpdmVyL3NyYy9tb2RlbHMvcHVibGljX2FwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgRGFmZkRyaXZlclJlc3BvbnNlIH0gZnJvbSAnLi9yZXNwb25zZS5pbnRlcmZhY2UnO1xuIl19
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVzcG9uc2UuaW50ZXJmYWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vbGlicy9kcml2ZXIvc3JjL21vZGVscy9yZXNwb25zZS5pbnRlcmZhY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IERhZmZFcnJvciB9IGZyb20gJ0BkYWZmb2RpbC9jb3JlJztcblxuLyoqXG4gKiBBIGRyaXZlciByZXNwb25zZS5cbiAqIENhbiBjb250YWluIGEgcmVzcG9uc2UsIGVycm9ycywgb3IgYm90aC5cbiAqL1xuZXhwb3J0IGludGVyZmFjZSBEYWZmRHJpdmVyUmVzcG9uc2U8VD4ge1xuICAvKipcbiAgICogVGhlIGJvZHkgb2YgdGhlIHJlc3BvbnNlLlxuICAgKi9cbiAgcmVzcG9uc2U/OiBUO1xuICAvKipcbiAgICogQSBsaXN0IG9mIGVycm9ycyB0aGF0IG9jY3VyZWQgZHVyaW5nIHRoZSBkcml2ZXIgY2FsbC5cbiAgICovXG4gIGVycm9yczogRGFmZkVycm9yW107XG59XG4iXX0=
@@ -0,0 +1,3 @@
1
+ export * from './errors/public_api';
2
+ export * from './models/public_api';
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX2FwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYnMvZHJpdmVyL3NyYy9wdWJsaWNfYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMscUJBQXFCLENBQUM7QUFDcEMsY0FBYyxxQkFBcUIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vZXJyb3JzL3B1YmxpY19hcGknO1xuZXhwb3J0ICogZnJvbSAnLi9tb2RlbHMvcHVibGljX2FwaSc7XG4iXX0=
@@ -53,4 +53,4 @@ const daffHubspotFormsServiceFactory = (http, document, router, title, config) =
53
53
  */
54
54
 
55
55
  export { DaffHubspotFormsService, daffHubspotFormsServiceFactory };
56
- //# sourceMappingURL=daffodil-driver-hubspot.js.map
56
+ //# sourceMappingURL=daffodil-driver-hubspot.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daffodil-driver-hubspot.mjs","sources":["../../../libs/driver/hubspot/src/transformers/json-builder.ts","../../../libs/driver/hubspot/src/hubspot-forms.service.ts","../../../libs/driver/hubspot/src/hubspot-forms.provider.ts","../../../libs/driver/hubspot/src/daffodil-driver-hubspot.ts"],"sourcesContent":["import { FieldValue } from '../models/hubspot-request';\n\n\nexport const jsonBuilder = (payload: Record<string, any>): FieldValue[] => Object.keys(payload).map((key) => ({ name: key, value: payload[key] }));\n","import { HttpClient } from '@angular/common/http';\nimport { Title } from '@angular/platform-browser';\nimport { Router } from '@angular/router';\nimport { Observable } from 'rxjs';\n\nimport { DaffHubspotConfig } from './models/config';\nimport { DaffHubspotRequest } from './models/hubspot-request';\nimport { HubspotResponse } from './models/hubspot-response';\nimport { jsonBuilder } from './transformers/json-builder';\n\nexport class DaffHubspotFormsService {\n\n constructor(\n private http: HttpClient,\n private document: Document,\n private route: Router,\n private title: Title,\n private config: DaffHubspotConfig) { }\n\n\n submit(payload: Record<string, any>): Observable<HubspotResponse> {\n return this.http.post<HubspotResponse>(\n this.generateUrl(this.config.portalId, this.config.guid, this.config.version),\n this.makeRequest(payload),\n );\n }\n\n private makeRequest(payload): DaffHubspotRequest {\n return {\n fields: [\n ...jsonBuilder(payload),\n ],\n context: {\n hutk: this.getCookie(),\n pageUri: this.getPageURI(),\n pageName: this.title.getTitle(),\n },\n };\n }\n\n private generateUrl(portalId: string, guid: string, version: string): string {\n if (version === undefined) {\n version = 'v3';\n }\n return 'https://api.hsforms.com/submissions/' + version + '/integration/submit/'\n + portalId + '/' + guid;\n }\n private getCookie() {\n if (!this.document) {\n return null;\n }\n const name = 'hubspotutk';\n const v = this.document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');\n return v ? v[2] : null;\n }\n private getPageURI() {\n if (!this.route) {\n return null;\n }\n return this.route.url;\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Title } from '@angular/platform-browser';\nimport { Router } from '@angular/router';\n\nimport { DaffHubspotFormsService } from './hubspot-forms.service';\nimport { DaffHubspotConfig } from './models/config';\n\n\nexport const daffHubspotFormsServiceFactory = (\n http: HttpClient,\n document: Document,\n router: Router,\n title: Title,\n config: DaffHubspotConfig,\n) => new DaffHubspotFormsService(http, document, router, title, config);\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAGO,MAAM,WAAW,GAAG,CAAC,OAA4B,KAAmB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;;MCOrI,uBAAuB,CAAA;IAElC,WACU,CAAA,IAAgB,EAChB,QAAkB,EAClB,KAAa,EACb,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AI,CAAC;AACb,SAAA;QACD,MAAM,IAAI,GAAG,YAAY,CAAC;AAC1B,QAAA,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI,GAAG,eAAe,CAAC,CAAC;AACzE,QAAA,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;KACxB;IACO,UAAU,GAAA;AAChB,QAAA,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;AACf,YAAA,OAAO,IAAI,CAAC;AACb,SAAA;AACD,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;KACvB;AACF;;ACrDM,MAAM,8BAA8B,GAAG,CAC5C,IAAgB,EAChB,QAAkB,EAClB,MAAc,EACd,KAAY,EACZ,MAAyB,KACtB,IAAI,uBAAuB,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;;ACdtE;;AAEG;;;;"}
@@ -0,0 +1,58 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable } from '@angular/core';
3
+ import * as faker from '@faker-js/faker/locale/en_US';
4
+ import { DaffModelFactory } from '@daffodil/core/testing';
5
+
6
+ class MockMagentoMoney {
7
+ constructor() {
8
+ this.__typename = 'Money';
9
+ this.value = faker.datatype.number({ min: 1, max: 10000 });
10
+ this.currency = faker.random.word();
11
+ }
12
+ }
13
+ ;
14
+ class MagentoMoneyFactory extends DaffModelFactory {
15
+ constructor() {
16
+ super(MockMagentoMoney);
17
+ }
18
+ }
19
+ MagentoMoneyFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: MagentoMoneyFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
20
+ MagentoMoneyFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: MagentoMoneyFactory, providedIn: 'root' });
21
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: MagentoMoneyFactory, decorators: [{
22
+ type: Injectable,
23
+ args: [{
24
+ providedIn: 'root',
25
+ }]
26
+ }], ctorParameters: function () { return []; } });
27
+
28
+ class MockMagentoDiscount {
29
+ constructor() {
30
+ this.__typename = 'Discount';
31
+ this.amount = this.money();
32
+ this.label = faker.random.word();
33
+ }
34
+ money() {
35
+ return (new MagentoMoneyFactory()).create();
36
+ }
37
+ }
38
+ ;
39
+ class MagentoDiscountFactory extends DaffModelFactory {
40
+ constructor() {
41
+ super(MockMagentoDiscount);
42
+ }
43
+ }
44
+ MagentoDiscountFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: MagentoDiscountFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
45
+ MagentoDiscountFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: MagentoDiscountFactory, providedIn: 'root' });
46
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: MagentoDiscountFactory, decorators: [{
47
+ type: Injectable,
48
+ args: [{
49
+ providedIn: 'root',
50
+ }]
51
+ }], ctorParameters: function () { return []; } });
52
+
53
+ /**
54
+ * Generated bundle index. Do not edit.
55
+ */
56
+
57
+ export { MagentoDiscountFactory, MagentoMoneyFactory };
58
+ //# sourceMappingURL=daffodil-driver-magento-testing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daffodil-driver-magento-testing.mjs","sources":["../../../libs/driver/magento/testing/src/factories/money.factory.ts","../../../libs/driver/magento/testing/src/factories/discount.factory.ts","../../../libs/driver/magento/testing/src/daffodil-driver-magento-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport * as faker from '@faker-js/faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport { MagentoMoney } from '@daffodil/driver/magento';\n\nexport class MockMagentoMoney implements MagentoMoney {\n\t__typename = 'Money';\n value = faker.datatype.number({ min: 1, max: 10000 });\n currency = faker.random.word();\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MagentoMoneyFactory extends DaffModelFactory<MagentoMoney> {\n constructor() {\n super(MockMagentoMoney);\n }\n}\n","import { Injectable } from '@angular/core';\nimport * as faker from '@faker-js/faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport {\n MagentoDiscount,\n MagentoMoney,\n} from '@daffodil/driver/magento';\n\nimport { MagentoMoneyFactory } from './money.factory';\n\nexport class MockMagentoDiscount implements MagentoDiscount {\n\t__typename = 'Discount';\n amount = this.money();\n label = faker.random.word();\n\n private money(): MagentoMoney {\n return (new MagentoMoneyFactory()).create();\n }\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MagentoDiscountFactory extends DaffModelFactory<MagentoDiscount> {\n constructor() {\n super(MockMagentoDiscount);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAMa,gBAAgB,CAAA;AAA7B,IAAA,WAAA,GAAA;AACC,QAAA,IAAU,CAAA,UAAA,GAAG,OAAO,CAAC;AACpB,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;QACtD,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;KAChC;AAAA,CAAA;AAAA,CAAC;AAKI,MAAO,mBAAoB,SAAQ,gBAA8B,CAAA;AACrE,IAAA,WAAA,GAAA;QACE,KAAK,CAAC,gBAAgB,CAAC,CAAC;KACzB;;gHAHU,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAA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,0 +1,200 @@
1
+ import { DaffInheritableError, daffIsError } from '@daffodil/core';
2
+ import * as i0 from '@angular/core';
3
+ import { InjectionToken, Injectable, Inject } from '@angular/core';
4
+ import { ApolloLink } from '@apollo/client/core';
5
+
6
+ var possibleTypes = {
7
+ CartAddressInterface: [
8
+ "BillingCartAddress",
9
+ "ShippingCartAddress"
10
+ ],
11
+ CartItemInterface: [
12
+ "SimpleCartItem",
13
+ "VirtualCartItem",
14
+ "DownloadableCartItem",
15
+ "BundleCartItem",
16
+ "ConfigurableCartItem"
17
+ ],
18
+ ProductInterface: [
19
+ "VirtualProduct",
20
+ "SimpleProduct",
21
+ "DownloadableProduct",
22
+ "BundleProduct",
23
+ "GroupedProduct",
24
+ "ConfigurableProduct"
25
+ ],
26
+ CategoryInterface: [
27
+ "CategoryTree"
28
+ ],
29
+ MediaGalleryInterface: [
30
+ "ProductImage",
31
+ "ProductVideo"
32
+ ],
33
+ ProductLinksInterface: [
34
+ "ProductLinks"
35
+ ],
36
+ CreditMemoItemInterface: [
37
+ "DownloadableCreditMemoItem",
38
+ "BundleCreditMemoItem",
39
+ "CreditMemoItem"
40
+ ],
41
+ OrderItemInterface: [
42
+ "DownloadableOrderItem",
43
+ "BundleOrderItem",
44
+ "OrderItem"
45
+ ],
46
+ InvoiceItemInterface: [
47
+ "DownloadableInvoiceItem",
48
+ "BundleInvoiceItem",
49
+ "InvoiceItem"
50
+ ],
51
+ ShipmentItemInterface: [
52
+ "BundleShipmentItem",
53
+ "ShipmentItem"
54
+ ],
55
+ AggregationOptionInterface: [
56
+ "AggregationOption"
57
+ ],
58
+ LayerFilterItemInterface: [
59
+ "LayerFilterItem",
60
+ "SwatchLayerFilterItem"
61
+ ],
62
+ PhysicalProductInterface: [
63
+ "SimpleProduct",
64
+ "BundleProduct",
65
+ "GroupedProduct",
66
+ "ConfigurableProduct"
67
+ ],
68
+ CustomizableOptionInterface: [
69
+ "CustomizableAreaOption",
70
+ "CustomizableDateOption",
71
+ "CustomizableDropDownOption",
72
+ "CustomizableMultipleOption",
73
+ "CustomizableFieldOption",
74
+ "CustomizableFileOption",
75
+ "CustomizableRadioOption",
76
+ "CustomizableCheckboxOption"
77
+ ],
78
+ CustomizableProductInterface: [
79
+ "VirtualProduct",
80
+ "SimpleProduct",
81
+ "DownloadableProduct",
82
+ "BundleProduct",
83
+ "ConfigurableProduct"
84
+ ],
85
+ SwatchDataInterface: [
86
+ "ImageSwatchData",
87
+ "TextSwatchData",
88
+ "ColorSwatchData"
89
+ ],
90
+ SwatchLayerFilterItemInterface: [
91
+ "SwatchLayerFilterItem"
92
+ ]
93
+ };
94
+ var introspectionQueryResultData = {
95
+ possibleTypes: possibleTypes
96
+ };
97
+
98
+ const schema = introspectionQueryResultData;
99
+
100
+ const DAFF_DRIVER_MAGENTO_ERROR_CODE = 'DAFF_DRIVER_MAGENTO_ERROR';
101
+ /**
102
+ * A very general error thrown when a more specific error type cannot be determined.
103
+ */
104
+ class DaffDriverMagentoError extends DaffInheritableError {
105
+ constructor(message) {
106
+ super(message);
107
+ this.code = DAFF_DRIVER_MAGENTO_ERROR_CODE;
108
+ }
109
+ }
110
+
111
+ function daffMagentoTransformGraphQlError(error, map) {
112
+ const ErrorClass = map[error.extensions.category] || DaffDriverMagentoError;
113
+ return new ErrorClass(error.message);
114
+ }
115
+ ;
116
+
117
+ /**
118
+ * Transforms the passed error according to the lookup in the passed map.
119
+ */
120
+ // TODO: return array of errors
121
+ function daffTransformMagentoError(error, map) {
122
+ // TODO: handle network errors
123
+ if (error.graphQLErrors) {
124
+ return error.graphQLErrors.map(err => daffMagentoTransformGraphQlError(err, map))[0];
125
+ }
126
+ else if (daffIsError(error)) {
127
+ return error;
128
+ }
129
+ else {
130
+ return new DaffDriverMagentoError(error.message);
131
+ }
132
+ }
133
+ ;
134
+
135
+ /**
136
+ * A multi-provider injection token of the operation names of magento queries that should
137
+ * be cached. This is needed because queries need to be converted into GET queries in order for Magento
138
+ * to cache them. This token should be used by daffodil driver platform modules to register operation names that are cacheable, and is
139
+ * intended for internal daffodil use only.
140
+ */
141
+ const DAFF_MAGENTO_CACHEABLE_OPERATIONS = new InjectionToken('DAFF_MAGENTO_CACHEABLE_OPERATIONS', { factory: () => [] });
142
+ /**
143
+ * Adds an operation name to the list of cacheable Magento operations. Use only with Angular 9+.
144
+ */
145
+ function provideDaffMagentoCacheableOperation(operationName) {
146
+ return {
147
+ provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,
148
+ useValue: operationName,
149
+ multi: true,
150
+ };
151
+ }
152
+ /**
153
+ * Adds many operation names to the list of cacheable Magento operations. Use only with Angular 9+.
154
+ */
155
+ function provideManyDaffMagentoCacheableOperations(...operationNames) {
156
+ return operationNames.map(name => ({
157
+ provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,
158
+ useValue: name,
159
+ multi: true,
160
+ }));
161
+ }
162
+
163
+ /**
164
+ * A service that will convert cacheable apollo operations into a format that Magento will understand as cacheable.
165
+ *
166
+ * @inheritdoc
167
+ */
168
+ class DaffMagentoApolloCacheableOperationsLinkGenerator {
169
+ constructor(apolloGetRequests) {
170
+ this.apolloGetRequests = apolloGetRequests;
171
+ }
172
+ getLink() {
173
+ return new ApolloLink((operation, forward) => {
174
+ if (this.apolloGetRequests.indexOf(operation.operationName) > -1) {
175
+ operation.setContext({ method: 'GET' });
176
+ }
177
+ return forward(operation);
178
+ });
179
+ }
180
+ }
181
+ DaffMagentoApolloCacheableOperationsLinkGenerator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffMagentoApolloCacheableOperationsLinkGenerator, deps: [{ token: DAFF_MAGENTO_CACHEABLE_OPERATIONS }], target: i0.ɵɵFactoryTarget.Injectable });
182
+ DaffMagentoApolloCacheableOperationsLinkGenerator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffMagentoApolloCacheableOperationsLinkGenerator, providedIn: 'root' });
183
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffMagentoApolloCacheableOperationsLinkGenerator, decorators: [{
184
+ type: Injectable,
185
+ args: [{
186
+ providedIn: 'root',
187
+ }]
188
+ }], ctorParameters: function () {
189
+ return [{ type: undefined, decorators: [{
190
+ type: Inject,
191
+ args: [DAFF_MAGENTO_CACHEABLE_OPERATIONS]
192
+ }] }];
193
+ } });
194
+
195
+ /**
196
+ * Generated bundle index. Do not edit.
197
+ */
198
+
199
+ export { DAFF_DRIVER_MAGENTO_ERROR_CODE, DAFF_MAGENTO_CACHEABLE_OPERATIONS, DaffDriverMagentoError, DaffMagentoApolloCacheableOperationsLinkGenerator, daffMagentoTransformGraphQlError, daffTransformMagentoError, provideDaffMagentoCacheableOperation, provideManyDaffMagentoCacheableOperations, schema };
200
+ //# sourceMappingURL=daffodil-driver-magento.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daffodil-driver-magento.mjs","sources":["../../../libs/driver/magento/src/schema/schema.ts","../../../libs/driver/magento/src/errors/error.class.ts","../../../libs/driver/magento/src/errors/transform-graphql.ts","../../../libs/driver/magento/src/errors/transform.ts","../../../libs/driver/magento/src/graphql/cacheable-operations/cacheable-operations-token.ts","../../../libs/driver/magento/src/graphql/cacheable-operations/apollo-cacheable-operations-link-generator.ts","../../../libs/driver/magento/src/daffodil-driver-magento.ts"],"sourcesContent":["import introspectionQueryResultData from './introspection.json';\n\nexport const schema = introspectionQueryResultData;\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nexport const DAFF_DRIVER_MAGENTO_ERROR_CODE = 'DAFF_DRIVER_MAGENTO_ERROR';\n\n/**\n * A very general error thrown when a more specific error type cannot be determined.\n */\nexport class DaffDriverMagentoError extends DaffInheritableError implements DaffError {\n\tpublic readonly code: string = DAFF_DRIVER_MAGENTO_ERROR_CODE;\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\n}\n","import { GraphQLError } from 'graphql';\n\nimport {\n DaffError,\n DaffErrorCodeMap,\n} from '@daffodil/core';\n\nimport { DaffDriverMagentoError } from './error.class';\n\nexport function daffMagentoTransformGraphQlError<T extends DaffErrorCodeMap>(\n error: GraphQLError,\n map: T,\n): DaffError {\n const ErrorClass = map[error.extensions.category] || DaffDriverMagentoError;\n\n return new ErrorClass(error.message) ;\n};\n","import {\n DaffError,\n DaffErrorCodeMap,\n daffIsError,\n} from '@daffodil/core';\n\nimport { DaffDriverMagentoError } from './error.class';\nimport { daffMagentoTransformGraphQlError } from './transform-graphql';\n\n/**\n * Transforms the passed error according to the lookup in the passed map.\n */\n// TODO: return array of errors\nexport function daffTransformMagentoError<T extends DaffErrorCodeMap>(error: any, map: T): DaffError {\n // TODO: handle network errors\n if (error.graphQLErrors) {\n return error.graphQLErrors.map(err => daffMagentoTransformGraphQlError<T>(err, map))[0];\n } else if (daffIsError(error)) {\n return error;\n } else {\n return new DaffDriverMagentoError(error.message);\n }\n};\n","import { InjectionToken } from '@angular/core';\n\n/**\n * A multi-provider injection token of the operation names of magento queries that should\n * be cached. This is needed because queries need to be converted into GET queries in order for Magento\n * to cache them. This token should be used by daffodil driver platform modules to register operation names that are cacheable, and is\n * intended for internal daffodil use only.\n */\nexport const DAFF_MAGENTO_CACHEABLE_OPERATIONS = new InjectionToken<string[]>('DAFF_MAGENTO_CACHEABLE_OPERATIONS', { factory: () => []});\n\n/**\n * Adds an operation name to the list of cacheable Magento operations. Use only with Angular 9+.\n */\nexport function provideDaffMagentoCacheableOperation(operationName: string) {\n return {\n provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,\n useValue: operationName,\n multi: true,\n };\n}\n\n/**\n * Adds many operation names to the list of cacheable Magento operations. Use only with Angular 9+.\n */\nexport function provideManyDaffMagentoCacheableOperations(...operationNames: string[]) {\n return operationNames.map(name => ({\n provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,\n useValue: name,\n multi: true,\n }));\n}\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport { ApolloLink } from '@apollo/client/core';\n\nimport { DaffApolloCacheableOperationLinkGenerator } from '@daffodil/core/graphql';\n\nimport { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from './cacheable-operations-token';\n\n/**\n * A service that will convert cacheable apollo operations into a format that Magento will understand as cacheable.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffMagentoApolloCacheableOperationsLinkGenerator implements DaffApolloCacheableOperationLinkGenerator {\n constructor(\n\t\t@Inject(DAFF_MAGENTO_CACHEABLE_OPERATIONS) private apolloGetRequests: string[],\n ) {}\n\n getLink(): ApolloLink {\n return new ApolloLink((operation, forward) => {\n if(this.apolloGetRequests.indexOf(operation.operationName) > -1) {\n operation.setContext({ method: 'GET' });\n }\n return forward(operation);\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAM,MAAM,GAAG;;ACGf,MAAM,8BAA8B,GAAG,4BAA4B;AAE1E;;AAEG;AACG,MAAO,sBAAuB,SAAQ,oBAAoB,CAAA;AAG/D,IAAA,WAAA,CAAY,OAAgB,EAAA;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;AAHD,QAAA,IAAI,CAAA,IAAA,GAAW,8BAA8B,CAAC;KAI7D;AACD;;ACPe,SAAA,gCAAgC,CAC9C,KAAmB,EACnB,GAAM,EAAA;AAEN,IAAA,MAAM,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,sBAAsB,CAAC;AAE5E,IAAA,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAE;AACxC,CAAC;AAAA;;ACPD;;AAEG;AACH;AACgB,SAAA,yBAAyB,CAA6B,KAAU,EAAE,GAAM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,CAAC,EAAE;gBAC/D,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AACzC,aAAA;AACD,YAAA,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;AAC5B,SAAC,CAAC,CAAC;KACJ;;AAZU,iDAAA,CAAA,IAAA,GAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iDAAiD,kBAEpD,iCAAiC,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAF9B,iDAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iDAAiD,cAFhD,MAAM,EAAA,CAAA,CAAA;2FAEP,iDAAiD,EAAA,UAAA,EAAA,CAAA;kBAH7D,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;iBACnB,CAAA;;;8BAGE,MAAM;+BAAC,iCAAiC,CAAA;;;;ACpB3C;;AAEG;;;;"}
@@ -13,4 +13,4 @@ class DaffBadInputError extends DaffInheritableError {
13
13
  */
14
14
 
15
15
  export { DaffBadInputError };
16
- //# sourceMappingURL=daffodil-driver.js.map
16
+ //# sourceMappingURL=daffodil-driver.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daffodil-driver.mjs","sources":["../../../libs/driver/src/errors/bad-input.ts","../../../libs/driver/src/daffodil-driver.ts"],"sourcesContent":["import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nexport class DaffBadInputError extends DaffInheritableError implements DaffError {\n public readonly code: string = 'DAFF_BAD_INPUT';\n\n constructor(public message: string) {\n super(message);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAKM,MAAO,iBAAkB,SAAQ,oBAAoB,CAAA;AAGzD,IAAA,WAAA,CAAmB,OAAe,EAAA;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;AADE,QAAA,IAAO,CAAA,OAAA,GAAP,OAAO,CAAQ;AAFlB,QAAA,IAAI,CAAA,IAAA,GAAW,gBAAgB,CAAC;KAI/C;AACF;;ACXD;;AAEG;;;;"}
@@ -0,0 +1,56 @@
1
+ const jsonBuilder = (payload) => Object.keys(payload).map((key) => ({ name: key, value: payload[key] }));
2
+
3
+ class DaffHubspotFormsService {
4
+ constructor(http, document, route, title, config) {
5
+ this.http = http;
6
+ this.document = document;
7
+ this.route = route;
8
+ this.title = title;
9
+ this.config = config;
10
+ }
11
+ submit(payload) {
12
+ return this.http.post(this.generateUrl(this.config.portalId, this.config.guid, this.config.version), this.makeRequest(payload));
13
+ }
14
+ makeRequest(payload) {
15
+ return {
16
+ fields: [
17
+ ...jsonBuilder(payload),
18
+ ],
19
+ context: {
20
+ hutk: this.getCookie(),
21
+ pageUri: this.getPageURI(),
22
+ pageName: this.title.getTitle(),
23
+ },
24
+ };
25
+ }
26
+ generateUrl(portalId, guid, version) {
27
+ if (version === undefined) {
28
+ version = 'v3';
29
+ }
30
+ return 'https://api.hsforms.com/submissions/' + version + '/integration/submit/'
31
+ + portalId + '/' + guid;
32
+ }
33
+ getCookie() {
34
+ if (!this.document) {
35
+ return null;
36
+ }
37
+ const name = 'hubspotutk';
38
+ const v = this.document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
39
+ return v ? v[2] : null;
40
+ }
41
+ getPageURI() {
42
+ if (!this.route) {
43
+ return null;
44
+ }
45
+ return this.route.url;
46
+ }
47
+ }
48
+
49
+ const daffHubspotFormsServiceFactory = (http, document, router, title, config) => new DaffHubspotFormsService(http, document, router, title, config);
50
+
51
+ /**
52
+ * Generated bundle index. Do not edit.
53
+ */
54
+
55
+ export { DaffHubspotFormsService, daffHubspotFormsServiceFactory };
56
+ //# sourceMappingURL=daffodil-driver-hubspot.mjs.map