@daffodil/driver 0.94.1-rc.0 → 0.95.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.
- package/fesm2022/daffodil-driver-hubspot-testing.mjs +53 -38
- package/fesm2022/daffodil-driver-hubspot-testing.mjs.map +1 -1
- package/fesm2022/daffodil-driver-hubspot.mjs +41 -60
- package/fesm2022/daffodil-driver-hubspot.mjs.map +1 -1
- package/fesm2022/daffodil-driver-in-memory.mjs +186 -258
- package/fesm2022/daffodil-driver-in-memory.mjs.map +1 -1
- package/fesm2022/daffodil-driver-magento-2.4.7-testing.mjs +139 -0
- package/fesm2022/daffodil-driver-magento-2.4.7-testing.mjs.map +1 -0
- package/fesm2022/daffodil-driver-magento-2.4.7.mjs +543 -0
- package/fesm2022/daffodil-driver-magento-2.4.7.mjs.map +1 -0
- package/fesm2022/daffodil-driver-magento-auto-testing.mjs +7 -0
- package/fesm2022/daffodil-driver-magento-auto-testing.mjs.map +1 -0
- package/fesm2022/daffodil-driver-magento-auto.mjs +7 -0
- package/fesm2022/daffodil-driver-magento-auto.mjs.map +1 -0
- package/fesm2022/daffodil-driver-shopify-testing.mjs +359 -216
- package/fesm2022/daffodil-driver-shopify-testing.mjs.map +1 -1
- package/fesm2022/daffodil-driver-shopify.mjs +1090 -2289
- package/fesm2022/daffodil-driver-shopify.mjs.map +1 -1
- package/fesm2022/daffodil-driver.mjs +55 -54
- package/fesm2022/daffodil-driver.mjs.map +1 -1
- package/package.json +1 -1
- package/types/daffodil-driver-hubspot-testing.d.ts +12 -15
- package/types/daffodil-driver-hubspot.d.ts +44 -52
- package/types/daffodil-driver-in-memory.d.ts +104 -121
- package/types/daffodil-driver-magento-2.4.7-testing.d.ts +18 -0
- package/types/daffodil-driver-magento-2.4.7.d.ts +189 -0
- package/types/daffodil-driver-magento-auto-testing.d.ts +1 -0
- package/types/daffodil-driver-magento-auto.d.ts +1 -0
- package/types/daffodil-driver-shopify-testing.d.ts +112 -121
- package/types/daffodil-driver-shopify.d.ts +6902 -6943
- package/types/daffodil-driver.d.ts +32 -42
- package/fesm2022/daffodil-driver-magento-testing.mjs +0 -79
- package/fesm2022/daffodil-driver-magento-testing.mjs.map +0 -1
- package/fesm2022/daffodil-driver-magento.mjs +0 -998
- package/fesm2022/daffodil-driver-magento.mjs.map +0 -1
- package/types/daffodil-driver-magento-testing.d.ts +0 -23
- package/types/daffodil-driver-magento.d.ts +0 -225
|
@@ -1,41 +1,56 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import { Injectable } from
|
|
3
|
-
import { faker } from
|
|
4
|
-
import { DaffModelFactory } from
|
|
5
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Injectable } from "@angular/core";
|
|
3
|
+
import { faker } from "@faker-js/faker";
|
|
4
|
+
import { DaffModelFactory } from "@daffodil/core/testing";
|
|
6
5
|
const MockHubspotError = () => ({
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
message: faker.lorem.words(5),
|
|
7
|
+
errorType: faker.lorem.word()
|
|
8
|
+
});
|
|
9
|
+
var MockHubspotResponse = class {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.redirectUri = faker.internet.url();
|
|
12
|
+
this.inlineMessage = faker.lorem.words(5);
|
|
13
|
+
this.errors = Array(faker.number.int({
|
|
14
|
+
min: 1,
|
|
15
|
+
max: 5
|
|
16
|
+
})).fill(MockHubspotError);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
var DaffHubspotResponseFactory = class DaffHubspotResponseFactory extends DaffModelFactory {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(MockHubspotResponse);
|
|
22
|
+
}
|
|
23
|
+
static {
|
|
24
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
25
|
+
minVersion: "12.0.0",
|
|
26
|
+
version: "22.2.4",
|
|
27
|
+
ngImport: i0,
|
|
28
|
+
type: DaffHubspotResponseFactory,
|
|
29
|
+
deps: [],
|
|
30
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
static {
|
|
34
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
35
|
+
minVersion: "12.0.0",
|
|
36
|
+
version: "22.2.4",
|
|
37
|
+
ngImport: i0,
|
|
38
|
+
type: DaffHubspotResponseFactory,
|
|
39
|
+
providedIn: "root"
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
44
|
+
minVersion: "12.0.0",
|
|
45
|
+
version: "22.2.4",
|
|
46
|
+
ngImport: i0,
|
|
47
|
+
type: DaffHubspotResponseFactory,
|
|
48
|
+
decorators: [{
|
|
49
|
+
type: Injectable,
|
|
50
|
+
args: [{ providedIn: "root" }]
|
|
51
|
+
}],
|
|
52
|
+
ctorParameters: () => []
|
|
9
53
|
});
|
|
10
|
-
class MockHubspotResponse {
|
|
11
|
-
constructor() {
|
|
12
|
-
this.redirectUri = faker.internet.url();
|
|
13
|
-
this.inlineMessage = faker.lorem.words(5);
|
|
14
|
-
this.errors = Array(faker.number.int({ min: 1, max: 5 })).fill(MockHubspotError);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Model factory for {@link MockHubspotResponse}s.
|
|
19
|
-
*
|
|
20
|
-
* Should be used to create {@link MockHubspotResponse}s for testing purposes.
|
|
21
|
-
*/
|
|
22
|
-
class DaffHubspotResponseFactory extends DaffModelFactory {
|
|
23
|
-
constructor() {
|
|
24
|
-
super(MockHubspotResponse);
|
|
25
|
-
}
|
|
26
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffHubspotResponseFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
27
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffHubspotResponseFactory, providedIn: 'root' }); }
|
|
28
|
-
}
|
|
29
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffHubspotResponseFactory, decorators: [{
|
|
30
|
-
type: Injectable,
|
|
31
|
-
args: [{
|
|
32
|
-
providedIn: 'root',
|
|
33
|
-
}]
|
|
34
|
-
}], ctorParameters: () => [] });
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Generated bundle index. Do not edit.
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
54
|
export { DaffHubspotResponseFactory, MockHubspotResponse };
|
|
41
|
-
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=daffodil-driver-hubspot-testing.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-driver-hubspot-testing.mjs","sources":["../../../libs/driver/hubspot/testing/src/factories/hubspot-response.factory.ts"
|
|
1
|
+
{"version":3,"file":"daffodil-driver-hubspot-testing.mjs","names":[],"sources":["../../../libs/driver/hubspot/testing/src/factories/hubspot-response.factory.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { faker } from '@faker-js/faker';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport {\n HubspotError,\n HubspotResponse,\n} from '@daffodil/driver/hubspot';\n\nconst MockHubspotError = (): HubspotError => ({\n message: faker.lorem.words(5),\n errorType: faker.lorem.word(),\n});\n\nexport class MockHubspotResponse implements HubspotResponse {\n redirectUri? = faker.internet.url();\n inlineMessage = faker.lorem.words(5);\n errors: HubspotError[] = Array(faker.number.int({ min: 1, max: 5 })).fill(MockHubspotError);\n}\n\n/**\n * Model factory for {@link MockHubspotResponse}s.\n *\n * Should be used to create {@link MockHubspotResponse}s for testing purposes.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffHubspotResponseFactory extends DaffModelFactory<HubspotResponse>{\n constructor() {\n super(MockHubspotResponse);\n }\n}\n"],"mappings":";;;;AASA,MAAM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
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const name = 'hubspotutk';
|
|
41
|
-
const v = this.document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
|
|
42
|
-
return v ? v[2] : null;
|
|
43
|
-
}
|
|
44
|
-
getPageURI() {
|
|
45
|
-
if (!this.route) {
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
return this.route.url;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Factory for {@link DaffHubspotFormsService}.
|
|
54
|
-
*/
|
|
1
|
+
const jsonBuilder = (payload) => Object.keys(payload).map((key) => ({
|
|
2
|
+
name: key,
|
|
3
|
+
value: payload[key]
|
|
4
|
+
}));
|
|
5
|
+
var DaffHubspotFormsService = class {
|
|
6
|
+
constructor(http, document, route, title, config) {
|
|
7
|
+
this.http = http;
|
|
8
|
+
this.document = document;
|
|
9
|
+
this.route = route;
|
|
10
|
+
this.title = title;
|
|
11
|
+
this.config = config;
|
|
12
|
+
}
|
|
13
|
+
submit(payload) {
|
|
14
|
+
return this.http.post(this.generateUrl(this.config.portalId, this.config.guid, this.config.version), this.makeRequest(payload));
|
|
15
|
+
}
|
|
16
|
+
makeRequest(payload) {
|
|
17
|
+
return {
|
|
18
|
+
fields: [...jsonBuilder(payload)],
|
|
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 === void 0) version = "v3";
|
|
28
|
+
return "https://api.hsforms.com/submissions/" + version + "/integration/submit/" + portalId + "/" + guid;
|
|
29
|
+
}
|
|
30
|
+
getCookie() {
|
|
31
|
+
if (!this.document) return null;
|
|
32
|
+
const v = this.document.cookie.match("(^|;) ?hubspotutk=([^;]*)(;|$)");
|
|
33
|
+
return v ? v[2] : null;
|
|
34
|
+
}
|
|
35
|
+
getPageURI() {
|
|
36
|
+
if (!this.route) return null;
|
|
37
|
+
return this.route.url;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
55
40
|
const daffHubspotFormsServiceFactory = (http, document, router, title, config) => new DaffHubspotFormsService(http, document, router, title, config);
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Generated bundle index. Do not edit.
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
41
|
export { DaffHubspotFormsService, daffHubspotFormsServiceFactory };
|
|
62
|
-
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=daffodil-driver-hubspot.mjs.map
|
|
@@ -1 +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"
|
|
1
|
+
{"version":3,"file":"daffodil-driver-hubspot.mjs","names":[],"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"],"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 { DaffHubspotFormsInterface } from './models/forms';\nimport { DaffHubspotRequest } from './models/hubspot-request';\nimport { HubspotResponse } from './models/hubspot-response';\nimport { jsonBuilder } from './transformers/json-builder';\n\n/**\n * Service for interacting with Hubspot Forms API.\n */\nexport class DaffHubspotFormsService implements DaffHubspotFormsInterface {\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';\nimport { DaffHubspotFormsInterface } from './models/forms';\n\n/**\n * Factory for {@link DaffHubspotFormsService}.\n */\nexport const daffHubspotFormsServiceFactory = (\n http: HttpClient,\n document: Document,\n router: Router,\n title: Title,\n config: DaffHubspotConfig,\n): DaffHubspotFormsInterface => new DaffHubspotFormsService(http, document, router, title, config);\n"],"mappings":"AAGA,MAAa,eAAe,YAA+C,OAAO,KAAK,OAAO,CAAC,CAAC,KAAK,SAAS;CAAE,MAAM;CAAK,OAAO,QAAQ;AAAI,EAAG;ACWjJ,IAAa,0BAAb,MAAoC;CAClC,YACU,MACA,UACA,OACA,OACA,QAAyB;EAJzB,KAAA,OAAA;EACA,KAAA,WAAA;EACA,KAAA,QAAA;EACA,KAAA,QAAA;EACA,KAAA,SAAA;CAA6B;CAGvC,OAAO,SAA4B;EACjC,OAAO,KAAK,KAAK,KACf,KAAK,YAAY,KAAK,OAAO,UAAU,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,GAC5E,KAAK,YAAY,OAAO,CAAC;CAE7B;CAEQ,YAAY,SAAO;EACzB,OAAO;GACL,QAAQ,CACN,GAAG,YAAY,OAAO,CACvB;GACD,SAAS;IACP,MAAM,KAAK,UAAS;IACpB,SAAS,KAAK,WAAU;IACxB,UAAU,KAAK,MAAM,SAAQ;GAC9B;EACF;CACH;CAEQ,YAAY,UAAkB,MAAc,SAAe;EACjE,IAAI,YAAY,QACd,UAAU;EAEZ,OAAO,yCAAyC,UAAU,yBACtD,WAAW,MAAM;CACvB;CACQ,YAAS;EACf,IAAI,CAAC,KAAK,UACR,OAAO;EAGT,MAAM,IAAI,KAAK,SAAS,OAAO,MAAM,gCAAkC;EACvE,OAAO,IAAI,EAAE,KAAK;CACpB;CACQ,aAAU;EAChB,IAAI,CAAC,KAAK,OACR,OAAO;EAET,OAAO,KAAK,MAAM;CACpB;AACD;ACrDD,MAAa,kCACX,MACA,UACA,QACA,OACA,WAC8B,IAAI,wBAAwB,MAAM,UAAU,QAAQ,OAAO,MAAM"}
|