@spiffcommerce/core 27.2.1-beta.18d38888-19ca-5144-b378-0ea4ef812e79 → 27.2.1-beta.3bacc6ca-c8cc-5dca-a011-3b4b088687dc

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/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ import { RenderableContextService, RenderableContext, ThreeDPreviewService, Mode
5
5
  import * as lodash from 'lodash';
6
6
  import { CompleteQuoteMessage, ThemeInstallConfigurationGraphQl, ConversionConfiguration } from '@spiffcommerce/theme-bridge';
7
7
  export { ConversionConfiguration, ConversionData, ConversionDataType, ConversionLocation } from '@spiffcommerce/theme-bridge';
8
+ import { Currency } from 'dinero.js';
8
9
  import { FuseResult } from 'fuse.js';
9
10
  import { Font } from 'opentype.js';
10
11
 
@@ -2187,6 +2188,37 @@ declare class IntegrationProduct {
2187
2188
  getAllWorkflows(): ProductWorkflow$1[];
2188
2189
  }
2189
2190
 
2191
+ declare class CurrencyContext {
2192
+ private readonly presentmentCurrency?;
2193
+ private readonly partnerCurrency;
2194
+ private readonly rateFrom;
2195
+ private readonly rateTo;
2196
+ constructor(rateFrom: number, rateTo: number, partnerCurrency: Currency, presentmentCurrency?: Currency);
2197
+ /**
2198
+ * @returns The currency code for the currency being used for monetary display.
2199
+ */
2200
+ code(): Currency;
2201
+ /**
2202
+ * @returns true if the conversion is required, false otherwise.
2203
+ */
2204
+ conversionRequired(): boolean;
2205
+ /**
2206
+ * Converts a monetary value from a workflow in a partner specified currency
2207
+ * to the units of the currency being used for display.
2208
+ * @param amount The amount in minor units to convert.
2209
+ * @returns
2210
+ */
2211
+ getConvertedSubunits(amount: number): number;
2212
+ /**
2213
+ * Converts a monetary value from the database to the units of its currency.
2214
+ */
2215
+ private units;
2216
+ /**
2217
+ * Converts a monetary value in units to the subunits of its currency.
2218
+ */
2219
+ private subunits;
2220
+ }
2221
+
2190
2222
  declare const getWorkflows: (ids: string[], options?: GetWorkflowGraphqlOptions) => Promise<Workflow[]>;
2191
2223
  declare const getWorkflow: (id: string, options?: GetWorkflowGraphqlOptions) => Promise<Workflow>;
2192
2224
  /**
@@ -2298,7 +2330,6 @@ interface ClientConfiguration {
2298
2330
  */
2299
2331
  declare class SpiffCommerceClient {
2300
2332
  private options;
2301
- private currencyCode?;
2302
2333
  private customer?;
2303
2334
  private activeIntegration?;
2304
2335
  private marketplaceThemeInstallId?;
@@ -2313,8 +2344,8 @@ declare class SpiffCommerceClient {
2313
2344
  * and the Spiff Commerce platform.
2314
2345
  */
2315
2346
  getAssetManager(): AssetManager;
2316
- getCurrencyCode(): string;
2317
2347
  getFlowService(): FlowService;
2348
+ getCurrencyContext(presentmentCurrency: string): Promise<CurrencyContext>;
2318
2349
  getIntegration(): Promise<Integration>;
2319
2350
  canUseAddon(addonHandle: AddonHandle): Promise<boolean>;
2320
2351
  /**