@daffodil/driver 0.38.6

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 (92) hide show
  1. package/README.md +3 -0
  2. package/bundles/daffodil-driver-hubspot.umd.js +384 -0
  3. package/bundles/daffodil-driver-hubspot.umd.js.map +1 -0
  4. package/bundles/daffodil-driver-hubspot.umd.min.js +16 -0
  5. package/bundles/daffodil-driver-hubspot.umd.min.js.map +1 -0
  6. package/bundles/daffodil-driver-magento-testing.umd.js +386 -0
  7. package/bundles/daffodil-driver-magento-testing.umd.js.map +1 -0
  8. package/bundles/daffodil-driver-magento-testing.umd.min.js +16 -0
  9. package/bundles/daffodil-driver-magento-testing.umd.min.js.map +1 -0
  10. package/bundles/daffodil-driver-magento.umd.js +199 -0
  11. package/bundles/daffodil-driver-magento.umd.js.map +1 -0
  12. package/bundles/daffodil-driver-magento.umd.min.js +2 -0
  13. package/bundles/daffodil-driver-magento.umd.min.js.map +1 -0
  14. package/bundles/daffodil-driver.umd.js +345 -0
  15. package/bundles/daffodil-driver.umd.js.map +1 -0
  16. package/bundles/daffodil-driver.umd.min.js +16 -0
  17. package/bundles/daffodil-driver.umd.min.js.map +1 -0
  18. package/daffodil-driver.d.ts +4 -0
  19. package/daffodil-driver.metadata.json +1 -0
  20. package/errors/bad-input.d.ts +6 -0
  21. package/errors/public_api.d.ts +1 -0
  22. package/esm2015/daffodil-driver.js +5 -0
  23. package/esm2015/errors/bad-input.js +9 -0
  24. package/esm2015/errors/public_api.js +2 -0
  25. package/esm2015/hubspot/daffodil-driver-hubspot.js +5 -0
  26. package/esm2015/hubspot/hubspot-forms.provider.js +3 -0
  27. package/esm2015/hubspot/hubspot-forms.service.js +47 -0
  28. package/esm2015/hubspot/index.js +3 -0
  29. package/esm2015/hubspot/models/config.js +1 -0
  30. package/esm2015/hubspot/models/hubspot-request.js +1 -0
  31. package/esm2015/hubspot/models/hubspot-response.js +1 -0
  32. package/esm2015/hubspot/transformers/json-builder.js +2 -0
  33. package/esm2015/index.js +2 -0
  34. package/esm2015/magento/daffodil-driver-magento.js +5 -0
  35. package/esm2015/magento/errors/public_api.js +2 -0
  36. package/esm2015/magento/errors/transform.js +22 -0
  37. package/esm2015/magento/graphql/cacheable-operations/apollo-cacheable-operations-link-generator.js +33 -0
  38. package/esm2015/magento/graphql/cacheable-operations/cacheable-operations-token.js +29 -0
  39. package/esm2015/magento/graphql/public_api.js +3 -0
  40. package/esm2015/magento/index.js +5 -0
  41. package/esm2015/magento/models/public_api.js +2 -0
  42. package/esm2015/magento/models/responses/discount.js +1 -0
  43. package/esm2015/magento/models/responses/money.js +1 -0
  44. package/esm2015/magento/models/responses/public_api.js +1 -0
  45. package/esm2015/magento/schema/introspection.json +90 -0
  46. package/esm2015/magento/schema/schema.js +3 -0
  47. package/esm2015/magento/testing/daffodil-driver-magento-testing.js +5 -0
  48. package/esm2015/magento/testing/factories/discount.factory.js +29 -0
  49. package/esm2015/magento/testing/factories/money.factory.js +25 -0
  50. package/esm2015/magento/testing/factories/public_api.js +3 -0
  51. package/esm2015/magento/testing/index.js +2 -0
  52. package/fesm2015/daffodil-driver-hubspot.js +56 -0
  53. package/fesm2015/daffodil-driver-hubspot.js.map +1 -0
  54. package/fesm2015/daffodil-driver-magento-testing.js +55 -0
  55. package/fesm2015/daffodil-driver-magento-testing.js.map +1 -0
  56. package/fesm2015/daffodil-driver-magento.js +181 -0
  57. package/fesm2015/daffodil-driver-magento.js.map +1 -0
  58. package/fesm2015/daffodil-driver.js +16 -0
  59. package/fesm2015/daffodil-driver.js.map +1 -0
  60. package/hubspot/daffodil-driver-hubspot.d.ts +4 -0
  61. package/hubspot/daffodil-driver-hubspot.metadata.json +1 -0
  62. package/hubspot/hubspot-forms.provider.d.ts +6 -0
  63. package/hubspot/hubspot-forms.service.d.ts +19 -0
  64. package/hubspot/index.d.ts +4 -0
  65. package/hubspot/models/config.d.ts +5 -0
  66. package/hubspot/models/hubspot-request.d.ts +15 -0
  67. package/hubspot/models/hubspot-response.d.ts +9 -0
  68. package/hubspot/package.json +11 -0
  69. package/hubspot/transformers/json-builder.d.ts +2 -0
  70. package/index.d.ts +1 -0
  71. package/magento/daffodil-driver-magento.d.ts +4 -0
  72. package/magento/daffodil-driver-magento.metadata.json +1 -0
  73. package/magento/errors/public_api.d.ts +1 -0
  74. package/magento/errors/transform.d.ts +5 -0
  75. package/magento/graphql/cacheable-operations/apollo-cacheable-operations-link-generator.d.ts +12 -0
  76. package/magento/graphql/cacheable-operations/cacheable-operations-token.d.ts +24 -0
  77. package/magento/graphql/public_api.d.ts +2 -0
  78. package/magento/index.d.ts +4 -0
  79. package/magento/models/public_api.d.ts +1 -0
  80. package/magento/models/responses/discount.d.ts +6 -0
  81. package/magento/models/responses/money.d.ts +5 -0
  82. package/magento/models/responses/public_api.d.ts +2 -0
  83. package/magento/package.json +11 -0
  84. package/magento/schema/schema.d.ts +21 -0
  85. package/magento/testing/daffodil-driver-magento-testing.d.ts +4 -0
  86. package/magento/testing/daffodil-driver-magento-testing.metadata.json +1 -0
  87. package/magento/testing/factories/discount.factory.d.ts +11 -0
  88. package/magento/testing/factories/money.factory.d.ts +10 -0
  89. package/magento/testing/factories/public_api.d.ts +2 -0
  90. package/magento/testing/index.d.ts +1 -0
  91. package/magento/testing/package.json +11 -0
  92. package/package.json +31 -0
@@ -0,0 +1,2 @@
1
+ export * from './factories/public_api';
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiL2hvbWUvZ3JpZXN0L2dyYXljb3JlaW8vZGFmZm9kaWwvbGlicy9kcml2ZXIvbWFnZW50by90ZXN0aW5nL3NyYy8iLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsd0JBQXdCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2ZhY3Rvcmllcy9wdWJsaWNfYXBpJztcbiJdfQ==
@@ -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.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daffodil-driver-hubspot.js","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;IAElC,YACU,IAAgB,EAChB,QAAkB,EAClB,KAAa,EACb,KAAY,EACZ,MAAyB;QAJzB,SAAI,GAAJ,IAAI,CAAY;QAChB,aAAQ,GAAR,QAAQ,CAAU;QAClB,UAAK,GAAL,KAAK,CAAQ;QACb,UAAK,GAAL,KAAK,CAAO;QACZ,WAAM,GAAN,MAAM,CAAmB;KAAK;IAGxC,MAAM,CAAC,OAA4B;QACjC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CACnB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAC7E,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAC1B,CAAC;KACH;IAEO,WAAW,CAAC,OAAO;QACzB,OAAO;YACL,MAAM,EAAE;gBACN,GAAG,WAAW,CAAC,OAAO,CAAC;aACxB;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE;gBACtB,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE;gBAC1B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;aAChC;SACF,CAAC;KACH;IAEO,WAAW,CAAC,QAAgB,EAAE,IAAY,EAAE,OAAe;QACjE,IAAI,OAAO,KAAK,SAAS,EAAE;YACzB,OAAO,GAAG,IAAI,CAAC;SAChB;QACD,OAAO,sCAAsC,GAAG,OAAO,GAAG,sBAAsB;cAC5E,QAAQ,GAAG,GAAG,GAAG,IAAI,CAAC;KAC3B;IACO,SAAS;QACf,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,OAAO,IAAI,CAAC;SACb;QACD,MAAM,IAAI,GAAG,YAAY,CAAC;QAC1B,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI,GAAG,eAAe,CAAC,CAAC;QACzE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;KACxB;IACO,UAAU;QAChB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACf,OAAO,IAAI,CAAC;SACb;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;KACvB;;;MCpDU,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;;;;;;"}
@@ -0,0 +1,55 @@
1
+ import { ɵɵdefineInjectable, Injectable } from '@angular/core';
2
+ import { datatype, random } from 'faker/locale/en_US';
3
+ import { DaffModelFactory } from '@daffodil/core/testing';
4
+
5
+ class MockMagentoMoney {
6
+ constructor() {
7
+ this.__typename = 'Money';
8
+ this.value = datatype.number({ min: 1, max: 10000 });
9
+ this.currency = random.word();
10
+ }
11
+ }
12
+ ;
13
+ class MagentoMoneyFactory extends DaffModelFactory {
14
+ constructor() {
15
+ super(MockMagentoMoney);
16
+ }
17
+ }
18
+ MagentoMoneyFactory.ɵprov = ɵɵdefineInjectable({ factory: function MagentoMoneyFactory_Factory() { return new MagentoMoneyFactory(); }, token: MagentoMoneyFactory, providedIn: "root" });
19
+ MagentoMoneyFactory.decorators = [
20
+ { type: Injectable, args: [{
21
+ providedIn: 'root',
22
+ },] }
23
+ ];
24
+ MagentoMoneyFactory.ctorParameters = () => [];
25
+
26
+ class MockMagentoDiscount {
27
+ constructor() {
28
+ this.__typename = 'Discount';
29
+ this.amount = this.money();
30
+ this.label = random.word();
31
+ }
32
+ money() {
33
+ return (new MagentoMoneyFactory()).create();
34
+ }
35
+ }
36
+ ;
37
+ class MagentoDiscountFactory extends DaffModelFactory {
38
+ constructor() {
39
+ super(MockMagentoDiscount);
40
+ }
41
+ }
42
+ MagentoDiscountFactory.ɵprov = ɵɵdefineInjectable({ factory: function MagentoDiscountFactory_Factory() { return new MagentoDiscountFactory(); }, token: MagentoDiscountFactory, providedIn: "root" });
43
+ MagentoDiscountFactory.decorators = [
44
+ { type: Injectable, args: [{
45
+ providedIn: 'root',
46
+ },] }
47
+ ];
48
+ MagentoDiscountFactory.ctorParameters = () => [];
49
+
50
+ /**
51
+ * Generated bundle index. Do not edit.
52
+ */
53
+
54
+ export { MagentoDiscountFactory, MagentoMoneyFactory };
55
+ //# sourceMappingURL=daffodil-driver-magento-testing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daffodil-driver-magento-testing.js","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/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/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":["faker.datatype","faker.random"],"mappings":";;;;MAMa,gBAAgB;IAA7B;QACC,eAAU,GAAG,OAAO,CAAC;QACpB,UAAK,GAAGA,QAAc,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;QACtD,aAAQ,GAAGC,MAAY,CAAC,IAAI,EAAE,CAAC;KAChC;CAAA;AAAA,CAAC;MAKW,mBAAoB,SAAQ,gBAA8B;IACrE;QACE,KAAK,CAAC,gBAAgB,CAAC,CAAC;KACzB;;;;YANF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;;MCHY,mBAAmB;IAAhC;QACC,eAAU,GAAG,UAAU,CAAC;QACvB,WAAM,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QACtB,UAAK,GAAGA,MAAY,CAAC,IAAI,EAAE,CAAC;KAK7B;IAHS,KAAK;QACX,OAAO,CAAC,IAAI,mBAAmB,EAAE,EAAE,MAAM,EAAE,CAAC;KAC7C;CACF;AAAA,CAAC;MAKW,sBAAuB,SAAQ,gBAAiC;IAC3E;QACE,KAAK,CAAC,mBAAmB,CAAC,CAAC;KAC5B;;;;YANF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;;ACvBD;;;;;;"}
@@ -0,0 +1,181 @@
1
+ import { InjectionToken, ɵɵdefineInjectable, ɵɵinject, Injectable, Inject } from '@angular/core';
2
+ import { ApolloLink } from '@apollo/client/core';
3
+
4
+ var possibleTypes = {
5
+ CartAddressInterface: [
6
+ "BillingCartAddress",
7
+ "ShippingCartAddress"
8
+ ],
9
+ CartItemInterface: [
10
+ "SimpleCartItem",
11
+ "VirtualCartItem",
12
+ "DownloadableCartItem",
13
+ "BundleCartItem",
14
+ "ConfigurableCartItem"
15
+ ],
16
+ ProductInterface: [
17
+ "VirtualProduct",
18
+ "SimpleProduct",
19
+ "DownloadableProduct",
20
+ "BundleProduct",
21
+ "GroupedProduct",
22
+ "ConfigurableProduct"
23
+ ],
24
+ CategoryInterface: [
25
+ "CategoryTree"
26
+ ],
27
+ MediaGalleryInterface: [
28
+ "ProductImage",
29
+ "ProductVideo"
30
+ ],
31
+ ProductLinksInterface: [
32
+ "ProductLinks"
33
+ ],
34
+ CreditMemoItemInterface: [
35
+ "DownloadableCreditMemoItem",
36
+ "BundleCreditMemoItem",
37
+ "CreditMemoItem"
38
+ ],
39
+ OrderItemInterface: [
40
+ "DownloadableOrderItem",
41
+ "BundleOrderItem",
42
+ "OrderItem"
43
+ ],
44
+ InvoiceItemInterface: [
45
+ "DownloadableInvoiceItem",
46
+ "BundleInvoiceItem",
47
+ "InvoiceItem"
48
+ ],
49
+ ShipmentItemInterface: [
50
+ "BundleShipmentItem",
51
+ "ShipmentItem"
52
+ ],
53
+ AggregationOptionInterface: [
54
+ "AggregationOption"
55
+ ],
56
+ LayerFilterItemInterface: [
57
+ "LayerFilterItem",
58
+ "SwatchLayerFilterItem"
59
+ ],
60
+ PhysicalProductInterface: [
61
+ "SimpleProduct",
62
+ "BundleProduct",
63
+ "GroupedProduct",
64
+ "ConfigurableProduct"
65
+ ],
66
+ CustomizableOptionInterface: [
67
+ "CustomizableAreaOption",
68
+ "CustomizableDateOption",
69
+ "CustomizableDropDownOption",
70
+ "CustomizableMultipleOption",
71
+ "CustomizableFieldOption",
72
+ "CustomizableFileOption",
73
+ "CustomizableRadioOption",
74
+ "CustomizableCheckboxOption"
75
+ ],
76
+ CustomizableProductInterface: [
77
+ "VirtualProduct",
78
+ "SimpleProduct",
79
+ "DownloadableProduct",
80
+ "BundleProduct",
81
+ "ConfigurableProduct"
82
+ ],
83
+ SwatchDataInterface: [
84
+ "ImageSwatchData",
85
+ "TextSwatchData",
86
+ "ColorSwatchData"
87
+ ],
88
+ SwatchLayerFilterItemInterface: [
89
+ "SwatchLayerFilterItem"
90
+ ]
91
+ };
92
+ var introspectionQueryResultData = {
93
+ possibleTypes: possibleTypes
94
+ };
95
+
96
+ const schema = introspectionQueryResultData;
97
+
98
+ function transformGraphQlError(error, map) {
99
+ if (!error.graphQLErrors.length) {
100
+ return error;
101
+ }
102
+ const lookup = map[error.graphQLErrors[0].extensions.category];
103
+ return lookup ? new lookup(error.message) : error;
104
+ }
105
+ ;
106
+ /**
107
+ * Transforms the passed error according to the lookup in the passed map.
108
+ */
109
+ function daffTransformMagentoError(error, map) {
110
+ // TODO: handle network errors
111
+ if (error.graphQLErrors) {
112
+ return transformGraphQlError(error, map);
113
+ }
114
+ else {
115
+ return error;
116
+ }
117
+ }
118
+ ;
119
+
120
+ /**
121
+ * A multi-provider injection token of the operation names of magento queries that should
122
+ * be cached. This is needed because queries need to be converted into GET queries in order for Magento
123
+ * to cache them. This token should be used by daffodil driver platform modules to register operation names that are cacheable, and is
124
+ * intended for internal daffodil use only.
125
+ */
126
+ const DAFF_MAGENTO_CACHEABLE_OPERATIONS = new InjectionToken('DAFF_MAGENTO_CACHEABLE_OPERATIONS', { factory: () => [] });
127
+ /**
128
+ * Adds an operation name to the list of cacheable Magento operations. Use only with Angular 9+.
129
+ */
130
+ function provideDaffMagentoCacheableOperation(operationName) {
131
+ return {
132
+ provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,
133
+ useValue: operationName,
134
+ multi: true,
135
+ };
136
+ }
137
+ /**
138
+ * Adds many operation names to the list of cacheable Magento operations. Use only with Angular 9+.
139
+ */
140
+ function provideManyDaffMagentoCacheableOperations(...operationNames) {
141
+ return operationNames.map(name => ({
142
+ provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,
143
+ useValue: name,
144
+ multi: true,
145
+ }));
146
+ }
147
+
148
+ /**
149
+ * A service that will convert cacheable apollo operations into a format that Magento will understand as cacheable.
150
+ *
151
+ * @inheritdoc
152
+ */
153
+ class DaffMagentoApolloCacheableOperationsLinkGenerator {
154
+ constructor(apolloGetRequests) {
155
+ this.apolloGetRequests = apolloGetRequests;
156
+ }
157
+ getLink() {
158
+ return new ApolloLink((operation, forward) => {
159
+ if (this.apolloGetRequests.indexOf(operation.operationName) > -1) {
160
+ operation.setContext({ method: 'GET' });
161
+ }
162
+ return forward(operation);
163
+ });
164
+ }
165
+ }
166
+ DaffMagentoApolloCacheableOperationsLinkGenerator.ɵprov = ɵɵdefineInjectable({ factory: function DaffMagentoApolloCacheableOperationsLinkGenerator_Factory() { return new DaffMagentoApolloCacheableOperationsLinkGenerator(ɵɵinject(DAFF_MAGENTO_CACHEABLE_OPERATIONS)); }, token: DaffMagentoApolloCacheableOperationsLinkGenerator, providedIn: "root" });
167
+ DaffMagentoApolloCacheableOperationsLinkGenerator.decorators = [
168
+ { type: Injectable, args: [{
169
+ providedIn: 'root',
170
+ },] }
171
+ ];
172
+ DaffMagentoApolloCacheableOperationsLinkGenerator.ctorParameters = () => [
173
+ { type: Array, decorators: [{ type: Inject, args: [DAFF_MAGENTO_CACHEABLE_OPERATIONS,] }] }
174
+ ];
175
+
176
+ /**
177
+ * Generated bundle index. Do not edit.
178
+ */
179
+
180
+ export { DAFF_MAGENTO_CACHEABLE_OPERATIONS, DaffMagentoApolloCacheableOperationsLinkGenerator, daffTransformMagentoError, provideDaffMagentoCacheableOperation, provideManyDaffMagentoCacheableOperations, schema };
181
+ //# sourceMappingURL=daffodil-driver-magento.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daffodil-driver-magento.js","sources":["../../../libs/driver/magento/src/schema/schema.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 { ApolloError } from '@apollo/client/core';\n\nimport { DaffErrorCodeMap } from '@daffodil/core';\n\nfunction transformGraphQlError<T extends DaffErrorCodeMap>(\n error: ApolloError,\n map: T,\n): Error {\n if (!error.graphQLErrors.length) {\n return error;\n }\n const lookup = map[error.graphQLErrors[0].extensions.category];\n return lookup ? new lookup(error.message) : error;\n};\n\n/**\n * Transforms the passed error according to the lookup in the passed map.\n */\nexport function daffTransformMagentoError<T extends DaffErrorCodeMap>(error: any, map: T): Error {\n // TODO: handle network errors\n if (error.graphQLErrors) {\n return transformGraphQlError<T>(error, map);\n } else {\n return error;\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAEa,MAAM,GAAG;;ACEtB,SAAS,qBAAqB,CAC5B,KAAkB,EAClB,GAAM;IAEN,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE;QAC/B,OAAO,KAAK,CAAC;KACd;IACD,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC/D,OAAO,MAAM,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;AACpD,CAAC;AAAA,CAAC;AAEF;;;SAGgB,yBAAyB,CAA6B,KAAU,EAAE,GAAM;;IAEtF,IAAI,KAAK,CAAC,aAAa,EAAE;QACvB,OAAO,qBAAqB,CAAI,KAAK,EAAE,GAAG,CAAC,CAAC;KAC7C;SAAM;QACL,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AAAA;;ACvBD;;;;;;MAMa,iCAAiC,GAAG,IAAI,cAAc,CAAW,mCAAmC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAC,EAAE;AAEzI;;;SAGgB,oCAAoC,CAAC,aAAqB;IACxE,OAAO;QACL,OAAO,EAAE,iCAAiC;QAC1C,QAAQ,EAAE,aAAa;QACvB,KAAK,EAAE,IAAI;KACZ,CAAC;AACJ,CAAC;AAED;;;SAGgB,yCAAyC,CAAC,GAAG,cAAwB;IACnF,OAAO,cAAc,CAAC,GAAG,CAAC,IAAI,KAAK;QACjC,OAAO,EAAE,iCAAiC;QAC1C,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC,CAAC;AACN;;ACpBA;;;;;MAQa,iDAAiD;IAC5D,YACmD,iBAA2B;QAA3B,sBAAiB,GAAjB,iBAAiB,CAAU;KAC1E;IAEJ,OAAO;QACL,OAAO,IAAI,UAAU,CAAC,CAAC,SAAS,EAAE,OAAO;YACvC,IAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE;gBAC/D,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;aACzC;YACD,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;SAC3B,CAAC,CAAC;KACJ;;;;YAfF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;wCAGE,MAAM,SAAC,iCAAiC;;;ACpB3C;;;;;;"}
@@ -0,0 +1,16 @@
1
+ import { DaffInheritableError } from '@daffodil/core';
2
+
3
+ class DaffBadInputError extends DaffInheritableError {
4
+ constructor(message) {
5
+ super(message);
6
+ this.message = message;
7
+ this.code = 'DAFF_BAD_INPUT';
8
+ }
9
+ }
10
+
11
+ /**
12
+ * Generated bundle index. Do not edit.
13
+ */
14
+
15
+ export { DaffBadInputError };
16
+ //# sourceMappingURL=daffodil-driver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daffodil-driver.js","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":";;MAKa,iBAAkB,SAAQ,oBAAoB;IAGzD,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QADE,YAAO,GAAP,OAAO,CAAQ;QAFlB,SAAI,GAAW,gBAAgB,CAAC;KAI/C;;;ACVH;;;;;;"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './index';
@@ -0,0 +1 @@
1
+ {"__symbolic":"module","version":4,"metadata":{"DaffHubspotFormsService":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/common/http","name":"HttpClient","line":13,"character":18},{"__symbolic":"error","message":"Could not resolve type","line":14,"character":22,"context":{"typeName":"Document"},"module":"./hubspot-forms.service"},{"__symbolic":"reference","module":"@angular/router","name":"Router","line":15,"character":19},{"__symbolic":"reference","module":"@angular/platform-browser","name":"Title","line":16,"character":19},{"__symbolic":"reference","name":"DaffHubspotConfig"}]}],"submit":[{"__symbolic":"method"}],"makeRequest":[{"__symbolic":"method"}],"generateUrl":[{"__symbolic":"method"}],"getCookie":[{"__symbolic":"method"}],"getPageURI":[{"__symbolic":"method"}]}},"DaffHubspotConfig":{"__symbolic":"interface"},"DaffHubspotRequest":{"__symbolic":"interface"},"daffHubspotFormsServiceFactory":{"__symbolic":"error","message":"Lambda not supported","line":8,"character":46,"module":"./hubspot-forms.provider"}},"origins":{"DaffHubspotFormsService":"./hubspot-forms.service","DaffHubspotConfig":"./models/config","DaffHubspotRequest":"./models/hubspot-request","daffHubspotFormsServiceFactory":"./hubspot-forms.provider"},"importAs":"@daffodil/driver/hubspot"}
@@ -0,0 +1,6 @@
1
+ import { HttpClient } from '@angular/common/http';
2
+ import { Title } from '@angular/platform-browser';
3
+ import { Router } from '@angular/router';
4
+ import { DaffHubspotFormsService } from './hubspot-forms.service';
5
+ import { DaffHubspotConfig } from './models/config';
6
+ export declare const daffHubspotFormsServiceFactory: (http: HttpClient, document: Document, router: Router, title: Title, config: DaffHubspotConfig) => DaffHubspotFormsService;
@@ -0,0 +1,19 @@
1
+ import { HttpClient } from '@angular/common/http';
2
+ import { Title } from '@angular/platform-browser';
3
+ import { Router } from '@angular/router';
4
+ import { Observable } from 'rxjs';
5
+ import { DaffHubspotConfig } from './models/config';
6
+ import { HubspotResponse } from './models/hubspot-response';
7
+ export declare class DaffHubspotFormsService {
8
+ private http;
9
+ private document;
10
+ private route;
11
+ private title;
12
+ private config;
13
+ constructor(http: HttpClient, document: Document, route: Router, title: Title, config: DaffHubspotConfig);
14
+ submit(payload: Record<string, any>): Observable<HubspotResponse>;
15
+ private makeRequest;
16
+ private generateUrl;
17
+ private getCookie;
18
+ private getPageURI;
19
+ }
@@ -0,0 +1,4 @@
1
+ export { DaffHubspotFormsService } from './hubspot-forms.service';
2
+ export { DaffHubspotConfig } from './models/config';
3
+ export { DaffHubspotRequest } from './models/hubspot-request';
4
+ export { daffHubspotFormsServiceFactory } from './hubspot-forms.provider';
@@ -0,0 +1,5 @@
1
+ export interface DaffHubspotConfig {
2
+ portalId: string;
3
+ guid: string;
4
+ version?: string;
5
+ }
@@ -0,0 +1,15 @@
1
+ export interface DaffHubspotRequest {
2
+ fields: FieldValue[];
3
+ context?: HubspotContext;
4
+ }
5
+ export interface HubspotContext {
6
+ hutk?: string;
7
+ ipAddress?: string;
8
+ pageName?: string;
9
+ pageUri?: string;
10
+ pageId?: string;
11
+ }
12
+ export interface FieldValue {
13
+ name: string;
14
+ value: string;
15
+ }
@@ -0,0 +1,9 @@
1
+ export interface HubspotError {
2
+ errorType: string;
3
+ message: string;
4
+ }
5
+ export interface HubspotResponse {
6
+ redirectUri?: string;
7
+ inlineMessage: string;
8
+ errors: HubspotError[];
9
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "@daffodil/driver/hubspot",
3
+ "main": "../bundles/daffodil-driver-hubspot.umd.js",
4
+ "module": "../fesm2015/daffodil-driver-hubspot.js",
5
+ "es2015": "../fesm2015/daffodil-driver-hubspot.js",
6
+ "esm2015": "../esm2015/hubspot/daffodil-driver-hubspot.js",
7
+ "fesm2015": "../fesm2015/daffodil-driver-hubspot.js",
8
+ "typings": "daffodil-driver-hubspot.d.ts",
9
+ "metadata": "daffodil-driver-hubspot.metadata.json",
10
+ "sideEffects": false
11
+ }
@@ -0,0 +1,2 @@
1
+ import { FieldValue } from '../models/hubspot-request';
2
+ export declare const jsonBuilder: (payload: Record<string, any>) => FieldValue[];
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './errors/public_api';
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './index';
@@ -0,0 +1 @@
1
+ {"__symbolic":"module","version":4,"metadata":{"daffTransformMagentoError":{"__symbolic":"function"},"MagentoMoney":{"__symbolic":"interface"},"MagentoDiscount":{"__symbolic":"interface"},"DaffMagentoApolloCacheableOperationsLinkGenerator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":15,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":20,"character":3},"arguments":[{"__symbolic":"reference","name":"DAFF_MAGENTO_CACHEABLE_OPERATIONS"}]}]],"parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"string"}]}]}],"getLink":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}},"DAFF_MAGENTO_CACHEABLE_OPERATIONS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":8,"character":53},"arguments":["DAFF_MAGENTO_CACHEABLE_OPERATIONS",{"__symbolic":"error","message":"Lambda not supported","line":8,"character":126,"module":"./graphql/cacheable-operations/cacheable-operations-token"}]},"provideDaffMagentoCacheableOperation":{"__symbolic":"function","parameters":["operationName"],"value":{"provide":{"__symbolic":"reference","name":"DAFF_MAGENTO_CACHEABLE_OPERATIONS"},"useValue":{"__symbolic":"reference","name":"operationName"},"multi":true}},"provideManyDaffMagentoCacheableOperations":{"__symbolic":"function","parameters":["operationNames"],"value":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"operationNames"},"member":"map"},"arguments":[{"__symbolic":"error","message":"Lambda not supported","line":25,"character":28,"module":"./graphql/cacheable-operations/cacheable-operations-token"}]}}},"origins":{"schema":"./schema/schema","daffTransformMagentoError":"./errors/transform","MagentoMoney":"./models/responses/money","MagentoDiscount":"./models/responses/discount","DaffMagentoApolloCacheableOperationsLinkGenerator":"./graphql/cacheable-operations/apollo-cacheable-operations-link-generator","DAFF_MAGENTO_CACHEABLE_OPERATIONS":"./graphql/cacheable-operations/cacheable-operations-token","provideDaffMagentoCacheableOperation":"./graphql/cacheable-operations/cacheable-operations-token","provideManyDaffMagentoCacheableOperations":"./graphql/cacheable-operations/cacheable-operations-token"},"importAs":"@daffodil/driver/magento"}
@@ -0,0 +1 @@
1
+ export { daffTransformMagentoError } from './transform';
@@ -0,0 +1,5 @@
1
+ import { DaffErrorCodeMap } from '@daffodil/core';
2
+ /**
3
+ * Transforms the passed error according to the lookup in the passed map.
4
+ */
5
+ export declare function daffTransformMagentoError<T extends DaffErrorCodeMap>(error: any, map: T): Error;