@daffodil/customer-store-credit 0.93.1 → 0.94.1-rc.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.
|
@@ -9,7 +9,7 @@ import { Injectable, NgModule } from '@angular/core';
|
|
|
9
9
|
import { throwError } from 'rxjs';
|
|
10
10
|
import { map, catchError } from 'rxjs/operators';
|
|
11
11
|
import { CommonModule } from '@angular/common';
|
|
12
|
-
import { provideDaffCustomerOrderMagentoExtraOrderFragments, provideDaffCustomerOrderMagentoExtraOrderTransforms } from '@daffodil/customer-order/driver/magento/2
|
|
12
|
+
import { provideDaffCustomerOrderMagentoExtraOrderFragments, provideDaffCustomerOrderMagentoExtraOrderTransforms } from '@daffodil/customer-order/driver/magento/2.4.6';
|
|
13
13
|
|
|
14
14
|
const magentoCustomerStoreCreditTransform = (storeCredit) => ({
|
|
15
15
|
balance: storeCredit.current_balance.value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-customer-store-credit-driver-magento.mjs","sources":["../../../libs/customer-store-credit/driver/magento/src/transforms/responses/customer-store-credit.ts","../../../libs/customer-store-credit/driver/magento/src/transforms/responses/customer-order.ts","../../../libs/customer-store-credit/driver/magento/src/queries/fragments/store-credit.ts","../../../libs/customer-store-credit/driver/magento/src/queries/fragments/customer-order.ts","../../../libs/customer-store-credit/driver/magento/src/queries/get-store-credit.ts","../../../libs/customer-store-credit/driver/magento/src/errors/map.ts","../../../libs/customer-store-credit/driver/magento/src/errors/transform.ts","../../../libs/customer-store-credit/driver/magento/src/validators/get-customer-store-credit.ts","../../../libs/customer-store-credit/driver/magento/src/customer-store-credit.service.ts","../../../libs/customer-store-credit/driver/magento/src/driver.module.ts","../../../libs/customer-store-credit/driver/magento/src/daffodil-customer-store-credit-driver-magento.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';\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';\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';\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 { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\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@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffCustomerStoreCreditMagentoDriverModule {\n static forRoot(): ModuleWithProviders<DaffCustomerStoreCreditMagentoDriverModule> {\n return {\n ngModule: DaffCustomerStoreCreditMagentoDriverModule,\n providers: [\n provideDaffCustomerStoreCreditDriver(DaffCustomerStoreCreditMagentoService),\n provideDaffCustomerOrderMagentoExtraOrderFragments(\n magentoCustomerOrderStoreCreditTotalFragment,\n ),\n provideDaffCustomerOrderMagentoExtraOrderTransforms(\n magentoCustomerOrderWithStoreCreditTransform,\n ),\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;MAIa,mCAAmC,GAAG,CAAC,WAAuC,MAA+B;AACxH,IAAA,OAAO,EAAE,WAAW,CAAC,eAAe,CAAC,KAAK;AAC3C,CAAA;;ACAM,MAAM,4CAA4C,GAAgF,CAAC,SAAoB,EAAE,YAAiD,EAAE,KAAa,MAAiB;AAC/O,IAAA,GAAG,SAAS;AACZ,IAAA,MAAM,EAAE;QACN,GAAG,SAAS,CAAC,MAAM;AACnB,QAAA;AACE,YAAA,IAAI,EAAE,2CAA2C;AACjD,YAAA,KAAK,EAAE,cAAc;AACrB,YAAA,KAAK,EAAE,YAAY,CAAC,KAAK,EAAE,kBAAkB,CAAC,KAAK;;AAEnD,YAAA,UAAU,EAAE,EAAE;AACf,SAAA;AACF,KAAA,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC;AAC9C,CAAA;;ACdM,MAAM,kCAAkC,GAAG,GAAG,CAAA;;;;;;;IAOjD,oBAAoB;;;ACPjB,MAAM,4CAA4C,GAAG,GAAG,CAAA;;;;;;;;IAQ3D,oBAAoB;;;ACRjB,MAAM,4CAA4C,GAAG;AAErD,MAAM,sBAAsB,GAAG,GAAG,CAAA;UAC/B,4CAA4C,CAAA;;;;;;;IAOlD,kCAAkC;;;ACd/B,MAAM,kDAAkD,GAAG,EACjE;;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A,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,0CAA0C,YAHnD,YAAY,CAAA,EAAA,CAAA,CAAA;AAGH,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,0CAA0C,YAHnD,YAAY,CAAA,EAAA,CAAA,CAAA;;2FAGH,0CAA0C,EAAA,UAAA,EAAA,CAAA;kBALtD,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;AACF,iBAAA;;;ACpBD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"daffodil-customer-store-credit-driver-magento.mjs","sources":["../../../libs/customer-store-credit/driver/magento/src/transforms/responses/customer-store-credit.ts","../../../libs/customer-store-credit/driver/magento/src/transforms/responses/customer-order.ts","../../../libs/customer-store-credit/driver/magento/src/queries/fragments/store-credit.ts","../../../libs/customer-store-credit/driver/magento/src/queries/fragments/customer-order.ts","../../../libs/customer-store-credit/driver/magento/src/queries/get-store-credit.ts","../../../libs/customer-store-credit/driver/magento/src/errors/map.ts","../../../libs/customer-store-credit/driver/magento/src/errors/transform.ts","../../../libs/customer-store-credit/driver/magento/src/validators/get-customer-store-credit.ts","../../../libs/customer-store-credit/driver/magento/src/customer-store-credit.service.ts","../../../libs/customer-store-credit/driver/magento/src/driver.module.ts","../../../libs/customer-store-credit/driver/magento/src/daffodil-customer-store-credit-driver-magento.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';\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';\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';\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 { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\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@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffCustomerStoreCreditMagentoDriverModule {\n static forRoot(): ModuleWithProviders<DaffCustomerStoreCreditMagentoDriverModule> {\n return {\n ngModule: DaffCustomerStoreCreditMagentoDriverModule,\n providers: [\n provideDaffCustomerStoreCreditDriver(DaffCustomerStoreCreditMagentoService),\n provideDaffCustomerOrderMagentoExtraOrderFragments(\n magentoCustomerOrderStoreCreditTotalFragment,\n ),\n provideDaffCustomerOrderMagentoExtraOrderTransforms(\n magentoCustomerOrderWithStoreCreditTransform,\n ),\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;MAIa,mCAAmC,GAAG,CAAC,WAAuC,MAA+B;AACxH,IAAA,OAAO,EAAE,WAAW,CAAC,eAAe,CAAC,KAAK;AAC3C,CAAA;;ACAM,MAAM,4CAA4C,GAAgF,CAAC,SAAoB,EAAE,YAAiD,EAAE,KAAa,MAAiB;AAC/O,IAAA,GAAG,SAAS;AACZ,IAAA,MAAM,EAAE;QACN,GAAG,SAAS,CAAC,MAAM;AACnB,QAAA;AACE,YAAA,IAAI,EAAE,2CAA2C;AACjD,YAAA,KAAK,EAAE,cAAc;AACrB,YAAA,KAAK,EAAE,YAAY,CAAC,KAAK,EAAE,kBAAkB,CAAC,KAAK;;AAEnD,YAAA,UAAU,EAAE,EAAE;AACf,SAAA;AACF,KAAA,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC;AAC9C,CAAA;;ACdM,MAAM,kCAAkC,GAAG,GAAG,CAAA;;;;;;;IAOjD,oBAAoB;;;ACPjB,MAAM,4CAA4C,GAAG,GAAG,CAAA;;;;;;;;IAQ3D,oBAAoB;;;ACRjB,MAAM,4CAA4C,GAAG;AAErD,MAAM,sBAAsB,GAAG,GAAG,CAAA;UAC/B,4CAA4C,CAAA;;;;;;;IAOlD,kCAAkC;;;ACd/B,MAAM,kDAAkD,GAAG,EACjE;;ACWD;;;;AAIG;AACG,SAAU,gCAAgC,CAAC,KAA4B,EAAE,cAAwB,EAAA;;AAErG,IAAA,KAAK,MAAM,IAAI,IAAI,kDAAkD,EAAE;AACrE,QA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,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,0CAA0C,YAHnD,YAAY,CAAA,EAAA,CAAA,CAAA;;2FAGH,0CAA0C,EAAA,UAAA,EAAA,CAAA;kBALtD,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;AACF,iBAAA;;;ACpBD;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@daffodil/customer-store-credit","nx":{"targets":{"build":{"outputs":["{workspaceRoot}/dist/customer-store-credit"]}}},"version":"0.
|
|
1
|
+
{"name":"@daffodil/customer-store-credit","nx":{"targets":{"build":{"outputs":["{workspaceRoot}/dist/customer-store-credit"]}}},"version":"0.94.1-rc.0","description":"Platform-agnostic models, state management, and drivers for customer store credit balances. Part of the Daffodil ecommerce framework.","repository":{"type":"git","url":"https://github.com/graycoreio/daffodil"},"author":"Graycore LLC","license":"MIT","bugs":{"url":"https://github.com/graycoreio/daffodil/issues"},"homepage":"https://github.com/graycoreio/daffodil","peerDependencies":{"@angular/common":"^21","@angular/core":"^21","@daffodil/customer":"0.94.1-rc.0","@daffodil/customer-order":"0.94.1-rc.0","@daffodil/core":"0.94.1-rc.0","@ngrx/effects":"^21","@ngrx/store":"^21","rxjs":"^7.0.0"},"optionalDependencies":{"@apollo/client":"^4.0.13","@daffodil/driver":"0.94.1-rc.0","apollo-angular":"^13.0.0","@faker-js/faker":"^10.3.0"},"module":"fesm2022/daffodil-customer-store-credit.mjs","typings":"types/daffodil-customer-store-credit.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./types/daffodil-customer-store-credit.d.ts","default":"./fesm2022/daffodil-customer-store-credit.mjs"},"./driver":{"types":"./types/daffodil-customer-store-credit-driver.d.ts","default":"./fesm2022/daffodil-customer-store-credit-driver.mjs"},"./driver/in-memory":{"types":"./types/daffodil-customer-store-credit-driver-in-memory.d.ts","default":"./fesm2022/daffodil-customer-store-credit-driver-in-memory.mjs"},"./driver/magento":{"types":"./types/daffodil-customer-store-credit-driver-magento.d.ts","default":"./fesm2022/daffodil-customer-store-credit-driver-magento.mjs"},"./driver/magento/testing":{"types":"./types/daffodil-customer-store-credit-driver-magento-testing.d.ts","default":"./fesm2022/daffodil-customer-store-credit-driver-magento-testing.mjs"},"./driver/testing":{"types":"./types/daffodil-customer-store-credit-driver-testing.d.ts","default":"./fesm2022/daffodil-customer-store-credit-driver-testing.mjs"},"./routing":{"types":"./types/daffodil-customer-store-credit-routing.d.ts","default":"./fesm2022/daffodil-customer-store-credit-routing.mjs"},"./state":{"types":"./types/daffodil-customer-store-credit-state.d.ts","default":"./fesm2022/daffodil-customer-store-credit-state.mjs"},"./state/testing":{"types":"./types/daffodil-customer-store-credit-state-testing.d.ts","default":"./fesm2022/daffodil-customer-store-credit-state-testing.mjs"},"./testing":{"types":"./types/daffodil-customer-store-credit-testing.d.ts","default":"./fesm2022/daffodil-customer-store-credit-testing.mjs"}},"sideEffects":false,"type":"module","dependencies":{"tslib":"^2.6.2"}}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DaffCustomerStoreCredit } from '@daffodil/customer-store-credit';
|
|
2
2
|
import { MagentoMoney } from '@daffodil/driver/magento';
|
|
3
|
-
import { MagentoCustomerOrder, DaffMagentoCustomerOrderExtraTransform } from '@daffodil/customer-order/driver/magento/2
|
|
3
|
+
import { MagentoCustomerOrder, DaffMagentoCustomerOrderExtraTransform } from '@daffodil/customer-order/driver/magento/2.4.6';
|
|
4
4
|
import * as apollo_angular from 'apollo-angular';
|
|
5
5
|
import { Apollo } from 'apollo-angular';
|
|
6
6
|
import { DaffError } from '@daffodil/core';
|