@daffodil/customer-store-credit 0.94.1 → 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-customer-store-credit-driver-in-memory.mjs +147 -116
- package/fesm2022/daffodil-customer-store-credit-driver-in-memory.mjs.map +1 -1
- package/fesm2022/daffodil-customer-store-credit-driver-magento-2.4.7-testing.mjs +51 -0
- package/fesm2022/daffodil-customer-store-credit-driver-magento-2.4.7-testing.mjs.map +1 -0
- package/fesm2022/daffodil-customer-store-credit-driver-magento-2.4.7.mjs +157 -0
- package/fesm2022/daffodil-customer-store-credit-driver-magento-2.4.7.mjs.map +1 -0
- package/fesm2022/daffodil-customer-store-credit-driver-magento-auto-testing.mjs +7 -0
- package/fesm2022/daffodil-customer-store-credit-driver-magento-auto-testing.mjs.map +1 -0
- package/fesm2022/daffodil-customer-store-credit-driver-magento-auto.mjs +7 -0
- package/fesm2022/daffodil-customer-store-credit-driver-magento-auto.mjs.map +1 -0
- package/fesm2022/daffodil-customer-store-credit-driver-testing.mjs +93 -60
- package/fesm2022/daffodil-customer-store-credit-driver-testing.mjs.map +1 -1
- package/fesm2022/daffodil-customer-store-credit-driver.mjs +13 -39
- package/fesm2022/daffodil-customer-store-credit-driver.mjs.map +1 -1
- package/fesm2022/daffodil-customer-store-credit-routing.mjs +86 -52
- package/fesm2022/daffodil-customer-store-credit-routing.mjs.map +1 -1
- package/fesm2022/daffodil-customer-store-credit-state-testing.mjs +86 -50
- package/fesm2022/daffodil-customer-store-credit-state-testing.mjs.map +1 -1
- package/fesm2022/daffodil-customer-store-credit-state.mjs +212 -231
- package/fesm2022/daffodil-customer-store-credit-state.mjs.map +1 -1
- package/fesm2022/daffodil-customer-store-credit-testing.mjs +49 -36
- package/fesm2022/daffodil-customer-store-credit-testing.mjs.map +1 -1
- package/fesm2022/daffodil-customer-store-credit.mjs +3 -7
- package/fesm2022/daffodil-customer-store-credit.mjs.map +1 -1
- package/package.json +1 -1
- package/types/daffodil-customer-store-credit-driver-in-memory.d.ts +54 -54
- package/types/daffodil-customer-store-credit-driver-magento-2.4.7-testing.d.ts +16 -0
- package/types/daffodil-customer-store-credit-driver-magento-2.4.7.d.ts +62 -0
- package/types/daffodil-customer-store-credit-driver-magento-auto-testing.d.ts +1 -0
- package/types/daffodil-customer-store-credit-driver-magento-auto.d.ts +1 -0
- package/types/daffodil-customer-store-credit-driver-testing.d.ts +24 -22
- package/types/daffodil-customer-store-credit-driver.d.ts +19 -28
- package/types/daffodil-customer-store-credit-routing.d.ts +18 -22
- package/types/daffodil-customer-store-credit-state-testing.d.ts +22 -19
- package/types/daffodil-customer-store-credit-state.d.ts +74 -86
- package/types/daffodil-customer-store-credit-testing.d.ts +10 -13
- package/types/daffodil-customer-store-credit.d.ts +6 -10
- package/fesm2022/daffodil-customer-store-credit-driver-magento-testing.mjs +0 -34
- package/fesm2022/daffodil-customer-store-credit-driver-magento-testing.mjs.map +0 -1
- package/fesm2022/daffodil-customer-store-credit-driver-magento.mjs +0 -154
- package/fesm2022/daffodil-customer-store-credit-driver-magento.mjs.map +0 -1
- package/types/daffodil-customer-store-credit-driver-magento-testing.d.ts +0 -20
- package/types/daffodil-customer-store-credit-driver-magento.d.ts +0 -67
|
@@ -1,117 +1,148 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import { Injectable, NgModule } from
|
|
3
|
-
import * as i2 from
|
|
4
|
-
import { STATUS } from
|
|
5
|
-
import * as i1 from
|
|
6
|
-
import * as i1
|
|
7
|
-
import { DaffInMemoryDriverBase, provideDaffInMemoryBackends } from
|
|
8
|
-
import { CommonModule } from
|
|
9
|
-
import { provideDaffCustomerStoreCreditDriver } from
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Injectable, NgModule, makeEnvironmentProviders } from "@angular/core";
|
|
3
|
+
import * as i2 from "angular-in-memory-web-api";
|
|
4
|
+
import { STATUS } from "angular-in-memory-web-api";
|
|
5
|
+
import * as i1$1 from "@daffodil/customer-store-credit/testing";
|
|
6
|
+
import * as i1 from "@angular/common/http";
|
|
7
|
+
import { DaffInMemoryDriverBase, provideDaffInMemoryBackends } from "@daffodil/driver/in-memory";
|
|
8
|
+
import { CommonModule } from "@angular/common";
|
|
9
|
+
import { provideDaffCustomerStoreCreditDriver } from "@daffodil/customer-store-credit/driver";
|
|
10
|
+
const DAFF_CUSTOMER_STORE_CREDIT_IN_MEMORY_COLLECTION_NAME = "customer-store-credit";
|
|
11
|
+
var DaffCustomerStoreCreditInMemoryBackendService = class DaffCustomerStoreCreditInMemoryBackendService {
|
|
12
|
+
constructor(factory) {
|
|
13
|
+
this.factory = factory;
|
|
14
|
+
this.collectionName = DAFF_CUSTOMER_STORE_CREDIT_IN_MEMORY_COLLECTION_NAME;
|
|
15
|
+
this.storeCredit = this.factory.create();
|
|
16
|
+
}
|
|
17
|
+
parseRequestUrl(url, utils) {
|
|
18
|
+
return utils.parseRequestUrl(url);
|
|
19
|
+
}
|
|
20
|
+
createDb() {
|
|
21
|
+
return { storeCredit: this.storeCredit };
|
|
22
|
+
}
|
|
23
|
+
get(reqInfo) {
|
|
24
|
+
return reqInfo.utils.createResponse$(() => ({
|
|
25
|
+
status: STATUS.OK,
|
|
26
|
+
body: this.storeCredit
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
static {
|
|
30
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
31
|
+
minVersion: "12.0.0",
|
|
32
|
+
version: "22.2.4",
|
|
33
|
+
ngImport: i0,
|
|
34
|
+
type: DaffCustomerStoreCreditInMemoryBackendService,
|
|
35
|
+
deps: [{ token: i1$1.DaffCustomerStoreCreditFactory }],
|
|
36
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
static {
|
|
40
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
41
|
+
minVersion: "12.0.0",
|
|
42
|
+
version: "22.2.4",
|
|
43
|
+
ngImport: i0,
|
|
44
|
+
type: DaffCustomerStoreCreditInMemoryBackendService,
|
|
45
|
+
providedIn: "root"
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
50
|
+
minVersion: "12.0.0",
|
|
51
|
+
version: "22.2.4",
|
|
52
|
+
ngImport: i0,
|
|
53
|
+
type: DaffCustomerStoreCreditInMemoryBackendService,
|
|
54
|
+
decorators: [{
|
|
55
|
+
type: Injectable,
|
|
56
|
+
args: [{ providedIn: "root" }]
|
|
57
|
+
}],
|
|
58
|
+
ctorParameters: () => [{ type: i1$1.DaffCustomerStoreCreditFactory }]
|
|
59
|
+
});
|
|
60
|
+
var DaffCustomerStoreCreditInMemoryDriver = class DaffCustomerStoreCreditInMemoryDriver extends DaffInMemoryDriverBase {
|
|
61
|
+
constructor(http, config) {
|
|
62
|
+
super(config, DAFF_CUSTOMER_STORE_CREDIT_IN_MEMORY_COLLECTION_NAME);
|
|
63
|
+
this.http = http;
|
|
64
|
+
}
|
|
65
|
+
get() {
|
|
66
|
+
return this.http.get(this.url);
|
|
67
|
+
}
|
|
68
|
+
static {
|
|
69
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
70
|
+
minVersion: "12.0.0",
|
|
71
|
+
version: "22.2.4",
|
|
72
|
+
ngImport: i0,
|
|
73
|
+
type: DaffCustomerStoreCreditInMemoryDriver,
|
|
74
|
+
deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }],
|
|
75
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
static {
|
|
79
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
80
|
+
minVersion: "12.0.0",
|
|
81
|
+
version: "22.2.4",
|
|
82
|
+
ngImport: i0,
|
|
83
|
+
type: DaffCustomerStoreCreditInMemoryDriver,
|
|
84
|
+
providedIn: "root"
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
89
|
+
minVersion: "12.0.0",
|
|
90
|
+
version: "22.2.4",
|
|
91
|
+
ngImport: i0,
|
|
92
|
+
type: DaffCustomerStoreCreditInMemoryDriver,
|
|
93
|
+
decorators: [{
|
|
94
|
+
type: Injectable,
|
|
95
|
+
args: [{ providedIn: "root" }]
|
|
96
|
+
}],
|
|
97
|
+
ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.InMemoryBackendConfig }]
|
|
98
|
+
});
|
|
99
|
+
const provideDaffCustomerStoreCreditInMemoryDriver = () => makeEnvironmentProviders([provideDaffCustomerStoreCreditDriver(DaffCustomerStoreCreditInMemoryDriver), provideDaffInMemoryBackends(DaffCustomerStoreCreditInMemoryBackendService)]);
|
|
100
|
+
var DaffCustomerStoreCreditInMemoryDriverModule = class DaffCustomerStoreCreditInMemoryDriverModule {
|
|
101
|
+
static forRoot() {
|
|
102
|
+
return {
|
|
103
|
+
ngModule: DaffCustomerStoreCreditInMemoryDriverModule,
|
|
104
|
+
providers: [provideDaffCustomerStoreCreditInMemoryDriver()]
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
static {
|
|
108
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
109
|
+
minVersion: "12.0.0",
|
|
110
|
+
version: "22.2.4",
|
|
111
|
+
ngImport: i0,
|
|
112
|
+
type: DaffCustomerStoreCreditInMemoryDriverModule,
|
|
113
|
+
deps: [],
|
|
114
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
static {
|
|
118
|
+
this.ɵmod = i0.ɵɵngDeclareNgModule({
|
|
119
|
+
minVersion: "14.0.0",
|
|
120
|
+
version: "22.2.4",
|
|
121
|
+
ngImport: i0,
|
|
122
|
+
type: DaffCustomerStoreCreditInMemoryDriverModule,
|
|
123
|
+
imports: [CommonModule]
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
static {
|
|
127
|
+
this.ɵinj = i0.ɵɵngDeclareInjector({
|
|
128
|
+
minVersion: "12.0.0",
|
|
129
|
+
version: "22.2.4",
|
|
130
|
+
ngImport: i0,
|
|
131
|
+
type: DaffCustomerStoreCreditInMemoryDriverModule,
|
|
132
|
+
imports: [CommonModule]
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
137
|
+
minVersion: "12.0.0",
|
|
138
|
+
version: "22.2.4",
|
|
139
|
+
ngImport: i0,
|
|
140
|
+
type: DaffCustomerStoreCreditInMemoryDriverModule,
|
|
141
|
+
decorators: [{
|
|
142
|
+
type: NgModule,
|
|
143
|
+
args: [{ imports: [CommonModule] }]
|
|
144
|
+
}]
|
|
145
|
+
});
|
|
146
|
+
export { DaffCustomerStoreCreditInMemoryBackendService, DaffCustomerStoreCreditInMemoryDriver, DaffCustomerStoreCreditInMemoryDriverModule, provideDaffCustomerStoreCreditInMemoryDriver };
|
|
10
147
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* An in-memory service that handles customer store credit HTTP requests.
|
|
15
|
-
*/
|
|
16
|
-
class DaffCustomerStoreCreditInMemoryBackendService {
|
|
17
|
-
constructor(factory) {
|
|
18
|
-
this.factory = factory;
|
|
19
|
-
this.collectionName = DAFF_CUSTOMER_STORE_CREDIT_IN_MEMORY_COLLECTION_NAME;
|
|
20
|
-
this.storeCredit = this.factory.create();
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Automatically called as part of the InMemoryDbService to parse incoming urls to match the InMemory backend urls.
|
|
24
|
-
*
|
|
25
|
-
* @param url initial url
|
|
26
|
-
* @param utils utility to parse url
|
|
27
|
-
* @returns ParsedRequestUrl
|
|
28
|
-
* @docs-private
|
|
29
|
-
*/
|
|
30
|
-
parseRequestUrl(url, utils) {
|
|
31
|
-
return utils.parseRequestUrl(url);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* @docs-private
|
|
35
|
-
*/
|
|
36
|
-
createDb() {
|
|
37
|
-
return {
|
|
38
|
-
storeCredit: this.storeCredit,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Gets the customer's store credit.
|
|
43
|
-
*
|
|
44
|
-
* @param reqInfo request object
|
|
45
|
-
* @returns An http response object
|
|
46
|
-
*/
|
|
47
|
-
get(reqInfo) {
|
|
48
|
-
return reqInfo.utils.createResponse$(() => ({
|
|
49
|
-
status: STATUS.OK,
|
|
50
|
-
body: this.storeCredit,
|
|
51
|
-
}));
|
|
52
|
-
}
|
|
53
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditInMemoryBackendService, deps: [{ token: i1.DaffCustomerStoreCreditFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
54
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditInMemoryBackendService, providedIn: 'root' }); }
|
|
55
|
-
}
|
|
56
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditInMemoryBackendService, decorators: [{
|
|
57
|
-
type: Injectable,
|
|
58
|
-
args: [{
|
|
59
|
-
providedIn: 'root',
|
|
60
|
-
}]
|
|
61
|
-
}], ctorParameters: () => [{ type: i1.DaffCustomerStoreCreditFactory }] });
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* The customer store credit in-memory driver to mock the customer store credit backend service.
|
|
65
|
-
*
|
|
66
|
-
* @inheritdoc
|
|
67
|
-
*/
|
|
68
|
-
class DaffCustomerStoreCreditInMemoryDriver extends DaffInMemoryDriverBase {
|
|
69
|
-
constructor(http, config) {
|
|
70
|
-
super(config, DAFF_CUSTOMER_STORE_CREDIT_IN_MEMORY_COLLECTION_NAME);
|
|
71
|
-
this.http = http;
|
|
72
|
-
}
|
|
73
|
-
get() {
|
|
74
|
-
return this.http.get(this.url);
|
|
75
|
-
}
|
|
76
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditInMemoryDriver, deps: [{ token: i1$1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
77
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditInMemoryDriver, providedIn: 'root' }); }
|
|
78
|
-
}
|
|
79
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditInMemoryDriver, decorators: [{
|
|
80
|
-
type: Injectable,
|
|
81
|
-
args: [{
|
|
82
|
-
providedIn: 'root',
|
|
83
|
-
}]
|
|
84
|
-
}], ctorParameters: () => [{ type: i1$1.HttpClient }, { type: i2.InMemoryBackendConfig }] });
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Provides the {@link DaffCustomerStoreCreditInMemoryDriver} as the {@link DaffCustomerStoreCreditDriver}.
|
|
88
|
-
*/
|
|
89
|
-
class DaffCustomerStoreCreditInMemoryDriverModule {
|
|
90
|
-
static forRoot() {
|
|
91
|
-
return {
|
|
92
|
-
ngModule: DaffCustomerStoreCreditInMemoryDriverModule,
|
|
93
|
-
providers: [
|
|
94
|
-
provideDaffCustomerStoreCreditDriver(DaffCustomerStoreCreditInMemoryDriver),
|
|
95
|
-
provideDaffInMemoryBackends(DaffCustomerStoreCreditInMemoryBackendService),
|
|
96
|
-
],
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditInMemoryDriverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
100
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditInMemoryDriverModule, imports: [CommonModule] }); }
|
|
101
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditInMemoryDriverModule, imports: [CommonModule] }); }
|
|
102
|
-
}
|
|
103
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditInMemoryDriverModule, decorators: [{
|
|
104
|
-
type: NgModule,
|
|
105
|
-
args: [{
|
|
106
|
-
imports: [
|
|
107
|
-
CommonModule,
|
|
108
|
-
],
|
|
109
|
-
}]
|
|
110
|
-
}] });
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Generated bundle index. Do not edit.
|
|
114
|
-
*/
|
|
115
|
-
|
|
116
|
-
export { DaffCustomerStoreCreditInMemoryBackendService, DaffCustomerStoreCreditInMemoryDriver, DaffCustomerStoreCreditInMemoryDriverModule };
|
|
117
|
-
//# sourceMappingURL=daffodil-customer-store-credit-driver-in-memory.mjs.map
|
|
148
|
+
//# sourceMappingURL=daffodil-customer-store-credit-driver-in-memory.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-customer-store-credit-driver-in-memory.mjs","sources":["../../../libs/customer-store-credit/driver/in-memory/src/collection-name.const.ts","../../../libs/customer-store-credit/driver/in-memory/src/backend/store-credit.service.ts","../../../libs/customer-store-credit/driver/in-memory/src/driver/store-credit.service.ts","../../../libs/customer-store-credit/driver/in-memory/src/
|
|
1
|
+
{"version":3,"file":"daffodil-customer-store-credit-driver-in-memory.mjs","names":["i1"],"sources":["../../../libs/customer-store-credit/driver/in-memory/src/collection-name.const.ts","../../../libs/customer-store-credit/driver/in-memory/src/backend/store-credit.service.ts","../../../libs/customer-store-credit/driver/in-memory/src/driver/store-credit.service.ts","../../../libs/customer-store-credit/driver/in-memory/src/provider.ts","../../../libs/customer-store-credit/driver/in-memory/src/driver/driver.module.ts"],"sourcesContent":["export const DAFF_CUSTOMER_STORE_CREDIT_IN_MEMORY_COLLECTION_NAME = 'customer-store-credit';\n","import { Injectable } from '@angular/core';\nimport {\n InMemoryDbService,\n RequestInfoUtilities,\n ParsedRequestUrl,\n STATUS,\n RequestInfo,\n} from 'angular-in-memory-web-api';\n\nimport { DaffCustomerStoreCredit } from '@daffodil/customer-store-credit';\nimport { DaffCustomerStoreCreditFactory } from '@daffodil/customer-store-credit/testing';\nimport { DaffInMemorySingleRouteableBackend } from '@daffodil/driver/in-memory';\n\nimport { DAFF_CUSTOMER_STORE_CREDIT_IN_MEMORY_COLLECTION_NAME } from '../collection-name.const';\n\n/**\n * An in-memory service that handles customer store credit HTTP requests.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCustomerStoreCreditInMemoryBackendService implements InMemoryDbService, DaffInMemorySingleRouteableBackend {\n readonly collectionName = DAFF_CUSTOMER_STORE_CREDIT_IN_MEMORY_COLLECTION_NAME;\n\n storeCredit: DaffCustomerStoreCredit;\n\n constructor(\n private factory: DaffCustomerStoreCreditFactory,\n ) {\n this.storeCredit = this.factory.create();\n }\n\n /**\n * Automatically called as part of the InMemoryDbService to parse incoming urls to match the InMemory backend urls.\n *\n * @param url initial url\n * @param utils utility to parse url\n * @returns ParsedRequestUrl\n * @docs-private\n */\n parseRequestUrl(url: string, utils: RequestInfoUtilities): ParsedRequestUrl {\n return utils.parseRequestUrl(url);\n }\n\n /**\n * @docs-private\n */\n createDb(): any {\n return {\n storeCredit: this.storeCredit,\n };\n }\n\n /**\n * Gets the customer's store credit.\n *\n * @param reqInfo request object\n * @returns An http response object\n */\n get(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n status: STATUS.OK,\n body: this.storeCredit,\n }));\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { InMemoryBackendConfig } from 'angular-in-memory-web-api';\nimport { Observable } from 'rxjs';\n\nimport { DaffCustomerStoreCredit } from '@daffodil/customer-store-credit';\nimport { DaffCustomerStoreCreditDriverInterface } from '@daffodil/customer-store-credit/driver';\nimport { DaffInMemoryDriverBase } from '@daffodil/driver/in-memory';\n\nimport { DAFF_CUSTOMER_STORE_CREDIT_IN_MEMORY_COLLECTION_NAME } from '../collection-name.const';\n\n/**\n * The customer store credit in-memory driver to mock the customer store credit backend service.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCustomerStoreCreditInMemoryDriver extends DaffInMemoryDriverBase implements DaffCustomerStoreCreditDriverInterface {\n constructor(\n private http: HttpClient,\n config: InMemoryBackendConfig,\n ) {\n super(config, DAFF_CUSTOMER_STORE_CREDIT_IN_MEMORY_COLLECTION_NAME);\n }\n\n get(): Observable<DaffCustomerStoreCredit> {\n return this.http.get<DaffCustomerStoreCredit>(this.url);\n }\n}\n","import {\n EnvironmentProviders,\n makeEnvironmentProviders,\n} from '@angular/core';\n\nimport { provideDaffCustomerStoreCreditDriver } from '@daffodil/customer-store-credit/driver';\nimport { provideDaffInMemoryBackends } from '@daffodil/driver/in-memory';\n\nimport { DaffCustomerStoreCreditInMemoryBackendService } from './backend/store-credit.service';\nimport { DaffCustomerStoreCreditInMemoryDriver } from './driver/store-credit.service';\n\n/**\n * Provides the {@link DaffCustomerStoreCreditInMemoryDriver} as the {@link DaffCustomerStoreCreditDriver}.\n */\nexport const provideDaffCustomerStoreCreditInMemoryDriver = (): EnvironmentProviders => makeEnvironmentProviders([\n provideDaffCustomerStoreCreditDriver(DaffCustomerStoreCreditInMemoryDriver),\n provideDaffInMemoryBackends(DaffCustomerStoreCreditInMemoryBackendService),\n]);\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { provideDaffCustomerStoreCreditInMemoryDriver } from '../provider';\n\n/**\n * Provides the {@link DaffCustomerStoreCreditInMemoryDriver} as the {@link DaffCustomerStoreCreditDriver}.\n *\n * @deprecated in favor of {@link provideDaffCustomerStoreCreditInMemoryDriver} Deprecated in version 0.95.0. Will be removed in version 0.98.0.\n */\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffCustomerStoreCreditInMemoryDriverModule {\n static forRoot(): ModuleWithProviders<DaffCustomerStoreCreditInMemoryDriverModule> {\n return {\n ngModule: DaffCustomerStoreCreditInMemoryDriverModule,\n providers: [\n provideDaffCustomerStoreCreditInMemoryDriver(),\n ],\n };\n }\n}\n"],"mappings":";;;;;;;;;AAAA,MAAa,uDAAuD;ACqBpE,IAAa,gDAAb,MAAa,8CAA6C;CAKxD,YACU,SAAuC;EAAvC,KAAA,UAAA;EALD,KAAA,iBAAiB;EAOxB,KAAK,cAAc,KAAK,QAAQ,OAAM;CACxC;CAUA,gBAAgB,KAAa,OAA2B;EACtD,OAAO,MAAM,gBAAgB,GAAG;CAClC;CAKA,WAAQ;EACN,OAAO,EACL,aAAa,KAAK,YACnB;CACH;CAQA,IAAI,SAAoB;EACtB,OAAO,QAAQ,MAAM,uBAAuB;GAC1C,QAAQ,OAAO;GACf,MAAM,KAAK;EACZ,EAAC;CACJ;CA3CW;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAA6C,MAAA,CAAA,EAAA,OAAAA,KAAA,+BAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAA7C;EAAA,KAAA,QAAA,GAAA,sBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAA6C,YAF5C;EAAM,CAAA;CAAA;;AAEP,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAA6C,YAAA,CAAA;EAHzD,MAAA;EAAW,MAAA,CAAA,EACV,YAAY,OACb,CAAA;;;;ACDD,IAAa,wCAAb,MAAa,8CAA8C,uBAAsB;CAC/E,YACU,MACR,QAA6B;EAE7B,MAAM,QAAQ,oDAAoD;EAH1D,KAAA,OAAA;CAIV;CAEA,MAAG;EACD,OAAO,KAAK,KAAK,IAA6B,KAAK,GAAG;CACxD;CAVW;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAqC,MAAA,CAAA,EAAA,OAAA,GAAA,WAAA,GAAA,EAAA,OAAA,GAAA,sBAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAArC;EAAA,KAAA,QAAA,GAAA,sBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAqC,YAFpC;EAAM,CAAA;CAAA;;AAEP,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAqC,YAAA,CAAA;EAHjD,MAAA;EAAW,MAAA,CAAA,EACV,YAAY,OACb,CAAA;;;;ACJD,MAAa,qDAA2E,yBAAyB,CAC/G,qCAAqC,qCAAqC,GAC1E,4BAA4B,6CAA6C,CAC1E,CAAA;ACCD,IAAa,8CAAb,MAAa,4CAA2C;CACtD,OAAO,UAAO;EACZ,OAAO;GACL,UAAU;GACV,WAAW,CACT,6CAA4C,CAC7C;EACF;CACH;CARW;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAA2C,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAA3C;EAAA,KAAA,OAAA,GAAA,oBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAA2C,SAAA,CAHpD,YAAY;EAAA,CAAA;CAAA;CAGH;EAAA,KAAA,OAAA,GAAA,oBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAA2C,SAAA,CAHpD,YAAY;EAAA,CAAA;CAAA;;AAGH,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAA2C,YAAA,CAAA;EALvD,MAAA;EAAS,MAAA,CAAA,EACR,SAAS,CACP,YACD,EACF,CAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Injectable } from "@angular/core";
|
|
3
|
+
import { faker } from "@faker-js/faker/locale/en_US";
|
|
4
|
+
import { DaffModelFactory } from "@daffodil/core/testing";
|
|
5
|
+
import * as i1 from "@daffodil/driver/magento/2.4.7/testing";
|
|
6
|
+
var MockMagentoCustomerStoreCredit = class {
|
|
7
|
+
constructor(moneyFactory) {
|
|
8
|
+
this.moneyFactory = moneyFactory;
|
|
9
|
+
this.__typename = "CustomerStoreCredit";
|
|
10
|
+
this.current_balance = this.moneyFactory.create();
|
|
11
|
+
this.enabled = faker.datatype.boolean();
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
var MagentoCustomerStoreCreditFactory = class MagentoCustomerStoreCreditFactory extends DaffModelFactory {
|
|
15
|
+
constructor(moneyFactory) {
|
|
16
|
+
super(MockMagentoCustomerStoreCredit, moneyFactory);
|
|
17
|
+
}
|
|
18
|
+
static {
|
|
19
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
20
|
+
minVersion: "12.0.0",
|
|
21
|
+
version: "22.2.4",
|
|
22
|
+
ngImport: i0,
|
|
23
|
+
type: MagentoCustomerStoreCreditFactory,
|
|
24
|
+
deps: [{ token: i1.MagentoMoneyFactory }],
|
|
25
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
static {
|
|
29
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
30
|
+
minVersion: "12.0.0",
|
|
31
|
+
version: "22.2.4",
|
|
32
|
+
ngImport: i0,
|
|
33
|
+
type: MagentoCustomerStoreCreditFactory,
|
|
34
|
+
providedIn: "root"
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
39
|
+
minVersion: "12.0.0",
|
|
40
|
+
version: "22.2.4",
|
|
41
|
+
ngImport: i0,
|
|
42
|
+
type: MagentoCustomerStoreCreditFactory,
|
|
43
|
+
decorators: [{
|
|
44
|
+
type: Injectable,
|
|
45
|
+
args: [{ providedIn: "root" }]
|
|
46
|
+
}],
|
|
47
|
+
ctorParameters: () => [{ type: i1.MagentoMoneyFactory }]
|
|
48
|
+
});
|
|
49
|
+
export { MagentoCustomerStoreCreditFactory, MockMagentoCustomerStoreCredit };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=daffodil-customer-store-credit-driver-magento-2.4.7-testing.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daffodil-customer-store-credit-driver-magento-2.4.7-testing.mjs","names":[],"sources":["../../../libs/customer-store-credit/driver/magento/2.4.7/testing/src/factories/customer-store-credit.factory.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { faker } from '@faker-js/faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport { MagentoCustomerStoreCredit } from '@daffodil/customer-store-credit/driver/magento/2.4.7';\nimport { MagentoMoneyFactory } from '@daffodil/driver/magento/2.4.7/testing';\n\nexport class MockMagentoCustomerStoreCredit implements MagentoCustomerStoreCredit {\n __typename = <const>'CustomerStoreCredit';\n current_balance = this.moneyFactory.create();\n enabled = faker.datatype.boolean();\n\n constructor(\n protected moneyFactory: MagentoMoneyFactory,\n ) {}\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MagentoCustomerStoreCreditFactory extends DaffModelFactory<MagentoCustomerStoreCredit> {\n constructor(\n moneyFactory: MagentoMoneyFactory,\n ) {\n super(MockMagentoCustomerStoreCredit, moneyFactory);\n }\n}\n"],"mappings":";;;;;AAOA,IAAa,iCAAb,MAA2C;CAKzC,YACY,cAAiC;EAAjC,KAAA,eAAA;EALZ,KAAA,aAAoB;EACpB,KAAA,kBAAkB,KAAK,aAAa,OAAM;EAC1C,KAAA,UAAU,MAAM,SAAS,QAAO;CAI7B;AACJ;AAKD,IAAa,oCAAb,MAAa,0CAA0C,iBAA4C;CACjG,YACE,cAAiC;EAEjC,MAAM,gCAAgC,YAAY;CACpD;CALW;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAiC,MAAA,CAAA,EAAA,OAAA,GAAA,oBAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAjC;EAAA,KAAA,QAAA,GAAA,sBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAiC,YAFhC;EAAM,CAAA;CAAA;;AAEP,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAiC,YAAA,CAAA;EAH7C,MAAA;EAAW,MAAA,CAAA,EACV,YAAY,OACb,CAAA"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { DAFF_CUSTOMER_STORE_CREDIT_ORDER_TOTAL_TYPE } from "@daffodil/customer-store-credit";
|
|
2
|
+
import * as i1 from "apollo-angular";
|
|
3
|
+
import { gql } from "apollo-angular";
|
|
4
|
+
import { daffTransformMagentoError, magentoMoneyFragment } from "@daffodil/driver/magento/2.4.7";
|
|
5
|
+
import { CombinedGraphQLErrors } from "@apollo/client";
|
|
6
|
+
import { DaffCustomerStoreCreditDriverErrorMap, DaffCustomerStoreCreditInvalidAPIResponseError, provideDaffCustomerStoreCreditDriver } from "@daffodil/customer-store-credit/driver";
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
import { Injectable, NgModule, makeEnvironmentProviders } from "@angular/core";
|
|
9
|
+
import { throwError } from "rxjs";
|
|
10
|
+
import { catchError, map } from "rxjs/operators";
|
|
11
|
+
import { CommonModule } from "@angular/common";
|
|
12
|
+
import { provideDaffCustomerOrderMagentoExtraOrderFragments, provideDaffCustomerOrderMagentoExtraOrderTransforms } from "@daffodil/customer-order/driver/magento/2.4.6";
|
|
13
|
+
const magentoCustomerStoreCreditTransform = (storeCredit) => ({ balance: storeCredit.current_balance.value });
|
|
14
|
+
const magentoCustomerOrderWithStoreCreditTransform = (daffOrder, magentoOrder, email) => ({
|
|
15
|
+
...daffOrder,
|
|
16
|
+
totals: [...daffOrder.totals, {
|
|
17
|
+
type: DAFF_CUSTOMER_STORE_CREDIT_ORDER_TOTAL_TYPE,
|
|
18
|
+
label: "Store Credit",
|
|
19
|
+
value: magentoOrder.total?.total_store_credit.value,
|
|
20
|
+
sort_order: 35
|
|
21
|
+
}].sort((a, b) => a.sort_order - b.sort_order)
|
|
22
|
+
});
|
|
23
|
+
const magentoCustomerStoreCreditFragment = gql`
|
|
24
|
+
fragment magentoCustomerStoreCredit on CustomerStoreCredit {
|
|
25
|
+
current_balance {
|
|
26
|
+
...moneyFragment
|
|
27
|
+
}
|
|
28
|
+
enabled
|
|
29
|
+
}
|
|
30
|
+
${magentoMoneyFragment}
|
|
31
|
+
`;
|
|
32
|
+
const magentoCustomerOrderStoreCreditTotalFragment = gql`
|
|
33
|
+
fragment magentoCustomerOrderStoreCreditTotal on CustomerOrder {
|
|
34
|
+
total {
|
|
35
|
+
total_store_credit {
|
|
36
|
+
...moneyFragment
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
${magentoMoneyFragment}
|
|
41
|
+
`;
|
|
42
|
+
const MAGENTO_GET_CUSTOMER_STORE_CREDIT_QUERY_NAME = "MagentoGetCustomerStoreCredit";
|
|
43
|
+
const getCustomerStoreCredit = gql`
|
|
44
|
+
query ${MAGENTO_GET_CUSTOMER_STORE_CREDIT_QUERY_NAME} {
|
|
45
|
+
customer {
|
|
46
|
+
store_credit {
|
|
47
|
+
...magentoCustomerStoreCredit
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
${magentoCustomerStoreCreditFragment}
|
|
52
|
+
`;
|
|
53
|
+
const DaffCustomerStoreCreditMagentoErrorMessageRegexMap = {};
|
|
54
|
+
function transformMagentoCartGraphQlError(error, requestPayload) {
|
|
55
|
+
for (const code in DaffCustomerStoreCreditMagentoErrorMessageRegexMap) if (error.message.search(DaffCustomerStoreCreditMagentoErrorMessageRegexMap[code]) > -1 && DaffCustomerStoreCreditDriverErrorMap[code]) return new DaffCustomerStoreCreditDriverErrorMap[code](error.message);
|
|
56
|
+
return daffTransformMagentoError(error, {});
|
|
57
|
+
}
|
|
58
|
+
function transformMagentoReviewsError(error, requestPayload) {
|
|
59
|
+
if (CombinedGraphQLErrors.is(error)) return transformMagentoCartGraphQlError(error.errors[0], requestPayload);
|
|
60
|
+
else return daffTransformMagentoError(error, {}) || new DaffCustomerStoreCreditInvalidAPIResponseError(error.message);
|
|
61
|
+
}
|
|
62
|
+
const validateGetCustomerStoreCreditResponse = (response) => {
|
|
63
|
+
if (response.data.customer?.store_credit?.enabled) return response;
|
|
64
|
+
else throw new DaffCustomerStoreCreditInvalidAPIResponseError("The store credit feature is not enabled on this platform.");
|
|
65
|
+
};
|
|
66
|
+
var DaffCustomerStoreCreditMagentoService = class DaffCustomerStoreCreditMagentoService {
|
|
67
|
+
constructor(apollo) {
|
|
68
|
+
this.apollo = apollo;
|
|
69
|
+
}
|
|
70
|
+
get() {
|
|
71
|
+
return this.apollo.query({ query: getCustomerStoreCredit }).pipe(map(validateGetCustomerStoreCreditResponse), map((response) => magentoCustomerStoreCreditTransform(response.data.customer.store_credit)), catchError((err) => throwError(() => transformMagentoReviewsError(err))));
|
|
72
|
+
}
|
|
73
|
+
static {
|
|
74
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
75
|
+
minVersion: "12.0.0",
|
|
76
|
+
version: "22.2.4",
|
|
77
|
+
ngImport: i0,
|
|
78
|
+
type: DaffCustomerStoreCreditMagentoService,
|
|
79
|
+
deps: [{ token: i1.Apollo }],
|
|
80
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
static {
|
|
84
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
85
|
+
minVersion: "12.0.0",
|
|
86
|
+
version: "22.2.4",
|
|
87
|
+
ngImport: i0,
|
|
88
|
+
type: DaffCustomerStoreCreditMagentoService,
|
|
89
|
+
providedIn: "root"
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
94
|
+
minVersion: "12.0.0",
|
|
95
|
+
version: "22.2.4",
|
|
96
|
+
ngImport: i0,
|
|
97
|
+
type: DaffCustomerStoreCreditMagentoService,
|
|
98
|
+
decorators: [{
|
|
99
|
+
type: Injectable,
|
|
100
|
+
args: [{ providedIn: "root" }]
|
|
101
|
+
}],
|
|
102
|
+
ctorParameters: () => [{ type: i1.Apollo }]
|
|
103
|
+
});
|
|
104
|
+
const provideDaffCustomerStoreCreditMagentoDriver = () => makeEnvironmentProviders([
|
|
105
|
+
provideDaffCustomerStoreCreditDriver(DaffCustomerStoreCreditMagentoService),
|
|
106
|
+
provideDaffCustomerOrderMagentoExtraOrderFragments(magentoCustomerOrderStoreCreditTotalFragment),
|
|
107
|
+
provideDaffCustomerOrderMagentoExtraOrderTransforms(magentoCustomerOrderWithStoreCreditTransform)
|
|
108
|
+
]);
|
|
109
|
+
var DaffCustomerStoreCreditMagentoDriverModule = class DaffCustomerStoreCreditMagentoDriverModule {
|
|
110
|
+
static forRoot() {
|
|
111
|
+
return {
|
|
112
|
+
ngModule: DaffCustomerStoreCreditMagentoDriverModule,
|
|
113
|
+
providers: [provideDaffCustomerStoreCreditMagentoDriver()]
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
static {
|
|
117
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
118
|
+
minVersion: "12.0.0",
|
|
119
|
+
version: "22.2.4",
|
|
120
|
+
ngImport: i0,
|
|
121
|
+
type: DaffCustomerStoreCreditMagentoDriverModule,
|
|
122
|
+
deps: [],
|
|
123
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
static {
|
|
127
|
+
this.ɵmod = i0.ɵɵngDeclareNgModule({
|
|
128
|
+
minVersion: "14.0.0",
|
|
129
|
+
version: "22.2.4",
|
|
130
|
+
ngImport: i0,
|
|
131
|
+
type: DaffCustomerStoreCreditMagentoDriverModule,
|
|
132
|
+
imports: [CommonModule]
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
static {
|
|
136
|
+
this.ɵinj = i0.ɵɵngDeclareInjector({
|
|
137
|
+
minVersion: "12.0.0",
|
|
138
|
+
version: "22.2.4",
|
|
139
|
+
ngImport: i0,
|
|
140
|
+
type: DaffCustomerStoreCreditMagentoDriverModule,
|
|
141
|
+
imports: [CommonModule]
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
146
|
+
minVersion: "12.0.0",
|
|
147
|
+
version: "22.2.4",
|
|
148
|
+
ngImport: i0,
|
|
149
|
+
type: DaffCustomerStoreCreditMagentoDriverModule,
|
|
150
|
+
decorators: [{
|
|
151
|
+
type: NgModule,
|
|
152
|
+
args: [{ imports: [CommonModule] }]
|
|
153
|
+
}]
|
|
154
|
+
});
|
|
155
|
+
export { DaffCustomerStoreCreditMagentoDriverModule, DaffCustomerStoreCreditMagentoService, MAGENTO_GET_CUSTOMER_STORE_CREDIT_QUERY_NAME, getCustomerStoreCredit, magentoCustomerOrderStoreCreditTotalFragment, magentoCustomerOrderWithStoreCreditTransform, magentoCustomerStoreCreditFragment, magentoCustomerStoreCreditTransform, provideDaffCustomerStoreCreditMagentoDriver, transformMagentoReviewsError, validateGetCustomerStoreCreditResponse };
|
|
156
|
+
|
|
157
|
+
//# sourceMappingURL=daffodil-customer-store-credit-driver-magento-2.4.7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daffodil-customer-store-credit-driver-magento-2.4.7.mjs","names":[],"sources":["../../../libs/customer-store-credit/driver/magento/2.4.7/src/transforms/responses/customer-store-credit.ts","../../../libs/customer-store-credit/driver/magento/2.4.7/src/transforms/responses/customer-order.ts","../../../libs/customer-store-credit/driver/magento/2.4.7/src/queries/fragments/store-credit.ts","../../../libs/customer-store-credit/driver/magento/2.4.7/src/queries/fragments/customer-order.ts","../../../libs/customer-store-credit/driver/magento/2.4.7/src/queries/get-store-credit.ts","../../../libs/customer-store-credit/driver/magento/2.4.7/src/errors/map.ts","../../../libs/customer-store-credit/driver/magento/2.4.7/src/errors/transform.ts","../../../libs/customer-store-credit/driver/magento/2.4.7/src/validators/get-customer-store-credit.ts","../../../libs/customer-store-credit/driver/magento/2.4.7/src/customer-store-credit.service.ts","../../../libs/customer-store-credit/driver/magento/2.4.7/src/provider.ts","../../../libs/customer-store-credit/driver/magento/2.4.7/src/driver.module.ts"],"sourcesContent":["import { DaffCustomerStoreCredit } from '@daffodil/customer-store-credit';\n\nimport { MagentoCustomerStoreCredit } from '../../models/public_api';\n\nexport const magentoCustomerStoreCreditTransform = (storeCredit: MagentoCustomerStoreCredit): DaffCustomerStoreCredit => ({\n balance: storeCredit.current_balance.value,\n});\n","import { DaffMagentoCustomerOrderExtraTransform } from '@daffodil/customer-order/driver/magento/2.4.6';\nimport { DAFF_CUSTOMER_STORE_CREDIT_ORDER_TOTAL_TYPE } from '@daffodil/customer-store-credit';\nimport { DaffOrder } from '@daffodil/order';\n\nimport { MagentoCustomerOrderWithStoreCredit } from '../../models/public_api';\n\nexport const magentoCustomerOrderWithStoreCreditTransform: DaffMagentoCustomerOrderExtraTransform<MagentoCustomerOrderWithStoreCredit> = (daffOrder: DaffOrder, magentoOrder: MagentoCustomerOrderWithStoreCredit, email: string): DaffOrder => ({\n ...daffOrder,\n totals: [\n ...daffOrder.totals,\n {\n type: DAFF_CUSTOMER_STORE_CREDIT_ORDER_TOTAL_TYPE,\n label: 'Store Credit',\n value: magentoOrder.total?.total_store_credit.value,\n // before grand total and after tax\n sort_order: 35,\n },\n ].sort((a, b) => a.sort_order - b.sort_order),\n});\n","import { gql } from 'apollo-angular';\n\nimport { magentoMoneyFragment } from '@daffodil/driver/magento/2.4.7';\n\nexport const magentoCustomerStoreCreditFragment = gql`\n fragment magentoCustomerStoreCredit on CustomerStoreCredit {\n current_balance {\n ...moneyFragment\n }\n enabled\n }\n ${magentoMoneyFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nimport { magentoMoneyFragment } from '@daffodil/driver/magento/2.4.7';\n\nexport const magentoCustomerOrderStoreCreditTotalFragment = gql`\n fragment magentoCustomerOrderStoreCreditTotal on CustomerOrder {\n total {\n total_store_credit {\n ...moneyFragment\n }\n }\n }\n ${magentoMoneyFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nimport { magentoCustomerStoreCreditFragment } from './fragments/public_api';\n\nexport const MAGENTO_GET_CUSTOMER_STORE_CREDIT_QUERY_NAME = 'MagentoGetCustomerStoreCredit';\n\nexport const getCustomerStoreCredit = gql`\n query ${MAGENTO_GET_CUSTOMER_STORE_CREDIT_QUERY_NAME} {\n customer {\n store_credit {\n ...magentoCustomerStoreCredit\n }\n }\n }\n ${magentoCustomerStoreCreditFragment}\n`;\n","export const DaffCustomerStoreCreditMagentoErrorMessageRegexMap = {\n};\n","import { CombinedGraphQLErrors } from '@apollo/client';\nimport { GraphQLFormattedError } from 'graphql';\n\nimport { DaffError } from '@daffodil/core';\nimport {\n DaffCustomerStoreCreditDriverErrorMap,\n DaffCustomerStoreCreditInvalidAPIResponseError,\n} from '@daffodil/customer-store-credit/driver';\nimport { daffTransformMagentoError } from '@daffodil/driver/magento/2.4.7';\n\nimport { DaffCustomerStoreCreditMagentoErrorMessageRegexMap } from './map';\n\n/**\n * Transforms a single GraphQL error.\n * Optionally accepts a request payload which can be used in certain cases\n * to add supplemental info to the error.\n */\nexport function transformMagentoCartGraphQlError(error: GraphQLFormattedError, requestPayload?: unknown): DaffError {\n // eslint-disable-next-line\n for (const code in DaffCustomerStoreCreditMagentoErrorMessageRegexMap) {\n const matchIndex = error.message.search(DaffCustomerStoreCreditMagentoErrorMessageRegexMap[code]);\n\n if (matchIndex > -1 && DaffCustomerStoreCreditDriverErrorMap[code]) {\n const errObj = new DaffCustomerStoreCreditDriverErrorMap[code](error.message);\n\n return errObj;\n }\n }\n\n return daffTransformMagentoError(error, {});\n}\n\nexport function transformMagentoReviewsError(error: any, requestPayload?: unknown) {\n if (CombinedGraphQLErrors.is(error)) {\n return transformMagentoCartGraphQlError(error.errors[0], requestPayload);\n } else {\n return daffTransformMagentoError(error, {}) || new DaffCustomerStoreCreditInvalidAPIResponseError(error.message);\n }\n}\n","import { Apollo } from 'apollo-angular';\n\nimport { DaffCustomerStoreCreditInvalidAPIResponseError } from '@daffodil/customer-store-credit/driver';\n\nimport { MagentoGetCustomerStoreCreditResponse } from '../models/public_api';\n\nexport const validateGetCustomerStoreCreditResponse = (response: Apollo.QueryResult<MagentoGetCustomerStoreCreditResponse>) => {\n if (response.data.customer?.store_credit?.enabled) {\n return response;\n } else {\n throw new DaffCustomerStoreCreditInvalidAPIResponseError('The store credit feature is not enabled on this platform.');\n }\n};\n","import { Injectable } from '@angular/core';\nimport { Apollo } from 'apollo-angular';\nimport {\n Observable,\n throwError,\n} from 'rxjs';\nimport {\n map,\n catchError,\n} from 'rxjs/operators';\n\nimport { DaffCustomerStoreCredit } from '@daffodil/customer-store-credit';\nimport { DaffCustomerStoreCreditDriverInterface } from '@daffodil/customer-store-credit/driver';\n\nimport { transformMagentoReviewsError } from './errors/transform';\nimport { MagentoGetCustomerStoreCreditResponse } from './models/public_api';\nimport { getCustomerStoreCredit } from './queries/public_api';\nimport { magentoCustomerStoreCreditTransform } from './transforms/public_api';\nimport { validateGetCustomerStoreCreditResponse } from './validators/public_api';\n\n/**\n * A service for making Magento GraphQL queries for customers.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCustomerStoreCreditMagentoService implements DaffCustomerStoreCreditDriverInterface {\n constructor(\n private apollo: Apollo,\n ) {}\n\n get(): Observable<DaffCustomerStoreCredit> {\n return this.apollo.query<MagentoGetCustomerStoreCreditResponse>({\n query: getCustomerStoreCredit,\n }).pipe(\n map(validateGetCustomerStoreCreditResponse),\n map((response) => magentoCustomerStoreCreditTransform(response.data.customer.store_credit)),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n );\n }\n}\n","import {\n EnvironmentProviders,\n makeEnvironmentProviders,\n} from '@angular/core';\n\nimport {\n provideDaffCustomerOrderMagentoExtraOrderFragments,\n provideDaffCustomerOrderMagentoExtraOrderTransforms,\n} from '@daffodil/customer-order/driver/magento/2.4.6';\nimport { provideDaffCustomerStoreCreditDriver } from '@daffodil/customer-store-credit/driver';\n\nimport { DaffCustomerStoreCreditMagentoService } from './customer-store-credit.service';\nimport { magentoCustomerOrderStoreCreditTotalFragment } from './queries/public_api';\nimport { magentoCustomerOrderWithStoreCreditTransform } from './transforms/public_api';\n\n/**\n * Provides the Magento implementation of the `@daffodil/customer-store-credit/driver` interface.\n */\nexport const provideDaffCustomerStoreCreditMagentoDriver = (): EnvironmentProviders => makeEnvironmentProviders([\n provideDaffCustomerStoreCreditDriver(DaffCustomerStoreCreditMagentoService),\n provideDaffCustomerOrderMagentoExtraOrderFragments(\n magentoCustomerOrderStoreCreditTotalFragment,\n ),\n provideDaffCustomerOrderMagentoExtraOrderTransforms(\n magentoCustomerOrderWithStoreCreditTransform,\n ),\n]);\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { provideDaffCustomerStoreCreditMagentoDriver } from './provider';\n\n/**\n * @deprecated in favor of {@link provideDaffCustomerStoreCreditMagentoDriver} Deprecated in version 0.95.0. Will be removed in version 0.98.0.\n */\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffCustomerStoreCreditMagentoDriverModule {\n static forRoot(): ModuleWithProviders<DaffCustomerStoreCreditMagentoDriverModule> {\n return {\n ngModule: DaffCustomerStoreCreditMagentoDriverModule,\n providers: [\n provideDaffCustomerStoreCreditMagentoDriver(),\n ],\n };\n }\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { isDevMode } from "@angular/core";
|
|
2
|
+
import { daffAutoDriverErrorMessage } from "@daffodil/driver";
|
|
3
|
+
const MESSAGE = daffAutoDriverErrorMessage("customer-store-credit");
|
|
4
|
+
if (isDevMode()) throw new Error(MESSAGE);
|
|
5
|
+
else console.error(MESSAGE);
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=daffodil-customer-store-credit-driver-magento-auto-testing.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daffodil-customer-store-credit-driver-magento-auto-testing.mjs","names":[],"sources":["../../../libs/customer-store-credit/driver/magento/auto/testing/src/index.ts"],"sourcesContent":["import { isDevMode } from '@angular/core';\n\nimport { daffAutoDriverErrorMessage } from '@daffodil/driver';\n\nconst MESSAGE = daffAutoDriverErrorMessage('customer-store-credit');\n\nif (isDevMode()) {\n throw new Error(MESSAGE);\n} else {\n console.error(MESSAGE);\n}\n\nexport {};\n"],"mappings":";;AAIA,MAAM,UAAU,2BAA2B,uBAAuB;AAElE,IAAI,UAAS,GACX,MAAM,IAAI,MAAM,OAAO;KAEvB,QAAQ,MAAM,OAAO"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { isDevMode } from "@angular/core";
|
|
2
|
+
import { daffAutoDriverErrorMessage } from "@daffodil/driver";
|
|
3
|
+
const MESSAGE = daffAutoDriverErrorMessage("customer-store-credit");
|
|
4
|
+
if (isDevMode()) throw new Error(MESSAGE);
|
|
5
|
+
else console.error(MESSAGE);
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=daffodil-customer-store-credit-driver-magento-auto.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daffodil-customer-store-credit-driver-magento-auto.mjs","names":[],"sources":["../../../libs/customer-store-credit/driver/magento/auto/src/index.ts"],"sourcesContent":["import { isDevMode } from '@angular/core';\n\nimport { daffAutoDriverErrorMessage } from '@daffodil/driver';\n\nconst MESSAGE = daffAutoDriverErrorMessage('customer-store-credit');\n\nif (isDevMode()) {\n throw new Error(MESSAGE);\n} else {\n console.error(MESSAGE);\n}\n\nexport {};\n"],"mappings":";;AAIA,MAAM,UAAU,2BAA2B,uBAAuB;AAElE,IAAI,UAAS,GACX,MAAM,IAAI,MAAM,OAAO;KAEvB,QAAQ,MAAM,OAAO"}
|